@fluid-app/fluid-cli 0.1.413 → 0.1.415

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as primeIdentityProfile, C as updateConfig, E as getConfigDir, F as resolveIdentityUrl, G as sendMfa, H as fetchUserCompanies, J as validateToken, K as signup, M as sessionFacts, N as signInWithBrowser, O as describeIdentityError, P as signOutIdentity, R as isIdentityProfile, S as readConfig, T as isStrictConfig, U as getFluidApiBase, V as confirmMfa, W as redeemIdentityLink, _ as getAuthToken, b as resolveCredentialSource, c as inputsModeActive, ct as filterCatalog, dt as visibleSubcommands, ft as walkCommands, g as getActiveProfile, i as INPUTS_MODE_ENV, k as identityToken, l as registerInputsHook, lt as rootCommand, q as switchCompany, s as exitOnInputsError, u as createInputsReader, ut as visibleOptions, w as writeConfig, z as FLUID_API_ERROR } from "../hook-jDkZbqMt.mjs";
2
+ import { A as primeIdentityProfile, C as updateConfig, E as getConfigDir, F as resolveIdentityUrl, G as sendMfa, H as fetchUserCompanies, J as validateToken, K as signup, M as sessionFacts, N as signInWithBrowser, O as describeIdentityError, P as signOutIdentity, R as isIdentityProfile, S as readConfig, T as isStrictConfig, U as getFluidApiBase, V as confirmMfa, W as redeemIdentityLink, _ as getAuthToken, b as resolveCredentialSource, c as inputsModeActive, ct as filterCatalog, dt as visibleSubcommands, ft as walkCommands, g as getActiveProfile, i as INPUTS_MODE_ENV, k as identityToken, l as registerInputsHook, lt as rootCommand, q as switchCompany, s as exitOnInputsError, u as createInputsReader, ut as visibleOptions, w as writeConfig, z as FLUID_API_ERROR } from "../hook-Cpk6jCiV.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -769,6 +769,14 @@ async function loginWithEmail(opts, ui, deps) {
769
769
  confirmSpinner.fail(chalk.red(`${confirmResult.error.message} (attempt ${attempt}/${MAX_CODE_ATTEMPTS})`));
770
770
  continue;
771
771
  }
772
+ if (confirmResult.error.code === "INVALID_CODE") return ui.fail({
773
+ ...confirmResult.error,
774
+ message: `${confirmResult.error.message}. If the code was right, the shop or the address may be wrong, or the company may sign in with an emailed link. Run fluid login again to start over.`
775
+ }, confirmSpinner);
776
+ if (confirmResult.error.code === "CONTACT_MISSING") return ui.fail({
777
+ ...confirmResult.error,
778
+ message: `${confirmResult.error.message}, then run fluid login again.`
779
+ }, confirmSpinner);
772
780
  return ui.fail(confirmResult.error, confirmSpinner);
773
781
  }
774
782
  if (!confirmResult?.success) return 0;
@@ -885,11 +893,15 @@ async function readCode(opts, deps) {
885
893
  function finishError(error, shop) {
886
894
  if (error.code === "INVALID_CODE") return {
887
895
  code: error.code,
888
- message: `${error.message}. Five wrong codes lock this sign-in; then run --send-code again.`
896
+ message: `${error.message}. If the code is right, the shop "${shop}" may be wrong, the address may not be an admin or rep there, or the company may sign in with an emailed link instead. If it does, pass that link to --code in place of the code. Five wrong codes lock this sign-in. If no code arrived, run --send-code again.`
889
897
  };
890
- if (error.code === "UUID_NOT_FOUND") return {
898
+ if (error.code === "SIGN_IN_UNFINISHED") return {
891
899
  code: error.code,
892
- message: `This sign-in can't be finished with a code: the shop "${shop}" is wrong, the address is not an admin or rep there, or the company signs in with an emailed link instead (pass that link to --code in place of the code). Check them and run --send-code again.`
900
+ message: `${error.message} (shop "${shop}"): run --send-code again.`
901
+ };
902
+ if (error.code === "CONTACT_MISSING") return {
903
+ code: error.code,
904
+ message: `${error.message}, then run --code again with the same code.`
893
905
  };
894
906
  return error;
895
907
  }
@@ -949,7 +961,8 @@ async function finishStep(opts, interactive, ui, deps) {
949
961
  if (![
950
962
  "INVALID_CODE",
951
963
  "RATE_LIMITED",
952
- "API_UNREACHABLE"
964
+ "API_UNREACHABLE",
965
+ "CONTACT_MISSING"
953
966
  ].includes(confirmed.error.code)) deps.pending.remove(email);
954
967
  return ui.fail(finishError(confirmed.error, shop), spinner);
955
968
  }