@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.
@@ -1,5 +1,6 @@
1
1
  import { getRenderingRef, forceUpdate, HTMLElement, createEvent, h, Host, getAssetPath, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
2
2
  export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
3
+ import '@typespec/ts-http-runtime/internal/util';
3
4
 
4
5
  const appGlobalScript = async () => {
5
6
  const font = new FontFace('Inter', 'url(https://rsms.me/inter/font-files/Inter-roman.var.woff2)', {
@@ -189,185 +190,104 @@ const createStore = (defaultState, shouldUpdate) => {
189
190
  return map;
190
191
  };
191
192
 
192
- function _typeof$1(obj) {
193
+ function _typeof(o) {
193
194
  "@babel/helpers - typeof";
194
195
 
195
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
196
- _typeof$1 = function _typeof(obj) {
197
- return typeof obj;
198
- };
199
- } else {
200
- _typeof$1 = function _typeof(obj) {
201
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
202
- };
203
- }
204
-
205
- return _typeof$1(obj);
196
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
197
+ return typeof o;
198
+ } : function (o) {
199
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
200
+ }, _typeof(o);
206
201
  }
207
202
 
208
- function _defineProperty(obj, key, value) {
209
- if (key in obj) {
210
- Object.defineProperty(obj, key, {
211
- value: value,
212
- enumerable: true,
213
- configurable: true,
214
- writable: true
215
- });
216
- } else {
217
- obj[key] = value;
203
+ function toPrimitive(t, r) {
204
+ if ("object" != _typeof(t) || !t) return t;
205
+ var e = t[Symbol.toPrimitive];
206
+ if (void 0 !== e) {
207
+ var i = e.call(t, r || "default");
208
+ if ("object" != _typeof(i)) return i;
209
+ throw new TypeError("@@toPrimitive must return a primitive value.");
218
210
  }
219
-
220
- return obj;
211
+ return ("string" === r ? String : Number)(t);
221
212
  }
222
213
 
223
- function _objectSpread(target) {
224
- for (var i = 1; i < arguments.length; i++) {
225
- var source = arguments[i] != null ? Object(arguments[i]) : {};
226
- var ownKeys = Object.keys(source);
227
-
228
- if (typeof Object.getOwnPropertySymbols === 'function') {
229
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
230
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
231
- }));
232
- }
233
-
234
- ownKeys.forEach(function (key) {
235
- _defineProperty(target, key, source[key]);
236
- });
237
- }
238
-
239
- return target;
214
+ function toPropertyKey(t) {
215
+ var i = toPrimitive(t, "string");
216
+ return "symbol" == _typeof(i) ? i : i + "";
240
217
  }
241
218
 
242
- function _classCallCheck(instance, Constructor) {
243
- if (!(instance instanceof Constructor)) {
244
- throw new TypeError("Cannot call a class as a function");
245
- }
219
+ function _defineProperty(e, r, t) {
220
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
221
+ value: t,
222
+ enumerable: !0,
223
+ configurable: !0,
224
+ writable: !0
225
+ }) : e[r] = t, e;
246
226
  }
247
227
 
248
- function _defineProperties(target, props) {
249
- for (var i = 0; i < props.length; i++) {
250
- var descriptor = props[i];
251
- descriptor.enumerable = descriptor.enumerable || false;
252
- descriptor.configurable = true;
253
- if ("value" in descriptor) descriptor.writable = true;
254
- Object.defineProperty(target, descriptor.key, descriptor);
228
+ function _objectSpread(e) {
229
+ for (var r = 1; r < arguments.length; r++) {
230
+ var t = null != arguments[r] ? Object(arguments[r]) : {},
231
+ o = Object.keys(t);
232
+ "function" == typeof Object.getOwnPropertySymbols && o.push.apply(o, Object.getOwnPropertySymbols(t).filter(function (e) {
233
+ return Object.getOwnPropertyDescriptor(t, e).enumerable;
234
+ })), o.forEach(function (r) {
235
+ _defineProperty(e, r, t[r]);
236
+ });
255
237
  }
238
+ return e;
256
239
  }
257
240
 
258
- function _createClass(Constructor, protoProps, staticProps) {
259
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
260
- if (staticProps) _defineProperties(Constructor, staticProps);
261
- return Constructor;
262
- }
263
-
264
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
265
-
266
- function getDefaultExportFromCjs (x) {
267
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
268
- }
269
-
270
- function createCommonjsModule(fn, basedir, module) {
271
- return module = {
272
- path: basedir,
273
- exports: {},
274
- require: function (path, base) {
275
- return commonjsRequire();
276
- }
277
- }, fn(module, module.exports), module.exports;
278
- }
279
-
280
- function getAugmentedNamespace(n) {
281
- if (n.__esModule) return n;
282
- var a = Object.defineProperty({}, '__esModule', {value: true});
283
- Object.keys(n).forEach(function (k) {
284
- var d = Object.getOwnPropertyDescriptor(n, k);
285
- Object.defineProperty(a, k, d.get ? d : {
286
- enumerable: true,
287
- get: function () {
288
- return n[k];
289
- }
290
- });
291
- });
292
- return a;
293
- }
294
-
295
- function commonjsRequire () {
296
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
241
+ function _classCallCheck(a, n) {
242
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
297
243
  }
298
244
 
299
- var _typeof_1 = createCommonjsModule(function (module) {
300
- function _typeof(obj) {
301
- "@babel/helpers - typeof";
302
-
303
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
304
- module.exports = _typeof = function _typeof(obj) {
305
- return typeof obj;
306
- };
307
-
308
- module.exports["default"] = module.exports, module.exports.__esModule = true;
309
- } else {
310
- module.exports = _typeof = function _typeof(obj) {
311
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
312
- };
313
-
314
- module.exports["default"] = module.exports, module.exports.__esModule = true;
245
+ function _defineProperties(e, r) {
246
+ for (var t = 0; t < r.length; t++) {
247
+ var o = r[t];
248
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
315
249
  }
316
-
317
- return _typeof(obj);
318
250
  }
319
-
320
- module.exports = _typeof;
321
- module.exports["default"] = module.exports, module.exports.__esModule = true;
322
- });
323
-
324
- const _typeof = /*@__PURE__*/getDefaultExportFromCjs(_typeof_1);
325
-
326
- function _assertThisInitialized(self) {
327
- if (self === void 0) {
328
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
329
- }
330
-
331
- return self;
251
+ function _createClass(e, r, t) {
252
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
253
+ writable: !1
254
+ }), e;
332
255
  }
333
256
 
334
- function _possibleConstructorReturn(self, call) {
335
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
336
- return call;
337
- }
338
-
339
- return _assertThisInitialized(self);
257
+ function _assertThisInitialized(e) {
258
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
259
+ return e;
340
260
  }
341
261
 
342
- function _getPrototypeOf(o) {
343
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
344
- return o.__proto__ || Object.getPrototypeOf(o);
345
- };
346
- return _getPrototypeOf(o);
262
+ function _possibleConstructorReturn(t, e) {
263
+ if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
264
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
265
+ return _assertThisInitialized(t);
347
266
  }
348
267
 
349
- function _setPrototypeOf(o, p) {
350
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
351
- o.__proto__ = p;
352
- return o;
353
- };
354
-
355
- return _setPrototypeOf(o, p);
268
+ function _getPrototypeOf(t) {
269
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
270
+ return t.__proto__ || Object.getPrototypeOf(t);
271
+ }, _getPrototypeOf(t);
356
272
  }
357
273
 
358
- function _inherits(subClass, superClass) {
359
- if (typeof superClass !== "function" && superClass !== null) {
360
- throw new TypeError("Super expression must either be null or a function");
361
- }
274
+ function _setPrototypeOf(t, e) {
275
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
276
+ return t.__proto__ = e, t;
277
+ }, _setPrototypeOf(t, e);
278
+ }
362
279
 
363
- subClass.prototype = Object.create(superClass && superClass.prototype, {
280
+ function _inherits(t, e) {
281
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
282
+ t.prototype = Object.create(e && e.prototype, {
364
283
  constructor: {
365
- value: subClass,
366
- writable: true,
367
- configurable: true
284
+ value: t,
285
+ writable: !0,
286
+ configurable: !0
368
287
  }
369
- });
370
- if (superClass) _setPrototypeOf(subClass, superClass);
288
+ }), Object.defineProperty(t, "prototype", {
289
+ writable: !1
290
+ }), e && _setPrototypeOf(t, e);
371
291
  }
372
292
 
373
293
  var consoleLogger = {
@@ -986,7 +906,7 @@ var Translator = function (_EventEmitter) {
986
906
  value: function translate(keys, options, lastKey) {
987
907
  var _this2 = this;
988
908
 
989
- if (_typeof$1(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
909
+ if (_typeof(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
990
910
  options = this.options.overloadTranslationOptionHandler(arguments);
991
911
  }
992
912
 
@@ -2242,11 +2162,11 @@ function get() {
2242
2162
  appendNamespaceToCIMode: false,
2243
2163
  overloadTranslationOptionHandler: function handle(args) {
2244
2164
  var ret = {};
2245
- if (_typeof$1(args[1]) === 'object') ret = args[1];
2165
+ if (_typeof(args[1]) === 'object') ret = args[1];
2246
2166
  if (typeof args[1] === 'string') ret.defaultValue = args[1];
2247
2167
  if (typeof args[2] === 'string') ret.tDescription = args[2];
2248
2168
 
2249
- if (_typeof$1(args[2]) === 'object' || _typeof$1(args[3]) === 'object') {
2169
+ if (_typeof(args[2]) === 'object' || _typeof(args[3]) === 'object') {
2250
2170
  var options = args[3] || args[2];
2251
2171
  Object.keys(options).forEach(function (key) {
2252
2172
  ret[key] = options[key];
@@ -2643,7 +2563,7 @@ var I18n = function (_EventEmitter) {
2643
2563
  var fixedT = function fixedT(key, opts) {
2644
2564
  var options;
2645
2565
 
2646
- if (_typeof$1(opts) !== 'object') {
2566
+ if (_typeof(opts) !== 'object') {
2647
2567
  for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2648
2568
  rest[_key3 - 2] = arguments[_key3];
2649
2569
  }
@@ -4197,6 +4117,23 @@ const fetch$2 = /*#__PURE__*/Object.freeze({
4197
4117
  fetch: fetch$1
4198
4118
  });
4199
4119
 
4120
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4121
+
4122
+ function getAugmentedNamespace(n) {
4123
+ if (n.__esModule) return n;
4124
+ var a = Object.defineProperty({}, '__esModule', {value: true});
4125
+ Object.keys(n).forEach(function (k) {
4126
+ var d = Object.getOwnPropertyDescriptor(n, k);
4127
+ Object.defineProperty(a, k, d.get ? d : {
4128
+ enumerable: true,
4129
+ get: function () {
4130
+ return n[k];
4131
+ }
4132
+ });
4133
+ });
4134
+ return a;
4135
+ }
4136
+
4200
4137
  const require$$0 = /*@__PURE__*/getAugmentedNamespace(fetch$2);
4201
4138
 
4202
4139
  var browser =
@@ -4543,7 +4480,7 @@ const Constants = {
4543
4480
  /**
4544
4481
  * The core-http version
4545
4482
  */
4546
- coreHttpVersion: "2.2.3",
4483
+ coreHttpVersion: "2.3.2",
4547
4484
  /**
4548
4485
  * Specifies HTTP.
4549
4486
  */
@@ -4794,6 +4731,7 @@ class Serializer {
4794
4731
  * @param mapper - The definition of data models.
4795
4732
  * @param value - The value.
4796
4733
  * @param objectName - Name of the object. Used in the error messages.
4734
+ * @deprecated Removing the constraints validation on client side.
4797
4735
  */
4798
4736
  validateConstraints(mapper, value, objectName) {
4799
4737
  const failValidation = (constraintName, constraintValue) => {
@@ -4892,8 +4830,6 @@ class Serializer {
4892
4830
  payload = object;
4893
4831
  }
4894
4832
  else {
4895
- // Validate Constraints if any
4896
- this.validateConstraints(mapper, object, objectName);
4897
4833
  if (mapperType.match(/^any$/i) !== null) {
4898
4834
  payload = object;
4899
4835
  }
@@ -5411,7 +5347,8 @@ function isSpecialXmlProperty(propertyName, options) {
5411
5347
  return [XML_ATTRKEY, options.xmlCharKey].includes(propertyName);
5412
5348
  }
5413
5349
  function deserializeCompositeType(serializer, mapper, responseBody, objectName, options) {
5414
- var _a;
5350
+ var _a, _b;
5351
+ const xmlCharKey = (_a = options.xmlCharKey) !== null && _a !== void 0 ? _a : XML_CHARKEY;
5415
5352
  if (getPolymorphicDiscriminatorRecursively(serializer, mapper)) {
5416
5353
  mapper = getPolymorphicMapper(serializer, mapper, responseBody, "serializedName");
5417
5354
  }
@@ -5442,6 +5379,16 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
5442
5379
  if (propertyMapper.xmlIsAttribute && responseBody[XML_ATTRKEY]) {
5443
5380
  instance[key] = serializer.deserialize(propertyMapper, responseBody[XML_ATTRKEY][xmlName], propertyObjectName, options);
5444
5381
  }
5382
+ else if (propertyMapper.xmlIsMsText) {
5383
+ if (responseBody[xmlCharKey] !== undefined) {
5384
+ instance[key] = responseBody[xmlCharKey];
5385
+ }
5386
+ else if (typeof responseBody === "string") {
5387
+ // The special case where xml parser parses "<Name>content</Name>" into JSON of
5388
+ // `{ name: "content"}` instead of `{ name: { "_": "content" }}`
5389
+ instance[key] = responseBody;
5390
+ }
5391
+ }
5445
5392
  else {
5446
5393
  const propertyName = xmlElementName || xmlName || serializedName;
5447
5394
  if (propertyMapper.xmlIsWrapped) {
@@ -5460,7 +5407,7 @@ function deserializeCompositeType(serializer, mapper, responseBody, objectName,
5460
5407
  xmlName is "Cors" and xmlElementName is"CorsRule".
5461
5408
  */
5462
5409
  const wrapped = responseBody[xmlName];
5463
- const elementList = (_a = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _a !== void 0 ? _a : [];
5410
+ const elementList = (_b = wrapped === null || wrapped === void 0 ? void 0 : wrapped[xmlElementName]) !== null && _b !== void 0 ? _b : [];
5464
5411
  instance[key] = serializer.deserialize(propertyMapper, elementList, propertyObjectName, options);
5465
5412
  }
5466
5413
  else {
@@ -5900,7 +5847,7 @@ class WebResource {
5900
5847
  }
5901
5848
  }
5902
5849
 
5903
- /*! *****************************************************************************
5850
+ /******************************************************************************
5904
5851
  Copyright (c) Microsoft Corporation.
5905
5852
 
5906
5853
  Permission to use, copy, modify, and/or distribute this software for any
@@ -5914,7 +5861,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
5914
5861
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5915
5862
  PERFORMANCE OF THIS SOFTWARE.
5916
5863
  ***************************************************************************** */
5917
- /* global Reflect, Promise */
5864
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
5918
5865
 
5919
5866
  var extendStatics = function(d, b) {
5920
5867
  extendStatics = Object.setPrototypeOf ||
@@ -5941,7 +5888,12 @@ function __rest(s, e) {
5941
5888
  t[p[i]] = s[p[i]];
5942
5889
  }
5943
5890
  return t;
5944
- }
5891
+ }
5892
+
5893
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
5894
+ var e = new Error(message);
5895
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
5896
+ };
5945
5897
 
5946
5898
  // Copyright (c) Microsoft Corporation.
5947
5899
  // Licensed under the MIT license.
@@ -6085,7 +6037,7 @@ function abortSignal(signal) {
6085
6037
  * }
6086
6038
  * ```
6087
6039
  */
6088
- var AbortError = /** @class */ (function (_super) {
6040
+ var AbortError$1 = /** @class */ (function (_super) {
6089
6041
  __extends(AbortError, _super);
6090
6042
  function AbortError(message) {
6091
6043
  var _this = _super.call(this, message) || this;
@@ -6192,10 +6144,6 @@ var AbortError = /** @class */ (function (_super) {
6192
6144
  return AbortController;
6193
6145
  })());
6194
6146
 
6195
- // Copyright (c) Microsoft Corporation.
6196
- // Licensed under the MIT license.
6197
- const url$1 = URL;
6198
-
6199
6147
  // Copyright (c) Microsoft Corporation.
6200
6148
  /**
6201
6149
  * A class that handles the query portion of a URLBuilder.
@@ -6832,6 +6780,7 @@ const defaultAllowedHeaderNames = [
6832
6780
  "Server",
6833
6781
  "Transfer-Encoding",
6834
6782
  "User-Agent",
6783
+ "WWW-Authenticate",
6835
6784
  ];
6836
6785
  const defaultAllowedQueryParameters = ["api-version"];
6837
6786
  class Sanitizer {
@@ -6973,7 +6922,7 @@ class XhrHttpClient {
6973
6922
  const abortSignal = request.abortSignal;
6974
6923
  if (abortSignal) {
6975
6924
  if (abortSignal.aborted) {
6976
- return Promise.reject(new AbortError("The operation was aborted."));
6925
+ return Promise.reject(new AbortError$1("The operation was aborted."));
6977
6926
  }
6978
6927
  const listener = () => {
6979
6928
  xhr.abort();
@@ -7126,7 +7075,7 @@ function parseHeaders(xhr) {
7126
7075
  }
7127
7076
  function rejectOnTerminalEvent(request, xhr, reject) {
7128
7077
  xhr.addEventListener("error", () => reject(new RestError(`Failed to send request to ${request.url}`, RestError.REQUEST_SEND_ERROR, undefined, request)));
7129
- const abortError = new AbortError("The operation was aborted.");
7078
+ const abortError = new AbortError$1("The operation was aborted.");
7130
7079
  xhr.addEventListener("abort", () => reject(abortError));
7131
7080
  xhr.addEventListener("timeout", () => reject(abortError));
7132
7081
  }
@@ -7163,7 +7112,6 @@ var HttpPipelineLogLevel;
7163
7112
  * @param opts - OperationOptions object to convert to RequestOptionsBase
7164
7113
  */
7165
7114
  function operationOptionsToRequestOptionsBase(opts) {
7166
- var _a;
7167
7115
  const { requestOptions, tracingOptions } = opts, additionalOptions = __rest(opts, ["requestOptions", "tracingOptions"]);
7168
7116
  let result = additionalOptions;
7169
7117
  if (requestOptions) {
@@ -7172,7 +7120,7 @@ function operationOptionsToRequestOptionsBase(opts) {
7172
7120
  if (tracingOptions) {
7173
7121
  result.tracingContext = tracingOptions.tracingContext;
7174
7122
  // By passing spanOptions if they exist at runtime, we're backwards compatible with @azure/core-tracing@preview.13 and earlier.
7175
- result.spanOptions = (_a = tracingOptions) === null || _a === void 0 ? void 0 : _a.spanOptions;
7123
+ result.spanOptions = tracingOptions === null || tracingOptions === void 0 ? void 0 : tracingOptions.spanOptions;
7176
7124
  }
7177
7125
  return result;
7178
7126
  }
@@ -7249,17 +7197,48 @@ class RequestPolicyOptions {
7249
7197
  if (!self.document || !self.DOMParser || !self.Node || !self.XMLSerializer) {
7250
7198
  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. `);
7251
7199
  }
7252
- const doc = document.implementation.createDocument(null, null, null);
7253
- const parser = new DOMParser();
7200
+ let cachedDoc;
7201
+ function getDoc() {
7202
+ if (!cachedDoc) {
7203
+ cachedDoc = document.implementation.createDocument(null, null, null);
7204
+ }
7205
+ return cachedDoc;
7206
+ }
7207
+ let cachedParser;
7208
+ function getParser() {
7209
+ if (!cachedParser) {
7210
+ cachedParser = new DOMParser();
7211
+ }
7212
+ return cachedParser;
7213
+ }
7214
+ let cachedSerializer;
7215
+ function getSerializer() {
7216
+ if (!cachedSerializer) {
7217
+ cachedSerializer = new XMLSerializer();
7218
+ }
7219
+ return cachedSerializer;
7220
+ }
7221
+ // Policy to make our code Trusted Types compliant.
7222
+ // https://github.com/w3c/webappsec-trusted-types
7223
+ // We are calling DOMParser.parseFromString() to parse XML payload from Azure services.
7224
+ // The parsed DOM object is not exposed to outside. Scripts are disabled when parsing
7225
+ // according to the spec. There are no HTML/XSS security concerns on the usage of
7226
+ // parseFromString() here.
7227
+ let ttPolicy;
7228
+ if (typeof self.trustedTypes !== "undefined") {
7229
+ ttPolicy = self.trustedTypes.createPolicy("@azure/core-http#xml.browser", {
7230
+ createHTML: (s) => s,
7231
+ });
7232
+ }
7254
7233
  function parseXML(str, opts = {}) {
7255
- var _a, _b, _c;
7234
+ var _a, _b, _c, _d;
7256
7235
  try {
7257
7236
  const updatedOptions = {
7258
7237
  rootName: (_a = opts.rootName) !== null && _a !== void 0 ? _a : "",
7259
7238
  includeRoot: (_b = opts.includeRoot) !== null && _b !== void 0 ? _b : false,
7260
7239
  xmlCharKey: (_c = opts.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY,
7261
7240
  };
7262
- const dom = parser.parseFromString(str, "application/xml");
7241
+ const dom = getParser().parseFromString(((_d = ttPolicy === null || ttPolicy === void 0 ? void 0 : ttPolicy.createHTML(str)) !== null && _d !== void 0 ? _d : str), "application/xml");
7263
7242
  throwIfError(dom);
7264
7243
  let obj;
7265
7244
  if (updatedOptions.includeRoot) {
@@ -7276,12 +7255,13 @@ function parseXML(str, opts = {}) {
7276
7255
  }
7277
7256
  let errorNS;
7278
7257
  function getErrorNamespace() {
7279
- var _a;
7258
+ var _a, _b;
7280
7259
  if (errorNS === undefined) {
7281
7260
  try {
7261
+ const invalidXML = ((_a = ttPolicy === null || ttPolicy === void 0 ? void 0 : ttPolicy.createHTML("INVALID")) !== null && _a !== void 0 ? _a : "INVALID");
7282
7262
  errorNS =
7283
- (_a = parser.parseFromString("INVALID", "text/xml").getElementsByTagName("parsererror")[0]
7284
- .namespaceURI) !== null && _a !== void 0 ? _a : "";
7263
+ (_b = getParser().parseFromString(invalidXML, "text/xml").getElementsByTagName("parsererror")[0]
7264
+ .namespaceURI) !== null && _b !== void 0 ? _b : "";
7285
7265
  }
7286
7266
  catch (ignored) {
7287
7267
  // Most browsers will return a document containing <parsererror>, but IE will throw.
@@ -7356,7 +7336,6 @@ function domToObject(node, options) {
7356
7336
  }
7357
7337
  return result;
7358
7338
  }
7359
- const serializer$3 = new XMLSerializer();
7360
7339
  function stringifyXML(content, opts = {}) {
7361
7340
  var _a, _b, _c;
7362
7341
  const updatedOptions = {
@@ -7365,12 +7344,13 @@ function stringifyXML(content, opts = {}) {
7365
7344
  xmlCharKey: (_c = opts.xmlCharKey) !== null && _c !== void 0 ? _c : XML_CHARKEY,
7366
7345
  };
7367
7346
  const dom = buildNode(content, updatedOptions.rootName, updatedOptions)[0];
7368
- return ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + serializer$3.serializeToString(dom));
7347
+ return ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
7348
+ getSerializer().serializeToString(dom));
7369
7349
  }
7370
7350
  function buildAttributes(attrs) {
7371
7351
  const result = [];
7372
7352
  for (const key of Object.keys(attrs)) {
7373
- const attr = doc.createAttribute(key);
7353
+ const attr = getDoc().createAttribute(key);
7374
7354
  attr.value = attrs[key].toString();
7375
7355
  result.push(attr);
7376
7356
  }
@@ -7382,7 +7362,7 @@ function buildNode(obj, elementName, options) {
7382
7362
  typeof obj === "string" ||
7383
7363
  typeof obj === "number" ||
7384
7364
  typeof obj === "boolean") {
7385
- const elem = doc.createElement(elementName);
7365
+ const elem = getDoc().createElement(elementName);
7386
7366
  elem.textContent = obj === undefined || obj === null ? "" : obj.toString();
7387
7367
  return [elem];
7388
7368
  }
@@ -7396,7 +7376,7 @@ function buildNode(obj, elementName, options) {
7396
7376
  return result;
7397
7377
  }
7398
7378
  else if (typeof obj === "object") {
7399
- const elem = doc.createElement(elementName);
7379
+ const elem = getDoc().createElement(elementName);
7400
7380
  for (const key of Object.keys(obj)) {
7401
7381
  if (key === XML_ATTRKEY) {
7402
7382
  for (const attr of buildAttributes(obj[key])) {
@@ -7537,7 +7517,7 @@ function deserializeResponseBody(jsonContentTypes, xmlContentTypes, response, op
7537
7517
  parsedResponse.parsedBody = response.status >= 200 && response.status < 300;
7538
7518
  }
7539
7519
  if (responseSpec.headersMapper) {
7540
- parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders", options);
7520
+ parsedResponse.parsedHeaders = operationSpec.serializer.deserialize(responseSpec.headersMapper, parsedResponse.headers.toJson(), "operationRes.parsedHeaders", options);
7541
7521
  }
7542
7522
  }
7543
7523
  return parsedResponse;
@@ -7603,7 +7583,7 @@ function handleErrorResponse(parsedResponse, operationSpec, responseSpec) {
7603
7583
  }
7604
7584
  // If error response has headers, try to deserialize it using default header mapper
7605
7585
  if (parsedResponse.headers && defaultHeadersMapper) {
7606
- error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.rawHeaders(), "operationRes.parsedHeaders");
7586
+ error.response.parsedHeaders = operationSpec.serializer.deserialize(defaultHeadersMapper, parsedResponse.headers.toJson(), "operationRes.parsedHeaders");
7607
7587
  }
7608
7588
  }
7609
7589
  catch (defaultError) {
@@ -7803,54 +7783,87 @@ function updateRetryData(retryOptions, retryData = { retryCount: 0, retryInterva
7803
7783
  // Copyright (c) Microsoft Corporation.
7804
7784
  // Licensed under the MIT license.
7805
7785
  /**
7806
- * Helper TypeGuard that checks if the value is not null or undefined.
7807
- * @param thing - Anything
7808
- * @internal
7786
+ * This error is thrown when an asynchronous operation has been aborted.
7787
+ * Check for this error by testing the `name` that the name property of the
7788
+ * error matches `"AbortError"`.
7789
+ *
7790
+ * @example
7791
+ * ```ts
7792
+ * const controller = new AbortController();
7793
+ * controller.abort();
7794
+ * try {
7795
+ * doAsyncWork(controller.signal)
7796
+ * } catch (e) {
7797
+ * if (e.name === 'AbortError') {
7798
+ * // handle abort error here.
7799
+ * }
7800
+ * }
7801
+ * ```
7809
7802
  */
7810
- function isDefined(thing) {
7811
- return typeof thing !== "undefined" && thing !== null;
7803
+ class AbortError extends Error {
7804
+ constructor(message) {
7805
+ super(message);
7806
+ this.name = "AbortError";
7807
+ }
7812
7808
  }
7813
7809
 
7814
7810
  // Copyright (c) Microsoft Corporation.
7815
- const StandardAbortMessage$1 = "The operation was aborted.";
7816
7811
  /**
7817
- * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds.
7818
- * @param delayInMs - The number of milliseconds to be delayed.
7819
- * @param value - The value to be resolved with after a timeout of t milliseconds.
7820
- * @param options - The options for delay - currently abort options
7821
- * @param abortSignal - The abortSignal associated with containing operation.
7822
- * @param abortErrorMsg - The abort error message associated with containing operation.
7823
- * @returns - Resolved promise
7812
+ * Creates an abortable promise.
7813
+ * @param buildPromise - A function that takes the resolve and reject functions as parameters.
7814
+ * @param options - The options for the abortable promise.
7815
+ * @returns A promise that can be aborted.
7824
7816
  */
7825
- function delay$1(delayInMs, value, options) {
7817
+ function createAbortablePromise(buildPromise, options) {
7818
+ const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {};
7826
7819
  return new Promise((resolve, reject) => {
7827
- let timer = undefined;
7828
- let onAborted = undefined;
7829
- const rejectOnAbort = () => {
7830
- return reject(new AbortError((options === null || options === void 0 ? void 0 : options.abortErrorMsg) ? options === null || options === void 0 ? void 0 : options.abortErrorMsg : StandardAbortMessage$1));
7831
- };
7832
- const removeListeners = () => {
7833
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) && onAborted) {
7834
- options.abortSignal.removeEventListener("abort", onAborted);
7835
- }
7836
- };
7837
- onAborted = () => {
7838
- if (isDefined(timer)) {
7839
- clearTimeout(timer);
7840
- }
7820
+ function rejectOnAbort() {
7821
+ reject(new AbortError(abortErrorMsg ?? "The operation was aborted."));
7822
+ }
7823
+ function removeListeners() {
7824
+ abortSignal?.removeEventListener("abort", onAbort);
7825
+ }
7826
+ function onAbort() {
7827
+ cleanupBeforeAbort?.();
7841
7828
  removeListeners();
7842
- return rejectOnAbort();
7843
- };
7844
- if ((options === null || options === void 0 ? void 0 : options.abortSignal) && options.abortSignal.aborted) {
7829
+ rejectOnAbort();
7830
+ }
7831
+ if (abortSignal?.aborted) {
7845
7832
  return rejectOnAbort();
7846
7833
  }
7847
- timer = setTimeout(() => {
7848
- removeListeners();
7849
- resolve(value);
7850
- }, delayInMs);
7851
- if (options === null || options === void 0 ? void 0 : options.abortSignal) {
7852
- options.abortSignal.addEventListener("abort", onAborted);
7834
+ try {
7835
+ buildPromise((x) => {
7836
+ removeListeners();
7837
+ resolve(x);
7838
+ }, (x) => {
7839
+ removeListeners();
7840
+ reject(x);
7841
+ });
7853
7842
  }
7843
+ catch (err) {
7844
+ reject(err);
7845
+ }
7846
+ abortSignal?.addEventListener("abort", onAbort);
7847
+ });
7848
+ }
7849
+
7850
+ // Copyright (c) Microsoft Corporation.
7851
+ const StandardAbortMessage$1 = "The delay was aborted.";
7852
+ /**
7853
+ * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds.
7854
+ * @param timeInMs - The number of milliseconds to be delayed.
7855
+ * @param options - The options for delay - currently abort options
7856
+ * @returns Promise that is resolved after timeInMs
7857
+ */
7858
+ function delay$1(timeInMs, options) {
7859
+ let token;
7860
+ const { abortSignal, abortErrorMsg } = options ?? {};
7861
+ return createAbortablePromise((resolve) => {
7862
+ token = setTimeout(resolve, timeInMs);
7863
+ }, {
7864
+ cleanupBeforeAbort: () => clearTimeout(token),
7865
+ abortSignal,
7866
+ abortErrorMsg: abortErrorMsg ?? StandardAbortMessage$1,
7854
7867
  });
7855
7868
  }
7856
7869
 
@@ -8965,12 +8978,12 @@ class ThrottlingRetryPolicy extends BaseRequestPolicy {
8965
8978
  const delayInMs = ThrottlingRetryPolicy.parseRetryAfterHeader(retryAfterHeader);
8966
8979
  if (delayInMs) {
8967
8980
  this.numberOfRetries += 1;
8968
- await delay$1(delayInMs, undefined, {
8981
+ await delay$1(delayInMs, {
8969
8982
  abortSignal: httpRequest.abortSignal,
8970
8983
  abortErrorMsg: StandardAbortMessage,
8971
8984
  });
8972
8985
  if ((_a = httpRequest.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
8973
- throw new AbortError(StandardAbortMessage);
8986
+ throw new AbortError$1(StandardAbortMessage);
8974
8987
  }
8975
8988
  if (this.numberOfRetries < DEFAULT_CLIENT_MAX_RETRY_COUNT) {
8976
8989
  return this.sendRequest(httpRequest);
@@ -10755,10 +10768,9 @@ class TracingPolicy extends BaseRequestPolicy {
10755
10768
  tryCreateSpan(request) {
10756
10769
  var _a;
10757
10770
  try {
10758
- const path = URLBuilder.parse(request.url).getPath() || "/";
10759
10771
  // Passing spanOptions as part of tracingOptions to maintain compatibility @azure/core-tracing@preview.13 and earlier.
10760
10772
  // We can pass this as a separate parameter once we upgrade to the latest core-tracing.
10761
- const { span } = createSpan$1(path, {
10773
+ const { span } = createSpan$1(`HTTP ${request.method}`, {
10762
10774
  tracingOptions: {
10763
10775
  spanOptions: Object.assign(Object.assign({}, request.spanOptions), { kind: SpanKind.CLIENT }),
10764
10776
  tracingContext: request.tracingContext,
@@ -11350,8 +11362,8 @@ function getCredentialScopes(options, baseUri) {
11350
11362
  if (options === null || options === void 0 ? void 0 : options.credentialScopes) {
11351
11363
  const scopes = options.credentialScopes;
11352
11364
  return Array.isArray(scopes)
11353
- ? scopes.map((scope) => new url$1(scope).toString())
11354
- : new url$1(scopes).toString();
11365
+ ? scopes.map((scope) => new URL(scope).toString())
11366
+ : new URL(scopes).toString();
11355
11367
  }
11356
11368
  if (baseUri) {
11357
11369
  return `${baseUri}/.default`;
@@ -26843,7 +26855,7 @@ const DEFAULT_RETRY_OPTIONS = {
26843
26855
  secondaryHost: "",
26844
26856
  tryTimeoutInMs: undefined // Use server side default timeout strategy
26845
26857
  };
26846
- const RETRY_ABORT_ERROR = new AbortError("The operation was aborted.");
26858
+ const RETRY_ABORT_ERROR = new AbortError$1("The operation was aborted.");
26847
26859
  /**
26848
26860
  * Retry policy with exponential retry and linear retry implemented.
26849
26861
  */