@base44-preview/cli 0.0.50-pr.484.1c556f7 → 0.0.50-pr.484.2156b3d

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
@@ -242018,9 +242018,10 @@ var SSOSecretKey;
242018
242018
  SSOSecretKey2["JwksUri"] = "sso_jwks_uri";
242019
242019
  })(SSOSecretKey ||= {});
242020
242020
  var ALL_SSO_SECRET_KEYS = Object.values(SSOSecretKey);
242021
+ var DEFAULT_OIDC_SCOPE = "openid email profile";
242022
+ var DEFAULT_GITHUB_SCOPE = "user:email";
242021
242023
 
242022
242024
  // src/core/resources/auth-config/sso/providers/custom.ts
242023
- var DEFAULT_SCOPE = "openid email profile";
242024
242025
  var customProvider = {
242025
242026
  requiredKeys: [
242026
242027
  "sso_auth_endpoint" /* AuthEndpoint */,
@@ -242029,7 +242030,7 @@ var customProvider = {
242029
242030
  "sso_jwks_uri" /* JwksUri */
242030
242031
  ],
242031
242032
  defaults: {
242032
- ["sso_scope" /* Scope */]: DEFAULT_SCOPE
242033
+ ["sso_scope" /* Scope */]: DEFAULT_OIDC_SCOPE
242033
242034
  }
242034
242035
  };
242035
242036
 
@@ -242037,7 +242038,7 @@ var customProvider = {
242037
242038
  var githubProvider = {
242038
242039
  requiredKeys: [],
242039
242040
  defaults: {
242040
- ["sso_scope" /* Scope */]: "user:email",
242041
+ ["sso_scope" /* Scope */]: DEFAULT_GITHUB_SCOPE,
242041
242042
  ["sso_auth_endpoint" /* AuthEndpoint */]: "https://github.com/login/oauth/authorize",
242042
242043
  ["sso_token_endpoint" /* TokenEndpoint */]: "https://github.com/login/oauth/access_token",
242043
242044
  ["sso_userinfo_endpoint" /* UserinfoEndpoint */]: "https://api.github.com/user"
@@ -242045,21 +242046,19 @@ var githubProvider = {
242045
242046
  };
242046
242047
 
242047
242048
  // src/core/resources/auth-config/sso/providers/google.ts
242048
- var DEFAULT_SCOPE2 = "openid email profile";
242049
242049
  var googleProvider = {
242050
242050
  requiredKeys: [],
242051
242051
  defaults: {
242052
- ["sso_scope" /* Scope */]: DEFAULT_SCOPE2,
242052
+ ["sso_scope" /* Scope */]: DEFAULT_OIDC_SCOPE,
242053
242053
  ["sso_discovery_url" /* DiscoveryUrl */]: "https://accounts.google.com/.well-known/openid-configuration"
242054
242054
  }
242055
242055
  };
242056
242056
 
242057
242057
  // src/core/resources/auth-config/sso/providers/microsoft.ts
242058
- var DEFAULT_SCOPE3 = "openid email profile";
242059
242058
  var microsoftProvider = {
242060
242059
  requiredKeys: ["sso_tenant_id" /* TenantId */],
242061
242060
  defaults: {
242062
- ["sso_scope" /* Scope */]: DEFAULT_SCOPE3
242061
+ ["sso_scope" /* Scope */]: DEFAULT_OIDC_SCOPE
242063
242062
  },
242064
242063
  deriveDefaults: (secrets) => {
242065
242064
  const tenantId = secrets["sso_tenant_id" /* TenantId */];
@@ -242073,11 +242072,10 @@ var microsoftProvider = {
242073
242072
  };
242074
242073
 
242075
242074
  // src/core/resources/auth-config/sso/providers/okta.ts
242076
- var DEFAULT_SCOPE4 = "openid email profile";
242077
242075
  var oktaProvider = {
242078
242076
  requiredKeys: ["sso_okta_domain" /* OktaDomain */],
242079
242077
  defaults: {
242080
- ["sso_scope" /* Scope */]: DEFAULT_SCOPE4
242078
+ ["sso_scope" /* Scope */]: DEFAULT_OIDC_SCOPE
242081
242079
  },
242082
242080
  deriveDefaults: (secrets) => {
242083
242081
  const domain2 = secrets["sso_okta_domain" /* OktaDomain */];
@@ -251264,6 +251262,19 @@ function mergeFileWithFlags(fileConfig, options) {
251264
251262
  };
251265
251263
  }
251266
251264
  var providerNames = Object.keys(KNOWN_SSO_PROVIDERS);
251265
+ function secretKeyToFlag(key) {
251266
+ return `--${key.replace(/^sso_/, "").replace(/_/g, "-")}`;
251267
+ }
251268
+ function exampleCommand(provider) {
251269
+ let cmd = `base44 auth sso enable --provider ${provider} --client-id <id> --client-secret <secret>`;
251270
+ if (provider === KNOWN_SSO_PROVIDERS.microsoft)
251271
+ cmd += " --tenant-id <id>";
251272
+ if (provider === KNOWN_SSO_PROVIDERS.okta)
251273
+ cmd += " --okta-domain <domain>";
251274
+ if (provider === KNOWN_SSO_PROVIDERS.custom)
251275
+ cmd += " --sso-name <name> --auth-endpoint <url> --token-endpoint <url> --userinfo-endpoint <url> --jwks-uri <url>";
251276
+ return cmd;
251277
+ }
251267
251278
  function validateProvider(provider) {
251268
251279
  if (!provider) {
251269
251280
  throw new InvalidInputError("Missing --provider.", {
@@ -251275,12 +251286,9 @@ function validateProvider(provider) {
251275
251286
  ]
251276
251287
  });
251277
251288
  }
251278
- if (!(provider in KNOWN_SSO_PROVIDERS)) {
251279
- throw new InvalidInputError(`Unknown provider "${provider}". Valid providers: ${providerNames.join(", ")}`);
251280
- }
251281
251289
  return provider;
251282
251290
  }
251283
- async function ssoEnableAction({ isNonInteractive, log, runTask: runTask2 }, options) {
251291
+ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options) {
251284
251292
  let merged = options;
251285
251293
  if (options.file) {
251286
251294
  const fileConfig = await loadSSOConfigFile(options.file);
@@ -251340,7 +251348,23 @@ async function ssoEnableAction({ isNonInteractive, log, runTask: runTask2 }, opt
251340
251348
  jwksUri: merged.jwksUri,
251341
251349
  ssoName: merged.ssoName
251342
251350
  };
251343
- const secrets = buildSSOSecrets(provider, secretOptions);
251351
+ let secrets;
251352
+ try {
251353
+ secrets = buildSSOSecrets(provider, secretOptions);
251354
+ } catch (error48) {
251355
+ if (error48 instanceof InvalidInputError) {
251356
+ const flagMessage = error48.message.replace(/sso_[a-z_]+/g, (key) => secretKeyToFlag(key));
251357
+ throw new InvalidInputError(flagMessage, {
251358
+ hints: [
251359
+ {
251360
+ message: `Example: ${exampleCommand(provider)}`,
251361
+ command: exampleCommand(provider)
251362
+ }
251363
+ ]
251364
+ });
251365
+ }
251366
+ throw error48;
251367
+ }
251344
251368
  const { project: project2 } = await readProjectConfig();
251345
251369
  const configDir = dirname11(project2.configPath);
251346
251370
  const authDir = join16(configDir, project2.authDir);
@@ -251351,7 +251375,6 @@ async function ssoEnableAction({ isNonInteractive, log, runTask: runTask2 }, opt
251351
251375
  };
251352
251376
  }
251353
251377
  async function ssoDisableAction({
251354
- log,
251355
251378
  runTask: runTask2
251356
251379
  }) {
251357
251380
  const { project: project2 } = await readProjectConfig();
@@ -251373,7 +251396,7 @@ function getSSOCommand() {
251373
251396
  return new Base44Command("sso").description("Configure SSO identity provider (google, microsoft, github, okta, custom)").addArgument(new Argument("<action>", "enable or disable SSO").choices([
251374
251397
  "enable",
251375
251398
  "disable"
251376
- ])).option("--provider <provider>", "SSO provider: google, microsoft, github, okta, custom").option("--client-id <id>", "OAuth client ID").option("--client-secret <secret>", "OAuth client secret").option("--client-secret-stdin", "Read client secret from stdin").option("--env-file <path>", "Read client secret from a .env file (key: sso_client_secret)").option("--file <path>", "JSON config file with all SSO settings").option("--scope <scope>", "OAuth scope (defaults per provider)").option("--discovery-url <url>", "OIDC discovery URL").option("--tenant-id <id>", "Microsoft tenant ID (required for microsoft)").option("--okta-domain <domain>", "Okta domain (required for okta)").option("--auth-endpoint <url>", "Authorization endpoint (required for custom)").option("--token-endpoint <url>", "Token endpoint (required for custom)").option("--userinfo-endpoint <url>", "Userinfo endpoint (required for custom)").option("--jwks-uri <url>", "JWKS URI (required for custom)").option("--sso-name <name>", "Provider display name (required for custom)").action(ssoAction);
251399
+ ])).addOption(new Option("--provider <provider>", "SSO provider").choices(Object.values(KNOWN_SSO_PROVIDERS))).option("--client-id <id>", "OAuth client ID").option("--client-secret <secret>", "OAuth client secret").option("--client-secret-stdin", "Read client secret from stdin").option("--env-file <path>", "Read client secret from a .env file (key: sso_client_secret)").option("--file <path>", "JSON config file with all SSO settings").option("--scope <scope>", "OAuth scope (defaults per provider)").option("--discovery-url <url>", "OIDC discovery URL").option("--tenant-id <id>", "Microsoft tenant ID (required for microsoft)").option("--okta-domain <domain>", "Okta domain (required for okta)").option("--auth-endpoint <url>", "Authorization endpoint (required for custom)").option("--token-endpoint <url>", "Token endpoint (required for custom)").option("--userinfo-endpoint <url>", "Userinfo endpoint (required for custom)").option("--jwks-uri <url>", "JWKS URI (required for custom)").option("--sso-name <name>", "Provider display name (required for custom)").action(ssoAction);
251377
251400
  }
251378
251401
 
251379
251402
  // src/cli/commands/auth/index.ts
@@ -261008,4 +261031,4 @@ export {
261008
261031
  CLIExitError
261009
261032
  };
261010
261033
 
261011
- //# debugId=939FB46B90B442D864756E2164756E21
261034
+ //# debugId=CDE136D996499A7364756E2164756E21