dsh-db-tool 1.9.0 → 1.9.2

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.
@@ -42,9 +42,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
42
42
  ));
43
43
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
44
44
 
45
- // node_modules/mssql/node_modules/ms/index.js
45
+ // node_modules/ms/index.js
46
46
  var require_ms = __commonJS({
47
- "node_modules/mssql/node_modules/ms/index.js"(exports2, module2) {
47
+ "node_modules/ms/index.js"(exports2, module2) {
48
48
  var s = 1e3;
49
49
  var m = s * 60;
50
50
  var h = m * 60;
@@ -2356,7 +2356,7 @@ var require_table = __commonJS({
2356
2356
  let cursor = -1;
2357
2357
  let buffer = "";
2358
2358
  let escaped = false;
2359
- const path2 = [];
2359
+ const path3 = [];
2360
2360
  while (++cursor < length) {
2361
2361
  const char = name.charAt(cursor);
2362
2362
  if (char === "[") {
@@ -2375,7 +2375,7 @@ var require_table = __commonJS({
2375
2375
  if (escaped) {
2376
2376
  buffer += char;
2377
2377
  } else {
2378
- path2.push(buffer);
2378
+ path3.push(buffer);
2379
2379
  buffer = "";
2380
2380
  }
2381
2381
  } else {
@@ -2383,26 +2383,26 @@ var require_table = __commonJS({
2383
2383
  }
2384
2384
  }
2385
2385
  if (buffer) {
2386
- path2.push(buffer);
2386
+ path3.push(buffer);
2387
2387
  }
2388
- switch (path2.length) {
2388
+ switch (path3.length) {
2389
2389
  case 1:
2390
2390
  return {
2391
- name: path2[0],
2391
+ name: path3[0],
2392
2392
  schema: null,
2393
2393
  database: null
2394
2394
  };
2395
2395
  case 2:
2396
2396
  return {
2397
- name: path2[1],
2398
- schema: path2[0],
2397
+ name: path3[1],
2398
+ schema: path3[0],
2399
2399
  database: null
2400
2400
  };
2401
2401
  case 3:
2402
2402
  return {
2403
- name: path2[2],
2404
- schema: path2[1],
2405
- database: path2[0]
2403
+ name: path3[2],
2404
+ schema: path3[1],
2405
+ database: path3[0]
2406
2406
  };
2407
2407
  default:
2408
2408
  throw new Error("Invalid table name.");
@@ -5783,7 +5783,7 @@ var require_constants = __commonJS({
5783
5783
  SDK_VERSION: () => SDK_VERSION
5784
5784
  });
5785
5785
  module2.exports = __toCommonJS2(constants_exports);
5786
- var SDK_VERSION = `4.13.3`;
5786
+ var SDK_VERSION = `4.14.1`;
5787
5787
  var DeveloperSignOnClientId = "04b07795-8ddb-461a-bbee-02f9e1bf7b46";
5788
5788
  var DefaultTenantId = "common";
5789
5789
  var AzureAuthorityHosts2 = /* @__PURE__ */ ((AzureAuthorityHosts22) => {
@@ -5860,8 +5860,8 @@ var require_msalPlugins = __commonJS({
5860
5860
  }
5861
5861
  };
5862
5862
  var msalNodeFlowVSCodeCredentialControl = {
5863
- setVSCodeAuthRecordPath(path2) {
5864
- vsCodeAuthRecordPath = path2;
5863
+ setVSCodeAuthRecordPath(path3) {
5864
+ vsCodeAuthRecordPath = path3;
5865
5865
  },
5866
5866
  setVSCodeBroker(broker) {
5867
5867
  vsCodeBrokerInfo = {
@@ -6162,10 +6162,10 @@ var require_log = __commonJS({
6162
6162
  });
6163
6163
  module2.exports = __toCommonJS2(log_exports);
6164
6164
  var import_node_os2 = require("node:os");
6165
- var import_node_util6 = __toESM2(require("node:util"));
6166
- var import_node_process8 = __toESM2(require("node:process"));
6165
+ var import_node_util7 = __toESM2(require("node:util"));
6166
+ var import_node_process9 = __toESM2(require("node:process"));
6167
6167
  function log(message, ...args) {
6168
- import_node_process8.default.stderr.write(`${import_node_util6.default.format(message, ...args)}${import_node_os2.EOL}`);
6168
+ import_node_process9.default.stderr.write(`${import_node_util7.default.format(message, ...args)}${import_node_os2.EOL}`);
6169
6169
  }
6170
6170
  }
6171
6171
  });
@@ -6213,17 +6213,17 @@ var require_env = __commonJS({
6213
6213
  isWebWorker: () => isWebWorker2
6214
6214
  });
6215
6215
  module2.exports = __toCommonJS2(env_exports);
6216
- var import_node_process8 = __toESM2(require("node:process"));
6216
+ var import_node_process9 = __toESM2(require("node:process"));
6217
6217
  function getEnvironmentVariable(name) {
6218
- return import_node_process8.default.env[name];
6218
+ return import_node_process9.default.env[name];
6219
6219
  }
6220
6220
  function emitNodeWarning(warning) {
6221
- import_node_process8.default.emitWarning(warning);
6221
+ import_node_process9.default.emitWarning(warning);
6222
6222
  }
6223
6223
  var isBrowser2 = false;
6224
6224
  var isWebWorker2 = false;
6225
- var isDeno2 = typeof import_node_process8.default.versions.deno === "string" && import_node_process8.default.versions.deno.length > 0;
6226
- var isBun2 = typeof import_node_process8.default.versions.bun === "string" && import_node_process8.default.versions.bun.length > 0;
6225
+ var isDeno2 = typeof import_node_process9.default.versions.deno === "string" && import_node_process9.default.versions.deno.length > 0;
6226
+ var isBun2 = typeof import_node_process9.default.versions.bun === "string" && import_node_process9.default.versions.bun.length > 0;
6227
6227
  var isNodeLike2 = true;
6228
6228
  var isNodeRuntime2 = !isBun2 && !isDeno2;
6229
6229
  var isReactNative2 = false;
@@ -7922,126 +7922,10 @@ var require_TokenExpiredError = __commonJS({
7922
7922
  }
7923
7923
  });
7924
7924
 
7925
- // node_modules/jsonwebtoken/node_modules/ms/index.js
7926
- var require_ms2 = __commonJS({
7927
- "node_modules/jsonwebtoken/node_modules/ms/index.js"(exports2, module2) {
7928
- var s = 1e3;
7929
- var m = s * 60;
7930
- var h = m * 60;
7931
- var d = h * 24;
7932
- var w = d * 7;
7933
- var y = d * 365.25;
7934
- module2.exports = function(val, options) {
7935
- options = options || {};
7936
- var type = typeof val;
7937
- if (type === "string" && val.length > 0) {
7938
- return parse(val);
7939
- } else if (type === "number" && isFinite(val)) {
7940
- return options.long ? fmtLong(val) : fmtShort(val);
7941
- }
7942
- throw new Error(
7943
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
7944
- );
7945
- };
7946
- function parse(str) {
7947
- str = String(str);
7948
- if (str.length > 100) {
7949
- return;
7950
- }
7951
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
7952
- str
7953
- );
7954
- if (!match) {
7955
- return;
7956
- }
7957
- var n = parseFloat(match[1]);
7958
- var type = (match[2] || "ms").toLowerCase();
7959
- switch (type) {
7960
- case "years":
7961
- case "year":
7962
- case "yrs":
7963
- case "yr":
7964
- case "y":
7965
- return n * y;
7966
- case "weeks":
7967
- case "week":
7968
- case "w":
7969
- return n * w;
7970
- case "days":
7971
- case "day":
7972
- case "d":
7973
- return n * d;
7974
- case "hours":
7975
- case "hour":
7976
- case "hrs":
7977
- case "hr":
7978
- case "h":
7979
- return n * h;
7980
- case "minutes":
7981
- case "minute":
7982
- case "mins":
7983
- case "min":
7984
- case "m":
7985
- return n * m;
7986
- case "seconds":
7987
- case "second":
7988
- case "secs":
7989
- case "sec":
7990
- case "s":
7991
- return n * s;
7992
- case "milliseconds":
7993
- case "millisecond":
7994
- case "msecs":
7995
- case "msec":
7996
- case "ms":
7997
- return n;
7998
- default:
7999
- return void 0;
8000
- }
8001
- }
8002
- function fmtShort(ms) {
8003
- var msAbs = Math.abs(ms);
8004
- if (msAbs >= d) {
8005
- return Math.round(ms / d) + "d";
8006
- }
8007
- if (msAbs >= h) {
8008
- return Math.round(ms / h) + "h";
8009
- }
8010
- if (msAbs >= m) {
8011
- return Math.round(ms / m) + "m";
8012
- }
8013
- if (msAbs >= s) {
8014
- return Math.round(ms / s) + "s";
8015
- }
8016
- return ms + "ms";
8017
- }
8018
- function fmtLong(ms) {
8019
- var msAbs = Math.abs(ms);
8020
- if (msAbs >= d) {
8021
- return plural(ms, msAbs, d, "day");
8022
- }
8023
- if (msAbs >= h) {
8024
- return plural(ms, msAbs, h, "hour");
8025
- }
8026
- if (msAbs >= m) {
8027
- return plural(ms, msAbs, m, "minute");
8028
- }
8029
- if (msAbs >= s) {
8030
- return plural(ms, msAbs, s, "second");
8031
- }
8032
- return ms + " ms";
8033
- }
8034
- function plural(ms, msAbs, n, name) {
8035
- var isPlural = msAbs >= n * 1.5;
8036
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
8037
- }
8038
- }
8039
- });
8040
-
8041
7925
  // node_modules/jsonwebtoken/lib/timespan.js
8042
7926
  var require_timespan = __commonJS({
8043
7927
  "node_modules/jsonwebtoken/lib/timespan.js"(exports2, module2) {
8044
- var ms = require_ms2();
7928
+ var ms = require_ms();
8045
7929
  module2.exports = function(time, iat) {
8046
7930
  var timestamp = iat || Math.floor(Date.now() / 1e3);
8047
7931
  if (typeof time === "string") {
@@ -11015,7 +10899,7 @@ var require_msal_node = __commonJS({
11015
10899
  var jwt = require_jsonwebtoken();
11016
10900
  var http = require("http");
11017
10901
  var fs6 = require("fs");
11018
- var path2 = require("path");
10902
+ var path3 = require("path");
11019
10903
  var Serializer = class {
11020
10904
  /**
11021
10905
  * serialize the JSON blob
@@ -11201,6 +11085,7 @@ var require_msal_node = __commonJS({
11201
11085
  var USER_ID = "user_id";
11202
11086
  var FMI_PATH = "fmi_path";
11203
11087
  var ATTRIBUTE_TOKENS = "attribute_tokens";
11088
+ var POPUP_ORIGIN_CHECK_DONE = "pocd";
11204
11089
  var SKU = "msal.js.common";
11205
11090
  var DEFAULT_AUTHORITY = "https://login.microsoftonline.com/common/";
11206
11091
  var DEFAULT_AUTHORITY_HOST = "login.microsoftonline.com";
@@ -11232,7 +11117,6 @@ var require_msal_node = __commonJS({
11232
11117
  ];
11233
11118
  var INVALID_INSTANCE = "invalid_instance";
11234
11119
  var HTTP_SUCCESS = 200;
11235
- var HTTP_REDIRECT = 302;
11236
11120
  var HTTP_CLIENT_ERROR_RANGE_START = 400;
11237
11121
  var HTTP_BAD_REQUEST = 400;
11238
11122
  var HTTP_UNAUTHORIZED = 401;
@@ -11389,7 +11273,7 @@ var require_msal_node = __commonJS({
11389
11273
  function getDefaultErrorMessage(code) {
11390
11274
  return `See https://aka.ms/msal.js.errors#${code} for details`;
11391
11275
  }
11392
- var AuthError = class _AuthError extends Error {
11276
+ var AuthError2 = class _AuthError extends Error {
11393
11277
  constructor(errorCode, correlationId, errorMessage, suberror) {
11394
11278
  const message = errorMessage || (errorCode ? getDefaultErrorMessage(errorCode) : "");
11395
11279
  const errorString = message ? `${errorCode}: ${message}` : errorCode;
@@ -11403,9 +11287,9 @@ var require_msal_node = __commonJS({
11403
11287
  }
11404
11288
  };
11405
11289
  function createAuthError(code, correlationId, additionalMessage) {
11406
- return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
11290
+ return new AuthError2(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
11407
11291
  }
11408
- var ClientAuthError = class _ClientAuthError extends AuthError {
11292
+ var ClientAuthError = class _ClientAuthError extends AuthError2 {
11409
11293
  constructor(errorCode, correlationId, additionalMessage) {
11410
11294
  super(errorCode, correlationId, additionalMessage);
11411
11295
  this.name = "ClientAuthError";
@@ -11720,7 +11604,7 @@ var require_msal_node = __commonJS({
11720
11604
  postRequestFailed,
11721
11605
  unexpectedError
11722
11606
  });
11723
- var ClientConfigurationError = class _ClientConfigurationError extends AuthError {
11607
+ var ClientConfigurationError = class _ClientConfigurationError extends AuthError2 {
11724
11608
  constructor(errorCode, correlationId) {
11725
11609
  super(errorCode, correlationId);
11726
11610
  this.name = "ClientConfigurationError";
@@ -11730,6 +11614,29 @@ var require_msal_node = __commonJS({
11730
11614
  function createClientConfigurationError(errorCode, correlationId) {
11731
11615
  return new ClientConfigurationError(errorCode, correlationId);
11732
11616
  }
11617
+ var normalizedHeaderRecords = /* @__PURE__ */ new WeakSet();
11618
+ function normalizeResponseHeaders(headers) {
11619
+ if (normalizedHeaderRecords.has(headers)) {
11620
+ return headers;
11621
+ }
11622
+ const normalized = Object.fromEntries(Object.entries(headers).map(([name2, value]) => [
11623
+ name2.toLowerCase(),
11624
+ value
11625
+ ]));
11626
+ normalizedHeaderRecords.add(normalized);
11627
+ return normalized;
11628
+ }
11629
+ function getResponseHeader(headers, name2) {
11630
+ const key = name2.toLowerCase();
11631
+ if (Object.prototype.hasOwnProperty.call(headers, key)) {
11632
+ return headers[key];
11633
+ }
11634
+ if (normalizedHeaderRecords.has(headers)) {
11635
+ return void 0;
11636
+ }
11637
+ const headerName = Object.keys(headers).find((header) => header.toLowerCase() === key);
11638
+ return headerName === void 0 ? void 0 : headers[headerName];
11639
+ }
11733
11640
  var redirectUriEmpty = "redirect_uri_empty";
11734
11641
  var claimsRequestParsingError = "claims_request_parsing_error";
11735
11642
  var authorityUriInsecure = "authority_uri_insecure";
@@ -12996,7 +12903,7 @@ var require_msal_node = __commonJS({
12996
12903
  this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.", this.correlationId);
12997
12904
  match = getCloudDiscoveryMetadataFromNetworkResponse(metadata, this.hostnameAndPort);
12998
12905
  } catch (error) {
12999
- if (error instanceof AuthError) {
12906
+ if (error instanceof AuthError2) {
13000
12907
  this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.
13001
12908
  Error: '${error.errorCode}'
13002
12909
  Error Description: '${error.errorMessage}'`, this.correlationId);
@@ -13601,6 +13508,11 @@ Error Description: '${typedError.message}'`, this.correlationId);
13601
13508
  parameters.set(INSTANCE_AWARE, "true");
13602
13509
  }
13603
13510
  }
13511
+ function addPopupOriginCheckDone(parameters) {
13512
+ if (!parameters.has(POPUP_ORIGIN_CHECK_DONE)) {
13513
+ parameters.set(POPUP_ORIGIN_CHECK_DONE, "1");
13514
+ }
13515
+ }
13604
13516
  function addExtraParameters(parameters, extraParams) {
13605
13517
  Object.entries(extraParams).forEach(([key, value]) => {
13606
13518
  if (!parameters.has(key) && value) {
@@ -13729,6 +13641,9 @@ Error Description: '${typedError.message}'`, this.correlationId);
13729
13641
  }
13730
13642
  try {
13731
13643
  const normalizedResponse = stripLeadingHashOrQuery(responseString);
13644
+ if (!/^[^=&?#/]+(?:=|&|$)/.test(normalizedResponse)) {
13645
+ return null;
13646
+ }
13732
13647
  const deserializedHash = Object.fromEntries(new URLSearchParams(normalizedResponse));
13733
13648
  if (deserializedHash.code || deserializedHash.ear_jwe || deserializedHash.error || deserializedHash.error_description || deserializedHash.state) {
13734
13649
  return deserializedHash;
@@ -13790,12 +13705,12 @@ Error Description: '${typedError.message}'`, this.correlationId);
13790
13705
  }
13791
13706
  };
13792
13707
  exports2.LogLevel = void 0;
13793
- (function(LogLevel) {
13794
- LogLevel[LogLevel["Error"] = 0] = "Error";
13795
- LogLevel[LogLevel["Warning"] = 1] = "Warning";
13796
- LogLevel[LogLevel["Info"] = 2] = "Info";
13797
- LogLevel[LogLevel["Verbose"] = 3] = "Verbose";
13798
- LogLevel[LogLevel["Trace"] = 4] = "Trace";
13708
+ (function(LogLevel2) {
13709
+ LogLevel2[LogLevel2["Error"] = 0] = "Error";
13710
+ LogLevel2[LogLevel2["Warning"] = 1] = "Warning";
13711
+ LogLevel2[LogLevel2["Info"] = 2] = "Info";
13712
+ LogLevel2[LogLevel2["Verbose"] = 3] = "Verbose";
13713
+ LogLevel2[LogLevel2["Trace"] = 4] = "Trace";
13799
13714
  })(exports2.LogLevel || (exports2.LogLevel = {}));
13800
13715
  var CACHE_CAPACITY = 50;
13801
13716
  var MAX_LOGS_PER_CORRELATION = 500;
@@ -14014,7 +13929,7 @@ Error Description: '${typedError.message}'`, this.correlationId);
14014
13929
  }
14015
13930
  };
14016
13931
  var name$1 = "@azure/msal-common";
14017
- var version$1 = "16.14.1";
13932
+ var version$1 = "16.15.0";
14018
13933
  var cacheQuotaExceeded = "cache_quota_exceeded";
14019
13934
  var cacheErrorUnknown = "cache_error_unknown";
14020
13935
  var CacheError = class _CacheError extends Error {
@@ -14214,7 +14129,7 @@ Error Description: '${typedError.message}'`, this.correlationId);
14214
14129
  }
14215
14130
  } catch (e) {
14216
14131
  this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`, correlationId);
14217
- if (e instanceof AuthError) {
14132
+ if (e instanceof AuthError2) {
14218
14133
  throw e;
14219
14134
  } else {
14220
14135
  throw createCacheError(e);
@@ -15224,7 +15139,7 @@ Error Description: '${typedError.message}'`, this.correlationId);
15224
15139
  return this.cache;
15225
15140
  }
15226
15141
  };
15227
- var JoseHeaderError = class _JoseHeaderError extends AuthError {
15142
+ var JoseHeaderError = class _JoseHeaderError extends AuthError2 {
15228
15143
  constructor(errorCode, correlationId, errorMessage) {
15229
15144
  super(errorCode, correlationId, errorMessage);
15230
15145
  this.name = "JoseHeaderError";
@@ -15550,7 +15465,7 @@ Error Description: '${typedError.message}'`, this.correlationId);
15550
15465
  "ui_not_allowed",
15551
15466
  "interrupted_user"
15552
15467
  ];
15553
- var InteractionRequiredAuthError = class _InteractionRequiredAuthError extends AuthError {
15468
+ var InteractionRequiredAuthError = class _InteractionRequiredAuthError extends AuthError2 {
15554
15469
  constructor(errorCode, correlationId, errorMessage, subError, timestamp, traceId, claims, errorNo) {
15555
15470
  super(errorCode, correlationId, errorMessage, subError);
15556
15471
  Object.setPrototypeOf(this, _InteractionRequiredAuthError.prototype);
@@ -15572,7 +15487,7 @@ Error Description: '${typedError.message}'`, this.correlationId);
15572
15487
  function createInteractionRequiredAuthError(errorCode, correlationId, errorMessage) {
15573
15488
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
15574
15489
  }
15575
- var ServerError = class _ServerError extends AuthError {
15490
+ var ServerError = class _ServerError extends AuthError2 {
15576
15491
  constructor(errorCode, correlationId, errorMessage, subError, errorNo, status) {
15577
15492
  super(errorCode, correlationId, errorMessage, subError);
15578
15493
  this.name = "ServerError";
@@ -15985,12 +15900,13 @@ ${serverError}`, correlationId);
15985
15900
  * Performs necessary throttling checks after a network request.
15986
15901
  * @param cacheManager
15987
15902
  * @param thumbprint
15988
- * @param response
15903
+ * @param response - Token response with case-insensitive header names.
15989
15904
  */
15990
15905
  static postProcess(cacheManager, thumbprint, response, correlationId) {
15991
- if (_ThrottlingUtils.checkResponseStatus(response) || _ThrottlingUtils.checkResponseForRetryAfter(response)) {
15906
+ const retryAfter = getRetryAfterHeader(response);
15907
+ if (_ThrottlingUtils.checkResponseStatus(response) || retryAfter !== void 0) {
15992
15908
  const thumbprintValue = {
15993
- throttleTime: _ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
15909
+ throttleTime: _ThrottlingUtils.calculateThrottleTime(parseInt(retryAfter || "")),
15994
15910
  error: response.body.error,
15995
15911
  errorCodes: response.body.error_codes,
15996
15912
  errorMessage: response.body.error_description,
@@ -16008,13 +15924,10 @@ ${serverError}`, correlationId);
16008
15924
  }
16009
15925
  /**
16010
15926
  * Checks a NetworkResponse object's RetryAfter header
16011
- * @param response
15927
+ * @param response - Token response with case-insensitive header names.
16012
15928
  */
16013
15929
  static checkResponseForRetryAfter(response) {
16014
- if (response.headers) {
16015
- return response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) && (response.status < 200 || response.status >= 300);
16016
- }
16017
- return false;
15930
+ return getRetryAfterHeader(response) !== void 0;
16018
15931
  }
16019
15932
  /**
16020
15933
  * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
@@ -16031,7 +15944,13 @@ ${serverError}`, correlationId);
16031
15944
  cacheManager.removeItem(key, request.correlationId);
16032
15945
  }
16033
15946
  };
16034
- var NetworkError = class _NetworkError extends AuthError {
15947
+ function getRetryAfterHeader(response) {
15948
+ if ((response.status < 200 || response.status >= 300) && response.headers) {
15949
+ return getResponseHeader(response.headers, HeaderNames.RETRY_AFTER);
15950
+ }
15951
+ return void 0;
15952
+ }
15953
+ var NetworkError = class _NetworkError extends AuthError2 {
16035
15954
  constructor(error, httpStatus, responseHeaders) {
16036
15955
  super(error.errorCode, error.correlationId, error.errorMessage, error.subError);
16037
15956
  Object.setPrototypeOf(this, _NetworkError.prototype);
@@ -16102,7 +16021,8 @@ ${serverError}`, correlationId);
16102
16021
  let response;
16103
16022
  try {
16104
16023
  response = await invokeAsync(networkClient.sendPostRequestAsync.bind(networkClient), NetworkClientSendPostRequestAsync, logger2, performanceClient, correlationId)(tokenEndpoint, { ...options, correlationId, performanceClient });
16105
- const responseHeaders = response.headers || {};
16024
+ const responseHeaders = normalizeResponseHeaders(response.headers || {});
16025
+ response = { ...response, headers: responseHeaders };
16106
16026
  performanceClient?.addFields({
16107
16027
  refreshTokenSize: response.body.refresh_token?.length || 0,
16108
16028
  httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
@@ -16110,19 +16030,19 @@ ${serverError}`, correlationId);
16110
16030
  }, correlationId);
16111
16031
  } catch (e) {
16112
16032
  if (e instanceof NetworkError) {
16113
- const responseHeaders = e.responseHeaders;
16033
+ const responseHeaders = e.responseHeaders ? normalizeResponseHeaders(e.responseHeaders) : void 0;
16114
16034
  if (responseHeaders) {
16115
16035
  performanceClient?.addFields({
16116
16036
  httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
16117
16037
  requestId: responseHeaders[HeaderNames.X_MS_REQUEST_ID] || "",
16118
- contentTypeHeader: responseHeaders[HeaderNames.CONTENT_TYPE] || void 0,
16119
- contentLengthHeader: responseHeaders[HeaderNames.CONTENT_LENGTH] || void 0,
16038
+ contentTypeHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_TYPE) || void 0,
16039
+ contentLengthHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_LENGTH) || void 0,
16120
16040
  httpStatus: e.httpStatus
16121
16041
  }, correlationId);
16122
16042
  }
16123
16043
  throw e.error;
16124
16044
  }
16125
- if (e instanceof AuthError) {
16045
+ if (e instanceof AuthError2) {
16126
16046
  throw e;
16127
16047
  } else {
16128
16048
  throw createClientAuthError(networkError, correlationId);
@@ -16325,6 +16245,9 @@ ${serverError}`, correlationId);
16325
16245
  if (request.logoutHint) {
16326
16246
  addLogoutHint(parameters, request.logoutHint);
16327
16247
  }
16248
+ if (request.popupOriginCheckDone) {
16249
+ addPopupOriginCheckDone(parameters);
16250
+ }
16328
16251
  if (request.extraQueryParameters) {
16329
16252
  addExtraParameters(parameters, request.extraQueryParameters);
16330
16253
  }
@@ -16429,6 +16352,9 @@ ${serverError}`, correlationId);
16429
16352
  if (authOptions.instanceAware && (!request.extraQueryParameters || !Object.keys(request.extraQueryParameters).includes(INSTANCE_AWARE))) {
16430
16353
  addInstanceAware(parameters);
16431
16354
  }
16355
+ if (request.popupOriginCheckDone) {
16356
+ addPopupOriginCheckDone(parameters);
16357
+ }
16432
16358
  return parameters;
16433
16359
  }
16434
16360
  function getAuthorizeUrl(authority, requestParameters) {
@@ -16558,6 +16484,7 @@ ${serverError}`, correlationId);
16558
16484
  addRedirectUri(parameters, request.redirectUri);
16559
16485
  }
16560
16486
  addScopes(parameters, request.scopes, request.correlationId, true, this.config.authOptions.authority.options.OIDCOptions?.defaultScopes);
16487
+ addResource(parameters, request.resource);
16561
16488
  addGrantType(parameters, GrantType.REFRESH_TOKEN_GRANT);
16562
16489
  addClientInfo(parameters);
16563
16490
  addLibraryInfo(parameters, this.config.libraryInfo);
@@ -16727,7 +16654,7 @@ ${serverError}`, correlationId);
16727
16654
  }
16728
16655
  lastRequests.failedRequests.push(this.apiId, this.correlationId);
16729
16656
  if (error instanceof Error && !!error && error.toString()) {
16730
- if (error instanceof AuthError) {
16657
+ if (error instanceof AuthError2) {
16731
16658
  if (error.subError) {
16732
16659
  lastRequests.errors.push(error.subError);
16733
16660
  } else if (error.errorCode) {
@@ -17382,7 +17309,7 @@ ${serverError}`, correlationId);
17382
17309
  [wwwAuthenticateHeaderMissing]: "A 401 response was received from the Azure Arc Managed Identity, but the www-authenticate header is missing.",
17383
17310
  [wwwAuthenticateHeaderUnsupportedFormat]: "A 401 response was received from the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format."
17384
17311
  };
17385
- var ManagedIdentityError = class _ManagedIdentityError extends AuthError {
17312
+ var ManagedIdentityError = class _ManagedIdentityError extends AuthError2 {
17386
17313
  constructor(errorCode, correlationId) {
17387
17314
  super(errorCode, correlationId, ManagedIdentityErrorMessages[errorCode]);
17388
17315
  this.name = "ManagedIdentityError";
@@ -17458,6 +17385,10 @@ ${serverError}`, correlationId);
17458
17385
  code: "loopback_server_timeout",
17459
17386
  desc: "Timed out waiting for auth code listener to be registered."
17460
17387
  },
17388
+ loopbackServerQueryResponseNotSupported: {
17389
+ code: "loopback_server_query_response_not_supported",
17390
+ desc: "The loopback server received an OAuth response in the URL. Interactive authentication requires form_post."
17391
+ },
17461
17392
  stateNotFoundError: {
17462
17393
  code: "state_not_found",
17463
17394
  desc: "State not found. Please verify that the request originated from msal."
@@ -17469,9 +17400,13 @@ ${serverError}`, correlationId);
17469
17400
  redirectUriNotSupported: {
17470
17401
  code: "redirect_uri_not_supported",
17471
17402
  desc: "RedirectUri is not supported in this scenario. Please remove redirectUri from the request."
17403
+ },
17404
+ unsupportedCcaInstanceAware: {
17405
+ code: "unsupported_cca_instance_aware",
17406
+ desc: "Instance-aware configuration is not supported by ConfidentialClientApplication."
17472
17407
  }
17473
17408
  };
17474
- var NodeAuthError = class _NodeAuthError extends AuthError {
17409
+ var NodeAuthError = class _NodeAuthError extends AuthError2 {
17475
17410
  constructor(errorCode, correlationId, errorMessage) {
17476
17411
  super(errorCode, correlationId, errorMessage);
17477
17412
  this.name = "NodeAuthError";
@@ -17512,6 +17447,12 @@ ${serverError}`, correlationId);
17512
17447
  static createLoopbackServerTimeoutError(correlationId = "") {
17513
17448
  return new _NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, correlationId, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
17514
17449
  }
17450
+ /**
17451
+ * Creates an error thrown if the loopback server receives an OAuth response in a query string.
17452
+ */
17453
+ static createLoopbackServerQueryResponseNotSupportedError() {
17454
+ return new _NodeAuthError(NodeAuthErrorMessage.loopbackServerQueryResponseNotSupported.code, "", NodeAuthErrorMessage.loopbackServerQueryResponseNotSupported.desc);
17455
+ }
17515
17456
  /**
17516
17457
  * Creates an error thrown when the state is not present.
17517
17458
  */
@@ -17530,6 +17471,12 @@ ${serverError}`, correlationId);
17530
17471
  static createRedirectUriNotSupportedError(correlationId = "") {
17531
17472
  return new _NodeAuthError(NodeAuthErrorMessage.redirectUriNotSupported.code, correlationId, NodeAuthErrorMessage.redirectUriNotSupported.desc);
17532
17473
  }
17474
+ /**
17475
+ * Creates an error thrown when instance-aware behavior is requested for a confidential client.
17476
+ */
17477
+ static createUnsupportedCcaInstanceAwareError(correlationId = "") {
17478
+ return new _NodeAuthError(NodeAuthErrorMessage.unsupportedCcaInstanceAware.code, correlationId, NodeAuthErrorMessage.unsupportedCcaInstanceAware.desc);
17479
+ }
17533
17480
  };
17534
17481
  var DEFAULT_AUTH_OPTIONS = {
17535
17482
  clientId: "",
@@ -18593,7 +18540,7 @@ ${serverError}`, correlationId);
18593
18540
  }
18594
18541
  };
18595
18542
  var name = "@azure/msal-node";
18596
- var version = "6.0.1";
18543
+ var version = "7.1.2";
18597
18544
  var BaseClient = class {
18598
18545
  constructor(configuration) {
18599
18546
  this.config = buildClientConfiguration(configuration);
@@ -18743,6 +18690,87 @@ ${serverError}`, correlationId);
18743
18690
  addExtraParameters(parameters, request.extraQueryParameters || {});
18744
18691
  return getAuthorizeUrl(authority, parameters);
18745
18692
  }
18693
+ var activeSilentTokenRequests = /* @__PURE__ */ new WeakMap();
18694
+ function acquireTokenSilentDeduped(owner, logger2, silentRequestKey, correlationId, acquireToken) {
18695
+ const existingRequests = activeSilentTokenRequests.get(owner);
18696
+ const activeRequests = existingRequests || /* @__PURE__ */ new Map();
18697
+ if (!existingRequests) {
18698
+ activeSilentTokenRequests.set(owner, activeRequests);
18699
+ }
18700
+ const inProgressRequest = activeRequests.get(silentRequestKey);
18701
+ if (inProgressRequest) {
18702
+ logger2.verbose("acquireTokenSilent has been called previously, returning the result from the first call", correlationId);
18703
+ return applyCallerCorrelationIdToResult(inProgressRequest, correlationId);
18704
+ }
18705
+ logger2.verbose("acquireTokenSilent called for the first time, storing active request", correlationId);
18706
+ const activeRequest = Promise.resolve().then(acquireToken).finally(() => {
18707
+ activeRequests.delete(silentRequestKey);
18708
+ if (activeRequests.size === 0) {
18709
+ activeSilentTokenRequests.delete(owner);
18710
+ }
18711
+ });
18712
+ activeRequests.set(silentRequestKey, activeRequest);
18713
+ return applyCallerCorrelationIdToResult(activeRequest, correlationId);
18714
+ }
18715
+ function getSilentRequestKey(input) {
18716
+ const { request } = input;
18717
+ const authority = input.requestType === "native" ? request.authority : input.authority;
18718
+ const commonKeyFields = {
18719
+ requestType: input.requestType,
18720
+ clientId: input.requestType === "native" ? input.request.clientId : input.clientId,
18721
+ authority,
18722
+ scopes: canonicalizeRequestValues(request.scopes),
18723
+ claims: request.claims,
18724
+ authenticationScheme: request.authenticationScheme,
18725
+ resourceRequestMethod: request.resourceRequestMethod,
18726
+ resourceRequestUri: request.resourceRequestUri,
18727
+ forceRefresh: request.forceRefresh,
18728
+ redirectUri: request.redirectUri || "",
18729
+ resource: request.resource,
18730
+ extraParameters: canonicalizeRequestValues(request.extraParameters)
18731
+ };
18732
+ if (input.requestType === "native") {
18733
+ return JSON.stringify({
18734
+ ...commonKeyFields,
18735
+ accountId: input.request.accountId,
18736
+ shrNonce: input.request.shrNonce,
18737
+ extraScopesToConsent: canonicalizeRequestValues(input.request.extraScopesToConsent),
18738
+ loginHint: input.request.loginHint,
18739
+ prompt: input.request.prompt
18740
+ });
18741
+ }
18742
+ const nonNativeRequest = input.request;
18743
+ const thumbprint = getRequestThumbprint(input.clientId, { ...nonNativeRequest, authority }, nonNativeRequest.account.homeAccountId);
18744
+ return JSON.stringify({
18745
+ ...thumbprint,
18746
+ ...commonKeyFields,
18747
+ accountTenantId: nonNativeRequest.account.tenantId,
18748
+ accountEnvironment: nonNativeRequest.account.environment,
18749
+ refreshTokenExpirationOffsetSeconds: nonNativeRequest.refreshTokenExpirationOffsetSeconds,
18750
+ extraQueryParameters: canonicalizeRequestValues(nonNativeRequest.extraQueryParameters),
18751
+ skipBrokerClaims: thumbprint.embeddedClientId || nonNativeRequest.extraParameters?.[BROKER_CLIENT_ID] ? nonNativeRequest.skipBrokerClaims : void 0
18752
+ });
18753
+ }
18754
+ function snapshotNativeRequest(request) {
18755
+ return {
18756
+ ...request,
18757
+ scopes: [...request.scopes],
18758
+ extraParameters: request.extraParameters ? { ...request.extraParameters } : void 0,
18759
+ extraScopesToConsent: request.extraScopesToConsent ? [...request.extraScopesToConsent] : void 0
18760
+ };
18761
+ }
18762
+ function canonicalizeRequestValues(values) {
18763
+ if (Array.isArray(values)) {
18764
+ return Array.from(new Set(values.map((scope) => scope.trim()).filter((scope) => scope.length > 0))).sort();
18765
+ }
18766
+ return values ? Object.keys(values).sort().map((key) => [key, values[key]]) : void 0;
18767
+ }
18768
+ function applyCallerCorrelationIdToResult(activeRequest, correlationId) {
18769
+ return activeRequest.then((result) => ({
18770
+ ...result,
18771
+ correlationId
18772
+ }));
18773
+ }
18746
18774
  var ClientApplication = class {
18747
18775
  /**
18748
18776
  * Constructor for the ClientApplication
@@ -18814,7 +18842,7 @@ ${serverError}`, correlationId);
18814
18842
  this.logger.verbose("Auth code client created", validRequest.correlationId);
18815
18843
  return await authorizationCodeClient.acquireToken(validRequest, ApiId.acquireTokenByCode, validatedAuthCodePayload);
18816
18844
  } catch (e) {
18817
- if (e instanceof AuthError) {
18845
+ if (e instanceof AuthError2) {
18818
18846
  e.correlationId = validRequest.correlationId;
18819
18847
  }
18820
18848
  serverTelemetryManager.cacheFailedRequest(e);
@@ -18843,7 +18871,7 @@ ${serverError}`, correlationId);
18843
18871
  this.logger.verbose("Refresh token client created", validRequest.correlationId);
18844
18872
  return await refreshTokenClient.acquireToken(validRequest, ApiId.acquireTokenByRefreshToken);
18845
18873
  } catch (e) {
18846
- if (e instanceof AuthError) {
18874
+ if (e instanceof AuthError2) {
18847
18875
  e.correlationId = validRequest.correlationId;
18848
18876
  }
18849
18877
  serverTelemetryManager.cacheFailedRequest(e);
@@ -18855,6 +18883,7 @@ ${serverError}`, correlationId);
18855
18883
  *
18856
18884
  * This API expects the user to provide an account object and looks into the cache to retrieve the token if present.
18857
18885
  * There is also an optional "forceRefresh" boolean the user can send to bypass the cache for access_token and id_token.
18886
+ * Concurrent requests with the same request thumbprint return the same in-progress result.
18858
18887
  * In case the refresh_token is expired or not found, an error is thrown
18859
18888
  * and the guidance is for the user to call any interactive token acquisition API (eg: `acquireTokenByCode()`).
18860
18889
  */
@@ -18864,9 +18893,22 @@ ${serverError}`, correlationId);
18864
18893
  ...await this.initializeBaseRequest(request),
18865
18894
  forceRefresh: request.forceRefresh || false
18866
18895
  };
18896
+ if (!validRequest.account) {
18897
+ return this.acquireTokenSilentAsync(validRequest, request.azureCloudOptions);
18898
+ }
18899
+ const authorityForThumbprint = Authority.generateAuthority(validRequest.authority, request.azureCloudOptions || this.config.auth.azureCloudOptions);
18900
+ const silentRequestKey = getSilentRequestKey({
18901
+ requestType: "non-native",
18902
+ request: validRequest,
18903
+ authority: authorityForThumbprint,
18904
+ clientId: this.config.auth.clientId
18905
+ });
18906
+ return acquireTokenSilentDeduped(this, this.logger, silentRequestKey, validRequest.correlationId, () => this.acquireTokenSilentAsync(validRequest, request.azureCloudOptions));
18907
+ }
18908
+ async acquireTokenSilentAsync(validRequest, azureCloudOptions) {
18867
18909
  const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent, validRequest.correlationId, validRequest.forceRefresh);
18868
18910
  try {
18869
- const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, void 0, request.azureCloudOptions);
18911
+ const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, void 0, azureCloudOptions);
18870
18912
  const clientConfiguration = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, validRequest.redirectUri || "", serverTelemetryManager);
18871
18913
  const silentFlowClient = new SilentFlowClient(clientConfiguration, new StubPerformanceClient());
18872
18914
  this.logger.verbose("Silent flow client created", validRequest.correlationId);
@@ -18881,7 +18923,7 @@ ${serverError}`, correlationId);
18881
18923
  throw error;
18882
18924
  }
18883
18925
  } catch (error) {
18884
- if (error instanceof AuthError) {
18926
+ if (error instanceof AuthError2) {
18885
18927
  error.correlationId = validRequest.correlationId;
18886
18928
  }
18887
18929
  serverTelemetryManager.cacheFailedRequest(error);
@@ -18928,7 +18970,7 @@ ${serverError}`, correlationId);
18928
18970
  this.logger.verbose("Username password client created", validRequest.correlationId);
18929
18971
  return await usernamePasswordClient.acquireToken(validRequest);
18930
18972
  } catch (e) {
18931
- if (e instanceof AuthError) {
18973
+ if (e instanceof AuthError2) {
18932
18974
  e.correlationId = validRequest.correlationId;
18933
18975
  }
18934
18976
  serverTelemetryManager.cacheFailedRequest(e);
@@ -19130,16 +19172,9 @@ ${serverError}`, correlationId);
19130
19172
  res.end();
19131
19173
  return;
19132
19174
  }
19133
- if (authCodeResponse.code) {
19134
- res.writeHead(HTTP_REDIRECT, {
19135
- location: redirectUri
19136
- });
19137
- res.end();
19138
- }
19139
- if (authCodeResponse.error) {
19140
- res.end(errorTemplate || `Error occurred: ${authCodeResponse.error}`);
19141
- }
19142
- resolve(authCodeResponse);
19175
+ res.writeHead(400);
19176
+ res.end("OAuth responses must use form_post and cannot be returned in the URL.");
19177
+ reject(NodeAuthError.createLoopbackServerQueryResponseNotSupportedError());
19143
19178
  } else {
19144
19179
  res.writeHead(200);
19145
19180
  res.end();
@@ -19457,7 +19492,7 @@ ${serverError}`, correlationId);
19457
19492
  this.logger.verbose("Device code client created", validRequest.correlationId);
19458
19493
  return await deviceCodeClient.acquireToken(validRequest);
19459
19494
  } catch (e) {
19460
- if (e instanceof AuthError) {
19495
+ if (e instanceof AuthError2) {
19461
19496
  e.correlationId = validRequest.correlationId;
19462
19497
  }
19463
19498
  serverTelemetryManager.cacheFailedRequest(e);
@@ -19497,8 +19532,8 @@ ${serverError}`, correlationId);
19497
19532
  }
19498
19533
  const { verifier, challenge } = await this.cryptoProvider.generatePkceCodes();
19499
19534
  const loopbackClient = new LoopbackClient(preferredPort);
19500
- const responseMode = remainingProperties.responseMode ?? ResponseMode$1.FORM_POST;
19501
- if (responseMode !== ResponseMode$1.QUERY && responseMode !== ResponseMode$1.FORM_POST) {
19535
+ const responseMode = remainingProperties.responseMode;
19536
+ if (responseMode !== void 0 && responseMode !== ResponseMode$1.FORM_POST) {
19502
19537
  throw createClientConfigurationError(invalidResponseMode, correlationId);
19503
19538
  }
19504
19539
  let authCodeResponse = {};
@@ -19515,7 +19550,7 @@ ${serverError}`, correlationId);
19515
19550
  correlationId,
19516
19551
  scopes: request.scopes || OIDC_DEFAULT_SCOPES,
19517
19552
  redirectUri,
19518
- responseMode,
19553
+ responseMode: ResponseMode$1.FORM_POST,
19519
19554
  codeChallenge: challenge,
19520
19555
  codeChallengeMethod: CodeChallengeMethodValues.S256
19521
19556
  };
@@ -19552,7 +19587,8 @@ ${serverError}`, correlationId);
19552
19587
  this.logger.trace("acquireTokenSilent called", correlationId);
19553
19588
  enforceResourceParameter(this.config.auth.isMcp, request);
19554
19589
  if (this.nativeBrokerPlugin) {
19555
- const brokerRequest = {
19590
+ const nativeBrokerPlugin = this.nativeBrokerPlugin;
19591
+ const brokerRequest = snapshotNativeRequest({
19556
19592
  ...request,
19557
19593
  clientId: this.config.auth.clientId,
19558
19594
  scopes: request.scopes || OIDC_DEFAULT_SCOPES,
@@ -19566,8 +19602,12 @@ ${serverError}`, correlationId);
19566
19602
  },
19567
19603
  accountId: request.account.nativeAccountId,
19568
19604
  forceRefresh: request.forceRefresh || false
19569
- };
19570
- return this.nativeBrokerPlugin.acquireTokenSilent(brokerRequest);
19605
+ });
19606
+ const silentRequestKey = getSilentRequestKey({
19607
+ requestType: "native",
19608
+ request: brokerRequest
19609
+ });
19610
+ return acquireTokenSilentDeduped(this, this.logger, silentRequestKey, correlationId, () => nativeBrokerPlugin.acquireTokenSilent(brokerRequest));
19571
19611
  }
19572
19612
  if (request.redirectUri) {
19573
19613
  if (!this.config.broker.nativeBrokerPlugin) {
@@ -19641,7 +19681,7 @@ ${serverError}`, correlationId);
19641
19681
  resolve(r);
19642
19682
  return;
19643
19683
  } catch (e) {
19644
- if (e instanceof AuthError && e.errorCode === NodeAuthErrorMessage.noLoopbackServerExists.code) {
19684
+ if (e instanceof AuthError2 && e.errorCode === NodeAuthErrorMessage.noLoopbackServerExists.code) {
19645
19685
  ticks++;
19646
19686
  return;
19647
19687
  }
@@ -20164,6 +20204,9 @@ ${serverError}`, correlationId);
20164
20204
  * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
20165
20205
  */
20166
20206
  constructor(configuration) {
20207
+ if ("instanceAware" in configuration.auth && configuration.auth.instanceAware === true) {
20208
+ throw NodeAuthError.createUnsupportedCcaInstanceAwareError();
20209
+ }
20167
20210
  super(configuration);
20168
20211
  const clientSecretNotEmpty = !!this.config.auth.clientSecret;
20169
20212
  const clientAssertionNotEmpty = !!this.config.auth.clientAssertion;
@@ -20194,6 +20237,26 @@ ${serverError}`, correlationId);
20194
20237
  }
20195
20238
  this.appTokenProvider = void 0;
20196
20239
  }
20240
+ /**
20241
+ * Creates the URL of the authorization request.
20242
+ */
20243
+ async getAuthCodeUrl(request) {
20244
+ if (request.extraQueryParameters && Object.prototype.hasOwnProperty.call(request.extraQueryParameters, "instance_aware")) {
20245
+ throw NodeAuthError.createUnsupportedCcaInstanceAwareError(request.correlationId);
20246
+ }
20247
+ return super.getAuthCodeUrl(request);
20248
+ }
20249
+ /**
20250
+ * Acquires a token by exchanging an authorization code.
20251
+ */
20252
+ async acquireTokenByCode(request, authCodePayload) {
20253
+ const sanitizedAuthCodePayload = authCodePayload ? {
20254
+ code: request.code,
20255
+ state: authCodePayload.state,
20256
+ nonce: request.nonce
20257
+ } : void 0;
20258
+ return super.acquireTokenByCode(request, sanitizedAuthCodePayload);
20259
+ }
20197
20260
  /**
20198
20261
  * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
20199
20262
  * is meant for Azure SDK to enhance Managed Identity support.
@@ -20255,7 +20318,7 @@ ${serverError}`, correlationId);
20255
20318
  this.logger.verbose("Client credential client created", validRequest.correlationId);
20256
20319
  return await clientCredentialClient.acquireToken(validRequest);
20257
20320
  } catch (e) {
20258
- if (e instanceof AuthError) {
20321
+ if (e instanceof AuthError2) {
20259
20322
  e.correlationId = validRequest.correlationId;
20260
20323
  }
20261
20324
  serverTelemetryManager.cacheFailedRequest(e);
@@ -20286,7 +20349,7 @@ ${serverError}`, correlationId);
20286
20349
  this.logger.verbose("On behalf of client created", validRequest.correlationId);
20287
20350
  return await oboClient.acquireToken(validRequest);
20288
20351
  } catch (e) {
20289
- if (e instanceof AuthError) {
20352
+ if (e instanceof AuthError2) {
20290
20353
  e.correlationId = validRequest.correlationId;
20291
20354
  }
20292
20355
  throw e;
@@ -20333,7 +20396,7 @@ ${serverError}`, correlationId);
20333
20396
  this.logger.verbose("UserFederatedIdentityCredential client created", validRequest.correlationId);
20334
20397
  return await ficClient.acquireToken(validRequest);
20335
20398
  } catch (e) {
20336
- if (e instanceof AuthError) {
20399
+ if (e instanceof AuthError2) {
20337
20400
  e.correlationId = validRequest.correlationId;
20338
20401
  }
20339
20402
  serverTelemetryManager.cacheFailedRequest(e);
@@ -20507,7 +20570,7 @@ ${serverError}`, correlationId);
20507
20570
  response = await networkClientHelper.sendGetRequestAsync(networkRequest.computeUri(), networkRequestOptions);
20508
20571
  }
20509
20572
  } catch (error) {
20510
- if (error instanceof AuthError) {
20573
+ if (error instanceof AuthError2) {
20511
20574
  throw error;
20512
20575
  } else {
20513
20576
  throw createClientAuthError(networkError, managedIdentityRequest.correlationId);
@@ -20898,7 +20961,7 @@ ${serverError}`, correlationId);
20898
20961
  throw createManagedIdentityError(platformNotSupported, "");
20899
20962
  }
20900
20963
  const expectedSecretFilePath = SUPPORTED_AZURE_ARC_PLATFORMS[process.platform];
20901
- const fileName = path2.basename(secretFilePath);
20964
+ const fileName = path3.basename(secretFilePath);
20902
20965
  if (!fileName.endsWith(".key")) {
20903
20966
  throw createManagedIdentityError(invalidFileExtension, "");
20904
20967
  }
@@ -20926,7 +20989,7 @@ ${serverError}`, correlationId);
20926
20989
  try {
20927
20990
  retryResponse = await networkClient.sendGetRequestAsync(networkRequest.computeUri(), networkRequestOptions);
20928
20991
  } catch (error) {
20929
- if (error instanceof AuthError) {
20992
+ if (error instanceof AuthError2) {
20930
20993
  throw error;
20931
20994
  } else {
20932
20995
  throw createClientAuthError(networkError, "");
@@ -21568,7 +21631,7 @@ ${serverError}`, correlationId);
21568
21631
  };
21569
21632
  var PromptValue = PromptValue$1;
21570
21633
  var ResponseMode = ResponseMode$1;
21571
- exports2.AuthError = AuthError;
21634
+ exports2.AuthError = AuthError2;
21572
21635
  exports2.AuthErrorCodes = AuthErrorCodes;
21573
21636
  exports2.AzureCloudInstance = AzureCloudInstance;
21574
21637
  exports2.ClientAssertion = ClientAssertion;
@@ -22470,11 +22533,9 @@ var require_commonjs4 = __commonJS({
22470
22533
  // node_modules/@azure/identity/dist/commonjs/msal/msal.js
22471
22534
  var require_msal = __commonJS({
22472
22535
  "node_modules/@azure/identity/dist/commonjs/msal/msal.js"(exports2, module2) {
22473
- var __create2 = Object.create;
22474
22536
  var __defProp2 = Object.defineProperty;
22475
22537
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
22476
22538
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
22477
- var __getProtoOf2 = Object.getPrototypeOf;
22478
22539
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
22479
22540
  var __export2 = (target, all) => {
22480
22541
  for (var name in all)
@@ -22488,21 +22549,14 @@ var require_msal = __commonJS({
22488
22549
  }
22489
22550
  return to;
22490
22551
  };
22491
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
22492
- // If the importer is in node compatibility mode or this is not an ESM
22493
- // file that has been converted to a CommonJS file using a Babel-
22494
- // compatible transform (i.e. "__esModule" has not been set), then set
22495
- // "default" to the CommonJS "module.exports" for node compatibility.
22496
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
22497
- mod
22498
- ));
22499
22552
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
22500
22553
  var msal_exports = {};
22501
22554
  __export2(msal_exports, {
22502
- msalCommon: () => msalCommon
22555
+ AuthError: () => import_msal_node.AuthError,
22556
+ LogLevel: () => import_msal_node.LogLevel
22503
22557
  });
22504
22558
  module2.exports = __toCommonJS2(msal_exports);
22505
- var msalCommon = __toESM2(require_msal_node());
22559
+ var import_msal_node = require_msal_node();
22506
22560
  }
22507
22561
  });
22508
22562
 
@@ -22532,7 +22586,6 @@ var require_utils3 = __commonJS({
22532
22586
  deserializeAuthenticationRecord: () => deserializeAuthenticationRecord2,
22533
22587
  ensureValidMsalToken: () => ensureValidMsalToken,
22534
22588
  getAuthority: () => getAuthority,
22535
- getAuthorityHost: () => getAuthorityHost,
22536
22589
  getKnownAuthorities: () => getKnownAuthorities,
22537
22590
  getMSALLogLevel: () => getMSALLogLevel,
22538
22591
  handleMsalError: () => handleMsalError,
@@ -22569,13 +22622,6 @@ var require_utils3 = __commonJS({
22569
22622
  throw error(`Response had no "accessToken" property.`);
22570
22623
  }
22571
22624
  }
22572
- function getAuthorityHost(options) {
22573
- let authorityHost = options?.authorityHost;
22574
- if (!authorityHost && import_core_util.isNodeLike) {
22575
- authorityHost = process.env.AZURE_AUTHORITY_HOST;
22576
- }
22577
- return authorityHost ?? import_constants.DefaultAuthorityHost;
22578
- }
22579
22625
  function getAuthority(tenantId, host) {
22580
22626
  if (!host) {
22581
22627
  host = import_constants.DefaultAuthorityHost;
@@ -22595,21 +22641,21 @@ var require_utils3 = __commonJS({
22595
22641
  }
22596
22642
  return [];
22597
22643
  }
22598
- var defaultLoggerCallback = (credLogger, platform2 = import_core_util.isNode ? "Node" : "Browser") => (level, message, containsPii) => {
22644
+ var defaultLoggerCallback = (credLogger, platform2 = import_core_util.isNodeLike ? "Node" : "Browser") => (level, message, containsPii) => {
22599
22645
  if (containsPii) {
22600
22646
  return;
22601
22647
  }
22602
22648
  switch (level) {
22603
- case import_msal.msalCommon.LogLevel.Error:
22649
+ case import_msal.LogLevel.Error:
22604
22650
  credLogger.info(`MSAL ${platform2} V2 error: ${message}`);
22605
22651
  return;
22606
- case import_msal.msalCommon.LogLevel.Info:
22652
+ case import_msal.LogLevel.Info:
22607
22653
  credLogger.info(`MSAL ${platform2} V2 info message: ${message}`);
22608
22654
  return;
22609
- case import_msal.msalCommon.LogLevel.Verbose:
22655
+ case import_msal.LogLevel.Verbose:
22610
22656
  credLogger.info(`MSAL ${platform2} V2 verbose message: ${message}`);
22611
22657
  return;
22612
- case import_msal.msalCommon.LogLevel.Warning:
22658
+ case import_msal.LogLevel.Warning:
22613
22659
  credLogger.info(`MSAL ${platform2} V2 warning: ${message}`);
22614
22660
  return;
22615
22661
  }
@@ -22617,15 +22663,15 @@ var require_utils3 = __commonJS({
22617
22663
  function getMSALLogLevel(logLevel) {
22618
22664
  switch (logLevel) {
22619
22665
  case "error":
22620
- return import_msal.msalCommon.LogLevel.Error;
22666
+ return import_msal.LogLevel.Error;
22621
22667
  case "info":
22622
- return import_msal.msalCommon.LogLevel.Info;
22668
+ return import_msal.LogLevel.Info;
22623
22669
  case "verbose":
22624
- return import_msal.msalCommon.LogLevel.Verbose;
22670
+ return import_msal.LogLevel.Verbose;
22625
22671
  case "warning":
22626
- return import_msal.msalCommon.LogLevel.Warning;
22672
+ return import_msal.LogLevel.Warning;
22627
22673
  default:
22628
- return import_msal.msalCommon.LogLevel.Info;
22674
+ return import_msal.LogLevel.Info;
22629
22675
  }
22630
22676
  }
22631
22677
  function randomUUID2() {
@@ -22664,7 +22710,12 @@ var require_utils3 = __commonJS({
22664
22710
  );
22665
22711
  return error;
22666
22712
  }
22667
- return new import_errors.AuthenticationRequiredError({ scopes, getTokenOptions, message: error.message });
22713
+ return new import_errors.AuthenticationRequiredError({
22714
+ scopes,
22715
+ getTokenOptions,
22716
+ message: error.message,
22717
+ cause: error
22718
+ });
22668
22719
  }
22669
22720
  function publicToMsal(account) {
22670
22721
  return {
@@ -23128,13 +23179,13 @@ function __disposeResources(env) {
23128
23179
  }
23129
23180
  return next();
23130
23181
  }
23131
- function __rewriteRelativeImportExtension(path2, preserveJsx) {
23132
- if (typeof path2 === "string" && /^\.\.?\//.test(path2)) {
23133
- return path2.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
23182
+ function __rewriteRelativeImportExtension(path3, preserveJsx) {
23183
+ if (typeof path3 === "string" && /^\.\.?\//.test(path3)) {
23184
+ return path3.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
23134
23185
  return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
23135
23186
  });
23136
23187
  }
23137
- return path2;
23188
+ return path3;
23138
23189
  }
23139
23190
  var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
23140
23191
  var init_tslib_es6 = __esm({
@@ -24565,8 +24616,8 @@ var require_inspect = __commonJS({
24565
24616
  custom: () => custom
24566
24617
  });
24567
24618
  module2.exports = __toCommonJS2(inspect_exports);
24568
- var import_node_util6 = require("node:util");
24569
- var custom = import_node_util6.inspect.custom;
24619
+ var import_node_util7 = require("node:util");
24620
+ var custom = import_node_util7.inspect.custom;
24570
24621
  }
24571
24622
  });
24572
24623
 
@@ -25166,19 +25217,19 @@ var require_userAgentPlatform = __commonJS({
25166
25217
  });
25167
25218
  module2.exports = __toCommonJS2(userAgentPlatform_exports);
25168
25219
  var import_node_os2 = __toESM2(require("node:os"));
25169
- var import_node_process8 = __toESM2(require("node:process"));
25220
+ var import_node_process9 = __toESM2(require("node:process"));
25170
25221
  function getHeaderName() {
25171
25222
  return "User-Agent";
25172
25223
  }
25173
25224
  async function setPlatformSpecificData2(map) {
25174
- if (import_node_process8.default && import_node_process8.default.versions) {
25225
+ if (import_node_process9.default && import_node_process9.default.versions) {
25175
25226
  const osInfo = `${import_node_os2.default.type()} ${import_node_os2.default.release()}; ${import_node_os2.default.arch()}`;
25176
- if (import_node_process8.default.versions.bun) {
25177
- map.set("Bun", `${import_node_process8.default.versions.bun} (${osInfo})`);
25178
- } else if (import_node_process8.default.versions.deno) {
25179
- map.set("Deno", `${import_node_process8.default.versions.deno} (${osInfo})`);
25180
- } else if (import_node_process8.default.versions.node) {
25181
- map.set("Node", `${import_node_process8.default.versions.node} (${osInfo})`);
25227
+ if (import_node_process9.default.versions.bun) {
25228
+ map.set("Bun", `${import_node_process9.default.versions.bun} (${osInfo})`);
25229
+ } else if (import_node_process9.default.versions.deno) {
25230
+ map.set("Deno", `${import_node_process9.default.versions.deno} (${osInfo})`);
25231
+ } else if (import_node_process9.default.versions.node) {
25232
+ map.set("Node", `${import_node_process9.default.versions.node} (${osInfo})`);
25182
25233
  }
25183
25234
  }
25184
25235
  }
@@ -25918,122 +25969,6 @@ var require_tlsPolicy = __commonJS({
25918
25969
  }
25919
25970
  });
25920
25971
 
25921
- // node_modules/https-proxy-agent/node_modules/ms/index.js
25922
- var require_ms3 = __commonJS({
25923
- "node_modules/https-proxy-agent/node_modules/ms/index.js"(exports2, module2) {
25924
- var s = 1e3;
25925
- var m = s * 60;
25926
- var h = m * 60;
25927
- var d = h * 24;
25928
- var w = d * 7;
25929
- var y = d * 365.25;
25930
- module2.exports = function(val, options) {
25931
- options = options || {};
25932
- var type = typeof val;
25933
- if (type === "string" && val.length > 0) {
25934
- return parse(val);
25935
- } else if (type === "number" && isFinite(val)) {
25936
- return options.long ? fmtLong(val) : fmtShort(val);
25937
- }
25938
- throw new Error(
25939
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
25940
- );
25941
- };
25942
- function parse(str) {
25943
- str = String(str);
25944
- if (str.length > 100) {
25945
- return;
25946
- }
25947
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
25948
- str
25949
- );
25950
- if (!match) {
25951
- return;
25952
- }
25953
- var n = parseFloat(match[1]);
25954
- var type = (match[2] || "ms").toLowerCase();
25955
- switch (type) {
25956
- case "years":
25957
- case "year":
25958
- case "yrs":
25959
- case "yr":
25960
- case "y":
25961
- return n * y;
25962
- case "weeks":
25963
- case "week":
25964
- case "w":
25965
- return n * w;
25966
- case "days":
25967
- case "day":
25968
- case "d":
25969
- return n * d;
25970
- case "hours":
25971
- case "hour":
25972
- case "hrs":
25973
- case "hr":
25974
- case "h":
25975
- return n * h;
25976
- case "minutes":
25977
- case "minute":
25978
- case "mins":
25979
- case "min":
25980
- case "m":
25981
- return n * m;
25982
- case "seconds":
25983
- case "second":
25984
- case "secs":
25985
- case "sec":
25986
- case "s":
25987
- return n * s;
25988
- case "milliseconds":
25989
- case "millisecond":
25990
- case "msecs":
25991
- case "msec":
25992
- case "ms":
25993
- return n;
25994
- default:
25995
- return void 0;
25996
- }
25997
- }
25998
- function fmtShort(ms) {
25999
- var msAbs = Math.abs(ms);
26000
- if (msAbs >= d) {
26001
- return Math.round(ms / d) + "d";
26002
- }
26003
- if (msAbs >= h) {
26004
- return Math.round(ms / h) + "h";
26005
- }
26006
- if (msAbs >= m) {
26007
- return Math.round(ms / m) + "m";
26008
- }
26009
- if (msAbs >= s) {
26010
- return Math.round(ms / s) + "s";
26011
- }
26012
- return ms + "ms";
26013
- }
26014
- function fmtLong(ms) {
26015
- var msAbs = Math.abs(ms);
26016
- if (msAbs >= d) {
26017
- return plural(ms, msAbs, d, "day");
26018
- }
26019
- if (msAbs >= h) {
26020
- return plural(ms, msAbs, h, "hour");
26021
- }
26022
- if (msAbs >= m) {
26023
- return plural(ms, msAbs, m, "minute");
26024
- }
26025
- if (msAbs >= s) {
26026
- return plural(ms, msAbs, s, "second");
26027
- }
26028
- return ms + " ms";
26029
- }
26030
- function plural(ms, msAbs, n, name) {
26031
- var isPlural = msAbs >= n * 1.5;
26032
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
26033
- }
26034
- }
26035
- });
26036
-
26037
25972
  // node_modules/https-proxy-agent/node_modules/debug/src/common.js
26038
25973
  var require_common2 = __commonJS({
26039
25974
  "node_modules/https-proxy-agent/node_modules/debug/src/common.js"(exports2, module2) {
@@ -26044,7 +25979,7 @@ var require_common2 = __commonJS({
26044
25979
  createDebug.disable = disable;
26045
25980
  createDebug.enable = enable;
26046
25981
  createDebug.enabled = enabled;
26047
- createDebug.humanize = require_ms3();
25982
+ createDebug.humanize = require_ms();
26048
25983
  createDebug.destroy = destroy;
26049
25984
  Object.keys(env).forEach((key) => {
26050
25985
  createDebug[key] = env[key];
@@ -27038,122 +26973,6 @@ var require_dist2 = __commonJS({
27038
26973
  }
27039
26974
  });
27040
26975
 
27041
- // node_modules/http-proxy-agent/node_modules/ms/index.js
27042
- var require_ms4 = __commonJS({
27043
- "node_modules/http-proxy-agent/node_modules/ms/index.js"(exports2, module2) {
27044
- var s = 1e3;
27045
- var m = s * 60;
27046
- var h = m * 60;
27047
- var d = h * 24;
27048
- var w = d * 7;
27049
- var y = d * 365.25;
27050
- module2.exports = function(val, options) {
27051
- options = options || {};
27052
- var type = typeof val;
27053
- if (type === "string" && val.length > 0) {
27054
- return parse(val);
27055
- } else if (type === "number" && isFinite(val)) {
27056
- return options.long ? fmtLong(val) : fmtShort(val);
27057
- }
27058
- throw new Error(
27059
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
27060
- );
27061
- };
27062
- function parse(str) {
27063
- str = String(str);
27064
- if (str.length > 100) {
27065
- return;
27066
- }
27067
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
27068
- str
27069
- );
27070
- if (!match) {
27071
- return;
27072
- }
27073
- var n = parseFloat(match[1]);
27074
- var type = (match[2] || "ms").toLowerCase();
27075
- switch (type) {
27076
- case "years":
27077
- case "year":
27078
- case "yrs":
27079
- case "yr":
27080
- case "y":
27081
- return n * y;
27082
- case "weeks":
27083
- case "week":
27084
- case "w":
27085
- return n * w;
27086
- case "days":
27087
- case "day":
27088
- case "d":
27089
- return n * d;
27090
- case "hours":
27091
- case "hour":
27092
- case "hrs":
27093
- case "hr":
27094
- case "h":
27095
- return n * h;
27096
- case "minutes":
27097
- case "minute":
27098
- case "mins":
27099
- case "min":
27100
- case "m":
27101
- return n * m;
27102
- case "seconds":
27103
- case "second":
27104
- case "secs":
27105
- case "sec":
27106
- case "s":
27107
- return n * s;
27108
- case "milliseconds":
27109
- case "millisecond":
27110
- case "msecs":
27111
- case "msec":
27112
- case "ms":
27113
- return n;
27114
- default:
27115
- return void 0;
27116
- }
27117
- }
27118
- function fmtShort(ms) {
27119
- var msAbs = Math.abs(ms);
27120
- if (msAbs >= d) {
27121
- return Math.round(ms / d) + "d";
27122
- }
27123
- if (msAbs >= h) {
27124
- return Math.round(ms / h) + "h";
27125
- }
27126
- if (msAbs >= m) {
27127
- return Math.round(ms / m) + "m";
27128
- }
27129
- if (msAbs >= s) {
27130
- return Math.round(ms / s) + "s";
27131
- }
27132
- return ms + "ms";
27133
- }
27134
- function fmtLong(ms) {
27135
- var msAbs = Math.abs(ms);
27136
- if (msAbs >= d) {
27137
- return plural(ms, msAbs, d, "day");
27138
- }
27139
- if (msAbs >= h) {
27140
- return plural(ms, msAbs, h, "hour");
27141
- }
27142
- if (msAbs >= m) {
27143
- return plural(ms, msAbs, m, "minute");
27144
- }
27145
- if (msAbs >= s) {
27146
- return plural(ms, msAbs, s, "second");
27147
- }
27148
- return ms + " ms";
27149
- }
27150
- function plural(ms, msAbs, n, name) {
27151
- var isPlural = msAbs >= n * 1.5;
27152
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
27153
- }
27154
- }
27155
- });
27156
-
27157
26976
  // node_modules/http-proxy-agent/node_modules/debug/src/common.js
27158
26977
  var require_common3 = __commonJS({
27159
26978
  "node_modules/http-proxy-agent/node_modules/debug/src/common.js"(exports2, module2) {
@@ -27164,7 +26983,7 @@ var require_common3 = __commonJS({
27164
26983
  createDebug.disable = disable;
27165
26984
  createDebug.enable = enable;
27166
26985
  createDebug.enabled = enabled;
27167
- createDebug.humanize = require_ms4();
26986
+ createDebug.humanize = require_ms();
27168
26987
  createDebug.destroy = destroy;
27169
26988
  Object.keys(env).forEach((key) => {
27170
26989
  createDebug[key] = env[key];
@@ -29504,8 +29323,8 @@ var require_getClient = __commonJS({
29504
29323
  const noDefaultAcceptHeader = clientOptions.internal?.noDefaultAcceptHeader ?? false;
29505
29324
  const { allowInsecureConnection, httpClient } = clientOptions;
29506
29325
  const endpointUrl = clientOptions.endpoint ?? endpoint;
29507
- const client = (path2, ...args) => {
29508
- const getUrl = (requestOptions) => (0, import_urlHelpers.buildRequestUrl)(endpointUrl, path2, args, { allowInsecureConnection, ...requestOptions });
29326
+ const client = (path3, ...args) => {
29327
+ const getUrl = (requestOptions) => (0, import_urlHelpers.buildRequestUrl)(endpointUrl, path3, args, { allowInsecureConnection, ...requestOptions });
29509
29328
  return {
29510
29329
  get: (requestOptions = {}) => {
29511
29330
  return buildOperation(
@@ -30173,19 +29992,19 @@ var require_userAgentPlatform2 = __commonJS({
30173
29992
  });
30174
29993
  module2.exports = __toCommonJS2(userAgentPlatform_exports);
30175
29994
  var import_node_os2 = __toESM2(require("node:os"));
30176
- var import_node_process8 = __toESM2(require("node:process"));
29995
+ var import_node_process9 = __toESM2(require("node:process"));
30177
29996
  function getHeaderName() {
30178
29997
  return "User-Agent";
30179
29998
  }
30180
29999
  async function setPlatformSpecificData2(map) {
30181
- if (import_node_process8.default && import_node_process8.default.versions) {
30000
+ if (import_node_process9.default && import_node_process9.default.versions) {
30182
30001
  const osInfo = `${import_node_os2.default.type()} ${import_node_os2.default.release()}; ${import_node_os2.default.arch()}`;
30183
- if (import_node_process8.default.versions.bun) {
30184
- map.set("Bun", `${import_node_process8.default.versions.bun} (${osInfo})`);
30185
- } else if (import_node_process8.default.versions.deno) {
30186
- map.set("Deno", `${import_node_process8.default.versions.deno} (${osInfo})`);
30187
- } else if (import_node_process8.default.versions.node) {
30188
- map.set("Node", `${import_node_process8.default.versions.node} (${osInfo})`);
30002
+ if (import_node_process9.default.versions.bun) {
30003
+ map.set("Bun", `${import_node_process9.default.versions.bun} (${osInfo})`);
30004
+ } else if (import_node_process9.default.versions.deno) {
30005
+ map.set("Deno", `${import_node_process9.default.versions.deno} (${osInfo})`);
30006
+ } else if (import_node_process9.default.versions.node) {
30007
+ map.set("Node", `${import_node_process9.default.versions.node} (${osInfo})`);
30189
30008
  }
30190
30009
  }
30191
30010
  }
@@ -32461,15 +32280,15 @@ var require_urlHelpers2 = __commonJS({
32461
32280
  let isAbsolutePath = false;
32462
32281
  let requestUrl = replaceAll(baseUri, urlReplacements);
32463
32282
  if (operationSpec.path) {
32464
- let path2 = replaceAll(operationSpec.path, urlReplacements);
32465
- if (operationSpec.path === "/{nextLink}" && path2.startsWith("/")) {
32466
- path2 = path2.substring(1);
32283
+ let path3 = replaceAll(operationSpec.path, urlReplacements);
32284
+ if (operationSpec.path === "/{nextLink}" && path3.startsWith("/")) {
32285
+ path3 = path3.substring(1);
32467
32286
  }
32468
- if (isAbsoluteUrl(path2)) {
32469
- requestUrl = path2;
32287
+ if (isAbsoluteUrl(path3)) {
32288
+ requestUrl = path3;
32470
32289
  isAbsolutePath = true;
32471
32290
  } else {
32472
- requestUrl = appendPath(requestUrl, path2);
32291
+ requestUrl = appendPath(requestUrl, path3);
32473
32292
  }
32474
32293
  }
32475
32294
  const { queryParams, sequenceParams } = calculateQueryParameters(operationSpec, operationArguments, fallbackObject);
@@ -32515,9 +32334,9 @@ var require_urlHelpers2 = __commonJS({
32515
32334
  }
32516
32335
  const searchStart = pathToAppend.indexOf("?");
32517
32336
  if (searchStart !== -1) {
32518
- const path2 = pathToAppend.substring(0, searchStart);
32337
+ const path3 = pathToAppend.substring(0, searchStart);
32519
32338
  const search = pathToAppend.substring(searchStart + 1);
32520
- newPath = newPath + path2;
32339
+ newPath = newPath + path3;
32521
32340
  if (search) {
32522
32341
  parsedUrl.search = parsedUrl.search ? `${parsedUrl.search}&${search}` : search;
32523
32342
  }
@@ -33130,6 +32949,43 @@ var require_utils5 = __commonJS({
33130
32949
  }
33131
32950
  });
33132
32951
 
32952
+ // node_modules/@azure/identity/dist/commonjs/util/authorityHost.js
32953
+ var require_authorityHost = __commonJS({
32954
+ "node_modules/@azure/identity/dist/commonjs/util/authorityHost.js"(exports2, module2) {
32955
+ var __defProp2 = Object.defineProperty;
32956
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
32957
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
32958
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
32959
+ var __export2 = (target, all) => {
32960
+ for (var name in all)
32961
+ __defProp2(target, name, { get: all[name], enumerable: true });
32962
+ };
32963
+ var __copyProps2 = (to, from, except, desc) => {
32964
+ if (from && typeof from === "object" || typeof from === "function") {
32965
+ for (let key of __getOwnPropNames2(from))
32966
+ if (!__hasOwnProp2.call(to, key) && key !== except)
32967
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
32968
+ }
32969
+ return to;
32970
+ };
32971
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
32972
+ var authorityHost_exports = {};
32973
+ __export2(authorityHost_exports, {
32974
+ getAuthorityHost: () => getAuthorityHost
32975
+ });
32976
+ module2.exports = __toCommonJS2(authorityHost_exports);
32977
+ var import_core_util = require_commonjs4();
32978
+ var import_constants = require_constants();
32979
+ function getAuthorityHost(options) {
32980
+ let authorityHost = options?.authorityHost;
32981
+ if (!authorityHost && import_core_util.isNodeLike) {
32982
+ authorityHost = process.env.AZURE_AUTHORITY_HOST;
32983
+ }
32984
+ return authorityHost ?? import_constants.DefaultAuthorityHost;
32985
+ }
32986
+ }
32987
+ });
32988
+
33133
32989
  // node_modules/@azure/identity/dist/commonjs/client/identityClient.js
33134
32990
  var require_identityClient = __commonJS({
33135
32991
  "node_modules/@azure/identity/dist/commonjs/client/identityClient.js"(exports2, module2) {
@@ -33152,27 +33008,26 @@ var require_identityClient = __commonJS({
33152
33008
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
33153
33009
  var identityClient_exports = {};
33154
33010
  __export2(identityClient_exports, {
33155
- IdentityClient: () => IdentityClient,
33156
- getIdentityClientAuthorityHost: () => getIdentityClientAuthorityHost
33011
+ IdentityClient: () => IdentityClient
33157
33012
  });
33158
33013
  module2.exports = __toCommonJS2(identityClient_exports);
33159
33014
  var import_core_client = require_commonjs7();
33160
- var import_core_util = require_commonjs4();
33161
33015
  var import_core_rest_pipeline = require_commonjs6();
33016
+ var import_core_util = require_commonjs4();
33162
33017
  var import_errors = require_errors2();
33163
33018
  var import_identityTokenEndpoint = require_identityTokenEndpoint();
33164
33019
  var import_constants = require_constants();
33165
33020
  var import_tracing = require_tracing();
33166
33021
  var import_logging = require_logging();
33167
33022
  var import_utils = require_utils5();
33023
+ var import_authorityHost = require_authorityHost();
33168
33024
  var noCorrelationId = "noCorrelationId";
33169
- function getIdentityClientAuthorityHost(options) {
33170
- let authorityHost = options?.authorityHost;
33171
- if (import_core_util.isNode) {
33172
- authorityHost = authorityHost ?? process.env.AZURE_AUTHORITY_HOST;
33173
- }
33174
- return authorityHost ?? import_constants.DefaultAuthorityHost;
33175
- }
33025
+ var HttpStatus = {
33026
+ CLIENT_ERROR_RANGE_START: 400,
33027
+ CLIENT_ERROR_RANGE_END: 499,
33028
+ SERVER_ERROR_RANGE_START: 500,
33029
+ SERVER_ERROR_RANGE_END: 599
33030
+ };
33176
33031
  var IdentityClient = class extends import_core_client.ServiceClient {
33177
33032
  authorityHost;
33178
33033
  allowLoggingAccountIdentifiers;
@@ -33183,7 +33038,7 @@ var require_identityClient = __commonJS({
33183
33038
  constructor(options) {
33184
33039
  const packageDetails = `azsdk-js-identity/${import_constants.SDK_VERSION}`;
33185
33040
  const userAgentPrefix = options?.userAgentOptions?.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`;
33186
- const baseUri = getIdentityClientAuthorityHost(options);
33041
+ const baseUri = (0, import_authorityHost.getAuthorityHost)(options);
33187
33042
  if (!baseUri.startsWith("https:")) {
33188
33043
  throw new Error("The authorityHost address must use the 'https' protocol.");
33189
33044
  }
@@ -33335,7 +33190,7 @@ var require_identityClient = __commonJS({
33335
33190
  const response = await this.sendRequest(request);
33336
33191
  this.logIdentifiers(response);
33337
33192
  return {
33338
- body: response.bodyAsText ? JSON.parse(response.bodyAsText) : void 0,
33193
+ body: this.parseResponseBody(response),
33339
33194
  headers: response.headers.toJSON(),
33340
33195
  status: response.status
33341
33196
  };
@@ -33353,7 +33208,7 @@ var require_identityClient = __commonJS({
33353
33208
  const response = await this.sendRequest(request);
33354
33209
  this.logIdentifiers(response);
33355
33210
  return {
33356
- body: response.bodyAsText ? JSON.parse(response.bodyAsText) : void 0,
33211
+ body: this.parseResponseBody(response),
33357
33212
  headers: response.headers.toJSON(),
33358
33213
  status: response.status
33359
33214
  };
@@ -33390,7 +33245,7 @@ var require_identityClient = __commonJS({
33390
33245
  }
33391
33246
  const base64Metadata = accessToken.split(".")[1];
33392
33247
  const { appid, upn, tid, oid } = JSON.parse(
33393
- Buffer.from(base64Metadata, "base64").toString("utf8")
33248
+ (0, import_core_util.uint8ArrayToString)((0, import_core_util.stringToUint8Array)(base64Metadata, "base64url"), "utf-8")
33394
33249
  );
33395
33250
  import_logging.logger.info(
33396
33251
  `[Authenticated account] Client ID: ${appid}. Tenant ID: ${tid}. User Principal Name: ${upn || unavailableUpn}. Object ID (user): ${oid}`
@@ -33402,6 +33257,41 @@ var require_identityClient = __commonJS({
33402
33257
  );
33403
33258
  }
33404
33259
  }
33260
+ /**
33261
+ * Parses the response body if possible. Add error properties if parsing fails.
33262
+ * This follows MSAL INetworkModule behavior so the response is in expected format.
33263
+ */
33264
+ parseResponseBody(response) {
33265
+ let parsedBody;
33266
+ try {
33267
+ parsedBody = JSON.parse(response.bodyAsText || "");
33268
+ } catch (error) {
33269
+ import_logging.logger.info(`IdentityClient: Could not parse response body: ${error}`);
33270
+ let errorType;
33271
+ let errorDescriptionHelper;
33272
+ if (response.status >= HttpStatus.CLIENT_ERROR_RANGE_START && response.status <= HttpStatus.CLIENT_ERROR_RANGE_END) {
33273
+ errorType = "client_error";
33274
+ errorDescriptionHelper = "A client";
33275
+ } else if (response.status >= HttpStatus.SERVER_ERROR_RANGE_START && response.status <= HttpStatus.SERVER_ERROR_RANGE_END) {
33276
+ errorType = "server_error";
33277
+ errorDescriptionHelper = "A server";
33278
+ } else {
33279
+ errorType = "unknown_error";
33280
+ errorDescriptionHelper = "An unknown";
33281
+ }
33282
+ const errorDescriptionLines = [
33283
+ `${errorDescriptionHelper} error occured.`,
33284
+ `Http status code: ${response.status}`,
33285
+ `Http status message: ${response.bodyAsText || "Unknown"}`,
33286
+ `Headers: ${JSON.stringify(response.headers)}`
33287
+ ];
33288
+ parsedBody = {
33289
+ error: errorType,
33290
+ error_description: errorDescriptionLines.join("\n")
33291
+ };
33292
+ }
33293
+ return parsedBody;
33294
+ }
33405
33295
  };
33406
33296
  }
33407
33297
  });
@@ -33699,14 +33589,80 @@ var init_is_wsl = __esm({
33699
33589
  }
33700
33590
  });
33701
33591
 
33592
+ // node_modules/powershell-utils/index.js
33593
+ var import_node_process2, import_node_buffer, import_node_util, import_node_child_process, execFile2, powerShellPath, argumentsPrefix, encodeCommand, escapeArgument, createArguments, createExecFileOptions, executePowerShell;
33594
+ var init_powershell_utils = __esm({
33595
+ "node_modules/powershell-utils/index.js"() {
33596
+ import_node_process2 = __toESM(require("node:process"), 1);
33597
+ import_node_buffer = require("node:buffer");
33598
+ import_node_util = require("node:util");
33599
+ import_node_child_process = __toESM(require("node:child_process"), 1);
33600
+ execFile2 = (0, import_node_util.promisify)(import_node_child_process.default.execFile);
33601
+ powerShellPath = () => `${import_node_process2.default.env.SYSTEMROOT || import_node_process2.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
33602
+ argumentsPrefix = [
33603
+ "-NoProfile",
33604
+ "-NonInteractive",
33605
+ "-ExecutionPolicy",
33606
+ "Bypass",
33607
+ "-EncodedCommand"
33608
+ ];
33609
+ encodeCommand = (command) => import_node_buffer.Buffer.from(command, "utf16le").toString("base64");
33610
+ escapeArgument = (value) => `'${String(value).replaceAll(/['‘’‚‛]/g, (match) => match + match)}'`;
33611
+ createArguments = (command) => [...argumentsPrefix, encodeCommand(command)];
33612
+ createExecFileOptions = (options) => ({
33613
+ encoding: "utf8",
33614
+ ...options,
33615
+ shell: false
33616
+ });
33617
+ executePowerShell = async (command, options = {}) => {
33618
+ const {
33619
+ powerShellPath: psPath,
33620
+ ...execFileOptions
33621
+ } = options;
33622
+ return execFile2(
33623
+ psPath ?? powerShellPath(),
33624
+ createArguments(command),
33625
+ createExecFileOptions(execFileOptions)
33626
+ );
33627
+ };
33628
+ executePowerShell.argumentsPrefix = argumentsPrefix;
33629
+ executePowerShell.encodeCommand = encodeCommand;
33630
+ executePowerShell.escapeArgument = escapeArgument;
33631
+ executePowerShell.createArguments = createArguments;
33632
+ }
33633
+ });
33634
+
33635
+ // node_modules/wsl-utils/utilities.js
33636
+ function parseMountPointFromConfig(content) {
33637
+ for (const line of content.split("\n")) {
33638
+ if (/^\s*#/.test(line)) {
33639
+ continue;
33640
+ }
33641
+ const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
33642
+ if (!match) {
33643
+ continue;
33644
+ }
33645
+ return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
33646
+ }
33647
+ }
33648
+ var init_utilities = __esm({
33649
+ "node_modules/wsl-utils/utilities.js"() {
33650
+ }
33651
+ });
33652
+
33702
33653
  // node_modules/wsl-utils/index.js
33703
- var import_node_process2, import_promises, wslDrivesMountPoint, powerShellPathFromWsl, powerShellPath;
33654
+ var import_node_path, import_node_util2, import_node_child_process2, import_promises, execFile3, wslDrivesMountPoint, powerShellPathFromWsl, powerShellPath2, canAccessPowerShellPromise, canAccessPowerShell, wslDefaultBrowser, isUrl, convertPath, convertWslPathToWindows;
33704
33655
  var init_wsl_utils = __esm({
33705
33656
  "node_modules/wsl-utils/index.js"() {
33706
- import_node_process2 = __toESM(require("node:process"), 1);
33657
+ import_node_path = __toESM(require("node:path"), 1);
33658
+ import_node_util2 = require("node:util");
33659
+ import_node_child_process2 = __toESM(require("node:child_process"), 1);
33707
33660
  import_promises = __toESM(require("node:fs/promises"), 1);
33708
33661
  init_is_wsl();
33662
+ init_powershell_utils();
33663
+ init_utilities();
33709
33664
  init_is_wsl();
33665
+ execFile3 = (0, import_node_util2.promisify)(import_node_child_process2.default.execFile);
33710
33666
  wslDrivesMountPoint = /* @__PURE__ */ (() => {
33711
33667
  const defaultMountPoint = "/mnt/";
33712
33668
  let mountPoint;
@@ -33725,11 +33681,11 @@ var init_wsl_utils = __esm({
33725
33681
  return defaultMountPoint;
33726
33682
  }
33727
33683
  const configContent = await import_promises.default.readFile(configFilePath, { encoding: "utf8" });
33728
- const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
33729
- if (!configMountPoint) {
33684
+ const parsedMountPoint = parseMountPointFromConfig(configContent);
33685
+ if (parsedMountPoint === void 0) {
33730
33686
  return defaultMountPoint;
33731
33687
  }
33732
- mountPoint = configMountPoint.groups.mountPoint.trim();
33688
+ mountPoint = parsedMountPoint;
33733
33689
  mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
33734
33690
  return mountPoint;
33735
33691
  };
@@ -33738,11 +33694,43 @@ var init_wsl_utils = __esm({
33738
33694
  const mountPoint = await wslDrivesMountPoint();
33739
33695
  return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
33740
33696
  };
33741
- powerShellPath = async () => {
33742
- if (is_wsl_default) {
33743
- return powerShellPathFromWsl();
33697
+ powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
33698
+ canAccessPowerShell = async () => {
33699
+ canAccessPowerShellPromise ??= (async () => {
33700
+ try {
33701
+ const psPath = await powerShellPath2();
33702
+ await import_promises.default.access(psPath, import_promises.constants.X_OK);
33703
+ return true;
33704
+ } catch {
33705
+ return false;
33706
+ }
33707
+ })();
33708
+ return canAccessPowerShellPromise;
33709
+ };
33710
+ wslDefaultBrowser = async () => {
33711
+ const psPath = await powerShellPath2();
33712
+ const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
33713
+ const { stdout } = await executePowerShell(command, {
33714
+ powerShellPath: psPath,
33715
+ cwd: import_node_path.default.dirname(psPath)
33716
+ });
33717
+ return stdout.trim();
33718
+ };
33719
+ isUrl = (path3) => /^[a-z]+:\/\//i.test(path3);
33720
+ convertPath = async (flag, path3) => {
33721
+ const wslpathArguments = path3.startsWith("-") ? [flag, "--", path3] : [flag, path3];
33722
+ try {
33723
+ const { stdout } = await execFile3("wslpath", wslpathArguments, { encoding: "utf8" });
33724
+ return stdout.replace(/\r?\n$/, "") || path3;
33725
+ } catch {
33726
+ return path3;
33744
33727
  }
33745
- return `${import_node_process2.default.env.SYSTEMROOT || import_node_process2.default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
33728
+ };
33729
+ convertWslPathToWindows = async (paths) => {
33730
+ const isBatch = Array.isArray(paths);
33731
+ const pathArray = isBatch ? paths : [paths];
33732
+ const results = await Promise.all(pathArray.map((path3) => isUrl(path3) ? path3 : convertPath("-aw", path3)));
33733
+ return isBatch ? results : results[0];
33746
33734
  };
33747
33735
  }
33748
33736
  });
@@ -33782,13 +33770,13 @@ async function defaultBrowserId() {
33782
33770
  }
33783
33771
  return browserId;
33784
33772
  }
33785
- var import_node_util, import_node_process3, import_node_child_process, execFileAsync;
33773
+ var import_node_util3, import_node_process3, import_node_child_process3, execFileAsync;
33786
33774
  var init_default_browser_id = __esm({
33787
33775
  "node_modules/default-browser-id/index.js"() {
33788
- import_node_util = require("node:util");
33776
+ import_node_util3 = require("node:util");
33789
33777
  import_node_process3 = __toESM(require("node:process"), 1);
33790
- import_node_child_process = require("node:child_process");
33791
- execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
33778
+ import_node_child_process3 = require("node:child_process");
33779
+ execFileAsync = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
33792
33780
  }
33793
33781
  });
33794
33782
 
@@ -33805,13 +33793,13 @@ async function runAppleScript(script, { humanReadableOutput = true, signal } = {
33805
33793
  const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
33806
33794
  return stdout.trim();
33807
33795
  }
33808
- var import_node_process4, import_node_util2, import_node_child_process2, execFileAsync2;
33796
+ var import_node_process4, import_node_util4, import_node_child_process4, execFileAsync2;
33809
33797
  var init_run_applescript = __esm({
33810
33798
  "node_modules/run-applescript/index.js"() {
33811
33799
  import_node_process4 = __toESM(require("node:process"), 1);
33812
- import_node_util2 = require("node:util");
33813
- import_node_child_process2 = require("node:child_process");
33814
- execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
33800
+ import_node_util4 = require("node:util");
33801
+ import_node_child_process4 = require("node:child_process");
33802
+ execFileAsync2 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
33815
33803
  }
33816
33804
  });
33817
33805
 
@@ -33854,13 +33842,13 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
33854
33842
  const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
33855
33843
  return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
33856
33844
  }
33857
- var import_node_process5, import_node_util3, import_node_child_process3, execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
33845
+ var import_node_process5, import_node_util5, import_node_child_process5, execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
33858
33846
  var init_windows = __esm({
33859
33847
  "node_modules/default-browser/windows.js"() {
33860
33848
  import_node_process5 = __toESM(require("node:process"), 1);
33861
- import_node_util3 = require("node:util");
33862
- import_node_child_process3 = require("node:child_process");
33863
- execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
33849
+ import_node_util5 = require("node:util");
33850
+ import_node_child_process5 = require("node:child_process");
33851
+ execFileAsync3 = (0, import_node_util5.promisify)(import_node_child_process5.execFile);
33864
33852
  windowsBrowserProgIds = {
33865
33853
  MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
33866
33854
  // The missing `L` is correct.
@@ -33904,20 +33892,31 @@ async function defaultBrowser2() {
33904
33892
  }
33905
33893
  throw new Error("Only macOS, Linux, and Windows are supported");
33906
33894
  }
33907
- var import_node_util4, import_node_process6, import_node_child_process4, execFileAsync4, titleize;
33895
+ var import_node_util6, import_node_process6, import_node_child_process6, execFileAsync4, titleize;
33908
33896
  var init_default_browser = __esm({
33909
33897
  "node_modules/default-browser/index.js"() {
33910
- import_node_util4 = require("node:util");
33898
+ import_node_util6 = require("node:util");
33911
33899
  import_node_process6 = __toESM(require("node:process"), 1);
33912
- import_node_child_process4 = require("node:child_process");
33900
+ import_node_child_process6 = require("node:child_process");
33913
33901
  init_default_browser_id();
33914
33902
  init_bundle_name();
33915
33903
  init_windows();
33916
- execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
33904
+ init_windows();
33905
+ execFileAsync4 = (0, import_node_util6.promisify)(import_node_child_process6.execFile);
33917
33906
  titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
33918
33907
  }
33919
33908
  });
33920
33909
 
33910
+ // node_modules/is-in-ssh/index.js
33911
+ var import_node_process7, isInSsh, is_in_ssh_default;
33912
+ var init_is_in_ssh = __esm({
33913
+ "node_modules/is-in-ssh/index.js"() {
33914
+ import_node_process7 = __toESM(require("node:process"), 1);
33915
+ isInSsh = Boolean(import_node_process7.default.env.SSH_CONNECTION || import_node_process7.default.env.SSH_CLIENT || import_node_process7.default.env.SSH_TTY);
33916
+ is_in_ssh_default = isInSsh;
33917
+ }
33918
+ });
33919
+
33921
33920
  // node_modules/open/index.js
33922
33921
  var open_exports = {};
33923
33922
  __export(open_exports, {
@@ -33925,31 +33924,6 @@ __export(open_exports, {
33925
33924
  default: () => open_default,
33926
33925
  openApp: () => openApp
33927
33926
  });
33928
- async function getWindowsDefaultBrowserFromWsl() {
33929
- const powershellPath = await powerShellPath();
33930
- const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
33931
- const encodedCommand = import_node_buffer.Buffer.from(rawCommand, "utf16le").toString("base64");
33932
- const { stdout } = await execFile6(
33933
- powershellPath,
33934
- [
33935
- "-NoProfile",
33936
- "-NonInteractive",
33937
- "-ExecutionPolicy",
33938
- "Bypass",
33939
- "-EncodedCommand",
33940
- encodedCommand
33941
- ],
33942
- { encoding: "utf8" }
33943
- );
33944
- const progId = stdout.trim();
33945
- const browserMap = {
33946
- ChromeHTML: "com.google.chrome",
33947
- BraveHTML: "com.brave.Browser",
33948
- MSEdgeHTM: "com.microsoft.edge",
33949
- FirefoxURL: "org.mozilla.firefox"
33950
- };
33951
- return browserMap[progId] ? { id: browserMap[progId] } : {};
33952
- }
33953
33927
  function detectArchBinary(binary) {
33954
33928
  if (typeof binary === "string" || Array.isArray(binary)) {
33955
33929
  return binary;
@@ -33960,7 +33934,7 @@ function detectArchBinary(binary) {
33960
33934
  }
33961
33935
  return archBinary;
33962
33936
  }
33963
- function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
33937
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
33964
33938
  if (wsl && is_wsl_default) {
33965
33939
  return detectArchBinary(wsl);
33966
33940
  }
@@ -33969,35 +33943,38 @@ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
33969
33943
  }
33970
33944
  return detectArchBinary(platformBinary);
33971
33945
  }
33972
- var import_node_process7, import_node_buffer, import_node_path, import_node_url, import_node_util5, import_node_child_process5, import_promises2, import_meta, execFile6, __dirname, localXdgOpenPath, platform, arch, pTryEach, baseOpen, open, openApp, apps, open_default;
33946
+ var import_node_process8, import_node_path2, import_node_url, import_node_child_process7, import_promises2, import_meta, fallbackAttemptSymbol, __dirname, localXdgOpenPath, platform, arch, tryEachApp, baseOpen, open, openApp, apps, open_default;
33973
33947
  var init_open = __esm({
33974
33948
  "node_modules/open/index.js"() {
33975
- import_node_process7 = __toESM(require("node:process"), 1);
33976
- import_node_buffer = require("node:buffer");
33977
- import_node_path = __toESM(require("node:path"), 1);
33949
+ import_node_process8 = __toESM(require("node:process"), 1);
33950
+ import_node_path2 = __toESM(require("node:path"), 1);
33978
33951
  import_node_url = require("node:url");
33979
- import_node_util5 = require("node:util");
33980
- import_node_child_process5 = __toESM(require("node:child_process"), 1);
33952
+ import_node_child_process7 = __toESM(require("node:child_process"), 1);
33981
33953
  import_promises2 = __toESM(require("node:fs/promises"), 1);
33982
33954
  init_wsl_utils();
33955
+ init_powershell_utils();
33983
33956
  init_define_lazy_prop();
33984
33957
  init_default_browser();
33985
33958
  init_is_inside_container();
33959
+ init_is_in_ssh();
33986
33960
  import_meta = {};
33987
- execFile6 = (0, import_node_util5.promisify)(import_node_child_process5.default.execFile);
33988
- __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
33989
- localXdgOpenPath = import_node_path.default.join(__dirname, "xdg-open");
33990
- ({ platform, arch } = import_node_process7.default);
33991
- pTryEach = async (array, mapper) => {
33992
- let latestError;
33993
- for (const item of array) {
33961
+ fallbackAttemptSymbol = /* @__PURE__ */ Symbol("fallbackAttempt");
33962
+ __dirname = import_meta.url ? import_node_path2.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url)) : "";
33963
+ localXdgOpenPath = import_node_path2.default.join(__dirname, "xdg-open");
33964
+ ({ platform, arch } = import_node_process8.default);
33965
+ tryEachApp = async (apps2, opener) => {
33966
+ if (apps2.length === 0) {
33967
+ return;
33968
+ }
33969
+ const errors = [];
33970
+ for (const app of apps2) {
33994
33971
  try {
33995
- return await mapper(item);
33972
+ return await opener(app);
33996
33973
  } catch (error) {
33997
- latestError = error;
33974
+ errors.push(error);
33998
33975
  }
33999
33976
  }
34000
- throw latestError;
33977
+ throw new AggregateError(errors, "Failed to open in all supported apps");
34001
33978
  };
34002
33979
  baseOpen = async (options) => {
34003
33980
  options = {
@@ -34007,45 +33984,62 @@ var init_open = __esm({
34007
33984
  allowNonzeroExitCode: false,
34008
33985
  ...options
34009
33986
  };
33987
+ const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
33988
+ delete options[fallbackAttemptSymbol];
34010
33989
  if (Array.isArray(options.app)) {
34011
- return pTryEach(options.app, (singleApp) => baseOpen({
33990
+ return tryEachApp(options.app, (singleApp) => baseOpen({
34012
33991
  ...options,
34013
- app: singleApp
33992
+ app: singleApp,
33993
+ [fallbackAttemptSymbol]: true
34014
33994
  }));
34015
33995
  }
34016
33996
  let { name: app, arguments: appArguments = [] } = options.app ?? {};
34017
33997
  appArguments = [...appArguments];
34018
33998
  if (Array.isArray(app)) {
34019
- return pTryEach(app, (appName) => baseOpen({
33999
+ return tryEachApp(app, (appName) => baseOpen({
34020
34000
  ...options,
34021
34001
  app: {
34022
34002
  name: appName,
34023
34003
  arguments: appArguments
34024
- }
34004
+ },
34005
+ [fallbackAttemptSymbol]: true
34025
34006
  }));
34026
34007
  }
34027
34008
  if (app === "browser" || app === "browserPrivate") {
34028
34009
  const ids = {
34029
34010
  "com.google.chrome": "chrome",
34030
34011
  "google-chrome.desktop": "chrome",
34031
- "com.brave.Browser": "brave",
34012
+ "com.brave.browser": "brave",
34032
34013
  "org.mozilla.firefox": "firefox",
34033
34014
  "firefox.desktop": "firefox",
34034
34015
  "com.microsoft.msedge": "edge",
34035
34016
  "com.microsoft.edge": "edge",
34036
34017
  "com.microsoft.edgemac": "edge",
34037
- "microsoft-edge.desktop": "edge"
34018
+ "microsoft-edge.desktop": "edge",
34019
+ "com.apple.safari": "safari"
34038
34020
  };
34039
34021
  const flags = {
34040
34022
  chrome: "--incognito",
34041
34023
  brave: "--incognito",
34042
34024
  firefox: "--private-window",
34043
34025
  edge: "--inPrivate"
34026
+ // Safari doesn't support private mode via command line
34044
34027
  };
34045
- const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
34046
- if (browser.id in ids) {
34047
- const browserName = ids[browser.id];
34028
+ let browser;
34029
+ if (is_wsl_default) {
34030
+ const progId = await wslDefaultBrowser();
34031
+ const browserInfo = _windowsBrowserProgIdMap.get(progId);
34032
+ browser = browserInfo ?? {};
34033
+ } else {
34034
+ browser = await defaultBrowser2();
34035
+ }
34036
+ const browserId = browser.id?.toLowerCase();
34037
+ if (Object.hasOwn(ids, browserId)) {
34038
+ const browserName = ids[browserId];
34048
34039
  if (app === "browserPrivate") {
34040
+ if (browserName === "safari") {
34041
+ throw new Error("Safari doesn't support opening in private mode via command line");
34042
+ }
34049
34043
  appArguments.push(flags[browserName]);
34050
34044
  }
34051
34045
  return baseOpen({
@@ -34061,6 +34055,10 @@ var init_open = __esm({
34061
34055
  let command;
34062
34056
  const cliArguments = [];
34063
34057
  const childProcessOptions = {};
34058
+ let shouldUseWindowsInWsl = false;
34059
+ if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
34060
+ shouldUseWindowsInWsl = await canAccessPowerShell();
34061
+ }
34064
34062
  if (platform === "darwin") {
34065
34063
  command = "open";
34066
34064
  if (options.wait) {
@@ -34075,35 +34073,38 @@ var init_open = __esm({
34075
34073
  if (app) {
34076
34074
  cliArguments.push("-a", app);
34077
34075
  }
34078
- } else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
34079
- command = await powerShellPath();
34080
- cliArguments.push(
34081
- "-NoProfile",
34082
- "-NonInteractive",
34083
- "-ExecutionPolicy",
34084
- "Bypass",
34085
- "-EncodedCommand"
34086
- );
34076
+ } else if (platform === "win32" || shouldUseWindowsInWsl) {
34077
+ command = await powerShellPath2();
34078
+ cliArguments.push(...executePowerShell.argumentsPrefix);
34087
34079
  if (!is_wsl_default) {
34088
34080
  childProcessOptions.windowsVerbatimArguments = true;
34089
34081
  }
34090
- const encodedArguments = ["Start"];
34082
+ if (is_wsl_default && options.target) {
34083
+ options.target = await convertWslPathToWindows(options.target);
34084
+ }
34085
+ const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
34091
34086
  if (options.wait) {
34092
34087
  encodedArguments.push("-Wait");
34093
34088
  }
34094
34089
  if (app) {
34095
- encodedArguments.push(`"\`"${app}\`""`);
34090
+ encodedArguments.push(executePowerShell.escapeArgument(app));
34096
34091
  if (options.target) {
34097
34092
  appArguments.push(options.target);
34098
34093
  }
34099
34094
  } else if (options.target) {
34100
- encodedArguments.push(`"${options.target}"`);
34095
+ encodedArguments.push(executePowerShell.escapeArgument(options.target));
34101
34096
  }
34102
34097
  if (appArguments.length > 0) {
34103
- appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
34098
+ appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
34104
34099
  encodedArguments.push("-ArgumentList", appArguments.join(","));
34105
34100
  }
34106
- options.target = import_node_buffer.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
34101
+ options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
34102
+ if (!options.wait) {
34103
+ childProcessOptions.stdio = "ignore";
34104
+ }
34105
+ if (is_wsl_default) {
34106
+ childProcessOptions.cwd = import_node_path2.default.dirname(command);
34107
+ }
34107
34108
  } else {
34108
34109
  if (app) {
34109
34110
  command = app;
@@ -34115,7 +34116,7 @@ var init_open = __esm({
34115
34116
  exeLocalXdgOpen = true;
34116
34117
  } catch {
34117
34118
  }
34118
- const useSystemXdgOpen = import_node_process7.default.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
34119
+ const useSystemXdgOpen = import_node_process8.default.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
34119
34120
  command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
34120
34121
  }
34121
34122
  if (appArguments.length > 0) {
@@ -34132,12 +34133,12 @@ var init_open = __esm({
34132
34133
  if (options.target) {
34133
34134
  cliArguments.push(options.target);
34134
34135
  }
34135
- const subprocess = import_node_child_process5.default.spawn(command, cliArguments, childProcessOptions);
34136
+ const subprocess = import_node_child_process7.default.spawn(command, cliArguments, childProcessOptions);
34136
34137
  if (options.wait) {
34137
34138
  return new Promise((resolve, reject) => {
34138
34139
  subprocess.once("error", reject);
34139
34140
  subprocess.once("close", (exitCode) => {
34140
- if (!options.allowNonzeroExitCode && exitCode > 0) {
34141
+ if (!options.allowNonzeroExitCode && exitCode !== 0) {
34141
34142
  reject(new Error(`Exited with code ${exitCode}`));
34142
34143
  return;
34143
34144
  }
@@ -34145,8 +34146,30 @@ var init_open = __esm({
34145
34146
  });
34146
34147
  });
34147
34148
  }
34149
+ if (isFallbackAttempt || platform === "win32" || shouldUseWindowsInWsl) {
34150
+ return new Promise((resolve, reject) => {
34151
+ subprocess.once("error", reject);
34152
+ subprocess.once("spawn", () => {
34153
+ subprocess.once("close", (exitCode) => {
34154
+ subprocess.off("error", reject);
34155
+ if (isFallbackAttempt && exitCode !== 0) {
34156
+ reject(new Error(`Exited with code ${exitCode}`));
34157
+ return;
34158
+ }
34159
+ subprocess.unref();
34160
+ resolve(subprocess);
34161
+ });
34162
+ });
34163
+ });
34164
+ }
34148
34165
  subprocess.unref();
34149
- return subprocess;
34166
+ return new Promise((resolve, reject) => {
34167
+ subprocess.once("error", reject);
34168
+ subprocess.once("spawn", () => {
34169
+ subprocess.off("error", reject);
34170
+ resolve(subprocess);
34171
+ });
34172
+ });
34150
34173
  };
34151
34174
  open = (target, options) => {
34152
34175
  if (typeof target !== "string") {
@@ -34173,11 +34196,15 @@ var init_open = __esm({
34173
34196
  }
34174
34197
  });
34175
34198
  };
34176
- apps = {};
34199
+ apps = {
34200
+ browser: "browser",
34201
+ browserPrivate: "browserPrivate"
34202
+ };
34177
34203
  defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
34178
34204
  darwin: "google chrome",
34179
34205
  win32: "chrome",
34180
- linux: ["google-chrome", "google-chrome-stable", "chromium"]
34206
+ // `chromium-browser` is the older deb package name used by Ubuntu/Debian before snap.
34207
+ linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
34181
34208
  }, {
34182
34209
  wsl: {
34183
34210
  ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
@@ -34208,8 +34235,9 @@ var init_open = __esm({
34208
34235
  }, {
34209
34236
  wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
34210
34237
  }));
34211
- defineLazyProperty(apps, "browser", () => "browser");
34212
- defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
34238
+ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
34239
+ darwin: "Safari"
34240
+ }));
34213
34241
  open_default = open;
34214
34242
  }
34215
34243
  });
@@ -34259,6 +34287,7 @@ var require_msalClient = __commonJS({
34259
34287
  var import_regionalAuthority = require_regionalAuthority();
34260
34288
  var import_logger = require_commonjs();
34261
34289
  var import_tenantIdUtils = require_tenantIdUtils();
34290
+ var import_authorityHost = require_authorityHost();
34262
34291
  var msalLogger = (0, import_logging.credentialLogger)("MsalClient");
34263
34292
  function generateMsalConfiguration(clientId, tenantId, msalClientOptions = {}) {
34264
34293
  const resolvedTenant = (0, import_tenantIdUtils.resolveTenantId)(
@@ -34266,9 +34295,9 @@ var require_msalClient = __commonJS({
34266
34295
  tenantId,
34267
34296
  clientId
34268
34297
  );
34269
- const authority = (0, import_utils.getAuthority)(resolvedTenant, (0, import_utils.getAuthorityHost)(msalClientOptions));
34298
+ const authority = (0, import_utils.getAuthority)(resolvedTenant, (0, import_authorityHost.getAuthorityHost)(msalClientOptions));
34270
34299
  const httpClient = new import_identityClient.IdentityClient({
34271
- ...msalClientOptions.tokenCredentialOptions,
34300
+ ...msalClientOptions,
34272
34301
  authorityHost: authority,
34273
34302
  loggingOptions: msalClientOptions.loggingOptions
34274
34303
  });
@@ -34378,7 +34407,7 @@ var require_msalClient = __commonJS({
34378
34407
  }
34379
34408
  function calculateRequestAuthority(options) {
34380
34409
  if (options?.tenantId) {
34381
- return (0, import_utils.getAuthority)(options.tenantId, (0, import_utils.getAuthorityHost)(createMsalClientOptions));
34410
+ return (0, import_utils.getAuthority)(options.tenantId, (0, import_authorityHost.getAuthorityHost)(createMsalClientOptions));
34382
34411
  }
34383
34412
  return state.msalConfig.auth.authority;
34384
34413
  }
@@ -34689,6 +34718,66 @@ var require_msalClient = __commonJS({
34689
34718
  }
34690
34719
  });
34691
34720
 
34721
+ // node_modules/@azure/identity/dist/commonjs/util/certificatesUtils.js
34722
+ var require_certificatesUtils = __commonJS({
34723
+ "node_modules/@azure/identity/dist/commonjs/util/certificatesUtils.js"(exports2, module2) {
34724
+ var __defProp2 = Object.defineProperty;
34725
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
34726
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
34727
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
34728
+ var __export2 = (target, all) => {
34729
+ for (var name in all)
34730
+ __defProp2(target, name, { get: all[name], enumerable: true });
34731
+ };
34732
+ var __copyProps2 = (to, from, except, desc) => {
34733
+ if (from && typeof from === "object" || typeof from === "function") {
34734
+ for (let key of __getOwnPropNames2(from))
34735
+ if (!__hasOwnProp2.call(to, key) && key !== except)
34736
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
34737
+ }
34738
+ return to;
34739
+ };
34740
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
34741
+ var certificatesUtils_exports = {};
34742
+ __export2(certificatesUtils_exports, {
34743
+ canParseAsX509Certificate: () => canParseAsX509Certificate,
34744
+ extractPemCertificateKeys: () => extractPemCertificateKeys
34745
+ });
34746
+ module2.exports = __toCommonJS2(certificatesUtils_exports);
34747
+ var import_crypto = require("crypto");
34748
+ function extractPemCertificateKeys(pemContent) {
34749
+ const certificatePattern = /(-+BEGIN CERTIFICATE-+)(\n\r?|\r\n?)([A-Za-z0-9+/\n\r]+=*)(\n\r?|\r\n?)(-+END CERTIFICATE-+)/g;
34750
+ const publicKeys = [];
34751
+ let match;
34752
+ do {
34753
+ match = certificatePattern.exec(pemContent);
34754
+ if (match) {
34755
+ publicKeys.push(match[3]);
34756
+ }
34757
+ } while (match);
34758
+ if (publicKeys.length === 0) {
34759
+ throw new Error("The file at the specified path does not contain a PEM-encoded certificate.");
34760
+ }
34761
+ return publicKeys;
34762
+ }
34763
+ function canParseAsX509Certificate(pemCert) {
34764
+ try {
34765
+ const pemContents = extractPemCertificateKeys(pemCert);
34766
+ for (let i = 0; i < pemContents.length; i++) {
34767
+ const pemContent = pemContents[i];
34768
+ const fullPemCertificate = `-----BEGIN CERTIFICATE-----
34769
+ ${pemContent}
34770
+ -----END CERTIFICATE-----`;
34771
+ new import_crypto.X509Certificate(fullPemCertificate);
34772
+ }
34773
+ return true;
34774
+ } catch (extractError) {
34775
+ return false;
34776
+ }
34777
+ }
34778
+ }
34779
+ });
34780
+
34692
34781
  // node_modules/@azure/identity/dist/commonjs/credentials/clientCertificateCredential.js
34693
34782
  var require_clientCertificateCredential = __commonJS({
34694
34783
  "node_modules/@azure/identity/dist/commonjs/credentials/clientCertificateCredential.js"(exports2, module2) {
@@ -34721,6 +34810,7 @@ var require_clientCertificateCredential = __commonJS({
34721
34810
  var import_logging = require_logging();
34722
34811
  var import_promises3 = require("node:fs/promises");
34723
34812
  var import_tracing = require_tracing();
34813
+ var import_certificatesUtils = require_certificatesUtils();
34724
34814
  var credentialName = "ClientCertificateCredential";
34725
34815
  var logger2 = (0, import_logging.credentialLogger)(credentialName);
34726
34816
  var ClientCertificateCredential2 = class {
@@ -34757,8 +34847,7 @@ var require_clientCertificateCredential = __commonJS({
34757
34847
  }
34758
34848
  this.msalClient = (0, import_msalClient.createMsalClient)(clientId, tenantId, {
34759
34849
  ...options,
34760
- logger: logger2,
34761
- tokenCredentialOptions: options
34850
+ logger: logger2
34762
34851
  });
34763
34852
  }
34764
34853
  /**
@@ -34813,18 +34902,7 @@ var require_clientCertificateCredential = __commonJS({
34813
34902
  const certificatePath = certificateConfiguration.certificatePath;
34814
34903
  const certificateContents = certificate || await (0, import_promises3.readFile)(certificatePath, "utf8");
34815
34904
  const x5c = sendCertificateChain ? certificateContents : void 0;
34816
- const certificatePattern = /(-+BEGIN CERTIFICATE-+)(\n\r?|\r\n?)([A-Za-z0-9+/\n\r]+=*)(\n\r?|\r\n?)(-+END CERTIFICATE-+)/g;
34817
- const publicKeys = [];
34818
- let match;
34819
- do {
34820
- match = certificatePattern.exec(certificateContents);
34821
- if (match) {
34822
- publicKeys.push(match[3]);
34823
- }
34824
- } while (match);
34825
- if (publicKeys.length === 0) {
34826
- throw new Error("The file at the specified path does not contain a PEM-encoded certificate.");
34827
- }
34905
+ const publicKeys = (0, import_certificatesUtils.extractPemCertificateKeys)(certificateContents);
34828
34906
  const thumbprint = (0, import_node_crypto.createHash)("sha1").update(Buffer.from(publicKeys[0], "base64")).digest("hex").toUpperCase();
34829
34907
  const thumbprintSha256 = (0, import_node_crypto.createHash)("sha256").update(Buffer.from(publicKeys[0], "base64")).digest("hex").toUpperCase();
34830
34908
  return {
@@ -34951,8 +35029,7 @@ var require_clientSecretCredential = __commonJS({
34951
35029
  );
34952
35030
  this.msalClient = (0, import_msalClient.createMsalClient)(clientId, tenantId, {
34953
35031
  ...options,
34954
- logger: logger2,
34955
- tokenCredentialOptions: options
35032
+ logger: logger2
34956
35033
  });
34957
35034
  }
34958
35035
  /**
@@ -35060,8 +35137,7 @@ var require_usernamePasswordCredential = __commonJS({
35060
35137
  this.username = username;
35061
35138
  this.password = password;
35062
35139
  this.msalClient = (0, import_msalClient.createMsalClient)(clientId, this.tenantId, {
35063
- ...options,
35064
- tokenCredentialOptions: options ?? {}
35140
+ ...options
35065
35141
  });
35066
35142
  }
35067
35143
  /**
@@ -35147,8 +35223,8 @@ var require_environmentCredential = __commonJS({
35147
35223
  "AZURE_CLIENT_SEND_CERTIFICATE_CHAIN"
35148
35224
  ];
35149
35225
  function getAdditionallyAllowedTenants() {
35150
- const additionallyAllowedValues = process.env.AZURE_ADDITIONALLY_ALLOWED_TENANTS ?? "";
35151
- return additionallyAllowedValues.split(";");
35226
+ const additionallyAllowedValues = process.env.AZURE_ADDITIONALLY_ALLOWED_TENANTS;
35227
+ return additionallyAllowedValues ? additionallyAllowedValues.split(";") : void 0;
35152
35228
  }
35153
35229
  var credentialName = "EnvironmentCredential";
35154
35230
  var logger2 = (0, import_logging.credentialLogger)(credentialName);
@@ -35191,9 +35267,13 @@ var require_environmentCredential = __commonJS({
35191
35267
  const assigned = (0, import_logging.processEnvVars)(AllSupportedEnvironmentVariables).assigned.join(", ");
35192
35268
  logger2.info(`Found the following environment variables: ${assigned}`);
35193
35269
  const tenantId = process.env.AZURE_TENANT_ID, clientId = process.env.AZURE_CLIENT_ID, clientSecret = process.env.AZURE_CLIENT_SECRET;
35194
- const additionallyAllowedTenantIds = getAdditionallyAllowedTenants();
35270
+ const additionallyAllowedTenants = options?.additionallyAllowedTenants ?? getAdditionallyAllowedTenants();
35195
35271
  const sendCertificateChain = getSendCertificateChain();
35196
- const newOptions = { ...options, additionallyAllowedTenantIds, sendCertificateChain };
35272
+ const newOptions = {
35273
+ ...options,
35274
+ additionallyAllowedTenants,
35275
+ sendCertificateChain
35276
+ };
35197
35277
  if (tenantId) {
35198
35278
  (0, import_tenantIdUtils.checkTenantId)(logger2, tenantId);
35199
35279
  }
@@ -35493,9 +35573,8 @@ var require_clientAssertionCredential = __commonJS({
35493
35573
  this.options = options;
35494
35574
  this.getAssertion = getAssertion;
35495
35575
  this.msalClient = (0, import_msalClient.createMsalClient)(clientId, tenantId, {
35496
- ...options,
35497
- logger: logger2,
35498
- tokenCredentialOptions: this.options
35576
+ ...this.options,
35577
+ logger: logger2
35499
35578
  });
35500
35579
  }
35501
35580
  /**
@@ -35553,7 +35632,8 @@ var require_workloadIdentityCredential = __commonJS({
35553
35632
  var workloadIdentityCredential_exports = {};
35554
35633
  __export2(workloadIdentityCredential_exports, {
35555
35634
  SupportedWorkloadEnvironmentVariables: () => SupportedWorkloadEnvironmentVariables,
35556
- WorkloadIdentityCredential: () => WorkloadIdentityCredential2
35635
+ WorkloadIdentityCredential: () => WorkloadIdentityCredential2,
35636
+ parseAndValidateCustomTokenProxy: () => parseAndValidateCustomTokenProxy
35557
35637
  });
35558
35638
  module2.exports = __toCommonJS2(workloadIdentityCredential_exports);
35559
35639
  var import_logging = require_logging();
@@ -35561,6 +35641,9 @@ var require_workloadIdentityCredential = __commonJS({
35561
35641
  var import_errors = require_errors2();
35562
35642
  var import_tenantIdUtils = require_tenantIdUtils();
35563
35643
  var import_promises3 = require("node:fs/promises");
35644
+ var import_core_rest_pipeline = require_commonjs6();
35645
+ var import_certificatesUtils = require_certificatesUtils();
35646
+ var import_node_fs4 = require("node:fs");
35564
35647
  var credentialName = "WorkloadIdentityCredential";
35565
35648
  var SupportedWorkloadEnvironmentVariables = [
35566
35649
  "AZURE_TENANT_ID",
@@ -35568,11 +35651,77 @@ var require_workloadIdentityCredential = __commonJS({
35568
35651
  "AZURE_FEDERATED_TOKEN_FILE"
35569
35652
  ];
35570
35653
  var logger2 = (0, import_logging.credentialLogger)(credentialName);
35654
+ var ErrorMessages = {
35655
+ FAILED_TO_PARSE_TOKEN_PROXY: (endpoint, error) => `Failed to parse custom token proxy URL "${endpoint}": ${error}`,
35656
+ INVALID_HTTPS_SCHEME: (protocol) => `Custom token endpoint must use https scheme, got "${protocol}"`,
35657
+ TOKEN_ENDPOINT_NO_USER_INFO: (url) => `Custom token endpoint URL "${url}" must not contain user info`,
35658
+ TOKEN_ENDPOINT_NO_QUERY: (url) => `Custom token endpoint URL "${url}" must not contain a query`,
35659
+ TOKEN_ENDPOINT_NO_FRAGMENT: (url) => `Custom token endpoint URL "${url}" must not contain a fragment`,
35660
+ CA_FILE_EMPTY: (file) => `CA certificate file is empty: ${file}`,
35661
+ FAILED_TO_READ_CA_FILE: (file, error) => `Failed to read CA certificate file: ${file}. ${error}`,
35662
+ INVALID_CA_CERTIFICATES: `Invalid CA certificate data: no valid PEM certificates found`,
35663
+ INVALID_FILE_PATH: (path3) => `Invalid file path provided ${path3}.`,
35664
+ NO_FILE_CONTENT: (path3) => `No content on the file ${path3}.`,
35665
+ NO_CA_SOURCE: `No CA certificate source specified.`,
35666
+ CLIENT_ID_REQUIRED: `clientId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_CLIENT_ID".
35667
+ See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,
35668
+ TENANT_ID_REQUIRED: `tenantId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_TENANT_ID".
35669
+ See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,
35670
+ TOKEN_FILE_PATH_REQUIRED: `federatedTokenFilePath is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_FEDERATED_TOKEN_FILE".
35671
+ See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,
35672
+ TOKEN_PROXY_NOT_SET: `AZURE_KUBERNETES_TOKEN_PROXY is not set but other custom endpoint-related environment variables are present`,
35673
+ CA_FILE_AND_DATA_EXCLUSIVE: `AZURE_KUBERNETES_CA_FILE and AZURE_KUBERNETES_CA_DATA are mutually exclusive. Specify only one.`,
35674
+ MISSING_ENV_VARS: `tenantId, clientId, and federatedTokenFilePath are required parameters.
35675
+ In DefaultAzureCredential and ManagedIdentityCredential, these can be provided as environment variables -
35676
+ "AZURE_TENANT_ID",
35677
+ "AZURE_CLIENT_ID",
35678
+ "AZURE_FEDERATED_TOKEN_FILE". See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`
35679
+ };
35680
+ function parseAndValidateCustomTokenProxy(endpoint) {
35681
+ let tokenProxy;
35682
+ try {
35683
+ tokenProxy = new URL(endpoint);
35684
+ } catch (error) {
35685
+ throw new import_errors.CredentialUnavailableError(
35686
+ `${credentialName}: is unavailable. ${ErrorMessages.FAILED_TO_PARSE_TOKEN_PROXY(endpoint, error)}`
35687
+ );
35688
+ }
35689
+ if (tokenProxy.protocol !== "https:") {
35690
+ throw new import_errors.CredentialUnavailableError(
35691
+ `${credentialName}: is unavailable. ${ErrorMessages.INVALID_HTTPS_SCHEME(tokenProxy.protocol)}`
35692
+ );
35693
+ }
35694
+ if (tokenProxy.username || tokenProxy.password) {
35695
+ throw new import_errors.CredentialUnavailableError(
35696
+ `${credentialName}: is unavailable. ${ErrorMessages.TOKEN_ENDPOINT_NO_USER_INFO(tokenProxy.toString())}`
35697
+ );
35698
+ }
35699
+ if (tokenProxy.search) {
35700
+ throw new import_errors.CredentialUnavailableError(
35701
+ `${credentialName}: is unavailable. ${ErrorMessages.TOKEN_ENDPOINT_NO_QUERY(tokenProxy.toString())}`
35702
+ );
35703
+ }
35704
+ if (tokenProxy.hash) {
35705
+ throw new import_errors.CredentialUnavailableError(
35706
+ `${credentialName}: is unavailable. ${ErrorMessages.TOKEN_ENDPOINT_NO_FRAGMENT(tokenProxy.toString())}`
35707
+ );
35708
+ }
35709
+ if (!tokenProxy.pathname || tokenProxy.pathname === "") {
35710
+ tokenProxy.pathname = "/";
35711
+ }
35712
+ return tokenProxy.toString();
35713
+ }
35571
35714
  var WorkloadIdentityCredential2 = class {
35572
35715
  client;
35573
35716
  azureFederatedTokenFileContent = void 0;
35574
35717
  cacheDate = void 0;
35575
35718
  federatedTokenFilePath;
35719
+ // AKS proxy CA caching - persists across token requests
35720
+ cachedTlsSettings;
35721
+ cachedCaData;
35722
+ caData;
35723
+ caFile;
35724
+ sniName;
35576
35725
  /**
35577
35726
  * WorkloadIdentityCredential supports Microsoft Entra Workload ID on Kubernetes.
35578
35727
  *
@@ -35590,22 +35739,48 @@ var require_workloadIdentityCredential = __commonJS({
35590
35739
  }
35591
35740
  if (!clientId) {
35592
35741
  throw new import_errors.CredentialUnavailableError(
35593
- `${credentialName}: is unavailable. clientId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_CLIENT_ID".
35594
- See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`
35742
+ `${credentialName}: is unavailable. ${ErrorMessages.CLIENT_ID_REQUIRED}`
35595
35743
  );
35596
35744
  }
35597
35745
  if (!tenantId) {
35598
35746
  throw new import_errors.CredentialUnavailableError(
35599
- `${credentialName}: is unavailable. tenantId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_TENANT_ID".
35600
- See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`
35747
+ `${credentialName}: is unavailable. ${ErrorMessages.TENANT_ID_REQUIRED}`
35601
35748
  );
35602
35749
  }
35603
35750
  if (!this.federatedTokenFilePath) {
35604
35751
  throw new import_errors.CredentialUnavailableError(
35605
- `${credentialName}: is unavailable. federatedTokenFilePath is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_FEDERATED_TOKEN_FILE".
35606
- See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`
35752
+ `${credentialName}: is unavailable. ${ErrorMessages.TOKEN_FILE_PATH_REQUIRED}`
35607
35753
  );
35608
35754
  }
35755
+ if (workloadIdentityCredentialOptions.enableAzureProxy) {
35756
+ const kubernetesTokenProxy = process.env.AZURE_KUBERNETES_TOKEN_PROXY;
35757
+ const kubernetesSNIName = process.env.AZURE_KUBERNETES_SNI_NAME;
35758
+ const kubernetesCAFile = process.env.AZURE_KUBERNETES_CA_FILE;
35759
+ const kubernetesCAData = process.env.AZURE_KUBERNETES_CA_DATA;
35760
+ if (!kubernetesTokenProxy) {
35761
+ if (kubernetesSNIName || kubernetesCAFile || kubernetesCAData) {
35762
+ throw new import_errors.CredentialUnavailableError(
35763
+ `${credentialName}: is unavailable. ${ErrorMessages.TOKEN_PROXY_NOT_SET}`
35764
+ );
35765
+ }
35766
+ logger2.info(
35767
+ `enableAzureProxy is true but AZURE_KUBERNETES_TOKEN_PROXY is not set, using normal authentication flow`
35768
+ );
35769
+ } else {
35770
+ const tokenProxy = parseAndValidateCustomTokenProxy(kubernetesTokenProxy);
35771
+ if (kubernetesCAFile && kubernetesCAData) {
35772
+ throw new import_errors.CredentialUnavailableError(
35773
+ `${credentialName}: is unavailable. ${ErrorMessages.CA_FILE_AND_DATA_EXCLUSIVE}`
35774
+ );
35775
+ }
35776
+ this.caData = kubernetesCAData;
35777
+ this.caFile = kubernetesCAFile;
35778
+ this.sniName = kubernetesSNIName;
35779
+ const proxyClient = this.createAksProxyClient(tokenProxy);
35780
+ workloadIdentityCredentialOptions.httpClient = proxyClient;
35781
+ logger2.info(`${credentialName}: Using proxy client for token requests`);
35782
+ }
35783
+ }
35609
35784
  logger2.info(
35610
35785
  `Invoking ClientAssertionCredential with tenant ID: ${tenantId}, clientId: ${workloadIdentityCredentialOptions.clientId} and federated token path: [REDACTED]`
35611
35786
  );
@@ -35613,9 +35788,90 @@ var require_workloadIdentityCredential = __commonJS({
35613
35788
  tenantId,
35614
35789
  clientId,
35615
35790
  this.readFileContents.bind(this),
35616
- options
35791
+ workloadIdentityCredentialOptions
35617
35792
  );
35618
35793
  }
35794
+ /**
35795
+ * Creates a proxy HttpClient that intercepts token requests and redirects them to the Kubernetes endpoint
35796
+ * Caching is handled at the credential level to persist across token requests
35797
+ */
35798
+ createAksProxyClient(tokenEndpoint) {
35799
+ const defaultClient = (0, import_core_rest_pipeline.createDefaultHttpClient)();
35800
+ this.cachedTlsSettings = this.getTlsSettings();
35801
+ return {
35802
+ sendRequest: async (request) => {
35803
+ const requestUrl = new URL(request.url);
35804
+ logger2.info(
35805
+ `${credentialName}: Redirecting request to Kubernetes endpoint: ${tokenEndpoint}`
35806
+ );
35807
+ const proxyUrl = new URL(tokenEndpoint);
35808
+ const requestPath = requestUrl.pathname.replace(/^\//, "");
35809
+ const combinedPath = proxyUrl.pathname.endsWith("/") ? proxyUrl.pathname + requestPath : proxyUrl.pathname + "/" + requestPath;
35810
+ const newUrl = new URL(proxyUrl.origin);
35811
+ newUrl.pathname = combinedPath;
35812
+ newUrl.search = requestUrl.search;
35813
+ newUrl.hash = requestUrl.hash;
35814
+ request.url = newUrl.toString();
35815
+ request.tlsSettings = this.getTlsSettings();
35816
+ logger2.info(`${credentialName}: Sending request to ${request.url}`);
35817
+ return defaultClient.sendRequest(request);
35818
+ }
35819
+ };
35820
+ }
35821
+ /**
35822
+ * Gets TLS settings for the request.
35823
+ * Handles a few scenarios with CA data or CA file provided.
35824
+ */
35825
+ getTlsSettings() {
35826
+ if (!this.caData && !this.caFile) {
35827
+ if (!this.cachedTlsSettings) {
35828
+ this.cachedTlsSettings = this.sniName ? { servername: this.sniName } : {};
35829
+ }
35830
+ return this.cachedTlsSettings;
35831
+ }
35832
+ if (!this.caFile) {
35833
+ if (!this.cachedTlsSettings) {
35834
+ if (!(0, import_certificatesUtils.canParseAsX509Certificate)(this.caData)) {
35835
+ throw new import_errors.CredentialUnavailableError(
35836
+ `${credentialName}: is unavailable. ${ErrorMessages.INVALID_CA_CERTIFICATES}`
35837
+ );
35838
+ }
35839
+ this.cachedTlsSettings = this.sniName ? { servername: this.sniName } : {};
35840
+ this.cachedTlsSettings.ca = this.caData;
35841
+ }
35842
+ return this.cachedTlsSettings;
35843
+ }
35844
+ let fileContent;
35845
+ try {
35846
+ fileContent = (0, import_node_fs4.readFileSync)(this.caFile);
35847
+ } catch (error) {
35848
+ throw new import_errors.CredentialUnavailableError(
35849
+ `${credentialName}: is unavailable. ${ErrorMessages.FAILED_TO_READ_CA_FILE(this.caFile, error)}`
35850
+ );
35851
+ }
35852
+ if (fileContent.length === 0) {
35853
+ if (!this.cachedTlsSettings) {
35854
+ throw new import_errors.CredentialUnavailableError(
35855
+ `${credentialName}: is unavailable. ${ErrorMessages.CA_FILE_EMPTY(this.caFile)}`
35856
+ );
35857
+ }
35858
+ return this.cachedTlsSettings;
35859
+ }
35860
+ if (!this.cachedCaData || !fileContent.equals(this.cachedCaData)) {
35861
+ const caDataString = fileContent.toString("utf8");
35862
+ if (!(0, import_certificatesUtils.canParseAsX509Certificate)(caDataString)) {
35863
+ throw new import_errors.CredentialUnavailableError(
35864
+ `${credentialName}: is unavailable. ${ErrorMessages.INVALID_CA_CERTIFICATES}`
35865
+ );
35866
+ }
35867
+ this.cachedTlsSettings = {
35868
+ ca: caDataString,
35869
+ ...this.sniName && { servername: this.sniName }
35870
+ };
35871
+ this.cachedCaData = fileContent;
35872
+ }
35873
+ return this.cachedTlsSettings;
35874
+ }
35619
35875
  /**
35620
35876
  * Authenticates with Microsoft Entra ID and returns an access token if successful.
35621
35877
  * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
@@ -35626,11 +35882,7 @@ var require_workloadIdentityCredential = __commonJS({
35626
35882
  */
35627
35883
  async getToken(scopes, options) {
35628
35884
  if (!this.client) {
35629
- const errorMessage = `${credentialName}: is unavailable. tenantId, clientId, and federatedTokenFilePath are required parameters.
35630
- In DefaultAzureCredential and ManagedIdentityCredential, these can be provided as environment variables -
35631
- "AZURE_TENANT_ID",
35632
- "AZURE_CLIENT_ID",
35633
- "AZURE_FEDERATED_TOKEN_FILE". See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`;
35885
+ const errorMessage = `${credentialName}: is unavailable. ${ErrorMessages.MISSING_ENV_VARS}`;
35634
35886
  logger2.info(errorMessage);
35635
35887
  throw new import_errors.CredentialUnavailableError(errorMessage);
35636
35888
  }
@@ -35643,7 +35895,7 @@ var require_workloadIdentityCredential = __commonJS({
35643
35895
  }
35644
35896
  if (!this.federatedTokenFilePath) {
35645
35897
  throw new import_errors.CredentialUnavailableError(
35646
- `${credentialName}: is unavailable. Invalid file path provided ${this.federatedTokenFilePath}.`
35898
+ `${credentialName}: is unavailable. ${ErrorMessages.INVALID_FILE_PATH(this.federatedTokenFilePath)}`
35647
35899
  );
35648
35900
  }
35649
35901
  if (!this.azureFederatedTokenFileContent) {
@@ -35651,7 +35903,7 @@ var require_workloadIdentityCredential = __commonJS({
35651
35903
  const value = file.trim();
35652
35904
  if (!value) {
35653
35905
  throw new import_errors.CredentialUnavailableError(
35654
- `${credentialName}: is unavailable. No content on the file ${this.federatedTokenFilePath}.`
35906
+ `${credentialName}: is unavailable. ${ErrorMessages.NO_FILE_CONTENT(this.federatedTokenFilePath)}`
35655
35907
  );
35656
35908
  } else {
35657
35909
  this.azureFederatedTokenFileContent = value;
@@ -36141,7 +36393,7 @@ var require_resolveExecutable = __commonJS({
36141
36393
  });
36142
36394
  module2.exports = __toCommonJS2(resolveExecutable_exports);
36143
36395
  var import_node_fs4 = require("node:fs");
36144
- var import_node_path2 = __toESM2(require("node:path"));
36396
+ var import_node_path3 = __toESM2(require("node:path"));
36145
36397
  var import_node_url2 = require("node:url");
36146
36398
  var import_errors = require_errors3();
36147
36399
  var WINDOWS_NATIVE_EXTENSIONS = [".exe", ".com"];
@@ -36189,7 +36441,7 @@ var require_resolveExecutable = __commonJS({
36189
36441
  }
36190
36442
  function normalizeCwd(cwd) {
36191
36443
  const cwdPath = cwd instanceof URL ? (0, import_node_url2.fileURLToPath)(cwd) : cwd;
36192
- return import_node_path2.default.resolve(cwdPath ?? process.cwd());
36444
+ return import_node_path3.default.resolve(cwdPath ?? process.cwd());
36193
36445
  }
36194
36446
  function createProcessContext(options = {}) {
36195
36447
  if (options.allowWindowsBatchFiles !== void 0 && typeof options.allowWindowsBatchFiles !== "boolean") {
@@ -36223,7 +36475,7 @@ var require_resolveExecutable = __commonJS({
36223
36475
  return WINDOWS_BATCH_EXTENSIONS.some((candidate) => candidate === extension);
36224
36476
  }
36225
36477
  function resolveWindowsCandidate(candidate, allowWindowsBatchFiles) {
36226
- const extension = import_node_path2.default.extname(candidate).toLowerCase();
36478
+ const extension = import_node_path3.default.extname(candidate).toLowerCase();
36227
36479
  if (extension) {
36228
36480
  if (!isNativeExtension(extension) && !(allowWindowsBatchFiles && isBatchExtension(extension))) {
36229
36481
  return void 0;
@@ -36250,7 +36502,7 @@ var require_resolveExecutable = __commonJS({
36250
36502
  const pathValue = getEnvironmentValue(context.env, "PATH") ?? "";
36251
36503
  const paths = [];
36252
36504
  const seen = /* @__PURE__ */ new Set();
36253
- for (const entry of pathValue.split(import_node_path2.default.delimiter)) {
36505
+ for (const entry of pathValue.split(import_node_path3.default.delimiter)) {
36254
36506
  let candidate = entry;
36255
36507
  if (process.platform === "win32") {
36256
36508
  candidate = candidate.trim();
@@ -36258,10 +36510,10 @@ var require_resolveExecutable = __commonJS({
36258
36510
  candidate = candidate.slice(1, -1);
36259
36511
  }
36260
36512
  }
36261
- if (!candidate || !import_node_path2.default.isAbsolute(candidate)) {
36513
+ if (!candidate || !import_node_path3.default.isAbsolute(candidate)) {
36262
36514
  continue;
36263
36515
  }
36264
- const normalized = import_node_path2.default.resolve(candidate);
36516
+ const normalized = import_node_path3.default.resolve(candidate);
36265
36517
  const key = process.platform === "win32" ? normalized.toLowerCase() : normalized;
36266
36518
  if (!seen.has(key)) {
36267
36519
  seen.add(key);
@@ -36287,8 +36539,8 @@ var require_resolveExecutable = __commonJS({
36287
36539
  }
36288
36540
  function resolveExecutableWithContext(command, context) {
36289
36541
  validateCommand(command);
36290
- if (hasPathSeparator(command) || import_node_path2.default.isAbsolute(command)) {
36291
- const candidate = import_node_path2.default.resolve(context.cwd, command);
36542
+ if (hasPathSeparator(command) || import_node_path3.default.isAbsolute(command)) {
36543
+ const candidate = import_node_path3.default.resolve(context.cwd, command);
36292
36544
  if (process.platform === "win32") {
36293
36545
  return resolveWindowsCandidate(candidate, context.allowWindowsBatchFiles);
36294
36546
  }
@@ -36297,20 +36549,20 @@ var require_resolveExecutable = __commonJS({
36297
36549
  const searchPaths = getSearchPaths(context);
36298
36550
  if (process.platform !== "win32") {
36299
36551
  for (const searchPath of searchPaths) {
36300
- const candidate = import_node_path2.default.join(searchPath, command);
36552
+ const candidate = import_node_path3.default.join(searchPath, command);
36301
36553
  if (isExecutableFile(candidate)) {
36302
36554
  return candidate;
36303
36555
  }
36304
36556
  }
36305
36557
  return void 0;
36306
36558
  }
36307
- const extension = import_node_path2.default.extname(command).toLowerCase();
36559
+ const extension = import_node_path3.default.extname(command).toLowerCase();
36308
36560
  if (extension) {
36309
36561
  if (!isNativeExtension(extension) && !(context.allowWindowsBatchFiles && isBatchExtension(extension))) {
36310
36562
  return void 0;
36311
36563
  }
36312
36564
  for (const searchPath of searchPaths) {
36313
- const candidate = import_node_path2.default.join(searchPath, command);
36565
+ const candidate = import_node_path3.default.join(searchPath, command);
36314
36566
  if (isExecutableFile(candidate)) {
36315
36567
  return candidate;
36316
36568
  }
@@ -36319,7 +36571,7 @@ var require_resolveExecutable = __commonJS({
36319
36571
  }
36320
36572
  for (const searchPath of searchPaths) {
36321
36573
  for (const nativeExtension of WINDOWS_NATIVE_EXTENSIONS) {
36322
- const candidate = import_node_path2.default.join(searchPath, command + nativeExtension);
36574
+ const candidate = import_node_path3.default.join(searchPath, command + nativeExtension);
36323
36575
  if (isExecutableFile(candidate)) {
36324
36576
  return candidate;
36325
36577
  }
@@ -36328,7 +36580,7 @@ var require_resolveExecutable = __commonJS({
36328
36580
  if (context.allowWindowsBatchFiles) {
36329
36581
  for (const searchPath of searchPaths) {
36330
36582
  for (const batchExtension of WINDOWS_BATCH_EXTENSIONS) {
36331
- const candidate = import_node_path2.default.join(searchPath, command + batchExtension);
36583
+ const candidate = import_node_path3.default.join(searchPath, command + batchExtension);
36332
36584
  if (isExecutableFile(candidate)) {
36333
36585
  return candidate;
36334
36586
  }
@@ -36344,7 +36596,7 @@ var require_resolveExecutable = __commonJS({
36344
36596
  try {
36345
36597
  return import_node_fs4.realpathSync.native(filePath).toLowerCase();
36346
36598
  } catch {
36347
- return import_node_path2.default.resolve(filePath).toLowerCase();
36599
+ return import_node_path3.default.resolve(filePath).toLowerCase();
36348
36600
  }
36349
36601
  }
36350
36602
  function isWindowsDriveAbsolutePath(filePath) {
@@ -36358,7 +36610,7 @@ var require_resolveExecutable = __commonJS({
36358
36610
  code: "ERR_UNTRUSTED_COMMAND_INTERPRETER"
36359
36611
  });
36360
36612
  }
36361
- const executablePath = import_node_path2.default.join(systemRoot, "System32", "cmd.exe");
36613
+ const executablePath = import_node_path3.default.join(systemRoot, "System32", "cmd.exe");
36362
36614
  if (!isExecutableFile(executablePath)) {
36363
36615
  throw new import_errors.ProcessError("The Windows command interpreter could not be found.", {
36364
36616
  code: "ERR_UNTRUSTED_COMMAND_INTERPRETER"
@@ -36424,7 +36676,7 @@ var require_normalizeCommand = __commonJS({
36424
36676
  normalizeCommand: () => normalizeCommand
36425
36677
  });
36426
36678
  module2.exports = __toCommonJS2(normalizeCommand_exports);
36427
- var import_node_path2 = __toESM2(require("node:path"));
36679
+ var import_node_path3 = __toESM2(require("node:path"));
36428
36680
  var import_errors = require_errors3();
36429
36681
  var import_resolveExecutable = require_resolveExecutable();
36430
36682
  var UNSAFE_BATCH_ARGUMENT = /[%!^&|<>()]/;
@@ -36488,7 +36740,7 @@ var require_normalizeCommand = __commonJS({
36488
36740
  windowsVerbatimArguments: false
36489
36741
  };
36490
36742
  }
36491
- const extension = import_node_path2.default.extname(resolvedPath).toLowerCase();
36743
+ const extension = import_node_path3.default.extname(resolvedPath).toLowerCase();
36492
36744
  if (extension === ".exe" || extension === ".com") {
36493
36745
  return {
36494
36746
  executable: resolvedPath,
@@ -36562,12 +36814,12 @@ var require_process = __commonJS({
36562
36814
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
36563
36815
  var process_exports = {};
36564
36816
  __export2(process_exports, {
36565
- execFile: () => execFile7,
36817
+ execFile: () => execFile8,
36566
36818
  spawn: () => spawn2,
36567
36819
  spawnSync: () => spawnSync2
36568
36820
  });
36569
36821
  module2.exports = __toCommonJS2(process_exports);
36570
- var childProcess2 = __toESM2(require("node:child_process"));
36822
+ var childProcess4 = __toESM2(require("node:child_process"));
36571
36823
  var import_errors = require_errors3();
36572
36824
  var import_normalizeCommand = require_normalizeCommand();
36573
36825
  var import_resolveExecutable = require_resolveExecutable();
@@ -36650,7 +36902,7 @@ var require_process = __commonJS({
36650
36902
  function spawn2(command, args = [], options = {}) {
36651
36903
  const prepared = prepareProcess(command, args, options, spawnOptionNames);
36652
36904
  const child = callWithSanitizedChildProcessErrors(
36653
- () => childProcess2.spawn(prepared.command.executable, prepared.command.args, {
36905
+ () => childProcess4.spawn(prepared.command.executable, prepared.command.args, {
36654
36906
  ...prepared.nodeOptions,
36655
36907
  cwd: prepared.command.cwd,
36656
36908
  env: prepared.command.env,
@@ -36663,7 +36915,7 @@ var require_process = __commonJS({
36663
36915
  function spawnSync2(command, args = [], options = {}) {
36664
36916
  const prepared = prepareProcess(command, args, options, spawnSyncOptionNames);
36665
36917
  const result = callWithSanitizedChildProcessErrors(
36666
- () => childProcess2.spawnSync(prepared.command.executable, prepared.command.args, {
36918
+ () => childProcess4.spawnSync(prepared.command.executable, prepared.command.args, {
36667
36919
  ...prepared.nodeOptions,
36668
36920
  cwd: prepared.command.cwd,
36669
36921
  env: prepared.command.env,
@@ -36679,11 +36931,11 @@ var require_process = __commonJS({
36679
36931
  }
36680
36932
  return result;
36681
36933
  }
36682
- async function execFile7(command, args = [], options = {}) {
36934
+ async function execFile8(command, args = [], options = {}) {
36683
36935
  const prepared = prepareProcess(command, args, options, execFileOptionNames);
36684
36936
  return new Promise((resolve, reject) => {
36685
36937
  callWithSanitizedChildProcessErrors(
36686
- () => childProcess2.execFile(
36938
+ () => childProcess4.execFile(
36687
36939
  prepared.command.executable,
36688
36940
  prepared.command.args,
36689
36941
  {
@@ -36845,6 +37097,7 @@ var require_azureDeveloperCliCredential = __commonJS({
36845
37097
  var import_tenantIdUtils = require_tenantIdUtils();
36846
37098
  var import_tracing = require_tracing();
36847
37099
  var import_scopeUtils = require_scopeUtils();
37100
+ var import_core_util = require_commonjs4();
36848
37101
  var import_processUtils = require_processUtils();
36849
37102
  var logger2 = (0, import_logging.credentialLogger)("AzureDeveloperCliCredential");
36850
37103
  var azureDeveloperCliPublicErrorMessages = {
@@ -36854,6 +37107,51 @@ var require_azureDeveloperCliCredential = __commonJS({
36854
37107
  claim: "This credential doesn't support claims challenges. To authenticate with the required claims, please run the following command:"
36855
37108
  };
36856
37109
  var developerCliCredentialInternals = {
37110
+ /**
37111
+ * Parses azd stderr JSON output to extract a human-readable error message.
37112
+ *
37113
+ * Three formats are supported across azd versions:
37114
+ * - pre-v1.23.7: `{"type":"consoleMessage","data":{"message":"..."}}`
37115
+ * - v1.23.7 - v1.23.15: an empty `consoleMessage` line followed by `{"error":"...","message":"...","suggestion":"..."}`
37116
+ * - v1.24.0+: `{"error":"...","message":"...","suggestion":"..."}`
37117
+ *
37118
+ * The structured `error` field is preferred. If absent, falls back to the
37119
+ * first non-empty `data.message` from a legacy `consoleMessage` line. If
37120
+ * neither is found, the raw stderr is returned unchanged so plain-text and
37121
+ * malformed output continue to surface to callers.
37122
+ *
37123
+ * @param stderr - The stderr output from azd command
37124
+ * @returns The parsed error message or raw stderr
37125
+ * @internal
37126
+ */
37127
+ parseAzdStderr(stderr) {
37128
+ if (!stderr?.trim()) {
37129
+ return stderr;
37130
+ }
37131
+ let fallback;
37132
+ for (const rawLine of stderr.split("\n")) {
37133
+ const line = rawLine.trim();
37134
+ if (!line.startsWith("{")) {
37135
+ continue;
37136
+ }
37137
+ let parsed;
37138
+ try {
37139
+ parsed = JSON.parse(line);
37140
+ } catch {
37141
+ continue;
37142
+ }
37143
+ if (typeof parsed?.error === "string" && parsed.error.trim()) {
37144
+ return parsed.error.trim();
37145
+ }
37146
+ if (fallback === void 0) {
37147
+ const message = parsed?.data?.message;
37148
+ if (typeof message === "string" && message.trim()) {
37149
+ fallback = message.trim();
37150
+ }
37151
+ }
37152
+ }
37153
+ return fallback ?? stderr;
37154
+ },
36857
37155
  /**
36858
37156
  * @internal
36859
37157
  */
@@ -36883,7 +37181,7 @@ var require_azureDeveloperCliCredential = __commonJS({
36883
37181
  }
36884
37182
  let claimsSections = [];
36885
37183
  if (claims) {
36886
- const encodedClaims = btoa(claims);
37184
+ const encodedClaims = (0, import_core_util.uint8ArrayToString)((0, import_core_util.stringToUint8Array)(claims, "utf-8"), "base64");
36887
37185
  claimsSections = ["--claims", encodedClaims];
36888
37186
  }
36889
37187
  const args = [
@@ -36995,7 +37293,8 @@ var require_azureDeveloperCliCredential = __commonJS({
36995
37293
  };
36996
37294
  } catch (e) {
36997
37295
  if (obj.stderr) {
36998
- throw new import_errors.CredentialUnavailableError(obj.stderr);
37296
+ const errorMessage = developerCliCredentialInternals.parseAzdStderr(obj.stderr);
37297
+ throw new import_errors.CredentialUnavailableError(errorMessage);
36999
37298
  }
37000
37299
  throw e;
37001
37300
  }
@@ -37081,6 +37380,7 @@ var require_azureCliCredential = __commonJS({
37081
37380
  var import_logging = require_logging();
37082
37381
  var import_scopeUtils = require_scopeUtils();
37083
37382
  var import_errors = require_errors2();
37383
+ var import_core_util = require_commonjs4();
37084
37384
  var import_tracing = require_tracing();
37085
37385
  var import_subscriptionUtils = require_subscriptionUtils();
37086
37386
  var import_processUtils = require_processUtils();
@@ -37182,7 +37482,7 @@ var require_azureCliCredential = __commonJS({
37182
37482
  const scope = typeof scopes === "string" ? scopes : scopes[0];
37183
37483
  const claimsValue = options.claims;
37184
37484
  if (claimsValue && claimsValue.trim()) {
37185
- const encodedClaims = btoa(claimsValue);
37485
+ const encodedClaims = (0, import_core_util.uint8ArrayToString)((0, import_core_util.stringToUint8Array)(claimsValue, "utf-8"), "base64");
37186
37486
  let loginCmd = `az login --claims-challenge ${encodedClaims} --scope ${scope}`;
37187
37487
  const tenantIdFromOptions = options.tenantId;
37188
37488
  if (tenantIdFromOptions) {
@@ -37324,6 +37624,7 @@ var require_azurePowerShellCredential = __commonJS({
37324
37624
  var import_errors = require_errors2();
37325
37625
  var import_processUtils = require_processUtils();
37326
37626
  var import_tracing = require_tracing();
37627
+ var import_core_util = require_commonjs4();
37327
37628
  var logger2 = (0, import_logging.credentialLogger)("AzurePowerShellCredential");
37328
37629
  var isWindows = process.platform === "win32";
37329
37630
  var powerShellResourceEnvironmentVariable = "AZURE_IDENTITY_POWERSHELL_RESOURCE";
@@ -37488,7 +37789,10 @@ var require_azurePowerShellCredential = __commonJS({
37488
37789
  const scope = typeof scopes === "string" ? scopes : scopes[0];
37489
37790
  const claimsValue = options.claims;
37490
37791
  if (claimsValue && claimsValue.trim()) {
37491
- const encodedClaims = btoa(claimsValue);
37792
+ const encodedClaims = (0, import_core_util.uint8ArrayToString)(
37793
+ (0, import_core_util.stringToUint8Array)(claimsValue, "utf-8"),
37794
+ "base64"
37795
+ );
37492
37796
  let loginCmd = `Connect-AzAccount -ClaimsChallenge ${encodedClaims}`;
37493
37797
  const tenantIdFromOptions = options.tenantId;
37494
37798
  if (tenantIdFromOptions) {
@@ -37779,7 +38083,6 @@ var require_brokerCredential = __commonJS({
37779
38083
  );
37780
38084
  const msalClientOptions = {
37781
38085
  ...options,
37782
- tokenCredentialOptions: options,
37783
38086
  logger: logger2,
37784
38087
  brokerOptions: {
37785
38088
  enabled: true,
@@ -38145,7 +38448,6 @@ var require_interactiveBrowserCredential = __commonJS({
38145
38448
  );
38146
38449
  const msalClientOptions = {
38147
38450
  ...options,
38148
- tokenCredentialOptions: options,
38149
38451
  logger: logger2
38150
38452
  };
38151
38453
  const ibcNodeOptions = options;
@@ -38313,8 +38615,7 @@ var require_deviceCodeCredential = __commonJS({
38313
38615
  this.userPromptCallback = options?.userPromptCallback ?? defaultDeviceCodePromptCallback;
38314
38616
  this.msalClient = (0, import_msalClient.createMsalClient)(clientId, tenantId, {
38315
38617
  ...options,
38316
- logger: logger2,
38317
- tokenCredentialOptions: options || {}
38618
+ logger: logger2
38318
38619
  });
38319
38620
  this.disableAutomaticAuthentication = options?.disableAutomaticAuthentication;
38320
38621
  }
@@ -38634,8 +38935,7 @@ var require_authorizationCodeCredential = __commonJS({
38634
38935
  );
38635
38936
  this.msalClient = (0, import_msalClient.createMsalClient)(clientId, tenantId, {
38636
38937
  ...options,
38637
- logger: logger2,
38638
- tokenCredentialOptions: options ?? {}
38938
+ logger: logger2
38639
38939
  });
38640
38940
  }
38641
38941
  /**
@@ -38760,8 +39060,7 @@ var require_onBehalfOfCredential = __commonJS({
38760
39060
  );
38761
39061
  this.msalClient = (0, import_msalClient.createMsalClient)(clientId, this.tenantId, {
38762
39062
  ...options,
38763
- logger: logger2,
38764
- tokenCredentialOptions: options
39063
+ logger: logger2
38765
39064
  });
38766
39065
  }
38767
39066
  /**
@@ -39584,206 +39883,17 @@ var require_transient_error_lookup = __commonJS({
39584
39883
  }
39585
39884
  });
39586
39885
 
39587
- // node_modules/sprintf-js/src/sprintf.js
39588
- var require_sprintf = __commonJS({
39589
- "node_modules/sprintf-js/src/sprintf.js"(exports2) {
39590
- !(function() {
39591
- "use strict";
39592
- var re = {
39593
- not_string: /[^s]/,
39594
- not_bool: /[^t]/,
39595
- not_type: /[^T]/,
39596
- not_primitive: /[^v]/,
39597
- number: /[diefg]/,
39598
- numeric_arg: /[bcdiefguxX]/,
39599
- json: /[j]/,
39600
- not_json: /[^j]/,
39601
- text: /^[^\x25]+/,
39602
- modulo: /^\x25{2}/,
39603
- placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,
39604
- key: /^([a-z_][a-z_\d]*)/i,
39605
- key_access: /^\.([a-z_][a-z_\d]*)/i,
39606
- index_access: /^\[(\d+)\]/,
39607
- sign: /^[+-]/
39608
- };
39609
- function sprintf(key) {
39610
- return sprintf_format(sprintf_parse(key), arguments);
39611
- }
39612
- function vsprintf(fmt, argv) {
39613
- return sprintf.apply(null, [fmt].concat(argv || []));
39614
- }
39615
- function sprintf_format(parse_tree, argv) {
39616
- var cursor = 1, tree_length = parse_tree.length, arg, output = "", i, k, ph, pad, pad_character, pad_length, is_positive, sign;
39617
- for (i = 0; i < tree_length; i++) {
39618
- if (typeof parse_tree[i] === "string") {
39619
- output += parse_tree[i];
39620
- } else if (typeof parse_tree[i] === "object") {
39621
- ph = parse_tree[i];
39622
- if (ph.keys) {
39623
- arg = argv[cursor];
39624
- for (k = 0; k < ph.keys.length; k++) {
39625
- if (arg == void 0) {
39626
- throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k - 1]));
39627
- }
39628
- arg = arg[ph.keys[k]];
39629
- }
39630
- } else if (ph.param_no) {
39631
- arg = argv[ph.param_no];
39632
- } else {
39633
- arg = argv[cursor++];
39634
- }
39635
- if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) {
39636
- arg = arg();
39637
- }
39638
- if (re.numeric_arg.test(ph.type) && (typeof arg !== "number" && isNaN(arg))) {
39639
- throw new TypeError(sprintf("[sprintf] expecting number but found %T", arg));
39640
- }
39641
- if (re.number.test(ph.type)) {
39642
- is_positive = arg >= 0;
39643
- }
39644
- switch (ph.type) {
39645
- case "b":
39646
- arg = parseInt(arg, 10).toString(2);
39647
- break;
39648
- case "c":
39649
- arg = String.fromCharCode(parseInt(arg, 10));
39650
- break;
39651
- case "d":
39652
- case "i":
39653
- arg = parseInt(arg, 10);
39654
- break;
39655
- case "j":
39656
- arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0);
39657
- break;
39658
- case "e":
39659
- arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential();
39660
- break;
39661
- case "f":
39662
- arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg);
39663
- break;
39664
- case "g":
39665
- arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg);
39666
- break;
39667
- case "o":
39668
- arg = (parseInt(arg, 10) >>> 0).toString(8);
39669
- break;
39670
- case "s":
39671
- arg = String(arg);
39672
- arg = ph.precision ? arg.substring(0, ph.precision) : arg;
39673
- break;
39674
- case "t":
39675
- arg = String(!!arg);
39676
- arg = ph.precision ? arg.substring(0, ph.precision) : arg;
39677
- break;
39678
- case "T":
39679
- arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();
39680
- arg = ph.precision ? arg.substring(0, ph.precision) : arg;
39681
- break;
39682
- case "u":
39683
- arg = parseInt(arg, 10) >>> 0;
39684
- break;
39685
- case "v":
39686
- arg = arg.valueOf();
39687
- arg = ph.precision ? arg.substring(0, ph.precision) : arg;
39688
- break;
39689
- case "x":
39690
- arg = (parseInt(arg, 10) >>> 0).toString(16);
39691
- break;
39692
- case "X":
39693
- arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase();
39694
- break;
39695
- }
39696
- if (re.json.test(ph.type)) {
39697
- output += arg;
39698
- } else {
39699
- if (re.number.test(ph.type) && (!is_positive || ph.sign)) {
39700
- sign = is_positive ? "+" : "-";
39701
- arg = arg.toString().replace(re.sign, "");
39702
- } else {
39703
- sign = "";
39704
- }
39705
- pad_character = ph.pad_char ? ph.pad_char === "0" ? "0" : ph.pad_char.charAt(1) : " ";
39706
- pad_length = ph.width - (sign + arg).length;
39707
- pad = ph.width ? pad_length > 0 ? pad_character.repeat(pad_length) : "" : "";
39708
- output += ph.align ? sign + arg + pad : pad_character === "0" ? sign + pad + arg : pad + sign + arg;
39709
- }
39710
- }
39711
- }
39712
- return output;
39713
- }
39714
- var sprintf_cache = /* @__PURE__ */ Object.create(null);
39715
- function sprintf_parse(fmt) {
39716
- if (sprintf_cache[fmt]) {
39717
- return sprintf_cache[fmt];
39718
- }
39719
- var _fmt = fmt, match, parse_tree = [], arg_names = 0;
39720
- while (_fmt) {
39721
- if ((match = re.text.exec(_fmt)) !== null) {
39722
- parse_tree.push(match[0]);
39723
- } else if ((match = re.modulo.exec(_fmt)) !== null) {
39724
- parse_tree.push("%");
39725
- } else if ((match = re.placeholder.exec(_fmt)) !== null) {
39726
- if (match[2]) {
39727
- arg_names |= 1;
39728
- var field_list = [], replacement_field = match[2], field_match = [];
39729
- if ((field_match = re.key.exec(replacement_field)) !== null) {
39730
- field_list.push(field_match[1]);
39731
- while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") {
39732
- if ((field_match = re.key_access.exec(replacement_field)) !== null) {
39733
- field_list.push(field_match[1]);
39734
- } else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
39735
- field_list.push(field_match[1]);
39736
- } else {
39737
- throw new SyntaxError("[sprintf] failed to parse named argument key");
39738
- }
39739
- }
39740
- } else {
39741
- throw new SyntaxError("[sprintf] failed to parse named argument key");
39742
- }
39743
- match[2] = field_list;
39744
- } else {
39745
- arg_names |= 2;
39746
- }
39747
- if (arg_names === 3) {
39748
- throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
39749
- }
39750
- parse_tree.push(
39751
- {
39752
- placeholder: match[0],
39753
- param_no: match[1],
39754
- keys: match[2],
39755
- sign: match[3],
39756
- pad_char: match[4],
39757
- align: match[5],
39758
- width: match[6],
39759
- precision: match[7],
39760
- type: match[8]
39761
- }
39762
- );
39763
- } else {
39764
- throw new SyntaxError("[sprintf] unexpected placeholder");
39765
- }
39766
- _fmt = _fmt.substring(match[0].length);
39767
- }
39768
- return sprintf_cache[fmt] = parse_tree;
39769
- }
39770
- if (typeof exports2 !== "undefined") {
39771
- exports2["sprintf"] = sprintf;
39772
- exports2["vsprintf"] = vsprintf;
39773
- }
39774
- if (typeof window !== "undefined") {
39775
- window["sprintf"] = sprintf;
39776
- window["vsprintf"] = vsprintf;
39777
- if (typeof define === "function" && define["amd"]) {
39778
- define(function() {
39779
- return {
39780
- "sprintf": sprintf,
39781
- "vsprintf": vsprintf
39782
- };
39783
- });
39784
- }
39785
- }
39786
- })();
39886
+ // node_modules/tedious/lib/format-hex.js
39887
+ var require_format_hex = __commonJS({
39888
+ "node_modules/tedious/lib/format-hex.js"(exports2) {
39889
+ "use strict";
39890
+ Object.defineProperty(exports2, "__esModule", {
39891
+ value: true
39892
+ });
39893
+ exports2.formatHex = formatHex;
39894
+ function formatHex(value, width) {
39895
+ return (value >>> 0).toString(16).toUpperCase().padStart(width, "0");
39896
+ }
39787
39897
  }
39788
39898
  });
39789
39899
 
@@ -39797,7 +39907,7 @@ var require_packet = __commonJS({
39797
39907
  exports2.TYPE = exports2.Packet = exports2.OFFSET = exports2.HEADER_LENGTH = void 0;
39798
39908
  exports2.isPacketComplete = isPacketComplete;
39799
39909
  exports2.packetLength = packetLength;
39800
- var _sprintfJs = require_sprintf();
39910
+ var _formatHex = require_format_hex();
39801
39911
  var HEADER_LENGTH = exports2.HEADER_LENGTH = 8;
39802
39912
  var TYPE = exports2.TYPE = {
39803
39913
  SQL_BATCH: 1,
@@ -39919,7 +40029,8 @@ var require_packet = __commonJS({
39919
40029
  return statuses.join(" ").trim();
39920
40030
  }
39921
40031
  headerToString(indent = "") {
39922
- const text = (0, _sprintfJs.sprintf)("type:0x%02X(%s), status:0x%02X(%s), length:0x%04X, spid:0x%04X, packetId:0x%02X, window:0x%02X", this.buffer.readUInt8(OFFSET.Type), typeByValue[this.buffer.readUInt8(OFFSET.Type)], this.buffer.readUInt8(OFFSET.Status), this.statusAsString(), this.buffer.readUInt16BE(OFFSET.Length), this.buffer.readUInt16BE(OFFSET.SPID), this.buffer.readUInt8(OFFSET.PacketID), this.buffer.readUInt8(OFFSET.Window));
40032
+ const type = this.buffer.readUInt8(OFFSET.Type);
40033
+ const text = `type:0x${(0, _formatHex.formatHex)(type, 2)}(${typeByValue[type]}), status:0x${(0, _formatHex.formatHex)(this.buffer.readUInt8(OFFSET.Status), 2)}(${this.statusAsString()}), length:0x${(0, _formatHex.formatHex)(this.buffer.readUInt16BE(OFFSET.Length), 4)}, spid:0x${(0, _formatHex.formatHex)(this.buffer.readUInt16BE(OFFSET.SPID), 4)}, packetId:0x${(0, _formatHex.formatHex)(this.buffer.readUInt8(OFFSET.PacketID), 2)}, window:0x${(0, _formatHex.formatHex)(this.buffer.readUInt8(OFFSET.Window), 2)}`;
39923
40034
  return indent + text;
39924
40035
  }
39925
40036
  dataToString(indent = "") {
@@ -39932,7 +40043,7 @@ var require_packet = __commonJS({
39932
40043
  for (let offset = 0; offset < data.length; offset++) {
39933
40044
  if (offset % BYTES_PER_LINE === 0) {
39934
40045
  dataDump += indent;
39935
- dataDump += (0, _sprintfJs.sprintf)("%04X ", offset);
40046
+ dataDump += (0, _formatHex.formatHex)(offset, 4) + " ";
39936
40047
  }
39937
40048
  if (data[offset] < 32 || data[offset] > 126) {
39938
40049
  chars += ".";
@@ -39943,7 +40054,7 @@ var require_packet = __commonJS({
39943
40054
  chars += String.fromCharCode(data[offset]);
39944
40055
  }
39945
40056
  if (data[offset] != null) {
39946
- dataDump += (0, _sprintfJs.sprintf)("%02X", data[offset]);
40057
+ dataDump += (0, _formatHex.formatHex)(data[offset], 2);
39947
40058
  }
39948
40059
  if ((offset + 1) % BYTES_PER_GROUP === 0 && !((offset + 1) % BYTES_PER_LINE === 0)) {
39949
40060
  dataDump += " ";
@@ -39990,7 +40101,8 @@ var require_prelogin_payload = __commonJS({
39990
40101
  value: true
39991
40102
  });
39992
40103
  exports2.default = void 0;
39993
- var _sprintfJs = require_sprintf();
40104
+ var _errors = require_errors();
40105
+ var _formatHex = require_format_hex();
39994
40106
  var _writableTrackingBuffer = _interopRequireDefault(require_writable_tracking_buffer());
39995
40107
  var _crypto = require("crypto");
39996
40108
  function _interopRequireDefault(e) {
@@ -40141,6 +40253,7 @@ var require_prelogin_payload = __commonJS({
40141
40253
  }
40142
40254
  extractOptions() {
40143
40255
  let offset = 0;
40256
+ let encryptionOffset;
40144
40257
  while (this.data[offset] !== TOKEN.TERMINATOR) {
40145
40258
  let dataOffset = this.data.readUInt16BE(offset + 1);
40146
40259
  const dataLength = this.data.readUInt16BE(offset + 3);
@@ -40149,6 +40262,13 @@ var require_prelogin_payload = __commonJS({
40149
40262
  this.extractVersion(dataOffset);
40150
40263
  break;
40151
40264
  case TOKEN.ENCRYPTION:
40265
+ if (encryptionOffset !== void 0) {
40266
+ throw new _errors.ConnectionError("Duplicate ENCRYPTION option in PRELOGIN response", "EENCRYPT");
40267
+ }
40268
+ if (dataLength !== 1 || dataOffset >= this.data.length) {
40269
+ throw new _errors.ConnectionError("Malformed ENCRYPTION option in PRELOGIN response", "EENCRYPT");
40270
+ }
40271
+ encryptionOffset = dataOffset;
40152
40272
  this.extractEncryption(dataOffset);
40153
40273
  break;
40154
40274
  case TOKEN.INSTOPT:
@@ -40172,6 +40292,9 @@ var require_prelogin_payload = __commonJS({
40172
40292
  offset += 5;
40173
40293
  dataOffset += dataLength;
40174
40294
  }
40295
+ if (encryptionOffset !== void 0 && encryptionOffset <= offset) {
40296
+ throw new _errors.ConnectionError("Malformed ENCRYPTION option in PRELOGIN response", "EENCRYPT");
40297
+ }
40175
40298
  }
40176
40299
  extractVersion(offset) {
40177
40300
  this.version = {
@@ -40202,7 +40325,13 @@ var require_prelogin_payload = __commonJS({
40202
40325
  this.fedAuthRequired = this.data.readUInt8(offset);
40203
40326
  }
40204
40327
  toString(indent = "") {
40205
- return indent + "PreLogin - " + (0, _sprintfJs.sprintf)("version:%d.%d.%d.%d, encryption:0x%02X(%s), instopt:0x%02X, threadId:0x%08X, mars:0x%02X(%s), traceId:%s", this.version.major, this.version.minor, this.version.build, this.version.subbuild, this.encryption ? this.encryption : 0, this.encryptionString ? this.encryptionString : "", this.instance ? this.instance : 0, this.threadId ? this.threadId : 0, this.mars ? this.mars : 0, this.marsString ? this.marsString : "", this.traceId ? this.traceId.toString("hex") : "");
40328
+ const {
40329
+ major,
40330
+ minor,
40331
+ build,
40332
+ subbuild
40333
+ } = this.version;
40334
+ return indent + `PreLogin - version:${major}.${minor}.${build}.${subbuild}, encryption:0x${(0, _formatHex.formatHex)(this.encryption ? this.encryption : 0, 2)}(${this.encryptionString ? this.encryptionString : ""}), instopt:0x${(0, _formatHex.formatHex)(this.instance ? this.instance : 0, 2)}, threadId:0x${(0, _formatHex.formatHex)(this.threadId ? this.threadId : 0, 8)}, mars:0x${(0, _formatHex.formatHex)(this.mars ? this.mars : 0, 2)}(${this.marsString ? this.marsString : ""}), traceId:${this.traceId ? this.traceId.toString("hex") : ""}`;
40206
40335
  }
40207
40336
  };
40208
40337
  var _default = exports2.default = PreloginPayload;
@@ -40241,7 +40370,7 @@ var require_login7_payload = __commonJS({
40241
40370
  value: true
40242
40371
  });
40243
40372
  exports2.default = void 0;
40244
- var _sprintfJs = require_sprintf();
40373
+ var _formatHex = require_format_hex();
40245
40374
  var _tdsVersions = require_tds_versions();
40246
40375
  var FLAGS_1 = {
40247
40376
  ENDIAN_LITTLE: 0,
@@ -40559,9 +40688,15 @@ var require_login7_payload = __commonJS({
40559
40688
  return password;
40560
40689
  }
40561
40690
  toString(indent = "") {
40562
- return indent + "Login7 - " + (0, _sprintfJs.sprintf)("TDS:0x%08X, PacketSize:0x%08X, ClientProgVer:0x%08X, ClientPID:0x%08X, ConnectionID:0x%08X", this.tdsVersion, this.packetSize, this.clientProgVer, this.clientPid, this.connectionId) + "\n" + indent + " " + (0, _sprintfJs.sprintf)("Flags1:0x%02X, Flags2:0x%02X, TypeFlags:0x%02X, Flags3:0x%02X, ClientTimezone:%d, ClientLCID:0x%08X", this.buildOptionFlags1(), this.buildOptionFlags2(), this.buildTypeFlags(), this.buildOptionFlags3(), this.clientTimeZone, this.clientLcid) + "\n" + indent + " " + (0, _sprintfJs.sprintf)("Hostname:'%s', Username:'%s', Password:'%s', AppName:'%s', ServerName:'%s', LibraryName:'%s'", this.hostname, this.userName, this.password, this.appName, this.serverName, this.libraryName) + "\n" + indent + " " + (0, _sprintfJs.sprintf)("Language:'%s', Database:'%s', SSPI:'%s', AttachDbFile:'%s', ChangePassword:'%s'", this.language, this.database, this.sspi, this.attachDbFile, this.changePassword);
40691
+ return indent + `Login7 - TDS:0x${(0, _formatHex.formatHex)(this.tdsVersion, 8)}, PacketSize:0x${(0, _formatHex.formatHex)(this.packetSize, 8)}, ClientProgVer:0x${(0, _formatHex.formatHex)(this.clientProgVer, 8)}, ClientPID:0x${(0, _formatHex.formatHex)(this.clientPid, 8)}, ConnectionID:0x${(0, _formatHex.formatHex)(this.connectionId, 8)}
40692
+ ` + indent + ` Flags1:0x${(0, _formatHex.formatHex)(this.buildOptionFlags1(), 2)}, Flags2:0x${(0, _formatHex.formatHex)(this.buildOptionFlags2(), 2)}, TypeFlags:0x${(0, _formatHex.formatHex)(this.buildTypeFlags(), 2)}, Flags3:0x${(0, _formatHex.formatHex)(this.buildOptionFlags3(), 2)}, ClientTimezone:${this.clientTimeZone}, ClientLCID:0x${(0, _formatHex.formatHex)(this.clientLcid, 8)}
40693
+ ` + indent + ` Hostname:'${this.hostname}', Username:'${this.userName}', Password:'${redact(this.password)}', AppName:'${this.appName}', ServerName:'${this.serverName}', LibraryName:'${this.libraryName}'
40694
+ ` + indent + ` Language:'${this.language}', Database:'${this.database}', SSPI:'${this.sspi}', AttachDbFile:'${this.attachDbFile}', ChangePassword:'${redact(this.changePassword)}'`;
40563
40695
  }
40564
40696
  };
40697
+ function redact(value) {
40698
+ return value === void 0 ? "undefined" : "********";
40699
+ }
40565
40700
  var _default = exports2.default = Login7Payload;
40566
40701
  module2.exports = Login7Payload;
40567
40702
  }
@@ -56650,19 +56785,24 @@ var require_plp_stream = __commonJS({
56650
56785
  }
56651
56786
  buffer.writeBuffer(PLP_TERMINATOR);
56652
56787
  }
56653
- async function* writePlpStream(buffer, source, encode) {
56788
+ async function* writePlpStream(buffer, source, encode, flush) {
56654
56789
  buffer.writeBuffer(UNKNOWN_PLP_LEN);
56655
- for await (const chunk of source) {
56656
- const bytes = encode(chunk);
56657
- if (bytes.length === 0) {
56658
- continue;
56790
+ const writeChunk = (bytes) => {
56791
+ if (!bytes || bytes.length === 0) {
56792
+ return false;
56659
56793
  }
56660
56794
  buffer.writeUInt32LE(bytes.length);
56661
56795
  buffer.writeBuffer(bytes);
56662
- if (buffer.length >= _writableTrackingBuffer.default.CHUNK_SIZE) {
56796
+ return buffer.length >= _writableTrackingBuffer.default.CHUNK_SIZE;
56797
+ };
56798
+ for await (const chunk of source) {
56799
+ if (writeChunk(encode(chunk))) {
56663
56800
  yield;
56664
56801
  }
56665
56802
  }
56803
+ if (writeChunk(flush?.())) {
56804
+ yield;
56805
+ }
56666
56806
  buffer.writeBuffer(PLP_TERMINATOR);
56667
56807
  }
56668
56808
  }
@@ -56742,7 +56882,8 @@ var require_varbinary = __commonJS({
56742
56882
  }
56743
56883
  const value = Buffer.isBuffer(parameter.value) ? parameter.value : parameter.value.toString();
56744
56884
  const length = typeof value === "string" ? value.length * 2 : value.length;
56745
- if (parameter.length <= this.maximumLength) {
56885
+ const isPlp = !(parameter.length <= this.maximumLength);
56886
+ if (!isPlp) {
56746
56887
  buffer.writeUInt16LE(length);
56747
56888
  } else {
56748
56889
  buffer.writeBuffer(UNKNOWN_PLP_LEN);
@@ -56757,7 +56898,7 @@ var require_varbinary = __commonJS({
56757
56898
  } else {
56758
56899
  buffer.writeBuffer(value);
56759
56900
  }
56760
- if (parameter.length > this.maximumLength) {
56901
+ if (isPlp) {
56761
56902
  buffer.writeBuffer(PLP_TERMINATOR);
56762
56903
  }
56763
56904
  },
@@ -56810,14 +56951,6 @@ var require_varchar = __commonJS({
56810
56951
  var NULL_LENGTH = Buffer.from([255, 255]);
56811
56952
  var MAX_NULL_LENGTH = Buffer.from([255, 255, 255, 255, 255, 255, 255, 255]);
56812
56953
  var NO_COLLATION = Buffer.from([0, 0, 0, 0, 0]);
56813
- function encoderFor(codepage) {
56814
- return (chunk) => {
56815
- if (typeof chunk !== "string") {
56816
- throw new TypeError("Invalid string.");
56817
- }
56818
- return _iconvLite.default.encode(chunk, codepage);
56819
- };
56820
- }
56821
56954
  var VarChar = {
56822
56955
  id: 167,
56823
56956
  type: "BIGVARCHR",
@@ -56915,7 +57048,14 @@ var require_varchar = __commonJS({
56915
57048
  return;
56916
57049
  }
56917
57050
  if ((0, _plpStream.isAsyncIterable)(parameter.value)) {
56918
- return (0, _plpStream.writePlpStream)(buffer, parameter.value, encoderFor(parameter.collation.codepage));
57051
+ const codepage = parameter.collation.codepage;
57052
+ const encoder = _iconvLite.default.getEncoder(codepage);
57053
+ return (0, _plpStream.writePlpStream)(buffer, parameter.value, (chunk) => {
57054
+ if (typeof chunk !== "string") {
57055
+ throw new TypeError("Invalid string.");
57056
+ }
57057
+ return encoder.write(chunk);
57058
+ }, () => encoder.end());
56919
57059
  }
56920
57060
  const value = parameter.value;
56921
57061
  if (parameter.length <= this.maximumLength) {
@@ -57166,7 +57306,8 @@ var require_nvarchar = __commonJS({
57166
57306
  }
57167
57307
  const value = parameter.value instanceof Buffer ? parameter.value : parameter.value.toString();
57168
57308
  const length = typeof value === "string" ? value.length * 2 : value.length;
57169
- if (parameter.length <= this.maximumLength) {
57309
+ const isPlp = !(parameter.length <= this.maximumLength);
57310
+ if (!isPlp) {
57170
57311
  buffer.writeUInt16LE(length);
57171
57312
  } else {
57172
57313
  buffer.writeBuffer(UNKNOWN_PLP_LEN);
@@ -57181,7 +57322,7 @@ var require_nvarchar = __commonJS({
57181
57322
  } else {
57182
57323
  buffer.writeBuffer(value);
57183
57324
  }
57184
- if (parameter.length > this.maximumLength) {
57325
+ if (isPlp) {
57185
57326
  buffer.writeBuffer(PLP_TERMINATOR);
57186
57327
  }
57187
57328
  },
@@ -58337,11 +58478,10 @@ var require_request2 = __commonJS({
58337
58478
  * request is being sent, so it does not have to fit in memory, and a
58338
58479
  * request that carries one can be executed only once.
58339
58480
  *
58340
- * Each chunk of a string source is encoded on its own, as `Writable.write`
58341
- * would encode it, so a chunk must not end halfway through a UTF-16
58342
- * surrogate pair. Text that Node.js decoded from UTF-8 (a `Readable` with
58343
- * `encoding: 'utf8'`, `readline`, `TextDecoder`) never does; a string
58344
- * sliced by index can. A `Buffer` chunk of 8 KB or more is sent by
58481
+ * String chunks may split UTF-16 surrogate pairs; the pairs are preserved
58482
+ * across chunk boundaries, including empty chunks. An unpaired surrogate
58483
+ * is handled by the type's encoding as it is for an in-memory value.
58484
+ * A `Buffer` chunk of 8 KB or more is sent by
58345
58485
  * reference, as `socket.write` would send it, so a source must not reuse
58346
58486
  * or modify a buffer it has yielded until the request has completed.
58347
58487
  *
@@ -60289,7 +60429,7 @@ var require_process2 = __commonJS({
60289
60429
  var require_process3 = __commonJS({
60290
60430
  "node_modules/readable-stream/lib/internal/shims/process.js"(exports2, module2) {
60291
60431
  "use strict";
60292
- var process9 = ((base, esmKey, keys, isValid) => {
60432
+ var process10 = ((base, esmKey, keys, isValid) => {
60293
60433
  if (esmKey in base && base[esmKey] === true) {
60294
60434
  let candidate;
60295
60435
  for (const key of keys) {
@@ -60304,7 +60444,7 @@ var require_process3 = __commonJS({
60304
60444
  }
60305
60445
  return base;
60306
60446
  })(require_process2(), "__esModule", ["default", "process"], (candidate) => "nextTick" in candidate);
60307
- module2.exports = process9;
60447
+ module2.exports = process10;
60308
60448
  }
60309
60449
  });
60310
60450
 
@@ -60521,7 +60661,7 @@ var require_utils6 = __commonJS({
60521
60661
  var require_end_of_stream = __commonJS({
60522
60662
  "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2, module2) {
60523
60663
  "use strict";
60524
- var process9 = require_process3();
60664
+ var process10 = require_process3();
60525
60665
  var { AbortError: AbortError2, codes } = require_errors4();
60526
60666
  var { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes;
60527
60667
  var { kEmptyObject, once } = require_util();
@@ -60657,17 +60797,17 @@ var require_end_of_stream = __commonJS({
60657
60797
  }
60658
60798
  stream.on("close", onclose);
60659
60799
  if (closed) {
60660
- process9.nextTick(onclose);
60800
+ process10.nextTick(onclose);
60661
60801
  } else if (wState !== null && wState !== void 0 && wState.errorEmitted || rState !== null && rState !== void 0 && rState.errorEmitted) {
60662
60802
  if (!willEmitClose) {
60663
- process9.nextTick(onclosed);
60803
+ process10.nextTick(onclosed);
60664
60804
  }
60665
60805
  } else if (!readable && (!willEmitClose || isReadable(stream)) && (writableFinished || isWritable(stream) === false)) {
60666
- process9.nextTick(onclosed);
60806
+ process10.nextTick(onclosed);
60667
60807
  } else if (!writable && (!willEmitClose || isWritable(stream)) && (readableFinished || isReadable(stream) === false)) {
60668
- process9.nextTick(onclosed);
60808
+ process10.nextTick(onclosed);
60669
60809
  } else if (rState && stream.req && stream.aborted) {
60670
- process9.nextTick(onclosed);
60810
+ process10.nextTick(onclosed);
60671
60811
  }
60672
60812
  const cleanup = () => {
60673
60813
  callback = nop;
@@ -60695,7 +60835,7 @@ var require_end_of_stream = __commonJS({
60695
60835
  );
60696
60836
  };
60697
60837
  if (options.signal.aborted) {
60698
- process9.nextTick(abort);
60838
+ process10.nextTick(abort);
60699
60839
  } else {
60700
60840
  addAbortListener = addAbortListener || require_util().addAbortListener;
60701
60841
  const disposable = addAbortListener(options.signal, abort);
@@ -60722,7 +60862,7 @@ var require_end_of_stream = __commonJS({
60722
60862
  );
60723
60863
  };
60724
60864
  if (options.signal.aborted) {
60725
- process9.nextTick(abort);
60865
+ process10.nextTick(abort);
60726
60866
  } else {
60727
60867
  addAbortListener = addAbortListener || require_util().addAbortListener;
60728
60868
  const disposable = addAbortListener(options.signal, abort);
@@ -60735,7 +60875,7 @@ var require_end_of_stream = __commonJS({
60735
60875
  }
60736
60876
  const resolverFn = (...args) => {
60737
60877
  if (!isAborted) {
60738
- process9.nextTick(() => callback.apply(stream, args));
60878
+ process10.nextTick(() => callback.apply(stream, args));
60739
60879
  }
60740
60880
  };
60741
60881
  PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn);
@@ -60773,7 +60913,7 @@ var require_end_of_stream = __commonJS({
60773
60913
  var require_destroy = __commonJS({
60774
60914
  "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
60775
60915
  "use strict";
60776
- var process9 = require_process3();
60916
+ var process10 = require_process3();
60777
60917
  var {
60778
60918
  aggregateTwoErrors,
60779
60919
  codes: { ERR_MULTIPLE_CALLBACK },
@@ -60840,9 +60980,9 @@ var require_destroy = __commonJS({
60840
60980
  cb(err2);
60841
60981
  }
60842
60982
  if (err2) {
60843
- process9.nextTick(emitErrorCloseNT, self2, err2);
60983
+ process10.nextTick(emitErrorCloseNT, self2, err2);
60844
60984
  } else {
60845
- process9.nextTick(emitCloseNT, self2);
60985
+ process10.nextTick(emitCloseNT, self2);
60846
60986
  }
60847
60987
  }
60848
60988
  try {
@@ -60927,7 +61067,7 @@ var require_destroy = __commonJS({
60927
61067
  r.errored = err;
60928
61068
  }
60929
61069
  if (sync) {
60930
- process9.nextTick(emitErrorNT, stream, err);
61070
+ process10.nextTick(emitErrorNT, stream, err);
60931
61071
  } else {
60932
61072
  emitErrorNT(stream, err);
60933
61073
  }
@@ -60949,7 +61089,7 @@ var require_destroy = __commonJS({
60949
61089
  if (stream.listenerCount(kConstruct) > 1) {
60950
61090
  return;
60951
61091
  }
60952
- process9.nextTick(constructNT, stream);
61092
+ process10.nextTick(constructNT, stream);
60953
61093
  }
60954
61094
  function constructNT(stream) {
60955
61095
  let called = false;
@@ -60973,15 +61113,15 @@ var require_destroy = __commonJS({
60973
61113
  } else if (err) {
60974
61114
  errorOrDestroy(stream, err, true);
60975
61115
  } else {
60976
- process9.nextTick(emitConstructNT, stream);
61116
+ process10.nextTick(emitConstructNT, stream);
60977
61117
  }
60978
61118
  }
60979
61119
  try {
60980
61120
  stream._construct((err) => {
60981
- process9.nextTick(onConstruct, err);
61121
+ process10.nextTick(onConstruct, err);
60982
61122
  });
60983
61123
  } catch (err) {
60984
- process9.nextTick(onConstruct, err);
61124
+ process10.nextTick(onConstruct, err);
60985
61125
  }
60986
61126
  }
60987
61127
  function emitConstructNT(stream) {
@@ -60995,7 +61135,7 @@ var require_destroy = __commonJS({
60995
61135
  }
60996
61136
  function emitErrorCloseLegacy(stream, err) {
60997
61137
  stream.emit("error", err);
60998
- process9.nextTick(emitCloseLegacy, stream);
61138
+ process10.nextTick(emitCloseLegacy, stream);
60999
61139
  }
61000
61140
  function destroyer(stream, err) {
61001
61141
  if (!stream || isDestroyed(stream)) {
@@ -61016,9 +61156,9 @@ var require_destroy = __commonJS({
61016
61156
  } else if (typeof stream.close === "function") {
61017
61157
  stream.close();
61018
61158
  } else if (err) {
61019
- process9.nextTick(emitErrorCloseLegacy, stream, err);
61159
+ process10.nextTick(emitErrorCloseLegacy, stream, err);
61020
61160
  } else {
61021
- process9.nextTick(emitCloseLegacy, stream);
61161
+ process10.nextTick(emitCloseLegacy, stream);
61022
61162
  }
61023
61163
  if (!stream.destroyed) {
61024
61164
  stream[kIsDestroyed] = true;
@@ -61603,7 +61743,7 @@ var require_string_decoder = __commonJS({
61603
61743
  var require_from = __commonJS({
61604
61744
  "node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
61605
61745
  "use strict";
61606
- var process9 = require_process3();
61746
+ var process10 = require_process3();
61607
61747
  var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials();
61608
61748
  var { Buffer: Buffer3 } = require("buffer");
61609
61749
  var { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = require_errors4().codes;
@@ -61645,9 +61785,9 @@ var require_from = __commonJS({
61645
61785
  readable._destroy = function(error, cb) {
61646
61786
  PromisePrototypeThen(
61647
61787
  close(error),
61648
- () => process9.nextTick(cb, error),
61788
+ () => process10.nextTick(cb, error),
61649
61789
  // nextTick is here in case cb throws
61650
- (e) => process9.nextTick(cb, e || error)
61790
+ (e) => process10.nextTick(cb, e || error)
61651
61791
  );
61652
61792
  };
61653
61793
  async function close(error) {
@@ -61698,7 +61838,7 @@ var require_from = __commonJS({
61698
61838
  var require_readable = __commonJS({
61699
61839
  "node_modules/readable-stream/lib/internal/streams/readable.js"(exports2, module2) {
61700
61840
  "use strict";
61701
- var process9 = require_process3();
61841
+ var process10 = require_process3();
61702
61842
  var {
61703
61843
  ArrayPrototypeIndexOf,
61704
61844
  NumberIsInteger,
@@ -62083,7 +62223,7 @@ var require_readable = __commonJS({
62083
62223
  if (!state.emittedReadable) {
62084
62224
  debug("emitReadable", state.flowing);
62085
62225
  state.emittedReadable = true;
62086
- process9.nextTick(emitReadable_, stream);
62226
+ process10.nextTick(emitReadable_, stream);
62087
62227
  }
62088
62228
  }
62089
62229
  function emitReadable_(stream) {
@@ -62099,7 +62239,7 @@ var require_readable = __commonJS({
62099
62239
  function maybeReadMore(stream, state) {
62100
62240
  if (!state.readingMore && state.constructed) {
62101
62241
  state.readingMore = true;
62102
- process9.nextTick(maybeReadMore_, stream, state);
62242
+ process10.nextTick(maybeReadMore_, stream, state);
62103
62243
  }
62104
62244
  }
62105
62245
  function maybeReadMore_(stream, state) {
@@ -62126,9 +62266,9 @@ var require_readable = __commonJS({
62126
62266
  }
62127
62267
  state.pipes.push(dest);
62128
62268
  debug("pipe count=%d opts=%j", state.pipes.length, pipeOpts);
62129
- const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process9.stdout && dest !== process9.stderr;
62269
+ const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process10.stdout && dest !== process10.stderr;
62130
62270
  const endFn = doEnd ? onend : unpipe;
62131
- if (state.endEmitted) process9.nextTick(endFn);
62271
+ if (state.endEmitted) process10.nextTick(endFn);
62132
62272
  else src.once("end", endFn);
62133
62273
  dest.on("unpipe", onunpipe);
62134
62274
  function onunpipe(readable, unpipeInfo) {
@@ -62278,7 +62418,7 @@ var require_readable = __commonJS({
62278
62418
  if (state.length) {
62279
62419
  emitReadable(this);
62280
62420
  } else if (!state.reading) {
62281
- process9.nextTick(nReadingNextTick, this);
62421
+ process10.nextTick(nReadingNextTick, this);
62282
62422
  }
62283
62423
  }
62284
62424
  }
@@ -62288,7 +62428,7 @@ var require_readable = __commonJS({
62288
62428
  Readable.prototype.removeListener = function(ev, fn) {
62289
62429
  const res = Stream.prototype.removeListener.call(this, ev, fn);
62290
62430
  if (ev === "readable") {
62291
- process9.nextTick(updateReadableListening, this);
62431
+ process10.nextTick(updateReadableListening, this);
62292
62432
  }
62293
62433
  return res;
62294
62434
  };
@@ -62296,7 +62436,7 @@ var require_readable = __commonJS({
62296
62436
  Readable.prototype.removeAllListeners = function(ev) {
62297
62437
  const res = Stream.prototype.removeAllListeners.apply(this, arguments);
62298
62438
  if (ev === "readable" || ev === void 0) {
62299
- process9.nextTick(updateReadableListening, this);
62439
+ process10.nextTick(updateReadableListening, this);
62300
62440
  }
62301
62441
  return res;
62302
62442
  };
@@ -62328,7 +62468,7 @@ var require_readable = __commonJS({
62328
62468
  function resume(stream, state) {
62329
62469
  if (!state.resumeScheduled) {
62330
62470
  state.resumeScheduled = true;
62331
- process9.nextTick(resume_, stream, state);
62471
+ process10.nextTick(resume_, stream, state);
62332
62472
  }
62333
62473
  }
62334
62474
  function resume_(stream, state) {
@@ -62605,7 +62745,7 @@ var require_readable = __commonJS({
62605
62745
  debug("endReadable", state.endEmitted);
62606
62746
  if (!state.endEmitted) {
62607
62747
  state.ended = true;
62608
- process9.nextTick(endReadableNT, state, stream);
62748
+ process10.nextTick(endReadableNT, state, stream);
62609
62749
  }
62610
62750
  }
62611
62751
  function endReadableNT(state, stream) {
@@ -62614,7 +62754,7 @@ var require_readable = __commonJS({
62614
62754
  state.endEmitted = true;
62615
62755
  stream.emit("end");
62616
62756
  if (stream.writable && stream.allowHalfOpen === false) {
62617
- process9.nextTick(endWritableNT, stream);
62757
+ process10.nextTick(endWritableNT, stream);
62618
62758
  } else if (state.autoDestroy) {
62619
62759
  const wState = stream._writableState;
62620
62760
  const autoDestroy = !wState || wState.autoDestroy && // We don't expect the writable to ever 'finish'
@@ -62664,7 +62804,7 @@ var require_readable = __commonJS({
62664
62804
  var require_writable = __commonJS({
62665
62805
  "node_modules/readable-stream/lib/internal/streams/writable.js"(exports2, module2) {
62666
62806
  "use strict";
62667
- var process9 = require_process3();
62807
+ var process10 = require_process3();
62668
62808
  var {
62669
62809
  ArrayPrototypeSlice,
62670
62810
  Error: Error2,
@@ -62817,7 +62957,7 @@ var require_writable = __commonJS({
62817
62957
  err = new ERR_STREAM_DESTROYED("write");
62818
62958
  }
62819
62959
  if (err) {
62820
- process9.nextTick(cb, err);
62960
+ process10.nextTick(cb, err);
62821
62961
  errorOrDestroy(stream, err, true);
62822
62962
  return err;
62823
62963
  }
@@ -62907,7 +63047,7 @@ var require_writable = __commonJS({
62907
63047
  stream._readableState.errored = er;
62908
63048
  }
62909
63049
  if (sync) {
62910
- process9.nextTick(onwriteError, stream, state, er, cb);
63050
+ process10.nextTick(onwriteError, stream, state, er, cb);
62911
63051
  } else {
62912
63052
  onwriteError(stream, state, er, cb);
62913
63053
  }
@@ -62925,7 +63065,7 @@ var require_writable = __commonJS({
62925
63065
  stream,
62926
63066
  state
62927
63067
  };
62928
- process9.nextTick(afterWriteTick, state.afterWriteTickInfo);
63068
+ process10.nextTick(afterWriteTick, state.afterWriteTickInfo);
62929
63069
  }
62930
63070
  } else {
62931
63071
  afterWrite(stream, state, 1, cb);
@@ -63062,7 +63202,7 @@ var require_writable = __commonJS({
63062
63202
  }
63063
63203
  if (typeof cb === "function") {
63064
63204
  if (err || state.finished) {
63065
- process9.nextTick(cb, err);
63205
+ process10.nextTick(cb, err);
63066
63206
  } else {
63067
63207
  state[kOnFinished].push(cb);
63068
63208
  }
@@ -63091,7 +63231,7 @@ var require_writable = __commonJS({
63091
63231
  state.prefinished = true;
63092
63232
  stream.emit("prefinish");
63093
63233
  state.pendingcb++;
63094
- process9.nextTick(finish, stream, state);
63234
+ process10.nextTick(finish, stream, state);
63095
63235
  }
63096
63236
  }
63097
63237
  state.sync = true;
@@ -63120,7 +63260,7 @@ var require_writable = __commonJS({
63120
63260
  if (state.pendingcb === 0) {
63121
63261
  if (sync) {
63122
63262
  state.pendingcb++;
63123
- process9.nextTick(
63263
+ process10.nextTick(
63124
63264
  (stream2, state2) => {
63125
63265
  if (needFinish(state2)) {
63126
63266
  finish(stream2, state2);
@@ -63255,7 +63395,7 @@ var require_writable = __commonJS({
63255
63395
  Writable.prototype.destroy = function(err, cb) {
63256
63396
  const state = this._writableState;
63257
63397
  if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) {
63258
- process9.nextTick(errorBuffer, state);
63398
+ process10.nextTick(errorBuffer, state);
63259
63399
  }
63260
63400
  destroy.call(this, err, cb);
63261
63401
  return this;
@@ -63284,7 +63424,7 @@ var require_writable = __commonJS({
63284
63424
  // node_modules/readable-stream/lib/internal/streams/duplexify.js
63285
63425
  var require_duplexify = __commonJS({
63286
63426
  "node_modules/readable-stream/lib/internal/streams/duplexify.js"(exports2, module2) {
63287
- var process9 = require_process3();
63427
+ var process10 = require_process3();
63288
63428
  var bufferModule = require("buffer");
63289
63429
  var {
63290
63430
  isReadable,
@@ -63397,9 +63537,9 @@ var require_duplexify = __commonJS({
63397
63537
  final(async () => {
63398
63538
  try {
63399
63539
  await promise;
63400
- process9.nextTick(cb, null);
63540
+ process10.nextTick(cb, null);
63401
63541
  } catch (err) {
63402
- process9.nextTick(cb, err);
63542
+ process10.nextTick(cb, err);
63403
63543
  }
63404
63544
  });
63405
63545
  },
@@ -63478,7 +63618,7 @@ var require_duplexify = __commonJS({
63478
63618
  const _promise = promise;
63479
63619
  promise = null;
63480
63620
  const { chunk, done, cb } = await _promise;
63481
- process9.nextTick(cb);
63621
+ process10.nextTick(cb);
63482
63622
  if (done) return;
63483
63623
  if (signal.aborted)
63484
63624
  throw new AbortError2(void 0, {
@@ -63869,7 +64009,7 @@ var require_passthrough = __commonJS({
63869
64009
  // node_modules/readable-stream/lib/internal/streams/pipeline.js
63870
64010
  var require_pipeline4 = __commonJS({
63871
64011
  "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports2, module2) {
63872
- var process9 = require_process3();
64012
+ var process10 = require_process3();
63873
64013
  var { ArrayIsArray, Promise: Promise2, SymbolAsyncIterator, SymbolDispose } = require_primordials();
63874
64014
  var eos = require_end_of_stream();
63875
64015
  var { once } = require_util();
@@ -64071,7 +64211,7 @@ var require_pipeline4 = __commonJS({
64071
64211
  if (!error) {
64072
64212
  lastStreamCleanup.forEach((fn) => fn());
64073
64213
  }
64074
- process9.nextTick(callback, error, value);
64214
+ process10.nextTick(callback, error, value);
64075
64215
  }
64076
64216
  }
64077
64217
  let ret;
@@ -64150,11 +64290,11 @@ var require_pipeline4 = __commonJS({
64150
64290
  if (end) {
64151
64291
  pt.end();
64152
64292
  }
64153
- process9.nextTick(finish);
64293
+ process10.nextTick(finish);
64154
64294
  },
64155
64295
  (err) => {
64156
64296
  pt.destroy(err);
64157
- process9.nextTick(finish, err);
64297
+ process10.nextTick(finish, err);
64158
64298
  }
64159
64299
  );
64160
64300
  } else if (isIterable(ret, true)) {
@@ -64235,7 +64375,7 @@ var require_pipeline4 = __commonJS({
64235
64375
  }
64236
64376
  }
64237
64377
  if (signal !== null && signal !== void 0 && signal.aborted || outerSignal !== null && outerSignal !== void 0 && outerSignal.aborted) {
64238
- process9.nextTick(abort);
64378
+ process10.nextTick(abort);
64239
64379
  }
64240
64380
  return ret;
64241
64381
  }
@@ -64256,7 +64396,7 @@ var require_pipeline4 = __commonJS({
64256
64396
  };
64257
64397
  var endFn = endFn2;
64258
64398
  if (isReadableFinished(src)) {
64259
- process9.nextTick(endFn2);
64399
+ process10.nextTick(endFn2);
64260
64400
  } else {
64261
64401
  src.once("end", endFn2);
64262
64402
  }
@@ -66526,7 +66666,7 @@ var require_metadata_parser = __commonJS({
66526
66666
  exports2.readMetadata = readMetadata;
66527
66667
  var _collation = require_collation();
66528
66668
  var _dataType = require_data_type();
66529
- var _sprintfJs = require_sprintf();
66669
+ var _formatHex = require_format_hex();
66530
66670
  var _helpers = require_helpers3();
66531
66671
  function readCollation(buf, offset) {
66532
66672
  offset = +offset;
@@ -66619,7 +66759,7 @@ var require_metadata_parser = __commonJS({
66619
66759
  } = (0, _helpers.readUInt8)(buf, offset));
66620
66760
  const type = _dataType.TYPE[typeNumber];
66621
66761
  if (!type) {
66622
- throw new Error((0, _sprintfJs.sprintf)("Unrecognised data type 0x%02X", typeNumber));
66762
+ throw new Error(`Unrecognised data type 0x${(0, _formatHex.formatHex)(typeNumber, 2)}`);
66623
66763
  }
66624
66764
  switch (type.name) {
66625
66765
  case "Null":
@@ -66860,7 +67000,7 @@ var require_metadata_parser = __commonJS({
66860
67000
  }, offset);
66861
67001
  }
66862
67002
  default:
66863
- throw new Error((0, _sprintfJs.sprintf)("Unrecognised type %s", type.name));
67003
+ throw new Error(`Unrecognised type ${type.name}`);
66864
67004
  }
66865
67005
  }
66866
67006
  module2.exports.readCollation = readCollation;
@@ -67590,7 +67730,6 @@ var require_value_parser = __commonJS({
67590
67730
  var _metadataParser = require_metadata_parser();
67591
67731
  var _dataType = require_data_type();
67592
67732
  var _iconvLite = _interopRequireDefault(require_lib2());
67593
- var _sprintfJs = require_sprintf();
67594
67733
  var _guidParser = require_guid_parser();
67595
67734
  var _helpers = require_helpers3();
67596
67735
  function _interopRequireDefault(e) {
@@ -67950,7 +68089,7 @@ var require_value_parser = __commonJS({
67950
68089
  case 16:
67951
68090
  return readUniqueIdentifier(buf, offset, options);
67952
68091
  default:
67953
- throw new Error((0, _sprintfJs.sprintf)("Unsupported guid size %d", dataLength - 1));
68092
+ throw new Error(`Unsupported guid size ${dataLength - 1}`);
67954
68093
  }
67955
68094
  }
67956
68095
  case "Variant": {
@@ -68021,7 +68160,7 @@ var require_value_parser = __commonJS({
68021
68160
  value
68022
68161
  } = (0, _helpers.readUNumeric128LE)(buf, offset));
68023
68162
  } else {
68024
- throw new Error((0, _sprintfJs.sprintf)("Unsupported numeric dataLength %d", dataLength));
68163
+ throw new Error(`Unsupported numeric dataLength ${dataLength}`);
68025
68164
  }
68026
68165
  return new _helpers.Result(value * sign / Math.pow(10, scale), offset);
68027
68166
  }
@@ -69499,7 +69638,7 @@ var require_package = __commonJS({
69499
69638
  homepage: "https://github.com/tediousjs/tedious",
69500
69639
  bugs: "https://github.com/tediousjs/tedious/issues",
69501
69640
  license: "MIT",
69502
- version: "20.3.3",
69641
+ version: "20.3.8",
69503
69642
  main: "./lib/tedious.js",
69504
69643
  types: "./lib/tedious.d.ts",
69505
69644
  repository: {
@@ -69539,8 +69678,7 @@ var require_package = __commonJS({
69539
69678
  bl: "^6.1.4",
69540
69679
  "iconv-lite": "^0.7.0",
69541
69680
  "js-md4": "^0.3.2",
69542
- "native-duplexpair": "^1.0.0",
69543
- "sprintf-js": "^1.1.3"
69681
+ "native-duplexpair": "^1.0.0"
69544
69682
  },
69545
69683
  devDependencies: {
69546
69684
  "@babel/cli": "^7.28.3",
@@ -69557,7 +69695,6 @@ var require_package = __commonJS({
69557
69695
  "@types/mitm": "^1.3.8",
69558
69696
  "@types/mocha": "^10.0.10",
69559
69697
  "@types/sinon": "^21.0.0",
69560
- "@types/sprintf-js": "^1.1.4",
69561
69698
  "@typescript-eslint/eslint-plugin": "^8.46.3",
69562
69699
  "@typescript-eslint/parser": "^8.46.3",
69563
69700
  async: "^3.2.6",
@@ -72162,9 +72299,12 @@ var require_connection = __commonJS({
72162
72299
  if (preloginPayload.fedAuthRequired === 1) {
72163
72300
  this.fedAuthRequired = true;
72164
72301
  }
72302
+ if (this.config.options.encrypt === true && preloginPayload.encryptionString !== "ON" && preloginPayload.encryptionString !== "REQ") {
72303
+ throw new _errors.ConnectionError("Server did not negotiate encryption, but the 'encrypt' config option is set to `true`. Set 'encrypt' to `false` to allow unencrypted connections.", "EENCRYPT");
72304
+ }
72165
72305
  if ("strict" !== this.config.options.encrypt && (preloginPayload.encryptionString === "ON" || preloginPayload.encryptionString === "REQ")) {
72166
72306
  if (!this.config.options.encrypt) {
72167
- throw new _errors.ConnectionError("Server requires encryption, set 'encrypt' config option to true.", "EENCRYPT");
72307
+ throw new _errors.ConnectionError("Server requires encryption, set 'encrypt' config option to `true`.", "EENCRYPT");
72168
72308
  }
72169
72309
  this.transitionTo(this.STATE.SENT_TLSSSLNEGOTIATION);
72170
72310
  await Promise.race([this.messageIo.startTls(this.secureContextOptions, this.config.options.serverName ? this.config.options.serverName : this.routingData?.server ?? this.config.server, this.config.options.trustServerCertificate).catch((err) => {