mirror of https://github.com/actions/cache
Use merge commit
This commit is contained in:
parent
6b28eff8f0
commit
d0b2dc463d
|
|
@ -2471,7 +2471,7 @@ class MemoryCookieStore extends Store {
|
|||
const results = [];
|
||||
if (typeof allowSpecialUseDomain === "function") {
|
||||
cb = allowSpecialUseDomain;
|
||||
allowSpecialUseDomain = false;
|
||||
allowSpecialUseDomain = true;
|
||||
}
|
||||
if (!domain) {
|
||||
return cb(null, []);
|
||||
|
|
@ -25471,7 +25471,7 @@ exports.CredentialsProviderError = CredentialsProviderError;
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.strictParseByte = exports.strictParseShort = exports.strictParseInt32 = exports.strictParseInt = exports.strictParseLong = exports.limitedParseFloat32 = exports.limitedParseFloat = exports.handleFloat = exports.limitedParseDouble = exports.strictParseFloat32 = exports.strictParseFloat = exports.strictParseDouble = exports.expectUnion = exports.expectString = exports.expectObject = exports.expectNonNull = exports.expectByte = exports.expectShort = exports.expectInt32 = exports.expectInt = exports.expectLong = exports.expectFloat32 = exports.expectNumber = exports.expectBoolean = exports.parseBoolean = void 0;
|
||||
exports.logger = exports.strictParseByte = exports.strictParseShort = exports.strictParseInt32 = exports.strictParseInt = exports.strictParseLong = exports.limitedParseFloat32 = exports.limitedParseFloat = exports.handleFloat = exports.limitedParseDouble = exports.strictParseFloat32 = exports.strictParseFloat = exports.strictParseDouble = exports.expectUnion = exports.expectString = exports.expectObject = exports.expectNonNull = exports.expectByte = exports.expectShort = exports.expectInt32 = exports.expectInt = exports.expectLong = exports.expectFloat32 = exports.expectNumber = exports.expectBoolean = exports.parseBoolean = void 0;
|
||||
const parseBoolean = (value) => {
|
||||
switch (value) {
|
||||
case "true":
|
||||
|
|
@ -25487,20 +25487,52 @@ const expectBoolean = (value) => {
|
|||
if (value === null || value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof value === "number") {
|
||||
if (value === 0 || value === 1) {
|
||||
exports.logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
|
||||
}
|
||||
if (value === 0) {
|
||||
return false;
|
||||
}
|
||||
if (value === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
const lower = value.toLowerCase();
|
||||
if (lower === "false" || lower === "true") {
|
||||
exports.logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
|
||||
}
|
||||
if (lower === "false") {
|
||||
return false;
|
||||
}
|
||||
if (lower === "true") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (typeof value === "boolean") {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected boolean, got ${typeof value}`);
|
||||
throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectBoolean = expectBoolean;
|
||||
const expectNumber = (value) => {
|
||||
if (value === null || value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
const parsed = parseFloat(value);
|
||||
if (!Number.isNaN(parsed)) {
|
||||
if (String(parsed) !== String(value)) {
|
||||
exports.logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
if (typeof value === "number") {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected number, got ${typeof value}`);
|
||||
throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectNumber = expectNumber;
|
||||
const MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
|
||||
|
|
@ -25521,7 +25553,7 @@ const expectLong = (value) => {
|
|||
if (Number.isInteger(value) && !Number.isNaN(value)) {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected integer, got ${typeof value}`);
|
||||
throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectLong = expectLong;
|
||||
exports.expectInt = exports.expectLong;
|
||||
|
|
@ -25565,7 +25597,8 @@ const expectObject = (value) => {
|
|||
if (typeof value === "object" && !Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected object, got ${typeof value}`);
|
||||
const receivedType = Array.isArray(value) ? "array" : typeof value;
|
||||
throw new TypeError(`Expected object, got ${receivedType}: ${value}`);
|
||||
};
|
||||
exports.expectObject = expectObject;
|
||||
const expectString = (value) => {
|
||||
|
|
@ -25575,7 +25608,11 @@ const expectString = (value) => {
|
|||
if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected string, got ${typeof value}`);
|
||||
if (["boolean", "number", "bigint"].includes(typeof value)) {
|
||||
exports.logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
|
||||
return String(value);
|
||||
}
|
||||
throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectString = expectString;
|
||||
const expectUnion = (value) => {
|
||||
|
|
@ -25584,10 +25621,10 @@ const expectUnion = (value) => {
|
|||
}
|
||||
const asObject = (0, exports.expectObject)(value);
|
||||
const setKeys = Object.entries(asObject)
|
||||
.filter(([_, v]) => v !== null && v !== undefined)
|
||||
.map(([k, _]) => k);
|
||||
.filter(([, v]) => v != null)
|
||||
.map(([k]) => k);
|
||||
if (setKeys.length === 0) {
|
||||
throw new TypeError(`Unions must have exactly one non-null member`);
|
||||
throw new TypeError(`Unions must have exactly one non-null member. None were found.`);
|
||||
}
|
||||
if (setKeys.length > 1) {
|
||||
throw new TypeError(`Unions must have exactly one non-null member. Keys ${setKeys} were not null.`);
|
||||
|
|
@ -25675,6 +25712,16 @@ const strictParseByte = (value) => {
|
|||
return (0, exports.expectByte)(value);
|
||||
};
|
||||
exports.strictParseByte = strictParseByte;
|
||||
const stackTraceWarning = (message) => {
|
||||
return String(new TypeError(message).stack || message)
|
||||
.split("\n")
|
||||
.slice(0, 5)
|
||||
.filter((s) => !s.includes("stackTraceWarning"))
|
||||
.join("\n");
|
||||
};
|
||||
exports.logger = {
|
||||
warn: console.warn,
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -28043,22 +28090,25 @@ const SPECIAL_USE_DOMAINS = [
|
|||
"test"
|
||||
];
|
||||
|
||||
const SPECIAL_TREATMENT_DOMAINS = ["localhost", "invalid"];
|
||||
|
||||
function getPublicSuffix(domain, options = {}) {
|
||||
const domainParts = domain.split(".");
|
||||
const topLevelDomain = domainParts[domainParts.length - 1];
|
||||
const allowSpecialUseDomain = !!options.allowSpecialUseDomain;
|
||||
const ignoreError = !!options.ignoreError;
|
||||
|
||||
if (
|
||||
allowSpecialUseDomain &&
|
||||
domainParts.length > 1 &&
|
||||
SPECIAL_USE_DOMAINS.includes(topLevelDomain)
|
||||
) {
|
||||
// If the right-most label in the name is a special-use domain (e.g. bananas.apple.localhost),
|
||||
// then don't use PSL. This is because most special-use domains are not listed on PSL.
|
||||
const secondLevelDomain = domainParts[domainParts.length - 2];
|
||||
// In aforementioned example, the eTLD/pubSuf will be apple.localhost
|
||||
return `${secondLevelDomain}.${topLevelDomain}`;
|
||||
if (allowSpecialUseDomain && SPECIAL_USE_DOMAINS.includes(topLevelDomain)) {
|
||||
if (domainParts.length > 1) {
|
||||
const secondLevelDomain = domainParts[domainParts.length - 2];
|
||||
// In aforementioned example, the eTLD/pubSuf will be apple.localhost
|
||||
return `${secondLevelDomain}.${topLevelDomain}`;
|
||||
} else if (SPECIAL_TREATMENT_DOMAINS.includes(topLevelDomain)) {
|
||||
// For a single word special use domain, e.g. 'localhost' or 'invalid', per RFC 6761,
|
||||
// "Application software MAY recognize {localhost/invalid} names as special, or
|
||||
// MAY pass them to name resolution APIs as they would for other domain names."
|
||||
return `${topLevelDomain}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignoreError && SPECIAL_USE_DOMAINS.includes(topLevelDomain)) {
|
||||
|
|
@ -29592,9 +29642,10 @@ var __createBinding;
|
|||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getSpanContext = exports.setSpanContext = exports.deleteSpan = exports.setSpan = exports.getSpan = void 0;
|
||||
exports.getSpanContext = exports.setSpanContext = exports.deleteSpan = exports.setSpan = exports.getActiveSpan = exports.getSpan = void 0;
|
||||
var context_1 = __webpack_require__(132);
|
||||
var NonRecordingSpan_1 = __webpack_require__(437);
|
||||
var context_2 = __webpack_require__(189);
|
||||
/**
|
||||
* span key
|
||||
*/
|
||||
|
|
@ -29608,6 +29659,13 @@ function getSpan(context) {
|
|||
return context.getValue(SPAN_KEY) || undefined;
|
||||
}
|
||||
exports.getSpan = getSpan;
|
||||
/**
|
||||
* Gets the span from the current context, if one exists.
|
||||
*/
|
||||
function getActiveSpan() {
|
||||
return getSpan(context_2.ContextAPI.getInstance().active());
|
||||
}
|
||||
exports.getActiveSpan = getActiveSpan;
|
||||
/**
|
||||
* Set the span on a context
|
||||
*
|
||||
|
|
@ -29705,7 +29763,7 @@ exports.getTransformedHeaders = getTransformedHeaders;
|
|||
/***/ (function(module) {
|
||||
|
||||
// generated by genversion
|
||||
module.exports = '4.1.0'
|
||||
module.exports = '4.1.2'
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -78144,7 +78202,10 @@ class CookieJar {
|
|||
validators.validate(validators.isObject(options), options);
|
||||
this.rejectPublicSuffixes = options.rejectPublicSuffixes;
|
||||
this.enableLooseMode = !!options.looseMode;
|
||||
this.allowSpecialUseDomain = !!options.allowSpecialUseDomain;
|
||||
this.allowSpecialUseDomain =
|
||||
typeof options.allowSpecialUseDomain === "boolean"
|
||||
? options.allowSpecialUseDomain
|
||||
: true;
|
||||
this.store = store || new MemoryCookieStore();
|
||||
this.prefixSecurity = getNormalizedPrefixSecurity(options.prefixSecurity);
|
||||
this._cloneSync = syncWrap("clone");
|
||||
|
|
@ -80908,6 +80969,7 @@ exports.AssumeRoleWithWebIdentityCommand = AssumeRoleWithWebIdentityCommand;
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SamplingDecision = void 0;
|
||||
/**
|
||||
* @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
|
||||
* A sampling decision that determines how a {@link Span} will be recorded
|
||||
* and collected.
|
||||
*/
|
||||
|
|
@ -96901,7 +96963,179 @@ exports.GetBucketEncryptionCommand = GetBucketEncryptionCommand;
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 900 */,
|
||||
/* 900 */
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var crypto = __webpack_require__(417);
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
var _a;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
const isNode = typeof process !== "undefined" && Boolean(process.version) && Boolean((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
function delay(timeInMs) {
|
||||
return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound,
|
||||
* inclusive of both bounds.
|
||||
* Note that this uses Math.random and isn't secure. If you need to use
|
||||
* this for any kind of security purpose, find a better source of random.
|
||||
* @param min - The smallest integer value allowed.
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
function getRandomIntegerInclusive(min, max) {
|
||||
// Make sure inputs are integers.
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
// Pick a random offset from zero to the size of the range.
|
||||
// Since Math.random() can never return 1, we have to make the range one larger
|
||||
// in order to be inclusive of the maximum value after we take the floor.
|
||||
const offset = Math.floor(Math.random() * (max - min + 1));
|
||||
return offset + min;
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
function isObject(input) {
|
||||
return (typeof input === "object" &&
|
||||
input !== null &&
|
||||
!Array.isArray(input) &&
|
||||
!(input instanceof RegExp) &&
|
||||
!(input instanceof Date));
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
function isError(e) {
|
||||
if (isObject(e)) {
|
||||
const hasName = typeof e.name === "string";
|
||||
const hasMessage = typeof e.message === "string";
|
||||
return hasName && hasMessage;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
function getErrorMessage(e) {
|
||||
if (isError(e)) {
|
||||
return e.message;
|
||||
}
|
||||
else {
|
||||
let stringified;
|
||||
try {
|
||||
if (typeof e === "object" && e) {
|
||||
stringified = JSON.stringify(e);
|
||||
}
|
||||
else {
|
||||
stringified = String(e);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
stringified = "[unable to stringify input]";
|
||||
}
|
||||
return `Unknown error ${stringified}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
* @param stringToSign - The data to be signed.
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
async function computeSha256Hmac(key, stringToSign, encoding) {
|
||||
const decodedKey = Buffer.from(key, "base64");
|
||||
return crypto.createHmac("sha256", decodedKey).update(stringToSign).digest(encoding);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
* @param content - The data to be included in the hash.
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
async function computeSha256Hash(content, encoding) {
|
||||
return crypto.createHash("sha256").update(content).digest(encoding);
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
function isDefined(thing) {
|
||||
return typeof thing !== "undefined" && thing !== null;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
function isObjectWithProperties(thing, properties) {
|
||||
if (!isDefined(thing) || typeof thing !== "object") {
|
||||
return false;
|
||||
}
|
||||
for (const property of properties) {
|
||||
if (!objectHasProperty(thing, property)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
function objectHasProperty(thing, property) {
|
||||
return (isDefined(thing) && typeof thing === "object" && property in thing);
|
||||
}
|
||||
|
||||
exports.computeSha256Hash = computeSha256Hash;
|
||||
exports.computeSha256Hmac = computeSha256Hmac;
|
||||
exports.delay = delay;
|
||||
exports.getErrorMessage = getErrorMessage;
|
||||
exports.getRandomIntegerInclusive = getRandomIntegerInclusive;
|
||||
exports.isDefined = isDefined;
|
||||
exports.isError = isError;
|
||||
exports.isNode = isNode;
|
||||
exports.isObject = isObject;
|
||||
exports.isObjectWithProperties = isObjectWithProperties;
|
||||
exports.objectHasProperty = objectHasProperty;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 901 */,
|
||||
/* 902 */
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
|
@ -97608,6 +97842,7 @@ var TraceAPI = /** @class */ (function () {
|
|||
this.isSpanContextValid = spancontext_utils_1.isSpanContextValid;
|
||||
this.deleteSpan = context_utils_1.deleteSpan;
|
||||
this.getSpan = context_utils_1.getSpan;
|
||||
this.getActiveSpan = context_utils_1.getActiveSpan;
|
||||
this.getSpanContext = context_utils_1.getSpanContext;
|
||||
this.setSpan = context_utils_1.setSpan;
|
||||
this.setSpanContext = context_utils_1.setSpanContext;
|
||||
|
|
@ -102683,6 +102918,702 @@ function getASCIIEncoder(obj) {
|
|||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var logger$1 = __webpack_require__(492);
|
||||
var abortController = __webpack_require__(819);
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* The `@azure/logger` configuration for this package.
|
||||
* @internal
|
||||
*/
|
||||
const logger = logger$1.createClientLogger("core-lro");
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* The default time interval to wait before sending the next polling request.
|
||||
*/
|
||||
const POLL_INTERVAL_IN_MS = 2000;
|
||||
/**
|
||||
* The closed set of terminal states.
|
||||
*/
|
||||
const terminalStates = ["succeeded", "canceled", "failed"];
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* Deserializes the state
|
||||
*/
|
||||
function deserializeState(serializedState) {
|
||||
try {
|
||||
return JSON.parse(serializedState).state;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Unable to deserialize input state: ${serializedState}`);
|
||||
}
|
||||
}
|
||||
function setStateError(inputs) {
|
||||
const { state, stateProxy } = inputs;
|
||||
return (error) => {
|
||||
stateProxy.setError(state, error);
|
||||
stateProxy.setFailed(state);
|
||||
throw error;
|
||||
};
|
||||
}
|
||||
function processOperationStatus(result) {
|
||||
const { state, stateProxy, status } = result;
|
||||
logger.verbose(`LRO: Status:\n\tPolling from: ${state.config.operationLocation}\n\tOperation status: ${status}\n\tPolling status: ${terminalStates.includes(status) ? "Stopped" : "Running"}`);
|
||||
switch (status) {
|
||||
case "succeeded": {
|
||||
stateProxy.setSucceeded(state);
|
||||
break;
|
||||
}
|
||||
case "failed": {
|
||||
stateProxy.setError(state, new Error(`The long-running operation has failed`));
|
||||
stateProxy.setFailed(state);
|
||||
break;
|
||||
}
|
||||
case "canceled": {
|
||||
stateProxy.setCanceled(state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function buildResult(inputs) {
|
||||
const { processResult, response, state } = inputs;
|
||||
return processResult ? processResult(response, state) : response;
|
||||
}
|
||||
/**
|
||||
* Initiates the long-running operation.
|
||||
*/
|
||||
async function initOperation(inputs) {
|
||||
const { init, stateProxy, processResult, getOperationStatus, withOperationLocation } = inputs;
|
||||
const { operationLocation, resourceLocation, metadata, response } = await init();
|
||||
if (operationLocation)
|
||||
withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(operationLocation, false);
|
||||
const config = {
|
||||
metadata,
|
||||
operationLocation,
|
||||
resourceLocation,
|
||||
};
|
||||
logger.verbose(`LRO: Operation description:`, config);
|
||||
const state = stateProxy.initState(config);
|
||||
const status = getOperationStatus(response, state);
|
||||
if (status === "succeeded" || operationLocation === undefined) {
|
||||
stateProxy.setSucceeded(state);
|
||||
stateProxy.setResult(state, buildResult({
|
||||
response,
|
||||
state,
|
||||
processResult,
|
||||
}));
|
||||
}
|
||||
return state;
|
||||
}
|
||||
async function pollOperationHelper(inputs) {
|
||||
const { poll, state, stateProxy, operationLocation, getOperationStatus, getResourceLocation, options, } = inputs;
|
||||
const response = await poll(operationLocation, options).catch(setStateError({
|
||||
state,
|
||||
stateProxy,
|
||||
}));
|
||||
const status = getOperationStatus(response, state);
|
||||
processOperationStatus({
|
||||
status,
|
||||
state,
|
||||
stateProxy,
|
||||
});
|
||||
if (status === "succeeded") {
|
||||
const resourceLocation = getResourceLocation(response, state);
|
||||
if (resourceLocation !== undefined) {
|
||||
return {
|
||||
response: await poll(resourceLocation).catch(setStateError({ state, stateProxy })),
|
||||
status,
|
||||
};
|
||||
}
|
||||
}
|
||||
return { response, status };
|
||||
}
|
||||
/** Polls the long-running operation. */
|
||||
async function pollOperation(inputs) {
|
||||
const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, withOperationLocation, getPollingInterval, processResult, updateState, setDelay, isDone, } = inputs;
|
||||
const { operationLocation } = state.config;
|
||||
if (operationLocation !== undefined) {
|
||||
const { response, status } = await pollOperationHelper({
|
||||
poll,
|
||||
getOperationStatus,
|
||||
state,
|
||||
stateProxy,
|
||||
operationLocation,
|
||||
getResourceLocation,
|
||||
options,
|
||||
});
|
||||
if ((isDone === null || isDone === void 0 ? void 0 : isDone(response, state)) ||
|
||||
(isDone === undefined && ["succeeded", "canceled"].includes(status))) {
|
||||
stateProxy.setResult(state, buildResult({
|
||||
response,
|
||||
state,
|
||||
processResult,
|
||||
}));
|
||||
}
|
||||
else {
|
||||
const intervalInMs = getPollingInterval === null || getPollingInterval === void 0 ? void 0 : getPollingInterval(response);
|
||||
if (intervalInMs)
|
||||
setDelay(intervalInMs);
|
||||
const location = getOperationLocation === null || getOperationLocation === void 0 ? void 0 : getOperationLocation(response, state);
|
||||
if (location !== undefined) {
|
||||
const isUpdated = operationLocation !== location;
|
||||
state.config.operationLocation = location;
|
||||
withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(location, isUpdated);
|
||||
}
|
||||
else
|
||||
withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(operationLocation, false);
|
||||
}
|
||||
updateState === null || updateState === void 0 ? void 0 : updateState(state, response);
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
function getOperationLocationPollingUrl(inputs) {
|
||||
const { azureAsyncOperation, operationLocation } = inputs;
|
||||
return operationLocation !== null && operationLocation !== void 0 ? operationLocation : azureAsyncOperation;
|
||||
}
|
||||
function getLocationHeader(rawResponse) {
|
||||
return rawResponse.headers["location"];
|
||||
}
|
||||
function getOperationLocationHeader(rawResponse) {
|
||||
return rawResponse.headers["operation-location"];
|
||||
}
|
||||
function getAzureAsyncOperationHeader(rawResponse) {
|
||||
return rawResponse.headers["azure-asyncoperation"];
|
||||
}
|
||||
function findResourceLocation(inputs) {
|
||||
const { location, requestMethod, requestPath, resourceLocationConfig } = inputs;
|
||||
switch (requestMethod) {
|
||||
case "PUT": {
|
||||
return requestPath;
|
||||
}
|
||||
case "DELETE": {
|
||||
return undefined;
|
||||
}
|
||||
default: {
|
||||
switch (resourceLocationConfig) {
|
||||
case "azure-async-operation": {
|
||||
return undefined;
|
||||
}
|
||||
case "original-uri": {
|
||||
return requestPath;
|
||||
}
|
||||
case "location":
|
||||
default: {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function inferLroMode(inputs) {
|
||||
const { rawResponse, requestMethod, requestPath, resourceLocationConfig } = inputs;
|
||||
const operationLocation = getOperationLocationHeader(rawResponse);
|
||||
const azureAsyncOperation = getAzureAsyncOperationHeader(rawResponse);
|
||||
const pollingUrl = getOperationLocationPollingUrl({ operationLocation, azureAsyncOperation });
|
||||
const location = getLocationHeader(rawResponse);
|
||||
const normalizedRequestMethod = requestMethod === null || requestMethod === void 0 ? void 0 : requestMethod.toLocaleUpperCase();
|
||||
if (pollingUrl !== undefined) {
|
||||
return {
|
||||
mode: "OperationLocation",
|
||||
operationLocation: pollingUrl,
|
||||
resourceLocation: findResourceLocation({
|
||||
requestMethod: normalizedRequestMethod,
|
||||
location,
|
||||
requestPath,
|
||||
resourceLocationConfig,
|
||||
}),
|
||||
};
|
||||
}
|
||||
else if (location !== undefined) {
|
||||
return {
|
||||
mode: "ResourceLocation",
|
||||
operationLocation: location,
|
||||
};
|
||||
}
|
||||
else if (normalizedRequestMethod === "PUT" && requestPath) {
|
||||
return {
|
||||
mode: "Body",
|
||||
operationLocation: requestPath,
|
||||
};
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function transformStatus(status) {
|
||||
switch (status === null || status === void 0 ? void 0 : status.toLowerCase()) {
|
||||
case undefined:
|
||||
case "succeeded":
|
||||
return "succeeded";
|
||||
case "failed":
|
||||
return "failed";
|
||||
case "running":
|
||||
case "accepted":
|
||||
case "canceling":
|
||||
case "cancelling":
|
||||
return "running";
|
||||
case "canceled":
|
||||
case "cancelled":
|
||||
return "canceled";
|
||||
default: {
|
||||
logger.warning(`LRO: unrecognized operation status: ${status}`);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getStatus(rawResponse) {
|
||||
var _a;
|
||||
const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
|
||||
return transformStatus(status);
|
||||
}
|
||||
function getProvisioningState(rawResponse) {
|
||||
var _a, _b;
|
||||
const { properties, provisioningState } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
|
||||
const state = (_b = properties === null || properties === void 0 ? void 0 : properties.provisioningState) !== null && _b !== void 0 ? _b : provisioningState;
|
||||
return transformStatus(state);
|
||||
}
|
||||
function toOperationStatus(statusCode) {
|
||||
if (statusCode === 202) {
|
||||
return "running";
|
||||
}
|
||||
else if (statusCode < 300) {
|
||||
return "succeeded";
|
||||
}
|
||||
else {
|
||||
return "failed";
|
||||
}
|
||||
}
|
||||
function parseRetryAfter({ rawResponse }) {
|
||||
const retryAfter = rawResponse.headers["retry-after"];
|
||||
if (retryAfter !== undefined) {
|
||||
// Retry-After header value is either in HTTP date format, or in seconds
|
||||
const retryAfterInSeconds = parseInt(retryAfter);
|
||||
return isNaN(retryAfterInSeconds)
|
||||
? calculatePollingIntervalFromDate(new Date(retryAfter))
|
||||
: retryAfterInSeconds * 1000;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function calculatePollingIntervalFromDate(retryAfterDate) {
|
||||
const timeNow = Math.floor(new Date().getTime());
|
||||
const retryAfterTime = retryAfterDate.getTime();
|
||||
if (timeNow < retryAfterTime) {
|
||||
return retryAfterTime - timeNow;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Initiates the long-running operation.
|
||||
*/
|
||||
async function initHttpOperation(inputs) {
|
||||
const { stateProxy, resourceLocationConfig, processResult, lro } = inputs;
|
||||
return initOperation({
|
||||
init: async () => {
|
||||
const response = await lro.sendInitialRequest();
|
||||
const config = inferLroMode({
|
||||
rawResponse: response.rawResponse,
|
||||
requestPath: lro.requestPath,
|
||||
requestMethod: lro.requestMethod,
|
||||
resourceLocationConfig,
|
||||
});
|
||||
return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {}));
|
||||
},
|
||||
stateProxy,
|
||||
processResult: processResult
|
||||
? ({ flatResponse }, state) => processResult(flatResponse, state)
|
||||
: ({ flatResponse }) => flatResponse,
|
||||
getOperationStatus: (response, state) => {
|
||||
var _a;
|
||||
const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"];
|
||||
return mode === undefined ||
|
||||
(mode === "Body" && getOperationStatus(response, state) === "succeeded")
|
||||
? "succeeded"
|
||||
: "running";
|
||||
},
|
||||
});
|
||||
}
|
||||
function getOperationLocation({ rawResponse }, state) {
|
||||
var _a;
|
||||
const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"];
|
||||
switch (mode) {
|
||||
case "OperationLocation": {
|
||||
return getOperationLocationPollingUrl({
|
||||
operationLocation: getOperationLocationHeader(rawResponse),
|
||||
azureAsyncOperation: getAzureAsyncOperationHeader(rawResponse),
|
||||
});
|
||||
}
|
||||
case "ResourceLocation": {
|
||||
return getLocationHeader(rawResponse);
|
||||
}
|
||||
case "Body":
|
||||
default: {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getOperationStatus({ rawResponse }, state) {
|
||||
var _a;
|
||||
const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"];
|
||||
switch (mode) {
|
||||
case "OperationLocation": {
|
||||
return getStatus(rawResponse);
|
||||
}
|
||||
case "ResourceLocation": {
|
||||
return toOperationStatus(rawResponse.statusCode);
|
||||
}
|
||||
case "Body": {
|
||||
return getProvisioningState(rawResponse);
|
||||
}
|
||||
default:
|
||||
throw new Error(`Unexpected operation mode: ${mode}`);
|
||||
}
|
||||
}
|
||||
function getResourceLocation({ flatResponse }, state) {
|
||||
if (typeof flatResponse === "object") {
|
||||
const resourceLocation = flatResponse.resourceLocation;
|
||||
if (resourceLocation !== undefined) {
|
||||
state.config.resourceLocation = resourceLocation;
|
||||
}
|
||||
}
|
||||
return state.config.resourceLocation;
|
||||
}
|
||||
/** Polls the long-running operation. */
|
||||
async function pollHttpOperation(inputs) {
|
||||
const { lro, stateProxy, options, processResult, updateState, setDelay, state } = inputs;
|
||||
return pollOperation({
|
||||
state,
|
||||
stateProxy,
|
||||
setDelay,
|
||||
processResult: processResult
|
||||
? ({ flatResponse }, inputState) => processResult(flatResponse, inputState)
|
||||
: ({ flatResponse }) => flatResponse,
|
||||
updateState,
|
||||
getPollingInterval: parseRetryAfter,
|
||||
getOperationLocation,
|
||||
getOperationStatus,
|
||||
getResourceLocation,
|
||||
options,
|
||||
/**
|
||||
* The expansion here is intentional because `lro` could be an object that
|
||||
* references an inner this, so we need to preserve a reference to it.
|
||||
*/
|
||||
poll: async (location, inputOptions) => lro.sendPollRequest(location, inputOptions),
|
||||
});
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Map an optional value through a function
|
||||
* @internal
|
||||
*/
|
||||
const maybemap = (value, f) => value === undefined ? undefined : f(value);
|
||||
const INTERRUPTED = new Error("The poller is already stopped");
|
||||
/**
|
||||
* A promise that delays resolution until a certain amount of time (in milliseconds) has passed, with facilities for
|
||||
* robust cancellation.
|
||||
*
|
||||
* ### Example:
|
||||
*
|
||||
* ```javascript
|
||||
* let toCancel;
|
||||
*
|
||||
* // Wait 20 seconds, and optionally allow the function to be cancelled.
|
||||
* await delayMs(20000, (cancel) => { toCancel = cancel });
|
||||
*
|
||||
* // ... if `toCancel` is called before the 20 second timer expires, then the delayMs promise will reject.
|
||||
* ```
|
||||
*
|
||||
* @internal
|
||||
* @param ms - the number of milliseconds to wait before resolving
|
||||
* @param cb - a callback that can provide the caller with a cancellation function
|
||||
*/
|
||||
function delayMs(ms) {
|
||||
let aborted = false;
|
||||
let toReject;
|
||||
return Object.assign(new Promise((resolve, reject) => {
|
||||
let token;
|
||||
toReject = () => {
|
||||
maybemap(token, clearTimeout);
|
||||
reject(INTERRUPTED);
|
||||
};
|
||||
// In the rare case that the operation is _already_ aborted, we will reject instantly. This could happen, for
|
||||
// example, if the user calls the cancellation function immediately without yielding execution.
|
||||
if (aborted) {
|
||||
toReject();
|
||||
}
|
||||
else {
|
||||
token = setTimeout(resolve, ms);
|
||||
}
|
||||
}), {
|
||||
cancel: () => {
|
||||
aborted = true;
|
||||
toReject === null || toReject === void 0 ? void 0 : toReject();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
const createStateProxy$1 = () => ({
|
||||
/**
|
||||
* The state at this point is created to be of type OperationState<TResult>.
|
||||
* It will be updated later to be of type TState when the
|
||||
* customer-provided callback, `updateState`, is called during polling.
|
||||
*/
|
||||
initState: (config) => ({ status: "running", config }),
|
||||
setCanceled: (state) => (state.status = "canceled"),
|
||||
setError: (state, error) => (state.error = error),
|
||||
setResult: (state, result) => (state.result = result),
|
||||
setRunning: (state) => (state.status = "running"),
|
||||
setSucceeded: (state) => (state.status = "succeeded"),
|
||||
setFailed: (state) => (state.status = "failed"),
|
||||
getError: (state) => state.error,
|
||||
getResult: (state) => state.result,
|
||||
isCanceled: (state) => state.status === "canceled",
|
||||
isFailed: (state) => state.status === "failed",
|
||||
isRunning: (state) => state.status === "running",
|
||||
isSucceeded: (state) => state.status === "succeeded",
|
||||
});
|
||||
/**
|
||||
* Returns a poller factory.
|
||||
*/
|
||||
function buildCreatePoller(inputs) {
|
||||
const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, getResourceLocation, getPollingInterval, } = inputs;
|
||||
return async ({ init, poll }, options) => {
|
||||
const { processResult, updateState, withOperationLocation: withOperationLocationCallback, intervalInMs = POLL_INTERVAL_IN_MS, restoreFrom, } = options || {};
|
||||
const stateProxy = createStateProxy$1();
|
||||
const withOperationLocation = withOperationLocationCallback
|
||||
? (() => {
|
||||
let called = false;
|
||||
return (operationLocation, isUpdated) => {
|
||||
if (isUpdated)
|
||||
withOperationLocationCallback(operationLocation);
|
||||
else if (!called)
|
||||
withOperationLocationCallback(operationLocation);
|
||||
called = true;
|
||||
};
|
||||
})()
|
||||
: undefined;
|
||||
const state = restoreFrom
|
||||
? deserializeState(restoreFrom)
|
||||
: await initOperation({
|
||||
init,
|
||||
stateProxy,
|
||||
processResult,
|
||||
getOperationStatus: getStatusFromInitialResponse,
|
||||
withOperationLocation,
|
||||
});
|
||||
let resultPromise;
|
||||
let cancelJob;
|
||||
const abortController$1 = new abortController.AbortController();
|
||||
const handlers = new Map();
|
||||
const handleProgressEvents = async () => handlers.forEach((h) => h(state));
|
||||
let currentPollIntervalInMs = intervalInMs;
|
||||
const poller = {
|
||||
getOperationState: () => state,
|
||||
getResult: () => state.result,
|
||||
isDone: () => ["succeeded", "failed", "canceled"].includes(state.status),
|
||||
isStopped: () => resultPromise === undefined,
|
||||
stopPolling: () => {
|
||||
abortController$1.abort();
|
||||
cancelJob === null || cancelJob === void 0 ? void 0 : cancelJob();
|
||||
},
|
||||
toString: () => JSON.stringify({
|
||||
state,
|
||||
}),
|
||||
onProgress: (callback) => {
|
||||
const s = Symbol();
|
||||
handlers.set(s, callback);
|
||||
return () => handlers.delete(s);
|
||||
},
|
||||
pollUntilDone: (pollOptions) => (resultPromise !== null && resultPromise !== void 0 ? resultPromise : (resultPromise = (async () => {
|
||||
const { abortSignal: inputAbortSignal } = pollOptions || {};
|
||||
const { signal: abortSignal } = inputAbortSignal
|
||||
? new abortController.AbortController([inputAbortSignal, abortController$1.signal])
|
||||
: abortController$1;
|
||||
if (!poller.isDone()) {
|
||||
await poller.poll({ abortSignal });
|
||||
while (!poller.isDone()) {
|
||||
const delay = delayMs(currentPollIntervalInMs);
|
||||
cancelJob = delay.cancel;
|
||||
await delay;
|
||||
await poller.poll({ abortSignal });
|
||||
}
|
||||
}
|
||||
switch (state.status) {
|
||||
case "succeeded": {
|
||||
return poller.getResult();
|
||||
}
|
||||
case "canceled": {
|
||||
throw new Error("Operation was canceled");
|
||||
}
|
||||
case "failed": {
|
||||
throw state.error;
|
||||
}
|
||||
case "notStarted":
|
||||
case "running": {
|
||||
// Unreachable
|
||||
throw new Error(`polling completed without succeeding or failing`);
|
||||
}
|
||||
}
|
||||
})().finally(() => {
|
||||
resultPromise = undefined;
|
||||
}))),
|
||||
async poll(pollOptions) {
|
||||
await pollOperation({
|
||||
poll,
|
||||
state,
|
||||
stateProxy,
|
||||
getOperationLocation,
|
||||
withOperationLocation,
|
||||
getPollingInterval,
|
||||
getOperationStatus: getStatusFromPollResponse,
|
||||
getResourceLocation,
|
||||
processResult,
|
||||
updateState,
|
||||
options: pollOptions,
|
||||
setDelay: (pollIntervalInMs) => {
|
||||
currentPollIntervalInMs = pollIntervalInMs;
|
||||
},
|
||||
});
|
||||
await handleProgressEvents();
|
||||
if (state.status === "canceled") {
|
||||
throw new Error("Operation was canceled");
|
||||
}
|
||||
if (state.status === "failed") {
|
||||
throw state.error;
|
||||
}
|
||||
},
|
||||
};
|
||||
return poller;
|
||||
};
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* Creates a poller that can be used to poll a long-running operation.
|
||||
* @param lro - Description of the long-running operation
|
||||
* @param options - options to configure the poller
|
||||
* @returns an initialized poller
|
||||
*/
|
||||
async function createHttpPoller(lro, options) {
|
||||
const { resourceLocationConfig, intervalInMs, processResult, restoreFrom, updateState, withOperationLocation, } = options || {};
|
||||
return buildCreatePoller({
|
||||
getStatusFromInitialResponse: (response, state) => {
|
||||
var _a;
|
||||
const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"];
|
||||
return mode === undefined ||
|
||||
(mode === "Body" && getOperationStatus(response, state) === "succeeded")
|
||||
? "succeeded"
|
||||
: "running";
|
||||
},
|
||||
getStatusFromPollResponse: getOperationStatus,
|
||||
getOperationLocation,
|
||||
getResourceLocation,
|
||||
getPollingInterval: parseRetryAfter,
|
||||
})({
|
||||
init: async () => {
|
||||
const response = await lro.sendInitialRequest();
|
||||
const config = inferLroMode({
|
||||
rawResponse: response.rawResponse,
|
||||
requestPath: lro.requestPath,
|
||||
requestMethod: lro.requestMethod,
|
||||
resourceLocationConfig,
|
||||
});
|
||||
return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {}));
|
||||
},
|
||||
poll: lro.sendPollRequest,
|
||||
}, {
|
||||
intervalInMs,
|
||||
withOperationLocation,
|
||||
restoreFrom,
|
||||
updateState,
|
||||
processResult: processResult
|
||||
? ({ flatResponse }, state) => processResult(flatResponse, state)
|
||||
: ({ flatResponse }) => flatResponse,
|
||||
});
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
const createStateProxy = () => ({
|
||||
initState: (config) => ({ config, isStarted: true }),
|
||||
setCanceled: (state) => (state.isCancelled = true),
|
||||
setError: (state, error) => (state.error = error),
|
||||
setResult: (state, result) => (state.result = result),
|
||||
setRunning: (state) => (state.isStarted = true),
|
||||
setSucceeded: (state) => (state.isCompleted = true),
|
||||
setFailed: () => {
|
||||
/** empty body */
|
||||
},
|
||||
getError: (state) => state.error,
|
||||
getResult: (state) => state.result,
|
||||
isCanceled: (state) => !!state.isCancelled,
|
||||
isFailed: (state) => !!state.error,
|
||||
isRunning: (state) => !!state.isStarted,
|
||||
isSucceeded: (state) => Boolean(state.isCompleted && !state.isCancelled && !state.error),
|
||||
});
|
||||
class GenericPollOperation {
|
||||
constructor(state, lro, lroResourceLocationConfig, processResult, updateState, isDone) {
|
||||
this.state = state;
|
||||
this.lro = lro;
|
||||
this.lroResourceLocationConfig = lroResourceLocationConfig;
|
||||
this.processResult = processResult;
|
||||
this.updateState = updateState;
|
||||
this.isDone = isDone;
|
||||
}
|
||||
setPollerConfig(pollerConfig) {
|
||||
this.pollerConfig = pollerConfig;
|
||||
}
|
||||
async update(options) {
|
||||
var _a;
|
||||
const stateProxy = createStateProxy();
|
||||
if (!this.state.isStarted) {
|
||||
this.state = Object.assign(Object.assign({}, this.state), (await initHttpOperation({
|
||||
lro: this.lro,
|
||||
stateProxy,
|
||||
resourceLocationConfig: this.lroResourceLocationConfig,
|
||||
processResult: this.processResult,
|
||||
})));
|
||||
}
|
||||
const updateState = this.updateState;
|
||||
const isDone = this.isDone;
|
||||
if (!this.state.isCompleted) {
|
||||
await pollHttpOperation({
|
||||
lro: this.lro,
|
||||
state: this.state,
|
||||
stateProxy,
|
||||
processResult: this.processResult,
|
||||
updateState: updateState
|
||||
? (state, { rawResponse }) => updateState(state, rawResponse)
|
||||
: undefined,
|
||||
isDone: isDone
|
||||
? ({ flatResponse }, state) => isDone(flatResponse, state)
|
||||
: undefined,
|
||||
options,
|
||||
setDelay: (intervalInMs) => {
|
||||
this.pollerConfig.intervalInMs = intervalInMs;
|
||||
},
|
||||
});
|
||||
}
|
||||
(_a = options === null || options === void 0 ? void 0 : options.fireProgress) === null || _a === void 0 ? void 0 : _a.call(options, this.state);
|
||||
return this;
|
||||
}
|
||||
async cancel() {
|
||||
logger.error("`cancelOperation` is deprecated because it wasn't implemented");
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Serializes the Poller operation.
|
||||
*/
|
||||
toString() {
|
||||
return JSON.stringify({
|
||||
state: this.state,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
|
@ -102855,12 +103786,12 @@ class Poller {
|
|||
* Starts a loop that will break only if the poller is done
|
||||
* or if the poller is stopped.
|
||||
*/
|
||||
async startPolling() {
|
||||
async startPolling(pollOptions = {}) {
|
||||
if (this.stopped) {
|
||||
this.stopped = false;
|
||||
}
|
||||
while (!this.isStopped() && !this.isDone()) {
|
||||
await this.poll();
|
||||
await this.poll(pollOptions);
|
||||
await this.delay();
|
||||
}
|
||||
}
|
||||
|
|
@ -102931,7 +103862,7 @@ class Poller {
|
|||
}
|
||||
if (this.operation.state.isCancelled) {
|
||||
this.stopped = true;
|
||||
const error = new PollerCancelledError("Poller cancelled");
|
||||
const error = new PollerCancelledError("Operation was canceled");
|
||||
this.reject(error);
|
||||
throw error;
|
||||
}
|
||||
|
|
@ -102947,9 +103878,9 @@ class Poller {
|
|||
/**
|
||||
* Returns a promise that will resolve once the underlying operation is completed.
|
||||
*/
|
||||
async pollUntilDone() {
|
||||
async pollUntilDone(pollOptions = {}) {
|
||||
if (this.stopped) {
|
||||
this.startPolling().catch(this.reject);
|
||||
this.startPolling(pollOptions).catch(this.reject);
|
||||
}
|
||||
// This is needed because the state could have been updated by
|
||||
// `cancelOperation`, e.g. the operation is canceled or an error occurred.
|
||||
|
|
@ -103081,391 +104012,12 @@ class Poller {
|
|||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* The `@azure/logger` configuration for this package.
|
||||
* @internal
|
||||
*/
|
||||
const logger = logger$1.createClientLogger("core-lro");
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
function throwIfUndefined(input, options = {}) {
|
||||
var _a;
|
||||
if (input === undefined) {
|
||||
throw new Error((_a = options.errorMessage) !== null && _a !== void 0 ? _a : "undefined variable");
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function updatePollingUrl(inputs) {
|
||||
var _a, _b;
|
||||
const { info, rawResponse } = inputs;
|
||||
switch (info.mode) {
|
||||
case "OperationLocation": {
|
||||
const operationLocation = getOperationLocation(rawResponse);
|
||||
const azureAsyncOperation = getAzureAsyncOperation(rawResponse);
|
||||
info.pollingUrl =
|
||||
(_a = getOperationLocationPollingUrl({ operationLocation, azureAsyncOperation })) !== null && _a !== void 0 ? _a : throwIfUndefined(info.pollingUrl);
|
||||
break;
|
||||
}
|
||||
case "ResourceLocation": {
|
||||
info.pollingUrl = (_b = getLocation(rawResponse)) !== null && _b !== void 0 ? _b : throwIfUndefined(info.pollingUrl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getOperationLocationPollingUrl(inputs) {
|
||||
const { azureAsyncOperation, operationLocation } = inputs;
|
||||
return operationLocation !== null && operationLocation !== void 0 ? operationLocation : azureAsyncOperation;
|
||||
}
|
||||
function getLocation(rawResponse) {
|
||||
return rawResponse.headers["location"];
|
||||
}
|
||||
function getOperationLocation(rawResponse) {
|
||||
return rawResponse.headers["operation-location"];
|
||||
}
|
||||
function getAzureAsyncOperation(rawResponse) {
|
||||
return rawResponse.headers["azure-asyncoperation"];
|
||||
}
|
||||
function findResourceLocation(inputs) {
|
||||
const { location, requestMethod, requestPath, lroResourceLocationConfig } = inputs;
|
||||
switch (requestMethod) {
|
||||
case "PUT": {
|
||||
return requestPath;
|
||||
}
|
||||
case "DELETE": {
|
||||
return undefined;
|
||||
}
|
||||
default: {
|
||||
switch (lroResourceLocationConfig) {
|
||||
case "azure-async-operation": {
|
||||
return undefined;
|
||||
}
|
||||
case "original-uri": {
|
||||
return requestPath;
|
||||
}
|
||||
case "location":
|
||||
default: {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function inferLroMode(inputs) {
|
||||
const { rawResponse, requestMethod, requestPath, lroResourceLocationConfig } = inputs;
|
||||
const operationLocation = getOperationLocation(rawResponse);
|
||||
const azureAsyncOperation = getAzureAsyncOperation(rawResponse);
|
||||
const location = getLocation(rawResponse);
|
||||
if (operationLocation !== undefined || azureAsyncOperation !== undefined) {
|
||||
return {
|
||||
mode: "OperationLocation",
|
||||
pollingUrl: operationLocation !== null && operationLocation !== void 0 ? operationLocation : azureAsyncOperation,
|
||||
resourceLocation: findResourceLocation({
|
||||
requestMethod,
|
||||
location,
|
||||
requestPath,
|
||||
lroResourceLocationConfig,
|
||||
}),
|
||||
};
|
||||
}
|
||||
else if (location !== undefined) {
|
||||
return {
|
||||
mode: "ResourceLocation",
|
||||
pollingUrl: location,
|
||||
};
|
||||
}
|
||||
else if (requestMethod === "PUT") {
|
||||
return {
|
||||
mode: "Body",
|
||||
pollingUrl: requestPath,
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
mode: "None",
|
||||
};
|
||||
}
|
||||
}
|
||||
class SimpleRestError extends Error {
|
||||
constructor(message, statusCode) {
|
||||
super(message);
|
||||
this.name = "RestError";
|
||||
this.statusCode = statusCode;
|
||||
Object.setPrototypeOf(this, SimpleRestError.prototype);
|
||||
}
|
||||
}
|
||||
function throwIfError(rawResponse) {
|
||||
const code = rawResponse.statusCode;
|
||||
if (code >= 400) {
|
||||
throw new SimpleRestError(`Received unexpected HTTP status code ${code} while polling. This may indicate a server issue.`, code);
|
||||
}
|
||||
}
|
||||
function getStatus(rawResponse) {
|
||||
var _a;
|
||||
const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
|
||||
return typeof status === "string" ? status.toLowerCase() : "succeeded";
|
||||
}
|
||||
function getProvisioningState(rawResponse) {
|
||||
var _a, _b;
|
||||
const { properties, provisioningState } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
|
||||
const state = (_b = properties === null || properties === void 0 ? void 0 : properties.provisioningState) !== null && _b !== void 0 ? _b : provisioningState;
|
||||
return typeof state === "string" ? state.toLowerCase() : "succeeded";
|
||||
}
|
||||
function isCanceled(operation) {
|
||||
const { state, operationStatus } = operation;
|
||||
if (["canceled", "cancelled"].includes(operationStatus)) {
|
||||
state.isCancelled = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isTerminal(operation) {
|
||||
const { state, operationStatus } = operation;
|
||||
if (operationStatus === "failed") {
|
||||
throw new Error(`The long-running operation has failed.`);
|
||||
}
|
||||
return operationStatus === "succeeded" || isCanceled({ state, operationStatus });
|
||||
}
|
||||
function getOperationStatus(result) {
|
||||
const { rawResponse, state, info, responseKind = "Polling" } = result;
|
||||
throwIfError(rawResponse);
|
||||
switch (info.mode) {
|
||||
case "OperationLocation": {
|
||||
const operationStatus = getStatus(rawResponse);
|
||||
return {
|
||||
operationStatus,
|
||||
shouldStopPolling: responseKind === "Polling" && isTerminal({ state, operationStatus }),
|
||||
};
|
||||
}
|
||||
case "Body": {
|
||||
const operationStatus = getProvisioningState(rawResponse);
|
||||
return {
|
||||
operationStatus,
|
||||
shouldStopPolling: isTerminal({ state, operationStatus }),
|
||||
};
|
||||
}
|
||||
case "ResourceLocation": {
|
||||
const operationStatus = rawResponse.statusCode;
|
||||
return {
|
||||
operationStatus,
|
||||
shouldStopPolling: responseKind === "Polling" && operationStatus !== 202,
|
||||
};
|
||||
}
|
||||
case "None": {
|
||||
return {
|
||||
shouldStopPolling: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
function shouldStopPolling(result) {
|
||||
const { rawResponse, state, info, responseKind = "Polling" } = result;
|
||||
const { shouldStopPolling: isPollingStopped, operationStatus } = getOperationStatus({
|
||||
info,
|
||||
rawResponse,
|
||||
state,
|
||||
responseKind,
|
||||
});
|
||||
if (operationStatus) {
|
||||
logger.verbose(`LRO: Status:\n\tPolling from: ${info.pollingUrl}\n\tOperation status: ${operationStatus}\n\tPolling status: ${isPollingStopped ? "Stopped" : "Running"}`);
|
||||
}
|
||||
else {
|
||||
logger.verbose(`LRO: Status: Not an LRO`);
|
||||
}
|
||||
return isPollingStopped;
|
||||
}
|
||||
/**
|
||||
* Creates a polling operation.
|
||||
*/
|
||||
function createPoll(lroPrimitives) {
|
||||
return async (path, pollerConfig, getLroStatusFromResponse) => {
|
||||
const response = await lroPrimitives.sendPollRequest(path);
|
||||
const retryAfter = response.rawResponse.headers["retry-after"];
|
||||
if (retryAfter !== undefined) {
|
||||
// Retry-After header value is either in HTTP date format, or in seconds
|
||||
const retryAfterInSeconds = parseInt(retryAfter);
|
||||
pollerConfig.intervalInMs = isNaN(retryAfterInSeconds)
|
||||
? calculatePollingIntervalFromDate(new Date(retryAfter), pollerConfig.intervalInMs)
|
||||
: retryAfterInSeconds * 1000;
|
||||
}
|
||||
return getLroStatusFromResponse(response);
|
||||
};
|
||||
}
|
||||
function calculatePollingIntervalFromDate(retryAfterDate, defaultIntervalInMs) {
|
||||
const timeNow = Math.floor(new Date().getTime());
|
||||
const retryAfterTime = retryAfterDate.getTime();
|
||||
if (timeNow < retryAfterTime) {
|
||||
return retryAfterTime - timeNow;
|
||||
}
|
||||
return defaultIntervalInMs;
|
||||
}
|
||||
function buildResult(inputs) {
|
||||
const { processResult, response, state } = inputs;
|
||||
return processResult ? processResult(response, state) : response;
|
||||
}
|
||||
/**
|
||||
* Creates a callback to be used to initialize the polling operation state.
|
||||
*/
|
||||
function createStateInitializer(inputs) {
|
||||
const { requestMethod, requestPath, state, lroResourceLocationConfig, processResult } = inputs;
|
||||
return (response) => {
|
||||
const { rawResponse } = response;
|
||||
state.isStarted = true;
|
||||
state.config = inferLroMode({
|
||||
rawResponse,
|
||||
requestPath,
|
||||
requestMethod,
|
||||
lroResourceLocationConfig,
|
||||
});
|
||||
logger.verbose(`LRO: Operation description:`, state.config);
|
||||
/** short circuit before polling */
|
||||
if (shouldStopPolling({
|
||||
rawResponse,
|
||||
state,
|
||||
info: state.config,
|
||||
responseKind: "Initial",
|
||||
})) {
|
||||
state.result = buildResult({
|
||||
response: response.flatResponse,
|
||||
state: state,
|
||||
processResult,
|
||||
});
|
||||
state.isCompleted = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
function createGetLroStatusFromResponse(inputs) {
|
||||
const { lro, state, info } = inputs;
|
||||
const location = info.resourceLocation;
|
||||
return (response) => {
|
||||
const isTerminalStatus = shouldStopPolling({
|
||||
info,
|
||||
rawResponse: response.rawResponse,
|
||||
state,
|
||||
});
|
||||
return Object.assign(Object.assign({}, response), { done: isTerminalStatus && !location, next: !(isTerminalStatus && location)
|
||||
? undefined
|
||||
: () => lro.sendPollRequest(location).then((res) => (Object.assign(Object.assign({}, res), { done: true }))) });
|
||||
};
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
class GenericPollOperation {
|
||||
constructor(state, lro, lroResourceLocationConfig, processResult, updateState, isDone) {
|
||||
this.state = state;
|
||||
this.lro = lro;
|
||||
this.lroResourceLocationConfig = lroResourceLocationConfig;
|
||||
this.processResult = processResult;
|
||||
this.updateState = updateState;
|
||||
this.isDone = isDone;
|
||||
}
|
||||
setPollerConfig(pollerConfig) {
|
||||
this.pollerConfig = pollerConfig;
|
||||
}
|
||||
/**
|
||||
* General update function for LROPoller, the general process is as follows
|
||||
* 1. Check initial operation result to determine the strategy to use
|
||||
* - Strategies: Location, Azure-AsyncOperation, Original Uri
|
||||
* 2. Check if the operation result has a terminal state
|
||||
* - Terminal state will be determined by each strategy
|
||||
* 2.1 If it is terminal state Check if a final GET request is required, if so
|
||||
* send final GET request and return result from operation. If no final GET
|
||||
* is required, just return the result from operation.
|
||||
* - Determining what to call for final request is responsibility of each strategy
|
||||
* 2.2 If it is not terminal state, call the polling operation and go to step 1
|
||||
* - Determining what to call for polling is responsibility of each strategy
|
||||
* - Strategies will always use the latest URI for polling if provided otherwise
|
||||
* the last known one
|
||||
*/
|
||||
async update(options) {
|
||||
var _a, _b, _c;
|
||||
const state = this.state;
|
||||
let lastResponse = undefined;
|
||||
if (!state.isStarted) {
|
||||
const initializeState = createStateInitializer({
|
||||
state,
|
||||
requestPath: this.lro.requestPath,
|
||||
requestMethod: this.lro.requestMethod,
|
||||
lroResourceLocationConfig: this.lroResourceLocationConfig,
|
||||
processResult: this.processResult,
|
||||
});
|
||||
lastResponse = await this.lro.sendInitialRequest();
|
||||
initializeState(lastResponse);
|
||||
}
|
||||
if (!state.isCompleted) {
|
||||
const config = throwIfUndefined(state.config, {
|
||||
errorMessage: "Bad state: LRO mode is undefined. Check if the serialized state is well-formed.",
|
||||
});
|
||||
if (!this.poll) {
|
||||
this.poll = createPoll(this.lro);
|
||||
}
|
||||
if (!this.getLroStatusFromResponse) {
|
||||
const isDone = this.isDone;
|
||||
this.getLroStatusFromResponse = isDone
|
||||
? (response) => (Object.assign(Object.assign({}, response), { done: isDone(response.flatResponse, this.state) }))
|
||||
: createGetLroStatusFromResponse({
|
||||
lro: this.lro,
|
||||
info: config,
|
||||
state: this.state,
|
||||
});
|
||||
}
|
||||
const currentState = await this.poll(throwIfUndefined(config.pollingUrl), this.pollerConfig, this.getLroStatusFromResponse);
|
||||
if (currentState.done) {
|
||||
state.result = buildResult({
|
||||
response: currentState.flatResponse,
|
||||
state,
|
||||
processResult: this.processResult,
|
||||
});
|
||||
state.isCompleted = true;
|
||||
}
|
||||
else {
|
||||
this.poll = (_a = currentState.next) !== null && _a !== void 0 ? _a : this.poll;
|
||||
updatePollingUrl({
|
||||
rawResponse: currentState.rawResponse,
|
||||
info: config,
|
||||
});
|
||||
/** for backward compatability */
|
||||
state.pollingURL = config.pollingUrl;
|
||||
}
|
||||
lastResponse = currentState;
|
||||
}
|
||||
if (lastResponse) {
|
||||
(_b = this.updateState) === null || _b === void 0 ? void 0 : _b.call(this, state, lastResponse === null || lastResponse === void 0 ? void 0 : lastResponse.rawResponse);
|
||||
}
|
||||
else {
|
||||
logger.error(`LRO: no response was received`);
|
||||
}
|
||||
(_c = options === null || options === void 0 ? void 0 : options.fireProgress) === null || _c === void 0 ? void 0 : _c.call(options, state);
|
||||
return this;
|
||||
}
|
||||
async cancel() {
|
||||
logger.error("`cancelOperation` is deprecated because it wasn't implemented");
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Serializes the Poller operation.
|
||||
*/
|
||||
toString() {
|
||||
return JSON.stringify({
|
||||
state: this.state,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
function deserializeState(serializedState) {
|
||||
try {
|
||||
return JSON.parse(serializedState).state;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`LroEngine: Unable to deserialize state: ${serializedState}`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The LRO Engine, a class that performs polling.
|
||||
*/
|
||||
class LroEngine extends Poller {
|
||||
constructor(lro, options) {
|
||||
const { intervalInMs = 2000, resumeFrom } = options || {};
|
||||
const { intervalInMs = POLL_INTERVAL_IN_MS, resumeFrom } = options || {};
|
||||
const state = resumeFrom
|
||||
? deserializeState(resumeFrom)
|
||||
: {};
|
||||
|
|
@ -103486,6 +104038,7 @@ exports.LroEngine = LroEngine;
|
|||
exports.Poller = Poller;
|
||||
exports.PollerCancelledError = PollerCancelledError;
|
||||
exports.PollerStoppedError = PollerStoppedError;
|
||||
exports.createHttpPoller = createHttpPoller;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
|
||||
|
|
@ -103595,7 +104148,7 @@ function runJob(iterator, key, item, callback)
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VERSION = void 0;
|
||||
// this is autogenerated file, see scripts/version-update.js
|
||||
exports.VERSION = '1.1.0';
|
||||
exports.VERSION = '1.2.0';
|
||||
//# sourceMappingURL=version.js.map
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -105891,6 +106444,7 @@ var util = __webpack_require__(669);
|
|||
var tslib = __webpack_require__(44);
|
||||
var xml2js = __webpack_require__(992);
|
||||
var abortController = __webpack_require__(819);
|
||||
var coreUtil = __webpack_require__(900);
|
||||
var logger$1 = __webpack_require__(492);
|
||||
var coreAuth = __webpack_require__(229);
|
||||
var os = __webpack_require__(87);
|
||||
|
|
@ -106119,7 +106673,7 @@ const Constants = {
|
|||
/**
|
||||
* The core-http version
|
||||
*/
|
||||
coreHttpVersion: "2.2.6",
|
||||
coreHttpVersion: "2.2.7",
|
||||
/**
|
||||
* Specifies HTTP.
|
||||
*/
|
||||
|
|
@ -109006,7 +109560,7 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, op
|
|||
parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
|
||||
}
|
||||
if (responseSpec.headersMapper) {
|
||||
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders", options);
|
||||
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.toJson(), "operationRes.parsedHeaders", options);
|
||||
}
|
||||
}
|
||||
return parsedResponse;
|
||||
|
|
@ -109072,7 +109626,7 @@ function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
|
|||
}
|
||||
// If error response has headers, try to deserialize it using default header mapper
|
||||
if (parsedResponse.headers && defaultHeadersMapper) {
|
||||
error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
|
||||
error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.toJson(), "operationRes.parsedHeaders");
|
||||
}
|
||||
}
|
||||
catch (defaultError) {
|
||||
|
|
@ -109273,17 +109827,6 @@ function updateRetryData(retryOptions, retryData = { retryCount: 0, retryInterva
|
|||
return retryData;
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Helper TypeGuard that checks if the value is not null or undefined.
|
||||
* @param thing - Anything
|
||||
* @internal
|
||||
*/
|
||||
function isDefined(thing) {
|
||||
return typeof thing !== "undefined" && thing !== null;
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
const StandardAbortMessage$1 = "The operation was aborted.";
|
||||
/**
|
||||
|
|
@ -109308,7 +109851,7 @@ function delay(delayInMs, value, options) {
|
|||
}
|
||||
};
|
||||
onAborted = () => {
|
||||
if (isDefined(timer)) {
|
||||
if (coreUtil.isDefined(timer)) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
removeListeners();
|
||||
|
|
|
|||
|
|
@ -2471,7 +2471,7 @@ class MemoryCookieStore extends Store {
|
|||
const results = [];
|
||||
if (typeof allowSpecialUseDomain === "function") {
|
||||
cb = allowSpecialUseDomain;
|
||||
allowSpecialUseDomain = false;
|
||||
allowSpecialUseDomain = true;
|
||||
}
|
||||
if (!domain) {
|
||||
return cb(null, []);
|
||||
|
|
@ -25534,7 +25534,7 @@ exports.CredentialsProviderError = CredentialsProviderError;
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.strictParseByte = exports.strictParseShort = exports.strictParseInt32 = exports.strictParseInt = exports.strictParseLong = exports.limitedParseFloat32 = exports.limitedParseFloat = exports.handleFloat = exports.limitedParseDouble = exports.strictParseFloat32 = exports.strictParseFloat = exports.strictParseDouble = exports.expectUnion = exports.expectString = exports.expectObject = exports.expectNonNull = exports.expectByte = exports.expectShort = exports.expectInt32 = exports.expectInt = exports.expectLong = exports.expectFloat32 = exports.expectNumber = exports.expectBoolean = exports.parseBoolean = void 0;
|
||||
exports.logger = exports.strictParseByte = exports.strictParseShort = exports.strictParseInt32 = exports.strictParseInt = exports.strictParseLong = exports.limitedParseFloat32 = exports.limitedParseFloat = exports.handleFloat = exports.limitedParseDouble = exports.strictParseFloat32 = exports.strictParseFloat = exports.strictParseDouble = exports.expectUnion = exports.expectString = exports.expectObject = exports.expectNonNull = exports.expectByte = exports.expectShort = exports.expectInt32 = exports.expectInt = exports.expectLong = exports.expectFloat32 = exports.expectNumber = exports.expectBoolean = exports.parseBoolean = void 0;
|
||||
const parseBoolean = (value) => {
|
||||
switch (value) {
|
||||
case "true":
|
||||
|
|
@ -25550,20 +25550,52 @@ const expectBoolean = (value) => {
|
|||
if (value === null || value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof value === "number") {
|
||||
if (value === 0 || value === 1) {
|
||||
exports.logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
|
||||
}
|
||||
if (value === 0) {
|
||||
return false;
|
||||
}
|
||||
if (value === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
const lower = value.toLowerCase();
|
||||
if (lower === "false" || lower === "true") {
|
||||
exports.logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
|
||||
}
|
||||
if (lower === "false") {
|
||||
return false;
|
||||
}
|
||||
if (lower === "true") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (typeof value === "boolean") {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected boolean, got ${typeof value}`);
|
||||
throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectBoolean = expectBoolean;
|
||||
const expectNumber = (value) => {
|
||||
if (value === null || value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
const parsed = parseFloat(value);
|
||||
if (!Number.isNaN(parsed)) {
|
||||
if (String(parsed) !== String(value)) {
|
||||
exports.logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
if (typeof value === "number") {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected number, got ${typeof value}`);
|
||||
throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectNumber = expectNumber;
|
||||
const MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
|
||||
|
|
@ -25584,7 +25616,7 @@ const expectLong = (value) => {
|
|||
if (Number.isInteger(value) && !Number.isNaN(value)) {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected integer, got ${typeof value}`);
|
||||
throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectLong = expectLong;
|
||||
exports.expectInt = exports.expectLong;
|
||||
|
|
@ -25628,7 +25660,8 @@ const expectObject = (value) => {
|
|||
if (typeof value === "object" && !Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected object, got ${typeof value}`);
|
||||
const receivedType = Array.isArray(value) ? "array" : typeof value;
|
||||
throw new TypeError(`Expected object, got ${receivedType}: ${value}`);
|
||||
};
|
||||
exports.expectObject = expectObject;
|
||||
const expectString = (value) => {
|
||||
|
|
@ -25638,7 +25671,11 @@ const expectString = (value) => {
|
|||
if (typeof value === "string") {
|
||||
return value;
|
||||
}
|
||||
throw new TypeError(`Expected string, got ${typeof value}`);
|
||||
if (["boolean", "number", "bigint"].includes(typeof value)) {
|
||||
exports.logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
|
||||
return String(value);
|
||||
}
|
||||
throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
|
||||
};
|
||||
exports.expectString = expectString;
|
||||
const expectUnion = (value) => {
|
||||
|
|
@ -25647,10 +25684,10 @@ const expectUnion = (value) => {
|
|||
}
|
||||
const asObject = (0, exports.expectObject)(value);
|
||||
const setKeys = Object.entries(asObject)
|
||||
.filter(([_, v]) => v !== null && v !== undefined)
|
||||
.map(([k, _]) => k);
|
||||
.filter(([, v]) => v != null)
|
||||
.map(([k]) => k);
|
||||
if (setKeys.length === 0) {
|
||||
throw new TypeError(`Unions must have exactly one non-null member`);
|
||||
throw new TypeError(`Unions must have exactly one non-null member. None were found.`);
|
||||
}
|
||||
if (setKeys.length > 1) {
|
||||
throw new TypeError(`Unions must have exactly one non-null member. Keys ${setKeys} were not null.`);
|
||||
|
|
@ -25738,6 +25775,16 @@ const strictParseByte = (value) => {
|
|||
return (0, exports.expectByte)(value);
|
||||
};
|
||||
exports.strictParseByte = strictParseByte;
|
||||
const stackTraceWarning = (message) => {
|
||||
return String(new TypeError(message).stack || message)
|
||||
.split("\n")
|
||||
.slice(0, 5)
|
||||
.filter((s) => !s.includes("stackTraceWarning"))
|
||||
.join("\n");
|
||||
};
|
||||
exports.logger = {
|
||||
warn: console.warn,
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -28106,22 +28153,25 @@ const SPECIAL_USE_DOMAINS = [
|
|||
"test"
|
||||
];
|
||||
|
||||
const SPECIAL_TREATMENT_DOMAINS = ["localhost", "invalid"];
|
||||
|
||||
function getPublicSuffix(domain, options = {}) {
|
||||
const domainParts = domain.split(".");
|
||||
const topLevelDomain = domainParts[domainParts.length - 1];
|
||||
const allowSpecialUseDomain = !!options.allowSpecialUseDomain;
|
||||
const ignoreError = !!options.ignoreError;
|
||||
|
||||
if (
|
||||
allowSpecialUseDomain &&
|
||||
domainParts.length > 1 &&
|
||||
SPECIAL_USE_DOMAINS.includes(topLevelDomain)
|
||||
) {
|
||||
// If the right-most label in the name is a special-use domain (e.g. bananas.apple.localhost),
|
||||
// then don't use PSL. This is because most special-use domains are not listed on PSL.
|
||||
const secondLevelDomain = domainParts[domainParts.length - 2];
|
||||
// In aforementioned example, the eTLD/pubSuf will be apple.localhost
|
||||
return `${secondLevelDomain}.${topLevelDomain}`;
|
||||
if (allowSpecialUseDomain && SPECIAL_USE_DOMAINS.includes(topLevelDomain)) {
|
||||
if (domainParts.length > 1) {
|
||||
const secondLevelDomain = domainParts[domainParts.length - 2];
|
||||
// In aforementioned example, the eTLD/pubSuf will be apple.localhost
|
||||
return `${secondLevelDomain}.${topLevelDomain}`;
|
||||
} else if (SPECIAL_TREATMENT_DOMAINS.includes(topLevelDomain)) {
|
||||
// For a single word special use domain, e.g. 'localhost' or 'invalid', per RFC 6761,
|
||||
// "Application software MAY recognize {localhost/invalid} names as special, or
|
||||
// MAY pass them to name resolution APIs as they would for other domain names."
|
||||
return `${topLevelDomain}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignoreError && SPECIAL_USE_DOMAINS.includes(topLevelDomain)) {
|
||||
|
|
@ -29655,9 +29705,10 @@ var __createBinding;
|
|||
* limitations under the License.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getSpanContext = exports.setSpanContext = exports.deleteSpan = exports.setSpan = exports.getSpan = void 0;
|
||||
exports.getSpanContext = exports.setSpanContext = exports.deleteSpan = exports.setSpan = exports.getActiveSpan = exports.getSpan = void 0;
|
||||
var context_1 = __webpack_require__(132);
|
||||
var NonRecordingSpan_1 = __webpack_require__(437);
|
||||
var context_2 = __webpack_require__(189);
|
||||
/**
|
||||
* span key
|
||||
*/
|
||||
|
|
@ -29671,6 +29722,13 @@ function getSpan(context) {
|
|||
return context.getValue(SPAN_KEY) || undefined;
|
||||
}
|
||||
exports.getSpan = getSpan;
|
||||
/**
|
||||
* Gets the span from the current context, if one exists.
|
||||
*/
|
||||
function getActiveSpan() {
|
||||
return getSpan(context_2.ContextAPI.getInstance().active());
|
||||
}
|
||||
exports.getActiveSpan = getActiveSpan;
|
||||
/**
|
||||
* Set the span on a context
|
||||
*
|
||||
|
|
@ -29768,7 +29826,7 @@ exports.getTransformedHeaders = getTransformedHeaders;
|
|||
/***/ (function(module) {
|
||||
|
||||
// generated by genversion
|
||||
module.exports = '4.1.0'
|
||||
module.exports = '4.1.2'
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -78207,7 +78265,10 @@ class CookieJar {
|
|||
validators.validate(validators.isObject(options), options);
|
||||
this.rejectPublicSuffixes = options.rejectPublicSuffixes;
|
||||
this.enableLooseMode = !!options.looseMode;
|
||||
this.allowSpecialUseDomain = !!options.allowSpecialUseDomain;
|
||||
this.allowSpecialUseDomain =
|
||||
typeof options.allowSpecialUseDomain === "boolean"
|
||||
? options.allowSpecialUseDomain
|
||||
: true;
|
||||
this.store = store || new MemoryCookieStore();
|
||||
this.prefixSecurity = getNormalizedPrefixSecurity(options.prefixSecurity);
|
||||
this._cloneSync = syncWrap("clone");
|
||||
|
|
@ -80971,6 +81032,7 @@ exports.AssumeRoleWithWebIdentityCommand = AssumeRoleWithWebIdentityCommand;
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SamplingDecision = void 0;
|
||||
/**
|
||||
* @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
|
||||
* A sampling decision that determines how a {@link Span} will be recorded
|
||||
* and collected.
|
||||
*/
|
||||
|
|
@ -96905,7 +96967,179 @@ exports.GetBucketEncryptionCommand = GetBucketEncryptionCommand;
|
|||
|
||||
|
||||
/***/ }),
|
||||
/* 900 */,
|
||||
/* 900 */
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var crypto = __webpack_require__(417);
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
var _a;
|
||||
/**
|
||||
* A constant that indicates whether the environment the code is running is Node.JS.
|
||||
*/
|
||||
const isNode = typeof process !== "undefined" && Boolean(process.version) && Boolean((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
|
||||
* @param timeInMs - The number of milliseconds to be delayed.
|
||||
* @returns Promise that is resolved after timeInMs
|
||||
*/
|
||||
function delay(timeInMs) {
|
||||
return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Returns a random integer value between a lower and upper bound,
|
||||
* inclusive of both bounds.
|
||||
* Note that this uses Math.random and isn't secure. If you need to use
|
||||
* this for any kind of security purpose, find a better source of random.
|
||||
* @param min - The smallest integer value allowed.
|
||||
* @param max - The largest integer value allowed.
|
||||
*/
|
||||
function getRandomIntegerInclusive(min, max) {
|
||||
// Make sure inputs are integers.
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
// Pick a random offset from zero to the size of the range.
|
||||
// Since Math.random() can never return 1, we have to make the range one larger
|
||||
// in order to be inclusive of the maximum value after we take the floor.
|
||||
const offset = Math.floor(Math.random() * (max - min + 1));
|
||||
return offset + min;
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Helper to determine when an input is a generic JS object.
|
||||
* @returns true when input is an object type that is not null, Array, RegExp, or Date.
|
||||
*/
|
||||
function isObject(input) {
|
||||
return (typeof input === "object" &&
|
||||
input !== null &&
|
||||
!Array.isArray(input) &&
|
||||
!(input instanceof RegExp) &&
|
||||
!(input instanceof Date));
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* Typeguard for an error object shape (has name and message)
|
||||
* @param e - Something caught by a catch clause.
|
||||
*/
|
||||
function isError(e) {
|
||||
if (isObject(e)) {
|
||||
const hasName = typeof e.name === "string";
|
||||
const hasMessage = typeof e.message === "string";
|
||||
return hasName && hasMessage;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Given what is thought to be an error object, return the message if possible.
|
||||
* If the message is missing, returns a stringified version of the input.
|
||||
* @param e - Something thrown from a try block
|
||||
* @returns The error message or a string of the input
|
||||
*/
|
||||
function getErrorMessage(e) {
|
||||
if (isError(e)) {
|
||||
return e.message;
|
||||
}
|
||||
else {
|
||||
let stringified;
|
||||
try {
|
||||
if (typeof e === "object" && e) {
|
||||
stringified = JSON.stringify(e);
|
||||
}
|
||||
else {
|
||||
stringified = String(e);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
stringified = "[unable to stringify input]";
|
||||
}
|
||||
return `Unknown error ${stringified}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* Generates a SHA-256 HMAC signature.
|
||||
* @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash.
|
||||
* @param stringToSign - The data to be signed.
|
||||
* @param encoding - The textual encoding to use for the returned HMAC digest.
|
||||
*/
|
||||
async function computeSha256Hmac(key, stringToSign, encoding) {
|
||||
const decodedKey = Buffer.from(key, "base64");
|
||||
return crypto.createHmac("sha256", decodedKey).update(stringToSign).digest(encoding);
|
||||
}
|
||||
/**
|
||||
* Generates a SHA-256 hash.
|
||||
* @param content - The data to be included in the hash.
|
||||
* @param encoding - The textual encoding to use for the returned hash.
|
||||
*/
|
||||
async function computeSha256Hash(content, encoding) {
|
||||
return crypto.createHash("sha256").update(content).digest(encoding);
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Helper TypeGuard that checks if something is defined or not.
|
||||
* @param thing - Anything
|
||||
*/
|
||||
function isDefined(thing) {
|
||||
return typeof thing !== "undefined" && thing !== null;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified properties.
|
||||
* @param thing - Anything.
|
||||
* @param properties - The name of the properties that should appear in the object.
|
||||
*/
|
||||
function isObjectWithProperties(thing, properties) {
|
||||
if (!isDefined(thing) || typeof thing !== "object") {
|
||||
return false;
|
||||
}
|
||||
for (const property of properties) {
|
||||
if (!objectHasProperty(thing, property)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Helper TypeGuard that checks if the input is an object with the specified property.
|
||||
* @param thing - Any object.
|
||||
* @param property - The name of the property that should appear in the object.
|
||||
*/
|
||||
function objectHasProperty(thing, property) {
|
||||
return (isDefined(thing) && typeof thing === "object" && property in thing);
|
||||
}
|
||||
|
||||
exports.computeSha256Hash = computeSha256Hash;
|
||||
exports.computeSha256Hmac = computeSha256Hmac;
|
||||
exports.delay = delay;
|
||||
exports.getErrorMessage = getErrorMessage;
|
||||
exports.getRandomIntegerInclusive = getRandomIntegerInclusive;
|
||||
exports.isDefined = isDefined;
|
||||
exports.isError = isError;
|
||||
exports.isNode = isNode;
|
||||
exports.isObject = isObject;
|
||||
exports.isObjectWithProperties = isObjectWithProperties;
|
||||
exports.objectHasProperty = objectHasProperty;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
|
||||
/***/ }),
|
||||
/* 901 */,
|
||||
/* 902 */
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
|
@ -97612,6 +97846,7 @@ var TraceAPI = /** @class */ (function () {
|
|||
this.isSpanContextValid = spancontext_utils_1.isSpanContextValid;
|
||||
this.deleteSpan = context_utils_1.deleteSpan;
|
||||
this.getSpan = context_utils_1.getSpan;
|
||||
this.getActiveSpan = context_utils_1.getActiveSpan;
|
||||
this.getSpanContext = context_utils_1.getSpanContext;
|
||||
this.setSpan = context_utils_1.setSpan;
|
||||
this.setSpanContext = context_utils_1.setSpanContext;
|
||||
|
|
@ -102687,6 +102922,702 @@ function getASCIIEncoder(obj) {
|
|||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var logger$1 = __webpack_require__(492);
|
||||
var abortController = __webpack_require__(819);
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* The `@azure/logger` configuration for this package.
|
||||
* @internal
|
||||
*/
|
||||
const logger = logger$1.createClientLogger("core-lro");
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* The default time interval to wait before sending the next polling request.
|
||||
*/
|
||||
const POLL_INTERVAL_IN_MS = 2000;
|
||||
/**
|
||||
* The closed set of terminal states.
|
||||
*/
|
||||
const terminalStates = ["succeeded", "canceled", "failed"];
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* Deserializes the state
|
||||
*/
|
||||
function deserializeState(serializedState) {
|
||||
try {
|
||||
return JSON.parse(serializedState).state;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Unable to deserialize input state: ${serializedState}`);
|
||||
}
|
||||
}
|
||||
function setStateError(inputs) {
|
||||
const { state, stateProxy } = inputs;
|
||||
return (error) => {
|
||||
stateProxy.setError(state, error);
|
||||
stateProxy.setFailed(state);
|
||||
throw error;
|
||||
};
|
||||
}
|
||||
function processOperationStatus(result) {
|
||||
const { state, stateProxy, status } = result;
|
||||
logger.verbose(`LRO: Status:\n\tPolling from: ${state.config.operationLocation}\n\tOperation status: ${status}\n\tPolling status: ${terminalStates.includes(status) ? "Stopped" : "Running"}`);
|
||||
switch (status) {
|
||||
case "succeeded": {
|
||||
stateProxy.setSucceeded(state);
|
||||
break;
|
||||
}
|
||||
case "failed": {
|
||||
stateProxy.setError(state, new Error(`The long-running operation has failed`));
|
||||
stateProxy.setFailed(state);
|
||||
break;
|
||||
}
|
||||
case "canceled": {
|
||||
stateProxy.setCanceled(state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function buildResult(inputs) {
|
||||
const { processResult, response, state } = inputs;
|
||||
return processResult ? processResult(response, state) : response;
|
||||
}
|
||||
/**
|
||||
* Initiates the long-running operation.
|
||||
*/
|
||||
async function initOperation(inputs) {
|
||||
const { init, stateProxy, processResult, getOperationStatus, withOperationLocation } = inputs;
|
||||
const { operationLocation, resourceLocation, metadata, response } = await init();
|
||||
if (operationLocation)
|
||||
withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(operationLocation, false);
|
||||
const config = {
|
||||
metadata,
|
||||
operationLocation,
|
||||
resourceLocation,
|
||||
};
|
||||
logger.verbose(`LRO: Operation description:`, config);
|
||||
const state = stateProxy.initState(config);
|
||||
const status = getOperationStatus(response, state);
|
||||
if (status === "succeeded" || operationLocation === undefined) {
|
||||
stateProxy.setSucceeded(state);
|
||||
stateProxy.setResult(state, buildResult({
|
||||
response,
|
||||
state,
|
||||
processResult,
|
||||
}));
|
||||
}
|
||||
return state;
|
||||
}
|
||||
async function pollOperationHelper(inputs) {
|
||||
const { poll, state, stateProxy, operationLocation, getOperationStatus, getResourceLocation, options, } = inputs;
|
||||
const response = await poll(operationLocation, options).catch(setStateError({
|
||||
state,
|
||||
stateProxy,
|
||||
}));
|
||||
const status = getOperationStatus(response, state);
|
||||
processOperationStatus({
|
||||
status,
|
||||
state,
|
||||
stateProxy,
|
||||
});
|
||||
if (status === "succeeded") {
|
||||
const resourceLocation = getResourceLocation(response, state);
|
||||
if (resourceLocation !== undefined) {
|
||||
return {
|
||||
response: await poll(resourceLocation).catch(setStateError({ state, stateProxy })),
|
||||
status,
|
||||
};
|
||||
}
|
||||
}
|
||||
return { response, status };
|
||||
}
|
||||
/** Polls the long-running operation. */
|
||||
async function pollOperation(inputs) {
|
||||
const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, withOperationLocation, getPollingInterval, processResult, updateState, setDelay, isDone, } = inputs;
|
||||
const { operationLocation } = state.config;
|
||||
if (operationLocation !== undefined) {
|
||||
const { response, status } = await pollOperationHelper({
|
||||
poll,
|
||||
getOperationStatus,
|
||||
state,
|
||||
stateProxy,
|
||||
operationLocation,
|
||||
getResourceLocation,
|
||||
options,
|
||||
});
|
||||
if ((isDone === null || isDone === void 0 ? void 0 : isDone(response, state)) ||
|
||||
(isDone === undefined && ["succeeded", "canceled"].includes(status))) {
|
||||
stateProxy.setResult(state, buildResult({
|
||||
response,
|
||||
state,
|
||||
processResult,
|
||||
}));
|
||||
}
|
||||
else {
|
||||
const intervalInMs = getPollingInterval === null || getPollingInterval === void 0 ? void 0 : getPollingInterval(response);
|
||||
if (intervalInMs)
|
||||
setDelay(intervalInMs);
|
||||
const location = getOperationLocation === null || getOperationLocation === void 0 ? void 0 : getOperationLocation(response, state);
|
||||
if (location !== undefined) {
|
||||
const isUpdated = operationLocation !== location;
|
||||
state.config.operationLocation = location;
|
||||
withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(location, isUpdated);
|
||||
}
|
||||
else
|
||||
withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(operationLocation, false);
|
||||
}
|
||||
updateState === null || updateState === void 0 ? void 0 : updateState(state, response);
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
function getOperationLocationPollingUrl(inputs) {
|
||||
const { azureAsyncOperation, operationLocation } = inputs;
|
||||
return operationLocation !== null && operationLocation !== void 0 ? operationLocation : azureAsyncOperation;
|
||||
}
|
||||
function getLocationHeader(rawResponse) {
|
||||
return rawResponse.headers["location"];
|
||||
}
|
||||
function getOperationLocationHeader(rawResponse) {
|
||||
return rawResponse.headers["operation-location"];
|
||||
}
|
||||
function getAzureAsyncOperationHeader(rawResponse) {
|
||||
return rawResponse.headers["azure-asyncoperation"];
|
||||
}
|
||||
function findResourceLocation(inputs) {
|
||||
const { location, requestMethod, requestPath, resourceLocationConfig } = inputs;
|
||||
switch (requestMethod) {
|
||||
case "PUT": {
|
||||
return requestPath;
|
||||
}
|
||||
case "DELETE": {
|
||||
return undefined;
|
||||
}
|
||||
default: {
|
||||
switch (resourceLocationConfig) {
|
||||
case "azure-async-operation": {
|
||||
return undefined;
|
||||
}
|
||||
case "original-uri": {
|
||||
return requestPath;
|
||||
}
|
||||
case "location":
|
||||
default: {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function inferLroMode(inputs) {
|
||||
const { rawResponse, requestMethod, requestPath, resourceLocationConfig } = inputs;
|
||||
const operationLocation = getOperationLocationHeader(rawResponse);
|
||||
const azureAsyncOperation = getAzureAsyncOperationHeader(rawResponse);
|
||||
const pollingUrl = getOperationLocationPollingUrl({ operationLocation, azureAsyncOperation });
|
||||
const location = getLocationHeader(rawResponse);
|
||||
const normalizedRequestMethod = requestMethod === null || requestMethod === void 0 ? void 0 : requestMethod.toLocaleUpperCase();
|
||||
if (pollingUrl !== undefined) {
|
||||
return {
|
||||
mode: "OperationLocation",
|
||||
operationLocation: pollingUrl,
|
||||
resourceLocation: findResourceLocation({
|
||||
requestMethod: normalizedRequestMethod,
|
||||
location,
|
||||
requestPath,
|
||||
resourceLocationConfig,
|
||||
}),
|
||||
};
|
||||
}
|
||||
else if (location !== undefined) {
|
||||
return {
|
||||
mode: "ResourceLocation",
|
||||
operationLocation: location,
|
||||
};
|
||||
}
|
||||
else if (normalizedRequestMethod === "PUT" && requestPath) {
|
||||
return {
|
||||
mode: "Body",
|
||||
operationLocation: requestPath,
|
||||
};
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function transformStatus(status) {
|
||||
switch (status === null || status === void 0 ? void 0 : status.toLowerCase()) {
|
||||
case undefined:
|
||||
case "succeeded":
|
||||
return "succeeded";
|
||||
case "failed":
|
||||
return "failed";
|
||||
case "running":
|
||||
case "accepted":
|
||||
case "canceling":
|
||||
case "cancelling":
|
||||
return "running";
|
||||
case "canceled":
|
||||
case "cancelled":
|
||||
return "canceled";
|
||||
default: {
|
||||
logger.warning(`LRO: unrecognized operation status: ${status}`);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getStatus(rawResponse) {
|
||||
var _a;
|
||||
const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
|
||||
return transformStatus(status);
|
||||
}
|
||||
function getProvisioningState(rawResponse) {
|
||||
var _a, _b;
|
||||
const { properties, provisioningState } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
|
||||
const state = (_b = properties === null || properties === void 0 ? void 0 : properties.provisioningState) !== null && _b !== void 0 ? _b : provisioningState;
|
||||
return transformStatus(state);
|
||||
}
|
||||
function toOperationStatus(statusCode) {
|
||||
if (statusCode === 202) {
|
||||
return "running";
|
||||
}
|
||||
else if (statusCode < 300) {
|
||||
return "succeeded";
|
||||
}
|
||||
else {
|
||||
return "failed";
|
||||
}
|
||||
}
|
||||
function parseRetryAfter({ rawResponse }) {
|
||||
const retryAfter = rawResponse.headers["retry-after"];
|
||||
if (retryAfter !== undefined) {
|
||||
// Retry-After header value is either in HTTP date format, or in seconds
|
||||
const retryAfterInSeconds = parseInt(retryAfter);
|
||||
return isNaN(retryAfterInSeconds)
|
||||
? calculatePollingIntervalFromDate(new Date(retryAfter))
|
||||
: retryAfterInSeconds * 1000;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function calculatePollingIntervalFromDate(retryAfterDate) {
|
||||
const timeNow = Math.floor(new Date().getTime());
|
||||
const retryAfterTime = retryAfterDate.getTime();
|
||||
if (timeNow < retryAfterTime) {
|
||||
return retryAfterTime - timeNow;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Initiates the long-running operation.
|
||||
*/
|
||||
async function initHttpOperation(inputs) {
|
||||
const { stateProxy, resourceLocationConfig, processResult, lro } = inputs;
|
||||
return initOperation({
|
||||
init: async () => {
|
||||
const response = await lro.sendInitialRequest();
|
||||
const config = inferLroMode({
|
||||
rawResponse: response.rawResponse,
|
||||
requestPath: lro.requestPath,
|
||||
requestMethod: lro.requestMethod,
|
||||
resourceLocationConfig,
|
||||
});
|
||||
return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {}));
|
||||
},
|
||||
stateProxy,
|
||||
processResult: processResult
|
||||
? ({ flatResponse }, state) => processResult(flatResponse, state)
|
||||
: ({ flatResponse }) => flatResponse,
|
||||
getOperationStatus: (response, state) => {
|
||||
var _a;
|
||||
const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"];
|
||||
return mode === undefined ||
|
||||
(mode === "Body" && getOperationStatus(response, state) === "succeeded")
|
||||
? "succeeded"
|
||||
: "running";
|
||||
},
|
||||
});
|
||||
}
|
||||
function getOperationLocation({ rawResponse }, state) {
|
||||
var _a;
|
||||
const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"];
|
||||
switch (mode) {
|
||||
case "OperationLocation": {
|
||||
return getOperationLocationPollingUrl({
|
||||
operationLocation: getOperationLocationHeader(rawResponse),
|
||||
azureAsyncOperation: getAzureAsyncOperationHeader(rawResponse),
|
||||
});
|
||||
}
|
||||
case "ResourceLocation": {
|
||||
return getLocationHeader(rawResponse);
|
||||
}
|
||||
case "Body":
|
||||
default: {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getOperationStatus({ rawResponse }, state) {
|
||||
var _a;
|
||||
const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"];
|
||||
switch (mode) {
|
||||
case "OperationLocation": {
|
||||
return getStatus(rawResponse);
|
||||
}
|
||||
case "ResourceLocation": {
|
||||
return toOperationStatus(rawResponse.statusCode);
|
||||
}
|
||||
case "Body": {
|
||||
return getProvisioningState(rawResponse);
|
||||
}
|
||||
default:
|
||||
throw new Error(`Unexpected operation mode: ${mode}`);
|
||||
}
|
||||
}
|
||||
function getResourceLocation({ flatResponse }, state) {
|
||||
if (typeof flatResponse === "object") {
|
||||
const resourceLocation = flatResponse.resourceLocation;
|
||||
if (resourceLocation !== undefined) {
|
||||
state.config.resourceLocation = resourceLocation;
|
||||
}
|
||||
}
|
||||
return state.config.resourceLocation;
|
||||
}
|
||||
/** Polls the long-running operation. */
|
||||
async function pollHttpOperation(inputs) {
|
||||
const { lro, stateProxy, options, processResult, updateState, setDelay, state } = inputs;
|
||||
return pollOperation({
|
||||
state,
|
||||
stateProxy,
|
||||
setDelay,
|
||||
processResult: processResult
|
||||
? ({ flatResponse }, inputState) => processResult(flatResponse, inputState)
|
||||
: ({ flatResponse }) => flatResponse,
|
||||
updateState,
|
||||
getPollingInterval: parseRetryAfter,
|
||||
getOperationLocation,
|
||||
getOperationStatus,
|
||||
getResourceLocation,
|
||||
options,
|
||||
/**
|
||||
* The expansion here is intentional because `lro` could be an object that
|
||||
* references an inner this, so we need to preserve a reference to it.
|
||||
*/
|
||||
poll: async (location, inputOptions) => lro.sendPollRequest(location, inputOptions),
|
||||
});
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Map an optional value through a function
|
||||
* @internal
|
||||
*/
|
||||
const maybemap = (value, f) => value === undefined ? undefined : f(value);
|
||||
const INTERRUPTED = new Error("The poller is already stopped");
|
||||
/**
|
||||
* A promise that delays resolution until a certain amount of time (in milliseconds) has passed, with facilities for
|
||||
* robust cancellation.
|
||||
*
|
||||
* ### Example:
|
||||
*
|
||||
* ```javascript
|
||||
* let toCancel;
|
||||
*
|
||||
* // Wait 20 seconds, and optionally allow the function to be cancelled.
|
||||
* await delayMs(20000, (cancel) => { toCancel = cancel });
|
||||
*
|
||||
* // ... if `toCancel` is called before the 20 second timer expires, then the delayMs promise will reject.
|
||||
* ```
|
||||
*
|
||||
* @internal
|
||||
* @param ms - the number of milliseconds to wait before resolving
|
||||
* @param cb - a callback that can provide the caller with a cancellation function
|
||||
*/
|
||||
function delayMs(ms) {
|
||||
let aborted = false;
|
||||
let toReject;
|
||||
return Object.assign(new Promise((resolve, reject) => {
|
||||
let token;
|
||||
toReject = () => {
|
||||
maybemap(token, clearTimeout);
|
||||
reject(INTERRUPTED);
|
||||
};
|
||||
// In the rare case that the operation is _already_ aborted, we will reject instantly. This could happen, for
|
||||
// example, if the user calls the cancellation function immediately without yielding execution.
|
||||
if (aborted) {
|
||||
toReject();
|
||||
}
|
||||
else {
|
||||
token = setTimeout(resolve, ms);
|
||||
}
|
||||
}), {
|
||||
cancel: () => {
|
||||
aborted = true;
|
||||
toReject === null || toReject === void 0 ? void 0 : toReject();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
const createStateProxy$1 = () => ({
|
||||
/**
|
||||
* The state at this point is created to be of type OperationState<TResult>.
|
||||
* It will be updated later to be of type TState when the
|
||||
* customer-provided callback, `updateState`, is called during polling.
|
||||
*/
|
||||
initState: (config) => ({ status: "running", config }),
|
||||
setCanceled: (state) => (state.status = "canceled"),
|
||||
setError: (state, error) => (state.error = error),
|
||||
setResult: (state, result) => (state.result = result),
|
||||
setRunning: (state) => (state.status = "running"),
|
||||
setSucceeded: (state) => (state.status = "succeeded"),
|
||||
setFailed: (state) => (state.status = "failed"),
|
||||
getError: (state) => state.error,
|
||||
getResult: (state) => state.result,
|
||||
isCanceled: (state) => state.status === "canceled",
|
||||
isFailed: (state) => state.status === "failed",
|
||||
isRunning: (state) => state.status === "running",
|
||||
isSucceeded: (state) => state.status === "succeeded",
|
||||
});
|
||||
/**
|
||||
* Returns a poller factory.
|
||||
*/
|
||||
function buildCreatePoller(inputs) {
|
||||
const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, getResourceLocation, getPollingInterval, } = inputs;
|
||||
return async ({ init, poll }, options) => {
|
||||
const { processResult, updateState, withOperationLocation: withOperationLocationCallback, intervalInMs = POLL_INTERVAL_IN_MS, restoreFrom, } = options || {};
|
||||
const stateProxy = createStateProxy$1();
|
||||
const withOperationLocation = withOperationLocationCallback
|
||||
? (() => {
|
||||
let called = false;
|
||||
return (operationLocation, isUpdated) => {
|
||||
if (isUpdated)
|
||||
withOperationLocationCallback(operationLocation);
|
||||
else if (!called)
|
||||
withOperationLocationCallback(operationLocation);
|
||||
called = true;
|
||||
};
|
||||
})()
|
||||
: undefined;
|
||||
const state = restoreFrom
|
||||
? deserializeState(restoreFrom)
|
||||
: await initOperation({
|
||||
init,
|
||||
stateProxy,
|
||||
processResult,
|
||||
getOperationStatus: getStatusFromInitialResponse,
|
||||
withOperationLocation,
|
||||
});
|
||||
let resultPromise;
|
||||
let cancelJob;
|
||||
const abortController$1 = new abortController.AbortController();
|
||||
const handlers = new Map();
|
||||
const handleProgressEvents = async () => handlers.forEach((h) => h(state));
|
||||
let currentPollIntervalInMs = intervalInMs;
|
||||
const poller = {
|
||||
getOperationState: () => state,
|
||||
getResult: () => state.result,
|
||||
isDone: () => ["succeeded", "failed", "canceled"].includes(state.status),
|
||||
isStopped: () => resultPromise === undefined,
|
||||
stopPolling: () => {
|
||||
abortController$1.abort();
|
||||
cancelJob === null || cancelJob === void 0 ? void 0 : cancelJob();
|
||||
},
|
||||
toString: () => JSON.stringify({
|
||||
state,
|
||||
}),
|
||||
onProgress: (callback) => {
|
||||
const s = Symbol();
|
||||
handlers.set(s, callback);
|
||||
return () => handlers.delete(s);
|
||||
},
|
||||
pollUntilDone: (pollOptions) => (resultPromise !== null && resultPromise !== void 0 ? resultPromise : (resultPromise = (async () => {
|
||||
const { abortSignal: inputAbortSignal } = pollOptions || {};
|
||||
const { signal: abortSignal } = inputAbortSignal
|
||||
? new abortController.AbortController([inputAbortSignal, abortController$1.signal])
|
||||
: abortController$1;
|
||||
if (!poller.isDone()) {
|
||||
await poller.poll({ abortSignal });
|
||||
while (!poller.isDone()) {
|
||||
const delay = delayMs(currentPollIntervalInMs);
|
||||
cancelJob = delay.cancel;
|
||||
await delay;
|
||||
await poller.poll({ abortSignal });
|
||||
}
|
||||
}
|
||||
switch (state.status) {
|
||||
case "succeeded": {
|
||||
return poller.getResult();
|
||||
}
|
||||
case "canceled": {
|
||||
throw new Error("Operation was canceled");
|
||||
}
|
||||
case "failed": {
|
||||
throw state.error;
|
||||
}
|
||||
case "notStarted":
|
||||
case "running": {
|
||||
// Unreachable
|
||||
throw new Error(`polling completed without succeeding or failing`);
|
||||
}
|
||||
}
|
||||
})().finally(() => {
|
||||
resultPromise = undefined;
|
||||
}))),
|
||||
async poll(pollOptions) {
|
||||
await pollOperation({
|
||||
poll,
|
||||
state,
|
||||
stateProxy,
|
||||
getOperationLocation,
|
||||
withOperationLocation,
|
||||
getPollingInterval,
|
||||
getOperationStatus: getStatusFromPollResponse,
|
||||
getResourceLocation,
|
||||
processResult,
|
||||
updateState,
|
||||
options: pollOptions,
|
||||
setDelay: (pollIntervalInMs) => {
|
||||
currentPollIntervalInMs = pollIntervalInMs;
|
||||
},
|
||||
});
|
||||
await handleProgressEvents();
|
||||
if (state.status === "canceled") {
|
||||
throw new Error("Operation was canceled");
|
||||
}
|
||||
if (state.status === "failed") {
|
||||
throw state.error;
|
||||
}
|
||||
},
|
||||
};
|
||||
return poller;
|
||||
};
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* Creates a poller that can be used to poll a long-running operation.
|
||||
* @param lro - Description of the long-running operation
|
||||
* @param options - options to configure the poller
|
||||
* @returns an initialized poller
|
||||
*/
|
||||
async function createHttpPoller(lro, options) {
|
||||
const { resourceLocationConfig, intervalInMs, processResult, restoreFrom, updateState, withOperationLocation, } = options || {};
|
||||
return buildCreatePoller({
|
||||
getStatusFromInitialResponse: (response, state) => {
|
||||
var _a;
|
||||
const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"];
|
||||
return mode === undefined ||
|
||||
(mode === "Body" && getOperationStatus(response, state) === "succeeded")
|
||||
? "succeeded"
|
||||
: "running";
|
||||
},
|
||||
getStatusFromPollResponse: getOperationStatus,
|
||||
getOperationLocation,
|
||||
getResourceLocation,
|
||||
getPollingInterval: parseRetryAfter,
|
||||
})({
|
||||
init: async () => {
|
||||
const response = await lro.sendInitialRequest();
|
||||
const config = inferLroMode({
|
||||
rawResponse: response.rawResponse,
|
||||
requestPath: lro.requestPath,
|
||||
requestMethod: lro.requestMethod,
|
||||
resourceLocationConfig,
|
||||
});
|
||||
return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {}));
|
||||
},
|
||||
poll: lro.sendPollRequest,
|
||||
}, {
|
||||
intervalInMs,
|
||||
withOperationLocation,
|
||||
restoreFrom,
|
||||
updateState,
|
||||
processResult: processResult
|
||||
? ({ flatResponse }, state) => processResult(flatResponse, state)
|
||||
: ({ flatResponse }) => flatResponse,
|
||||
});
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
const createStateProxy = () => ({
|
||||
initState: (config) => ({ config, isStarted: true }),
|
||||
setCanceled: (state) => (state.isCancelled = true),
|
||||
setError: (state, error) => (state.error = error),
|
||||
setResult: (state, result) => (state.result = result),
|
||||
setRunning: (state) => (state.isStarted = true),
|
||||
setSucceeded: (state) => (state.isCompleted = true),
|
||||
setFailed: () => {
|
||||
/** empty body */
|
||||
},
|
||||
getError: (state) => state.error,
|
||||
getResult: (state) => state.result,
|
||||
isCanceled: (state) => !!state.isCancelled,
|
||||
isFailed: (state) => !!state.error,
|
||||
isRunning: (state) => !!state.isStarted,
|
||||
isSucceeded: (state) => Boolean(state.isCompleted && !state.isCancelled && !state.error),
|
||||
});
|
||||
class GenericPollOperation {
|
||||
constructor(state, lro, lroResourceLocationConfig, processResult, updateState, isDone) {
|
||||
this.state = state;
|
||||
this.lro = lro;
|
||||
this.lroResourceLocationConfig = lroResourceLocationConfig;
|
||||
this.processResult = processResult;
|
||||
this.updateState = updateState;
|
||||
this.isDone = isDone;
|
||||
}
|
||||
setPollerConfig(pollerConfig) {
|
||||
this.pollerConfig = pollerConfig;
|
||||
}
|
||||
async update(options) {
|
||||
var _a;
|
||||
const stateProxy = createStateProxy();
|
||||
if (!this.state.isStarted) {
|
||||
this.state = Object.assign(Object.assign({}, this.state), (await initHttpOperation({
|
||||
lro: this.lro,
|
||||
stateProxy,
|
||||
resourceLocationConfig: this.lroResourceLocationConfig,
|
||||
processResult: this.processResult,
|
||||
})));
|
||||
}
|
||||
const updateState = this.updateState;
|
||||
const isDone = this.isDone;
|
||||
if (!this.state.isCompleted) {
|
||||
await pollHttpOperation({
|
||||
lro: this.lro,
|
||||
state: this.state,
|
||||
stateProxy,
|
||||
processResult: this.processResult,
|
||||
updateState: updateState
|
||||
? (state, { rawResponse }) => updateState(state, rawResponse)
|
||||
: undefined,
|
||||
isDone: isDone
|
||||
? ({ flatResponse }, state) => isDone(flatResponse, state)
|
||||
: undefined,
|
||||
options,
|
||||
setDelay: (intervalInMs) => {
|
||||
this.pollerConfig.intervalInMs = intervalInMs;
|
||||
},
|
||||
});
|
||||
}
|
||||
(_a = options === null || options === void 0 ? void 0 : options.fireProgress) === null || _a === void 0 ? void 0 : _a.call(options, this.state);
|
||||
return this;
|
||||
}
|
||||
async cancel() {
|
||||
logger.error("`cancelOperation` is deprecated because it wasn't implemented");
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Serializes the Poller operation.
|
||||
*/
|
||||
toString() {
|
||||
return JSON.stringify({
|
||||
state: this.state,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
|
@ -102859,12 +103790,12 @@ class Poller {
|
|||
* Starts a loop that will break only if the poller is done
|
||||
* or if the poller is stopped.
|
||||
*/
|
||||
async startPolling() {
|
||||
async startPolling(pollOptions = {}) {
|
||||
if (this.stopped) {
|
||||
this.stopped = false;
|
||||
}
|
||||
while (!this.isStopped() && !this.isDone()) {
|
||||
await this.poll();
|
||||
await this.poll(pollOptions);
|
||||
await this.delay();
|
||||
}
|
||||
}
|
||||
|
|
@ -102935,7 +103866,7 @@ class Poller {
|
|||
}
|
||||
if (this.operation.state.isCancelled) {
|
||||
this.stopped = true;
|
||||
const error = new PollerCancelledError("Poller cancelled");
|
||||
const error = new PollerCancelledError("Operation was canceled");
|
||||
this.reject(error);
|
||||
throw error;
|
||||
}
|
||||
|
|
@ -102951,9 +103882,9 @@ class Poller {
|
|||
/**
|
||||
* Returns a promise that will resolve once the underlying operation is completed.
|
||||
*/
|
||||
async pollUntilDone() {
|
||||
async pollUntilDone(pollOptions = {}) {
|
||||
if (this.stopped) {
|
||||
this.startPolling().catch(this.reject);
|
||||
this.startPolling(pollOptions).catch(this.reject);
|
||||
}
|
||||
// This is needed because the state could have been updated by
|
||||
// `cancelOperation`, e.g. the operation is canceled or an error occurred.
|
||||
|
|
@ -103085,391 +104016,12 @@ class Poller {
|
|||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
/**
|
||||
* The `@azure/logger` configuration for this package.
|
||||
* @internal
|
||||
*/
|
||||
const logger = logger$1.createClientLogger("core-lro");
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
function throwIfUndefined(input, options = {}) {
|
||||
var _a;
|
||||
if (input === undefined) {
|
||||
throw new Error((_a = options.errorMessage) !== null && _a !== void 0 ? _a : "undefined variable");
|
||||
}
|
||||
return input;
|
||||
}
|
||||
function updatePollingUrl(inputs) {
|
||||
var _a, _b;
|
||||
const { info, rawResponse } = inputs;
|
||||
switch (info.mode) {
|
||||
case "OperationLocation": {
|
||||
const operationLocation = getOperationLocation(rawResponse);
|
||||
const azureAsyncOperation = getAzureAsyncOperation(rawResponse);
|
||||
info.pollingUrl =
|
||||
(_a = getOperationLocationPollingUrl({ operationLocation, azureAsyncOperation })) !== null && _a !== void 0 ? _a : throwIfUndefined(info.pollingUrl);
|
||||
break;
|
||||
}
|
||||
case "ResourceLocation": {
|
||||
info.pollingUrl = (_b = getLocation(rawResponse)) !== null && _b !== void 0 ? _b : throwIfUndefined(info.pollingUrl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getOperationLocationPollingUrl(inputs) {
|
||||
const { azureAsyncOperation, operationLocation } = inputs;
|
||||
return operationLocation !== null && operationLocation !== void 0 ? operationLocation : azureAsyncOperation;
|
||||
}
|
||||
function getLocation(rawResponse) {
|
||||
return rawResponse.headers["location"];
|
||||
}
|
||||
function getOperationLocation(rawResponse) {
|
||||
return rawResponse.headers["operation-location"];
|
||||
}
|
||||
function getAzureAsyncOperation(rawResponse) {
|
||||
return rawResponse.headers["azure-asyncoperation"];
|
||||
}
|
||||
function findResourceLocation(inputs) {
|
||||
const { location, requestMethod, requestPath, lroResourceLocationConfig } = inputs;
|
||||
switch (requestMethod) {
|
||||
case "PUT": {
|
||||
return requestPath;
|
||||
}
|
||||
case "DELETE": {
|
||||
return undefined;
|
||||
}
|
||||
default: {
|
||||
switch (lroResourceLocationConfig) {
|
||||
case "azure-async-operation": {
|
||||
return undefined;
|
||||
}
|
||||
case "original-uri": {
|
||||
return requestPath;
|
||||
}
|
||||
case "location":
|
||||
default: {
|
||||
return location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function inferLroMode(inputs) {
|
||||
const { rawResponse, requestMethod, requestPath, lroResourceLocationConfig } = inputs;
|
||||
const operationLocation = getOperationLocation(rawResponse);
|
||||
const azureAsyncOperation = getAzureAsyncOperation(rawResponse);
|
||||
const location = getLocation(rawResponse);
|
||||
if (operationLocation !== undefined || azureAsyncOperation !== undefined) {
|
||||
return {
|
||||
mode: "OperationLocation",
|
||||
pollingUrl: operationLocation !== null && operationLocation !== void 0 ? operationLocation : azureAsyncOperation,
|
||||
resourceLocation: findResourceLocation({
|
||||
requestMethod,
|
||||
location,
|
||||
requestPath,
|
||||
lroResourceLocationConfig,
|
||||
}),
|
||||
};
|
||||
}
|
||||
else if (location !== undefined) {
|
||||
return {
|
||||
mode: "ResourceLocation",
|
||||
pollingUrl: location,
|
||||
};
|
||||
}
|
||||
else if (requestMethod === "PUT") {
|
||||
return {
|
||||
mode: "Body",
|
||||
pollingUrl: requestPath,
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
mode: "None",
|
||||
};
|
||||
}
|
||||
}
|
||||
class SimpleRestError extends Error {
|
||||
constructor(message, statusCode) {
|
||||
super(message);
|
||||
this.name = "RestError";
|
||||
this.statusCode = statusCode;
|
||||
Object.setPrototypeOf(this, SimpleRestError.prototype);
|
||||
}
|
||||
}
|
||||
function throwIfError(rawResponse) {
|
||||
const code = rawResponse.statusCode;
|
||||
if (code >= 400) {
|
||||
throw new SimpleRestError(`Received unexpected HTTP status code ${code} while polling. This may indicate a server issue.`, code);
|
||||
}
|
||||
}
|
||||
function getStatus(rawResponse) {
|
||||
var _a;
|
||||
const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
|
||||
return typeof status === "string" ? status.toLowerCase() : "succeeded";
|
||||
}
|
||||
function getProvisioningState(rawResponse) {
|
||||
var _a, _b;
|
||||
const { properties, provisioningState } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
|
||||
const state = (_b = properties === null || properties === void 0 ? void 0 : properties.provisioningState) !== null && _b !== void 0 ? _b : provisioningState;
|
||||
return typeof state === "string" ? state.toLowerCase() : "succeeded";
|
||||
}
|
||||
function isCanceled(operation) {
|
||||
const { state, operationStatus } = operation;
|
||||
if (["canceled", "cancelled"].includes(operationStatus)) {
|
||||
state.isCancelled = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isTerminal(operation) {
|
||||
const { state, operationStatus } = operation;
|
||||
if (operationStatus === "failed") {
|
||||
throw new Error(`The long-running operation has failed.`);
|
||||
}
|
||||
return operationStatus === "succeeded" || isCanceled({ state, operationStatus });
|
||||
}
|
||||
function getOperationStatus(result) {
|
||||
const { rawResponse, state, info, responseKind = "Polling" } = result;
|
||||
throwIfError(rawResponse);
|
||||
switch (info.mode) {
|
||||
case "OperationLocation": {
|
||||
const operationStatus = getStatus(rawResponse);
|
||||
return {
|
||||
operationStatus,
|
||||
shouldStopPolling: responseKind === "Polling" && isTerminal({ state, operationStatus }),
|
||||
};
|
||||
}
|
||||
case "Body": {
|
||||
const operationStatus = getProvisioningState(rawResponse);
|
||||
return {
|
||||
operationStatus,
|
||||
shouldStopPolling: isTerminal({ state, operationStatus }),
|
||||
};
|
||||
}
|
||||
case "ResourceLocation": {
|
||||
const operationStatus = rawResponse.statusCode;
|
||||
return {
|
||||
operationStatus,
|
||||
shouldStopPolling: responseKind === "Polling" && operationStatus !== 202,
|
||||
};
|
||||
}
|
||||
case "None": {
|
||||
return {
|
||||
shouldStopPolling: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
function shouldStopPolling(result) {
|
||||
const { rawResponse, state, info, responseKind = "Polling" } = result;
|
||||
const { shouldStopPolling: isPollingStopped, operationStatus } = getOperationStatus({
|
||||
info,
|
||||
rawResponse,
|
||||
state,
|
||||
responseKind,
|
||||
});
|
||||
if (operationStatus) {
|
||||
logger.verbose(`LRO: Status:\n\tPolling from: ${info.pollingUrl}\n\tOperation status: ${operationStatus}\n\tPolling status: ${isPollingStopped ? "Stopped" : "Running"}`);
|
||||
}
|
||||
else {
|
||||
logger.verbose(`LRO: Status: Not an LRO`);
|
||||
}
|
||||
return isPollingStopped;
|
||||
}
|
||||
/**
|
||||
* Creates a polling operation.
|
||||
*/
|
||||
function createPoll(lroPrimitives) {
|
||||
return async (path, pollerConfig, getLroStatusFromResponse) => {
|
||||
const response = await lroPrimitives.sendPollRequest(path);
|
||||
const retryAfter = response.rawResponse.headers["retry-after"];
|
||||
if (retryAfter !== undefined) {
|
||||
// Retry-After header value is either in HTTP date format, or in seconds
|
||||
const retryAfterInSeconds = parseInt(retryAfter);
|
||||
pollerConfig.intervalInMs = isNaN(retryAfterInSeconds)
|
||||
? calculatePollingIntervalFromDate(new Date(retryAfter), pollerConfig.intervalInMs)
|
||||
: retryAfterInSeconds * 1000;
|
||||
}
|
||||
return getLroStatusFromResponse(response);
|
||||
};
|
||||
}
|
||||
function calculatePollingIntervalFromDate(retryAfterDate, defaultIntervalInMs) {
|
||||
const timeNow = Math.floor(new Date().getTime());
|
||||
const retryAfterTime = retryAfterDate.getTime();
|
||||
if (timeNow < retryAfterTime) {
|
||||
return retryAfterTime - timeNow;
|
||||
}
|
||||
return defaultIntervalInMs;
|
||||
}
|
||||
function buildResult(inputs) {
|
||||
const { processResult, response, state } = inputs;
|
||||
return processResult ? processResult(response, state) : response;
|
||||
}
|
||||
/**
|
||||
* Creates a callback to be used to initialize the polling operation state.
|
||||
*/
|
||||
function createStateInitializer(inputs) {
|
||||
const { requestMethod, requestPath, state, lroResourceLocationConfig, processResult } = inputs;
|
||||
return (response) => {
|
||||
const { rawResponse } = response;
|
||||
state.isStarted = true;
|
||||
state.config = inferLroMode({
|
||||
rawResponse,
|
||||
requestPath,
|
||||
requestMethod,
|
||||
lroResourceLocationConfig,
|
||||
});
|
||||
logger.verbose(`LRO: Operation description:`, state.config);
|
||||
/** short circuit before polling */
|
||||
if (shouldStopPolling({
|
||||
rawResponse,
|
||||
state,
|
||||
info: state.config,
|
||||
responseKind: "Initial",
|
||||
})) {
|
||||
state.result = buildResult({
|
||||
response: response.flatResponse,
|
||||
state: state,
|
||||
processResult,
|
||||
});
|
||||
state.isCompleted = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
function createGetLroStatusFromResponse(inputs) {
|
||||
const { lro, state, info } = inputs;
|
||||
const location = info.resourceLocation;
|
||||
return (response) => {
|
||||
const isTerminalStatus = shouldStopPolling({
|
||||
info,
|
||||
rawResponse: response.rawResponse,
|
||||
state,
|
||||
});
|
||||
return Object.assign(Object.assign({}, response), { done: isTerminalStatus && !location, next: !(isTerminalStatus && location)
|
||||
? undefined
|
||||
: () => lro.sendPollRequest(location).then((res) => (Object.assign(Object.assign({}, res), { done: true }))) });
|
||||
};
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
class GenericPollOperation {
|
||||
constructor(state, lro, lroResourceLocationConfig, processResult, updateState, isDone) {
|
||||
this.state = state;
|
||||
this.lro = lro;
|
||||
this.lroResourceLocationConfig = lroResourceLocationConfig;
|
||||
this.processResult = processResult;
|
||||
this.updateState = updateState;
|
||||
this.isDone = isDone;
|
||||
}
|
||||
setPollerConfig(pollerConfig) {
|
||||
this.pollerConfig = pollerConfig;
|
||||
}
|
||||
/**
|
||||
* General update function for LROPoller, the general process is as follows
|
||||
* 1. Check initial operation result to determine the strategy to use
|
||||
* - Strategies: Location, Azure-AsyncOperation, Original Uri
|
||||
* 2. Check if the operation result has a terminal state
|
||||
* - Terminal state will be determined by each strategy
|
||||
* 2.1 If it is terminal state Check if a final GET request is required, if so
|
||||
* send final GET request and return result from operation. If no final GET
|
||||
* is required, just return the result from operation.
|
||||
* - Determining what to call for final request is responsibility of each strategy
|
||||
* 2.2 If it is not terminal state, call the polling operation and go to step 1
|
||||
* - Determining what to call for polling is responsibility of each strategy
|
||||
* - Strategies will always use the latest URI for polling if provided otherwise
|
||||
* the last known one
|
||||
*/
|
||||
async update(options) {
|
||||
var _a, _b, _c;
|
||||
const state = this.state;
|
||||
let lastResponse = undefined;
|
||||
if (!state.isStarted) {
|
||||
const initializeState = createStateInitializer({
|
||||
state,
|
||||
requestPath: this.lro.requestPath,
|
||||
requestMethod: this.lro.requestMethod,
|
||||
lroResourceLocationConfig: this.lroResourceLocationConfig,
|
||||
processResult: this.processResult,
|
||||
});
|
||||
lastResponse = await this.lro.sendInitialRequest();
|
||||
initializeState(lastResponse);
|
||||
}
|
||||
if (!state.isCompleted) {
|
||||
const config = throwIfUndefined(state.config, {
|
||||
errorMessage: "Bad state: LRO mode is undefined. Check if the serialized state is well-formed.",
|
||||
});
|
||||
if (!this.poll) {
|
||||
this.poll = createPoll(this.lro);
|
||||
}
|
||||
if (!this.getLroStatusFromResponse) {
|
||||
const isDone = this.isDone;
|
||||
this.getLroStatusFromResponse = isDone
|
||||
? (response) => (Object.assign(Object.assign({}, response), { done: isDone(response.flatResponse, this.state) }))
|
||||
: createGetLroStatusFromResponse({
|
||||
lro: this.lro,
|
||||
info: config,
|
||||
state: this.state,
|
||||
});
|
||||
}
|
||||
const currentState = await this.poll(throwIfUndefined(config.pollingUrl), this.pollerConfig, this.getLroStatusFromResponse);
|
||||
if (currentState.done) {
|
||||
state.result = buildResult({
|
||||
response: currentState.flatResponse,
|
||||
state,
|
||||
processResult: this.processResult,
|
||||
});
|
||||
state.isCompleted = true;
|
||||
}
|
||||
else {
|
||||
this.poll = (_a = currentState.next) !== null && _a !== void 0 ? _a : this.poll;
|
||||
updatePollingUrl({
|
||||
rawResponse: currentState.rawResponse,
|
||||
info: config,
|
||||
});
|
||||
/** for backward compatability */
|
||||
state.pollingURL = config.pollingUrl;
|
||||
}
|
||||
lastResponse = currentState;
|
||||
}
|
||||
if (lastResponse) {
|
||||
(_b = this.updateState) === null || _b === void 0 ? void 0 : _b.call(this, state, lastResponse === null || lastResponse === void 0 ? void 0 : lastResponse.rawResponse);
|
||||
}
|
||||
else {
|
||||
logger.error(`LRO: no response was received`);
|
||||
}
|
||||
(_c = options === null || options === void 0 ? void 0 : options.fireProgress) === null || _c === void 0 ? void 0 : _c.call(options, state);
|
||||
return this;
|
||||
}
|
||||
async cancel() {
|
||||
logger.error("`cancelOperation` is deprecated because it wasn't implemented");
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Serializes the Poller operation.
|
||||
*/
|
||||
toString() {
|
||||
return JSON.stringify({
|
||||
state: this.state,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
function deserializeState(serializedState) {
|
||||
try {
|
||||
return JSON.parse(serializedState).state;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`LroEngine: Unable to deserialize state: ${serializedState}`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The LRO Engine, a class that performs polling.
|
||||
*/
|
||||
class LroEngine extends Poller {
|
||||
constructor(lro, options) {
|
||||
const { intervalInMs = 2000, resumeFrom } = options || {};
|
||||
const { intervalInMs = POLL_INTERVAL_IN_MS, resumeFrom } = options || {};
|
||||
const state = resumeFrom
|
||||
? deserializeState(resumeFrom)
|
||||
: {};
|
||||
|
|
@ -103490,6 +104042,7 @@ exports.LroEngine = LroEngine;
|
|||
exports.Poller = Poller;
|
||||
exports.PollerCancelledError = PollerCancelledError;
|
||||
exports.PollerStoppedError = PollerStoppedError;
|
||||
exports.createHttpPoller = createHttpPoller;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
|
||||
|
|
@ -103599,7 +104152,7 @@ function runJob(iterator, key, item, callback)
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VERSION = void 0;
|
||||
// this is autogenerated file, see scripts/version-update.js
|
||||
exports.VERSION = '1.1.0';
|
||||
exports.VERSION = '1.2.0';
|
||||
//# sourceMappingURL=version.js.map
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -105895,6 +106448,7 @@ var util = __webpack_require__(669);
|
|||
var tslib = __webpack_require__(44);
|
||||
var xml2js = __webpack_require__(992);
|
||||
var abortController = __webpack_require__(819);
|
||||
var coreUtil = __webpack_require__(900);
|
||||
var logger$1 = __webpack_require__(492);
|
||||
var coreAuth = __webpack_require__(229);
|
||||
var os = __webpack_require__(87);
|
||||
|
|
@ -106123,7 +106677,7 @@ const Constants = {
|
|||
/**
|
||||
* The core-http version
|
||||
*/
|
||||
coreHttpVersion: "2.2.6",
|
||||
coreHttpVersion: "2.2.7",
|
||||
/**
|
||||
* Specifies HTTP.
|
||||
*/
|
||||
|
|
@ -109010,7 +109564,7 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, op
|
|||
parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
|
||||
}
|
||||
if (responseSpec.headersMapper) {
|
||||
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders", options);
|
||||
parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.toJson(), "operationRes.parsedHeaders", options);
|
||||
}
|
||||
}
|
||||
return parsedResponse;
|
||||
|
|
@ -109076,7 +109630,7 @@ function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
|
|||
}
|
||||
// If error response has headers, try to deserialize it using default header mapper
|
||||
if (parsedResponse.headers && defaultHeadersMapper) {
|
||||
error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
|
||||
error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.toJson(), "operationRes.parsedHeaders");
|
||||
}
|
||||
}
|
||||
catch (defaultError) {
|
||||
|
|
@ -109277,17 +109831,6 @@ function updateRetryData(retryOptions, retryData = { retryCount: 0, retryInterva
|
|||
return retryData;
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
/**
|
||||
* Helper TypeGuard that checks if the value is not null or undefined.
|
||||
* @param thing - Anything
|
||||
* @internal
|
||||
*/
|
||||
function isDefined(thing) {
|
||||
return typeof thing !== "undefined" && thing !== null;
|
||||
}
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
const StandardAbortMessage$1 = "The operation was aborted.";
|
||||
/**
|
||||
|
|
@ -109312,7 +109855,7 @@ function delay(delayInMs, value, options) {
|
|||
}
|
||||
};
|
||||
onAborted = () => {
|
||||
if (isDefined(timer)) {
|
||||
if (coreUtil.isDefined(timer)) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
removeListeners();
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/cache": {
|
||||
"version": "https://gitpkg.now.sh/whywaita/toolkit/packages/cache?feat/support-prefixmatch",
|
||||
"integrity": "sha512-oeO9Hu+0E0Od+MW3t4CdVvMkz4QfYQKf8Sl+cbscdzjv40j5CUdU6kD3uM57T3n0wgSYSSYumKPntXTDCecYcw==",
|
||||
"version": "https://gitpkg.now.sh/whywaita/toolkit/packages/cache?0dcc12b18a1f353a46b14188aa30a2c28c57ae74",
|
||||
"integrity": "sha512-hXhzsmjlEF4j1iEc7FP+I7JV8kxzrItvdW1JD0cc1snnFFapcHa1v0DQ5VBGNA7uY17oZLZtmQSISw2D3rOnYw==",
|
||||
"requires": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.1",
|
||||
|
|
@ -681,11 +681,11 @@
|
|||
}
|
||||
},
|
||||
"@aws-sdk/lib-storage": {
|
||||
"version": "3.154.0",
|
||||
"resolved": "https://registry.npmjs.org/@aws-sdk/lib-storage/-/lib-storage-3.154.0.tgz",
|
||||
"integrity": "sha512-P4OiUM8LQjQquUHhJxzpIYKikNvSDfxz27gWO0YBk2DhSTmatdARntvGtjB6lWzQObsa1aOm7oHR6tHdOkJeiw==",
|
||||
"version": "3.168.0",
|
||||
"resolved": "https://registry.npmjs.org/@aws-sdk/lib-storage/-/lib-storage-3.168.0.tgz",
|
||||
"integrity": "sha512-nLJb7ZzjYGSAuRlNkNwVtOPPcIcNdTlQJlH7p4K0eGDmVtrBogfcLsq3FtzwVozE1j3VTCdfiiB5AIPVMM67OA==",
|
||||
"requires": {
|
||||
"@aws-sdk/smithy-client": "3.142.0",
|
||||
"@aws-sdk/smithy-client": "3.168.0",
|
||||
"buffer": "5.6.0",
|
||||
"events": "3.3.0",
|
||||
"stream-browserify": "3.0.0",
|
||||
|
|
@ -693,27 +693,27 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/middleware-stack": {
|
||||
"version": "3.127.0",
|
||||
"resolved": "https://registry.npmjs.org/@aws-sdk/middleware-stack/-/middleware-stack-3.127.0.tgz",
|
||||
"integrity": "sha512-S1IoUE5o1vCmjsF5nIE8zlItNOM1UE+lhmZeigF7knXJ9+a6ewMB6POAj/s4eoi0wcn0eSnAGsqJCWMSUjOPLA==",
|
||||
"version": "3.168.0",
|
||||
"resolved": "https://registry.npmjs.org/@aws-sdk/middleware-stack/-/middleware-stack-3.168.0.tgz",
|
||||
"integrity": "sha512-tUMa6gQFqyRC9xRy1cfQAX/K84LkFC+NAyENoDn4cbLvTJpH6tLPINFktaXLkKl2bdzGGWLHefxriBjTqZB+rg==",
|
||||
"requires": {
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"@aws-sdk/smithy-client": {
|
||||
"version": "3.142.0",
|
||||
"resolved": "https://registry.npmjs.org/@aws-sdk/smithy-client/-/smithy-client-3.142.0.tgz",
|
||||
"integrity": "sha512-G38YWTfSFZb5cOH6IwLct530Uy8pnmJvJFeC1pd1nkKD4PRZb+bI2w4xXSX+znYdLA71RYK620OtVKJlB44PtA==",
|
||||
"version": "3.168.0",
|
||||
"resolved": "https://registry.npmjs.org/@aws-sdk/smithy-client/-/smithy-client-3.168.0.tgz",
|
||||
"integrity": "sha512-B2wuTg5ymTYA7eVkt73bdRlWNWvdWNRY3QQizTWn0Ch3nOZXyVZSdH4mGmuWcpiQXEX/YYGmTLY7nCKWrk1E6Q==",
|
||||
"requires": {
|
||||
"@aws-sdk/middleware-stack": "3.127.0",
|
||||
"@aws-sdk/types": "3.127.0",
|
||||
"@aws-sdk/middleware-stack": "3.168.0",
|
||||
"@aws-sdk/types": "3.168.0",
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"@aws-sdk/types": {
|
||||
"version": "3.127.0",
|
||||
"resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.127.0.tgz",
|
||||
"integrity": "sha512-e0wtx2IkOl7rwfKfLH5pPTzQ+d45V7b1WrjeL0WDI8kOu6w+sXmhNxI6uM2kf0k4NiTLN84lW290AEWupey9Og=="
|
||||
"version": "3.168.0",
|
||||
"resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.168.0.tgz",
|
||||
"integrity": "sha512-J9VmQAakmqrdYKt3N0T/zQR6ZkfvQ7Y3WufjEWRTdslYcQ9f7UyI93Q21baCHvgcp3E5c4w62x18o6mEA/cHPQ=="
|
||||
},
|
||||
"tslib": {
|
||||
"version": "2.4.0",
|
||||
|
|
@ -1539,13 +1539,14 @@
|
|||
}
|
||||
},
|
||||
"@azure/core-http": {
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.6.tgz",
|
||||
"integrity": "sha512-Lx7A3k2JIXpIbixfUaOOG79WNSo/Y7dhZ0LaLhaayyZ6PwQdVsEQXAR+oIPqPSfgPzv7RtwPSVviJ2APrsQKvQ==",
|
||||
"version": "2.2.7",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.7.tgz",
|
||||
"integrity": "sha512-TyGMeDm90mkRS8XzSQbSMD+TqnWL1XKGCh0x0QVGMD8COH2yU0q5SaHm/IBEBkzcq0u73NhS/p57T3KVSgUFqQ==",
|
||||
"requires": {
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"@azure/core-auth": "^1.3.0",
|
||||
"@azure/core-tracing": "1.0.0-preview.13",
|
||||
"@azure/core-util": "^1.1.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
"@types/node-fetch": "^2.5.0",
|
||||
"@types/tunnel": "^0.0.3",
|
||||
|
|
@ -1570,9 +1571,9 @@
|
|||
}
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.0.tgz",
|
||||
"integrity": "sha512-IVX6AagLelGwl6F0E+hoRpXzuD192cZhAcmT7/eoLr0PnsB1wv2E5c+A2O+V8xth9FlL2p0OstFsWn0bZpVn4w==",
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz",
|
||||
"integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==",
|
||||
"requires": {
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
|
|
@ -1598,9 +1599,9 @@
|
|||
}
|
||||
},
|
||||
"@azure/core-lro": {
|
||||
"version": "2.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.5.tgz",
|
||||
"integrity": "sha512-/7LKDHNd2Q6gGCrg7zV4va/N90w250pE4vaQUfFt+hTd/dyycgJWCqQ6EljQr8hrIFiH93C8Apk97tsnl7Czkg==",
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.3.1.tgz",
|
||||
"integrity": "sha512-nQ+Xnm9g1EWcmbqgxJGmkNHfOHRUmrbYIlRT4KjluzhHQooaGO55m/h6wCX0ho3Jte2ZNBzZPJRmi6yBWeb3yA==",
|
||||
"requires": {
|
||||
"@azure/abort-controller": "^1.0.0",
|
||||
"@azure/logger": "^1.0.0",
|
||||
|
|
@ -1645,6 +1646,21 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@azure/core-util": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.1.0.tgz",
|
||||
"integrity": "sha512-+i93lNJNA3Pl3KSuC6xKP2jTL4YFeDfO6VNOaYdk0cppZcLCxt811gS878VsqsCisaltdhl9lhMzK5kbxCiF4w==",
|
||||
"requires": {
|
||||
"tslib": "^2.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
|
||||
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@azure/logger": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.3.tgz",
|
||||
|
|
@ -3077,9 +3093,9 @@
|
|||
}
|
||||
},
|
||||
"@opentelemetry/api": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.1.0.tgz",
|
||||
"integrity": "sha512-hf+3bwuBwtXsugA2ULBc95qxrOqP2pOekLz34BJhcAKawt94vfeNyUKpYc0lZQ/3sCP6LqRa7UAdHA7i5UODzQ=="
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.2.0.tgz",
|
||||
"integrity": "sha512-0nBr+VZNKm9tvNDZFstI3Pq1fCTEDK5OZTnVKNvBNAKgd0yIvmwsP4m61rEv7ZP+tOUjWJhROpxK5MsnlF911g=="
|
||||
},
|
||||
"@sinonjs/commons": {
|
||||
"version": "1.8.3",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "https://gitpkg.now.sh/whywaita/toolkit/packages/cache?feat/support-prefixmatch",
|
||||
"@actions/cache": "https://gitpkg.now.sh/whywaita/toolkit/packages/cache?0dcc12b18a1f353a46b14188aa30a2c28c57ae74",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/io": "^1.1.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue