Skip to content

Commit 587972c

Browse files
authored
Merge pull request whywaita#10 from whywaita/fix/no-content
Fix missing error handle
2 parents e4ae4c2 + 178a582 commit 587972c

4 files changed

Lines changed: 155 additions & 176 deletions

File tree

dist/restore/index.js

Lines changed: 69 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -8164,6 +8164,9 @@ function getCacheEntryS3(s3Options, s3BucketName, keys, paths) {
81648164
throw new Error(`Error from S3: ${e}`);
81658165
}
81668166
if (!response.Contents) {
8167+
if (contents.length != 0) {
8168+
break;
8169+
}
81678170
throw new Error(`Cannot found object in bucket ${s3BucketName}`);
81688171
}
81698172
core.debug(`Found objects ${response.Contents.length}`);
@@ -30281,7 +30284,7 @@ exports.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
3028130284
"use strict";
3028230285

3028330286
Object.defineProperty(exports, "__esModule", { value: true });
30284-
exports.convertMap = exports.map = void 0;
30287+
exports.take = exports.convertMap = exports.map = void 0;
3028530288
function map(arg0, arg1, arg2) {
3028630289
let target;
3028730290
let filter;
@@ -30306,25 +30309,7 @@ function map(arg0, arg1, arg2) {
3030630309
target[key] = instructions[key];
3030730310
continue;
3030830311
}
30309-
let [filter, value] = instructions[key];
30310-
if (typeof value === "function") {
30311-
let _value;
30312-
const defaultFilterPassed = filter === undefined && (_value = value()) != null;
30313-
const customFilterPassed = (typeof filter === "function" && !!filter(void 0)) || (typeof filter !== "function" && !!filter);
30314-
if (defaultFilterPassed) {
30315-
target[key] = _value;
30316-
}
30317-
else if (customFilterPassed) {
30318-
target[key] = value();
30319-
}
30320-
}
30321-
else {
30322-
const defaultFilterPassed = filter === undefined && value != null;
30323-
const customFilterPassed = (typeof filter === "function" && !!filter(value)) || (typeof filter !== "function" && !!filter);
30324-
if (defaultFilterPassed || customFilterPassed) {
30325-
target[key] = value;
30326-
}
30327-
}
30312+
applyInstruction(target, null, instructions, key);
3032830313
}
3032930314
return target;
3033030315
}
@@ -30337,6 +30322,14 @@ const convertMap = (target) => {
3033730322
return output;
3033830323
};
3033930324
exports.convertMap = convertMap;
30325+
const take = (source, instructions) => {
30326+
const out = {};
30327+
for (const key in instructions) {
30328+
applyInstruction(out, source, instructions, key);
30329+
}
30330+
return out;
30331+
};
30332+
exports.take = take;
3034030333
const mapWithFilter = (target, filter, instructions) => {
3034130334
return map(target, Object.entries(instructions).reduce((_instructions, [key, value]) => {
3034230335
if (Array.isArray(value)) {
@@ -30353,6 +30346,40 @@ const mapWithFilter = (target, filter, instructions) => {
3035330346
return _instructions;
3035430347
}, {}));
3035530348
};
30349+
const applyInstruction = (target, source, instructions, targetKey) => {
30350+
if (source !== null) {
30351+
let instruction = instructions[targetKey];
30352+
if (typeof instruction === "function") {
30353+
instruction = [, instruction];
30354+
}
30355+
const [filter = nonNullish, valueFn = pass, sourceKey = targetKey] = instruction;
30356+
if ((typeof filter === "function" && filter(source[sourceKey])) || (typeof filter !== "function" && !!filter)) {
30357+
target[targetKey] = valueFn(source[sourceKey]);
30358+
}
30359+
return;
30360+
}
30361+
let [filter, value] = instructions[targetKey];
30362+
if (typeof value === "function") {
30363+
let _value;
30364+
const defaultFilterPassed = filter === undefined && (_value = value()) != null;
30365+
const customFilterPassed = (typeof filter === "function" && !!filter(void 0)) || (typeof filter !== "function" && !!filter);
30366+
if (defaultFilterPassed) {
30367+
target[targetKey] = _value;
30368+
}
30369+
else if (customFilterPassed) {
30370+
target[targetKey] = value();
30371+
}
30372+
}
30373+
else {
30374+
const defaultFilterPassed = filter === undefined && value != null;
30375+
const customFilterPassed = (typeof filter === "function" && !!filter(value)) || (typeof filter !== "function" && !!filter);
30376+
if (defaultFilterPassed || customFilterPassed) {
30377+
target[targetKey] = value;
30378+
}
30379+
}
30380+
};
30381+
const nonNullish = (_) => _ != null;
30382+
const pass = (_) => _;
3035630383

3035730384

3035830385
/***/ }),
@@ -94081,11 +94108,11 @@ var crypto = __webpack_require__(417);
9408194108

9408294109
// Copyright (c) Microsoft Corporation.
9408394110
// Licensed under the MIT license.
94084-
var _a;
94111+
var _a$1;
9408594112
/**
9408694113
* A constant that indicates whether the environment the code is running is Node.JS.
9408794114
*/
94088-
const isNode = typeof process !== "undefined" && Boolean(process.version) && Boolean((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
94115+
const isNode = typeof process !== "undefined" && Boolean(process.version) && Boolean((_a$1 = process.versions) === null || _a$1 === void 0 ? void 0 : _a$1.node);
9408994116

9409094117
// Copyright (c) Microsoft Corporation.
9409194118
/**
@@ -94276,6 +94303,22 @@ function objectHasProperty(thing, property) {
9427694303
return (isDefined(thing) && typeof thing === "object" && property in thing);
9427794304
}
9427894305

94306+
// Copyright (c) Microsoft Corporation.
94307+
// Licensed under the MIT license.
94308+
var _a;
94309+
// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+.
94310+
const uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function"
94311+
? globalThis.crypto.randomUUID.bind(globalThis.crypto)
94312+
: crypto.randomUUID;
94313+
/**
94314+
* Generated Universally Unique Identifier
94315+
*
94316+
* @returns RFC4122 v4 UUID.
94317+
*/
94318+
function randomUUID() {
94319+
return uuidFunction();
94320+
}
94321+
9427994322
exports.computeSha256Hash = computeSha256Hash;
9428094323
exports.computeSha256Hmac = computeSha256Hmac;
9428194324
exports.createAbortablePromise = createAbortablePromise;
@@ -94288,6 +94331,7 @@ exports.isNode = isNode;
9428894331
exports.isObject = isObject;
9428994332
exports.isObjectWithProperties = isObjectWithProperties;
9429094333
exports.objectHasProperty = objectHasProperty;
94334+
exports.randomUUID = randomUUID;
9429194335
//# sourceMappingURL=index.js.map
9429294336

9429394337

@@ -98040,6 +98084,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
9804098084

9804198085
var logger$1 = __webpack_require__(492);
9804298086
var abortController = __webpack_require__(819);
98087+
var coreUtil = __webpack_require__(900);
9804398088

9804498089
// Copyright (c) Microsoft Corporation.
9804598090
/**
@@ -98288,7 +98333,7 @@ function transformStatus(inputs) {
9828898333
case "cancelled":
9828998334
return "canceled";
9829098335
default: {
98291-
logger.warning(`LRO: unrecognized operation status: ${status}`);
98336+
logger.verbose(`LRO: unrecognized operation status: ${status}`);
9829298337
return status;
9829398338
}
9829498339
}
@@ -98449,58 +98494,6 @@ async function pollHttpOperation(inputs) {
9844998494
});
9845098495
}
9845198496

98452-
// Copyright (c) Microsoft Corporation.
98453-
// Licensed under the MIT license.
98454-
/**
98455-
* Map an optional value through a function
98456-
* @internal
98457-
*/
98458-
const maybemap = (value, f) => value === undefined ? undefined : f(value);
98459-
const INTERRUPTED = new Error("The poller is already stopped");
98460-
/**
98461-
* A promise that delays resolution until a certain amount of time (in milliseconds) has passed, with facilities for
98462-
* robust cancellation.
98463-
*
98464-
* ### Example:
98465-
*
98466-
* ```javascript
98467-
* let toCancel;
98468-
*
98469-
* // Wait 20 seconds, and optionally allow the function to be cancelled.
98470-
* await delayMs(20000, (cancel) => { toCancel = cancel });
98471-
*
98472-
* // ... if `toCancel` is called before the 20 second timer expires, then the delayMs promise will reject.
98473-
* ```
98474-
*
98475-
* @internal
98476-
* @param ms - the number of milliseconds to wait before resolving
98477-
* @param cb - a callback that can provide the caller with a cancellation function
98478-
*/
98479-
function delayMs(ms) {
98480-
let aborted = false;
98481-
let toReject;
98482-
return Object.assign(new Promise((resolve, reject) => {
98483-
let token;
98484-
toReject = () => {
98485-
maybemap(token, clearTimeout);
98486-
reject(INTERRUPTED);
98487-
};
98488-
// In the rare case that the operation is _already_ aborted, we will reject instantly. This could happen, for
98489-
// example, if the user calls the cancellation function immediately without yielding execution.
98490-
if (aborted) {
98491-
toReject();
98492-
}
98493-
else {
98494-
token = setTimeout(resolve, ms);
98495-
}
98496-
}), {
98497-
cancel: () => {
98498-
aborted = true;
98499-
toReject === null || toReject === void 0 ? void 0 : toReject();
98500-
},
98501-
});
98502-
}
98503-
9850498497
// Copyright (c) Microsoft Corporation.
9850598498
const createStateProxy$1 = () => ({
9850698499
/**
@@ -98553,7 +98546,6 @@ function buildCreatePoller(inputs) {
9855398546
setErrorAsResult: !resolveOnUnsuccessful,
9855498547
});
9855598548
let resultPromise;
98556-
let cancelJob;
9855798549
const abortController$1 = new abortController.AbortController();
9855898550
const handlers = new Map();
9855998551
const handleProgressEvents = async () => handlers.forEach((h) => h(state));
@@ -98566,7 +98558,6 @@ function buildCreatePoller(inputs) {
9856698558
isStopped: () => resultPromise === undefined,
9856798559
stopPolling: () => {
9856898560
abortController$1.abort();
98569-
cancelJob === null || cancelJob === void 0 ? void 0 : cancelJob();
9857098561
},
9857198562
toString: () => JSON.stringify({
9857298563
state,
@@ -98584,9 +98575,7 @@ function buildCreatePoller(inputs) {
9858498575
if (!poller.isDone()) {
9858598576
await poller.poll({ abortSignal });
9858698577
while (!poller.isDone()) {
98587-
const delay = delayMs(currentPollIntervalInMs);
98588-
cancelJob = delay.cancel;
98589-
await delay;
98578+
await coreUtil.delay(currentPollIntervalInMs, { abortSignal });
9859098579
await poller.poll({ abortSignal });
9859198580
}
9859298581
}

0 commit comments

Comments
 (0)