Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

fix(power-automate): handle Default-env IDs + sovereign cloud support (#261)

Matt Townsend42ed8f10b2e8
diff --git a/plugins/power-automate/server/mcp.mjs b/plugins/power-automate/server/mcp.mjs
index a370e637c..62c8a9bd3 100644
--- a/plugins/power-automate/server/mcp.mjs
+++ b/plugins/power-automate/server/mcp.mjs
@@ -1,6 +1,6 @@
#!/usr/bin/env node
// FlowAgent stdio MCP server — single-file ESM bundle for the power-automate plugin.
-// Generated by scripts/bundle-plugin-mcp.mjs (npm run build:plugin). Do not edit.
+// Generated by esbuild. Do not edit.
// https://github.com/matow_microsoft/flow-agent
import { createRequire as __pa_createRequire } from 'node:module';
const require = __pa_createRequire(import.meta.url);
@@ -113,11 +113,11 @@ function snapshotOrThrow(opts) {
backupVersion: 1
};
const filename = `${timestampSlug(new Date(capturedAt))}.json`;
- const path3 = join(dir, filename);
- writeFileSync(path3, JSON.stringify(backup, null, 2), "utf-8");
- logger.debug(`Backup written: ${path3}`);
+ const path5 = join(dir, filename);
+ writeFileSync(path5, JSON.stringify(backup, null, 2), "utf-8");
+ logger.debug(`Backup written: ${path5}`);
pruneRetention(dir);
- return path3;
+ return path5;
}
function pruneRetention(dir) {
let entries;
@@ -152,28 +152,28 @@ function listBackups(envId, flowId) {
return [];
const files = readdirSync(dir).filter((f) => f.endsWith(".json"));
return files.map((filename) => {
- const path3 = join(dir, filename);
+ const path5 = join(dir, filename);
let capturedAt = "";
let operation = "unknown";
let sizeBytes = 0;
try {
- sizeBytes = statSync(path3).size;
- const raw = readFileSync(path3, "utf-8");
+ sizeBytes = statSync(path5).size;
+ const raw = readFileSync(path5, "utf-8");
const parsed = JSON.parse(raw);
capturedAt = parsed.capturedAt ?? "";
operation = parsed.operation ?? "unknown";
} catch (err) {
logger.warn(`Could not read backup ${filename}: ${err instanceof Error ? err.message : err}`);
}
- return { filename, capturedAt, operation, path: path3, sizeBytes };
+ return { filename, capturedAt, operation, path: path5, sizeBytes };
}).sort((a, b) => b.capturedAt > a.capturedAt ? 1 : -1);
}
function readBackup(envId, flowId, filename) {
- const path3 = join(flowDir(envId, flowId), filename);
- if (!existsSync(path3)) {
- throw new Error(`Backup not found: ${path3}`);
+ const path5 = join(flowDir(envId, flowId), filename);
+ if (!existsSync(path5)) {
+ throw new Error(`Backup not found: ${path5}`);
}
- const raw = readFileSync(path3, "utf-8");
+ const raw = readFileSync(path5, "utf-8");
return JSON.parse(raw);
}
function latestBackup(envId, flowId) {
@@ -529,8 +529,7 @@ var init_Serializer = __esm({
key_id: atEntity.keyId,
token_type: atEntity.tokenType,
userAssertionHash: atEntity.userAssertionHash,
- resource: atEntity.resource,
- additionalCacheKeyComponents: atEntity.additionalCacheKeyComponents
+ resource: atEntity.resource
};
});
return accessTokens;
@@ -719,8 +718,8 @@ var init_Constants = __esm({
NOT_APPLICABLE = "N/A";
NOT_AVAILABLE = "Not Available";
FORWARD_SLASH = "/";
- IMDS_ENDPOINT = "http://169.254.169.254/metadata/instance/compute";
- IMDS_VERSION = "2021-02-01";
+ IMDS_ENDPOINT = "http://169.254.169.254/metadata/instance/compute/location";
+ IMDS_VERSION = "2020-06-01";
IMDS_TIMEOUT = 2e3;
AZURE_REGION_AUTO_DISCOVER_FLAG = "TryAutoDetect";
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX = "login.microsoft.com";
@@ -782,10 +781,7 @@ var init_Constants = __esm({
};
ClaimsRequestKeys = {
ACCESS_TOKEN: "access_token",
- XMS_CC: "xms_cc",
- ID_TOKEN: "id_token",
- SIGNIN_STATE: "signin_state",
- LOGIN_HINT: "login_hint"
+ XMS_CC: "xms_cc"
};
PromptValue = {
LOGIN: "login",
@@ -816,8 +812,7 @@ var init_Constants = __esm({
RESOURCE_OWNER_PASSWORD_GRANT: "password",
REFRESH_TOKEN_GRANT: "refresh_token",
DEVICE_CODE_GRANT: "device_code",
- JWT_BEARER: "urn:ietf:params:oauth:grant-type:jwt-bearer",
- USER_FIC: "user_fic"
+ JWT_BEARER: "urn:ietf:params:oauth:grant-type:jwt-bearer"
};
CACHE_ACCOUNT_TYPE_MSSTS = "MSSTS";
CACHE_ACCOUNT_TYPE_ADFS = "ADFS";
@@ -944,7 +939,6 @@ __export(AADServerParamKeys_exports, {
ERROR: () => ERROR,
ERROR_DESCRIPTION: () => ERROR_DESCRIPTION,
EXPIRES_IN: () => EXPIRES_IN,
- FMI_PATH: () => FMI_PATH,
FOCI: () => FOCI,
GRANT_TYPE: () => GRANT_TYPE,
ID_TOKEN: () => ID_TOKEN,
@@ -972,9 +966,6 @@ __export(AADServerParamKeys_exports, {
SID: () => SID,
STATE: () => STATE,
TOKEN_TYPE: () => TOKEN_TYPE,
- USERNAME: () => USERNAME,
- USER_FEDERATED_IDENTITY_CREDENTIAL: () => USER_FEDERATED_IDENTITY_CREDENTIAL,
- USER_ID: () => USER_ID,
X_APP_NAME: () => X_APP_NAME,
X_APP_VER: () => X_APP_VER,
X_CLIENT_CPU: () => X_CLIENT_CPU,
@@ -986,7 +977,7 @@ __export(AADServerParamKeys_exports, {
X_CLIENT_VER: () => X_CLIENT_VER,
X_MS_LIB_CAPABILITY: () => X_MS_LIB_CAPABILITY
});
-var CLIENT_ID, REDIRECT_URI, RESPONSE_TYPE, RESPONSE_MODE, GRANT_TYPE, CLAIMS, SCOPE, ERROR, ERROR_DESCRIPTION, ACCESS_TOKEN, ID_TOKEN, REFRESH_TOKEN, EXPIRES_IN, REFRESH_TOKEN_EXPIRES_IN, STATE, NONCE, PROMPT, SESSION_STATE, CLIENT_INFO2, CODE, CODE_CHALLENGE, CODE_CHALLENGE_METHOD, CODE_VERIFIER, CLIENT_REQUEST_ID, X_CLIENT_SKU, X_CLIENT_VER, X_CLIENT_OS, X_CLIENT_CPU, X_CLIENT_CURR_TELEM, X_CLIENT_LAST_TELEM, X_MS_LIB_CAPABILITY, X_APP_NAME, X_APP_VER, POST_LOGOUT_URI, ID_TOKEN_HINT, DEVICE_CODE, CLIENT_SECRET, CLIENT_ASSERTION, CLIENT_ASSERTION_TYPE, TOKEN_TYPE, REQ_CNF, OBO_ASSERTION, REQUESTED_TOKEN_USE, ON_BEHALF_OF, FOCI, CCS_HEADER, RETURN_SPA_CODE, NATIVE_BROKER, LOGOUT_HINT, SID, LOGIN_HINT, DOMAIN_HINT, X_CLIENT_EXTRA_SKU, BROKER_CLIENT_ID, BROKER_REDIRECT_URI, INSTANCE_AWARE, EAR_JWK, EAR_JWE_CRYPTO, RESOURCE, CLI_DATA, USER_FEDERATED_IDENTITY_CREDENTIAL, USERNAME, USER_ID, FMI_PATH;
+var CLIENT_ID, REDIRECT_URI, RESPONSE_TYPE, RESPONSE_MODE, GRANT_TYPE, CLAIMS, SCOPE, ERROR, ERROR_DESCRIPTION, ACCESS_TOKEN, ID_TOKEN, REFRESH_TOKEN, EXPIRES_IN, REFRESH_TOKEN_EXPIRES_IN, STATE, NONCE, PROMPT, SESSION_STATE, CLIENT_INFO2, CODE, CODE_CHALLENGE, CODE_CHALLENGE_METHOD, CODE_VERIFIER, CLIENT_REQUEST_ID, X_CLIENT_SKU, X_CLIENT_VER, X_CLIENT_OS, X_CLIENT_CPU, X_CLIENT_CURR_TELEM, X_CLIENT_LAST_TELEM, X_MS_LIB_CAPABILITY, X_APP_NAME, X_APP_VER, POST_LOGOUT_URI, ID_TOKEN_HINT, DEVICE_CODE, CLIENT_SECRET, CLIENT_ASSERTION, CLIENT_ASSERTION_TYPE, TOKEN_TYPE, REQ_CNF, OBO_ASSERTION, REQUESTED_TOKEN_USE, ON_BEHALF_OF, FOCI, CCS_HEADER, RETURN_SPA_CODE, NATIVE_BROKER, LOGOUT_HINT, SID, LOGIN_HINT, DOMAIN_HINT, X_CLIENT_EXTRA_SKU, BROKER_CLIENT_ID, BROKER_REDIRECT_URI, INSTANCE_AWARE, EAR_JWK, EAR_JWE_CRYPTO, RESOURCE, CLI_DATA;
var init_AADServerParamKeys = __esm({
"node_modules/@azure/msal-common/dist/constants/AADServerParamKeys.mjs"() {
"use strict";
@@ -1050,10 +1041,6 @@ var init_AADServerParamKeys = __esm({
EAR_JWE_CRYPTO = "ear_jwe_crypto";
RESOURCE = "resource";
CLI_DATA = "clidata";
- USER_FEDERATED_IDENTITY_CREDENTIAL = "user_federated_identity_credential";
- USERNAME = "username";
- USER_ID = "user_id";
- FMI_PATH = "fmi_path";
}
});
@@ -1061,32 +1048,34 @@ var init_AADServerParamKeys = __esm({
function getDefaultErrorMessage(code) {
return `See https://aka.ms/msal.js.errors#${code} for details`;
}
-function createAuthError(code, correlationId, additionalMessage) {
- return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage(code));
+function createAuthError(code, additionalMessage) {
+ return new AuthError(code, additionalMessage || getDefaultErrorMessage(code));
}
var AuthError;
var init_AuthError = __esm({
"node_modules/@azure/msal-common/dist/error/AuthError.mjs"() {
"use strict";
AuthError = class _AuthError extends Error {
- constructor(errorCode, correlationId, errorMessage, suberror) {
- const message = errorMessage || (errorCode ? getDefaultErrorMessage(errorCode) : "");
- const errorString = message ? `${errorCode}: ${message}` : errorCode;
+ constructor(errorCode2, errorMessage, suberror) {
+ const message = errorMessage || (errorCode2 ? getDefaultErrorMessage(errorCode2) : "");
+ const errorString = message ? `${errorCode2}: ${message}` : errorCode2;
super(errorString);
Object.setPrototypeOf(this, _AuthError.prototype);
- this.errorCode = errorCode || "";
+ this.errorCode = errorCode2 || "";
this.errorMessage = message || "";
this.subError = suberror || "";
- this.correlationId = correlationId;
this.name = "AuthError";
}
+ setCorrelationId(correlationId) {
+ this.correlationId = correlationId;
+ }
};
}
});
// node_modules/@azure/msal-common/dist/error/ClientConfigurationError.mjs
-function createClientConfigurationError(errorCode, correlationId) {
- return new ClientConfigurationError(errorCode, correlationId);
+function createClientConfigurationError(errorCode2) {
+ return new ClientConfigurationError(errorCode2);
}
var ClientConfigurationError;
var init_ClientConfigurationError = __esm({
@@ -1094,8 +1083,8 @@ var init_ClientConfigurationError = __esm({
"use strict";
init_AuthError();
ClientConfigurationError = class _ClientConfigurationError extends AuthError {
- constructor(errorCode, correlationId) {
- super(errorCode, correlationId);
+ constructor(errorCode2) {
+ super(errorCode2);
this.name = "ClientConfigurationError";
Object.setPrototypeOf(this, _ClientConfigurationError.prototype);
}
@@ -1181,8 +1170,8 @@ var init_StringUtils = __esm({
});
// node_modules/@azure/msal-common/dist/error/ClientAuthError.mjs
-function createClientAuthError(errorCode, correlationId, additionalMessage) {
- return new ClientAuthError(errorCode, correlationId, additionalMessage);
+function createClientAuthError(errorCode2, additionalMessage) {
+ return new ClientAuthError(errorCode2, additionalMessage);
}
var ClientAuthError;
var init_ClientAuthError = __esm({
@@ -1190,8 +1179,8 @@ var init_ClientAuthError = __esm({
"use strict";
init_AuthError();
ClientAuthError = class _ClientAuthError extends AuthError {
- constructor(errorCode, correlationId, additionalMessage) {
- super(errorCode, correlationId, additionalMessage);
+ constructor(errorCode2, additionalMessage) {
+ super(errorCode2, additionalMessage);
this.name = "ClientAuthError";
Object.setPrototypeOf(this, _ClientAuthError.prototype);
}
@@ -1224,6 +1213,7 @@ var init_ClientConfigurationErrorCodes = __esm({
// node_modules/@azure/msal-common/dist/error/ClientAuthErrorCodes.mjs
var ClientAuthErrorCodes_exports = {};
__export(ClientAuthErrorCodes_exports, {
+ authTimeNotFound: () => authTimeNotFound,
authorizationCodeMissingFromServerResponse: () => authorizationCodeMissingFromServerResponse,
bindingKeyNotRemoved: () => bindingKeyNotRemoved,
cannotAppendScopeSet: () => cannotAppendScopeSet,
@@ -1238,6 +1228,7 @@ __export(ClientAuthErrorCodes_exports, {
invalidCacheRecord: () => invalidCacheRecord,
invalidState: () => invalidState,
keyIdMissing: () => keyIdMissing,
+ maxAgeTranspired: () => maxAgeTranspired,
methodNotImplemented: () => methodNotImplemented,
misplacedResourceParam: () => misplacedResourceParam,
multipleMatchingAppMetadata: () => multipleMatchingAppMetadata,
@@ -1262,7 +1253,7 @@ __export(ClientAuthErrorCodes_exports, {
unexpectedCredentialType: () => unexpectedCredentialType,
userCanceled: () => userCanceled
});
-var clientInfoDecodingError, clientInfoEmptyError, tokenParsingError, nullOrEmptyToken, endpointResolutionError, networkError, openIdConfigError, hashNotDeserialized, invalidState, stateMismatch, stateNotFound, nonceMismatch, multipleMatchingTokens, multipleMatchingAppMetadata, requestCannotBeMade, cannotRemoveEmptyScope, cannotAppendScopeSet, emptyInputScopeSet, noAccountInSilentRequest, invalidCacheRecord, invalidCacheEnvironment, noAccountFound, noCryptoObject, unexpectedCredentialType, tokenRefreshRequired, tokenClaimsCnfRequiredForSignedJwt, authorizationCodeMissingFromServerResponse, bindingKeyNotRemoved, endSessionEndpointNotSupported, keyIdMissing, noNetworkConnectivity, userCanceled, methodNotImplemented, nestedAppAuthBridgeDisabled, platformBrokerError, resourceParameterRequired, misplacedResourceParam;
+var clientInfoDecodingError, clientInfoEmptyError, tokenParsingError, nullOrEmptyToken, endpointResolutionError, networkError, openIdConfigError, hashNotDeserialized, invalidState, stateMismatch, stateNotFound, nonceMismatch, authTimeNotFound, maxAgeTranspired, multipleMatchingTokens, multipleMatchingAppMetadata, requestCannotBeMade, cannotRemoveEmptyScope, cannotAppendScopeSet, emptyInputScopeSet, noAccountInSilentRequest, invalidCacheRecord, invalidCacheEnvironment, noAccountFound, noCryptoObject, unexpectedCredentialType, tokenRefreshRequired, tokenClaimsCnfRequiredForSignedJwt, authorizationCodeMissingFromServerResponse, bindingKeyNotRemoved, endSessionEndpointNotSupported, keyIdMissing, noNetworkConnectivity, userCanceled, methodNotImplemented, nestedAppAuthBridgeDisabled, platformBrokerError, resourceParameterRequired, misplacedResourceParam;
var init_ClientAuthErrorCodes = __esm({
"node_modules/@azure/msal-common/dist/error/ClientAuthErrorCodes.mjs"() {
"use strict";
@@ -1278,6 +1269,8 @@ var init_ClientAuthErrorCodes = __esm({
stateMismatch = "state_mismatch";
stateNotFound = "state_not_found";
nonceMismatch = "nonce_mismatch";
+ authTimeNotFound = "auth_time_not_found";
+ maxAgeTranspired = "max_age_transpired";
multipleMatchingTokens = "multiple_matching_tokens";
multipleMatchingAppMetadata = "multiple_matching_appMetadata";
requestCannotBeMade = "request_cannot_be_made";
@@ -1318,12 +1311,11 @@ var init_ScopeSet = __esm({
init_ClientConfigurationErrorCodes();
init_ClientAuthErrorCodes();
ScopeSet = class _ScopeSet {
- constructor(inputScopes, correlationId) {
- this.correlationId = correlationId;
+ constructor(inputScopes) {
const scopeArr = inputScopes ? StringUtils.trimArrayEntries([...inputScopes]) : [];
const filteredInput = scopeArr ? StringUtils.removeEmptyStringsFromArray(scopeArr) : [];
if (!filteredInput || !filteredInput.length) {
- throw createClientConfigurationError(emptyInputScopesError, correlationId);
+ throw createClientConfigurationError(emptyInputScopesError);
}
this.scopes = /* @__PURE__ */ new Set();
filteredInput.forEach((scope) => this.scopes.add(scope));
@@ -1334,19 +1326,19 @@ var init_ScopeSet = __esm({
* @param appClientId
* @param scopesRequired
*/
- static fromString(inputScopeString, correlationId) {
+ static fromString(inputScopeString) {
const scopeString = inputScopeString || "";
const inputScopes = scopeString.split(" ");
- return new _ScopeSet(inputScopes, correlationId);
+ return new _ScopeSet(inputScopes);
}
/**
* Creates the set of scopes to search for in cache lookups
* @param inputScopeString
* @returns
*/
- static createSearchScopes(inputScopeString, correlationId) {
+ static createSearchScopes(inputScopeString) {
const scopesToUse = inputScopeString && inputScopeString.length > 0 ? inputScopeString : [...OIDC_DEFAULT_SCOPES];
- const scopeSet = new _ScopeSet(scopesToUse, correlationId);
+ const scopeSet = new _ScopeSet(scopesToUse);
if (!scopeSet.containsOnlyOIDCScopes()) {
scopeSet.removeOIDCScopes();
} else {
@@ -1360,7 +1352,7 @@ var init_ScopeSet = __esm({
*/
containsScope(scope) {
const lowerCaseScopes = this.printScopesLowerCase().split(" ");
- const lowerCaseScopesSet = new _ScopeSet(lowerCaseScopes, this.correlationId);
+ const lowerCaseScopesSet = new _ScopeSet(lowerCaseScopes);
return scope ? lowerCaseScopesSet.scopes.has(scope.toLowerCase()) : false;
}
/**
@@ -1402,7 +1394,7 @@ var init_ScopeSet = __esm({
try {
newScopes.forEach((newScope) => this.appendScope(newScope));
} catch (e) {
- throw createClientAuthError(cannotAppendScopeSet, this.correlationId);
+ throw createClientAuthError(cannotAppendScopeSet);
}
}
/**
@@ -1411,7 +1403,7 @@ var init_ScopeSet = __esm({
*/
removeScope(scope) {
if (!scope) {
- throw createClientAuthError(cannotRemoveEmptyScope, this.correlationId);
+ throw createClientAuthError(cannotRemoveEmptyScope);
}
this.scopes.delete(scope.trim());
}
@@ -1430,7 +1422,7 @@ var init_ScopeSet = __esm({
*/
unionScopeSets(otherScopes) {
if (!otherScopes) {
- throw createClientAuthError(emptyInputScopeSet, this.correlationId);
+ throw createClientAuthError(emptyInputScopeSet);
}
const unionScopes = /* @__PURE__ */ new Set();
otherScopes.scopes.forEach((scope) => unionScopes.add(scope.toLowerCase()));
@@ -1443,7 +1435,7 @@ var init_ScopeSet = __esm({
*/
intersectingScopeSets(otherScopes) {
if (!otherScopes) {
- throw createClientAuthError(emptyInputScopeSet, this.correlationId);
+ throw createClientAuthError(emptyInputScopeSet);
}
if (!otherScopes.containsOnlyOIDCScopes()) {
otherScopes.removeOIDCScopes();
@@ -1500,6 +1492,7 @@ __export(RequestParameterBuilder_exports, {
addCliData: () => addCliData,
addClientAssertion: () => addClientAssertion,
addClientAssertionType: () => addClientAssertionType,
+ addClientCapabilitiesToClaims: () => addClientCapabilitiesToClaims,
addClientId: () => addClientId,
addClientInfo: () => addClientInfo,
addClientSecret: () => addClientSecret,
@@ -1536,7 +1529,6 @@ __export(RequestParameterBuilder_exports, {
addState: () => addState,
addThrottling: () => addThrottling,
addUsername: () => addUsername,
- buildMergedClaims: () => buildMergedClaims,
instrumentBrokerParams: () => instrumentBrokerParams
});
function instrumentBrokerParams(parameters, correlationId, performanceClient) {
@@ -1560,12 +1552,12 @@ function addResponseMode(parameters, responseMode) {
function addNativeBroker(parameters) {
parameters.set(NATIVE_BROKER, "1");
}
-function addScopes(parameters, scopes, correlationId, addOidcScopes = true, defaultScopes = OIDC_DEFAULT_SCOPES) {
+function addScopes(parameters, scopes, addOidcScopes = true, defaultScopes = OIDC_DEFAULT_SCOPES) {
if (addOidcScopes && !defaultScopes.includes("openid") && !scopes.includes("openid")) {
defaultScopes.push("openid");
}
const requestScopes = addOidcScopes ? [...scopes || [], ...defaultScopes] : scopes || [];
- const scopeSet = new ScopeSet(requestScopes, correlationId);
+ const scopeSet = new ScopeSet(requestScopes);
parameters.set(SCOPE, scopeSet.printScopes());
}
function addClientId(parameters, clientId) {
@@ -1595,10 +1587,17 @@ function addCcsOid(parameters, clientInfo) {
function addSid(parameters, sid) {
parameters.set(SID, sid);
}
-function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims) {
+function addClaims(parameters, claims, clientCapabilities, skipBrokerClaims) {
const configClaims = skipBrokerClaims && parameters.has(BROKER_CLIENT_ID) ? void 0 : clientCapabilities;
- const mergedClaims = buildMergedClaims(claims, configClaims, correlationId);
- parameters.set(CLAIMS, mergedClaims);
+ if (!StringUtils.isEmptyObj(claims) || configClaims && configClaims.length > 0) {
+ const mergedClaims = addClientCapabilitiesToClaims(claims, configClaims);
+ try {
+ JSON.parse(mergedClaims);
+ } catch (e) {
+ throw createClientConfigurationError(invalidClaims);
+ }
+ parameters.set(CLAIMS, mergedClaims);
+ }
}
function addCorrelationId(parameters, correlationId) {
parameters.set(CLIENT_REQUEST_ID, correlationId);
@@ -1637,7 +1636,7 @@ function addCodeChallengeParams(parameters, codeChallenge, codeChallengeMethod)
parameters.set(CODE_CHALLENGE, codeChallenge);
parameters.set(CODE_CHALLENGE_METHOD, codeChallengeMethod);
} else {
- throw createClientConfigurationError(pkceParamsMissing, "");
+ throw createClientConfigurationError(pkceParamsMissing);
}
}
function addAuthorizationCode(parameters, code) {
@@ -1692,32 +1691,19 @@ function addExtraParameters(parameters, extraParams) {
}
});
}
-function buildMergedClaims(claims, clientCapabilities, correlationId = "") {
+function addClientCapabilitiesToClaims(claims, clientCapabilities) {
let mergedClaims;
if (!claims) {
mergedClaims = {};
} else {
try {
- const parsed = JSON.parse(claims);
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
- throw new Error("Claims must be a JSON object");
- }
- mergedClaims = parsed;
+ mergedClaims = JSON.parse(claims);
} catch (e) {
- throw createClientConfigurationError(invalidClaims, correlationId);
- }
- }
- if (!Object.prototype.hasOwnProperty.call(mergedClaims, ClaimsRequestKeys.ID_TOKEN)) {
- mergedClaims[ClaimsRequestKeys.ID_TOKEN] = {};
- }
- const idTokenClaims = mergedClaims[ClaimsRequestKeys.ID_TOKEN];
- for (const [key, value] of Object.entries(DEFAULT_ID_TOKEN_CLAIMS)) {
- if (!(key in idTokenClaims)) {
- idTokenClaims[key] = value;
+ throw createClientConfigurationError(invalidClaims);
}
}
if (clientCapabilities && clientCapabilities.length > 0) {
- if (!Object.prototype.hasOwnProperty.call(mergedClaims, ClaimsRequestKeys.ACCESS_TOKEN)) {
+ if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};
}
mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] = {
@@ -1772,7 +1758,6 @@ function addResource(parameters, resource) {
parameters.set(RESOURCE, resource);
}
}
-var DEFAULT_ID_TOKEN_CLAIMS;
var init_RequestParameterBuilder = __esm({
"node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.mjs"() {
"use strict";
@@ -1780,11 +1765,8 @@ var init_RequestParameterBuilder = __esm({
init_AADServerParamKeys();
init_ScopeSet();
init_ClientConfigurationError();
+ init_StringUtils();
init_ClientConfigurationErrorCodes();
- DEFAULT_ID_TOKEN_CLAIMS = {
- [ClaimsRequestKeys.SIGNIN_STATE]: { essential: false },
- [ClaimsRequestKeys.LOGIN_HINT]: { essential: false }
- };
}
});
@@ -1794,9 +1776,23 @@ __export(UrlUtils_exports, {
getDeserializedResponse: () => getDeserializedResponse,
mapToQueryString: () => mapToQueryString,
normalizeUrlForComparison: () => normalizeUrlForComparison,
- stripLeadingHashOrQuery: () => stripLeadingHashOrQuery,
- validateUrl: () => validateUrl
+ stripLeadingHashOrQuery: () => stripLeadingHashOrQuery
});
+function canonicalizeUrl(url) {
+ if (!url) {
+ return url;
+ }
+ let lowerCaseUrl = url.toLowerCase();
+ if (StringUtils.endsWith(lowerCaseUrl, "?")) {
+ lowerCaseUrl = lowerCaseUrl.slice(0, -1);
+ } else if (StringUtils.endsWith(lowerCaseUrl, "?/")) {
+ lowerCaseUrl = lowerCaseUrl.slice(0, -2);
+ }
+ if (!StringUtils.endsWith(lowerCaseUrl, "/")) {
+ lowerCaseUrl += "/";
+ }
+ return lowerCaseUrl;
+}
function stripLeadingHashOrQuery(responseString) {
if (responseString.startsWith("#/")) {
return responseString.substring(2);
@@ -1816,7 +1812,7 @@ function getDeserializedResponse(responseString) {
return deserializedHash;
}
} catch (e) {
- throw createClientAuthError(hashNotDeserialized, "");
+ throw createClientAuthError(hashNotDeserialized);
}
return null;
}
@@ -1827,50 +1823,25 @@ function mapToQueryString(parameters) {
});
return queryParameterArray.join("&");
}
-function normalizeUrlForComparison(url, logger2, correlationId) {
+function normalizeUrlForComparison(url) {
if (!url) {
return url;
}
const urlWithoutHash = url.split("#")[0];
- if (!urlWithoutHash) {
- return urlWithoutHash;
- }
try {
const urlObj = new URL(urlWithoutHash);
- if (!urlObj.search) {
- urlObj.search = "";
- }
- let pathname;
- try {
- pathname = decodeURIComponent(urlObj.pathname);
- } catch (e) {
- pathname = urlObj.pathname;
- }
- if (!pathname.endsWith("/")) {
- pathname += "/";
- }
- urlObj.pathname = pathname;
- return urlObj.href;
- } catch (e) {
- logger2?.error(`Failed to normalize URL for comparison: '${e}'`, correlationId || "");
- throw createClientConfigurationError(urlParseError, correlationId || "");
- }
-}
-function validateUrl(url, logger2, correlationId) {
- try {
- new URL(url);
+ const normalizedUrl = urlObj.origin + urlObj.pathname + urlObj.search;
+ return canonicalizeUrl(normalizedUrl);
} catch (e) {
- logger2?.error(`Failed to validate URL: '${e}'`, correlationId || "");
- throw createClientConfigurationError(urlParseError, correlationId || "");
+ return canonicalizeUrl(urlWithoutHash);
}
}
var init_UrlUtils = __esm({
"node_modules/@azure/msal-common/dist/utils/UrlUtils.mjs"() {
"use strict";
init_ClientAuthError();
- init_ClientConfigurationError();
+ init_StringUtils();
init_ClientAuthErrorCodes();
- init_ClientConfigurationErrorCodes();
}
});
@@ -1883,34 +1854,34 @@ var init_ICrypto = __esm({
init_ClientAuthErrorCodes();
DEFAULT_CRYPTO_IMPLEMENTATION = {
createNewGuid: () => {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
base64Decode: () => {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
base64Encode: () => {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
base64UrlEncode: () => {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
encodeKid: () => {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
async getPublicKeyThumbprint() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
async removeTokenBindingKey() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
async clearKeystore() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
async signJwt() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
async hashString() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
};
}
@@ -1931,7 +1902,7 @@ function addLogToCache(correlationId, loggedMessage) {
correlationCache.set(correlationId, data);
if (correlationCache.size > CACHE_CAPACITY) {
const firstKey = correlationCache.keys().next().value;
- if (firstKey !== void 0) {
+ if (firstKey) {
correlationCache.delete(firstKey);
}
}
@@ -1944,21 +1915,18 @@ function addLogToCache(correlationId, loggedMessage) {
data.logs.shift();
}
}
-function getMessageHash(str) {
- if (str.length < 6) {
- return null;
- }
- if (str.length > 6 && str[6] !== " ") {
- return null;
+function isHashedString(str) {
+ if (str.length !== 6) {
+ return false;
}
- for (let i = 0; i < 6; i++) {
+ for (let i = 0; i < str.length; i++) {
const char = str[i];
const isAlphaNumeric = char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char >= "0" && char <= "9";
if (!isAlphaNumeric) {
- return null;
+ return false;
}
}
- return str.substring(0, 6);
+ return true;
}
var LogLevel, CACHE_CAPACITY, MAX_LOGS_PER_CORRELATION, correlationCache, Logger;
var init_Logger = __esm({
@@ -2010,10 +1978,10 @@ var init_Logger = __esm({
*/
logMessage(logMessage, options) {
const correlationId = options.correlationId;
- const messageHash = getMessageHash(logMessage);
- if (messageHash) {
+ const isHashedInput = isHashedString(logMessage);
+ if (isHashedInput) {
const loggedMessage = {
- hash: messageHash,
+ hash: logMessage,
level: options.logLevel,
containsPii: options.containsPii || false,
milliseconds: 0
@@ -2153,7 +2121,7 @@ var init_packageMetadata = __esm({
"node_modules/@azure/msal-common/dist/packageMetadata.mjs"() {
"use strict";
name = "@azure/msal-common";
- version2 = "16.11.0";
+ version2 = "16.6.1";
}
});
@@ -2179,67 +2147,29 @@ var init_AuthorityOptions = __esm({
}
});
-// node_modules/@azure/msal-common/dist/account/AuthToken.mjs
-function extractTokenClaims(encodedToken, base64Decode, correlationId) {
- const jswPayload = getJWSPayload(encodedToken, correlationId);
- try {
- const base64Decoded = base64Decode(jswPayload);
- return JSON.parse(base64Decoded);
- } catch (err) {
- throw createClientAuthError(tokenParsingError, correlationId);
- }
-}
-function isKmsi(idTokenClaims) {
- if (!idTokenClaims.signin_state) {
- return false;
- }
- const kmsiClaims = ["kmsi", "dvc_dmjd"];
- return idTokenClaims.signin_state.some((value) => kmsiClaims.includes(value.trim().toLowerCase()));
-}
-function getJWSPayload(authToken, correlationId) {
- if (!authToken) {
- throw createClientAuthError(nullOrEmptyToken, correlationId);
- }
- const tokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/;
- const matches = tokenPartsRegex.exec(authToken);
- if (!matches || matches.length < 4) {
- throw createClientAuthError(tokenParsingError, correlationId);
- }
- return matches[2];
-}
-var init_AuthToken = __esm({
- "node_modules/@azure/msal-common/dist/account/AuthToken.mjs"() {
- "use strict";
- init_ClientAuthError();
- init_ClientAuthErrorCodes();
- }
-});
-
// node_modules/@azure/msal-common/dist/account/AccountInfo.mjs
-function tenantIdMatchesHomeTenant(tenantId, homeAccountId) {
- return !!tenantId && !!homeAccountId && tenantId === homeAccountId.split(".")[1];
+function tenantIdMatchesHomeTenant(tenantId2, homeAccountId) {
+ return !!tenantId2 && !!homeAccountId && tenantId2 === homeAccountId.split(".")[1];
}
-function buildTenantProfile(homeAccountId, localAccountId, tenantId, nativeAccountId, idTokenClaims) {
+function buildTenantProfile(homeAccountId, localAccountId, tenantId2, idTokenClaims) {
if (idTokenClaims) {
const { oid, sub, tid, name: name3, tfp, acr, preferred_username, upn, login_hint } = idTokenClaims;
- const tenantId2 = tid || tfp || acr || "";
+ const tenantId3 = tid || tfp || acr || "";
return {
- tenantId: tenantId2,
+ tenantId: tenantId3,
localAccountId: oid || sub || "",
name: name3,
username: preferred_username || upn || "",
loginHint: login_hint,
- isHomeTenant: tenantIdMatchesHomeTenant(tenantId2, homeAccountId),
- upn,
- ...nativeAccountId && { nativeAccountId }
+ isHomeTenant: tenantIdMatchesHomeTenant(tenantId3, homeAccountId),
+ upn
};
} else {
return {
- tenantId,
+ tenantId: tenantId2,
localAccountId,
username: "",
- isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
- ...nativeAccountId && { nativeAccountId }
+ isHomeTenant: tenantIdMatchesHomeTenant(tenantId2, homeAccountId)
};
}
}
@@ -2250,13 +2180,12 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
updatedAccountInfo = { ...baseAccountInfo, ...tenantProfileOverride };
}
if (idTokenClaims) {
- const { isHomeTenant, ...claimsSourcedTenantProfile } = buildTenantProfile(baseAccountInfo.homeAccountId, baseAccountInfo.localAccountId, baseAccountInfo.tenantId, updatedAccountInfo.nativeAccountId, idTokenClaims);
+ const { isHomeTenant, ...claimsSourcedTenantProfile } = buildTenantProfile(baseAccountInfo.homeAccountId, baseAccountInfo.localAccountId, baseAccountInfo.tenantId, idTokenClaims);
updatedAccountInfo = {
...updatedAccountInfo,
...claimsSourcedTenantProfile,
idTokenClaims,
- idToken: idTokenSecret,
- kmsi: isKmsi(idTokenClaims)
+ idToken: idTokenSecret
};
return updatedAccountInfo;
}
@@ -2265,7 +2194,48 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
var init_AccountInfo = __esm({
"node_modules/@azure/msal-common/dist/account/AccountInfo.mjs"() {
"use strict";
- init_AuthToken();
+ }
+});
+
+// node_modules/@azure/msal-common/dist/account/AuthToken.mjs
+function extractTokenClaims(encodedToken, base64Decode) {
+ const jswPayload = getJWSPayload(encodedToken);
+ try {
+ const base64Decoded = base64Decode(jswPayload);
+ return JSON.parse(base64Decoded);
+ } catch (err) {
+ throw createClientAuthError(tokenParsingError);
+ }
+}
+function isKmsi(idTokenClaims) {
+ if (!idTokenClaims.signin_state) {
+ return false;
+ }
+ const kmsiClaims = ["kmsi", "dvc_dmjd"];
+ return idTokenClaims.signin_state.some((value) => kmsiClaims.includes(value.trim().toLowerCase()));
+}
+function getJWSPayload(authToken) {
+ if (!authToken) {
+ throw createClientAuthError(nullOrEmptyToken);
+ }
+ const tokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/;
+ const matches = tokenPartsRegex.exec(authToken);
+ if (!matches || matches.length < 4) {
+ throw createClientAuthError(tokenParsingError);
+ }
+ return matches[2];
+}
+function checkMaxAge(authTime, maxAge) {
+ const fiveMinuteSkew = 3e5;
+ if (maxAge === 0 || Date.now() - fiveMinuteSkew > authTime + maxAge) {
+ throw createClientAuthError(maxAgeTranspired);
+ }
+}
+var init_AuthToken = __esm({
+ "node_modules/@azure/msal-common/dist/account/AuthToken.mjs"() {
+ "use strict";
+ init_ClientAuthError();
+ init_ClientAuthErrorCodes();
}
});
@@ -2282,11 +2252,10 @@ var init_UrlString = __esm({
get urlString() {
return this._urlString;
}
- constructor(url, correlationId) {
+ constructor(url) {
this._urlString = url;
- this.correlationId = correlationId;
if (!this._urlString) {
- throw createClientConfigurationError(urlEmptyError, correlationId);
+ throw createClientConfigurationError(urlEmptyError);
}
if (!url.includes("#")) {
this._urlString = _UrlString.canonicalizeUri(url);
@@ -2319,13 +2288,13 @@ var init_UrlString = __esm({
try {
components = this.getUrlComponents();
} catch (e) {
- throw createClientConfigurationError(urlParseError, this.correlationId);
+ throw createClientConfigurationError(urlParseError);
}
if (!components.HostNameAndPort || !components.PathSegments) {
- throw createClientConfigurationError(urlParseError, this.correlationId);
+ throw createClientConfigurationError(urlParseError);
}
if (!components.Protocol || components.Protocol.toLowerCase() !== "https:") {
- throw createClientConfigurationError(authorityUriInsecure, this.correlationId);
+ throw createClientConfigurationError(authorityUriInsecure);
}
}
/**
@@ -2351,13 +2320,13 @@ var init_UrlString = __esm({
* @param href The url
* @param tenantId The tenant id to replace
*/
- replaceTenantPath(tenantId) {
+ replaceTenantPath(tenantId2) {
const urlObject = this.getUrlComponents();
const pathArray = urlObject.PathSegments;
- if (tenantId && pathArray.length !== 0 && (pathArray[0] === AADAuthority.COMMON || pathArray[0] === AADAuthority.ORGANIZATIONS)) {
- pathArray[0] = tenantId;
+ if (tenantId2 && pathArray.length !== 0 && (pathArray[0] === AADAuthority.COMMON || pathArray[0] === AADAuthority.ORGANIZATIONS)) {
+ pathArray[0] = tenantId2;
}
- return _UrlString.constructAuthorityUriFromObject(urlObject, this.correlationId);
+ return _UrlString.constructAuthorityUriFromObject(urlObject);
}
/**
* Parses out the components from a url string.
@@ -2367,7 +2336,7 @@ var init_UrlString = __esm({
const regEx = RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
const match = this.urlString.match(regEx);
if (!match) {
- throw createClientConfigurationError(urlParseError, this.correlationId);
+ throw createClientConfigurationError(urlParseError);
}
const urlComponents = {
Protocol: match[1],
@@ -2383,24 +2352,24 @@ var init_UrlString = __esm({
}
return urlComponents;
}
- static getDomainFromUrl(url, correlationId) {
+ static getDomainFromUrl(url) {
const regEx = RegExp("^([^:/?#]+://)?([^/?#]*)");
const match = url.match(regEx);
if (!match) {
- throw createClientConfigurationError(urlParseError, correlationId);
+ throw createClientConfigurationError(urlParseError);
}
return match[2];
}
- static getAbsoluteUrl(relativeUrl, baseUrl, correlationId) {
+ static getAbsoluteUrl(relativeUrl, baseUrl) {
if (relativeUrl[0] === FORWARD_SLASH) {
- const url = new _UrlString(baseUrl, correlationId);
+ const url = new _UrlString(baseUrl);
const baseComponents = url.getUrlComponents();
return baseComponents.Protocol + "//" + baseComponents.HostNameAndPort + relativeUrl;
}
return relativeUrl;
}
- static constructAuthorityUriFromObject(urlObject, correlationId) {
- return new _UrlString(urlObject.Protocol + "//" + urlObject.HostNameAndPort + "/" + urlObject.PathSegments.join("/"), correlationId);
+ static constructAuthorityUriFromObject(urlObject) {
+ return new _UrlString(urlObject.Protocol + "//" + urlObject.HostNameAndPort + "/" + urlObject.PathSegments.join("/"));
}
};
}
@@ -2420,7 +2389,7 @@ function getAliasesFromStaticSources(staticAuthorityOptions, logger2, correlatio
let staticAliases;
const canonicalAuthority = staticAuthorityOptions.canonicalAuthority;
if (canonicalAuthority) {
- const authorityHost = new UrlString(canonicalAuthority, correlationId).getUrlComponents().HostNameAndPort;
+ const authorityHost = new UrlString(canonicalAuthority).getUrlComponents().HostNameAndPort;
staticAliases = getAliasesFromMetadata(logger2, correlationId, authorityHost, staticAuthorityOptions.cloudDiscoveryMetadata?.metadata, AuthorityMetadataSource.CONFIG) || getAliasesFromMetadata(logger2, correlationId, authorityHost, InstanceDiscoveryMetadata.metadata, AuthorityMetadataSource.HARDCODED_VALUES) || staticAuthorityOptions.knownAuthorities;
}
return staticAliases || [];
@@ -2579,12 +2548,12 @@ var init_CacheError = __esm({
init_CacheErrorCodes();
init_AuthError();
CacheError = class _CacheError extends Error {
- constructor(errorCode, errorMessage) {
- const message = errorMessage || getDefaultErrorMessage(errorCode);
+ constructor(errorCode2, errorMessage) {
+ const message = errorMessage || getDefaultErrorMessage(errorCode2);
super(message);
Object.setPrototypeOf(this, _CacheError.prototype);
this.name = "CacheError";
- this.errorCode = errorCode;
+ this.errorCode = errorCode2;
this.errorMessage = message;
}
};
@@ -2594,18 +2563,18 @@ var init_CacheError = __esm({
// node_modules/@azure/msal-common/dist/account/ClientInfo.mjs
function buildClientInfo(rawClientInfo, base64Decode) {
if (!rawClientInfo) {
- throw createClientAuthError(clientInfoEmptyError, "");
+ throw createClientAuthError(clientInfoEmptyError);
}
try {
const decodedClientInfo = base64Decode(rawClientInfo);
return JSON.parse(decodedClientInfo);
} catch (e) {
- throw createClientAuthError(clientInfoDecodingError, "");
+ throw createClientAuthError(clientInfoDecodingError);
}
}
function buildClientInfoFromHomeAccountId(homeAccountId) {
if (!homeAccountId) {
- throw createClientAuthError(clientInfoDecodingError, "");
+ throw createClientAuthError(clientInfoDecodingError);
}
const clientInfoParts = homeAccountId.split(CLIENT_INFO_SEPARATOR, 2);
return {
@@ -2639,8 +2608,8 @@ var init_AuthorityType = __esm({
// node_modules/@azure/msal-common/dist/account/TokenClaims.mjs
function getTenantIdFromIdTokenClaims(idTokenClaims) {
if (idTokenClaims) {
- const tenantId = idTokenClaims.tid || idTokenClaims.tfp || idTokenClaims.acr;
- return tenantId || null;
+ const tenantId2 = idTokenClaims.tid || idTokenClaims.tfp || idTokenClaims.acr;
+ return tenantId2 || null;
}
return null;
}
@@ -2694,10 +2663,8 @@ function generateAccountId(accountEntity) {
function getAccountInfo(accountEntity) {
const tenantProfiles = accountEntity.tenantProfiles || [];
if (tenantProfiles.length === 0 && accountEntity.realm && accountEntity.localAccountId) {
- tenantProfiles.push(buildTenantProfile(accountEntity.homeAccountId, accountEntity.localAccountId, accountEntity.realm, accountEntity.nativeAccountId));
+ tenantProfiles.push(buildTenantProfile(accountEntity.homeAccountId, accountEntity.localAccountId, accountEntity.realm));
}
- const homeTenantProfile = tenantProfiles.find((tp) => tp.tenantId === accountEntity.realm);
- const nativeAccountId = homeTenantProfile?.nativeAccountId || accountEntity.nativeAccountId;
return {
homeAccountId: accountEntity.homeAccountId,
environment: accountEntity.environment,
@@ -2706,7 +2673,7 @@ function getAccountInfo(accountEntity) {
localAccountId: accountEntity.localAccountId,
loginHint: accountEntity.loginHint,
name: accountEntity.name,
- nativeAccountId,
+ nativeAccountId: accountEntity.nativeAccountId,
authorityType: accountEntity.authorityType,
// Deserialize tenant profiles array into a Map
tenantProfiles: new Map(tenantProfiles.map((tenantProfile) => {
@@ -2718,7 +2685,7 @@ function getAccountInfo(accountEntity) {
function isSingleTenant(accountEntity) {
return !accountEntity.tenantProfiles;
}
-function createAccountEntity(accountDetails, authority, correlationId, base64Decode) {
+function createAccountEntity(accountDetails, authority, base64Decode) {
let authorityType;
if (authority.authorityType === AuthorityType.Adfs) {
authorityType = CACHE_ACCOUNT_TYPE_ADFS;
@@ -2737,7 +2704,7 @@ function createAccountEntity(accountDetails, authority, correlationId, base64Dec
}
const env = accountDetails.environment || authority && authority.getPreferredCache();
if (!env) {
- throw createClientAuthError(invalidCacheEnvironment, correlationId);
+ throw createClientAuthError(invalidCacheEnvironment);
}
const preferredUsername = accountDetails.idTokenClaims?.preferred_username || accountDetails.idTokenClaims?.upn;
const email2 = accountDetails.idTokenClaims?.emails ? accountDetails.idTokenClaims.emails[0] : null;
@@ -2749,7 +2716,7 @@ function createAccountEntity(accountDetails, authority, correlationId, base64Dec
if (accountDetails.tenantProfiles) {
tenantProfiles = accountDetails.tenantProfiles;
} else {
- const tenantProfile = buildTenantProfile(accountDetails.homeAccountId, localAccountId, realm, accountDetails.nativeAccountId, accountDetails.idTokenClaims);
+ const tenantProfile = buildTenantProfile(accountDetails.homeAccountId, localAccountId, realm, accountDetails.idTokenClaims);
tenantProfiles = [tenantProfile];
}
return {
@@ -2774,12 +2741,7 @@ function createAccountEntity(accountDetails, authority, correlationId, base64Dec
function createAccountEntityFromAccountInfo(accountInfo, cloudGraphHostName, msGraphHost) {
const tenantProfiles = Array.from(accountInfo.tenantProfiles?.values() || []);
if (tenantProfiles.length === 0 && accountInfo.tenantId && accountInfo.localAccountId) {
- tenantProfiles.push(buildTenantProfile(accountInfo.homeAccountId, accountInfo.localAccountId, accountInfo.tenantId, accountInfo.nativeAccountId, accountInfo.idTokenClaims));
- } else if (accountInfo.nativeAccountId) {
- const matchingProfile = tenantProfiles.find((tp) => tp.tenantId === accountInfo.tenantId);
- if (matchingProfile && !matchingProfile.nativeAccountId) {
- matchingProfile.nativeAccountId = accountInfo.nativeAccountId;
- }
+ tenantProfiles.push(buildTenantProfile(accountInfo.homeAccountId, accountInfo.localAccountId, accountInfo.tenantId, accountInfo.idTokenClaims));
}
return {
authorityType: accountInfo.authorityType || CACHE_ACCOUNT_TYPE_GENERIC,
@@ -2921,7 +2883,7 @@ var init_CacheManager = __esm({
}
const idToken = this.getIdToken(accountInfo, correlationId, tokenKeys, tenantProfile.tenantId);
if (idToken) {
- idTokenClaims = extractTokenClaims(idToken.secret, this.cryptoImpl.base64Decode, correlationId);
+ idTokenClaims = extractTokenClaims(idToken.secret, this.cryptoImpl.base64Decode);
if (!this.idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter)) {
return null;
}
@@ -2962,7 +2924,7 @@ var init_CacheManager = __esm({
if (tenantProfileFilter.isHomeTenant !== void 0 && !(tenantProfile.isHomeTenant === tenantProfileFilter.isHomeTenant)) {
return false;
}
- if (!!tenantProfileFilter.username && !this.matchUsername(tenantProfile.username, tenantProfileFilter.username) && !this.matchUsername(tenantProfile.upn, tenantProfileFilter.username)) {
+ if (!!tenantProfileFilter.username && !(this.matchUsername(tenantProfile.username, tenantProfileFilter.username) || !this.matchUsername(tenantProfile.upn, tenantProfileFilter.username))) {
return false;
}
if (!!tenantProfileFilter.loginHint && !this.matchLoginHintWithTenantProfile(tenantProfile, tenantProfileFilter.loginHint)) {
@@ -2971,9 +2933,6 @@ var init_CacheManager = __esm({
if (!!tenantProfileFilter.upn && !(tenantProfile.upn === tenantProfileFilter.upn)) {
return false;
}
- if (!!tenantProfileFilter.nativeAccountId && tenantProfile.nativeAccountId !== tenantProfileFilter.nativeAccountId) {
- return false;
- }
return true;
}
idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter) {
@@ -3004,7 +2963,7 @@ var init_CacheManager = __esm({
*/
async saveCacheRecord(cacheRecord, correlationId, kmsi, apiId, storeInCache) {
if (!cacheRecord) {
- throw createClientAuthError(invalidCacheRecord, correlationId);
+ throw createClientAuthError(invalidCacheRecord);
}
try {
if (!!cacheRecord.account) {
@@ -3045,14 +3004,14 @@ var init_CacheManager = __esm({
tokenType: credential.tokenType
};
const tokenKeys = this.getTokenKeys();
- const currentScopes = ScopeSet.fromString(credential.target, correlationId);
+ const currentScopes = ScopeSet.fromString(credential.target);
tokenKeys.accessToken.forEach((key) => {
if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
return;
}
const tokenEntity = this.getAccessTokenCredential(key, correlationId);
if (tokenEntity && this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
- const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
+ const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
this.removeAccessToken(key, correlationId);
}
@@ -3082,6 +3041,9 @@ var init_CacheManager = __esm({
if (!!accountFilter.realm && !this.matchRealm(entity, accountFilter.realm)) {
return;
}
+ if (!!accountFilter.nativeAccountId && !this.matchNativeAccountId(entity, accountFilter.nativeAccountId)) {
+ return;
+ }
if (!!accountFilter.authorityType && !this.matchAuthorityType(entity, accountFilter.authorityType)) {
return;
}
@@ -3090,8 +3052,7 @@ var init_CacheManager = __esm({
name: accountFilter?.name,
username: accountFilter?.username,
loginHint: accountFilter?.loginHint,
- upn: accountFilter?.upn,
- nativeAccountId: accountFilter?.nativeAccountId
+ upn: accountFilter?.upn
};
const matchingTenantProfiles = entity.tenantProfiles?.filter((tenantProfile) => {
return this.tenantProfileMatchesFilter(tenantProfile, tenantProfileFilter);
@@ -3132,7 +3093,7 @@ var init_CacheManager = __esm({
if (!!filter.familyId && !this.matchFamilyId(entity, filter.familyId)) {
return false;
}
- if (!!filter.target && !this.matchTarget(entity, filter.target, correlationId)) {
+ if (!!filter.target && !this.matchTarget(entity, filter.target)) {
return false;
}
if (entity.credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
@@ -3145,25 +3106,6 @@ var init_CacheManager = __esm({
}
}
}
- const entityComponents = entity.additionalCacheKeyComponents;
- const filterComponents = filter.additionalCacheKeyComponents;
- const entityHasComponents = !!entityComponents && Object.keys(entityComponents).length > 0;
- const filterHasComponents = !!filterComponents && Object.keys(filterComponents).length > 0;
- if (entityHasComponents !== filterHasComponents) {
- return false;
- }
- if (entityHasComponents && filterHasComponents) {
- const entityKeys = Object.keys(entityComponents).sort();
- const filterKeys = Object.keys(filterComponents).sort();
- if (entityKeys.length !== filterKeys.length) {
- return false;
- }
- for (let i = 0; i < entityKeys.length; i++) {
- if (entityKeys[i] !== filterKeys[i] || entityComponents[entityKeys[i]] !== filterComponents[filterKeys[i]]) {
- return false;
- }
- }
- }
return true;
}
/**
@@ -3409,7 +3351,7 @@ var init_CacheManager = __esm({
getAccessToken(account, request, tokenKeys, targetRealm) {
const correlationId = request.correlationId;
this.commonLogger.trace("CacheManager - getAccessToken called", correlationId);
- const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
+ const scopes = ScopeSet.createSearchScopes(request.scopes);
const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
const credentialType = authScheme && authScheme.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase() ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;
const accessTokenFilter = {
@@ -3567,7 +3509,7 @@ var init_CacheManager = __esm({
if (numAppMetadata < 1) {
return null;
} else if (numAppMetadata > 1) {
- throw createClientAuthError(multipleMatchingAppMetadata, correlationId);
+ throw createClientAuthError(multipleMatchingAppMetadata);
}
return appMetadataEntries[0];
}
@@ -3686,6 +3628,15 @@ var init_CacheManager = __esm({
matchRealm(entity, realm) {
return !!(entity.realm?.toLowerCase() === realm.toLowerCase());
}
+ /**
+ * helper to match nativeAccountId
+ * @param entity
+ * @param nativeAccountId
+ * @returns boolean indicating the match result
+ */
+ matchNativeAccountId(entity, nativeAccountId) {
+ return !!(entity.nativeAccountId && nativeAccountId === entity.nativeAccountId);
+ }
/**
* helper to match loginHint which can be either:
* 1. login_hint ID token claim
@@ -3727,12 +3678,12 @@ var init_CacheManager = __esm({
* @param entity
* @param target
*/
- matchTarget(entity, target, correlationId) {
+ matchTarget(entity, target) {
const isNotAccessTokenCredential = entity.credentialType !== CredentialType.ACCESS_TOKEN && entity.credentialType !== CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
if (isNotAccessTokenCredential || !entity.target) {
return false;
}
- const entityScopeSet = ScopeSet.fromString(entity.target, correlationId);
+ const entityScopeSet = ScopeSet.fromString(entity.target);
return entityScopeSet.containsScopeSet(target);
}
/**
@@ -3785,73 +3736,73 @@ var init_CacheManager = __esm({
};
DefaultStorageClass = class extends CacheManager {
async setAccount() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getAccount() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
async setIdTokenCredential() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getIdTokenCredential() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
async setAccessTokenCredential() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getAccessTokenCredential() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
async setRefreshTokenCredential() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getRefreshTokenCredential() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
setAppMetadata() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getAppMetadata() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
setServerTelemetry() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getServerTelemetry() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
setAuthorityMetadata() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getAuthorityMetadata() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getAuthorityMetadataKeys() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
setThrottlingCache() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getThrottlingCache() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
removeItem() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getKeys() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getAccountKeys() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
getTokenKeys() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
generateCredentialKey() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
generateAccountKey() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
};
}
@@ -3920,9 +3871,6 @@ var init_StubPerformanceClient = __esm({
addFields() {
return;
}
- addGlobalFields() {
- return;
- }
incrementFields() {
return;
}
@@ -3943,7 +3891,7 @@ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions:
authOptions: buildAuthOptions(userAuthOptions),
systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },
loggerOptions,
- storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name, version2), new StubPerformanceClient()),
+ storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions), new StubPerformanceClient()),
networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
@@ -3963,8 +3911,8 @@ function buildAuthOptions(authOptions) {
...authOptions
};
}
-function isOidcProtocolMode(config2) {
- return config2.authOptions.authority.options.protocolMode === ProtocolMode.OIDC;
+function isOidcProtocolMode(config3) {
+ return config3.authOptions.authority.options.protocolMode === ProtocolMode.OIDC;
}
var DEFAULT_SYSTEM_OPTIONS, DEFAULT_LOGGER_IMPLEMENTATION, DEFAULT_NETWORK_IMPLEMENTATION, DEFAULT_LIBRARY_INFO, DEFAULT_CLIENT_CREDENTIALS, DEFAULT_AZURE_CLOUD_OPTIONS, DEFAULT_TELEMETRY_OPTIONS;
var init_ClientConfiguration = __esm({
@@ -3993,10 +3941,10 @@ var init_ClientConfiguration = __esm({
};
DEFAULT_NETWORK_IMPLEMENTATION = {
async sendGetRequestAsync() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
},
async sendPostRequestAsync() {
- throw createClientAuthError(methodNotImplemented, "");
+ throw createClientAuthError(methodNotImplemented);
}
};
DEFAULT_LIBRARY_INFO = {
@@ -4113,20 +4061,20 @@ __export(CacheHelpers_exports, {
updateAuthorityEndpointMetadata: () => updateAuthorityEndpointMetadata,
updateCloudDiscoveryMetadata: () => updateCloudDiscoveryMetadata
});
-function createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId) {
+function createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId2) {
const idTokenEntity = {
credentialType: CredentialType.ID_TOKEN,
homeAccountId,
environment,
clientId,
secret: idToken,
- realm: tenantId,
+ realm: tenantId2,
lastUpdatedAt: Date.now().toString()
// Set the last updated time to now
};
return idTokenEntity;
}
-function createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, base64Decode, correlationId, refreshOn, tokenType, userAssertionHash, keyId, additionalCacheKeyComponents) {
+function createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId2, scopes, expiresOn, extExpiresOn, base64Decode, refreshOn, tokenType, userAssertionHash, keyId) {
const atEntity = {
homeAccountId,
credentialType: CredentialType.ACCESS_TOKEN,
@@ -4136,7 +4084,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
extendedExpiresOn: extExpiresOn.toString(),
environment,
clientId,
- realm: tenantId,
+ realm: tenantId2,
target: scopes,
tokenType: tokenType || AuthenticationScheme.BEARER,
lastUpdatedAt: Date.now().toString()
@@ -4152,9 +4100,9 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
switch (atEntity.tokenType) {
case AuthenticationScheme.POP:
- const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
+ const tokenClaims = extractTokenClaims(accessToken, base64Decode);
if (!tokenClaims?.cnf?.kid) {
- throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt, correlationId);
+ throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt);
}
atEntity.keyId = tokenClaims.cnf.kid;
break;
@@ -4162,9 +4110,6 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
atEntity.keyId = keyId;
}
}
- if (additionalCacheKeyComponents && Object.keys(additionalCacheKeyComponents).length > 0) {
- atEntity.additionalCacheKeyComponents = additionalCacheKeyComponents;
- }
return atEntity;
}
function createRefreshTokenEntity(homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash, expiresOn) {
@@ -4434,7 +4379,7 @@ var init_PopTokenGenerator = __esm({
*/
async signPayload(payload, keyId, request, claims) {
const { resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, shrOptions } = request;
- const resourceUrlString = resourceRequestUri ? new UrlString(resourceRequestUri, request.correlationId) : void 0;
+ const resourceUrlString = resourceRequestUri ? new UrlString(resourceRequestUri) : void 0;
const resourceUrlComponents = resourceUrlString?.getUrlComponents();
return this.cryptoUtils.signJwt({
at: payload,
@@ -4453,13 +4398,13 @@ var init_PopTokenGenerator = __esm({
});
// node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthErrorCodes.mjs
-var noTokensFound, refreshTokenExpired, uiNotAllowed, interactionRequired, consentRequired, loginRequired, badToken, interruptedUser;
+var noTokensFound, refreshTokenExpired, uxNotAllowed, interactionRequired, consentRequired, loginRequired, badToken, interruptedUser;
var init_InteractionRequiredAuthErrorCodes = __esm({
"node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthErrorCodes.mjs"() {
"use strict";
noTokensFound = "no_tokens_found";
refreshTokenExpired = "refresh_token_expired";
- uiNotAllowed = "ui_not_allowed";
+ uxNotAllowed = "ux_not_allowed";
interactionRequired = "interaction_required";
consentRequired = "consent_required";
loginRequired = "login_required";
@@ -4469,16 +4414,16 @@ var init_InteractionRequiredAuthErrorCodes = __esm({
});
// node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.mjs
-function isInteractionRequiredError(errorCode, errorString, subError) {
- const isInteractionRequiredErrorCode = !!errorCode && InteractionRequiredServerErrorMessage.indexOf(errorCode) > -1;
+function isInteractionRequiredError(errorCode2, errorString, subError) {
+ const isInteractionRequiredErrorCode = !!errorCode2 && InteractionRequiredServerErrorMessage.indexOf(errorCode2) > -1;
const isInteractionRequiredSubError = !!subError && InteractionRequiredAuthSubErrorMessage.indexOf(subError) > -1;
const isInteractionRequiredErrorDesc = !!errorString && InteractionRequiredServerErrorMessage.some((irErrorCode) => {
return errorString.indexOf(irErrorCode) > -1;
});
return isInteractionRequiredErrorCode || isInteractionRequiredErrorDesc || isInteractionRequiredSubError;
}
-function createInteractionRequiredAuthError(errorCode, correlationId, errorMessage) {
- return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
+function createInteractionRequiredAuthError(errorCode2, errorMessage) {
+ return new InteractionRequiredAuthError(errorCode2, errorMessage);
}
var InteractionRequiredServerErrorMessage, InteractionRequiredAuthSubErrorMessage, InteractionRequiredAuthError;
var init_InteractionRequiredAuthError = __esm({
@@ -4491,7 +4436,7 @@ var init_InteractionRequiredAuthError = __esm({
consentRequired,
loginRequired,
badToken,
- uiNotAllowed,
+ uxNotAllowed,
interruptedUser
];
InteractionRequiredAuthSubErrorMessage = [
@@ -4501,15 +4446,16 @@ var init_InteractionRequiredAuthError = __esm({
"user_password_expired",
"consent_required",
"bad_token",
- "ui_not_allowed",
+ "ux_not_allowed",
"interrupted_user"
];
InteractionRequiredAuthError = class _InteractionRequiredAuthError extends AuthError {
- constructor(errorCode, correlationId, errorMessage, subError, timestamp, traceId, claims, errorNo) {
- super(errorCode, correlationId, errorMessage, subError);
+ constructor(errorCode2, errorMessage, subError, timestamp, traceId, correlationId, claims, errorNo) {
+ super(errorCode2, errorMessage, subError);
Object.setPrototypeOf(this, _InteractionRequiredAuthError.prototype);
this.timestamp = timestamp || "";
this.traceId = traceId || "";
+ this.correlationId = correlationId || "";
this.claims = claims || "";
this.name = "InteractionRequiredAuthError";
this.errorNo = errorNo;
@@ -4525,8 +4471,8 @@ var init_ServerError = __esm({
"use strict";
init_AuthError();
ServerError = class _ServerError extends AuthError {
- constructor(errorCode, correlationId, errorMessage, subError, errorNo, status) {
- super(errorCode, correlationId, errorMessage, subError);
+ constructor(errorCode2, errorMessage, subError, errorNo, status) {
+ super(errorCode2, errorMessage, subError);
this.name = "ServerError";
this.errorNo = errorNo;
this.status = status;
@@ -4537,12 +4483,12 @@ var init_ServerError = __esm({
});
// node_modules/@azure/msal-common/dist/utils/ProtocolUtils.mjs
-function parseRequestState(base64Decode, state, correlationId) {
+function parseRequestState(base64Decode, state) {
if (!base64Decode) {
- throw createClientAuthError(noCryptoObject, correlationId);
+ throw createClientAuthError(noCryptoObject);
}
if (!state) {
- throw createClientAuthError(invalidState, correlationId);
+ throw createClientAuthError(invalidState);
}
try {
const splitState = state.split(RESOURCE_DELIM);
@@ -4555,7 +4501,7 @@ function parseRequestState(base64Decode, state, correlationId) {
libraryState: libraryStateObj
};
} catch (e) {
- throw createClientAuthError(invalidState, correlationId);
+ throw createClientAuthError(invalidState);
}
}
var init_ProtocolUtils = __esm({
@@ -4585,13 +4531,13 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
cloudGraphHostName: authCodePayload?.cloud_graph_host_name,
msGraphHost: authCodePayload?.msgraph_host,
nativeAccountId
- }, authority, correlationId, base64Decode);
+ }, authority, base64Decode);
const tenantProfiles = baseAccount.tenantProfiles || [];
- const tenantId = claimsTenantId || baseAccount.realm;
- if (tenantId && !tenantProfiles.find((tenantProfile) => {
- return tenantProfile.tenantId === tenantId;
+ const tenantId2 = claimsTenantId || baseAccount.realm;
+ if (tenantId2 && !tenantProfiles.find((tenantProfile) => {
+ return tenantProfile.tenantId === tenantId2;
})) {
- const newTenantProfile = buildTenantProfile(homeAccountId, baseAccount.localAccountId, tenantId, nativeAccountId, idTokenClaims);
+ const newTenantProfile = buildTenantProfile(homeAccountId, baseAccount.localAccountId, tenantId2, idTokenClaims);
tenantProfiles.push(newTenantProfile);
}
baseAccount.tenantProfiles = tenantProfiles;
@@ -4636,7 +4582,7 @@ var init_ResponseHandler = __esm({
if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {
const errString = `Error(s): ${serverResponse.error_codes || NOT_AVAILABLE} - Timestamp: ${serverResponse.timestamp || NOT_AVAILABLE} - Description: ${serverResponse.error_description || NOT_AVAILABLE} - Correlation ID: ${serverResponse.correlation_id || NOT_AVAILABLE} - Trace ID: ${serverResponse.trace_id || NOT_AVAILABLE}`;
const serverErrorNo = serverResponse.error_codes?.length ? serverResponse.error_codes[0] : void 0;
- const serverError = new ServerError(serverResponse.error || "", serverResponse.correlation_id || "", errString, serverResponse.suberror, serverErrorNo, serverResponse.status);
+ const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo, serverResponse.status);
if (refreshAccessToken && serverResponse.status && serverResponse.status >= HTTP_SERVER_ERROR_RANGE_START && serverResponse.status <= HTTP_SERVER_ERROR_RANGE_END) {
this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.
${serverError}`, correlationId);
@@ -4647,7 +4593,7 @@ ${serverError}`, correlationId);
return;
}
if (isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
- throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.correlation_id || "", serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.claims || "", serverErrorNo);
+ throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.correlation_id || "", serverResponse.claims || "", serverErrorNo);
}
throw serverError;
}
@@ -4657,23 +4603,30 @@ ${serverError}`, correlationId);
* @param serverTokenResponse
* @param authority
*/
- async handleServerTokenResponse(serverTokenResponse, authority, reqTimestamp, request, apiId, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId, additionalCacheKeyComponents) {
+ async handleServerTokenResponse(serverTokenResponse, authority, reqTimestamp, request, apiId, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {
let idTokenClaims;
if (serverTokenResponse.id_token) {
- idTokenClaims = extractTokenClaims(serverTokenResponse.id_token || "", this.cryptoObj.base64Decode, request.correlationId);
+ idTokenClaims = extractTokenClaims(serverTokenResponse.id_token || "", this.cryptoObj.base64Decode);
if (authCodePayload && authCodePayload.nonce) {
if (idTokenClaims.nonce !== authCodePayload.nonce) {
- throw createClientAuthError(nonceMismatch, request.correlationId);
+ throw createClientAuthError(nonceMismatch);
+ }
+ }
+ if (request.maxAge || request.maxAge === 0) {
+ const authTime = idTokenClaims.auth_time;
+ if (!authTime) {
+ throw createClientAuthError(authTimeNotFound);
}
+ checkMaxAge(authTime, request.maxAge);
}
}
this.homeAccountIdentifier = generateHomeAccountId(serverTokenResponse.client_info || "", authority.authorityType, this.logger, this.cryptoObj, request.correlationId, idTokenClaims);
let requestStateObj;
if (!!authCodePayload && !!authCodePayload.state) {
- requestStateObj = parseRequestState(this.cryptoObj.base64Decode, authCodePayload.state, request.correlationId);
+ requestStateObj = parseRequestState(this.cryptoObj.base64Decode, authCodePayload.state);
}
serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || void 0;
- const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, additionalCacheKeyComponents);
+ const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload);
let cacheContext;
try {
if (this.persistencePlugin && this.serializableCache) {
@@ -4709,10 +4662,10 @@ ${serverError}`, correlationId);
* @param idTokenObj
* @param authority
*/
- generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, additionalCacheKeyComponents) {
+ generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload) {
const env = authority.getPreferredCache();
if (!env) {
- throw createClientAuthError(invalidCacheEnvironment, request.correlationId);
+ throw createClientAuthError(invalidCacheEnvironment);
}
const claimsTenantId = getTenantIdFromIdTokenClaims(idTokenClaims);
let cachedIdToken;
@@ -4738,14 +4691,14 @@ ${serverError}`, correlationId);
}
let cachedAccessToken = null;
if (serverTokenResponse.access_token) {
- const responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope, request.correlationId) : new ScopeSet(request.scopes || [], request.correlationId);
+ const responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(request.scopes || []);
const expiresIn = (typeof serverTokenResponse.expires_in === "string" ? parseInt(serverTokenResponse.expires_in, 10) : serverTokenResponse.expires_in) || 0;
const extExpiresIn = (typeof serverTokenResponse.ext_expires_in === "string" ? parseInt(serverTokenResponse.ext_expires_in, 10) : serverTokenResponse.ext_expires_in) || 0;
const refreshIn = (typeof serverTokenResponse.refresh_in === "string" ? parseInt(serverTokenResponse.refresh_in, 10) : serverTokenResponse.refresh_in) || void 0;
const tokenExpirationSeconds = reqTimestamp + expiresIn;
const extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;
const refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : void 0;
- cachedAccessToken = createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token, this.clientId, claimsTenantId || authority.tenant || "", responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj.base64Decode, request.correlationId, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id, additionalCacheKeyComponents);
+ cachedAccessToken = createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token, this.clientId, claimsTenantId || authority.tenant || "", responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj.base64Decode, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id);
const resource = request.resource || null;
if (resource) {
cachedAccessToken.resource = resource;
@@ -4799,13 +4752,13 @@ ${serverError}`, correlationId);
const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
const { secret, keyId } = cacheRecord.accessToken;
if (!keyId) {
- throw createClientAuthError(keyIdMissing, request.correlationId);
+ throw createClientAuthError(keyIdMissing);
}
accessToken = await popTokenGenerator.signPopToken(secret, keyId, request);
} else {
accessToken = cacheRecord.accessToken.secret;
}
- responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target, request.correlationId).asArray();
+ responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();
expiresOn = toDateFromSeconds(cacheRecord.accessToken.expiresOn);
extExpiresOn = toDateFromSeconds(cacheRecord.accessToken.extendedExpiresOn);
if (cacheRecord.accessToken.refreshOn) {
@@ -4819,13 +4772,6 @@ ${serverError}`, correlationId);
const tid = idTokenClaims?.tid || "";
if (serverTokenResponse?.spa_accountid && !!cacheRecord.account) {
cacheRecord.account.nativeAccountId = serverTokenResponse?.spa_accountid;
- const targetTenantId = tid || cacheRecord.account.realm;
- if (cacheRecord.account.tenantProfiles) {
- const matchingProfile = cacheRecord.account.tenantProfiles.find((tp) => tp.tenantId === targetTenantId);
- if (matchingProfile) {
- matchingProfile.nativeAccountId = serverTokenResponse.spa_accountid;
- }
- }
}
const accountInfo = cacheRecord.account ? updateAccountTenantProfileData(
getAccountInfo(cacheRecord.account),
@@ -4875,16 +4821,15 @@ var init_CcsCredential = __esm({
});
// node_modules/@azure/msal-common/dist/utils/ClientAssertionUtils.mjs
-async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiPath) {
+async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
if (typeof clientAssertion === "string") {
return clientAssertion;
} else {
- const config2 = {
+ const config3 = {
clientId,
- tokenEndpoint,
- fmiPath
+ tokenEndpoint
};
- return clientAssertion(config2);
+ return clientAssertion(config3);
}
}
var init_ClientAssertionUtils = __esm({
@@ -4906,8 +4851,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
resourceRequestUri: request.resourceRequestUri,
shrClaims: request.shrClaims,
sshKid: request.sshKid,
- embeddedClientId: request.embeddedClientId || request.extraParameters?.clientId,
- resource: request.resource
+ embeddedClientId: request.embeddedClientId || request.extraParameters?.clientId
};
}
var init_RequestThumbprint = __esm({
@@ -4945,7 +4889,7 @@ var init_ThrottlingUtils = __esm({
cacheManager.removeItem(key, correlationId);
return;
}
- throw new ServerError(value.errorCodes?.join(" ") || "", correlationId, value.errorMessage, value.subError);
+ throw new ServerError(value.errorCodes?.join(" ") || "", value.errorMessage, value.subError);
}
}
/**
@@ -5013,7 +4957,7 @@ var init_NetworkError = __esm({
init_AuthError();
NetworkError = class _NetworkError extends AuthError {
constructor(error2, httpStatus, responseHeaders) {
- super(error2.errorCode, error2.correlationId, error2.errorMessage, error2.subError);
+ super(error2.errorCode, error2.errorMessage, error2.subError);
Object.setPrototypeOf(this, _NetworkError.prototype);
this.name = "NetworkError";
this.error = error2;
@@ -5099,7 +5043,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
if (e instanceof AuthError) {
throw e;
} else {
- throw createClientAuthError(networkError, correlationId);
+ throw createClientAuthError(networkError);
}
}
ThrottlingUtils.postProcess(cacheManager, thumbprint, response, correlationId);
@@ -5180,10 +5124,8 @@ var init_RegionDiscovery = __esm({
try {
const localIMDSVersionResponse = await invokeAsync(this.getRegionFromIMDS.bind(this), RegionDiscoveryGetRegionFromIMDS, this.logger, this.performanceClient, this.correlationId)(IMDS_VERSION, options);
if (localIMDSVersionResponse.status === HTTP_SUCCESS) {
- autodetectedRegionName = localIMDSVersionResponse.body?.location;
- if (autodetectedRegionName) {
- regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
- }
+ autodetectedRegionName = localIMDSVersionResponse.body;
+ regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
}
if (localIMDSVersionResponse.status === HTTP_BAD_REQUEST) {
const currentIMDSVersion = await invokeAsync(this.getCurrentVersion.bind(this), RegionDiscoveryGetCurrentVersion, this.logger, this.performanceClient, this.correlationId)(options);
@@ -5193,10 +5135,8 @@ var init_RegionDiscovery = __esm({
}
const currentIMDSVersionResponse = await invokeAsync(this.getRegionFromIMDS.bind(this), RegionDiscoveryGetRegionFromIMDS, this.logger, this.performanceClient, this.correlationId)(currentIMDSVersion, options);
if (currentIMDSVersionResponse.status === HTTP_SUCCESS) {
- autodetectedRegionName = currentIMDSVersionResponse.body?.location;
- if (autodetectedRegionName) {
- regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
- }
+ autodetectedRegionName = currentIMDSVersionResponse.body;
+ regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
}
}
} catch (e) {
@@ -5214,12 +5154,11 @@ var init_RegionDiscovery = __esm({
/**
* Make the call to the IMDS endpoint
*
- * @param version
- * @param options
- * @returns Promise<NetworkResponse<ImdsComputeResponse>>
+ * @param imdsEndpointUrl
+ * @returns Promise<NetworkResponse<string>>
*/
async getRegionFromIMDS(version4, options) {
- return this.networkInterface.sendGetRequestAsync(`${IMDS_ENDPOINT}?api-version=${version4}`, options, IMDS_TIMEOUT);
+ return this.networkInterface.sendGetRequestAsync(`${IMDS_ENDPOINT}?api-version=${version4}&format=text`, options, IMDS_TIMEOUT);
}
/**
* Get the most recent version of the IMDS endpoint available
@@ -5247,17 +5186,17 @@ var init_RegionDiscovery = __esm({
});
// node_modules/@azure/msal-common/dist/authority/Authority.mjs
-function getTenantFromAuthorityString(authority, correlationId) {
- const authorityUrl = new UrlString(authority, correlationId);
+function getTenantFromAuthorityString(authority) {
+ const authorityUrl = new UrlString(authority);
const authorityUrlComponents = authorityUrl.getUrlComponents();
- const tenantId = authorityUrlComponents.PathSegments.slice(-1)[0]?.toLowerCase();
- switch (tenantId) {
+ const tenantId2 = authorityUrlComponents.PathSegments.slice(-1)[0]?.toLowerCase();
+ switch (tenantId2) {
case AADAuthority.COMMON:
case AADAuthority.ORGANIZATIONS:
case AADAuthority.CONSUMERS:
return void 0;
default:
- return tenantId;
+ return tenantId2;
}
}
function formatAuthorityUri(authorityUri) {
@@ -5270,7 +5209,7 @@ function buildStaticAuthorityOptions(authOptions) {
try {
cloudDiscoveryMetadata = JSON.parse(rawCloudDiscoveryMetadata);
} catch (e) {
- throw createClientConfigurationError(invalidCloudDiscoveryMetadata, "");
+ throw createClientConfigurationError(invalidCloudDiscoveryMetadata);
}
}
return {
@@ -5320,7 +5259,7 @@ var init_Authority = __esm({
this.regionDiscovery = new RegionDiscovery(networkInterface, this.logger, this.performanceClient, this.correlationId);
}
/**
- * Get {@link AuthorityType:type}
+ * Get {@link AuthorityType}
* @param authorityUri {@link IUri}
* @private
*/
@@ -5365,7 +5304,7 @@ var init_Authority = __esm({
* Sets canonical authority.
*/
set canonicalAuthority(url) {
- this._canonicalAuthority = new UrlString(url, this.correlationId);
+ this._canonicalAuthority = new UrlString(url);
this._canonicalAuthority.validateAsUri();
this._canonicalAuthorityUrlComponents = null;
}
@@ -5397,7 +5336,7 @@ var init_Authority = __esm({
if (this.discoveryComplete()) {
return this.replacePath(this.metadata.authorization_endpoint);
} else {
- throw createClientAuthError(endpointResolutionError, this.correlationId);
+ throw createClientAuthError(endpointResolutionError);
}
}
/**
@@ -5407,14 +5346,14 @@ var init_Authority = __esm({
if (this.discoveryComplete()) {
return this.replacePath(this.metadata.token_endpoint);
} else {
- throw createClientAuthError(endpointResolutionError, this.correlationId);
+ throw createClientAuthError(endpointResolutionError);
}
}
get deviceCodeEndpoint() {
if (this.discoveryComplete()) {
return this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
} else {
- throw createClientAuthError(endpointResolutionError, this.correlationId);
+ throw createClientAuthError(endpointResolutionError);
}
}
/**
@@ -5423,11 +5362,11 @@ var init_Authority = __esm({
get endSessionEndpoint() {
if (this.discoveryComplete()) {
if (!this.metadata.end_session_endpoint) {
- throw createClientAuthError(endSessionEndpointNotSupported, this.correlationId);
+ throw createClientAuthError(endSessionEndpointNotSupported);
}
return this.replacePath(this.metadata.end_session_endpoint);
} else {
- throw createClientAuthError(endpointResolutionError, this.correlationId);
+ throw createClientAuthError(endpointResolutionError);
}
}
/**
@@ -5437,7 +5376,7 @@ var init_Authority = __esm({
if (this.discoveryComplete()) {
return this.replacePath(this.metadata.issuer);
} else {
- throw createClientAuthError(endpointResolutionError, this.correlationId);
+ throw createClientAuthError(endpointResolutionError);
}
}
/**
@@ -5447,7 +5386,7 @@ var init_Authority = __esm({
if (this.discoveryComplete()) {
return this.replacePath(this.metadata.jwks_uri);
} else {
- throw createClientAuthError(endpointResolutionError, this.correlationId);
+ throw createClientAuthError(endpointResolutionError);
}
}
/**
@@ -5471,17 +5410,17 @@ var init_Authority = __esm({
*/
replacePath(urlString) {
let endpoint = urlString;
- const cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority, this.correlationId);
+ const cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);
const cachedAuthorityUrlComponents = cachedAuthorityUrl.getUrlComponents();
const cachedAuthorityParts = cachedAuthorityUrlComponents.PathSegments;
const currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;
currentAuthorityParts.forEach((currentPart, index) => {
let cachedPart = cachedAuthorityParts[index];
if (index === 0 && this.canReplaceTenant(cachedAuthorityUrlComponents)) {
- const tenantId = new UrlString(this.metadata.authorization_endpoint, this.correlationId).getUrlComponents().PathSegments[0];
- if (cachedPart !== tenantId) {
- this.logger.verbose(`Replacing tenant domain name '${cachedPart}' with id '${tenantId}'`, this.correlationId);
- cachedPart = tenantId;
+ const tenantId2 = new UrlString(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];
+ if (cachedPart !== tenantId2) {
+ this.logger.verbose(`Replacing tenant domain name '${cachedPart}' with id '${tenantId2}'`, this.correlationId);
+ cachedPart = tenantId2;
}
}
if (currentPart !== cachedPart) {
@@ -5591,7 +5530,7 @@ var init_Authority = __esm({
updateAuthorityEndpointMetadata(metadataEntity, metadata, true);
return AuthorityMetadataSource.NETWORK;
} else {
- throw createClientAuthError(openIdConfigError, this.defaultOpenIdConfigurationEndpoint, this.correlationId);
+ throw createClientAuthError(openIdConfigError, this.defaultOpenIdConfigurationEndpoint);
}
}
/**
@@ -5637,7 +5576,7 @@ var init_Authority = __esm({
* @param metadataEntity
*/
isAuthoritySameType(metadataEntity) {
- const cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority, this.correlationId);
+ const cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority);
const cachedParts = cachedAuthorityUrl.getUrlComponents().PathSegments;
return cachedParts.length === this.canonicalAuthorityUrlComponents.PathSegments.length;
}
@@ -5649,7 +5588,7 @@ var init_Authority = __esm({
try {
return JSON.parse(this.authorityOptions.authorityMetadata);
} catch (e) {
- throw createClientConfigurationError(invalidAuthorityMetadata, this.correlationId);
+ throw createClientConfigurationError(invalidAuthorityMetadata);
}
}
return null;
@@ -5696,13 +5635,13 @@ var init_Authority = __esm({
if (userConfiguredAzureRegion !== AZURE_REGION_AUTO_DISCOVER_FLAG) {
this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
this.regionDiscoveryMetadata.region_used = userConfiguredAzureRegion;
- return _Authority.replaceWithRegionalInformation(metadata, userConfiguredAzureRegion, this.correlationId);
+ return _Authority.replaceWithRegionalInformation(metadata, userConfiguredAzureRegion);
}
const autodetectedRegionName = await invokeAsync(this.regionDiscovery.detectRegion.bind(this.regionDiscovery), RegionDiscoveryDetectRegion, this.logger, this.performanceClient, this.correlationId)(this.authorityOptions.azureRegionConfiguration?.environmentRegion, this.regionDiscoveryMetadata);
if (autodetectedRegionName) {
this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL;
this.regionDiscoveryMetadata.region_used = autodetectedRegionName;
- return _Authority.replaceWithRegionalInformation(metadata, autodetectedRegionName, this.correlationId);
+ return _Authority.replaceWithRegionalInformation(metadata, autodetectedRegionName);
}
this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
}
@@ -5724,7 +5663,7 @@ var init_Authority = __esm({
updateCloudDiscoveryMetadata(metadataEntity, metadata, true);
return AuthorityMetadataSource.NETWORK;
}
- throw createClientConfigurationError(untrustedAuthority, this.correlationId);
+ throw createClientConfigurationError(untrustedAuthority);
}
updateCloudDiscoveryMetadataFromLocalSources(metadataEntity) {
this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration", this.correlationId);
@@ -5777,10 +5716,10 @@ var init_Authority = __esm({
}
} catch (e) {
this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.", this.correlationId);
- throw createClientConfigurationError(invalidCloudDiscoveryMetadata, this.correlationId);
+ throw createClientConfigurationError(invalidCloudDiscoveryMetadata);
}
}
- if (this.isInKnownAuthorities(this.hostnameAndPort)) {
+ if (this.isInKnownAuthorities()) {
this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.", this.correlationId);
return _Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
}
@@ -5841,12 +5780,11 @@ Error Description: '${typedError.message}'`, this.correlationId);
return match;
}
/**
- * Helper function to determine if a host is included in the knownAuthorities config option.
+ * Helper function to determine if this host is included in the knownAuthorities config option
*/
- isInKnownAuthorities(host) {
- const normalizedHost = host.toLowerCase();
+ isInKnownAuthorities() {
const matches = this.authorityOptions.knownAuthorities.filter((authority) => {
- return authority && UrlString.getDomainFromUrl(authority, this.correlationId).toLowerCase() === normalizedHost;
+ return authority && UrlString.getDomainFromUrl(authority).toLowerCase() === this.hostnameAndPort;
});
return matches.length > 0;
}
@@ -5883,7 +5821,7 @@ Error Description: '${typedError.message}'`, this.correlationId);
} else if (this.discoveryComplete()) {
return this.metadata.preferred_cache;
} else {
- throw createClientAuthError(endpointResolutionError, this.correlationId);
+ throw createClientAuthError(endpointResolutionError);
}
}
/**
@@ -5916,23 +5854,19 @@ Error Description: '${typedError.message}'`, this.correlationId);
* 4. Same as (2), but the issuer host matches the CIAM tenant pattern
* `{tenant}.ciamlogin.com` with an optional `/{tenant}[.onmicrosoft.com][/v2.0]`
* path.
- * 5. The issuer host is HTTPS and is explicitly listed in the
- * developer-configured `knownAuthorities`. This covers scenarios where
- * the OIDC discovery document returns an issuer host that differs from
- * the authority (e.g., a GUID-based issuer for a name-based CIAM authority).
*
* @param issuer The `issuer` value returned in the OIDC discovery document.
* @throws ClientConfigurationError("issuer_validation_failed") on failure.
*/
validateIssuer(issuer) {
if (!issuer) {
- throw createClientConfigurationError(issuerValidationFailed, this.correlationId);
+ throw createClientConfigurationError(issuerValidationFailed);
}
let issuerUrl;
try {
issuerUrl = new URL(issuer);
} catch {
- throw createClientConfigurationError(issuerValidationFailed, this.correlationId);
+ throw createClientConfigurationError(issuerValidationFailed);
}
const issuerScheme = issuerUrl.protocol;
const issuerHost = issuerUrl.host;
@@ -5942,11 +5876,10 @@ Error Description: '${typedError.message}'`, this.correlationId);
const matchesKnownMicrosoftHost = issuerScheme === "https:" && this.isAliasOfKnownMicrosoftAuthority(issuerHost);
const matchesRegionalMicrosoftHost = issuerScheme === "https:" && this.matchesRegionalMicrosoftHost(issuerHost);
const matchesCiamTenantPattern = this.matchesCiamTenantPattern(issuerUrl, authorityHost, this.canonicalAuthorityUrlComponents.PathSegments);
- const matchesKnownAuthority = issuerScheme === "https:" && this.isInKnownAuthorities(issuerHost);
- if (matchesAuthorityOrigin || matchesKnownMicrosoftHost || matchesRegionalMicrosoftHost || matchesCiamTenantPattern || matchesKnownAuthority) {
+ if (matchesAuthorityOrigin || matchesKnownMicrosoftHost || matchesRegionalMicrosoftHost || matchesCiamTenantPattern) {
return;
}
- throw createClientConfigurationError(issuerValidationFailed, this.correlationId);
+ throw createClientConfigurationError(issuerValidationFailed);
}
/**
* Rule 1: The issuer scheme + host (and port) match the authority's. Path
@@ -6015,8 +5948,8 @@ Error Description: '${typedError.message}'`, this.correlationId);
* @param host string
* @param region string
*/
- static buildRegionalAuthorityString(host, region, correlationId, queryString) {
- const authorityUrlInstance = new UrlString(host, correlationId);
+ static buildRegionalAuthorityString(host, region, queryString) {
+ const authorityUrlInstance = new UrlString(host);
authorityUrlInstance.validateAsUri();
const authorityUrlParts = authorityUrlInstance.getUrlComponents();
let hostNameAndPort = `${region}.${authorityUrlParts.HostNameAndPort}`;
@@ -6026,7 +5959,7 @@ Error Description: '${typedError.message}'`, this.correlationId);
const url = UrlString.constructAuthorityUriFromObject({
...authorityUrlInstance.getUrlComponents(),
HostNameAndPort: hostNameAndPort
- }, correlationId).urlString;
+ }).urlString;
if (queryString)
return `${url}?${queryString}`;
return url;
@@ -6037,12 +5970,12 @@ Error Description: '${typedError.message}'`, this.correlationId);
* @param metadata OpenIdConfigResponse
* @param azureRegion string
*/
- static replaceWithRegionalInformation(metadata, azureRegion, correlationId) {
+ static replaceWithRegionalInformation(metadata, azureRegion) {
const regionalMetadata = { ...metadata };
- regionalMetadata.authorization_endpoint = _Authority.buildRegionalAuthorityString(regionalMetadata.authorization_endpoint, azureRegion, correlationId);
- regionalMetadata.token_endpoint = _Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion, correlationId);
+ regionalMetadata.authorization_endpoint = _Authority.buildRegionalAuthorityString(regionalMetadata.authorization_endpoint, azureRegion);
+ regionalMetadata.token_endpoint = _Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion);
if (regionalMetadata.end_session_endpoint) {
- regionalMetadata.end_session_endpoint = _Authority.buildRegionalAuthorityString(regionalMetadata.end_session_endpoint, azureRegion, correlationId);
+ regionalMetadata.end_session_endpoint = _Authority.buildRegionalAuthorityString(regionalMetadata.end_session_endpoint, azureRegion);
}
return regionalMetadata;
}
@@ -6055,9 +5988,9 @@ Error Description: '${typedError.message}'`, this.correlationId);
*
* @param authority
*/
- static transformCIAMAuthority(authority, correlationId) {
+ static transformCIAMAuthority(authority) {
let ciamAuthority = authority;
- const authorityUrl = new UrlString(authority, correlationId);
+ const authorityUrl = new UrlString(authority);
const authorityUrlComponents = authorityUrl.getUrlComponents();
if (authorityUrlComponents.PathSegments.length === 0 && authorityUrlComponents.HostNameAndPort.endsWith(CIAM_AUTH_URL)) {
const tenantIdOrDomain = authorityUrlComponents.HostNameAndPort.split(".")[0];
@@ -6082,13 +6015,13 @@ __export(AuthorityFactory_exports, {
createDiscoveredInstance: () => createDiscoveredInstance
});
async function createDiscoveredInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger2, correlationId, performanceClient) {
- const authorityUriFinal = Authority.transformCIAMAuthority(formatAuthorityUri(authorityUri), correlationId);
+ const authorityUriFinal = Authority.transformCIAMAuthority(formatAuthorityUri(authorityUri));
const acquireTokenAuthority = new Authority(authorityUriFinal, networkClient, cacheManager, authorityOptions, logger2, correlationId, performanceClient);
try {
await invokeAsync(acquireTokenAuthority.resolveEndpointsAsync.bind(acquireTokenAuthority), AuthorityResolveEndpointsAsync, logger2, performanceClient, correlationId)();
return acquireTokenAuthority;
} catch (e) {
- throw createClientAuthError(endpointResolutionError, correlationId);
+ throw createClientAuthError(endpointResolutionError);
}
}
var init_AuthorityFactory = __esm({
@@ -6150,7 +6083,7 @@ var init_AuthorizationCodeClient = __esm({
*/
async acquireToken(request, apiId, authCodePayload) {
if (!request.code) {
- throw createClientAuthError(requestCannotBeMade, request.correlationId);
+ throw createClientAuthError(requestCannotBeMade);
}
if (authCodePayload && authCodePayload.cloud_instance_host_name) {
await invokeAsync(this.updateTokenEndpointAuthority.bind(this), UpdateTokenEndpointAuthority, this.logger, this.performanceClient, request.correlationId)(authCodePayload.cloud_instance_host_name, request.correlationId);
@@ -6169,7 +6102,7 @@ var init_AuthorizationCodeClient = __esm({
*/
getLogoutUri(logoutRequest) {
if (!logoutRequest) {
- throw createClientConfigurationError(logoutRequestEmpty, "");
+ throw createClientConfigurationError(logoutRequestEmpty);
}
const queryString = this.createLogoutUrlQueryString(logoutRequest);
return UrlString.appendQueryString(this.authority.endSessionEndpoint, queryString);
@@ -6208,12 +6141,12 @@ var init_AuthorizationCodeClient = __esm({
addClientId(parameters, request.embeddedClientId || request.extraParameters?.[CLIENT_ID] || this.config.authOptions.clientId);
if (!this.includeRedirectUri) {
if (!request.redirectUri) {
- throw createClientConfigurationError(redirectUriEmpty, request.correlationId);
+ throw createClientConfigurationError(redirectUriEmpty);
}
} else {
addRedirectUri(parameters, request.redirectUri);
}
- addScopes(parameters, request.scopes, request.correlationId, true, this.oidcDefaultScopes);
+ addScopes(parameters, request.scopes, true, this.oidcDefaultScopes);
addResource(parameters, request.resource);
addAuthorizationCode(parameters, request.code);
addLibraryInfo(parameters, this.config.libraryInfo);
@@ -6249,7 +6182,7 @@ var init_AuthorizationCodeClient = __esm({
if (request.sshJwk) {
addSshJwk(parameters, request.sshJwk);
} else {
- throw createClientConfigurationError(missingSshJwk, request.correlationId);
+ throw createClientConfigurationError(missingSshJwk);
}
}
let ccsCred = void 0;
@@ -6293,7 +6226,7 @@ var init_AuthorizationCodeClient = __esm({
});
}
instrumentBrokerParams(parameters, request.correlationId, this.performanceClient);
- addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, request.skipBrokerClaims);
+ addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities, request.skipBrokerClaims);
return mapToQueryString(parameters);
}
/**
@@ -6395,10 +6328,10 @@ var init_RefreshTokenClient = __esm({
*/
async acquireTokenByRefreshToken(request, apiId) {
if (!request) {
- throw createClientConfigurationError(tokenRequestEmpty, "");
+ throw createClientConfigurationError(tokenRequestEmpty);
}
if (!request.account) {
- throw createClientAuthError(noAccountInSilentRequest, request.correlationId);
+ throw createClientAuthError(noAccountInSilentRequest);
}
const isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment, request.correlationId);
if (isFOCI) {
@@ -6423,7 +6356,7 @@ var init_RefreshTokenClient = __esm({
async acquireTokenWithCachedRefreshToken(request, foci, apiId) {
const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, request.correlationId, void 0);
if (!refreshToken) {
- throw createInteractionRequiredAuthError(noTokensFound, request.correlationId);
+ throw createInteractionRequiredAuthError(noTokensFound);
}
if (refreshToken.expiresOn) {
const offset = request.refreshTokenExpirationOffsetSeconds || DEFAULT_REFRESH_TOKEN_EXPIRATION_OFFSET_SECONDS;
@@ -6432,7 +6365,7 @@ var init_RefreshTokenClient = __esm({
rtOffsetSeconds: offset
}, request.correlationId);
if (isTokenExpired(refreshToken.expiresOn, offset)) {
- throw createInteractionRequiredAuthError(refreshTokenExpired, request.correlationId);
+ throw createInteractionRequiredAuthError(refreshTokenExpired);
}
}
const refreshTokenRequest = {
@@ -6480,7 +6413,7 @@ var init_RefreshTokenClient = __esm({
if (request.redirectUri) {
addRedirectUri(parameters, request.redirectUri);
}
- addScopes(parameters, request.scopes, request.correlationId, true, this.config.authOptions.authority.options.OIDCOptions?.defaultScopes);
+ addScopes(parameters, request.scopes, true, this.config.authOptions.authority.options.OIDCOptions?.defaultScopes);
addGrantType(parameters, GrantType.REFRESH_TOKEN_GRANT);
addClientInfo(parameters);
addLibraryInfo(parameters, this.config.libraryInfo);
@@ -6512,7 +6445,7 @@ var init_RefreshTokenClient = __esm({
if (request.sshJwk) {
addSshJwk(parameters, request.sshJwk);
} else {
- throw createClientConfigurationError(missingSshJwk, request.correlationId);
+ throw createClientConfigurationError(missingSshJwk);
}
}
if (this.config.systemOptions.preventCorsPreflight && request.ccsCredential) {
@@ -6539,7 +6472,7 @@ var init_RefreshTokenClient = __esm({
});
}
instrumentBrokerParams(parameters, request.correlationId, this.performanceClient);
- addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities, request.skipBrokerClaims);
+ addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities, request.skipBrokerClaims);
return mapToQueryString(parameters);
}
};
@@ -6583,24 +6516,24 @@ var init_SilentFlowClient = __esm({
let lastCacheOutcome = CacheOutcome.NOT_APPLICABLE;
if (request.forceRefresh || !StringUtils.isEmptyObj(request.claims)) {
this.setCacheOutcome(CacheOutcome.FORCE_REFRESH_OR_CLAIMS, request.correlationId);
- throw createClientAuthError(tokenRefreshRequired, request.correlationId);
+ throw createClientAuthError(tokenRefreshRequired);
}
if (!request.account) {
- throw createClientAuthError(noAccountInSilentRequest, request.correlationId);
+ throw createClientAuthError(noAccountInSilentRequest);
}
- const requestTenantId = request.account.tenantId || getTenantFromAuthorityString(request.authority, request.correlationId);
+ const requestTenantId = request.account.tenantId || getTenantFromAuthorityString(request.authority);
const tokenKeys = this.cacheManager.getTokenKeys();
const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId);
if (!cachedAccessToken) {
this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
- throw createClientAuthError(tokenRefreshRequired, request.correlationId);
+ throw createClientAuthError(tokenRefreshRequired);
} else if (wasClockTurnedBack(cachedAccessToken.cachedAt) || isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
this.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED, request.correlationId);
- throw createClientAuthError(tokenRefreshRequired, request.correlationId);
+ throw createClientAuthError(tokenRefreshRequired);
} else if (request.resource) {
if (cachedAccessToken.resource !== request.resource) {
this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
- throw createClientAuthError(tokenRefreshRequired, request.correlationId);
+ throw createClientAuthError(tokenRefreshRequired);
}
} else if (cachedAccessToken.refreshOn && isTokenExpired(cachedAccessToken.refreshOn, 0)) {
lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
@@ -6638,7 +6571,14 @@ var init_SilentFlowClient = __esm({
async generateResultFromCacheRecord(cacheRecord, request) {
let idTokenClaims;
if (cacheRecord.idToken) {
- idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
+ idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode);
+ }
+ if (request.maxAge || request.maxAge === 0) {
+ const authTime = idTokenClaims?.auth_time;
+ if (!authTime) {
+ throw createClientAuthError(authTimeNotFound);
+ }
+ checkMaxAge(authTime, request.maxAge);
}
return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, idTokenClaims);
}
@@ -6662,7 +6602,7 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger2, pe
...request.scopes || [],
...request.extraScopesToConsent || []
];
- addScopes(parameters, requestScopes, request.correlationId, true, authOptions.authority.options.OIDCOptions?.defaultScopes);
+ addScopes(parameters, requestScopes, true, authOptions.authority.options.OIDCOptions?.defaultScopes);
addResource(parameters, request.resource);
addRedirectUri(parameters, request.redirectUri);
addCorrelationId(parameters, correlationId);
@@ -6743,7 +6683,7 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger2, pe
if (request.embeddedClientId) {
addBrokerParameters(parameters, authOptions.clientId, authOptions.redirectUri);
}
- addClaims(parameters, request.correlationId, request.claims, authOptions.clientCapabilities, request.skipBrokerClaims);
+ addClaims(parameters, request.claims, authOptions.clientCapabilities, request.skipBrokerClaims);
if (authOptions.instanceAware && (!request.extraQueryParameters || !Object.keys(request.extraQueryParameters).includes(INSTANCE_AWARE))) {
addInstanceAware(parameters);
}
@@ -6753,38 +6693,38 @@ function getAuthorizeUrl(authority, requestParameters) {
const queryString = mapToQueryString(requestParameters);
return UrlString.appendQueryString(authority.authorizationEndpoint, queryString);
}
-function getAuthorizationCodePayload(serverParams, cachedState, correlationId) {
- validateAuthorizationResponse(serverParams, cachedState, correlationId);
+function getAuthorizationCodePayload(serverParams, cachedState) {
+ validateAuthorizationResponse(serverParams, cachedState);
if (!serverParams.code) {
- throw createClientAuthError(authorizationCodeMissingFromServerResponse, correlationId);
+ throw createClientAuthError(authorizationCodeMissingFromServerResponse);
}
return serverParams;
}
-function validateAuthorizationResponse(serverResponse, requestState, correlationId) {
+function validateAuthorizationResponse(serverResponse, requestState) {
if (!serverResponse.state || !requestState) {
- throw serverResponse.state ? createClientAuthError(stateNotFound, correlationId, "Cached State") : createClientAuthError(stateNotFound, correlationId, "Server State");
+ throw serverResponse.state ? createClientAuthError(stateNotFound, "Cached State") : createClientAuthError(stateNotFound, "Server State");
}
let decodedServerResponseState;
let decodedRequestState;
try {
decodedServerResponseState = decodeURIComponent(serverResponse.state);
} catch (e) {
- throw createClientAuthError(invalidState, correlationId, serverResponse.state);
+ throw createClientAuthError(invalidState, serverResponse.state);
}
try {
decodedRequestState = decodeURIComponent(requestState);
} catch (e) {
- throw createClientAuthError(invalidState, correlationId, serverResponse.state);
+ throw createClientAuthError(invalidState, serverResponse.state);
}
if (decodedServerResponseState !== decodedRequestState) {
- throw createClientAuthError(stateMismatch, correlationId);
+ throw createClientAuthError(stateMismatch);
}
if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {
const serverErrorNo = parseServerErrorNo(serverResponse);
if (isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
- throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.correlation_id || correlationId, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.claims || "", serverErrorNo);
+ throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.correlation_id || "", serverResponse.claims || "", serverErrorNo);
}
- throw new ServerError(serverResponse.error || "", serverResponse.correlation_id || correlationId, serverResponse.error_description, serverResponse.suberror, serverErrorNo);
+ throw new ServerError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverErrorNo);
}
}
function parseServerErrorNo(serverResponse) {
@@ -6820,10 +6760,10 @@ function enforceResourceParameter(isMcp, request) {
return;
}
if (request.resource && (containsResourceParam(request.extraParameters) || containsResourceParam(request.extraQueryParameters))) {
- throw createClientAuthError(misplacedResourceParam, request.correlationId || "");
+ throw createClientAuthError(misplacedResourceParam);
}
if (!request.resource) {
- throw createClientAuthError(resourceParameterRequired, request.correlationId || "");
+ throw createClientAuthError(resourceParameterRequired);
}
}
function containsResourceParam(params) {
@@ -6954,32 +6894,29 @@ var init_ServerTelemetryManager = __esm({
* @param error
*/
cacheFailedRequest(error2) {
- try {
- const lastRequests = this.getLastRequests();
- if (lastRequests.errors.length >= SERVER_TELEM_MAX_CACHED_ERRORS) {
- lastRequests.failedRequests.shift();
- lastRequests.failedRequests.shift();
- lastRequests.errors.shift();
- }
- lastRequests.failedRequests.push(this.apiId, this.correlationId);
- if (error2 instanceof Error && !!error2 && error2.toString()) {
- if (error2 instanceof AuthError) {
- if (error2.subError) {
- lastRequests.errors.push(error2.subError);
- } else if (error2.errorCode) {
- lastRequests.errors.push(error2.errorCode);
- } else {
- lastRequests.errors.push(error2.toString());
- }
+ const lastRequests = this.getLastRequests();
+ if (lastRequests.errors.length >= SERVER_TELEM_MAX_CACHED_ERRORS) {
+ lastRequests.failedRequests.shift();
+ lastRequests.failedRequests.shift();
+ lastRequests.errors.shift();
+ }
+ lastRequests.failedRequests.push(this.apiId, this.correlationId);
+ if (error2 instanceof Error && !!error2 && error2.toString()) {
+ if (error2 instanceof AuthError) {
+ if (error2.subError) {
+ lastRequests.errors.push(error2.subError);
+ } else if (error2.errorCode) {
+ lastRequests.errors.push(error2.errorCode);
} else {
lastRequests.errors.push(error2.toString());
}
} else {
- lastRequests.errors.push(SERVER_TELEM_UNKNOWN_ERROR);
+ lastRequests.errors.push(error2.toString());
}
- this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
- } catch {
+ } else {
+ lastRequests.errors.push(SERVER_TELEM_UNKNOWN_ERROR);
}
+ this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
return;
}
/**
@@ -7033,8 +6970,8 @@ var init_ServerTelemetryManager = __esm({
for (i = 0; i < errorCount; i++) {
const apiId = serverTelemetryEntity.failedRequests[2 * i] || "";
const correlationId = serverTelemetryEntity.failedRequests[2 * i + 1] || "";
- const errorCode = serverTelemetryEntity.errors[i] || "";
- dataSize += apiId.toString().length + correlationId.toString().length + errorCode.length + 3;
+ const errorCode2 = serverTelemetryEntity.errors[i] || "";
+ dataSize += apiId.toString().length + correlationId.toString().length + errorCode2.length + 3;
if (dataSize < SERVER_TELEM_MAX_LAST_HEADER_BYTES) {
maxErrors += 1;
} else {
@@ -7072,9 +7009,9 @@ var init_ServerTelemetryManager = __esm({
setCacheOutcome(cacheOutcome) {
this.cacheOutcome = cacheOutcome;
}
- setNativeBrokerErrorCode(errorCode) {
+ setNativeBrokerErrorCode(errorCode2) {
const lastRequests = this.getLastRequests();
- lastRequests.nativeBrokerErrorCode = errorCode;
+ lastRequests.nativeBrokerErrorCode = errorCode2;
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests, this.correlationId);
}
getNativeBrokerErrorCode() {
@@ -7229,7 +7166,6 @@ var init_Deserializer = __esm({
tokenType: serializedAT.token_type,
userAssertionHash: serializedAT.userAssertionHash,
resource: serializedAT.resource,
- additionalCacheKeyComponents: serializedAT.additionalCacheKeyComponents,
lastUpdatedAt: Date.now().toString()
};
atObjects[key] = accessToken;
@@ -7381,7 +7317,6 @@ var init_Constants2 = __esm({
acquireTokenByClientCredential: 771,
acquireTokenByOBO: 772,
acquireTokenWithManagedIdentity: 773,
- acquireTokenByUserFederatedIdentityCredential: 774,
acquireTokenByCode: 871,
acquireTokenByRefreshToken: 872
};
@@ -7513,9 +7448,9 @@ var init_HttpClient = __esm({
clearTimeout(timeoutId);
}
if (error2 instanceof Error && error2.name === "AbortError") {
- throw createAuthError(ClientAuthErrorCodes_exports.networkError, "", "Request timeout");
+ throw createAuthError(ClientAuthErrorCodes_exports.networkError, "Request timeout");
}
- const baseAuthError = createAuthError(ClientAuthErrorCodes_exports.networkError, "", `Network request failed: ${error2 instanceof Error ? error2.message : "unknown"}`);
+ const baseAuthError = createAuthError(ClientAuthErrorCodes_exports.networkError, `Network request failed: ${error2 instanceof Error ? error2.message : "unknown"}`);
throw createNetworkError(baseAuthError, void 0, void 0, error2 instanceof Error ? error2 : void 0);
}
if (timeoutId) {
@@ -7528,7 +7463,7 @@ var init_HttpClient = __esm({
status: response.status
};
} catch (error2) {
- throw createAuthError(ClientAuthErrorCodes_exports.tokenParsingError, "", `Failed to parse response: ${error2 instanceof Error ? error2.message : "unknown"}`);
+ throw createAuthError(ClientAuthErrorCodes_exports.tokenParsingError, `Failed to parse response: ${error2 instanceof Error ? error2.message : "unknown"}`);
}
}
};
@@ -7565,8 +7500,8 @@ var init_ManagedIdentityErrorCodes = __esm({
});
// node_modules/@azure/msal-node/dist/error/ManagedIdentityError.mjs
-function createManagedIdentityError(errorCode, correlationId) {
- return new ManagedIdentityError(errorCode, correlationId);
+function createManagedIdentityError(errorCode2) {
+ return new ManagedIdentityError(errorCode2);
}
var ManagedIdentityErrorMessages, ManagedIdentityError;
var init_ManagedIdentityError = __esm({
@@ -7596,8 +7531,8 @@ var init_ManagedIdentityError = __esm({
[wwwAuthenticateHeaderUnsupportedFormat]: "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format."
};
ManagedIdentityError = class _ManagedIdentityError extends AuthError {
- constructor(errorCode, correlationId) {
- super(errorCode, correlationId, ManagedIdentityErrorMessages[errorCode]);
+ constructor(errorCode2) {
+ super(errorCode2, ManagedIdentityErrorMessages[errorCode2]);
this.name = "ManagedIdentityError";
Object.setPrototypeOf(this, _ManagedIdentityError.prototype);
}
@@ -7660,63 +7595,63 @@ var init_NodeAuthError = __esm({
}
};
NodeAuthError = class _NodeAuthError extends AuthError {
- constructor(errorCode, correlationId, errorMessage) {
- super(errorCode, correlationId, errorMessage);
+ constructor(errorCode2, errorMessage) {
+ super(errorCode2, errorMessage);
this.name = "NodeAuthError";
}
/**
* Creates an error thrown if loopback server address is of type string.
*/
static createInvalidLoopbackAddressTypeError() {
- return new _NodeAuthError(NodeAuthErrorMessage.invalidLoopbackAddressType.code, "", `${NodeAuthErrorMessage.invalidLoopbackAddressType.desc}`);
+ return new _NodeAuthError(NodeAuthErrorMessage.invalidLoopbackAddressType.code, `${NodeAuthErrorMessage.invalidLoopbackAddressType.desc}`);
}
/**
* Creates an error thrown if the loopback server is unable to get a url.
*/
static createUnableToLoadRedirectUrlError() {
- return new _NodeAuthError(NodeAuthErrorMessage.unableToLoadRedirectUri.code, "", `${NodeAuthErrorMessage.unableToLoadRedirectUri.desc}`);
+ return new _NodeAuthError(NodeAuthErrorMessage.unableToLoadRedirectUri.code, `${NodeAuthErrorMessage.unableToLoadRedirectUri.desc}`);
}
/**
* Creates an error thrown if the server response does not contain an auth code.
*/
- static createNoAuthCodeInResponseError(correlationId = "") {
- return new _NodeAuthError(NodeAuthErrorMessage.noAuthCodeInResponse.code, correlationId, `${NodeAuthErrorMessage.noAuthCodeInResponse.desc}`);
+ static createNoAuthCodeInResponseError() {
+ return new _NodeAuthError(NodeAuthErrorMessage.noAuthCodeInResponse.code, `${NodeAuthErrorMessage.noAuthCodeInResponse.desc}`);
}
/**
* Creates an error thrown if the loopback server has not been spun up yet.
*/
static createNoLoopbackServerExistsError() {
- return new _NodeAuthError(NodeAuthErrorMessage.noLoopbackServerExists.code, "", `${NodeAuthErrorMessage.noLoopbackServerExists.desc}`);
+ return new _NodeAuthError(NodeAuthErrorMessage.noLoopbackServerExists.code, `${NodeAuthErrorMessage.noLoopbackServerExists.desc}`);
}
/**
* Creates an error thrown if a loopback server already exists when attempting to create another one.
*/
static createLoopbackServerAlreadyExistsError() {
- return new _NodeAuthError(NodeAuthErrorMessage.loopbackServerAlreadyExists.code, "", `${NodeAuthErrorMessage.loopbackServerAlreadyExists.desc}`);
+ return new _NodeAuthError(NodeAuthErrorMessage.loopbackServerAlreadyExists.code, `${NodeAuthErrorMessage.loopbackServerAlreadyExists.desc}`);
}
/**
* Creates an error thrown if the loopback server times out registering the auth code listener.
*/
- static createLoopbackServerTimeoutError(correlationId = "") {
- return new _NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, correlationId, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
+ static createLoopbackServerTimeoutError() {
+ return new _NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
}
/**
* Creates an error thrown when the state is not present.
*/
- static createStateNotFoundError(correlationId = "") {
- return new _NodeAuthError(NodeAuthErrorMessage.stateNotFoundError.code, correlationId, NodeAuthErrorMessage.stateNotFoundError.desc);
+ static createStateNotFoundError() {
+ return new _NodeAuthError(NodeAuthErrorMessage.stateNotFoundError.code, NodeAuthErrorMessage.stateNotFoundError.desc);
}
/**
* Creates an error thrown when client certificate was provided, but neither the SHA-1 or SHA-256 thumbprints were provided
*/
static createThumbprintMissingError() {
- return new _NodeAuthError(NodeAuthErrorMessage.thumbprintMissing.code, "", NodeAuthErrorMessage.thumbprintMissing.desc);
+ return new _NodeAuthError(NodeAuthErrorMessage.thumbprintMissing.code, NodeAuthErrorMessage.thumbprintMissing.desc);
}
/**
* Creates an error thrown when redirectUri is provided in an unsupported scenario
*/
- static createRedirectUriNotSupportedError(correlationId = "") {
- return new _NodeAuthError(NodeAuthErrorMessage.redirectUriNotSupported.code, correlationId, NodeAuthErrorMessage.redirectUriNotSupported.desc);
+ static createRedirectUriNotSupportedError() {
+ return new _NodeAuthError(NodeAuthErrorMessage.redirectUriNotSupported.code, NodeAuthErrorMessage.redirectUriNotSupported.desc);
}
};
}
@@ -8026,12 +7961,6 @@ var init_CryptoProvider = __esm({
});
// node_modules/@azure/msal-node/dist/cache/CacheHelpers.mjs
-import { createHash as createHash2 } from "crypto";
-function computeAdditionalCacheKeyHash(components) {
- const sortedKeys = Object.keys(components).sort();
- const input = sortedKeys.map((k) => k + components[k]).join("");
- return createHash2("sha256").update(input, "utf8").digest("base64url");
-}
function generateCredentialKey(credential) {
const familyId = credential.credentialType === Constants_exports.CredentialType.REFRESH_TOKEN && credential.familyId || credential.clientId;
const scheme = credential.tokenType && credential.tokenType.toLowerCase() !== Constants_exports.AuthenticationScheme.BEARER.toLowerCase() ? credential.tokenType.toLowerCase() : "";
@@ -8044,9 +7973,6 @@ function generateCredentialKey(credential) {
credential.target || "",
scheme
];
- if (credential.additionalCacheKeyComponents && Object.keys(credential.additionalCacheKeyComponents).length > 0) {
- credentialKey.push(computeAdditionalCacheKeyHash(credential.additionalCacheKeyComponents));
- }
return credentialKey.join(CACHE.KEY_SEPARATOR).toLowerCase();
}
function generateAccountKey(account) {
@@ -8739,6 +8665,7 @@ var init_TokenCache = __esm({
// node_modules/safe-buffer/index.js
var require_safe_buffer = __commonJS({
"node_modules/safe-buffer/index.js"(exports, module) {
+ "use strict";
var buffer = __require("buffer");
var Buffer2 = buffer.Buffer;
function copyProps(src, dst) {
@@ -8797,6 +8724,7 @@ var require_safe_buffer = __commonJS({
// node_modules/jws/lib/data-stream.js
var require_data_stream = __commonJS({
"node_modules/jws/lib/data-stream.js"(exports, module) {
+ "use strict";
var Buffer2 = require_safe_buffer().Buffer;
var Stream = __require("stream");
var util2 = __require("util");
@@ -9043,6 +8971,7 @@ var require_buffer_equal_constant_time = __commonJS({
// node_modules/jwa/index.js
var require_jwa = __commonJS({
"node_modules/jwa/index.js"(exports, module) {
+ "use strict";
var Buffer2 = require_safe_buffer().Buffer;
var crypto3 = __require("crypto");
var formatEcdsa = require_ecdsa_sig_formatter();
@@ -9267,6 +9196,7 @@ var require_jwa = __commonJS({
// node_modules/jws/lib/tostring.js
var require_tostring = __commonJS({
"node_modules/jws/lib/tostring.js"(exports, module) {
+ "use strict";
var Buffer2 = __require("buffer").Buffer;
module.exports = function toString(obj) {
if (typeof obj === "string")
@@ -9281,6 +9211,7 @@ var require_tostring = __commonJS({
// node_modules/jws/lib/sign-stream.js
var require_sign_stream = __commonJS({
"node_modules/jws/lib/sign-stream.js"(exports, module) {
+ "use strict";
var Buffer2 = require_safe_buffer().Buffer;
var DataStream = require_data_stream();
var jwa = require_jwa();
@@ -9356,6 +9287,7 @@ var require_sign_stream = __commonJS({
// node_modules/jws/lib/verify-stream.js
var require_verify_stream = __commonJS({
"node_modules/jws/lib/verify-stream.js"(exports, module) {
+ "use strict";
var Buffer2 = require_safe_buffer().Buffer;
var DataStream = require_data_stream();
var jwa = require_jwa();
@@ -9471,6 +9403,7 @@ var require_verify_stream = __commonJS({
// node_modules/jws/index.js
var require_jws = __commonJS({
"node_modules/jws/index.js"(exports) {
+ "use strict";
var SignStream = require_sign_stream();
var VerifyStream = require_verify_stream();
var ALGORITHMS = [
@@ -9504,6 +9437,7 @@ var require_jws = __commonJS({
// node_modules/jsonwebtoken/decode.js
var require_decode = __commonJS({
"node_modules/jsonwebtoken/decode.js"(exports, module) {
+ "use strict";
var jws = require_jws();
module.exports = function(jwt2, options) {
options = options || {};
@@ -9536,6 +9470,7 @@ var require_decode = __commonJS({
// node_modules/jsonwebtoken/lib/JsonWebTokenError.js
var require_JsonWebTokenError = __commonJS({
"node_modules/jsonwebtoken/lib/JsonWebTokenError.js"(exports, module) {
+ "use strict";
var JsonWebTokenError = function(message, error2) {
Error.call(this, message);
if (Error.captureStackTrace) {
@@ -9554,6 +9489,7 @@ var require_JsonWebTokenError = __commonJS({
// node_modules/jsonwebtoken/lib/NotBeforeError.js
var require_NotBeforeError = __commonJS({
"node_modules/jsonwebtoken/lib/NotBeforeError.js"(exports, module) {
+ "use strict";
var JsonWebTokenError = require_JsonWebTokenError();
var NotBeforeError = function(message, date3) {
JsonWebTokenError.call(this, message);
@@ -9569,6 +9505,7 @@ var require_NotBeforeError = __commonJS({
// node_modules/jsonwebtoken/lib/TokenExpiredError.js
var require_TokenExpiredError = __commonJS({
"node_modules/jsonwebtoken/lib/TokenExpiredError.js"(exports, module) {
+ "use strict";
var JsonWebTokenError = require_JsonWebTokenError();
var TokenExpiredError = function(message, expiredAt) {
JsonWebTokenError.call(this, message);
@@ -9584,6 +9521,7 @@ var require_TokenExpiredError = __commonJS({
// node_modules/ms/index.js
var require_ms = __commonJS({
"node_modules/ms/index.js"(exports, module) {
+ "use strict";
var s = 1e3;
var m = s * 60;
var h = m * 60;
@@ -9700,6 +9638,7 @@ var require_ms = __commonJS({
// node_modules/jsonwebtoken/lib/timespan.js
var require_timespan = __commonJS({
"node_modules/jsonwebtoken/lib/timespan.js"(exports, module) {
+ "use strict";
var ms = require_ms();
module.exports = function(time3, iat) {
var timestamp = iat || Math.floor(Date.now() / 1e3);
@@ -9901,18 +9840,6 @@ var require_semver = __commonJS({
var { safeRe: re, t } = require_re();
var parseOptions = require_parse_options();
var { compareIdentifiers } = require_identifiers();
- var isPrereleaseIdentifier = (prerelease, identifier) => {
- const identifiers = identifier.split(".");
- if (identifiers.length > prerelease.length) {
- return false;
- }
- for (let i = 0; i < identifiers.length; i++) {
- if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {
- return false;
- }
- }
- return true;
- };
var SemVer = class _SemVer {
constructor(version4, options) {
options = parseOptions(options);
@@ -10159,9 +10086,8 @@ var require_semver = __commonJS({
if (identifierBase === false) {
prerelease = [identifier];
}
- if (isPrereleaseIdentifier(this.prerelease, identifier)) {
- const prereleaseBase = this.prerelease[identifier.split(".").length];
- if (isNaN(prereleaseBase)) {
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
+ if (isNaN(this.prerelease[1])) {
this.prerelease = prerelease;
}
} else {
@@ -10712,12 +10638,11 @@ var require_range = __commonJS({
return this.range;
}
parseRange(range) {
- range = range.replace(BUILDSTRIPRE, "");
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
const memoKey = memoOpts + ":" + range;
- const cached2 = cache.get(memoKey);
- if (cached2) {
- return cached2;
+ const cached3 = cache.get(memoKey);
+ if (cached3) {
+ return cached3;
}
const loose = this.options.loose;
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
@@ -10795,14 +10720,12 @@ var require_range = __commonJS({
var SemVer = require_semver();
var {
safeRe: re,
- src,
t,
comparatorTrimReplace,
tildeTrimReplace,
caretTrimReplace
} = require_re();
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
- var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
var isNullSet = (c) => c.value === "<0.0.0-0";
var isAny = (c) => c.value === "";
var isSatisfiable = (comparators, options) => {
@@ -10831,22 +10754,20 @@ var require_range = __commonJS({
return comp;
};
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
- var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
var replaceTildes = (comp, options) => {
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
};
var replaceTilde = (comp, options) => {
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
- const z = options.includePrerelease ? "-0" : "";
return comp.replace(r, (_, M, m, p, pr) => {
debug("tilde", comp, _, M, m, p, pr);
let ret;
if (isX(M)) {
ret = "";
} else if (isX(m)) {
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
} else if (isX(p)) {
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
} else if (pr) {
debug("replaceTilde pr", pr);
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
@@ -10892,9 +10813,9 @@ var require_range = __commonJS({
debug("no pr");
if (M === "0") {
if (m === "0") {
- ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
+ ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
} else {
- ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
+ ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
}
} else {
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
@@ -10913,9 +10834,6 @@ var require_range = __commonJS({
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
debug("xRange", comp, ret, gtlt, M, m, p, pr);
- if (invalidXRangeOrder(M, m, p)) {
- return comp;
- }
const xM = isX(M);
const xm = xM || isX(m);
const xp = xm || isX(p);
@@ -11563,7 +11481,7 @@ var require_subset = __commonJS({
if (higher === c && higher !== gt) {
return false;
}
- } else if (gt.operator === ">=" && !c.test(gt.semver)) {
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
return false;
}
}
@@ -11578,7 +11496,7 @@ var require_subset = __commonJS({
if (lower === c && lower !== lt) {
return false;
}
- } else if (lt.operator === "<=" && !c.test(lt.semver)) {
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
return false;
}
}
@@ -11715,6 +11633,7 @@ var require_semver2 = __commonJS({
// node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js
var require_asymmetricKeyDetailsSupported = __commonJS({
"node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js"(exports, module) {
+ "use strict";
var semver = require_semver2();
module.exports = semver.satisfies(process.version, ">=15.7.0");
}
@@ -11723,6 +11642,7 @@ var require_asymmetricKeyDetailsSupported = __commonJS({
// node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js
var require_rsaPssKeyDetailsSupported = __commonJS({
"node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js"(exports, module) {
+ "use strict";
var semver = require_semver2();
module.exports = semver.satisfies(process.version, ">=16.9.0");
}
@@ -11731,6 +11651,7 @@ var require_rsaPssKeyDetailsSupported = __commonJS({
// node_modules/jsonwebtoken/lib/validateAsymmetricKey.js
var require_validateAsymmetricKey = __commonJS({
"node_modules/jsonwebtoken/lib/validateAsymmetricKey.js"(exports, module) {
+ "use strict";
var ASYMMETRIC_KEY_DETAILS_SUPPORTED = require_asymmetricKeyDetailsSupported();
var RSA_PSS_KEY_DETAILS_SUPPORTED = require_rsaPssKeyDetailsSupported();
var allowedAlgorithmsForKeys = {
@@ -11784,6 +11705,7 @@ var require_validateAsymmetricKey = __commonJS({
// node_modules/jsonwebtoken/lib/psSupported.js
var require_psSupported = __commonJS({
"node_modules/jsonwebtoken/lib/psSupported.js"(exports, module) {
+ "use strict";
var semver = require_semver2();
module.exports = semver.satisfies(process.version, "^6.12.0 || >=8.0.0");
}
@@ -11792,6 +11714,7 @@ var require_psSupported = __commonJS({
// node_modules/jsonwebtoken/verify.js
var require_verify = __commonJS({
"node_modules/jsonwebtoken/verify.js"(exports, module) {
+ "use strict";
var JsonWebTokenError = require_JsonWebTokenError();
var NotBeforeError = require_NotBeforeError();
var TokenExpiredError = require_TokenExpiredError();
@@ -12007,6 +11930,7 @@ var require_verify = __commonJS({
// node_modules/lodash.includes/index.js
var require_lodash = __commonJS({
"node_modules/lodash.includes/index.js"(exports, module) {
+ "use strict";
var INFINITY = 1 / 0;
var MAX_SAFE_INTEGER = 9007199254740991;
var MAX_INTEGER = 17976931348623157e292;
@@ -12191,6 +12115,7 @@ var require_lodash = __commonJS({
// node_modules/lodash.isboolean/index.js
var require_lodash2 = __commonJS({
"node_modules/lodash.isboolean/index.js"(exports, module) {
+ "use strict";
var boolTag = "[object Boolean]";
var objectProto = Object.prototype;
var objectToString = objectProto.toString;
@@ -12207,6 +12132,7 @@ var require_lodash2 = __commonJS({
// node_modules/lodash.isinteger/index.js
var require_lodash3 = __commonJS({
"node_modules/lodash.isinteger/index.js"(exports, module) {
+ "use strict";
var INFINITY = 1 / 0;
var MAX_INTEGER = 17976931348623157e292;
var NAN = 0 / 0;
@@ -12271,6 +12197,7 @@ var require_lodash3 = __commonJS({
// node_modules/lodash.isnumber/index.js
var require_lodash4 = __commonJS({
"node_modules/lodash.isnumber/index.js"(exports, module) {
+ "use strict";
var numberTag = "[object Number]";
var objectProto = Object.prototype;
var objectToString = objectProto.toString;
@@ -12287,6 +12214,7 @@ var require_lodash4 = __commonJS({
// node_modules/lodash.isplainobject/index.js
var require_lodash5 = __commonJS({
"node_modules/lodash.isplainobject/index.js"(exports, module) {
+ "use strict";
var objectTag = "[object Object]";
function isHostObject(value) {
var result = false;
@@ -12313,7 +12241,7 @@ var require_lodash5 = __commonJS({
function isObjectLike(value) {
return !!value && typeof value == "object";
}
- function isPlainObject4(value) {
+ function isPlainObject3(value) {
if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
return false;
}
@@ -12324,13 +12252,14 @@ var require_lodash5 = __commonJS({
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
- module.exports = isPlainObject4;
+ module.exports = isPlainObject3;
}
});
// node_modules/lodash.isstring/index.js
var require_lodash6 = __commonJS({
"node_modules/lodash.isstring/index.js"(exports, module) {
+ "use strict";
var stringTag = "[object String]";
var objectProto = Object.prototype;
var objectToString = objectProto.toString;
@@ -12348,6 +12277,7 @@ var require_lodash6 = __commonJS({
// node_modules/lodash.once/index.js
var require_lodash7 = __commonJS({
"node_modules/lodash.once/index.js"(exports, module) {
+ "use strict";
var FUNC_ERROR_TEXT = "Expected a function";
var INFINITY = 1 / 0;
var MAX_INTEGER = 17976931348623157e292;
@@ -12429,6 +12359,7 @@ var require_lodash7 = __commonJS({
// node_modules/jsonwebtoken/sign.js
var require_sign = __commonJS({
"node_modules/jsonwebtoken/sign.js"(exports, module) {
+ "use strict";
var timespan = require_timespan();
var PS_SUPPORTED = require_psSupported();
var validateAsymmetricKey = require_validateAsymmetricKey();
@@ -12437,7 +12368,7 @@ var require_sign = __commonJS({
var isBoolean = require_lodash2();
var isInteger = require_lodash3();
var isNumber = require_lodash4();
- var isPlainObject4 = require_lodash5();
+ var isPlainObject3 = require_lodash5();
var isString = require_lodash6();
var once = require_lodash7();
var { KeyObject, createSecretKey, createPrivateKey } = __require("crypto");
@@ -12456,7 +12387,7 @@ var require_sign = __commonJS({
return isString(value) || Array.isArray(value);
}, message: '"audience" must be a string or array' },
algorithm: { isValid: includes.bind(null, SUPPORTED_ALGS), message: '"algorithm" must be a valid string enum value' },
- header: { isValid: isPlainObject4, message: '"header" must be an object' },
+ header: { isValid: isPlainObject3, message: '"header" must be an object' },
encoding: { isValid: isString, message: '"encoding" must be a string' },
issuer: { isValid: isString, message: '"issuer" must be a string' },
subject: { isValid: isString, message: '"subject" must be a string' },
@@ -12473,7 +12404,7 @@ var require_sign = __commonJS({
nbf: { isValid: isNumber, message: '"nbf" should be a number of seconds' }
};
function validate(schema, allowUnknown, object3, parameterName) {
- if (!isPlainObject4(object3)) {
+ if (!isPlainObject3(object3)) {
throw new Error('Expected "' + parameterName + '" to be a plain object.');
}
Object.keys(object3).forEach(function(key) {
@@ -12654,6 +12585,7 @@ var require_sign = __commonJS({
// node_modules/jsonwebtoken/index.js
var require_jsonwebtoken = __commonJS({
"node_modules/jsonwebtoken/index.js"(exports, module) {
+ "use strict";
module.exports = {
decode: require_decode(),
verify: require_verify(),
@@ -12747,7 +12679,7 @@ var init_ClientAssertion = __esm({
if (this.jwt) {
return this.jwt;
}
- throw createClientAuthError(invalidAssertion, "");
+ throw createClientAuthError(invalidAssertion);
}
/**
* JWT format and required claims specified: https://tools.ietf.org/html/rfc7523#section-3
@@ -12810,7 +12742,7 @@ var init_packageMetadata2 = __esm({
"node_modules/@azure/msal-node/dist/packageMetadata.mjs"() {
"use strict";
name2 = "@azure/msal-node";
- version3 = "5.3.1";
+ version3 = "5.2.1";
}
});
@@ -12930,7 +12862,7 @@ var init_UsernamePasswordClient = __esm({
RequestParameterBuilder_exports.addClientId(parameters, this.config.authOptions.clientId);
RequestParameterBuilder_exports.addUsername(parameters, request.username);
RequestParameterBuilder_exports.addPassword(parameters, request.password);
- RequestParameterBuilder_exports.addScopes(parameters, request.scopes, request.correlationId);
+ RequestParameterBuilder_exports.addScopes(parameters, request.scopes);
RequestParameterBuilder_exports.addResponseType(parameters, Constants_exports.OAuthResponseType.IDTOKEN_TOKEN);
RequestParameterBuilder_exports.addGrantType(parameters, Constants_exports.GrantType.RESOURCE_OWNER_PASSWORD_GRANT);
RequestParameterBuilder_exports.addClientInfo(parameters);
@@ -12951,7 +12883,7 @@ var init_UsernamePasswordClient = __esm({
RequestParameterBuilder_exports.addClientAssertionType(parameters, clientAssertion.assertionType);
}
if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
- RequestParameterBuilder_exports.addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
+ RequestParameterBuilder_exports.addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
}
if (this.config.systemOptions.preventCorsPreflight && request.username) {
RequestParameterBuilder_exports.addCcsUpn(parameters, request.username);
@@ -12963,9 +12895,9 @@ var init_UsernamePasswordClient = __esm({
});
// node_modules/@azure/msal-node/dist/protocol/Authorize.mjs
-function getAuthCodeRequestUrl(config2, authority, request, logger2) {
+function getAuthCodeRequestUrl(config3, authority, request, logger2) {
const parameters = Authorize_exports.getStandardAuthorizeRequestParameters({
- ...config2.auth,
+ ...config3.auth,
authority,
redirectUri: request.redirectUri || ""
}, request, logger2);
@@ -12975,8 +12907,8 @@ function getAuthCodeRequestUrl(config2, authority, request, logger2) {
cpu: process.arch || "",
os: process.platform || ""
});
- if (config2.system.protocolMode !== ProtocolMode.OIDC) {
- RequestParameterBuilder_exports.addApplicationTelemetry(parameters, config2.telemetry.application);
+ if (config3.system.protocolMode !== ProtocolMode.OIDC) {
+ RequestParameterBuilder_exports.addApplicationTelemetry(parameters, config3.telemetry.application);
}
RequestParameterBuilder_exports.addResponseType(parameters, Constants_exports.OAuthResponseType.CODE);
if (request.codeChallenge && request.codeChallengeMethod) {
@@ -13055,7 +12987,7 @@ var init_ClientApplication = __esm({
this.logger.info("acquireTokenByCode called", request.correlationId || "");
if (request.state && authCodePayLoad) {
this.logger.info("acquireTokenByCode - validating state", request.correlationId || "");
- this.validateState(request.state, authCodePayLoad.state || "", request.correlationId || "");
+ this.validateState(request.state, authCodePayLoad.state || "");
authCodePayLoad = { ...authCodePayLoad, state: "" };
}
const validRequest = {
@@ -13072,7 +13004,7 @@ var init_ClientApplication = __esm({
return await authorizationCodeClient.acquireToken(validRequest, ApiId.acquireTokenByCode, authCodePayLoad);
} catch (e) {
if (e instanceof AuthError) {
- e.correlationId = validRequest.correlationId;
+ e.setCorrelationId(validRequest.correlationId);
}
serverTelemetryManager.cacheFailedRequest(e);
throw e;
@@ -13101,7 +13033,7 @@ var init_ClientApplication = __esm({
return await refreshTokenClient.acquireToken(validRequest, ApiId.acquireTokenByRefreshToken);
} catch (e) {
if (e instanceof AuthError) {
- e.correlationId = validRequest.correlationId;
+ e.setCorrelationId(validRequest.correlationId);
}
serverTelemetryManager.cacheFailedRequest(e);
throw e;
@@ -13139,7 +13071,7 @@ var init_ClientApplication = __esm({
}
} catch (error2) {
if (error2 instanceof AuthError) {
- error2.correlationId = validRequest.correlationId;
+ error2.setCorrelationId(validRequest.correlationId);
}
serverTelemetryManager.cacheFailedRequest(error2);
throw error2;
@@ -13186,7 +13118,7 @@ var init_ClientApplication = __esm({
return await usernamePasswordClient.acquireToken(validRequest);
} catch (e) {
if (e instanceof AuthError) {
- e.correlationId = validRequest.correlationId;
+ e.setCorrelationId(validRequest.correlationId);
}
serverTelemetryManager.cacheFailedRequest(e);
throw e;
@@ -13208,12 +13140,12 @@ var init_ClientApplication = __esm({
* @param state - Unique GUID generated by the user that is cached by the user and sent to the server during the first leg of the flow
* @param cachedState - This string is sent back by the server with the authorization code
*/
- validateState(state, cachedState, correlationId) {
+ validateState(state, cachedState) {
if (!state) {
- throw NodeAuthError.createStateNotFoundError(correlationId);
+ throw NodeAuthError.createStateNotFoundError();
}
if (state !== cachedState) {
- throw createClientAuthError(ClientAuthErrorCodes_exports.stateMismatch, correlationId);
+ throw createClientAuthError(ClientAuthErrorCodes_exports.stateMismatch);
}
}
/**
@@ -13513,36 +13445,35 @@ var init_DeviceCodeClient = __esm({
*/
createQueryString(request) {
const parameters = /* @__PURE__ */ new Map();
- RequestParameterBuilder_exports.addScopes(parameters, request.scopes, request.correlationId);
+ RequestParameterBuilder_exports.addScopes(parameters, request.scopes);
RequestParameterBuilder_exports.addClientId(parameters, this.config.authOptions.clientId);
if (request.extraQueryParameters) {
RequestParameterBuilder_exports.addExtraParameters(parameters, request.extraQueryParameters);
}
if (request.claims || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
- RequestParameterBuilder_exports.addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
+ RequestParameterBuilder_exports.addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
}
return UrlUtils_exports.mapToQueryString(parameters);
}
/**
* Breaks the polling with specific conditions
* @param deviceCodeExpirationTime - expiration time for the device code request
- * @param correlationId - correlation id of the request
* @param userSpecifiedTimeout - developer provided timeout, to be compared against deviceCodeExpirationTime
* @param userSpecifiedCancelFlag - boolean indicating the developer would like to cancel the request
*/
- continuePolling(deviceCodeExpirationTime, correlationId, userSpecifiedTimeout, userSpecifiedCancelFlag) {
+ continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, userSpecifiedCancelFlag) {
if (userSpecifiedCancelFlag) {
- this.logger.error("Token request cancelled by setting DeviceCodeRequest.cancel = true", correlationId);
- throw createClientAuthError(deviceCodePollingCancelled, correlationId);
+ this.logger.error("Token request cancelled by setting DeviceCodeRequest.cancel = true", "");
+ throw createClientAuthError(deviceCodePollingCancelled);
} else if (userSpecifiedTimeout && userSpecifiedTimeout < deviceCodeExpirationTime && TimeUtils_exports.nowSeconds() > userSpecifiedTimeout) {
- this.logger.error(`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`, correlationId);
- throw createClientAuthError(userTimeoutReached, correlationId);
+ this.logger.error(`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`, "");
+ throw createClientAuthError(userTimeoutReached);
} else if (TimeUtils_exports.nowSeconds() > deviceCodeExpirationTime) {
if (userSpecifiedTimeout) {
- this.logger.verbose(`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`, correlationId);
+ this.logger.verbose(`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`, "");
}
- this.logger.error(`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`, correlationId);
- throw createClientAuthError(deviceCodeExpired, correlationId);
+ this.logger.error(`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`, "");
+ throw createClientAuthError(deviceCodeExpired);
}
return true;
}
@@ -13559,7 +13490,7 @@ var init_DeviceCodeClient = __esm({
const userSpecifiedTimeout = request.timeout ? TimeUtils_exports.nowSeconds() + request.timeout : void 0;
const deviceCodeExpirationTime = TimeUtils_exports.nowSeconds() + deviceCodeResponse.expiresIn;
const pollingIntervalMilli = deviceCodeResponse.interval * 1e3;
- while (this.continuePolling(deviceCodeExpirationTime, request.correlationId, userSpecifiedTimeout, request.cancel)) {
+ while (this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) {
const thumbprint = {
clientId: this.config.authOptions.clientId,
authority: request.authority,
@@ -13578,7 +13509,7 @@ var init_DeviceCodeClient = __esm({
await TimeUtils_exports.delay(pollingIntervalMilli);
} else {
this.logger.info("Unexpected error in polling from the server", request.correlationId);
- throw createAuthError(AuthErrorCodes_exports.postRequestFailed, request.correlationId, response.body.error);
+ throw createAuthError(AuthErrorCodes_exports.postRequestFailed, response.body.error);
}
} else {
this.logger.verbose("Authorization completed successfully. Polling stopped.", request.correlationId);
@@ -13586,7 +13517,7 @@ var init_DeviceCodeClient = __esm({
}
}
this.logger.error("Polling stopped for unknown reasons.", request.correlationId);
- throw createClientAuthError(deviceCodeUnknownError, request.correlationId);
+ throw createClientAuthError(deviceCodeUnknownError);
}
/**
* Creates query parameters and converts to string.
@@ -13595,7 +13526,7 @@ var init_DeviceCodeClient = __esm({
*/
createTokenRequestBody(request, deviceCodeResponse) {
const parameters = /* @__PURE__ */ new Map();
- RequestParameterBuilder_exports.addScopes(parameters, request.scopes, request.correlationId);
+ RequestParameterBuilder_exports.addScopes(parameters, request.scopes);
RequestParameterBuilder_exports.addClientId(parameters, this.config.authOptions.clientId);
RequestParameterBuilder_exports.addGrantType(parameters, Constants_exports.GrantType.DEVICE_CODE_GRANT);
RequestParameterBuilder_exports.addDeviceCode(parameters, deviceCodeResponse.deviceCode);
@@ -13609,7 +13540,7 @@ var init_DeviceCodeClient = __esm({
RequestParameterBuilder_exports.addServerTelemetry(parameters, this.serverTelemetryManager);
}
if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
- RequestParameterBuilder_exports.addClaims(parameters, request.correlationId, request.claims, this.config.authOptions.clientCapabilities);
+ RequestParameterBuilder_exports.addClaims(parameters, request.claims, this.config.authOptions.clientCapabilities);
}
return UrlUtils_exports.mapToQueryString(parameters);
}
@@ -13684,7 +13615,7 @@ var init_PublicClientApplication = __esm({
return await deviceCodeClient.acquireToken(validRequest);
} catch (e) {
if (e instanceof AuthError) {
- e.correlationId = validRequest.correlationId;
+ e.setCorrelationId(validRequest.correlationId);
}
serverTelemetryManager.cacheFailedRequest(e);
throw e;
@@ -13717,7 +13648,7 @@ var init_PublicClientApplication = __esm({
}
if (request.redirectUri) {
if (!this.config.broker.nativeBrokerPlugin) {
- throw NodeAuthError.createRedirectUriNotSupportedError(correlationId);
+ throw NodeAuthError.createRedirectUriNotSupportedError();
}
request.redirectUri = "";
}
@@ -13731,7 +13662,7 @@ var init_PublicClientApplication = __esm({
}).catch((e) => {
authCodeListenerError = e;
});
- const redirectUri = await this.waitForRedirectUri(loopbackClient, correlationId);
+ const redirectUri = await this.waitForRedirectUri(loopbackClient);
const validRequest = {
...remainingProperties,
correlationId,
@@ -13748,9 +13679,9 @@ var init_PublicClientApplication = __esm({
throw authCodeListenerError;
}
if (authCodeResponse.error) {
- throw new ServerError(authCodeResponse.error, correlationId, authCodeResponse.error_description, authCodeResponse.suberror);
+ throw new ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
} else if (!authCodeResponse.code) {
- throw NodeAuthError.createNoAuthCodeInResponseError(correlationId);
+ throw NodeAuthError.createNoAuthCodeInResponseError();
}
const clientInfo = authCodeResponse.client_info;
const tokenRequest = {
@@ -13793,7 +13724,7 @@ var init_PublicClientApplication = __esm({
}
if (request.redirectUri) {
if (!this.config.broker.nativeBrokerPlugin) {
- throw NodeAuthError.createRedirectUriNotSupportedError(correlationId);
+ throw NodeAuthError.createRedirectUriNotSupportedError();
}
request.redirectUri = "";
}
@@ -13845,16 +13776,15 @@ var init_PublicClientApplication = __esm({
/**
* Attempts to retrieve the redirectUri from the loopback server. If the loopback server does not start listening for requests within the timeout this will throw.
* @param loopbackClient - developer provided custom loopback server implementation
- * @param correlationId - correlation id of the request
* @returns
*/
- async waitForRedirectUri(loopbackClient, correlationId) {
+ async waitForRedirectUri(loopbackClient) {
return new Promise((resolve2, reject) => {
let ticks = 0;
const id = setInterval(() => {
if (LOOPBACK_SERVER_CONSTANTS.TIMEOUT_MS / LOOPBACK_SERVER_CONSTANTS.INTERVAL_MS < ticks) {
clearInterval(id);
- reject(NodeAuthError.createLoopbackServerTimeoutError(correlationId));
+ reject(NodeAuthError.createLoopbackServerTimeoutError());
return;
}
try {
@@ -13897,15 +13827,6 @@ var init_OnBehalfOfClient = __esm({
}
});
-// node_modules/@azure/msal-node/dist/client/UserFederatedIdentityCredentialClient.mjs
-var init_UserFederatedIdentityCredentialClient = __esm({
- "node_modules/@azure/msal-node/dist/client/UserFederatedIdentityCredentialClient.mjs"() {
- "use strict";
- init_Constants2();
- init_BaseClient();
- }
-});
-
// node_modules/@azure/msal-node/dist/client/ConfidentialClientApplication.mjs
var init_ConfidentialClientApplication = __esm({
"node_modules/@azure/msal-node/dist/client/ConfidentialClientApplication.mjs"() {
@@ -13915,7 +13836,6 @@ var init_ConfidentialClientApplication = __esm({
init_Constants2();
init_ClientCredentialClient();
init_OnBehalfOfClient();
- init_UserFederatedIdentityCredentialClient();
init_ClientAuthErrorCodes2();
}
});
@@ -14117,7 +14037,7 @@ var init_BaseManagedIdentitySource = __esm({
if (error2 instanceof AuthError) {
throw error2;
} else {
- throw createClientAuthError(ClientAuthErrorCodes_exports.networkError, managedIdentityRequest.correlationId);
+ throw createClientAuthError(ClientAuthErrorCodes_exports.networkError);
}
}
const responseHandler = new ResponseHandler(managedIdentityId.id, this.nodeStorage, this.cryptoProvider, this.logger, new StubPerformanceClient(), null, null);
@@ -14150,16 +14070,16 @@ var init_BaseManagedIdentitySource = __esm({
this.logger.info("[Managed Identity] Adding user assigned object id to the request.", "");
return ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_OBJECT_ID;
default:
- throw createManagedIdentityError(invalidManagedIdentityIdType, "");
+ throw createManagedIdentityError(invalidManagedIdentityIdType);
}
}
};
BaseManagedIdentitySource.getValidatedEnvVariableUrlString = (envVariableStringName, envVariable, sourceName, logger2) => {
try {
- return new UrlString(envVariable, "").urlString;
+ return new UrlString(envVariable).urlString;
} catch (error2) {
logger2.info(`[Managed Identity] ${sourceName} managed identity is unavailable because the '${envVariableStringName}' environment variable is malformed.`, "");
- throw createManagedIdentityError(MsiEnvironmentVariableUrlMalformedErrorCodes[envVariableStringName], "");
+ throw createManagedIdentityError(MsiEnvironmentVariableUrlMalformedErrorCodes[envVariableStringName]);
}
};
}
@@ -14443,21 +14363,30 @@ var init_msal_auth = __esm({
MsalTokenProvider = class {
pca;
account = null;
- constructor(clientId = DEFAULT_CLIENT_ID, tenantId) {
- const tenant = tenantId || process.env.PA_TENANT_ID || "common";
- const config2 = {
+ constructor(clientIdOrOpts, tenantId2) {
+ let clientId;
+ let tenant;
+ let authorityHost;
+ if (typeof clientIdOrOpts === "object" && clientIdOrOpts !== null) {
+ clientId = clientIdOrOpts.clientId ?? process.env.PA_CLIENT_ID ?? DEFAULT_CLIENT_ID;
+ tenant = clientIdOrOpts.tenantId ?? process.env.PA_TENANT_ID ?? "common";
+ authorityHost = clientIdOrOpts.authorityHost ?? "https://login.microsoftonline.com";
+ } else {
+ clientId = clientIdOrOpts ?? process.env.PA_CLIENT_ID ?? DEFAULT_CLIENT_ID;
+ tenant = tenantId2 ?? process.env.PA_TENANT_ID ?? "common";
+ authorityHost = "https://login.microsoftonline.com";
+ }
+ const config3 = {
auth: {
clientId,
- authority: `https://login.microsoftonline.com/${tenant}`
+ authority: `${authorityHost}/${tenant}`
},
- // L2 disk cache for MSAL refresh tokens — eliminates the 30–90 s/call
- // overhead of fresh CLI subprocesses re-running browser auth. See
- // msal-disk-cache.ts for the security model and opt-out env vars.
+ // L2 disk cache for MSAL refresh tokens
cache: {
cachePlugin: createMsalDiskCachePlugin({ identity: tenant })
}
};
- this.pca = new PublicClientApplication(config2);
+ this.pca = new PublicClientApplication(config3);
}
async getAccessToken(resource) {
const scopes = resource ? [`${resource}/.default`] : ["https://api.powerplatform.com/.default"];
@@ -17857,8 +17786,8 @@ var require_utils = __commonJS({
}
return ind;
}
- function removeDotSegments(path3) {
- let input = path3;
+ function removeDotSegments(path5) {
+ let input = path5;
const output = [];
let nextSlash = -1;
let len = 0;
@@ -18110,8 +18039,8 @@ var require_schemes = __commonJS({
wsComponent.secure = void 0;
}
if (wsComponent.resourceName) {
- const [path3, query] = wsComponent.resourceName.split("?");
- wsComponent.path = path3 && path3 !== "/" ? path3 : void 0;
+ const [path5, query] = wsComponent.resourceName.split("?");
+ wsComponent.path = path5 && path5 !== "/" ? path5 : void 0;
wsComponent.query = query;
wsComponent.resourceName = void 0;
}
@@ -18469,7 +18398,7 @@ var require_fast_uri = __commonJS({
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
try {
- parsed.host = new URL("http://" + parsed.host).hostname;
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
} catch (e) {
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
}
@@ -21504,12 +21433,12 @@ var require_dist = __commonJS({
throw new Error(`Unknown format "${name3}"`);
return f;
};
- function addFormats(ajv, list, fs3, exportName) {
+ function addFormats(ajv, list, fs4, exportName) {
var _a;
var _b;
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
for (const f of list)
- ajv.addFormat(f, fs3[f]);
+ ajv.addFormat(f, fs4[f]);
}
module.exports = exports = formatsPlugin;
Object.defineProperty(exports, "__esModule", { value: true });
@@ -21716,10 +21645,10 @@ function assignProp(target, prop, value) {
configurable: true
});
}
-function getElementAtPath(obj, path3) {
- if (!path3)
+function getElementAtPath(obj, path5) {
+ if (!path5)
return obj;
- return path3.reduce((acc, key) => acc?.[key], obj);
+ return path5.reduce((acc, key) => acc?.[key], obj);
}
function promiseAllObject(promisesObj) {
const keys = Object.keys(promisesObj);
@@ -22039,21 +21968,21 @@ function aborted(x, startIndex = 0) {
}
return false;
}
-function prefixIssues(path3, issues) {
+function prefixIssues(path5, issues) {
return issues.map((iss) => {
var _a;
(_a = iss).path ?? (_a.path = []);
- iss.path.unshift(path3);
+ iss.path.unshift(path5);
return iss;
});
}
function unwrapMessage(message) {
return typeof message === "string" ? message : message?.message;
}
-function finalizeIssue(iss, ctx, config2) {
+function finalizeIssue(iss, ctx, config3) {
const full = { ...iss, path: iss.path ?? [] };
if (!iss.message) {
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config3.customError?.(iss)) ?? unwrapMessage(config3.localeError?.(iss)) ?? "Invalid input";
full.message = message;
}
delete full.inst;
@@ -27765,15 +27694,16 @@ function dataverseConnectionReferencesUrl(instanceUrl, opts) {
}
var PPAPI_API_VERSION = "1";
var PPAPI_DEFAULT_SUFFIX = "environment.api.powerplatform.com";
-function ppapiBaseUrl(envId, templateOverride) {
- const hex = envId.replace(/-/g, "");
+function ppapiBaseUrl(envId, templateOverride, suffixOverride) {
+ const rawId = envId.replace(/^Default-/i, "");
+ const hex = rawId.replace(/-/g, "");
const prefix = hex.slice(0, 30);
const shard = hex.slice(30, 32);
const template = templateOverride ?? process.env.PA_PPAPI_BASE_URL;
if (template) {
return template.replace(/\{prefix\}/g, prefix).replace(/\{shard\}/g, shard).replace(/\{envId\}/g, envId).replace(/\{hex\}/g, hex);
}
- const suffix = process.env.PA_PPAPI_SUFFIX ?? PPAPI_DEFAULT_SUFFIX;
+ const suffix = process.env.PA_PPAPI_SUFFIX ?? suffixOverride ?? PPAPI_DEFAULT_SUFFIX;
return `https://${prefix}.${shard}.${suffix}`;
}
function ppapiQs(extra) {
@@ -27978,19 +27908,20 @@ function dataverseImportSolutionUrl(instanceUrl) {
var GOVERNANCE_API_VERSION = "1";
var GOVERNANCE_BASE = "https://api.powerplatform.com";
var BAP_BASE = "https://api.bap.microsoft.com";
-function governanceBaseUrl() {
- return process.env.PA_GOVERNANCE_BASE ?? GOVERNANCE_BASE;
+function governanceBaseUrl(cloudOverride) {
+ return process.env.PA_GOVERNANCE_BASE ?? cloudOverride ?? GOVERNANCE_BASE;
}
-function governanceUserRoutingUrl() {
- const base = governanceBaseUrl();
+function governanceUserRoutingUrl(governanceBase) {
+ const base = governanceBaseUrl(governanceBase);
return `${base}/governance/userRoutingEnvironment?api-version=${GOVERNANCE_API_VERSION}`;
}
-function governanceRoutingStatusUrl(operationId) {
- const base = governanceBaseUrl();
+function governanceRoutingStatusUrl(operationId, governanceBase) {
+ const base = governanceBaseUrl(governanceBase);
return `${base}/governance/environmentRoutingOperationStatus/${operationId}?api-version=${GOVERNANCE_API_VERSION}`;
}
-function bapDefaultEnvironmentUrl() {
- return `${BAP_BASE}/providers/Microsoft.BusinessAppPlatform/environments/~default?api-version=2021-04-01`;
+function bapDefaultEnvironmentUrl(bapBase) {
+ const base = bapBase ?? BAP_BASE;
+ return `${base}/providers/Microsoft.BusinessAppPlatform/environments/~default?api-version=2021-04-01`;
}
function graphUsersSearchUrl(query, top = 10) {
const escaped = query.replace(/["']/g, "\\$&");
@@ -28205,135 +28136,6 @@ function stableStringify(v) {
return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
}
-// packages/core/dist/api/flow-edit.js
-var FlowEditError = class extends Error {
- code;
- path;
- constructor(code, message, path3) {
- super(message);
- this.code = code;
- this.path = path3;
- this.name = "FlowEditError";
- }
-};
-function isPlainObject2(v) {
- return typeof v === "object" && v !== null && !Array.isArray(v);
-}
-function parsePath(path3) {
- return path3.split("/").map((s) => s.trim()).filter((s) => s.length > 0);
-}
-function deepClone(v) {
- if (typeof structuredClone === "function")
- return structuredClone(v);
- return JSON.parse(JSON.stringify(v));
-}
-function deepMerge(target, source) {
- for (const [k, v] of Object.entries(source)) {
- const existing = target[k];
- if (isPlainObject2(existing) && isPlainObject2(v)) {
- deepMerge(existing, v);
- } else {
- target[k] = v;
- }
- }
- return target;
-}
-function resolveParent(root, segments, fullPath) {
- let node = root;
- for (let i = 0; i < segments.length - 1; i++) {
- if (!isPlainObject2(node)) {
- throw new FlowEditError("PathNotObject", `Cannot descend into "${segments.slice(0, i).join("/")}" \u2014 not an object.`, fullPath);
- }
- if (!(segments[i] in node)) {
- throw new FlowEditError("PathNotFound", `Path segment "${segments[i]}" does not exist (in "${fullPath}").`, fullPath);
- }
- node = node[segments[i]];
- }
- if (!isPlainObject2(node)) {
- throw new FlowEditError("PathNotObject", `Parent of "${fullPath}" is not an object.`, fullPath);
- }
- return { parent: node, key: segments[segments.length - 1] };
-}
-function getNode(root, segments, fullPath) {
- let node = root;
- for (const seg of segments) {
- if (!isPlainObject2(node) || !(seg in node)) {
- throw new FlowEditError("PathNotFound", `Path "${fullPath}" not found (stopped at "${seg}").`, fullPath);
- }
- node = node[seg];
- }
- return node;
-}
-function assertNoOrphanRunAfter(definition) {
- const actions = definition.actions;
- if (!isPlainObject2(actions))
- return;
- const names = new Set(Object.keys(actions));
- const orphans = [];
- for (const [name3, action] of Object.entries(actions)) {
- if (!isPlainObject2(action))
- continue;
- const runAfter = action.runAfter;
- if (!isPlainObject2(runAfter))
- continue;
- for (const dep of Object.keys(runAfter)) {
- if (!names.has(dep)) {
- orphans.push(`${name3}.runAfter \u2192 "${dep}" (missing)`);
- }
- }
- }
- if (orphans.length > 0) {
- throw new FlowEditError("OrphanRunAfter", `Edit would leave dangling runAfter dependencies: ${orphans.join("; ")}. Re-point or remove the dependent action(s) in the same edit.`);
- }
-}
-function applyFlowEdits(definition, operations) {
- if (!Array.isArray(operations) || operations.length === 0) {
- throw new FlowEditError("EmptyOperations", "No edit operations supplied.");
- }
- const next = deepClone(definition);
- const applied = [];
- for (const operation of operations) {
- const { op, path: path3 } = operation;
- if (op !== "set" && op !== "add" && op !== "remove" && op !== "merge") {
- throw new FlowEditError("InvalidOp", `Unknown op "${op}". Use one of: set, add, remove, merge.`, path3);
- }
- const segments = parsePath(path3 ?? "");
- if (op === "merge") {
- const value = operation.value;
- if (!isPlainObject2(value)) {
- throw new FlowEditError("MergeValueNotObject", `merge "${path3}" requires an object value.`, path3);
- }
- const targetNode = segments.length === 0 ? next : getNode(next, segments, path3);
- if (!isPlainObject2(targetNode)) {
- throw new FlowEditError("MergeTargetNotObject", `merge target "${path3}" is not an object.`, path3);
- }
- deepMerge(targetNode, value);
- applied.push({ op, path: path3 });
- continue;
- }
- if (segments.length === 0) {
- throw new FlowEditError("EmptyPath", `"${op}" requires a non-empty path.`, path3);
- }
- const { parent, key } = resolveParent(next, segments, path3);
- if (op === "remove") {
- if (!(key in parent)) {
- throw new FlowEditError("PathNotFound", `remove "${path3}" \u2014 key "${key}" does not exist.`, path3);
- }
- delete parent[key];
- } else if (op === "add") {
- if (key in parent) {
- throw new FlowEditError("KeyExists", `add "${path3}" \u2014 key "${key}" already exists. Use op:"set" to overwrite.`, path3);
- }
- parent[key] = operation.value;
- } else {
- parent[key] = operation.value;
- }
- applied.push({ op, path: path3 });
- }
- assertNoOrphanRunAfter(next);
- return { definition: next, applied };
-}
-
// packages/core/dist/api/preview-tokens.js
import { randomUUID } from "node:crypto";
var DEFAULT_TTL_MS = 5 * 60 * 1e3;
@@ -28430,7 +28232,6 @@ function createSha256ContentDigest(value) {
var MAX_RETRIES = 3;
var INITIAL_DELAY_MS = 1e3;
var APIHUB_RESOURCE = "https://apihub.azure.com";
-var CONNECTIVITY_RESOURCE = "https://api.powerplatform.com";
function extractLogicalNamesFromFlow(flow) {
const refs = flow?.properties?.connectionReferences;
if (!refs)
@@ -28446,13 +28247,13 @@ function extractLogicalNamesFromFlow(flow) {
var FlowClient = class _FlowClient {
auth;
config;
- constructor(auth2, config2) {
+ constructor(auth2, config3) {
this.auth = auth2;
- this.config = config2;
+ this.config = config3;
}
/** Resolve the PPAPI base URL for an environment, respecting config overrides. */
ppapiBase(envId) {
- return ppapiBaseUrl(envId, this.config.ppapiBaseUrlTemplate);
+ return ppapiBaseUrl(envId, this.config.ppapiBaseUrlTemplate, this.config.cloudEndpoints.ppapiSuffix);
}
/** Build PPAPI flow query string with api-version. */
ppapiFlowQs(extra) {
@@ -28588,138 +28389,6 @@ var FlowClient = class _FlowClient {
throw new PreviewTokenError(result.code);
}
}
- /**
- * Apply targeted ("surgical") edits to a flow definition without resending
- * the whole thing. The current definition is fetched, the ordered list of
- * operations is applied to a clone (see flow-edit.ts), and the result is
- * routed through the normal `updateFlow` path — so the managed-solution
- * guard, auto-backup, and preview-token concurrency check all still apply.
- *
- * Works for non-solution flows and unmanaged-solution flows alike. Managed
- * solution flows are rejected by the same guard as update_flow (pass
- * forceManaged to override). Flows with no connection references are fine —
- * the definition is edited in place regardless.
- *
- * With `dryRun: true`, no write happens: the resulting definition is diffed
- * against the live flow and a single-use preview token is returned. Re-call
- * with the same operations plus that `previewToken` to apply.
- */
- async editFlow(envId, flowId, operations, opts = {}) {
- const current = await this.getFlow(envId, flowId);
- const currentDef = current.properties?.definition ?? {};
- const { definition, applied } = applyFlowEdits(currentDef, operations);
- const body = { properties: { definition } };
- if (opts.dryRun) {
- const preview = await this.previewUpdate(envId, flowId, body);
- return {
- mode: "preview",
- applied,
- diff: preview.diff,
- token: preview.token,
- expiresAt: preview.expiresAt,
- note: "Dry run \u2014 no change applied. Re-call edit_flow with the SAME operations plus this previewToken to apply."
- };
- }
- const flow = await this.updateFlow(envId, flowId, body, {
- forceManaged: opts.forceManaged,
- previewToken: opts.previewToken,
- skipBackup: opts.skipBackup,
- backupNote: opts.backupNote ?? `edit_flow: ${applied.length} op(s)`
- });
- return { mode: "applied", applied, flow };
- }
- /**
- * Copy a flow within the same environment or across environments. The source
- * definition is read and re-created as a new, standalone flow (always created
- * Stopped by default). No native PA "copy" endpoint exists — this orchestrates
- * getFlow + connection-ref remapping + createFlow.
- *
- * Behaviour by flow shape:
- * - **No connection references** (built-in actions only, e.g. Compose/HTTP):
- * copied as-is, no resolution attempted.
- * - **Same-env copy**: source connection references are reused verbatim
- * (they are already valid in that environment).
- * - **Cross-env copy**: each connector is re-resolved in the target env via
- * resolveConnectionRefs (Dataverse-first, PPAPI fallback). Connectors with
- * no usable connection in the target are reported in `unresolvedConnectors`
- * and the new flow is left Stopped so it cannot run half-wired.
- * - **Solution-bound source** (managed or unmanaged): the copy is a plain
- * standalone flow — solution membership is intentionally dropped. A note
- * is returned when this is detected.
- */
- async copyFlow(envId, flowId, opts = {}) {
- const source = await this.getFlow(envId, flowId);
- const props = source.properties ?? {};
- const definition = props.definition;
- if (!definition) {
- throw new FlowApiError(404, "Source flow has no definition", `Flow ${flowId} returned no definition; cannot copy.`, "");
- }
- const sourceName = props.displayName ?? "Flow";
- const targetEnv = opts.targetEnv ?? envId;
- const sameEnv = targetEnv === envId;
- const newName = opts.name ?? `${sourceName} (Copy)`;
- const state = opts.state ?? "Stopped";
- const autoResolve = opts.autoResolveConnections !== false;
- const sourceRefs = props.connectionReferences;
- let connectionReferences = sourceRefs;
- const unresolvedConnectors = [];
- const hasRefs = !!sourceRefs && Object.keys(sourceRefs).length > 0;
- if (hasRefs && !sameEnv && autoResolve) {
- const connectorByRefKey = {};
- for (const [refKey, ref] of Object.entries(sourceRefs)) {
- connectorByRefKey[refKey] = connectorFromRef(refKey, ref);
- }
- const connectors = Array.from(new Set(Object.values(connectorByRefKey)));
- const resolved = await this.resolveConnectionRefs(targetEnv, connectors);
- const remapped = {};
- for (const [refKey, ref] of Object.entries(sourceRefs)) {
- const connector = connectorByRefKey[refKey];
- const target = resolved[connector];
- const newRef = { ...ref };
- const targetName = target?.connectionName;
- const isPlaceholder = !!target?._error || typeof targetName === "string" && (targetName.startsWith("NO_CONNECTION_FOUND_FOR_") || targetName.startsWith("LOOKUP_FAILED_FOR_"));
- if (target && !isPlaceholder && targetName) {
- newRef.connectionName = targetName;
- if (target.connectionReferenceLogicalName) {
- newRef.connectionReferenceLogicalName = target.connectionReferenceLogicalName;
- }
- } else {
- unresolvedConnectors.push(connector);
- }
- delete newRef._error;
- remapped[refKey] = newRef;
- }
- connectionReferences = remapped;
- }
- let note;
- try {
- const ctx = await this.getFlowContext(envId, flowId);
- if (!ctx.warning && ctx.inSolution) {
- note = `Source flow is in solution "${ctx.solutionFriendlyName ?? ctx.solutionUniqueName ?? "(unknown)"}"${ctx.isManaged ? " (managed)" : ""}; the copy is a standalone, non-solution flow.`;
- }
- } catch {
- }
- const created = await this.createFlow(targetEnv, {
- properties: {
- displayName: newName,
- definition,
- state,
- connectionReferences
- }
- });
- if (unresolvedConnectors.length > 0) {
- const warn = `Created Stopped with ${unresolvedConnectors.length} unresolved connector(s): ${unresolvedConnectors.join(", ")}. Create connections in the target env, then update the flow's references.`;
- note = note ? `${note} ${warn}` : warn;
- }
- return {
- flowId: created.name,
- environmentId: targetEnv,
- displayName: newName,
- sameEnv,
- unresolvedConnectors,
- note
- };
- }
async deleteFlow(envId, flowId, opts = {}) {
await this.assertNotManaged(envId, flowId, "delete_flow", opts);
await this.snapshotBeforeMutation(envId, flowId, "delete_flow", opts);
@@ -28863,154 +28532,6 @@ var FlowClient = class _FlowClient {
const url = `${base}/powerautomate/flows/${flowId}/runs/${runId}/actions${this.ppapiFlowQs({})}`;
return followPagination(async (nextUrl) => this.ppapiRequest("GET", nextUrl ?? url));
}
- /**
- * Cancel a single in-progress (Running/Waiting) flow run.
- * No-op-safe: PA returns an error for already-terminal runs, surfaced as a
- * FlowApiError. Endpoint mirrors the Logic Apps `runs/{run}/cancel` contract.
- */
- async cancelRun(envId, flowId, runId) {
- const base = this.ppapiBase(envId);
- const url = `${base}/powerautomate/flows/${flowId}/runs/${runId}/cancel${this.ppapiFlowQs({})}`;
- await this.ppapiRequest("POST", url);
- return { cancelled: true, runId };
- }
- /**
- * Resubmit a past run using the same trigger inputs it originally received.
- * The PA/Logic Apps contract resubmits against the trigger history:
- * `triggers/{triggerName}/histories/{runId}/resubmit`. The trigger name is
- * discovered from the run unless supplied.
- */
- async resubmitRun(envId, flowId, runId, opts = {}) {
- let triggerName = opts.triggerName;
- if (!triggerName) {
- try {
- const run = await this.getRunDetails(envId, flowId, runId);
- triggerName = run.properties?.trigger?.name;
- } catch {
- }
- }
- triggerName = triggerName ?? "manual";
- const base = this.ppapiBase(envId);
- const url = `${base}/powerautomate/flows/${flowId}/triggers/${triggerName}/histories/${runId}/resubmit${this.ppapiFlowQs({})}`;
- await this.ppapiRequest("POST", url);
- return { resubmitted: true, runId, triggerName };
- }
- /**
- * List iteration-level details for an action that runs inside a loop
- * (Apply_to_each / Do_until) within a run. Each repetition is one pass of the
- * loop and carries its own status, inputs/outputs links, and (on failure)
- * error — the only way to see WHICH iteration of a loop failed. Pass the name
- * of an action INSIDE the loop, not the loop container (the container returns
- * no repetitions). Mirrors the Logic Apps
- * `runs/{run}/actions/{action}/repetitions` contract.
- */
- async getRunActionRepetitions(envId, flowId, runId, actionName) {
- const base = this.ppapiBase(envId);
- const url = `${base}/powerautomate/flows/${flowId}/runs/${runId}/actions/${actionName}/repetitions${this.ppapiFlowQs({})}`;
- return followPagination(async (nextUrl) => this.ppapiRequest("GET", nextUrl ?? url));
- }
- /**
- * Bulk-cancel every in-progress run of a flow. Two paths (per
- * https://learn.microsoft.com/power-automate/how-tos-bulk-resubmit#cancel-flow-runs):
- *
- * 1. **Dataverse bulk action** (`CancelAllCloudFlowRuns`, bound to the
- * `workflow` entity) — used whenever the flow exists as a Dataverse
- * workflow record, which covers BOTH solution flows AND modern
- * non-solution flows. One server-side call cancels the whole queue;
- * statuses transition Running/Waiting → Canceling → Canceled (can take
- * up to 24h).
- * 2. **Per-run fallback** — for flows with no Dataverse workflow record
- * (e.g. environments without Dataverse): enumerate run history, filter to
- * Running/Waiting, and cancel each individually.
- *
- * Optionally turns the flow off afterwards (`turnOff`) so the underlying
- * issue can be fixed. Cancel happens first, then turn-off (turning a flow off
- * first would leave pending runs stuck Waiting until it is turned back on).
- */
- async cancelAllRuns(envId, flowId, opts = {}) {
- let workflowId = null;
- try {
- const ctx = await this.getFlowContext(envId, flowId);
- if (!ctx.warning)
- workflowId = ctx.workflowId;
- } catch {
- workflowId = null;
- }
- let result;
- if (workflowId) {
- const instanceUrl = await this.getDataverseInstanceUrl(envId);
- const dvToken = await this.auth.getAccessToken(instanceUrl);
- const base = instanceUrl.replace(/\/$/, "");
- const url = `${base}/api/data/v9.2/workflows(${workflowId})/Microsoft.Dynamics.CRM.CancelAllCloudFlowRuns`;
- await this.dataversePost(url, {}, dvToken);
- result = {
- method: "dataverse-bulk",
- note: "Server-side bulk cancel queued via CancelAllCloudFlowRuns. Runs in Running/Waiting transition to Canceling then Canceled (can take up to 24h)."
- };
- } else {
- const cap = opts.maxFallback ?? 250;
- const active = (await this.getRunHistory(envId, flowId, { top: cap })).filter((r) => ["Running", "Waiting"].includes(r.properties?.status));
- let cancelled = 0;
- const failures = [];
- for (const r of active) {
- try {
- await this.cancelRun(envId, flowId, r.name);
- cancelled++;
- } catch (e) {
- failures.push({ runId: r.name, error: e instanceof Error ? e.message : String(e) });
- }
- }
- result = {
- method: "per-run",
- cancelled,
- attempted: active.length,
- failures,
- note: active.length === 0 ? "No Running/Waiting runs to cancel (and no Dataverse workflow record for a bulk action)." : `Cancelled ${cancelled}/${active.length} active runs individually (no Dataverse workflow record for a bulk action).`
- };
- }
- let turnedOff = false;
- if (opts.turnOff) {
- try {
- await this.disableFlow(envId, flowId, { forceManaged: opts.forceManaged });
- turnedOff = true;
- } catch (e) {
- logger.warn(`cancelAllRuns: turn-off failed: ${e instanceof Error ? e.message : String(e)}`);
- }
- }
- return { ...result, turnedOff };
- }
- /**
- * Diagnose a flow run: classify each failed action with an actionable
- * remediation. Read-only — fetches run details + actions and maps known
- * error codes to fixes. Complements the flow-debugger skill as a callable
- * primitive.
- */
- async diagnoseRun(envId, flowId, runId) {
- const run = await this.getRunDetails(envId, flowId, runId);
- const status = run.properties?.status ?? "Unknown";
- const actions = await this.getRunActionDetails(envId, flowId, runId);
- const failedActions = actions.filter((a) => {
- const s = a.properties?.status;
- return s === "Failed" || s === "TimedOut";
- }).map((a) => {
- const code = a.properties?.code ?? a.properties?.error?.code;
- const message = a.properties?.error?.message;
- return {
- name: a.name,
- code,
- message,
- remediation: remediateActionError(code, message)
- };
- });
- const summary = status === "Succeeded" ? "Run succeeded \u2014 no failed actions." : failedActions.length > 0 ? `Run ${status}; ${failedActions.length} failed action(s): ${failedActions.map((f) => f.name).join(", ")}.` : `Run ${status}; no per-action failures captured (check the trigger or run-level error).`;
- return {
- runId,
- status,
- error: run.properties?.error,
- failedActions,
- summary
- };
- }
/**
* Fetch trigger inputs from a past run. This is the same primitive the PA
* designer uses for "Test with previous run data". For each requested run,
@@ -29287,7 +28808,7 @@ var FlowClient = class _FlowClient {
* Returns the raw response and HTTP status for the caller to interpret.
*/
async getUserRoutingEnvironment() {
- const url = governanceUserRoutingUrl();
+ const url = governanceUserRoutingUrl(this.config.cloudEndpoints.powerPlatformApiUrl);
const token = await this.auth.getAccessToken();
logger.debug(`GET ${url}`);
const response = await fetch(url, {
@@ -29305,7 +28826,7 @@ var FlowClient = class _FlowClient {
* Poll for routing provisioning operation completion.
*/
async getRoutingOperationStatus(operationId) {
- const url = governanceRoutingStatusUrl(operationId);
+ const url = governanceRoutingStatusUrl(operationId, this.config.cloudEndpoints.powerPlatformApiUrl);
const token = await this.auth.getAccessToken();
logger.debug(`GET ${url}`);
const response = await fetch(url, {
@@ -29325,7 +28846,7 @@ var FlowClient = class _FlowClient {
* Get the default environment via BAP-RP (~default).
*/
async getDefaultEnvironment() {
- const url = bapDefaultEnvironmentUrl();
+ const url = bapDefaultEnvironmentUrl(this.config.cloudEndpoints.bapBaseUrl);
const token = await this.auth.getAccessToken();
logger.debug(`GET ${url}`);
const response = await fetch(url, {
@@ -29444,7 +28965,7 @@ var FlowClient = class _FlowClient {
const swagger = connector.properties.swagger;
const operations = [];
if (swagger?.paths) {
- for (const [path3, methods] of Object.entries(swagger.paths)) {
+ for (const [path5, methods] of Object.entries(swagger.paths)) {
for (const [method, op] of Object.entries(methods)) {
if (!op.operationId)
continue;
@@ -29456,7 +28977,7 @@ var FlowClient = class _FlowClient {
operationId: op.operationId,
summary: op.summary ?? op.description,
method: method.toUpperCase(),
- path: path3,
+ path: path5,
parameters: params
});
}
@@ -29485,11 +29006,11 @@ var FlowClient = class _FlowClient {
}
let opMethod = "GET";
let opPath = "";
- for (const [path3, methods] of Object.entries(swagger.paths)) {
+ for (const [path5, methods] of Object.entries(swagger.paths)) {
for (const [method, op] of Object.entries(methods)) {
if (op.operationId === operationId) {
opMethod = method.toUpperCase();
- opPath = path3;
+ opPath = path5;
break;
}
}
@@ -29663,7 +29184,7 @@ var FlowClient = class _FlowClient {
let lastError;
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
try {
- const token = await this.auth.getAccessToken(CONNECTIVITY_RESOURCE);
+ const token = await this.auth.getAccessToken(this.config.cloudEndpoints.powerPlatformApiUrl);
return await this.requestWithToken(method, url, token, body);
} catch (err) {
lastError = err;
@@ -30660,18 +30181,32 @@ var FlowClient = class _FlowClient {
const headers = {
Authorization: `Bearer ${token}`,
Accept: "application/json",
- ...extraHeaders,
- "User-Agent": "power-automate-plugin/2.0.0"
+ "User-Agent": "power-automate-plugin/2.0.0",
+ ...extraHeaders
};
if (body !== void 0) {
headers["Content-Type"] = "application/json";
}
logger.debug(`${method} ${url}`);
- const response = await fetch(url, {
- method,
- headers,
- body: body !== void 0 ? JSON.stringify(body) : void 0
- });
+ let response;
+ try {
+ response = await fetch(url, {
+ method,
+ headers,
+ body: body !== void 0 ? JSON.stringify(body) : void 0
+ });
+ } catch (fetchErr) {
+ const cause = fetchErr?.cause;
+ const hostname2 = cause?.hostname ?? (() => {
+ try {
+ return new URL(url).hostname;
+ } catch {
+ return url;
+ }
+ })();
+ const code = cause?.code ?? (fetchErr instanceof TypeError ? "FETCH_FAILED" : "UNKNOWN");
+ throw new FlowApiError(0, "NetworkError", `Network request failed: ${code} (hostname: ${hostname2}). This often means the environment ID produced an invalid PPAPI URL. Verify the environment ID is a valid GUID.`, url);
+ }
if (!response.ok) {
const responseBody = await response.text();
throw new FlowApiError(response.status, response.statusText, responseBody, url);
@@ -30732,48 +30267,6 @@ var FlowClient = class _FlowClient {
throw lastError;
}
};
-function connectorFromRef(refKey, ref) {
- const id = typeof ref?.id === "string" ? ref.id : void 0;
- if (id) {
- const marker = "/apis/";
- const idx = id.lastIndexOf(marker);
- if (idx >= 0) {
- const tail = id.slice(idx + marker.length).split("/")[0];
- if (tail)
- return tail;
- }
- }
- return refKey;
-}
-function remediateActionError(code, message) {
- const c = (code ?? "").toLowerCase();
- const m = (message ?? "").toLowerCase();
- if (c.includes("unauthorized") || c === "401" || m.includes("unauthorized") || m.includes("token")) {
- return "Connection auth expired or insufficient. Re-authenticate the connection (fix_connection) and confirm it is Connected.";
- }
- if (c.includes("forbidden") || c === "403" || m.includes("forbidden") || m.includes("permission")) {
- return "The caller lacks permission, or a DLP policy blocks the connector. Verify the connection identity's access and tenant DLP groups.";
- }
- if (c.includes("notfound") || c === "404") {
- return "A referenced resource (item, list, table, record) was not found. Check the IDs/paths in the action inputs \u2014 they may be stale after an env copy.";
- }
- if (c.includes("badrequest") || c === "400" || m.includes("invalid")) {
- return "The action inputs were rejected. Re-check required parameters and expression outputs feeding this action (inspect inputsLink).";
- }
- if (c.includes("toomanyrequests") || c === "429" || m.includes("throttl") || m.includes("rate limit")) {
- return "The connector throttled the request. Add a concurrency limit or retry policy, or reduce call volume; consider Process capacity for high-throughput flows.";
- }
- if (c.includes("timeout") || c === "504" || m.includes("timed out")) {
- return "The action timed out. Check the downstream service, increase the action timeout, or split long-running work.";
- }
- if (c.includes("actionfailed") || m.includes("dependent action")) {
- return "This action failed because an upstream action it depends on failed. Diagnose the first failing action in the run.";
- }
- if (c.includes("serviceunavailable") || c === "503" || c === "500" || c.includes("internalserver")) {
- return "The downstream service returned a server error. Often transient \u2014 resubmit the run; if persistent, check the connector's service health.";
- }
- return message ? "Inspect the action's inputs/outputs (inputsLink/outputsLink) and the connector docs for this error." : "No error message captured. Re-run with get_run_actions to inspect the action's inputs/outputs.";
-}
function toSnapshot(flow) {
const p = flow.properties ?? {};
return {
@@ -30928,8 +30421,8 @@ function parseJwtClaims(token) {
return {};
}
}
-function cacheKeyFile(cacheDir, resource, tenantId, accountId) {
- const composite = `${resource}\0${tenantId ?? ""}\0${accountId ?? ""}`;
+function cacheKeyFile(cacheDir, resource, tenantId2, accountId) {
+ const composite = `${resource}\0${tenantId2 ?? ""}\0${accountId ?? ""}`;
const hash = createHash("sha256").update(composite).digest("hex").slice(0, 32);
return path.join(cacheDir, `${hash}.json`);
}
@@ -31005,18 +30498,18 @@ var DiskTokenCache = class {
return;
try {
fs.mkdirSync(this.cacheDir, { recursive: true });
- const { tenantId, accountId } = parseJwtClaims(token.token);
- this.identityHints.set(resource, { tenantId, accountId });
+ const { tenantId: tenantId2, accountId } = parseJwtClaims(token.token);
+ this.identityHints.set(resource, { tenantId: tenantId2, accountId });
const entry = {
v: SCHEMA_VERSION,
resource,
- tenantId,
+ tenantId: tenantId2,
accountId,
token: token.token,
expiresAt: token.expiresAt,
writtenAt: Date.now()
};
- const dest = tenantId || accountId ? cacheKeyFile(this.cacheDir, resource, tenantId, accountId) : unkeyedFile(this.cacheDir, resource);
+ const dest = tenantId2 || accountId ? cacheKeyFile(this.cacheDir, resource, tenantId2, accountId) : unkeyedFile(this.cacheDir, resource);
atomicWrite(dest, JSON.stringify(entry));
} catch {
}
@@ -31082,7 +30575,9 @@ var DEFAULT_RESOURCE = "https://service.flow.microsoft.com";
var AzCliTokenProvider = class {
tokenCache = /* @__PURE__ */ new Map();
diskCache;
+ defaultResource;
constructor(opts = {}) {
+ this.defaultResource = opts.defaultResource ?? DEFAULT_RESOURCE;
if (opts.diskCache === false) {
this.diskCache = null;
} else if (opts.diskCache instanceof DiskTokenCache) {
@@ -31092,7 +30587,7 @@ var AzCliTokenProvider = class {
}
}
async getAccessToken(resource) {
- const res = resource ?? DEFAULT_RESOURCE;
+ const res = resource ?? this.defaultResource;
const memHit = this.tokenCache.get(res);
if (memHit && Date.now() < memHit.expiresAt - REFRESH_BUFFER_MS) {
return memHit.token;
@@ -31168,10 +30663,16 @@ function getAzTenantId() {
}
// packages/core/dist/auth/composite-auth.js
-var CONNECTIVITY_RESOURCE2 = "https://api.powerplatform.com";
+var CONNECTIVITY_RESOURCE_COMMERCIAL = "https://api.powerplatform.com";
function buildCompositeAuth(opts = {}) {
- const azAuth = opts.azProvider ?? new AzCliTokenProvider(opts);
+ const azOpts = {
+ ...opts,
+ defaultResource: opts.cloudEndpoints?.flowResource
+ };
+ const azAuth = opts.azProvider ?? new AzCliTokenProvider(azOpts);
let msalAuth = null;
+ const cloud = opts.cloud ?? "commercial";
+ const connectivityResource = opts.cloudEndpoints?.powerPlatformApiUrl ?? CONNECTIVITY_RESOURCE_COMMERCIAL;
async function getMsalAuth() {
if (msalAuth)
return msalAuth;
@@ -31179,15 +30680,24 @@ function buildCompositeAuth(opts = {}) {
msalAuth = opts.msalFactory();
return msalAuth;
}
- const tenantId = getAzTenantId();
+ const customClientId = process.env.PA_CLIENT_ID;
+ if (cloud !== "commercial" && !customClientId) {
+ throw new Error(`Connection management commands require MSAL authentication, but the PAC CLI app (9cee029c) is not preauthorized in ${cloud.toUpperCase()} tenants. To use connection commands, register your own Azure AD app with Power Platform Connectivity scopes and set PA_CLIENT_ID=<your-app-id>. Flow management commands (list, create, run flows) work without this.`);
+ }
+ const tenantId2 = getAzTenantId();
+ const authorityHost = opts.cloudEndpoints?.authorityHost ?? "https://login.microsoftonline.com";
const mod = await Promise.resolve().then(() => (init_msal_auth(), msal_auth_exports));
const Cls = mod.MsalTokenProvider;
- msalAuth = new Cls(void 0, tenantId);
+ msalAuth = new Cls({
+ clientId: customClientId,
+ tenantId: tenantId2,
+ authorityHost
+ });
return msalAuth;
}
return {
async getAccessToken(resource) {
- if (resource === CONNECTIVITY_RESOURCE2) {
+ if (resource === connectivityResource || resource === CONNECTIVITY_RESOURCE_COMMERCIAL) {
const provider = await getMsalAuth();
return provider.getAccessToken(resource);
}
@@ -31205,6 +30715,98 @@ init_logger();
import { readFileSync as readFileSync4 } from "node:fs";
import { join as join4 } from "node:path";
import { homedir as homedir3 } from "node:os";
+import { spawnSync as spawnSync2 } from "node:child_process";
+var CLOUD_ENDPOINTS = {
+ commercial: {
+ authorityHost: "https://login.microsoftonline.com",
+ flowBaseUrl: "https://api.flow.microsoft.com",
+ flowResource: "https://service.flow.microsoft.com",
+ bapBaseUrl: "https://api.bap.microsoft.com",
+ powerPlatformApiUrl: "https://api.powerplatform.com",
+ ppapiSuffix: "environment.api.powerplatform.com"
+ },
+ gcc: {
+ authorityHost: "https://login.microsoftonline.com",
+ flowBaseUrl: "https://gov.api.flow.microsoft.us",
+ flowResource: "https://gov.service.flow.microsoft.us",
+ bapBaseUrl: "https://gov.api.bap.microsoft.us",
+ powerPlatformApiUrl: "https://api.gov.powerplatform.microsoft.us",
+ ppapiSuffix: "environment.api.gov.powerplatform.microsoft.us"
+ },
+ gcchigh: {
+ authorityHost: "https://login.microsoftonline.us",
+ flowBaseUrl: "https://high.api.flow.microsoft.us",
+ flowResource: "https://high.service.flow.microsoft.us",
+ bapBaseUrl: "https://high.api.bap.microsoft.us",
+ powerPlatformApiUrl: "https://high.api.powerplatform.microsoft.us",
+ ppapiSuffix: "environment.api.high.powerplatform.microsoft.us"
+ },
+ dod: {
+ authorityHost: "https://login.microsoftonline.us",
+ flowBaseUrl: "https://dod.api.flow.microsoft.us",
+ flowResource: "https://dod.service.flow.microsoft.us",
+ bapBaseUrl: "https://dod.api.bap.microsoft.us",
+ powerPlatformApiUrl: "https://dod.api.powerplatform.microsoft.us",
+ ppapiSuffix: "environment.api.dod.powerplatform.microsoft.us"
+ }
+};
+function detectAzureCloud() {
+ try {
+ const isWindows = process.platform === "win32";
+ const result = spawnSync2("az", ["cloud", "show", "--query", "name", "-o", "tsv"], { encoding: "utf-8", shell: isWindows, windowsHide: true, timeout: 1e4 });
+ if (result.status === 0 && result.stdout) {
+ const cloudName = result.stdout.trim();
+ switch (cloudName) {
+ case "AzureUSGovernment":
+ return "gcchigh";
+ case "AzureCloud":
+ return "commercial";
+ default:
+ logger.debug(`Unknown Azure cloud "${cloudName}", defaulting to commercial`);
+ return "commercial";
+ }
+ }
+ } catch {
+ logger.debug("Failed to detect Azure cloud, defaulting to commercial");
+ }
+ return "commercial";
+}
+function parseCloudEnvVar(value) {
+ const normalized = value.toLowerCase().replace(/[-_\s]/g, "");
+ switch (normalized) {
+ case "commercial":
+ case "azurecloud":
+ return "commercial";
+ case "gcc":
+ return "gcc";
+ case "gcchigh":
+ case "azureusgovernment":
+ case "usgovhigh":
+ return "gcchigh";
+ case "dod":
+ case "usgov":
+ return "dod";
+ default:
+ return void 0;
+ }
+}
+function resolveCloud() {
+ const envCloud = process.env.PA_CLOUD;
+ if (envCloud) {
+ const parsed = parseCloudEnvVar(envCloud);
+ if (parsed) {
+ logger.debug(`Cloud from PA_CLOUD env var: ${parsed}`);
+ return parsed;
+ }
+ logger.warn(`Unrecognized PA_CLOUD value "${envCloud}", detecting from Azure CLI...`);
+ }
+ const detected = detectAzureCloud();
+ logger.debug(`Cloud detected from Azure CLI: ${detected}`);
+ return detected;
+}
+function getCloudEndpoints(cloud) {
+ return CLOUD_ENDPOINTS[cloud];
+}
function loadFileConfig(configDir) {
const configPath = join4(configDir, "config.json");
try {
@@ -31218,115 +30820,207 @@ function loadFileConfig(configDir) {
function loadConfig() {
const configDir = join4(homedir3(), ".power-automate-cli");
const fileConfig = loadFileConfig(configDir);
+ let cloud;
+ if (process.env.PA_CLOUD) {
+ cloud = parseCloudEnvVar(process.env.PA_CLOUD) ?? resolveCloud();
+ } else if (fileConfig.cloud) {
+ cloud = parseCloudEnvVar(fileConfig.cloud) ?? resolveCloud();
+ } else {
+ cloud = resolveCloud();
+ }
+ const cloudEndpoints = getCloudEndpoints(cloud);
return {
defaultEnvironmentId: process.env.PA_DEFAULT_ENVIRONMENT ?? fileConfig.defaultEnvironmentId,
- baseUrl: process.env.PA_BASE_URL ?? fileConfig.baseUrl ?? "https://api.flow.microsoft.com",
+ baseUrl: process.env.PA_BASE_URL ?? fileConfig.baseUrl ?? cloudEndpoints.flowBaseUrl,
configDir,
- ppapiBaseUrlTemplate: process.env.PA_PPAPI_BASE_URL
+ ppapiBaseUrlTemplate: process.env.PA_PPAPI_BASE_URL,
+ cloud,
+ cloudEndpoints
};
}
-// packages/core/dist/connection-refs.js
-async function enrichRefsWithLogicalNames(client, envId, refs, log) {
- const needsEnrichment = Object.values(refs).some((r) => !r.connectionReferenceLogicalName);
- if (!needsEnrichment)
- return refs;
- let dvRefs;
- try {
- dvRefs = await client.listConnections(envId);
- } catch {
- log?.("Dataverse connection references unavailable; using direct connections");
- return refs;
- }
- const connectorToLogical = {};
- for (const dv of dvRefs) {
- if (dv.connectorid && dv.connectionreferencelogicalname) {
- connectorToLogical[dv.connectorid] = dv.connectionreferencelogicalname;
- }
- }
- const enriched = { ...refs };
- let count = 0;
- for (const [key, ref] of Object.entries(enriched)) {
- if (ref.connectionReferenceLogicalName)
+// packages/core/dist/telemetry/index.js
+import { spawn } from "node:child_process";
+import { fileURLToPath } from "node:url";
+
+// packages/core/dist/telemetry/config.js
+import os3 from "node:os";
+import path3 from "node:path";
+var TELEMETRY_PLUGIN_NAME = "flow-agent";
+var TELEMETRY_PLUGIN_VERSION = "2.0.0";
+var TELEMETRY_SCHEMA_VERSION = "1.0";
+var DEFAULT_COLLECTOR_URL = "https://mobile.events.data.microsoft.com/OneCollector/1.0/";
+function isOptedOut() {
+ const off = (v) => v === "0" || v === "false" || v === "off";
+ return off(process.env.FLOWAGENT_TELEMETRY) || off(process.env.POWER_PLATFORM_SKILLS_TELEMETRY);
+}
+function resolveLocalLogPath() {
+ const override = process.env.FLOWAGENT_TELEMETRY_LOG;
+ if (override)
+ return override;
+ return path3.join(os3.homedir(), ".flowagent", "telemetry.jsonl");
+}
+var cached2;
+function getTelemetryConfig() {
+ if (cached2)
+ return cached2;
+ const localLogPath = resolveLocalLogPath();
+ const instrumentationKey = process.env.FLOWAGENT_TELEMETRY_IKEY ?? "";
+ const collectorUrl = process.env.FLOWAGENT_TELEMETRY_COLLECTOR ?? DEFAULT_COLLECTOR_URL;
+ let mode;
+ if (isOptedOut()) {
+ mode = "off";
+ } else if (instrumentationKey) {
+ mode = "collector";
+ } else {
+ mode = "local";
+ }
+ cached2 = { mode, instrumentationKey, collectorUrl, localLogPath };
+ return cached2;
+}
+
+// packages/core/dist/telemetry/session.js
+import { randomUUID as randomUUID4 } from "node:crypto";
+import os4 from "node:os";
+var SESSION_ID = randomUUID4();
+function getSessionId() {
+ return SESSION_ID;
+}
+var hostInfo;
+function getHostInfo() {
+ if (!hostInfo) {
+ hostInfo = {
+ osName: os4.platform(),
+ osVersion: os4.release(),
+ nodeVersion: process.version
+ };
+ }
+ return hostInfo;
+}
+function newCorrelationId() {
+ return randomUUID4();
+}
+
+// packages/core/dist/telemetry/agent-info.js
+var mcpClient;
+function setMcpClient(info) {
+ if (info && (info.aiAgentName || info.aiAgentVersion))
+ mcpClient = info;
+}
+function detectFromEnv() {
+ if (process.env.FLOWAGENT_AGENT) {
+ return { aiAgentName: process.env.FLOWAGENT_AGENT, aiAgentVersion: process.env.FLOWAGENT_AGENT_VERSION };
+ }
+ if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) {
+ return { aiAgentName: "claude-code", aiAgentVersion: process.env.CLAUDE_CODE_VERSION };
+ }
+ if (process.env.COPILOT_CLI || process.env.GITHUB_COPILOT_CLI || process.env.COPILOT_AGENT_ID) {
+ return { aiAgentName: "copilot-cli", aiAgentVersion: process.env.COPILOT_CLI_VERSION };
+ }
+ if (process.env.CURSOR_TRACE_ID || process.env.CURSOR) {
+ return { aiAgentName: "cursor" };
+ }
+ if (process.env.TERM_PROGRAM === "vscode") {
+ return { aiAgentName: "vscode" };
+ }
+ return {};
+}
+function getAgentInfo() {
+ if (mcpClient)
+ return mcpClient;
+ return detectFromEnv();
+}
+var tenantId = null;
+function getTenantId() {
+ if (tenantId === null) {
+ tenantId = process.env.FLOWAGENT_TENANT_ID || void 0;
+ }
+ return tenantId ?? void 0;
+}
+
+// packages/core/dist/telemetry/events.js
+var FIELD_TYPES = {
+ // Envelope / common
+ schemaVersion: "string",
+ eventName: "string",
+ time: "string",
+ pluginName: "string",
+ pluginVersion: "string",
+ sessionId: "string",
+ correlationId: "string",
+ osName: "string",
+ osVersion: "string",
+ nodeVersion: "string",
+ tenantId: "string",
+ aiAgentName: "string",
+ aiAgentVersion: "string",
+ surface: "string",
+ // "mcp" | "cli"
+ // Tool / command identity
+ toolName: "string",
+ commandName: "string",
+ // Outcome
+ outcome: "string",
+ // "success" | "failure"
+ durationMs: "number",
+ errorClass: "string",
+ errorCode: "string",
+ // MCP transport
+ mcpTransport: "string",
+ // "stdio" | "http"
+ mcpClientName: "string",
+ // Sizing / shape
+ responseBytes: "number",
+ actionCount: "number",
+ // Flow creation
+ templateId: "string",
+ envId: "string"
+};
+function pick2(input) {
+ const out = {};
+ for (const [key, type] of Object.entries(FIELD_TYPES)) {
+ const v = input[key];
+ if (v === void 0 || v === null)
continue;
- const connectorId = ref.id ?? `/providers/Microsoft.PowerApps/apis/${key}`;
- const logicalName = connectorToLogical[connectorId];
- if (logicalName) {
- enriched[key] = { ...ref, connectionReferenceLogicalName: logicalName };
- count++;
+ if (type === "number") {
+ const n = typeof v === "number" ? v : Number(v);
+ if (Number.isFinite(n))
+ out[key] = n;
+ } else {
+ out[key] = typeof v === "string" ? v : String(v);
}
}
- if (count > 0) {
- log?.(`Resolved ${count} connection reference logical name(s) from Dataverse`);
- }
- return enriched;
+ return out;
+}
+function commonFields() {
+ const host = getHostInfo();
+ const agent = getAgentInfo();
+ return {
+ schemaVersion: TELEMETRY_SCHEMA_VERSION,
+ time: (/* @__PURE__ */ new Date()).toISOString(),
+ pluginName: TELEMETRY_PLUGIN_NAME,
+ pluginVersion: TELEMETRY_PLUGIN_VERSION,
+ sessionId: getSessionId(),
+ osName: host.osName,
+ osVersion: host.osVersion,
+ nodeVersion: host.nodeVersion,
+ tenantId: getTenantId(),
+ aiAgentName: agent.aiAgentName,
+ aiAgentVersion: agent.aiAgentVersion
+ };
+}
+function buildEvent(eventName, fields) {
+ return pick2({ ...commonFields(), eventName, name: eventName, ...fields });
}
-// packages/core/dist/current-env-store.js
-var CurrentEnvStore = class {
- state;
- subscribers = /* @__PURE__ */ new Set();
- constructor(initialEnvId = process.env.PA_DEFAULT_ENVIRONMENT) {
- this.state = initialEnvId ? { envId: initialEnvId, displayName: null, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "env-var" } : { envId: null, displayName: null, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "none" };
- }
- get() {
- return this.state;
- }
- set(envId, opts) {
- const prevId = this.state.envId;
- this.state = {
- envId,
- displayName: opts.displayName ?? this.state.displayName ?? null,
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
- source: opts.source
- };
- if (prevId !== envId) {
- for (const cb of this.subscribers) {
- try {
- cb(this.state);
- } catch {
- }
- }
- }
- return this.state;
- }
- subscribe(cb) {
- this.subscribers.add(cb);
- return () => {
- this.subscribers.delete(cb);
- };
- }
- subscriberCount() {
- return this.subscribers.size;
- }
-};
-var legacyCurrentEnvStore = new CurrentEnvStore();
-
-// packages/core/dist/current-flow-store.js
-var CurrentFlowStore = class {
- state;
- constructor() {
- this.state = { flowId: null, displayName: null, envId: null, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "none" };
- }
- get() {
- return this.state;
- }
- set(flowId, opts) {
- this.state = {
- flowId,
- displayName: opts.displayName ?? this.state.displayName ?? null,
- envId: opts.envId ?? this.state.envId ?? null,
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
- source: opts.source
- };
- return this.state;
- }
- clear() {
- this.state = { flowId: null, displayName: null, envId: null, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "none" };
- return this.state;
- }
-};
-var legacyCurrentFlowStore = new CurrentFlowStore();
+// packages/core/dist/telemetry/local-log.js
+import fs3 from "node:fs";
+import path4 from "node:path";
+function appendLocal(logPath, record2) {
+ const dir = path4.dirname(logPath);
+ fs3.mkdirSync(dir, { recursive: true });
+ fs3.appendFileSync(logPath, JSON.stringify(record2) + "\n", "utf8");
+}
// packages/core/dist/templates.js
var FLOWAGENT_TEMPLATE_ID = "fa2c7b91-3e04-4d8a-b6f1-a9e5c8d20147";
@@ -32558,8 +32252,292 @@ var TEMPLATES = {
}
}
}
+ },
+ "ai-builder-prompt": {
+ id: "ai-builder-prompt",
+ name: "AI Builder Prompt (Copilot Credits)",
+ description: "Manual trigger with text input \u2192 AI Builder 'Run a prompt' action (uses Copilot credits) \u2192 Compose output",
+ connectors: ["shared_commondataserviceforapps"],
+ definition: {
+ $schema: SCHEMA,
+ contentVersion: "1.0.0.0",
+ parameters: BASE_PARAMS,
+ outputs: {},
+ triggers: {
+ manual: {
+ type: "Request",
+ kind: "Button",
+ inputs: {
+ schema: {
+ type: "object",
+ properties: {
+ text_input: {
+ type: "string",
+ title: "Text Input",
+ description: "Text to send to the AI Builder prompt",
+ default: "Summarize this text...",
+ "x-ms-content-hint": "TEXT",
+ "x-ms-dynamically-added": true
+ }
+ },
+ required: ["text_input"]
+ }
+ }
+ }
+ },
+ actions: {
+ Run_a_prompt: {
+ type: "OpenApiConnection",
+ inputs: {
+ parameters: {
+ recordId: "REPLACE_WITH_AI_CONFIGURATION_ID",
+ "item/source": '{"consumptionSource":"PowerAutomate","partnerSource":"AIBuilder","consumptionSourceVersion":"Flow","partnerSourceVersion":"REPLACE_WITH_FLOW_ID"}'
+ },
+ host: {
+ apiId: "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps",
+ operationId: "aibuilderpredict_customprompt",
+ connectionName: "shared_commondataserviceforapps"
+ }
+ },
+ runAfter: {},
+ metadata: {
+ flowSystemMetadata: {
+ portalOperationId: "aibuilderpredict_customprompt",
+ portalOperationGroup: "aibuilder",
+ portalOperationApiDisplayNameOverride: "AI Builder",
+ portalOperationIconOverride: "https://content.powerapps.com/resource/makerx/static/pauto/images/designeroperations/aibuilderIcon2026.8e878397.png",
+ portalOperationBrandColorOverride: "#0A76C4",
+ portalOperationApiTierOverride: "Standard"
+ }
+ }
+ },
+ Extract_Prompt_Output: {
+ type: "Compose",
+ inputs: "@outputs('Run_a_prompt')?['body/responsev2/predictionOutput/text']",
+ runAfter: { Run_a_prompt: ["Succeeded"] }
+ }
+ }
+ }
+ }
+};
+
+// packages/core/dist/telemetry/index.js
+var dispatcherPath;
+function getDispatcherPath() {
+ if (!dispatcherPath) {
+ dispatcherPath = fileURLToPath(new URL("./emit-dispatcher.js", import.meta.url));
+ }
+ return dispatcherPath;
+}
+function sendToCollector(record2) {
+ const cfg = getTelemetryConfig();
+ const payload = Buffer.from(JSON.stringify(record2), "utf8").toString("base64");
+ const childEnv = {
+ PATH: process.env.PATH,
+ SystemRoot: process.env.SystemRoot,
+ HOME: process.env.HOME,
+ USERPROFILE: process.env.USERPROFILE,
+ FLOWAGENT_TELEMETRY_PAYLOAD: payload,
+ FLOWAGENT_TELEMETRY_IKEY: cfg.instrumentationKey,
+ FLOWAGENT_TELEMETRY_COLLECTOR: cfg.collectorUrl
+ };
+ const child = spawn(process.execPath, [getDispatcherPath()], {
+ detached: true,
+ stdio: "ignore",
+ env: childEnv
+ });
+ child.unref();
+}
+function emit(eventName, fields) {
+ try {
+ const cfg = getTelemetryConfig();
+ if (cfg.mode === "off")
+ return;
+ const record2 = buildEvent(eventName, fields);
+ if (cfg.mode === "collector") {
+ sendToCollector(record2);
+ } else {
+ appendLocal(cfg.localLogPath, record2);
+ }
+ } catch {
+ }
+}
+function emitToolStarted(info) {
+ emit("tool_started", { surface: "mcp", ...info });
+}
+function emitToolCompleted(info) {
+ emit("tool_completed", { surface: "mcp", ...info });
+}
+function emitFlowCreated(info) {
+ emit("flow_created", { correlationId: info.correlationId ?? newCorrelationId(), ...info });
+}
+function createTelemetryObserver(opts = {}) {
+ const transport2 = opts.transport;
+ function clientName() {
+ try {
+ const info = opts.getClientInfo?.();
+ if (info?.name) {
+ setMcpClient({ aiAgentName: info.name, aiAgentVersion: info.version });
+ return info.name;
+ }
+ } catch {
+ }
+ return void 0;
+ }
+ function envOf(args) {
+ const e = args?.env;
+ return typeof e === "string" ? e : void 0;
+ }
+ function responseBytes(result) {
+ try {
+ const text = result?.content?.[0]?.text;
+ if (typeof text === "string")
+ return Buffer.byteLength(text, "utf8");
+ } catch {
+ }
+ return void 0;
+ }
+ return {
+ onToolStart(info) {
+ emitToolStarted({
+ toolName: info.tool,
+ correlationId: info.correlationId,
+ surface: "mcp",
+ envId: envOf(info.args)
+ });
+ },
+ onToolEnd(info) {
+ const mcpClientName = clientName();
+ emitToolCompleted({
+ toolName: info.tool,
+ correlationId: info.correlationId,
+ outcome: info.isError ? "failure" : "success",
+ durationMs: info.durationMs,
+ surface: "mcp",
+ envId: envOf(info.args),
+ errorCode: info.errorCode,
+ responseBytes: responseBytes(info.result),
+ mcpTransport: transport2,
+ mcpClientName
+ });
+ if (info.tool === "create_flow" && !info.isError) {
+ const def = info.args?.definition;
+ const templateId = def?.metadata?.templateId ?? FLOWAGENT_TEMPLATE_ID;
+ const actionCount = def?.actions ? Object.keys(def.actions).length : void 0;
+ emitFlowCreated({
+ templateId,
+ surface: "mcp",
+ correlationId: info.correlationId,
+ envId: envOf(info.args),
+ actionCount,
+ mcpClientName
+ });
+ }
+ }
+ };
+}
+
+// packages/core/dist/connection-refs.js
+async function enrichRefsWithLogicalNames(client, envId, refs, log) {
+ const needsEnrichment = Object.values(refs).some((r) => !r.connectionReferenceLogicalName);
+ if (!needsEnrichment)
+ return refs;
+ let dvRefs;
+ try {
+ dvRefs = await client.listConnections(envId);
+ } catch {
+ log?.("Dataverse connection references unavailable; using direct connections");
+ return refs;
+ }
+ const connectorToLogical = {};
+ for (const dv of dvRefs) {
+ if (dv.connectorid && dv.connectionreferencelogicalname) {
+ connectorToLogical[dv.connectorid] = dv.connectionreferencelogicalname;
+ }
+ }
+ const enriched = { ...refs };
+ let count = 0;
+ for (const [key, ref] of Object.entries(enriched)) {
+ if (ref.connectionReferenceLogicalName)
+ continue;
+ const connectorId = ref.id ?? `/providers/Microsoft.PowerApps/apis/${key}`;
+ const logicalName = connectorToLogical[connectorId];
+ if (logicalName) {
+ enriched[key] = { ...ref, connectionReferenceLogicalName: logicalName };
+ count++;
+ }
+ }
+ if (count > 0) {
+ log?.(`Resolved ${count} connection reference logical name(s) from Dataverse`);
+ }
+ return enriched;
+}
+
+// packages/core/dist/current-env-store.js
+var CurrentEnvStore = class {
+ state;
+ subscribers = /* @__PURE__ */ new Set();
+ constructor(initialEnvId = process.env.PA_DEFAULT_ENVIRONMENT) {
+ this.state = initialEnvId ? { envId: initialEnvId, displayName: null, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "env-var" } : { envId: null, displayName: null, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "none" };
+ }
+ get() {
+ return this.state;
+ }
+ set(envId, opts) {
+ const prevId = this.state.envId;
+ this.state = {
+ envId,
+ displayName: opts.displayName ?? this.state.displayName ?? null,
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
+ source: opts.source
+ };
+ if (prevId !== envId) {
+ for (const cb of this.subscribers) {
+ try {
+ cb(this.state);
+ } catch {
+ }
+ }
+ }
+ return this.state;
+ }
+ subscribe(cb) {
+ this.subscribers.add(cb);
+ return () => {
+ this.subscribers.delete(cb);
+ };
+ }
+ subscriberCount() {
+ return this.subscribers.size;
}
};
+var legacyCurrentEnvStore = new CurrentEnvStore();
+
+// packages/core/dist/current-flow-store.js
+var CurrentFlowStore = class {
+ state;
+ constructor() {
+ this.state = { flowId: null, displayName: null, envId: null, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "none" };
+ }
+ get() {
+ return this.state;
+ }
+ set(flowId, opts) {
+ this.state = {
+ flowId,
+ displayName: opts.displayName ?? this.state.displayName ?? null,
+ envId: opts.envId ?? this.state.envId ?? null,
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
+ source: opts.source
+ };
+ return this.state;
+ }
+ clear() {
+ this.state = { flowId: null, displayName: null, envId: null, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "none" };
+ return this.state;
+ }
+};
+var legacyCurrentFlowStore = new CurrentFlowStore();
// packages/core/dist/index.js
init_trigger_emulators();
@@ -33046,8 +33024,8 @@ function getErrorMap() {
// node_modules/zod/v3/helpers/parseUtil.js
var makeIssue = (params) => {
- const { data, path: path3, errorMaps, issueData } = params;
- const fullPath = [...path3, ...issueData.path || []];
+ const { data, path: path5, errorMaps, issueData } = params;
+ const fullPath = [...path5, ...issueData.path || []];
const fullIssue = {
...issueData,
path: fullPath
@@ -33163,11 +33141,11 @@ var errorUtil;
// node_modules/zod/v3/types.js
var ParseInputLazyPath = class {
- constructor(parent, value, path3, key) {
+ constructor(parent, value, path5, key) {
this._cachedPath = [];
this.parent = parent;
this.data = value;
- this._path = path3;
+ this._path = path5;
this._key = key;
}
get path() {
@@ -39064,7 +39042,7 @@ var Protocol = class {
};
}
};
-function isPlainObject3(value) {
+function isPlainObject2(value) {
return value !== null && typeof value === "object" && !Array.isArray(value);
}
function mergeCapabilities(base, additional) {
@@ -39075,7 +39053,7 @@ function mergeCapabilities(base, additional) {
if (addValue === void 0)
continue;
const baseValue = result[k];
- if (isPlainObject3(baseValue) && isPlainObject3(addValue)) {
+ if (isPlainObject2(baseValue) && isPlainObject2(addValue)) {
result[k] = { ...baseValue, ...addValue };
} else {
result[k] = addValue;
@@ -40079,13 +40057,13 @@ var ExperimentalMcpServerTasks = class {
constructor(_mcpServer) {
this._mcpServer = _mcpServer;
}
- registerToolTask(name3, config2, handler) {
- const execution = { taskSupport: "required", ...config2.execution };
+ registerToolTask(name3, config3, handler) {
+ const execution = { taskSupport: "required", ...config3.execution };
if (execution.taskSupport === "forbidden") {
throw new Error(`Cannot register task-based tool '${name3}' with taskSupport 'forbidden'. Use registerTool() instead.`);
}
const mcpServerInternal = this._mcpServer;
- return mcpServerInternal._createRegisteredTool(name3, config2.title, config2.description, config2.inputSchema, config2.outputSchema, config2.annotations, execution, config2._meta, handler);
+ return mcpServerInternal._createRegisteredTool(name3, config3.title, config3.description, config3.inputSchema, config3.outputSchema, config3.annotations, execution, config3._meta, handler);
}
};
@@ -40514,12 +40492,12 @@ var McpServer = class {
return registeredResourceTemplate;
}
}
- registerResource(name3, uriOrTemplate, config2, readCallback) {
+ registerResource(name3, uriOrTemplate, config3, readCallback) {
if (typeof uriOrTemplate === "string") {
if (this._registeredResources[uriOrTemplate]) {
throw new Error(`Resource ${uriOrTemplate} is already registered`);
}
- const registeredResource = this._createRegisteredResource(name3, config2.title, uriOrTemplate, config2, readCallback);
+ const registeredResource = this._createRegisteredResource(name3, config3.title, uriOrTemplate, config3, readCallback);
this.setResourceRequestHandlers();
this.sendResourceListChanged();
return registeredResource;
@@ -40527,7 +40505,7 @@ var McpServer = class {
if (this._registeredResourceTemplates[name3]) {
throw new Error(`Resource template ${name3} is already registered`);
}
- const registeredResourceTemplate = this._createRegisteredResourceTemplate(name3, config2.title, uriOrTemplate, config2, readCallback);
+ const registeredResourceTemplate = this._createRegisteredResourceTemplate(name3, config3.title, uriOrTemplate, config3, readCallback);
this.setResourceRequestHandlers();
this.sendResourceListChanged();
return registeredResourceTemplate;
@@ -40725,11 +40703,11 @@ var McpServer = class {
/**
* Registers a tool with a config object and callback.
*/
- registerTool(name3, config2, cb) {
+ registerTool(name3, config3, cb) {
if (this._registeredTools[name3]) {
throw new Error(`Tool ${name3} is already registered`);
}
- const { title, description, inputSchema, outputSchema, annotations, _meta } = config2;
+ const { title, description, inputSchema, outputSchema, annotations, _meta } = config3;
return this._createRegisteredTool(name3, title, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, _meta, cb);
}
prompt(name3, ...rest) {
@@ -40753,11 +40731,11 @@ var McpServer = class {
/**
* Registers a prompt with a config object and callback.
*/
- registerPrompt(name3, config2, cb) {
+ registerPrompt(name3, config3, cb) {
if (this._registeredPrompts[name3]) {
throw new Error(`Prompt ${name3} is already registered`);
}
- const { title, description, argsSchema } = config2;
+ const { title, description, argsSchema } = config3;
const registeredPrompt = this._createRegisteredPrompt(name3, title, description, argsSchema, cb);
this.setPromptRequestHandlers();
this.sendPromptListChanged();
@@ -40978,9 +40956,9 @@ function summarizeList(items, fields, rename) {
return summary;
});
}
-function getNestedValue(obj, path3) {
+function getNestedValue(obj, path5) {
let current = obj;
- for (const segment of path3.split(".")) {
+ for (const segment of path5.split(".")) {
if (current == null)
return void 0;
current = current[segment];
@@ -41022,16 +41000,16 @@ function progress(extra) {
// packages/core/dist/mcp/server.js
init_backups();
-function buildToolContext(mcpCtx, config2, clientFactory) {
+function buildToolContext(mcpCtx, config3, clientFactory) {
let client = null;
function getClient() {
if (!client)
- client = clientFactory(mcpCtx.auth, config2);
+ client = clientFactory(mcpCtx.auth, config3);
return client;
}
function resolveEnv(env) {
const fromStore = mcpCtx.currentEnv.get().envId ?? void 0;
- const r = env || fromStore || config2.defaultEnvironmentId;
+ const r = env || fromStore || config3.defaultEnvironmentId;
if (!r)
throw new Error("No environment specified and no default set. Call list_environments first, set one with set_current_env, or set PA_DEFAULT_ENVIRONMENT.");
return r;
@@ -41096,7 +41074,7 @@ function inferActionType(opProps) {
return "OpenApiConnection";
}
async function createMcpServer(authProvider, deps = {}) {
- const config2 = deps.config ?? loadConfig();
+ const config3 = deps.config ?? loadConfig();
const clientFactory = deps.clientFactory ?? ((auth2, cfg) => new FlowClient(auth2, cfg));
const sessionScope = new AsyncLocalStorage();
const toolContexts = /* @__PURE__ */ new WeakMap();
@@ -41123,7 +41101,7 @@ async function createMcpServer(authProvider, deps = {}) {
const mcpCtx = getActiveMcpContext();
let toolCtx = toolContexts.get(mcpCtx);
if (!toolCtx) {
- toolCtx = buildToolContext(mcpCtx, config2, clientFactory);
+ toolCtx = buildToolContext(mcpCtx, config3, clientFactory);
toolContexts.set(mcpCtx, toolCtx);
}
return toolCtx;
@@ -41161,13 +41139,13 @@ async function createMcpServer(authProvider, deps = {}) {
try {
const result = await handler(...handlerArgs);
const isError = result?.isError === true;
- let errorCode;
+ let errorCode2;
if (isError) {
try {
const text = result.content?.[0]?.text;
if (typeof text === "string") {
const parsed = JSON.parse(text);
- errorCode = parsed?.code;
+ errorCode2 = parsed?.code;
}
} catch {
}
@@ -41179,7 +41157,7 @@ async function createMcpServer(authProvider, deps = {}) {
correlationId,
durationMs: Date.now() - t0,
isError,
- errorCode,
+ errorCode: errorCode2,
result
});
} catch {
@@ -41463,14 +41441,7 @@ async function createMcpServer(authProvider, deps = {}) {
const triggerWallClock = Date.now() - 5e3;
let triggerResult;
if (body) {
- try {
- triggerResult = await c.runFlowViaCallback(envId, flow, body);
- } catch (e) {
- if (String(e?.message ?? "").match(/CallbackUrl|ListCallbackUrl/i)) {
- triggerResult = await c.runFlow(envId, flow);
- } else
- throw e;
- }
+ triggerResult = await c.runFlowViaCallback(envId, flow, body);
} else {
triggerResult = await c.runFlow(envId, flow);
}
@@ -41520,19 +41491,7 @@ async function createMcpServer(authProvider, deps = {}) {
clearInterval(hb);
}
}
- let r;
- if (body) {
- try {
- r = await c.runFlowViaCallback(envId, flow, body);
- } catch (e) {
- if (e?.message?.includes("CallbackUrl") || e?.message?.includes("ListCallbackUrl")) {
- r = await c.runFlow(envId, flow);
- } else
- throw e;
- }
- } else {
- r = await c.runFlow(envId, flow);
- }
+ const r = body ? await c.runFlowViaCallback(envId, flow, body) : await c.runFlow(envId, flow);
return safeResult(r ?? { triggered: true });
} catch (e) {
return safeError(e);
@@ -42272,15 +42231,15 @@ async function createMcpServer(authProvider, deps = {}) {
};
});
server2.resource("recipe-content", new ResourceTemplate("flowagent://recipes/{slug}", { list: void 0 }), { description: "Full markdown content of a specific recipe by slug.", mimeType: "text/markdown" }, async (uri, { slug }) => {
- const fs3 = await import("node:fs");
- const path3 = await import("node:path");
- const fileURLToPath = (await import("node:url")).fileURLToPath;
- const here = path3.dirname(fileURLToPath(import.meta.url));
- const recipesDir = path3.resolve(here, "..", "..", "docs", "recipes");
+ const fs4 = await import("node:fs");
+ const path5 = await import("node:path");
+ const fileURLToPath2 = (await import("node:url")).fileURLToPath;
+ const here = path5.dirname(fileURLToPath2(import.meta.url));
+ const recipesDir = path5.resolve(here, "..", "..", "docs", "recipes");
const safeSlug = String(slug).replace(/[^a-z0-9-]/gi, "");
- const file = path3.join(recipesDir, `${safeSlug}.md`);
+ const file = path5.join(recipesDir, `${safeSlug}.md`);
try {
- const text = fs3.readFileSync(file, "utf-8");
+ const text = fs4.readFileSync(file, "utf-8");
return { contents: [{ uri: uri.href, mimeType: "text/markdown", text }] };
} catch {
return { contents: [{ uri: uri.href, mimeType: "text/plain", text: `Recipe '${safeSlug}' not found. Available recipes: see flowagent://recipes/index` }] };
@@ -42291,15 +42250,15 @@ async function createMcpServer(authProvider, deps = {}) {
// packages/core/dist/index.js
init_logger();
-function createTelemetryObserver(_opts) {
- return { onToolStart() {
- }, onToolEnd() {
- } };
-}
-// packages/cli/dist/bin/mcp-stdio.js
-var auth = buildCompositeAuth();
+// packages/cli/src/bin/mcp-stdio.ts
+var config2 = loadConfig();
+var auth = buildCompositeAuth({
+ cloud: config2.cloud,
+ cloudEndpoints: config2.cloudEndpoints
+});
var server = await createMcpServer(auth, {
+ config: config2,
...createTelemetryObserver({
transport: "stdio",
getClientInfo: () => server?.server?.getClientVersion?.()
@@ -42322,338 +42281,335 @@ function countRegisteredTools(srv) {
/*! Bundled license information:
@azure/msal-node/dist/cache/serializer/Serializer.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-common/dist/utils/Constants.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/constants/AADServerParamKeys.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/AuthError.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/ClientConfigurationError.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/utils/StringUtils.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/ClientAuthError.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/ClientConfigurationErrorCodes.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/ClientAuthErrorCodes.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/request/ScopeSet.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/request/RequestParameterBuilder.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/utils/UrlUtils.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/crypto/ICrypto.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/logger/Logger.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/packageMetadata.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/AuthorityOptions.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
-
-@azure/msal-common/dist/account/AuthToken.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/account/AccountInfo.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
+
+@azure/msal-common/dist/account/AuthToken.mjs:
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/url/UrlString.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/AuthorityMetadata.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/CacheErrorCodes.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/CacheError.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/account/ClientInfo.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/AuthorityType.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/account/TokenClaims.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/ProtocolMode.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/cache/utils/AccountEntityUtils.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/cache/CacheManager.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/telemetry/performance/PerformanceEvent.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/config/ClientConfiguration.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/cache/persistence/TokenCacheContext.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/utils/TimeUtils.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/cache/utils/CacheHelpers.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/telemetry/performance/PerformanceEvents.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/utils/FunctionWrappers.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/crypto/PopTokenGenerator.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/InteractionRequiredAuthErrorCodes.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/InteractionRequiredAuthError.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/ServerError.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/utils/ProtocolUtils.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/response/ResponseHandler.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/account/CcsCredential.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/utils/ClientAssertionUtils.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/network/RequestThumbprint.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/network/ThrottlingUtils.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/NetworkError.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/protocol/Token.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/OpenIdConfigResponse.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/RegionDiscovery.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/Authority.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/authority/AuthorityFactory.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/client/AuthorizationCodeClient.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/client/RefreshTokenClient.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/client/SilentFlowClient.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/protocol/Authorize.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/request/BaseAuthRequest.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/error/AuthErrorCodes.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-common/dist/index-node.mjs:
- (*! @azure/msal-common v16.11.0 2026-06-30 *)
+ (*! @azure/msal-common v16.6.1 2026-05-11 *)
@azure/msal-node/dist/cache/serializer/Deserializer.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/internals.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/utils/Constants.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/network/HttpClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/error/ManagedIdentityErrorCodes.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/error/ManagedIdentityError.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/config/ManagedIdentityId.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/error/NodeAuthError.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/config/Configuration.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/crypto/GuidGenerator.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/utils/EncodingUtils.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/crypto/HashUtils.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/crypto/PkceGenerator.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/crypto/CryptoProvider.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/cache/CacheHelpers.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/cache/NodeStorage.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/cache/TokenCache.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
@azure/msal-node/dist/error/ClientAuthErrorCodes.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ClientAssertion.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/packageMetadata.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/BaseClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/UsernamePasswordClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/protocol/Authorize.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ClientApplication.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/network/LoopbackClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/DeviceCodeClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/PublicClientApplication.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ClientCredentialClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/OnBehalfOfClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
-
-@azure/msal-node/dist/client/UserFederatedIdentityCredentialClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ConfidentialClientApplication.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/utils/TimeUtils.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/network/HttpClientWithRetries.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/retry/LinearRetryStrategy.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/retry/DefaultManagedIdentityRetryPolicy.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/config/ManagedIdentityRequestParameters.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentitySources/AppService.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentitySources/AzureArc.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentitySources/CloudShell.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/retry/ExponentialRetryStrategy.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/retry/ImdsRetryPolicy.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentitySources/Imds.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentitySources/ServiceFabric.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentitySources/MachineLearning.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentityClient.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/client/ManagedIdentityApplication.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
@azure/msal-node/dist/index.mjs:
- (*! @azure/msal-node v5.3.1 2026-06-30 *)
+ (*! @azure/msal-node v5.2.1 2026-05-11 *)
*/