diff --git a/README.md b/README.md
index 1dda5eb..b174cab 100644
--- a/README.md
+++ b/README.md
@@ -142,6 +142,6 @@ git branch test
git checkout test
pnpm build
pnpm release
-git-commit -a -m "..."
+git commit -a -m "..."
git push origin test
```
diff --git a/dist/index.js b/dist/index.js
index 7a8ae11..79c2840 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1700,7 +1700,7 @@ const util = __importStar(__nccwpck_require__(9023));
const utils = __importStar(__nccwpck_require__(680));
const constants_1 = __nccwpck_require__(8287);
const requestUtils_1 = __nccwpck_require__(2846);
-const abort_controller_1 = __nccwpck_require__(9048);
+const abort_controller_1 = __nccwpck_require__(8110);
/**
* Pipes the body of a HTTP response to a stream
*
@@ -3102,253 +3102,6 @@ function getDownloadOptions(copy) {
exports.getDownloadOptions = getDownloadOptions;
//# sourceMappingURL=options.js.map
-/***/ }),
-
-/***/ 9048:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT license.
-///
-const listenersMap = new WeakMap();
-const abortedMap = new WeakMap();
-/**
- * An aborter instance implements AbortSignal interface, can abort HTTP requests.
- *
- * - Call AbortSignal.none to create a new AbortSignal instance that cannot be cancelled.
- * Use `AbortSignal.none` when you are required to pass a cancellation token but the operation
- * cannot or will not ever be cancelled.
- *
- * @example
- * Abort without timeout
- * ```ts
- * await doAsyncWork(AbortSignal.none);
- * ```
- */
-class AbortSignal {
- constructor() {
- /**
- * onabort event listener.
- */
- this.onabort = null;
- listenersMap.set(this, []);
- abortedMap.set(this, false);
- }
- /**
- * Status of whether aborted or not.
- *
- * @readonly
- */
- get aborted() {
- if (!abortedMap.has(this)) {
- throw new TypeError("Expected `this` to be an instance of AbortSignal.");
- }
- return abortedMap.get(this);
- }
- /**
- * Creates a new AbortSignal instance that will never be aborted.
- *
- * @readonly
- */
- static get none() {
- return new AbortSignal();
- }
- /**
- * Added new "abort" event listener, only support "abort" event.
- *
- * @param _type - Only support "abort" event
- * @param listener - The listener to be added
- */
- addEventListener(
- // tslint:disable-next-line:variable-name
- _type, listener) {
- if (!listenersMap.has(this)) {
- throw new TypeError("Expected `this` to be an instance of AbortSignal.");
- }
- const listeners = listenersMap.get(this);
- listeners.push(listener);
- }
- /**
- * Remove "abort" event listener, only support "abort" event.
- *
- * @param _type - Only support "abort" event
- * @param listener - The listener to be removed
- */
- removeEventListener(
- // tslint:disable-next-line:variable-name
- _type, listener) {
- if (!listenersMap.has(this)) {
- throw new TypeError("Expected `this` to be an instance of AbortSignal.");
- }
- const listeners = listenersMap.get(this);
- const index = listeners.indexOf(listener);
- if (index > -1) {
- listeners.splice(index, 1);
- }
- }
- /**
- * Dispatches a synthetic event to the AbortSignal.
- */
- dispatchEvent(_event) {
- throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes.");
- }
-}
-/**
- * Helper to trigger an abort event immediately, the onabort and all abort event listeners will be triggered.
- * Will try to trigger abort event for all linked AbortSignal nodes.
- *
- * - If there is a timeout, the timer will be cancelled.
- * - If aborted is true, nothing will happen.
- *
- * @internal
- */
-// eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
-function abortSignal(signal) {
- if (signal.aborted) {
- return;
- }
- if (signal.onabort) {
- signal.onabort.call(signal);
- }
- const listeners = listenersMap.get(signal);
- if (listeners) {
- // Create a copy of listeners so mutations to the array
- // (e.g. via removeListener calls) don't affect the listeners
- // we invoke.
- listeners.slice().forEach((listener) => {
- listener.call(signal, { type: "abort" });
- });
- }
- abortedMap.set(signal, true);
-}
-
-// Copyright (c) Microsoft Corporation.
-/**
- * This error is thrown when an asynchronous operation has been aborted.
- * Check for this error by testing the `name` that the name property of the
- * error matches `"AbortError"`.
- *
- * @example
- * ```ts
- * const controller = new AbortController();
- * controller.abort();
- * try {
- * doAsyncWork(controller.signal)
- * } catch (e) {
- * if (e.name === 'AbortError') {
- * // handle abort error here.
- * }
- * }
- * ```
- */
-class AbortError extends Error {
- constructor(message) {
- super(message);
- this.name = "AbortError";
- }
-}
-/**
- * An AbortController provides an AbortSignal and the associated controls to signal
- * that an asynchronous operation should be aborted.
- *
- * @example
- * Abort an operation when another event fires
- * ```ts
- * const controller = new AbortController();
- * const signal = controller.signal;
- * doAsyncWork(signal);
- * button.addEventListener('click', () => controller.abort());
- * ```
- *
- * @example
- * Share aborter cross multiple operations in 30s
- * ```ts
- * // Upload the same data to 2 different data centers at the same time,
- * // abort another when any of them is finished
- * const controller = AbortController.withTimeout(30 * 1000);
- * doAsyncWork(controller.signal).then(controller.abort);
- * doAsyncWork(controller.signal).then(controller.abort);
- *```
- *
- * @example
- * Cascaded aborting
- * ```ts
- * // All operations can't take more than 30 seconds
- * const aborter = Aborter.timeout(30 * 1000);
- *
- * // Following 2 operations can't take more than 25 seconds
- * await doAsyncWork(aborter.withTimeout(25 * 1000));
- * await doAsyncWork(aborter.withTimeout(25 * 1000));
- * ```
- */
-class AbortController {
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
- constructor(parentSignals) {
- this._signal = new AbortSignal();
- if (!parentSignals) {
- return;
- }
- // coerce parentSignals into an array
- if (!Array.isArray(parentSignals)) {
- // eslint-disable-next-line prefer-rest-params
- parentSignals = arguments;
- }
- for (const parentSignal of parentSignals) {
- // if the parent signal has already had abort() called,
- // then call abort on this signal as well.
- if (parentSignal.aborted) {
- this.abort();
- }
- else {
- // when the parent signal aborts, this signal should as well.
- parentSignal.addEventListener("abort", () => {
- this.abort();
- });
- }
- }
- }
- /**
- * The AbortSignal associated with this controller that will signal aborted
- * when the abort method is called on this controller.
- *
- * @readonly
- */
- get signal() {
- return this._signal;
- }
- /**
- * Signal that any operations passed this controller's associated abort signal
- * to cancel any remaining work and throw an `AbortError`.
- */
- abort() {
- abortSignal(this._signal);
- }
- /**
- * Creates a new AbortSignal instance that will abort after the provided ms.
- * @param ms - Elapsed time in milliseconds to trigger an abort.
- */
- static timeout(ms) {
- const signal = new AbortSignal();
- const timer = setTimeout(abortSignal, ms, signal);
- // Prevent the active Timer from keeping the Node.js event loop active.
- if (typeof timer.unref === "function") {
- timer.unref();
- }
- return signal;
- }
-}
-
-exports.AbortController = AbortController;
-exports.AbortError = AbortError;
-exports.AbortSignal = AbortSignal;
-//# sourceMappingURL=index.js.map
-
-
/***/ }),
/***/ 3272:
@@ -10192,11 +9945,8 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
// Max safe segment length for coercion.
var MAX_SAFE_COMPONENT_LENGTH = 16
-var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
-
// The actual regexps go on exports.re
var re = exports.re = []
-var safeRe = exports.safeRe = []
var src = exports.src = []
var t = exports.tokens = {}
var R = 0
@@ -10205,31 +9955,6 @@ function tok (n) {
t[n] = R++
}
-var LETTERDASHNUMBER = '[a-zA-Z0-9-]'
-
-// Replace some greedy regex tokens to prevent regex dos issues. These regex are
-// used internally via the safeRe object since all inputs in this library get
-// normalized first to trim and collapse all extra whitespace. The original
-// regexes are exported for userland consumption and lower level usage. A
-// future breaking change could export the safer regex only with a note that
-// all input should have extra whitespace removed.
-var safeRegexReplacements = [
- ['\\s', 1],
- ['\\d', MAX_LENGTH],
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
-]
-
-function makeSafeRe (value) {
- for (var i = 0; i < safeRegexReplacements.length; i++) {
- var token = safeRegexReplacements[i][0]
- var max = safeRegexReplacements[i][1]
- value = value
- .split(token + '*').join(token + '{0,' + max + '}')
- .split(token + '+').join(token + '{1,' + max + '}')
- }
- return value
-}
-
// The following Regular Expressions can be used for tokenizing,
// validating, and parsing SemVer version strings.
@@ -10239,14 +9964,14 @@ function makeSafeRe (value) {
tok('NUMERICIDENTIFIER')
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'
tok('NUMERICIDENTIFIERLOOSE')
-src[t.NUMERICIDENTIFIERLOOSE] = '\\d+'
+src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'
// ## Non-numeric Identifier
// Zero or more digits, followed by a letter or hyphen, and then zero or
// more letters, digits, or hyphens.
tok('NONNUMERICIDENTIFIER')
-src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*'
+src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
// ## Main Version
// Three dot-separated numeric identifiers.
@@ -10288,7 +10013,7 @@ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
// Any combination of digits, letters, or hyphens.
tok('BUILDIDENTIFIER')
-src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+'
+src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
// ## Build Metadata
// Plus sign, followed by one or more period-separated build metadata
@@ -10368,7 +10093,6 @@ src[t.COERCE] = '(^|[^\\d])' +
'(?:$|[^\\d])'
tok('COERCERTL')
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')
-safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g')
// Tilde ranges.
// Meaning is "reasonably at or greater than"
@@ -10378,7 +10102,6 @@ src[t.LONETILDE] = '(?:~>?)'
tok('TILDETRIM')
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')
-safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g')
var tildeTrimReplace = '$1~'
tok('TILDE')
@@ -10394,7 +10117,6 @@ src[t.LONECARET] = '(?:\\^)'
tok('CARETTRIM')
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')
-safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g')
var caretTrimReplace = '$1^'
tok('CARET')
@@ -10416,7 +10138,6 @@ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
// this one has to use the /g flag
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')
-safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g')
var comparatorTrimReplace = '$1$2$3'
// Something like `1.2.3 - 1.2.4`
@@ -10445,14 +10166,6 @@ for (var i = 0; i < R; i++) {
debug(i, src[i])
if (!re[i]) {
re[i] = new RegExp(src[i])
-
- // Replace all greedy whitespace to prevent regex dos issues. These regex are
- // used internally via the safeRe object since all inputs in this library get
- // normalized first to trim and collapse all extra whitespace. The original
- // regexes are exported for userland consumption and lower level usage. A
- // future breaking change could export the safer regex only with a note that
- // all input should have extra whitespace removed.
- safeRe[i] = new RegExp(makeSafeRe(src[i]))
}
}
@@ -10477,7 +10190,7 @@ function parse (version, options) {
return null
}
- var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]
+ var r = options.loose ? re[t.LOOSE] : re[t.FULL]
if (!r.test(version)) {
return null
}
@@ -10532,7 +10245,7 @@ function SemVer (version, options) {
this.options = options
this.loose = !!options.loose
- var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL])
+ var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
if (!m) {
throw new TypeError('Invalid Version: ' + version)
@@ -10977,7 +10690,6 @@ function Comparator (comp, options) {
return new Comparator(comp, options)
}
- comp = comp.trim().split(/\s+/).join(' ')
debug('comparator', comp, options)
this.options = options
this.loose = !!options.loose
@@ -10994,7 +10706,7 @@ function Comparator (comp, options) {
var ANY = {}
Comparator.prototype.parse = function (comp) {
- var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
+ var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
var m = comp.match(r)
if (!m) {
@@ -11118,16 +10830,9 @@ function Range (range, options) {
this.loose = !!options.loose
this.includePrerelease = !!options.includePrerelease
- // First reduce all whitespace as much as possible so we do not have to rely
- // on potentially slow regexes like \s*. This is then stored and used for
- // future error messages as well.
- this.raw = range
- .trim()
- .split(/\s+/)
- .join(' ')
-
// First, split based on boolean or ||
- this.set = this.raw.split('||').map(function (range) {
+ this.raw = range
+ this.set = range.split(/\s*\|\|\s*/).map(function (range) {
return this.parseRange(range.trim())
}, this).filter(function (c) {
// throw out any that are not relevant for whatever reason
@@ -11135,7 +10840,7 @@ function Range (range, options) {
})
if (!this.set.length) {
- throw new TypeError('Invalid SemVer Range: ' + this.raw)
+ throw new TypeError('Invalid SemVer Range: ' + range)
}
this.format()
@@ -11154,19 +10859,20 @@ Range.prototype.toString = function () {
Range.prototype.parseRange = function (range) {
var loose = this.options.loose
+ range = range.trim()
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
- var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE]
+ var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
range = range.replace(hr, hyphenReplace)
debug('hyphen replace', range)
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
- range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace)
- debug('comparator trim', range, safeRe[t.COMPARATORTRIM])
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
+ debug('comparator trim', range, re[t.COMPARATORTRIM])
// `~ 1.2.3` => `~1.2.3`
- range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace)
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
// `^ 1.2.3` => `^1.2.3`
- range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace)
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace)
// normalize spaces
range = range.split(/\s+/).join(' ')
@@ -11174,7 +10880,7 @@ Range.prototype.parseRange = function (range) {
// At this point, the range is completely trimmed and
// ready to be split into comparators.
- var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
+ var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
var set = range.split(' ').map(function (comp) {
return parseComparator(comp, this.options)
}, this).join(' ').split(/\s+/)
@@ -11274,7 +10980,7 @@ function replaceTildes (comp, options) {
}
function replaceTilde (comp, options) {
- var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE]
+ var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
return comp.replace(r, function (_, M, m, p, pr) {
debug('tilde', comp, _, M, m, p, pr)
var ret
@@ -11315,7 +11021,7 @@ function replaceCarets (comp, options) {
function replaceCaret (comp, options) {
debug('caret', comp, options)
- var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET]
+ var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
return comp.replace(r, function (_, M, m, p, pr) {
debug('caret', comp, _, M, m, p, pr)
var ret
@@ -11374,7 +11080,7 @@ function replaceXRanges (comp, options) {
function replaceXRange (comp, options) {
comp = comp.trim()
- var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE]
+ var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
debug('xRange', comp, ret, gtlt, M, m, p, pr)
var xM = isX(M)
@@ -11449,7 +11155,7 @@ function replaceXRange (comp, options) {
function replaceStars (comp, options) {
debug('replaceStars', comp, options)
// Looseness is ignored here. star is always as loose as it gets!
- return comp.trim().replace(safeRe[t.STAR], '')
+ return comp.trim().replace(re[t.STAR], '')
}
// This function is passed to string.replace(re[t.HYPHENRANGE])
@@ -11775,7 +11481,7 @@ function coerce (version, options) {
var match = null
if (!options.rtl) {
- match = version.match(safeRe[t.COERCE])
+ match = version.match(re[t.COERCE])
} else {
// Find the right-most coercible string that does not share
// a terminus with a more left-ward coercible string.
@@ -11786,17 +11492,17 @@ function coerce (version, options) {
// Stop when we get a match that ends at the string end, since no
// coercible string can be more right-ward without the same terminus.
var next
- while ((next = safeRe[t.COERCERTL].exec(version)) &&
+ while ((next = re[t.COERCERTL].exec(version)) &&
(!match || match.index + match[0].length !== version.length)
) {
if (!match ||
next.index + next[0].length !== match.index + match[0].length) {
match = next
}
- safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
+ re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
}
// leave it in a clean state
- safeRe[t.COERCERTL].lastIndex = -1
+ re[t.COERCERTL].lastIndex = -1
}
if (match === null) {
@@ -11809,6 +11515,253 @@ function coerce (version, options) {
}
+/***/ }),
+
+/***/ 8110:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
+///
+const listenersMap = new WeakMap();
+const abortedMap = new WeakMap();
+/**
+ * An aborter instance implements AbortSignal interface, can abort HTTP requests.
+ *
+ * - Call AbortSignal.none to create a new AbortSignal instance that cannot be cancelled.
+ * Use `AbortSignal.none` when you are required to pass a cancellation token but the operation
+ * cannot or will not ever be cancelled.
+ *
+ * @example
+ * Abort without timeout
+ * ```ts
+ * await doAsyncWork(AbortSignal.none);
+ * ```
+ */
+class AbortSignal {
+ constructor() {
+ /**
+ * onabort event listener.
+ */
+ this.onabort = null;
+ listenersMap.set(this, []);
+ abortedMap.set(this, false);
+ }
+ /**
+ * Status of whether aborted or not.
+ *
+ * @readonly
+ */
+ get aborted() {
+ if (!abortedMap.has(this)) {
+ throw new TypeError("Expected `this` to be an instance of AbortSignal.");
+ }
+ return abortedMap.get(this);
+ }
+ /**
+ * Creates a new AbortSignal instance that will never be aborted.
+ *
+ * @readonly
+ */
+ static get none() {
+ return new AbortSignal();
+ }
+ /**
+ * Added new "abort" event listener, only support "abort" event.
+ *
+ * @param _type - Only support "abort" event
+ * @param listener - The listener to be added
+ */
+ addEventListener(
+ // tslint:disable-next-line:variable-name
+ _type, listener) {
+ if (!listenersMap.has(this)) {
+ throw new TypeError("Expected `this` to be an instance of AbortSignal.");
+ }
+ const listeners = listenersMap.get(this);
+ listeners.push(listener);
+ }
+ /**
+ * Remove "abort" event listener, only support "abort" event.
+ *
+ * @param _type - Only support "abort" event
+ * @param listener - The listener to be removed
+ */
+ removeEventListener(
+ // tslint:disable-next-line:variable-name
+ _type, listener) {
+ if (!listenersMap.has(this)) {
+ throw new TypeError("Expected `this` to be an instance of AbortSignal.");
+ }
+ const listeners = listenersMap.get(this);
+ const index = listeners.indexOf(listener);
+ if (index > -1) {
+ listeners.splice(index, 1);
+ }
+ }
+ /**
+ * Dispatches a synthetic event to the AbortSignal.
+ */
+ dispatchEvent(_event) {
+ throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes.");
+ }
+}
+/**
+ * Helper to trigger an abort event immediately, the onabort and all abort event listeners will be triggered.
+ * Will try to trigger abort event for all linked AbortSignal nodes.
+ *
+ * - If there is a timeout, the timer will be cancelled.
+ * - If aborted is true, nothing will happen.
+ *
+ * @internal
+ */
+// eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
+function abortSignal(signal) {
+ if (signal.aborted) {
+ return;
+ }
+ if (signal.onabort) {
+ signal.onabort.call(signal);
+ }
+ const listeners = listenersMap.get(signal);
+ if (listeners) {
+ // Create a copy of listeners so mutations to the array
+ // (e.g. via removeListener calls) don't affect the listeners
+ // we invoke.
+ listeners.slice().forEach((listener) => {
+ listener.call(signal, { type: "abort" });
+ });
+ }
+ abortedMap.set(signal, true);
+}
+
+// Copyright (c) Microsoft Corporation.
+/**
+ * This error is thrown when an asynchronous operation has been aborted.
+ * Check for this error by testing the `name` that the name property of the
+ * error matches `"AbortError"`.
+ *
+ * @example
+ * ```ts
+ * const controller = new AbortController();
+ * controller.abort();
+ * try {
+ * doAsyncWork(controller.signal)
+ * } catch (e) {
+ * if (e.name === 'AbortError') {
+ * // handle abort error here.
+ * }
+ * }
+ * ```
+ */
+class AbortError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = "AbortError";
+ }
+}
+/**
+ * An AbortController provides an AbortSignal and the associated controls to signal
+ * that an asynchronous operation should be aborted.
+ *
+ * @example
+ * Abort an operation when another event fires
+ * ```ts
+ * const controller = new AbortController();
+ * const signal = controller.signal;
+ * doAsyncWork(signal);
+ * button.addEventListener('click', () => controller.abort());
+ * ```
+ *
+ * @example
+ * Share aborter cross multiple operations in 30s
+ * ```ts
+ * // Upload the same data to 2 different data centers at the same time,
+ * // abort another when any of them is finished
+ * const controller = AbortController.withTimeout(30 * 1000);
+ * doAsyncWork(controller.signal).then(controller.abort);
+ * doAsyncWork(controller.signal).then(controller.abort);
+ *```
+ *
+ * @example
+ * Cascaded aborting
+ * ```ts
+ * // All operations can't take more than 30 seconds
+ * const aborter = Aborter.timeout(30 * 1000);
+ *
+ * // Following 2 operations can't take more than 25 seconds
+ * await doAsyncWork(aborter.withTimeout(25 * 1000));
+ * await doAsyncWork(aborter.withTimeout(25 * 1000));
+ * ```
+ */
+class AbortController {
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
+ constructor(parentSignals) {
+ this._signal = new AbortSignal();
+ if (!parentSignals) {
+ return;
+ }
+ // coerce parentSignals into an array
+ if (!Array.isArray(parentSignals)) {
+ // eslint-disable-next-line prefer-rest-params
+ parentSignals = arguments;
+ }
+ for (const parentSignal of parentSignals) {
+ // if the parent signal has already had abort() called,
+ // then call abort on this signal as well.
+ if (parentSignal.aborted) {
+ this.abort();
+ }
+ else {
+ // when the parent signal aborts, this signal should as well.
+ parentSignal.addEventListener("abort", () => {
+ this.abort();
+ });
+ }
+ }
+ }
+ /**
+ * The AbortSignal associated with this controller that will signal aborted
+ * when the abort method is called on this controller.
+ *
+ * @readonly
+ */
+ get signal() {
+ return this._signal;
+ }
+ /**
+ * Signal that any operations passed this controller's associated abort signal
+ * to cancel any remaining work and throw an `AbortError`.
+ */
+ abort() {
+ abortSignal(this._signal);
+ }
+ /**
+ * Creates a new AbortSignal instance that will abort after the provided ms.
+ * @param ms - Elapsed time in milliseconds to trigger an abort.
+ */
+ static timeout(ms) {
+ const signal = new AbortSignal();
+ const timer = setTimeout(abortSignal, ms, signal);
+ // Prevent the active Timer from keeping the Node.js event loop active.
+ if (typeof timer.unref === "function") {
+ timer.unref();
+ }
+ return signal;
+ }
+}
+
+exports.AbortController = AbortController;
+exports.AbortError = AbortError;
+exports.AbortSignal = AbortSignal;
+//# sourceMappingURL=index.js.map
+
+
/***/ }),
/***/ 1012:
@@ -11827,7 +11780,7 @@ var coreHttpCompat = __nccwpck_require__(1584);
var coreClient = __nccwpck_require__(160);
var coreXml = __nccwpck_require__(6375);
var logger$1 = __nccwpck_require__(6515);
-var abortController = __nccwpck_require__(3134);
+var abortController = __nccwpck_require__(4517);
var crypto = __nccwpck_require__(6982);
var coreTracing = __nccwpck_require__(623);
var stream = __nccwpck_require__(2203);
@@ -11908,8 +11861,8 @@ class BaseRequestPolicy {
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
-const SDK_VERSION = "12.27.0";
-const SERVICE_VERSION = "2025-05-05";
+const SDK_VERSION = "12.26.0";
+const SERVICE_VERSION = "2025-01-05";
const BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB
const BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB
const BLOCK_BLOB_MAX_BLOCKS = 50000;
@@ -11924,15 +11877,22 @@ const StorageOAuthScopes = "https://storage.azure.com/.default";
const URLConstants = {
Parameters: {
FORCE_BROWSER_NO_CACHE: "_",
+ SIGNATURE: "sig",
SNAPSHOT: "snapshot",
VERSIONID: "versionid",
TIMEOUT: "timeout",
},
};
const HTTPURLConnection = {
- HTTP_ACCEPTED: 202};
+ HTTP_ACCEPTED: 202,
+ HTTP_CONFLICT: 409,
+ HTTP_NOT_FOUND: 404,
+ HTTP_PRECON_FAILED: 412,
+ HTTP_RANGE_NOT_SATISFIABLE: 416,
+};
const HeaderConstants = {
AUTHORIZATION: "Authorization",
+ AUTHORIZATION_SCHEME: "Bearer",
CONTENT_ENCODING: "Content-Encoding",
CONTENT_ID: "Content-ID",
CONTENT_LANGUAGE: "Content-Language",
@@ -11948,9 +11908,14 @@ const HeaderConstants = {
IF_UNMODIFIED_SINCE: "if-unmodified-since",
PREFIX_FOR_STORAGE: "x-ms-",
RANGE: "Range",
+ USER_AGENT: "User-Agent",
+ X_MS_CLIENT_REQUEST_ID: "x-ms-client-request-id",
+ X_MS_COPY_SOURCE: "x-ms-copy-source",
X_MS_DATE: "x-ms-date",
X_MS_ERROR_CODE: "x-ms-error-code",
- X_MS_VERSION: "x-ms-version"};
+ X_MS_VERSION: "x-ms-version",
+ X_MS_CopySourceErrorCode: "x-ms-copy-source-error-code",
+};
const ETagNone = "";
const ETagAny = "*";
const SIZE_1_MB = 1 * 1024 * 1024;
@@ -12169,8 +12134,8 @@ const PathStylePorts = [
*
* We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata
*
* @param url -
*/
@@ -12184,7 +12149,7 @@ function escapeURLPath(url) {
}
function getProxyUriFromDevConnString(connectionString) {
// Development Connection String
- // https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key
+ // https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key
let proxyUri = "";
if (connectionString.search("DevelopmentStorageProxyUri=") !== -1) {
// CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri
@@ -13225,7 +13190,7 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
}
/**
* Retrieve header value according to shared key sign rules.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
*
* @param request -
* @param headerName -
@@ -13237,7 +13202,7 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
}
// When using version 2015-02-21 or later, if Content-Length is zero, then
// set the Content-Length part of the StringToSign to an empty string.
- // https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
+ // https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
if (headerName === HeaderConstants.CONTENT_LENGTH && value === "0") {
return "";
}
@@ -13658,7 +13623,7 @@ function storageSharedKeyCredentialPolicy(options) {
}
/**
* Retrieve header value according to shared key sign rules.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
*/
function getHeaderValueToSign(request, headerName) {
const value = request.headers.get(headerName);
@@ -13667,7 +13632,7 @@ function storageSharedKeyCredentialPolicy(options) {
}
// When using version 2015-02-21 or later, if Content-Length is zero, then
// set the Content-Length part of the StringToSign to an empty string.
- // https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
+ // https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
if (headerName === HeaderConstants.CONTENT_LENGTH && value === "0") {
return "";
}
@@ -22559,7 +22524,7 @@ const timeoutInSeconds = {
const version = {
parameterPath: "version",
mapper: {
- defaultValue: "2025-05-05",
+ defaultValue: "2025-01-05",
isConstant: true,
serializedName: "x-ms-version",
type: {
@@ -27191,7 +27156,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
const defaults = {
requestContentType: "application/json; charset=utf-8",
};
- const packageDetails = `azsdk-js-azure-storage-blob/12.27.0`;
+ const packageDetails = `azsdk-js-azure-storage-blob/12.26.0`;
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
: `${packageDetails}`;
@@ -27202,7 +27167,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
// Parameter assignments
this.url = url;
// Assigning values to Constant parameters
- this.version = options.version || "2025-05-05";
+ this.version = options.version || "2025-01-05";
this.service = new ServiceImpl(this);
this.container = new ContainerImpl(this);
this.blob = new BlobImpl(this);
@@ -27634,7 +27599,7 @@ class ContainerSASPermissions {
* order accepted by the service.
*
* The order of the characters should be as specified here to ensure correctness.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
*/
toString() {
@@ -27688,7 +27653,7 @@ class ContainerSASPermissions {
* ONLY AVAILABLE IN NODE.JS RUNTIME.
*
* UserDelegationKeyCredential is only used for generation of user delegation SAS.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas
*/
class UserDelegationKeyCredential {
/**
@@ -27985,7 +27950,7 @@ function generateBlobSASQueryParametersInternal(blobSASSignatureValues, sharedKe
}
// Version 2019-12-12 adds support for the blob tags permission.
// Version 2018-11-09 adds support for the signed resource and signed blob snapshot time fields.
- // https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas#constructing-the-signature-string
+ // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas#constructing-the-signature-string
if (version >= "2018-11-09") {
if (sharedKeyCredential !== undefined) {
return generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential);
@@ -28572,9 +28537,9 @@ class BlobLeaseClient {
* Establishes and manages a lock on a container for delete operations, or on a blob
* for write and delete operations.
* The lock duration can be 15 to 60 seconds, or can be infinite.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container
* and
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
*
* @param duration - Must be between 15 to 60 seconds, or infinite (-1)
* @param options - option to configure lease management operations.
@@ -28601,9 +28566,9 @@ class BlobLeaseClient {
}
/**
* To change the ID of the lease.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container
* and
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
*
* @param proposedLeaseId - the proposed new lease Id.
* @param options - option to configure lease management operations.
@@ -28631,9 +28596,9 @@ class BlobLeaseClient {
/**
* To free the lease if it is no longer needed so that another client may
* immediately acquire a lease against the container or the blob.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container
* and
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
*
* @param options - option to configure lease management operations.
* @returns Response data for release lease operation.
@@ -28657,9 +28622,9 @@ class BlobLeaseClient {
}
/**
* To renew the lease.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container
* and
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
*
* @param options - Optional option to configure lease management operations.
* @returns Response data for renew lease operation.
@@ -28684,9 +28649,9 @@ class BlobLeaseClient {
/**
* To end the lease but ensure that another client cannot acquire a new lease
* until the current lease period has expired.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-container
* and
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob
*
* @param breakPeriod - Break period
* @param options - Optional options to configure lease management operations.
@@ -30296,7 +30261,7 @@ class BlobQueryResponse {
// Licensed under the MIT License.
/**
* Represents the access tier on a blob.
- * For detailed information about block blob level tiering see {@link https://learn.microsoft.com/azure/storage/blobs/storage-blob-storage-tiers|Hot, cool and archive storage tiers.}
+ * For detailed information about block blob level tiering see {@link https://docs.microsoft.com/azure/storage/blobs/storage-blob-storage-tiers|Hot, cool and archive storage tiers.}
*/
exports.BlockBlobTier = void 0;
(function (BlockBlobTier) {
@@ -30320,7 +30285,7 @@ exports.BlockBlobTier = void 0;
})(exports.BlockBlobTier || (exports.BlockBlobTier = {}));
/**
* Specifies the page blob tier to set the blob to. This is only applicable to page blobs on premium storage accounts.
- * Please see {@link https://learn.microsoft.com/azure/storage/storage-premium-storage#scalability-and-performance-targets|here}
+ * Please see {@link https://docs.microsoft.com/azure/storage/storage-premium-storage#scalability-and-performance-targets|here}
* for detailed information on the corresponding IOPS and throughput per PageBlobTier.
*/
exports.PremiumPageBlobTier = void 0;
@@ -31363,7 +31328,7 @@ class BlobClient extends StorageClient {
* * In Node.js, data returns in a Readable stream readableStreamBody
* * In browsers, data returns in a promise blobBody
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob
*
* @param offset - From which position of the blob to download, greater than or equal to 0
* @param count - How much data to be downloaded, greater than 0. Will download to the end when undefined
@@ -31379,16 +31344,16 @@ class BlobClient extends StorageClient {
* console.log("Downloaded blob content:", downloaded.toString());
*
* async function streamToBuffer(readableStream) {
- * return new Promise((resolve, reject) => {
- * const chunks = [];
- * readableStream.on("data", (data) => {
- * chunks.push(typeof data === "string" ? Buffer.from(data) : data);
- * });
- * readableStream.on("end", () => {
- * resolve(Buffer.concat(chunks));
- * });
- * readableStream.on("error", reject);
- * });
+ * return new Promise((resolve, reject) => {
+ * const chunks = [];
+ * readableStream.on("data", (data) => {
+ * chunks.push(data instanceof Buffer ? data : Buffer.from(data));
+ * });
+ * readableStream.on("end", () => {
+ * resolve(Buffer.concat(chunks));
+ * });
+ * readableStream.on("error", reject);
+ * });
* }
* ```
*
@@ -31527,7 +31492,7 @@ class BlobClient extends StorageClient {
/**
* Returns all user-defined metadata, standard HTTP properties, and system properties
* for the blob. It does not return the content of the blob.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob-properties
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties
*
* WARNING: The `metadata` object returned in the response will have its keys in lowercase, even if
* they originally contained uppercase characters. This differs from the metadata keys returned by
@@ -31556,7 +31521,7 @@ class BlobClient extends StorageClient {
* during garbage collection. Note that in order to delete a blob, you must delete
* all of its snapshots. You can delete both at the same time with the Delete
* Blob operation.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob
*
* @param options - Optional options to Blob Delete operation.
*/
@@ -31578,7 +31543,7 @@ class BlobClient extends StorageClient {
* during garbage collection. Note that in order to delete a blob, you must delete
* all of its snapshots. You can delete both at the same time with the Delete
* Blob operation.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob
*
* @param options - Optional options to Blob Delete operation.
*/
@@ -31601,7 +31566,7 @@ class BlobClient extends StorageClient {
* Restores the contents and metadata of soft deleted blob and any associated
* soft deleted snapshots. Undelete Blob is supported only on version 2017-07-29
* or later.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/undelete-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/undelete-blob
*
* @param options - Optional options to Blob Undelete operation.
*/
@@ -31618,7 +31583,7 @@ class BlobClient extends StorageClient {
*
* If no value provided, or no value provided for the specified blob HTTP headers,
* these blob HTTP headers without a value will be cleared.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-properties
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties
*
* @param blobHTTPHeaders - If no value provided, or no value provided for
* the specified blob HTTP headers, these blob HTTP
@@ -31648,7 +31613,7 @@ class BlobClient extends StorageClient {
*
* If no option provided, or no metadata defined in the parameter, the blob
* metadata will be removed.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-metadata
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-metadata
*
* @param metadata - Replace existing metadata with this value.
* If no value provided the existing metadata will be removed.
@@ -31720,7 +31685,7 @@ class BlobClient extends StorageClient {
}
/**
* Creates a read-only snapshot of a blob.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/snapshot-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/snapshot-blob
*
* @param options - Optional options to the Blob Create Snapshot operation.
*/
@@ -31754,7 +31719,7 @@ class BlobClient extends StorageClient {
* an Azure file in any Azure storage account.
* Only storage accounts created on or after June 7th, 2012 allow the Copy Blob
* operation to copy from another storage account.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/copy-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob
*
* Example using automatic polling:
*
@@ -31834,7 +31799,7 @@ class BlobClient extends StorageClient {
/**
* Aborts a pending asynchronous Copy Blob operation, and leaves a destination blob with zero
* length and full metadata. Version 2012-02-12 and newer.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/abort-copy-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/abort-copy-blob
*
* @param copyId - Id of the Copy From URL operation.
* @param options - Optional options to the Blob Abort Copy From URL operation.
@@ -31851,7 +31816,7 @@ class BlobClient extends StorageClient {
/**
* The synchronous Copy From URL operation copies a blob or an internet resource to a new blob. It will not
* return a response until the copy is complete.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url
*
* @param copySource - The source URL to copy from, Shared Access Signature(SAS) maybe needed for authentication
* @param options -
@@ -31891,7 +31856,7 @@ class BlobClient extends StorageClient {
* storage only). A premium page blob's tier determines the allowed size, IOPS,
* and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive
* storage type. This operation does not update the blob's ETag.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
*
* @param tier - The tier to be set on the blob. Valid values are Hot, Cool, or Archive.
* @param options - Optional options to the Blob Set Tier operation.
@@ -32076,7 +32041,7 @@ class BlobClient extends StorageClient {
* an Azure file in any Azure storage account.
* Only storage accounts created on or after June 7th, 2012 allow the Copy Blob
* operation to copy from another storage account.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/copy-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob
*
* @param copySource - url to the source Azure Blob/File.
* @param options - Optional options to the Blob Start Copy From URL operation.
@@ -32115,7 +32080,7 @@ class BlobClient extends StorageClient {
* Generates a Blob Service Shared Access Signature (SAS) URI based on the client properties
* and parameters passed in. The SAS is signed by the shared key credential of the client.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
* @param options - Optional parameters.
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
@@ -32135,7 +32100,7 @@ class BlobClient extends StorageClient {
* Generates string to sign for a Blob Service Shared Access Signature (SAS) URI based on
* the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
* @param options - Optional parameters.
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
@@ -32152,7 +32117,7 @@ class BlobClient extends StorageClient {
* Generates a Blob Service Shared Access Signature (SAS) URI based on
* the client properties and parameters passed in. The SAS is signed by the input user delegation key.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
* @param options - Optional parameters.
* @param userDelegationKey - Return value of `blobServiceClient.getUserDelegationKey()`
@@ -32170,7 +32135,7 @@ class BlobClient extends StorageClient {
* Generates string to sign for a Blob Service Shared Access Signature (SAS) URI based on
* the client properties and parameters passed in. The SAS is signed by the input user delegation key.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
* @param options - Optional parameters.
* @param userDelegationKey - Return value of `blobServiceClient.getUserDelegationKey()`
@@ -32222,7 +32187,7 @@ class BlobClient extends StorageClient {
* for the specified account.
* The Get Account Information operation is available on service versions beginning
* with version 2018-03-28.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-account-information
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information
*
* @param options - Options to the Service Get Account Info operation.
* @returns Response data for the Service Get Account Info operation.
@@ -32320,7 +32285,7 @@ class AppendBlobClient extends BlobClient {
}
/**
* Creates a 0-length append blob. Call AppendBlock to append data to an append blob.
- * @see https://learn.microsoft.com/rest/api/storageservices/put-blob
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-blob
*
* @param options - Options to the Append Block Create operation.
*
@@ -32356,7 +32321,7 @@ class AppendBlobClient extends BlobClient {
/**
* Creates a 0-length append blob. Call AppendBlock to append data to an append blob.
* If the blob with the same name already exists, the content of the existing blob will remain unchanged.
- * @see https://learn.microsoft.com/rest/api/storageservices/put-blob
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-blob
*
* @param options -
*/
@@ -32396,7 +32361,7 @@ class AppendBlobClient extends BlobClient {
}
/**
* Commits a new block of data to the end of the existing append blob.
- * @see https://learn.microsoft.com/rest/api/storageservices/append-block
+ * @see https://docs.microsoft.com/rest/api/storageservices/append-block
*
* @param body - Data to be appended.
* @param contentLength - Length of the body in bytes.
@@ -32442,7 +32407,7 @@ class AppendBlobClient extends BlobClient {
/**
* The Append Block operation commits a new block of data to the end of an existing append blob
* where the contents are read from a source url.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/append-block-from-url
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/append-block-from-url
*
* @param sourceURL -
* The url to the blob that will be the source of the copy. A source blob in the same storage account can
@@ -32584,7 +32549,7 @@ class BlockBlobClient extends BlobClient {
* return new Promise((resolve, reject) => {
* const chunks = [];
* readableStream.on("data", (data) => {
- * chunks.push(typeof data === "string" ? Buffer.from(data) : data);
+ * chunks.push(data instanceof Buffer ? data : Buffer.from(data));
* });
* readableStream.on("end", () => {
* resolve(Buffer.concat(chunks));
@@ -32635,7 +32600,7 @@ class BlockBlobClient extends BlobClient {
* {@link uploadStream} or {@link uploadBrowserData} for better performance
* with concurrency uploading.
*
- * @see https://learn.microsoft.com/rest/api/storageservices/put-blob
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-blob
*
* @param body - Blob, string, ArrayBuffer, ArrayBufferView or a function
* which returns a new Readable stream whose offset is from data source beginning.
@@ -32711,7 +32676,7 @@ class BlockBlobClient extends BlobClient {
/**
* Uploads the specified block to the block blob's "staging area" to be later
* committed by a call to commitBlockList.
- * @see https://learn.microsoft.com/rest/api/storageservices/put-block
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-block
*
* @param blockId - A 64-byte value that is base64-encoded
* @param body - Data to upload to the staging area.
@@ -32740,7 +32705,7 @@ class BlockBlobClient extends BlobClient {
* The Stage Block From URL operation creates a new block to be committed as part
* of a blob where the contents are read from a URL.
* This API is available starting in version 2018-03-28.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/put-block-from-url
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-from-url
*
* @param blockId - A 64-byte value that is base64-encoded
* @param sourceURL - Specifies the URL of the blob. The value
@@ -32779,7 +32744,7 @@ class BlockBlobClient extends BlobClient {
* to the server in a prior {@link stageBlock} operation. You can call {@link commitBlockList} to
* update a blob by uploading only those blocks that have changed, then committing the new and existing
* blocks together. Any blocks not specified in the block list and permanently deleted.
- * @see https://learn.microsoft.com/rest/api/storageservices/put-block-list
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-block-list
*
* @param blocks - Array of 64-byte value that is base64-encoded
* @param options - Options to the Block Blob Commit Block List operation.
@@ -32810,7 +32775,7 @@ class BlockBlobClient extends BlobClient {
/**
* Returns the list of blocks that have been uploaded as part of a block blob
* using the specified block list filter.
- * @see https://learn.microsoft.com/rest/api/storageservices/get-block-list
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-block-list
*
* @param listType - Specifies whether to return the list of committed blocks,
* the list of uncommitted blocks, or both lists together.
@@ -33144,7 +33109,7 @@ class PageBlobClient extends BlobClient {
/**
* Creates a page blob of the specified length. Call uploadPages to upload data
* data to a page blob.
- * @see https://learn.microsoft.com/rest/api/storageservices/put-blob
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-blob
*
* @param size - size of the page blob.
* @param options - Options to the Page Blob Create operation.
@@ -33177,7 +33142,7 @@ class PageBlobClient extends BlobClient {
* Creates a page blob of the specified length. Call uploadPages to upload data
* data to a page blob. If the blob with the same name already exists, the content
* of the existing blob will remain unchanged.
- * @see https://learn.microsoft.com/rest/api/storageservices/put-blob
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-blob
*
* @param size - size of the page blob.
* @param options -
@@ -33200,7 +33165,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512.
- * @see https://learn.microsoft.com/rest/api/storageservices/put-page
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-page
*
* @param body - Data to upload
* @param offset - Offset of destination page blob
@@ -33233,7 +33198,7 @@ class PageBlobClient extends BlobClient {
/**
* The Upload Pages operation writes a range of pages to a page blob where the
* contents are read from a URL.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/put-page-from-url
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/put-page-from-url
*
* @param sourceURL - Specify a URL to the copy source, Shared Access Signature(SAS) maybe needed for authentication
* @param sourceOffset - The source offset to copy from. Pass 0 to copy from the beginning of source page blob
@@ -33269,7 +33234,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Frees the specified pages from the page blob.
- * @see https://learn.microsoft.com/rest/api/storageservices/put-page
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-page
*
* @param offset - Starting byte position of the pages to clear.
* @param count - Number of bytes to clear.
@@ -33294,7 +33259,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Returns the list of valid page ranges for a page blob or snapshot of a page blob.
- * @see https://learn.microsoft.com/rest/api/storageservices/get-page-ranges
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
*
* @param offset - Starting byte position of the page ranges.
* @param count - Number of bytes to get.
@@ -33320,7 +33285,7 @@ class PageBlobClient extends BlobClient {
* specified Marker. Use an empty Marker to start enumeration from the beginning.
* After getting a segment, process it, and then call getPageRangesSegment again
* (passing the the previously-returned Marker) to get the next segment.
- * @see https://learn.microsoft.com/rest/api/storageservices/get-page-ranges
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
*
* @param offset - Starting byte position of the page ranges.
* @param count - Number of bytes to get.
@@ -33397,7 +33362,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Returns an async iterable iterator to list of page ranges for a page blob.
- * @see https://learn.microsoft.com/rest/api/storageservices/get-page-ranges
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
*
* .byPage() returns an async iterable iterator to list of page ranges for a page blob.
*
@@ -33493,7 +33458,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Gets the collection of page ranges that differ between a specified snapshot and this page blob.
- * @see https://learn.microsoft.com/rest/api/storageservices/get-page-ranges
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
*
* @param offset - Starting byte position of the page blob
* @param count - Number of bytes to get ranges diff.
@@ -33522,7 +33487,7 @@ class PageBlobClient extends BlobClient {
* Use an empty Marker to start enumeration from the beginning.
* After getting a segment, process it, and then call getPageRangesDiffSegment again
* (passing the the previously-returned Marker) to get the next segment.
- * @see https://learn.microsoft.com/rest/api/storageservices/get-page-ranges
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
*
* @param offset - Starting byte position of the page ranges.
* @param count - Number of bytes to get.
@@ -33607,7 +33572,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Returns an async iterable iterator to list of page ranges that differ between a specified snapshot and this page blob.
- * @see https://learn.microsoft.com/rest/api/storageservices/get-page-ranges
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
*
* .byPage() returns an async iterable iterator to list of page ranges that differ between a specified snapshot and this page blob.
*
@@ -33704,7 +33669,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Gets the collection of page ranges that differ between a specified snapshot and this page blob for managed disks.
- * @see https://learn.microsoft.com/rest/api/storageservices/get-page-ranges
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
*
* @param offset - Starting byte position of the page blob
* @param count - Number of bytes to get ranges diff.
@@ -33729,7 +33694,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Resizes the page blob to the specified size (which must be a multiple of 512).
- * @see https://learn.microsoft.com/rest/api/storageservices/set-blob-properties
+ * @see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties
*
* @param size - Target size
* @param options - Options to the Page Blob Resize operation.
@@ -33750,7 +33715,7 @@ class PageBlobClient extends BlobClient {
}
/**
* Sets a page blob's sequence number.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-properties
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties
*
* @param sequenceNumberAction - Indicates how the service should modify the blob's sequence number.
* @param sequenceNumber - Required if sequenceNumberAction is max or update
@@ -33775,8 +33740,8 @@ class PageBlobClient extends BlobClient {
* The snapshot is copied such that only the differential changes between the previously
* copied snapshot are transferred to the destination.
* The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual.
- * @see https://learn.microsoft.com/rest/api/storageservices/incremental-copy-blob
- * @see https://learn.microsoft.com/en-us/azure/virtual-machines/windows/incremental-snapshots
+ * @see https://docs.microsoft.com/rest/api/storageservices/incremental-copy-blob
+ * @see https://docs.microsoft.com/en-us/azure/virtual-machines/windows/incremental-snapshots
*
* @param copySource - Specifies the name of the source page blob snapshot. For example,
* https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot=
@@ -33832,7 +33797,7 @@ class BatchResponseParser {
this.perResponsePrefix = `--${this.responseBatchBoundary}${HTTP_LINE_ENDING}`;
this.batchResponseEnding = `--${this.responseBatchBoundary}--`;
}
- // For example of response, please refer to https://learn.microsoft.com/en-us/rest/api/storageservices/blob-batch#response
+ // For example of response, please refer to https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch#response
async parseBatchResponse() {
// When logic reach here, suppose batch request has already succeeded with 202, so we can further parse
// sub request's response.
@@ -34127,7 +34092,7 @@ class BlobBatch {
}
/**
* Inner batch request class which is responsible for assembling and serializing sub requests.
- * See https://learn.microsoft.com/en-us/rest/api/storageservices/blob-batch#request-body for how requests are assembled.
+ * See https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch#request-body for how requests are assembled.
*/
class InnerBatchRequest {
constructor() {
@@ -34262,7 +34227,7 @@ function batchHeaderFilterPolicy() {
/**
* A BlobBatchClient allows you to make batched requests to the Azure Storage Blob service.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/blob-batch
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch
*/
class BlobBatchClient {
constructor(url, credentialOrPipeline,
@@ -34357,7 +34322,7 @@ class BlobBatchClient {
* console.log(batchResp.subResponsesSucceededCount);
* ```
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/blob-batch
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch
*
* @param batchRequest - A set of Delete or SetTier operations.
* @param options -
@@ -34464,7 +34429,7 @@ class ContainerClient extends StorageClient {
/**
* Creates a new container under the specified account. If the container with
* the same name already exists, the operation fails.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container
* Naming rules: @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
*
* @param options - Options to Container Create operation.
@@ -34486,7 +34451,7 @@ class ContainerClient extends StorageClient {
/**
* Creates a new container under the specified account. If the container with
* the same name already exists, it is not changed.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container
* Naming rules: @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
*
* @param options -
@@ -34580,7 +34545,7 @@ class ContainerClient extends StorageClient {
/**
* Returns all user-defined metadata and system properties for the specified
* container. The data returned does not include the container's list of blobs.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-container-properties
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-properties
*
* WARNING: The `metadata` object returned in the response will have its keys in lowercase, even if
* they originally contained uppercase characters. This differs from the metadata keys returned by
@@ -34600,7 +34565,7 @@ class ContainerClient extends StorageClient {
/**
* Marks the specified container for deletion. The container and any blobs
* contained within it are later deleted during garbage collection.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container
*
* @param options - Options to Container Delete operation.
*/
@@ -34620,7 +34585,7 @@ class ContainerClient extends StorageClient {
/**
* Marks the specified container for deletion if it exists. The container and any blobs
* contained within it are later deleted during garbage collection.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-container
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container
*
* @param options - Options to Container Delete operation.
*/
@@ -34645,7 +34610,7 @@ class ContainerClient extends StorageClient {
* If no option provided, or no metadata defined in the parameter, the container
* metadata will be removed.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-container-metadata
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-metadata
*
* @param metadata - Replace existing metadata with this value.
* If no value provided the existing metadata will be removed.
@@ -34675,7 +34640,7 @@ class ContainerClient extends StorageClient {
* WARNING: JavaScript Date will potentially lose precision when parsing startsOn and expiresOn strings.
* For example, new Date("2018-12-31T03:44:23.8827891Z").toISOString() will get "2018-12-31T03:44:23.882Z".
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-container-acl
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-acl
*
* @param options - Options to Container Get Access Policy operation.
*/
@@ -34733,7 +34698,7 @@ class ContainerClient extends StorageClient {
* When you establish a stored access policy on a container, it may take up to 30 seconds to take effect.
* During this interval, a shared access signature that is associated with the stored access policy will
* fail with status code 403 (Forbidden), until the access policy becomes active.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-container-acl
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-acl
*
* @param access - The level of public access to data in the container.
* @param containerAcl - Array of elements each having a unique Id and details of the access policy.
@@ -34788,7 +34753,7 @@ class ContainerClient extends StorageClient {
* {@link BlockBlobClient.uploadStream} or {@link BlockBlobClient.uploadBrowserData} for better
* performance with concurrency uploading.
*
- * @see https://learn.microsoft.com/rest/api/storageservices/put-blob
+ * @see https://docs.microsoft.com/rest/api/storageservices/put-blob
*
* @param blobName - Name of the block blob to create or update.
* @param body - Blob, string, ArrayBuffer, ArrayBufferView or a function
@@ -34813,7 +34778,7 @@ class ContainerClient extends StorageClient {
* during garbage collection. Note that in order to delete a blob, you must delete
* all of its snapshots. You can delete both at the same time with the Delete
* Blob operation.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-blob
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob
*
* @param blobName -
* @param options - Options to Blob Delete operation.
@@ -34833,7 +34798,7 @@ class ContainerClient extends StorageClient {
* specified Marker. Use an empty Marker to start enumeration from the beginning.
* After getting a segment, process it, and then call listBlobsFlatSegment again
* (passing the the previously-returned Marker) to get the next segment.
- * @see https://learn.microsoft.com/rest/api/storageservices/list-blobs
+ * @see https://docs.microsoft.com/rest/api/storageservices/list-blobs
*
* @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
* @param options - Options to Container List Blob Flat Segment operation.
@@ -34853,7 +34818,7 @@ class ContainerClient extends StorageClient {
* the specified Marker. Use an empty Marker to start enumeration from the
* beginning. After getting a segment, process it, and then call listBlobsHierarchicalSegment
* again (passing the the previously-returned Marker) to get the next segment.
- * @see https://learn.microsoft.com/rest/api/storageservices/list-blobs
+ * @see https://docs.microsoft.com/rest/api/storageservices/list-blobs
*
* @param delimiter - The character or string used to define the virtual hierarchy
* @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
@@ -35455,7 +35420,7 @@ class ContainerClient extends StorageClient {
* for the specified account.
* The Get Account Information operation is available on service versions beginning
* with version 2018-03-28.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-account-information
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information
*
* @param options - Options to the Service Get Account Info operation.
* @returns Response data for the Service Get Account Info operation.
@@ -35511,7 +35476,7 @@ class ContainerClient extends StorageClient {
* Generates a Blob Container Service Shared Access Signature (SAS) URI based on the client properties
* and parameters passed in. The SAS is signed by the shared key credential of the client.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
* @param options - Optional parameters.
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
@@ -35531,7 +35496,7 @@ class ContainerClient extends StorageClient {
* Generates string to sign for a Blob Container Service Shared Access Signature (SAS) URI
* based on the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
* @param options - Optional parameters.
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
@@ -35547,7 +35512,7 @@ class ContainerClient extends StorageClient {
* Generates a Blob Container Service Shared Access Signature (SAS) URI based on the client properties
* and parameters passed in. The SAS is signed by the input user delegation key.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
* @param options - Optional parameters.
* @param userDelegationKey - Return value of `blobServiceClient.getUserDelegationKey()`
@@ -35563,7 +35528,7 @@ class ContainerClient extends StorageClient {
* Generates string to sign for a Blob Container Service Shared Access Signature (SAS) URI
* based on the client properties and parameters passed in. The SAS is signed by the input user delegation key.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
*
* @param options - Optional parameters.
* @param userDelegationKey - Return value of `blobServiceClient.getUserDelegationKey()`
@@ -35575,7 +35540,7 @@ class ContainerClient extends StorageClient {
/**
* Creates a BlobBatchClient object to conduct batch operations.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/blob-batch
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch
*
* @returns A new BlobBatchClient object for this container.
*/
@@ -35760,12 +35725,12 @@ class AccountSASPermissions {
* Using this method will guarantee the resource types are in
* an order accepted by the service.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
*
*/
toString() {
// The order of the characters should be as specified here to ensure correctness:
- // https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
+ // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
// Use a string array instead of string concatenating += operator for performance
const permissions = [];
if (this.read) {
@@ -35865,7 +35830,7 @@ class AccountSASResourceTypes {
/**
* Converts the given resource types to a string.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
*
*/
toString() {
@@ -35971,7 +35936,7 @@ class AccountSASServices {
* Generates a {@link SASQueryParameters} object which contains all SAS query parameters needed to make an actual
* REST request.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
*
* @param accountSASSignatureValues -
* @param sharedKeyCredential -
@@ -36136,7 +36101,7 @@ class BlobServiceClient extends StorageClient {
return new ContainerClient(appendToURLPath(this.url, encodeURIComponent(containerName)), this.pipeline);
}
/**
- * Create a Blob container. @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-container
+ * Create a Blob container. @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container
*
* @param containerName - Name of the container to create.
* @param options - Options to configure Container Create operation.
@@ -36209,7 +36174,7 @@ class BlobServiceClient extends StorageClient {
/**
* Gets the properties of a storage account’s Blob service, including properties
* for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties
*
* @param options - Options to the Service Get Properties operation.
* @returns Response data for the Service Get Properties operation.
@@ -36225,7 +36190,7 @@ class BlobServiceClient extends StorageClient {
/**
* Sets properties for a storage account’s Blob service endpoint, including properties
* for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and soft delete settings.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-blob-service-properties
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-service-properties
*
* @param properties -
* @param options - Options to the Service Set Properties operation.
@@ -36243,7 +36208,7 @@ class BlobServiceClient extends StorageClient {
* Retrieves statistics related to replication for the Blob service. It is only
* available on the secondary location endpoint when read-access geo-redundant
* replication is enabled for the storage account.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats
*
* @param options - Options to the Service Get Statistics operation.
* @returns Response data for the Service Get Statistics operation.
@@ -36261,7 +36226,7 @@ class BlobServiceClient extends StorageClient {
* for the specified account.
* The Get Account Information operation is available on service versions beginning
* with version 2018-03-28.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-account-information
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information
*
* @param options - Options to the Service Get Account Info operation.
* @returns Response data for the Service Get Account Info operation.
@@ -36276,7 +36241,7 @@ class BlobServiceClient extends StorageClient {
}
/**
* Returns a list of the containers under the specified account.
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/list-containers2
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/list-containers2
*
* @param marker - A string value that identifies the portion of
* the list of containers to be returned with the next listing operation. The
@@ -36396,7 +36361,7 @@ class BlobServiceClient extends StorageClient {
*
* .byPage() returns an async iterable iterator to list the blobs in pages.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties
*
* Example using `for await` syntax:
*
@@ -36664,7 +36629,7 @@ class BlobServiceClient extends StorageClient {
* Retrieves a user delegation key for the Blob service. This is only a valid operation when using
* bearer token authentication.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-user-delegation-key
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-user-delegation-key
*
* @param startsOn - The start time for the user delegation SAS. Must be within 7 days of the current time
* @param expiresOn - The end time for the user delegation SAS. Must be within 7 days of the current time
@@ -36694,7 +36659,7 @@ class BlobServiceClient extends StorageClient {
/**
* Creates a BlobBatchClient object to conduct batch operations.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/blob-batch
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch
*
* @returns A new BlobBatchClient object for this service.
*/
@@ -36707,7 +36672,7 @@ class BlobServiceClient extends StorageClient {
* Generates a Blob account Shared Access Signature (SAS) URI based on the client properties
* and parameters passed in. The SAS is signed by the shared key credential of the client.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas
*
* @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not provided.
* @param permissions - Specifies the list of permissions to be associated with the SAS.
@@ -36734,7 +36699,7 @@ class BlobServiceClient extends StorageClient {
* Generates string to sign for a Blob account Shared Access Signature (SAS) URI based on
* the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.
*
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas
*
* @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not provided.
* @param permissions - Specifies the list of permissions to be associated with the SAS.
@@ -39190,7 +39155,7 @@ Object.defineProperty(exports, "readMessageOption", ({ enumerable: true, get: fu
// Message operations via reflection
var reflection_type_check_1 = __nccwpck_require__(5167);
Object.defineProperty(exports, "ReflectionTypeCheck", ({ enumerable: true, get: function () { return reflection_type_check_1.ReflectionTypeCheck; } }));
-var reflection_create_1 = __nccwpck_require__(488);
+var reflection_create_1 = __nccwpck_require__(5726);
Object.defineProperty(exports, "reflectionCreate", ({ enumerable: true, get: function () { return reflection_create_1.reflectionCreate; } }));
var reflection_scalar_default_1 = __nccwpck_require__(9526);
Object.defineProperty(exports, "reflectionScalarDefault", ({ enumerable: true, get: function () { return reflection_scalar_default_1.reflectionScalarDefault; } }));
@@ -39386,7 +39351,7 @@ const reflection_json_reader_1 = __nccwpck_require__(6790);
const reflection_json_writer_1 = __nccwpck_require__(1094);
const reflection_binary_reader_1 = __nccwpck_require__(9611);
const reflection_binary_writer_1 = __nccwpck_require__(6907);
-const reflection_create_1 = __nccwpck_require__(488);
+const reflection_create_1 = __nccwpck_require__(5726);
const reflection_merge_partial_1 = __nccwpck_require__(8044);
const json_typings_1 = __nccwpck_require__(9999);
const json_format_contract_1 = __nccwpck_require__(9367);
@@ -40460,7 +40425,7 @@ exports.containsMessageType = containsMessageType;
/***/ }),
-/***/ 488:
+/***/ 5726:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
@@ -42071,6 +42036,214 @@ function range(a, b, str) {
}
+/***/ }),
+
+/***/ 4691:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+var concatMap = __nccwpck_require__(7087);
+var balanced = __nccwpck_require__(9380);
+
+module.exports = expandTop;
+
+var escSlash = '\0SLASH'+Math.random()+'\0';
+var escOpen = '\0OPEN'+Math.random()+'\0';
+var escClose = '\0CLOSE'+Math.random()+'\0';
+var escComma = '\0COMMA'+Math.random()+'\0';
+var escPeriod = '\0PERIOD'+Math.random()+'\0';
+
+function numeric(str) {
+ return parseInt(str, 10) == str
+ ? parseInt(str, 10)
+ : str.charCodeAt(0);
+}
+
+function escapeBraces(str) {
+ return str.split('\\\\').join(escSlash)
+ .split('\\{').join(escOpen)
+ .split('\\}').join(escClose)
+ .split('\\,').join(escComma)
+ .split('\\.').join(escPeriod);
+}
+
+function unescapeBraces(str) {
+ return str.split(escSlash).join('\\')
+ .split(escOpen).join('{')
+ .split(escClose).join('}')
+ .split(escComma).join(',')
+ .split(escPeriod).join('.');
+}
+
+
+// Basically just str.split(","), but handling cases
+// where we have nested braced sections, which should be
+// treated as individual members, like {a,{b,c},d}
+function parseCommaParts(str) {
+ if (!str)
+ return [''];
+
+ var parts = [];
+ var m = balanced('{', '}', str);
+
+ if (!m)
+ return str.split(',');
+
+ var pre = m.pre;
+ var body = m.body;
+ var post = m.post;
+ var p = pre.split(',');
+
+ p[p.length-1] += '{' + body + '}';
+ var postParts = parseCommaParts(post);
+ if (post.length) {
+ p[p.length-1] += postParts.shift();
+ p.push.apply(p, postParts);
+ }
+
+ parts.push.apply(parts, p);
+
+ return parts;
+}
+
+function expandTop(str) {
+ if (!str)
+ return [];
+
+ // I don't know why Bash 4.3 does this, but it does.
+ // Anything starting with {} will have the first two bytes preserved
+ // but *only* at the top level, so {},a}b will not expand to anything,
+ // but a{},b}c will be expanded to [a}c,abc].
+ // One could argue that this is a bug in Bash, but since the goal of
+ // this module is to match Bash's rules, we escape a leading {}
+ if (str.substr(0, 2) === '{}') {
+ str = '\\{\\}' + str.substr(2);
+ }
+
+ return expand(escapeBraces(str), true).map(unescapeBraces);
+}
+
+function identity(e) {
+ return e;
+}
+
+function embrace(str) {
+ return '{' + str + '}';
+}
+function isPadded(el) {
+ return /^-?0\d/.test(el);
+}
+
+function lte(i, y) {
+ return i <= y;
+}
+function gte(i, y) {
+ return i >= y;
+}
+
+function expand(str, isTop) {
+ var expansions = [];
+
+ var m = balanced('{', '}', str);
+ if (!m || /\$$/.test(m.pre)) return [str];
+
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
+ var isSequence = isNumericSequence || isAlphaSequence;
+ var isOptions = m.body.indexOf(',') >= 0;
+ if (!isSequence && !isOptions) {
+ // {a},b}
+ if (m.post.match(/,.*\}/)) {
+ str = m.pre + '{' + m.body + escClose + m.post;
+ return expand(str);
+ }
+ return [str];
+ }
+
+ var n;
+ if (isSequence) {
+ n = m.body.split(/\.\./);
+ } else {
+ n = parseCommaParts(m.body);
+ if (n.length === 1) {
+ // x{{a,b}}y ==> x{a}y x{b}y
+ n = expand(n[0], false).map(embrace);
+ if (n.length === 1) {
+ var post = m.post.length
+ ? expand(m.post, false)
+ : [''];
+ return post.map(function(p) {
+ return m.pre + n[0] + p;
+ });
+ }
+ }
+ }
+
+ // at this point, n is the parts, and we know it's not a comma set
+ // with a single entry.
+
+ // no need to expand pre, since it is guaranteed to be free of brace-sets
+ var pre = m.pre;
+ var post = m.post.length
+ ? expand(m.post, false)
+ : [''];
+
+ var N;
+
+ if (isSequence) {
+ var x = numeric(n[0]);
+ var y = numeric(n[1]);
+ var width = Math.max(n[0].length, n[1].length)
+ var incr = n.length == 3
+ ? Math.abs(numeric(n[2]))
+ : 1;
+ var test = lte;
+ var reverse = y < x;
+ if (reverse) {
+ incr *= -1;
+ test = gte;
+ }
+ var pad = n.some(isPadded);
+
+ N = [];
+
+ for (var i = x; test(i, y); i += incr) {
+ var c;
+ if (isAlphaSequence) {
+ c = String.fromCharCode(i);
+ if (c === '\\')
+ c = '';
+ } else {
+ c = String(i);
+ if (pad) {
+ var need = width - c.length;
+ if (need > 0) {
+ var z = new Array(need + 1).join('0');
+ if (i < 0)
+ c = '-' + z + c.slice(1);
+ else
+ c = z + c;
+ }
+ }
+ }
+ N.push(c);
+ }
+ } else {
+ N = concatMap(n, function(el) { return expand(el, false) });
+ }
+
+ for (var j = 0; j < N.length; j++) {
+ for (var k = 0; k < post.length; k++) {
+ var expansion = pre + N[j] + post[k];
+ if (!isTop || isSequence || expansion)
+ expansions.push(expansion);
+ }
+ }
+
+ return expansions;
+}
+
+
+
/***/ }),
/***/ 7087:
@@ -42317,7 +42490,7 @@ function save(namespaces) {
function load() {
let r;
try {
- r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
+ r = exports.storage.getItem('debug');
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
@@ -42545,7 +42718,7 @@ function setup(env) {
const split = (typeof namespaces === 'string' ? namespaces : '')
.trim()
- .replace(/\s+/g, ',')
+ .replace(' ', ',')
.split(',')
.filter(Boolean);
@@ -42956,6 +43129,2041 @@ formatters.O = function (v) {
};
+/***/ }),
+
+/***/ 9741:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+const validator = __nccwpck_require__(9433);
+const XMLParser = __nccwpck_require__(9844);
+const XMLBuilder = __nccwpck_require__(659);
+
+module.exports = {
+ XMLParser: XMLParser,
+ XMLValidator: validator,
+ XMLBuilder: XMLBuilder
+}
+
+/***/ }),
+
+/***/ 812:
+/***/ ((module) => {
+
+function getIgnoreAttributesFn(ignoreAttributes) {
+ if (typeof ignoreAttributes === 'function') {
+ return ignoreAttributes
+ }
+ if (Array.isArray(ignoreAttributes)) {
+ return (attrName) => {
+ for (const pattern of ignoreAttributes) {
+ if (typeof pattern === 'string' && attrName === pattern) {
+ return true
+ }
+ if (pattern instanceof RegExp && pattern.test(attrName)) {
+ return true
+ }
+ }
+ }
+ }
+ return () => false
+}
+
+module.exports = getIgnoreAttributesFn
+
+/***/ }),
+
+/***/ 7019:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
+const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
+const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*'
+const regexName = new RegExp('^' + nameRegexp + '$');
+
+const getAllMatches = function(string, regex) {
+ const matches = [];
+ let match = regex.exec(string);
+ while (match) {
+ const allmatches = [];
+ allmatches.startIndex = regex.lastIndex - match[0].length;
+ const len = match.length;
+ for (let index = 0; index < len; index++) {
+ allmatches.push(match[index]);
+ }
+ matches.push(allmatches);
+ match = regex.exec(string);
+ }
+ return matches;
+};
+
+const isName = function(string) {
+ const match = regexName.exec(string);
+ return !(match === null || typeof match === 'undefined');
+};
+
+exports.isExist = function(v) {
+ return typeof v !== 'undefined';
+};
+
+exports.isEmptyObject = function(obj) {
+ return Object.keys(obj).length === 0;
+};
+
+/**
+ * Copy all the properties of a into b.
+ * @param {*} target
+ * @param {*} a
+ */
+exports.merge = function(target, a, arrayMode) {
+ if (a) {
+ const keys = Object.keys(a); // will return an array of own properties
+ const len = keys.length; //don't make it inline
+ for (let i = 0; i < len; i++) {
+ if (arrayMode === 'strict') {
+ target[keys[i]] = [ a[keys[i]] ];
+ } else {
+ target[keys[i]] = a[keys[i]];
+ }
+ }
+ }
+};
+/* exports.merge =function (b,a){
+ return Object.assign(b,a);
+} */
+
+exports.getValue = function(v) {
+ if (exports.isExist(v)) {
+ return v;
+ } else {
+ return '';
+ }
+};
+
+// const fakeCall = function(a) {return a;};
+// const fakeCallNoReturn = function() {};
+
+exports.isName = isName;
+exports.getAllMatches = getAllMatches;
+exports.nameRegexp = nameRegexp;
+
+
+/***/ }),
+
+/***/ 9433:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+
+const util = __nccwpck_require__(7019);
+
+const defaultOptions = {
+ allowBooleanAttributes: false, //A tag can have attributes without any value
+ unpairedTags: []
+};
+
+//const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g");
+exports.validate = function (xmlData, options) {
+ options = Object.assign({}, defaultOptions, options);
+
+ //xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line
+ //xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag
+ //xmlData = xmlData.replace(/()/g,"");//Remove DOCTYPE
+ const tags = [];
+ let tagFound = false;
+
+ //indicates that the root tag has been closed (aka. depth 0 has been reached)
+ let reachedRoot = false;
+
+ if (xmlData[0] === '\ufeff') {
+ // check for byte order mark (BOM)
+ xmlData = xmlData.substr(1);
+ }
+
+ for (let i = 0; i < xmlData.length; i++) {
+
+ if (xmlData[i] === '<' && xmlData[i+1] === '?') {
+ i+=2;
+ i = readPI(xmlData,i);
+ if (i.err) return i;
+ }else if (xmlData[i] === '<') {
+ //starting of tag
+ //read until you reach to '>' avoiding any '>' in attribute value
+ let tagStartPos = i;
+ i++;
+
+ if (xmlData[i] === '!') {
+ i = readCommentAndCDATA(xmlData, i);
+ continue;
+ } else {
+ let closingTag = false;
+ if (xmlData[i] === '/') {
+ //closing tag
+ closingTag = true;
+ i++;
+ }
+ //read tagname
+ let tagName = '';
+ for (; i < xmlData.length &&
+ xmlData[i] !== '>' &&
+ xmlData[i] !== ' ' &&
+ xmlData[i] !== '\t' &&
+ xmlData[i] !== '\n' &&
+ xmlData[i] !== '\r'; i++
+ ) {
+ tagName += xmlData[i];
+ }
+ tagName = tagName.trim();
+ //console.log(tagName);
+
+ if (tagName[tagName.length - 1] === '/') {
+ //self closing tag without attributes
+ tagName = tagName.substring(0, tagName.length - 1);
+ //continue;
+ i--;
+ }
+ if (!validateTagName(tagName)) {
+ let msg;
+ if (tagName.trim().length === 0) {
+ msg = "Invalid space after '<'.";
+ } else {
+ msg = "Tag '"+tagName+"' is an invalid name.";
+ }
+ return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));
+ }
+
+ const result = readAttributeStr(xmlData, i);
+ if (result === false) {
+ return getErrorObject('InvalidAttr', "Attributes for '"+tagName+"' have open quote.", getLineNumberForPosition(xmlData, i));
+ }
+ let attrStr = result.value;
+ i = result.index;
+
+ if (attrStr[attrStr.length - 1] === '/') {
+ //self closing tag
+ const attrStrStart = i - attrStr.length;
+ attrStr = attrStr.substring(0, attrStr.length - 1);
+ const isValid = validateAttributeString(attrStr, options);
+ if (isValid === true) {
+ tagFound = true;
+ //continue; //text may presents after self closing tag
+ } else {
+ //the result from the nested function returns the position of the error within the attribute
+ //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
+ //this gives us the absolute index in the entire xml, which we can use to find the line at last
+ return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
+ }
+ } else if (closingTag) {
+ if (!result.tagClosed) {
+ return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
+ } else if (attrStr.trim().length > 0) {
+ return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
+ } else if (tags.length === 0) {
+ return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
+ } else {
+ const otg = tags.pop();
+ if (tagName !== otg.tagName) {
+ let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
+ return getErrorObject('InvalidTag',
+ "Expected closing tag '"+otg.tagName+"' (opened in line "+openPos.line+", col "+openPos.col+") instead of closing tag '"+tagName+"'.",
+ getLineNumberForPosition(xmlData, tagStartPos));
+ }
+
+ //when there are no more tags, we reached the root level.
+ if (tags.length == 0) {
+ reachedRoot = true;
+ }
+ }
+ } else {
+ const isValid = validateAttributeString(attrStr, options);
+ if (isValid !== true) {
+ //the result from the nested function returns the position of the error within the attribute
+ //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
+ //this gives us the absolute index in the entire xml, which we can use to find the line at last
+ return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
+ }
+
+ //if the root level has been reached before ...
+ if (reachedRoot === true) {
+ return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));
+ } else if(options.unpairedTags.indexOf(tagName) !== -1){
+ //don't push into stack
+ } else {
+ tags.push({tagName, tagStartPos});
+ }
+ tagFound = true;
+ }
+
+ //skip tag text value
+ //It may include comments and CDATA value
+ for (i++; i < xmlData.length; i++) {
+ if (xmlData[i] === '<') {
+ if (xmlData[i + 1] === '!') {
+ //comment or CADATA
+ i++;
+ i = readCommentAndCDATA(xmlData, i);
+ continue;
+ } else if (xmlData[i+1] === '?') {
+ i = readPI(xmlData, ++i);
+ if (i.err) return i;
+ } else{
+ break;
+ }
+ } else if (xmlData[i] === '&') {
+ const afterAmp = validateAmpersand(xmlData, i);
+ if (afterAmp == -1)
+ return getErrorObject('InvalidChar', "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
+ i = afterAmp;
+ }else{
+ if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {
+ return getErrorObject('InvalidXml', "Extra text at the end", getLineNumberForPosition(xmlData, i));
+ }
+ }
+ } //end of reading tag text value
+ if (xmlData[i] === '<') {
+ i--;
+ }
+ }
+ } else {
+ if ( isWhiteSpace(xmlData[i])) {
+ continue;
+ }
+ return getErrorObject('InvalidChar', "char '"+xmlData[i]+"' is not expected.", getLineNumberForPosition(xmlData, i));
+ }
+ }
+
+ if (!tagFound) {
+ return getErrorObject('InvalidXml', 'Start tag expected.', 1);
+ }else if (tags.length == 1) {
+ return getErrorObject('InvalidTag', "Unclosed tag '"+tags[0].tagName+"'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
+ }else if (tags.length > 0) {
+ return getErrorObject('InvalidXml', "Invalid '"+
+ JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\r?\n/g, '')+
+ "' found.", {line: 1, col: 1});
+ }
+
+ return true;
+};
+
+function isWhiteSpace(char){
+ return char === ' ' || char === '\t' || char === '\n' || char === '\r';
+}
+/**
+ * Read Processing insstructions and skip
+ * @param {*} xmlData
+ * @param {*} i
+ */
+function readPI(xmlData, i) {
+ const start = i;
+ for (; i < xmlData.length; i++) {
+ if (xmlData[i] == '?' || xmlData[i] == ' ') {
+ //tagname
+ const tagname = xmlData.substr(start, i - start);
+ if (i > 5 && tagname === 'xml') {
+ return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));
+ } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {
+ //check if valid attribut string
+ i++;
+ break;
+ } else {
+ continue;
+ }
+ }
+ }
+ return i;
+}
+
+function readCommentAndCDATA(xmlData, i) {
+ if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {
+ //comment
+ for (i += 3; i < xmlData.length; i++) {
+ if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {
+ i += 2;
+ break;
+ }
+ }
+ } else if (
+ xmlData.length > i + 8 &&
+ xmlData[i + 1] === 'D' &&
+ xmlData[i + 2] === 'O' &&
+ xmlData[i + 3] === 'C' &&
+ xmlData[i + 4] === 'T' &&
+ xmlData[i + 5] === 'Y' &&
+ xmlData[i + 6] === 'P' &&
+ xmlData[i + 7] === 'E'
+ ) {
+ let angleBracketsCount = 1;
+ for (i += 8; i < xmlData.length; i++) {
+ if (xmlData[i] === '<') {
+ angleBracketsCount++;
+ } else if (xmlData[i] === '>') {
+ angleBracketsCount--;
+ if (angleBracketsCount === 0) {
+ break;
+ }
+ }
+ }
+ } else if (
+ xmlData.length > i + 9 &&
+ xmlData[i + 1] === '[' &&
+ xmlData[i + 2] === 'C' &&
+ xmlData[i + 3] === 'D' &&
+ xmlData[i + 4] === 'A' &&
+ xmlData[i + 5] === 'T' &&
+ xmlData[i + 6] === 'A' &&
+ xmlData[i + 7] === '['
+ ) {
+ for (i += 8; i < xmlData.length; i++) {
+ if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {
+ i += 2;
+ break;
+ }
+ }
+ }
+
+ return i;
+}
+
+const doubleQuote = '"';
+const singleQuote = "'";
+
+/**
+ * Keep reading xmlData until '<' is found outside the attribute value.
+ * @param {string} xmlData
+ * @param {number} i
+ */
+function readAttributeStr(xmlData, i) {
+ let attrStr = '';
+ let startChar = '';
+ let tagClosed = false;
+ for (; i < xmlData.length; i++) {
+ if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
+ if (startChar === '') {
+ startChar = xmlData[i];
+ } else if (startChar !== xmlData[i]) {
+ //if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa
+ } else {
+ startChar = '';
+ }
+ } else if (xmlData[i] === '>') {
+ if (startChar === '') {
+ tagClosed = true;
+ break;
+ }
+ }
+ attrStr += xmlData[i];
+ }
+ if (startChar !== '') {
+ return false;
+ }
+
+ return {
+ value: attrStr,
+ index: i,
+ tagClosed: tagClosed
+ };
+}
+
+/**
+ * Select all the attributes whether valid or invalid.
+ */
+const validAttrStrRegxp = new RegExp('(\\s*)([^\\s=]+)(\\s*=)?(\\s*([\'"])(([\\s\\S])*?)\\5)?', 'g');
+
+//attr, ="sd", a="amit's", a="sd"b="saf", ab cd=""
+
+function validateAttributeString(attrStr, options) {
+ //console.log("start:"+attrStr+":end");
+
+ //if(attrStr.trim().length === 0) return true; //empty string
+
+ const matches = util.getAllMatches(attrStr, validAttrStrRegxp);
+ const attrNames = {};
+
+ for (let i = 0; i < matches.length; i++) {
+ if (matches[i][1].length === 0) {
+ //nospace before attribute name: a="sd"b="saf"
+ return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' has no space in starting.", getPositionFromMatch(matches[i]))
+ } else if (matches[i][3] !== undefined && matches[i][4] === undefined) {
+ return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' is without value.", getPositionFromMatch(matches[i]));
+ } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {
+ //independent attribute: ab
+ return getErrorObject('InvalidAttr', "boolean attribute '"+matches[i][2]+"' is not allowed.", getPositionFromMatch(matches[i]));
+ }
+ /* else if(matches[i][6] === undefined){//attribute without value: ab=
+ return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}};
+ } */
+ const attrName = matches[i][2];
+ if (!validateAttrName(attrName)) {
+ return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is an invalid name.", getPositionFromMatch(matches[i]));
+ }
+ if (!attrNames.hasOwnProperty(attrName)) {
+ //check for duplicate attribute.
+ attrNames[attrName] = 1;
+ } else {
+ return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is repeated.", getPositionFromMatch(matches[i]));
+ }
+ }
+
+ return true;
+}
+
+function validateNumberAmpersand(xmlData, i) {
+ let re = /\d/;
+ if (xmlData[i] === 'x') {
+ i++;
+ re = /[\da-fA-F]/;
+ }
+ for (; i < xmlData.length; i++) {
+ if (xmlData[i] === ';')
+ return i;
+ if (!xmlData[i].match(re))
+ break;
+ }
+ return -1;
+}
+
+function validateAmpersand(xmlData, i) {
+ // https://www.w3.org/TR/xml/#dt-charref
+ i++;
+ if (xmlData[i] === ';')
+ return -1;
+ if (xmlData[i] === '#') {
+ i++;
+ return validateNumberAmpersand(xmlData, i);
+ }
+ let count = 0;
+ for (; i < xmlData.length; i++, count++) {
+ if (xmlData[i].match(/\w/) && count < 20)
+ continue;
+ if (xmlData[i] === ';')
+ break;
+ return -1;
+ }
+ return i;
+}
+
+function getErrorObject(code, message, lineNumber) {
+ return {
+ err: {
+ code: code,
+ msg: message,
+ line: lineNumber.line || lineNumber,
+ col: lineNumber.col,
+ },
+ };
+}
+
+function validateAttrName(attrName) {
+ return util.isName(attrName);
+}
+
+// const startsWithXML = /^xml/i;
+
+function validateTagName(tagname) {
+ return util.isName(tagname) /* && !tagname.match(startsWithXML) */;
+}
+
+//this function returns the line number for the character at the given index
+function getLineNumberForPosition(xmlData, index) {
+ const lines = xmlData.substring(0, index).split(/\r?\n/);
+ return {
+ line: lines.length,
+
+ // column number is last line's length + 1, because column numbering starts at 1:
+ col: lines[lines.length - 1].length + 1
+ };
+}
+
+//this function returns the position of the first character of match within attrStr
+function getPositionFromMatch(match) {
+ return match.startIndex + match[1].length;
+}
+
+
+/***/ }),
+
+/***/ 659:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+"use strict";
+
+//parse Empty Node as self closing node
+const buildFromOrderedJs = __nccwpck_require__(3997);
+const getIgnoreAttributesFn = __nccwpck_require__(812)
+
+const defaultOptions = {
+ attributeNamePrefix: '@_',
+ attributesGroupName: false,
+ textNodeName: '#text',
+ ignoreAttributes: true,
+ cdataPropName: false,
+ format: false,
+ indentBy: ' ',
+ suppressEmptyNode: false,
+ suppressUnpairedNode: true,
+ suppressBooleanAttributes: true,
+ tagValueProcessor: function(key, a) {
+ return a;
+ },
+ attributeValueProcessor: function(attrName, a) {
+ return a;
+ },
+ preserveOrder: false,
+ commentPropName: false,
+ unpairedTags: [],
+ entities: [
+ { regex: new RegExp("&", "g"), val: "&" },//it must be on top
+ { regex: new RegExp(">", "g"), val: ">" },
+ { regex: new RegExp("<", "g"), val: "<" },
+ { regex: new RegExp("\'", "g"), val: "'" },
+ { regex: new RegExp("\"", "g"), val: """ }
+ ],
+ processEntities: true,
+ stopNodes: [],
+ // transformTagName: false,
+ // transformAttributeName: false,
+ oneListGroup: false
+};
+
+function Builder(options) {
+ this.options = Object.assign({}, defaultOptions, options);
+ if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
+ this.isAttribute = function(/*a*/) {
+ return false;
+ };
+ } else {
+ this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
+ this.attrPrefixLen = this.options.attributeNamePrefix.length;
+ this.isAttribute = isAttribute;
+ }
+
+ this.processTextOrObjNode = processTextOrObjNode
+
+ if (this.options.format) {
+ this.indentate = indentate;
+ this.tagEndChar = '>\n';
+ this.newLine = '\n';
+ } else {
+ this.indentate = function() {
+ return '';
+ };
+ this.tagEndChar = '>';
+ this.newLine = '';
+ }
+}
+
+Builder.prototype.build = function(jObj) {
+ if(this.options.preserveOrder){
+ return buildFromOrderedJs(jObj, this.options);
+ }else {
+ if(Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1){
+ jObj = {
+ [this.options.arrayNodeName] : jObj
+ }
+ }
+ return this.j2x(jObj, 0, []).val;
+ }
+};
+
+Builder.prototype.j2x = function(jObj, level, ajPath) {
+ let attrStr = '';
+ let val = '';
+ const jPath = ajPath.join('.')
+ for (let key in jObj) {
+ if(!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
+ if (typeof jObj[key] === 'undefined') {
+ // supress undefined node only if it is not an attribute
+ if (this.isAttribute(key)) {
+ val += '';
+ }
+ } else if (jObj[key] === null) {
+ // null attribute should be ignored by the attribute list, but should not cause the tag closing
+ if (this.isAttribute(key)) {
+ val += '';
+ } else if (key[0] === '?') {
+ val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
+ } else {
+ val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
+ }
+ // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
+ } else if (jObj[key] instanceof Date) {
+ val += this.buildTextValNode(jObj[key], key, '', level);
+ } else if (typeof jObj[key] !== 'object') {
+ //premitive type
+ const attr = this.isAttribute(key);
+ if (attr && !this.ignoreAttributesFn(attr, jPath)) {
+ attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);
+ } else if (!attr) {
+ //tag value
+ if (key === this.options.textNodeName) {
+ let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
+ val += this.replaceEntitiesValue(newval);
+ } else {
+ val += this.buildTextValNode(jObj[key], key, '', level);
+ }
+ }
+ } else if (Array.isArray(jObj[key])) {
+ //repeated nodes
+ const arrLen = jObj[key].length;
+ let listTagVal = "";
+ let listTagAttr = "";
+ for (let j = 0; j < arrLen; j++) {
+ const item = jObj[key][j];
+ if (typeof item === 'undefined') {
+ // supress undefined node
+ } else if (item === null) {
+ if(key[0] === "?") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
+ else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
+ // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
+ } else if (typeof item === 'object') {
+ if(this.options.oneListGroup){
+ const result = this.j2x(item, level + 1, ajPath.concat(key));
+ listTagVal += result.val;
+ if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
+ listTagAttr += result.attrStr
+ }
+ }else{
+ listTagVal += this.processTextOrObjNode(item, key, level, ajPath)
+ }
+ } else {
+ if (this.options.oneListGroup) {
+ let textValue = this.options.tagValueProcessor(key, item);
+ textValue = this.replaceEntitiesValue(textValue);
+ listTagVal += textValue;
+ } else {
+ listTagVal += this.buildTextValNode(item, key, '', level);
+ }
+ }
+ }
+ if(this.options.oneListGroup){
+ listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
+ }
+ val += listTagVal;
+ } else {
+ //nested node
+ if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
+ const Ks = Object.keys(jObj[key]);
+ const L = Ks.length;
+ for (let j = 0; j < L; j++) {
+ attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);
+ }
+ } else {
+ val += this.processTextOrObjNode(jObj[key], key, level, ajPath)
+ }
+ }
+ }
+ return {attrStr: attrStr, val: val};
+};
+
+Builder.prototype.buildAttrPairStr = function(attrName, val){
+ val = this.options.attributeValueProcessor(attrName, '' + val);
+ val = this.replaceEntitiesValue(val);
+ if (this.options.suppressBooleanAttributes && val === "true") {
+ return ' ' + attrName;
+ } else return ' ' + attrName + '="' + val + '"';
+}
+
+function processTextOrObjNode (object, key, level, ajPath) {
+ const result = this.j2x(object, level + 1, ajPath.concat(key));
+ if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
+ return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
+ } else {
+ return this.buildObjectNode(result.val, key, result.attrStr, level);
+ }
+}
+
+Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
+ if(val === ""){
+ if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
+ else {
+ return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
+ }
+ }else{
+
+ let tagEndExp = '' + key + this.tagEndChar;
+ let piClosingChar = "";
+
+ if(key[0] === "?") {
+ piClosingChar = "?";
+ tagEndExp = "";
+ }
+
+ // attrStr is an empty string in case the attribute came as undefined or null
+ if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {
+ return ( this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp );
+ } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
+ return this.indentate(level) + `` + this.newLine;
+ }else {
+ return (
+ this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar +
+ val +
+ this.indentate(level) + tagEndExp );
+ }
+ }
+}
+
+Builder.prototype.closeTag = function(key){
+ let closeTag = "";
+ if(this.options.unpairedTags.indexOf(key) !== -1){ //unpaired
+ if(!this.options.suppressUnpairedNode) closeTag = "/"
+ }else if(this.options.suppressEmptyNode){ //empty
+ closeTag = "/";
+ }else{
+ closeTag = `>${key}`
+ }
+ return closeTag;
+}
+
+function buildEmptyObjNode(val, key, attrStr, level) {
+ if (val !== '') {
+ return this.buildObjectNode(val, key, attrStr, level);
+ } else {
+ if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
+ else {
+ return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;
+ // return this.buildTagStr(level,key, attrStr);
+ }
+ }
+}
+
+Builder.prototype.buildTextValNode = function(val, key, attrStr, level) {
+ if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
+ return this.indentate(level) + `` + this.newLine;
+ }else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
+ return this.indentate(level) + `` + this.newLine;
+ }else if(key[0] === "?") {//PI tag
+ return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
+ }else{
+ let textValue = this.options.tagValueProcessor(key, val);
+ textValue = this.replaceEntitiesValue(textValue);
+
+ if( textValue === ''){
+ return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
+ }else{
+ return this.indentate(level) + '<' + key + attrStr + '>' +
+ textValue +
+ '' + key + this.tagEndChar;
+ }
+ }
+}
+
+Builder.prototype.replaceEntitiesValue = function(textValue){
+ if(textValue && textValue.length > 0 && this.options.processEntities){
+ for (let i=0; i {
+
+const EOL = "\n";
+
+/**
+ *
+ * @param {array} jArray
+ * @param {any} options
+ * @returns
+ */
+function toXml(jArray, options) {
+ let indentation = "";
+ if (options.format && options.indentBy.length > 0) {
+ indentation = EOL;
+ }
+ return arrToStr(jArray, options, "", indentation);
+}
+
+function arrToStr(arr, options, jPath, indentation) {
+ let xmlStr = "";
+ let isPreviousElementTag = false;
+
+ for (let i = 0; i < arr.length; i++) {
+ const tagObj = arr[i];
+ const tagName = propName(tagObj);
+ if(tagName === undefined) continue;
+
+ let newJPath = "";
+ if (jPath.length === 0) newJPath = tagName
+ else newJPath = `${jPath}.${tagName}`;
+
+ if (tagName === options.textNodeName) {
+ let tagText = tagObj[tagName];
+ if (!isStopNode(newJPath, options)) {
+ tagText = options.tagValueProcessor(tagName, tagText);
+ tagText = replaceEntitiesValue(tagText, options);
+ }
+ if (isPreviousElementTag) {
+ xmlStr += indentation;
+ }
+ xmlStr += tagText;
+ isPreviousElementTag = false;
+ continue;
+ } else if (tagName === options.cdataPropName) {
+ if (isPreviousElementTag) {
+ xmlStr += indentation;
+ }
+ xmlStr += ``;
+ isPreviousElementTag = false;
+ continue;
+ } else if (tagName === options.commentPropName) {
+ xmlStr += indentation + ``;
+ isPreviousElementTag = true;
+ continue;
+ } else if (tagName[0] === "?") {
+ const attStr = attr_to_str(tagObj[":@"], options);
+ const tempInd = tagName === "?xml" ? "" : indentation;
+ let piTextNodeName = tagObj[tagName][0][options.textNodeName];
+ piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
+ xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;
+ isPreviousElementTag = true;
+ continue;
+ }
+ let newIdentation = indentation;
+ if (newIdentation !== "") {
+ newIdentation += options.indentBy;
+ }
+ const attStr = attr_to_str(tagObj[":@"], options);
+ const tagStart = indentation + `<${tagName}${attStr}`;
+ const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
+ if (options.unpairedTags.indexOf(tagName) !== -1) {
+ if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
+ else xmlStr += tagStart + "/>";
+ } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
+ xmlStr += tagStart + "/>";
+ } else if (tagValue && tagValue.endsWith(">")) {
+ xmlStr += tagStart + `>${tagValue}${indentation}${tagName}>`;
+ } else {
+ xmlStr += tagStart + ">";
+ if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes(""))) {
+ xmlStr += indentation + options.indentBy + tagValue + indentation;
+ } else {
+ xmlStr += tagValue;
+ }
+ xmlStr += `${tagName}>`;
+ }
+ isPreviousElementTag = true;
+ }
+
+ return xmlStr;
+}
+
+function propName(obj) {
+ const keys = Object.keys(obj);
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ if(!obj.hasOwnProperty(key)) continue;
+ if (key !== ":@") return key;
+ }
+}
+
+function attr_to_str(attrMap, options) {
+ let attrStr = "";
+ if (attrMap && !options.ignoreAttributes) {
+ for (let attr in attrMap) {
+ if(!attrMap.hasOwnProperty(attr)) continue;
+ let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
+ attrVal = replaceEntitiesValue(attrVal, options);
+ if (attrVal === true && options.suppressBooleanAttributes) {
+ attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
+ } else {
+ attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
+ }
+ }
+ }
+ return attrStr;
+}
+
+function isStopNode(jPath, options) {
+ jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
+ let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
+ for (let index in options.stopNodes) {
+ if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
+ }
+ return false;
+}
+
+function replaceEntitiesValue(textValue, options) {
+ if (textValue && textValue.length > 0 && options.processEntities) {
+ for (let i = 0; i < options.entities.length; i++) {
+ const entity = options.entities[i];
+ textValue = textValue.replace(entity.regex, entity.val);
+ }
+ }
+ return textValue;
+}
+module.exports = toXml;
+
+
+/***/ }),
+
+/***/ 151:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+const util = __nccwpck_require__(7019);
+
+//TODO: handle comments
+function readDocType(xmlData, i){
+
+ const entities = {};
+ if( xmlData[i + 3] === 'O' &&
+ xmlData[i + 4] === 'C' &&
+ xmlData[i + 5] === 'T' &&
+ xmlData[i + 6] === 'Y' &&
+ xmlData[i + 7] === 'P' &&
+ xmlData[i + 8] === 'E')
+ {
+ i = i+9;
+ let angleBracketsCount = 1;
+ let hasBody = false, comment = false;
+ let exp = "";
+ for(;i') { //Read tag content
+ if(comment){
+ if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
+ comment = false;
+ angleBracketsCount--;
+ }
+ }else{
+ angleBracketsCount--;
+ }
+ if (angleBracketsCount === 0) {
+ break;
+ }
+ }else if( xmlData[i] === '['){
+ hasBody = true;
+ }else{
+ exp += xmlData[i];
+ }
+ }
+ if(angleBracketsCount !== 0){
+ throw new Error(`Unclosed DOCTYPE`);
+ }
+ }else{
+ throw new Error(`Invalid Tag instead of DOCTYPE`);
+ }
+ return {entities, i};
+}
+
+function readEntityExp(xmlData,i){
+ //External entities are not supported
+ //
+
+ //Parameter entities are not supported
+ //
+
+ //Internal entities are supported
+ //
+
+ //read EntityName
+ let entityName = "";
+ for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"' ); i++) {
+ // if(xmlData[i] === " ") continue;
+ // else
+ entityName += xmlData[i];
+ }
+ entityName = entityName.trim();
+ if(entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported");
+
+ //read Entity Value
+ const startChar = xmlData[i++];
+ let val = ""
+ for (; i < xmlData.length && xmlData[i] !== startChar ; i++) {
+ val += xmlData[i];
+ }
+ return [entityName, val, i];
+}
+
+function isComment(xmlData, i){
+ if(xmlData[i+1] === '!' &&
+ xmlData[i+2] === '-' &&
+ xmlData[i+3] === '-') return true
+ return false
+}
+function isEntity(xmlData, i){
+ if(xmlData[i+1] === '!' &&
+ xmlData[i+2] === 'E' &&
+ xmlData[i+3] === 'N' &&
+ xmlData[i+4] === 'T' &&
+ xmlData[i+5] === 'I' &&
+ xmlData[i+6] === 'T' &&
+ xmlData[i+7] === 'Y') return true
+ return false
+}
+function isElement(xmlData, i){
+ if(xmlData[i+1] === '!' &&
+ xmlData[i+2] === 'E' &&
+ xmlData[i+3] === 'L' &&
+ xmlData[i+4] === 'E' &&
+ xmlData[i+5] === 'M' &&
+ xmlData[i+6] === 'E' &&
+ xmlData[i+7] === 'N' &&
+ xmlData[i+8] === 'T') return true
+ return false
+}
+
+function isAttlist(xmlData, i){
+ if(xmlData[i+1] === '!' &&
+ xmlData[i+2] === 'A' &&
+ xmlData[i+3] === 'T' &&
+ xmlData[i+4] === 'T' &&
+ xmlData[i+5] === 'L' &&
+ xmlData[i+6] === 'I' &&
+ xmlData[i+7] === 'S' &&
+ xmlData[i+8] === 'T') return true
+ return false
+}
+function isNotation(xmlData, i){
+ if(xmlData[i+1] === '!' &&
+ xmlData[i+2] === 'N' &&
+ xmlData[i+3] === 'O' &&
+ xmlData[i+4] === 'T' &&
+ xmlData[i+5] === 'A' &&
+ xmlData[i+6] === 'T' &&
+ xmlData[i+7] === 'I' &&
+ xmlData[i+8] === 'O' &&
+ xmlData[i+9] === 'N') return true
+ return false
+}
+
+function validateEntityName(name){
+ if (util.isName(name))
+ return name;
+ else
+ throw new Error(`Invalid entity name ${name}`);
+}
+
+module.exports = readDocType;
+
+
+/***/ }),
+
+/***/ 4769:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+const defaultOptions = {
+ preserveOrder: false,
+ attributeNamePrefix: '@_',
+ attributesGroupName: false,
+ textNodeName: '#text',
+ ignoreAttributes: true,
+ removeNSPrefix: false, // remove NS from tag name or attribute name if true
+ allowBooleanAttributes: false, //a tag can have attributes without any value
+ //ignoreRootElement : false,
+ parseTagValue: true,
+ parseAttributeValue: false,
+ trimValues: true, //Trim string values of tag and attributes
+ cdataPropName: false,
+ numberParseOptions: {
+ hex: true,
+ leadingZeros: true,
+ eNotation: true
+ },
+ tagValueProcessor: function(tagName, val) {
+ return val;
+ },
+ attributeValueProcessor: function(attrName, val) {
+ return val;
+ },
+ stopNodes: [], //nested tags will not be parsed even for errors
+ alwaysCreateTextNode: false,
+ isArray: () => false,
+ commentPropName: false,
+ unpairedTags: [],
+ processEntities: true,
+ htmlEntities: false,
+ ignoreDeclaration: false,
+ ignorePiTags: false,
+ transformTagName: false,
+ transformAttributeName: false,
+ updateTag: function(tagName, jPath, attrs){
+ return tagName
+ },
+ // skipEmptyListItem: false
+};
+
+const buildOptions = function(options) {
+ return Object.assign({}, defaultOptions, options);
+};
+
+exports.buildOptions = buildOptions;
+exports.defaultOptions = defaultOptions;
+
+/***/ }),
+
+/***/ 3017:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+"use strict";
+
+///@ts-check
+
+const util = __nccwpck_require__(7019);
+const xmlNode = __nccwpck_require__(9307);
+const readDocType = __nccwpck_require__(151);
+const toNumber = __nccwpck_require__(6496);
+const getIgnoreAttributesFn = __nccwpck_require__(812)
+
+// const regx =
+// '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)'
+// .replace(/NAME/g, util.nameRegexp);
+
+//const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
+//const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
+
+class OrderedObjParser{
+ constructor(options){
+ this.options = options;
+ this.currentNode = null;
+ this.tagsNodeStack = [];
+ this.docTypeEntities = {};
+ this.lastEntities = {
+ "apos" : { regex: /&(apos|#39|#x27);/g, val : "'"},
+ "gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"},
+ "lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"},
+ "quot" : { regex: /&(quot|#34|#x22);/g, val : "\""},
+ };
+ this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : "&"};
+ this.htmlEntities = {
+ "space": { regex: /&(nbsp|#160);/g, val: " " },
+ // "lt" : { regex: /&(lt|#60);/g, val: "<" },
+ // "gt" : { regex: /&(gt|#62);/g, val: ">" },
+ // "amp" : { regex: /&(amp|#38);/g, val: "&" },
+ // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
+ // "apos" : { regex: /&(apos|#39);/g, val: "'" },
+ "cent" : { regex: /&(cent|#162);/g, val: "¢" },
+ "pound" : { regex: /&(pound|#163);/g, val: "£" },
+ "yen" : { regex: /&(yen|#165);/g, val: "¥" },
+ "euro" : { regex: /&(euro|#8364);/g, val: "€" },
+ "copyright" : { regex: /&(copy|#169);/g, val: "©" },
+ "reg" : { regex: /&(reg|#174);/g, val: "®" },
+ "inr" : { regex: /&(inr|#8377);/g, val: "₹" },
+ "num_dec": { regex: /([0-9]{1,7});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
+ "num_hex": { regex: /([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 16)) },
+ };
+ this.addExternalEntities = addExternalEntities;
+ this.parseXml = parseXml;
+ this.parseTextData = parseTextData;
+ this.resolveNameSpace = resolveNameSpace;
+ this.buildAttributesMap = buildAttributesMap;
+ this.isItStopNode = isItStopNode;
+ this.replaceEntitiesValue = replaceEntitiesValue;
+ this.readStopNodeData = readStopNodeData;
+ this.saveTextToParentTag = saveTextToParentTag;
+ this.addChild = addChild;
+ this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
+ }
+
+}
+
+function addExternalEntities(externalEntities){
+ const entKeys = Object.keys(externalEntities);
+ for (let i = 0; i < entKeys.length; i++) {
+ const ent = entKeys[i];
+ this.lastEntities[ent] = {
+ regex: new RegExp("&"+ent+";","g"),
+ val : externalEntities[ent]
+ }
+ }
+}
+
+/**
+ * @param {string} val
+ * @param {string} tagName
+ * @param {string} jPath
+ * @param {boolean} dontTrim
+ * @param {boolean} hasAttributes
+ * @param {boolean} isLeafNode
+ * @param {boolean} escapeEntities
+ */
+function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
+ if (val !== undefined) {
+ if (this.options.trimValues && !dontTrim) {
+ val = val.trim();
+ }
+ if(val.length > 0){
+ if(!escapeEntities) val = this.replaceEntitiesValue(val);
+
+ const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
+ if(newval === null || newval === undefined){
+ //don't parse
+ return val;
+ }else if(typeof newval !== typeof val || newval !== val){
+ //overwrite
+ return newval;
+ }else if(this.options.trimValues){
+ return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
+ }else{
+ const trimmedVal = val.trim();
+ if(trimmedVal === val){
+ return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
+ }else{
+ return val;
+ }
+ }
+ }
+ }
+}
+
+function resolveNameSpace(tagname) {
+ if (this.options.removeNSPrefix) {
+ const tags = tagname.split(':');
+ const prefix = tagname.charAt(0) === '/' ? '/' : '';
+ if (tags[0] === 'xmlns') {
+ return '';
+ }
+ if (tags.length === 2) {
+ tagname = prefix + tags[1];
+ }
+ }
+ return tagname;
+}
+
+//TODO: change regex to capture NS
+//const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
+const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
+
+function buildAttributesMap(attrStr, jPath, tagName) {
+ if (this.options.ignoreAttributes !== true && typeof attrStr === 'string') {
+ // attrStr = attrStr.replace(/\r?\n/g, ' ');
+ //attrStr = attrStr || attrStr.trim();
+
+ const matches = util.getAllMatches(attrStr, attrsRegx);
+ const len = matches.length; //don't make it inline
+ const attrs = {};
+ for (let i = 0; i < len; i++) {
+ const attrName = this.resolveNameSpace(matches[i][1]);
+ if (this.ignoreAttributesFn(attrName, jPath)) {
+ continue
+ }
+ let oldVal = matches[i][4];
+ let aName = this.options.attributeNamePrefix + attrName;
+ if (attrName.length) {
+ if (this.options.transformAttributeName) {
+ aName = this.options.transformAttributeName(aName);
+ }
+ if(aName === "__proto__") aName = "#__proto__";
+ if (oldVal !== undefined) {
+ if (this.options.trimValues) {
+ oldVal = oldVal.trim();
+ }
+ oldVal = this.replaceEntitiesValue(oldVal);
+ const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
+ if(newVal === null || newVal === undefined){
+ //don't parse
+ attrs[aName] = oldVal;
+ }else if(typeof newVal !== typeof oldVal || newVal !== oldVal){
+ //overwrite
+ attrs[aName] = newVal;
+ }else{
+ //parse
+ attrs[aName] = parseValue(
+ oldVal,
+ this.options.parseAttributeValue,
+ this.options.numberParseOptions
+ );
+ }
+ } else if (this.options.allowBooleanAttributes) {
+ attrs[aName] = true;
+ }
+ }
+ }
+ if (!Object.keys(attrs).length) {
+ return;
+ }
+ if (this.options.attributesGroupName) {
+ const attrCollection = {};
+ attrCollection[this.options.attributesGroupName] = attrs;
+ return attrCollection;
+ }
+ return attrs
+ }
+}
+
+const parseXml = function(xmlData) {
+ xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line
+ const xmlObj = new xmlNode('!xml');
+ let currentNode = xmlObj;
+ let textData = "";
+ let jPath = "";
+ for(let i=0; i< xmlData.length; i++){//for each char in XML data
+ const ch = xmlData[i];
+ if(ch === '<'){
+ // const nextIndex = i+1;
+ // const _2ndChar = xmlData[nextIndex];
+ if( xmlData[i+1] === '/') {//Closing Tag
+ const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.")
+ let tagName = xmlData.substring(i+2,closeIndex).trim();
+
+ if(this.options.removeNSPrefix){
+ const colonIndex = tagName.indexOf(":");
+ if(colonIndex !== -1){
+ tagName = tagName.substr(colonIndex+1);
+ }
+ }
+
+ if(this.options.transformTagName) {
+ tagName = this.options.transformTagName(tagName);
+ }
+
+ if(currentNode){
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
+ }
+
+ //check if last tag of nested tag was unpaired tag
+ const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1);
+ if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){
+ throw new Error(`Unpaired tag can not be used as closing tag: ${tagName}>`);
+ }
+ let propIndex = 0
+ if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){
+ propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1)
+ this.tagsNodeStack.pop();
+ }else{
+ propIndex = jPath.lastIndexOf(".");
+ }
+ jPath = jPath.substring(0, propIndex);
+
+ currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
+ textData = "";
+ i = closeIndex;
+ } else if( xmlData[i+1] === '?') {
+
+ let tagData = readTagExp(xmlData,i, false, "?>");
+ if(!tagData) throw new Error("Pi Tag is not closed.");
+
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
+ if( (this.options.ignoreDeclaration && tagData.tagName === "?xml") || this.options.ignorePiTags){
+
+ }else{
+
+ const childNode = new xmlNode(tagData.tagName);
+ childNode.add(this.options.textNodeName, "");
+
+ if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){
+ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
+ }
+ this.addChild(currentNode, childNode, jPath)
+
+ }
+
+
+ i = tagData.closeIndex + 1;
+ } else if(xmlData.substr(i + 1, 3) === '!--') {
+ const endIndex = findClosingIndex(xmlData, "-->", i+4, "Comment is not closed.")
+ if(this.options.commentPropName){
+ const comment = xmlData.substring(i + 4, endIndex - 2);
+
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
+
+ currentNode.add(this.options.commentPropName, [ { [this.options.textNodeName] : comment } ]);
+ }
+ i = endIndex;
+ } else if( xmlData.substr(i + 1, 2) === '!D') {
+ const result = readDocType(xmlData, i);
+ this.docTypeEntities = result.entities;
+ i = result.i;
+ }else if(xmlData.substr(i + 1, 2) === '![') {
+ const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
+ const tagExp = xmlData.substring(i + 9,closeIndex);
+
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
+
+ let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
+ if(val == undefined) val = "";
+
+ //cdata should be set even if it is 0 length string
+ if(this.options.cdataPropName){
+ currentNode.add(this.options.cdataPropName, [ { [this.options.textNodeName] : tagExp } ]);
+ }else{
+ currentNode.add(this.options.textNodeName, val);
+ }
+
+ i = closeIndex + 2;
+ }else {//Opening tag
+ let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
+ let tagName= result.tagName;
+ const rawTagName = result.rawTagName;
+ let tagExp = result.tagExp;
+ let attrExpPresent = result.attrExpPresent;
+ let closeIndex = result.closeIndex;
+
+ if (this.options.transformTagName) {
+ tagName = this.options.transformTagName(tagName);
+ }
+
+ //save text as child node
+ if (currentNode && textData) {
+ if(currentNode.tagname !== '!xml'){
+ //when nested tag is found
+ textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
+ }
+ }
+
+ //check if last tag was unpaired tag
+ const lastTag = currentNode;
+ if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){
+ currentNode = this.tagsNodeStack.pop();
+ jPath = jPath.substring(0, jPath.lastIndexOf("."));
+ }
+ if(tagName !== xmlObj.tagname){
+ jPath += jPath ? "." + tagName : tagName;
+ }
+ if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
+ let tagContent = "";
+ //self-closing tag
+ if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
+ if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
+ tagName = tagName.substr(0, tagName.length - 1);
+ jPath = jPath.substr(0, jPath.length - 1);
+ tagExp = tagName;
+ }else{
+ tagExp = tagExp.substr(0, tagExp.length - 1);
+ }
+ i = result.closeIndex;
+ }
+ //unpaired tag
+ else if(this.options.unpairedTags.indexOf(tagName) !== -1){
+
+ i = result.closeIndex;
+ }
+ //normal tag
+ else{
+ //read until closing tag is found
+ const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
+ if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
+ i = result.i;
+ tagContent = result.tagContent;
+ }
+
+ const childNode = new xmlNode(tagName);
+ if(tagName !== tagExp && attrExpPresent){
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
+ }
+ if(tagContent) {
+ tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
+ }
+
+ jPath = jPath.substr(0, jPath.lastIndexOf("."));
+ childNode.add(this.options.textNodeName, tagContent);
+
+ this.addChild(currentNode, childNode, jPath)
+ }else{
+ //selfClosing tag
+ if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
+ if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
+ tagName = tagName.substr(0, tagName.length - 1);
+ jPath = jPath.substr(0, jPath.length - 1);
+ tagExp = tagName;
+ }else{
+ tagExp = tagExp.substr(0, tagExp.length - 1);
+ }
+
+ if(this.options.transformTagName) {
+ tagName = this.options.transformTagName(tagName);
+ }
+
+ const childNode = new xmlNode(tagName);
+ if(tagName !== tagExp && attrExpPresent){
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
+ }
+ this.addChild(currentNode, childNode, jPath)
+ jPath = jPath.substr(0, jPath.lastIndexOf("."));
+ }
+ //opening tag
+ else{
+ const childNode = new xmlNode( tagName);
+ this.tagsNodeStack.push(currentNode);
+
+ if(tagName !== tagExp && attrExpPresent){
+ childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
+ }
+ this.addChild(currentNode, childNode, jPath)
+ currentNode = childNode;
+ }
+ textData = "";
+ i = closeIndex;
+ }
+ }
+ }else{
+ textData += xmlData[i];
+ }
+ }
+ return xmlObj.child;
+}
+
+function addChild(currentNode, childNode, jPath){
+ const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"])
+ if(result === false){
+ }else if(typeof result === "string"){
+ childNode.tagname = result
+ currentNode.addChild(childNode);
+ }else{
+ currentNode.addChild(childNode);
+ }
+}
+
+const replaceEntitiesValue = function(val){
+
+ if(this.options.processEntities){
+ for(let entityName in this.docTypeEntities){
+ const entity = this.docTypeEntities[entityName];
+ val = val.replace( entity.regx, entity.val);
+ }
+ for(let entityName in this.lastEntities){
+ const entity = this.lastEntities[entityName];
+ val = val.replace( entity.regex, entity.val);
+ }
+ if(this.options.htmlEntities){
+ for(let entityName in this.htmlEntities){
+ const entity = this.htmlEntities[entityName];
+ val = val.replace( entity.regex, entity.val);
+ }
+ }
+ val = val.replace( this.ampEntity.regex, this.ampEntity.val);
+ }
+ return val;
+}
+function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
+ if (textData) { //store previously collected data as textNode
+ if(isLeafNode === undefined) isLeafNode = Object.keys(currentNode.child).length === 0
+
+ textData = this.parseTextData(textData,
+ currentNode.tagname,
+ jPath,
+ false,
+ currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
+ isLeafNode);
+
+ if (textData !== undefined && textData !== "")
+ currentNode.add(this.options.textNodeName, textData);
+ textData = "";
+ }
+ return textData;
+}
+
+//TODO: use jPath to simplify the logic
+/**
+ *
+ * @param {string[]} stopNodes
+ * @param {string} jPath
+ * @param {string} currentTagName
+ */
+function isItStopNode(stopNodes, jPath, currentTagName){
+ const allNodesExp = "*." + currentTagName;
+ for (const stopNodePath in stopNodes) {
+ const stopNodeExp = stopNodes[stopNodePath];
+ if( allNodesExp === stopNodeExp || jPath === stopNodeExp ) return true;
+ }
+ return false;
+}
+
+/**
+ * Returns the tag Expression and where it is ending handling single-double quotes situation
+ * @param {string} xmlData
+ * @param {number} i starting index
+ * @returns
+ */
+function tagExpWithClosingIndex(xmlData, i, closingChar = ">"){
+ let attrBoundary;
+ let tagExp = "";
+ for (let index = i; index < xmlData.length; index++) {
+ let ch = xmlData[index];
+ if (attrBoundary) {
+ if (ch === attrBoundary) attrBoundary = "";//reset
+ } else if (ch === '"' || ch === "'") {
+ attrBoundary = ch;
+ } else if (ch === closingChar[0]) {
+ if(closingChar[1]){
+ if(xmlData[index + 1] === closingChar[1]){
+ return {
+ data: tagExp,
+ index: index
+ }
+ }
+ }else{
+ return {
+ data: tagExp,
+ index: index
+ }
+ }
+ } else if (ch === '\t') {
+ ch = " "
+ }
+ tagExp += ch;
+ }
+}
+
+function findClosingIndex(xmlData, str, i, errMsg){
+ const closingIndex = xmlData.indexOf(str, i);
+ if(closingIndex === -1){
+ throw new Error(errMsg)
+ }else{
+ return closingIndex + str.length - 1;
+ }
+}
+
+function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
+ const result = tagExpWithClosingIndex(xmlData, i+1, closingChar);
+ if(!result) return;
+ let tagExp = result.data;
+ const closeIndex = result.index;
+ const separatorIndex = tagExp.search(/\s/);
+ let tagName = tagExp;
+ let attrExpPresent = true;
+ if(separatorIndex !== -1){//separate tag name and attributes expression
+ tagName = tagExp.substring(0, separatorIndex);
+ tagExp = tagExp.substring(separatorIndex + 1).trimStart();
+ }
+
+ const rawTagName = tagName;
+ if(removeNSPrefix){
+ const colonIndex = tagName.indexOf(":");
+ if(colonIndex !== -1){
+ tagName = tagName.substr(colonIndex+1);
+ attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
+ }
+ }
+
+ return {
+ tagName: tagName,
+ tagExp: tagExp,
+ closeIndex: closeIndex,
+ attrExpPresent: attrExpPresent,
+ rawTagName: rawTagName,
+ }
+}
+/**
+ * find paired tag for a stop node
+ * @param {string} xmlData
+ * @param {string} tagName
+ * @param {number} i
+ */
+function readStopNodeData(xmlData, tagName, i){
+ const startIndex = i;
+ // Starting at 1 since we already have an open tag
+ let openTagCount = 1;
+
+ for (; i < xmlData.length; i++) {
+ if( xmlData[i] === "<"){
+ if (xmlData[i+1] === "/") {//close tag
+ const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`);
+ let closeTagName = xmlData.substring(i+2,closeIndex).trim();
+ if(closeTagName === tagName){
+ openTagCount--;
+ if (openTagCount === 0) {
+ return {
+ tagContent: xmlData.substring(startIndex, i),
+ i : closeIndex
+ }
+ }
+ }
+ i=closeIndex;
+ } else if(xmlData[i+1] === '?') {
+ const closeIndex = findClosingIndex(xmlData, "?>", i+1, "StopNode is not closed.")
+ i=closeIndex;
+ } else if(xmlData.substr(i + 1, 3) === '!--') {
+ const closeIndex = findClosingIndex(xmlData, "-->", i+3, "StopNode is not closed.")
+ i=closeIndex;
+ } else if(xmlData.substr(i + 1, 2) === '![') {
+ const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
+ i=closeIndex;
+ } else {
+ const tagData = readTagExp(xmlData, i, '>')
+
+ if (tagData) {
+ const openTagName = tagData && tagData.tagName;
+ if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== "/") {
+ openTagCount++;
+ }
+ i=tagData.closeIndex;
+ }
+ }
+ }
+ }//end for loop
+}
+
+function parseValue(val, shouldParse, options) {
+ if (shouldParse && typeof val === 'string') {
+ //console.log(options)
+ const newval = val.trim();
+ if(newval === 'true' ) return true;
+ else if(newval === 'false' ) return false;
+ else return toNumber(val, options);
+ } else {
+ if (util.isExist(val)) {
+ return val;
+ } else {
+ return '';
+ }
+ }
+}
+
+
+module.exports = OrderedObjParser;
+
+
+/***/ }),
+
+/***/ 9844:
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
+
+const { buildOptions} = __nccwpck_require__(4769);
+const OrderedObjParser = __nccwpck_require__(3017);
+const { prettify} = __nccwpck_require__(7594);
+const validator = __nccwpck_require__(9433);
+
+class XMLParser{
+
+ constructor(options){
+ this.externalEntities = {};
+ this.options = buildOptions(options);
+
+ }
+ /**
+ * Parse XML dats to JS object
+ * @param {string|Buffer} xmlData
+ * @param {boolean|Object} validationOption
+ */
+ parse(xmlData,validationOption){
+ if(typeof xmlData === "string"){
+ }else if( xmlData.toString){
+ xmlData = xmlData.toString();
+ }else{
+ throw new Error("XML data is accepted in String or Bytes[] form.")
+ }
+ if( validationOption){
+ if(validationOption === true) validationOption = {}; //validate with default options
+
+ const result = validator.validate(xmlData, validationOption);
+ if (result !== true) {
+ throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` )
+ }
+ }
+ const orderedObjParser = new OrderedObjParser(this.options);
+ orderedObjParser.addExternalEntities(this.externalEntities);
+ const orderedResult = orderedObjParser.parseXml(xmlData);
+ if(this.options.preserveOrder || orderedResult === undefined) return orderedResult;
+ else return prettify(orderedResult, this.options);
+ }
+
+ /**
+ * Add Entity which is not by default supported by this library
+ * @param {string} key
+ * @param {string} value
+ */
+ addEntity(key, value){
+ if(value.indexOf("&") !== -1){
+ throw new Error("Entity value can't have '&'")
+ }else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){
+ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'")
+ }else if(value === "&"){
+ throw new Error("An entity with value '&' is not permitted");
+ }else{
+ this.externalEntities[key] = value;
+ }
+ }
+}
+
+module.exports = XMLParser;
+
+/***/ }),
+
+/***/ 7594:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+
+/**
+ *
+ * @param {array} node
+ * @param {any} options
+ * @returns
+ */
+function prettify(node, options){
+ return compress( node, options);
+}
+
+/**
+ *
+ * @param {array} arr
+ * @param {object} options
+ * @param {string} jPath
+ * @returns object
+ */
+function compress(arr, options, jPath){
+ let text;
+ const compressedObj = {};
+ for (let i = 0; i < arr.length; i++) {
+ const tagObj = arr[i];
+ const property = propName(tagObj);
+ let newJpath = "";
+ if(jPath === undefined) newJpath = property;
+ else newJpath = jPath + "." + property;
+
+ if(property === options.textNodeName){
+ if(text === undefined) text = tagObj[property];
+ else text += "" + tagObj[property];
+ }else if(property === undefined){
+ continue;
+ }else if(tagObj[property]){
+
+ let val = compress(tagObj[property], options, newJpath);
+ const isLeaf = isLeafTag(val, options);
+
+ if(tagObj[":@"]){
+ assignAttributes( val, tagObj[":@"], newJpath, options);
+ }else if(Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode){
+ val = val[options.textNodeName];
+ }else if(Object.keys(val).length === 0){
+ if(options.alwaysCreateTextNode) val[options.textNodeName] = "";
+ else val = "";
+ }
+
+ if(compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) {
+ if(!Array.isArray(compressedObj[property])) {
+ compressedObj[property] = [ compressedObj[property] ];
+ }
+ compressedObj[property].push(val);
+ }else{
+ //TODO: if a node is not an array, then check if it should be an array
+ //also determine if it is a leaf node
+ if (options.isArray(property, newJpath, isLeaf )) {
+ compressedObj[property] = [val];
+ }else{
+ compressedObj[property] = val;
+ }
+ }
+ }
+
+ }
+ // if(text && text.length > 0) compressedObj[options.textNodeName] = text;
+ if(typeof text === "string"){
+ if(text.length > 0) compressedObj[options.textNodeName] = text;
+ }else if(text !== undefined) compressedObj[options.textNodeName] = text;
+ return compressedObj;
+}
+
+function propName(obj){
+ const keys = Object.keys(obj);
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ if(key !== ":@") return key;
+ }
+}
+
+function assignAttributes(obj, attrMap, jpath, options){
+ if (attrMap) {
+ const keys = Object.keys(attrMap);
+ const len = keys.length; //don't make it inline
+ for (let i = 0; i < len; i++) {
+ const atrrName = keys[i];
+ if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
+ obj[atrrName] = [ attrMap[atrrName] ];
+ } else {
+ obj[atrrName] = attrMap[atrrName];
+ }
+ }
+ }
+}
+
+function isLeafTag(obj, options){
+ const { textNodeName } = options;
+ const propCount = Object.keys(obj).length;
+
+ if (propCount === 0) {
+ return true;
+ }
+
+ if (
+ propCount === 1 &&
+ (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)
+ ) {
+ return true;
+ }
+
+ return false;
+}
+exports.prettify = prettify;
+
+
+/***/ }),
+
+/***/ 9307:
+/***/ ((module) => {
+
+"use strict";
+
+
+class XmlNode{
+ constructor(tagname) {
+ this.tagname = tagname;
+ this.child = []; //nested tags, text, cdata, comments in order
+ this[":@"] = {}; //attributes map
+ }
+ add(key,val){
+ // this.child.push( {name : key, val: val, isCdata: isCdata });
+ if(key === "__proto__") key = "#__proto__";
+ this.child.push( {[key]: val });
+ }
+ addChild(node) {
+ if(node.tagname === "__proto__") node.tagname = "#__proto__";
+ if(node[":@"] && Object.keys(node[":@"]).length > 0){
+ this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] });
+ }else{
+ this.child.push( { [node.tagname]: node.child });
+ }
+ };
+};
+
+
+module.exports = XmlNode;
+
/***/ }),
/***/ 3813:
@@ -43436,7 +45644,7 @@ var path = (function () { try { return __nccwpck_require__(6928) } catch (e) {}}
minimatch.sep = path.sep
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
-var expand = __nccwpck_require__(3783)
+var expand = __nccwpck_require__(4691)
var plTypes = {
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
@@ -44376,214 +46584,6 @@ function regExpEscape (s) {
}
-/***/ }),
-
-/***/ 3783:
-/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-
-var concatMap = __nccwpck_require__(7087);
-var balanced = __nccwpck_require__(9380);
-
-module.exports = expandTop;
-
-var escSlash = '\0SLASH'+Math.random()+'\0';
-var escOpen = '\0OPEN'+Math.random()+'\0';
-var escClose = '\0CLOSE'+Math.random()+'\0';
-var escComma = '\0COMMA'+Math.random()+'\0';
-var escPeriod = '\0PERIOD'+Math.random()+'\0';
-
-function numeric(str) {
- return parseInt(str, 10) == str
- ? parseInt(str, 10)
- : str.charCodeAt(0);
-}
-
-function escapeBraces(str) {
- return str.split('\\\\').join(escSlash)
- .split('\\{').join(escOpen)
- .split('\\}').join(escClose)
- .split('\\,').join(escComma)
- .split('\\.').join(escPeriod);
-}
-
-function unescapeBraces(str) {
- return str.split(escSlash).join('\\')
- .split(escOpen).join('{')
- .split(escClose).join('}')
- .split(escComma).join(',')
- .split(escPeriod).join('.');
-}
-
-
-// Basically just str.split(","), but handling cases
-// where we have nested braced sections, which should be
-// treated as individual members, like {a,{b,c},d}
-function parseCommaParts(str) {
- if (!str)
- return [''];
-
- var parts = [];
- var m = balanced('{', '}', str);
-
- if (!m)
- return str.split(',');
-
- var pre = m.pre;
- var body = m.body;
- var post = m.post;
- var p = pre.split(',');
-
- p[p.length-1] += '{' + body + '}';
- var postParts = parseCommaParts(post);
- if (post.length) {
- p[p.length-1] += postParts.shift();
- p.push.apply(p, postParts);
- }
-
- parts.push.apply(parts, p);
-
- return parts;
-}
-
-function expandTop(str) {
- if (!str)
- return [];
-
- // I don't know why Bash 4.3 does this, but it does.
- // Anything starting with {} will have the first two bytes preserved
- // but *only* at the top level, so {},a}b will not expand to anything,
- // but a{},b}c will be expanded to [a}c,abc].
- // One could argue that this is a bug in Bash, but since the goal of
- // this module is to match Bash's rules, we escape a leading {}
- if (str.substr(0, 2) === '{}') {
- str = '\\{\\}' + str.substr(2);
- }
-
- return expand(escapeBraces(str), true).map(unescapeBraces);
-}
-
-function identity(e) {
- return e;
-}
-
-function embrace(str) {
- return '{' + str + '}';
-}
-function isPadded(el) {
- return /^-?0\d/.test(el);
-}
-
-function lte(i, y) {
- return i <= y;
-}
-function gte(i, y) {
- return i >= y;
-}
-
-function expand(str, isTop) {
- var expansions = [];
-
- var m = balanced('{', '}', str);
- if (!m || /\$$/.test(m.pre)) return [str];
-
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
- var isSequence = isNumericSequence || isAlphaSequence;
- var isOptions = m.body.indexOf(',') >= 0;
- if (!isSequence && !isOptions) {
- // {a},b}
- if (m.post.match(/,.*\}/)) {
- str = m.pre + '{' + m.body + escClose + m.post;
- return expand(str);
- }
- return [str];
- }
-
- var n;
- if (isSequence) {
- n = m.body.split(/\.\./);
- } else {
- n = parseCommaParts(m.body);
- if (n.length === 1) {
- // x{{a,b}}y ==> x{a}y x{b}y
- n = expand(n[0], false).map(embrace);
- if (n.length === 1) {
- var post = m.post.length
- ? expand(m.post, false)
- : [''];
- return post.map(function(p) {
- return m.pre + n[0] + p;
- });
- }
- }
- }
-
- // at this point, n is the parts, and we know it's not a comma set
- // with a single entry.
-
- // no need to expand pre, since it is guaranteed to be free of brace-sets
- var pre = m.pre;
- var post = m.post.length
- ? expand(m.post, false)
- : [''];
-
- var N;
-
- if (isSequence) {
- var x = numeric(n[0]);
- var y = numeric(n[1]);
- var width = Math.max(n[0].length, n[1].length)
- var incr = n.length == 3
- ? Math.abs(numeric(n[2]))
- : 1;
- var test = lte;
- var reverse = y < x;
- if (reverse) {
- incr *= -1;
- test = gte;
- }
- var pad = n.some(isPadded);
-
- N = [];
-
- for (var i = x; test(i, y); i += incr) {
- var c;
- if (isAlphaSequence) {
- c = String.fromCharCode(i);
- if (c === '\\')
- c = '';
- } else {
- c = String(i);
- if (pad) {
- var need = width - c.length;
- if (need > 0) {
- var z = new Array(need + 1).join('0');
- if (i < 0)
- c = '-' + z + c.slice(1);
- else
- c = z + c;
- }
- }
- }
- N.push(c);
- }
- } else {
- N = concatMap(n, function(el) { return expand(el, false) });
- }
-
- for (var j = 0; j < N.length; j++) {
- for (var k = 0; k < post.length; k++) {
- var expansion = pre + N[j] + post[k];
- if (!isTop || isSequence || expansion)
- expansions.push(expansion);
- }
- }
-
- return expansions;
-}
-
-
-
/***/ }),
/***/ 744:
@@ -47449,6 +49449,137 @@ const validRange = (range, options) => {
module.exports = validRange
+/***/ }),
+
+/***/ 6496:
+/***/ ((module) => {
+
+const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
+const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
+// const octRegex = /0x[a-z0-9]+/;
+// const binRegex = /0x[a-z0-9]+/;
+
+
+//polyfill
+if (!Number.parseInt && window.parseInt) {
+ Number.parseInt = window.parseInt;
+}
+if (!Number.parseFloat && window.parseFloat) {
+ Number.parseFloat = window.parseFloat;
+}
+
+
+const consider = {
+ hex : true,
+ leadingZeros: true,
+ decimalPoint: "\.",
+ eNotation: true
+ //skipLike: /regex/
+};
+
+function toNumber(str, options = {}){
+ // const options = Object.assign({}, consider);
+ // if(opt.leadingZeros === false){
+ // options.leadingZeros = false;
+ // }else if(opt.hex === false){
+ // options.hex = false;
+ // }
+
+ options = Object.assign({}, consider, options );
+ if(!str || typeof str !== "string" ) return str;
+
+ let trimmedStr = str.trim();
+ // if(trimmedStr === "0.0") return 0;
+ // else if(trimmedStr === "+0.0") return 0;
+ // else if(trimmedStr === "-0.0") return -0;
+
+ if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
+ else if (options.hex && hexRegex.test(trimmedStr)) {
+ return Number.parseInt(trimmedStr, 16);
+ // } else if (options.parseOct && octRegex.test(str)) {
+ // return Number.parseInt(val, 8);
+ // }else if (options.parseBin && binRegex.test(str)) {
+ // return Number.parseInt(val, 2);
+ }else{
+ //separate negative sign, leading zeros, and rest number
+ const match = numRegex.exec(trimmedStr);
+ if(match){
+ const sign = match[1];
+ const leadingZeros = match[2];
+ let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
+ //trim ending zeros for floating number
+
+ const eNotation = match[4] || match[6];
+ if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123
+ else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123
+ else{//no leading zeros or leading zeros are allowed
+ const num = Number(trimmedStr);
+ const numStr = "" + num;
+ if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation
+ if(options.eNotation) return num;
+ else return str;
+ }else if(eNotation){ //given number has enotation
+ if(options.eNotation) return num;
+ else return str;
+ }else if(trimmedStr.indexOf(".") !== -1){ //floating number
+ // const decimalPart = match[5].substr(1);
+ // const intPart = trimmedStr.substr(0,trimmedStr.indexOf("."));
+
+
+ // const p = numStr.indexOf(".");
+ // const givenIntPart = numStr.substr(0,p);
+ // const givenDecPart = numStr.substr(p+1);
+ if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0
+ else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000
+ else if( sign && numStr === "-"+numTrimmedByZeros) return num;
+ else return str;
+ }
+
+ if(leadingZeros){
+ // if(numTrimmedByZeros === numStr){
+ // if(options.leadingZeros) return num;
+ // else return str;
+ // }else return str;
+ if(numTrimmedByZeros === numStr) return num;
+ else if(sign+numTrimmedByZeros === numStr) return num;
+ else return str;
+ }
+
+ if(trimmedStr === numStr) return num;
+ else if(trimmedStr === sign+numStr) return num;
+ // else{
+ // //number with +/- sign
+ // trimmedStr.test(/[-+][0-9]);
+
+ // }
+ return str;
+ }
+ // else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str;
+
+ }else{ //non-numeric string
+ return str;
+ }
+ }
+}
+
+/**
+ *
+ * @param {string} numStr without leading zeros
+ * @returns
+ */
+function trimZeros(numStr){
+ if(numStr && numStr.indexOf(".") !== -1){//float
+ numStr = numStr.replace(/0+$/, ""); //remove ending zeros
+ if(numStr === ".") numStr = "0";
+ else if(numStr[0] === ".") numStr = "0"+numStr;
+ else if(numStr[numStr.length-1] === ".") numStr = numStr.substr(0,numStr.length-1);
+ return numStr;
+ }
+ return numStr;
+}
+module.exports = toNumber
+
+
/***/ }),
/***/ 1450:
@@ -53660,7 +55791,7 @@ module.exports = {
const { parseSetCookie } = __nccwpck_require__(8915)
-const { stringify } = __nccwpck_require__(3834)
+const { stringify, getHeadersList } = __nccwpck_require__(3834)
const { webidl } = __nccwpck_require__(4222)
const { Headers } = __nccwpck_require__(6349)
@@ -53736,13 +55867,14 @@ function getSetCookies (headers) {
webidl.brandCheck(headers, Headers, { strict: false })
- const cookies = headers.getSetCookie()
+ const cookies = getHeadersList(headers).cookies
if (!cookies) {
return []
}
- return cookies.map((pair) => parseSetCookie(pair))
+ // In older versions of undici, cookies is a list of name:value.
+ return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair))
}
/**
@@ -54170,15 +56302,14 @@ module.exports = {
/***/ }),
/***/ 3834:
-/***/ ((module) => {
+/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-/**
- * @param {string} value
- * @returns {boolean}
- */
+const assert = __nccwpck_require__(2613)
+const { kHeadersList } = __nccwpck_require__(6443)
+
function isCTLExcludingHtab (value) {
if (value.length === 0) {
return false
@@ -54439,13 +56570,31 @@ function stringify (cookie) {
return out.join('; ')
}
+let kHeadersListNode
+
+function getHeadersList (headers) {
+ if (headers[kHeadersList]) {
+ return headers[kHeadersList]
+ }
+
+ if (!kHeadersListNode) {
+ kHeadersListNode = Object.getOwnPropertySymbols(headers).find(
+ (symbol) => symbol.description === 'headers list'
+ )
+
+ assert(kHeadersListNode, 'Headers cannot be parsed')
+ }
+
+ const headersList = headers[kHeadersListNode]
+ assert(headersList)
+
+ return headersList
+}
+
module.exports = {
isCTLExcludingHtab,
- validateCookieName,
- validateCookiePath,
- validateCookieValue,
- toIMFDate,
- stringify
+ stringify,
+ getHeadersList
}
@@ -56374,14 +58523,6 @@ const { isUint8Array, isArrayBuffer } = __nccwpck_require__(8253)
const { File: UndiciFile } = __nccwpck_require__(3041)
const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(4322)
-let random
-try {
- const crypto = __nccwpck_require__(7598)
- random = (max) => crypto.randomInt(0, max)
-} catch {
- random = (max) => Math.floor(Math.random(max))
-}
-
let ReadableStream = globalThis.ReadableStream
/** @type {globalThis['File']} */
@@ -56467,7 +58608,7 @@ function extractBody (object, keepalive = false) {
// Set source to a copy of the bytes held by object.
source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
} else if (util.isFormDataLike(object)) {
- const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
+ const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}`
const prefix = `--${boundary}\r\nContent-Disposition: form-data`
/*! formdata-polyfill. MIT License. Jimmy Wärting */
@@ -58449,7 +60590,6 @@ const {
isValidHeaderName,
isValidHeaderValue
} = __nccwpck_require__(5523)
-const util = __nccwpck_require__(9023)
const { webidl } = __nccwpck_require__(4222)
const assert = __nccwpck_require__(2613)
@@ -59003,9 +61143,6 @@ Object.defineProperties(Headers.prototype, {
[Symbol.toStringTag]: {
value: 'Headers',
configurable: true
- },
- [util.inspect.custom]: {
- enumerable: false
}
})
@@ -68182,20 +70319,6 @@ class Pool extends PoolBase {
? { ...options.interceptors }
: undefined
this[kFactory] = factory
-
- this.on('connectionError', (origin, targets, error) => {
- // If a connection error occurs, we remove the client from the pool,
- // and emit a connectionError event. They will not be re-used.
- // Fixes https://github.com/nodejs/undici/issues/3895
- for (const target of targets) {
- // Do not use kRemoveClient here, as it will close the client,
- // but the client cannot be closed in this state.
- const idx = this[kClients].indexOf(target)
- if (idx !== -1) {
- this[kClients].splice(idx, 1)
- }
- }
- })
}
[kGetDispatcher] () {
@@ -70784,8 +72907,7 @@ const unix_install_1 = __nccwpck_require__(9095);
async function installXmake() {
const version = await (0, versions_1.selectVersion)();
if (os.platform() === 'win32' || os.platform() === 'cygwin') {
- const latest = await (0, versions_1.selectVersion)('latest');
- await (0, win_install_1.winInstall)(version, latest);
+ await (0, win_install_1.winInstall)(version);
}
else {
await (0, unix_install_1.unixInstall)(version);
@@ -71226,9 +73348,9 @@ async function selectSha(repo, sha) {
return selectPr(repo, Number.parseInt(pr));
}
}
- return Promise.resolve(new GitVersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substr(0, 8)}`));
+ return Promise.resolve(new GitVersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substring(0, 8)}`));
}
-async function selectVersion(version) {
+async function selectVersion(version, _fallback = false) {
// get version string
version = (version !== null && version !== void 0 ? version : core.getInput('xmake-version')) || 'latest';
if (version.toLowerCase() === 'latest')
@@ -71249,20 +73371,20 @@ async function selectVersion(version) {
}
// select branch
if (version.startsWith('branch@')) {
- const branch = version.substr('branch@'.length);
+ const branch = version.substring('branch@'.length);
ret = await selectBranch(repo, branch);
}
// select pr
if (version.startsWith('pr@')) {
- const pr = Number.parseInt(version.substr('pr@'.length));
+ const pr = Number.parseInt(version.substring('pr@'.length));
if (Number.isNaN(pr) || pr <= 0) {
- throw new Error(`Invalid pull requrest ${version.substr('pr@'.length)}, should be a positive integer`);
+ throw new Error(`Invalid pull requrest ${version.substring('pr@'.length)}, should be a positive integer`);
}
ret = await selectPr(repo, pr);
}
// select sha
if (version.startsWith('sha@')) {
- const sha = version.substr('sha@'.length);
+ const sha = version.substring('sha@'.length);
ret = await selectSha(repo, sha);
}
// select version
@@ -71275,8 +73397,8 @@ async function selectVersion(version) {
if (ret.type === 'local') {
core.info(`Use local xmake at '${ret.path}'`);
}
- else {
- core.info(`Selected xmake ${String(ret)} (commit: ${ret.sha.substr(0, 8)})` +
+ else if (!_fallback) {
+ core.info(`Selected xmake ${String(ret)} (commit: ${ret.sha.substring(0, 8)})` +
(repo !== DEFAULT_REPO ? ` of ${repo}` : ''));
}
return ret;
@@ -71302,17 +73424,21 @@ const fs = __nccwpck_require__(9896);
const path = __nccwpck_require__(6928);
const semver = __nccwpck_require__(2088);
const git = __nccwpck_require__(1243);
+const versions_1 = __nccwpck_require__(7902);
const system_1 = __nccwpck_require__(7666);
-function getInstallerUrl(version, latest) {
- let ver = version.version;
+async function getInstallerUrl(version, _fallback = false) {
+ const latest = (await (0, versions_1.selectVersion)('latest', _fallback));
+ const latestVers = latest.version;
+ let vers = version.version;
+ let finalUrl;
switch (version.type) {
case 'heads': {
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
- const latestver = latest.version;
- if (ver !== 'dev' && ver !== 'master') {
- ver = latestver;
+ if (vers !== 'dev' && vers !== 'master') {
+ vers = latestVers;
}
- return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
+ finalUrl = `https://github.com/xmake-io/xmake/releases/download/${latestVers}/xmake-${vers}.${arch}.exe`;
+ break;
}
case 'pull': {
throw new Error('PR builds for windows is not supported');
@@ -71322,9 +73448,10 @@ function getInstallerUrl(version, latest) {
}
case 'tags': {
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
- return semver.gt(ver, '2.2.6')
- ? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
- : `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
+ finalUrl = semver.gt(vers, '2.2.6')
+ ? `https://github.com/xmake-io/xmake/releases/download/${vers}/xmake-${vers}.${arch}.exe`
+ : `https://github.com/xmake-io/xmake/releases/download/${vers}/xmake-${vers}.exe`;
+ break;
}
default: {
// check that we have tested all types
@@ -71332,13 +73459,26 @@ function getInstallerUrl(version, latest) {
throw new Error('Unknown version type');
}
}
+ // check if the URL returns 404. If so, xmake may have just released a
+ // new version, causing some binaries to be temporarily unavailable, so
+ // we need to fallback to the previous version.
+ if (!_fallback) {
+ const head = await fetch(finalUrl, { method: 'HEAD' });
+ if (head.status === 404) {
+ const currentVers = latestVers || vers;
+ const previousVersion = (await (0, versions_1.selectVersion)('<' + currentVers));
+ core.warning(`The requested version ${currentVers} (${finalUrl}) resource is temporarily unavailable, trying to fallback to the previous version...`);
+ return await getInstallerUrl(previousVersion, true);
+ }
+ }
+ return finalUrl;
}
async function installFromSource(xmakeBin, sourceDir, binDir) {
await (0, exec_1.exec)(xmakeBin, ['-y'], { cwd: sourceDir });
await (0, exec_1.exec)(xmakeBin, ['install', '-o', binDir, 'cli'], { cwd: sourceDir });
}
-async function winInstall(version, latest) {
- if (version.type === 'local' || latest.type === 'local') {
+async function winInstall(version) {
+ if (version.type === 'local') {
throw new Error('Local builds for windows is not supported');
}
const actionsCacheFolder = core.getInput('actions-cache-folder');
@@ -71374,7 +73514,7 @@ async function winInstall(version, latest) {
}
if (!toolDir) {
const installer = await core.group(`download xmake ${String(version)}`, async () => {
- const url = getInstallerUrl(version, latest);
+ const url = await getInstallerUrl(version);
core.info(`downloading from ${url}`);
const file = await toolCache.downloadTool(url);
const exe = path.format({
@@ -71530,14 +73670,6 @@ module.exports = require("net");
/***/ }),
-/***/ 7598:
-/***/ ((module) => {
-
-"use strict";
-module.exports = require("node:crypto");
-
-/***/ }),
-
/***/ 8474:
/***/ ((module) => {
@@ -71722,59 +73854,6 @@ module.exports = require("zlib");
/***/ }),
-/***/ 9192:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT license.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.AbortError = void 0;
-/**
- * This error is thrown when an asynchronous operation has been aborted.
- * Check for this error by testing the `name` that the name property of the
- * error matches `"AbortError"`.
- *
- * @example
- * ```ts
- * const controller = new AbortController();
- * controller.abort();
- * try {
- * doAsyncWork(controller.signal)
- * } catch (e) {
- * if (e.name === 'AbortError') {
- * // handle abort error here.
- * }
- * }
- * ```
- */
-class AbortError extends Error {
- constructor(message) {
- super(message);
- this.name = "AbortError";
- }
-}
-exports.AbortError = AbortError;
-//# sourceMappingURL=AbortError.js.map
-
-/***/ }),
-
-/***/ 3134:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT license.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.AbortError = void 0;
-var AbortError_js_1 = __nccwpck_require__(9192);
-Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } }));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
/***/ 198:
/***/ ((__unused_webpack_module, exports) => {
@@ -72058,10 +74137,9 @@ function isTokenCredential(credential) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.parseCAEChallenge = parseCAEChallenge;
-exports.authorizeRequestOnClaimChallenge = authorizeRequestOnClaimChallenge;
+exports.authorizeRequestOnClaimChallenge = exports.parseCAEChallenge = void 0;
const log_js_1 = __nccwpck_require__(9994);
const base64_js_1 = __nccwpck_require__(741);
/**
@@ -72079,21 +74157,19 @@ function parseCAEChallenge(challenges) {
return keyValuePairs.reduce((a, b) => (Object.assign(Object.assign({}, a), b)), {});
});
}
+exports.parseCAEChallenge = parseCAEChallenge;
/**
* This function can be used as a callback for the `bearerTokenAuthenticationPolicy` of `@azure/core-rest-pipeline`, to support CAE challenges:
- * [Continuous Access Evaluation](https://learn.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation).
+ * [Continuous Access Evaluation](https://docs.microsoft.com/azure/active-directory/conditional-access/concept-continuous-access-evaluation).
*
* Call the `bearerTokenAuthenticationPolicy` with the following options:
*
- * ```ts snippet:AuthorizeRequestOnClaimChallenge
+ * ```ts
* import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
* import { authorizeRequestOnClaimChallenge } from "@azure/core-client";
*
- * const policy = bearerTokenAuthenticationPolicy({
- * challengeCallbacks: {
- * authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge,
- * },
- * scopes: ["https://service/.default"],
+ * const bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy({
+ * authorizeRequestOnChallenge: authorizeRequestOnClaimChallenge
* });
* ```
*
@@ -72109,7 +74185,6 @@ function parseCAEChallenge(challenges) {
* ```
*/
async function authorizeRequestOnClaimChallenge(onChallengeOptions) {
- var _a;
const { scopes, response } = onChallengeOptions;
const logger = onChallengeOptions.logger || log_js_1.logger;
const challenge = response.headers.get("WWW-Authenticate");
@@ -72129,9 +74204,10 @@ async function authorizeRequestOnClaimChallenge(onChallengeOptions) {
if (!accessToken) {
return false;
}
- onChallengeOptions.request.headers.set("Authorization", `${(_a = accessToken.tokenType) !== null && _a !== void 0 ? _a : "Bearer"} ${accessToken.token}`);
+ onChallengeOptions.request.headers.set("Authorization", `Bearer ${accessToken.token}`);
return true;
}
+exports.authorizeRequestOnClaimChallenge = authorizeRequestOnClaimChallenge;
//# sourceMappingURL=authorizeRequestOnClaimChallenge.js.map
/***/ }),
@@ -72142,7 +74218,7 @@ async function authorizeRequestOnClaimChallenge(onChallengeOptions) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.authorizeRequestOnTenantChallenge = void 0;
/**
@@ -72165,11 +74241,10 @@ function isUuid(text) {
}
/**
* Defines a callback to handle auth challenge for Storage APIs.
- * This implements the bearer challenge process described here: https://learn.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#bearer-challenge
+ * This implements the bearer challenge process described here: https://docs.microsoft.com/rest/api/storageservices/authorize-with-azure-active-directory#bearer-challenge
* Handling has specific features for storage that departs to the general AAD challenge docs.
**/
const authorizeRequestOnTenantChallenge = async (challengeOptions) => {
- var _a;
const requestOptions = requestToOptions(challengeOptions.request);
const challenge = getChallenge(challengeOptions.response);
if (challenge) {
@@ -72183,7 +74258,7 @@ const authorizeRequestOnTenantChallenge = async (challengeOptions) => {
if (!accessToken) {
return false;
}
- challengeOptions.request.headers.set(Constants.HeaderConstants.AUTHORIZATION, `${(_a = accessToken.tokenType) !== null && _a !== void 0 ? _a : "Bearer"} ${accessToken.token}`);
+ challengeOptions.request.headers.set(Constants.HeaderConstants.AUTHORIZATION, `Bearer ${accessToken.token}`);
return true;
}
return false;
@@ -72267,12 +74342,9 @@ function requestToOptions(request) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.encodeString = encodeString;
-exports.encodeByteArray = encodeByteArray;
-exports.decodeString = decodeString;
-exports.decodeStringToString = decodeStringToString;
+exports.decodeStringToString = exports.decodeString = exports.encodeByteArray = exports.encodeString = void 0;
/**
* Encodes a string in base64 format.
* @param value - the string to encode
@@ -72281,6 +74353,7 @@ exports.decodeStringToString = decodeStringToString;
function encodeString(value) {
return Buffer.from(value).toString("base64");
}
+exports.encodeString = encodeString;
/**
* Encodes a byte array in base64 format.
* @param value - the Uint8Aray to encode
@@ -72290,6 +74363,7 @@ function encodeByteArray(value) {
const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);
return bufferValue.toString("base64");
}
+exports.encodeByteArray = encodeByteArray;
/**
* Decodes a base64 string into a byte array.
* @param value - the base64 string to decode
@@ -72298,6 +74372,7 @@ function encodeByteArray(value) {
function decodeString(value) {
return Buffer.from(value, "base64");
}
+exports.decodeString = decodeString;
/**
* Decodes a base64 string into a string.
* @param value - the base64 string to decode
@@ -72306,6 +74381,7 @@ function decodeString(value) {
function decodeStringToString(value) {
return Buffer.from(value, "base64").toString();
}
+exports.decodeStringToString = decodeStringToString;
//# sourceMappingURL=base64.js.map
/***/ }),
@@ -72316,10 +74392,9 @@ function decodeStringToString(value) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.deserializationPolicyName = void 0;
-exports.deserializationPolicy = deserializationPolicy;
+exports.deserializationPolicy = exports.deserializationPolicyName = void 0;
const interfaces_js_1 = __nccwpck_require__(6058);
const core_rest_pipeline_1 = __nccwpck_require__(778);
const serializer_js_1 = __nccwpck_require__(1530);
@@ -72354,6 +74429,7 @@ function deserializationPolicy(options = {}) {
},
};
}
+exports.deserializationPolicy = deserializationPolicy;
function getOperationResponseMap(parsedResponse) {
let result;
const request = parsedResponse.request;
@@ -72442,7 +74518,7 @@ function isOperationSpecEmpty(operationSpec) {
(expectedStatusCodes.length === 1 && expectedStatusCodes[0] === "default"));
}
function handleErrorResponse(parsedResponse, operationSpec, responseSpec, options) {
- var _a, _b, _c, _d, _e;
+ var _a;
const isSuccessByStatus = 200 <= parsedResponse.status && parsedResponse.status < 300;
const isExpectedStatusCode = isOperationSpecEmpty(operationSpec)
? isSuccessByStatus
@@ -72467,14 +74543,12 @@ function handleErrorResponse(parsedResponse, operationSpec, responseSpec, option
response: parsedResponse,
});
// If the item failed but there's no error spec or default spec to deserialize the error,
- // and the parsed body doesn't look like an error object,
// we should fail so we just throw the parsed response
- if (!errorResponseSpec &&
- !(((_c = (_b = parsedResponse.parsedBody) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code) && ((_e = (_d = parsedResponse.parsedBody) === null || _d === void 0 ? void 0 : _d.error) === null || _e === void 0 ? void 0 : _e.message))) {
+ if (!errorResponseSpec) {
throw error;
}
- const defaultBodyMapper = errorResponseSpec === null || errorResponseSpec === void 0 ? void 0 : errorResponseSpec.bodyMapper;
- const defaultHeadersMapper = errorResponseSpec === null || errorResponseSpec === void 0 ? void 0 : errorResponseSpec.headersMapper;
+ const defaultBodyMapper = errorResponseSpec.bodyMapper;
+ const defaultHeadersMapper = errorResponseSpec.headersMapper;
try {
// If error response has a body, try to deserialize it using default body mapper.
// Then try to extract error code & message from it
@@ -72560,9 +74634,9 @@ async function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts,
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getCachedDefaultHttpClient = getCachedDefaultHttpClient;
+exports.getCachedDefaultHttpClient = void 0;
const core_rest_pipeline_1 = __nccwpck_require__(778);
let cachedHttpClient;
function getCachedDefaultHttpClient() {
@@ -72571,6 +74645,7 @@ function getCachedDefaultHttpClient() {
}
return cachedHttpClient;
}
+exports.getCachedDefaultHttpClient = getCachedDefaultHttpClient;
//# sourceMappingURL=httpClientCache.js.map
/***/ }),
@@ -72581,7 +74656,7 @@ function getCachedDefaultHttpClient() {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.authorizeRequestOnTenantChallenge = exports.authorizeRequestOnClaimChallenge = exports.serializationPolicyName = exports.serializationPolicy = exports.deserializationPolicyName = exports.deserializationPolicy = exports.XML_CHARKEY = exports.XML_ATTRKEY = exports.createClientPipeline = exports.ServiceClient = exports.MapperTypeNames = exports.createSerializer = void 0;
var serializer_js_1 = __nccwpck_require__(1530);
@@ -72614,10 +74689,9 @@ Object.defineProperty(exports, "authorizeRequestOnTenantChallenge", ({ enumerabl
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getStreamingResponseStatusCodes = getStreamingResponseStatusCodes;
-exports.getPathStringFromParameter = getPathStringFromParameter;
+exports.getPathStringFromParameter = exports.getStreamingResponseStatusCodes = void 0;
const serializer_js_1 = __nccwpck_require__(1530);
/**
* Gets the list of status codes for streaming responses.
@@ -72634,6 +74708,7 @@ function getStreamingResponseStatusCodes(operationSpec) {
}
return result;
}
+exports.getStreamingResponseStatusCodes = getStreamingResponseStatusCodes;
/**
* Get the path to this parameter's value as a dotted string (a.b.c).
* @param parameter - The parameter to get the path string for.
@@ -72654,6 +74729,7 @@ function getPathStringFromParameter(parameter) {
}
return result;
}
+exports.getPathStringFromParameter = getPathStringFromParameter;
//# sourceMappingURL=interfaceHelpers.js.map
/***/ }),
@@ -72664,7 +74740,7 @@ function getPathStringFromParameter(parameter) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.XML_CHARKEY = exports.XML_ATTRKEY = void 0;
/**
@@ -72685,7 +74761,7 @@ exports.XML_CHARKEY = "_";
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.logger = void 0;
const logger_1 = __nccwpck_require__(6515);
@@ -72700,11 +74776,10 @@ exports.logger = (0, logger_1.createClientLogger)("core-client");
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getOperationArgumentValueFromParameter = getOperationArgumentValueFromParameter;
-exports.getOperationRequestInfo = getOperationRequestInfo;
-const state_js_1 = __nccwpck_require__(5726);
+exports.getOperationRequestInfo = exports.getOperationArgumentValueFromParameter = void 0;
+const state_js_1 = __nccwpck_require__(3345);
/**
* @internal
* Retrieves the value to use for a given operation argument
@@ -72761,6 +74836,7 @@ function getOperationArgumentValueFromParameter(operationArguments, parameter, f
}
return value;
}
+exports.getOperationArgumentValueFromParameter = getOperationArgumentValueFromParameter;
function getPropertyFromParameterPath(parent, parameterPath) {
const result = { propertyFound: false };
let i = 0;
@@ -72795,6 +74871,7 @@ function getOperationRequestInfo(request) {
}
return info;
}
+exports.getOperationRequestInfo = getOperationRequestInfo;
//# sourceMappingURL=operationHelpers.js.map
/***/ }),
@@ -72805,9 +74882,9 @@ function getOperationRequestInfo(request) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createClientPipeline = createClientPipeline;
+exports.createClientPipeline = void 0;
const deserializationPolicy_js_1 = __nccwpck_require__(111);
const core_rest_pipeline_1 = __nccwpck_require__(778);
const serializationPolicy_js_1 = __nccwpck_require__(6234);
@@ -72831,6 +74908,7 @@ function createClientPipeline(options = {}) {
});
return pipeline;
}
+exports.createClientPipeline = createClientPipeline;
//# sourceMappingURL=pipeline.js.map
/***/ }),
@@ -72841,12 +74919,9 @@ function createClientPipeline(options = {}) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.serializationPolicyName = void 0;
-exports.serializationPolicy = serializationPolicy;
-exports.serializeHeaders = serializeHeaders;
-exports.serializeRequestBody = serializeRequestBody;
+exports.serializeRequestBody = exports.serializeHeaders = exports.serializationPolicy = exports.serializationPolicyName = void 0;
const interfaces_js_1 = __nccwpck_require__(6058);
const operationHelpers_js_1 = __nccwpck_require__(9688);
const serializer_js_1 = __nccwpck_require__(1530);
@@ -72875,6 +74950,7 @@ function serializationPolicy(options = {}) {
},
};
}
+exports.serializationPolicy = serializationPolicy;
/**
* @internal
*/
@@ -72905,6 +74981,7 @@ function serializeHeaders(request, operationArguments, operationSpec) {
}
}
}
+exports.serializeHeaders = serializeHeaders;
/**
* @internal
*/
@@ -72972,6 +75049,7 @@ function serializeRequestBody(request, operationArguments, operationSpec, string
}
}
}
+exports.serializeRequestBody = serializeRequestBody;
/**
* Adds an xml namespace to the xml serialized object if needed, otherwise it just returns the value itself
*/
@@ -73007,10 +75085,9 @@ function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.MapperTypeNames = void 0;
-exports.createSerializer = createSerializer;
+exports.MapperTypeNames = exports.createSerializer = void 0;
const tslib_1 = __nccwpck_require__(1860);
const base64 = tslib_1.__importStar(__nccwpck_require__(741));
const interfaces_js_1 = __nccwpck_require__(6058);
@@ -73264,6 +75341,7 @@ class SerializerImpl {
function createSerializer(modelMappers = {}, isXML = false) {
return new SerializerImpl(modelMappers, isXML);
}
+exports.createSerializer = createSerializer;
function trimEnd(str, ch) {
let len = str.length;
while (len - 1 >= 0 && str[len - 1] === ch) {
@@ -73941,7 +76019,7 @@ exports.MapperTypeNames = {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ServiceClient = void 0;
const core_rest_pipeline_1 = __nccwpck_require__(778);
@@ -73958,6 +76036,7 @@ const log_js_1 = __nccwpck_require__(9994);
class ServiceClient {
/**
* The ServiceClient constructor
+ * @param credential - The credentials used for authentication with the service.
* @param options - The service client options that govern the behavior of the client.
*/
constructor(options = {}) {
@@ -74094,13 +76173,13 @@ function getCredentialScopes(options) {
/***/ }),
-/***/ 5726:
+/***/ 3345:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.state = void 0;
/**
@@ -74119,10 +76198,9 @@ exports.state = {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getRequestUrl = getRequestUrl;
-exports.appendQueryParams = appendQueryParams;
+exports.appendQueryParams = exports.getRequestUrl = void 0;
const operationHelpers_js_1 = __nccwpck_require__(9688);
const interfaceHelpers_js_1 = __nccwpck_require__(2066);
const CollectionFormatToDelimiterMap = {
@@ -74165,6 +76243,7 @@ function getRequestUrl(baseUri, operationSpec, operationArguments, fallbackObjec
requestUrl = appendQueryParams(requestUrl, queryParams, sequenceParams, isAbsolutePath);
return requestUrl;
}
+exports.getRequestUrl = getRequestUrl;
function replaceAll(input, replacements) {
let result = input;
for (const [searchValue, replaceValue] of replacements) {
@@ -74355,6 +76434,7 @@ function appendQueryParams(url, queryParams, sequenceParams, noOverwrite = false
parsedUrl.search = searchPieces.length ? `?${searchPieces.join("&")}` : "";
return parsedUrl.toString();
}
+exports.appendQueryParams = appendQueryParams;
//# sourceMappingURL=urlHelpers.js.map
/***/ }),
@@ -74365,12 +76445,9 @@ function appendQueryParams(url, queryParams, sequenceParams, noOverwrite = false
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.isPrimitiveBody = isPrimitiveBody;
-exports.isDuration = isDuration;
-exports.isValidUuid = isValidUuid;
-exports.flattenResponse = flattenResponse;
+exports.flattenResponse = exports.isValidUuid = exports.isDuration = exports.isPrimitiveBody = void 0;
/**
* A type guard for a primitive response body.
* @param value - Value to test
@@ -74388,6 +76465,7 @@ function isPrimitiveBody(value, mapperTypeName) {
value === undefined ||
value === null));
}
+exports.isPrimitiveBody = isPrimitiveBody;
const validateISODuration = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
/**
* Returns true if the given string is in ISO 8601 format.
@@ -74397,6 +76475,7 @@ const validateISODuration = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?
function isDuration(value) {
return validateISODuration.test(value);
}
+exports.isDuration = isDuration;
const validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;
/**
* Returns true if the provided uuid is valid.
@@ -74408,6 +76487,7 @@ const validUuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F
function isValidUuid(uuid) {
return validUuidRegex.test(uuid);
}
+exports.isValidUuid = isValidUuid;
/**
* Maps the response as follows:
* - wraps the response body if needed (typically if its type is primitive).
@@ -74483,6 +76563,7 @@ function flattenResponse(fullResponse, responseSpec) {
shouldWrapBody: isPrimitiveBody(fullResponse.parsedBody, expectedBodyTypeName),
});
}
+exports.flattenResponse = flattenResponse;
//# sourceMappingURL=utils.js.map
/***/ }),
@@ -74493,7 +76574,7 @@ function flattenResponse(fullResponse, responseSpec) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExtendedServiceClient = void 0;
const disableKeepAlivePolicy_js_1 = __nccwpck_require__(2639);
@@ -74555,9 +76636,9 @@ exports.ExtendedServiceClient = ExtendedServiceClient;
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.convertHttpClient = convertHttpClient;
+exports.convertHttpClient = void 0;
const response_js_1 = __nccwpck_require__(8153);
const util_js_1 = __nccwpck_require__(3850);
/**
@@ -74573,6 +76654,7 @@ function convertHttpClient(requestPolicyClient) {
},
};
}
+exports.convertHttpClient = convertHttpClient;
//# sourceMappingURL=httpClientAdapter.js.map
/***/ }),
@@ -74583,7 +76665,7 @@ function convertHttpClient(requestPolicyClient) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.toHttpHeadersLike = exports.convertHttpClient = exports.disableKeepAlivePolicyName = exports.HttpPipelineLogLevel = exports.createRequestPolicyFactoryPolicy = exports.requestPolicyFactoryPolicyName = exports.ExtendedServiceClient = void 0;
/**
@@ -74613,11 +76695,9 @@ Object.defineProperty(exports, "toHttpHeadersLike", ({ enumerable: true, get: fu
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.disableKeepAlivePolicyName = void 0;
-exports.createDisableKeepAlivePolicy = createDisableKeepAlivePolicy;
-exports.pipelineContainsDisableKeepAlivePolicy = pipelineContainsDisableKeepAlivePolicy;
+exports.pipelineContainsDisableKeepAlivePolicy = exports.createDisableKeepAlivePolicy = exports.disableKeepAlivePolicyName = void 0;
exports.disableKeepAlivePolicyName = "DisableKeepAlivePolicy";
function createDisableKeepAlivePolicy() {
return {
@@ -74628,12 +76708,14 @@ function createDisableKeepAlivePolicy() {
},
};
}
+exports.createDisableKeepAlivePolicy = createDisableKeepAlivePolicy;
/**
* @internal
*/
function pipelineContainsDisableKeepAlivePolicy(pipeline) {
return pipeline.getOrderedPolicies().some((policy) => policy.name === exports.disableKeepAlivePolicyName);
}
+exports.pipelineContainsDisableKeepAlivePolicy = pipelineContainsDisableKeepAlivePolicy;
//# sourceMappingURL=disableKeepAlivePolicy.js.map
/***/ }),
@@ -74644,10 +76726,9 @@ function pipelineContainsDisableKeepAlivePolicy(pipeline) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.requestPolicyFactoryPolicyName = exports.HttpPipelineLogLevel = void 0;
-exports.createRequestPolicyFactoryPolicy = createRequestPolicyFactoryPolicy;
+exports.createRequestPolicyFactoryPolicy = exports.requestPolicyFactoryPolicyName = exports.HttpPipelineLogLevel = void 0;
const util_js_1 = __nccwpck_require__(3850);
const response_js_1 = __nccwpck_require__(8153);
/**
@@ -74696,6 +76777,7 @@ function createRequestPolicyFactoryPolicy(factories) {
},
};
}
+exports.createRequestPolicyFactoryPolicy = createRequestPolicyFactoryPolicy;
//# sourceMappingURL=requestPolicyFactoryPolicy.js.map
/***/ }),
@@ -74706,10 +76788,9 @@ function createRequestPolicyFactoryPolicy(factories) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.toCompatResponse = toCompatResponse;
-exports.toPipelineResponse = toPipelineResponse;
+exports.toPipelineResponse = exports.toCompatResponse = void 0;
const core_rest_pipeline_1 = __nccwpck_require__(778);
const util_js_1 = __nccwpck_require__(3850);
const originalResponse = Symbol("Original FullOperationResponse");
@@ -74751,6 +76832,7 @@ function toCompatResponse(response, options) {
headers });
}
}
+exports.toCompatResponse = toCompatResponse;
/**
* A helper to convert back to a PipelineResponse
* @param compatResponse - A response compatible with `HttpOperationResponse` from core-http.
@@ -74767,6 +76849,7 @@ function toPipelineResponse(compatResponse) {
return Object.assign(Object.assign({}, compatResponse), { headers, request: (0, util_js_1.toPipelineRequest)(compatResponse.request) });
}
}
+exports.toPipelineResponse = toPipelineResponse;
//# sourceMappingURL=response.js.map
/***/ }),
@@ -74777,12 +76860,9 @@ function toPipelineResponse(compatResponse) {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.HttpHeaders = void 0;
-exports.toPipelineRequest = toPipelineRequest;
-exports.toWebResourceLike = toWebResourceLike;
-exports.toHttpHeadersLike = toHttpHeadersLike;
+exports.HttpHeaders = exports.toHttpHeadersLike = exports.toWebResourceLike = exports.toPipelineRequest = void 0;
const core_rest_pipeline_1 = __nccwpck_require__(778);
// We use a custom symbol to cache a reference to the original request without
// exposing it on the public interface.
@@ -74816,8 +76896,6 @@ function toPipelineRequest(webResource, options = {}) {
onUploadProgress: webResource.onUploadProgress,
proxySettings: webResource.proxySettings,
streamResponseStatusCodes: webResource.streamResponseStatusCodes,
- agent: webResource.agent,
- requestOverrides: webResource.requestOverrides,
});
if (options.originalRequest) {
newRequest[originalClientRequestSymbol] =
@@ -74826,6 +76904,7 @@ function toPipelineRequest(webResource, options = {}) {
return newRequest;
}
}
+exports.toPipelineRequest = toPipelineRequest;
function toWebResourceLike(request, options) {
var _a;
const originalRequest = (_a = options === null || options === void 0 ? void 0 : options.originalRequest) !== null && _a !== void 0 ? _a : request;
@@ -74844,8 +76923,6 @@ function toWebResourceLike(request, options) {
onUploadProgress: request.onUploadProgress,
proxySettings: request.proxySettings,
streamResponseStatusCodes: request.streamResponseStatusCodes,
- agent: request.agent,
- requestOverrides: request.requestOverrides,
clone() {
throw new Error("Cannot clone a non-proxied WebResourceLike");
},
@@ -74889,8 +76966,6 @@ function toWebResourceLike(request, options) {
"onUploadProgress",
"proxySettings",
"streamResponseStatusCodes",
- "agent",
- "requestOverrides",
];
if (typeof prop === "string" && passThroughProps.includes(prop)) {
request[prop] = value;
@@ -74903,6 +76978,7 @@ function toWebResourceLike(request, options) {
return webResource;
}
}
+exports.toWebResourceLike = toWebResourceLike;
/**
* Converts HttpHeaders from core-rest-pipeline to look like
* HttpHeaders from core-http.
@@ -74912,6 +76988,7 @@ function toWebResourceLike(request, options) {
function toHttpHeadersLike(headers) {
return new HttpHeaders(headers.toJSON({ preserveCase: true }));
}
+exports.toHttpHeadersLike = toHttpHeadersLike;
/**
* A collection of HttpHeaders that can be sent with a HTTP request.
*/
@@ -76416,7 +78493,7 @@ exports.buildCreatePoller = buildCreatePoller;
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DEFAULT_RETRY_POLICY_COUNT = exports.SDK_VERSION = void 0;
-exports.SDK_VERSION = "1.20.0";
+exports.SDK_VERSION = "1.18.1";
exports.DEFAULT_RETRY_POLICY_COUNT = 3;
//# sourceMappingURL=constants.js.map
@@ -76442,10 +78519,8 @@ const formDataPolicy_js_1 = __nccwpck_require__(5497);
const core_util_1 = __nccwpck_require__(7779);
const proxyPolicy_js_1 = __nccwpck_require__(2815);
const setClientRequestIdPolicy_js_1 = __nccwpck_require__(5686);
-const agentPolicy_js_1 = __nccwpck_require__(8554);
const tlsPolicy_js_1 = __nccwpck_require__(5798);
const tracingPolicy_js_1 = __nccwpck_require__(3237);
-const wrapAbortSignalLikePolicy_js_1 = __nccwpck_require__(7466);
/**
* Create a new pipeline with a default set of customizable policies.
* @param options - Options to configure a custom pipeline.
@@ -76454,16 +78529,12 @@ function createPipelineFromOptions(options) {
var _a;
const pipeline = (0, pipeline_js_1.createEmptyPipeline)();
if (core_util_1.isNodeLike) {
- if (options.agent) {
- pipeline.addPolicy((0, agentPolicy_js_1.agentPolicy)(options.agent));
- }
if (options.tlsOptions) {
pipeline.addPolicy((0, tlsPolicy_js_1.tlsPolicy)(options.tlsOptions));
}
pipeline.addPolicy((0, proxyPolicy_js_1.proxyPolicy)(options.proxyOptions));
pipeline.addPolicy((0, decompressResponsePolicy_js_1.decompressResponsePolicy)());
}
- pipeline.addPolicy((0, wrapAbortSignalLikePolicy_js_1.wrapAbortSignalLikePolicy)());
pipeline.addPolicy((0, formDataPolicy_js_1.formDataPolicy)(), { beforePolicies: [multipartPolicy_js_1.multipartPolicyName] });
pipeline.addPolicy((0, userAgentPolicy_js_1.userAgentPolicy)(options.userAgentOptions));
pipeline.addPolicy((0, setClientRequestIdPolicy_js_1.setClientRequestIdPolicy)((_a = options.telemetryOptions) === null || _a === void 0 ? void 0 : _a.clientRequestIdHeaderName));
@@ -76496,37 +78567,19 @@ function createPipelineFromOptions(options) {
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createDefaultHttpClient = createDefaultHttpClient;
-const ts_http_runtime_1 = __nccwpck_require__(1958);
-const wrapAbortSignal_js_1 = __nccwpck_require__(1297);
+const nodeHttpClient_js_1 = __nccwpck_require__(195);
/**
* Create the correct HttpClient for the current environment.
*/
function createDefaultHttpClient() {
- const client = (0, ts_http_runtime_1.createDefaultHttpClient)();
- return {
- async sendRequest(request) {
- // we wrap any AbortSignalLike here since the TypeSpec runtime expects a native AbortSignal.
- // 99% of the time, this should be a no-op since a native AbortSignal is passed in.
- const { abortSignal, cleanup } = request.abortSignal
- ? (0, wrapAbortSignal_js_1.wrapAbortSignalLike)(request.abortSignal)
- : {};
- try {
- // eslint-disable-next-line no-param-reassign
- request.abortSignal = abortSignal;
- return await client.sendRequest(request);
- }
- finally {
- cleanup === null || cleanup === void 0 ? void 0 : cleanup();
- }
- },
- };
+ return (0, nodeHttpClient_js_1.createNodeHttpClient)();
}
//# sourceMappingURL=defaultHttpClient.js.map
/***/ }),
/***/ 192:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+/***/ ((__unused_webpack_module, exports) => {
"use strict";
@@ -76534,13 +78587,91 @@ function createDefaultHttpClient() {
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createHttpHeaders = createHttpHeaders;
-const ts_http_runtime_1 = __nccwpck_require__(1958);
+function normalizeName(name) {
+ return name.toLowerCase();
+}
+function* headerIterator(map) {
+ for (const entry of map.values()) {
+ yield [entry.name, entry.value];
+ }
+}
+class HttpHeadersImpl {
+ constructor(rawHeaders) {
+ this._headersMap = new Map();
+ if (rawHeaders) {
+ for (const headerName of Object.keys(rawHeaders)) {
+ this.set(headerName, rawHeaders[headerName]);
+ }
+ }
+ }
+ /**
+ * Set a header in this collection with the provided name and value. The name is
+ * case-insensitive.
+ * @param name - The name of the header to set. This value is case-insensitive.
+ * @param value - The value of the header to set.
+ */
+ set(name, value) {
+ this._headersMap.set(normalizeName(name), { name, value: String(value).trim() });
+ }
+ /**
+ * Get the header value for the provided header name, or undefined if no header exists in this
+ * collection with the provided name.
+ * @param name - The name of the header. This value is case-insensitive.
+ */
+ get(name) {
+ var _a;
+ return (_a = this._headersMap.get(normalizeName(name))) === null || _a === void 0 ? void 0 : _a.value;
+ }
+ /**
+ * Get whether or not this header collection contains a header entry for the provided header name.
+ * @param name - The name of the header to set. This value is case-insensitive.
+ */
+ has(name) {
+ return this._headersMap.has(normalizeName(name));
+ }
+ /**
+ * Remove the header with the provided headerName.
+ * @param name - The name of the header to remove.
+ */
+ delete(name) {
+ this._headersMap.delete(normalizeName(name));
+ }
+ /**
+ * Get the JSON object representation of this HTTP header collection.
+ */
+ toJSON(options = {}) {
+ const result = {};
+ if (options.preserveCase) {
+ for (const entry of this._headersMap.values()) {
+ result[entry.name] = entry.value;
+ }
+ }
+ else {
+ for (const [normalizedName, entry] of this._headersMap) {
+ result[normalizedName] = entry.value;
+ }
+ }
+ return result;
+ }
+ /**
+ * Get the string representation of this HTTP header collection.
+ */
+ toString() {
+ return JSON.stringify(this.toJSON({ preserveCase: true }));
+ }
+ /**
+ * Iterate over tuples of header [name, value] pairs.
+ */
+ [Symbol.iterator]() {
+ return headerIterator(this._headersMap);
+ }
+}
/**
* Creates an object that satisfies the `HttpHeaders` interface.
* @param rawHeaders - A simple object representing initial headers
*/
function createHttpHeaders(rawHeaders) {
- return (0, ts_http_runtime_1.createHttpHeaders)(rawHeaders);
+ return new HttpHeadersImpl(rawHeaders);
}
//# sourceMappingURL=httpHeaders.js.map
@@ -76554,7 +78685,7 @@ function createHttpHeaders(rawHeaders) {
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createFileFromStream = exports.createFile = exports.agentPolicyName = exports.agentPolicy = exports.auxiliaryAuthenticationHeaderPolicyName = exports.auxiliaryAuthenticationHeaderPolicy = exports.ndJsonPolicyName = exports.ndJsonPolicy = exports.bearerTokenAuthenticationPolicyName = exports.bearerTokenAuthenticationPolicy = exports.formDataPolicyName = exports.formDataPolicy = exports.tlsPolicyName = exports.tlsPolicy = exports.userAgentPolicyName = exports.userAgentPolicy = exports.defaultRetryPolicy = exports.tracingPolicyName = exports.tracingPolicy = exports.retryPolicy = exports.throttlingRetryPolicyName = exports.throttlingRetryPolicy = exports.systemErrorRetryPolicyName = exports.systemErrorRetryPolicy = exports.redirectPolicyName = exports.redirectPolicy = exports.getDefaultProxySettings = exports.proxyPolicyName = exports.proxyPolicy = exports.multipartPolicyName = exports.multipartPolicy = exports.logPolicyName = exports.logPolicy = exports.setClientRequestIdPolicyName = exports.setClientRequestIdPolicy = exports.exponentialRetryPolicyName = exports.exponentialRetryPolicy = exports.decompressResponsePolicyName = exports.decompressResponsePolicy = exports.isRestError = exports.RestError = exports.createPipelineRequest = exports.createHttpHeaders = exports.createDefaultHttpClient = exports.createPipelineFromOptions = exports.createEmptyPipeline = void 0;
+exports.createFileFromStream = exports.createFile = exports.auxiliaryAuthenticationHeaderPolicyName = exports.auxiliaryAuthenticationHeaderPolicy = exports.ndJsonPolicyName = exports.ndJsonPolicy = exports.bearerTokenAuthenticationPolicyName = exports.bearerTokenAuthenticationPolicy = exports.formDataPolicyName = exports.formDataPolicy = exports.tlsPolicyName = exports.tlsPolicy = exports.userAgentPolicyName = exports.userAgentPolicy = exports.defaultRetryPolicy = exports.tracingPolicyName = exports.tracingPolicy = exports.retryPolicy = exports.throttlingRetryPolicyName = exports.throttlingRetryPolicy = exports.systemErrorRetryPolicyName = exports.systemErrorRetryPolicy = exports.redirectPolicyName = exports.redirectPolicy = exports.getDefaultProxySettings = exports.proxyPolicyName = exports.proxyPolicy = exports.multipartPolicyName = exports.multipartPolicy = exports.logPolicyName = exports.logPolicy = exports.setClientRequestIdPolicyName = exports.setClientRequestIdPolicy = exports.exponentialRetryPolicyName = exports.exponentialRetryPolicy = exports.decompressResponsePolicyName = exports.decompressResponsePolicy = exports.isRestError = exports.RestError = exports.createPipelineRequest = exports.createHttpHeaders = exports.createDefaultHttpClient = exports.createPipelineFromOptions = exports.createEmptyPipeline = void 0;
var pipeline_js_1 = __nccwpck_require__(9590);
Object.defineProperty(exports, "createEmptyPipeline", ({ enumerable: true, get: function () { return pipeline_js_1.createEmptyPipeline; } }));
var createPipelineFromOptions_js_1 = __nccwpck_require__(862);
@@ -76621,9 +78752,6 @@ Object.defineProperty(exports, "ndJsonPolicyName", ({ enumerable: true, get: fun
var auxiliaryAuthenticationHeaderPolicy_js_1 = __nccwpck_require__(2262);
Object.defineProperty(exports, "auxiliaryAuthenticationHeaderPolicy", ({ enumerable: true, get: function () { return auxiliaryAuthenticationHeaderPolicy_js_1.auxiliaryAuthenticationHeaderPolicy; } }));
Object.defineProperty(exports, "auxiliaryAuthenticationHeaderPolicyName", ({ enumerable: true, get: function () { return auxiliaryAuthenticationHeaderPolicy_js_1.auxiliaryAuthenticationHeaderPolicyName; } }));
-var agentPolicy_js_1 = __nccwpck_require__(8554);
-Object.defineProperty(exports, "agentPolicy", ({ enumerable: true, get: function () { return agentPolicy_js_1.agentPolicy; } }));
-Object.defineProperty(exports, "agentPolicyName", ({ enumerable: true, get: function () { return agentPolicy_js_1.agentPolicyName; } }));
var file_js_1 = __nccwpck_require__(7073);
Object.defineProperty(exports, "createFile", ({ enumerable: true, get: function () { return file_js_1.createFile; } }));
Object.defineProperty(exports, "createFileFromStream", ({ enumerable: true, get: function () { return file_js_1.createFileFromStream; } }));
@@ -76646,22 +78774,626 @@ exports.logger = (0, logger_1.createClientLogger)("core-rest-pipeline");
/***/ }),
-/***/ 9590:
+/***/ 195:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.getBodyLength = getBodyLength;
+exports.createNodeHttpClient = createNodeHttpClient;
+const tslib_1 = __nccwpck_require__(1860);
+const http = tslib_1.__importStar(__nccwpck_require__(7067));
+const https = tslib_1.__importStar(__nccwpck_require__(4708));
+const zlib = tslib_1.__importStar(__nccwpck_require__(8522));
+const node_stream_1 = __nccwpck_require__(7075);
+const abort_controller_1 = __nccwpck_require__(3287);
+const httpHeaders_js_1 = __nccwpck_require__(192);
+const restError_js_1 = __nccwpck_require__(8666);
+const log_js_1 = __nccwpck_require__(544);
+const DEFAULT_TLS_SETTINGS = {};
+function isReadableStream(body) {
+ return body && typeof body.pipe === "function";
+}
+function isStreamComplete(stream) {
+ if (stream.readable === false) {
+ return Promise.resolve();
+ }
+ return new Promise((resolve) => {
+ const handler = () => {
+ resolve();
+ stream.removeListener("close", handler);
+ stream.removeListener("end", handler);
+ stream.removeListener("error", handler);
+ };
+ stream.on("close", handler);
+ stream.on("end", handler);
+ stream.on("error", handler);
+ });
+}
+function isArrayBuffer(body) {
+ return body && typeof body.byteLength === "number";
+}
+class ReportTransform extends node_stream_1.Transform {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
+ _transform(chunk, _encoding, callback) {
+ this.push(chunk);
+ this.loadedBytes += chunk.length;
+ try {
+ this.progressCallback({ loadedBytes: this.loadedBytes });
+ callback();
+ }
+ catch (e) {
+ callback(e);
+ }
+ }
+ constructor(progressCallback) {
+ super();
+ this.loadedBytes = 0;
+ this.progressCallback = progressCallback;
+ }
+}
+/**
+ * A HttpClient implementation that uses Node's "https" module to send HTTPS requests.
+ * @internal
+ */
+class NodeHttpClient {
+ constructor() {
+ this.cachedHttpsAgents = new WeakMap();
+ }
+ /**
+ * Makes a request over an underlying transport layer and returns the response.
+ * @param request - The request to be made.
+ */
+ async sendRequest(request) {
+ var _a, _b, _c;
+ const abortController = new AbortController();
+ let abortListener;
+ if (request.abortSignal) {
+ if (request.abortSignal.aborted) {
+ throw new abort_controller_1.AbortError("The operation was aborted.");
+ }
+ abortListener = (event) => {
+ if (event.type === "abort") {
+ abortController.abort();
+ }
+ };
+ request.abortSignal.addEventListener("abort", abortListener);
+ }
+ if (request.timeout > 0) {
+ setTimeout(() => {
+ abortController.abort();
+ }, request.timeout);
+ }
+ const acceptEncoding = request.headers.get("Accept-Encoding");
+ const shouldDecompress = (acceptEncoding === null || acceptEncoding === void 0 ? void 0 : acceptEncoding.includes("gzip")) || (acceptEncoding === null || acceptEncoding === void 0 ? void 0 : acceptEncoding.includes("deflate"));
+ let body = typeof request.body === "function" ? request.body() : request.body;
+ if (body && !request.headers.has("Content-Length")) {
+ const bodyLength = getBodyLength(body);
+ if (bodyLength !== null) {
+ request.headers.set("Content-Length", bodyLength);
+ }
+ }
+ let responseStream;
+ try {
+ if (body && request.onUploadProgress) {
+ const onUploadProgress = request.onUploadProgress;
+ const uploadReportStream = new ReportTransform(onUploadProgress);
+ uploadReportStream.on("error", (e) => {
+ log_js_1.logger.error("Error in upload progress", e);
+ });
+ if (isReadableStream(body)) {
+ body.pipe(uploadReportStream);
+ }
+ else {
+ uploadReportStream.end(body);
+ }
+ body = uploadReportStream;
+ }
+ const res = await this.makeRequest(request, abortController, body);
+ const headers = getResponseHeaders(res);
+ const status = (_a = res.statusCode) !== null && _a !== void 0 ? _a : 0;
+ const response = {
+ status,
+ headers,
+ request,
+ };
+ // Responses to HEAD must not have a body.
+ // If they do return a body, that body must be ignored.
+ if (request.method === "HEAD") {
+ // call resume() and not destroy() to avoid closing the socket
+ // and losing keep alive
+ res.resume();
+ return response;
+ }
+ responseStream = shouldDecompress ? getDecodedResponseStream(res, headers) : res;
+ const onDownloadProgress = request.onDownloadProgress;
+ if (onDownloadProgress) {
+ const downloadReportStream = new ReportTransform(onDownloadProgress);
+ downloadReportStream.on("error", (e) => {
+ log_js_1.logger.error("Error in download progress", e);
+ });
+ responseStream.pipe(downloadReportStream);
+ responseStream = downloadReportStream;
+ }
+ if (
+ // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code
+ ((_b = request.streamResponseStatusCodes) === null || _b === void 0 ? void 0 : _b.has(Number.POSITIVE_INFINITY)) ||
+ ((_c = request.streamResponseStatusCodes) === null || _c === void 0 ? void 0 : _c.has(response.status))) {
+ response.readableStreamBody = responseStream;
+ }
+ else {
+ response.bodyAsText = await streamToText(responseStream);
+ }
+ return response;
+ }
+ finally {
+ // clean up event listener
+ if (request.abortSignal && abortListener) {
+ let uploadStreamDone = Promise.resolve();
+ if (isReadableStream(body)) {
+ uploadStreamDone = isStreamComplete(body);
+ }
+ let downloadStreamDone = Promise.resolve();
+ if (isReadableStream(responseStream)) {
+ downloadStreamDone = isStreamComplete(responseStream);
+ }
+ Promise.all([uploadStreamDone, downloadStreamDone])
+ .then(() => {
+ var _a;
+ // eslint-disable-next-line promise/always-return
+ if (abortListener) {
+ (_a = request.abortSignal) === null || _a === void 0 ? void 0 : _a.removeEventListener("abort", abortListener);
+ }
+ })
+ .catch((e) => {
+ log_js_1.logger.warning("Error when cleaning up abortListener on httpRequest", e);
+ });
+ }
+ }
+ }
+ makeRequest(request, abortController, body) {
+ var _a;
+ const url = new URL(request.url);
+ const isInsecure = url.protocol !== "https:";
+ if (isInsecure && !request.allowInsecureConnection) {
+ throw new Error(`Cannot connect to ${request.url} while allowInsecureConnection is false.`);
+ }
+ const agent = (_a = request.agent) !== null && _a !== void 0 ? _a : this.getOrCreateAgent(request, isInsecure);
+ const options = {
+ agent,
+ hostname: url.hostname,
+ path: `${url.pathname}${url.search}`,
+ port: url.port,
+ method: request.method,
+ headers: request.headers.toJSON({ preserveCase: true }),
+ };
+ return new Promise((resolve, reject) => {
+ const req = isInsecure ? http.request(options, resolve) : https.request(options, resolve);
+ req.once("error", (err) => {
+ var _a;
+ reject(new restError_js_1.RestError(err.message, { code: (_a = err.code) !== null && _a !== void 0 ? _a : restError_js_1.RestError.REQUEST_SEND_ERROR, request }));
+ });
+ abortController.signal.addEventListener("abort", () => {
+ const abortError = new abort_controller_1.AbortError("The operation was aborted.");
+ req.destroy(abortError);
+ reject(abortError);
+ });
+ if (body && isReadableStream(body)) {
+ body.pipe(req);
+ }
+ else if (body) {
+ if (typeof body === "string" || Buffer.isBuffer(body)) {
+ req.end(body);
+ }
+ else if (isArrayBuffer(body)) {
+ req.end(ArrayBuffer.isView(body) ? Buffer.from(body.buffer) : Buffer.from(body));
+ }
+ else {
+ log_js_1.logger.error("Unrecognized body type", body);
+ reject(new restError_js_1.RestError("Unrecognized body type"));
+ }
+ }
+ else {
+ // streams don't like "undefined" being passed as data
+ req.end();
+ }
+ });
+ }
+ getOrCreateAgent(request, isInsecure) {
+ var _a;
+ const disableKeepAlive = request.disableKeepAlive;
+ // Handle Insecure requests first
+ if (isInsecure) {
+ if (disableKeepAlive) {
+ // keepAlive:false is the default so we don't need a custom Agent
+ return http.globalAgent;
+ }
+ if (!this.cachedHttpAgent) {
+ // If there is no cached agent create a new one and cache it.
+ this.cachedHttpAgent = new http.Agent({ keepAlive: true });
+ }
+ return this.cachedHttpAgent;
+ }
+ else {
+ if (disableKeepAlive && !request.tlsSettings) {
+ // When there are no tlsSettings and keepAlive is false
+ // we don't need a custom agent
+ return https.globalAgent;
+ }
+ // We use the tlsSettings to index cached clients
+ const tlsSettings = (_a = request.tlsSettings) !== null && _a !== void 0 ? _a : DEFAULT_TLS_SETTINGS;
+ // Get the cached agent or create a new one with the
+ // provided values for keepAlive and tlsSettings
+ let agent = this.cachedHttpsAgents.get(tlsSettings);
+ if (agent && agent.options.keepAlive === !disableKeepAlive) {
+ return agent;
+ }
+ log_js_1.logger.info("No cached TLS Agent exist, creating a new Agent");
+ agent = new https.Agent(Object.assign({
+ // keepAlive is true if disableKeepAlive is false.
+ keepAlive: !disableKeepAlive }, tlsSettings));
+ this.cachedHttpsAgents.set(tlsSettings, agent);
+ return agent;
+ }
+ }
+}
+function getResponseHeaders(res) {
+ const headers = (0, httpHeaders_js_1.createHttpHeaders)();
+ for (const header of Object.keys(res.headers)) {
+ const value = res.headers[header];
+ if (Array.isArray(value)) {
+ if (value.length > 0) {
+ headers.set(header, value[0]);
+ }
+ }
+ else if (value) {
+ headers.set(header, value);
+ }
+ }
+ return headers;
+}
+function getDecodedResponseStream(stream, headers) {
+ const contentEncoding = headers.get("Content-Encoding");
+ if (contentEncoding === "gzip") {
+ const unzip = zlib.createGunzip();
+ stream.pipe(unzip);
+ return unzip;
+ }
+ else if (contentEncoding === "deflate") {
+ const inflate = zlib.createInflate();
+ stream.pipe(inflate);
+ return inflate;
+ }
+ return stream;
+}
+function streamToText(stream) {
+ return new Promise((resolve, reject) => {
+ const buffer = [];
+ stream.on("data", (chunk) => {
+ if (Buffer.isBuffer(chunk)) {
+ buffer.push(chunk);
+ }
+ else {
+ buffer.push(Buffer.from(chunk));
+ }
+ });
+ stream.on("end", () => {
+ resolve(Buffer.concat(buffer).toString("utf8"));
+ });
+ stream.on("error", (e) => {
+ if (e && (e === null || e === void 0 ? void 0 : e.name) === "AbortError") {
+ reject(e);
+ }
+ else {
+ reject(new restError_js_1.RestError(`Error reading response as text: ${e.message}`, {
+ code: restError_js_1.RestError.PARSE_ERROR,
+ }));
+ }
+ });
+ });
+}
+/** @internal */
+function getBodyLength(body) {
+ if (!body) {
+ return 0;
+ }
+ else if (Buffer.isBuffer(body)) {
+ return body.length;
+ }
+ else if (isReadableStream(body)) {
+ return null;
+ }
+ else if (isArrayBuffer(body)) {
+ return body.byteLength;
+ }
+ else if (typeof body === "string") {
+ return Buffer.from(body).length;
+ }
+ else {
+ return null;
+ }
+}
+/**
+ * Create a new HttpClient instance for the NodeJS environment.
+ * @internal
+ */
+function createNodeHttpClient() {
+ return new NodeHttpClient();
+}
+//# sourceMappingURL=nodeHttpClient.js.map
+
+/***/ }),
+
+/***/ 9590:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createEmptyPipeline = createEmptyPipeline;
-const ts_http_runtime_1 = __nccwpck_require__(1958);
+const ValidPhaseNames = new Set(["Deserialize", "Serialize", "Retry", "Sign"]);
+/**
+ * A private implementation of Pipeline.
+ * Do not export this class from the package.
+ * @internal
+ */
+class HttpPipeline {
+ constructor(policies) {
+ var _a;
+ this._policies = [];
+ this._policies = (_a = policies === null || policies === void 0 ? void 0 : policies.slice(0)) !== null && _a !== void 0 ? _a : [];
+ this._orderedPolicies = undefined;
+ }
+ addPolicy(policy, options = {}) {
+ if (options.phase && options.afterPhase) {
+ throw new Error("Policies inside a phase cannot specify afterPhase.");
+ }
+ if (options.phase && !ValidPhaseNames.has(options.phase)) {
+ throw new Error(`Invalid phase name: ${options.phase}`);
+ }
+ if (options.afterPhase && !ValidPhaseNames.has(options.afterPhase)) {
+ throw new Error(`Invalid afterPhase name: ${options.afterPhase}`);
+ }
+ this._policies.push({
+ policy,
+ options,
+ });
+ this._orderedPolicies = undefined;
+ }
+ removePolicy(options) {
+ const removedPolicies = [];
+ this._policies = this._policies.filter((policyDescriptor) => {
+ if ((options.name && policyDescriptor.policy.name === options.name) ||
+ (options.phase && policyDescriptor.options.phase === options.phase)) {
+ removedPolicies.push(policyDescriptor.policy);
+ return false;
+ }
+ else {
+ return true;
+ }
+ });
+ this._orderedPolicies = undefined;
+ return removedPolicies;
+ }
+ sendRequest(httpClient, request) {
+ const policies = this.getOrderedPolicies();
+ const pipeline = policies.reduceRight((next, policy) => {
+ return (req) => {
+ return policy.sendRequest(req, next);
+ };
+ }, (req) => httpClient.sendRequest(req));
+ return pipeline(request);
+ }
+ getOrderedPolicies() {
+ if (!this._orderedPolicies) {
+ this._orderedPolicies = this.orderPolicies();
+ }
+ return this._orderedPolicies;
+ }
+ clone() {
+ return new HttpPipeline(this._policies);
+ }
+ static create() {
+ return new HttpPipeline();
+ }
+ orderPolicies() {
+ /**
+ * The goal of this method is to reliably order pipeline policies
+ * based on their declared requirements when they were added.
+ *
+ * Order is first determined by phase:
+ *
+ * 1. Serialize Phase
+ * 2. Policies not in a phase
+ * 3. Deserialize Phase
+ * 4. Retry Phase
+ * 5. Sign Phase
+ *
+ * Within each phase, policies are executed in the order
+ * they were added unless they were specified to execute
+ * before/after other policies or after a particular phase.
+ *
+ * To determine the final order, we will walk the policy list
+ * in phase order multiple times until all dependencies are
+ * satisfied.
+ *
+ * `afterPolicies` are the set of policies that must be
+ * executed before a given policy. This requirement is
+ * considered satisfied when each of the listed policies
+ * have been scheduled.
+ *
+ * `beforePolicies` are the set of policies that must be
+ * executed after a given policy. Since this dependency
+ * can be expressed by converting it into a equivalent
+ * `afterPolicies` declarations, they are normalized
+ * into that form for simplicity.
+ *
+ * An `afterPhase` dependency is considered satisfied when all
+ * policies in that phase have scheduled.
+ *
+ */
+ const result = [];
+ // Track all policies we know about.
+ const policyMap = new Map();
+ function createPhase(name) {
+ return {
+ name,
+ policies: new Set(),
+ hasRun: false,
+ hasAfterPolicies: false,
+ };
+ }
+ // Track policies for each phase.
+ const serializePhase = createPhase("Serialize");
+ const noPhase = createPhase("None");
+ const deserializePhase = createPhase("Deserialize");
+ const retryPhase = createPhase("Retry");
+ const signPhase = createPhase("Sign");
+ // a list of phases in order
+ const orderedPhases = [serializePhase, noPhase, deserializePhase, retryPhase, signPhase];
+ // Small helper function to map phase name to each Phase
+ function getPhase(phase) {
+ if (phase === "Retry") {
+ return retryPhase;
+ }
+ else if (phase === "Serialize") {
+ return serializePhase;
+ }
+ else if (phase === "Deserialize") {
+ return deserializePhase;
+ }
+ else if (phase === "Sign") {
+ return signPhase;
+ }
+ else {
+ return noPhase;
+ }
+ }
+ // First walk each policy and create a node to track metadata.
+ for (const descriptor of this._policies) {
+ const policy = descriptor.policy;
+ const options = descriptor.options;
+ const policyName = policy.name;
+ if (policyMap.has(policyName)) {
+ throw new Error("Duplicate policy names not allowed in pipeline");
+ }
+ const node = {
+ policy,
+ dependsOn: new Set(),
+ dependants: new Set(),
+ };
+ if (options.afterPhase) {
+ node.afterPhase = getPhase(options.afterPhase);
+ node.afterPhase.hasAfterPolicies = true;
+ }
+ policyMap.set(policyName, node);
+ const phase = getPhase(options.phase);
+ phase.policies.add(node);
+ }
+ // Now that each policy has a node, connect dependency references.
+ for (const descriptor of this._policies) {
+ const { policy, options } = descriptor;
+ const policyName = policy.name;
+ const node = policyMap.get(policyName);
+ if (!node) {
+ throw new Error(`Missing node for policy ${policyName}`);
+ }
+ if (options.afterPolicies) {
+ for (const afterPolicyName of options.afterPolicies) {
+ const afterNode = policyMap.get(afterPolicyName);
+ if (afterNode) {
+ // Linking in both directions helps later
+ // when we want to notify dependants.
+ node.dependsOn.add(afterNode);
+ afterNode.dependants.add(node);
+ }
+ }
+ }
+ if (options.beforePolicies) {
+ for (const beforePolicyName of options.beforePolicies) {
+ const beforeNode = policyMap.get(beforePolicyName);
+ if (beforeNode) {
+ // To execute before another node, make it
+ // depend on the current node.
+ beforeNode.dependsOn.add(node);
+ node.dependants.add(beforeNode);
+ }
+ }
+ }
+ }
+ function walkPhase(phase) {
+ phase.hasRun = true;
+ // Sets iterate in insertion order
+ for (const node of phase.policies) {
+ if (node.afterPhase && (!node.afterPhase.hasRun || node.afterPhase.policies.size)) {
+ // If this node is waiting on a phase to complete,
+ // we need to skip it for now.
+ // Even if the phase is empty, we should wait for it
+ // to be walked to avoid re-ordering policies.
+ continue;
+ }
+ if (node.dependsOn.size === 0) {
+ // If there's nothing else we're waiting for, we can
+ // add this policy to the result list.
+ result.push(node.policy);
+ // Notify anything that depends on this policy that
+ // the policy has been scheduled.
+ for (const dependant of node.dependants) {
+ dependant.dependsOn.delete(node);
+ }
+ policyMap.delete(node.policy.name);
+ phase.policies.delete(node);
+ }
+ }
+ }
+ function walkPhases() {
+ for (const phase of orderedPhases) {
+ walkPhase(phase);
+ // if the phase isn't complete
+ if (phase.policies.size > 0 && phase !== noPhase) {
+ if (!noPhase.hasRun) {
+ // Try running noPhase to see if that unblocks this phase next tick.
+ // This can happen if a phase that happens before noPhase
+ // is waiting on a noPhase policy to complete.
+ walkPhase(noPhase);
+ }
+ // Don't proceed to the next phase until this phase finishes.
+ return;
+ }
+ if (phase.hasAfterPolicies) {
+ // Run any policies unblocked by this phase
+ walkPhase(noPhase);
+ }
+ }
+ }
+ // Iterate until we've put every node in the result list.
+ let iteration = 0;
+ while (policyMap.size > 0) {
+ iteration++;
+ const initialResultLength = result.length;
+ // Keep walking each phase in order until we can order every node.
+ walkPhases();
+ // The result list *should* get at least one larger each time
+ // after the first full pass.
+ // Otherwise, we're going to loop forever.
+ if (result.length <= initialResultLength && iteration > 1) {
+ throw new Error("Cannot satisfy policy dependencies due to requirements cycle.");
+ }
+ }
+ return result;
+ }
+}
/**
* Creates a totally empty pipeline.
* Useful for testing or creating a custom one.
*/
function createEmptyPipeline() {
- return (0, ts_http_runtime_1.createEmptyPipeline)();
+ return HttpPipeline.create();
}
//# sourceMappingURL=pipeline.js.map
@@ -76676,47 +79408,43 @@ function createEmptyPipeline() {
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createPipelineRequest = createPipelineRequest;
-const ts_http_runtime_1 = __nccwpck_require__(1958);
+const httpHeaders_js_1 = __nccwpck_require__(192);
+const core_util_1 = __nccwpck_require__(7779);
+class PipelineRequestImpl {
+ constructor(options) {
+ var _a, _b, _c, _d, _e, _f, _g;
+ this.url = options.url;
+ this.body = options.body;
+ this.headers = (_a = options.headers) !== null && _a !== void 0 ? _a : (0, httpHeaders_js_1.createHttpHeaders)();
+ this.method = (_b = options.method) !== null && _b !== void 0 ? _b : "GET";
+ this.timeout = (_c = options.timeout) !== null && _c !== void 0 ? _c : 0;
+ this.multipartBody = options.multipartBody;
+ this.formData = options.formData;
+ this.disableKeepAlive = (_d = options.disableKeepAlive) !== null && _d !== void 0 ? _d : false;
+ this.proxySettings = options.proxySettings;
+ this.streamResponseStatusCodes = options.streamResponseStatusCodes;
+ this.withCredentials = (_e = options.withCredentials) !== null && _e !== void 0 ? _e : false;
+ this.abortSignal = options.abortSignal;
+ this.tracingOptions = options.tracingOptions;
+ this.onUploadProgress = options.onUploadProgress;
+ this.onDownloadProgress = options.onDownloadProgress;
+ this.requestId = options.requestId || (0, core_util_1.randomUUID)();
+ this.allowInsecureConnection = (_f = options.allowInsecureConnection) !== null && _f !== void 0 ? _f : false;
+ this.enableBrowserStreams = (_g = options.enableBrowserStreams) !== null && _g !== void 0 ? _g : false;
+ }
+}
/**
* Creates a new pipeline request with the given options.
* This method is to allow for the easy setting of default values and not required.
* @param options - The options to create the request with.
*/
function createPipelineRequest(options) {
- // Cast required due to difference between ts-http-runtime requiring AbortSignal while core-rest-pipeline allows
- // the more generic AbortSignalLike. The wrapAbortSignalLike pipeline policy will take care of ensuring that any AbortSignalLike in the request
- // is converted into a true AbortSignal.
- return (0, ts_http_runtime_1.createPipelineRequest)(options);
+ return new PipelineRequestImpl(options);
}
//# sourceMappingURL=pipelineRequest.js.map
/***/ }),
-/***/ 8554:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.agentPolicyName = void 0;
-exports.agentPolicy = agentPolicy;
-const policies_1 = __nccwpck_require__(4960);
-/**
- * Name of the Agent Policy
- */
-exports.agentPolicyName = policies_1.agentPolicyName;
-/**
- * Gets a pipeline policy that sets http.agent
- */
-function agentPolicy(agent) {
- return (0, policies_1.agentPolicy)(agent);
-}
-//# sourceMappingURL=agentPolicy.js.map
-
-/***/ }),
-
/***/ 2262:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -77042,7 +79770,7 @@ function getCaeChallengeClaims(challenges) {
/***/ }),
/***/ 9295:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+/***/ ((__unused_webpack_module, exports) => {
"use strict";
@@ -77051,17 +79779,25 @@ function getCaeChallengeClaims(challenges) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.decompressResponsePolicyName = void 0;
exports.decompressResponsePolicy = decompressResponsePolicy;
-const policies_1 = __nccwpck_require__(4960);
/**
* The programmatic identifier of the decompressResponsePolicy.
*/
-exports.decompressResponsePolicyName = policies_1.decompressResponsePolicyName;
+exports.decompressResponsePolicyName = "decompressResponsePolicy";
/**
* A policy to enable response decompression according to Accept-Encoding header
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding
*/
function decompressResponsePolicy() {
- return (0, policies_1.decompressResponsePolicy)();
+ return {
+ name: exports.decompressResponsePolicyName,
+ async sendRequest(request, next) {
+ // HEAD requests have no body
+ if (request.method !== "HEAD") {
+ request.headers.set("Accept-Encoding", "gzip,deflate");
+ }
+ return next(request);
+ },
+ };
}
//# sourceMappingURL=decompressResponsePolicy.js.map
@@ -77077,11 +79813,14 @@ function decompressResponsePolicy() {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.defaultRetryPolicyName = void 0;
exports.defaultRetryPolicy = defaultRetryPolicy;
-const policies_1 = __nccwpck_require__(4960);
+const exponentialRetryStrategy_js_1 = __nccwpck_require__(2);
+const throttlingRetryStrategy_js_1 = __nccwpck_require__(7084);
+const retryPolicy_js_1 = __nccwpck_require__(6085);
+const constants_js_1 = __nccwpck_require__(6427);
/**
* Name of the {@link defaultRetryPolicy}
*/
-exports.defaultRetryPolicyName = policies_1.defaultRetryPolicyName;
+exports.defaultRetryPolicyName = "defaultRetryPolicy";
/**
* A policy that retries according to three strategies:
* - When the server sends a 429 response with a Retry-After header.
@@ -77089,7 +79828,13 @@ exports.defaultRetryPolicyName = policies_1.defaultRetryPolicyName;
* - Or otherwise if the outgoing request fails, it will retry with an exponentially increasing delay.
*/
function defaultRetryPolicy(options = {}) {
- return (0, policies_1.defaultRetryPolicy)(options);
+ var _a;
+ return {
+ name: exports.defaultRetryPolicyName,
+ sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)(), (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)(options)], {
+ maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
+ }).sendRequest,
+ };
}
//# sourceMappingURL=defaultRetryPolicy.js.map
@@ -77105,17 +79850,24 @@ function defaultRetryPolicy(options = {}) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.exponentialRetryPolicyName = void 0;
exports.exponentialRetryPolicy = exponentialRetryPolicy;
-const policies_1 = __nccwpck_require__(4960);
+const exponentialRetryStrategy_js_1 = __nccwpck_require__(2);
+const retryPolicy_js_1 = __nccwpck_require__(6085);
+const constants_js_1 = __nccwpck_require__(6427);
/**
* The programmatic identifier of the exponentialRetryPolicy.
*/
-exports.exponentialRetryPolicyName = policies_1.exponentialRetryPolicyName;
+exports.exponentialRetryPolicyName = "exponentialRetryPolicy";
/**
* A policy that attempts to retry requests while introducing an exponentially increasing delay.
* @param options - Options that configure retry logic.
*/
function exponentialRetryPolicy(options = {}) {
- return (0, policies_1.exponentialRetryPolicy)(options);
+ var _a;
+ return (0, retryPolicy_js_1.retryPolicy)([
+ (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)(Object.assign(Object.assign({}, options), { ignoreSystemErrors: true })),
+ ], {
+ maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
+ });
}
//# sourceMappingURL=exponentialRetryPolicy.js.map
@@ -77131,16 +79883,98 @@ function exponentialRetryPolicy(options = {}) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.formDataPolicyName = void 0;
exports.formDataPolicy = formDataPolicy;
-const policies_1 = __nccwpck_require__(4960);
+const core_util_1 = __nccwpck_require__(7779);
+const httpHeaders_js_1 = __nccwpck_require__(192);
/**
* The programmatic identifier of the formDataPolicy.
*/
-exports.formDataPolicyName = policies_1.formDataPolicyName;
+exports.formDataPolicyName = "formDataPolicy";
+function formDataToFormDataMap(formData) {
+ var _a;
+ const formDataMap = {};
+ for (const [key, value] of formData.entries()) {
+ (_a = formDataMap[key]) !== null && _a !== void 0 ? _a : (formDataMap[key] = []);
+ formDataMap[key].push(value);
+ }
+ return formDataMap;
+}
/**
* A policy that encodes FormData on the request into the body.
*/
function formDataPolicy() {
- return (0, policies_1.formDataPolicy)();
+ return {
+ name: exports.formDataPolicyName,
+ async sendRequest(request, next) {
+ if (core_util_1.isNodeLike && typeof FormData !== "undefined" && request.body instanceof FormData) {
+ request.formData = formDataToFormDataMap(request.body);
+ request.body = undefined;
+ }
+ if (request.formData) {
+ const contentType = request.headers.get("Content-Type");
+ if (contentType && contentType.indexOf("application/x-www-form-urlencoded") !== -1) {
+ request.body = wwwFormUrlEncode(request.formData);
+ }
+ else {
+ await prepareFormData(request.formData, request);
+ }
+ request.formData = undefined;
+ }
+ return next(request);
+ },
+ };
+}
+function wwwFormUrlEncode(formData) {
+ const urlSearchParams = new URLSearchParams();
+ for (const [key, value] of Object.entries(formData)) {
+ if (Array.isArray(value)) {
+ for (const subValue of value) {
+ urlSearchParams.append(key, subValue.toString());
+ }
+ }
+ else {
+ urlSearchParams.append(key, value.toString());
+ }
+ }
+ return urlSearchParams.toString();
+}
+async function prepareFormData(formData, request) {
+ // validate content type (multipart/form-data)
+ const contentType = request.headers.get("Content-Type");
+ if (contentType && !contentType.startsWith("multipart/form-data")) {
+ // content type is specified and is not multipart/form-data. Exit.
+ return;
+ }
+ request.headers.set("Content-Type", contentType !== null && contentType !== void 0 ? contentType : "multipart/form-data");
+ // set body to MultipartRequestBody using content from FormDataMap
+ const parts = [];
+ for (const [fieldName, values] of Object.entries(formData)) {
+ for (const value of Array.isArray(values) ? values : [values]) {
+ if (typeof value === "string") {
+ parts.push({
+ headers: (0, httpHeaders_js_1.createHttpHeaders)({
+ "Content-Disposition": `form-data; name="${fieldName}"`,
+ }),
+ body: (0, core_util_1.stringToUint8Array)(value, "utf-8"),
+ });
+ }
+ else if (value === undefined || value === null || typeof value !== "object") {
+ throw new Error(`Unexpected value for key ${fieldName}: ${value}. Value should be serialized to string first.`);
+ }
+ else {
+ // using || instead of ?? here since if value.name is empty we should create a file name
+ const fileName = value.name || "blob";
+ const headers = (0, httpHeaders_js_1.createHttpHeaders)();
+ headers.set("Content-Disposition", `form-data; name="${fieldName}"; filename="${fileName}"`);
+ // again, || is used since an empty value.type means the content type is unset
+ headers.set("Content-Type", value.type || "application/octet-stream");
+ parts.push({
+ headers,
+ body: value,
+ });
+ }
+ }
+ }
+ request.multipartBody = { parts };
}
//# sourceMappingURL=formDataPolicy.js.map
@@ -77157,17 +79991,35 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.logPolicyName = void 0;
exports.logPolicy = logPolicy;
const log_js_1 = __nccwpck_require__(544);
-const policies_1 = __nccwpck_require__(4960);
+const sanitizer_js_1 = __nccwpck_require__(5204);
/**
* The programmatic identifier of the logPolicy.
*/
-exports.logPolicyName = policies_1.logPolicyName;
+exports.logPolicyName = "logPolicy";
/**
* A policy that logs all requests and responses.
* @param options - Options to configure logPolicy.
*/
function logPolicy(options = {}) {
- return (0, policies_1.logPolicy)(Object.assign({ logger: log_js_1.logger.info }, options));
+ var _a;
+ const logger = (_a = options.logger) !== null && _a !== void 0 ? _a : log_js_1.logger.info;
+ const sanitizer = new sanitizer_js_1.Sanitizer({
+ additionalAllowedHeaderNames: options.additionalAllowedHeaderNames,
+ additionalAllowedQueryParameters: options.additionalAllowedQueryParameters,
+ });
+ return {
+ name: exports.logPolicyName,
+ async sendRequest(request, next) {
+ if (!logger.enabled) {
+ return next(request);
+ }
+ logger(`Request: ${sanitizer.sanitize(request)}`);
+ const response = await next(request);
+ logger(`Response status code: ${response.status}`);
+ logger(`Headers: ${sanitizer.sanitize(response.headers)}`);
+ return response;
+ },
+ };
}
//# sourceMappingURL=logPolicy.js.map
@@ -77183,28 +80035,111 @@ function logPolicy(options = {}) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.multipartPolicyName = void 0;
exports.multipartPolicy = multipartPolicy;
-const policies_1 = __nccwpck_require__(4960);
-const file_js_1 = __nccwpck_require__(7073);
+const core_util_1 = __nccwpck_require__(7779);
+const concat_js_1 = __nccwpck_require__(2471);
+const typeGuards_js_1 = __nccwpck_require__(2621);
+function generateBoundary() {
+ return `----AzSDKFormBoundary${(0, core_util_1.randomUUID)()}`;
+}
+function encodeHeaders(headers) {
+ let result = "";
+ for (const [key, value] of headers) {
+ result += `${key}: ${value}\r\n`;
+ }
+ return result;
+}
+function getLength(source) {
+ if (source instanceof Uint8Array) {
+ return source.byteLength;
+ }
+ else if ((0, typeGuards_js_1.isBlob)(source)) {
+ // if was created using createFile then -1 means we have an unknown size
+ return source.size === -1 ? undefined : source.size;
+ }
+ else {
+ return undefined;
+ }
+}
+function getTotalLength(sources) {
+ let total = 0;
+ for (const source of sources) {
+ const partLength = getLength(source);
+ if (partLength === undefined) {
+ return undefined;
+ }
+ else {
+ total += partLength;
+ }
+ }
+ return total;
+}
+async function buildRequestBody(request, parts, boundary) {
+ const sources = [
+ (0, core_util_1.stringToUint8Array)(`--${boundary}`, "utf-8"),
+ ...parts.flatMap((part) => [
+ (0, core_util_1.stringToUint8Array)("\r\n", "utf-8"),
+ (0, core_util_1.stringToUint8Array)(encodeHeaders(part.headers), "utf-8"),
+ (0, core_util_1.stringToUint8Array)("\r\n", "utf-8"),
+ part.body,
+ (0, core_util_1.stringToUint8Array)(`\r\n--${boundary}`, "utf-8"),
+ ]),
+ (0, core_util_1.stringToUint8Array)("--\r\n\r\n", "utf-8"),
+ ];
+ const contentLength = getTotalLength(sources);
+ if (contentLength) {
+ request.headers.set("Content-Length", contentLength);
+ }
+ request.body = await (0, concat_js_1.concat)(sources);
+}
/**
* Name of multipart policy
*/
-exports.multipartPolicyName = policies_1.multipartPolicyName;
+exports.multipartPolicyName = "multipartPolicy";
+const maxBoundaryLength = 70;
+const validBoundaryCharacters = new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`);
+function assertValidBoundary(boundary) {
+ if (boundary.length > maxBoundaryLength) {
+ throw new Error(`Multipart boundary "${boundary}" exceeds maximum length of 70 characters`);
+ }
+ if (Array.from(boundary).some((x) => !validBoundaryCharacters.has(x))) {
+ throw new Error(`Multipart boundary "${boundary}" contains invalid characters`);
+ }
+}
/**
* Pipeline policy for multipart requests
*/
function multipartPolicy() {
- const tspPolicy = (0, policies_1.multipartPolicy)();
return {
name: exports.multipartPolicyName,
- sendRequest: async (request, next) => {
- if (request.multipartBody) {
- for (const part of request.multipartBody.parts) {
- if ((0, file_js_1.hasRawContent)(part.body)) {
- part.body = (0, file_js_1.getRawContent)(part.body);
- }
- }
+ async sendRequest(request, next) {
+ var _a;
+ if (!request.multipartBody) {
+ return next(request);
}
- return tspPolicy.sendRequest(request, next);
+ if (request.body) {
+ throw new Error("multipartBody and regular body cannot be set at the same time");
+ }
+ let boundary = request.multipartBody.boundary;
+ const contentTypeHeader = (_a = request.headers.get("Content-Type")) !== null && _a !== void 0 ? _a : "multipart/mixed";
+ const parsedHeader = contentTypeHeader.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/);
+ if (!parsedHeader) {
+ throw new Error(`Got multipart request body, but content-type header was not multipart: ${contentTypeHeader}`);
+ }
+ const [, contentType, parsedBoundary] = parsedHeader;
+ if (parsedBoundary && boundary && parsedBoundary !== boundary) {
+ throw new Error(`Multipart boundary was specified as ${parsedBoundary} in the header, but got ${boundary} in the request body`);
+ }
+ boundary !== null && boundary !== void 0 ? boundary : (boundary = parsedBoundary);
+ if (boundary) {
+ assertValidBoundary(boundary);
+ }
+ else {
+ boundary = generateBoundary();
+ }
+ request.headers.set("Content-Type", `${contentType}; boundary=${boundary}`);
+ await buildRequestBody(request, request.multipartBody.parts, boundary);
+ request.multipartBody = undefined;
+ return next(request);
},
};
}
@@ -77256,14 +80191,94 @@ function ndJsonPolicy() {
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.proxyPolicyName = void 0;
+exports.globalNoProxyList = exports.proxyPolicyName = void 0;
+exports.loadNoProxy = loadNoProxy;
exports.getDefaultProxySettings = getDefaultProxySettings;
exports.proxyPolicy = proxyPolicy;
-const policies_1 = __nccwpck_require__(4960);
+const https_proxy_agent_1 = __nccwpck_require__(3669);
+const http_proxy_agent_1 = __nccwpck_require__(1970);
+const log_js_1 = __nccwpck_require__(544);
+const HTTPS_PROXY = "HTTPS_PROXY";
+const HTTP_PROXY = "HTTP_PROXY";
+const ALL_PROXY = "ALL_PROXY";
+const NO_PROXY = "NO_PROXY";
/**
* The programmatic identifier of the proxyPolicy.
*/
-exports.proxyPolicyName = policies_1.proxyPolicyName;
+exports.proxyPolicyName = "proxyPolicy";
+/**
+ * Stores the patterns specified in NO_PROXY environment variable.
+ * @internal
+ */
+exports.globalNoProxyList = [];
+let noProxyListLoaded = false;
+/** A cache of whether a host should bypass the proxy. */
+const globalBypassedMap = new Map();
+function getEnvironmentValue(name) {
+ if (process.env[name]) {
+ return process.env[name];
+ }
+ else if (process.env[name.toLowerCase()]) {
+ return process.env[name.toLowerCase()];
+ }
+ return undefined;
+}
+function loadEnvironmentProxyValue() {
+ if (!process) {
+ return undefined;
+ }
+ const httpsProxy = getEnvironmentValue(HTTPS_PROXY);
+ const allProxy = getEnvironmentValue(ALL_PROXY);
+ const httpProxy = getEnvironmentValue(HTTP_PROXY);
+ return httpsProxy || allProxy || httpProxy;
+}
+/**
+ * Check whether the host of a given `uri` matches any pattern in the no proxy list.
+ * If there's a match, any request sent to the same host shouldn't have the proxy settings set.
+ * This implementation is a port of https://github.com/Azure/azure-sdk-for-net/blob/8cca811371159e527159c7eb65602477898683e2/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs#L210
+ */
+function isBypassed(uri, noProxyList, bypassedMap) {
+ if (noProxyList.length === 0) {
+ return false;
+ }
+ const host = new URL(uri).hostname;
+ if (bypassedMap === null || bypassedMap === void 0 ? void 0 : bypassedMap.has(host)) {
+ return bypassedMap.get(host);
+ }
+ let isBypassedFlag = false;
+ for (const pattern of noProxyList) {
+ if (pattern[0] === ".") {
+ // This should match either domain it self or any subdomain or host
+ // .foo.com will match foo.com it self or *.foo.com
+ if (host.endsWith(pattern)) {
+ isBypassedFlag = true;
+ }
+ else {
+ if (host.length === pattern.length - 1 && host === pattern.slice(1)) {
+ isBypassedFlag = true;
+ }
+ }
+ }
+ else {
+ if (host === pattern) {
+ isBypassedFlag = true;
+ }
+ }
+ }
+ bypassedMap === null || bypassedMap === void 0 ? void 0 : bypassedMap.set(host, isBypassedFlag);
+ return isBypassedFlag;
+}
+function loadNoProxy() {
+ const noProxy = getEnvironmentValue(NO_PROXY);
+ noProxyListLoaded = true;
+ if (noProxy) {
+ return noProxy
+ .split(",")
+ .map((item) => item.trim())
+ .filter((item) => item.length);
+ }
+ return [];
+}
/**
* This method converts a proxy url into `ProxySettings` for use with ProxyPolicy.
* If no argument is given, it attempts to parse a proxy URL from the environment
@@ -77272,7 +80287,70 @@ exports.proxyPolicyName = policies_1.proxyPolicyName;
* @deprecated - Internally this method is no longer necessary when setting proxy information.
*/
function getDefaultProxySettings(proxyUrl) {
- return (0, policies_1.getDefaultProxySettings)(proxyUrl);
+ if (!proxyUrl) {
+ proxyUrl = loadEnvironmentProxyValue();
+ if (!proxyUrl) {
+ return undefined;
+ }
+ }
+ const parsedUrl = new URL(proxyUrl);
+ const schema = parsedUrl.protocol ? parsedUrl.protocol + "//" : "";
+ return {
+ host: schema + parsedUrl.hostname,
+ port: Number.parseInt(parsedUrl.port || "80"),
+ username: parsedUrl.username,
+ password: parsedUrl.password,
+ };
+}
+/**
+ * This method attempts to parse a proxy URL from the environment
+ * variables `HTTPS_PROXY` or `HTTP_PROXY`.
+ */
+function getDefaultProxySettingsInternal() {
+ const envProxy = loadEnvironmentProxyValue();
+ return envProxy ? new URL(envProxy) : undefined;
+}
+function getUrlFromProxySettings(settings) {
+ let parsedProxyUrl;
+ try {
+ parsedProxyUrl = new URL(settings.host);
+ }
+ catch (_a) {
+ throw new Error(`Expecting a valid host string in proxy settings, but found "${settings.host}".`);
+ }
+ parsedProxyUrl.port = String(settings.port);
+ if (settings.username) {
+ parsedProxyUrl.username = settings.username;
+ }
+ if (settings.password) {
+ parsedProxyUrl.password = settings.password;
+ }
+ return parsedProxyUrl;
+}
+function setProxyAgentOnRequest(request, cachedAgents, proxyUrl) {
+ // Custom Agent should take precedence so if one is present
+ // we should skip to avoid overwriting it.
+ if (request.agent) {
+ return;
+ }
+ const url = new URL(request.url);
+ const isInsecure = url.protocol !== "https:";
+ if (request.tlsSettings) {
+ log_js_1.logger.warning("TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored.");
+ }
+ const headers = request.headers.toJSON();
+ if (isInsecure) {
+ if (!cachedAgents.httpProxyAgent) {
+ cachedAgents.httpProxyAgent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl, { headers });
+ }
+ request.agent = cachedAgents.httpProxyAgent;
+ }
+ else {
+ if (!cachedAgents.httpsProxyAgent) {
+ cachedAgents.httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, { headers });
+ }
+ request.agent = cachedAgents.httpsProxyAgent;
+ }
}
/**
* A policy that allows one to apply proxy settings to all requests.
@@ -77282,14 +80360,35 @@ function getDefaultProxySettings(proxyUrl) {
* @param options - additional settings, for example, custom NO_PROXY patterns
*/
function proxyPolicy(proxySettings, options) {
- return (0, policies_1.proxyPolicy)(proxySettings, options);
+ if (!noProxyListLoaded) {
+ exports.globalNoProxyList.push(...loadNoProxy());
+ }
+ const defaultProxy = proxySettings
+ ? getUrlFromProxySettings(proxySettings)
+ : getDefaultProxySettingsInternal();
+ const cachedAgents = {};
+ return {
+ name: exports.proxyPolicyName,
+ async sendRequest(request, next) {
+ var _a;
+ if (!request.proxySettings &&
+ defaultProxy &&
+ !isBypassed(request.url, (_a = options === null || options === void 0 ? void 0 : options.customNoProxyList) !== null && _a !== void 0 ? _a : exports.globalNoProxyList, (options === null || options === void 0 ? void 0 : options.customNoProxyList) ? undefined : globalBypassedMap)) {
+ setProxyAgentOnRequest(request, cachedAgents, defaultProxy);
+ }
+ else if (request.proxySettings) {
+ setProxyAgentOnRequest(request, cachedAgents, getUrlFromProxySettings(request.proxySettings));
+ }
+ return next(request);
+ },
+ };
}
//# sourceMappingURL=proxyPolicy.js.map
/***/ }),
/***/ 4087:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+/***/ ((__unused_webpack_module, exports) => {
"use strict";
@@ -77298,11 +80397,14 @@ function proxyPolicy(proxySettings, options) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.redirectPolicyName = void 0;
exports.redirectPolicy = redirectPolicy;
-const policies_1 = __nccwpck_require__(4960);
/**
* The programmatic identifier of the redirectPolicy.
*/
-exports.redirectPolicyName = policies_1.redirectPolicyName;
+exports.redirectPolicyName = "redirectPolicy";
+/**
+ * Methods that are allowed to follow redirects 301 and 302
+ */
+const allowedRedirect = ["GET", "HEAD"];
/**
* A policy to follow Location headers from the server in order
* to support server-side redirection.
@@ -77310,7 +80412,39 @@ exports.redirectPolicyName = policies_1.redirectPolicyName;
* @param options - Options to control policy behavior.
*/
function redirectPolicy(options = {}) {
- return (0, policies_1.redirectPolicy)(options);
+ const { maxRetries = 20 } = options;
+ return {
+ name: exports.redirectPolicyName,
+ async sendRequest(request, next) {
+ const response = await next(request);
+ return handleRedirect(next, response, maxRetries);
+ },
+ };
+}
+async function handleRedirect(next, response, maxRetries, currentRetries = 0) {
+ const { request, status, headers } = response;
+ const locationHeader = headers.get("location");
+ if (locationHeader &&
+ (status === 300 ||
+ (status === 301 && allowedRedirect.includes(request.method)) ||
+ (status === 302 && allowedRedirect.includes(request.method)) ||
+ (status === 303 && request.method === "POST") ||
+ status === 307) &&
+ currentRetries < maxRetries) {
+ const url = new URL(locationHeader, request.url);
+ request.url = url.toString();
+ // POST request with Status code 303 should be converted into a
+ // redirected GET request if the redirect url is present in the location header
+ if (status === 303) {
+ request.method = "GET";
+ request.headers.delete("Content-Length");
+ delete request.body;
+ }
+ request.headers.delete("Authorization");
+ const res = await next(request);
+ return handleRedirect(next, res, maxRetries, currentRetries + 1);
+ }
+ return response;
}
//# sourceMappingURL=redirectPolicy.js.map
@@ -77325,18 +80459,108 @@ function redirectPolicy(options = {}) {
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.retryPolicy = retryPolicy;
+const helpers_js_1 = __nccwpck_require__(3034);
const logger_1 = __nccwpck_require__(6515);
+const abort_controller_1 = __nccwpck_require__(3287);
const constants_js_1 = __nccwpck_require__(6427);
-const policies_1 = __nccwpck_require__(4960);
const retryPolicyLogger = (0, logger_1.createClientLogger)("core-rest-pipeline retryPolicy");
+/**
+ * The programmatic identifier of the retryPolicy.
+ */
+const retryPolicyName = "retryPolicy";
/**
* retryPolicy is a generic policy to enable retrying requests when certain conditions are met
*/
function retryPolicy(strategies, options = { maxRetries: constants_js_1.DEFAULT_RETRY_POLICY_COUNT }) {
- // Cast is required since the TSP runtime retry strategy type is slightly different
- // very deep down (using real AbortSignal vs. AbortSignalLike in RestError).
- // In practice the difference doesn't actually matter.
- return (0, policies_1.retryPolicy)(strategies, Object.assign({ logger: retryPolicyLogger }, options));
+ const logger = options.logger || retryPolicyLogger;
+ return {
+ name: retryPolicyName,
+ async sendRequest(request, next) {
+ var _a, _b;
+ let response;
+ let responseError;
+ let retryCount = -1;
+ // eslint-disable-next-line no-constant-condition
+ retryRequest: while (true) {
+ retryCount += 1;
+ response = undefined;
+ responseError = undefined;
+ try {
+ logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);
+ response = await next(request);
+ logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);
+ }
+ catch (e) {
+ logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);
+ // RestErrors are valid targets for the retry strategies.
+ // If none of the retry strategies can work with them, they will be thrown later in this policy.
+ // If the received error is not a RestError, it is immediately thrown.
+ responseError = e;
+ if (!e || responseError.name !== "RestError") {
+ throw e;
+ }
+ response = responseError.response;
+ }
+ if ((_a = request.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
+ logger.error(`Retry ${retryCount}: Request aborted.`);
+ const abortError = new abort_controller_1.AbortError();
+ throw abortError;
+ }
+ if (retryCount >= ((_b = options.maxRetries) !== null && _b !== void 0 ? _b : constants_js_1.DEFAULT_RETRY_POLICY_COUNT)) {
+ logger.info(`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`);
+ if (responseError) {
+ throw responseError;
+ }
+ else if (response) {
+ return response;
+ }
+ else {
+ throw new Error("Maximum retries reached with no response or error to throw");
+ }
+ }
+ logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);
+ strategiesLoop: for (const strategy of strategies) {
+ const strategyLogger = strategy.logger || retryPolicyLogger;
+ strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);
+ const modifiers = strategy.retry({
+ retryCount,
+ response,
+ responseError,
+ });
+ if (modifiers.skipStrategy) {
+ strategyLogger.info(`Retry ${retryCount}: Skipped.`);
+ continue strategiesLoop;
+ }
+ const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;
+ if (errorToThrow) {
+ strategyLogger.error(`Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`, errorToThrow);
+ throw errorToThrow;
+ }
+ if (retryAfterInMs || retryAfterInMs === 0) {
+ strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`);
+ await (0, helpers_js_1.delay)(retryAfterInMs, undefined, { abortSignal: request.abortSignal });
+ continue retryRequest;
+ }
+ if (redirectTo) {
+ strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`);
+ request.url = redirectTo;
+ continue retryRequest;
+ }
+ }
+ if (responseError) {
+ logger.info(`None of the retry strategies could work with the received error. Throwing it.`);
+ throw responseError;
+ }
+ if (response) {
+ logger.info(`None of the retry strategies could work with the received response. Returning it.`);
+ return response;
+ }
+ // If all the retries skip and there's no response,
+ // we're still in the retry loop, so a new request will be sent
+ // until `maxRetries` is reached.
+ }
+ },
+ };
}
//# sourceMappingURL=retryPolicy.js.map
@@ -77387,11 +80611,13 @@ function setClientRequestIdPolicy(requestIdHeaderName = "x-ms-client-request-id"
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.systemErrorRetryPolicyName = void 0;
exports.systemErrorRetryPolicy = systemErrorRetryPolicy;
-const policies_1 = __nccwpck_require__(4960);
+const exponentialRetryStrategy_js_1 = __nccwpck_require__(2);
+const retryPolicy_js_1 = __nccwpck_require__(6085);
+const constants_js_1 = __nccwpck_require__(6427);
/**
* Name of the {@link systemErrorRetryPolicy}
*/
-exports.systemErrorRetryPolicyName = policies_1.systemErrorRetryPolicyName;
+exports.systemErrorRetryPolicyName = "systemErrorRetryPolicy";
/**
* A retry policy that specifically seeks to handle errors in the
* underlying transport layer (e.g. DNS lookup failures) rather than
@@ -77399,7 +80625,15 @@ exports.systemErrorRetryPolicyName = policies_1.systemErrorRetryPolicyName;
* @param options - Options that customize the policy.
*/
function systemErrorRetryPolicy(options = {}) {
- return (0, policies_1.systemErrorRetryPolicy)(options);
+ var _a;
+ return {
+ name: exports.systemErrorRetryPolicyName,
+ sendRequest: (0, retryPolicy_js_1.retryPolicy)([
+ (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)(Object.assign(Object.assign({}, options), { ignoreHttpStatusCodes: true })),
+ ], {
+ maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
+ }).sendRequest,
+ };
}
//# sourceMappingURL=systemErrorRetryPolicy.js.map
@@ -77415,30 +80649,38 @@ function systemErrorRetryPolicy(options = {}) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.throttlingRetryPolicyName = void 0;
exports.throttlingRetryPolicy = throttlingRetryPolicy;
-const policies_1 = __nccwpck_require__(4960);
+const throttlingRetryStrategy_js_1 = __nccwpck_require__(7084);
+const retryPolicy_js_1 = __nccwpck_require__(6085);
+const constants_js_1 = __nccwpck_require__(6427);
/**
* Name of the {@link throttlingRetryPolicy}
*/
-exports.throttlingRetryPolicyName = policies_1.throttlingRetryPolicyName;
+exports.throttlingRetryPolicyName = "throttlingRetryPolicy";
/**
* A policy that retries when the server sends a 429 response with a Retry-After header.
*
* To learn more, please refer to
- * https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,
- * https://learn.microsoft.com/en-us/azure/azure-subscription-service-limits and
- * https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors
+ * https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,
+ * https://docs.microsoft.com/en-us/azure/azure-subscription-service-limits and
+ * https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors
*
* @param options - Options that configure retry logic.
*/
function throttlingRetryPolicy(options = {}) {
- return (0, policies_1.throttlingRetryPolicy)(options);
+ var _a;
+ return {
+ name: exports.throttlingRetryPolicyName,
+ sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)()], {
+ maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
+ }).sendRequest,
+ };
}
//# sourceMappingURL=throttlingRetryPolicy.js.map
/***/ }),
/***/ 5798:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+/***/ ((__unused_webpack_module, exports) => {
"use strict";
@@ -77447,16 +80689,24 @@ function throttlingRetryPolicy(options = {}) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.tlsPolicyName = void 0;
exports.tlsPolicy = tlsPolicy;
-const policies_1 = __nccwpck_require__(4960);
/**
* Name of the TLS Policy
*/
-exports.tlsPolicyName = policies_1.tlsPolicyName;
+exports.tlsPolicyName = "tlsPolicy";
/**
* Gets a pipeline policy that adds the client certificate to the HttpClient agent for authentication.
*/
function tlsPolicy(tlsSettings) {
- return (0, policies_1.tlsPolicy)(tlsSettings);
+ return {
+ name: exports.tlsPolicyName,
+ sendRequest: async (req, next) => {
+ // Users may define a request tlsSettings, honor those over the client level one
+ if (!req.tlsSettings) {
+ req.tlsSettings = tlsSettings;
+ }
+ return next(req);
+ },
+ };
}
//# sourceMappingURL=tlsPolicy.js.map
@@ -77478,7 +80728,7 @@ const userAgent_js_1 = __nccwpck_require__(8431);
const log_js_1 = __nccwpck_require__(544);
const core_util_1 = __nccwpck_require__(7779);
const restError_js_1 = __nccwpck_require__(8666);
-const util_1 = __nccwpck_require__(5750);
+const sanitizer_js_1 = __nccwpck_require__(5204);
/**
* The programmatic identifier of the tracingPolicy.
*/
@@ -77491,7 +80741,7 @@ exports.tracingPolicyName = "tracingPolicy";
*/
function tracingPolicy(options = {}) {
const userAgentPromise = (0, userAgent_js_1.getUserAgentValue)(options.userAgentPrefix);
- const sanitizer = new util_1.Sanitizer({
+ const sanitizer = new sanitizer_js_1.Sanitizer({
additionalAllowedQueryParameters: options.additionalAllowedQueryParameters,
});
const tracingClient = tryCreateTracingClient();
@@ -77587,14 +80837,9 @@ function tryProcessResponse(span, response) {
if (serviceRequestId) {
span.setAttribute("serviceRequestId", serviceRequestId);
}
- // Per semantic conventions, only set the status to error if the status code is 4xx or 5xx.
- // Otherwise, the status MUST remain unset.
- // https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
- if (response.status >= 400) {
- span.setStatus({
- status: "error",
- });
- }
+ span.setStatus({
+ status: "success",
+ });
span.end();
}
catch (e) {
@@ -77642,47 +80887,6 @@ function userAgentPolicy(options = {}) {
/***/ }),
-/***/ 7466:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.wrapAbortSignalLikePolicyName = void 0;
-exports.wrapAbortSignalLikePolicy = wrapAbortSignalLikePolicy;
-const wrapAbortSignal_js_1 = __nccwpck_require__(1297);
-exports.wrapAbortSignalLikePolicyName = "wrapAbortSignalLikePolicy";
-/**
- * Policy that ensure that any AbortSignalLike is wrapped in a native AbortSignal for processing by the pipeline.
- * Since the ts-http-runtime expects a native AbortSignal, this policy is used to ensure that any AbortSignalLike is wrapped in a native AbortSignal.
- *
- * @returns - created policy
- */
-function wrapAbortSignalLikePolicy() {
- return {
- name: exports.wrapAbortSignalLikePolicyName,
- sendRequest: async (request, next) => {
- if (!request.abortSignal) {
- return next(request);
- }
- const { abortSignal, cleanup } = (0, wrapAbortSignal_js_1.wrapAbortSignalLike)(request.abortSignal);
- // eslint-disable-next-line no-param-reassign
- request.abortSignal = abortSignal;
- try {
- return await next(request);
- }
- finally {
- cleanup === null || cleanup === void 0 ? void 0 : cleanup();
- }
- },
- };
-}
-//# sourceMappingURL=wrapAbortSignalLikePolicy.js.map
-
-/***/ }),
-
/***/ 8666:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -77693,19 +80897,34 @@ function wrapAbortSignalLikePolicy() {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.RestError = void 0;
exports.isRestError = isRestError;
-const ts_http_runtime_1 = __nccwpck_require__(1958);
+const core_util_1 = __nccwpck_require__(7779);
+const inspect_js_1 = __nccwpck_require__(995);
+const sanitizer_js_1 = __nccwpck_require__(5204);
+const errorSanitizer = new sanitizer_js_1.Sanitizer();
/**
* A custom error type for failed pipeline requests.
*/
class RestError extends Error {
constructor(message, options = {}) {
super(message);
- // what is this??
- // it turns out that you can return from a constructor and it causes
- // calling `new` to return the value you return.
- // this lets us wrap the TypeSpec RestError so that calling this constructor will give you the same type of object as calling the TypeSpec one,
- // even though the constructor signatures (through RestErrorOptions) are slightly different.
- return new ts_http_runtime_1.RestError(message, options);
+ this.name = "RestError";
+ this.code = options.code;
+ this.statusCode = options.statusCode;
+ // The request and response may contain sensitive information in the headers or body.
+ // To help prevent this sensitive information being accidentally logged, the request and response
+ // properties are marked as non-enumerable here. This prevents them showing up in the output of
+ // JSON.stringify and console.log.
+ Object.defineProperty(this, "request", { value: options.request, enumerable: false });
+ Object.defineProperty(this, "response", { value: options.response, enumerable: false });
+ Object.setPrototypeOf(this, RestError.prototype);
+ }
+ /**
+ * Logging method for util.inspect in Node
+ */
+ [inspect_js_1.custom]() {
+ // Extract non-enumerable properties and add them back. This is OK since in this output the request and
+ // response get sanitized.
+ return `RestError: ${this.message} \n ${errorSanitizer.sanitize(Object.assign(Object.assign({}, this), { request: this.request, response: this.response }))}`;
}
}
exports.RestError = RestError;
@@ -77725,12 +80944,274 @@ RestError.PARSE_ERROR = "PARSE_ERROR";
* @param e - Something caught by a catch clause.
*/
function isRestError(e) {
- return (0, ts_http_runtime_1.isRestError)(e);
+ if (e instanceof RestError) {
+ return true;
+ }
+ return (0, core_util_1.isError)(e) && e.name === "RestError";
}
//# sourceMappingURL=restError.js.map
/***/ }),
+/***/ 2:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.exponentialRetryStrategy = exponentialRetryStrategy;
+exports.isExponentialRetryResponse = isExponentialRetryResponse;
+exports.isSystemError = isSystemError;
+const core_util_1 = __nccwpck_require__(7779);
+const throttlingRetryStrategy_js_1 = __nccwpck_require__(7084);
+// intervals are in milliseconds
+const DEFAULT_CLIENT_RETRY_INTERVAL = 1000;
+const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;
+/**
+ * A retry strategy that retries with an exponentially increasing delay in these two cases:
+ * - When there are errors in the underlying transport layer (e.g. DNS lookup failures).
+ * - Or otherwise if the outgoing request fails (408, greater or equal than 500, except for 501 and 505).
+ */
+function exponentialRetryStrategy(options = {}) {
+ var _a, _b;
+ const retryInterval = (_a = options.retryDelayInMs) !== null && _a !== void 0 ? _a : DEFAULT_CLIENT_RETRY_INTERVAL;
+ const maxRetryInterval = (_b = options.maxRetryDelayInMs) !== null && _b !== void 0 ? _b : DEFAULT_CLIENT_MAX_RETRY_INTERVAL;
+ return {
+ name: "exponentialRetryStrategy",
+ retry({ retryCount, response, responseError }) {
+ const matchedSystemError = isSystemError(responseError);
+ const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors;
+ const isExponential = isExponentialRetryResponse(response);
+ const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes;
+ const unknownResponse = response && ((0, throttlingRetryStrategy_js_1.isThrottlingRetryResponse)(response) || !isExponential);
+ if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) {
+ return { skipStrategy: true };
+ }
+ if (responseError && !matchedSystemError && !isExponential) {
+ return { errorToThrow: responseError };
+ }
+ return (0, core_util_1.calculateRetryDelay)(retryCount, {
+ retryDelayInMs: retryInterval,
+ maxRetryDelayInMs: maxRetryInterval,
+ });
+ },
+ };
+}
+/**
+ * A response is a retry response if it has status codes:
+ * - 408, or
+ * - Greater or equal than 500, except for 501 and 505.
+ */
+function isExponentialRetryResponse(response) {
+ return Boolean(response &&
+ response.status !== undefined &&
+ (response.status >= 500 || response.status === 408) &&
+ response.status !== 501 &&
+ response.status !== 505);
+}
+/**
+ * Determines whether an error from a pipeline response was triggered in the network layer.
+ */
+function isSystemError(err) {
+ if (!err) {
+ return false;
+ }
+ return (err.code === "ETIMEDOUT" ||
+ err.code === "ESOCKETTIMEDOUT" ||
+ err.code === "ECONNREFUSED" ||
+ err.code === "ECONNRESET" ||
+ err.code === "ENOENT" ||
+ err.code === "ENOTFOUND");
+}
+//# sourceMappingURL=exponentialRetryStrategy.js.map
+
+/***/ }),
+
+/***/ 7084:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.isThrottlingRetryResponse = isThrottlingRetryResponse;
+exports.throttlingRetryStrategy = throttlingRetryStrategy;
+const helpers_js_1 = __nccwpck_require__(3034);
+/**
+ * The header that comes back from Azure services representing
+ * the amount of time (minimum) to wait to retry (in seconds or timestamp after which we can retry).
+ */
+const RetryAfterHeader = "Retry-After";
+/**
+ * The headers that come back from Azure services representing
+ * the amount of time (minimum) to wait to retry.
+ *
+ * "retry-after-ms", "x-ms-retry-after-ms" : milliseconds
+ * "Retry-After" : seconds or timestamp
+ */
+const AllRetryAfterHeaders = ["retry-after-ms", "x-ms-retry-after-ms", RetryAfterHeader];
+/**
+ * A response is a throttling retry response if it has a throttling status code (429 or 503),
+ * as long as one of the [ "Retry-After" or "retry-after-ms" or "x-ms-retry-after-ms" ] headers has a valid value.
+ *
+ * Returns the `retryAfterInMs` value if the response is a throttling retry response.
+ * If not throttling retry response, returns `undefined`.
+ *
+ * @internal
+ */
+function getRetryAfterInMs(response) {
+ if (!(response && [429, 503].includes(response.status)))
+ return undefined;
+ try {
+ // Headers: "retry-after-ms", "x-ms-retry-after-ms", "Retry-After"
+ for (const header of AllRetryAfterHeaders) {
+ const retryAfterValue = (0, helpers_js_1.parseHeaderValueAsNumber)(response, header);
+ if (retryAfterValue === 0 || retryAfterValue) {
+ // "Retry-After" header ==> seconds
+ // "retry-after-ms", "x-ms-retry-after-ms" headers ==> milli-seconds
+ const multiplyingFactor = header === RetryAfterHeader ? 1000 : 1;
+ return retryAfterValue * multiplyingFactor; // in milli-seconds
+ }
+ }
+ // RetryAfterHeader ("Retry-After") has a special case where it might be formatted as a date instead of a number of seconds
+ const retryAfterHeader = response.headers.get(RetryAfterHeader);
+ if (!retryAfterHeader)
+ return;
+ const date = Date.parse(retryAfterHeader);
+ const diff = date - Date.now();
+ // negative diff would mean a date in the past, so retry asap with 0 milliseconds
+ return Number.isFinite(diff) ? Math.max(0, diff) : undefined;
+ }
+ catch (_a) {
+ return undefined;
+ }
+}
+/**
+ * A response is a retry response if it has a throttling status code (429 or 503),
+ * as long as one of the [ "Retry-After" or "retry-after-ms" or "x-ms-retry-after-ms" ] headers has a valid value.
+ */
+function isThrottlingRetryResponse(response) {
+ return Number.isFinite(getRetryAfterInMs(response));
+}
+function throttlingRetryStrategy() {
+ return {
+ name: "throttlingRetryStrategy",
+ retry({ response }) {
+ const retryAfterInMs = getRetryAfterInMs(response);
+ if (!Number.isFinite(retryAfterInMs)) {
+ return { skipStrategy: true };
+ }
+ return {
+ retryAfterInMs,
+ };
+ },
+ };
+}
+//# sourceMappingURL=throttlingRetryStrategy.js.map
+
+/***/ }),
+
+/***/ 2471:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.concat = concat;
+const tslib_1 = __nccwpck_require__(1860);
+const node_stream_1 = __nccwpck_require__(7075);
+const typeGuards_js_1 = __nccwpck_require__(2621);
+const file_js_1 = __nccwpck_require__(7073);
+function streamAsyncIterator() {
+ return tslib_1.__asyncGenerator(this, arguments, function* streamAsyncIterator_1() {
+ const reader = this.getReader();
+ try {
+ while (true) {
+ const { done, value } = yield tslib_1.__await(reader.read());
+ if (done) {
+ return yield tslib_1.__await(void 0);
+ }
+ yield yield tslib_1.__await(value);
+ }
+ }
+ finally {
+ reader.releaseLock();
+ }
+ });
+}
+function makeAsyncIterable(webStream) {
+ if (!webStream[Symbol.asyncIterator]) {
+ webStream[Symbol.asyncIterator] = streamAsyncIterator.bind(webStream);
+ }
+ if (!webStream.values) {
+ webStream.values = streamAsyncIterator.bind(webStream);
+ }
+}
+function ensureNodeStream(stream) {
+ if (stream instanceof ReadableStream) {
+ makeAsyncIterable(stream);
+ return node_stream_1.Readable.fromWeb(stream);
+ }
+ else {
+ return stream;
+ }
+}
+function toStream(source) {
+ if (source instanceof Uint8Array) {
+ return node_stream_1.Readable.from(Buffer.from(source));
+ }
+ else if ((0, typeGuards_js_1.isBlob)(source)) {
+ return toStream((0, file_js_1.getRawContent)(source));
+ }
+ else {
+ return ensureNodeStream(source);
+ }
+}
+/**
+ * Utility function that concatenates a set of binary inputs into one combined output.
+ *
+ * @param sources - array of sources for the concatenation
+ * @returns - in Node, a (() =\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.
+ * In browser, returns a `Blob` representing all the concatenated inputs.
+ *
+ * @internal
+ */
+async function concat(sources) {
+ return function () {
+ const streams = sources.map((x) => (typeof x === "function" ? x() : x)).map(toStream);
+ return node_stream_1.Readable.from((function () {
+ return tslib_1.__asyncGenerator(this, arguments, function* () {
+ var _a, e_1, _b, _c;
+ for (const stream of streams) {
+ try {
+ for (var _d = true, stream_1 = (e_1 = void 0, tslib_1.__asyncValues(stream)), stream_1_1; stream_1_1 = yield tslib_1.__await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
+ _c = stream_1_1.value;
+ _d = false;
+ const chunk = _c;
+ yield yield tslib_1.__await(chunk);
+ }
+ }
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
+ finally {
+ try {
+ if (!_d && !_a && (_b = stream_1.return)) yield tslib_1.__await(_b.call(stream_1));
+ }
+ finally { if (e_1) throw e_1.error; }
+ }
+ }
+ });
+ })());
+ };
+}
+//# sourceMappingURL=concat.js.map
+
+/***/ }),
+
/***/ 7073:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -77739,21 +81220,15 @@ function isRestError(e) {
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.hasRawContent = hasRawContent;
exports.getRawContent = getRawContent;
exports.createFileFromStream = createFileFromStream;
exports.createFile = createFile;
const core_util_1 = __nccwpck_require__(7779);
-function isNodeReadableStream(x) {
- return Boolean(x && typeof x["pipe"] === "function");
-}
+const typeGuards_js_1 = __nccwpck_require__(2621);
const unimplementedMethods = {
arrayBuffer: () => {
throw new Error("Not implemented");
},
- bytes: () => {
- throw new Error("Not implemented");
- },
slice: () => {
throw new Error("Not implemented");
},
@@ -77776,16 +81251,13 @@ const unimplementedMethods = {
* @internal
*/
const rawContent = Symbol("rawContent");
-/**
- * Type guard to check if a given object is a blob-like object with a raw content property.
- */
function hasRawContent(x) {
return typeof x[rawContent] === "function";
}
/**
* Extract the raw content from a given blob-like object. If the input was created using createFile
* or createFileFromStream, the exact content passed into createFile/createFileFromStream will be used.
- * For true instances of Blob and File, returns the actual blob.
+ * For true instances of Blob and File, returns the blob's content as a Web ReadableStream.
*
* @internal
*/
@@ -77794,7 +81266,7 @@ function getRawContent(blob) {
return blob[rawContent]();
}
else {
- return blob;
+ return blob.stream();
}
}
/**
@@ -77818,7 +81290,7 @@ function createFileFromStream(stream, name, options = {}) {
var _a, _b, _c, _d;
return Object.assign(Object.assign({}, unimplementedMethods), { type: (_a = options.type) !== null && _a !== void 0 ? _a : "", lastModified: (_b = options.lastModified) !== null && _b !== void 0 ? _b : new Date().getTime(), webkitRelativePath: (_c = options.webkitRelativePath) !== null && _c !== void 0 ? _c : "", size: (_d = options.size) !== null && _d !== void 0 ? _d : -1, name, stream: () => {
const s = stream();
- if (isNodeReadableStream(s)) {
+ if ((0, typeGuards_js_1.isNodeReadableStream)(s)) {
throw new Error("Not supported: a Node stream was provided as input to createFileFromStream.");
}
return s;
@@ -77848,6 +81320,240 @@ function createFile(content, name, options = {}) {
/***/ }),
+/***/ 3034:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.delay = delay;
+exports.parseHeaderValueAsNumber = parseHeaderValueAsNumber;
+const abort_controller_1 = __nccwpck_require__(3287);
+const StandardAbortMessage = "The operation was aborted.";
+/**
+ * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds.
+ * @param delayInMs - The number of milliseconds to be delayed.
+ * @param value - The value to be resolved with after a timeout of t milliseconds.
+ * @param options - The options for delay - currently abort options
+ * - abortSignal - The abortSignal associated with containing operation.
+ * - abortErrorMsg - The abort error message associated with containing operation.
+ * @returns Resolved promise
+ */
+function delay(delayInMs, value, options) {
+ return new Promise((resolve, reject) => {
+ let timer = undefined;
+ let onAborted = undefined;
+ const rejectOnAbort = () => {
+ return reject(new abort_controller_1.AbortError((options === null || options === void 0 ? void 0 : options.abortErrorMsg) ? options === null || options === void 0 ? void 0 : options.abortErrorMsg : StandardAbortMessage));
+ };
+ const removeListeners = () => {
+ if ((options === null || options === void 0 ? void 0 : options.abortSignal) && onAborted) {
+ options.abortSignal.removeEventListener("abort", onAborted);
+ }
+ };
+ onAborted = () => {
+ if (timer) {
+ clearTimeout(timer);
+ }
+ removeListeners();
+ return rejectOnAbort();
+ };
+ if ((options === null || options === void 0 ? void 0 : options.abortSignal) && options.abortSignal.aborted) {
+ return rejectOnAbort();
+ }
+ timer = setTimeout(() => {
+ removeListeners();
+ resolve(value);
+ }, delayInMs);
+ if (options === null || options === void 0 ? void 0 : options.abortSignal) {
+ options.abortSignal.addEventListener("abort", onAborted);
+ }
+ });
+}
+/**
+ * @internal
+ * @returns the parsed value or undefined if the parsed value is invalid.
+ */
+function parseHeaderValueAsNumber(response, headerName) {
+ const value = response.headers.get(headerName);
+ if (!value)
+ return;
+ const valueAsNum = Number(value);
+ if (Number.isNaN(valueAsNum))
+ return;
+ return valueAsNum;
+}
+//# sourceMappingURL=helpers.js.map
+
+/***/ }),
+
+/***/ 995:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.custom = void 0;
+const node_util_1 = __nccwpck_require__(7975);
+exports.custom = node_util_1.inspect.custom;
+//# sourceMappingURL=inspect.js.map
+
+/***/ }),
+
+/***/ 5204:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.Sanitizer = void 0;
+const core_util_1 = __nccwpck_require__(7779);
+const RedactedString = "REDACTED";
+// Make sure this list is up-to-date with the one under core/logger/Readme#Keyconcepts
+const defaultAllowedHeaderNames = [
+ "x-ms-client-request-id",
+ "x-ms-return-client-request-id",
+ "x-ms-useragent",
+ "x-ms-correlation-request-id",
+ "x-ms-request-id",
+ "client-request-id",
+ "ms-cv",
+ "return-client-request-id",
+ "traceparent",
+ "Access-Control-Allow-Credentials",
+ "Access-Control-Allow-Headers",
+ "Access-Control-Allow-Methods",
+ "Access-Control-Allow-Origin",
+ "Access-Control-Expose-Headers",
+ "Access-Control-Max-Age",
+ "Access-Control-Request-Headers",
+ "Access-Control-Request-Method",
+ "Origin",
+ "Accept",
+ "Accept-Encoding",
+ "Cache-Control",
+ "Connection",
+ "Content-Length",
+ "Content-Type",
+ "Date",
+ "ETag",
+ "Expires",
+ "If-Match",
+ "If-Modified-Since",
+ "If-None-Match",
+ "If-Unmodified-Since",
+ "Last-Modified",
+ "Pragma",
+ "Request-Id",
+ "Retry-After",
+ "Server",
+ "Transfer-Encoding",
+ "User-Agent",
+ "WWW-Authenticate",
+];
+const defaultAllowedQueryParameters = ["api-version"];
+/**
+ * @internal
+ */
+class Sanitizer {
+ constructor({ additionalAllowedHeaderNames: allowedHeaderNames = [], additionalAllowedQueryParameters: allowedQueryParameters = [], } = {}) {
+ allowedHeaderNames = defaultAllowedHeaderNames.concat(allowedHeaderNames);
+ allowedQueryParameters = defaultAllowedQueryParameters.concat(allowedQueryParameters);
+ this.allowedHeaderNames = new Set(allowedHeaderNames.map((n) => n.toLowerCase()));
+ this.allowedQueryParameters = new Set(allowedQueryParameters.map((p) => p.toLowerCase()));
+ }
+ sanitize(obj) {
+ const seen = new Set();
+ return JSON.stringify(obj, (key, value) => {
+ // Ensure Errors include their interesting non-enumerable members
+ if (value instanceof Error) {
+ return Object.assign(Object.assign({}, value), { name: value.name, message: value.message });
+ }
+ if (key === "headers") {
+ return this.sanitizeHeaders(value);
+ }
+ else if (key === "url") {
+ return this.sanitizeUrl(value);
+ }
+ else if (key === "query") {
+ return this.sanitizeQuery(value);
+ }
+ else if (key === "body") {
+ // Don't log the request body
+ return undefined;
+ }
+ else if (key === "response") {
+ // Don't log response again
+ return undefined;
+ }
+ else if (key === "operationSpec") {
+ // When using sendOperationRequest, the request carries a massive
+ // field with the autorest spec. No need to log it.
+ return undefined;
+ }
+ else if (Array.isArray(value) || (0, core_util_1.isObject)(value)) {
+ if (seen.has(value)) {
+ return "[Circular]";
+ }
+ seen.add(value);
+ }
+ return value;
+ }, 2);
+ }
+ sanitizeUrl(value) {
+ if (typeof value !== "string" || value === null || value === "") {
+ return value;
+ }
+ const url = new URL(value);
+ if (!url.search) {
+ return value;
+ }
+ for (const [key] of url.searchParams) {
+ if (!this.allowedQueryParameters.has(key.toLowerCase())) {
+ url.searchParams.set(key, RedactedString);
+ }
+ }
+ return url.toString();
+ }
+ sanitizeHeaders(obj) {
+ const sanitized = {};
+ for (const key of Object.keys(obj)) {
+ if (this.allowedHeaderNames.has(key.toLowerCase())) {
+ sanitized[key] = obj[key];
+ }
+ else {
+ sanitized[key] = RedactedString;
+ }
+ }
+ return sanitized;
+ }
+ sanitizeQuery(value) {
+ if (typeof value !== "object" || value === null) {
+ return value;
+ }
+ const sanitized = {};
+ for (const k of Object.keys(value)) {
+ if (this.allowedQueryParameters.has(k.toLowerCase())) {
+ sanitized[k] = value[k];
+ }
+ else {
+ sanitized[k] = RedactedString;
+ }
+ }
+ return sanitized;
+ }
+}
+exports.Sanitizer = Sanitizer;
+//# sourceMappingURL=sanitizer.js.map
+
+/***/ }),
+
/***/ 9202:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -77858,7 +81564,7 @@ function createFile(content, name, options = {}) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DEFAULT_CYCLER_OPTIONS = void 0;
exports.createTokenCycler = createTokenCycler;
-const core_util_1 = __nccwpck_require__(7779);
+const helpers_js_1 = __nccwpck_require__(3034);
// Default options for the cycler if none are provided
exports.DEFAULT_CYCLER_OPTIONS = {
forcedRefreshWindowInMs: 1000, // Force waiting for a refresh 1s before the token expires
@@ -77898,7 +81604,7 @@ async function beginRefresh(getAccessToken, retryIntervalInMs, refreshTimeout) {
}
let token = await tryGetAccessToken();
while (token === null) {
- await (0, core_util_1.delay)(retryIntervalInMs);
+ await (0, helpers_js_1.delay)(retryIntervalInMs);
token = await tryGetAccessToken();
}
return token;
@@ -78021,6 +81727,36 @@ function createTokenCycler(credential, tokenCyclerOptions) {
/***/ }),
+/***/ 2621:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.isNodeReadableStream = isNodeReadableStream;
+exports.isWebReadableStream = isWebReadableStream;
+exports.isReadableStream = isReadableStream;
+exports.isBlob = isBlob;
+function isNodeReadableStream(x) {
+ return Boolean(x && typeof x["pipe"] === "function");
+}
+function isWebReadableStream(x) {
+ return Boolean(x &&
+ typeof x.getReader === "function" &&
+ typeof x.tee === "function");
+}
+function isReadableStream(x) {
+ return isNodeReadableStream(x) || isWebReadableStream(x);
+}
+function isBlob(x) {
+ return typeof x.stream === "function";
+}
+//# sourceMappingURL=typeGuards.js.map
+
+/***/ }),
+
/***/ 8431:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -78103,44 +81839,56 @@ async function setPlatformSpecificData(map) {
/***/ }),
-/***/ 1297:
+/***/ 5455:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.wrapAbortSignalLike = wrapAbortSignalLike;
+exports.AbortError = void 0;
/**
- * Creates a native AbortSignal which reflects the state of the provided AbortSignalLike.
- * If the AbortSignalLike is already a native AbortSignal, it is returned as is.
- * @param abortSignalLike - The AbortSignalLike to wrap.
- * @returns - An object containing the native AbortSignal and an optional cleanup function. The cleanup function should be called when the AbortSignal is no longer needed.
+ * This error is thrown when an asynchronous operation has been aborted.
+ * Check for this error by testing the `name` that the name property of the
+ * error matches `"AbortError"`.
+ *
+ * @example
+ * ```ts
+ * const controller = new AbortController();
+ * controller.abort();
+ * try {
+ * doAsyncWork(controller.signal)
+ * } catch (e) {
+ * if (e.name === 'AbortError') {
+ * // handle abort error here.
+ * }
+ * }
+ * ```
*/
-function wrapAbortSignalLike(abortSignalLike) {
- if (abortSignalLike instanceof AbortSignal) {
- return { abortSignal: abortSignalLike };
+class AbortError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = "AbortError";
}
- if (abortSignalLike.aborted) {
- return { abortSignal: AbortSignal.abort(abortSignalLike.reason) };
- }
- const controller = new AbortController();
- let needsCleanup = true;
- function cleanup() {
- if (needsCleanup) {
- abortSignalLike.removeEventListener("abort", listener);
- needsCleanup = false;
- }
- }
- function listener() {
- controller.abort(abortSignalLike.reason);
- cleanup();
- }
- abortSignalLike.addEventListener("abort", listener);
- return { abortSignal: controller.signal, cleanup };
}
-//# sourceMappingURL=wrapAbortSignal.js.map
+exports.AbortError = AbortError;
+//# sourceMappingURL=AbortError.js.map
+
+/***/ }),
+
+/***/ 3287:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.AbortError = void 0;
+var AbortError_js_1 = __nccwpck_require__(5455);
+Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } }));
+//# sourceMappingURL=index.js.map
/***/ }),
@@ -78432,6 +82180,95 @@ async function cancelablePromiseRace(abortablePromiseBuilders, options) {
/***/ }),
+/***/ 2741:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.uint8ArrayToString = uint8ArrayToString;
+exports.stringToUint8Array = stringToUint8Array;
+/**
+ * The helper that transforms bytes with specific character encoding into string
+ * @param bytes - the uint8array bytes
+ * @param format - the format we use to encode the byte
+ * @returns a string of the encoded string
+ */
+function uint8ArrayToString(bytes, format) {
+ return Buffer.from(bytes).toString(format);
+}
+/**
+ * The helper that transforms string to specific character encoded bytes array.
+ * @param value - the string to be converted
+ * @param format - the format we use to decode the value
+ * @returns a uint8array
+ */
+function stringToUint8Array(value, format) {
+ return Buffer.from(value, format);
+}
+//# sourceMappingURL=bytesEncoding.js.map
+
+/***/ }),
+
+/***/ 8162:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var _a, _b, _c, _d;
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.isReactNative = exports.isNodeRuntime = exports.isNode = exports.isNodeLike = exports.isBun = exports.isDeno = exports.isWebWorker = exports.isBrowser = void 0;
+/**
+ * A constant that indicates whether the environment the code is running is a Web Browser.
+ */
+// eslint-disable-next-line @azure/azure-sdk/ts-no-window
+exports.isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
+/**
+ * A constant that indicates whether the environment the code is running is a Web Worker.
+ */
+exports.isWebWorker = typeof self === "object" &&
+ typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
+ (((_a = self.constructor) === null || _a === void 0 ? void 0 : _a.name) === "DedicatedWorkerGlobalScope" ||
+ ((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" ||
+ ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope");
+/**
+ * A constant that indicates whether the environment the code is running is Deno.
+ */
+exports.isDeno = typeof Deno !== "undefined" &&
+ typeof Deno.version !== "undefined" &&
+ typeof Deno.version.deno !== "undefined";
+/**
+ * A constant that indicates whether the environment the code is running is Bun.sh.
+ */
+exports.isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
+/**
+ * A constant that indicates whether the environment the code is running is a Node.js compatible environment.
+ */
+exports.isNodeLike = typeof globalThis.process !== "undefined" &&
+ Boolean(globalThis.process.version) &&
+ Boolean((_d = globalThis.process.versions) === null || _d === void 0 ? void 0 : _d.node);
+/**
+ * A constant that indicates whether the environment the code is running is a Node.js compatible environment.
+ * @deprecated Use `isNodeLike` instead.
+ */
+exports.isNode = exports.isNodeLike;
+/**
+ * A constant that indicates whether the environment the code is running is Node.JS.
+ */
+exports.isNodeRuntime = exports.isNodeLike && !exports.isBun && !exports.isDeno;
+/**
+ * A constant that indicates whether the environment the code is running is in React-Native.
+ */
+// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
+exports.isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
+//# sourceMappingURL=checkEnvironment.js.map
+
+/***/ }),
+
/***/ 3128:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -78441,7 +82278,7 @@ async function cancelablePromiseRace(abortablePromiseBuilders, options) {
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createAbortablePromise = createAbortablePromise;
-const abort_controller_1 = __nccwpck_require__(3134);
+const abort_controller_1 = __nccwpck_require__(6492);
/**
* Creates an abortable promise.
* @param buildPromise - A function that takes the resolve and reject functions as parameters.
@@ -78495,7 +82332,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.delay = delay;
exports.calculateRetryDelay = calculateRetryDelay;
const createAbortablePromise_js_1 = __nccwpck_require__(3128);
-const util_1 = __nccwpck_require__(5750);
+const random_js_1 = __nccwpck_require__(4196);
const StandardAbortMessage = "The delay was aborted.";
/**
* A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
@@ -78527,7 +82364,7 @@ function calculateRetryDelay(retryAttempt, config) {
const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);
// Allow the final value to have some "jitter" (within 50% of the delay size) so
// that retries across multiple clients don't occur simultaneously.
- const retryAfterInMs = clampedDelay / 2 + (0, util_1.getRandomIntegerInclusive)(0, clampedDelay / 2);
+ const retryAfterInMs = clampedDelay / 2 + (0, random_js_1.getRandomIntegerInclusive)(0, clampedDelay / 2);
return { retryAfterInMs };
}
//# sourceMappingURL=delay.js.map
@@ -78542,8 +82379,21 @@ function calculateRetryDelay(retryAttempt, config) {
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.isError = isError;
exports.getErrorMessage = getErrorMessage;
-const util_1 = __nccwpck_require__(5750);
+const object_js_1 = __nccwpck_require__(7756);
+/**
+ * Typeguard for an error object shape (has name and message)
+ * @param e - Something caught by a catch clause.
+ */
+function isError(e) {
+ if ((0, object_js_1.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.
@@ -78551,7 +82401,7 @@ const util_1 = __nccwpck_require__(5750);
* @returns The error message or a string of the input
*/
function getErrorMessage(e) {
- if ((0, util_1.isError)(e)) {
+ if (isError(e)) {
return e.message;
}
else {
@@ -78582,153 +82432,131 @@ function getErrorMessage(e) {
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.isWebWorker = exports.isReactNative = exports.isNodeRuntime = exports.isNodeLike = exports.isNode = exports.isDeno = exports.isBun = exports.isBrowser = exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = exports.getErrorMessage = exports.delay = exports.createAbortablePromise = exports.cancelablePromiseRace = void 0;
-exports.calculateRetryDelay = calculateRetryDelay;
-exports.computeSha256Hash = computeSha256Hash;
-exports.computeSha256Hmac = computeSha256Hmac;
-exports.getRandomIntegerInclusive = getRandomIntegerInclusive;
-exports.isError = isError;
-exports.isObject = isObject;
-exports.randomUUID = randomUUID;
-exports.uint8ArrayToString = uint8ArrayToString;
-exports.stringToUint8Array = stringToUint8Array;
-const tslib_1 = __nccwpck_require__(1860);
-const tspRuntime = tslib_1.__importStar(__nccwpck_require__(5750));
+exports.stringToUint8Array = exports.uint8ArrayToString = exports.isWebWorker = exports.isReactNative = exports.isDeno = exports.isNodeRuntime = exports.isNodeLike = exports.isNode = exports.isBun = exports.isBrowser = exports.randomUUID = exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = exports.computeSha256Hmac = exports.computeSha256Hash = exports.getErrorMessage = exports.isError = exports.isObject = exports.getRandomIntegerInclusive = exports.createAbortablePromise = exports.cancelablePromiseRace = exports.calculateRetryDelay = exports.delay = void 0;
+var delay_js_1 = __nccwpck_require__(636);
+Object.defineProperty(exports, "delay", ({ enumerable: true, get: function () { return delay_js_1.delay; } }));
+Object.defineProperty(exports, "calculateRetryDelay", ({ enumerable: true, get: function () { return delay_js_1.calculateRetryDelay; } }));
var aborterUtils_js_1 = __nccwpck_require__(5209);
Object.defineProperty(exports, "cancelablePromiseRace", ({ enumerable: true, get: function () { return aborterUtils_js_1.cancelablePromiseRace; } }));
var createAbortablePromise_js_1 = __nccwpck_require__(3128);
Object.defineProperty(exports, "createAbortablePromise", ({ enumerable: true, get: function () { return createAbortablePromise_js_1.createAbortablePromise; } }));
-var delay_js_1 = __nccwpck_require__(636);
-Object.defineProperty(exports, "delay", ({ enumerable: true, get: function () { return delay_js_1.delay; } }));
+var random_js_1 = __nccwpck_require__(4196);
+Object.defineProperty(exports, "getRandomIntegerInclusive", ({ enumerable: true, get: function () { return random_js_1.getRandomIntegerInclusive; } }));
+var object_js_1 = __nccwpck_require__(7756);
+Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return object_js_1.isObject; } }));
var error_js_1 = __nccwpck_require__(9945);
+Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return error_js_1.isError; } }));
Object.defineProperty(exports, "getErrorMessage", ({ enumerable: true, get: function () { return error_js_1.getErrorMessage; } }));
+var sha256_js_1 = __nccwpck_require__(9732);
+Object.defineProperty(exports, "computeSha256Hash", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hash; } }));
+Object.defineProperty(exports, "computeSha256Hmac", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hmac; } }));
var typeGuards_js_1 = __nccwpck_require__(6277);
Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typeGuards_js_1.isDefined; } }));
Object.defineProperty(exports, "isObjectWithProperties", ({ enumerable: true, get: function () { return typeGuards_js_1.isObjectWithProperties; } }));
Object.defineProperty(exports, "objectHasProperty", ({ enumerable: true, get: function () { return typeGuards_js_1.objectHasProperty; } }));
-/**
- * Calculates the delay interval for retry attempts using exponential delay with jitter.
- *
- * @param retryAttempt - The current retry attempt number.
- *
- * @param config - The exponential retry configuration.
- *
- * @returns An object containing the calculated retry delay.
- */
-function calculateRetryDelay(retryAttempt, config) {
- return tspRuntime.calculateRetryDelay(retryAttempt, config);
-}
-/**
- * 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.
- */
-function computeSha256Hash(content, encoding) {
- return tspRuntime.computeSha256Hash(content, encoding);
-}
-/**
- * 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.
- */
-function computeSha256Hmac(key, stringToSign, encoding) {
- return tspRuntime.computeSha256Hmac(key, stringToSign, encoding);
-}
-/**
- * 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) {
- return tspRuntime.getRandomIntegerInclusive(min, max);
-}
-/**
- * Typeguard for an error object shape (has name and message)
- *
- * @param e - Something caught by a catch clause.
- */
-function isError(e) {
- return tspRuntime.isError(e);
-}
+var uuidUtils_js_1 = __nccwpck_require__(8795);
+Object.defineProperty(exports, "randomUUID", ({ enumerable: true, get: function () { return uuidUtils_js_1.randomUUID; } }));
+var checkEnvironment_js_1 = __nccwpck_require__(8162);
+Object.defineProperty(exports, "isBrowser", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBrowser; } }));
+Object.defineProperty(exports, "isBun", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBun; } }));
+Object.defineProperty(exports, "isNode", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNode; } }));
+Object.defineProperty(exports, "isNodeLike", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNodeLike; } }));
+Object.defineProperty(exports, "isNodeRuntime", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNodeRuntime; } }));
+Object.defineProperty(exports, "isDeno", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isDeno; } }));
+Object.defineProperty(exports, "isReactNative", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isReactNative; } }));
+Object.defineProperty(exports, "isWebWorker", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isWebWorker; } }));
+var bytesEncoding_js_1 = __nccwpck_require__(2741);
+Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } }));
+Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } }));
+//# sourceMappingURL=index.js.map
+
+/***/ }),
+
+/***/ 7756:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.isObject = isObject;
/**
* 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 tspRuntime.isObject(input);
+ return (typeof input === "object" &&
+ input !== null &&
+ !Array.isArray(input) &&
+ !(input instanceof RegExp) &&
+ !(input instanceof Date));
+}
+//# sourceMappingURL=object.js.map
+
+/***/ }),
+
+/***/ 4196:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.getRandomIntegerInclusive = getRandomIntegerInclusive;
+/**
+ * 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;
+}
+//# sourceMappingURL=random.js.map
+
+/***/ }),
+
+/***/ 9732:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.computeSha256Hmac = computeSha256Hmac;
+exports.computeSha256Hash = computeSha256Hash;
+const crypto_1 = __nccwpck_require__(6982);
+/**
+ * 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 (0, crypto_1.createHmac)("sha256", decodedKey).update(stringToSign).digest(encoding);
}
/**
- * Generated Universally Unique Identifier
- *
- * @returns RFC4122 v4 UUID.
+ * 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.
*/
-function randomUUID() {
- return tspRuntime.randomUUID();
+async function computeSha256Hash(content, encoding) {
+ return (0, crypto_1.createHash)("sha256").update(content).digest(encoding);
}
-/**
- * A constant that indicates whether the environment the code is running is a Web Browser.
- */
-exports.isBrowser = tspRuntime.isBrowser;
-/**
- * A constant that indicates whether the environment the code is running is Bun.sh.
- */
-exports.isBun = tspRuntime.isBun;
-/**
- * A constant that indicates whether the environment the code is running is Deno.
- */
-exports.isDeno = tspRuntime.isDeno;
-/**
- * A constant that indicates whether the environment the code is running is a Node.js compatible environment.
- *
- * @deprecated
- *
- * Use `isNodeLike` instead.
- */
-exports.isNode = tspRuntime.isNodeLike;
-/**
- * A constant that indicates whether the environment the code is running is a Node.js compatible environment.
- */
-exports.isNodeLike = tspRuntime.isNodeLike;
-/**
- * A constant that indicates whether the environment the code is running is Node.JS.
- */
-exports.isNodeRuntime = tspRuntime.isNodeRuntime;
-/**
- * A constant that indicates whether the environment the code is running is in React-Native.
- */
-exports.isReactNative = tspRuntime.isReactNative;
-/**
- * A constant that indicates whether the environment the code is running is a Web Worker.
- */
-exports.isWebWorker = tspRuntime.isWebWorker;
-/**
- * The helper that transforms bytes with specific character encoding into string
- * @param bytes - the uint8array bytes
- * @param format - the format we use to encode the byte
- * @returns a string of the encoded string
- */
-function uint8ArrayToString(bytes, format) {
- return tspRuntime.uint8ArrayToString(bytes, format);
-}
-/**
- * The helper that transforms string to specific character encoded bytes array.
- * @param value - the string to be converted
- * @param format - the format we use to decode the value
- * @returns a uint8array
- */
-function stringToUint8Array(value, format) {
- return tspRuntime.stringToUint8Array(value, format);
-}
-//# sourceMappingURL=index.js.map
+//# sourceMappingURL=sha256.js.map
/***/ }),
@@ -78778,6 +82606,86 @@ function objectHasProperty(thing, property) {
/***/ }),
+/***/ 8795:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var _a;
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.randomUUID = randomUUID;
+const crypto_1 = __nccwpck_require__(6982);
+// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+.
+const uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function"
+ ? globalThis.crypto.randomUUID.bind(globalThis.crypto)
+ : crypto_1.randomUUID;
+/**
+ * Generated Universally Unique Identifier
+ *
+ * @returns RFC4122 v4 UUID.
+ */
+function randomUUID() {
+ return uuidFunction();
+}
+//# sourceMappingURL=uuidUtils.js.map
+
+/***/ }),
+
+/***/ 1658:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.AbortError = void 0;
+/**
+ * This error is thrown when an asynchronous operation has been aborted.
+ * Check for this error by testing the `name` that the name property of the
+ * error matches `"AbortError"`.
+ *
+ * @example
+ * ```ts
+ * const controller = new AbortController();
+ * controller.abort();
+ * try {
+ * doAsyncWork(controller.signal)
+ * } catch (e) {
+ * if (e.name === 'AbortError') {
+ * // handle abort error here.
+ * }
+ * }
+ * ```
+ */
+class AbortError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = "AbortError";
+ }
+}
+exports.AbortError = AbortError;
+//# sourceMappingURL=AbortError.js.map
+
+/***/ }),
+
+/***/ 6492:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.AbortError = void 0;
+var AbortError_js_1 = __nccwpck_require__(1658);
+Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } }));
+//# sourceMappingURL=index.js.map
+
+/***/ }),
+
/***/ 6375:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
@@ -78828,7 +82736,7 @@ exports.XML_CHARKEY = "_";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.stringifyXML = stringifyXML;
exports.parseXML = parseXML;
-const fast_xml_parser_1 = __nccwpck_require__(591);
+const fast_xml_parser_1 = __nccwpck_require__(9741);
const xml_common_js_1 = __nccwpck_require__(3406);
function getCommonOptions(options) {
var _a;
@@ -78844,7 +82752,7 @@ function getSerializerOptions(options = {}) {
return Object.assign(Object.assign({}, getCommonOptions(options)), { attributeNamePrefix: "@_", format: true, suppressEmptyNode: true, indentBy: "", rootNodeName: (_a = options.rootName) !== null && _a !== void 0 ? _a : "root", cdataPropName: (_b = options.cdataPropName) !== null && _b !== void 0 ? _b : "__cdata" });
}
function getParserOptions(options = {}) {
- return Object.assign(Object.assign({}, getCommonOptions(options)), { parseAttributeValue: false, parseTagValue: false, attributeNamePrefix: "", stopNodes: options.stopNodes, processEntities: true, trimValues: false });
+ return Object.assign(Object.assign({}, getCommonOptions(options)), { parseAttributeValue: false, parseTagValue: false, attributeNamePrefix: "", stopNodes: options.stopNodes, processEntities: true });
}
/**
* Converts given JSON object to XML string
@@ -78892,29 +82800,144 @@ async function parseXML(str, opts = {}) {
/***/ }),
+/***/ 1676:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+const log_js_1 = __nccwpck_require__(6757);
+const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined;
+let enabledString;
+let enabledNamespaces = [];
+let skippedNamespaces = [];
+const debuggers = [];
+if (debugEnvVariable) {
+ enable(debugEnvVariable);
+}
+const debugObj = Object.assign((namespace) => {
+ return createDebugger(namespace);
+}, {
+ enable,
+ enabled,
+ disable,
+ log: log_js_1.log,
+});
+function enable(namespaces) {
+ enabledString = namespaces;
+ enabledNamespaces = [];
+ skippedNamespaces = [];
+ const wildcard = /\*/g;
+ const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?"));
+ for (const ns of namespaceList) {
+ if (ns.startsWith("-")) {
+ skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`));
+ }
+ else {
+ enabledNamespaces.push(new RegExp(`^${ns}$`));
+ }
+ }
+ for (const instance of debuggers) {
+ instance.enabled = enabled(instance.namespace);
+ }
+}
+function enabled(namespace) {
+ if (namespace.endsWith("*")) {
+ return true;
+ }
+ for (const skipped of skippedNamespaces) {
+ if (skipped.test(namespace)) {
+ return false;
+ }
+ }
+ for (const enabledNamespace of enabledNamespaces) {
+ if (enabledNamespace.test(namespace)) {
+ return true;
+ }
+ }
+ return false;
+}
+function disable() {
+ const result = enabledString || "";
+ enable("");
+ return result;
+}
+function createDebugger(namespace) {
+ const newDebugger = Object.assign(debug, {
+ enabled: enabled(namespace),
+ destroy,
+ log: debugObj.log,
+ namespace,
+ extend,
+ });
+ function debug(...args) {
+ if (!newDebugger.enabled) {
+ return;
+ }
+ if (args.length > 0) {
+ args[0] = `${namespace} ${args[0]}`;
+ }
+ newDebugger.log(...args);
+ }
+ debuggers.push(newDebugger);
+ return newDebugger;
+}
+function destroy() {
+ const index = debuggers.indexOf(this);
+ if (index >= 0) {
+ debuggers.splice(index, 1);
+ return true;
+ }
+ return false;
+}
+function extend(namespace) {
+ const newDebugger = createDebugger(`${this.namespace}:${namespace}`);
+ newDebugger.log = this.log;
+ return newDebugger;
+}
+exports["default"] = debugObj;
+//# sourceMappingURL=debug.js.map
+
+/***/ }),
+
/***/ 6515:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
+// Licensed under the MIT license.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AzureLogger = void 0;
exports.setLogLevel = setLogLevel;
exports.getLogLevel = getLogLevel;
exports.createClientLogger = createClientLogger;
-const logger_1 = __nccwpck_require__(2490);
-const context = (0, logger_1.createLoggerContext)({
- logLevelEnvVarName: "AZURE_LOG_LEVEL",
- namespace: "azure",
-});
+const tslib_1 = __nccwpck_require__(1860);
+const debug_js_1 = tslib_1.__importDefault(__nccwpck_require__(1676));
+const registeredLoggers = new Set();
+const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env.AZURE_LOG_LEVEL) || undefined;
+let azureLogLevel;
/**
* The AzureLogger provides a mechanism for overriding where logs are output to.
* By default, logs are sent to stderr.
* Override the `log` method to redirect logs to another location.
*/
-exports.AzureLogger = context.logger;
+exports.AzureLogger = (0, debug_js_1.default)("azure");
+exports.AzureLogger.log = (...args) => {
+ debug_js_1.default.log(...args);
+};
+const AZURE_LOG_LEVELS = ["verbose", "info", "warning", "error"];
+if (logLevelFromEnv) {
+ // avoid calling setLogLevel because we don't want a mis-set environment variable to crash
+ if (isAzureLogLevel(logLevelFromEnv)) {
+ setLogLevel(logLevelFromEnv);
+ }
+ else {
+ console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`);
+ }
+}
/**
* Immediately enables logging at the specified log level. If no level is specified, logging is disabled.
* @param level - The log level to enable for logging.
@@ -78925,22 +82948,141 @@ exports.AzureLogger = context.logger;
* - error
*/
function setLogLevel(level) {
- context.setLogLevel(level);
+ if (level && !isAzureLogLevel(level)) {
+ throw new Error(`Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(",")}`);
+ }
+ azureLogLevel = level;
+ const enabledNamespaces = [];
+ for (const logger of registeredLoggers) {
+ if (shouldEnable(logger)) {
+ enabledNamespaces.push(logger.namespace);
+ }
+ }
+ debug_js_1.default.enable(enabledNamespaces.join(","));
}
/**
* Retrieves the currently specified log level.
*/
function getLogLevel() {
- return context.getLogLevel();
+ return azureLogLevel;
}
+const levelMap = {
+ verbose: 400,
+ info: 300,
+ warning: 200,
+ error: 100,
+};
/**
* Creates a logger for use by the Azure SDKs that inherits from `AzureLogger`.
* @param namespace - The name of the SDK package.
* @hidden
*/
function createClientLogger(namespace) {
- return context.createClientLogger(namespace);
+ const clientRootLogger = exports.AzureLogger.extend(namespace);
+ patchLogMethod(exports.AzureLogger, clientRootLogger);
+ return {
+ error: createLogger(clientRootLogger, "error"),
+ warning: createLogger(clientRootLogger, "warning"),
+ info: createLogger(clientRootLogger, "info"),
+ verbose: createLogger(clientRootLogger, "verbose"),
+ };
}
+function patchLogMethod(parent, child) {
+ child.log = (...args) => {
+ parent.log(...args);
+ };
+}
+function createLogger(parent, level) {
+ const logger = Object.assign(parent.extend(level), {
+ level,
+ });
+ patchLogMethod(parent, logger);
+ if (shouldEnable(logger)) {
+ const enabledNamespaces = debug_js_1.default.disable();
+ debug_js_1.default.enable(enabledNamespaces + "," + logger.namespace);
+ }
+ registeredLoggers.add(logger);
+ return logger;
+}
+function shouldEnable(logger) {
+ return Boolean(azureLogLevel && levelMap[logger.level] <= levelMap[azureLogLevel]);
+}
+function isAzureLogLevel(logLevel) {
+ return AZURE_LOG_LEVELS.includes(logLevel);
+}
+//# sourceMappingURL=index.js.map
+
+/***/ }),
+
+/***/ 6757:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.log = log;
+const tslib_1 = __nccwpck_require__(1860);
+const node_os_1 = __nccwpck_require__(8161);
+const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(7975));
+const process = tslib_1.__importStar(__nccwpck_require__(1708));
+function log(message, ...args) {
+ process.stderr.write(`${node_util_1.default.format(message, ...args)}${node_os_1.EOL}`);
+}
+//# sourceMappingURL=log.js.map
+
+/***/ }),
+
+/***/ 4841:
+/***/ ((__unused_webpack_module, exports) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.AbortError = void 0;
+/**
+ * This error is thrown when an asynchronous operation has been aborted.
+ * Check for this error by testing the `name` that the name property of the
+ * error matches `"AbortError"`.
+ *
+ * @example
+ * ```ts
+ * const controller = new AbortController();
+ * controller.abort();
+ * try {
+ * doAsyncWork(controller.signal)
+ * } catch (e) {
+ * if (e.name === 'AbortError') {
+ * // handle abort error here.
+ * }
+ * }
+ * ```
+ */
+class AbortError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = "AbortError";
+ }
+}
+exports.AbortError = AbortError;
+//# sourceMappingURL=AbortError.js.map
+
+/***/ }),
+
+/***/ 4517:
+/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
+
+"use strict";
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.AbortError = void 0;
+var AbortError_js_1 = __nccwpck_require__(4841);
+Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } }));
//# sourceMappingURL=index.js.map
/***/ }),
@@ -80568,4269 +84710,6 @@ function parseParams (str) {
module.exports = parseParams
-/***/ }),
-
-/***/ 9992:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.AbortError = void 0;
-/**
- * This error is thrown when an asynchronous operation has been aborted.
- * Check for this error by testing the `name` that the name property of the
- * error matches `"AbortError"`.
- *
- * @example
- * ```ts snippet:ReadmeSampleAbortError
- * import { AbortError } from "@typespec/ts-http-runtime";
- *
- * async function doAsyncWork(options: { abortSignal: AbortSignal }): Promise {
- * if (options.abortSignal.aborted) {
- * throw new AbortError();
- * }
- *
- * // do async work
- * }
- *
- * const controller = new AbortController();
- * controller.abort();
- *
- * try {
- * doAsyncWork({ abortSignal: controller.signal });
- * } catch (e) {
- * if (e instanceof Error && e.name === "AbortError") {
- * // handle abort error here.
- * }
- * }
- * ```
- */
-class AbortError extends Error {
- constructor(message) {
- super(message);
- this.name = "AbortError";
- }
-}
-exports.AbortError = AbortError;
-//# sourceMappingURL=AbortError.js.map
-
-/***/ }),
-
-/***/ 6227:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.isOAuth2TokenCredential = isOAuth2TokenCredential;
-exports.isBearerTokenCredential = isBearerTokenCredential;
-exports.isBasicCredential = isBasicCredential;
-exports.isApiKeyCredential = isApiKeyCredential;
-/**
- * Type guard to check if a credential is an OAuth2 token credential.
- */
-function isOAuth2TokenCredential(credential) {
- return "getOAuth2Token" in credential;
-}
-/**
- * Type guard to check if a credential is a Bearer token credential.
- */
-function isBearerTokenCredential(credential) {
- return "getBearerToken" in credential;
-}
-/**
- * Type guard to check if a credential is a Basic auth credential.
- */
-function isBasicCredential(credential) {
- return "username" in credential && "password" in credential;
-}
-/**
- * Type guard to check if a credential is an API key credential.
- */
-function isApiKeyCredential(credential) {
- return "key" in credential;
-}
-//# sourceMappingURL=credentials.js.map
-
-/***/ }),
-
-/***/ 3097:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-//# sourceMappingURL=oauth2Flows.js.map
-
-/***/ }),
-
-/***/ 2097:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-//# sourceMappingURL=schemes.js.map
-
-/***/ }),
-
-/***/ 1408:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.apiVersionPolicyName = void 0;
-exports.apiVersionPolicy = apiVersionPolicy;
-exports.apiVersionPolicyName = "ApiVersionPolicy";
-/**
- * Creates a policy that sets the apiVersion as a query parameter on every request
- * @param options - Client options
- * @returns Pipeline policy that sets the apiVersion as a query parameter on every request
- */
-function apiVersionPolicy(options) {
- return {
- name: exports.apiVersionPolicyName,
- sendRequest: (req, next) => {
- // Use the apiVesion defined in request url directly
- // Append one if there is no apiVesion and we have one at client options
- const url = new URL(req.url);
- if (!url.searchParams.get("api-version") && options.apiVersion) {
- req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${options.apiVersion}`;
- }
- return next(req);
- },
- };
-}
-//# sourceMappingURL=apiVersionPolicy.js.map
-
-/***/ }),
-
-/***/ 8728:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createDefaultPipeline = createDefaultPipeline;
-exports.getCachedDefaultHttpsClient = getCachedDefaultHttpsClient;
-const defaultHttpClient_js_1 = __nccwpck_require__(9468);
-const createPipelineFromOptions_js_1 = __nccwpck_require__(1810);
-const apiVersionPolicy_js_1 = __nccwpck_require__(1408);
-const credentials_js_1 = __nccwpck_require__(6227);
-const apiKeyAuthenticationPolicy_js_1 = __nccwpck_require__(2095);
-const basicAuthenticationPolicy_js_1 = __nccwpck_require__(5756);
-const bearerAuthenticationPolicy_js_1 = __nccwpck_require__(9709);
-const oauth2AuthenticationPolicy_js_1 = __nccwpck_require__(219);
-let cachedHttpClient;
-/**
- * Creates a default rest pipeline to re-use accross Rest Level Clients
- */
-function createDefaultPipeline(options = {}) {
- const pipeline = (0, createPipelineFromOptions_js_1.createPipelineFromOptions)(options);
- pipeline.addPolicy((0, apiVersionPolicy_js_1.apiVersionPolicy)(options));
- const { credential, authSchemes, allowInsecureConnection } = options;
- if (credential) {
- if ((0, credentials_js_1.isApiKeyCredential)(credential)) {
- pipeline.addPolicy((0, apiKeyAuthenticationPolicy_js_1.apiKeyAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection }));
- }
- else if ((0, credentials_js_1.isBasicCredential)(credential)) {
- pipeline.addPolicy((0, basicAuthenticationPolicy_js_1.basicAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection }));
- }
- else if ((0, credentials_js_1.isBearerTokenCredential)(credential)) {
- pipeline.addPolicy((0, bearerAuthenticationPolicy_js_1.bearerAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection }));
- }
- else if ((0, credentials_js_1.isOAuth2TokenCredential)(credential)) {
- pipeline.addPolicy((0, oauth2AuthenticationPolicy_js_1.oauth2AuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection }));
- }
- }
- return pipeline;
-}
-function getCachedDefaultHttpsClient() {
- if (!cachedHttpClient) {
- cachedHttpClient = (0, defaultHttpClient_js_1.createDefaultHttpClient)();
- }
- return cachedHttpClient;
-}
-//# sourceMappingURL=clientHelpers.js.map
-
-/***/ }),
-
-/***/ 6191:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getClient = getClient;
-const clientHelpers_js_1 = __nccwpck_require__(8728);
-const sendRequest_js_1 = __nccwpck_require__(6311);
-const urlHelpers_js_1 = __nccwpck_require__(7088);
-const checkEnvironment_js_1 = __nccwpck_require__(5086);
-/**
- * Creates a client with a default pipeline
- * @param endpoint - Base endpoint for the client
- * @param credentials - Credentials to authenticate the requests
- * @param options - Client options
- */
-function getClient(endpoint, clientOptions = {}) {
- var _a, _b, _c;
- const pipeline = (_a = clientOptions.pipeline) !== null && _a !== void 0 ? _a : (0, clientHelpers_js_1.createDefaultPipeline)(clientOptions);
- if ((_b = clientOptions.additionalPolicies) === null || _b === void 0 ? void 0 : _b.length) {
- for (const { policy, position } of clientOptions.additionalPolicies) {
- // Sign happens after Retry and is commonly needed to occur
- // before policies that intercept post-retry.
- const afterPhase = position === "perRetry" ? "Sign" : undefined;
- pipeline.addPolicy(policy, {
- afterPhase,
- });
- }
- }
- const { allowInsecureConnection, httpClient } = clientOptions;
- const endpointUrl = (_c = clientOptions.endpoint) !== null && _c !== void 0 ? _c : endpoint;
- const client = (path, ...args) => {
- const getUrl = (requestOptions) => (0, urlHelpers_js_1.buildRequestUrl)(endpointUrl, path, args, Object.assign({ allowInsecureConnection }, requestOptions));
- return {
- get: (requestOptions = {}) => {
- return buildOperation("GET", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient);
- },
- post: (requestOptions = {}) => {
- return buildOperation("POST", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient);
- },
- put: (requestOptions = {}) => {
- return buildOperation("PUT", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient);
- },
- patch: (requestOptions = {}) => {
- return buildOperation("PATCH", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient);
- },
- delete: (requestOptions = {}) => {
- return buildOperation("DELETE", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient);
- },
- head: (requestOptions = {}) => {
- return buildOperation("HEAD", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient);
- },
- options: (requestOptions = {}) => {
- return buildOperation("OPTIONS", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient);
- },
- trace: (requestOptions = {}) => {
- return buildOperation("TRACE", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient);
- },
- };
- };
- return {
- path: client,
- pathUnchecked: client,
- pipeline,
- };
-}
-function buildOperation(method, url, pipeline, options, allowInsecureConnection, httpClient) {
- var _a;
- allowInsecureConnection = (_a = options.allowInsecureConnection) !== null && _a !== void 0 ? _a : allowInsecureConnection;
- return {
- then: function (onFulfilled, onrejected) {
- return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, Object.assign(Object.assign({}, options), { allowInsecureConnection }), httpClient).then(onFulfilled, onrejected);
- },
- async asBrowserStream() {
- if (checkEnvironment_js_1.isNodeLike) {
- throw new Error("`asBrowserStream` is supported only in the browser environment. Use `asNodeStream` instead to obtain the response body stream. If you require a Web stream of the response in Node, consider using `Readable.toWeb` on the result of `asNodeStream`.");
- }
- else {
- return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, Object.assign(Object.assign({}, options), { allowInsecureConnection, responseAsStream: true }), httpClient);
- }
- },
- async asNodeStream() {
- if (checkEnvironment_js_1.isNodeLike) {
- return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, Object.assign(Object.assign({}, options), { allowInsecureConnection, responseAsStream: true }), httpClient);
- }
- else {
- throw new Error("`isNodeStream` is not supported in the browser environment. Use `asBrowserStream` to obtain the response body stream.");
- }
- },
- };
-}
-//# sourceMappingURL=getClient.js.map
-
-/***/ }),
-
-/***/ 8240:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.buildBodyPart = buildBodyPart;
-exports.buildMultipartBody = buildMultipartBody;
-const restError_js_1 = __nccwpck_require__(9758);
-const httpHeaders_js_1 = __nccwpck_require__(4220);
-const bytesEncoding_js_1 = __nccwpck_require__(2921);
-const typeGuards_js_1 = __nccwpck_require__(8505);
-/**
- * Get value of a header in the part descriptor ignoring case
- */
-function getHeaderValue(descriptor, headerName) {
- if (descriptor.headers) {
- const actualHeaderName = Object.keys(descriptor.headers).find((x) => x.toLowerCase() === headerName.toLowerCase());
- if (actualHeaderName) {
- return descriptor.headers[actualHeaderName];
- }
- }
- return undefined;
-}
-function getPartContentType(descriptor) {
- const contentTypeHeader = getHeaderValue(descriptor, "content-type");
- if (contentTypeHeader) {
- return contentTypeHeader;
- }
- // Special value of null means content type is to be omitted
- if (descriptor.contentType === null) {
- return undefined;
- }
- if (descriptor.contentType) {
- return descriptor.contentType;
- }
- const { body } = descriptor;
- if (body === null || body === undefined) {
- return undefined;
- }
- if (typeof body === "string" || typeof body === "number" || typeof body === "boolean") {
- return "text/plain; charset=UTF-8";
- }
- if (body instanceof Blob) {
- return body.type || "application/octet-stream";
- }
- if ((0, typeGuards_js_1.isBinaryBody)(body)) {
- return "application/octet-stream";
- }
- // arbitrary non-text object -> generic JSON content type by default. We will try to JSON.stringify the body.
- return "application/json";
-}
-/**
- * Enclose value in quotes and escape special characters, for use in the Content-Disposition header
- */
-function escapeDispositionField(value) {
- return JSON.stringify(value);
-}
-function getContentDisposition(descriptor) {
- var _a;
- const contentDispositionHeader = getHeaderValue(descriptor, "content-disposition");
- if (contentDispositionHeader) {
- return contentDispositionHeader;
- }
- if (descriptor.dispositionType === undefined &&
- descriptor.name === undefined &&
- descriptor.filename === undefined) {
- return undefined;
- }
- const dispositionType = (_a = descriptor.dispositionType) !== null && _a !== void 0 ? _a : "form-data";
- let disposition = dispositionType;
- if (descriptor.name) {
- disposition += `; name=${escapeDispositionField(descriptor.name)}`;
- }
- let filename = undefined;
- if (descriptor.filename) {
- filename = descriptor.filename;
- }
- else if (typeof File !== "undefined" && descriptor.body instanceof File) {
- const filenameFromFile = descriptor.body.name;
- if (filenameFromFile !== "") {
- filename = filenameFromFile;
- }
- }
- if (filename) {
- disposition += `; filename=${escapeDispositionField(filename)}`;
- }
- return disposition;
-}
-function normalizeBody(body, contentType) {
- if (body === undefined) {
- // zero-length body
- return new Uint8Array([]);
- }
- // binary and primitives should go straight on the wire regardless of content type
- if ((0, typeGuards_js_1.isBinaryBody)(body)) {
- return body;
- }
- if (typeof body === "string" || typeof body === "number" || typeof body === "boolean") {
- return (0, bytesEncoding_js_1.stringToUint8Array)(String(body), "utf-8");
- }
- // stringify objects for JSON-ish content types e.g. application/json, application/merge-patch+json, application/vnd.oci.manifest.v1+json, application.json; charset=UTF-8
- if (contentType && /application\/(.+\+)?json(;.+)?/i.test(String(contentType))) {
- return (0, bytesEncoding_js_1.stringToUint8Array)(JSON.stringify(body), "utf-8");
- }
- throw new restError_js_1.RestError(`Unsupported body/content-type combination: ${body}, ${contentType}`);
-}
-function buildBodyPart(descriptor) {
- var _a;
- const contentType = getPartContentType(descriptor);
- const contentDisposition = getContentDisposition(descriptor);
- const headers = (0, httpHeaders_js_1.createHttpHeaders)((_a = descriptor.headers) !== null && _a !== void 0 ? _a : {});
- if (contentType) {
- headers.set("content-type", contentType);
- }
- if (contentDisposition) {
- headers.set("content-disposition", contentDisposition);
- }
- const body = normalizeBody(descriptor.body, contentType);
- return {
- headers,
- body,
- };
-}
-function buildMultipartBody(parts) {
- return { parts: parts.map(buildBodyPart) };
-}
-//# sourceMappingURL=multipart.js.map
-
-/***/ }),
-
-/***/ 9635:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.operationOptionsToRequestParameters = operationOptionsToRequestParameters;
-/**
- * Helper function to convert OperationOptions to RequestParameters
- * @param options - the options that are used by Modular layer to send the request
- * @returns the result of the conversion in RequestParameters of RLC layer
- */
-function operationOptionsToRequestParameters(options) {
- var _a, _b, _c, _d, _e, _f;
- return {
- allowInsecureConnection: (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.allowInsecureConnection,
- timeout: (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.timeout,
- skipUrlEncoding: (_c = options.requestOptions) === null || _c === void 0 ? void 0 : _c.skipUrlEncoding,
- abortSignal: options.abortSignal,
- onUploadProgress: (_d = options.requestOptions) === null || _d === void 0 ? void 0 : _d.onUploadProgress,
- onDownloadProgress: (_e = options.requestOptions) === null || _e === void 0 ? void 0 : _e.onDownloadProgress,
- headers: Object.assign({}, (_f = options.requestOptions) === null || _f === void 0 ? void 0 : _f.headers),
- onResponse: options.onResponse,
- };
-}
-//# sourceMappingURL=operationOptionHelpers.js.map
-
-/***/ }),
-
-/***/ 7332:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createRestError = createRestError;
-const restError_js_1 = __nccwpck_require__(9758);
-const httpHeaders_js_1 = __nccwpck_require__(4220);
-function createRestError(messageOrResponse, response) {
- var _a, _b, _c;
- const resp = typeof messageOrResponse === "string" ? response : messageOrResponse;
- const internalError = (_b = (_a = resp.body) === null || _a === void 0 ? void 0 : _a.error) !== null && _b !== void 0 ? _b : resp.body;
- const message = typeof messageOrResponse === "string"
- ? messageOrResponse
- : ((_c = internalError === null || internalError === void 0 ? void 0 : internalError.message) !== null && _c !== void 0 ? _c : `Unexpected status code: ${resp.status}`);
- return new restError_js_1.RestError(message, {
- statusCode: statusCodeToNumber(resp.status),
- code: internalError === null || internalError === void 0 ? void 0 : internalError.code,
- request: resp.request,
- response: toPipelineResponse(resp),
- });
-}
-function toPipelineResponse(response) {
- var _a;
- return {
- headers: (0, httpHeaders_js_1.createHttpHeaders)(response.headers),
- request: response.request,
- status: (_a = statusCodeToNumber(response.status)) !== null && _a !== void 0 ? _a : -1,
- };
-}
-function statusCodeToNumber(statusCode) {
- const status = Number.parseInt(statusCode);
- return Number.isNaN(status) ? undefined : status;
-}
-//# sourceMappingURL=restError.js.map
-
-/***/ }),
-
-/***/ 6311:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.sendRequest = sendRequest;
-const restError_js_1 = __nccwpck_require__(9758);
-const httpHeaders_js_1 = __nccwpck_require__(4220);
-const pipelineRequest_js_1 = __nccwpck_require__(2305);
-const clientHelpers_js_1 = __nccwpck_require__(8728);
-const typeGuards_js_1 = __nccwpck_require__(8505);
-const multipart_js_1 = __nccwpck_require__(8240);
-/**
- * Helper function to send request used by the client
- * @param method - method to use to send the request
- * @param url - url to send the request to
- * @param pipeline - pipeline with the policies to run when sending the request
- * @param options - request options
- * @param customHttpClient - a custom HttpClient to use when making the request
- * @returns returns and HttpResponse
- */
-async function sendRequest(method, url, pipeline, options = {}, customHttpClient) {
- var _a;
- const httpClient = customHttpClient !== null && customHttpClient !== void 0 ? customHttpClient : (0, clientHelpers_js_1.getCachedDefaultHttpsClient)();
- const request = buildPipelineRequest(method, url, options);
- try {
- const response = await pipeline.sendRequest(httpClient, request);
- const headers = response.headers.toJSON();
- const stream = (_a = response.readableStreamBody) !== null && _a !== void 0 ? _a : response.browserStreamBody;
- const parsedBody = options.responseAsStream || stream !== undefined ? undefined : getResponseBody(response);
- const body = stream !== null && stream !== void 0 ? stream : parsedBody;
- if (options === null || options === void 0 ? void 0 : options.onResponse) {
- options.onResponse(Object.assign(Object.assign({}, response), { request, rawHeaders: headers, parsedBody }));
- }
- return {
- request,
- headers,
- status: `${response.status}`,
- body,
- };
- }
- catch (e) {
- if ((0, restError_js_1.isRestError)(e) && e.response && options.onResponse) {
- const { response } = e;
- const rawHeaders = response.headers.toJSON();
- // UNBRANDED DIFFERENCE: onResponse callback does not have a second __legacyError property
- options === null || options === void 0 ? void 0 : options.onResponse(Object.assign(Object.assign({}, response), { request, rawHeaders }), e);
- }
- throw e;
- }
-}
-/**
- * Function to determine the request content type
- * @param options - request options InternalRequestParameters
- * @returns returns the content-type
- */
-function getRequestContentType(options = {}) {
- var _a, _b, _c;
- return ((_c = (_a = options.contentType) !== null && _a !== void 0 ? _a : (_b = options.headers) === null || _b === void 0 ? void 0 : _b["content-type"]) !== null && _c !== void 0 ? _c : getContentType(options.body));
-}
-/**
- * Function to determine the content-type of a body
- * this is used if an explicit content-type is not provided
- * @param body - body in the request
- * @returns returns the content-type
- */
-function getContentType(body) {
- if (ArrayBuffer.isView(body)) {
- return "application/octet-stream";
- }
- if (typeof body === "string") {
- try {
- JSON.parse(body);
- return "application/json";
- }
- catch (error) {
- // If we fail to parse the body, it is not json
- return undefined;
- }
- }
- // By default return json
- return "application/json";
-}
-function buildPipelineRequest(method, url, options = {}) {
- var _a, _b, _c;
- const requestContentType = getRequestContentType(options);
- const { body, multipartBody } = getRequestBody(options.body, requestContentType);
- const hasContent = body !== undefined || multipartBody !== undefined;
- const headers = (0, httpHeaders_js_1.createHttpHeaders)(Object.assign(Object.assign(Object.assign({}, (options.headers ? options.headers : {})), { accept: (_c = (_a = options.accept) !== null && _a !== void 0 ? _a : (_b = options.headers) === null || _b === void 0 ? void 0 : _b.accept) !== null && _c !== void 0 ? _c : "application/json" }), (hasContent &&
- requestContentType && {
- "content-type": requestContentType,
- })));
- return (0, pipelineRequest_js_1.createPipelineRequest)({
- url,
- method,
- body,
- multipartBody,
- headers,
- allowInsecureConnection: options.allowInsecureConnection,
- abortSignal: options.abortSignal,
- onUploadProgress: options.onUploadProgress,
- onDownloadProgress: options.onDownloadProgress,
- timeout: options.timeout,
- enableBrowserStreams: true,
- streamResponseStatusCodes: options.responseAsStream
- ? new Set([Number.POSITIVE_INFINITY])
- : undefined,
- });
-}
-/**
- * Prepares the body before sending the request
- */
-function getRequestBody(body, contentType = "") {
- if (body === undefined) {
- return { body: undefined };
- }
- if (typeof FormData !== "undefined" && body instanceof FormData) {
- return { body };
- }
- if ((0, typeGuards_js_1.isReadableStream)(body)) {
- return { body };
- }
- if (ArrayBuffer.isView(body)) {
- return { body: body instanceof Uint8Array ? body : JSON.stringify(body) };
- }
- const firstType = contentType.split(";")[0];
- switch (firstType) {
- case "application/json":
- return { body: JSON.stringify(body) };
- case "multipart/form-data":
- if (Array.isArray(body)) {
- return { multipartBody: (0, multipart_js_1.buildMultipartBody)(body) };
- }
- return { body: JSON.stringify(body) };
- case "text/plain":
- return { body: String(body) };
- default:
- if (typeof body === "string") {
- return { body };
- }
- return { body: JSON.stringify(body) };
- }
-}
-/**
- * Prepares the response body
- */
-function getResponseBody(response) {
- var _a, _b;
- // Set the default response type
- const contentType = (_a = response.headers.get("content-type")) !== null && _a !== void 0 ? _a : "";
- const firstType = contentType.split(";")[0];
- const bodyToParse = (_b = response.bodyAsText) !== null && _b !== void 0 ? _b : "";
- if (firstType === "text/plain") {
- return String(bodyToParse);
- }
- // Default to "application/json" and fallback to string;
- try {
- return bodyToParse ? JSON.parse(bodyToParse) : undefined;
- }
- catch (error) {
- // If we were supposed to get a JSON object and failed to
- // parse, throw a parse error
- if (firstType === "application/json") {
- throw createParseError(response, error);
- }
- // We are not sure how to handle the response so we return it as
- // plain text.
- return String(bodyToParse);
- }
-}
-function createParseError(response, err) {
- var _a;
- const msg = `Error "${err}" occurred while parsing the response body - ${response.bodyAsText}.`;
- const errCode = (_a = err.code) !== null && _a !== void 0 ? _a : restError_js_1.RestError.PARSE_ERROR;
- return new restError_js_1.RestError(msg, {
- code: errCode,
- statusCode: response.status,
- request: response.request,
- response: response,
- });
-}
-//# sourceMappingURL=sendRequest.js.map
-
-/***/ }),
-
-/***/ 7088:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.buildRequestUrl = buildRequestUrl;
-exports.buildBaseUrl = buildBaseUrl;
-exports.replaceAll = replaceAll;
-function isQueryParameterWithOptions(x) {
- const value = x.value;
- return (value !== undefined && value.toString !== undefined && typeof value.toString === "function");
-}
-/**
- * Builds the request url, filling in query and path parameters
- * @param endpoint - base url which can be a template url
- * @param routePath - path to append to the endpoint
- * @param pathParameters - values of the path parameters
- * @param options - request parameters including query parameters
- * @returns a full url with path and query parameters
- */
-function buildRequestUrl(endpoint, routePath, pathParameters, options = {}) {
- if (routePath.startsWith("https://") || routePath.startsWith("http://")) {
- return routePath;
- }
- endpoint = buildBaseUrl(endpoint, options);
- routePath = buildRoutePath(routePath, pathParameters, options);
- const requestUrl = appendQueryParams(`${endpoint}/${routePath}`, options);
- const url = new URL(requestUrl);
- return (url
- .toString()
- // Remove double forward slashes
- .replace(/([^:]\/)\/+/g, "$1"));
-}
-function getQueryParamValue(key, allowReserved, style, param) {
- let separator;
- if (style === "pipeDelimited") {
- separator = "|";
- }
- else if (style === "spaceDelimited") {
- separator = "%20";
- }
- else {
- separator = ",";
- }
- let paramValues;
- if (Array.isArray(param)) {
- paramValues = param;
- }
- else if (typeof param === "object" && param.toString === Object.prototype.toString) {
- // If the parameter is an object without a custom toString implementation (e.g. a Date),
- // then we should deconstruct the object into an array [key1, value1, key2, value2, ...].
- paramValues = Object.entries(param).flat();
- }
- else {
- paramValues = [param];
- }
- const value = paramValues
- .map((p) => {
- if (p === null || p === undefined) {
- return "";
- }
- if (!p.toString || typeof p.toString !== "function") {
- throw new Error(`Query parameters must be able to be represented as string, ${key} can't`);
- }
- const rawValue = p.toISOString !== undefined ? p.toISOString() : p.toString();
- return allowReserved ? rawValue : encodeURIComponent(rawValue);
- })
- .join(separator);
- return `${allowReserved ? key : encodeURIComponent(key)}=${value}`;
-}
-function appendQueryParams(url, options = {}) {
- var _a, _b, _c, _d;
- if (!options.queryParameters) {
- return url;
- }
- const parsedUrl = new URL(url);
- const queryParams = options.queryParameters;
- const paramStrings = [];
- for (const key of Object.keys(queryParams)) {
- const param = queryParams[key];
- if (param === undefined || param === null) {
- continue;
- }
- const hasMetadata = isQueryParameterWithOptions(param);
- const rawValue = hasMetadata ? param.value : param;
- const explode = hasMetadata ? ((_a = param.explode) !== null && _a !== void 0 ? _a : false) : false;
- const style = hasMetadata && param.style ? param.style : "form";
- if (explode) {
- if (Array.isArray(rawValue)) {
- for (const item of rawValue) {
- paramStrings.push(getQueryParamValue(key, (_b = options.skipUrlEncoding) !== null && _b !== void 0 ? _b : false, style, item));
- }
- }
- else if (typeof rawValue === "object") {
- // For object explode, the name of the query parameter is ignored and we use the object key instead
- for (const [actualKey, value] of Object.entries(rawValue)) {
- paramStrings.push(getQueryParamValue(actualKey, (_c = options.skipUrlEncoding) !== null && _c !== void 0 ? _c : false, style, value));
- }
- }
- else {
- // Explode doesn't really make sense for primitives
- throw new Error("explode can only be set to true for objects and arrays");
- }
- }
- else {
- paramStrings.push(getQueryParamValue(key, (_d = options.skipUrlEncoding) !== null && _d !== void 0 ? _d : false, style, rawValue));
- }
- }
- if (parsedUrl.search !== "") {
- parsedUrl.search += "&";
- }
- parsedUrl.search += paramStrings.join("&");
- return parsedUrl.toString();
-}
-function buildBaseUrl(endpoint, options) {
- var _a;
- if (!options.pathParameters) {
- return endpoint;
- }
- const pathParams = options.pathParameters;
- for (const [key, param] of Object.entries(pathParams)) {
- if (param === undefined || param === null) {
- throw new Error(`Path parameters ${key} must not be undefined or null`);
- }
- if (!param.toString || typeof param.toString !== "function") {
- throw new Error(`Path parameters must be able to be represented as string, ${key} can't`);
- }
- let value = param.toISOString !== undefined ? param.toISOString() : String(param);
- if (!options.skipUrlEncoding) {
- value = encodeURIComponent(param);
- }
- endpoint = (_a = replaceAll(endpoint, `{${key}}`, value)) !== null && _a !== void 0 ? _a : "";
- }
- return endpoint;
-}
-function buildRoutePath(routePath, pathParameters, options = {}) {
- var _a;
- for (const pathParam of pathParameters) {
- const allowReserved = typeof pathParam === "object" && ((_a = pathParam.allowReserved) !== null && _a !== void 0 ? _a : false);
- let value = typeof pathParam === "object" ? pathParam.value : pathParam;
- if (!options.skipUrlEncoding && !allowReserved) {
- value = encodeURIComponent(value);
- }
- routePath = routePath.replace(/\{[\w-]+\}/, String(value));
- }
- return routePath;
-}
-/**
- * Replace all of the instances of searchValue in value with the provided replaceValue.
- * @param value - The value to search and replace in.
- * @param searchValue - The value to search for in the value argument.
- * @param replaceValue - The value to replace searchValue with in the value argument.
- * @returns The value where each instance of searchValue was replaced with replacedValue.
- */
-function replaceAll(value, searchValue, replaceValue) {
- return !value || !searchValue ? value : value.split(searchValue).join(replaceValue || "");
-}
-//# sourceMappingURL=urlHelpers.js.map
-
-/***/ }),
-
-/***/ 1255:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.DEFAULT_RETRY_POLICY_COUNT = exports.SDK_VERSION = void 0;
-exports.SDK_VERSION = "0.2.2";
-exports.DEFAULT_RETRY_POLICY_COUNT = 3;
-//# sourceMappingURL=constants.js.map
-
-/***/ }),
-
-/***/ 1810:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createPipelineFromOptions = createPipelineFromOptions;
-const logPolicy_js_1 = __nccwpck_require__(7129);
-const pipeline_js_1 = __nccwpck_require__(9957);
-const redirectPolicy_js_1 = __nccwpck_require__(2187);
-const userAgentPolicy_js_1 = __nccwpck_require__(1691);
-const decompressResponsePolicy_js_1 = __nccwpck_require__(5035);
-const defaultRetryPolicy_js_1 = __nccwpck_require__(2462);
-const formDataPolicy_js_1 = __nccwpck_require__(4197);
-const checkEnvironment_js_1 = __nccwpck_require__(5086);
-const proxyPolicy_js_1 = __nccwpck_require__(67);
-const agentPolicy_js_1 = __nccwpck_require__(5366);
-const tlsPolicy_js_1 = __nccwpck_require__(6690);
-const multipartPolicy_js_1 = __nccwpck_require__(7427);
-/**
- * Create a new pipeline with a default set of customizable policies.
- * @param options - Options to configure a custom pipeline.
- */
-function createPipelineFromOptions(options) {
- const pipeline = (0, pipeline_js_1.createEmptyPipeline)();
- if (checkEnvironment_js_1.isNodeLike) {
- if (options.agent) {
- pipeline.addPolicy((0, agentPolicy_js_1.agentPolicy)(options.agent));
- }
- if (options.tlsOptions) {
- pipeline.addPolicy((0, tlsPolicy_js_1.tlsPolicy)(options.tlsOptions));
- }
- pipeline.addPolicy((0, proxyPolicy_js_1.proxyPolicy)(options.proxyOptions));
- pipeline.addPolicy((0, decompressResponsePolicy_js_1.decompressResponsePolicy)());
- }
- pipeline.addPolicy((0, formDataPolicy_js_1.formDataPolicy)(), { beforePolicies: [multipartPolicy_js_1.multipartPolicyName] });
- pipeline.addPolicy((0, userAgentPolicy_js_1.userAgentPolicy)(options.userAgentOptions));
- // The multipart policy is added after policies with no phase, so that
- // policies can be added between it and formDataPolicy to modify
- // properties (e.g., making the boundary constant in recorded tests).
- pipeline.addPolicy((0, multipartPolicy_js_1.multipartPolicy)(), { afterPhase: "Deserialize" });
- pipeline.addPolicy((0, defaultRetryPolicy_js_1.defaultRetryPolicy)(options.retryOptions), { phase: "Retry" });
- if (checkEnvironment_js_1.isNodeLike) {
- // Both XHR and Fetch expect to handle redirects automatically,
- // so only include this policy when we're in Node.
- pipeline.addPolicy((0, redirectPolicy_js_1.redirectPolicy)(options.redirectOptions), { afterPhase: "Retry" });
- }
- pipeline.addPolicy((0, logPolicy_js_1.logPolicy)(options.loggingOptions), { afterPhase: "Sign" });
- return pipeline;
-}
-//# sourceMappingURL=createPipelineFromOptions.js.map
-
-/***/ }),
-
-/***/ 9468:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createDefaultHttpClient = createDefaultHttpClient;
-const nodeHttpClient_js_1 = __nccwpck_require__(1167);
-/**
- * Create the correct HttpClient for the current environment.
- */
-function createDefaultHttpClient() {
- return (0, nodeHttpClient_js_1.createNodeHttpClient)();
-}
-//# sourceMappingURL=defaultHttpClient.js.map
-
-/***/ }),
-
-/***/ 4220:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createHttpHeaders = createHttpHeaders;
-function normalizeName(name) {
- return name.toLowerCase();
-}
-function* headerIterator(map) {
- for (const entry of map.values()) {
- yield [entry.name, entry.value];
- }
-}
-class HttpHeadersImpl {
- constructor(rawHeaders) {
- this._headersMap = new Map();
- if (rawHeaders) {
- for (const headerName of Object.keys(rawHeaders)) {
- this.set(headerName, rawHeaders[headerName]);
- }
- }
- }
- /**
- * Set a header in this collection with the provided name and value. The name is
- * case-insensitive.
- * @param name - The name of the header to set. This value is case-insensitive.
- * @param value - The value of the header to set.
- */
- set(name, value) {
- this._headersMap.set(normalizeName(name), { name, value: String(value).trim() });
- }
- /**
- * Get the header value for the provided header name, or undefined if no header exists in this
- * collection with the provided name.
- * @param name - The name of the header. This value is case-insensitive.
- */
- get(name) {
- var _a;
- return (_a = this._headersMap.get(normalizeName(name))) === null || _a === void 0 ? void 0 : _a.value;
- }
- /**
- * Get whether or not this header collection contains a header entry for the provided header name.
- * @param name - The name of the header to set. This value is case-insensitive.
- */
- has(name) {
- return this._headersMap.has(normalizeName(name));
- }
- /**
- * Remove the header with the provided headerName.
- * @param name - The name of the header to remove.
- */
- delete(name) {
- this._headersMap.delete(normalizeName(name));
- }
- /**
- * Get the JSON object representation of this HTTP header collection.
- */
- toJSON(options = {}) {
- const result = {};
- if (options.preserveCase) {
- for (const entry of this._headersMap.values()) {
- result[entry.name] = entry.value;
- }
- }
- else {
- for (const [normalizedName, entry] of this._headersMap) {
- result[normalizedName] = entry.value;
- }
- }
- return result;
- }
- /**
- * Get the string representation of this HTTP header collection.
- */
- toString() {
- return JSON.stringify(this.toJSON({ preserveCase: true }));
- }
- /**
- * Iterate over tuples of header [name, value] pairs.
- */
- [Symbol.iterator]() {
- return headerIterator(this._headersMap);
- }
-}
-/**
- * Creates an object that satisfies the `HttpHeaders` interface.
- * @param rawHeaders - A simple object representing initial headers
- */
-function createHttpHeaders(rawHeaders) {
- return new HttpHeadersImpl(rawHeaders);
-}
-//# sourceMappingURL=httpHeaders.js.map
-
-/***/ }),
-
-/***/ 1958:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createRestError = exports.operationOptionsToRequestParameters = exports.getClient = exports.createDefaultHttpClient = exports.uint8ArrayToString = exports.stringToUint8Array = exports.isRestError = exports.RestError = exports.createEmptyPipeline = exports.createPipelineRequest = exports.createHttpHeaders = exports.TypeSpecRuntimeLogger = exports.setLogLevel = exports.getLogLevel = exports.createClientLogger = exports.AbortError = void 0;
-const tslib_1 = __nccwpck_require__(1860);
-var AbortError_js_1 = __nccwpck_require__(9992);
-Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } }));
-var logger_js_1 = __nccwpck_require__(8459);
-Object.defineProperty(exports, "createClientLogger", ({ enumerable: true, get: function () { return logger_js_1.createClientLogger; } }));
-Object.defineProperty(exports, "getLogLevel", ({ enumerable: true, get: function () { return logger_js_1.getLogLevel; } }));
-Object.defineProperty(exports, "setLogLevel", ({ enumerable: true, get: function () { return logger_js_1.setLogLevel; } }));
-Object.defineProperty(exports, "TypeSpecRuntimeLogger", ({ enumerable: true, get: function () { return logger_js_1.TypeSpecRuntimeLogger; } }));
-var httpHeaders_js_1 = __nccwpck_require__(4220);
-Object.defineProperty(exports, "createHttpHeaders", ({ enumerable: true, get: function () { return httpHeaders_js_1.createHttpHeaders; } }));
-tslib_1.__exportStar(__nccwpck_require__(2097), exports);
-tslib_1.__exportStar(__nccwpck_require__(3097), exports);
-var pipelineRequest_js_1 = __nccwpck_require__(2305);
-Object.defineProperty(exports, "createPipelineRequest", ({ enumerable: true, get: function () { return pipelineRequest_js_1.createPipelineRequest; } }));
-var pipeline_js_1 = __nccwpck_require__(9957);
-Object.defineProperty(exports, "createEmptyPipeline", ({ enumerable: true, get: function () { return pipeline_js_1.createEmptyPipeline; } }));
-var restError_js_1 = __nccwpck_require__(9758);
-Object.defineProperty(exports, "RestError", ({ enumerable: true, get: function () { return restError_js_1.RestError; } }));
-Object.defineProperty(exports, "isRestError", ({ enumerable: true, get: function () { return restError_js_1.isRestError; } }));
-var bytesEncoding_js_1 = __nccwpck_require__(2921);
-Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } }));
-Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } }));
-var defaultHttpClient_js_1 = __nccwpck_require__(9468);
-Object.defineProperty(exports, "createDefaultHttpClient", ({ enumerable: true, get: function () { return defaultHttpClient_js_1.createDefaultHttpClient; } }));
-var getClient_js_1 = __nccwpck_require__(6191);
-Object.defineProperty(exports, "getClient", ({ enumerable: true, get: function () { return getClient_js_1.getClient; } }));
-var operationOptionHelpers_js_1 = __nccwpck_require__(9635);
-Object.defineProperty(exports, "operationOptionsToRequestParameters", ({ enumerable: true, get: function () { return operationOptionHelpers_js_1.operationOptionsToRequestParameters; } }));
-var restError_js_2 = __nccwpck_require__(7332);
-Object.defineProperty(exports, "createRestError", ({ enumerable: true, get: function () { return restError_js_2.createRestError; } }));
-//# sourceMappingURL=index.js.map
-
-/***/ }),
-
-/***/ 3644:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.logger = void 0;
-const logger_js_1 = __nccwpck_require__(8459);
-exports.logger = (0, logger_js_1.createClientLogger)("ts-http-runtime");
-//# sourceMappingURL=log.js.map
-
-/***/ }),
-
-/***/ 6836:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-const log_js_1 = __nccwpck_require__(8029);
-const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined;
-let enabledString;
-let enabledNamespaces = [];
-let skippedNamespaces = [];
-const debuggers = [];
-if (debugEnvVariable) {
- enable(debugEnvVariable);
-}
-const debugObj = Object.assign((namespace) => {
- return createDebugger(namespace);
-}, {
- enable,
- enabled,
- disable,
- log: log_js_1.log,
-});
-function enable(namespaces) {
- enabledString = namespaces;
- enabledNamespaces = [];
- skippedNamespaces = [];
- const wildcard = /\*/g;
- const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?"));
- for (const ns of namespaceList) {
- if (ns.startsWith("-")) {
- skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`));
- }
- else {
- enabledNamespaces.push(new RegExp(`^${ns}$`));
- }
- }
- for (const instance of debuggers) {
- instance.enabled = enabled(instance.namespace);
- }
-}
-function enabled(namespace) {
- if (namespace.endsWith("*")) {
- return true;
- }
- for (const skipped of skippedNamespaces) {
- if (skipped.test(namespace)) {
- return false;
- }
- }
- for (const enabledNamespace of enabledNamespaces) {
- if (enabledNamespace.test(namespace)) {
- return true;
- }
- }
- return false;
-}
-function disable() {
- const result = enabledString || "";
- enable("");
- return result;
-}
-function createDebugger(namespace) {
- const newDebugger = Object.assign(debug, {
- enabled: enabled(namespace),
- destroy,
- log: debugObj.log,
- namespace,
- extend,
- });
- function debug(...args) {
- if (!newDebugger.enabled) {
- return;
- }
- if (args.length > 0) {
- args[0] = `${namespace} ${args[0]}`;
- }
- newDebugger.log(...args);
- }
- debuggers.push(newDebugger);
- return newDebugger;
-}
-function destroy() {
- const index = debuggers.indexOf(this);
- if (index >= 0) {
- debuggers.splice(index, 1);
- return true;
- }
- return false;
-}
-function extend(namespace) {
- const newDebugger = createDebugger(`${this.namespace}:${namespace}`);
- newDebugger.log = this.log;
- return newDebugger;
-}
-exports["default"] = debugObj;
-//# sourceMappingURL=debug.js.map
-
-/***/ }),
-
-/***/ 2490:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createLoggerContext = void 0;
-var logger_js_1 = __nccwpck_require__(8459);
-Object.defineProperty(exports, "createLoggerContext", ({ enumerable: true, get: function () { return logger_js_1.createLoggerContext; } }));
-//# sourceMappingURL=internal.js.map
-
-/***/ }),
-
-/***/ 8029:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.log = log;
-const tslib_1 = __nccwpck_require__(1860);
-const node_os_1 = __nccwpck_require__(8161);
-const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(7975));
-const process = tslib_1.__importStar(__nccwpck_require__(1708));
-function log(message, ...args) {
- process.stderr.write(`${node_util_1.default.format(message, ...args)}${node_os_1.EOL}`);
-}
-//# sourceMappingURL=log.js.map
-
-/***/ }),
-
-/***/ 8459:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.TypeSpecRuntimeLogger = void 0;
-exports.createLoggerContext = createLoggerContext;
-exports.setLogLevel = setLogLevel;
-exports.getLogLevel = getLogLevel;
-exports.createClientLogger = createClientLogger;
-const tslib_1 = __nccwpck_require__(1860);
-const debug_js_1 = tslib_1.__importDefault(__nccwpck_require__(6836));
-const TYPESPEC_RUNTIME_LOG_LEVELS = ["verbose", "info", "warning", "error"];
-const levelMap = {
- verbose: 400,
- info: 300,
- warning: 200,
- error: 100,
-};
-function patchLogMethod(parent, child) {
- child.log = (...args) => {
- parent.log(...args);
- };
-}
-function isTypeSpecRuntimeLogLevel(level) {
- return TYPESPEC_RUNTIME_LOG_LEVELS.includes(level);
-}
-/**
- * Creates a logger context base on the provided options.
- * @param options - The options for creating a logger context.
- * @returns The logger context.
- */
-function createLoggerContext(options) {
- const registeredLoggers = new Set();
- const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env[options.logLevelEnvVarName]) ||
- undefined;
- let logLevel;
- const clientLogger = (0, debug_js_1.default)(options.namespace);
- clientLogger.log = (...args) => {
- debug_js_1.default.log(...args);
- };
- if (logLevelFromEnv) {
- // avoid calling setLogLevel because we don't want a mis-set environment variable to crash
- if (isTypeSpecRuntimeLogLevel(logLevelFromEnv)) {
- setLogLevel(logLevelFromEnv);
- }
- else {
- console.error(`${options.logLevelEnvVarName} set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${TYPESPEC_RUNTIME_LOG_LEVELS.join(", ")}.`);
- }
- }
- function shouldEnable(logger) {
- return Boolean(logLevel && levelMap[logger.level] <= levelMap[logLevel]);
- }
- function createLogger(parent, level) {
- const logger = Object.assign(parent.extend(level), {
- level,
- });
- patchLogMethod(parent, logger);
- if (shouldEnable(logger)) {
- const enabledNamespaces = debug_js_1.default.disable();
- debug_js_1.default.enable(enabledNamespaces + "," + logger.namespace);
- }
- registeredLoggers.add(logger);
- return logger;
- }
- return {
- setLogLevel(level) {
- if (level && !isTypeSpecRuntimeLogLevel(level)) {
- throw new Error(`Unknown log level '${level}'. Acceptable values: ${TYPESPEC_RUNTIME_LOG_LEVELS.join(",")}`);
- }
- logLevel = level;
- const enabledNamespaces = [];
- for (const logger of registeredLoggers) {
- if (shouldEnable(logger)) {
- enabledNamespaces.push(logger.namespace);
- }
- }
- debug_js_1.default.enable(enabledNamespaces.join(","));
- },
- getLogLevel() {
- return logLevel;
- },
- createClientLogger(namespace) {
- const clientRootLogger = clientLogger.extend(namespace);
- patchLogMethod(clientLogger, clientRootLogger);
- return {
- error: createLogger(clientRootLogger, "error"),
- warning: createLogger(clientRootLogger, "warning"),
- info: createLogger(clientRootLogger, "info"),
- verbose: createLogger(clientRootLogger, "verbose"),
- };
- },
- logger: clientLogger,
- };
-}
-const context = createLoggerContext({
- logLevelEnvVarName: "TYPESPEC_RUNTIME_LOG_LEVEL",
- namespace: "typeSpecRuntime",
-});
-/**
- * Immediately enables logging at the specified log level. If no level is specified, logging is disabled.
- * @param level - The log level to enable for logging.
- * Options from most verbose to least verbose are:
- * - verbose
- * - info
- * - warning
- * - error
- */
-// eslint-disable-next-line @typescript-eslint/no-redeclare
-exports.TypeSpecRuntimeLogger = context.logger;
-/**
- * Retrieves the currently specified log level.
- */
-function setLogLevel(logLevel) {
- context.setLogLevel(logLevel);
-}
-/**
- * Retrieves the currently specified log level.
- */
-function getLogLevel() {
- return context.getLogLevel();
-}
-/**
- * Creates a logger for use by the SDKs that inherits from `TypeSpecRuntimeLogger`.
- * @param namespace - The name of the SDK package.
- * @hidden
- */
-function createClientLogger(namespace) {
- return context.createClientLogger(namespace);
-}
-//# sourceMappingURL=logger.js.map
-
-/***/ }),
-
-/***/ 1167:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getBodyLength = getBodyLength;
-exports.createNodeHttpClient = createNodeHttpClient;
-const tslib_1 = __nccwpck_require__(1860);
-const http = tslib_1.__importStar(__nccwpck_require__(7067));
-const https = tslib_1.__importStar(__nccwpck_require__(4708));
-const zlib = tslib_1.__importStar(__nccwpck_require__(8522));
-const node_stream_1 = __nccwpck_require__(7075);
-const AbortError_js_1 = __nccwpck_require__(9992);
-const httpHeaders_js_1 = __nccwpck_require__(4220);
-const restError_js_1 = __nccwpck_require__(9758);
-const log_js_1 = __nccwpck_require__(3644);
-const sanitizer_js_1 = __nccwpck_require__(7784);
-const DEFAULT_TLS_SETTINGS = {};
-function isReadableStream(body) {
- return body && typeof body.pipe === "function";
-}
-function isStreamComplete(stream) {
- if (stream.readable === false) {
- return Promise.resolve();
- }
- return new Promise((resolve) => {
- const handler = () => {
- resolve();
- stream.removeListener("close", handler);
- stream.removeListener("end", handler);
- stream.removeListener("error", handler);
- };
- stream.on("close", handler);
- stream.on("end", handler);
- stream.on("error", handler);
- });
-}
-function isArrayBuffer(body) {
- return body && typeof body.byteLength === "number";
-}
-class ReportTransform extends node_stream_1.Transform {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
- _transform(chunk, _encoding, callback) {
- this.push(chunk);
- this.loadedBytes += chunk.length;
- try {
- this.progressCallback({ loadedBytes: this.loadedBytes });
- callback();
- }
- catch (e) {
- callback(e);
- }
- }
- constructor(progressCallback) {
- super();
- this.loadedBytes = 0;
- this.progressCallback = progressCallback;
- }
-}
-/**
- * A HttpClient implementation that uses Node's "https" module to send HTTPS requests.
- * @internal
- */
-class NodeHttpClient {
- constructor() {
- this.cachedHttpsAgents = new WeakMap();
- }
- /**
- * Makes a request over an underlying transport layer and returns the response.
- * @param request - The request to be made.
- */
- async sendRequest(request) {
- var _a, _b, _c;
- const abortController = new AbortController();
- let abortListener;
- if (request.abortSignal) {
- if (request.abortSignal.aborted) {
- throw new AbortError_js_1.AbortError("The operation was aborted. Request has already been canceled.");
- }
- abortListener = (event) => {
- if (event.type === "abort") {
- abortController.abort();
- }
- };
- request.abortSignal.addEventListener("abort", abortListener);
- }
- let timeoutId;
- if (request.timeout > 0) {
- timeoutId = setTimeout(() => {
- const sanitizer = new sanitizer_js_1.Sanitizer();
- log_js_1.logger.info(`request to '${sanitizer.sanitizeUrl(request.url)}' timed out. canceling...`);
- abortController.abort();
- }, request.timeout);
- }
- const acceptEncoding = request.headers.get("Accept-Encoding");
- const shouldDecompress = (acceptEncoding === null || acceptEncoding === void 0 ? void 0 : acceptEncoding.includes("gzip")) || (acceptEncoding === null || acceptEncoding === void 0 ? void 0 : acceptEncoding.includes("deflate"));
- let body = typeof request.body === "function" ? request.body() : request.body;
- if (body && !request.headers.has("Content-Length")) {
- const bodyLength = getBodyLength(body);
- if (bodyLength !== null) {
- request.headers.set("Content-Length", bodyLength);
- }
- }
- let responseStream;
- try {
- if (body && request.onUploadProgress) {
- const onUploadProgress = request.onUploadProgress;
- const uploadReportStream = new ReportTransform(onUploadProgress);
- uploadReportStream.on("error", (e) => {
- log_js_1.logger.error("Error in upload progress", e);
- });
- if (isReadableStream(body)) {
- body.pipe(uploadReportStream);
- }
- else {
- uploadReportStream.end(body);
- }
- body = uploadReportStream;
- }
- const res = await this.makeRequest(request, abortController, body);
- if (timeoutId !== undefined) {
- clearTimeout(timeoutId);
- }
- const headers = getResponseHeaders(res);
- const status = (_a = res.statusCode) !== null && _a !== void 0 ? _a : 0;
- const response = {
- status,
- headers,
- request,
- };
- // Responses to HEAD must not have a body.
- // If they do return a body, that body must be ignored.
- if (request.method === "HEAD") {
- // call resume() and not destroy() to avoid closing the socket
- // and losing keep alive
- res.resume();
- return response;
- }
- responseStream = shouldDecompress ? getDecodedResponseStream(res, headers) : res;
- const onDownloadProgress = request.onDownloadProgress;
- if (onDownloadProgress) {
- const downloadReportStream = new ReportTransform(onDownloadProgress);
- downloadReportStream.on("error", (e) => {
- log_js_1.logger.error("Error in download progress", e);
- });
- responseStream.pipe(downloadReportStream);
- responseStream = downloadReportStream;
- }
- if (
- // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code
- ((_b = request.streamResponseStatusCodes) === null || _b === void 0 ? void 0 : _b.has(Number.POSITIVE_INFINITY)) ||
- ((_c = request.streamResponseStatusCodes) === null || _c === void 0 ? void 0 : _c.has(response.status))) {
- response.readableStreamBody = responseStream;
- }
- else {
- response.bodyAsText = await streamToText(responseStream);
- }
- return response;
- }
- finally {
- // clean up event listener
- if (request.abortSignal && abortListener) {
- let uploadStreamDone = Promise.resolve();
- if (isReadableStream(body)) {
- uploadStreamDone = isStreamComplete(body);
- }
- let downloadStreamDone = Promise.resolve();
- if (isReadableStream(responseStream)) {
- downloadStreamDone = isStreamComplete(responseStream);
- }
- Promise.all([uploadStreamDone, downloadStreamDone])
- .then(() => {
- var _a;
- // eslint-disable-next-line promise/always-return
- if (abortListener) {
- (_a = request.abortSignal) === null || _a === void 0 ? void 0 : _a.removeEventListener("abort", abortListener);
- }
- })
- .catch((e) => {
- log_js_1.logger.warning("Error when cleaning up abortListener on httpRequest", e);
- });
- }
- }
- }
- makeRequest(request, abortController, body) {
- var _a;
- const url = new URL(request.url);
- const isInsecure = url.protocol !== "https:";
- if (isInsecure && !request.allowInsecureConnection) {
- throw new Error(`Cannot connect to ${request.url} while allowInsecureConnection is false.`);
- }
- const agent = (_a = request.agent) !== null && _a !== void 0 ? _a : this.getOrCreateAgent(request, isInsecure);
- const options = Object.assign({ agent, hostname: url.hostname, path: `${url.pathname}${url.search}`, port: url.port, method: request.method, headers: request.headers.toJSON({ preserveCase: true }) }, request.requestOverrides);
- return new Promise((resolve, reject) => {
- const req = isInsecure ? http.request(options, resolve) : https.request(options, resolve);
- req.once("error", (err) => {
- var _a;
- reject(new restError_js_1.RestError(err.message, { code: (_a = err.code) !== null && _a !== void 0 ? _a : restError_js_1.RestError.REQUEST_SEND_ERROR, request }));
- });
- abortController.signal.addEventListener("abort", () => {
- const abortError = new AbortError_js_1.AbortError("The operation was aborted. Rejecting from abort signal callback while making request.");
- req.destroy(abortError);
- reject(abortError);
- });
- if (body && isReadableStream(body)) {
- body.pipe(req);
- }
- else if (body) {
- if (typeof body === "string" || Buffer.isBuffer(body)) {
- req.end(body);
- }
- else if (isArrayBuffer(body)) {
- req.end(ArrayBuffer.isView(body) ? Buffer.from(body.buffer) : Buffer.from(body));
- }
- else {
- log_js_1.logger.error("Unrecognized body type", body);
- reject(new restError_js_1.RestError("Unrecognized body type"));
- }
- }
- else {
- // streams don't like "undefined" being passed as data
- req.end();
- }
- });
- }
- getOrCreateAgent(request, isInsecure) {
- var _a;
- const disableKeepAlive = request.disableKeepAlive;
- // Handle Insecure requests first
- if (isInsecure) {
- if (disableKeepAlive) {
- // keepAlive:false is the default so we don't need a custom Agent
- return http.globalAgent;
- }
- if (!this.cachedHttpAgent) {
- // If there is no cached agent create a new one and cache it.
- this.cachedHttpAgent = new http.Agent({ keepAlive: true });
- }
- return this.cachedHttpAgent;
- }
- else {
- if (disableKeepAlive && !request.tlsSettings) {
- // When there are no tlsSettings and keepAlive is false
- // we don't need a custom agent
- return https.globalAgent;
- }
- // We use the tlsSettings to index cached clients
- const tlsSettings = (_a = request.tlsSettings) !== null && _a !== void 0 ? _a : DEFAULT_TLS_SETTINGS;
- // Get the cached agent or create a new one with the
- // provided values for keepAlive and tlsSettings
- let agent = this.cachedHttpsAgents.get(tlsSettings);
- if (agent && agent.options.keepAlive === !disableKeepAlive) {
- return agent;
- }
- log_js_1.logger.info("No cached TLS Agent exist, creating a new Agent");
- agent = new https.Agent(Object.assign({
- // keepAlive is true if disableKeepAlive is false.
- keepAlive: !disableKeepAlive }, tlsSettings));
- this.cachedHttpsAgents.set(tlsSettings, agent);
- return agent;
- }
- }
-}
-function getResponseHeaders(res) {
- const headers = (0, httpHeaders_js_1.createHttpHeaders)();
- for (const header of Object.keys(res.headers)) {
- const value = res.headers[header];
- if (Array.isArray(value)) {
- if (value.length > 0) {
- headers.set(header, value[0]);
- }
- }
- else if (value) {
- headers.set(header, value);
- }
- }
- return headers;
-}
-function getDecodedResponseStream(stream, headers) {
- const contentEncoding = headers.get("Content-Encoding");
- if (contentEncoding === "gzip") {
- const unzip = zlib.createGunzip();
- stream.pipe(unzip);
- return unzip;
- }
- else if (contentEncoding === "deflate") {
- const inflate = zlib.createInflate();
- stream.pipe(inflate);
- return inflate;
- }
- return stream;
-}
-function streamToText(stream) {
- return new Promise((resolve, reject) => {
- const buffer = [];
- stream.on("data", (chunk) => {
- if (Buffer.isBuffer(chunk)) {
- buffer.push(chunk);
- }
- else {
- buffer.push(Buffer.from(chunk));
- }
- });
- stream.on("end", () => {
- resolve(Buffer.concat(buffer).toString("utf8"));
- });
- stream.on("error", (e) => {
- if (e && (e === null || e === void 0 ? void 0 : e.name) === "AbortError") {
- reject(e);
- }
- else {
- reject(new restError_js_1.RestError(`Error reading response as text: ${e.message}`, {
- code: restError_js_1.RestError.PARSE_ERROR,
- }));
- }
- });
- });
-}
-/** @internal */
-function getBodyLength(body) {
- if (!body) {
- return 0;
- }
- else if (Buffer.isBuffer(body)) {
- return body.length;
- }
- else if (isReadableStream(body)) {
- return null;
- }
- else if (isArrayBuffer(body)) {
- return body.byteLength;
- }
- else if (typeof body === "string") {
- return Buffer.from(body).length;
- }
- else {
- return null;
- }
-}
-/**
- * Create a new HttpClient instance for the NodeJS environment.
- * @internal
- */
-function createNodeHttpClient() {
- return new NodeHttpClient();
-}
-//# sourceMappingURL=nodeHttpClient.js.map
-
-/***/ }),
-
-/***/ 9957:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createEmptyPipeline = createEmptyPipeline;
-const ValidPhaseNames = new Set(["Deserialize", "Serialize", "Retry", "Sign"]);
-/**
- * A private implementation of Pipeline.
- * Do not export this class from the package.
- * @internal
- */
-class HttpPipeline {
- constructor(policies) {
- var _a;
- this._policies = [];
- this._policies = (_a = policies === null || policies === void 0 ? void 0 : policies.slice(0)) !== null && _a !== void 0 ? _a : [];
- this._orderedPolicies = undefined;
- }
- addPolicy(policy, options = {}) {
- if (options.phase && options.afterPhase) {
- throw new Error("Policies inside a phase cannot specify afterPhase.");
- }
- if (options.phase && !ValidPhaseNames.has(options.phase)) {
- throw new Error(`Invalid phase name: ${options.phase}`);
- }
- if (options.afterPhase && !ValidPhaseNames.has(options.afterPhase)) {
- throw new Error(`Invalid afterPhase name: ${options.afterPhase}`);
- }
- this._policies.push({
- policy,
- options,
- });
- this._orderedPolicies = undefined;
- }
- removePolicy(options) {
- const removedPolicies = [];
- this._policies = this._policies.filter((policyDescriptor) => {
- if ((options.name && policyDescriptor.policy.name === options.name) ||
- (options.phase && policyDescriptor.options.phase === options.phase)) {
- removedPolicies.push(policyDescriptor.policy);
- return false;
- }
- else {
- return true;
- }
- });
- this._orderedPolicies = undefined;
- return removedPolicies;
- }
- sendRequest(httpClient, request) {
- const policies = this.getOrderedPolicies();
- const pipeline = policies.reduceRight((next, policy) => {
- return (req) => {
- return policy.sendRequest(req, next);
- };
- }, (req) => httpClient.sendRequest(req));
- return pipeline(request);
- }
- getOrderedPolicies() {
- if (!this._orderedPolicies) {
- this._orderedPolicies = this.orderPolicies();
- }
- return this._orderedPolicies;
- }
- clone() {
- return new HttpPipeline(this._policies);
- }
- static create() {
- return new HttpPipeline();
- }
- orderPolicies() {
- /**
- * The goal of this method is to reliably order pipeline policies
- * based on their declared requirements when they were added.
- *
- * Order is first determined by phase:
- *
- * 1. Serialize Phase
- * 2. Policies not in a phase
- * 3. Deserialize Phase
- * 4. Retry Phase
- * 5. Sign Phase
- *
- * Within each phase, policies are executed in the order
- * they were added unless they were specified to execute
- * before/after other policies or after a particular phase.
- *
- * To determine the final order, we will walk the policy list
- * in phase order multiple times until all dependencies are
- * satisfied.
- *
- * `afterPolicies` are the set of policies that must be
- * executed before a given policy. This requirement is
- * considered satisfied when each of the listed policies
- * have been scheduled.
- *
- * `beforePolicies` are the set of policies that must be
- * executed after a given policy. Since this dependency
- * can be expressed by converting it into a equivalent
- * `afterPolicies` declarations, they are normalized
- * into that form for simplicity.
- *
- * An `afterPhase` dependency is considered satisfied when all
- * policies in that phase have scheduled.
- *
- */
- const result = [];
- // Track all policies we know about.
- const policyMap = new Map();
- function createPhase(name) {
- return {
- name,
- policies: new Set(),
- hasRun: false,
- hasAfterPolicies: false,
- };
- }
- // Track policies for each phase.
- const serializePhase = createPhase("Serialize");
- const noPhase = createPhase("None");
- const deserializePhase = createPhase("Deserialize");
- const retryPhase = createPhase("Retry");
- const signPhase = createPhase("Sign");
- // a list of phases in order
- const orderedPhases = [serializePhase, noPhase, deserializePhase, retryPhase, signPhase];
- // Small helper function to map phase name to each Phase
- function getPhase(phase) {
- if (phase === "Retry") {
- return retryPhase;
- }
- else if (phase === "Serialize") {
- return serializePhase;
- }
- else if (phase === "Deserialize") {
- return deserializePhase;
- }
- else if (phase === "Sign") {
- return signPhase;
- }
- else {
- return noPhase;
- }
- }
- // First walk each policy and create a node to track metadata.
- for (const descriptor of this._policies) {
- const policy = descriptor.policy;
- const options = descriptor.options;
- const policyName = policy.name;
- if (policyMap.has(policyName)) {
- throw new Error("Duplicate policy names not allowed in pipeline");
- }
- const node = {
- policy,
- dependsOn: new Set(),
- dependants: new Set(),
- };
- if (options.afterPhase) {
- node.afterPhase = getPhase(options.afterPhase);
- node.afterPhase.hasAfterPolicies = true;
- }
- policyMap.set(policyName, node);
- const phase = getPhase(options.phase);
- phase.policies.add(node);
- }
- // Now that each policy has a node, connect dependency references.
- for (const descriptor of this._policies) {
- const { policy, options } = descriptor;
- const policyName = policy.name;
- const node = policyMap.get(policyName);
- if (!node) {
- throw new Error(`Missing node for policy ${policyName}`);
- }
- if (options.afterPolicies) {
- for (const afterPolicyName of options.afterPolicies) {
- const afterNode = policyMap.get(afterPolicyName);
- if (afterNode) {
- // Linking in both directions helps later
- // when we want to notify dependants.
- node.dependsOn.add(afterNode);
- afterNode.dependants.add(node);
- }
- }
- }
- if (options.beforePolicies) {
- for (const beforePolicyName of options.beforePolicies) {
- const beforeNode = policyMap.get(beforePolicyName);
- if (beforeNode) {
- // To execute before another node, make it
- // depend on the current node.
- beforeNode.dependsOn.add(node);
- node.dependants.add(beforeNode);
- }
- }
- }
- }
- function walkPhase(phase) {
- phase.hasRun = true;
- // Sets iterate in insertion order
- for (const node of phase.policies) {
- if (node.afterPhase && (!node.afterPhase.hasRun || node.afterPhase.policies.size)) {
- // If this node is waiting on a phase to complete,
- // we need to skip it for now.
- // Even if the phase is empty, we should wait for it
- // to be walked to avoid re-ordering policies.
- continue;
- }
- if (node.dependsOn.size === 0) {
- // If there's nothing else we're waiting for, we can
- // add this policy to the result list.
- result.push(node.policy);
- // Notify anything that depends on this policy that
- // the policy has been scheduled.
- for (const dependant of node.dependants) {
- dependant.dependsOn.delete(node);
- }
- policyMap.delete(node.policy.name);
- phase.policies.delete(node);
- }
- }
- }
- function walkPhases() {
- for (const phase of orderedPhases) {
- walkPhase(phase);
- // if the phase isn't complete
- if (phase.policies.size > 0 && phase !== noPhase) {
- if (!noPhase.hasRun) {
- // Try running noPhase to see if that unblocks this phase next tick.
- // This can happen if a phase that happens before noPhase
- // is waiting on a noPhase policy to complete.
- walkPhase(noPhase);
- }
- // Don't proceed to the next phase until this phase finishes.
- return;
- }
- if (phase.hasAfterPolicies) {
- // Run any policies unblocked by this phase
- walkPhase(noPhase);
- }
- }
- }
- // Iterate until we've put every node in the result list.
- let iteration = 0;
- while (policyMap.size > 0) {
- iteration++;
- const initialResultLength = result.length;
- // Keep walking each phase in order until we can order every node.
- walkPhases();
- // The result list *should* get at least one larger each time
- // after the first full pass.
- // Otherwise, we're going to loop forever.
- if (result.length <= initialResultLength && iteration > 1) {
- throw new Error("Cannot satisfy policy dependencies due to requirements cycle.");
- }
- }
- return result;
- }
-}
-/**
- * Creates a totally empty pipeline.
- * Useful for testing or creating a custom one.
- */
-function createEmptyPipeline() {
- return HttpPipeline.create();
-}
-//# sourceMappingURL=pipeline.js.map
-
-/***/ }),
-
-/***/ 2305:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.createPipelineRequest = createPipelineRequest;
-const httpHeaders_js_1 = __nccwpck_require__(4220);
-const uuidUtils_js_1 = __nccwpck_require__(5023);
-class PipelineRequestImpl {
- constructor(options) {
- var _a, _b, _c, _d, _e, _f, _g;
- this.url = options.url;
- this.body = options.body;
- this.headers = (_a = options.headers) !== null && _a !== void 0 ? _a : (0, httpHeaders_js_1.createHttpHeaders)();
- this.method = (_b = options.method) !== null && _b !== void 0 ? _b : "GET";
- this.timeout = (_c = options.timeout) !== null && _c !== void 0 ? _c : 0;
- this.multipartBody = options.multipartBody;
- this.formData = options.formData;
- this.disableKeepAlive = (_d = options.disableKeepAlive) !== null && _d !== void 0 ? _d : false;
- this.proxySettings = options.proxySettings;
- this.streamResponseStatusCodes = options.streamResponseStatusCodes;
- this.withCredentials = (_e = options.withCredentials) !== null && _e !== void 0 ? _e : false;
- this.abortSignal = options.abortSignal;
- this.onUploadProgress = options.onUploadProgress;
- this.onDownloadProgress = options.onDownloadProgress;
- this.requestId = options.requestId || (0, uuidUtils_js_1.randomUUID)();
- this.allowInsecureConnection = (_f = options.allowInsecureConnection) !== null && _f !== void 0 ? _f : false;
- this.enableBrowserStreams = (_g = options.enableBrowserStreams) !== null && _g !== void 0 ? _g : false;
- this.requestOverrides = options.requestOverrides;
- }
-}
-/**
- * Creates a new pipeline request with the given options.
- * This method is to allow for the easy setting of default values and not required.
- * @param options - The options to create the request with.
- */
-function createPipelineRequest(options) {
- return new PipelineRequestImpl(options);
-}
-//# sourceMappingURL=pipelineRequest.js.map
-
-/***/ }),
-
-/***/ 5366:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.agentPolicyName = void 0;
-exports.agentPolicy = agentPolicy;
-/**
- * Name of the Agent Policy
- */
-exports.agentPolicyName = "agentPolicy";
-/**
- * Gets a pipeline policy that sets http.agent
- */
-function agentPolicy(agent) {
- return {
- name: exports.agentPolicyName,
- sendRequest: async (req, next) => {
- // Users may define an agent on the request, honor it over the client level one
- if (!req.agent) {
- req.agent = agent;
- }
- return next(req);
- },
- };
-}
-//# sourceMappingURL=agentPolicy.js.map
-
-/***/ }),
-
-/***/ 2095:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.apiKeyAuthenticationPolicyName = void 0;
-exports.apiKeyAuthenticationPolicy = apiKeyAuthenticationPolicy;
-const checkInsecureConnection_js_1 = __nccwpck_require__(2302);
-/**
- * Name of the API Key Authentication Policy
- */
-exports.apiKeyAuthenticationPolicyName = "apiKeyAuthenticationPolicy";
-/**
- * Gets a pipeline policy that adds API key authentication to requests
- */
-function apiKeyAuthenticationPolicy(options) {
- return {
- name: exports.apiKeyAuthenticationPolicyName,
- async sendRequest(request, next) {
- var _a, _b;
- // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
- (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options);
- const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "apiKey");
- // Skip adding authentication header if no API key authentication scheme is found
- if (!scheme) {
- return next(request);
- }
- if (scheme.apiKeyLocation !== "header") {
- throw new Error(`Unsupported API key location: ${scheme.apiKeyLocation}`);
- }
- request.headers.set(scheme.name, options.credential.key);
- return next(request);
- },
- };
-}
-//# sourceMappingURL=apiKeyAuthenticationPolicy.js.map
-
-/***/ }),
-
-/***/ 5756:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.basicAuthenticationPolicyName = void 0;
-exports.basicAuthenticationPolicy = basicAuthenticationPolicy;
-const bytesEncoding_js_1 = __nccwpck_require__(2921);
-const checkInsecureConnection_js_1 = __nccwpck_require__(2302);
-/**
- * Name of the Basic Authentication Policy
- */
-exports.basicAuthenticationPolicyName = "bearerAuthenticationPolicy";
-/**
- * Gets a pipeline policy that adds basic authentication to requests
- */
-function basicAuthenticationPolicy(options) {
- return {
- name: exports.basicAuthenticationPolicyName,
- async sendRequest(request, next) {
- var _a, _b;
- // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
- (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options);
- const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "http" && x.scheme === "basic");
- // Skip adding authentication header if no basic authentication scheme is found
- if (!scheme) {
- return next(request);
- }
- const { username, password } = options.credential;
- const headerValue = (0, bytesEncoding_js_1.uint8ArrayToString)((0, bytesEncoding_js_1.stringToUint8Array)(`${username}:${password}`, "utf-8"), "base64");
- request.headers.set("Authorization", `Basic ${headerValue}`);
- return next(request);
- },
- };
-}
-//# sourceMappingURL=basicAuthenticationPolicy.js.map
-
-/***/ }),
-
-/***/ 9709:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.bearerAuthenticationPolicyName = void 0;
-exports.bearerAuthenticationPolicy = bearerAuthenticationPolicy;
-const checkInsecureConnection_js_1 = __nccwpck_require__(2302);
-/**
- * Name of the Bearer Authentication Policy
- */
-exports.bearerAuthenticationPolicyName = "bearerAuthenticationPolicy";
-/**
- * Gets a pipeline policy that adds bearer token authentication to requests
- */
-function bearerAuthenticationPolicy(options) {
- return {
- name: exports.bearerAuthenticationPolicyName,
- async sendRequest(request, next) {
- var _a, _b;
- // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
- (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options);
- const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "http" && x.scheme === "bearer");
- // Skip adding authentication header if no bearer authentication scheme is found
- if (!scheme) {
- return next(request);
- }
- const token = await options.credential.getBearerToken({
- abortSignal: request.abortSignal,
- });
- request.headers.set("Authorization", `Bearer ${token}`);
- return next(request);
- },
- };
-}
-//# sourceMappingURL=bearerAuthenticationPolicy.js.map
-
-/***/ }),
-
-/***/ 2302:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.ensureSecureConnection = ensureSecureConnection;
-const log_js_1 = __nccwpck_require__(3644);
-// Ensure the warining is only emitted once
-let insecureConnectionWarningEmmitted = false;
-/**
- * Checks if the request is allowed to be sent over an insecure connection.
- *
- * A request is allowed to be sent over an insecure connection when:
- * - The `allowInsecureConnection` option is set to `true`.
- * - The request has the `allowInsecureConnection` property set to `true`.
- * - The request is being sent to `localhost` or `127.0.0.1`
- */
-function allowInsecureConnection(request, options) {
- if (options.allowInsecureConnection && request.allowInsecureConnection) {
- const url = new URL(request.url);
- if (url.hostname === "localhost" || url.hostname === "127.0.0.1") {
- return true;
- }
- }
- return false;
-}
-/**
- * Logs a warning about sending a token over an insecure connection.
- *
- * This function will emit a node warning once, but log the warning every time.
- */
-function emitInsecureConnectionWarning() {
- const warning = "Sending token over insecure transport. Assume any token issued is compromised.";
- log_js_1.logger.warning(warning);
- if (typeof (process === null || process === void 0 ? void 0 : process.emitWarning) === "function" && !insecureConnectionWarningEmmitted) {
- insecureConnectionWarningEmmitted = true;
- process.emitWarning(warning);
- }
-}
-/**
- * Ensures that authentication is only allowed over HTTPS unless explicitly allowed.
- * Throws an error if the connection is not secure and not explicitly allowed.
- */
-function ensureSecureConnection(request, options) {
- if (!request.url.toLowerCase().startsWith("https://")) {
- if (allowInsecureConnection(request, options)) {
- emitInsecureConnectionWarning();
- }
- else {
- throw new Error("Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false.");
- }
- }
-}
-//# sourceMappingURL=checkInsecureConnection.js.map
-
-/***/ }),
-
-/***/ 219:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.oauth2AuthenticationPolicyName = void 0;
-exports.oauth2AuthenticationPolicy = oauth2AuthenticationPolicy;
-const checkInsecureConnection_js_1 = __nccwpck_require__(2302);
-/**
- * Name of the OAuth2 Authentication Policy
- */
-exports.oauth2AuthenticationPolicyName = "oauth2AuthenticationPolicy";
-/**
- * Gets a pipeline policy that adds authorization header from OAuth2 schemes
- */
-function oauth2AuthenticationPolicy(options) {
- return {
- name: exports.oauth2AuthenticationPolicyName,
- async sendRequest(request, next) {
- var _a, _b;
- // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
- (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options);
- const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "oauth2");
- // Skip adding authentication header if no OAuth2 authentication scheme is found
- if (!scheme) {
- return next(request);
- }
- const token = await options.credential.getOAuth2Token(scheme.flows, {
- abortSignal: request.abortSignal,
- });
- request.headers.set("Authorization", `Bearer ${token}`);
- return next(request);
- },
- };
-}
-//# sourceMappingURL=oauth2AuthenticationPolicy.js.map
-
-/***/ }),
-
-/***/ 5035:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.decompressResponsePolicyName = void 0;
-exports.decompressResponsePolicy = decompressResponsePolicy;
-/**
- * The programmatic identifier of the decompressResponsePolicy.
- */
-exports.decompressResponsePolicyName = "decompressResponsePolicy";
-/**
- * A policy to enable response decompression according to Accept-Encoding header
- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding
- */
-function decompressResponsePolicy() {
- return {
- name: exports.decompressResponsePolicyName,
- async sendRequest(request, next) {
- // HEAD requests have no body
- if (request.method !== "HEAD") {
- request.headers.set("Accept-Encoding", "gzip,deflate");
- }
- return next(request);
- },
- };
-}
-//# sourceMappingURL=decompressResponsePolicy.js.map
-
-/***/ }),
-
-/***/ 2462:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.defaultRetryPolicyName = void 0;
-exports.defaultRetryPolicy = defaultRetryPolicy;
-const exponentialRetryStrategy_js_1 = __nccwpck_require__(8102);
-const throttlingRetryStrategy_js_1 = __nccwpck_require__(1112);
-const retryPolicy_js_1 = __nccwpck_require__(3345);
-const constants_js_1 = __nccwpck_require__(1255);
-/**
- * Name of the {@link defaultRetryPolicy}
- */
-exports.defaultRetryPolicyName = "defaultRetryPolicy";
-/**
- * A policy that retries according to three strategies:
- * - When the server sends a 429 response with a Retry-After header.
- * - When there are errors in the underlying transport layer (e.g. DNS lookup failures).
- * - Or otherwise if the outgoing request fails, it will retry with an exponentially increasing delay.
- */
-function defaultRetryPolicy(options = {}) {
- var _a;
- return {
- name: exports.defaultRetryPolicyName,
- sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)(), (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)(options)], {
- maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
- }).sendRequest,
- };
-}
-//# sourceMappingURL=defaultRetryPolicy.js.map
-
-/***/ }),
-
-/***/ 4656:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.exponentialRetryPolicyName = void 0;
-exports.exponentialRetryPolicy = exponentialRetryPolicy;
-const exponentialRetryStrategy_js_1 = __nccwpck_require__(8102);
-const retryPolicy_js_1 = __nccwpck_require__(3345);
-const constants_js_1 = __nccwpck_require__(1255);
-/**
- * The programmatic identifier of the exponentialRetryPolicy.
- */
-exports.exponentialRetryPolicyName = "exponentialRetryPolicy";
-/**
- * A policy that attempts to retry requests while introducing an exponentially increasing delay.
- * @param options - Options that configure retry logic.
- */
-function exponentialRetryPolicy(options = {}) {
- var _a;
- return (0, retryPolicy_js_1.retryPolicy)([
- (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)(Object.assign(Object.assign({}, options), { ignoreSystemErrors: true })),
- ], {
- maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
- });
-}
-//# sourceMappingURL=exponentialRetryPolicy.js.map
-
-/***/ }),
-
-/***/ 4197:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.formDataPolicyName = void 0;
-exports.formDataPolicy = formDataPolicy;
-const bytesEncoding_js_1 = __nccwpck_require__(2921);
-const checkEnvironment_js_1 = __nccwpck_require__(5086);
-const httpHeaders_js_1 = __nccwpck_require__(4220);
-/**
- * The programmatic identifier of the formDataPolicy.
- */
-exports.formDataPolicyName = "formDataPolicy";
-function formDataToFormDataMap(formData) {
- var _a;
- const formDataMap = {};
- for (const [key, value] of formData.entries()) {
- (_a = formDataMap[key]) !== null && _a !== void 0 ? _a : (formDataMap[key] = []);
- formDataMap[key].push(value);
- }
- return formDataMap;
-}
-/**
- * A policy that encodes FormData on the request into the body.
- */
-function formDataPolicy() {
- return {
- name: exports.formDataPolicyName,
- async sendRequest(request, next) {
- if (checkEnvironment_js_1.isNodeLike && typeof FormData !== "undefined" && request.body instanceof FormData) {
- request.formData = formDataToFormDataMap(request.body);
- request.body = undefined;
- }
- if (request.formData) {
- const contentType = request.headers.get("Content-Type");
- if (contentType && contentType.indexOf("application/x-www-form-urlencoded") !== -1) {
- request.body = wwwFormUrlEncode(request.formData);
- }
- else {
- await prepareFormData(request.formData, request);
- }
- request.formData = undefined;
- }
- return next(request);
- },
- };
-}
-function wwwFormUrlEncode(formData) {
- const urlSearchParams = new URLSearchParams();
- for (const [key, value] of Object.entries(formData)) {
- if (Array.isArray(value)) {
- for (const subValue of value) {
- urlSearchParams.append(key, subValue.toString());
- }
- }
- else {
- urlSearchParams.append(key, value.toString());
- }
- }
- return urlSearchParams.toString();
-}
-async function prepareFormData(formData, request) {
- // validate content type (multipart/form-data)
- const contentType = request.headers.get("Content-Type");
- if (contentType && !contentType.startsWith("multipart/form-data")) {
- // content type is specified and is not multipart/form-data. Exit.
- return;
- }
- request.headers.set("Content-Type", contentType !== null && contentType !== void 0 ? contentType : "multipart/form-data");
- // set body to MultipartRequestBody using content from FormDataMap
- const parts = [];
- for (const [fieldName, values] of Object.entries(formData)) {
- for (const value of Array.isArray(values) ? values : [values]) {
- if (typeof value === "string") {
- parts.push({
- headers: (0, httpHeaders_js_1.createHttpHeaders)({
- "Content-Disposition": `form-data; name="${fieldName}"`,
- }),
- body: (0, bytesEncoding_js_1.stringToUint8Array)(value, "utf-8"),
- });
- }
- else if (value === undefined || value === null || typeof value !== "object") {
- throw new Error(`Unexpected value for key ${fieldName}: ${value}. Value should be serialized to string first.`);
- }
- else {
- // using || instead of ?? here since if value.name is empty we should create a file name
- const fileName = value.name || "blob";
- const headers = (0, httpHeaders_js_1.createHttpHeaders)();
- headers.set("Content-Disposition", `form-data; name="${fieldName}"; filename="${fileName}"`);
- // again, || is used since an empty value.type means the content type is unset
- headers.set("Content-Type", value.type || "application/octet-stream");
- parts.push({
- headers,
- body: value,
- });
- }
- }
- }
- request.multipartBody = { parts };
-}
-//# sourceMappingURL=formDataPolicy.js.map
-
-/***/ }),
-
-/***/ 4960:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.userAgentPolicyName = exports.userAgentPolicy = exports.tlsPolicyName = exports.tlsPolicy = exports.redirectPolicyName = exports.redirectPolicy = exports.getDefaultProxySettings = exports.proxyPolicyName = exports.proxyPolicy = exports.multipartPolicyName = exports.multipartPolicy = exports.logPolicyName = exports.logPolicy = exports.formDataPolicyName = exports.formDataPolicy = exports.throttlingRetryPolicyName = exports.throttlingRetryPolicy = exports.systemErrorRetryPolicyName = exports.systemErrorRetryPolicy = exports.retryPolicy = exports.exponentialRetryPolicyName = exports.exponentialRetryPolicy = exports.defaultRetryPolicyName = exports.defaultRetryPolicy = exports.decompressResponsePolicyName = exports.decompressResponsePolicy = exports.agentPolicyName = exports.agentPolicy = void 0;
-var agentPolicy_js_1 = __nccwpck_require__(5366);
-Object.defineProperty(exports, "agentPolicy", ({ enumerable: true, get: function () { return agentPolicy_js_1.agentPolicy; } }));
-Object.defineProperty(exports, "agentPolicyName", ({ enumerable: true, get: function () { return agentPolicy_js_1.agentPolicyName; } }));
-var decompressResponsePolicy_js_1 = __nccwpck_require__(5035);
-Object.defineProperty(exports, "decompressResponsePolicy", ({ enumerable: true, get: function () { return decompressResponsePolicy_js_1.decompressResponsePolicy; } }));
-Object.defineProperty(exports, "decompressResponsePolicyName", ({ enumerable: true, get: function () { return decompressResponsePolicy_js_1.decompressResponsePolicyName; } }));
-var defaultRetryPolicy_js_1 = __nccwpck_require__(2462);
-Object.defineProperty(exports, "defaultRetryPolicy", ({ enumerable: true, get: function () { return defaultRetryPolicy_js_1.defaultRetryPolicy; } }));
-Object.defineProperty(exports, "defaultRetryPolicyName", ({ enumerable: true, get: function () { return defaultRetryPolicy_js_1.defaultRetryPolicyName; } }));
-var exponentialRetryPolicy_js_1 = __nccwpck_require__(4656);
-Object.defineProperty(exports, "exponentialRetryPolicy", ({ enumerable: true, get: function () { return exponentialRetryPolicy_js_1.exponentialRetryPolicy; } }));
-Object.defineProperty(exports, "exponentialRetryPolicyName", ({ enumerable: true, get: function () { return exponentialRetryPolicy_js_1.exponentialRetryPolicyName; } }));
-var retryPolicy_js_1 = __nccwpck_require__(3345);
-Object.defineProperty(exports, "retryPolicy", ({ enumerable: true, get: function () { return retryPolicy_js_1.retryPolicy; } }));
-var systemErrorRetryPolicy_js_1 = __nccwpck_require__(2418);
-Object.defineProperty(exports, "systemErrorRetryPolicy", ({ enumerable: true, get: function () { return systemErrorRetryPolicy_js_1.systemErrorRetryPolicy; } }));
-Object.defineProperty(exports, "systemErrorRetryPolicyName", ({ enumerable: true, get: function () { return systemErrorRetryPolicy_js_1.systemErrorRetryPolicyName; } }));
-var throttlingRetryPolicy_js_1 = __nccwpck_require__(4728);
-Object.defineProperty(exports, "throttlingRetryPolicy", ({ enumerable: true, get: function () { return throttlingRetryPolicy_js_1.throttlingRetryPolicy; } }));
-Object.defineProperty(exports, "throttlingRetryPolicyName", ({ enumerable: true, get: function () { return throttlingRetryPolicy_js_1.throttlingRetryPolicyName; } }));
-var formDataPolicy_js_1 = __nccwpck_require__(4197);
-Object.defineProperty(exports, "formDataPolicy", ({ enumerable: true, get: function () { return formDataPolicy_js_1.formDataPolicy; } }));
-Object.defineProperty(exports, "formDataPolicyName", ({ enumerable: true, get: function () { return formDataPolicy_js_1.formDataPolicyName; } }));
-var logPolicy_js_1 = __nccwpck_require__(7129);
-Object.defineProperty(exports, "logPolicy", ({ enumerable: true, get: function () { return logPolicy_js_1.logPolicy; } }));
-Object.defineProperty(exports, "logPolicyName", ({ enumerable: true, get: function () { return logPolicy_js_1.logPolicyName; } }));
-var multipartPolicy_js_1 = __nccwpck_require__(7427);
-Object.defineProperty(exports, "multipartPolicy", ({ enumerable: true, get: function () { return multipartPolicy_js_1.multipartPolicy; } }));
-Object.defineProperty(exports, "multipartPolicyName", ({ enumerable: true, get: function () { return multipartPolicy_js_1.multipartPolicyName; } }));
-var proxyPolicy_js_1 = __nccwpck_require__(67);
-Object.defineProperty(exports, "proxyPolicy", ({ enumerable: true, get: function () { return proxyPolicy_js_1.proxyPolicy; } }));
-Object.defineProperty(exports, "proxyPolicyName", ({ enumerable: true, get: function () { return proxyPolicy_js_1.proxyPolicyName; } }));
-Object.defineProperty(exports, "getDefaultProxySettings", ({ enumerable: true, get: function () { return proxyPolicy_js_1.getDefaultProxySettings; } }));
-var redirectPolicy_js_1 = __nccwpck_require__(2187);
-Object.defineProperty(exports, "redirectPolicy", ({ enumerable: true, get: function () { return redirectPolicy_js_1.redirectPolicy; } }));
-Object.defineProperty(exports, "redirectPolicyName", ({ enumerable: true, get: function () { return redirectPolicy_js_1.redirectPolicyName; } }));
-var tlsPolicy_js_1 = __nccwpck_require__(6690);
-Object.defineProperty(exports, "tlsPolicy", ({ enumerable: true, get: function () { return tlsPolicy_js_1.tlsPolicy; } }));
-Object.defineProperty(exports, "tlsPolicyName", ({ enumerable: true, get: function () { return tlsPolicy_js_1.tlsPolicyName; } }));
-var userAgentPolicy_js_1 = __nccwpck_require__(1691);
-Object.defineProperty(exports, "userAgentPolicy", ({ enumerable: true, get: function () { return userAgentPolicy_js_1.userAgentPolicy; } }));
-Object.defineProperty(exports, "userAgentPolicyName", ({ enumerable: true, get: function () { return userAgentPolicy_js_1.userAgentPolicyName; } }));
-//# sourceMappingURL=internal.js.map
-
-/***/ }),
-
-/***/ 7129:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.logPolicyName = void 0;
-exports.logPolicy = logPolicy;
-const log_js_1 = __nccwpck_require__(3644);
-const sanitizer_js_1 = __nccwpck_require__(7784);
-/**
- * The programmatic identifier of the logPolicy.
- */
-exports.logPolicyName = "logPolicy";
-/**
- * A policy that logs all requests and responses.
- * @param options - Options to configure logPolicy.
- */
-function logPolicy(options = {}) {
- var _a;
- const logger = (_a = options.logger) !== null && _a !== void 0 ? _a : log_js_1.logger.info;
- const sanitizer = new sanitizer_js_1.Sanitizer({
- additionalAllowedHeaderNames: options.additionalAllowedHeaderNames,
- additionalAllowedQueryParameters: options.additionalAllowedQueryParameters,
- });
- return {
- name: exports.logPolicyName,
- async sendRequest(request, next) {
- if (!logger.enabled) {
- return next(request);
- }
- logger(`Request: ${sanitizer.sanitize(request)}`);
- const response = await next(request);
- logger(`Response status code: ${response.status}`);
- logger(`Headers: ${sanitizer.sanitize(response.headers)}`);
- return response;
- },
- };
-}
-//# sourceMappingURL=logPolicy.js.map
-
-/***/ }),
-
-/***/ 7427:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.multipartPolicyName = void 0;
-exports.multipartPolicy = multipartPolicy;
-const bytesEncoding_js_1 = __nccwpck_require__(2921);
-const typeGuards_js_1 = __nccwpck_require__(8505);
-const uuidUtils_js_1 = __nccwpck_require__(5023);
-const concat_js_1 = __nccwpck_require__(547);
-function generateBoundary() {
- return `----AzSDKFormBoundary${(0, uuidUtils_js_1.randomUUID)()}`;
-}
-function encodeHeaders(headers) {
- let result = "";
- for (const [key, value] of headers) {
- result += `${key}: ${value}\r\n`;
- }
- return result;
-}
-function getLength(source) {
- if (source instanceof Uint8Array) {
- return source.byteLength;
- }
- else if ((0, typeGuards_js_1.isBlob)(source)) {
- // if was created using createFile then -1 means we have an unknown size
- return source.size === -1 ? undefined : source.size;
- }
- else {
- return undefined;
- }
-}
-function getTotalLength(sources) {
- let total = 0;
- for (const source of sources) {
- const partLength = getLength(source);
- if (partLength === undefined) {
- return undefined;
- }
- else {
- total += partLength;
- }
- }
- return total;
-}
-async function buildRequestBody(request, parts, boundary) {
- const sources = [
- (0, bytesEncoding_js_1.stringToUint8Array)(`--${boundary}`, "utf-8"),
- ...parts.flatMap((part) => [
- (0, bytesEncoding_js_1.stringToUint8Array)("\r\n", "utf-8"),
- (0, bytesEncoding_js_1.stringToUint8Array)(encodeHeaders(part.headers), "utf-8"),
- (0, bytesEncoding_js_1.stringToUint8Array)("\r\n", "utf-8"),
- part.body,
- (0, bytesEncoding_js_1.stringToUint8Array)(`\r\n--${boundary}`, "utf-8"),
- ]),
- (0, bytesEncoding_js_1.stringToUint8Array)("--\r\n\r\n", "utf-8"),
- ];
- const contentLength = getTotalLength(sources);
- if (contentLength) {
- request.headers.set("Content-Length", contentLength);
- }
- request.body = await (0, concat_js_1.concat)(sources);
-}
-/**
- * Name of multipart policy
- */
-exports.multipartPolicyName = "multipartPolicy";
-const maxBoundaryLength = 70;
-const validBoundaryCharacters = new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`);
-function assertValidBoundary(boundary) {
- if (boundary.length > maxBoundaryLength) {
- throw new Error(`Multipart boundary "${boundary}" exceeds maximum length of 70 characters`);
- }
- if (Array.from(boundary).some((x) => !validBoundaryCharacters.has(x))) {
- throw new Error(`Multipart boundary "${boundary}" contains invalid characters`);
- }
-}
-/**
- * Pipeline policy for multipart requests
- */
-function multipartPolicy() {
- return {
- name: exports.multipartPolicyName,
- async sendRequest(request, next) {
- var _a;
- if (!request.multipartBody) {
- return next(request);
- }
- if (request.body) {
- throw new Error("multipartBody and regular body cannot be set at the same time");
- }
- let boundary = request.multipartBody.boundary;
- const contentTypeHeader = (_a = request.headers.get("Content-Type")) !== null && _a !== void 0 ? _a : "multipart/mixed";
- const parsedHeader = contentTypeHeader.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/);
- if (!parsedHeader) {
- throw new Error(`Got multipart request body, but content-type header was not multipart: ${contentTypeHeader}`);
- }
- const [, contentType, parsedBoundary] = parsedHeader;
- if (parsedBoundary && boundary && parsedBoundary !== boundary) {
- throw new Error(`Multipart boundary was specified as ${parsedBoundary} in the header, but got ${boundary} in the request body`);
- }
- boundary !== null && boundary !== void 0 ? boundary : (boundary = parsedBoundary);
- if (boundary) {
- assertValidBoundary(boundary);
- }
- else {
- boundary = generateBoundary();
- }
- request.headers.set("Content-Type", `${contentType}; boundary=${boundary}`);
- await buildRequestBody(request, request.multipartBody.parts, boundary);
- request.multipartBody = undefined;
- return next(request);
- },
- };
-}
-//# sourceMappingURL=multipartPolicy.js.map
-
-/***/ }),
-
-/***/ 67:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.globalNoProxyList = exports.proxyPolicyName = void 0;
-exports.loadNoProxy = loadNoProxy;
-exports.getDefaultProxySettings = getDefaultProxySettings;
-exports.proxyPolicy = proxyPolicy;
-const https_proxy_agent_1 = __nccwpck_require__(3669);
-const http_proxy_agent_1 = __nccwpck_require__(1970);
-const log_js_1 = __nccwpck_require__(3644);
-const HTTPS_PROXY = "HTTPS_PROXY";
-const HTTP_PROXY = "HTTP_PROXY";
-const ALL_PROXY = "ALL_PROXY";
-const NO_PROXY = "NO_PROXY";
-/**
- * The programmatic identifier of the proxyPolicy.
- */
-exports.proxyPolicyName = "proxyPolicy";
-/**
- * Stores the patterns specified in NO_PROXY environment variable.
- * @internal
- */
-exports.globalNoProxyList = [];
-let noProxyListLoaded = false;
-/** A cache of whether a host should bypass the proxy. */
-const globalBypassedMap = new Map();
-function getEnvironmentValue(name) {
- if (process.env[name]) {
- return process.env[name];
- }
- else if (process.env[name.toLowerCase()]) {
- return process.env[name.toLowerCase()];
- }
- return undefined;
-}
-function loadEnvironmentProxyValue() {
- if (!process) {
- return undefined;
- }
- const httpsProxy = getEnvironmentValue(HTTPS_PROXY);
- const allProxy = getEnvironmentValue(ALL_PROXY);
- const httpProxy = getEnvironmentValue(HTTP_PROXY);
- return httpsProxy || allProxy || httpProxy;
-}
-/**
- * Check whether the host of a given `uri` matches any pattern in the no proxy list.
- * If there's a match, any request sent to the same host shouldn't have the proxy settings set.
- * This implementation is a port of https://github.com/Azure/azure-sdk-for-net/blob/8cca811371159e527159c7eb65602477898683e2/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs#L210
- */
-function isBypassed(uri, noProxyList, bypassedMap) {
- if (noProxyList.length === 0) {
- return false;
- }
- const host = new URL(uri).hostname;
- if (bypassedMap === null || bypassedMap === void 0 ? void 0 : bypassedMap.has(host)) {
- return bypassedMap.get(host);
- }
- let isBypassedFlag = false;
- for (const pattern of noProxyList) {
- if (pattern[0] === ".") {
- // This should match either domain it self or any subdomain or host
- // .foo.com will match foo.com it self or *.foo.com
- if (host.endsWith(pattern)) {
- isBypassedFlag = true;
- }
- else {
- if (host.length === pattern.length - 1 && host === pattern.slice(1)) {
- isBypassedFlag = true;
- }
- }
- }
- else {
- if (host === pattern) {
- isBypassedFlag = true;
- }
- }
- }
- bypassedMap === null || bypassedMap === void 0 ? void 0 : bypassedMap.set(host, isBypassedFlag);
- return isBypassedFlag;
-}
-function loadNoProxy() {
- const noProxy = getEnvironmentValue(NO_PROXY);
- noProxyListLoaded = true;
- if (noProxy) {
- return noProxy
- .split(",")
- .map((item) => item.trim())
- .filter((item) => item.length);
- }
- return [];
-}
-/**
- * This method converts a proxy url into `ProxySettings` for use with ProxyPolicy.
- * If no argument is given, it attempts to parse a proxy URL from the environment
- * variables `HTTPS_PROXY` or `HTTP_PROXY`.
- * @param proxyUrl - The url of the proxy to use. May contain authentication information.
- * @deprecated - Internally this method is no longer necessary when setting proxy information.
- */
-function getDefaultProxySettings(proxyUrl) {
- if (!proxyUrl) {
- proxyUrl = loadEnvironmentProxyValue();
- if (!proxyUrl) {
- return undefined;
- }
- }
- const parsedUrl = new URL(proxyUrl);
- const schema = parsedUrl.protocol ? parsedUrl.protocol + "//" : "";
- return {
- host: schema + parsedUrl.hostname,
- port: Number.parseInt(parsedUrl.port || "80"),
- username: parsedUrl.username,
- password: parsedUrl.password,
- };
-}
-/**
- * This method attempts to parse a proxy URL from the environment
- * variables `HTTPS_PROXY` or `HTTP_PROXY`.
- */
-function getDefaultProxySettingsInternal() {
- const envProxy = loadEnvironmentProxyValue();
- return envProxy ? new URL(envProxy) : undefined;
-}
-function getUrlFromProxySettings(settings) {
- let parsedProxyUrl;
- try {
- parsedProxyUrl = new URL(settings.host);
- }
- catch (_a) {
- throw new Error(`Expecting a valid host string in proxy settings, but found "${settings.host}".`);
- }
- parsedProxyUrl.port = String(settings.port);
- if (settings.username) {
- parsedProxyUrl.username = settings.username;
- }
- if (settings.password) {
- parsedProxyUrl.password = settings.password;
- }
- return parsedProxyUrl;
-}
-function setProxyAgentOnRequest(request, cachedAgents, proxyUrl) {
- // Custom Agent should take precedence so if one is present
- // we should skip to avoid overwriting it.
- if (request.agent) {
- return;
- }
- const url = new URL(request.url);
- const isInsecure = url.protocol !== "https:";
- if (request.tlsSettings) {
- log_js_1.logger.warning("TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored.");
- }
- const headers = request.headers.toJSON();
- if (isInsecure) {
- if (!cachedAgents.httpProxyAgent) {
- cachedAgents.httpProxyAgent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl, { headers });
- }
- request.agent = cachedAgents.httpProxyAgent;
- }
- else {
- if (!cachedAgents.httpsProxyAgent) {
- cachedAgents.httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, { headers });
- }
- request.agent = cachedAgents.httpsProxyAgent;
- }
-}
-/**
- * A policy that allows one to apply proxy settings to all requests.
- * If not passed static settings, they will be retrieved from the HTTPS_PROXY
- * or HTTP_PROXY environment variables.
- * @param proxySettings - ProxySettings to use on each request.
- * @param options - additional settings, for example, custom NO_PROXY patterns
- */
-function proxyPolicy(proxySettings, options) {
- if (!noProxyListLoaded) {
- exports.globalNoProxyList.push(...loadNoProxy());
- }
- const defaultProxy = proxySettings
- ? getUrlFromProxySettings(proxySettings)
- : getDefaultProxySettingsInternal();
- const cachedAgents = {};
- return {
- name: exports.proxyPolicyName,
- async sendRequest(request, next) {
- var _a;
- if (!request.proxySettings &&
- defaultProxy &&
- !isBypassed(request.url, (_a = options === null || options === void 0 ? void 0 : options.customNoProxyList) !== null && _a !== void 0 ? _a : exports.globalNoProxyList, (options === null || options === void 0 ? void 0 : options.customNoProxyList) ? undefined : globalBypassedMap)) {
- setProxyAgentOnRequest(request, cachedAgents, defaultProxy);
- }
- else if (request.proxySettings) {
- setProxyAgentOnRequest(request, cachedAgents, getUrlFromProxySettings(request.proxySettings));
- }
- return next(request);
- },
- };
-}
-//# sourceMappingURL=proxyPolicy.js.map
-
-/***/ }),
-
-/***/ 2187:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.redirectPolicyName = void 0;
-exports.redirectPolicy = redirectPolicy;
-/**
- * The programmatic identifier of the redirectPolicy.
- */
-exports.redirectPolicyName = "redirectPolicy";
-/**
- * Methods that are allowed to follow redirects 301 and 302
- */
-const allowedRedirect = ["GET", "HEAD"];
-/**
- * A policy to follow Location headers from the server in order
- * to support server-side redirection.
- * In the browser, this policy is not used.
- * @param options - Options to control policy behavior.
- */
-function redirectPolicy(options = {}) {
- const { maxRetries = 20 } = options;
- return {
- name: exports.redirectPolicyName,
- async sendRequest(request, next) {
- const response = await next(request);
- return handleRedirect(next, response, maxRetries);
- },
- };
-}
-async function handleRedirect(next, response, maxRetries, currentRetries = 0) {
- const { request, status, headers } = response;
- const locationHeader = headers.get("location");
- if (locationHeader &&
- (status === 300 ||
- (status === 301 && allowedRedirect.includes(request.method)) ||
- (status === 302 && allowedRedirect.includes(request.method)) ||
- (status === 303 && request.method === "POST") ||
- status === 307) &&
- currentRetries < maxRetries) {
- const url = new URL(locationHeader, request.url);
- request.url = url.toString();
- // POST request with Status code 303 should be converted into a
- // redirected GET request if the redirect url is present in the location header
- if (status === 303) {
- request.method = "GET";
- request.headers.delete("Content-Length");
- delete request.body;
- }
- request.headers.delete("Authorization");
- const res = await next(request);
- return handleRedirect(next, res, maxRetries, currentRetries + 1);
- }
- return response;
-}
-//# sourceMappingURL=redirectPolicy.js.map
-
-/***/ }),
-
-/***/ 3345:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.retryPolicy = retryPolicy;
-const helpers_js_1 = __nccwpck_require__(7566);
-const AbortError_js_1 = __nccwpck_require__(9992);
-const logger_js_1 = __nccwpck_require__(8459);
-const constants_js_1 = __nccwpck_require__(1255);
-const retryPolicyLogger = (0, logger_js_1.createClientLogger)("ts-http-runtime retryPolicy");
-/**
- * The programmatic identifier of the retryPolicy.
- */
-const retryPolicyName = "retryPolicy";
-/**
- * retryPolicy is a generic policy to enable retrying requests when certain conditions are met
- */
-function retryPolicy(strategies, options = { maxRetries: constants_js_1.DEFAULT_RETRY_POLICY_COUNT }) {
- const logger = options.logger || retryPolicyLogger;
- return {
- name: retryPolicyName,
- async sendRequest(request, next) {
- var _a, _b;
- let response;
- let responseError;
- let retryCount = -1;
- retryRequest: while (true) {
- retryCount += 1;
- response = undefined;
- responseError = undefined;
- try {
- logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);
- response = await next(request);
- logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);
- }
- catch (e) {
- logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);
- // RestErrors are valid targets for the retry strategies.
- // If none of the retry strategies can work with them, they will be thrown later in this policy.
- // If the received error is not a RestError, it is immediately thrown.
- responseError = e;
- if (!e || responseError.name !== "RestError") {
- throw e;
- }
- response = responseError.response;
- }
- if ((_a = request.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
- logger.error(`Retry ${retryCount}: Request aborted.`);
- const abortError = new AbortError_js_1.AbortError();
- throw abortError;
- }
- if (retryCount >= ((_b = options.maxRetries) !== null && _b !== void 0 ? _b : constants_js_1.DEFAULT_RETRY_POLICY_COUNT)) {
- logger.info(`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`);
- if (responseError) {
- throw responseError;
- }
- else if (response) {
- return response;
- }
- else {
- throw new Error("Maximum retries reached with no response or error to throw");
- }
- }
- logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);
- strategiesLoop: for (const strategy of strategies) {
- const strategyLogger = strategy.logger || logger;
- strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);
- const modifiers = strategy.retry({
- retryCount,
- response,
- responseError,
- });
- if (modifiers.skipStrategy) {
- strategyLogger.info(`Retry ${retryCount}: Skipped.`);
- continue strategiesLoop;
- }
- const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;
- if (errorToThrow) {
- strategyLogger.error(`Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`, errorToThrow);
- throw errorToThrow;
- }
- if (retryAfterInMs || retryAfterInMs === 0) {
- strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`);
- await (0, helpers_js_1.delay)(retryAfterInMs, undefined, { abortSignal: request.abortSignal });
- continue retryRequest;
- }
- if (redirectTo) {
- strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`);
- request.url = redirectTo;
- continue retryRequest;
- }
- }
- if (responseError) {
- logger.info(`None of the retry strategies could work with the received error. Throwing it.`);
- throw responseError;
- }
- if (response) {
- logger.info(`None of the retry strategies could work with the received response. Returning it.`);
- return response;
- }
- // If all the retries skip and there's no response,
- // we're still in the retry loop, so a new request will be sent
- // until `maxRetries` is reached.
- }
- },
- };
-}
-//# sourceMappingURL=retryPolicy.js.map
-
-/***/ }),
-
-/***/ 2418:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.systemErrorRetryPolicyName = void 0;
-exports.systemErrorRetryPolicy = systemErrorRetryPolicy;
-const exponentialRetryStrategy_js_1 = __nccwpck_require__(8102);
-const retryPolicy_js_1 = __nccwpck_require__(3345);
-const constants_js_1 = __nccwpck_require__(1255);
-/**
- * Name of the {@link systemErrorRetryPolicy}
- */
-exports.systemErrorRetryPolicyName = "systemErrorRetryPolicy";
-/**
- * A retry policy that specifically seeks to handle errors in the
- * underlying transport layer (e.g. DNS lookup failures) rather than
- * retryable error codes from the server itself.
- * @param options - Options that customize the policy.
- */
-function systemErrorRetryPolicy(options = {}) {
- var _a;
- return {
- name: exports.systemErrorRetryPolicyName,
- sendRequest: (0, retryPolicy_js_1.retryPolicy)([
- (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)(Object.assign(Object.assign({}, options), { ignoreHttpStatusCodes: true })),
- ], {
- maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
- }).sendRequest,
- };
-}
-//# sourceMappingURL=systemErrorRetryPolicy.js.map
-
-/***/ }),
-
-/***/ 4728:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.throttlingRetryPolicyName = void 0;
-exports.throttlingRetryPolicy = throttlingRetryPolicy;
-const throttlingRetryStrategy_js_1 = __nccwpck_require__(1112);
-const retryPolicy_js_1 = __nccwpck_require__(3345);
-const constants_js_1 = __nccwpck_require__(1255);
-/**
- * Name of the {@link throttlingRetryPolicy}
- */
-exports.throttlingRetryPolicyName = "throttlingRetryPolicy";
-/**
- * A policy that retries when the server sends a 429 response with a Retry-After header.
- *
- * To learn more, please refer to
- * https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,
- * https://learn.microsoft.com/en-us/azure/azure-subscription-service-limits and
- * https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors
- *
- * @param options - Options that configure retry logic.
- */
-function throttlingRetryPolicy(options = {}) {
- var _a;
- return {
- name: exports.throttlingRetryPolicyName,
- sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)()], {
- maxRetries: (_a = options.maxRetries) !== null && _a !== void 0 ? _a : constants_js_1.DEFAULT_RETRY_POLICY_COUNT,
- }).sendRequest,
- };
-}
-//# sourceMappingURL=throttlingRetryPolicy.js.map
-
-/***/ }),
-
-/***/ 6690:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.tlsPolicyName = void 0;
-exports.tlsPolicy = tlsPolicy;
-/**
- * Name of the TLS Policy
- */
-exports.tlsPolicyName = "tlsPolicy";
-/**
- * Gets a pipeline policy that adds the client certificate to the HttpClient agent for authentication.
- */
-function tlsPolicy(tlsSettings) {
- return {
- name: exports.tlsPolicyName,
- sendRequest: async (req, next) => {
- // Users may define a request tlsSettings, honor those over the client level one
- if (!req.tlsSettings) {
- req.tlsSettings = tlsSettings;
- }
- return next(req);
- },
- };
-}
-//# sourceMappingURL=tlsPolicy.js.map
-
-/***/ }),
-
-/***/ 1691:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.userAgentPolicyName = void 0;
-exports.userAgentPolicy = userAgentPolicy;
-const userAgent_js_1 = __nccwpck_require__(2731);
-const UserAgentHeaderName = (0, userAgent_js_1.getUserAgentHeaderName)();
-/**
- * The programmatic identifier of the userAgentPolicy.
- */
-exports.userAgentPolicyName = "userAgentPolicy";
-/**
- * A policy that sets the User-Agent header (or equivalent) to reflect
- * the library version.
- * @param options - Options to customize the user agent value.
- */
-function userAgentPolicy(options = {}) {
- const userAgentValue = (0, userAgent_js_1.getUserAgentValue)(options.userAgentPrefix);
- return {
- name: exports.userAgentPolicyName,
- async sendRequest(request, next) {
- if (!request.headers.has(UserAgentHeaderName)) {
- request.headers.set(UserAgentHeaderName, await userAgentValue);
- }
- return next(request);
- },
- };
-}
-//# sourceMappingURL=userAgentPolicy.js.map
-
-/***/ }),
-
-/***/ 9758:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.RestError = void 0;
-exports.isRestError = isRestError;
-const error_js_1 = __nccwpck_require__(2573);
-const inspect_js_1 = __nccwpck_require__(7639);
-const sanitizer_js_1 = __nccwpck_require__(7784);
-const errorSanitizer = new sanitizer_js_1.Sanitizer();
-/**
- * A custom error type for failed pipeline requests.
- */
-class RestError extends Error {
- constructor(message, options = {}) {
- super(message);
- this.name = "RestError";
- this.code = options.code;
- this.statusCode = options.statusCode;
- // The request and response may contain sensitive information in the headers or body.
- // To help prevent this sensitive information being accidentally logged, the request and response
- // properties are marked as non-enumerable here. This prevents them showing up in the output of
- // JSON.stringify and console.log.
- Object.defineProperty(this, "request", { value: options.request, enumerable: false });
- Object.defineProperty(this, "response", { value: options.response, enumerable: false });
- // Logging method for util.inspect in Node
- Object.defineProperty(this, inspect_js_1.custom, {
- value: () => {
- // Extract non-enumerable properties and add them back. This is OK since in this output the request and
- // response get sanitized.
- return `RestError: ${this.message} \n ${errorSanitizer.sanitize(Object.assign(Object.assign({}, this), { request: this.request, response: this.response }))}`;
- },
- enumerable: false,
- });
- Object.setPrototypeOf(this, RestError.prototype);
- }
-}
-exports.RestError = RestError;
-/**
- * Something went wrong when making the request.
- * This means the actual request failed for some reason,
- * such as a DNS issue or the connection being lost.
- */
-RestError.REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
-/**
- * This means that parsing the response from the server failed.
- * It may have been malformed.
- */
-RestError.PARSE_ERROR = "PARSE_ERROR";
-/**
- * Typeguard for RestError
- * @param e - Something caught by a catch clause.
- */
-function isRestError(e) {
- if (e instanceof RestError) {
- return true;
- }
- return (0, error_js_1.isError)(e) && e.name === "RestError";
-}
-//# sourceMappingURL=restError.js.map
-
-/***/ }),
-
-/***/ 8102:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.exponentialRetryStrategy = exponentialRetryStrategy;
-exports.isExponentialRetryResponse = isExponentialRetryResponse;
-exports.isSystemError = isSystemError;
-const delay_js_1 = __nccwpck_require__(6776);
-const throttlingRetryStrategy_js_1 = __nccwpck_require__(1112);
-// intervals are in milliseconds
-const DEFAULT_CLIENT_RETRY_INTERVAL = 1000;
-const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64;
-/**
- * A retry strategy that retries with an exponentially increasing delay in these two cases:
- * - When there are errors in the underlying transport layer (e.g. DNS lookup failures).
- * - Or otherwise if the outgoing request fails (408, greater or equal than 500, except for 501 and 505).
- */
-function exponentialRetryStrategy(options = {}) {
- var _a, _b;
- const retryInterval = (_a = options.retryDelayInMs) !== null && _a !== void 0 ? _a : DEFAULT_CLIENT_RETRY_INTERVAL;
- const maxRetryInterval = (_b = options.maxRetryDelayInMs) !== null && _b !== void 0 ? _b : DEFAULT_CLIENT_MAX_RETRY_INTERVAL;
- return {
- name: "exponentialRetryStrategy",
- retry({ retryCount, response, responseError }) {
- const matchedSystemError = isSystemError(responseError);
- const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors;
- const isExponential = isExponentialRetryResponse(response);
- const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes;
- const unknownResponse = response && ((0, throttlingRetryStrategy_js_1.isThrottlingRetryResponse)(response) || !isExponential);
- if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) {
- return { skipStrategy: true };
- }
- if (responseError && !matchedSystemError && !isExponential) {
- return { errorToThrow: responseError };
- }
- return (0, delay_js_1.calculateRetryDelay)(retryCount, {
- retryDelayInMs: retryInterval,
- maxRetryDelayInMs: maxRetryInterval,
- });
- },
- };
-}
-/**
- * A response is a retry response if it has status codes:
- * - 408, or
- * - Greater or equal than 500, except for 501 and 505.
- */
-function isExponentialRetryResponse(response) {
- return Boolean(response &&
- response.status !== undefined &&
- (response.status >= 500 || response.status === 408) &&
- response.status !== 501 &&
- response.status !== 505);
-}
-/**
- * Determines whether an error from a pipeline response was triggered in the network layer.
- */
-function isSystemError(err) {
- if (!err) {
- return false;
- }
- return (err.code === "ETIMEDOUT" ||
- err.code === "ESOCKETTIMEDOUT" ||
- err.code === "ECONNREFUSED" ||
- err.code === "ECONNRESET" ||
- err.code === "ENOENT" ||
- err.code === "ENOTFOUND");
-}
-//# sourceMappingURL=exponentialRetryStrategy.js.map
-
-/***/ }),
-
-/***/ 1112:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.isThrottlingRetryResponse = isThrottlingRetryResponse;
-exports.throttlingRetryStrategy = throttlingRetryStrategy;
-const helpers_js_1 = __nccwpck_require__(7566);
-/**
- * The header that comes back from services representing
- * the amount of time (minimum) to wait to retry (in seconds or timestamp after which we can retry).
- */
-const RetryAfterHeader = "Retry-After";
-/**
- * The headers that come back from services representing
- * the amount of time (minimum) to wait to retry.
- *
- * "retry-after-ms", "x-ms-retry-after-ms" : milliseconds
- * "Retry-After" : seconds or timestamp
- */
-const AllRetryAfterHeaders = ["retry-after-ms", "x-ms-retry-after-ms", RetryAfterHeader];
-/**
- * A response is a throttling retry response if it has a throttling status code (429 or 503),
- * as long as one of the [ "Retry-After" or "retry-after-ms" or "x-ms-retry-after-ms" ] headers has a valid value.
- *
- * Returns the `retryAfterInMs` value if the response is a throttling retry response.
- * If not throttling retry response, returns `undefined`.
- *
- * @internal
- */
-function getRetryAfterInMs(response) {
- if (!(response && [429, 503].includes(response.status)))
- return undefined;
- try {
- // Headers: "retry-after-ms", "x-ms-retry-after-ms", "Retry-After"
- for (const header of AllRetryAfterHeaders) {
- const retryAfterValue = (0, helpers_js_1.parseHeaderValueAsNumber)(response, header);
- if (retryAfterValue === 0 || retryAfterValue) {
- // "Retry-After" header ==> seconds
- // "retry-after-ms", "x-ms-retry-after-ms" headers ==> milli-seconds
- const multiplyingFactor = header === RetryAfterHeader ? 1000 : 1;
- return retryAfterValue * multiplyingFactor; // in milli-seconds
- }
- }
- // RetryAfterHeader ("Retry-After") has a special case where it might be formatted as a date instead of a number of seconds
- const retryAfterHeader = response.headers.get(RetryAfterHeader);
- if (!retryAfterHeader)
- return;
- const date = Date.parse(retryAfterHeader);
- const diff = date - Date.now();
- // negative diff would mean a date in the past, so retry asap with 0 milliseconds
- return Number.isFinite(diff) ? Math.max(0, diff) : undefined;
- }
- catch (_a) {
- return undefined;
- }
-}
-/**
- * A response is a retry response if it has a throttling status code (429 or 503),
- * as long as one of the [ "Retry-After" or "retry-after-ms" or "x-ms-retry-after-ms" ] headers has a valid value.
- */
-function isThrottlingRetryResponse(response) {
- return Number.isFinite(getRetryAfterInMs(response));
-}
-function throttlingRetryStrategy() {
- return {
- name: "throttlingRetryStrategy",
- retry({ response }) {
- const retryAfterInMs = getRetryAfterInMs(response);
- if (!Number.isFinite(retryAfterInMs)) {
- return { skipStrategy: true };
- }
- return {
- retryAfterInMs,
- };
- },
- };
-}
-//# sourceMappingURL=throttlingRetryStrategy.js.map
-
-/***/ }),
-
-/***/ 2921:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.uint8ArrayToString = uint8ArrayToString;
-exports.stringToUint8Array = stringToUint8Array;
-/**
- * The helper that transforms bytes with specific character encoding into string
- * @param bytes - the uint8array bytes
- * @param format - the format we use to encode the byte
- * @returns a string of the encoded string
- */
-function uint8ArrayToString(bytes, format) {
- return Buffer.from(bytes).toString(format);
-}
-/**
- * The helper that transforms string to specific character encoded bytes array.
- * @param value - the string to be converted
- * @param format - the format we use to decode the value
- * @returns a uint8array
- */
-function stringToUint8Array(value, format) {
- return Buffer.from(value, format);
-}
-//# sourceMappingURL=bytesEncoding.js.map
-
-/***/ }),
-
-/***/ 5086:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-var _a, _b, _c, _d;
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.isReactNative = exports.isNodeRuntime = exports.isNodeLike = exports.isBun = exports.isDeno = exports.isWebWorker = exports.isBrowser = void 0;
-/**
- * A constant that indicates whether the environment the code is running is a Web Browser.
- */
-// eslint-disable-next-line @azure/azure-sdk/ts-no-window
-exports.isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
-/**
- * A constant that indicates whether the environment the code is running is a Web Worker.
- */
-exports.isWebWorker = typeof self === "object" &&
- typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
- (((_a = self.constructor) === null || _a === void 0 ? void 0 : _a.name) === "DedicatedWorkerGlobalScope" ||
- ((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" ||
- ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope");
-/**
- * A constant that indicates whether the environment the code is running is Deno.
- */
-exports.isDeno = typeof Deno !== "undefined" &&
- typeof Deno.version !== "undefined" &&
- typeof Deno.version.deno !== "undefined";
-/**
- * A constant that indicates whether the environment the code is running is Bun.sh.
- */
-exports.isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
-/**
- * A constant that indicates whether the environment the code is running is a Node.js compatible environment.
- */
-exports.isNodeLike = typeof globalThis.process !== "undefined" &&
- Boolean(globalThis.process.version) &&
- Boolean((_d = globalThis.process.versions) === null || _d === void 0 ? void 0 : _d.node);
-/**
- * A constant that indicates whether the environment the code is running is Node.JS.
- */
-exports.isNodeRuntime = exports.isNodeLike && !exports.isBun && !exports.isDeno;
-/**
- * A constant that indicates whether the environment the code is running is in React-Native.
- */
-// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
-exports.isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
-//# sourceMappingURL=checkEnvironment.js.map
-
-/***/ }),
-
-/***/ 547:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.concat = concat;
-const tslib_1 = __nccwpck_require__(1860);
-const stream_1 = __nccwpck_require__(2203);
-const typeGuards_js_1 = __nccwpck_require__(8505);
-function streamAsyncIterator() {
- return tslib_1.__asyncGenerator(this, arguments, function* streamAsyncIterator_1() {
- const reader = this.getReader();
- try {
- while (true) {
- const { done, value } = yield tslib_1.__await(reader.read());
- if (done) {
- return yield tslib_1.__await(void 0);
- }
- yield yield tslib_1.__await(value);
- }
- }
- finally {
- reader.releaseLock();
- }
- });
-}
-function makeAsyncIterable(webStream) {
- if (!webStream[Symbol.asyncIterator]) {
- webStream[Symbol.asyncIterator] = streamAsyncIterator.bind(webStream);
- }
- if (!webStream.values) {
- webStream.values = streamAsyncIterator.bind(webStream);
- }
-}
-function ensureNodeStream(stream) {
- if (stream instanceof ReadableStream) {
- makeAsyncIterable(stream);
- return stream_1.Readable.fromWeb(stream);
- }
- else {
- return stream;
- }
-}
-function toStream(source) {
- if (source instanceof Uint8Array) {
- return stream_1.Readable.from(Buffer.from(source));
- }
- else if ((0, typeGuards_js_1.isBlob)(source)) {
- return ensureNodeStream(source.stream());
- }
- else {
- return ensureNodeStream(source);
- }
-}
-/**
- * Utility function that concatenates a set of binary inputs into one combined output.
- *
- * @param sources - array of sources for the concatenation
- * @returns - in Node, a (() =\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs.
- * In browser, returns a `Blob` representing all the concatenated inputs.
- *
- * @internal
- */
-async function concat(sources) {
- return function () {
- const streams = sources.map((x) => (typeof x === "function" ? x() : x)).map(toStream);
- return stream_1.Readable.from((function () {
- return tslib_1.__asyncGenerator(this, arguments, function* () {
- var _a, e_1, _b, _c;
- for (const stream of streams) {
- try {
- for (var _d = true, stream_2 = (e_1 = void 0, tslib_1.__asyncValues(stream)), stream_2_1; stream_2_1 = yield tslib_1.__await(stream_2.next()), _a = stream_2_1.done, !_a; _d = true) {
- _c = stream_2_1.value;
- _d = false;
- const chunk = _c;
- yield yield tslib_1.__await(chunk);
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (!_d && !_a && (_b = stream_2.return)) yield tslib_1.__await(_b.call(stream_2));
- }
- finally { if (e_1) throw e_1.error; }
- }
- }
- });
- })());
- };
-}
-//# sourceMappingURL=concat.js.map
-
-/***/ }),
-
-/***/ 6776:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.calculateRetryDelay = calculateRetryDelay;
-const random_js_1 = __nccwpck_require__(6259);
-/**
- * Calculates the delay interval for retry attempts using exponential delay with jitter.
- * @param retryAttempt - The current retry attempt number.
- * @param config - The exponential retry configuration.
- * @returns An object containing the calculated retry delay.
- */
-function calculateRetryDelay(retryAttempt, config) {
- // Exponentially increase the delay each time
- const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);
- // Don't let the delay exceed the maximum
- const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);
- // Allow the final value to have some "jitter" (within 50% of the delay size) so
- // that retries across multiple clients don't occur simultaneously.
- const retryAfterInMs = clampedDelay / 2 + (0, random_js_1.getRandomIntegerInclusive)(0, clampedDelay / 2);
- return { retryAfterInMs };
-}
-//# sourceMappingURL=delay.js.map
-
-/***/ }),
-
-/***/ 2573:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.isError = isError;
-const object_js_1 = __nccwpck_require__(3632);
-/**
- * Typeguard for an error object shape (has name and message)
- * @param e - Something caught by a catch clause.
- */
-function isError(e) {
- if ((0, object_js_1.isObject)(e)) {
- const hasName = typeof e.name === "string";
- const hasMessage = typeof e.message === "string";
- return hasName && hasMessage;
- }
- return false;
-}
-//# sourceMappingURL=error.js.map
-
-/***/ }),
-
-/***/ 7566:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.delay = delay;
-exports.parseHeaderValueAsNumber = parseHeaderValueAsNumber;
-const AbortError_js_1 = __nccwpck_require__(9992);
-const StandardAbortMessage = "The operation was aborted.";
-/**
- * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds.
- * @param delayInMs - The number of milliseconds to be delayed.
- * @param value - The value to be resolved with after a timeout of t milliseconds.
- * @param options - The options for delay - currently abort options
- * - abortSignal - The abortSignal associated with containing operation.
- * - abortErrorMsg - The abort error message associated with containing operation.
- * @returns Resolved promise
- */
-function delay(delayInMs, value, options) {
- return new Promise((resolve, reject) => {
- let timer = undefined;
- let onAborted = undefined;
- const rejectOnAbort = () => {
- return reject(new AbortError_js_1.AbortError((options === null || options === void 0 ? void 0 : options.abortErrorMsg) ? options === null || options === void 0 ? void 0 : options.abortErrorMsg : StandardAbortMessage));
- };
- const removeListeners = () => {
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) && onAborted) {
- options.abortSignal.removeEventListener("abort", onAborted);
- }
- };
- onAborted = () => {
- if (timer) {
- clearTimeout(timer);
- }
- removeListeners();
- return rejectOnAbort();
- };
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) && options.abortSignal.aborted) {
- return rejectOnAbort();
- }
- timer = setTimeout(() => {
- removeListeners();
- resolve(value);
- }, delayInMs);
- if (options === null || options === void 0 ? void 0 : options.abortSignal) {
- options.abortSignal.addEventListener("abort", onAborted);
- }
- });
-}
-/**
- * @internal
- * @returns the parsed value or undefined if the parsed value is invalid.
- */
-function parseHeaderValueAsNumber(response, headerName) {
- const value = response.headers.get(headerName);
- if (!value)
- return;
- const valueAsNum = Number(value);
- if (Number.isNaN(valueAsNum))
- return;
- return valueAsNum;
-}
-//# sourceMappingURL=helpers.js.map
-
-/***/ }),
-
-/***/ 7639:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.custom = void 0;
-const node_util_1 = __nccwpck_require__(7975);
-exports.custom = node_util_1.inspect.custom;
-//# sourceMappingURL=inspect.js.map
-
-/***/ }),
-
-/***/ 5750:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.Sanitizer = exports.uint8ArrayToString = exports.stringToUint8Array = exports.isWebWorker = exports.isReactNative = exports.isDeno = exports.isNodeRuntime = exports.isNodeLike = exports.isBun = exports.isBrowser = exports.randomUUID = exports.computeSha256Hmac = exports.computeSha256Hash = exports.isError = exports.isObject = exports.getRandomIntegerInclusive = exports.calculateRetryDelay = void 0;
-var delay_js_1 = __nccwpck_require__(6776);
-Object.defineProperty(exports, "calculateRetryDelay", ({ enumerable: true, get: function () { return delay_js_1.calculateRetryDelay; } }));
-var random_js_1 = __nccwpck_require__(6259);
-Object.defineProperty(exports, "getRandomIntegerInclusive", ({ enumerable: true, get: function () { return random_js_1.getRandomIntegerInclusive; } }));
-var object_js_1 = __nccwpck_require__(3632);
-Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return object_js_1.isObject; } }));
-var error_js_1 = __nccwpck_require__(2573);
-Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return error_js_1.isError; } }));
-var sha256_js_1 = __nccwpck_require__(2016);
-Object.defineProperty(exports, "computeSha256Hash", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hash; } }));
-Object.defineProperty(exports, "computeSha256Hmac", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hmac; } }));
-var uuidUtils_js_1 = __nccwpck_require__(5023);
-Object.defineProperty(exports, "randomUUID", ({ enumerable: true, get: function () { return uuidUtils_js_1.randomUUID; } }));
-var checkEnvironment_js_1 = __nccwpck_require__(5086);
-Object.defineProperty(exports, "isBrowser", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBrowser; } }));
-Object.defineProperty(exports, "isBun", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBun; } }));
-Object.defineProperty(exports, "isNodeLike", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNodeLike; } }));
-Object.defineProperty(exports, "isNodeRuntime", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNodeRuntime; } }));
-Object.defineProperty(exports, "isDeno", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isDeno; } }));
-Object.defineProperty(exports, "isReactNative", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isReactNative; } }));
-Object.defineProperty(exports, "isWebWorker", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isWebWorker; } }));
-var bytesEncoding_js_1 = __nccwpck_require__(2921);
-Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } }));
-Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } }));
-var sanitizer_js_1 = __nccwpck_require__(7784);
-Object.defineProperty(exports, "Sanitizer", ({ enumerable: true, get: function () { return sanitizer_js_1.Sanitizer; } }));
-//# sourceMappingURL=internal.js.map
-
-/***/ }),
-
-/***/ 3632:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.isObject = isObject;
-/**
- * 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));
-}
-//# sourceMappingURL=object.js.map
-
-/***/ }),
-
-/***/ 6259:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getRandomIntegerInclusive = getRandomIntegerInclusive;
-/**
- * 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;
-}
-//# sourceMappingURL=random.js.map
-
-/***/ }),
-
-/***/ 7784:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.Sanitizer = void 0;
-const object_js_1 = __nccwpck_require__(3632);
-const RedactedString = "REDACTED";
-// Make sure this list is up-to-date with the one under core/logger/Readme#Keyconcepts
-const defaultAllowedHeaderNames = [
- "x-ms-client-request-id",
- "x-ms-return-client-request-id",
- "x-ms-useragent",
- "x-ms-correlation-request-id",
- "x-ms-request-id",
- "client-request-id",
- "ms-cv",
- "return-client-request-id",
- "traceparent",
- "Access-Control-Allow-Credentials",
- "Access-Control-Allow-Headers",
- "Access-Control-Allow-Methods",
- "Access-Control-Allow-Origin",
- "Access-Control-Expose-Headers",
- "Access-Control-Max-Age",
- "Access-Control-Request-Headers",
- "Access-Control-Request-Method",
- "Origin",
- "Accept",
- "Accept-Encoding",
- "Cache-Control",
- "Connection",
- "Content-Length",
- "Content-Type",
- "Date",
- "ETag",
- "Expires",
- "If-Match",
- "If-Modified-Since",
- "If-None-Match",
- "If-Unmodified-Since",
- "Last-Modified",
- "Pragma",
- "Request-Id",
- "Retry-After",
- "Server",
- "Transfer-Encoding",
- "User-Agent",
- "WWW-Authenticate",
-];
-const defaultAllowedQueryParameters = ["api-version"];
-/**
- * A utility class to sanitize objects for logging.
- */
-class Sanitizer {
- constructor({ additionalAllowedHeaderNames: allowedHeaderNames = [], additionalAllowedQueryParameters: allowedQueryParameters = [], } = {}) {
- allowedHeaderNames = defaultAllowedHeaderNames.concat(allowedHeaderNames);
- allowedQueryParameters = defaultAllowedQueryParameters.concat(allowedQueryParameters);
- this.allowedHeaderNames = new Set(allowedHeaderNames.map((n) => n.toLowerCase()));
- this.allowedQueryParameters = new Set(allowedQueryParameters.map((p) => p.toLowerCase()));
- }
- /**
- * Sanitizes an object for logging.
- * @param obj - The object to sanitize
- * @returns - The sanitized object as a string
- */
- sanitize(obj) {
- const seen = new Set();
- return JSON.stringify(obj, (key, value) => {
- // Ensure Errors include their interesting non-enumerable members
- if (value instanceof Error) {
- return Object.assign(Object.assign({}, value), { name: value.name, message: value.message });
- }
- if (key === "headers") {
- return this.sanitizeHeaders(value);
- }
- else if (key === "url") {
- return this.sanitizeUrl(value);
- }
- else if (key === "query") {
- return this.sanitizeQuery(value);
- }
- else if (key === "body") {
- // Don't log the request body
- return undefined;
- }
- else if (key === "response") {
- // Don't log response again
- return undefined;
- }
- else if (key === "operationSpec") {
- // When using sendOperationRequest, the request carries a massive
- // field with the autorest spec. No need to log it.
- return undefined;
- }
- else if (Array.isArray(value) || (0, object_js_1.isObject)(value)) {
- if (seen.has(value)) {
- return "[Circular]";
- }
- seen.add(value);
- }
- return value;
- }, 2);
- }
- /**
- * Sanitizes a URL for logging.
- * @param value - The URL to sanitize
- * @returns - The sanitized URL as a string
- */
- sanitizeUrl(value) {
- if (typeof value !== "string" || value === null || value === "") {
- return value;
- }
- const url = new URL(value);
- if (!url.search) {
- return value;
- }
- for (const [key] of url.searchParams) {
- if (!this.allowedQueryParameters.has(key.toLowerCase())) {
- url.searchParams.set(key, RedactedString);
- }
- }
- return url.toString();
- }
- sanitizeHeaders(obj) {
- const sanitized = {};
- for (const key of Object.keys(obj)) {
- if (this.allowedHeaderNames.has(key.toLowerCase())) {
- sanitized[key] = obj[key];
- }
- else {
- sanitized[key] = RedactedString;
- }
- }
- return sanitized;
- }
- sanitizeQuery(value) {
- if (typeof value !== "object" || value === null) {
- return value;
- }
- const sanitized = {};
- for (const k of Object.keys(value)) {
- if (this.allowedQueryParameters.has(k.toLowerCase())) {
- sanitized[k] = value[k];
- }
- else {
- sanitized[k] = RedactedString;
- }
- }
- return sanitized;
- }
-}
-exports.Sanitizer = Sanitizer;
-//# sourceMappingURL=sanitizer.js.map
-
-/***/ }),
-
-/***/ 2016:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.computeSha256Hmac = computeSha256Hmac;
-exports.computeSha256Hash = computeSha256Hash;
-const node_crypto_1 = __nccwpck_require__(7598);
-/**
- * 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 (0, node_crypto_1.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 (0, node_crypto_1.createHash)("sha256").update(content).digest(encoding);
-}
-//# sourceMappingURL=sha256.js.map
-
-/***/ }),
-
-/***/ 8505:
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.isNodeReadableStream = isNodeReadableStream;
-exports.isWebReadableStream = isWebReadableStream;
-exports.isBinaryBody = isBinaryBody;
-exports.isReadableStream = isReadableStream;
-exports.isBlob = isBlob;
-function isNodeReadableStream(x) {
- return Boolean(x && typeof x["pipe"] === "function");
-}
-function isWebReadableStream(x) {
- return Boolean(x &&
- typeof x.getReader === "function" &&
- typeof x.tee === "function");
-}
-function isBinaryBody(body) {
- return (body !== undefined &&
- (body instanceof Uint8Array ||
- isReadableStream(body) ||
- typeof body === "function" ||
- body instanceof Blob));
-}
-function isReadableStream(x) {
- return isNodeReadableStream(x) || isWebReadableStream(x);
-}
-function isBlob(x) {
- return typeof x.stream === "function";
-}
-//# sourceMappingURL=typeGuards.js.map
-
-/***/ }),
-
-/***/ 2731:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getUserAgentHeaderName = getUserAgentHeaderName;
-exports.getUserAgentValue = getUserAgentValue;
-const userAgentPlatform_js_1 = __nccwpck_require__(3196);
-const constants_js_1 = __nccwpck_require__(1255);
-function getUserAgentString(telemetryInfo) {
- const parts = [];
- for (const [key, value] of telemetryInfo) {
- const token = value ? `${key}/${value}` : key;
- parts.push(token);
- }
- return parts.join(" ");
-}
-/**
- * @internal
- */
-function getUserAgentHeaderName() {
- return (0, userAgentPlatform_js_1.getHeaderName)();
-}
-/**
- * @internal
- */
-async function getUserAgentValue(prefix) {
- const runtimeInfo = new Map();
- runtimeInfo.set("ts-http-runtime", constants_js_1.SDK_VERSION);
- await (0, userAgentPlatform_js_1.setPlatformSpecificData)(runtimeInfo);
- const defaultAgent = getUserAgentString(runtimeInfo);
- const userAgentValue = prefix ? `${prefix} ${defaultAgent}` : defaultAgent;
- return userAgentValue;
-}
-//# sourceMappingURL=userAgent.js.map
-
-/***/ }),
-
-/***/ 3196:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.getHeaderName = getHeaderName;
-exports.setPlatformSpecificData = setPlatformSpecificData;
-const tslib_1 = __nccwpck_require__(1860);
-const os = tslib_1.__importStar(__nccwpck_require__(8161));
-const process = tslib_1.__importStar(__nccwpck_require__(1708));
-/**
- * @internal
- */
-function getHeaderName() {
- return "User-Agent";
-}
-/**
- * @internal
- */
-async function setPlatformSpecificData(map) {
- if (process && process.versions) {
- const versions = process.versions;
- if (versions.bun) {
- map.set("Bun", versions.bun);
- }
- else if (versions.deno) {
- map.set("Deno", versions.deno);
- }
- else if (versions.node) {
- map.set("Node", versions.node);
- }
- }
- map.set("OS", `(${os.arch()}-${os.type()}-${os.release()})`);
-}
-//# sourceMappingURL=userAgentPlatform.js.map
-
-/***/ }),
-
-/***/ 5023:
-/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
-
-"use strict";
-
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-var _a;
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.randomUUID = randomUUID;
-const node_crypto_1 = __nccwpck_require__(7598);
-// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+.
-const uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function"
- ? globalThis.crypto.randomUUID.bind(globalThis.crypto)
- : node_crypto_1.randomUUID;
-/**
- * Generated Universally Unique Identifier
- *
- * @returns RFC4122 v4 UUID.
- */
-function randomUUID() {
- return uuidFunction();
-}
-//# sourceMappingURL=uuidUtils.js.map
-
-/***/ }),
-
-/***/ 591:
-/***/ ((module) => {
-
-(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>ft,XMLParser:()=>st,XMLValidator:()=>mt});const n=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i=new RegExp("^["+n+"]["+n+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function s(t,e){const n=[];let i=e.exec(t);for(;i;){const s=[];s.startIndex=e.lastIndex-i[0].length;const r=i.length;for(let t=0;t"!==t[o]&&" "!==t[o]&&"\t"!==t[o]&&"\n"!==t[o]&&"\r"!==t[o];o++)f+=t[o];if(f=f.trim(),"/"===f[f.length-1]&&(f=f.substring(0,f.length-1),o--),!r(f)){let e;return e=0===f.trim().length?"Invalid space after '<'.":"Tag '"+f+"' is an invalid name.",x("InvalidTag",e,N(t,o))}const p=c(t,o);if(!1===p)return x("InvalidAttr","Attributes for '"+f+"' have open quote.",N(t,o));let b=p.value;if(o=p.index,"/"===b[b.length-1]){const n=o-b.length;b=b.substring(0,b.length-1);const s=g(b,e);if(!0!==s)return x(s.err.code,s.err.msg,N(t,n+s.err.line));i=!0}else if(d){if(!p.tagClosed)return x("InvalidTag","Closing tag '"+f+"' doesn't have proper closing.",N(t,o));if(b.trim().length>0)return x("InvalidTag","Closing tag '"+f+"' can't have attributes or invalid starting.",N(t,a));if(0===n.length)return x("InvalidTag","Closing tag '"+f+"' has not been opened.",N(t,a));{const e=n.pop();if(f!==e.tagName){let n=N(t,e.tagStartPos);return x("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+f+"'.",N(t,a))}0==n.length&&(s=!0)}}else{const r=g(b,e);if(!0!==r)return x(r.err.code,r.err.msg,N(t,o-b.length+r.err.line));if(!0===s)return x("InvalidXml","Multiple possible root nodes found.",N(t,o));-1!==e.unpairedTags.indexOf(f)||n.push({tagName:f,tagStartPos:a}),i=!0}for(o++;o0)||x("InvalidXml","Invalid '"+JSON.stringify(n.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):x("InvalidXml","Start tag expected.",1)}function l(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function u(t,e){const n=e;for(;e5&&"xml"===i)return x("InvalidXml","XML declaration allowed only at the start of the document.",N(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function h(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let n=1;for(e+=8;e"===t[e]&&(n--,0===n))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e"===t[e+2]){e+=2;break}return e}const d='"',f="'";function c(t,e){let n="",i="",s=!1;for(;e"===t[e]&&""===i){s=!0;break}n+=t[e]}return""===i&&{value:n,index:e,tagClosed:s}}const p=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function g(t,e){const n=s(t,p),i={};for(let t=0;t!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t},captureMetaData:!1};let y;y="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class T{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][y]={startIndex:e})}static getMetaDataSymbol(){return y}}function w(t,e){const n={};if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let i=1,s=!1,r=!1,o="";for(;e"===t[e]){if(r?"-"===t[e-1]&&"-"===t[e-2]&&(r=!1,i--):i--,0===i)break}else"["===t[e]?s=!0:o+=t[e];else{if(s&&C(t,"!ENTITY",e)){let i,s;e+=7,[i,s,e]=O(t,e+1),-1===s.indexOf("&")&&(n[i]={regx:RegExp(`&${i};`,"g"),val:s})}else if(s&&C(t,"!ELEMENT",e)){e+=8;const{index:n}=S(t,e+1);e=n}else if(s&&C(t,"!ATTLIST",e))e+=8;else if(s&&C(t,"!NOTATION",e)){e+=9;const{index:n}=A(t,e+1);e=n}else{if(!C(t,"!--",e))throw new Error("Invalid DOCTYPE");r=!0}i++,o=""}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:e}}const P=(t,e)=>{for(;e{for(const n of t){if("string"==typeof n&&e===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}}:()=>!1}class k{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/([0-9]{1,7});/g,val:(t,e)=>String.fromCodePoint(Number.parseInt(e,10))},num_hex:{regex:/([0-9a-fA-F]{1,6});/g,val:(t,e)=>String.fromCodePoint(Number.parseInt(e,16))}},this.addExternalEntities=F,this.parseXml=X,this.parseTextData=L,this.resolveNameSpace=B,this.buildAttributesMap=G,this.isItStopNode=Z,this.replaceEntitiesValue=R,this.readStopNodeData=J,this.saveTextToParentTag=q,this.addChild=Y,this.ignoreAttributesFn=_(this.options.ignoreAttributes)}}function F(t){const e=Object.keys(t);for(let n=0;n0)){o||(t=this.replaceEntitiesValue(t));const i=this.options.tagValueProcessor(e,t,n,s,r);return null==i?t:typeof i!=typeof t||i!==t?i:this.options.trimValues||t.trim()===t?H(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function B(t){if(this.options.removeNSPrefix){const e=t.split(":"),n="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=n+e[1])}return t}const U=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function G(t,e,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const n=s(t,U),i=n.length,r={};for(let t=0;t",r,"Closing Tag is not closed.");let o=t.substring(r+2,e).trim();if(this.options.removeNSPrefix){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),n&&(i=this.saveTextToParentTag(i,n,s));const a=s.substring(s.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: ${o}>`);let l=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(l=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=s.lastIndexOf("."),s=s.substring(0,l),n=this.tagsNodeStack.pop(),i="",r=e}else if("?"===t[r+1]){let e=z(t,r,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,n,s),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new T(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,s,e.tagName)),this.addChild(n,t,s,r)}r=e.closeIndex+1}else if("!--"===t.substr(r+1,3)){const e=W(t,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=t.substring(r+4,e-2);i=this.saveTextToParentTag(i,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=e}else if("!D"===t.substr(r+1,2)){const e=w(t,r);this.docTypeEntities=e.entities,r=e.i}else if("!["===t.substr(r+1,2)){const e=W(t,"]]>",r,"CDATA is not closed.")-2,o=t.substring(r+9,e);i=this.saveTextToParentTag(i,n,s);let a=this.parseTextData(o,n.tagname,s,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):n.add(this.options.textNodeName,a),r=e+2}else{let o=z(t,r,this.options.removeNSPrefix),a=o.tagName;const l=o.rawTagName;let u=o.tagExp,h=o.attrExpPresent,d=o.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&i&&"!xml"!==n.tagname&&(i=this.saveTextToParentTag(i,n,s,!1));const f=n;f&&-1!==this.options.unpairedTags.indexOf(f.tagname)&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),a!==e.tagname&&(s+=s?"."+a:a);const c=r;if(this.isItStopNode(this.options.stopNodes,s,a)){let e="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),u=a):u=u.substr(0,u.length-1),r=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))r=o.closeIndex;else{const n=this.readStopNodeData(t,l,d+1);if(!n)throw new Error(`Unexpected end of ${l}`);r=n.i,e=n.tagContent}const i=new T(a);a!==u&&h&&(i[":@"]=this.buildAttributesMap(u,s,a)),e&&(e=this.parseTextData(e,a,s,!0,h,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),i.add(this.options.textNodeName,e),this.addChild(n,i,s,c)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),u=a):u=u.substr(0,u.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const t=new T(a);a!==u&&h&&(t[":@"]=this.buildAttributesMap(u,s,a)),this.addChild(n,t,s,c),s=s.substr(0,s.lastIndexOf("."))}else{const t=new T(a);this.tagsNodeStack.push(n),a!==u&&h&&(t[":@"]=this.buildAttributesMap(u,s,a)),this.addChild(n,t,s,c),n=t}i="",r=d}}else i+=t[r];return e.child};function Y(t,e,n,i){this.options.captureMetaData||(i=void 0);const s=this.options.updateTag(e.tagname,n,e[":@"]);!1===s||("string"==typeof s?(e.tagname=s,t.addChild(e,i)):t.addChild(e,i))}const R=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const n=this.docTypeEntities[e];t=t.replace(n.regx,n.val)}for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function q(t,e,n,i){return t&&(void 0===i&&(i=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,n,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,i))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function Z(t,e,n){const i="*."+n;for(const n in t){const s=t[n];if(i===s||e===s)return!0}return!1}function W(t,e,n,i){const s=t.indexOf(e,n);if(-1===s)throw new Error(i);return s+e.length-1}function z(t,e,n,i=">"){const s=function(t,e,n=">"){let i,s="";for(let r=e;r",n,`${e} is not closed`);if(t.substring(n+2,r).trim()===e&&(s--,0===s))return{tagContent:t.substring(i,n),i:r};n=r}else if("?"===t[n+1])n=W(t,"?>",n+1,"StopNode is not closed.");else if("!--"===t.substr(n+1,3))n=W(t,"--\x3e",n+3,"StopNode is not closed.");else if("!["===t.substr(n+1,2))n=W(t,"]]>",n,"StopNode is not closed.")-2;else{const i=z(t,n,">");i&&((i&&i.tagName)===e&&"/"!==i.tagExp[i.tagExp.length-1]&&s++,n=i.closeIndex)}}function H(t,e,n){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&function(t,e={}){if(e=Object.assign({},V,e),!t||"string"!=typeof t)return t;let n=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(n))return t;if("0"===t)return 0;if(e.hex&&j.test(n))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(n);if(-1!==n.search(/.+[eE].+/))return function(t,e,n){if(!n.eNotation)return t;const i=e.match(M);if(i){let s=i[1]||"";const r=-1===i[3].indexOf("e")?"E":"e",o=i[2],a=s?t[o.length+1]===r:t[o.length]===r;return o.length>1&&a?t:1!==o.length||!i[3].startsWith(`.${r}`)&&i[3][0]!==r?n.leadingZeros&&!a?(e=(i[1]||"")+i[3],Number(e)):t:Number(e)}return t}(t,n,e);{const s=D.exec(n);if(s){const r=s[1]||"",o=s[2];let a=(i=s[3])&&-1!==i.indexOf(".")?("."===(i=i.replace(/0+$/,""))?i="0":"."===i[0]?i="0"+i:"."===i[i.length-1]&&(i=i.substring(0,i.length-1)),i):i;const l=r?"."===t[o.length+1]:"."===t[o.length];if(!e.leadingZeros&&(o.length>1||1===o.length&&!l))return t;{const i=Number(n),s=String(i);if(0===i||-0===i)return i;if(-1!==s.search(/[eE]/))return e.eNotation?i:t;if(-1!==n.indexOf("."))return"0"===s||s===a||s===`${r}${a}`?i:t;let l=o?a:n;return o?l===s||r+l===s?i:t:l===s||l===r+s?i:t}}return t}var i}(t,n)}return void 0!==t?t:""}const K=T.getMetaDataSymbol();function Q(t,e){return tt(t,e)}function tt(t,e,n){let i;const s={};for(let r=0;r0&&(s[e.textNodeName]=i):void 0!==i&&(s[e.textNodeName]=i),s}function et(t){const e=Object.keys(t);for(let t=0;t0&&(n="\n"),ot(t,e,"",n)}function ot(t,e,n,i){let s="",r=!1;for(let o=0;o`,r=!1;continue}if(l===e.commentPropName){s+=i+`\x3c!--${a[l][0][e.textNodeName]}--\x3e`,r=!0;continue}if("?"===l[0]){const t=lt(a[":@"],e),n="?xml"===l?"":i;let o=a[l][0][e.textNodeName];o=0!==o.length?" "+o:"",s+=n+`<${l}${o}${t}?>`,r=!0;continue}let h=i;""!==h&&(h+=e.indentBy);const d=i+`<${l}${lt(a[":@"],e)}`,f=ot(a[l],e,u,h);-1!==e.unpairedTags.indexOf(l)?e.suppressUnpairedNode?s+=d+">":s+=d+"/>":f&&0!==f.length||!e.suppressEmptyNode?f&&f.endsWith(">")?s+=d+`>${f}${i}${l}>`:(s+=d+">",f&&""!==i&&(f.includes("/>")||f.includes(""))?s+=i+e.indentBy+f+i:s+=f,s+=`${l}>`):s+=d+"/>",r=!0}return s}function at(t){const e=Object.keys(t);for(let n=0;n0&&e.processEntities)for(let n=0;n","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function ft(t){this.options=Object.assign({},dt,t),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=_(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=gt),this.processTextOrObjNode=ct,this.options.format?(this.indentate=pt,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function ct(t,e,n,i){const s=this.j2x(t,n+1,i.concat(e));return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,n):this.buildObjectNode(s.val,e,s.attrStr,n)}function pt(t){return this.options.indentBy.repeat(t)}function gt(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}ft.prototype.build=function(t){return this.options.preserveOrder?rt(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)},ft.prototype.j2x=function(t,e,n){let i="",s="";const r=n.join(".");for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o))if(void 0===t[o])this.isAttribute(o)&&(s+="");else if(null===t[o])this.isAttribute(o)||o===this.options.cdataPropName?s+="":"?"===o[0]?s+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(t[o]instanceof Date)s+=this.buildTextValNode(t[o],o,"",e);else if("object"!=typeof t[o]){const n=this.isAttribute(o);if(n&&!this.ignoreAttributesFn(n,r))i+=this.buildAttrPairStr(n,""+t[o]);else if(!n)if(o===this.options.textNodeName){let e=this.options.tagValueProcessor(o,""+t[o]);s+=this.replaceEntitiesValue(e)}else s+=this.buildTextValNode(t[o],o,"",e)}else if(Array.isArray(t[o])){const i=t[o].length;let r="",a="";for(let l=0;l"+t+s}},ft.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`>${t}`,e},ft.prototype.buildTextValNode=function(t,e,n,i){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(i)+``+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(i)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(i)+"<"+e+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),""===s?this.indentate(i)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+n+">"+s+""+e+this.tagEndChar}},ft.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e {
const version = await selectVersion();
if (os.platform() === 'win32' || os.platform() === 'cygwin') {
- const latest = await selectVersion('latest');
- await winInstall(version, latest);
+ await winInstall(version);
} else {
await unixInstall(version);
}
diff --git a/src/versions.ts b/src/versions.ts
index 8be65a7..e21554b 100644
--- a/src/versions.ts
+++ b/src/versions.ts
@@ -96,11 +96,11 @@ async function selectSha(repo: Repo, sha: string): Promise {
}
}
return Promise.resolve(
- new GitVersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substr(0, 8)}`),
+ new GitVersionImpl(repo, `sha#${shaValue}`, shaValue, 'sha', `commit ${shaValue.substring(0, 8)}`),
);
}
-export async function selectVersion(version?: string): Promise {
+export async function selectVersion(version?: string, _fallback: boolean = false): Promise {
// get version string
version = (version ?? core.getInput('xmake-version')) || 'latest';
if (version.toLowerCase() === 'latest') version = '';
@@ -123,20 +123,20 @@ export async function selectVersion(version?: string): Promise {
// select branch
if (version.startsWith('branch@')) {
- const branch = version.substr('branch@'.length);
+ const branch = version.substring('branch@'.length);
ret = await selectBranch(repo, branch);
}
// select pr
if (version.startsWith('pr@')) {
- const pr = Number.parseInt(version.substr('pr@'.length));
+ const pr = Number.parseInt(version.substring('pr@'.length));
if (Number.isNaN(pr) || pr <= 0) {
- throw new Error(`Invalid pull requrest ${version.substr('pr@'.length)}, should be a positive integer`);
+ throw new Error(`Invalid pull requrest ${version.substring('pr@'.length)}, should be a positive integer`);
}
ret = await selectPr(repo, pr);
}
// select sha
if (version.startsWith('sha@')) {
- const sha = version.substr('sha@'.length);
+ const sha = version.substring('sha@'.length);
ret = await selectSha(repo, sha);
}
// select version
@@ -148,9 +148,9 @@ export async function selectVersion(version?: string): Promise {
}
if (ret.type === 'local') {
core.info(`Use local xmake at '${ret.path}'`);
- } else {
+ } else if (!_fallback) {
core.info(
- `Selected xmake ${String(ret)} (commit: ${ret.sha.substr(0, 8)})` +
+ `Selected xmake ${String(ret)} (commit: ${ret.sha.substring(0, 8)})` +
(repo !== DEFAULT_REPO ? ` of ${repo}` : ''),
);
}
diff --git a/src/win-install.ts b/src/win-install.ts
index 8811ec5..f35524a 100644
--- a/src/win-install.ts
+++ b/src/win-install.ts
@@ -9,18 +9,22 @@ import * as path from 'path';
import * as semver from 'semver';
import * as git from './git';
import { Version, GitVersion } from './interfaces';
+import { selectVersion } from './versions';
import { getPlatformIdentifier } from './system';
-function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
- let ver = version.version;
+async function getInstallerUrl(version: GitVersion, _fallback: boolean = false): Promise {
+ const latest = (await selectVersion('latest', _fallback)) as GitVersion;
+ const latestVers = latest.version;
+ let vers = version.version;
+ let finalUrl: string;
switch (version.type) {
case 'heads': {
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
- const latestver = latest.version;
- if (ver !== 'dev' && ver !== 'master') {
- ver = latestver;
+ if (vers !== 'dev' && vers !== 'master') {
+ vers = latestVers;
}
- return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
+ finalUrl = `https://github.com/xmake-io/xmake/releases/download/${latestVers}/xmake-${vers}.${arch}.exe`;
+ break;
}
case 'pull': {
throw new Error('PR builds for windows is not supported');
@@ -30,9 +34,10 @@ function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
}
case 'tags': {
const arch = os.arch() === 'arm64' ? 'arm64' : os.arch() === 'x64' ? 'win64' : 'win32';
- return semver.gt(ver, '2.2.6')
- ? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
- : `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.exe`;
+ finalUrl = semver.gt(vers, '2.2.6')
+ ? `https://github.com/xmake-io/xmake/releases/download/${vers}/xmake-${vers}.${arch}.exe`
+ : `https://github.com/xmake-io/xmake/releases/download/${vers}/xmake-${vers}.exe`;
+ break;
}
default: {
// check that we have tested all types
@@ -40,6 +45,21 @@ function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
throw new Error('Unknown version type');
}
}
+ // check if the URL returns 404. If so, xmake may have just released a
+ // new version, causing some binaries to be temporarily unavailable, so
+ // we need to fallback to the previous version.
+ if (!_fallback) {
+ const head = await fetch(finalUrl, { method: 'HEAD' });
+ if (head.status === 404) {
+ const currentVers = latestVers || vers;
+ const previousVersion = (await selectVersion('<' + currentVers)) as GitVersion;
+ core.warning(
+ `The requested version ${currentVers} (${finalUrl}) resource is temporarily unavailable, trying to fallback to the previous version...`,
+ );
+ return await getInstallerUrl(previousVersion, true);
+ }
+ }
+ return finalUrl;
}
async function installFromSource(xmakeBin: string, sourceDir: string, binDir: string): Promise {
@@ -47,8 +67,8 @@ async function installFromSource(xmakeBin: string, sourceDir: string, binDir: st
await exec(xmakeBin, ['install', '-o', binDir, 'cli'], { cwd: sourceDir });
}
-export async function winInstall(version: Version, latest: Version): Promise {
- if (version.type === 'local' || latest.type === 'local') {
+export async function winInstall(version: Version): Promise {
+ if (version.type === 'local') {
throw new Error('Local builds for windows is not supported');
}
@@ -85,7 +105,7 @@ export async function winInstall(version: Version, latest: Version): Promise {
- const url = getInstallerUrl(version, latest);
+ const url = await getInstallerUrl(version);
core.info(`downloading from ${url}`);
const file = await toolCache.downloadTool(url);
const exe = path.format({