@base44-preview/cli 0.0.45-pr.422.0f6b58f → 0.0.45-pr.422.d49cf05

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/cli/index.js CHANGED
@@ -141617,12 +141617,12 @@ var require_linker = __commonJS((exports) => {
141617
141617
  var require_optionValidator = __commonJS((exports) => {
141618
141618
  Object.defineProperty(exports, "__esModule", { value: true });
141619
141619
  exports.validateOptions = undefined;
141620
- function validateOptions2({ maxItems }) {
141620
+ function validateOptions3({ maxItems }) {
141621
141621
  if (maxItems !== undefined && maxItems < -1) {
141622
141622
  throw RangeError(`Expected options.maxItems to be >= -1, but was given ${maxItems}.`);
141623
141623
  }
141624
141624
  }
141625
- exports.validateOptions = validateOptions2;
141625
+ exports.validateOptions = validateOptions3;
141626
141626
  });
141627
141627
 
141628
141628
  // ../../node_modules/json-schema-to-typescript/dist/src/index.js
@@ -246897,20 +246897,38 @@ async function updatePasswordAuth(enable) {
246897
246897
  return await updateAuthConfig({ enableUsernamePassword: enable });
246898
246898
  }
246899
246899
  // src/cli/commands/auth/password-login.ts
246900
- async function passwordLoginAction() {
246901
- const current = await runTask("Fetching current auth config", async () => await getAuthConfig());
246902
- const currentStatus = current.enableUsernamePassword ? "enabled" : "disabled";
246903
- R2.info(`Username & password authentication is currently ${currentStatus}.`);
246904
- const shouldEnable = await Re({
246905
- message: "Enable username & password authentication?",
246906
- initialValue: current.enableUsernamePassword
246907
- });
246908
- if (Ct(shouldEnable)) {
246909
- throw new CLIExitError(0);
246900
+ function validateOptions2(options) {
246901
+ const errors5 = [];
246902
+ if (!options.enable && !options.disable) {
246903
+ errors5.push("Missing required flag: specify --enable or --disable");
246904
+ }
246905
+ if (options.enable && options.disable) {
246906
+ errors5.push("Conflicting flags: --enable and --disable cannot be used together");
246910
246907
  }
246908
+ if (errors5.length > 0) {
246909
+ throw new InvalidInputError(errors5.join(`
246910
+ `), {
246911
+ hints: [
246912
+ {
246913
+ message: "Enable password auth: base44 auth password-login --enable",
246914
+ command: "base44 auth password-login --enable"
246915
+ },
246916
+ {
246917
+ message: "Disable password auth: base44 auth password-login --disable",
246918
+ command: "base44 auth password-login --disable"
246919
+ }
246920
+ ]
246921
+ });
246922
+ }
246923
+ }
246924
+ async function passwordLoginAction(options) {
246925
+ validateOptions2(options);
246926
+ const shouldEnable = !!options.enable;
246927
+ const current = await runTask("Fetching current auth config", async () => await getAuthConfig());
246911
246928
  if (shouldEnable === current.enableUsernamePassword) {
246929
+ const status = shouldEnable ? "enabled" : "disabled";
246912
246930
  return {
246913
- outroMessage: `Username & password authentication is already ${currentStatus}`
246931
+ outroMessage: `Username & password authentication is already ${status}`
246914
246932
  };
246915
246933
  }
246916
246934
  if (!shouldEnable) {
@@ -246920,13 +246938,6 @@ async function passwordLoginAction() {
246920
246938
  };
246921
246939
  if (!hasAnyLoginMethod(configWithoutPassword)) {
246922
246940
  R2.warn("Disabling password auth will leave no login methods enabled. Users will be locked out.");
246923
- const proceed = await Re({
246924
- message: "Are you sure you want to continue?",
246925
- initialValue: false
246926
- });
246927
- if (Ct(proceed) || !proceed) {
246928
- throw new CLIExitError(0);
246929
- }
246930
246941
  }
246931
246942
  }
246932
246943
  const action = shouldEnable ? "Enabling" : "Disabling";
@@ -246937,8 +246948,8 @@ async function passwordLoginAction() {
246937
246948
  };
246938
246949
  }
246939
246950
  function getPasswordLoginCommand(context) {
246940
- return new Command("password-login").description("Enable or disable username & password authentication").action(async () => {
246941
- await runCommand(passwordLoginAction, { requireAuth: true }, context);
246951
+ return new Command("password-login").description("Enable or disable username & password authentication").option("--enable", "Enable password authentication").option("--disable", "Disable password authentication").action(async (options) => {
246952
+ await runCommand(() => passwordLoginAction(options), { requireAuth: true }, context);
246942
246953
  });
246943
246954
  }
246944
246955
 
@@ -256096,4 +256107,4 @@ export {
256096
256107
  CLIExitError
256097
256108
  };
256098
256109
 
256099
- //# debugId=7653CD16B4DE4AF964756E2164756E21
256110
+ //# debugId=FD70C1725704242064756E2164756E21