@ms-cloudpack/telemetry 0.11.22 → 0.11.23

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.
Files changed (2) hide show
  1. package/dist/index.js +2024 -1741
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -206,12 +206,12 @@ var init_global_utils = __esm({
206
206
 
207
207
  // ../../node_modules/.store/@opentelemetry-api-npm-1.9.0-7d0560d0dd/package/build/esm/diag/ComponentLogger.js
208
208
  function logProxy(funcName, namespace, args) {
209
- var logger3 = getGlobal("diag");
210
- if (!logger3) {
209
+ var logger4 = getGlobal("diag");
210
+ if (!logger4) {
211
211
  return;
212
212
  }
213
213
  args.unshift(namespace);
214
- return logger3[funcName].apply(logger3, __spreadArray([], __read(args), false));
214
+ return logger4[funcName].apply(logger4, __spreadArray([], __read(args), false));
215
215
  }
216
216
  var __read, __spreadArray, DiagComponentLogger;
217
217
  var init_ComponentLogger = __esm({
@@ -307,17 +307,17 @@ var init_types = __esm({
307
307
  });
308
308
 
309
309
  // ../../node_modules/.store/@opentelemetry-api-npm-1.9.0-7d0560d0dd/package/build/esm/diag/internal/logLevelLogger.js
310
- function createLogLevelDiagLogger(maxLevel, logger3) {
310
+ function createLogLevelDiagLogger(maxLevel, logger4) {
311
311
  if (maxLevel < DiagLogLevel.NONE) {
312
312
  maxLevel = DiagLogLevel.NONE;
313
313
  } else if (maxLevel > DiagLogLevel.ALL) {
314
314
  maxLevel = DiagLogLevel.ALL;
315
315
  }
316
- logger3 = logger3 || {};
316
+ logger4 = logger4 || {};
317
317
  function _filterFunc(funcName, theLevel) {
318
- var theFunc = logger3[funcName];
318
+ var theFunc = logger4[funcName];
319
319
  if (typeof theFunc === "function" && maxLevel >= theLevel) {
320
- return theFunc.bind(logger3);
320
+ return theFunc.bind(logger4);
321
321
  }
322
322
  return function() {
323
323
  };
@@ -382,20 +382,20 @@ var init_diag = __esm({
382
382
  for (var _i = 0; _i < arguments.length; _i++) {
383
383
  args[_i] = arguments[_i];
384
384
  }
385
- var logger3 = getGlobal("diag");
386
- if (!logger3)
385
+ var logger4 = getGlobal("diag");
386
+ if (!logger4)
387
387
  return;
388
- return logger3[funcName].apply(logger3, __spreadArray2([], __read2(args), false));
388
+ return logger4[funcName].apply(logger4, __spreadArray2([], __read2(args), false));
389
389
  };
390
390
  }
391
391
  __name(_logProxy, "_logProxy");
392
392
  var self2 = this;
393
- var setLogger = /* @__PURE__ */ __name(function(logger3, optionsOrLogLevel) {
393
+ var setLogger = /* @__PURE__ */ __name(function(logger4, optionsOrLogLevel) {
394
394
  var _a3, _b2, _c2;
395
395
  if (optionsOrLogLevel === void 0) {
396
396
  optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
397
397
  }
398
- if (logger3 === self2) {
398
+ if (logger4 === self2) {
399
399
  var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
400
400
  self2.error((_a3 = err.stack) !== null && _a3 !== void 0 ? _a3 : err.message);
401
401
  return false;
@@ -406,7 +406,7 @@ var init_diag = __esm({
406
406
  };
407
407
  }
408
408
  var oldLogger = getGlobal("diag");
409
- var newLogger = createLogLevelDiagLogger((_b2 = optionsOrLogLevel.logLevel) !== null && _b2 !== void 0 ? _b2 : DiagLogLevel.INFO, logger3);
409
+ var newLogger = createLogLevelDiagLogger((_b2 = optionsOrLogLevel.logLevel) !== null && _b2 !== void 0 ? _b2 : DiagLogLevel.INFO, logger4);
410
410
  if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
411
411
  var stack = (_c2 = new Error().stack) !== null && _c2 !== void 0 ? _c2 : "<failed to generate stacktrace>";
412
412
  oldLogger.warn("Current logger will be overwritten from " + stack);
@@ -587,14 +587,14 @@ var init_context = __esm({
587
587
  return self2._currentContext.get(key);
588
588
  };
589
589
  self2.setValue = function(key, value) {
590
- var context2 = new BaseContext2(self2._currentContext);
591
- context2._currentContext.set(key, value);
592
- return context2;
590
+ var context4 = new BaseContext2(self2._currentContext);
591
+ context4._currentContext.set(key, value);
592
+ return context4;
593
593
  };
594
594
  self2.deleteValue = function(key) {
595
- var context2 = new BaseContext2(self2._currentContext);
596
- context2._currentContext.delete(key);
597
- return context2;
595
+ var context4 = new BaseContext2(self2._currentContext);
596
+ context4._currentContext.delete(key);
597
+ return context4;
598
598
  };
599
599
  }
600
600
  __name(BaseContext2, "BaseContext");
@@ -958,16 +958,16 @@ var init_context2 = __esm({
958
958
  ContextAPI2.prototype.active = function() {
959
959
  return this._getContextManager().active();
960
960
  };
961
- ContextAPI2.prototype.with = function(context2, fn, thisArg) {
961
+ ContextAPI2.prototype.with = function(context4, fn, thisArg) {
962
962
  var _a3;
963
963
  var args = [];
964
964
  for (var _i = 3; _i < arguments.length; _i++) {
965
965
  args[_i - 3] = arguments[_i];
966
966
  }
967
- return (_a3 = this._getContextManager()).with.apply(_a3, __spreadArray4([context2, fn, thisArg], __read5(args), false));
967
+ return (_a3 = this._getContextManager()).with.apply(_a3, __spreadArray4([context4, fn, thisArg], __read5(args), false));
968
968
  };
969
- ContextAPI2.prototype.bind = function(context2, target) {
970
- return this._getContextManager().bind(context2, target);
969
+ ContextAPI2.prototype.bind = function(context4, target) {
970
+ return this._getContextManager().bind(context4, target);
971
971
  };
972
972
  ContextAPI2.prototype._getContextManager = function() {
973
973
  return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
@@ -1058,24 +1058,24 @@ var init_NonRecordingSpan = __esm({
1058
1058
  });
1059
1059
 
1060
1060
  // ../../node_modules/.store/@opentelemetry-api-npm-1.9.0-7d0560d0dd/package/build/esm/trace/context-utils.js
1061
- function getSpan(context2) {
1062
- return context2.getValue(SPAN_KEY) || void 0;
1061
+ function getSpan(context4) {
1062
+ return context4.getValue(SPAN_KEY) || void 0;
1063
1063
  }
1064
1064
  function getActiveSpan() {
1065
1065
  return getSpan(ContextAPI.getInstance().active());
1066
1066
  }
1067
- function setSpan(context2, span) {
1068
- return context2.setValue(SPAN_KEY, span);
1067
+ function setSpan(context4, span) {
1068
+ return context4.setValue(SPAN_KEY, span);
1069
1069
  }
1070
- function deleteSpan(context2) {
1071
- return context2.deleteValue(SPAN_KEY);
1070
+ function deleteSpan(context4) {
1071
+ return context4.deleteValue(SPAN_KEY);
1072
1072
  }
1073
- function setSpanContext(context2, spanContext) {
1074
- return setSpan(context2, new NonRecordingSpan(spanContext));
1073
+ function setSpanContext(context4, spanContext) {
1074
+ return setSpan(context4, new NonRecordingSpan(spanContext));
1075
1075
  }
1076
- function getSpanContext(context2) {
1076
+ function getSpanContext(context4) {
1077
1077
  var _a3;
1078
- return (_a3 = getSpan(context2)) === null || _a3 === void 0 ? void 0 : _a3.spanContext();
1078
+ return (_a3 = getSpan(context4)) === null || _a3 === void 0 ? void 0 : _a3.spanContext();
1079
1079
  }
1080
1080
  var SPAN_KEY;
1081
1081
  var init_context_utils = __esm({
@@ -1137,15 +1137,15 @@ var init_NoopTracer = __esm({
1137
1137
  function NoopTracer2() {
1138
1138
  }
1139
1139
  __name(NoopTracer2, "NoopTracer");
1140
- NoopTracer2.prototype.startSpan = function(name, options, context2) {
1141
- if (context2 === void 0) {
1142
- context2 = contextApi.active();
1140
+ NoopTracer2.prototype.startSpan = function(name, options, context4) {
1141
+ if (context4 === void 0) {
1142
+ context4 = contextApi.active();
1143
1143
  }
1144
1144
  var root = Boolean(options === null || options === void 0 ? void 0 : options.root);
1145
1145
  if (root) {
1146
1146
  return new NonRecordingSpan();
1147
1147
  }
1148
- var parentFromContext = context2 && getSpanContext(context2);
1148
+ var parentFromContext = context4 && getSpanContext(context4);
1149
1149
  if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
1150
1150
  return new NonRecordingSpan(parentFromContext);
1151
1151
  } else {
@@ -1194,8 +1194,8 @@ var init_ProxyTracer = __esm({
1194
1194
  this.options = options;
1195
1195
  }
1196
1196
  __name(ProxyTracer2, "ProxyTracer");
1197
- ProxyTracer2.prototype.startSpan = function(name, options, context2) {
1198
- return this._getTracer().startSpan(name, options, context2);
1197
+ ProxyTracer2.prototype.startSpan = function(name, options, context4) {
1198
+ return this._getTracer().startSpan(name, options, context4);
1199
1199
  };
1200
1200
  ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
1201
1201
  var tracer = this._getTracer();
@@ -1503,8 +1503,8 @@ var init_NoopTextMapPropagator = __esm({
1503
1503
  __name(NoopTextMapPropagator2, "NoopTextMapPropagator");
1504
1504
  NoopTextMapPropagator2.prototype.inject = function(_context, _carrier) {
1505
1505
  };
1506
- NoopTextMapPropagator2.prototype.extract = function(context2, _carrier) {
1507
- return context2;
1506
+ NoopTextMapPropagator2.prototype.extract = function(context4, _carrier) {
1507
+ return context4;
1508
1508
  };
1509
1509
  NoopTextMapPropagator2.prototype.fields = function() {
1510
1510
  return [];
@@ -1515,17 +1515,17 @@ var init_NoopTextMapPropagator = __esm({
1515
1515
  });
1516
1516
 
1517
1517
  // ../../node_modules/.store/@opentelemetry-api-npm-1.9.0-7d0560d0dd/package/build/esm/baggage/context-helpers.js
1518
- function getBaggage(context2) {
1519
- return context2.getValue(BAGGAGE_KEY) || void 0;
1518
+ function getBaggage(context4) {
1519
+ return context4.getValue(BAGGAGE_KEY) || void 0;
1520
1520
  }
1521
1521
  function getActiveBaggage() {
1522
1522
  return getBaggage(ContextAPI.getInstance().active());
1523
1523
  }
1524
- function setBaggage(context2, baggage) {
1525
- return context2.setValue(BAGGAGE_KEY, baggage);
1524
+ function setBaggage(context4, baggage) {
1525
+ return context4.setValue(BAGGAGE_KEY, baggage);
1526
1526
  }
1527
- function deleteBaggage(context2) {
1528
- return context2.deleteValue(BAGGAGE_KEY);
1527
+ function deleteBaggage(context4) {
1528
+ return context4.deleteValue(BAGGAGE_KEY);
1529
1529
  }
1530
1530
  var BAGGAGE_KEY;
1531
1531
  var init_context_helpers = __esm({
@@ -1571,17 +1571,17 @@ var init_propagation = __esm({
1571
1571
  PropagationAPI2.prototype.setGlobalPropagator = function(propagator) {
1572
1572
  return registerGlobal(API_NAME4, propagator, DiagAPI.instance());
1573
1573
  };
1574
- PropagationAPI2.prototype.inject = function(context2, carrier, setter) {
1574
+ PropagationAPI2.prototype.inject = function(context4, carrier, setter) {
1575
1575
  if (setter === void 0) {
1576
1576
  setter = defaultTextMapSetter;
1577
1577
  }
1578
- return this._getGlobalPropagator().inject(context2, carrier, setter);
1578
+ return this._getGlobalPropagator().inject(context4, carrier, setter);
1579
1579
  };
1580
- PropagationAPI2.prototype.extract = function(context2, carrier, getter) {
1580
+ PropagationAPI2.prototype.extract = function(context4, carrier, getter) {
1581
1581
  if (getter === void 0) {
1582
1582
  getter = defaultTextMapGetter;
1583
1583
  }
1584
- return this._getGlobalPropagator().extract(context2, carrier, getter);
1584
+ return this._getGlobalPropagator().extract(context4, carrier, getter);
1585
1585
  };
1586
1586
  PropagationAPI2.prototype.fields = function() {
1587
1587
  return this._getGlobalPropagator().fields();
@@ -3730,18 +3730,18 @@ var require_suppress_tracing = __commonJS({
3730
3730
  exports.isTracingSuppressed = exports.unsuppressTracing = exports.suppressTracing = void 0;
3731
3731
  var api_1 = (init_esm(), __toCommonJS(esm_exports));
3732
3732
  var SUPPRESS_TRACING_KEY = (0, api_1.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");
3733
- function suppressTracing2(context2) {
3734
- return context2.setValue(SUPPRESS_TRACING_KEY, true);
3733
+ function suppressTracing2(context4) {
3734
+ return context4.setValue(SUPPRESS_TRACING_KEY, true);
3735
3735
  }
3736
3736
  __name(suppressTracing2, "suppressTracing");
3737
3737
  exports.suppressTracing = suppressTracing2;
3738
- function unsuppressTracing(context2) {
3739
- return context2.deleteValue(SUPPRESS_TRACING_KEY);
3738
+ function unsuppressTracing(context4) {
3739
+ return context4.deleteValue(SUPPRESS_TRACING_KEY);
3740
3740
  }
3741
3741
  __name(unsuppressTracing, "unsuppressTracing");
3742
3742
  exports.unsuppressTracing = unsuppressTracing;
3743
- function isTracingSuppressed(context2) {
3744
- return context2.getValue(SUPPRESS_TRACING_KEY) === true;
3743
+ function isTracingSuppressed(context4) {
3744
+ return context4.getValue(SUPPRESS_TRACING_KEY) === true;
3745
3745
  }
3746
3746
  __name(isTracingSuppressed, "isTracingSuppressed");
3747
3747
  exports.isTracingSuppressed = isTracingSuppressed;
@@ -3837,9 +3837,9 @@ var require_W3CBaggagePropagator = __commonJS({
3837
3837
  var constants_1 = require_constants();
3838
3838
  var utils_1 = require_utils();
3839
3839
  var _W3CBaggagePropagator = class _W3CBaggagePropagator {
3840
- inject(context2, carrier, setter) {
3841
- const baggage = api_1.propagation.getBaggage(context2);
3842
- if (!baggage || (0, suppress_tracing_1.isTracingSuppressed)(context2))
3840
+ inject(context4, carrier, setter) {
3841
+ const baggage = api_1.propagation.getBaggage(context4);
3842
+ if (!baggage || (0, suppress_tracing_1.isTracingSuppressed)(context4))
3843
3843
  return;
3844
3844
  const keyPairs = (0, utils_1.getKeyPairs)(baggage).filter((pair) => {
3845
3845
  return pair.length <= constants_1.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS;
@@ -3849,14 +3849,14 @@ var require_W3CBaggagePropagator = __commonJS({
3849
3849
  setter.set(carrier, constants_1.BAGGAGE_HEADER, headerValue);
3850
3850
  }
3851
3851
  }
3852
- extract(context2, carrier, getter) {
3852
+ extract(context4, carrier, getter) {
3853
3853
  const headerValue = getter.get(carrier, constants_1.BAGGAGE_HEADER);
3854
3854
  const baggageString = Array.isArray(headerValue) ? headerValue.join(constants_1.BAGGAGE_ITEMS_SEPARATOR) : headerValue;
3855
3855
  if (!baggageString)
3856
- return context2;
3856
+ return context4;
3857
3857
  const baggage = {};
3858
3858
  if (baggageString.length === 0) {
3859
- return context2;
3859
+ return context4;
3860
3860
  }
3861
3861
  const pairs = baggageString.split(constants_1.BAGGAGE_ITEMS_SEPARATOR);
3862
3862
  pairs.forEach((entry) => {
@@ -3870,9 +3870,9 @@ var require_W3CBaggagePropagator = __commonJS({
3870
3870
  }
3871
3871
  });
3872
3872
  if (Object.entries(baggage).length === 0) {
3873
- return context2;
3873
+ return context4;
3874
3874
  }
3875
- return api_1.propagation.setBaggage(context2, api_1.propagation.createBaggage(baggage));
3875
+ return api_1.propagation.setBaggage(context4, api_1.propagation.createBaggage(baggage));
3876
3876
  }
3877
3877
  fields() {
3878
3878
  return [constants_1.BAGGAGE_HEADER];
@@ -4688,10 +4688,10 @@ var require_composite = __commonJS({
4688
4688
  * @param context Context to inject
4689
4689
  * @param carrier Carrier into which context will be injected
4690
4690
  */
4691
- inject(context2, carrier, setter) {
4691
+ inject(context4, carrier, setter) {
4692
4692
  for (const propagator of this._propagators) {
4693
4693
  try {
4694
- propagator.inject(context2, carrier, setter);
4694
+ propagator.inject(context4, carrier, setter);
4695
4695
  } catch (err) {
4696
4696
  api_1.diag.warn(`Failed to inject with ${propagator.constructor.name}. Err: ${err.message}`);
4697
4697
  }
@@ -4706,7 +4706,7 @@ var require_composite = __commonJS({
4706
4706
  * @param context Context to add values to
4707
4707
  * @param carrier Carrier from which to extract context
4708
4708
  */
4709
- extract(context2, carrier, getter) {
4709
+ extract(context4, carrier, getter) {
4710
4710
  return this._propagators.reduce((ctx, propagator) => {
4711
4711
  try {
4712
4712
  return propagator.extract(ctx, carrier, getter);
@@ -4714,7 +4714,7 @@ var require_composite = __commonJS({
4714
4714
  api_1.diag.warn(`Failed to extract with ${propagator.constructor.name}. Err: ${err.message}`);
4715
4715
  }
4716
4716
  return ctx;
4717
- }, context2);
4717
+ }, context4);
4718
4718
  }
4719
4719
  fields() {
4720
4720
  return this._fields.slice();
@@ -4857,9 +4857,9 @@ var require_W3CTraceContextPropagator = __commonJS({
4857
4857
  __name(parseTraceParent, "parseTraceParent");
4858
4858
  exports.parseTraceParent = parseTraceParent;
4859
4859
  var _W3CTraceContextPropagator = class _W3CTraceContextPropagator {
4860
- inject(context2, carrier, setter) {
4861
- const spanContext = api_1.trace.getSpanContext(context2);
4862
- if (!spanContext || (0, suppress_tracing_1.isTracingSuppressed)(context2) || !(0, api_1.isSpanContextValid)(spanContext))
4860
+ inject(context4, carrier, setter) {
4861
+ const spanContext = api_1.trace.getSpanContext(context4);
4862
+ if (!spanContext || (0, suppress_tracing_1.isTracingSuppressed)(context4) || !(0, api_1.isSpanContextValid)(spanContext))
4863
4863
  return;
4864
4864
  const traceParent = `${VERSION2}-${spanContext.traceId}-${spanContext.spanId}-0${Number(spanContext.traceFlags || api_1.TraceFlags.NONE).toString(16)}`;
4865
4865
  setter.set(carrier, exports.TRACE_PARENT_HEADER, traceParent);
@@ -4867,23 +4867,23 @@ var require_W3CTraceContextPropagator = __commonJS({
4867
4867
  setter.set(carrier, exports.TRACE_STATE_HEADER, spanContext.traceState.serialize());
4868
4868
  }
4869
4869
  }
4870
- extract(context2, carrier, getter) {
4870
+ extract(context4, carrier, getter) {
4871
4871
  const traceParentHeader = getter.get(carrier, exports.TRACE_PARENT_HEADER);
4872
4872
  if (!traceParentHeader)
4873
- return context2;
4873
+ return context4;
4874
4874
  const traceParent = Array.isArray(traceParentHeader) ? traceParentHeader[0] : traceParentHeader;
4875
4875
  if (typeof traceParent !== "string")
4876
- return context2;
4876
+ return context4;
4877
4877
  const spanContext = parseTraceParent(traceParent);
4878
4878
  if (!spanContext)
4879
- return context2;
4879
+ return context4;
4880
4880
  spanContext.isRemote = true;
4881
4881
  const traceStateHeader = getter.get(carrier, exports.TRACE_STATE_HEADER);
4882
4882
  if (traceStateHeader) {
4883
4883
  const state3 = Array.isArray(traceStateHeader) ? traceStateHeader.join(",") : traceStateHeader;
4884
4884
  spanContext.traceState = new TraceState_1.TraceState(typeof state3 === "string" ? state3 : void 0);
4885
4885
  }
4886
- return api_1.trace.setSpanContext(context2, spanContext);
4886
+ return api_1.trace.setSpanContext(context4, spanContext);
4887
4887
  }
4888
4888
  fields() {
4889
4889
  return [exports.TRACE_PARENT_HEADER, exports.TRACE_STATE_HEADER];
@@ -4907,18 +4907,18 @@ var require_rpc_metadata = __commonJS({
4907
4907
  (function(RPCType2) {
4908
4908
  RPCType2["HTTP"] = "http";
4909
4909
  })(RPCType = exports.RPCType || (exports.RPCType = {}));
4910
- function setRPCMetadata(context2, meta) {
4911
- return context2.setValue(RPC_METADATA_KEY, meta);
4910
+ function setRPCMetadata(context4, meta) {
4911
+ return context4.setValue(RPC_METADATA_KEY, meta);
4912
4912
  }
4913
4913
  __name(setRPCMetadata, "setRPCMetadata");
4914
4914
  exports.setRPCMetadata = setRPCMetadata;
4915
- function deleteRPCMetadata(context2) {
4916
- return context2.deleteValue(RPC_METADATA_KEY);
4915
+ function deleteRPCMetadata(context4) {
4916
+ return context4.deleteValue(RPC_METADATA_KEY);
4917
4917
  }
4918
4918
  __name(deleteRPCMetadata, "deleteRPCMetadata");
4919
4919
  exports.deleteRPCMetadata = deleteRPCMetadata;
4920
- function getRPCMetadata(context2) {
4921
- return context2.getValue(RPC_METADATA_KEY);
4920
+ function getRPCMetadata(context4) {
4921
+ return context4.getValue(RPC_METADATA_KEY);
4922
4922
  }
4923
4923
  __name(getRPCMetadata, "getRPCMetadata");
4924
4924
  exports.getRPCMetadata = getRPCMetadata;
@@ -4994,21 +4994,21 @@ var require_ParentBasedSampler = __commonJS({
4994
4994
  this._localParentSampled = (_c2 = config.localParentSampled) !== null && _c2 !== void 0 ? _c2 : new AlwaysOnSampler_1.AlwaysOnSampler();
4995
4995
  this._localParentNotSampled = (_d2 = config.localParentNotSampled) !== null && _d2 !== void 0 ? _d2 : new AlwaysOffSampler_1.AlwaysOffSampler();
4996
4996
  }
4997
- shouldSample(context2, traceId, spanName, spanKind, attributes, links) {
4998
- const parentContext = api_1.trace.getSpanContext(context2);
4997
+ shouldSample(context4, traceId, spanName, spanKind, attributes, links) {
4998
+ const parentContext = api_1.trace.getSpanContext(context4);
4999
4999
  if (!parentContext || !(0, api_1.isSpanContextValid)(parentContext)) {
5000
- return this._root.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
5000
+ return this._root.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
5001
5001
  }
5002
5002
  if (parentContext.isRemote) {
5003
5003
  if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) {
5004
- return this._remoteParentSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
5004
+ return this._remoteParentSampled.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
5005
5005
  }
5006
- return this._remoteParentNotSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
5006
+ return this._remoteParentNotSampled.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
5007
5007
  }
5008
5008
  if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) {
5009
- return this._localParentSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
5009
+ return this._localParentSampled.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
5010
5010
  }
5011
- return this._localParentNotSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
5011
+ return this._localParentNotSampled.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
5012
5012
  }
5013
5013
  toString() {
5014
5014
  return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;
@@ -5033,7 +5033,7 @@ var require_TraceIdRatioBasedSampler = __commonJS({
5033
5033
  this._ratio = this._normalize(_ratio);
5034
5034
  this._upperBound = Math.floor(this._ratio * 4294967295);
5035
5035
  }
5036
- shouldSample(context2, traceId) {
5036
+ shouldSample(context4, traceId) {
5037
5037
  return {
5038
5038
  decision: (0, api_1.isValidTraceId)(traceId) && this._accumulate(traceId) < this._upperBound ? api_1.SamplingDecision.RECORD_AND_SAMPLED : api_1.SamplingDecision.NOT_RECORD
5039
5039
  };
@@ -6668,19 +6668,19 @@ var require_AbstractAsyncHooksContextManager = __commonJS({
6668
6668
  * @param target a function or event emitter. When target or one of its callbacks is called,
6669
6669
  * the provided context will be used as the active context for the duration of the call.
6670
6670
  */
6671
- bind(context2, target) {
6671
+ bind(context4, target) {
6672
6672
  if (target instanceof events_1.EventEmitter) {
6673
- return this._bindEventEmitter(context2, target);
6673
+ return this._bindEventEmitter(context4, target);
6674
6674
  }
6675
6675
  if (typeof target === "function") {
6676
- return this._bindFunction(context2, target);
6676
+ return this._bindFunction(context4, target);
6677
6677
  }
6678
6678
  return target;
6679
6679
  }
6680
- _bindFunction(context2, target) {
6680
+ _bindFunction(context4, target) {
6681
6681
  const manager = this;
6682
6682
  const contextWrapper = /* @__PURE__ */ __name(function(...args) {
6683
- return manager.with(context2, () => target.apply(this, args));
6683
+ return manager.with(context4, () => target.apply(this, args));
6684
6684
  }, "contextWrapper");
6685
6685
  Object.defineProperty(contextWrapper, "length", {
6686
6686
  enumerable: false,
@@ -6697,7 +6697,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS({
6697
6697
  * @param context the context we want to bind
6698
6698
  * @param ee EventEmitter an instance of EventEmitter to patch
6699
6699
  */
6700
- _bindEventEmitter(context2, ee) {
6700
+ _bindEventEmitter(context4, ee) {
6701
6701
  const map = this._getPatchMap(ee);
6702
6702
  if (map !== void 0)
6703
6703
  return ee;
@@ -6705,7 +6705,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS({
6705
6705
  ADD_LISTENER_METHODS.forEach((methodName) => {
6706
6706
  if (ee[methodName] === void 0)
6707
6707
  return;
6708
- ee[methodName] = this._patchAddListener(ee, ee[methodName], context2);
6708
+ ee[methodName] = this._patchAddListener(ee, ee[methodName], context4);
6709
6709
  });
6710
6710
  if (typeof ee.removeListener === "function") {
6711
6711
  ee.removeListener = this._patchRemoveListener(ee, ee.removeListener);
@@ -6763,7 +6763,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS({
6763
6763
  * @param original reference to the patched method
6764
6764
  * @param [context] context to propagate when calling listeners
6765
6765
  */
6766
- _patchAddListener(ee, original, context2) {
6766
+ _patchAddListener(ee, original, context4) {
6767
6767
  const contextManager = this;
6768
6768
  return function(event, listener) {
6769
6769
  if (contextManager._wrapped) {
@@ -6778,7 +6778,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS({
6778
6778
  listeners = /* @__PURE__ */ new WeakMap();
6779
6779
  map[event] = listeners;
6780
6780
  }
6781
- const patchedListener = contextManager.bind(context2, listener);
6781
+ const patchedListener = contextManager.bind(context4, listener);
6782
6782
  listeners.set(listener, patchedListener);
6783
6783
  contextManager._wrapped = true;
6784
6784
  try {
@@ -6829,8 +6829,8 @@ var require_AsyncHooksContextManager = __commonJS({
6829
6829
  var _a3;
6830
6830
  return (_a3 = this._stack[this._stack.length - 1]) !== null && _a3 !== void 0 ? _a3 : api_1.ROOT_CONTEXT;
6831
6831
  }
6832
- with(context2, fn, thisArg, ...args) {
6833
- this._enterContext(context2);
6832
+ with(context4, fn, thisArg, ...args) {
6833
+ this._enterContext(context4);
6834
6834
  try {
6835
6835
  return fn.call(thisArg, ...args);
6836
6836
  } finally {
@@ -6856,9 +6856,9 @@ var require_AsyncHooksContextManager = __commonJS({
6856
6856
  _init(uid, type4) {
6857
6857
  if (type4 === "TIMERWRAP")
6858
6858
  return;
6859
- const context2 = this._stack[this._stack.length - 1];
6860
- if (context2 !== void 0) {
6861
- this._contexts.set(uid, context2);
6859
+ const context4 = this._stack[this._stack.length - 1];
6860
+ if (context4 !== void 0) {
6861
+ this._contexts.set(uid, context4);
6862
6862
  }
6863
6863
  }
6864
6864
  /**
@@ -6874,9 +6874,9 @@ var require_AsyncHooksContextManager = __commonJS({
6874
6874
  * @param uid uid of the async context
6875
6875
  */
6876
6876
  _before(uid) {
6877
- const context2 = this._contexts.get(uid);
6878
- if (context2 !== void 0) {
6879
- this._enterContext(context2);
6877
+ const context4 = this._contexts.get(uid);
6878
+ if (context4 !== void 0) {
6879
+ this._enterContext(context4);
6880
6880
  }
6881
6881
  }
6882
6882
  /**
@@ -6888,8 +6888,8 @@ var require_AsyncHooksContextManager = __commonJS({
6888
6888
  /**
6889
6889
  * Set the given context as active
6890
6890
  */
6891
- _enterContext(context2) {
6892
- this._stack.push(context2);
6891
+ _enterContext(context4) {
6892
+ this._stack.push(context4);
6893
6893
  }
6894
6894
  /**
6895
6895
  * Remove the context at the root of the stack
@@ -6922,9 +6922,9 @@ var require_AsyncLocalStorageContextManager = __commonJS({
6922
6922
  var _a3;
6923
6923
  return (_a3 = this._asyncLocalStorage.getStore()) !== null && _a3 !== void 0 ? _a3 : api_1.ROOT_CONTEXT;
6924
6924
  }
6925
- with(context2, fn, thisArg, ...args) {
6925
+ with(context4, fn, thisArg, ...args) {
6926
6926
  const cb = thisArg == null ? fn : fn.bind(thisArg);
6927
- return this._asyncLocalStorage.run(context2, cb, ...args);
6927
+ return this._asyncLocalStorage.run(context4, cb, ...args);
6928
6928
  }
6929
6929
  enable() {
6930
6930
  return this;
@@ -7042,11 +7042,11 @@ var require_B3MultiPropagator = __commonJS({
7042
7042
  }
7043
7043
  __name(getTraceFlags, "getTraceFlags");
7044
7044
  var _B3MultiPropagator = class _B3MultiPropagator {
7045
- inject(context2, carrier, setter) {
7046
- const spanContext = api_1.trace.getSpanContext(context2);
7047
- if (!spanContext || !(0, api_1.isSpanContextValid)(spanContext) || (0, core_1.isTracingSuppressed)(context2))
7045
+ inject(context4, carrier, setter) {
7046
+ const spanContext = api_1.trace.getSpanContext(context4);
7047
+ if (!spanContext || !(0, api_1.isSpanContextValid)(spanContext) || (0, core_1.isTracingSuppressed)(context4))
7048
7048
  return;
7049
- const debug = context2.getValue(common_1.B3_DEBUG_FLAG_KEY);
7049
+ const debug = context4.getValue(common_1.B3_DEBUG_FLAG_KEY);
7050
7050
  setter.set(carrier, constants_1.X_B3_TRACE_ID, spanContext.traceId);
7051
7051
  setter.set(carrier, constants_1.X_B3_SPAN_ID, spanContext.spanId);
7052
7052
  if (debug === "1") {
@@ -7055,21 +7055,21 @@ var require_B3MultiPropagator = __commonJS({
7055
7055
  setter.set(carrier, constants_1.X_B3_SAMPLED, (api_1.TraceFlags.SAMPLED & spanContext.traceFlags) === api_1.TraceFlags.SAMPLED ? "1" : "0");
7056
7056
  }
7057
7057
  }
7058
- extract(context2, carrier, getter) {
7058
+ extract(context4, carrier, getter) {
7059
7059
  const traceId = getTraceId(carrier, getter);
7060
7060
  const spanId = getSpanId(carrier, getter);
7061
7061
  const traceFlags = getTraceFlags(carrier, getter);
7062
7062
  const debug = getDebug(carrier, getter);
7063
7063
  if ((0, api_1.isValidTraceId)(traceId) && (0, api_1.isValidSpanId)(spanId) && isValidSampledValue(traceFlags)) {
7064
- context2 = context2.setValue(common_1.B3_DEBUG_FLAG_KEY, debug);
7065
- return api_1.trace.setSpanContext(context2, {
7064
+ context4 = context4.setValue(common_1.B3_DEBUG_FLAG_KEY, debug);
7065
+ return api_1.trace.setSpanContext(context4, {
7066
7066
  traceId,
7067
7067
  spanId,
7068
7068
  isRemote: true,
7069
7069
  traceFlags
7070
7070
  });
7071
7071
  }
7072
- return context2;
7072
+ return context4;
7073
7073
  }
7074
7074
  fields() {
7075
7075
  return [
@@ -7113,31 +7113,31 @@ var require_B3SinglePropagator = __commonJS({
7113
7113
  }
7114
7114
  __name(convertToTraceFlags, "convertToTraceFlags");
7115
7115
  var _B3SinglePropagator = class _B3SinglePropagator {
7116
- inject(context2, carrier, setter) {
7117
- const spanContext = api_1.trace.getSpanContext(context2);
7118
- if (!spanContext || !(0, api_1.isSpanContextValid)(spanContext) || (0, core_1.isTracingSuppressed)(context2))
7116
+ inject(context4, carrier, setter) {
7117
+ const spanContext = api_1.trace.getSpanContext(context4);
7118
+ if (!spanContext || !(0, api_1.isSpanContextValid)(spanContext) || (0, core_1.isTracingSuppressed)(context4))
7119
7119
  return;
7120
- const samplingState = context2.getValue(common_1.B3_DEBUG_FLAG_KEY) || spanContext.traceFlags & 1;
7120
+ const samplingState = context4.getValue(common_1.B3_DEBUG_FLAG_KEY) || spanContext.traceFlags & 1;
7121
7121
  const value = `${spanContext.traceId}-${spanContext.spanId}-${samplingState}`;
7122
7122
  setter.set(carrier, constants_1.B3_CONTEXT_HEADER, value);
7123
7123
  }
7124
- extract(context2, carrier, getter) {
7124
+ extract(context4, carrier, getter) {
7125
7125
  const header = getter.get(carrier, constants_1.B3_CONTEXT_HEADER);
7126
7126
  const b3Context = Array.isArray(header) ? header[0] : header;
7127
7127
  if (typeof b3Context !== "string")
7128
- return context2;
7128
+ return context4;
7129
7129
  const match = b3Context.match(B3_CONTEXT_REGEX);
7130
7130
  if (!match)
7131
- return context2;
7131
+ return context4;
7132
7132
  const [, extractedTraceId, spanId, samplingState] = match;
7133
7133
  const traceId = convertToTraceId128(extractedTraceId);
7134
7134
  if (!(0, api_1.isValidTraceId)(traceId) || !(0, api_1.isValidSpanId)(spanId))
7135
- return context2;
7135
+ return context4;
7136
7136
  const traceFlags = convertToTraceFlags(samplingState);
7137
7137
  if (samplingState === DEBUG_STATE) {
7138
- context2 = context2.setValue(common_1.B3_DEBUG_FLAG_KEY, samplingState);
7138
+ context4 = context4.setValue(common_1.B3_DEBUG_FLAG_KEY, samplingState);
7139
7139
  }
7140
- return api_1.trace.setSpanContext(context2, {
7140
+ return api_1.trace.setSpanContext(context4, {
7141
7141
  traceId,
7142
7142
  spanId,
7143
7143
  isRemote: true,
@@ -7191,19 +7191,19 @@ var require_B3Propagator = __commonJS({
7191
7191
  this._fields = this._b3SinglePropagator.fields();
7192
7192
  }
7193
7193
  }
7194
- inject(context2, carrier, setter) {
7195
- if ((0, core_1.isTracingSuppressed)(context2)) {
7194
+ inject(context4, carrier, setter) {
7195
+ if ((0, core_1.isTracingSuppressed)(context4)) {
7196
7196
  return;
7197
7197
  }
7198
- this._inject(context2, carrier, setter);
7198
+ this._inject(context4, carrier, setter);
7199
7199
  }
7200
- extract(context2, carrier, getter) {
7200
+ extract(context4, carrier, getter) {
7201
7201
  const header = getter.get(carrier, constants_1.B3_CONTEXT_HEADER);
7202
7202
  const b3Context = Array.isArray(header) ? header[0] : header;
7203
7203
  if (b3Context) {
7204
- return this._b3SinglePropagator.extract(context2, carrier, getter);
7204
+ return this._b3SinglePropagator.extract(context4, carrier, getter);
7205
7205
  } else {
7206
- return this._b3MultiPropagator.extract(context2, carrier, getter);
7206
+ return this._b3MultiPropagator.extract(context4, carrier, getter);
7207
7207
  }
7208
7208
  }
7209
7209
  fields() {
@@ -7278,7 +7278,7 @@ var require_Span = __commonJS({
7278
7278
  *
7279
7279
  * @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan.
7280
7280
  * */
7281
- constructor(parentTracer, context2, spanName, spanContext, kind, parentSpanId, links = [], startTime, _deprecatedClock, attributes) {
7281
+ constructor(parentTracer, context4, spanName, spanContext, kind, parentSpanId, links = [], startTime, _deprecatedClock, attributes) {
7282
7282
  this.attributes = {};
7283
7283
  this.links = [];
7284
7284
  this.events = [];
@@ -7309,7 +7309,7 @@ var require_Span = __commonJS({
7309
7309
  this.setAttributes(attributes);
7310
7310
  }
7311
7311
  this._spanProcessor = parentTracer.getActiveSpanProcessor();
7312
- this._spanProcessor.onStart(this, context2);
7312
+ this._spanProcessor.onStart(this, context4);
7313
7313
  }
7314
7314
  spanContext() {
7315
7315
  return this._spanContext;
@@ -7609,21 +7609,21 @@ var require_ParentBasedSampler2 = __commonJS({
7609
7609
  this._localParentSampled = (_c2 = config.localParentSampled) !== null && _c2 !== void 0 ? _c2 : new AlwaysOnSampler_1.AlwaysOnSampler();
7610
7610
  this._localParentNotSampled = (_d2 = config.localParentNotSampled) !== null && _d2 !== void 0 ? _d2 : new AlwaysOffSampler_1.AlwaysOffSampler();
7611
7611
  }
7612
- shouldSample(context2, traceId, spanName, spanKind, attributes, links) {
7613
- const parentContext = api_1.trace.getSpanContext(context2);
7612
+ shouldSample(context4, traceId, spanName, spanKind, attributes, links) {
7613
+ const parentContext = api_1.trace.getSpanContext(context4);
7614
7614
  if (!parentContext || !(0, api_1.isSpanContextValid)(parentContext)) {
7615
- return this._root.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
7615
+ return this._root.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
7616
7616
  }
7617
7617
  if (parentContext.isRemote) {
7618
7618
  if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) {
7619
- return this._remoteParentSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
7619
+ return this._remoteParentSampled.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
7620
7620
  }
7621
- return this._remoteParentNotSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
7621
+ return this._remoteParentNotSampled.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
7622
7622
  }
7623
7623
  if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) {
7624
- return this._localParentSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
7624
+ return this._localParentSampled.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
7625
7625
  }
7626
- return this._localParentNotSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
7626
+ return this._localParentNotSampled.shouldSample(context4, traceId, spanName, spanKind, attributes, links);
7627
7627
  }
7628
7628
  toString() {
7629
7629
  return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;
@@ -7649,7 +7649,7 @@ var require_TraceIdRatioBasedSampler2 = __commonJS({
7649
7649
  this._ratio = this._normalize(_ratio);
7650
7650
  this._upperBound = Math.floor(this._ratio * 4294967295);
7651
7651
  }
7652
- shouldSample(context2, traceId) {
7652
+ shouldSample(context4, traceId) {
7653
7653
  return {
7654
7654
  decision: (0, api_1.isValidTraceId)(traceId) && this._accumulate(traceId) < this._upperBound ? Sampler_1.SamplingDecision.RECORD_AND_SAMPLED : Sampler_1.SamplingDecision.NOT_RECORD
7655
7655
  };
@@ -8080,13 +8080,13 @@ var require_Tracer = __commonJS({
8080
8080
  * Starts a new Span or returns the default NoopSpan based on the sampling
8081
8081
  * decision.
8082
8082
  */
8083
- startSpan(name, options = {}, context2 = api.context.active()) {
8083
+ startSpan(name, options = {}, context4 = api.context.active()) {
8084
8084
  var _a3, _b2, _c2;
8085
8085
  if (options.root) {
8086
- context2 = api.trace.deleteSpan(context2);
8086
+ context4 = api.trace.deleteSpan(context4);
8087
8087
  }
8088
- const parentSpan = api.trace.getSpan(context2);
8089
- if ((0, core_1.isTracingSuppressed)(context2)) {
8088
+ const parentSpan = api.trace.getSpan(context4);
8089
+ if ((0, core_1.isTracingSuppressed)(context4)) {
8090
8090
  api.diag.debug("Instrumentation suppressed, returning Noop Span");
8091
8091
  const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
8092
8092
  return nonRecordingSpan;
@@ -8111,7 +8111,7 @@ var require_Tracer = __commonJS({
8111
8111
  };
8112
8112
  });
8113
8113
  const attributes = (0, core_1.sanitizeAttributes)(options.attributes);
8114
- const samplingResult = this._sampler.shouldSample(context2, traceId, name, spanKind, attributes, links);
8114
+ const samplingResult = this._sampler.shouldSample(context4, traceId, name, spanKind, attributes, links);
8115
8115
  traceState = (_c2 = samplingResult.traceState) !== null && _c2 !== void 0 ? _c2 : traceState;
8116
8116
  const traceFlags = samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED ? api.TraceFlags.SAMPLED : api.TraceFlags.NONE;
8117
8117
  const spanContext = { traceId, spanId, traceFlags, traceState };
@@ -8121,7 +8121,7 @@ var require_Tracer = __commonJS({
8121
8121
  return nonRecordingSpan;
8122
8122
  }
8123
8123
  const initAttributes = (0, core_1.sanitizeAttributes)(Object.assign(attributes, samplingResult.attributes));
8124
- const span = new Span_1.Span(this, context2, name, spanContext, spanKind, parentSpanId, links, options.startTime, void 0, initAttributes);
8124
+ const span = new Span_1.Span(this, context4, name, spanContext, spanKind, parentSpanId, links, options.startTime, void 0, initAttributes);
8125
8125
  return span;
8126
8126
  }
8127
8127
  startActiveSpan(name, arg2, arg3, arg4) {
@@ -8188,9 +8188,9 @@ var require_MultiSpanProcessor = __commonJS({
8188
8188
  });
8189
8189
  });
8190
8190
  }
8191
- onStart(span, context2) {
8191
+ onStart(span, context4) {
8192
8192
  for (const spanProcessor of this._spanProcessors) {
8193
- spanProcessor.onStart(span, context2);
8193
+ spanProcessor.onStart(span, context4);
8194
8194
  }
8195
8195
  }
8196
8196
  onEnd(span) {
@@ -10614,10 +10614,10 @@ var require_JaegerPropagator = __commonJS({
10614
10614
  this._jaegerBaggageHeaderPrefix = (config === null || config === void 0 ? void 0 : config.customBaggageHeaderPrefix) || exports.UBER_BAGGAGE_HEADER_PREFIX;
10615
10615
  }
10616
10616
  }
10617
- inject(context2, carrier, setter) {
10618
- const spanContext = api_1.trace.getSpanContext(context2);
10619
- const baggage = api_1.propagation.getBaggage(context2);
10620
- if (spanContext && (0, core_1.isTracingSuppressed)(context2) === false) {
10617
+ inject(context4, carrier, setter) {
10618
+ const spanContext = api_1.trace.getSpanContext(context4);
10619
+ const baggage = api_1.propagation.getBaggage(context4);
10620
+ if (spanContext && (0, core_1.isTracingSuppressed)(context4) === false) {
10621
10621
  const traceFlags = `0${(spanContext.traceFlags || api_1.TraceFlags.NONE).toString(16)}`;
10622
10622
  setter.set(carrier, this._jaegerTraceHeader, `${spanContext.traceId}:${spanContext.spanId}:0:${traceFlags}`);
10623
10623
  }
@@ -10627,7 +10627,7 @@ var require_JaegerPropagator = __commonJS({
10627
10627
  }
10628
10628
  }
10629
10629
  }
10630
- extract(context2, carrier, getter) {
10630
+ extract(context4, carrier, getter) {
10631
10631
  var _a3;
10632
10632
  const uberTraceIdHeader = getter.get(carrier, this._jaegerTraceHeader);
10633
10633
  const uberTraceId = Array.isArray(uberTraceIdHeader) ? uberTraceIdHeader[0] : uberTraceIdHeader;
@@ -10638,7 +10638,7 @@ var require_JaegerPropagator = __commonJS({
10638
10638
  value: Array.isArray(value) ? value[0] : value
10639
10639
  };
10640
10640
  });
10641
- let newContext = context2;
10641
+ let newContext = context4;
10642
10642
  if (typeof uberTraceId === "string") {
10643
10643
  const spanContext = deserializeSpanContext(uberTraceId);
10644
10644
  if (spanContext) {
@@ -10647,7 +10647,7 @@ var require_JaegerPropagator = __commonJS({
10647
10647
  }
10648
10648
  if (baggageValues.length === 0)
10649
10649
  return newContext;
10650
- let currentBaggage = (_a3 = api_1.propagation.getBaggage(context2)) !== null && _a3 !== void 0 ? _a3 : api_1.propagation.createBaggage();
10650
+ let currentBaggage = (_a3 = api_1.propagation.getBaggage(context4)) !== null && _a3 !== void 0 ? _a3 : api_1.propagation.createBaggage();
10651
10651
  for (const baggageEntry of baggageValues) {
10652
10652
  if (baggageEntry.value === void 0)
10653
10653
  continue;
@@ -12251,9 +12251,9 @@ var require_package3 = __commonJS({
12251
12251
  }
12252
12252
  });
12253
12253
 
12254
- // ../../node_modules/.store/debug-virtual-098a2845dd/package/src/common.js
12254
+ // ../../node_modules/.store/debug-virtual-62ddc027ef/package/src/common.js
12255
12255
  var require_common2 = __commonJS({
12256
- "../../node_modules/.store/debug-virtual-098a2845dd/package/src/common.js"(exports, module) {
12256
+ "../../node_modules/.store/debug-virtual-62ddc027ef/package/src/common.js"(exports, module) {
12257
12257
  function setup(env) {
12258
12258
  createDebug.debug = createDebug;
12259
12259
  createDebug.default = createDebug;
@@ -12439,9 +12439,9 @@ var require_common2 = __commonJS({
12439
12439
  }
12440
12440
  });
12441
12441
 
12442
- // ../../node_modules/.store/debug-virtual-098a2845dd/package/src/browser.js
12442
+ // ../../node_modules/.store/debug-virtual-62ddc027ef/package/src/browser.js
12443
12443
  var require_browser = __commonJS({
12444
- "../../node_modules/.store/debug-virtual-098a2845dd/package/src/browser.js"(exports, module) {
12444
+ "../../node_modules/.store/debug-virtual-62ddc027ef/package/src/browser.js"(exports, module) {
12445
12445
  exports.formatArgs = formatArgs;
12446
12446
  exports.save = save;
12447
12447
  exports.load = load;
@@ -12745,9 +12745,9 @@ var require_package5 = __commonJS({
12745
12745
  }
12746
12746
  });
12747
12747
 
12748
- // ../../node_modules/.store/debug-virtual-098a2845dd/package/src/node.js
12748
+ // ../../node_modules/.store/debug-virtual-62ddc027ef/package/src/node.js
12749
12749
  var require_node5 = __commonJS({
12750
- "../../node_modules/.store/debug-virtual-098a2845dd/package/src/node.js"(exports, module) {
12750
+ "../../node_modules/.store/debug-virtual-62ddc027ef/package/src/node.js"(exports, module) {
12751
12751
  var tty = __require("tty");
12752
12752
  var util2 = __require("util");
12753
12753
  exports.init = init;
@@ -12926,9 +12926,9 @@ var require_node5 = __commonJS({
12926
12926
  }
12927
12927
  });
12928
12928
 
12929
- // ../../node_modules/.store/debug-virtual-098a2845dd/package/src/index.js
12929
+ // ../../node_modules/.store/debug-virtual-62ddc027ef/package/src/index.js
12930
12930
  var require_src8 = __commonJS({
12931
- "../../node_modules/.store/debug-virtual-098a2845dd/package/src/index.js"(exports, module) {
12931
+ "../../node_modules/.store/debug-virtual-62ddc027ef/package/src/index.js"(exports, module) {
12932
12932
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
12933
12933
  module.exports = require_browser();
12934
12934
  } else {
@@ -13569,9 +13569,9 @@ var require_state = __commonJS({
13569
13569
  }
13570
13570
  });
13571
13571
 
13572
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/commonjs/state.js
13572
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/commonjs/state.js
13573
13573
  var require_state2 = __commonJS({
13574
- "../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/commonjs/state.js"(exports) {
13574
+ "../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/commonjs/state.js"(exports) {
13575
13575
  "use strict";
13576
13576
  Object.defineProperty(exports, "__esModule", { value: true });
13577
13577
  exports.state = void 0;
@@ -15698,7 +15698,7 @@ var require_Instruments = __commonJS({
15698
15698
  this._writableMetricStorage = _writableMetricStorage;
15699
15699
  this._descriptor = _descriptor;
15700
15700
  }
15701
- _record(value, attributes = {}, context2 = api_1.context.active()) {
15701
+ _record(value, attributes = {}, context4 = api_1.context.active()) {
15702
15702
  if (typeof value !== "number") {
15703
15703
  api_1.diag.warn(`non-number value provided to metric ${this._descriptor.name}: ${value}`);
15704
15704
  return;
@@ -15710,7 +15710,7 @@ var require_Instruments = __commonJS({
15710
15710
  return;
15711
15711
  }
15712
15712
  }
15713
- this._writableMetricStorage.record(value, attributes, context2, (0, core_1.millisToHrTime)(Date.now()));
15713
+ this._writableMetricStorage.record(value, attributes, context4, (0, core_1.millisToHrTime)(Date.now()));
15714
15714
  }
15715
15715
  };
15716
15716
  __name(_SyncInstrument, "SyncInstrument");
@@ -16425,9 +16425,9 @@ var require_MultiWritableMetricStorage = __commonJS({
16425
16425
  constructor(_backingStorages) {
16426
16426
  this._backingStorages = _backingStorages;
16427
16427
  }
16428
- record(value, attributes, context2, recordTime) {
16428
+ record(value, attributes, context4, recordTime) {
16429
16429
  this._backingStorages.forEach((it) => {
16430
- it.record(value, attributes, context2, recordTime);
16430
+ it.record(value, attributes, context4, recordTime);
16431
16431
  });
16432
16432
  }
16433
16433
  };
@@ -16637,9 +16637,9 @@ var require_SyncMetricStorage = __commonJS({
16637
16637
  this._deltaMetricStorage = new DeltaMetricProcessor_1.DeltaMetricProcessor(aggregator, this._aggregationCardinalityLimit);
16638
16638
  this._temporalMetricStorage = new TemporalMetricProcessor_1.TemporalMetricProcessor(aggregator, collectorHandles);
16639
16639
  }
16640
- record(value, attributes, context2, recordTime) {
16641
- attributes = this._attributesProcessor.process(attributes, context2);
16642
- this._deltaMetricStorage.record(value, attributes, context2, recordTime);
16640
+ record(value, attributes, context4, recordTime) {
16641
+ attributes = this._attributesProcessor.process(attributes, context4);
16642
+ this._deltaMetricStorage.record(value, attributes, context4, recordTime);
16643
16643
  }
16644
16644
  /**
16645
16645
  * Collects the metrics from this storage.
@@ -18225,195 +18225,17 @@ FileSystemPersist.FILENAME_SUFFIX = ".ai.json";
18225
18225
  init_esm();
18226
18226
  import url from "node:url";
18227
18227
 
18228
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/pipeline.js
18229
- var ValidPhaseNames = /* @__PURE__ */ new Set(["Deserialize", "Serialize", "Retry", "Sign"]);
18230
- var _HttpPipeline = class _HttpPipeline {
18231
- constructor(policies) {
18232
- var _a3;
18233
- this._policies = [];
18234
- this._policies = (_a3 = policies === null || policies === void 0 ? void 0 : policies.slice(0)) !== null && _a3 !== void 0 ? _a3 : [];
18235
- this._orderedPolicies = void 0;
18236
- }
18237
- addPolicy(policy, options = {}) {
18238
- if (options.phase && options.afterPhase) {
18239
- throw new Error("Policies inside a phase cannot specify afterPhase.");
18240
- }
18241
- if (options.phase && !ValidPhaseNames.has(options.phase)) {
18242
- throw new Error(`Invalid phase name: ${options.phase}`);
18243
- }
18244
- if (options.afterPhase && !ValidPhaseNames.has(options.afterPhase)) {
18245
- throw new Error(`Invalid afterPhase name: ${options.afterPhase}`);
18246
- }
18247
- this._policies.push({
18248
- policy,
18249
- options
18250
- });
18251
- this._orderedPolicies = void 0;
18252
- }
18253
- removePolicy(options) {
18254
- const removedPolicies = [];
18255
- this._policies = this._policies.filter((policyDescriptor) => {
18256
- if (options.name && policyDescriptor.policy.name === options.name || options.phase && policyDescriptor.options.phase === options.phase) {
18257
- removedPolicies.push(policyDescriptor.policy);
18258
- return false;
18259
- } else {
18260
- return true;
18261
- }
18262
- });
18263
- this._orderedPolicies = void 0;
18264
- return removedPolicies;
18265
- }
18266
- sendRequest(httpClient, request3) {
18267
- const policies = this.getOrderedPolicies();
18268
- const pipeline = policies.reduceRight((next, policy) => {
18269
- return (req) => {
18270
- return policy.sendRequest(req, next);
18271
- };
18272
- }, (req) => httpClient.sendRequest(req));
18273
- return pipeline(request3);
18274
- }
18275
- getOrderedPolicies() {
18276
- if (!this._orderedPolicies) {
18277
- this._orderedPolicies = this.orderPolicies();
18278
- }
18279
- return this._orderedPolicies;
18280
- }
18281
- clone() {
18282
- return new _HttpPipeline(this._policies);
18283
- }
18284
- static create() {
18285
- return new _HttpPipeline();
18286
- }
18287
- orderPolicies() {
18288
- const result = [];
18289
- const policyMap = /* @__PURE__ */ new Map();
18290
- function createPhase(name) {
18291
- return {
18292
- name,
18293
- policies: /* @__PURE__ */ new Set(),
18294
- hasRun: false,
18295
- hasAfterPolicies: false
18296
- };
18297
- }
18298
- __name(createPhase, "createPhase");
18299
- const serializePhase = createPhase("Serialize");
18300
- const noPhase = createPhase("None");
18301
- const deserializePhase = createPhase("Deserialize");
18302
- const retryPhase = createPhase("Retry");
18303
- const signPhase = createPhase("Sign");
18304
- const orderedPhases = [serializePhase, noPhase, deserializePhase, retryPhase, signPhase];
18305
- function getPhase(phase) {
18306
- if (phase === "Retry") {
18307
- return retryPhase;
18308
- } else if (phase === "Serialize") {
18309
- return serializePhase;
18310
- } else if (phase === "Deserialize") {
18311
- return deserializePhase;
18312
- } else if (phase === "Sign") {
18313
- return signPhase;
18314
- } else {
18315
- return noPhase;
18316
- }
18317
- }
18318
- __name(getPhase, "getPhase");
18319
- for (const descriptor of this._policies) {
18320
- const policy = descriptor.policy;
18321
- const options = descriptor.options;
18322
- const policyName = policy.name;
18323
- if (policyMap.has(policyName)) {
18324
- throw new Error("Duplicate policy names not allowed in pipeline");
18325
- }
18326
- const node = {
18327
- policy,
18328
- dependsOn: /* @__PURE__ */ new Set(),
18329
- dependants: /* @__PURE__ */ new Set()
18330
- };
18331
- if (options.afterPhase) {
18332
- node.afterPhase = getPhase(options.afterPhase);
18333
- node.afterPhase.hasAfterPolicies = true;
18334
- }
18335
- policyMap.set(policyName, node);
18336
- const phase = getPhase(options.phase);
18337
- phase.policies.add(node);
18338
- }
18339
- for (const descriptor of this._policies) {
18340
- const { policy, options } = descriptor;
18341
- const policyName = policy.name;
18342
- const node = policyMap.get(policyName);
18343
- if (!node) {
18344
- throw new Error(`Missing node for policy ${policyName}`);
18345
- }
18346
- if (options.afterPolicies) {
18347
- for (const afterPolicyName of options.afterPolicies) {
18348
- const afterNode = policyMap.get(afterPolicyName);
18349
- if (afterNode) {
18350
- node.dependsOn.add(afterNode);
18351
- afterNode.dependants.add(node);
18352
- }
18353
- }
18354
- }
18355
- if (options.beforePolicies) {
18356
- for (const beforePolicyName of options.beforePolicies) {
18357
- const beforeNode = policyMap.get(beforePolicyName);
18358
- if (beforeNode) {
18359
- beforeNode.dependsOn.add(node);
18360
- node.dependants.add(beforeNode);
18361
- }
18362
- }
18363
- }
18364
- }
18365
- function walkPhase(phase) {
18366
- phase.hasRun = true;
18367
- for (const node of phase.policies) {
18368
- if (node.afterPhase && (!node.afterPhase.hasRun || node.afterPhase.policies.size)) {
18369
- continue;
18370
- }
18371
- if (node.dependsOn.size === 0) {
18372
- result.push(node.policy);
18373
- for (const dependant of node.dependants) {
18374
- dependant.dependsOn.delete(node);
18375
- }
18376
- policyMap.delete(node.policy.name);
18377
- phase.policies.delete(node);
18378
- }
18379
- }
18380
- }
18381
- __name(walkPhase, "walkPhase");
18382
- function walkPhases() {
18383
- for (const phase of orderedPhases) {
18384
- walkPhase(phase);
18385
- if (phase.policies.size > 0 && phase !== noPhase) {
18386
- if (!noPhase.hasRun) {
18387
- walkPhase(noPhase);
18388
- }
18389
- return;
18390
- }
18391
- if (phase.hasAfterPolicies) {
18392
- walkPhase(noPhase);
18393
- }
18394
- }
18395
- }
18396
- __name(walkPhases, "walkPhases");
18397
- let iteration = 0;
18398
- while (policyMap.size > 0) {
18399
- iteration++;
18400
- const initialResultLength = result.length;
18401
- walkPhases();
18402
- if (result.length <= initialResultLength && iteration > 1) {
18403
- throw new Error("Cannot satisfy policy dependencies due to requirements cycle.");
18404
- }
18405
- }
18406
- return result;
18228
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/abort-controller/AbortError.js
18229
+ var _AbortError = class _AbortError extends Error {
18230
+ constructor(message) {
18231
+ super(message);
18232
+ this.name = "AbortError";
18407
18233
  }
18408
18234
  };
18409
- __name(_HttpPipeline, "HttpPipeline");
18410
- var HttpPipeline = _HttpPipeline;
18411
- function createEmptyPipeline() {
18412
- return HttpPipeline.create();
18413
- }
18414
- __name(createEmptyPipeline, "createEmptyPipeline");
18235
+ __name(_AbortError, "AbortError");
18236
+ var AbortError = _AbortError;
18415
18237
 
18416
- // ../../node_modules/.store/@azure-logger-npm-1.1.4-957abd6a95/package/dist/esm/log.js
18238
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/logger/log.js
18417
18239
  import { EOL } from "node:os";
18418
18240
  import util from "node:util";
18419
18241
  import * as process3 from "node:process";
@@ -18422,7 +18244,7 @@ function log(message, ...args) {
18422
18244
  }
18423
18245
  __name(log, "log");
18424
18246
 
18425
- // ../../node_modules/.store/@azure-logger-npm-1.1.4-957abd6a95/package/dist/esm/debug.js
18247
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/logger/debug.js
18426
18248
  var debugEnvVariable = typeof process !== "undefined" && process.env && process.env.DEBUG || void 0;
18427
18249
  var enabledString;
18428
18250
  var enabledNamespaces = [];
@@ -18519,149 +18341,193 @@ function extend(namespace) {
18519
18341
  __name(extend, "extend");
18520
18342
  var debug_default = debugObj;
18521
18343
 
18522
- // ../../node_modules/.store/@azure-logger-npm-1.1.4-957abd6a95/package/dist/esm/index.js
18523
- var registeredLoggers = /* @__PURE__ */ new Set();
18524
- var logLevelFromEnv = typeof process !== "undefined" && process.env && process.env.AZURE_LOG_LEVEL || void 0;
18525
- var azureLogLevel;
18526
- var AzureLogger = debug_default("azure");
18527
- AzureLogger.log = (...args) => {
18528
- debug_default.log(...args);
18529
- };
18530
- var AZURE_LOG_LEVELS = ["verbose", "info", "warning", "error"];
18531
- if (logLevelFromEnv) {
18532
- if (isAzureLogLevel(logLevelFromEnv)) {
18533
- setLogLevel(logLevelFromEnv);
18534
- } else {
18535
- console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`);
18536
- }
18537
- }
18538
- function setLogLevel(level) {
18539
- if (level && !isAzureLogLevel(level)) {
18540
- throw new Error(`Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(",")}`);
18541
- }
18542
- azureLogLevel = level;
18543
- const enabledNamespaces2 = [];
18544
- for (const logger3 of registeredLoggers) {
18545
- if (shouldEnable(logger3)) {
18546
- enabledNamespaces2.push(logger3.namespace);
18547
- }
18548
- }
18549
- debug_default.enable(enabledNamespaces2.join(","));
18550
- }
18551
- __name(setLogLevel, "setLogLevel");
18344
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/logger/logger.js
18345
+ var TYPESPEC_RUNTIME_LOG_LEVELS = ["verbose", "info", "warning", "error"];
18552
18346
  var levelMap = {
18553
18347
  verbose: 400,
18554
18348
  info: 300,
18555
18349
  warning: 200,
18556
18350
  error: 100
18557
18351
  };
18558
- function createClientLogger(namespace) {
18559
- const clientRootLogger = AzureLogger.extend(namespace);
18560
- patchLogMethod(AzureLogger, clientRootLogger);
18561
- return {
18562
- error: createLogger(clientRootLogger, "error"),
18563
- warning: createLogger(clientRootLogger, "warning"),
18564
- info: createLogger(clientRootLogger, "info"),
18565
- verbose: createLogger(clientRootLogger, "verbose")
18566
- };
18567
- }
18568
- __name(createClientLogger, "createClientLogger");
18569
18352
  function patchLogMethod(parent, child) {
18570
18353
  child.log = (...args) => {
18571
18354
  parent.log(...args);
18572
18355
  };
18573
18356
  }
18574
18357
  __name(patchLogMethod, "patchLogMethod");
18575
- function createLogger(parent, level) {
18576
- const logger3 = Object.assign(parent.extend(level), {
18577
- level
18578
- });
18579
- patchLogMethod(parent, logger3);
18580
- if (shouldEnable(logger3)) {
18581
- const enabledNamespaces2 = debug_default.disable();
18582
- debug_default.enable(enabledNamespaces2 + "," + logger3.namespace);
18583
- }
18584
- registeredLoggers.add(logger3);
18585
- return logger3;
18586
- }
18587
- __name(createLogger, "createLogger");
18588
- function shouldEnable(logger3) {
18589
- return Boolean(azureLogLevel && levelMap[logger3.level] <= levelMap[azureLogLevel]);
18358
+ function isTypeSpecRuntimeLogLevel(level) {
18359
+ return TYPESPEC_RUNTIME_LOG_LEVELS.includes(level);
18590
18360
  }
18591
- __name(shouldEnable, "shouldEnable");
18592
- function isAzureLogLevel(logLevel) {
18593
- return AZURE_LOG_LEVELS.includes(logLevel);
18594
- }
18595
- __name(isAzureLogLevel, "isAzureLogLevel");
18596
-
18597
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/log.js
18598
- var logger = createClientLogger("core-rest-pipeline");
18599
-
18600
- // ../../node_modules/.store/@azure-abort-controller-npm-2.1.2-a36d73ebb9/package/dist/esm/AbortError.js
18601
- var _AbortError = class _AbortError extends Error {
18602
- constructor(message) {
18603
- super(message);
18604
- this.name = "AbortError";
18361
+ __name(isTypeSpecRuntimeLogLevel, "isTypeSpecRuntimeLogLevel");
18362
+ function createLoggerContext(options) {
18363
+ const registeredLoggers = /* @__PURE__ */ new Set();
18364
+ const logLevelFromEnv = typeof process !== "undefined" && process.env && process.env[options.logLevelEnvVarName] || void 0;
18365
+ let logLevel;
18366
+ const clientLogger = debug_default(options.namespace);
18367
+ clientLogger.log = (...args) => {
18368
+ debug_default.log(...args);
18369
+ };
18370
+ function contextSetLogLevel(level) {
18371
+ if (level && !isTypeSpecRuntimeLogLevel(level)) {
18372
+ throw new Error(`Unknown log level '${level}'. Acceptable values: ${TYPESPEC_RUNTIME_LOG_LEVELS.join(",")}`);
18373
+ }
18374
+ logLevel = level;
18375
+ const enabledNamespaces2 = [];
18376
+ for (const logger4 of registeredLoggers) {
18377
+ if (shouldEnable(logger4)) {
18378
+ enabledNamespaces2.push(logger4.namespace);
18379
+ }
18380
+ }
18381
+ debug_default.enable(enabledNamespaces2.join(","));
18605
18382
  }
18606
- };
18607
- __name(_AbortError, "AbortError");
18608
- var AbortError = _AbortError;
18609
-
18610
- // ../../node_modules/.store/@azure-core-util-npm-1.11.0-56c728e23b/package/dist/esm/random.js
18611
- function getRandomIntegerInclusive(min, max) {
18612
- min = Math.ceil(min);
18613
- max = Math.floor(max);
18614
- const offset = Math.floor(Math.random() * (max - min + 1));
18615
- return offset + min;
18383
+ __name(contextSetLogLevel, "contextSetLogLevel");
18384
+ if (logLevelFromEnv) {
18385
+ if (isTypeSpecRuntimeLogLevel(logLevelFromEnv)) {
18386
+ contextSetLogLevel(logLevelFromEnv);
18387
+ } else {
18388
+ console.error(`${options.logLevelEnvVarName} set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${TYPESPEC_RUNTIME_LOG_LEVELS.join(", ")}.`);
18389
+ }
18390
+ }
18391
+ function shouldEnable(logger4) {
18392
+ return Boolean(logLevel && levelMap[logger4.level] <= levelMap[logLevel]);
18393
+ }
18394
+ __name(shouldEnable, "shouldEnable");
18395
+ function createLogger(parent, level) {
18396
+ const logger4 = Object.assign(parent.extend(level), {
18397
+ level
18398
+ });
18399
+ patchLogMethod(parent, logger4);
18400
+ if (shouldEnable(logger4)) {
18401
+ const enabledNamespaces2 = debug_default.disable();
18402
+ debug_default.enable(enabledNamespaces2 + "," + logger4.namespace);
18403
+ }
18404
+ registeredLoggers.add(logger4);
18405
+ return logger4;
18406
+ }
18407
+ __name(createLogger, "createLogger");
18408
+ function contextGetLogLevel() {
18409
+ return logLevel;
18410
+ }
18411
+ __name(contextGetLogLevel, "contextGetLogLevel");
18412
+ function contextCreateClientLogger(namespace) {
18413
+ const clientRootLogger = clientLogger.extend(namespace);
18414
+ patchLogMethod(clientLogger, clientRootLogger);
18415
+ return {
18416
+ error: createLogger(clientRootLogger, "error"),
18417
+ warning: createLogger(clientRootLogger, "warning"),
18418
+ info: createLogger(clientRootLogger, "info"),
18419
+ verbose: createLogger(clientRootLogger, "verbose")
18420
+ };
18421
+ }
18422
+ __name(contextCreateClientLogger, "contextCreateClientLogger");
18423
+ return {
18424
+ setLogLevel: contextSetLogLevel,
18425
+ getLogLevel: contextGetLogLevel,
18426
+ createClientLogger: contextCreateClientLogger,
18427
+ logger: clientLogger
18428
+ };
18616
18429
  }
18617
- __name(getRandomIntegerInclusive, "getRandomIntegerInclusive");
18618
-
18619
- // ../../node_modules/.store/@azure-core-util-npm-1.11.0-56c728e23b/package/dist/esm/delay.js
18620
- function calculateRetryDelay(retryAttempt, config) {
18621
- const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);
18622
- const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);
18623
- const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);
18624
- return { retryAfterInMs };
18430
+ __name(createLoggerContext, "createLoggerContext");
18431
+ var context2 = createLoggerContext({
18432
+ logLevelEnvVarName: "TYPESPEC_RUNTIME_LOG_LEVEL",
18433
+ namespace: "typeSpecRuntime"
18434
+ });
18435
+ var TypeSpecRuntimeLogger = context2.logger;
18436
+ function createClientLogger(namespace) {
18437
+ return context2.createClientLogger(namespace);
18625
18438
  }
18626
- __name(calculateRetryDelay, "calculateRetryDelay");
18439
+ __name(createClientLogger, "createClientLogger");
18627
18440
 
18628
- // ../../node_modules/.store/@azure-core-util-npm-1.11.0-56c728e23b/package/dist/esm/object.js
18629
- function isObject(input) {
18630
- return typeof input === "object" && input !== null && !Array.isArray(input) && !(input instanceof RegExp) && !(input instanceof Date);
18441
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/httpHeaders.js
18442
+ function normalizeName(name) {
18443
+ return name.toLowerCase();
18631
18444
  }
18632
- __name(isObject, "isObject");
18633
-
18634
- // ../../node_modules/.store/@azure-core-util-npm-1.11.0-56c728e23b/package/dist/esm/error.js
18635
- function isError(e) {
18636
- if (isObject(e)) {
18637
- const hasName = typeof e.name === "string";
18638
- const hasMessage = typeof e.message === "string";
18639
- return hasName && hasMessage;
18445
+ __name(normalizeName, "normalizeName");
18446
+ function* headerIterator(map) {
18447
+ for (const entry of map.values()) {
18448
+ yield [entry.name, entry.value];
18640
18449
  }
18641
- return false;
18642
18450
  }
18643
- __name(isError, "isError");
18644
- function getErrorMessage(e) {
18645
- if (isError(e)) {
18646
- return e.message;
18647
- } else {
18648
- let stringified;
18649
- try {
18650
- if (typeof e === "object" && e) {
18651
- stringified = JSON.stringify(e);
18652
- } else {
18653
- stringified = String(e);
18451
+ __name(headerIterator, "headerIterator");
18452
+ var _HttpHeadersImpl = class _HttpHeadersImpl {
18453
+ constructor(rawHeaders) {
18454
+ this._headersMap = /* @__PURE__ */ new Map();
18455
+ if (rawHeaders) {
18456
+ for (const headerName of Object.keys(rawHeaders)) {
18457
+ this.set(headerName, rawHeaders[headerName]);
18654
18458
  }
18655
- } catch (err) {
18656
- stringified = "[unable to stringify input]";
18657
18459
  }
18658
- return `Unknown error ${stringified}`;
18659
18460
  }
18461
+ /**
18462
+ * Set a header in this collection with the provided name and value. The name is
18463
+ * case-insensitive.
18464
+ * @param name - The name of the header to set. This value is case-insensitive.
18465
+ * @param value - The value of the header to set.
18466
+ */
18467
+ set(name, value) {
18468
+ this._headersMap.set(normalizeName(name), { name, value: String(value).trim() });
18469
+ }
18470
+ /**
18471
+ * Get the header value for the provided header name, or undefined if no header exists in this
18472
+ * collection with the provided name.
18473
+ * @param name - The name of the header. This value is case-insensitive.
18474
+ */
18475
+ get(name) {
18476
+ var _a3;
18477
+ return (_a3 = this._headersMap.get(normalizeName(name))) === null || _a3 === void 0 ? void 0 : _a3.value;
18478
+ }
18479
+ /**
18480
+ * Get whether or not this header collection contains a header entry for the provided header name.
18481
+ * @param name - The name of the header to set. This value is case-insensitive.
18482
+ */
18483
+ has(name) {
18484
+ return this._headersMap.has(normalizeName(name));
18485
+ }
18486
+ /**
18487
+ * Remove the header with the provided headerName.
18488
+ * @param name - The name of the header to remove.
18489
+ */
18490
+ delete(name) {
18491
+ this._headersMap.delete(normalizeName(name));
18492
+ }
18493
+ /**
18494
+ * Get the JSON object representation of this HTTP header collection.
18495
+ */
18496
+ toJSON(options = {}) {
18497
+ const result = {};
18498
+ if (options.preserveCase) {
18499
+ for (const entry of this._headersMap.values()) {
18500
+ result[entry.name] = entry.value;
18501
+ }
18502
+ } else {
18503
+ for (const [normalizedName, entry] of this._headersMap) {
18504
+ result[normalizedName] = entry.value;
18505
+ }
18506
+ }
18507
+ return result;
18508
+ }
18509
+ /**
18510
+ * Get the string representation of this HTTP header collection.
18511
+ */
18512
+ toString() {
18513
+ return JSON.stringify(this.toJSON({ preserveCase: true }));
18514
+ }
18515
+ /**
18516
+ * Iterate over tuples of header [name, value] pairs.
18517
+ */
18518
+ [Symbol.iterator]() {
18519
+ return headerIterator(this._headersMap);
18520
+ }
18521
+ };
18522
+ __name(_HttpHeadersImpl, "HttpHeadersImpl");
18523
+ var HttpHeadersImpl = _HttpHeadersImpl;
18524
+ function createHttpHeaders(rawHeaders) {
18525
+ return new HttpHeadersImpl(rawHeaders);
18660
18526
  }
18661
- __name(getErrorMessage, "getErrorMessage");
18527
+ __name(createHttpHeaders, "createHttpHeaders");
18662
18528
 
18663
- // ../../node_modules/.store/@azure-core-util-npm-1.11.0-56c728e23b/package/dist/esm/uuidUtils.js
18664
- import { randomUUID as v4RandomUUID } from "crypto";
18529
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/uuidUtils.js
18530
+ import { randomUUID as v4RandomUUID } from "node:crypto";
18665
18531
  var _a;
18666
18532
  var 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) : v4RandomUUID;
18667
18533
  function randomUUID() {
@@ -18669,566 +18535,809 @@ function randomUUID() {
18669
18535
  }
18670
18536
  __name(randomUUID, "randomUUID");
18671
18537
 
18672
- // ../../node_modules/.store/@azure-core-util-npm-1.11.0-56c728e23b/package/dist/esm/checkEnvironment.js
18673
- var _a2;
18674
- var _b;
18675
- var _c;
18676
- var _d;
18677
- var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
18678
- var isWebWorker = typeof self === "object" && typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" && (((_a2 = self.constructor) === null || _a2 === void 0 ? void 0 : _a2.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");
18679
- var isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
18680
- var isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
18681
- var isNodeLike = typeof globalThis.process !== "undefined" && Boolean(globalThis.process.version) && Boolean((_d = globalThis.process.versions) === null || _d === void 0 ? void 0 : _d.node);
18682
- var isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
18683
-
18684
- // ../../node_modules/.store/@azure-core-util-npm-1.11.0-56c728e23b/package/dist/esm/bytesEncoding.js
18685
- function stringToUint8Array(value, format) {
18686
- return Buffer.from(value, format);
18538
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/pipelineRequest.js
18539
+ var _PipelineRequestImpl = class _PipelineRequestImpl {
18540
+ constructor(options) {
18541
+ var _a3, _b2, _c2, _d2, _e, _f, _g;
18542
+ this.url = options.url;
18543
+ this.body = options.body;
18544
+ this.headers = (_a3 = options.headers) !== null && _a3 !== void 0 ? _a3 : createHttpHeaders();
18545
+ this.method = (_b2 = options.method) !== null && _b2 !== void 0 ? _b2 : "GET";
18546
+ this.timeout = (_c2 = options.timeout) !== null && _c2 !== void 0 ? _c2 : 0;
18547
+ this.multipartBody = options.multipartBody;
18548
+ this.formData = options.formData;
18549
+ this.disableKeepAlive = (_d2 = options.disableKeepAlive) !== null && _d2 !== void 0 ? _d2 : false;
18550
+ this.proxySettings = options.proxySettings;
18551
+ this.streamResponseStatusCodes = options.streamResponseStatusCodes;
18552
+ this.withCredentials = (_e = options.withCredentials) !== null && _e !== void 0 ? _e : false;
18553
+ this.abortSignal = options.abortSignal;
18554
+ this.onUploadProgress = options.onUploadProgress;
18555
+ this.onDownloadProgress = options.onDownloadProgress;
18556
+ this.requestId = options.requestId || randomUUID();
18557
+ this.allowInsecureConnection = (_f = options.allowInsecureConnection) !== null && _f !== void 0 ? _f : false;
18558
+ this.enableBrowserStreams = (_g = options.enableBrowserStreams) !== null && _g !== void 0 ? _g : false;
18559
+ this.requestOverrides = options.requestOverrides;
18560
+ this.authSchemes = options.authSchemes;
18561
+ }
18562
+ };
18563
+ __name(_PipelineRequestImpl, "PipelineRequestImpl");
18564
+ var PipelineRequestImpl = _PipelineRequestImpl;
18565
+ function createPipelineRequest(options) {
18566
+ return new PipelineRequestImpl(options);
18687
18567
  }
18688
- __name(stringToUint8Array, "stringToUint8Array");
18568
+ __name(createPipelineRequest, "createPipelineRequest");
18689
18569
 
18690
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/sanitizer.js
18691
- var RedactedString = "REDACTED";
18692
- var defaultAllowedHeaderNames = [
18693
- "x-ms-client-request-id",
18694
- "x-ms-return-client-request-id",
18695
- "x-ms-useragent",
18696
- "x-ms-correlation-request-id",
18697
- "x-ms-request-id",
18698
- "client-request-id",
18699
- "ms-cv",
18700
- "return-client-request-id",
18701
- "traceparent",
18702
- "Access-Control-Allow-Credentials",
18703
- "Access-Control-Allow-Headers",
18704
- "Access-Control-Allow-Methods",
18705
- "Access-Control-Allow-Origin",
18706
- "Access-Control-Expose-Headers",
18707
- "Access-Control-Max-Age",
18708
- "Access-Control-Request-Headers",
18709
- "Access-Control-Request-Method",
18710
- "Origin",
18711
- "Accept",
18712
- "Accept-Encoding",
18713
- "Cache-Control",
18714
- "Connection",
18715
- "Content-Length",
18716
- "Content-Type",
18717
- "Date",
18718
- "ETag",
18719
- "Expires",
18720
- "If-Match",
18721
- "If-Modified-Since",
18722
- "If-None-Match",
18723
- "If-Unmodified-Since",
18724
- "Last-Modified",
18725
- "Pragma",
18726
- "Request-Id",
18727
- "Retry-After",
18728
- "Server",
18729
- "Transfer-Encoding",
18730
- "User-Agent",
18731
- "WWW-Authenticate"
18732
- ];
18733
- var defaultAllowedQueryParameters = ["api-version"];
18734
- var _Sanitizer = class _Sanitizer {
18735
- constructor({ additionalAllowedHeaderNames: allowedHeaderNames = [], additionalAllowedQueryParameters: allowedQueryParameters = [] } = {}) {
18736
- allowedHeaderNames = defaultAllowedHeaderNames.concat(allowedHeaderNames);
18737
- allowedQueryParameters = defaultAllowedQueryParameters.concat(allowedQueryParameters);
18738
- this.allowedHeaderNames = new Set(allowedHeaderNames.map((n) => n.toLowerCase()));
18739
- this.allowedQueryParameters = new Set(allowedQueryParameters.map((p) => p.toLowerCase()));
18740
- }
18741
- sanitize(obj) {
18742
- const seen = /* @__PURE__ */ new Set();
18743
- return JSON.stringify(obj, (key, value) => {
18744
- if (value instanceof Error) {
18745
- return Object.assign(Object.assign({}, value), { name: value.name, message: value.message });
18746
- }
18747
- if (key === "headers") {
18748
- return this.sanitizeHeaders(value);
18749
- } else if (key === "url") {
18750
- return this.sanitizeUrl(value);
18751
- } else if (key === "query") {
18752
- return this.sanitizeQuery(value);
18753
- } else if (key === "body") {
18754
- return void 0;
18755
- } else if (key === "response") {
18756
- return void 0;
18757
- } else if (key === "operationSpec") {
18758
- return void 0;
18759
- } else if (Array.isArray(value) || isObject(value)) {
18760
- if (seen.has(value)) {
18761
- return "[Circular]";
18762
- }
18763
- seen.add(value);
18764
- }
18765
- return value;
18766
- }, 2);
18570
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/pipeline.js
18571
+ var ValidPhaseNames = /* @__PURE__ */ new Set(["Deserialize", "Serialize", "Retry", "Sign"]);
18572
+ var _HttpPipeline = class _HttpPipeline {
18573
+ constructor(policies) {
18574
+ var _a3;
18575
+ this._policies = [];
18576
+ this._policies = (_a3 = policies === null || policies === void 0 ? void 0 : policies.slice(0)) !== null && _a3 !== void 0 ? _a3 : [];
18577
+ this._orderedPolicies = void 0;
18767
18578
  }
18768
- sanitizeUrl(value) {
18769
- if (typeof value !== "string" || value === null || value === "") {
18770
- return value;
18579
+ addPolicy(policy, options = {}) {
18580
+ if (options.phase && options.afterPhase) {
18581
+ throw new Error("Policies inside a phase cannot specify afterPhase.");
18771
18582
  }
18772
- const url2 = new URL(value);
18773
- if (!url2.search) {
18774
- return value;
18583
+ if (options.phase && !ValidPhaseNames.has(options.phase)) {
18584
+ throw new Error(`Invalid phase name: ${options.phase}`);
18775
18585
  }
18776
- for (const [key] of url2.searchParams) {
18777
- if (!this.allowedQueryParameters.has(key.toLowerCase())) {
18778
- url2.searchParams.set(key, RedactedString);
18779
- }
18586
+ if (options.afterPhase && !ValidPhaseNames.has(options.afterPhase)) {
18587
+ throw new Error(`Invalid afterPhase name: ${options.afterPhase}`);
18780
18588
  }
18781
- return url2.toString();
18589
+ this._policies.push({
18590
+ policy,
18591
+ options
18592
+ });
18593
+ this._orderedPolicies = void 0;
18782
18594
  }
18783
- sanitizeHeaders(obj) {
18784
- const sanitized = {};
18785
- for (const key of Object.keys(obj)) {
18786
- if (this.allowedHeaderNames.has(key.toLowerCase())) {
18787
- sanitized[key] = obj[key];
18595
+ removePolicy(options) {
18596
+ const removedPolicies = [];
18597
+ this._policies = this._policies.filter((policyDescriptor) => {
18598
+ if (options.name && policyDescriptor.policy.name === options.name || options.phase && policyDescriptor.options.phase === options.phase) {
18599
+ removedPolicies.push(policyDescriptor.policy);
18600
+ return false;
18788
18601
  } else {
18789
- sanitized[key] = RedactedString;
18602
+ return true;
18790
18603
  }
18604
+ });
18605
+ this._orderedPolicies = void 0;
18606
+ return removedPolicies;
18607
+ }
18608
+ sendRequest(httpClient, request3) {
18609
+ const policies = this.getOrderedPolicies();
18610
+ const pipeline = policies.reduceRight((next, policy) => {
18611
+ return (req) => {
18612
+ return policy.sendRequest(req, next);
18613
+ };
18614
+ }, (req) => httpClient.sendRequest(req));
18615
+ return pipeline(request3);
18616
+ }
18617
+ getOrderedPolicies() {
18618
+ if (!this._orderedPolicies) {
18619
+ this._orderedPolicies = this.orderPolicies();
18791
18620
  }
18792
- return sanitized;
18621
+ return this._orderedPolicies;
18793
18622
  }
18794
- sanitizeQuery(value) {
18795
- if (typeof value !== "object" || value === null) {
18796
- return value;
18623
+ clone() {
18624
+ return new _HttpPipeline(this._policies);
18625
+ }
18626
+ static create() {
18627
+ return new _HttpPipeline();
18628
+ }
18629
+ orderPolicies() {
18630
+ const result = [];
18631
+ const policyMap = /* @__PURE__ */ new Map();
18632
+ function createPhase(name) {
18633
+ return {
18634
+ name,
18635
+ policies: /* @__PURE__ */ new Set(),
18636
+ hasRun: false,
18637
+ hasAfterPolicies: false
18638
+ };
18797
18639
  }
18798
- const sanitized = {};
18799
- for (const k of Object.keys(value)) {
18800
- if (this.allowedQueryParameters.has(k.toLowerCase())) {
18801
- sanitized[k] = value[k];
18640
+ __name(createPhase, "createPhase");
18641
+ const serializePhase = createPhase("Serialize");
18642
+ const noPhase = createPhase("None");
18643
+ const deserializePhase = createPhase("Deserialize");
18644
+ const retryPhase = createPhase("Retry");
18645
+ const signPhase = createPhase("Sign");
18646
+ const orderedPhases = [serializePhase, noPhase, deserializePhase, retryPhase, signPhase];
18647
+ function getPhase(phase) {
18648
+ if (phase === "Retry") {
18649
+ return retryPhase;
18650
+ } else if (phase === "Serialize") {
18651
+ return serializePhase;
18652
+ } else if (phase === "Deserialize") {
18653
+ return deserializePhase;
18654
+ } else if (phase === "Sign") {
18655
+ return signPhase;
18802
18656
  } else {
18803
- sanitized[k] = RedactedString;
18657
+ return noPhase;
18804
18658
  }
18805
18659
  }
18806
- return sanitized;
18807
- }
18808
- };
18809
- __name(_Sanitizer, "Sanitizer");
18810
- var Sanitizer = _Sanitizer;
18811
-
18812
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/logPolicy.js
18813
- var logPolicyName = "logPolicy";
18814
- function logPolicy(options = {}) {
18815
- var _a3;
18816
- const logger3 = (_a3 = options.logger) !== null && _a3 !== void 0 ? _a3 : logger.info;
18817
- const sanitizer = new Sanitizer({
18818
- additionalAllowedHeaderNames: options.additionalAllowedHeaderNames,
18819
- additionalAllowedQueryParameters: options.additionalAllowedQueryParameters
18820
- });
18821
- return {
18822
- name: logPolicyName,
18823
- async sendRequest(request3, next) {
18824
- if (!logger3.enabled) {
18825
- return next(request3);
18660
+ __name(getPhase, "getPhase");
18661
+ for (const descriptor of this._policies) {
18662
+ const policy = descriptor.policy;
18663
+ const options = descriptor.options;
18664
+ const policyName = policy.name;
18665
+ if (policyMap.has(policyName)) {
18666
+ throw new Error("Duplicate policy names not allowed in pipeline");
18826
18667
  }
18827
- logger3(`Request: ${sanitizer.sanitize(request3)}`);
18828
- const response = await next(request3);
18829
- logger3(`Response status code: ${response.status}`);
18830
- logger3(`Headers: ${sanitizer.sanitize(response.headers)}`);
18831
- return response;
18668
+ const node = {
18669
+ policy,
18670
+ dependsOn: /* @__PURE__ */ new Set(),
18671
+ dependants: /* @__PURE__ */ new Set()
18672
+ };
18673
+ if (options.afterPhase) {
18674
+ node.afterPhase = getPhase(options.afterPhase);
18675
+ node.afterPhase.hasAfterPolicies = true;
18676
+ }
18677
+ policyMap.set(policyName, node);
18678
+ const phase = getPhase(options.phase);
18679
+ phase.policies.add(node);
18832
18680
  }
18833
- };
18834
- }
18835
- __name(logPolicy, "logPolicy");
18836
-
18837
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/redirectPolicy.js
18838
- var redirectPolicyName = "redirectPolicy";
18839
- var allowedRedirect = ["GET", "HEAD"];
18840
- function redirectPolicy(options = {}) {
18841
- const { maxRetries = 20 } = options;
18842
- return {
18843
- name: redirectPolicyName,
18844
- async sendRequest(request3, next) {
18845
- const response = await next(request3);
18846
- return handleRedirect(next, response, maxRetries);
18681
+ for (const descriptor of this._policies) {
18682
+ const { policy, options } = descriptor;
18683
+ const policyName = policy.name;
18684
+ const node = policyMap.get(policyName);
18685
+ if (!node) {
18686
+ throw new Error(`Missing node for policy ${policyName}`);
18687
+ }
18688
+ if (options.afterPolicies) {
18689
+ for (const afterPolicyName of options.afterPolicies) {
18690
+ const afterNode = policyMap.get(afterPolicyName);
18691
+ if (afterNode) {
18692
+ node.dependsOn.add(afterNode);
18693
+ afterNode.dependants.add(node);
18694
+ }
18695
+ }
18696
+ }
18697
+ if (options.beforePolicies) {
18698
+ for (const beforePolicyName of options.beforePolicies) {
18699
+ const beforeNode = policyMap.get(beforePolicyName);
18700
+ if (beforeNode) {
18701
+ beforeNode.dependsOn.add(node);
18702
+ node.dependants.add(beforeNode);
18703
+ }
18704
+ }
18705
+ }
18847
18706
  }
18848
- };
18849
- }
18850
- __name(redirectPolicy, "redirectPolicy");
18851
- async function handleRedirect(next, response, maxRetries, currentRetries = 0) {
18852
- const { request: request3, status, headers } = response;
18853
- const locationHeader = headers.get("location");
18854
- if (locationHeader && (status === 300 || status === 301 && allowedRedirect.includes(request3.method) || status === 302 && allowedRedirect.includes(request3.method) || status === 303 && request3.method === "POST" || status === 307) && currentRetries < maxRetries) {
18855
- const url2 = new URL(locationHeader, request3.url);
18856
- request3.url = url2.toString();
18857
- if (status === 303) {
18858
- request3.method = "GET";
18859
- request3.headers.delete("Content-Length");
18860
- delete request3.body;
18707
+ function walkPhase(phase) {
18708
+ phase.hasRun = true;
18709
+ for (const node of phase.policies) {
18710
+ if (node.afterPhase && (!node.afterPhase.hasRun || node.afterPhase.policies.size)) {
18711
+ continue;
18712
+ }
18713
+ if (node.dependsOn.size === 0) {
18714
+ result.push(node.policy);
18715
+ for (const dependant of node.dependants) {
18716
+ dependant.dependsOn.delete(node);
18717
+ }
18718
+ policyMap.delete(node.policy.name);
18719
+ phase.policies.delete(node);
18720
+ }
18721
+ }
18861
18722
  }
18862
- request3.headers.delete("Authorization");
18863
- const res = await next(request3);
18864
- return handleRedirect(next, res, maxRetries, currentRetries + 1);
18865
- }
18866
- return response;
18867
- }
18868
- __name(handleRedirect, "handleRedirect");
18869
-
18870
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/userAgentPlatform.js
18871
- import * as os from "node:os";
18872
- import * as process4 from "node:process";
18873
- function getHeaderName() {
18874
- return "User-Agent";
18875
- }
18876
- __name(getHeaderName, "getHeaderName");
18877
- async function setPlatformSpecificData(map) {
18878
- if (process4 && process4.versions) {
18879
- const versions2 = process4.versions;
18880
- if (versions2.bun) {
18881
- map.set("Bun", versions2.bun);
18882
- } else if (versions2.deno) {
18883
- map.set("Deno", versions2.deno);
18884
- } else if (versions2.node) {
18885
- map.set("Node", versions2.node);
18723
+ __name(walkPhase, "walkPhase");
18724
+ function walkPhases() {
18725
+ for (const phase of orderedPhases) {
18726
+ walkPhase(phase);
18727
+ if (phase.policies.size > 0 && phase !== noPhase) {
18728
+ if (!noPhase.hasRun) {
18729
+ walkPhase(noPhase);
18730
+ }
18731
+ return;
18732
+ }
18733
+ if (phase.hasAfterPolicies) {
18734
+ walkPhase(noPhase);
18735
+ }
18736
+ }
18737
+ }
18738
+ __name(walkPhases, "walkPhases");
18739
+ let iteration = 0;
18740
+ while (policyMap.size > 0) {
18741
+ iteration++;
18742
+ const initialResultLength = result.length;
18743
+ walkPhases();
18744
+ if (result.length <= initialResultLength && iteration > 1) {
18745
+ throw new Error("Cannot satisfy policy dependencies due to requirements cycle.");
18746
+ }
18886
18747
  }
18748
+ return result;
18887
18749
  }
18888
- map.set("OS", `(${os.arch()}-${os.type()}-${os.release()})`);
18750
+ };
18751
+ __name(_HttpPipeline, "HttpPipeline");
18752
+ var HttpPipeline = _HttpPipeline;
18753
+ function createEmptyPipeline() {
18754
+ return HttpPipeline.create();
18889
18755
  }
18890
- __name(setPlatformSpecificData, "setPlatformSpecificData");
18756
+ __name(createEmptyPipeline, "createEmptyPipeline");
18891
18757
 
18892
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/constants.js
18893
- var SDK_VERSION = "1.19.1";
18894
- var DEFAULT_RETRY_POLICY_COUNT = 3;
18758
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/object.js
18759
+ function isObject(input) {
18760
+ return typeof input === "object" && input !== null && !Array.isArray(input) && !(input instanceof RegExp) && !(input instanceof Date);
18761
+ }
18762
+ __name(isObject, "isObject");
18895
18763
 
18896
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/userAgent.js
18897
- function getUserAgentString(telemetryInfo) {
18898
- const parts = [];
18899
- for (const [key, value] of telemetryInfo) {
18900
- const token = value ? `${key}/${value}` : key;
18901
- parts.push(token);
18764
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/error.js
18765
+ function isError(e) {
18766
+ if (isObject(e)) {
18767
+ const hasName = typeof e.name === "string";
18768
+ const hasMessage = typeof e.message === "string";
18769
+ return hasName && hasMessage;
18902
18770
  }
18903
- return parts.join(" ");
18904
- }
18905
- __name(getUserAgentString, "getUserAgentString");
18906
- function getUserAgentHeaderName() {
18907
- return getHeaderName();
18908
- }
18909
- __name(getUserAgentHeaderName, "getUserAgentHeaderName");
18910
- async function getUserAgentValue(prefix) {
18911
- const runtimeInfo = /* @__PURE__ */ new Map();
18912
- runtimeInfo.set("core-rest-pipeline", SDK_VERSION);
18913
- await setPlatformSpecificData(runtimeInfo);
18914
- const defaultAgent = getUserAgentString(runtimeInfo);
18915
- const userAgentValue = prefix ? `${prefix} ${defaultAgent}` : defaultAgent;
18916
- return userAgentValue;
18771
+ return false;
18917
18772
  }
18918
- __name(getUserAgentValue, "getUserAgentValue");
18773
+ __name(isError, "isError");
18919
18774
 
18920
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/userAgentPolicy.js
18921
- var UserAgentHeaderName = getUserAgentHeaderName();
18922
- var userAgentPolicyName = "userAgentPolicy";
18923
- function userAgentPolicy(options = {}) {
18924
- const userAgentValue = getUserAgentValue(options.userAgentPrefix);
18925
- return {
18926
- name: userAgentPolicyName,
18927
- async sendRequest(request3, next) {
18928
- if (!request3.headers.has(UserAgentHeaderName)) {
18929
- request3.headers.set(UserAgentHeaderName, await userAgentValue);
18930
- }
18931
- return next(request3);
18932
- }
18933
- };
18934
- }
18935
- __name(userAgentPolicy, "userAgentPolicy");
18775
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/inspect.js
18776
+ import { inspect } from "node:util";
18777
+ var custom = inspect.custom;
18936
18778
 
18937
- // ../../node_modules/.store/tslib-npm-2.8.1-66590b21b8/package/tslib.es6.mjs
18938
- function __values2(o) {
18939
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
18940
- if (m) return m.call(o);
18941
- if (o && typeof o.length === "number") return {
18942
- next: /* @__PURE__ */ __name(function() {
18943
- if (o && i >= o.length) o = void 0;
18944
- return { value: o && o[i++], done: !o };
18945
- }, "next")
18946
- };
18947
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
18948
- }
18949
- __name(__values2, "__values");
18950
- function __await(v) {
18951
- return this instanceof __await ? (this.v = v, this) : new __await(v);
18952
- }
18953
- __name(__await, "__await");
18954
- function __asyncGenerator(thisArg, _arguments, generator) {
18955
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
18956
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
18957
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
18958
- return this;
18959
- }, i;
18960
- function awaitReturn(f) {
18961
- return function(v) {
18962
- return Promise.resolve(v).then(f, reject);
18963
- };
18779
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/sanitizer.js
18780
+ var RedactedString = "REDACTED";
18781
+ var defaultAllowedHeaderNames = [
18782
+ "x-ms-client-request-id",
18783
+ "x-ms-return-client-request-id",
18784
+ "x-ms-useragent",
18785
+ "x-ms-correlation-request-id",
18786
+ "x-ms-request-id",
18787
+ "client-request-id",
18788
+ "ms-cv",
18789
+ "return-client-request-id",
18790
+ "traceparent",
18791
+ "Access-Control-Allow-Credentials",
18792
+ "Access-Control-Allow-Headers",
18793
+ "Access-Control-Allow-Methods",
18794
+ "Access-Control-Allow-Origin",
18795
+ "Access-Control-Expose-Headers",
18796
+ "Access-Control-Max-Age",
18797
+ "Access-Control-Request-Headers",
18798
+ "Access-Control-Request-Method",
18799
+ "Origin",
18800
+ "Accept",
18801
+ "Accept-Encoding",
18802
+ "Cache-Control",
18803
+ "Connection",
18804
+ "Content-Length",
18805
+ "Content-Type",
18806
+ "Date",
18807
+ "ETag",
18808
+ "Expires",
18809
+ "If-Match",
18810
+ "If-Modified-Since",
18811
+ "If-None-Match",
18812
+ "If-Unmodified-Since",
18813
+ "Last-Modified",
18814
+ "Pragma",
18815
+ "Request-Id",
18816
+ "Retry-After",
18817
+ "Server",
18818
+ "Transfer-Encoding",
18819
+ "User-Agent",
18820
+ "WWW-Authenticate"
18821
+ ];
18822
+ var defaultAllowedQueryParameters = ["api-version"];
18823
+ var _Sanitizer = class _Sanitizer {
18824
+ constructor({ additionalAllowedHeaderNames: allowedHeaderNames = [], additionalAllowedQueryParameters: allowedQueryParameters = [] } = {}) {
18825
+ allowedHeaderNames = defaultAllowedHeaderNames.concat(allowedHeaderNames);
18826
+ allowedQueryParameters = defaultAllowedQueryParameters.concat(allowedQueryParameters);
18827
+ this.allowedHeaderNames = new Set(allowedHeaderNames.map((n) => n.toLowerCase()));
18828
+ this.allowedQueryParameters = new Set(allowedQueryParameters.map((p) => p.toLowerCase()));
18964
18829
  }
18965
- __name(awaitReturn, "awaitReturn");
18966
- function verb(n, f) {
18967
- if (g[n]) {
18968
- i[n] = function(v) {
18969
- return new Promise(function(a, b) {
18970
- q.push([n, v, a, b]) > 1 || resume(n, v);
18971
- });
18972
- };
18973
- if (f) i[n] = f(i[n]);
18974
- }
18830
+ /**
18831
+ * Sanitizes an object for logging.
18832
+ * @param obj - The object to sanitize
18833
+ * @returns - The sanitized object as a string
18834
+ */
18835
+ sanitize(obj) {
18836
+ const seen = /* @__PURE__ */ new Set();
18837
+ return JSON.stringify(obj, (key, value) => {
18838
+ if (value instanceof Error) {
18839
+ return Object.assign(Object.assign({}, value), { name: value.name, message: value.message });
18840
+ }
18841
+ if (key === "headers") {
18842
+ return this.sanitizeHeaders(value);
18843
+ } else if (key === "url") {
18844
+ return this.sanitizeUrl(value);
18845
+ } else if (key === "query") {
18846
+ return this.sanitizeQuery(value);
18847
+ } else if (key === "body") {
18848
+ return void 0;
18849
+ } else if (key === "response") {
18850
+ return void 0;
18851
+ } else if (key === "operationSpec") {
18852
+ return void 0;
18853
+ } else if (Array.isArray(value) || isObject(value)) {
18854
+ if (seen.has(value)) {
18855
+ return "[Circular]";
18856
+ }
18857
+ seen.add(value);
18858
+ }
18859
+ return value;
18860
+ }, 2);
18975
18861
  }
18976
- __name(verb, "verb");
18977
- function resume(n, v) {
18978
- try {
18979
- step(g[n](v));
18980
- } catch (e) {
18981
- settle(q[0][3], e);
18862
+ /**
18863
+ * Sanitizes a URL for logging.
18864
+ * @param value - The URL to sanitize
18865
+ * @returns - The sanitized URL as a string
18866
+ */
18867
+ sanitizeUrl(value) {
18868
+ if (typeof value !== "string" || value === null || value === "") {
18869
+ return value;
18870
+ }
18871
+ const url2 = new URL(value);
18872
+ if (!url2.search) {
18873
+ return value;
18982
18874
  }
18875
+ for (const [key] of url2.searchParams) {
18876
+ if (!this.allowedQueryParameters.has(key.toLowerCase())) {
18877
+ url2.searchParams.set(key, RedactedString);
18878
+ }
18879
+ }
18880
+ return url2.toString();
18983
18881
  }
18984
- __name(resume, "resume");
18985
- function step(r) {
18986
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
18882
+ sanitizeHeaders(obj) {
18883
+ const sanitized = {};
18884
+ for (const key of Object.keys(obj)) {
18885
+ if (this.allowedHeaderNames.has(key.toLowerCase())) {
18886
+ sanitized[key] = obj[key];
18887
+ } else {
18888
+ sanitized[key] = RedactedString;
18889
+ }
18890
+ }
18891
+ return sanitized;
18987
18892
  }
18988
- __name(step, "step");
18989
- function fulfill(value) {
18990
- resume("next", value);
18893
+ sanitizeQuery(value) {
18894
+ if (typeof value !== "object" || value === null) {
18895
+ return value;
18896
+ }
18897
+ const sanitized = {};
18898
+ for (const k of Object.keys(value)) {
18899
+ if (this.allowedQueryParameters.has(k.toLowerCase())) {
18900
+ sanitized[k] = value[k];
18901
+ } else {
18902
+ sanitized[k] = RedactedString;
18903
+ }
18904
+ }
18905
+ return sanitized;
18991
18906
  }
18992
- __name(fulfill, "fulfill");
18993
- function reject(value) {
18994
- resume("throw", value);
18907
+ };
18908
+ __name(_Sanitizer, "Sanitizer");
18909
+ var Sanitizer = _Sanitizer;
18910
+
18911
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/restError.js
18912
+ var errorSanitizer = new Sanitizer();
18913
+ var _RestError = class _RestError extends Error {
18914
+ constructor(message, options = {}) {
18915
+ super(message);
18916
+ this.name = "RestError";
18917
+ this.code = options.code;
18918
+ this.statusCode = options.statusCode;
18919
+ Object.defineProperty(this, "request", { value: options.request, enumerable: false });
18920
+ Object.defineProperty(this, "response", { value: options.response, enumerable: false });
18921
+ Object.defineProperty(this, custom, {
18922
+ value: /* @__PURE__ */ __name(() => {
18923
+ return `RestError: ${this.message}
18924
+ ${errorSanitizer.sanitize(Object.assign(Object.assign({}, this), { request: this.request, response: this.response }))}`;
18925
+ }, "value"),
18926
+ enumerable: false
18927
+ });
18928
+ Object.setPrototypeOf(this, _RestError.prototype);
18995
18929
  }
18996
- __name(reject, "reject");
18997
- function settle(f, v) {
18998
- if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
18930
+ };
18931
+ __name(_RestError, "RestError");
18932
+ var RestError = _RestError;
18933
+ RestError.REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
18934
+ RestError.PARSE_ERROR = "PARSE_ERROR";
18935
+ function isRestError(e) {
18936
+ if (e instanceof RestError) {
18937
+ return true;
18999
18938
  }
19000
- __name(settle, "settle");
18939
+ return isError(e) && e.name === "RestError";
19001
18940
  }
19002
- __name(__asyncGenerator, "__asyncGenerator");
19003
- function __asyncValues(o) {
19004
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
19005
- var m = o[Symbol.asyncIterator], i;
19006
- return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
19007
- return this;
19008
- }, i);
19009
- function verb(n) {
19010
- i[n] = o[n] && function(v) {
19011
- return new Promise(function(resolve, reject) {
19012
- v = o[n](v), settle(resolve, reject, v.done, v.value);
19013
- });
19014
- };
19015
- }
19016
- __name(verb, "verb");
19017
- function settle(resolve, reject, d, v) {
19018
- Promise.resolve(v).then(function(v2) {
19019
- resolve({ value: v2, done: d });
19020
- }, reject);
19021
- }
19022
- __name(settle, "settle");
18941
+ __name(isRestError, "isRestError");
18942
+
18943
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/bytesEncoding.js
18944
+ function stringToUint8Array(value, format) {
18945
+ return Buffer.from(value, format);
19023
18946
  }
19024
- __name(__asyncValues, "__asyncValues");
18947
+ __name(stringToUint8Array, "stringToUint8Array");
19025
18948
 
19026
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/concat.js
19027
- import { Readable } from "node:stream";
18949
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/nodeHttpClient.js
18950
+ import * as http from "node:http";
18951
+ import * as https from "node:https";
18952
+ import * as zlib from "node:zlib";
18953
+ import { Transform } from "node:stream";
19028
18954
 
19029
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/typeGuards.js
19030
- function isBlob(x) {
19031
- return typeof x.stream === "function";
19032
- }
19033
- __name(isBlob, "isBlob");
18955
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/log.js
18956
+ var logger = createClientLogger("ts-http-runtime");
19034
18957
 
19035
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/file.js
19036
- var rawContent = Symbol("rawContent");
19037
- function hasRawContent(x) {
19038
- return typeof x[rawContent] === "function";
18958
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/nodeHttpClient.js
18959
+ var DEFAULT_TLS_SETTINGS = {};
18960
+ function isReadableStream(body2) {
18961
+ return body2 && typeof body2.pipe === "function";
19039
18962
  }
19040
- __name(hasRawContent, "hasRawContent");
19041
- function getRawContent(blob) {
19042
- if (hasRawContent(blob)) {
19043
- return blob[rawContent]();
19044
- } else {
19045
- return blob.stream();
18963
+ __name(isReadableStream, "isReadableStream");
18964
+ function isStreamComplete(stream) {
18965
+ if (stream.readable === false) {
18966
+ return Promise.resolve();
19046
18967
  }
18968
+ return new Promise((resolve) => {
18969
+ const handler = /* @__PURE__ */ __name(() => {
18970
+ resolve();
18971
+ stream.removeListener("close", handler);
18972
+ stream.removeListener("end", handler);
18973
+ stream.removeListener("error", handler);
18974
+ }, "handler");
18975
+ stream.on("close", handler);
18976
+ stream.on("end", handler);
18977
+ stream.on("error", handler);
18978
+ });
19047
18979
  }
19048
- __name(getRawContent, "getRawContent");
19049
-
19050
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/concat.js
19051
- function streamAsyncIterator() {
19052
- return __asyncGenerator(this, arguments, /* @__PURE__ */ __name(function* streamAsyncIterator_1() {
19053
- const reader = this.getReader();
18980
+ __name(isStreamComplete, "isStreamComplete");
18981
+ function isArrayBuffer(body2) {
18982
+ return body2 && typeof body2.byteLength === "number";
18983
+ }
18984
+ __name(isArrayBuffer, "isArrayBuffer");
18985
+ var _ReportTransform = class _ReportTransform extends Transform {
18986
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
18987
+ _transform(chunk, _encoding, callback) {
18988
+ this.push(chunk);
18989
+ this.loadedBytes += chunk.length;
19054
18990
  try {
19055
- while (true) {
19056
- const { done, value } = yield __await(reader.read());
19057
- if (done) {
19058
- return yield __await(void 0);
19059
- }
19060
- yield yield __await(value);
19061
- }
19062
- } finally {
19063
- reader.releaseLock();
18991
+ this.progressCallback({ loadedBytes: this.loadedBytes });
18992
+ callback();
18993
+ } catch (e) {
18994
+ callback(e);
19064
18995
  }
19065
- }, "streamAsyncIterator_1"));
19066
- }
19067
- __name(streamAsyncIterator, "streamAsyncIterator");
19068
- function makeAsyncIterable(webStream) {
19069
- if (!webStream[Symbol.asyncIterator]) {
19070
- webStream[Symbol.asyncIterator] = streamAsyncIterator.bind(webStream);
19071
- }
19072
- if (!webStream.values) {
19073
- webStream.values = streamAsyncIterator.bind(webStream);
19074
18996
  }
19075
- }
19076
- __name(makeAsyncIterable, "makeAsyncIterable");
19077
- function ensureNodeStream(stream) {
19078
- if (stream instanceof ReadableStream) {
19079
- makeAsyncIterable(stream);
19080
- return Readable.fromWeb(stream);
19081
- } else {
19082
- return stream;
18997
+ constructor(progressCallback) {
18998
+ super();
18999
+ this.loadedBytes = 0;
19000
+ this.progressCallback = progressCallback;
19083
19001
  }
19084
- }
19085
- __name(ensureNodeStream, "ensureNodeStream");
19086
- function toStream(source) {
19087
- if (source instanceof Uint8Array) {
19088
- return Readable.from(Buffer.from(source));
19089
- } else if (isBlob(source)) {
19090
- return toStream(getRawContent(source));
19091
- } else {
19092
- return ensureNodeStream(source);
19002
+ };
19003
+ __name(_ReportTransform, "ReportTransform");
19004
+ var ReportTransform = _ReportTransform;
19005
+ var _NodeHttpClient = class _NodeHttpClient {
19006
+ constructor() {
19007
+ this.cachedHttpsAgents = /* @__PURE__ */ new WeakMap();
19093
19008
  }
19094
- }
19095
- __name(toStream, "toStream");
19096
- async function concat(sources) {
19097
- return function() {
19098
- const streams = sources.map((x) => typeof x === "function" ? x() : x).map(toStream);
19099
- return Readable.from(function() {
19100
- return __asyncGenerator(this, arguments, function* () {
19101
- var _a3, e_1, _b2, _c2;
19102
- for (const stream of streams) {
19103
- try {
19104
- for (var _d2 = true, stream_1 = (e_1 = void 0, __asyncValues(stream)), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a3 = stream_1_1.done, !_a3; _d2 = true) {
19105
- _c2 = stream_1_1.value;
19106
- _d2 = false;
19107
- const chunk = _c2;
19108
- yield yield __await(chunk);
19109
- }
19110
- } catch (e_1_1) {
19111
- e_1 = { error: e_1_1 };
19112
- } finally {
19113
- try {
19114
- if (!_d2 && !_a3 && (_b2 = stream_1.return)) yield __await(_b2.call(stream_1));
19115
- } finally {
19116
- if (e_1) throw e_1.error;
19117
- }
19118
- }
19009
+ /**
19010
+ * Makes a request over an underlying transport layer and returns the response.
19011
+ * @param request - The request to be made.
19012
+ */
19013
+ async sendRequest(request3) {
19014
+ var _a3, _b2, _c2;
19015
+ const abortController = new AbortController();
19016
+ let abortListener;
19017
+ if (request3.abortSignal) {
19018
+ if (request3.abortSignal.aborted) {
19019
+ throw new AbortError("The operation was aborted. Request has already been canceled.");
19020
+ }
19021
+ abortListener = /* @__PURE__ */ __name((event) => {
19022
+ if (event.type === "abort") {
19023
+ abortController.abort();
19119
19024
  }
19120
- });
19121
- }());
19122
- };
19123
- }
19124
- __name(concat, "concat");
19125
-
19126
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/multipartPolicy.js
19127
- function generateBoundary() {
19128
- return `----AzSDKFormBoundary${randomUUID()}`;
19129
- }
19130
- __name(generateBoundary, "generateBoundary");
19131
- function encodeHeaders(headers) {
19132
- let result = "";
19133
- for (const [key, value] of headers) {
19134
- result += `${key}: ${value}\r
19135
- `;
19136
- }
19137
- return result;
19138
- }
19139
- __name(encodeHeaders, "encodeHeaders");
19140
- function getLength(source) {
19141
- if (source instanceof Uint8Array) {
19142
- return source.byteLength;
19143
- } else if (isBlob(source)) {
19144
- return source.size === -1 ? void 0 : source.size;
19145
- } else {
19146
- return void 0;
19147
- }
19148
- }
19149
- __name(getLength, "getLength");
19150
- function getTotalLength(sources) {
19151
- let total = 0;
19152
- for (const source of sources) {
19153
- const partLength = getLength(source);
19154
- if (partLength === void 0) {
19155
- return void 0;
19156
- } else {
19157
- total += partLength;
19025
+ }, "abortListener");
19026
+ request3.abortSignal.addEventListener("abort", abortListener);
19158
19027
  }
19159
- }
19160
- return total;
19161
- }
19162
- __name(getTotalLength, "getTotalLength");
19163
- async function buildRequestBody(request3, parts, boundary) {
19164
- const sources = [
19165
- stringToUint8Array(`--${boundary}`, "utf-8"),
19166
- ...parts.flatMap((part) => [
19167
- stringToUint8Array("\r\n", "utf-8"),
19168
- stringToUint8Array(encodeHeaders(part.headers), "utf-8"),
19169
- stringToUint8Array("\r\n", "utf-8"),
19170
- part.body,
19171
- stringToUint8Array(`\r
19172
- --${boundary}`, "utf-8")
19173
- ]),
19174
- stringToUint8Array("--\r\n\r\n", "utf-8")
19175
- ];
19176
- const contentLength = getTotalLength(sources);
19177
- if (contentLength) {
19178
- request3.headers.set("Content-Length", contentLength);
19179
- }
19180
- request3.body = await concat(sources);
19181
- }
19182
- __name(buildRequestBody, "buildRequestBody");
19183
- var multipartPolicyName = "multipartPolicy";
19184
- var maxBoundaryLength = 70;
19185
- var validBoundaryCharacters = new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`);
19186
- function assertValidBoundary(boundary) {
19187
- if (boundary.length > maxBoundaryLength) {
19188
- throw new Error(`Multipart boundary "${boundary}" exceeds maximum length of 70 characters`);
19189
- }
19190
- if (Array.from(boundary).some((x) => !validBoundaryCharacters.has(x))) {
19191
- throw new Error(`Multipart boundary "${boundary}" contains invalid characters`);
19192
- }
19193
- }
19194
- __name(assertValidBoundary, "assertValidBoundary");
19195
- function multipartPolicy() {
19196
- return {
19197
- name: multipartPolicyName,
19198
- async sendRequest(request3, next) {
19199
- var _a3;
19200
- if (!request3.multipartBody) {
19201
- return next(request3);
19028
+ let timeoutId;
19029
+ if (request3.timeout > 0) {
19030
+ timeoutId = setTimeout(() => {
19031
+ const sanitizer = new Sanitizer();
19032
+ logger.info(`request to '${sanitizer.sanitizeUrl(request3.url)}' timed out. canceling...`);
19033
+ abortController.abort();
19034
+ }, request3.timeout);
19035
+ }
19036
+ const acceptEncoding = request3.headers.get("Accept-Encoding");
19037
+ const shouldDecompress = (acceptEncoding === null || acceptEncoding === void 0 ? void 0 : acceptEncoding.includes("gzip")) || (acceptEncoding === null || acceptEncoding === void 0 ? void 0 : acceptEncoding.includes("deflate"));
19038
+ let body2 = typeof request3.body === "function" ? request3.body() : request3.body;
19039
+ if (body2 && !request3.headers.has("Content-Length")) {
19040
+ const bodyLength = getBodyLength(body2);
19041
+ if (bodyLength !== null) {
19042
+ request3.headers.set("Content-Length", bodyLength);
19202
19043
  }
19203
- if (request3.body) {
19204
- throw new Error("multipartBody and regular body cannot be set at the same time");
19044
+ }
19045
+ let responseStream;
19046
+ try {
19047
+ if (body2 && request3.onUploadProgress) {
19048
+ const onUploadProgress = request3.onUploadProgress;
19049
+ const uploadReportStream = new ReportTransform(onUploadProgress);
19050
+ uploadReportStream.on("error", (e) => {
19051
+ logger.error("Error in upload progress", e);
19052
+ });
19053
+ if (isReadableStream(body2)) {
19054
+ body2.pipe(uploadReportStream);
19055
+ } else {
19056
+ uploadReportStream.end(body2);
19057
+ }
19058
+ body2 = uploadReportStream;
19205
19059
  }
19206
- let boundary = request3.multipartBody.boundary;
19207
- const contentTypeHeader = (_a3 = request3.headers.get("Content-Type")) !== null && _a3 !== void 0 ? _a3 : "multipart/mixed";
19208
- const parsedHeader = contentTypeHeader.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/);
19209
- if (!parsedHeader) {
19210
- throw new Error(`Got multipart request body, but content-type header was not multipart: ${contentTypeHeader}`);
19060
+ const res = await this.makeRequest(request3, abortController, body2);
19061
+ if (timeoutId !== void 0) {
19062
+ clearTimeout(timeoutId);
19211
19063
  }
19212
- const [, contentType2, parsedBoundary] = parsedHeader;
19213
- if (parsedBoundary && boundary && parsedBoundary !== boundary) {
19214
- throw new Error(`Multipart boundary was specified as ${parsedBoundary} in the header, but got ${boundary} in the request body`);
19064
+ const headers = getResponseHeaders(res);
19065
+ const status = (_a3 = res.statusCode) !== null && _a3 !== void 0 ? _a3 : 0;
19066
+ const response = {
19067
+ status,
19068
+ headers,
19069
+ request: request3
19070
+ };
19071
+ if (request3.method === "HEAD") {
19072
+ res.resume();
19073
+ return response;
19215
19074
  }
19216
- boundary !== null && boundary !== void 0 ? boundary : boundary = parsedBoundary;
19217
- if (boundary) {
19218
- assertValidBoundary(boundary);
19219
- } else {
19220
- boundary = generateBoundary();
19075
+ responseStream = shouldDecompress ? getDecodedResponseStream(res, headers) : res;
19076
+ const onDownloadProgress = request3.onDownloadProgress;
19077
+ if (onDownloadProgress) {
19078
+ const downloadReportStream = new ReportTransform(onDownloadProgress);
19079
+ downloadReportStream.on("error", (e) => {
19080
+ logger.error("Error in download progress", e);
19081
+ });
19082
+ responseStream.pipe(downloadReportStream);
19083
+ responseStream = downloadReportStream;
19221
19084
  }
19222
- request3.headers.set("Content-Type", `${contentType2}; boundary=${boundary}`);
19223
- await buildRequestBody(request3, request3.multipartBody.parts, boundary);
19224
- request3.multipartBody = void 0;
19225
- return next(request3);
19085
+ if (
19086
+ // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code
19087
+ ((_b2 = request3.streamResponseStatusCodes) === null || _b2 === void 0 ? void 0 : _b2.has(Number.POSITIVE_INFINITY)) || ((_c2 = request3.streamResponseStatusCodes) === null || _c2 === void 0 ? void 0 : _c2.has(response.status))
19088
+ ) {
19089
+ response.readableStreamBody = responseStream;
19090
+ } else {
19091
+ response.bodyAsText = await streamToText(responseStream);
19092
+ }
19093
+ return response;
19094
+ } finally {
19095
+ if (request3.abortSignal && abortListener) {
19096
+ let uploadStreamDone = Promise.resolve();
19097
+ if (isReadableStream(body2)) {
19098
+ uploadStreamDone = isStreamComplete(body2);
19099
+ }
19100
+ let downloadStreamDone = Promise.resolve();
19101
+ if (isReadableStream(responseStream)) {
19102
+ downloadStreamDone = isStreamComplete(responseStream);
19103
+ }
19104
+ Promise.all([uploadStreamDone, downloadStreamDone]).then(() => {
19105
+ var _a4;
19106
+ if (abortListener) {
19107
+ (_a4 = request3.abortSignal) === null || _a4 === void 0 ? void 0 : _a4.removeEventListener("abort", abortListener);
19108
+ }
19109
+ }).catch((e) => {
19110
+ logger.warning("Error when cleaning up abortListener on httpRequest", e);
19111
+ });
19112
+ }
19113
+ }
19114
+ }
19115
+ makeRequest(request3, abortController, body2) {
19116
+ var _a3;
19117
+ const url2 = new URL(request3.url);
19118
+ const isInsecure = url2.protocol !== "https:";
19119
+ if (isInsecure && !request3.allowInsecureConnection) {
19120
+ throw new Error(`Cannot connect to ${request3.url} while allowInsecureConnection is false.`);
19121
+ }
19122
+ const agent = (_a3 = request3.agent) !== null && _a3 !== void 0 ? _a3 : this.getOrCreateAgent(request3, isInsecure);
19123
+ const options = Object.assign({ agent, hostname: url2.hostname, path: `${url2.pathname}${url2.search}`, port: url2.port, method: request3.method, headers: request3.headers.toJSON({ preserveCase: true }) }, request3.requestOverrides);
19124
+ return new Promise((resolve, reject) => {
19125
+ const req = isInsecure ? http.request(options, resolve) : https.request(options, resolve);
19126
+ req.once("error", (err) => {
19127
+ var _a4;
19128
+ reject(new RestError(err.message, { code: (_a4 = err.code) !== null && _a4 !== void 0 ? _a4 : RestError.REQUEST_SEND_ERROR, request: request3 }));
19129
+ });
19130
+ abortController.signal.addEventListener("abort", () => {
19131
+ const abortError = new AbortError("The operation was aborted. Rejecting from abort signal callback while making request.");
19132
+ req.destroy(abortError);
19133
+ reject(abortError);
19134
+ });
19135
+ if (body2 && isReadableStream(body2)) {
19136
+ body2.pipe(req);
19137
+ } else if (body2) {
19138
+ if (typeof body2 === "string" || Buffer.isBuffer(body2)) {
19139
+ req.end(body2);
19140
+ } else if (isArrayBuffer(body2)) {
19141
+ req.end(ArrayBuffer.isView(body2) ? Buffer.from(body2.buffer) : Buffer.from(body2));
19142
+ } else {
19143
+ logger.error("Unrecognized body type", body2);
19144
+ reject(new RestError("Unrecognized body type"));
19145
+ }
19146
+ } else {
19147
+ req.end();
19148
+ }
19149
+ });
19150
+ }
19151
+ getOrCreateAgent(request3, isInsecure) {
19152
+ var _a3;
19153
+ const disableKeepAlive = request3.disableKeepAlive;
19154
+ if (isInsecure) {
19155
+ if (disableKeepAlive) {
19156
+ return http.globalAgent;
19157
+ }
19158
+ if (!this.cachedHttpAgent) {
19159
+ this.cachedHttpAgent = new http.Agent({ keepAlive: true });
19160
+ }
19161
+ return this.cachedHttpAgent;
19162
+ } else {
19163
+ if (disableKeepAlive && !request3.tlsSettings) {
19164
+ return https.globalAgent;
19165
+ }
19166
+ const tlsSettings = (_a3 = request3.tlsSettings) !== null && _a3 !== void 0 ? _a3 : DEFAULT_TLS_SETTINGS;
19167
+ let agent = this.cachedHttpsAgents.get(tlsSettings);
19168
+ if (agent && agent.options.keepAlive === !disableKeepAlive) {
19169
+ return agent;
19170
+ }
19171
+ logger.info("No cached TLS Agent exist, creating a new Agent");
19172
+ agent = new https.Agent(Object.assign({
19173
+ // keepAlive is true if disableKeepAlive is false.
19174
+ keepAlive: !disableKeepAlive
19175
+ }, tlsSettings));
19176
+ this.cachedHttpsAgents.set(tlsSettings, agent);
19177
+ return agent;
19178
+ }
19179
+ }
19180
+ };
19181
+ __name(_NodeHttpClient, "NodeHttpClient");
19182
+ var NodeHttpClient = _NodeHttpClient;
19183
+ function getResponseHeaders(res) {
19184
+ const headers = createHttpHeaders();
19185
+ for (const header of Object.keys(res.headers)) {
19186
+ const value = res.headers[header];
19187
+ if (Array.isArray(value)) {
19188
+ if (value.length > 0) {
19189
+ headers.set(header, value[0]);
19190
+ }
19191
+ } else if (value) {
19192
+ headers.set(header, value);
19193
+ }
19194
+ }
19195
+ return headers;
19196
+ }
19197
+ __name(getResponseHeaders, "getResponseHeaders");
19198
+ function getDecodedResponseStream(stream, headers) {
19199
+ const contentEncoding = headers.get("Content-Encoding");
19200
+ if (contentEncoding === "gzip") {
19201
+ const unzip = zlib.createGunzip();
19202
+ stream.pipe(unzip);
19203
+ return unzip;
19204
+ } else if (contentEncoding === "deflate") {
19205
+ const inflate = zlib.createInflate();
19206
+ stream.pipe(inflate);
19207
+ return inflate;
19208
+ }
19209
+ return stream;
19210
+ }
19211
+ __name(getDecodedResponseStream, "getDecodedResponseStream");
19212
+ function streamToText(stream) {
19213
+ return new Promise((resolve, reject) => {
19214
+ const buffer = [];
19215
+ stream.on("data", (chunk) => {
19216
+ if (Buffer.isBuffer(chunk)) {
19217
+ buffer.push(chunk);
19218
+ } else {
19219
+ buffer.push(Buffer.from(chunk));
19220
+ }
19221
+ });
19222
+ stream.on("end", () => {
19223
+ resolve(Buffer.concat(buffer).toString("utf8"));
19224
+ });
19225
+ stream.on("error", (e) => {
19226
+ if (e && (e === null || e === void 0 ? void 0 : e.name) === "AbortError") {
19227
+ reject(e);
19228
+ } else {
19229
+ reject(new RestError(`Error reading response as text: ${e.message}`, {
19230
+ code: RestError.PARSE_ERROR
19231
+ }));
19232
+ }
19233
+ });
19234
+ });
19235
+ }
19236
+ __name(streamToText, "streamToText");
19237
+ function getBodyLength(body2) {
19238
+ if (!body2) {
19239
+ return 0;
19240
+ } else if (Buffer.isBuffer(body2)) {
19241
+ return body2.length;
19242
+ } else if (isReadableStream(body2)) {
19243
+ return null;
19244
+ } else if (isArrayBuffer(body2)) {
19245
+ return body2.byteLength;
19246
+ } else if (typeof body2 === "string") {
19247
+ return Buffer.from(body2).length;
19248
+ } else {
19249
+ return null;
19250
+ }
19251
+ }
19252
+ __name(getBodyLength, "getBodyLength");
19253
+ function createNodeHttpClient() {
19254
+ return new NodeHttpClient();
19255
+ }
19256
+ __name(createNodeHttpClient, "createNodeHttpClient");
19257
+
19258
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/defaultHttpClient.js
19259
+ function createDefaultHttpClient() {
19260
+ return createNodeHttpClient();
19261
+ }
19262
+ __name(createDefaultHttpClient, "createDefaultHttpClient");
19263
+
19264
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/logPolicy.js
19265
+ var logPolicyName = "logPolicy";
19266
+ function logPolicy(options = {}) {
19267
+ var _a3;
19268
+ const logger4 = (_a3 = options.logger) !== null && _a3 !== void 0 ? _a3 : logger.info;
19269
+ const sanitizer = new Sanitizer({
19270
+ additionalAllowedHeaderNames: options.additionalAllowedHeaderNames,
19271
+ additionalAllowedQueryParameters: options.additionalAllowedQueryParameters
19272
+ });
19273
+ return {
19274
+ name: logPolicyName,
19275
+ async sendRequest(request3, next) {
19276
+ if (!logger4.enabled) {
19277
+ return next(request3);
19278
+ }
19279
+ logger4(`Request: ${sanitizer.sanitize(request3)}`);
19280
+ const response = await next(request3);
19281
+ logger4(`Response status code: ${response.status}`);
19282
+ logger4(`Headers: ${sanitizer.sanitize(response.headers)}`);
19283
+ return response;
19226
19284
  }
19227
19285
  };
19228
19286
  }
19229
- __name(multipartPolicy, "multipartPolicy");
19287
+ __name(logPolicy, "logPolicy");
19288
+
19289
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/redirectPolicy.js
19290
+ var redirectPolicyName = "redirectPolicy";
19291
+ var allowedRedirect = ["GET", "HEAD"];
19292
+ function redirectPolicy(options = {}) {
19293
+ const { maxRetries = 20 } = options;
19294
+ return {
19295
+ name: redirectPolicyName,
19296
+ async sendRequest(request3, next) {
19297
+ const response = await next(request3);
19298
+ return handleRedirect(next, response, maxRetries);
19299
+ }
19300
+ };
19301
+ }
19302
+ __name(redirectPolicy, "redirectPolicy");
19303
+ async function handleRedirect(next, response, maxRetries, currentRetries = 0) {
19304
+ const { request: request3, status, headers } = response;
19305
+ const locationHeader = headers.get("location");
19306
+ if (locationHeader && (status === 300 || status === 301 && allowedRedirect.includes(request3.method) || status === 302 && allowedRedirect.includes(request3.method) || status === 303 && request3.method === "POST" || status === 307) && currentRetries < maxRetries) {
19307
+ const url2 = new URL(locationHeader, request3.url);
19308
+ request3.url = url2.toString();
19309
+ if (status === 303) {
19310
+ request3.method = "GET";
19311
+ request3.headers.delete("Content-Length");
19312
+ delete request3.body;
19313
+ }
19314
+ request3.headers.delete("Authorization");
19315
+ const res = await next(request3);
19316
+ return handleRedirect(next, res, maxRetries, currentRetries + 1);
19317
+ }
19318
+ return response;
19319
+ }
19320
+ __name(handleRedirect, "handleRedirect");
19321
+
19322
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/userAgentPlatform.js
19323
+ function getHeaderName() {
19324
+ return "User-Agent";
19325
+ }
19326
+ __name(getHeaderName, "getHeaderName");
19327
+
19328
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/constants.js
19329
+ var DEFAULT_RETRY_POLICY_COUNT = 3;
19230
19330
 
19231
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/decompressResponsePolicy.js
19331
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/userAgent.js
19332
+ function getUserAgentHeaderName() {
19333
+ return getHeaderName();
19334
+ }
19335
+ __name(getUserAgentHeaderName, "getUserAgentHeaderName");
19336
+
19337
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/userAgentPolicy.js
19338
+ var UserAgentHeaderName = getUserAgentHeaderName();
19339
+
19340
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/decompressResponsePolicy.js
19232
19341
  var decompressResponsePolicyName = "decompressResponsePolicy";
19233
19342
  function decompressResponsePolicy() {
19234
19343
  return {
@@ -19243,9 +19352,27 @@ function decompressResponsePolicy() {
19243
19352
  }
19244
19353
  __name(decompressResponsePolicy, "decompressResponsePolicy");
19245
19354
 
19246
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/helpers.js
19355
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/random.js
19356
+ function getRandomIntegerInclusive(min, max) {
19357
+ min = Math.ceil(min);
19358
+ max = Math.floor(max);
19359
+ const offset = Math.floor(Math.random() * (max - min + 1));
19360
+ return offset + min;
19361
+ }
19362
+ __name(getRandomIntegerInclusive, "getRandomIntegerInclusive");
19363
+
19364
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/delay.js
19365
+ function calculateRetryDelay(retryAttempt, config) {
19366
+ const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt);
19367
+ const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay);
19368
+ const retryAfterInMs = clampedDelay / 2 + getRandomIntegerInclusive(0, clampedDelay / 2);
19369
+ return { retryAfterInMs };
19370
+ }
19371
+ __name(calculateRetryDelay, "calculateRetryDelay");
19372
+
19373
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/helpers.js
19247
19374
  var StandardAbortMessage = "The operation was aborted.";
19248
- function delay2(delayInMs, value, options) {
19375
+ function delay(delayInMs, value, options) {
19249
19376
  return new Promise((resolve, reject) => {
19250
19377
  let timer = void 0;
19251
19378
  let onAborted = void 0;
@@ -19276,7 +19403,7 @@ function delay2(delayInMs, value, options) {
19276
19403
  }
19277
19404
  });
19278
19405
  }
19279
- __name(delay2, "delay");
19406
+ __name(delay, "delay");
19280
19407
  function parseHeaderValueAsNumber(response, headerName) {
19281
19408
  const value = response.headers.get(headerName);
19282
19409
  if (!value)
@@ -19288,7 +19415,7 @@ function parseHeaderValueAsNumber(response, headerName) {
19288
19415
  }
19289
19416
  __name(parseHeaderValueAsNumber, "parseHeaderValueAsNumber");
19290
19417
 
19291
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/retryStrategies/throttlingRetryStrategy.js
19418
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/retryStrategies/throttlingRetryStrategy.js
19292
19419
  var RetryAfterHeader = "Retry-After";
19293
19420
  var AllRetryAfterHeaders = ["retry-after-ms", "x-ms-retry-after-ms", RetryAfterHeader];
19294
19421
  function getRetryAfterInMs(response) {
@@ -19333,7 +19460,7 @@ function throttlingRetryStrategy() {
19333
19460
  }
19334
19461
  __name(throttlingRetryStrategy, "throttlingRetryStrategy");
19335
19462
 
19336
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/retryStrategies/exponentialRetryStrategy.js
19463
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/retryStrategies/exponentialRetryStrategy.js
19337
19464
  var DEFAULT_CLIENT_RETRY_INTERVAL = 1e3;
19338
19465
  var DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1e3 * 64;
19339
19466
  function exponentialRetryStrategy(options = {}) {
@@ -19374,11 +19501,11 @@ function isSystemError(err) {
19374
19501
  }
19375
19502
  __name(isSystemError, "isSystemError");
19376
19503
 
19377
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/retryPolicy.js
19378
- var retryPolicyLogger = createClientLogger("core-rest-pipeline retryPolicy");
19504
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/retryPolicy.js
19505
+ var retryPolicyLogger = createClientLogger("ts-http-runtime retryPolicy");
19379
19506
  var retryPolicyName = "retryPolicy";
19380
19507
  function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_POLICY_COUNT }) {
19381
- const logger3 = options.logger || retryPolicyLogger;
19508
+ const logger4 = options.logger || retryPolicyLogger;
19382
19509
  return {
19383
19510
  name: retryPolicyName,
19384
19511
  async sendRequest(request3, next) {
@@ -19391,11 +19518,11 @@ function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_POLICY_CO
19391
19518
  response = void 0;
19392
19519
  responseError = void 0;
19393
19520
  try {
19394
- logger3.info(`Retry ${retryCount}: Attempting to send request`, request3.requestId);
19521
+ logger4.info(`Retry ${retryCount}: Attempting to send request`, request3.requestId);
19395
19522
  response = await next(request3);
19396
- logger3.info(`Retry ${retryCount}: Received a response from request`, request3.requestId);
19523
+ logger4.info(`Retry ${retryCount}: Received a response from request`, request3.requestId);
19397
19524
  } catch (e) {
19398
- logger3.error(`Retry ${retryCount}: Received an error from request`, request3.requestId);
19525
+ logger4.error(`Retry ${retryCount}: Received an error from request`, request3.requestId);
19399
19526
  responseError = e;
19400
19527
  if (!e || responseError.name !== "RestError") {
19401
19528
  throw e;
@@ -19403,12 +19530,12 @@ function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_POLICY_CO
19403
19530
  response = responseError.response;
19404
19531
  }
19405
19532
  if ((_a3 = request3.abortSignal) === null || _a3 === void 0 ? void 0 : _a3.aborted) {
19406
- logger3.error(`Retry ${retryCount}: Request aborted.`);
19533
+ logger4.error(`Retry ${retryCount}: Request aborted.`);
19407
19534
  const abortError = new AbortError();
19408
19535
  throw abortError;
19409
19536
  }
19410
19537
  if (retryCount >= ((_b2 = options.maxRetries) !== null && _b2 !== void 0 ? _b2 : DEFAULT_RETRY_POLICY_COUNT)) {
19411
- logger3.info(`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`);
19538
+ logger4.info(`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`);
19412
19539
  if (responseError) {
19413
19540
  throw responseError;
19414
19541
  } else if (response) {
@@ -19417,9 +19544,9 @@ function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_POLICY_CO
19417
19544
  throw new Error("Maximum retries reached with no response or error to throw");
19418
19545
  }
19419
19546
  }
19420
- logger3.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);
19547
+ logger4.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);
19421
19548
  strategiesLoop: for (const strategy of strategies) {
19422
- const strategyLogger = strategy.logger || retryPolicyLogger;
19549
+ const strategyLogger = strategy.logger || logger4;
19423
19550
  strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);
19424
19551
  const modifiers = strategy.retry({
19425
19552
  retryCount,
@@ -19437,7 +19564,7 @@ function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_POLICY_CO
19437
19564
  }
19438
19565
  if (retryAfterInMs || retryAfterInMs === 0) {
19439
19566
  strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`);
19440
- await delay2(retryAfterInMs, void 0, { abortSignal: request3.abortSignal });
19567
+ await delay(retryAfterInMs, void 0, { abortSignal: request3.abortSignal });
19441
19568
  continue retryRequest;
19442
19569
  }
19443
19570
  if (redirectTo) {
@@ -19447,11 +19574,11 @@ function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_POLICY_CO
19447
19574
  }
19448
19575
  }
19449
19576
  if (responseError) {
19450
- logger3.info(`None of the retry strategies could work with the received error. Throwing it.`);
19577
+ logger4.info(`None of the retry strategies could work with the received error. Throwing it.`);
19451
19578
  throw responseError;
19452
19579
  }
19453
19580
  if (response) {
19454
- logger3.info(`None of the retry strategies could work with the received response. Returning it.`);
19581
+ logger4.info(`None of the retry strategies could work with the received response. Returning it.`);
19455
19582
  return response;
19456
19583
  }
19457
19584
  }
@@ -19460,7 +19587,7 @@ function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_POLICY_CO
19460
19587
  }
19461
19588
  __name(retryPolicy, "retryPolicy");
19462
19589
 
19463
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/defaultRetryPolicy.js
19590
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/defaultRetryPolicy.js
19464
19591
  var defaultRetryPolicyName = "defaultRetryPolicy";
19465
19592
  function defaultRetryPolicy(options = {}) {
19466
19593
  var _a3;
@@ -19473,95 +19600,19 @@ function defaultRetryPolicy(options = {}) {
19473
19600
  }
19474
19601
  __name(defaultRetryPolicy, "defaultRetryPolicy");
19475
19602
 
19476
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/httpHeaders.js
19477
- function normalizeName(name) {
19478
- return name.toLowerCase();
19479
- }
19480
- __name(normalizeName, "normalizeName");
19481
- function* headerIterator(map) {
19482
- for (const entry of map.values()) {
19483
- yield [entry.name, entry.value];
19484
- }
19485
- }
19486
- __name(headerIterator, "headerIterator");
19487
- var _HttpHeadersImpl = class _HttpHeadersImpl {
19488
- constructor(rawHeaders) {
19489
- this._headersMap = /* @__PURE__ */ new Map();
19490
- if (rawHeaders) {
19491
- for (const headerName of Object.keys(rawHeaders)) {
19492
- this.set(headerName, rawHeaders[headerName]);
19493
- }
19494
- }
19495
- }
19496
- /**
19497
- * Set a header in this collection with the provided name and value. The name is
19498
- * case-insensitive.
19499
- * @param name - The name of the header to set. This value is case-insensitive.
19500
- * @param value - The value of the header to set.
19501
- */
19502
- set(name, value) {
19503
- this._headersMap.set(normalizeName(name), { name, value: String(value).trim() });
19504
- }
19505
- /**
19506
- * Get the header value for the provided header name, or undefined if no header exists in this
19507
- * collection with the provided name.
19508
- * @param name - The name of the header. This value is case-insensitive.
19509
- */
19510
- get(name) {
19511
- var _a3;
19512
- return (_a3 = this._headersMap.get(normalizeName(name))) === null || _a3 === void 0 ? void 0 : _a3.value;
19513
- }
19514
- /**
19515
- * Get whether or not this header collection contains a header entry for the provided header name.
19516
- * @param name - The name of the header to set. This value is case-insensitive.
19517
- */
19518
- has(name) {
19519
- return this._headersMap.has(normalizeName(name));
19520
- }
19521
- /**
19522
- * Remove the header with the provided headerName.
19523
- * @param name - The name of the header to remove.
19524
- */
19525
- delete(name) {
19526
- this._headersMap.delete(normalizeName(name));
19527
- }
19528
- /**
19529
- * Get the JSON object representation of this HTTP header collection.
19530
- */
19531
- toJSON(options = {}) {
19532
- const result = {};
19533
- if (options.preserveCase) {
19534
- for (const entry of this._headersMap.values()) {
19535
- result[entry.name] = entry.value;
19536
- }
19537
- } else {
19538
- for (const [normalizedName, entry] of this._headersMap) {
19539
- result[normalizedName] = entry.value;
19540
- }
19541
- }
19542
- return result;
19543
- }
19544
- /**
19545
- * Get the string representation of this HTTP header collection.
19546
- */
19547
- toString() {
19548
- return JSON.stringify(this.toJSON({ preserveCase: true }));
19549
- }
19550
- /**
19551
- * Iterate over tuples of header [name, value] pairs.
19552
- */
19553
- [Symbol.iterator]() {
19554
- return headerIterator(this._headersMap);
19555
- }
19556
- };
19557
- __name(_HttpHeadersImpl, "HttpHeadersImpl");
19558
- var HttpHeadersImpl = _HttpHeadersImpl;
19559
- function createHttpHeaders(rawHeaders) {
19560
- return new HttpHeadersImpl(rawHeaders);
19561
- }
19562
- __name(createHttpHeaders, "createHttpHeaders");
19603
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/checkEnvironment.js
19604
+ var _a2;
19605
+ var _b;
19606
+ var _c;
19607
+ var _d;
19608
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
19609
+ var isWebWorker = typeof self === "object" && typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" && (((_a2 = self.constructor) === null || _a2 === void 0 ? void 0 : _a2.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");
19610
+ var isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
19611
+ var isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
19612
+ var isNodeLike = typeof globalThis.process !== "undefined" && Boolean(globalThis.process.version) && Boolean((_d = globalThis.process.versions) === null || _d === void 0 ? void 0 : _d.node);
19613
+ var isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
19563
19614
 
19564
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/formDataPolicy.js
19615
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/formDataPolicy.js
19565
19616
  var formDataPolicyName = "formDataPolicy";
19566
19617
  function formDataToFormDataMap(formData) {
19567
19618
  var _a3;
@@ -19643,7 +19694,7 @@ async function prepareFormData(formData, request3) {
19643
19694
  }
19644
19695
  __name(prepareFormData, "prepareFormData");
19645
19696
 
19646
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/proxyPolicy.js
19697
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/proxyPolicy.js
19647
19698
  var import_https_proxy_agent = __toESM(require_dist2(), 1);
19648
19699
  var import_http_proxy_agent = __toESM(require_dist3(), 1);
19649
19700
  var HTTPS_PROXY = "HTTPS_PROXY";
@@ -19776,22 +19827,7 @@ function proxyPolicy(proxySettings, options) {
19776
19827
  }
19777
19828
  __name(proxyPolicy, "proxyPolicy");
19778
19829
 
19779
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/setClientRequestIdPolicy.js
19780
- var setClientRequestIdPolicyName = "setClientRequestIdPolicy";
19781
- function setClientRequestIdPolicy(requestIdHeaderName = "x-ms-client-request-id") {
19782
- return {
19783
- name: setClientRequestIdPolicyName,
19784
- async sendRequest(request3, next) {
19785
- if (!request3.headers.has(requestIdHeaderName)) {
19786
- request3.headers.set(requestIdHeaderName, request3.requestId);
19787
- }
19788
- return next(request3);
19789
- }
19790
- };
19791
- }
19792
- __name(setClientRequestIdPolicy, "setClientRequestIdPolicy");
19793
-
19794
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/agentPolicy.js
19830
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/agentPolicy.js
19795
19831
  var agentPolicyName = "agentPolicy";
19796
19832
  function agentPolicy(agent) {
19797
19833
  return {
@@ -19806,7 +19842,7 @@ function agentPolicy(agent) {
19806
19842
  }
19807
19843
  __name(agentPolicy, "agentPolicy");
19808
19844
 
19809
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/tlsPolicy.js
19845
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/tlsPolicy.js
19810
19846
  var tlsPolicyName = "tlsPolicy";
19811
19847
  function tlsPolicy(tlsSettings) {
19812
19848
  return {
@@ -19821,675 +19857,922 @@ function tlsPolicy(tlsSettings) {
19821
19857
  }
19822
19858
  __name(tlsPolicy, "tlsPolicy");
19823
19859
 
19824
- // ../../node_modules/.store/@azure-core-tracing-npm-1.2.0-cae64582fc/package/dist/esm/tracingContext.js
19825
- var knownContextKeys = {
19826
- span: Symbol.for("@azure/core-tracing span"),
19827
- namespace: Symbol.for("@azure/core-tracing namespace")
19828
- };
19829
- function createTracingContext(options = {}) {
19830
- let context2 = new TracingContextImpl(options.parentContext);
19831
- if (options.span) {
19832
- context2 = context2.setValue(knownContextKeys.span, options.span);
19833
- }
19834
- if (options.namespace) {
19835
- context2 = context2.setValue(knownContextKeys.namespace, options.namespace);
19836
- }
19837
- return context2;
19860
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/typeGuards.js
19861
+ function isBlob(x) {
19862
+ return typeof x.stream === "function";
19838
19863
  }
19839
- __name(createTracingContext, "createTracingContext");
19840
- var _TracingContextImpl = class _TracingContextImpl {
19841
- constructor(initialContext) {
19842
- this._contextMap = initialContext instanceof _TracingContextImpl ? new Map(initialContext._contextMap) : /* @__PURE__ */ new Map();
19843
- }
19844
- setValue(key, value) {
19845
- const newContext = new _TracingContextImpl(this);
19846
- newContext._contextMap.set(key, value);
19847
- return newContext;
19848
- }
19849
- getValue(key) {
19850
- return this._contextMap.get(key);
19851
- }
19852
- deleteValue(key) {
19853
- const newContext = new _TracingContextImpl(this);
19854
- newContext._contextMap.delete(key);
19855
- return newContext;
19856
- }
19857
- };
19858
- __name(_TracingContextImpl, "TracingContextImpl");
19859
- var TracingContextImpl = _TracingContextImpl;
19860
-
19861
- // ../../node_modules/.store/@azure-core-tracing-npm-1.2.0-cae64582fc/package/dist/esm/state.js
19862
- var import_state = __toESM(require_state(), 1);
19863
- var state = import_state.state;
19864
+ __name(isBlob, "isBlob");
19864
19865
 
19865
- // ../../node_modules/.store/@azure-core-tracing-npm-1.2.0-cae64582fc/package/dist/esm/instrumenter.js
19866
- function createDefaultTracingSpan() {
19867
- return {
19868
- end: /* @__PURE__ */ __name(() => {
19869
- }, "end"),
19870
- isRecording: /* @__PURE__ */ __name(() => false, "isRecording"),
19871
- recordException: /* @__PURE__ */ __name(() => {
19872
- }, "recordException"),
19873
- setAttribute: /* @__PURE__ */ __name(() => {
19874
- }, "setAttribute"),
19875
- setStatus: /* @__PURE__ */ __name(() => {
19876
- }, "setStatus"),
19877
- addEvent: /* @__PURE__ */ __name(() => {
19878
- }, "addEvent")
19866
+ // ../../node_modules/.store/tslib-npm-2.8.1-66590b21b8/package/tslib.es6.mjs
19867
+ function __values2(o) {
19868
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
19869
+ if (m) return m.call(o);
19870
+ if (o && typeof o.length === "number") return {
19871
+ next: /* @__PURE__ */ __name(function() {
19872
+ if (o && i >= o.length) o = void 0;
19873
+ return { value: o && o[i++], done: !o };
19874
+ }, "next")
19879
19875
  };
19876
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
19880
19877
  }
19881
- __name(createDefaultTracingSpan, "createDefaultTracingSpan");
19882
- function createDefaultInstrumenter() {
19883
- return {
19884
- createRequestHeaders: /* @__PURE__ */ __name(() => {
19885
- return {};
19886
- }, "createRequestHeaders"),
19887
- parseTraceparentHeader: /* @__PURE__ */ __name(() => {
19888
- return void 0;
19889
- }, "parseTraceparentHeader"),
19890
- startSpan: /* @__PURE__ */ __name((_name, spanOptions) => {
19891
- return {
19892
- span: createDefaultTracingSpan(),
19893
- tracingContext: createTracingContext({ parentContext: spanOptions.tracingContext })
19894
- };
19895
- }, "startSpan"),
19896
- withContext(_context, callback, ...callbackArgs) {
19897
- return callback(...callbackArgs);
19898
- }
19899
- };
19878
+ __name(__values2, "__values");
19879
+ function __await(v) {
19880
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
19900
19881
  }
19901
- __name(createDefaultInstrumenter, "createDefaultInstrumenter");
19902
- function getInstrumenter() {
19903
- if (!state.instrumenterImplementation) {
19904
- state.instrumenterImplementation = createDefaultInstrumenter();
19882
+ __name(__await, "__await");
19883
+ function __asyncGenerator(thisArg, _arguments, generator) {
19884
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
19885
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
19886
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
19887
+ return this;
19888
+ }, i;
19889
+ function awaitReturn(f) {
19890
+ return function(v) {
19891
+ return Promise.resolve(v).then(f, reject);
19892
+ };
19905
19893
  }
19906
- return state.instrumenterImplementation;
19907
- }
19908
- __name(getInstrumenter, "getInstrumenter");
19909
-
19910
- // ../../node_modules/.store/@azure-core-tracing-npm-1.2.0-cae64582fc/package/dist/esm/tracingClient.js
19911
- function createTracingClient(options) {
19912
- const { namespace, packageName, packageVersion: packageVersion2 } = options;
19913
- function startSpan(name, operationOptions, spanOptions) {
19914
- var _a3;
19915
- const startSpanResult = getInstrumenter().startSpan(name, Object.assign(Object.assign({}, spanOptions), { packageName, packageVersion: packageVersion2, tracingContext: (_a3 = operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions) === null || _a3 === void 0 ? void 0 : _a3.tracingContext }));
19916
- let tracingContext = startSpanResult.tracingContext;
19917
- const span = startSpanResult.span;
19918
- if (!tracingContext.getValue(knownContextKeys.namespace)) {
19919
- tracingContext = tracingContext.setValue(knownContextKeys.namespace, namespace);
19894
+ __name(awaitReturn, "awaitReturn");
19895
+ function verb(n, f) {
19896
+ if (g[n]) {
19897
+ i[n] = function(v) {
19898
+ return new Promise(function(a, b) {
19899
+ q.push([n, v, a, b]) > 1 || resume(n, v);
19900
+ });
19901
+ };
19902
+ if (f) i[n] = f(i[n]);
19920
19903
  }
19921
- span.setAttribute("az.namespace", tracingContext.getValue(knownContextKeys.namespace));
19922
- const updatedOptions = Object.assign({}, operationOptions, {
19923
- tracingOptions: Object.assign(Object.assign({}, operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions), { tracingContext })
19924
- });
19925
- return {
19926
- span,
19927
- updatedOptions
19928
- };
19929
19904
  }
19930
- __name(startSpan, "startSpan");
19931
- async function withSpan(name, operationOptions, callback, spanOptions) {
19932
- const { span, updatedOptions } = startSpan(name, operationOptions, spanOptions);
19905
+ __name(verb, "verb");
19906
+ function resume(n, v) {
19933
19907
  try {
19934
- const result = await withContext(updatedOptions.tracingOptions.tracingContext, () => Promise.resolve(callback(updatedOptions, span)));
19935
- span.setStatus({ status: "success" });
19936
- return result;
19937
- } catch (err) {
19938
- span.setStatus({ status: "error", error: err });
19939
- throw err;
19940
- } finally {
19941
- span.end();
19908
+ step(g[n](v));
19909
+ } catch (e) {
19910
+ settle(q[0][3], e);
19942
19911
  }
19943
19912
  }
19944
- __name(withSpan, "withSpan");
19945
- function withContext(context2, callback, ...callbackArgs) {
19946
- return getInstrumenter().withContext(context2, callback, ...callbackArgs);
19913
+ __name(resume, "resume");
19914
+ function step(r) {
19915
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
19947
19916
  }
19948
- __name(withContext, "withContext");
19949
- function parseTraceparentHeader(traceparentHeader) {
19950
- return getInstrumenter().parseTraceparentHeader(traceparentHeader);
19917
+ __name(step, "step");
19918
+ function fulfill(value) {
19919
+ resume("next", value);
19951
19920
  }
19952
- __name(parseTraceparentHeader, "parseTraceparentHeader");
19953
- function createRequestHeaders(tracingContext) {
19954
- return getInstrumenter().createRequestHeaders(tracingContext);
19921
+ __name(fulfill, "fulfill");
19922
+ function reject(value) {
19923
+ resume("throw", value);
19955
19924
  }
19956
- __name(createRequestHeaders, "createRequestHeaders");
19957
- return {
19958
- startSpan,
19959
- withSpan,
19960
- withContext,
19961
- parseTraceparentHeader,
19962
- createRequestHeaders
19963
- };
19964
- }
19965
- __name(createTracingClient, "createTracingClient");
19966
-
19967
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/inspect.js
19968
- import { inspect } from "node:util";
19969
- var custom = inspect.custom;
19970
-
19971
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/restError.js
19972
- var errorSanitizer = new Sanitizer();
19973
- var _RestError = class _RestError extends Error {
19974
- constructor(message, options = {}) {
19975
- super(message);
19976
- this.name = "RestError";
19977
- this.code = options.code;
19978
- this.statusCode = options.statusCode;
19979
- Object.defineProperty(this, "request", { value: options.request, enumerable: false });
19980
- Object.defineProperty(this, "response", { value: options.response, enumerable: false });
19981
- Object.setPrototypeOf(this, _RestError.prototype);
19925
+ __name(reject, "reject");
19926
+ function settle(f, v) {
19927
+ if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
19982
19928
  }
19983
- /**
19984
- * Logging method for util.inspect in Node
19985
- */
19986
- [custom]() {
19987
- return `RestError: ${this.message}
19988
- ${errorSanitizer.sanitize(Object.assign(Object.assign({}, this), { request: this.request, response: this.response }))}`;
19929
+ __name(settle, "settle");
19930
+ }
19931
+ __name(__asyncGenerator, "__asyncGenerator");
19932
+ function __asyncValues(o) {
19933
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
19934
+ var m = o[Symbol.asyncIterator], i;
19935
+ return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
19936
+ return this;
19937
+ }, i);
19938
+ function verb(n) {
19939
+ i[n] = o[n] && function(v) {
19940
+ return new Promise(function(resolve, reject) {
19941
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
19942
+ });
19943
+ };
19989
19944
  }
19990
- };
19991
- __name(_RestError, "RestError");
19992
- var RestError = _RestError;
19993
- RestError.REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR";
19994
- RestError.PARSE_ERROR = "PARSE_ERROR";
19995
- function isRestError(e) {
19996
- if (e instanceof RestError) {
19997
- return true;
19945
+ __name(verb, "verb");
19946
+ function settle(resolve, reject, d, v) {
19947
+ Promise.resolve(v).then(function(v2) {
19948
+ resolve({ value: v2, done: d });
19949
+ }, reject);
19998
19950
  }
19999
- return isError(e) && e.name === "RestError";
19951
+ __name(settle, "settle");
20000
19952
  }
20001
- __name(isRestError, "isRestError");
19953
+ __name(__asyncValues, "__asyncValues");
20002
19954
 
20003
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/tracingPolicy.js
20004
- var tracingPolicyName = "tracingPolicy";
20005
- function tracingPolicy(options = {}) {
20006
- const userAgentPromise = getUserAgentValue(options.userAgentPrefix);
20007
- const sanitizer = new Sanitizer({
20008
- additionalAllowedQueryParameters: options.additionalAllowedQueryParameters
20009
- });
20010
- const tracingClient = tryCreateTracingClient();
20011
- return {
20012
- name: tracingPolicyName,
20013
- async sendRequest(request3, next) {
20014
- var _a3;
20015
- if (!tracingClient) {
20016
- return next(request3);
20017
- }
20018
- const userAgent = await userAgentPromise;
20019
- const spanAttributes = {
20020
- "http.url": sanitizer.sanitizeUrl(request3.url),
20021
- "http.method": request3.method,
20022
- "http.user_agent": userAgent,
20023
- requestId: request3.requestId
20024
- };
20025
- if (userAgent) {
20026
- spanAttributes["http.user_agent"] = userAgent;
20027
- }
20028
- const { span, tracingContext } = (_a3 = tryCreateSpan(tracingClient, request3, spanAttributes)) !== null && _a3 !== void 0 ? _a3 : {};
20029
- if (!span || !tracingContext) {
20030
- return next(request3);
20031
- }
20032
- try {
20033
- const response = await tracingClient.withContext(tracingContext, next, request3);
20034
- tryProcessResponse(span, response);
20035
- return response;
20036
- } catch (err) {
20037
- tryProcessError(span, err);
20038
- throw err;
19955
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/util/concat.js
19956
+ import { Readable } from "stream";
19957
+ function streamAsyncIterator() {
19958
+ return __asyncGenerator(this, arguments, /* @__PURE__ */ __name(function* streamAsyncIterator_1() {
19959
+ const reader = this.getReader();
19960
+ try {
19961
+ while (true) {
19962
+ const { done, value } = yield __await(reader.read());
19963
+ if (done) {
19964
+ return yield __await(void 0);
19965
+ }
19966
+ yield yield __await(value);
20039
19967
  }
19968
+ } finally {
19969
+ reader.releaseLock();
20040
19970
  }
20041
- };
19971
+ }, "streamAsyncIterator_1"));
20042
19972
  }
20043
- __name(tracingPolicy, "tracingPolicy");
20044
- function tryCreateTracingClient() {
20045
- try {
20046
- return createTracingClient({
20047
- namespace: "",
20048
- packageName: "@azure/core-rest-pipeline",
20049
- packageVersion: SDK_VERSION
20050
- });
20051
- } catch (e) {
20052
- logger.warning(`Error when creating the TracingClient: ${getErrorMessage(e)}`);
20053
- return void 0;
19973
+ __name(streamAsyncIterator, "streamAsyncIterator");
19974
+ function makeAsyncIterable(webStream) {
19975
+ if (!webStream[Symbol.asyncIterator]) {
19976
+ webStream[Symbol.asyncIterator] = streamAsyncIterator.bind(webStream);
19977
+ }
19978
+ if (!webStream.values) {
19979
+ webStream.values = streamAsyncIterator.bind(webStream);
20054
19980
  }
20055
19981
  }
20056
- __name(tryCreateTracingClient, "tryCreateTracingClient");
20057
- function tryCreateSpan(tracingClient, request3, spanAttributes) {
20058
- try {
20059
- const { span, updatedOptions } = tracingClient.startSpan(`HTTP ${request3.method}`, { tracingOptions: request3.tracingOptions }, {
20060
- spanKind: "client",
20061
- spanAttributes
20062
- });
20063
- if (!span.isRecording()) {
20064
- span.end();
20065
- return void 0;
20066
- }
20067
- const headers = tracingClient.createRequestHeaders(updatedOptions.tracingOptions.tracingContext);
20068
- for (const [key, value] of Object.entries(headers)) {
20069
- request3.headers.set(key, value);
20070
- }
20071
- return { span, tracingContext: updatedOptions.tracingOptions.tracingContext };
20072
- } catch (e) {
20073
- logger.warning(`Skipping creating a tracing span due to an error: ${getErrorMessage(e)}`);
20074
- return void 0;
19982
+ __name(makeAsyncIterable, "makeAsyncIterable");
19983
+ function ensureNodeStream(stream) {
19984
+ if (stream instanceof ReadableStream) {
19985
+ makeAsyncIterable(stream);
19986
+ return Readable.fromWeb(stream);
19987
+ } else {
19988
+ return stream;
20075
19989
  }
20076
19990
  }
20077
- __name(tryCreateSpan, "tryCreateSpan");
20078
- function tryProcessError(span, error) {
20079
- try {
20080
- span.setStatus({
20081
- status: "error",
20082
- error: isError(error) ? error : void 0
20083
- });
20084
- if (isRestError(error) && error.statusCode) {
20085
- span.setAttribute("http.status_code", error.statusCode);
20086
- }
20087
- span.end();
20088
- } catch (e) {
20089
- logger.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`);
19991
+ __name(ensureNodeStream, "ensureNodeStream");
19992
+ function toStream(source) {
19993
+ if (source instanceof Uint8Array) {
19994
+ return Readable.from(Buffer.from(source));
19995
+ } else if (isBlob(source)) {
19996
+ return ensureNodeStream(source.stream());
19997
+ } else {
19998
+ return ensureNodeStream(source);
20090
19999
  }
20091
20000
  }
20092
- __name(tryProcessError, "tryProcessError");
20093
- function tryProcessResponse(span, response) {
20094
- try {
20095
- span.setAttribute("http.status_code", response.status);
20096
- const serviceRequestId = response.headers.get("x-ms-request-id");
20097
- if (serviceRequestId) {
20098
- span.setAttribute("serviceRequestId", serviceRequestId);
20099
- }
20100
- if (response.status >= 400) {
20101
- span.setStatus({
20102
- status: "error"
20001
+ __name(toStream, "toStream");
20002
+ async function concat(sources) {
20003
+ return function() {
20004
+ const streams = sources.map((x) => typeof x === "function" ? x() : x).map(toStream);
20005
+ return Readable.from(function() {
20006
+ return __asyncGenerator(this, arguments, function* () {
20007
+ var _a3, e_1, _b2, _c2;
20008
+ for (const stream of streams) {
20009
+ try {
20010
+ for (var _d2 = true, stream_1 = (e_1 = void 0, __asyncValues(stream)), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a3 = stream_1_1.done, !_a3; _d2 = true) {
20011
+ _c2 = stream_1_1.value;
20012
+ _d2 = false;
20013
+ const chunk = _c2;
20014
+ yield yield __await(chunk);
20015
+ }
20016
+ } catch (e_1_1) {
20017
+ e_1 = { error: e_1_1 };
20018
+ } finally {
20019
+ try {
20020
+ if (!_d2 && !_a3 && (_b2 = stream_1.return)) yield __await(_b2.call(stream_1));
20021
+ } finally {
20022
+ if (e_1) throw e_1.error;
20023
+ }
20024
+ }
20025
+ }
20103
20026
  });
20104
- }
20105
- span.end();
20106
- } catch (e) {
20107
- logger.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`);
20108
- }
20027
+ }());
20028
+ };
20109
20029
  }
20110
- __name(tryProcessResponse, "tryProcessResponse");
20030
+ __name(concat, "concat");
20111
20031
 
20112
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/createPipelineFromOptions.js
20113
- function createPipelineFromOptions(options) {
20114
- var _a3;
20115
- const pipeline = createEmptyPipeline();
20116
- if (isNodeLike) {
20117
- if (options.agent) {
20118
- pipeline.addPolicy(agentPolicy(options.agent));
20119
- }
20120
- if (options.tlsOptions) {
20121
- pipeline.addPolicy(tlsPolicy(options.tlsOptions));
20122
- }
20123
- pipeline.addPolicy(proxyPolicy(options.proxyOptions));
20124
- pipeline.addPolicy(decompressResponsePolicy());
20125
- }
20126
- pipeline.addPolicy(formDataPolicy(), { beforePolicies: [multipartPolicyName] });
20127
- pipeline.addPolicy(userAgentPolicy(options.userAgentOptions));
20128
- pipeline.addPolicy(setClientRequestIdPolicy((_a3 = options.telemetryOptions) === null || _a3 === void 0 ? void 0 : _a3.clientRequestIdHeaderName));
20129
- pipeline.addPolicy(multipartPolicy(), { afterPhase: "Deserialize" });
20130
- pipeline.addPolicy(defaultRetryPolicy(options.retryOptions), { phase: "Retry" });
20131
- pipeline.addPolicy(tracingPolicy(Object.assign(Object.assign({}, options.userAgentOptions), options.loggingOptions)), {
20132
- afterPhase: "Retry"
20133
- });
20134
- if (isNodeLike) {
20135
- pipeline.addPolicy(redirectPolicy(options.redirectOptions), { afterPhase: "Retry" });
20032
+ // ../../node_modules/.store/@typespec-ts-http-runtime-npm-0.2.3-47d5e20163/package/dist/esm/policies/multipartPolicy.js
20033
+ function generateBoundary() {
20034
+ return `----AzSDKFormBoundary${randomUUID()}`;
20035
+ }
20036
+ __name(generateBoundary, "generateBoundary");
20037
+ function encodeHeaders(headers) {
20038
+ let result = "";
20039
+ for (const [key, value] of headers) {
20040
+ result += `${key}: ${value}\r
20041
+ `;
20136
20042
  }
20137
- pipeline.addPolicy(logPolicy(options.loggingOptions), { afterPhase: "Sign" });
20138
- return pipeline;
20043
+ return result;
20139
20044
  }
20140
- __name(createPipelineFromOptions, "createPipelineFromOptions");
20141
-
20142
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/nodeHttpClient.js
20143
- import * as http from "node:http";
20144
- import * as https from "node:https";
20145
- import * as zlib from "node:zlib";
20146
- import { Transform } from "node:stream";
20147
- var DEFAULT_TLS_SETTINGS = {};
20148
- function isReadableStream(body2) {
20149
- return body2 && typeof body2.pipe === "function";
20150
- }
20151
- __name(isReadableStream, "isReadableStream");
20152
- function isStreamComplete(stream) {
20153
- if (stream.readable === false) {
20154
- return Promise.resolve();
20045
+ __name(encodeHeaders, "encodeHeaders");
20046
+ function getLength(source) {
20047
+ if (source instanceof Uint8Array) {
20048
+ return source.byteLength;
20049
+ } else if (isBlob(source)) {
20050
+ return source.size === -1 ? void 0 : source.size;
20051
+ } else {
20052
+ return void 0;
20155
20053
  }
20156
- return new Promise((resolve) => {
20157
- const handler = /* @__PURE__ */ __name(() => {
20158
- resolve();
20159
- stream.removeListener("close", handler);
20160
- stream.removeListener("end", handler);
20161
- stream.removeListener("error", handler);
20162
- }, "handler");
20163
- stream.on("close", handler);
20164
- stream.on("end", handler);
20165
- stream.on("error", handler);
20166
- });
20167
- }
20168
- __name(isStreamComplete, "isStreamComplete");
20169
- function isArrayBuffer(body2) {
20170
- return body2 && typeof body2.byteLength === "number";
20171
20054
  }
20172
- __name(isArrayBuffer, "isArrayBuffer");
20173
- var _ReportTransform = class _ReportTransform extends Transform {
20174
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
20175
- _transform(chunk, _encoding, callback) {
20176
- this.push(chunk);
20177
- this.loadedBytes += chunk.length;
20178
- try {
20179
- this.progressCallback({ loadedBytes: this.loadedBytes });
20180
- callback();
20181
- } catch (e) {
20182
- callback(e);
20055
+ __name(getLength, "getLength");
20056
+ function getTotalLength(sources) {
20057
+ let total = 0;
20058
+ for (const source of sources) {
20059
+ const partLength = getLength(source);
20060
+ if (partLength === void 0) {
20061
+ return void 0;
20062
+ } else {
20063
+ total += partLength;
20183
20064
  }
20184
20065
  }
20185
- constructor(progressCallback) {
20186
- super();
20187
- this.loadedBytes = 0;
20188
- this.progressCallback = progressCallback;
20066
+ return total;
20067
+ }
20068
+ __name(getTotalLength, "getTotalLength");
20069
+ async function buildRequestBody(request3, parts, boundary) {
20070
+ const sources = [
20071
+ stringToUint8Array(`--${boundary}`, "utf-8"),
20072
+ ...parts.flatMap((part) => [
20073
+ stringToUint8Array("\r\n", "utf-8"),
20074
+ stringToUint8Array(encodeHeaders(part.headers), "utf-8"),
20075
+ stringToUint8Array("\r\n", "utf-8"),
20076
+ part.body,
20077
+ stringToUint8Array(`\r
20078
+ --${boundary}`, "utf-8")
20079
+ ]),
20080
+ stringToUint8Array("--\r\n\r\n", "utf-8")
20081
+ ];
20082
+ const contentLength = getTotalLength(sources);
20083
+ if (contentLength) {
20084
+ request3.headers.set("Content-Length", contentLength);
20189
20085
  }
20190
- };
20191
- __name(_ReportTransform, "ReportTransform");
20192
- var ReportTransform = _ReportTransform;
20193
- var _NodeHttpClient = class _NodeHttpClient {
20194
- constructor() {
20195
- this.cachedHttpsAgents = /* @__PURE__ */ new WeakMap();
20086
+ request3.body = await concat(sources);
20087
+ }
20088
+ __name(buildRequestBody, "buildRequestBody");
20089
+ var multipartPolicyName = "multipartPolicy";
20090
+ var maxBoundaryLength = 70;
20091
+ var validBoundaryCharacters = new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`);
20092
+ function assertValidBoundary(boundary) {
20093
+ if (boundary.length > maxBoundaryLength) {
20094
+ throw new Error(`Multipart boundary "${boundary}" exceeds maximum length of 70 characters`);
20196
20095
  }
20197
- /**
20198
- * Makes a request over an underlying transport layer and returns the response.
20199
- * @param request - The request to be made.
20200
- */
20201
- async sendRequest(request3) {
20202
- var _a3, _b2, _c2;
20203
- const abortController = new AbortController();
20204
- let abortListener;
20205
- if (request3.abortSignal) {
20206
- if (request3.abortSignal.aborted) {
20207
- throw new AbortError("The operation was aborted. Request has already been canceled.");
20096
+ if (Array.from(boundary).some((x) => !validBoundaryCharacters.has(x))) {
20097
+ throw new Error(`Multipart boundary "${boundary}" contains invalid characters`);
20098
+ }
20099
+ }
20100
+ __name(assertValidBoundary, "assertValidBoundary");
20101
+ function multipartPolicy() {
20102
+ return {
20103
+ name: multipartPolicyName,
20104
+ async sendRequest(request3, next) {
20105
+ var _a3;
20106
+ if (!request3.multipartBody) {
20107
+ return next(request3);
20208
20108
  }
20209
- abortListener = /* @__PURE__ */ __name((event) => {
20210
- if (event.type === "abort") {
20211
- abortController.abort();
20212
- }
20213
- }, "abortListener");
20214
- request3.abortSignal.addEventListener("abort", abortListener);
20215
- }
20216
- let timeoutId;
20217
- if (request3.timeout > 0) {
20218
- timeoutId = setTimeout(() => {
20219
- const sanitizer = new Sanitizer();
20220
- logger.info(`request to '${sanitizer.sanitizeUrl(request3.url)}' timed out. canceling...`);
20221
- abortController.abort();
20222
- }, request3.timeout);
20223
- }
20224
- const acceptEncoding = request3.headers.get("Accept-Encoding");
20225
- const shouldDecompress = (acceptEncoding === null || acceptEncoding === void 0 ? void 0 : acceptEncoding.includes("gzip")) || (acceptEncoding === null || acceptEncoding === void 0 ? void 0 : acceptEncoding.includes("deflate"));
20226
- let body2 = typeof request3.body === "function" ? request3.body() : request3.body;
20227
- if (body2 && !request3.headers.has("Content-Length")) {
20228
- const bodyLength = getBodyLength(body2);
20229
- if (bodyLength !== null) {
20230
- request3.headers.set("Content-Length", bodyLength);
20109
+ if (request3.body) {
20110
+ throw new Error("multipartBody and regular body cannot be set at the same time");
20231
20111
  }
20232
- }
20233
- let responseStream;
20234
- try {
20235
- if (body2 && request3.onUploadProgress) {
20236
- const onUploadProgress = request3.onUploadProgress;
20237
- const uploadReportStream = new ReportTransform(onUploadProgress);
20238
- uploadReportStream.on("error", (e) => {
20239
- logger.error("Error in upload progress", e);
20240
- });
20241
- if (isReadableStream(body2)) {
20242
- body2.pipe(uploadReportStream);
20243
- } else {
20244
- uploadReportStream.end(body2);
20245
- }
20246
- body2 = uploadReportStream;
20112
+ let boundary = request3.multipartBody.boundary;
20113
+ const contentTypeHeader = (_a3 = request3.headers.get("Content-Type")) !== null && _a3 !== void 0 ? _a3 : "multipart/mixed";
20114
+ const parsedHeader = contentTypeHeader.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/);
20115
+ if (!parsedHeader) {
20116
+ throw new Error(`Got multipart request body, but content-type header was not multipart: ${contentTypeHeader}`);
20247
20117
  }
20248
- const res = await this.makeRequest(request3, abortController, body2);
20249
- if (timeoutId !== void 0) {
20250
- clearTimeout(timeoutId);
20118
+ const [, contentType2, parsedBoundary] = parsedHeader;
20119
+ if (parsedBoundary && boundary && parsedBoundary !== boundary) {
20120
+ throw new Error(`Multipart boundary was specified as ${parsedBoundary} in the header, but got ${boundary} in the request body`);
20251
20121
  }
20252
- const headers = getResponseHeaders(res);
20253
- const status = (_a3 = res.statusCode) !== null && _a3 !== void 0 ? _a3 : 0;
20254
- const response = {
20255
- status,
20256
- headers,
20257
- request: request3
20258
- };
20259
- if (request3.method === "HEAD") {
20260
- res.resume();
20261
- return response;
20122
+ boundary !== null && boundary !== void 0 ? boundary : boundary = parsedBoundary;
20123
+ if (boundary) {
20124
+ assertValidBoundary(boundary);
20125
+ } else {
20126
+ boundary = generateBoundary();
20262
20127
  }
20263
- responseStream = shouldDecompress ? getDecodedResponseStream(res, headers) : res;
20264
- const onDownloadProgress = request3.onDownloadProgress;
20265
- if (onDownloadProgress) {
20266
- const downloadReportStream = new ReportTransform(onDownloadProgress);
20267
- downloadReportStream.on("error", (e) => {
20268
- logger.error("Error in download progress", e);
20269
- });
20270
- responseStream.pipe(downloadReportStream);
20271
- responseStream = downloadReportStream;
20128
+ request3.headers.set("Content-Type", `${contentType2}; boundary=${boundary}`);
20129
+ await buildRequestBody(request3, request3.multipartBody.parts, boundary);
20130
+ request3.multipartBody = void 0;
20131
+ return next(request3);
20132
+ }
20133
+ };
20134
+ }
20135
+ __name(multipartPolicy, "multipartPolicy");
20136
+
20137
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/pipeline.js
20138
+ function createEmptyPipeline2() {
20139
+ return createEmptyPipeline();
20140
+ }
20141
+ __name(createEmptyPipeline2, "createEmptyPipeline");
20142
+
20143
+ // ../../node_modules/.store/@azure-logger-npm-1.2.0-25a03e63ed/package/dist/esm/index.js
20144
+ var context3 = createLoggerContext({
20145
+ logLevelEnvVarName: "AZURE_LOG_LEVEL",
20146
+ namespace: "azure"
20147
+ });
20148
+ var AzureLogger = context3.logger;
20149
+ function createClientLogger2(namespace) {
20150
+ return context3.createClientLogger(namespace);
20151
+ }
20152
+ __name(createClientLogger2, "createClientLogger");
20153
+
20154
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/log.js
20155
+ var logger2 = createClientLogger2("core-rest-pipeline");
20156
+
20157
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/logPolicy.js
20158
+ function logPolicy2(options = {}) {
20159
+ return logPolicy(Object.assign({ logger: logger2.info }, options));
20160
+ }
20161
+ __name(logPolicy2, "logPolicy");
20162
+
20163
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/redirectPolicy.js
20164
+ var redirectPolicyName2 = redirectPolicyName;
20165
+ function redirectPolicy2(options = {}) {
20166
+ return redirectPolicy(options);
20167
+ }
20168
+ __name(redirectPolicy2, "redirectPolicy");
20169
+
20170
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/util/userAgentPlatform.js
20171
+ import * as os from "node:os";
20172
+ import * as process4 from "node:process";
20173
+ function getHeaderName2() {
20174
+ return "User-Agent";
20175
+ }
20176
+ __name(getHeaderName2, "getHeaderName");
20177
+ async function setPlatformSpecificData2(map) {
20178
+ if (process4 && process4.versions) {
20179
+ const versions2 = process4.versions;
20180
+ if (versions2.bun) {
20181
+ map.set("Bun", versions2.bun);
20182
+ } else if (versions2.deno) {
20183
+ map.set("Deno", versions2.deno);
20184
+ } else if (versions2.node) {
20185
+ map.set("Node", versions2.node);
20186
+ }
20187
+ }
20188
+ map.set("OS", `(${os.arch()}-${os.type()}-${os.release()})`);
20189
+ }
20190
+ __name(setPlatformSpecificData2, "setPlatformSpecificData");
20191
+
20192
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/constants.js
20193
+ var SDK_VERSION2 = "1.21.0";
20194
+
20195
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/util/userAgent.js
20196
+ function getUserAgentString(telemetryInfo) {
20197
+ const parts = [];
20198
+ for (const [key, value] of telemetryInfo) {
20199
+ const token = value ? `${key}/${value}` : key;
20200
+ parts.push(token);
20201
+ }
20202
+ return parts.join(" ");
20203
+ }
20204
+ __name(getUserAgentString, "getUserAgentString");
20205
+ function getUserAgentHeaderName2() {
20206
+ return getHeaderName2();
20207
+ }
20208
+ __name(getUserAgentHeaderName2, "getUserAgentHeaderName");
20209
+ async function getUserAgentValue2(prefix) {
20210
+ const runtimeInfo = /* @__PURE__ */ new Map();
20211
+ runtimeInfo.set("core-rest-pipeline", SDK_VERSION2);
20212
+ await setPlatformSpecificData2(runtimeInfo);
20213
+ const defaultAgent = getUserAgentString(runtimeInfo);
20214
+ const userAgentValue = prefix ? `${prefix} ${defaultAgent}` : defaultAgent;
20215
+ return userAgentValue;
20216
+ }
20217
+ __name(getUserAgentValue2, "getUserAgentValue");
20218
+
20219
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/userAgentPolicy.js
20220
+ var UserAgentHeaderName2 = getUserAgentHeaderName2();
20221
+ var userAgentPolicyName2 = "userAgentPolicy";
20222
+ function userAgentPolicy2(options = {}) {
20223
+ const userAgentValue = getUserAgentValue2(options.userAgentPrefix);
20224
+ return {
20225
+ name: userAgentPolicyName2,
20226
+ async sendRequest(request3, next) {
20227
+ if (!request3.headers.has(UserAgentHeaderName2)) {
20228
+ request3.headers.set(UserAgentHeaderName2, await userAgentValue);
20272
20229
  }
20273
- if (
20274
- // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code
20275
- ((_b2 = request3.streamResponseStatusCodes) === null || _b2 === void 0 ? void 0 : _b2.has(Number.POSITIVE_INFINITY)) || ((_c2 = request3.streamResponseStatusCodes) === null || _c2 === void 0 ? void 0 : _c2.has(response.status))
20276
- ) {
20277
- response.readableStreamBody = responseStream;
20230
+ return next(request3);
20231
+ }
20232
+ };
20233
+ }
20234
+ __name(userAgentPolicy2, "userAgentPolicy");
20235
+
20236
+ // ../../node_modules/.store/@azure-abort-controller-npm-2.1.2-a36d73ebb9/package/dist/esm/AbortError.js
20237
+ var _AbortError2 = class _AbortError2 extends Error {
20238
+ constructor(message) {
20239
+ super(message);
20240
+ this.name = "AbortError";
20241
+ }
20242
+ };
20243
+ __name(_AbortError2, "AbortError");
20244
+ var AbortError2 = _AbortError2;
20245
+
20246
+ // ../../node_modules/.store/@azure-core-util-npm-1.12.0-967d7aa602/package/dist/esm/createAbortablePromise.js
20247
+ function createAbortablePromise(buildPromise, options) {
20248
+ const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options !== null && options !== void 0 ? options : {};
20249
+ return new Promise((resolve, reject) => {
20250
+ function rejectOnAbort() {
20251
+ reject(new AbortError2(abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : "The operation was aborted."));
20252
+ }
20253
+ __name(rejectOnAbort, "rejectOnAbort");
20254
+ function removeListeners() {
20255
+ abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener("abort", onAbort);
20256
+ }
20257
+ __name(removeListeners, "removeListeners");
20258
+ function onAbort() {
20259
+ cleanupBeforeAbort === null || cleanupBeforeAbort === void 0 ? void 0 : cleanupBeforeAbort();
20260
+ removeListeners();
20261
+ rejectOnAbort();
20262
+ }
20263
+ __name(onAbort, "onAbort");
20264
+ if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
20265
+ return rejectOnAbort();
20266
+ }
20267
+ try {
20268
+ buildPromise((x) => {
20269
+ removeListeners();
20270
+ resolve(x);
20271
+ }, (x) => {
20272
+ removeListeners();
20273
+ reject(x);
20274
+ });
20275
+ } catch (err) {
20276
+ reject(err);
20277
+ }
20278
+ abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener("abort", onAbort);
20279
+ });
20280
+ }
20281
+ __name(createAbortablePromise, "createAbortablePromise");
20282
+
20283
+ // ../../node_modules/.store/@azure-core-util-npm-1.12.0-967d7aa602/package/dist/esm/delay.js
20284
+ var StandardAbortMessage2 = "The delay was aborted.";
20285
+ function delay2(timeInMs, options) {
20286
+ let token;
20287
+ const { abortSignal, abortErrorMsg } = options !== null && options !== void 0 ? options : {};
20288
+ return createAbortablePromise((resolve) => {
20289
+ token = setTimeout(resolve, timeInMs);
20290
+ }, {
20291
+ cleanupBeforeAbort: /* @__PURE__ */ __name(() => clearTimeout(token), "cleanupBeforeAbort"),
20292
+ abortSignal,
20293
+ abortErrorMsg: abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : StandardAbortMessage2
20294
+ });
20295
+ }
20296
+ __name(delay2, "delay");
20297
+
20298
+ // ../../node_modules/.store/@azure-core-util-npm-1.12.0-967d7aa602/package/dist/esm/error.js
20299
+ function getErrorMessage(e) {
20300
+ if (isError(e)) {
20301
+ return e.message;
20302
+ } else {
20303
+ let stringified;
20304
+ try {
20305
+ if (typeof e === "object" && e) {
20306
+ stringified = JSON.stringify(e);
20278
20307
  } else {
20279
- response.bodyAsText = await streamToText(responseStream);
20308
+ stringified = String(e);
20280
20309
  }
20281
- return response;
20282
- } finally {
20283
- if (request3.abortSignal && abortListener) {
20284
- let uploadStreamDone = Promise.resolve();
20285
- if (isReadableStream(body2)) {
20286
- uploadStreamDone = isStreamComplete(body2);
20287
- }
20288
- let downloadStreamDone = Promise.resolve();
20289
- if (isReadableStream(responseStream)) {
20290
- downloadStreamDone = isStreamComplete(responseStream);
20291
- }
20292
- Promise.all([uploadStreamDone, downloadStreamDone]).then(() => {
20293
- var _a4;
20294
- if (abortListener) {
20295
- (_a4 = request3.abortSignal) === null || _a4 === void 0 ? void 0 : _a4.removeEventListener("abort", abortListener);
20310
+ } catch (err) {
20311
+ stringified = "[unable to stringify input]";
20312
+ }
20313
+ return `Unknown error ${stringified}`;
20314
+ }
20315
+ }
20316
+ __name(getErrorMessage, "getErrorMessage");
20317
+
20318
+ // ../../node_modules/.store/@azure-core-util-npm-1.12.0-967d7aa602/package/dist/esm/index.js
20319
+ function isError2(e) {
20320
+ return isError(e);
20321
+ }
20322
+ __name(isError2, "isError");
20323
+ var isNodeLike2 = isNodeLike;
20324
+
20325
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/util/file.js
20326
+ var rawContent = Symbol("rawContent");
20327
+ function hasRawContent(x) {
20328
+ return typeof x[rawContent] === "function";
20329
+ }
20330
+ __name(hasRawContent, "hasRawContent");
20331
+ function getRawContent(blob) {
20332
+ if (hasRawContent(blob)) {
20333
+ return blob[rawContent]();
20334
+ } else {
20335
+ return blob;
20336
+ }
20337
+ }
20338
+ __name(getRawContent, "getRawContent");
20339
+
20340
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/multipartPolicy.js
20341
+ var multipartPolicyName2 = multipartPolicyName;
20342
+ function multipartPolicy2() {
20343
+ const tspPolicy = multipartPolicy();
20344
+ return {
20345
+ name: multipartPolicyName2,
20346
+ sendRequest: /* @__PURE__ */ __name(async (request3, next) => {
20347
+ if (request3.multipartBody) {
20348
+ for (const part of request3.multipartBody.parts) {
20349
+ if (hasRawContent(part.body)) {
20350
+ part.body = getRawContent(part.body);
20296
20351
  }
20297
- }).catch((e) => {
20298
- logger.warning("Error when cleaning up abortListener on httpRequest", e);
20299
- });
20352
+ }
20353
+ }
20354
+ return tspPolicy.sendRequest(request3, next);
20355
+ }, "sendRequest")
20356
+ };
20357
+ }
20358
+ __name(multipartPolicy2, "multipartPolicy");
20359
+
20360
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/decompressResponsePolicy.js
20361
+ function decompressResponsePolicy2() {
20362
+ return decompressResponsePolicy();
20363
+ }
20364
+ __name(decompressResponsePolicy2, "decompressResponsePolicy");
20365
+
20366
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/defaultRetryPolicy.js
20367
+ function defaultRetryPolicy2(options = {}) {
20368
+ return defaultRetryPolicy(options);
20369
+ }
20370
+ __name(defaultRetryPolicy2, "defaultRetryPolicy");
20371
+
20372
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/formDataPolicy.js
20373
+ function formDataPolicy2() {
20374
+ return formDataPolicy();
20375
+ }
20376
+ __name(formDataPolicy2, "formDataPolicy");
20377
+
20378
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/proxyPolicy.js
20379
+ function proxyPolicy2(proxySettings, options) {
20380
+ return proxyPolicy(proxySettings, options);
20381
+ }
20382
+ __name(proxyPolicy2, "proxyPolicy");
20383
+
20384
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/setClientRequestIdPolicy.js
20385
+ var setClientRequestIdPolicyName = "setClientRequestIdPolicy";
20386
+ function setClientRequestIdPolicy(requestIdHeaderName = "x-ms-client-request-id") {
20387
+ return {
20388
+ name: setClientRequestIdPolicyName,
20389
+ async sendRequest(request3, next) {
20390
+ if (!request3.headers.has(requestIdHeaderName)) {
20391
+ request3.headers.set(requestIdHeaderName, request3.requestId);
20300
20392
  }
20393
+ return next(request3);
20301
20394
  }
20395
+ };
20396
+ }
20397
+ __name(setClientRequestIdPolicy, "setClientRequestIdPolicy");
20398
+
20399
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/agentPolicy.js
20400
+ function agentPolicy2(agent) {
20401
+ return agentPolicy(agent);
20402
+ }
20403
+ __name(agentPolicy2, "agentPolicy");
20404
+
20405
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/tlsPolicy.js
20406
+ function tlsPolicy2(tlsSettings) {
20407
+ return tlsPolicy(tlsSettings);
20408
+ }
20409
+ __name(tlsPolicy2, "tlsPolicy");
20410
+
20411
+ // ../../node_modules/.store/@azure-core-tracing-npm-1.2.0-cae64582fc/package/dist/esm/tracingContext.js
20412
+ var knownContextKeys = {
20413
+ span: Symbol.for("@azure/core-tracing span"),
20414
+ namespace: Symbol.for("@azure/core-tracing namespace")
20415
+ };
20416
+ function createTracingContext(options = {}) {
20417
+ let context4 = new TracingContextImpl(options.parentContext);
20418
+ if (options.span) {
20419
+ context4 = context4.setValue(knownContextKeys.span, options.span);
20302
20420
  }
20303
- makeRequest(request3, abortController, body2) {
20421
+ if (options.namespace) {
20422
+ context4 = context4.setValue(knownContextKeys.namespace, options.namespace);
20423
+ }
20424
+ return context4;
20425
+ }
20426
+ __name(createTracingContext, "createTracingContext");
20427
+ var _TracingContextImpl = class _TracingContextImpl {
20428
+ constructor(initialContext) {
20429
+ this._contextMap = initialContext instanceof _TracingContextImpl ? new Map(initialContext._contextMap) : /* @__PURE__ */ new Map();
20430
+ }
20431
+ setValue(key, value) {
20432
+ const newContext = new _TracingContextImpl(this);
20433
+ newContext._contextMap.set(key, value);
20434
+ return newContext;
20435
+ }
20436
+ getValue(key) {
20437
+ return this._contextMap.get(key);
20438
+ }
20439
+ deleteValue(key) {
20440
+ const newContext = new _TracingContextImpl(this);
20441
+ newContext._contextMap.delete(key);
20442
+ return newContext;
20443
+ }
20444
+ };
20445
+ __name(_TracingContextImpl, "TracingContextImpl");
20446
+ var TracingContextImpl = _TracingContextImpl;
20447
+
20448
+ // ../../node_modules/.store/@azure-core-tracing-npm-1.2.0-cae64582fc/package/dist/esm/state.js
20449
+ var import_state = __toESM(require_state(), 1);
20450
+ var state = import_state.state;
20451
+
20452
+ // ../../node_modules/.store/@azure-core-tracing-npm-1.2.0-cae64582fc/package/dist/esm/instrumenter.js
20453
+ function createDefaultTracingSpan() {
20454
+ return {
20455
+ end: /* @__PURE__ */ __name(() => {
20456
+ }, "end"),
20457
+ isRecording: /* @__PURE__ */ __name(() => false, "isRecording"),
20458
+ recordException: /* @__PURE__ */ __name(() => {
20459
+ }, "recordException"),
20460
+ setAttribute: /* @__PURE__ */ __name(() => {
20461
+ }, "setAttribute"),
20462
+ setStatus: /* @__PURE__ */ __name(() => {
20463
+ }, "setStatus"),
20464
+ addEvent: /* @__PURE__ */ __name(() => {
20465
+ }, "addEvent")
20466
+ };
20467
+ }
20468
+ __name(createDefaultTracingSpan, "createDefaultTracingSpan");
20469
+ function createDefaultInstrumenter() {
20470
+ return {
20471
+ createRequestHeaders: /* @__PURE__ */ __name(() => {
20472
+ return {};
20473
+ }, "createRequestHeaders"),
20474
+ parseTraceparentHeader: /* @__PURE__ */ __name(() => {
20475
+ return void 0;
20476
+ }, "parseTraceparentHeader"),
20477
+ startSpan: /* @__PURE__ */ __name((_name, spanOptions) => {
20478
+ return {
20479
+ span: createDefaultTracingSpan(),
20480
+ tracingContext: createTracingContext({ parentContext: spanOptions.tracingContext })
20481
+ };
20482
+ }, "startSpan"),
20483
+ withContext(_context, callback, ...callbackArgs) {
20484
+ return callback(...callbackArgs);
20485
+ }
20486
+ };
20487
+ }
20488
+ __name(createDefaultInstrumenter, "createDefaultInstrumenter");
20489
+ function getInstrumenter() {
20490
+ if (!state.instrumenterImplementation) {
20491
+ state.instrumenterImplementation = createDefaultInstrumenter();
20492
+ }
20493
+ return state.instrumenterImplementation;
20494
+ }
20495
+ __name(getInstrumenter, "getInstrumenter");
20496
+
20497
+ // ../../node_modules/.store/@azure-core-tracing-npm-1.2.0-cae64582fc/package/dist/esm/tracingClient.js
20498
+ function createTracingClient(options) {
20499
+ const { namespace, packageName, packageVersion: packageVersion2 } = options;
20500
+ function startSpan(name, operationOptions, spanOptions) {
20304
20501
  var _a3;
20305
- const url2 = new URL(request3.url);
20306
- const isInsecure = url2.protocol !== "https:";
20307
- if (isInsecure && !request3.allowInsecureConnection) {
20308
- throw new Error(`Cannot connect to ${request3.url} while allowInsecureConnection is false.`);
20502
+ const startSpanResult = getInstrumenter().startSpan(name, Object.assign(Object.assign({}, spanOptions), { packageName, packageVersion: packageVersion2, tracingContext: (_a3 = operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions) === null || _a3 === void 0 ? void 0 : _a3.tracingContext }));
20503
+ let tracingContext = startSpanResult.tracingContext;
20504
+ const span = startSpanResult.span;
20505
+ if (!tracingContext.getValue(knownContextKeys.namespace)) {
20506
+ tracingContext = tracingContext.setValue(knownContextKeys.namespace, namespace);
20309
20507
  }
20310
- const agent = (_a3 = request3.agent) !== null && _a3 !== void 0 ? _a3 : this.getOrCreateAgent(request3, isInsecure);
20311
- const options = {
20312
- agent,
20313
- hostname: url2.hostname,
20314
- path: `${url2.pathname}${url2.search}`,
20315
- port: url2.port,
20316
- method: request3.method,
20317
- headers: request3.headers.toJSON({ preserveCase: true })
20318
- };
20319
- return new Promise((resolve, reject) => {
20320
- const req = isInsecure ? http.request(options, resolve) : https.request(options, resolve);
20321
- req.once("error", (err) => {
20322
- var _a4;
20323
- reject(new RestError(err.message, { code: (_a4 = err.code) !== null && _a4 !== void 0 ? _a4 : RestError.REQUEST_SEND_ERROR, request: request3 }));
20324
- });
20325
- abortController.signal.addEventListener("abort", () => {
20326
- const abortError = new AbortError("The operation was aborted. Rejecting from abort signal callback while making request.");
20327
- req.destroy(abortError);
20328
- reject(abortError);
20329
- });
20330
- if (body2 && isReadableStream(body2)) {
20331
- body2.pipe(req);
20332
- } else if (body2) {
20333
- if (typeof body2 === "string" || Buffer.isBuffer(body2)) {
20334
- req.end(body2);
20335
- } else if (isArrayBuffer(body2)) {
20336
- req.end(ArrayBuffer.isView(body2) ? Buffer.from(body2.buffer) : Buffer.from(body2));
20337
- } else {
20338
- logger.error("Unrecognized body type", body2);
20339
- reject(new RestError("Unrecognized body type"));
20340
- }
20341
- } else {
20342
- req.end();
20343
- }
20508
+ span.setAttribute("az.namespace", tracingContext.getValue(knownContextKeys.namespace));
20509
+ const updatedOptions = Object.assign({}, operationOptions, {
20510
+ tracingOptions: Object.assign(Object.assign({}, operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions), { tracingContext })
20344
20511
  });
20512
+ return {
20513
+ span,
20514
+ updatedOptions
20515
+ };
20516
+ }
20517
+ __name(startSpan, "startSpan");
20518
+ async function withSpan(name, operationOptions, callback, spanOptions) {
20519
+ const { span, updatedOptions } = startSpan(name, operationOptions, spanOptions);
20520
+ try {
20521
+ const result = await withContext(updatedOptions.tracingOptions.tracingContext, () => Promise.resolve(callback(updatedOptions, span)));
20522
+ span.setStatus({ status: "success" });
20523
+ return result;
20524
+ } catch (err) {
20525
+ span.setStatus({ status: "error", error: err });
20526
+ throw err;
20527
+ } finally {
20528
+ span.end();
20529
+ }
20530
+ }
20531
+ __name(withSpan, "withSpan");
20532
+ function withContext(context4, callback, ...callbackArgs) {
20533
+ return getInstrumenter().withContext(context4, callback, ...callbackArgs);
20534
+ }
20535
+ __name(withContext, "withContext");
20536
+ function parseTraceparentHeader(traceparentHeader) {
20537
+ return getInstrumenter().parseTraceparentHeader(traceparentHeader);
20538
+ }
20539
+ __name(parseTraceparentHeader, "parseTraceparentHeader");
20540
+ function createRequestHeaders(tracingContext) {
20541
+ return getInstrumenter().createRequestHeaders(tracingContext);
20345
20542
  }
20346
- getOrCreateAgent(request3, isInsecure) {
20347
- var _a3;
20348
- const disableKeepAlive = request3.disableKeepAlive;
20349
- if (isInsecure) {
20350
- if (disableKeepAlive) {
20351
- return http.globalAgent;
20543
+ __name(createRequestHeaders, "createRequestHeaders");
20544
+ return {
20545
+ startSpan,
20546
+ withSpan,
20547
+ withContext,
20548
+ parseTraceparentHeader,
20549
+ createRequestHeaders
20550
+ };
20551
+ }
20552
+ __name(createTracingClient, "createTracingClient");
20553
+
20554
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/restError.js
20555
+ var RestError2 = RestError;
20556
+ function isRestError2(e) {
20557
+ return isRestError(e);
20558
+ }
20559
+ __name(isRestError2, "isRestError");
20560
+
20561
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/tracingPolicy.js
20562
+ var tracingPolicyName = "tracingPolicy";
20563
+ function tracingPolicy(options = {}) {
20564
+ const userAgentPromise = getUserAgentValue2(options.userAgentPrefix);
20565
+ const sanitizer = new Sanitizer({
20566
+ additionalAllowedQueryParameters: options.additionalAllowedQueryParameters
20567
+ });
20568
+ const tracingClient = tryCreateTracingClient();
20569
+ return {
20570
+ name: tracingPolicyName,
20571
+ async sendRequest(request3, next) {
20572
+ var _a3;
20573
+ if (!tracingClient) {
20574
+ return next(request3);
20352
20575
  }
20353
- if (!this.cachedHttpAgent) {
20354
- this.cachedHttpAgent = new http.Agent({ keepAlive: true });
20576
+ const userAgent = await userAgentPromise;
20577
+ const spanAttributes = {
20578
+ "http.url": sanitizer.sanitizeUrl(request3.url),
20579
+ "http.method": request3.method,
20580
+ "http.user_agent": userAgent,
20581
+ requestId: request3.requestId
20582
+ };
20583
+ if (userAgent) {
20584
+ spanAttributes["http.user_agent"] = userAgent;
20355
20585
  }
20356
- return this.cachedHttpAgent;
20357
- } else {
20358
- if (disableKeepAlive && !request3.tlsSettings) {
20359
- return https.globalAgent;
20586
+ const { span, tracingContext } = (_a3 = tryCreateSpan(tracingClient, request3, spanAttributes)) !== null && _a3 !== void 0 ? _a3 : {};
20587
+ if (!span || !tracingContext) {
20588
+ return next(request3);
20360
20589
  }
20361
- const tlsSettings = (_a3 = request3.tlsSettings) !== null && _a3 !== void 0 ? _a3 : DEFAULT_TLS_SETTINGS;
20362
- let agent = this.cachedHttpsAgents.get(tlsSettings);
20363
- if (agent && agent.options.keepAlive === !disableKeepAlive) {
20364
- return agent;
20590
+ try {
20591
+ const response = await tracingClient.withContext(tracingContext, next, request3);
20592
+ tryProcessResponse(span, response);
20593
+ return response;
20594
+ } catch (err) {
20595
+ tryProcessError(span, err);
20596
+ throw err;
20365
20597
  }
20366
- logger.info("No cached TLS Agent exist, creating a new Agent");
20367
- agent = new https.Agent(Object.assign({
20368
- // keepAlive is true if disableKeepAlive is false.
20369
- keepAlive: !disableKeepAlive
20370
- }, tlsSettings));
20371
- this.cachedHttpsAgents.set(tlsSettings, agent);
20372
- return agent;
20373
20598
  }
20599
+ };
20600
+ }
20601
+ __name(tracingPolicy, "tracingPolicy");
20602
+ function tryCreateTracingClient() {
20603
+ try {
20604
+ return createTracingClient({
20605
+ namespace: "",
20606
+ packageName: "@azure/core-rest-pipeline",
20607
+ packageVersion: SDK_VERSION2
20608
+ });
20609
+ } catch (e) {
20610
+ logger2.warning(`Error when creating the TracingClient: ${getErrorMessage(e)}`);
20611
+ return void 0;
20374
20612
  }
20375
- };
20376
- __name(_NodeHttpClient, "NodeHttpClient");
20377
- var NodeHttpClient = _NodeHttpClient;
20378
- function getResponseHeaders(res) {
20379
- const headers = createHttpHeaders();
20380
- for (const header of Object.keys(res.headers)) {
20381
- const value = res.headers[header];
20382
- if (Array.isArray(value)) {
20383
- if (value.length > 0) {
20384
- headers.set(header, value[0]);
20385
- }
20386
- } else if (value) {
20387
- headers.set(header, value);
20613
+ }
20614
+ __name(tryCreateTracingClient, "tryCreateTracingClient");
20615
+ function tryCreateSpan(tracingClient, request3, spanAttributes) {
20616
+ try {
20617
+ const { span, updatedOptions } = tracingClient.startSpan(`HTTP ${request3.method}`, { tracingOptions: request3.tracingOptions }, {
20618
+ spanKind: "client",
20619
+ spanAttributes
20620
+ });
20621
+ if (!span.isRecording()) {
20622
+ span.end();
20623
+ return void 0;
20388
20624
  }
20625
+ const headers = tracingClient.createRequestHeaders(updatedOptions.tracingOptions.tracingContext);
20626
+ for (const [key, value] of Object.entries(headers)) {
20627
+ request3.headers.set(key, value);
20628
+ }
20629
+ return { span, tracingContext: updatedOptions.tracingOptions.tracingContext };
20630
+ } catch (e) {
20631
+ logger2.warning(`Skipping creating a tracing span due to an error: ${getErrorMessage(e)}`);
20632
+ return void 0;
20389
20633
  }
20390
- return headers;
20391
20634
  }
20392
- __name(getResponseHeaders, "getResponseHeaders");
20393
- function getDecodedResponseStream(stream, headers) {
20394
- const contentEncoding = headers.get("Content-Encoding");
20395
- if (contentEncoding === "gzip") {
20396
- const unzip = zlib.createGunzip();
20397
- stream.pipe(unzip);
20398
- return unzip;
20399
- } else if (contentEncoding === "deflate") {
20400
- const inflate = zlib.createInflate();
20401
- stream.pipe(inflate);
20402
- return inflate;
20635
+ __name(tryCreateSpan, "tryCreateSpan");
20636
+ function tryProcessError(span, error) {
20637
+ try {
20638
+ span.setStatus({
20639
+ status: "error",
20640
+ error: isError2(error) ? error : void 0
20641
+ });
20642
+ if (isRestError2(error) && error.statusCode) {
20643
+ span.setAttribute("http.status_code", error.statusCode);
20644
+ }
20645
+ span.end();
20646
+ } catch (e) {
20647
+ logger2.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`);
20403
20648
  }
20404
- return stream;
20405
20649
  }
20406
- __name(getDecodedResponseStream, "getDecodedResponseStream");
20407
- function streamToText(stream) {
20408
- return new Promise((resolve, reject) => {
20409
- const buffer = [];
20410
- stream.on("data", (chunk) => {
20411
- if (Buffer.isBuffer(chunk)) {
20412
- buffer.push(chunk);
20413
- } else {
20414
- buffer.push(Buffer.from(chunk));
20650
+ __name(tryProcessError, "tryProcessError");
20651
+ function tryProcessResponse(span, response) {
20652
+ try {
20653
+ span.setAttribute("http.status_code", response.status);
20654
+ const serviceRequestId = response.headers.get("x-ms-request-id");
20655
+ if (serviceRequestId) {
20656
+ span.setAttribute("serviceRequestId", serviceRequestId);
20657
+ }
20658
+ if (response.status >= 400) {
20659
+ span.setStatus({
20660
+ status: "error"
20661
+ });
20662
+ }
20663
+ span.end();
20664
+ } catch (e) {
20665
+ logger2.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`);
20666
+ }
20667
+ }
20668
+ __name(tryProcessResponse, "tryProcessResponse");
20669
+
20670
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/util/wrapAbortSignal.js
20671
+ function wrapAbortSignalLike(abortSignalLike) {
20672
+ if (abortSignalLike instanceof AbortSignal) {
20673
+ return { abortSignal: abortSignalLike };
20674
+ }
20675
+ if (abortSignalLike.aborted) {
20676
+ return { abortSignal: AbortSignal.abort(abortSignalLike.reason) };
20677
+ }
20678
+ const controller = new AbortController();
20679
+ let needsCleanup = true;
20680
+ function cleanup() {
20681
+ if (needsCleanup) {
20682
+ abortSignalLike.removeEventListener("abort", listener);
20683
+ needsCleanup = false;
20684
+ }
20685
+ }
20686
+ __name(cleanup, "cleanup");
20687
+ function listener() {
20688
+ controller.abort(abortSignalLike.reason);
20689
+ cleanup();
20690
+ }
20691
+ __name(listener, "listener");
20692
+ abortSignalLike.addEventListener("abort", listener);
20693
+ return { abortSignal: controller.signal, cleanup };
20694
+ }
20695
+ __name(wrapAbortSignalLike, "wrapAbortSignalLike");
20696
+
20697
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/wrapAbortSignalLikePolicy.js
20698
+ var wrapAbortSignalLikePolicyName = "wrapAbortSignalLikePolicy";
20699
+ function wrapAbortSignalLikePolicy() {
20700
+ return {
20701
+ name: wrapAbortSignalLikePolicyName,
20702
+ sendRequest: /* @__PURE__ */ __name(async (request3, next) => {
20703
+ if (!request3.abortSignal) {
20704
+ return next(request3);
20415
20705
  }
20416
- });
20417
- stream.on("end", () => {
20418
- resolve(Buffer.concat(buffer).toString("utf8"));
20419
- });
20420
- stream.on("error", (e) => {
20421
- if (e && (e === null || e === void 0 ? void 0 : e.name) === "AbortError") {
20422
- reject(e);
20423
- } else {
20424
- reject(new RestError(`Error reading response as text: ${e.message}`, {
20425
- code: RestError.PARSE_ERROR
20426
- }));
20706
+ const { abortSignal, cleanup } = wrapAbortSignalLike(request3.abortSignal);
20707
+ request3.abortSignal = abortSignal;
20708
+ try {
20709
+ return await next(request3);
20710
+ } finally {
20711
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
20427
20712
  }
20428
- });
20429
- });
20713
+ }, "sendRequest")
20714
+ };
20430
20715
  }
20431
- __name(streamToText, "streamToText");
20432
- function getBodyLength(body2) {
20433
- if (!body2) {
20434
- return 0;
20435
- } else if (Buffer.isBuffer(body2)) {
20436
- return body2.length;
20437
- } else if (isReadableStream(body2)) {
20438
- return null;
20439
- } else if (isArrayBuffer(body2)) {
20440
- return body2.byteLength;
20441
- } else if (typeof body2 === "string") {
20442
- return Buffer.from(body2).length;
20443
- } else {
20444
- return null;
20716
+ __name(wrapAbortSignalLikePolicy, "wrapAbortSignalLikePolicy");
20717
+
20718
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/createPipelineFromOptions.js
20719
+ function createPipelineFromOptions2(options) {
20720
+ var _a3;
20721
+ const pipeline = createEmptyPipeline2();
20722
+ if (isNodeLike2) {
20723
+ if (options.agent) {
20724
+ pipeline.addPolicy(agentPolicy2(options.agent));
20725
+ }
20726
+ if (options.tlsOptions) {
20727
+ pipeline.addPolicy(tlsPolicy2(options.tlsOptions));
20728
+ }
20729
+ pipeline.addPolicy(proxyPolicy2(options.proxyOptions));
20730
+ pipeline.addPolicy(decompressResponsePolicy2());
20445
20731
  }
20732
+ pipeline.addPolicy(wrapAbortSignalLikePolicy());
20733
+ pipeline.addPolicy(formDataPolicy2(), { beforePolicies: [multipartPolicyName2] });
20734
+ pipeline.addPolicy(userAgentPolicy2(options.userAgentOptions));
20735
+ pipeline.addPolicy(setClientRequestIdPolicy((_a3 = options.telemetryOptions) === null || _a3 === void 0 ? void 0 : _a3.clientRequestIdHeaderName));
20736
+ pipeline.addPolicy(multipartPolicy2(), { afterPhase: "Deserialize" });
20737
+ pipeline.addPolicy(defaultRetryPolicy2(options.retryOptions), { phase: "Retry" });
20738
+ pipeline.addPolicy(tracingPolicy(Object.assign(Object.assign({}, options.userAgentOptions), options.loggingOptions)), {
20739
+ afterPhase: "Retry"
20740
+ });
20741
+ if (isNodeLike2) {
20742
+ pipeline.addPolicy(redirectPolicy2(options.redirectOptions), { afterPhase: "Retry" });
20743
+ }
20744
+ pipeline.addPolicy(logPolicy2(options.loggingOptions), { afterPhase: "Sign" });
20745
+ return pipeline;
20446
20746
  }
20447
- __name(getBodyLength, "getBodyLength");
20448
- function createNodeHttpClient() {
20449
- return new NodeHttpClient();
20450
- }
20451
- __name(createNodeHttpClient, "createNodeHttpClient");
20747
+ __name(createPipelineFromOptions2, "createPipelineFromOptions");
20452
20748
 
20453
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/defaultHttpClient.js
20454
- function createDefaultHttpClient() {
20455
- return createNodeHttpClient();
20749
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/defaultHttpClient.js
20750
+ function createDefaultHttpClient2() {
20751
+ const client = createDefaultHttpClient();
20752
+ return {
20753
+ async sendRequest(request3) {
20754
+ const { abortSignal, cleanup } = request3.abortSignal ? wrapAbortSignalLike(request3.abortSignal) : {};
20755
+ try {
20756
+ request3.abortSignal = abortSignal;
20757
+ return await client.sendRequest(request3);
20758
+ } finally {
20759
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
20760
+ }
20761
+ }
20762
+ };
20456
20763
  }
20457
- __name(createDefaultHttpClient, "createDefaultHttpClient");
20764
+ __name(createDefaultHttpClient2, "createDefaultHttpClient");
20458
20765
 
20459
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/pipelineRequest.js
20460
- var _PipelineRequestImpl = class _PipelineRequestImpl {
20461
- constructor(options) {
20462
- var _a3, _b2, _c2, _d2, _e, _f, _g;
20463
- this.url = options.url;
20464
- this.body = options.body;
20465
- this.headers = (_a3 = options.headers) !== null && _a3 !== void 0 ? _a3 : createHttpHeaders();
20466
- this.method = (_b2 = options.method) !== null && _b2 !== void 0 ? _b2 : "GET";
20467
- this.timeout = (_c2 = options.timeout) !== null && _c2 !== void 0 ? _c2 : 0;
20468
- this.multipartBody = options.multipartBody;
20469
- this.formData = options.formData;
20470
- this.disableKeepAlive = (_d2 = options.disableKeepAlive) !== null && _d2 !== void 0 ? _d2 : false;
20471
- this.proxySettings = options.proxySettings;
20472
- this.streamResponseStatusCodes = options.streamResponseStatusCodes;
20473
- this.withCredentials = (_e = options.withCredentials) !== null && _e !== void 0 ? _e : false;
20474
- this.abortSignal = options.abortSignal;
20475
- this.tracingOptions = options.tracingOptions;
20476
- this.onUploadProgress = options.onUploadProgress;
20477
- this.onDownloadProgress = options.onDownloadProgress;
20478
- this.requestId = options.requestId || randomUUID();
20479
- this.allowInsecureConnection = (_f = options.allowInsecureConnection) !== null && _f !== void 0 ? _f : false;
20480
- this.enableBrowserStreams = (_g = options.enableBrowserStreams) !== null && _g !== void 0 ? _g : false;
20481
- this.agent = options.agent;
20482
- this.tlsSettings = options.tlsSettings;
20483
- }
20484
- };
20485
- __name(_PipelineRequestImpl, "PipelineRequestImpl");
20486
- var PipelineRequestImpl = _PipelineRequestImpl;
20487
- function createPipelineRequest(options) {
20488
- return new PipelineRequestImpl(options);
20766
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/pipelineRequest.js
20767
+ function createPipelineRequest2(options) {
20768
+ return createPipelineRequest(options);
20489
20769
  }
20490
- __name(createPipelineRequest, "createPipelineRequest");
20770
+ __name(createPipelineRequest2, "createPipelineRequest");
20771
+
20772
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/retryPolicy.js
20773
+ var retryPolicyLogger2 = createClientLogger2("core-rest-pipeline retryPolicy");
20491
20774
 
20492
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/util/tokenCycler.js
20775
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/util/tokenCycler.js
20493
20776
  var DEFAULT_CYCLER_OPTIONS = {
20494
20777
  forcedRefreshWindowInMs: 1e3,
20495
20778
  // Force waiting for a refresh 1s before the token expires
@@ -20599,13 +20882,13 @@ function createTokenCycler(credential, tokenCyclerOptions) {
20599
20882
  }
20600
20883
  __name(createTokenCycler, "createTokenCycler");
20601
20884
 
20602
- // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.19.1-39c04f58d0/package/dist/esm/policies/bearerTokenAuthenticationPolicy.js
20885
+ // ../../node_modules/.store/@azure-core-rest-pipeline-npm-1.21.0-081c6c69ab/package/dist/esm/policies/bearerTokenAuthenticationPolicy.js
20603
20886
  var bearerTokenAuthenticationPolicyName = "bearerTokenAuthenticationPolicy";
20604
20887
  async function trySendRequest(request3, next) {
20605
20888
  try {
20606
20889
  return [await next(request3), void 0];
20607
20890
  } catch (e) {
20608
- if (isRestError(e) && e.response) {
20891
+ if (isRestError2(e) && e.response) {
20609
20892
  return [e.response, e];
20610
20893
  } else {
20611
20894
  throw e;
@@ -20647,7 +20930,7 @@ __name(authorizeRequestOnCaeChallenge, "authorizeRequestOnCaeChallenge");
20647
20930
  function bearerTokenAuthenticationPolicy(options) {
20648
20931
  var _a3, _b2, _c2;
20649
20932
  const { credential, scopes, challengeCallbacks } = options;
20650
- const logger3 = options.logger || logger;
20933
+ const logger4 = options.logger || logger2;
20651
20934
  const callbacks = {
20652
20935
  authorizeRequest: (_b2 = (_a3 = challengeCallbacks === null || challengeCallbacks === void 0 ? void 0 : challengeCallbacks.authorizeRequest) === null || _a3 === void 0 ? void 0 : _a3.bind(challengeCallbacks)) !== null && _b2 !== void 0 ? _b2 : defaultAuthorizeRequest,
20653
20936
  authorizeRequestOnChallenge: (_c2 = challengeCallbacks === null || challengeCallbacks === void 0 ? void 0 : challengeCallbacks.authorizeRequestOnChallenge) === null || _c2 === void 0 ? void 0 : _c2.bind(challengeCallbacks)
@@ -20679,7 +20962,7 @@ function bearerTokenAuthenticationPolicy(options) {
20679
20962
  scopes: Array.isArray(scopes) ? scopes : [scopes],
20680
20963
  request: request3,
20681
20964
  getAccessToken,
20682
- logger: logger3
20965
+ logger: logger4
20683
20966
  });
20684
20967
  let response;
20685
20968
  let error;
@@ -20692,7 +20975,7 @@ function bearerTokenAuthenticationPolicy(options) {
20692
20975
  try {
20693
20976
  parsedClaim = atob(claims);
20694
20977
  } catch (e) {
20695
- logger3.warning(`The WWW-Authenticate header contains "claims" that cannot be parsed. Unable to perform the Continuous Access Evaluation authentication flow. Unparsable claims: ${claims}`);
20978
+ logger4.warning(`The WWW-Authenticate header contains "claims" that cannot be parsed. Unable to perform the Continuous Access Evaluation authentication flow. Unparsable claims: ${claims}`);
20696
20979
  return response;
20697
20980
  }
20698
20981
  shouldSendRequest = await authorizeRequestOnCaeChallenge({
@@ -20700,7 +20983,7 @@ function bearerTokenAuthenticationPolicy(options) {
20700
20983
  response,
20701
20984
  request: request3,
20702
20985
  getAccessToken,
20703
- logger: logger3
20986
+ logger: logger4
20704
20987
  }, parsedClaim);
20705
20988
  if (shouldSendRequest) {
20706
20989
  [response, error] = await trySendRequest(request3, next);
@@ -20711,7 +20994,7 @@ function bearerTokenAuthenticationPolicy(options) {
20711
20994
  request: request3,
20712
20995
  response,
20713
20996
  getAccessToken,
20714
- logger: logger3
20997
+ logger: logger4
20715
20998
  });
20716
20999
  if (shouldSendRequest) {
20717
21000
  [response, error] = await trySendRequest(request3, next);
@@ -20723,7 +21006,7 @@ function bearerTokenAuthenticationPolicy(options) {
20723
21006
  try {
20724
21007
  parsedClaim = atob(claims);
20725
21008
  } catch (e) {
20726
- logger3.warning(`The WWW-Authenticate header contains "claims" that cannot be parsed. Unable to perform the Continuous Access Evaluation authentication flow. Unparsable claims: ${claims}`);
21009
+ logger4.warning(`The WWW-Authenticate header contains "claims" that cannot be parsed. Unable to perform the Continuous Access Evaluation authentication flow. Unparsable claims: ${claims}`);
20727
21010
  return response;
20728
21011
  }
20729
21012
  shouldSendRequest = await authorizeRequestOnCaeChallenge({
@@ -20731,7 +21014,7 @@ function bearerTokenAuthenticationPolicy(options) {
20731
21014
  response,
20732
21015
  request: request3,
20733
21016
  getAccessToken,
20734
- logger: logger3
21017
+ logger: logger4
20735
21018
  }, parsedClaim);
20736
21019
  if (shouldSendRequest) {
20737
21020
  [response, error] = await trySendRequest(request3, next);
@@ -20823,7 +21106,7 @@ var KnownContextTagKeys;
20823
21106
  KnownContextTagKeys2["AiInternalNodeName"] = "ai.internal.nodeName";
20824
21107
  })(KnownContextTagKeys || (KnownContextTagKeys = {}));
20825
21108
 
20826
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/base64.js
21109
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/base64.js
20827
21110
  function encodeByteArray(value) {
20828
21111
  const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);
20829
21112
  return bufferValue.toString("base64");
@@ -20834,11 +21117,11 @@ function decodeString(value) {
20834
21117
  }
20835
21118
  __name(decodeString, "decodeString");
20836
21119
 
20837
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/interfaces.js
21120
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/interfaces.js
20838
21121
  var XML_ATTRKEY = "$";
20839
21122
  var XML_CHARKEY = "_";
20840
21123
 
20841
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/utils.js
21124
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/utils.js
20842
21125
  function isPrimitiveBody(value, mapperTypeName) {
20843
21126
  return mapperTypeName !== "Composite" && mapperTypeName !== "Dictionary" && (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || (mapperTypeName === null || mapperTypeName === void 0 ? void 0 : mapperTypeName.match(/^(Date|DateTime|DateTimeRfc1123|UnixTime|ByteArray|Base64Url)$/i)) !== null || value === void 0 || value === null);
20844
21127
  }
@@ -20899,7 +21182,7 @@ function flattenResponse(fullResponse, responseSpec) {
20899
21182
  }
20900
21183
  __name(flattenResponse, "flattenResponse");
20901
21184
 
20902
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/serializer.js
21185
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/serializer.js
20903
21186
  var _SerializerImpl = class _SerializerImpl {
20904
21187
  constructor(modelMappers = {}, isXML = false) {
20905
21188
  this.modelMappers = modelMappers;
@@ -21667,11 +21950,11 @@ var MapperTypeNames = {
21667
21950
  UnixTime: "UnixTime"
21668
21951
  };
21669
21952
 
21670
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/state.js
21953
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/state.js
21671
21954
  var import_state3 = __toESM(require_state2(), 1);
21672
21955
  var state2 = import_state3.state;
21673
21956
 
21674
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/operationHelpers.js
21957
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/operationHelpers.js
21675
21958
  function getOperationArgumentValueFromParameter(operationArguments, parameter, fallbackObject) {
21676
21959
  let parameterPath = parameter.parameterPath;
21677
21960
  const parameterMapper = parameter.mapper;
@@ -21753,7 +22036,7 @@ function getOperationRequestInfo(request3) {
21753
22036
  }
21754
22037
  __name(getOperationRequestInfo, "getOperationRequestInfo");
21755
22038
 
21756
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/deserializationPolicy.js
22039
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/deserializationPolicy.js
21757
22040
  var defaultJsonContentTypes = ["application/json", "text/json"];
21758
22041
  var defaultXmlContentTypes = ["application/xml", "application/atom+xml"];
21759
22042
  var deserializationPolicyName = "deserializationPolicy";
@@ -21835,7 +22118,7 @@ async function deserializeResponseBody(jsonContentTypes, xmlContentTypes, respon
21835
22118
  try {
21836
22119
  parsedResponse.parsedBody = operationSpec.serializer.deserialize(responseSpec.bodyMapper, valueToDeserialize, "operationRes.parsedBody", options);
21837
22120
  } catch (deserializeError) {
21838
- const restError = new RestError(`Error ${deserializeError} occurred in deserializing the responseBody - ${parsedResponse.bodyAsText}`, {
22121
+ const restError = new RestError2(`Error ${deserializeError} occurred in deserializing the responseBody - ${parsedResponse.bodyAsText}`, {
21839
22122
  statusCode: parsedResponse.status,
21840
22123
  request: parsedResponse.request,
21841
22124
  response: parsedResponse
@@ -21872,7 +22155,7 @@ function handleErrorResponse(parsedResponse, operationSpec, responseSpec, option
21872
22155
  }
21873
22156
  const errorResponseSpec = responseSpec !== null && responseSpec !== void 0 ? responseSpec : operationSpec.responses.default;
21874
22157
  const initialErrorMessage = ((_a3 = parsedResponse.request.streamResponseStatusCodes) === null || _a3 === void 0 ? void 0 : _a3.has(parsedResponse.status)) ? `Unexpected status code: ${parsedResponse.status}` : parsedResponse.bodyAsText;
21875
- const error = new RestError(initialErrorMessage, {
22158
+ const error = new RestError2(initialErrorMessage, {
21876
22159
  statusCode: parsedResponse.status,
21877
22160
  request: parsedResponse.request,
21878
22161
  response: parsedResponse
@@ -21935,8 +22218,8 @@ async function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts,
21935
22218
  }
21936
22219
  } catch (err) {
21937
22220
  const msg = `Error "${err}" occurred while parsing the response body - ${operationResponse.bodyAsText}.`;
21938
- const errCode = err.code || RestError.PARSE_ERROR;
21939
- const e = new RestError(msg, {
22221
+ const errCode = err.code || RestError2.PARSE_ERROR;
22222
+ const e = new RestError2(msg, {
21940
22223
  code: errCode,
21941
22224
  statusCode: operationResponse.status,
21942
22225
  request: operationResponse.request,
@@ -21949,7 +22232,7 @@ async function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts,
21949
22232
  }
21950
22233
  __name(parse, "parse");
21951
22234
 
21952
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/interfaceHelpers.js
22235
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/interfaceHelpers.js
21953
22236
  function getStreamingResponseStatusCodes(operationSpec) {
21954
22237
  const result = /* @__PURE__ */ new Set();
21955
22238
  for (const statusCode in operationSpec.responses) {
@@ -21975,7 +22258,7 @@ function getPathStringFromParameter(parameter) {
21975
22258
  }
21976
22259
  __name(getPathStringFromParameter, "getPathStringFromParameter");
21977
22260
 
21978
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/serializationPolicy.js
22261
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/serializationPolicy.js
21979
22262
  var serializationPolicyName = "serializationPolicy";
21980
22263
  function serializationPolicy(options = {}) {
21981
22264
  const stringifyXML = options.stringifyXML;
@@ -22098,9 +22381,9 @@ function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) {
22098
22381
  }
22099
22382
  __name(prepareXMLRootList, "prepareXMLRootList");
22100
22383
 
22101
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/pipeline.js
22384
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/pipeline.js
22102
22385
  function createClientPipeline(options = {}) {
22103
- const pipeline = createPipelineFromOptions(options !== null && options !== void 0 ? options : {});
22386
+ const pipeline = createPipelineFromOptions2(options !== null && options !== void 0 ? options : {});
22104
22387
  if (options.credentialOptions) {
22105
22388
  pipeline.addPolicy(bearerTokenAuthenticationPolicy({
22106
22389
  credential: options.credentialOptions.credential,
@@ -22115,17 +22398,17 @@ function createClientPipeline(options = {}) {
22115
22398
  }
22116
22399
  __name(createClientPipeline, "createClientPipeline");
22117
22400
 
22118
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/httpClientCache.js
22401
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/httpClientCache.js
22119
22402
  var cachedHttpClient;
22120
22403
  function getCachedDefaultHttpClient() {
22121
22404
  if (!cachedHttpClient) {
22122
- cachedHttpClient = createDefaultHttpClient();
22405
+ cachedHttpClient = createDefaultHttpClient2();
22123
22406
  }
22124
22407
  return cachedHttpClient;
22125
22408
  }
22126
22409
  __name(getCachedDefaultHttpClient, "getCachedDefaultHttpClient");
22127
22410
 
22128
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/urlHelpers.js
22411
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/urlHelpers.js
22129
22412
  var CollectionFormatToDelimiterMap = {
22130
22413
  CSV: ",",
22131
22414
  SSV: " ",
@@ -22327,10 +22610,10 @@ function appendQueryParams(url2, queryParams, sequenceParams, noOverwrite = fals
22327
22610
  }
22328
22611
  __name(appendQueryParams, "appendQueryParams");
22329
22612
 
22330
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/log.js
22331
- var logger2 = createClientLogger("core-client");
22613
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/log.js
22614
+ var logger3 = createClientLogger2("core-client");
22332
22615
 
22333
- // ../../node_modules/.store/@azure-core-client-npm-1.9.3-f102979df4/package/dist/esm/serviceClient.js
22616
+ // ../../node_modules/.store/@azure-core-client-npm-1.9.4-e6930146b3/package/dist/esm/serviceClient.js
22334
22617
  var _ServiceClient = class _ServiceClient {
22335
22618
  /**
22336
22619
  * The ServiceClient constructor
@@ -22341,11 +22624,11 @@ var _ServiceClient = class _ServiceClient {
22341
22624
  this._requestContentType = options.requestContentType;
22342
22625
  this._endpoint = (_a3 = options.endpoint) !== null && _a3 !== void 0 ? _a3 : options.baseUri;
22343
22626
  if (options.baseUri) {
22344
- logger2.warning("The baseUri option for SDK Clients has been deprecated, please use endpoint instead.");
22627
+ logger3.warning("The baseUri option for SDK Clients has been deprecated, please use endpoint instead.");
22345
22628
  }
22346
22629
  this._allowInsecureConnection = options.allowInsecureConnection;
22347
22630
  this._httpClient = options.httpClient || getCachedDefaultHttpClient();
22348
- this.pipeline = options.pipeline || createDefaultPipeline(options);
22631
+ this.pipeline = options.pipeline || createDefaultPipeline2(options);
22349
22632
  if ((_b2 = options.additionalPolicies) === null || _b2 === void 0 ? void 0 : _b2.length) {
22350
22633
  for (const { policy, position } of options.additionalPolicies) {
22351
22634
  const afterPhase = position === "perRetry" ? "Sign" : void 0;
@@ -22373,7 +22656,7 @@ var _ServiceClient = class _ServiceClient {
22373
22656
  throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.");
22374
22657
  }
22375
22658
  const url2 = getRequestUrl(endpoint, operationSpec, operationArguments, this);
22376
- const request3 = createPipelineRequest({
22659
+ const request3 = createPipelineRequest2({
22377
22660
  url: url2
22378
22661
  });
22379
22662
  request3.method = operationSpec.httpMethod;
@@ -22439,12 +22722,12 @@ var _ServiceClient = class _ServiceClient {
22439
22722
  };
22440
22723
  __name(_ServiceClient, "ServiceClient");
22441
22724
  var ServiceClient = _ServiceClient;
22442
- function createDefaultPipeline(options) {
22725
+ function createDefaultPipeline2(options) {
22443
22726
  const credentialScopes = getCredentialScopes(options);
22444
22727
  const credentialOptions = options.credential && credentialScopes ? { credentialScopes, credential: options.credential } : void 0;
22445
22728
  return createClientPipeline(Object.assign(Object.assign({}, options), { credentialOptions }));
22446
22729
  }
22447
- __name(createDefaultPipeline, "createDefaultPipeline");
22730
+ __name(createDefaultPipeline2, "createDefaultPipeline");
22448
22731
  function getCredentialScopes(options) {
22449
22732
  if (options.credentialScopes) {
22450
22733
  return options.credentialScopes;
@@ -23570,7 +23853,7 @@ var _StatsbeatMetrics = class _StatsbeatMetrics {
23570
23853
  }
23571
23854
  }
23572
23855
  async getAzureComputeMetadata() {
23573
- const httpClient = createDefaultHttpClient();
23856
+ const httpClient = createDefaultHttpClient2();
23574
23857
  const method = "GET";
23575
23858
  const options = {
23576
23859
  url: `${AIMS_URI}?${AIMS_API_VERSION}&${AIMS_FORMAT}`,
@@ -23579,7 +23862,7 @@ var _StatsbeatMetrics = class _StatsbeatMetrics {
23579
23862
  method,
23580
23863
  allowInsecureConnection: true
23581
23864
  };
23582
- const request3 = createPipelineRequest(options);
23865
+ const request3 = createPipelineRequest2(options);
23583
23866
  await httpClient.sendRequest(request3).then((res) => {
23584
23867
  if (res.status === 200) {
23585
23868
  this.vmInfo.isVM = true;
@@ -24377,7 +24660,7 @@ var _HttpSender = class _HttpSender extends BaseSender {
24377
24660
  }
24378
24661
  }
24379
24662
  this.appInsightsClient = new ApplicationInsightsClient(this.appInsightsClientOptions);
24380
- this.appInsightsClient.pipeline.removePolicy({ name: redirectPolicyName });
24663
+ this.appInsightsClient.pipeline.removePolicy({ name: redirectPolicyName2 });
24381
24664
  }
24382
24665
  /**
24383
24666
  * Send Azure envelopes
@@ -24461,8 +24744,8 @@ function hrTimeToDate(hrTime) {
24461
24744
  }
24462
24745
  __name(hrTimeToDate, "hrTimeToDate");
24463
24746
  function createTagsFromResource(resource) {
24464
- const context2 = getInstance2();
24465
- const tags = Object.assign({}, context2.tags);
24747
+ const context4 = getInstance2();
24748
+ const tags = Object.assign({}, context4.tags);
24466
24749
  if (resource && resource.attributes) {
24467
24750
  tags[KnownContextTagKeys.AiCloudRole] = getCloudRole(resource);
24468
24751
  tags[KnownContextTagKeys.AiCloudRoleInstance] = getCloudRoleInstance(resource);