@fluid-app/fluid-cli 0.1.755 → 0.1.757
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 +23 -5
- package/dist/bin/fluid.mjs.map +1 -1
- package/dist/{hook-C_RzFBdF.mjs → hook-BPEq6ENH.mjs} +4 -3
- package/dist/hook-BPEq6ENH.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/hook-C_RzFBdF.mjs.map +0 -1
package/dist/bin/fluid.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as walkCommands, A as pollAgentAccess, D as fetchUserCompanies, E as confirmMfa, F as validateToken, M as sendMfa, N as signup, O as getFluidApiBase, P as switchCompany, Q as visibleSubcommands, S as resolveCredentialSource, X as rootCommand, Y as filterCatalog, Z as visibleOptions, _ as getAuthToken, c as inputsModeActive, g as getActiveProfile, j as redeemIdentityLink, k as isInsecureRemoteBase, l as registerInputsHook, s as exitOnInputsError, u as createInputsReader, w as FLUID_API_ERROR, x as readFdToken } from "../hook-
|
|
2
|
+
import { $ as walkCommands, A as pollAgentAccess, D as fetchUserCompanies, E as confirmMfa, F as validateToken, M as sendMfa, N as signup, O as getFluidApiBase, P as switchCompany, Q as visibleSubcommands, S as resolveCredentialSource, X as rootCommand, Y as filterCatalog, Z as visibleOptions, _ as getAuthToken, c as inputsModeActive, g as getActiveProfile, j as redeemIdentityLink, k as isInsecureRemoteBase, l as registerInputsHook, s as exitOnInputsError, u as createInputsReader, w as FLUID_API_ERROR, x as readFdToken } from "../hook-BPEq6ENH.mjs";
|
|
3
3
|
import { A as isClientProfile, C as readStoredConfig, D as getConfigDir, E as isStrictConfig, S as readConfig, T as writeConfig, _ as primeClientProfile, c as sessionFacts, j as isIdentityProfile, l as signInWithBrowser, n as describeIdentityError, o as primeIdentityProfile, p as clientAccessToken, r as identityToken, t as endUnusedSessions, u as signOutIdentity, w as updateConfig, y as resolveIdentityUrl } from "../profiles-5slwyRzI.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
@@ -447,6 +447,17 @@ function failed(code, message) {
|
|
|
447
447
|
}
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* What pins an identity sign-in to the account and company a sign-in
|
|
452
|
+
* confirmed: the company, when known, and a fresh login so the browser's
|
|
453
|
+
* existing session is not reused.
|
|
454
|
+
*/
|
|
455
|
+
function pinnedIdentity(companyUuid) {
|
|
456
|
+
return {
|
|
457
|
+
...companyUuid ? { org: companyUuid } : {},
|
|
458
|
+
forceLogin: true
|
|
459
|
+
};
|
|
460
|
+
}
|
|
450
461
|
/** Signs in through the identity service and stores the profile. */
|
|
451
462
|
async function loginWithIdentity(context) {
|
|
452
463
|
const apiBase = context.apiBase ?? getFluidApiBase();
|
|
@@ -534,8 +545,7 @@ async function loginWithIdentityLink(token, context) {
|
|
|
534
545
|
spinner.succeed("Sign-in link accepted");
|
|
535
546
|
return loginWithIdentity({
|
|
536
547
|
...context,
|
|
537
|
-
|
|
538
|
-
forceLogin: true
|
|
548
|
+
...pinnedIdentity(redemption.value.companyUuid)
|
|
539
549
|
});
|
|
540
550
|
}
|
|
541
551
|
//#endregion
|
|
@@ -795,7 +805,11 @@ async function loginWithEmail(opts, ui, deps) {
|
|
|
795
805
|
return ui.fail(confirmResult.error, confirmSpinner);
|
|
796
806
|
}
|
|
797
807
|
if (!confirmResult?.success) return 0;
|
|
798
|
-
if (signInPathFor(confirmResult.value) === "identity") return identityResult(await loginWithIdentity(
|
|
808
|
+
if (signInPathFor(confirmResult.value) === "identity") return identityResult(await loginWithIdentity({
|
|
809
|
+
...identityContext(opts, true, ui, deps),
|
|
810
|
+
loginHint: normaliseEmail(email),
|
|
811
|
+
...pinnedIdentity(confirmResult.value.companyUuid)
|
|
812
|
+
}), ui, deps);
|
|
799
813
|
const { companies } = confirmResult.value;
|
|
800
814
|
if (companies.length === 0) {
|
|
801
815
|
deps.log(chalk.red("No companies found for this account."));
|
|
@@ -984,7 +998,11 @@ async function finishStep(opts, interactive, ui, deps) {
|
|
|
984
998
|
}
|
|
985
999
|
spinner.succeed("Verified");
|
|
986
1000
|
deps.pending.remove(email);
|
|
987
|
-
if (signInPathFor(confirmed.value) === "identity") return identityResult(await loginWithIdentity(
|
|
1001
|
+
if (signInPathFor(confirmed.value) === "identity") return identityResult(await loginWithIdentity({
|
|
1002
|
+
...identityContext(opts, interactive, ui, deps, record.baseUrl),
|
|
1003
|
+
loginHint: normaliseEmail(email),
|
|
1004
|
+
...pinnedIdentity(confirmed.value.companyUuid)
|
|
1005
|
+
}), ui, deps);
|
|
988
1006
|
const { companies } = confirmed.value;
|
|
989
1007
|
const selected = findByShop(companies, shop);
|
|
990
1008
|
if (!selected) {
|