From 865fd1f6db91c2019ed92e3c36110c34a2281bee Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Sat, 13 May 2023 12:16:26 +0200 Subject: [PATCH] "update dependencies and changelog" --- CHANGELOG.md | 4 ++-- dist/restore/index.js | 56 +++++++++++++++++++++++++++++++++++++++---- dist/save/index.js | 56 +++++++++++++++++++++++++++++++++++++++---- package-lock.json | 48 ++++++++++++++++++------------------- 4 files changed, 130 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb6511..0f7ed04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Changelog -## 2.2.2 +## 2.3.0 -- Add `cache-all-crates` option, which is enables caching of creates installed by workflows. +- Add `cache-all-crates` option, which enables caching of crates installed by workflows. - Add installed packages to cache key, so changes to workflows that install rust tools are detected and cached properly. - Fix cache restore failures due to upstream bug. - Fix `EISDIR` error due to globed directories. diff --git a/dist/restore/index.js b/dist/restore/index.js index 2337e53..01116cd 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -14634,16 +14634,45 @@ function setStateError(inputs) { throw error; }; } +function appendReadableErrorMessage(currentMessage, innerMessage) { + let message = currentMessage; + if (message.slice(-1) !== ".") { + message = message + "."; + } + return message + " " + innerMessage; +} +function simplifyError(err) { + let message = err.message; + let code = err.code; + let curErr = err; + while (curErr.innererror) { + curErr = curErr.innererror; + code = curErr.code; + message = appendReadableErrorMessage(message, curErr.message); + } + return { + code, + message, + }; +} function processOperationStatus(result) { - const { state, stateProxy, status, isDone, processResult, response, setErrorAsResult } = result; + const { state, stateProxy, status, isDone, processResult, getError, response, setErrorAsResult } = result; switch (status) { case "succeeded": { stateProxy.setSucceeded(state); break; } case "failed": { - stateProxy.setError(state, new Error(`The long-running operation has failed`)); + const err = getError === null || getError === void 0 ? void 0 : getError(response); + let postfix = ""; + if (err) { + const { code, message } = simplifyError(err); + postfix = `. ${code}. ${message}`; + } + const errStr = `The long-running operation has failed${postfix}`; + stateProxy.setError(state, new Error(errStr)); stateProxy.setFailed(state); + logger.warning(errStr); break; } case "canceled": { @@ -14706,7 +14735,7 @@ async function pollOperationHelper(inputs) { } /** Polls the long-running operation. */ async function pollOperation(inputs) { - const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, isOperationError, withOperationLocation, getPollingInterval, processResult, updateState, setDelay, isDone, setErrorAsResult, } = inputs; + const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, isOperationError, withOperationLocation, getPollingInterval, processResult, getError, updateState, setDelay, isDone, setErrorAsResult, } = inputs; const { operationLocation } = state.config; if (operationLocation !== undefined) { const { response, status } = await pollOperationHelper({ @@ -14726,6 +14755,7 @@ async function pollOperation(inputs) { stateProxy, isDone, processResult, + getError, setErrorAsResult, }); if (!terminalStates.includes(status)) { @@ -14879,6 +14909,18 @@ function parseRetryAfter({ rawResponse }) { } return undefined; } +function getErrorFromResponse(response) { + const error = response.flatResponse.error; + if (!error) { + logger.warning(`The long-running operation failed but there is no error property in the response's body`); + return; + } + if (!error.code || !error.message) { + logger.warning(`The long-running operation failed but the error property in the response's body doesn't contain code or message`); + return; + } + return error; +} function calculatePollingIntervalFromDate(retryAfterDate) { const timeNow = Math.floor(new Date().getTime()); const retryAfterTime = retryAfterDate.getTime(); @@ -14986,6 +15028,7 @@ async function pollHttpOperation(inputs) { processResult: processResult ? ({ flatResponse }, inputState) => processResult(flatResponse, inputState) : ({ flatResponse }) => flatResponse, + getError: getErrorFromResponse, updateState, getPollingInterval: parseRetryAfter, getOperationLocation, @@ -15027,7 +15070,7 @@ const createStateProxy$1 = () => ({ * Returns a poller factory. */ function buildCreatePoller(inputs) { - const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, isOperationError, getResourceLocation, getPollingInterval, resolveOnUnsuccessful, } = inputs; + const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, isOperationError, getResourceLocation, getPollingInterval, getError, resolveOnUnsuccessful, } = inputs; return async ({ init, poll }, options) => { const { processResult, updateState, withOperationLocation: withOperationLocationCallback, intervalInMs = POLL_INTERVAL_IN_MS, restoreFrom, } = options || {}; const stateProxy = createStateProxy$1(); @@ -15132,6 +15175,7 @@ function buildCreatePoller(inputs) { getOperationStatus: getStatusFromPollResponse, getResourceLocation, processResult, + getError, updateState, options: pollOptions, setDelay: (pollIntervalInMs) => { @@ -15170,6 +15214,7 @@ async function createHttpPoller(lro, options) { getOperationLocation, getResourceLocation, getPollingInterval: parseRetryAfter, + getError: getErrorFromResponse, resolveOnUnsuccessful, })({ init: async () => { @@ -16255,6 +16300,9 @@ function objectHasProperty(thing, property) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +/* + * NOTE: When moving this file, please update "react-native" section in package.json. + */ /** * Generated Universally Unique Identifier * diff --git a/dist/save/index.js b/dist/save/index.js index 7ab9fde..1fc5d86 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -14634,16 +14634,45 @@ function setStateError(inputs) { throw error; }; } +function appendReadableErrorMessage(currentMessage, innerMessage) { + let message = currentMessage; + if (message.slice(-1) !== ".") { + message = message + "."; + } + return message + " " + innerMessage; +} +function simplifyError(err) { + let message = err.message; + let code = err.code; + let curErr = err; + while (curErr.innererror) { + curErr = curErr.innererror; + code = curErr.code; + message = appendReadableErrorMessage(message, curErr.message); + } + return { + code, + message, + }; +} function processOperationStatus(result) { - const { state, stateProxy, status, isDone, processResult, response, setErrorAsResult } = result; + const { state, stateProxy, status, isDone, processResult, getError, response, setErrorAsResult } = result; switch (status) { case "succeeded": { stateProxy.setSucceeded(state); break; } case "failed": { - stateProxy.setError(state, new Error(`The long-running operation has failed`)); + const err = getError === null || getError === void 0 ? void 0 : getError(response); + let postfix = ""; + if (err) { + const { code, message } = simplifyError(err); + postfix = `. ${code}. ${message}`; + } + const errStr = `The long-running operation has failed${postfix}`; + stateProxy.setError(state, new Error(errStr)); stateProxy.setFailed(state); + logger.warning(errStr); break; } case "canceled": { @@ -14706,7 +14735,7 @@ async function pollOperationHelper(inputs) { } /** Polls the long-running operation. */ async function pollOperation(inputs) { - const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, isOperationError, withOperationLocation, getPollingInterval, processResult, updateState, setDelay, isDone, setErrorAsResult, } = inputs; + const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, isOperationError, withOperationLocation, getPollingInterval, processResult, getError, updateState, setDelay, isDone, setErrorAsResult, } = inputs; const { operationLocation } = state.config; if (operationLocation !== undefined) { const { response, status } = await pollOperationHelper({ @@ -14726,6 +14755,7 @@ async function pollOperation(inputs) { stateProxy, isDone, processResult, + getError, setErrorAsResult, }); if (!terminalStates.includes(status)) { @@ -14879,6 +14909,18 @@ function parseRetryAfter({ rawResponse }) { } return undefined; } +function getErrorFromResponse(response) { + const error = response.flatResponse.error; + if (!error) { + logger.warning(`The long-running operation failed but there is no error property in the response's body`); + return; + } + if (!error.code || !error.message) { + logger.warning(`The long-running operation failed but the error property in the response's body doesn't contain code or message`); + return; + } + return error; +} function calculatePollingIntervalFromDate(retryAfterDate) { const timeNow = Math.floor(new Date().getTime()); const retryAfterTime = retryAfterDate.getTime(); @@ -14986,6 +15028,7 @@ async function pollHttpOperation(inputs) { processResult: processResult ? ({ flatResponse }, inputState) => processResult(flatResponse, inputState) : ({ flatResponse }) => flatResponse, + getError: getErrorFromResponse, updateState, getPollingInterval: parseRetryAfter, getOperationLocation, @@ -15027,7 +15070,7 @@ const createStateProxy$1 = () => ({ * Returns a poller factory. */ function buildCreatePoller(inputs) { - const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, isOperationError, getResourceLocation, getPollingInterval, resolveOnUnsuccessful, } = inputs; + const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, isOperationError, getResourceLocation, getPollingInterval, getError, resolveOnUnsuccessful, } = inputs; return async ({ init, poll }, options) => { const { processResult, updateState, withOperationLocation: withOperationLocationCallback, intervalInMs = POLL_INTERVAL_IN_MS, restoreFrom, } = options || {}; const stateProxy = createStateProxy$1(); @@ -15132,6 +15175,7 @@ function buildCreatePoller(inputs) { getOperationStatus: getStatusFromPollResponse, getResourceLocation, processResult, + getError, updateState, options: pollOptions, setDelay: (pollIntervalInMs) => { @@ -15170,6 +15214,7 @@ async function createHttpPoller(lro, options) { getOperationLocation, getResourceLocation, getPollingInterval: parseRetryAfter, + getError: getErrorFromResponse, resolveOnUnsuccessful, })({ init: async () => { @@ -16255,6 +16300,9 @@ function objectHasProperty(thing, property) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +/* + * NOTE: When moving this file, please update "react-native" section in package.json. + */ /** * Generated Universally Unique Identifier * diff --git a/package-lock.json b/package-lock.json index df2d315..c69c024 100644 --- a/package-lock.json +++ b/package-lock.json @@ -166,9 +166,9 @@ } }, "node_modules/@azure/core-lro": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.5.2.tgz", - "integrity": "sha512-tucUutPhBwCPu6v16KEFYML81npEL6gnT+iwewXvK5ZD55sr0/Vw2jfQETMiKVeARRrXHB2QQ3SpxxGi1zAUWg==", + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.5.3.tgz", + "integrity": "sha512-ubkOf2YCnVtq7KqEJQqAI8dDD5rH1M6OP5kW0KO/JQyTaxLA0N0pjFWvvaysCj9eHMNBcuuoZXhhl0ypjod2DA==", "dependencies": { "@azure/abort-controller": "^1.0.0", "@azure/core-util": "^1.2.0", @@ -203,9 +203,9 @@ } }, "node_modules/@azure/core-util": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.3.1.tgz", - "integrity": "sha512-pjfOUAb+MPLODhGuXot/Hy8wUgPD0UTqYkY3BiYcwEETrLcUCVM1t0roIvlQMgvn1lc48TGy5bsonsFpF862Jw==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.3.2.tgz", + "integrity": "sha512-2bECOUh88RvL1pMZTcc6OzfobBeWDBf5oBbhjIhT1MV9otMVWCzpOJkkiKtrnO88y5GGBelgY8At73KGAdbkeQ==", "dependencies": { "@azure/abort-controller": "^1.0.0", "tslib": "^2.2.0" @@ -281,9 +281,9 @@ } }, "node_modules/@types/node": { - "version": "18.16.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", - "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==" + "version": "20.1.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.3.tgz", + "integrity": "sha512-NP2yfZpgmf2eDRPmgGq+fjGjSwFgYbihA8/gK+ey23qT9RkxsgNTZvGOEpXgzIGqesTYkElELLgtKoMQTys5vA==" }, "node_modules/@types/node-fetch": { "version": "2.6.3", @@ -455,9 +455,9 @@ } }, "node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -726,9 +726,9 @@ } }, "@azure/core-lro": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.5.2.tgz", - "integrity": "sha512-tucUutPhBwCPu6v16KEFYML81npEL6gnT+iwewXvK5ZD55sr0/Vw2jfQETMiKVeARRrXHB2QQ3SpxxGi1zAUWg==", + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.5.3.tgz", + "integrity": "sha512-ubkOf2YCnVtq7KqEJQqAI8dDD5rH1M6OP5kW0KO/JQyTaxLA0N0pjFWvvaysCj9eHMNBcuuoZXhhl0ypjod2DA==", "requires": { "@azure/abort-controller": "^1.0.0", "@azure/core-util": "^1.2.0", @@ -754,9 +754,9 @@ } }, "@azure/core-util": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.3.1.tgz", - "integrity": "sha512-pjfOUAb+MPLODhGuXot/Hy8wUgPD0UTqYkY3BiYcwEETrLcUCVM1t0roIvlQMgvn1lc48TGy5bsonsFpF862Jw==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.3.2.tgz", + "integrity": "sha512-2bECOUh88RvL1pMZTcc6OzfobBeWDBf5oBbhjIhT1MV9otMVWCzpOJkkiKtrnO88y5GGBelgY8At73KGAdbkeQ==", "requires": { "@azure/abort-controller": "^1.0.0", "tslib": "^2.2.0" @@ -819,9 +819,9 @@ "integrity": "sha512-O2yRJce1GOc6PAy3QxFM4NzFiWzvScDC1/5ihYBL6BUEVdq0XMWN01sppE+H6bBXbaFYipjwFLEWLg5PaSOThA==" }, "@types/node": { - "version": "18.16.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", - "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==" + "version": "20.1.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.3.tgz", + "integrity": "sha512-NP2yfZpgmf2eDRPmgGq+fjGjSwFgYbihA8/gK+ey23qT9RkxsgNTZvGOEpXgzIGqesTYkElELLgtKoMQTys5vA==" }, "@types/node-fetch": { "version": "2.6.3", @@ -956,9 +956,9 @@ } }, "node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", "requires": { "whatwg-url": "^5.0.0" }