@base44-preview/cli 0.0.48-pr.445.4fa436f → 0.0.49-pr.445.2022753

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
@@ -243201,7 +243201,7 @@ import { join as join9 } from "node:path";
243201
243201
  // package.json
243202
243202
  var package_default = {
243203
243203
  name: "base44",
243204
- version: "0.0.48",
243204
+ version: "0.0.49",
243205
243205
  description: "Base44 CLI - Unified interface for managing Base44 applications",
243206
243206
  type: "module",
243207
243207
  bin: {
@@ -250717,24 +250717,7 @@ function getAgentsCommand() {
250717
250717
 
250718
250718
  // src/cli/commands/auth/password-login.ts
250719
250719
  import { dirname as dirname8, join as join13 } from "node:path";
250720
- function validateAction(action) {
250721
- if (action !== "enable" && action !== "disable") {
250722
- throw new InvalidInputError(`Invalid action "${action}". Must be "enable" or "disable".`, {
250723
- hints: [
250724
- {
250725
- message: "Enable password auth: base44 auth password-login enable",
250726
- command: "base44 auth password-login enable"
250727
- },
250728
- {
250729
- message: "Disable password auth: base44 auth password-login disable",
250730
- command: "base44 auth password-login disable"
250731
- }
250732
- ]
250733
- });
250734
- }
250735
- }
250736
250720
  async function passwordLoginAction({ log }, action) {
250737
- validateAction(action);
250738
250721
  const shouldEnable = action === "enable";
250739
250722
  const { project: project2 } = await readProjectConfig();
250740
250723
  const configDir = dirname8(project2.configPath);
@@ -250754,7 +250737,7 @@ async function passwordLoginAction({ log }, action) {
250754
250737
  };
250755
250738
  }
250756
250739
  function getPasswordLoginCommand() {
250757
- return new Base44Command("password-login").description("Enable or disable username & password authentication").argument("<enable|disable>", "enable or disable password authentication").action(passwordLoginAction);
250740
+ return new Base44Command("password-login").description("Enable or disable username & password authentication").addArgument(new Argument("<action>", "enable or disable password authentication").choices(["enable", "disable"])).action(passwordLoginAction);
250758
250741
  }
250759
250742
 
250760
250743
  // src/cli/commands/auth/pull.ts
@@ -250828,72 +250811,59 @@ function getAuthPushCommand() {
250828
250811
  // src/cli/commands/auth/social-login.ts
250829
250812
  import { dirname as dirname10, join as join15 } from "node:path";
250830
250813
  var SOCIAL_PROVIDERS = {
250831
- google: { field: "enableGoogleLogin", label: "Google" },
250814
+ google: {
250815
+ field: "enableGoogleLogin",
250816
+ label: "Google",
250817
+ customOAuth: {
250818
+ modeField: "googleOAuthMode",
250819
+ clientIdField: "googleOAuthClientId",
250820
+ secretKey: "google_oauth_client_secret",
250821
+ envVar: "BASE44_GOOGLE_OAUTH_CLIENT_SECRET",
250822
+ promptMessage: "Enter Google OAuth client secret"
250823
+ }
250824
+ },
250832
250825
  microsoft: { field: "enableMicrosoftLogin", label: "Microsoft" },
250833
250826
  facebook: { field: "enableFacebookLogin", label: "Facebook" },
250834
250827
  apple: { field: "enableAppleLogin", label: "Apple" }
250835
250828
  };
250836
250829
  var VALID_PROVIDERS = Object.keys(SOCIAL_PROVIDERS);
250837
- function validateProvider(provider) {
250838
- if (!(provider in SOCIAL_PROVIDERS)) {
250839
- throw new InvalidInputError(`Invalid provider "${provider}". Must be one of: ${VALID_PROVIDERS.join(", ")}.`, {
250840
- hints: VALID_PROVIDERS.map((p) => ({
250841
- message: `Enable ${SOCIAL_PROVIDERS[p].label} login: base44 auth social-login ${p} enable`,
250842
- command: `base44 auth social-login ${p} enable`
250843
- }))
250844
- });
250845
- }
250846
- }
250847
- function validateAction2(action) {
250848
- if (action !== "enable" && action !== "disable") {
250849
- throw new InvalidInputError(`Invalid action "${action}". Must be "enable" or "disable".`, {
250850
- hints: [
250851
- {
250852
- message: "Enable social login: base44 auth social-login <provider> enable",
250853
- command: "base44 auth social-login <provider> enable"
250854
- },
250855
- {
250856
- message: "Disable social login: base44 auth social-login <provider> disable",
250857
- command: "base44 auth social-login <provider> disable"
250858
- }
250859
- ]
250860
- });
250861
- }
250830
+ function hasCustomOAuthOptions(options) {
250831
+ return Boolean(options.clientId || options.clientSecret || options.clientSecretStdin);
250862
250832
  }
250863
250833
  async function socialLoginAction({ log, isNonInteractive }, provider, action, options) {
250864
- validateProvider(provider);
250865
- validateAction2(action);
250866
250834
  const shouldEnable = action === "enable";
250867
250835
  const providerInfo = SOCIAL_PROVIDERS[provider];
250868
- const hasCustomOAuth = Boolean(options.clientId);
250836
+ const hasOAuthOptions = hasCustomOAuthOptions(options);
250837
+ if (hasOAuthOptions && !providerInfo.customOAuth) {
250838
+ throw new InvalidInputError(`Custom OAuth options are only supported for providers with custom OAuth (e.g., google). Use: base44 auth social-login ${provider} ${action}`);
250839
+ }
250840
+ if (hasOAuthOptions && !shouldEnable) {
250841
+ throw new InvalidInputError(`Custom OAuth options cannot be used with disable. To disable ${providerInfo.label} login: base44 auth social-login ${provider} disable`);
250842
+ }
250869
250843
  const { project: project2 } = await readProjectConfig();
250870
250844
  const configDir = dirname10(project2.configPath);
250871
250845
  const authDir = join15(configDir, project2.authDir);
250872
- if (provider !== "google" && (options.clientId || options.clientSecret || options.clientSecretStdin)) {
250873
- throw new InvalidInputError(`Custom OAuth options are only supported for Google. Use: base44 auth social-login ${provider} ${action}`);
250874
- }
250875
- if (provider === "google" && !shouldEnable && hasCustomOAuth) {
250876
- throw new InvalidInputError("Custom OAuth options cannot be used with disable. To disable Google login: base44 auth social-login google disable");
250877
- }
250846
+ const useCustomOAuth = shouldEnable && hasOAuthOptions && providerInfo.customOAuth;
250878
250847
  let clientSecret;
250879
- if (provider === "google" && shouldEnable && hasCustomOAuth) {
250848
+ if (useCustomOAuth) {
250849
+ const oauth = providerInfo.customOAuth;
250880
250850
  clientSecret = await resolveSecret({
250881
250851
  flagValue: options.clientSecret,
250882
250852
  fromStdin: options.clientSecretStdin,
250883
- envVar: "BASE44_GOOGLE_CLIENT_SECRET",
250884
- promptMessage: "Enter Google OAuth client secret",
250853
+ envVar: oauth.envVar,
250854
+ promptMessage: oauth.promptMessage,
250885
250855
  isNonInteractive,
250886
250856
  name: "client secret",
250887
250857
  hints: [
250888
250858
  {
250889
- message: "Provide via flag: base44 auth social-login google enable --client-id <id> --client-secret <secret>",
250890
- command: "base44 auth social-login google enable --client-id <id> --client-secret <secret>"
250859
+ message: `Provide via flag: base44 auth social-login ${provider} enable --client-id <id> --client-secret <secret>`,
250860
+ command: `base44 auth social-login ${provider} enable --client-id <id> --client-secret <secret>`
250891
250861
  },
250892
250862
  {
250893
- message: "Provide via stdin: echo <secret> | base44 auth social-login google enable --client-id <id> --client-secret-stdin"
250863
+ message: `Provide via stdin: echo <secret> | base44 auth social-login ${provider} enable --client-id <id> --client-secret-stdin`
250894
250864
  },
250895
250865
  {
250896
- message: "Provide via env: BASE44_GOOGLE_CLIENT_SECRET=<secret> base44 auth social-login google enable --client-id <id>"
250866
+ message: `Provide via env: ${oauth.envVar}=<secret> base44 auth social-login ${provider} enable --client-id <id>`
250897
250867
  }
250898
250868
  ]
250899
250869
  });
@@ -250904,38 +250874,40 @@ async function socialLoginAction({ log, isNonInteractive }, provider, action, op
250904
250874
  ...current,
250905
250875
  [providerInfo.field]: shouldEnable
250906
250876
  };
250907
- if (provider === "google" && shouldEnable) {
250908
- if (hasCustomOAuth) {
250909
- merged.googleOAuthMode = "custom";
250910
- merged.googleOAuthClientId = options.clientId;
250877
+ if (providerInfo.customOAuth) {
250878
+ const oauth = providerInfo.customOAuth;
250879
+ if (useCustomOAuth) {
250880
+ merged[oauth.modeField] = "custom";
250881
+ merged[oauth.clientIdField] = options.clientId;
250911
250882
  } else {
250912
- merged.googleOAuthMode = "default";
250913
- merged.googleOAuthClientId = null;
250883
+ merged[oauth.modeField] = "default";
250884
+ merged[oauth.clientIdField] = null;
250914
250885
  }
250915
250886
  }
250916
- if (provider === "google" && !shouldEnable) {
250917
- merged.googleOAuthMode = "default";
250918
- merged.googleOAuthClientId = null;
250919
- }
250920
250887
  await writeAuthConfig(authDir, merged);
250921
250888
  return merged;
250922
250889
  });
250923
- if (clientSecret) {
250890
+ if (clientSecret && providerInfo.customOAuth) {
250924
250891
  await runTask("Saving client secret", async () => {
250925
- await setSecrets({ google_oauth_client_secret: clientSecret });
250892
+ await setSecrets({
250893
+ [providerInfo.customOAuth.secretKey]: clientSecret
250894
+ });
250926
250895
  });
250927
250896
  }
250928
250897
  if (!shouldEnable && !hasAnyLoginMethod(updated)) {
250929
250898
  log.warn(`Disabling ${providerInfo.label} login will leave no login methods enabled. Users will be locked out.`);
250930
250899
  }
250931
250900
  const newStatus = shouldEnable ? "enabled" : "disabled";
250932
- const oauthNote = provider === "google" && shouldEnable && hasCustomOAuth ? " with custom OAuth" : "";
250901
+ const oauthNote = useCustomOAuth ? " with custom OAuth" : "";
250933
250902
  return {
250934
250903
  outroMessage: `${providerInfo.label} login ${newStatus}${oauthNote} in local config. Run \`base44 auth push\` or \`base44 deploy\` to apply.`
250935
250904
  };
250936
250905
  }
250937
250906
  function getSocialLoginCommand() {
250938
- return new Base44Command("social-login").description("Enable or disable social login providers (google, microsoft, facebook, apple)").argument("<provider>", "social login provider (google, microsoft, facebook, apple)").argument("<enable|disable>", "enable or disable the provider").option("--client-id <id>", "Google OAuth client ID (enables custom OAuth mode)").option("--client-secret <secret>", "Google OAuth client secret").option("--client-secret-stdin", "Read client secret from stdin").action(socialLoginAction);
250907
+ return new Base44Command("social-login").description("Enable or disable social login providers (google, microsoft, facebook, apple)").addArgument(new Argument("<provider>", "social login provider").choices(VALID_PROVIDERS)).addArgument(new Argument("<action>", "enable or disable the provider").choices([
250908
+ "enable",
250909
+ "disable"
250910
+ ])).option("--client-id <id>", "custom OAuth client ID (supported providers: google)").option("--client-secret <secret>", "custom OAuth client secret").option("--client-secret-stdin", "Read client secret from stdin").action(socialLoginAction);
250939
250911
  }
250940
250912
 
250941
250913
  // src/cli/commands/auth/index.ts
@@ -256091,7 +256063,7 @@ function createProgram(context) {
256091
256063
  program2.addCommand(getConnectorsCommand());
256092
256064
  program2.addCommand(getFunctionsCommand());
256093
256065
  program2.addCommand(getSecretsCommand());
256094
- program2.addCommand(getAuthCommand(), { hidden: true });
256066
+ program2.addCommand(getAuthCommand());
256095
256067
  program2.addCommand(getSiteCommand());
256096
256068
  program2.addCommand(getTypesCommand());
256097
256069
  program2.addCommand(getExecCommand());
@@ -260340,4 +260312,4 @@ export {
260340
260312
  CLIExitError
260341
260313
  };
260342
260314
 
260343
- //# debugId=598E133C9D56418664756E2164756E21
260315
+ //# debugId=BD7CF0B997F9C7CF64756E2164756E21