@ezeep/ezeep-js 1.0.252 → 1.0.253

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1f953145.js');
6
+ require('@typespec/ts-http-runtime/internal/util');
6
7
 
7
8
  const appendToMap = (map, propName, value) => {
8
9
  const items = map.get(propName);
@@ -180,185 +181,104 @@ const createStore = (defaultState, shouldUpdate) => {
180
181
  return map;
181
182
  };
182
183
 
183
- function _typeof$1(obj) {
184
+ function _typeof(o) {
184
185
  "@babel/helpers - typeof";
185
186
 
186
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
187
- _typeof$1 = function _typeof(obj) {
188
- return typeof obj;
189
- };
190
- } else {
191
- _typeof$1 = function _typeof(obj) {
192
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
193
- };
194
- }
195
-
196
- return _typeof$1(obj);
187
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
188
+ return typeof o;
189
+ } : function (o) {
190
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
191
+ }, _typeof(o);
197
192
  }
198
193
 
199
- function _defineProperty(obj, key, value) {
200
- if (key in obj) {
201
- Object.defineProperty(obj, key, {
202
- value: value,
203
- enumerable: true,
204
- configurable: true,
205
- writable: true
206
- });
207
- } else {
208
- obj[key] = value;
194
+ function toPrimitive(t, r) {
195
+ if ("object" != _typeof(t) || !t) return t;
196
+ var e = t[Symbol.toPrimitive];
197
+ if (void 0 !== e) {
198
+ var i = e.call(t, r || "default");
199
+ if ("object" != _typeof(i)) return i;
200
+ throw new TypeError("@@toPrimitive must return a primitive value.");
209
201
  }
210
-
211
- return obj;
202
+ return ("string" === r ? String : Number)(t);
212
203
  }
213
204
 
214
- function _objectSpread(target) {
215
- for (var i = 1; i < arguments.length; i++) {
216
- var source = arguments[i] != null ? Object(arguments[i]) : {};
217
- var ownKeys = Object.keys(source);
218
-
219
- if (typeof Object.getOwnPropertySymbols === 'function') {
220
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
221
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
222
- }));
223
- }
224
-
225
- ownKeys.forEach(function (key) {
226
- _defineProperty(target, key, source[key]);
227
- });
228
- }
229
-
230
- return target;
205
+ function toPropertyKey(t) {
206
+ var i = toPrimitive(t, "string");
207
+ return "symbol" == _typeof(i) ? i : i + "";
231
208
  }
232
209
 
233
- function _classCallCheck(instance, Constructor) {
234
- if (!(instance instanceof Constructor)) {
235
- throw new TypeError("Cannot call a class as a function");
236
- }
210
+ function _defineProperty(e, r, t) {
211
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
212
+ value: t,
213
+ enumerable: !0,
214
+ configurable: !0,
215
+ writable: !0
216
+ }) : e[r] = t, e;
237
217
  }
238
218
 
239
- function _defineProperties(target, props) {
240
- for (var i = 0; i < props.length; i++) {
241
- var descriptor = props[i];
242
- descriptor.enumerable = descriptor.enumerable || false;
243
- descriptor.configurable = true;
244
- if ("value" in descriptor) descriptor.writable = true;
245
- Object.defineProperty(target, descriptor.key, descriptor);
219
+ function _objectSpread(e) {
220
+ for (var r = 1; r < arguments.length; r++) {
221
+ var t = null != arguments[r] ? Object(arguments[r]) : {},
222
+ o = Object.keys(t);
223
+ "function" == typeof Object.getOwnPropertySymbols && o.push.apply(o, Object.getOwnPropertySymbols(t).filter(function (e) {
224
+ return Object.getOwnPropertyDescriptor(t, e).enumerable;
225
+ })), o.forEach(function (r) {
226
+ _defineProperty(e, r, t[r]);
227
+ });
246
228
  }
229
+ return e;
247
230
  }
248
231
 
249
- function _createClass(Constructor, protoProps, staticProps) {
250
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
251
- if (staticProps) _defineProperties(Constructor, staticProps);
252
- return Constructor;
253
- }
254
-
255
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
256
-
257
- function getDefaultExportFromCjs (x) {
258
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
259
- }
260
-
261
- function createCommonjsModule(fn, basedir, module) {
262
- return module = {
263
- path: basedir,
264
- exports: {},
265
- require: function (path, base) {
266
- return commonjsRequire();
267
- }
268
- }, fn(module, module.exports), module.exports;
269
- }
270
-
271
- function getAugmentedNamespace(n) {
272
- if (n.__esModule) return n;
273
- var a = Object.defineProperty({}, '__esModule', {value: true});
274
- Object.keys(n).forEach(function (k) {
275
- var d = Object.getOwnPropertyDescriptor(n, k);
276
- Object.defineProperty(a, k, d.get ? d : {
277
- enumerable: true,
278
- get: function () {
279
- return n[k];
280
- }
281
- });
282
- });
283
- return a;
284
- }
285
-
286
- function commonjsRequire () {
287
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
232
+ function _classCallCheck(a, n) {
233
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
288
234
  }
289
235
 
290
- var _typeof_1 = createCommonjsModule(function (module) {
291
- function _typeof(obj) {
292
- "@babel/helpers - typeof";
293
-
294
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
295
- module.exports = _typeof = function _typeof(obj) {
296
- return typeof obj;
297
- };
298
-
299
- module.exports["default"] = module.exports, module.exports.__esModule = true;
300
- } else {
301
- module.exports = _typeof = function _typeof(obj) {
302
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
303
- };
304
-
305
- module.exports["default"] = module.exports, module.exports.__esModule = true;
236
+ function _defineProperties(e, r) {
237
+ for (var t = 0; t < r.length; t++) {
238
+ var o = r[t];
239
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
306
240
  }
307
-
308
- return _typeof(obj);
309
241
  }
310
-
311
- module.exports = _typeof;
312
- module.exports["default"] = module.exports, module.exports.__esModule = true;
313
- });
314
-
315
- const _typeof = /*@__PURE__*/getDefaultExportFromCjs(_typeof_1);
316
-
317
- function _assertThisInitialized(self) {
318
- if (self === void 0) {
319
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
320
- }
321
-
322
- return self;
242
+ function _createClass(e, r, t) {
243
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
244
+ writable: !1
245
+ }), e;
323
246
  }
324
247
 
325
- function _possibleConstructorReturn(self, call) {
326
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
327
- return call;
328
- }
329
-
330
- return _assertThisInitialized(self);
248
+ function _assertThisInitialized(e) {
249
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
250
+ return e;
331
251
  }
332
252
 
333
- function _getPrototypeOf(o) {
334
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
335
- return o.__proto__ || Object.getPrototypeOf(o);
336
- };
337
- return _getPrototypeOf(o);
253
+ function _possibleConstructorReturn(t, e) {
254
+ if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
255
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
256
+ return _assertThisInitialized(t);
338
257
  }
339
258
 
340
- function _setPrototypeOf(o, p) {
341
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
342
- o.__proto__ = p;
343
- return o;
344
- };
345
-
346
- return _setPrototypeOf(o, p);
259
+ function _getPrototypeOf(t) {
260
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
261
+ return t.__proto__ || Object.getPrototypeOf(t);
262
+ }, _getPrototypeOf(t);
347
263
  }
348
264
 
349
- function _inherits(subClass, superClass) {
350
- if (typeof superClass !== "function" && superClass !== null) {
351
- throw new TypeError("Super expression must either be null or a function");
352
- }
265
+ function _setPrototypeOf(t, e) {
266
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
267
+ return t.__proto__ = e, t;
268
+ }, _setPrototypeOf(t, e);
269
+ }
353
270
 
354
- subClass.prototype = Object.create(superClass && superClass.prototype, {
271
+ function _inherits(t, e) {
272
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
273
+ t.prototype = Object.create(e && e.prototype, {
355
274
  constructor: {
356
- value: subClass,
357
- writable: true,
358
- configurable: true
275
+ value: t,
276
+ writable: !0,
277
+ configurable: !0
359
278
  }
360
- });
361
- if (superClass) _setPrototypeOf(subClass, superClass);
279
+ }), Object.defineProperty(t, "prototype", {
280
+ writable: !1
281
+ }), e && _setPrototypeOf(t, e);
362
282
  }
363
283
 
364
284
  var consoleLogger = {
@@ -977,7 +897,7 @@ var Translator = function (_EventEmitter) {
977
897
  value: function translate(keys, options, lastKey) {
978
898
  var _this2 = this;
979
899
 
980
- if (_typeof$1(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
900
+ if (_typeof(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
981
901
  options = this.options.overloadTranslationOptionHandler(arguments);
982
902
  }
983
903
 
@@ -2233,11 +2153,11 @@ function get() {
2233
2153
  appendNamespaceToCIMode: false,
2234
2154
  overloadTranslationOptionHandler: function handle(args) {
2235
2155
  var ret = {};
2236
- if (_typeof$1(args[1]) === 'object') ret = args[1];
2156
+ if (_typeof(args[1]) === 'object') ret = args[1];
2237
2157
  if (typeof args[1] === 'string') ret.defaultValue = args[1];
2238
2158
  if (typeof args[2] === 'string') ret.tDescription = args[2];
2239
2159
 
2240
- if (_typeof$1(args[2]) === 'object' || _typeof$1(args[3]) === 'object') {
2160
+ if (_typeof(args[2]) === 'object' || _typeof(args[3]) === 'object') {
2241
2161
  var options = args[3] || args[2];
2242
2162
  Object.keys(options).forEach(function (key) {
2243
2163
  ret[key] = options[key];
@@ -2634,7 +2554,7 @@ var I18n = function (_EventEmitter) {
2634
2554
  var fixedT = function fixedT(key, opts) {
2635
2555
  var options;
2636
2556
 
2637
- if (_typeof$1(opts) !== 'object') {
2557
+ if (_typeof(opts) !== 'object') {
2638
2558
  for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2639
2559
  rest[_key3 - 2] = arguments[_key3];
2640
2560
  }
@@ -4174,6 +4094,23 @@ const fetch$2 = /*#__PURE__*/Object.freeze({
4174
4094
  fetch: fetch$1
4175
4095
  });
4176
4096
 
4097
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4098
+
4099
+ function getAugmentedNamespace(n) {
4100
+ if (n.__esModule) return n;
4101
+ var a = Object.defineProperty({}, '__esModule', {value: true});
4102
+ Object.keys(n).forEach(function (k) {
4103
+ var d = Object.getOwnPropertyDescriptor(n, k);
4104
+ Object.defineProperty(a, k, d.get ? d : {
4105
+ enumerable: true,
4106
+ get: function () {
4107
+ return n[k];
4108
+ }
4109
+ });
4110
+ });
4111
+ return a;
4112
+ }
4113
+
4177
4114
  const require$$0 = /*@__PURE__*/getAugmentedNamespace(fetch$2);
4178
4115
 
4179
4116
  var browser =
@@ -4520,7 +4457,7 @@ const Constants = {
4520
4457
  /**
4521
4458
  * The core-http version
4522
4459
  */
4523
- coreHttpVersion: "2.2.3",
4460
+ coreHttpVersion: "2.3.2",
4524
4461
  /**
4525
4462
  * Specifies HTTP.
4526
4463
  */
@@ -4771,6 +4708,7 @@ class Serializer {
4771
4708
  * @param mapper - The definition of data models.
4772
4709
  * @param value - The value.
4773
4710
  * @param objectName - Name of the object. Used in the error messages.
4711
+ * @deprecated Removing the constraints validation on client side.
4774
4712
  */
4775
4713
  validateConstraints(mapper, value, objectName) {
4776
4714
  const failValidation = (constraintName, constraintValue) => {
@@ -4869,8 +4807,6 @@ class Serializer {
4869
4807
  payload = object;
4870
4808
  }
4871
4809
  else {
4872
- // Validate Constraints if any
4873
- this.validateConstraints(mapper, object, objectName);
4874
4810
  if (mapperType.match(/^any$/i) !== null) {
4875
4811
  payload = object;
4876
4812
  }
@@ -5388,7 +5324,8 @@ function isSpecialXmlProperty(propertyName, options) {
5388
5324
  return [XML_ATTRKEY, options.xmlCharKey].includes(propertyName);
5389
5325
  }
5390
5326
  function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) {
5391
- var _a;
5327
+ var _a, _b;
5328
+ const xmlCharKey = (_a = options.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
5392
5329
  if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
5393
5330
  mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName");
5394
5331
  }
@@ -5419,6 +5356,16 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
5419
5356
  if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) {
5420
5357
  instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options);
5421
5358
  }
5359
+ else if (propertyMapper.xmlIsMsText) {
5360
+ if (responseBody[xmlCharKey] !== undefined) {
5361
+ instance[key] = responseBody[xmlCharKey];
5362
+ }
5363
+ else if (typeof responseBody === "string") {
5364
+ // The special case where xml parser parses "<Name>content</Name>" into JSON of
5365
+ // `{ name: "content"}` instead of `{ name: { "_": "content" }}`
5366
+ instance[key] = responseBody;
5367
+ }
5368
+ }
5422
5369
  else {
5423
5370
  const propertyName = xmlElementName || xmlName || serializedName;
5424
5371
  if (propertyMapper.xmlIsWrapped) {
@@ -5437,7 +5384,7 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
5437
5384
  xmlName is "Cors" and xmlElementName is"CorsRule".
5438
5385
  */
5439
5386
  const wrapped = responseBody[xmlName];
5440
- const elementList = (_a = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _a !== void 0 ? _a : [];
5387
+ const elementList = (_b = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _b !== void 0 ? _b : [];
5441
5388
  instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options);
5442
5389
  }
5443
5390
  else {
@@ -5877,7 +5824,7 @@ class WebResource {
5877
5824
  }
5878
5825
  }
5879
5826
 
5880
- /*! *****************************************************************************
5827
+ /******************************************************************************
5881
5828
  Copyright (c) Microsoft Corporation.
5882
5829
 
5883
5830
  Permission to use, copy, modify, and/or distribute this software for any
@@ -5891,7 +5838,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
5891
5838
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5892
5839
  PERFORMANCE OF THIS SOFTWARE.
5893
5840
  ***************************************************************************** */
5894
- /* global Reflect, Promise */
5841
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
5895
5842
 
5896
5843
  var extendStatics = function(d, b) {
5897
5844
  extendStatics = Object.setPrototypeOf ||
@@ -5918,7 +5865,12 @@ function __rest(s, e) {
5918
5865
  t[p[i]] = s[p[i]];
5919
5866
  }
5920
5867
  return t;
5921
- }
5868
+ }
5869
+
5870
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
5871
+ var e = new Error(message);
5872
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
5873
+ };
5922
5874
 
5923
5875
  // Copyright (c) Microsoft Corporation.
5924
5876
  // Licensed under the MIT license.
@@ -6062,7 +6014,7 @@ function abortSignal(signal) {
6062
6014
  * }
6063
6015
  * ```
6064
6016
  */
6065
- var AbortError = /** @class */ (function (_super) {
6017
+ var AbortError$1 = /** @class */ (function (_super) {
6066
6018
  __extends(AbortError, _super);
6067
6019
  function AbortError(message) {
6068
6020
  var _this = _super.call(this, message) || this;
@@ -6169,10 +6121,6 @@ var AbortError = /** @class */ (function (_super) {
6169
6121
  return AbortController;
6170
6122
  })());
6171
6123
 
6172
- // Copyright (c) Microsoft Corporation.
6173
- // Licensed under the MIT license.
6174
- const url$1 = URL;
6175
-
6176
6124
  // Copyright (c) Microsoft Corporation.
6177
6125
  /**
6178
6126
  * A class that handles the query portion of a URLBuilder.
@@ -6809,6 +6757,7 @@ const defaultAllowedHeaderNames = [
6809
6757
  "Server",
6810
6758
  "Transfer-Encoding",
6811
6759
  "User-Agent",
6760
+ "WWW-Authenticate",
6812
6761
  ];
6813
6762
  const defaultAllowedQueryParameters = ["api-version"];
6814
6763
  class Sanitizer {
@@ -6950,7 +6899,7 @@ class XhrHttpClient {
6950
6899
  const abortSignal = request.abortSignal;
6951
6900
  if (abortSignal) {
6952
6901
  if (abortSignal.aborted) {
6953
- return Promise.reject(new AbortError("The operation was aborted."));
6902
+ return Promise.reject(new AbortError$1("The operation was aborted."));
6954
6903
  }
6955
6904
  const listener = () => {
6956
6905
  xhr.abort();
@@ -7103,7 +7052,7 @@ function parseHeaders(xhr) {
7103
7052
  }
7104
7053
  function rejectOnTerminalEvent(request, xhr, reject) {
7105
7054
  xhr.addEventListener("error", () => reject(new RestError(`Failed to send request to ${request.url}`, RestError.REQUEST_SEND_ERROR, undefined, request)));
7106
- const abortError = new AbortError("The operation was aborted.");
7055
+ const abortError = new AbortError$1("The operation was aborted.");
7107
7056
  xhr.addEventListener("abort", () => reject(abortError));
7108
7057
  xhr.addEventListener("timeout", () => reject(abortError));
7109
7058
  }
@@ -7140,7 +7089,6 @@ var HttpPipelineLogLevel;
7140
7089
  * @param opts - OperationOptions object to convert to RequestOptionsBase
7141
7090
  */
7142
7091
  function operationOptionsToRequestOptionsBase(opts) {
7143
- var _a;
7144
7092
  const { requestOptions, tracingOptions } = opts, additionalOptions = __rest(opts, ["requestOptions", "tracingOptions"]);
7145
7093
  let result = additionalOptions;
7146
7094
  if (requestOptions) {
@@ -7149,7 +7097,7 @@ function operationOptionsToRequestOptionsBase(opts) {
7149
7097
  if (tracingOptions) {
7150
7098
  result.tracingContext = tracingOptions.tracingContext;
7151
7099
  // By passing spanOptions if they exist at runtime, we're backwards compatible with @azure/core-tracing@preview.13 and earlier.
7152
- result.spanOptions = (_a = tracingOptions) === null || _a === void 0 ? void 0 : _a.spanOptions;
7100
+ result.spanOptions = tracingOptions === null || tracingOptions === void 0 ? void 0 : tracingOptions.spanOptions;
7153
7101
  }
7154
7102
  return result;
7155
7103
  }
@@ -7226,17 +7174,48 @@ class RequestPolicyOptions {
7226
7174
  if (!self.document || !self.DOMParser || !self.Node || !self.XMLSerializer) {
7227
7175
  throw new Error(`This library depends on the following DOM objects: ["document", "DOMParser", "Node", "XMLSerializer"] to parse XML, but some of these are undefined. You may provide a polyfill to make these globally available in order to support your environment. For more information, please refer to https://aka.ms/azsdk/js/web-workers. `);
7228
7176
  }
7229
- const doc = document.implementation.createDocument(null, null, null);
7230
- const parser = new DOMParser();
7177
+ let cachedDoc;
7178
+ function getDoc() {
7179
+ if (!cachedDoc) {
7180
+ cachedDoc = document.implementation.createDocument(null, null, null);
7181
+ }
7182
+ return cachedDoc;
7183
+ }
7184
+ let cachedParser;
7185
+ function getParser() {
7186
+ if (!cachedParser) {
7187
+ cachedParser = new DOMParser();
7188
+ }
7189
+ return cachedParser;
7190
+ }
7191
+ let cachedSerializer;
7192
+ function getSerializer() {
7193
+ if (!cachedSerializer) {
7194
+ cachedSerializer = new XMLSerializer();
7195
+ }
7196
+ return cachedSerializer;
7197
+ }
7198
+ // Policy to make our code Trusted Types compliant.
7199
+ // https://github.com/w3c/webappsec-trusted-types
7200
+ // We are calling DOMParser.parseFromString() to parse XML payload from Azure services.
7201
+ // The parsed DOM object is not exposed to outside. Scripts are disabled when parsing
7202
+ // according to the spec. There are no HTML/XSS security concerns on the usage of
7203
+ // parseFromString() here.
7204
+ let ttPolicy;
7205
+ if (typeof self.trustedTypes !== "undefined") {
7206
+ ttPolicy = self.trustedTypes.createPolicy("@azure/core-http#xml.browser", {
7207
+ createHTML: (s) => s,
7208
+ });
7209
+ }
7231
7210
  function parseXML(str, opts = {}) {
7232
- var _a, _b, _c;
7211
+ var _a, _b, _c, _d;
7233
7212
  try {
7234
7213
  const updatedOptions = {
7235
7214
  rootName: (_a = opts.rootName) !== null && _a !== void 0 ? _a : "",
7236
7215
  includeRoot: (_b = opts.includeRoot) !== null && _b !== void 0 ? _b : false,
7237
7216
  xmlCharKey: (_c = opts.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY,
7238
7217
  };
7239
- const dom = parser.parseFromString(str, "application/xml");
7218
+ const dom = getParser().parseFromString(((_d = ttPolicy === null || ttPolicy === void 0 ? void 0 : ttPolicy.createHTML(str)) !== null && _d !== void 0 ? _d : str), "application/xml");
7240
7219
  throwIfError(dom);
7241
7220
  let obj;
7242
7221
  if (updatedOptions.includeRoot) {
@@ -7253,12 +7232,13 @@ function parseXML(str, opts = {}) {
7253
7232
  }
7254
7233
  let errorNS;
7255
7234
  function getErrorNamespace() {
7256
- var _a;
7235
+ var _a, _b;
7257
7236
  if (errorNS === undefined) {
7258
7237
  try {
7238
+ const invalidXML = ((_a = ttPolicy === null || ttPolicy === void 0 ? void 0 : ttPolicy.createHTML("INVALID")) !== null && _a !== void 0 ? _a : "INVALID");
7259
7239
  errorNS =
7260
- (_a = parser.parseFromString("INVALID", "text/xml").getElementsByTagName("parsererror")[0]
7261
- .namespaceURI) !== null && _a !== void 0 ? _a : "";
7240
+ (_b = getParser().parseFromString(invalidXML, "text/xml").getElementsByTagName("parsererror")[0]
7241
+ .namespaceURI) !== null && _b !== void 0 ? _b : "";
7262
7242
  }
7263
7243
  catch (ignored) {
7264
7244
  // Most browsers will return a document containing <parsererror>, but IE will throw.
@@ -7333,7 +7313,6 @@ function domToObject(node, options) {
7333
7313
  }
7334
7314
  return result;
7335
7315
  }
7336
- const serializer$3 = new XMLSerializer();
7337
7316
  function stringifyXML(content, opts = {}) {
7338
7317
  var _a, _b, _c;
7339
7318
  const updatedOptions = {
@@ -7342,12 +7321,13 @@ function stringifyXML(content, opts = {}) {
7342
7321
  xmlCharKey: (_c = opts.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY,
7343
7322
  };
7344
7323
  const dom = buildNode(content, updatedOptions.rootName, updatedOptions)[0];
7345
- return ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + serializer$3.serializeToString(dom));
7324
+ return ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
7325
+ getSerializer().serializeToString(dom));
7346
7326
  }
7347
7327
  function buildAttributes(attrs) {
7348
7328
  const result = [];
7349
7329
  for (const key of Object.keys(attrs)) {
7350
- const attr = doc.createAttribute(key);
7330
+ const attr = getDoc().createAttribute(key);
7351
7331
  attr.value = attrs[key].toString();
7352
7332
  result.push(attr);
7353
7333
  }
@@ -7359,7 +7339,7 @@ function buildNode(obj, elementName, options) {
7359
7339
  typeof obj === "string" ||
7360
7340
  typeof obj === "number" ||
7361
7341
  typeof obj === "boolean") {
7362
- const elem = doc.createElement(elementName);
7342
+ const elem = getDoc().createElement(elementName);
7363
7343
  elem.textContent = obj === undefined || obj === null ? "" : obj.toString();
7364
7344
  return [elem];
7365
7345
  }
@@ -7373,7 +7353,7 @@ function buildNode(obj, elementName, options) {
7373
7353
  return result;
7374
7354
  }
7375
7355
  else if (typeof obj === "object") {
7376
- const elem = doc.createElement(elementName);
7356
+ const elem = getDoc().createElement(elementName);
7377
7357
  for (const key of Object.keys(obj)) {
7378
7358
  if (key === XML_ATTRKEY) {
7379
7359
  for (const attr of buildAttributes(obj[key])) {
@@ -7514,7 +7494,7 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, op
7514
7494
  parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
7515
7495
  }
7516
7496
  if (responseSpec.headersMapper) {
7517
- parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders", options);
7497
+ parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.toJson(), "operationRes.parsedHeaders", options);
7518
7498
  }
7519
7499
  }
7520
7500
  return parsedResponse;
@@ -7580,7 +7560,7 @@ function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
7580
7560
  }
7581
7561
  // If error response has headers, try to deserialize it using default header mapper
7582
7562
  if (parsedResponse.headers && defaultHeadersMapper) {
7583
- error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
7563
+ error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.toJson(), "operationRes.parsedHeaders");
7584
7564
  }
7585
7565
  }
7586
7566
  catch (defaultError) {
@@ -7780,54 +7760,87 @@ function updateRetryData(retryOptions, retryData = { retryCount: 0, retryInterva
7780
7760
  // Copyright (c) Microsoft Corporation.
7781
7761
  // Licensed under the MIT license.
7782
7762
  /**
7783
- * Helper TypeGuard that checks if the value is not null or undefined.
7784
- * @param thing - Anything
7785
- * @internal
7763
+ * This error is thrown when an asynchronous operation has been aborted.
7764
+ * Check for this error by testing the `name` that the name property of the
7765
+ * error matches `"AbortError"`.
7766
+ *
7767
+ * @example
7768
+ * ```ts
7769
+ * const controller = new AbortController();
7770
+ * controller.abort();
7771
+ * try {
7772
+ * doAsyncWork(controller.signal)
7773
+ * } catch (e) {
7774
+ * if (e.name === 'AbortError') {
7775
+ * // handle abort error here.
7776
+ * }
7777
+ * }
7778
+ * ```
7786
7779
  */
7787
- function isDefined(thing) {
7788
- return typeof thing !== "undefined" && thing !== null;
7780
+ class AbortError extends Error {
7781
+ constructor(message) {
7782
+ super(message);
7783
+ this.name = "AbortError";
7784
+ }
7789
7785
  }
7790
7786
 
7791
7787
  // Copyright (c) Microsoft Corporation.
7792
- const StandardAbortMessage$1 = "The operation was aborted.";
7793
7788
  /**
7794
- * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds.
7795
- * @param delayInMs - The number of milliseconds to be delayed.
7796
- * @param value - The value to be resolved with after a timeout of t milliseconds.
7797
- * @param options - The options for delay - currently abort options
7798
- * @param abortSignal - The abortSignal associated with containing operation.
7799
- * @param abortErrorMsg - The abort error message associated with containing operation.
7800
- * @returns - Resolved promise
7789
+ * Creates an abortable promise.
7790
+ * @param buildPromise - A function that takes the resolve and reject functions as parameters.
7791
+ * @param options - The options for the abortable promise.
7792
+ * @returns A promise that can be aborted.
7801
7793
  */
7802
- function delay$1(delayInMs, value, options) {
7794
+ function createAbortablePromise(buildPromise, options) {
7795
+ const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};
7803
7796
  return new Promise((resolve, reject) => {
7804
- let timer = undefined;
7805
- let onAborted = undefined;
7806
- const rejectOnAbort = () => {
7807
- return reject(new AbortError((options === null || options === void 0 ? void 0 : options.abortErrorMsg) ? options === null || options === void 0 ? void 0 : options.abortErrorMsg : StandardAbortMessage$1));
7808
- };
7809
- const removeListeners = () => {
7810
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) && onAborted) {
7811
- options.abortSignal.removeEventListener("abort", onAborted);
7812
- }
7813
- };
7814
- onAborted = () => {
7815
- if (isDefined(timer)) {
7816
- clearTimeout(timer);
7817
- }
7797
+ function rejectOnAbort() {
7798
+ reject(new AbortError(abortErrorMsg ?? "The operation was aborted."));
7799
+ }
7800
+ function removeListeners() {
7801
+ abortSignal?.removeEventListener("abort", onAbort);
7802
+ }
7803
+ function onAbort() {
7804
+ cleanupBeforeAbort?.();
7818
7805
  removeListeners();
7819
- return rejectOnAbort();
7820
- };
7821
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) && options.abortSignal.aborted) {
7806
+ rejectOnAbort();
7807
+ }
7808
+ if (abortSignal?.aborted) {
7822
7809
  return rejectOnAbort();
7823
7810
  }
7824
- timer = setTimeout(() => {
7825
- removeListeners();
7826
- resolve(value);
7827
- }, delayInMs);
7828
- if (options === null || options === void 0 ? void 0 : options.abortSignal) {
7829
- options.abortSignal.addEventListener("abort", onAborted);
7811
+ try {
7812
+ buildPromise((x) => {
7813
+ removeListeners();
7814
+ resolve(x);
7815
+ }, (x) => {
7816
+ removeListeners();
7817
+ reject(x);
7818
+ });
7830
7819
  }
7820
+ catch (err) {
7821
+ reject(err);
7822
+ }
7823
+ abortSignal?.addEventListener("abort", onAbort);
7824
+ });
7825
+ }
7826
+
7827
+ // Copyright (c) Microsoft Corporation.
7828
+ const StandardAbortMessage$1 = "The delay was aborted.";
7829
+ /**
7830
+ * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
7831
+ * @param timeInMs - The number of milliseconds to be delayed.
7832
+ * @param options - The options for delay - currently abort options
7833
+ * @returns Promise that is resolved after timeInMs
7834
+ */
7835
+ function delay$1(timeInMs, options) {
7836
+ let token;
7837
+ const { abortSignal, abortErrorMsg } = options ?? {};
7838
+ return createAbortablePromise((resolve) => {
7839
+ token = setTimeout(resolve, timeInMs);
7840
+ }, {
7841
+ cleanupBeforeAbort: () => clearTimeout(token),
7842
+ abortSignal,
7843
+ abortErrorMsg: abortErrorMsg ?? StandardAbortMessage$1,
7831
7844
  });
7832
7845
  }
7833
7846
 
@@ -8942,12 +8955,12 @@ class ThrottlingRetryPolicy extends BaseRequestPolicy {
8942
8955
  const delayInMs = ThrottlingRetryPolicy.parseRetryAfterHeader(retryAfterHeader);
8943
8956
  if (delayInMs) {
8944
8957
  this.numberOfRetries += 1;
8945
- await delay$1(delayInMs, undefined, {
8958
+ await delay$1(delayInMs, {
8946
8959
  abortSignal: httpRequest.abortSignal,
8947
8960
  abortErrorMsg: StandardAbortMessage,
8948
8961
  });
8949
8962
  if ((_a = httpRequest.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
8950
- throw new AbortError(StandardAbortMessage);
8963
+ throw new AbortError$1(StandardAbortMessage);
8951
8964
  }
8952
8965
  if (this.numberOfRetries < DEFAULT_CLIENT_MAX_RETRY_COUNT) {
8953
8966
  return this.sendRequest(httpRequest);
@@ -10732,10 +10745,9 @@ class TracingPolicy extends BaseRequestPolicy {
10732
10745
  tryCreateSpan(request) {
10733
10746
  var _a;
10734
10747
  try {
10735
- const path = URLBuilder.parse(request.url).getPath() || "/";
10736
10748
  // Passing spanOptions as part of tracingOptions to maintain compatibility @azure/core-tracing@preview.13 and earlier.
10737
10749
  // We can pass this as a separate parameter once we upgrade to the latest core-tracing.
10738
- const { span } = createSpan$1(path, {
10750
+ const { span } = createSpan$1(`HTTP ${request.method}`, {
10739
10751
  tracingOptions: {
10740
10752
  spanOptions: Object.assign(Object.assign({}, request.spanOptions), { kind: SpanKind.CLIENT }),
10741
10753
  tracingContext: request.tracingContext,
@@ -11327,8 +11339,8 @@ function getCredentialScopes(options, baseUri) {
11327
11339
  if (options === null || options === void 0 ? void 0 : options.credentialScopes) {
11328
11340
  const scopes = options.credentialScopes;
11329
11341
  return Array.isArray(scopes)
11330
- ? scopes.map((scope) => new url$1(scope).toString())
11331
- : new url$1(scopes).toString();
11342
+ ? scopes.map((scope) => new URL(scope).toString())
11343
+ : new URL(scopes).toString();
11332
11344
  }
11333
11345
  if (baseUri) {
11334
11346
  return `${baseUri}/.default`;
@@ -26820,7 +26832,7 @@ const DEFAULT_RETRY_OPTIONS = {
26820
26832
  secondaryHost: "",
26821
26833
  tryTimeoutInMs: undefined // Use server side default timeout strategy
26822
26834
  };
26823
- const RETRY_ABORT_ERROR = new AbortError("The operation was aborted.");
26835
+ const RETRY_ABORT_ERROR = new AbortError$1("The operation was aborted.");
26824
26836
  /**
26825
26837
  * Retry policy with exponential retry and linear retry implemented.
26826
26838
  */