@fluid-app/fluid-cli 0.1.775 → 0.1.777
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/fluid.mjs +2366 -2332
- package/dist/bin/fluid.mjs.map +1 -1
- package/dist/client-CFmMhNvn.mjs +2 -0
- package/dist/{hook-0PUIConU.mjs → hook-Dr7zgvyp.mjs} +3 -3
- package/dist/{hook-0PUIConU.mjs.map → hook-Dr7zgvyp.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{profiles-5slwyRzI.mjs → profiles-DqDZHbAv.mjs} +41 -15
- package/dist/{profiles-5slwyRzI.mjs.map → profiles-DqDZHbAv.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/client-BABOfZRW.mjs +0 -2
|
@@ -1472,6 +1472,29 @@ function classifyRefreshFailure(error) {
|
|
|
1472
1472
|
return "unavailable";
|
|
1473
1473
|
}
|
|
1474
1474
|
//#endregion
|
|
1475
|
+
//#region ../../platform/auth/src/session/types.ts
|
|
1476
|
+
const REFUSAL_REASONS = new Set([
|
|
1477
|
+
"company_not_yet_available",
|
|
1478
|
+
"not_on_one_auth",
|
|
1479
|
+
"not_mirrored",
|
|
1480
|
+
"no_membership",
|
|
1481
|
+
"bound",
|
|
1482
|
+
"flushed"
|
|
1483
|
+
]);
|
|
1484
|
+
function isRefusalReason(value) {
|
|
1485
|
+
return typeof value === "string" && REFUSAL_REASONS.has(value);
|
|
1486
|
+
}
|
|
1487
|
+
var SessionError = class extends Error {
|
|
1488
|
+
code;
|
|
1489
|
+
refusal;
|
|
1490
|
+
constructor(code, message, refusal) {
|
|
1491
|
+
super(message ?? code);
|
|
1492
|
+
this.name = "SessionError";
|
|
1493
|
+
this.code = code;
|
|
1494
|
+
if (refusal) this.refusal = refusal;
|
|
1495
|
+
}
|
|
1496
|
+
};
|
|
1497
|
+
//#endregion
|
|
1475
1498
|
//#region ../../platform/auth/src/session/exchange.ts
|
|
1476
1499
|
/**
|
|
1477
1500
|
* Token exchange (RFC 8693): company switch, role narrowing, and a root
|
|
@@ -1507,12 +1530,25 @@ function exchangeToken(client, clientId, subjectToken, target) {
|
|
|
1507
1530
|
credentials: "omit"
|
|
1508
1531
|
});
|
|
1509
1532
|
}
|
|
1510
|
-
|
|
1533
|
+
/** The `reason` on a refused exchange; null when absent or not one we know. */
|
|
1534
|
+
function refusalReason(error) {
|
|
1535
|
+
if (!isApiError(error)) return null;
|
|
1536
|
+
const reason = error.body?.reason;
|
|
1537
|
+
return isRefusalReason(reason) ? reason : null;
|
|
1538
|
+
}
|
|
1539
|
+
/** The refusal an identity answer carried, null when it carried no OAuth error. */
|
|
1540
|
+
function moveRefusal(error) {
|
|
1541
|
+
const code = oauthErrorCode(error);
|
|
1542
|
+
return code ? {
|
|
1543
|
+
error: code,
|
|
1544
|
+
reason: refusalReason(error)
|
|
1545
|
+
} : null;
|
|
1546
|
+
}
|
|
1511
1547
|
function classifyExchangeFailure(error) {
|
|
1512
1548
|
if (classifyRefreshFailure(error) === "unavailable") return "unavailable";
|
|
1513
1549
|
const code = oauthErrorCode(error);
|
|
1514
1550
|
if (code === "invalid_request" || code === "invalid_token") return "unusable";
|
|
1515
|
-
if (code === "invalid_target" &&
|
|
1551
|
+
if (code === "invalid_target" && refusalReason(error) === "company_not_yet_available") return "not_yet_available";
|
|
1516
1552
|
return "refused";
|
|
1517
1553
|
}
|
|
1518
1554
|
//#endregion
|
|
@@ -1534,16 +1570,6 @@ function toSessionFacts(info, expiresAt, exchanged = false) {
|
|
|
1534
1570
|
};
|
|
1535
1571
|
}
|
|
1536
1572
|
//#endregion
|
|
1537
|
-
//#region ../../platform/auth/src/session/types.ts
|
|
1538
|
-
var SessionError = class extends Error {
|
|
1539
|
-
code;
|
|
1540
|
-
constructor(code, message) {
|
|
1541
|
-
super(message ?? code);
|
|
1542
|
-
this.name = "SessionError";
|
|
1543
|
-
this.code = code;
|
|
1544
|
-
}
|
|
1545
|
-
};
|
|
1546
|
-
//#endregion
|
|
1547
1573
|
//#region ../../platform/auth/src/native/exchange.ts
|
|
1548
1574
|
/**
|
|
1549
1575
|
* Token exchange for native clients (Phase 007 FR-3): moves a native
|
|
@@ -1581,7 +1607,7 @@ async function exchangeNativeToken(config, subjectToken, target) {
|
|
|
1581
1607
|
const failure = classifyExchangeFailure(error);
|
|
1582
1608
|
if (failure === "unavailable") throw new SessionError("temporarily_unavailable");
|
|
1583
1609
|
if (failure === "unusable") throw new SessionError("session_expired", "The identity service did not accept the token to exchange.");
|
|
1584
|
-
throw new SessionError("access_denied", "The identity service refused the exchange.");
|
|
1610
|
+
throw new SessionError("access_denied", "The identity service refused the exchange.", moveRefusal(error) ?? void 0);
|
|
1585
1611
|
}
|
|
1586
1612
|
try {
|
|
1587
1613
|
const info = await getUserinfo({
|
|
@@ -1784,7 +1810,7 @@ function createNativeSession(config) {
|
|
|
1784
1810
|
});
|
|
1785
1811
|
} catch (error) {
|
|
1786
1812
|
if (started !== generation) throw new SessionError("not_signed_in");
|
|
1787
|
-
const sessionError = error instanceof SessionError && error.code === "access_denied" ? new SessionError("access_denied", `The identity service will not move this session to company ${org}
|
|
1813
|
+
const sessionError = error instanceof SessionError && error.code === "access_denied" ? new SessionError("access_denied", `The identity service will not move this session to company ${org}.`, error.refusal) : new SessionError("temporarily_unavailable", error instanceof SessionError && error.code === "session_expired" ? "The identity service did not accept the session's token for an exchange; a refresh may." : "The identity service could not exchange the session's token; retry later.");
|
|
1788
1814
|
update({ error: sessionError });
|
|
1789
1815
|
throw sessionError;
|
|
1790
1816
|
}
|
|
@@ -3069,4 +3095,4 @@ async function endUnusedSessions(before, after) {
|
|
|
3069
3095
|
//#endregion
|
|
3070
3096
|
export { isClientProfile as A, readStoredConfig as C, getConfigDir as D, isStrictConfig as E, getConfigFilePath as O, readConfig as S, writeConfig as T, primeClientProfile as _, peekIdentityToken as a, ApiError as b, sessionFacts as c, OrphanedClientSecretError as d, ProfileExistsError as f, peekClientToken as g, invalidateClientToken as h, isRoleNotGrantedError as i, isIdentityProfile as j, createDefaultConfig as k, signInWithBrowser as l, deleteClientSecret as m, describeIdentityError as n, primeIdentityProfile as o, clientAccessToken as p, identityToken as r, profileAccessToken as s, endUnusedSessions as t, signOutIdentity as u, saveClientProfile as v, updateConfig as w, createFetchClient as x, resolveIdentityUrl as y };
|
|
3071
3097
|
|
|
3072
|
-
//# sourceMappingURL=profiles-
|
|
3098
|
+
//# sourceMappingURL=profiles-DqDZHbAv.mjs.map
|