@base44-preview/cli 0.0.50-pr.484.8b296df → 0.0.50-pr.484.cb7ade7

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 */];
@@ -242099,6 +242097,15 @@ var SSO_PROVIDER_SCHEMAS = {
242099
242097
  custom: customProvider
242100
242098
  };
242101
242099
 
242100
+ // src/core/resources/auth-config/sso/types.ts
242101
+ var KNOWN_SSO_PROVIDERS = {
242102
+ google: "google",
242103
+ microsoft: "microsoft",
242104
+ github: "github",
242105
+ okta: "okta",
242106
+ custom: "custom"
242107
+ };
242108
+
242102
242109
  // src/core/resources/auth-config/sso/operations.ts
242103
242110
  var OPTION_TO_SECRET_KEY = {
242104
242111
  scope: "sso_scope" /* Scope */,
@@ -242157,7 +242164,7 @@ function buildSSOSecrets(provider, options) {
242157
242164
  missing.push(key);
242158
242165
  }
242159
242166
  }
242160
- if (provider === "custom" && !options.ssoName) {
242167
+ if (provider === KNOWN_SSO_PROVIDERS.custom && !options.ssoName) {
242161
242168
  missing.push("sso_name" /* Name */);
242162
242169
  }
242163
242170
  if (missing.length > 0) {
@@ -242171,14 +242178,6 @@ async function pushSSOSecrets(secrets) {
242171
242178
  async function deleteSSOSecrets() {
242172
242179
  await Promise.allSettled(ALL_SSO_SECRET_KEYS.map((key) => deleteSecret(key)));
242173
242180
  }
242174
- // src/core/resources/auth-config/sso/types.ts
242175
- var KNOWN_SSO_PROVIDERS = [
242176
- "google",
242177
- "microsoft",
242178
- "github",
242179
- "okta",
242180
- "custom"
242181
- ];
242182
242181
  // src/core/resources/connector/schema.ts
242183
242182
  var GoogleCalendarConnectorSchema = exports_external.object({
242184
242183
  type: exports_external.literal("googlecalendar"),
@@ -251262,23 +251261,34 @@ function mergeFileWithFlags(fileConfig, options) {
251262
251261
  ssoName: options.ssoName ?? fileConfig.ssoName
251263
251262
  };
251264
251263
  }
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
+ }
251265
251278
  function validateProvider(provider) {
251266
251279
  if (!provider) {
251267
251280
  throw new InvalidInputError("Missing --provider.", {
251268
251281
  hints: [
251269
251282
  {
251270
- message: `Valid providers: ${KNOWN_SSO_PROVIDERS.join(", ")}`,
251283
+ message: `Valid providers: ${providerNames.join(", ")}`,
251271
251284
  command: "base44 auth sso enable --provider <provider> --client-id <id> --client-secret <secret>"
251272
251285
  }
251273
251286
  ]
251274
251287
  });
251275
251288
  }
251276
- if (!KNOWN_SSO_PROVIDERS.includes(provider)) {
251277
- throw new InvalidInputError(`Unknown provider "${provider}". Valid providers: ${KNOWN_SSO_PROVIDERS.join(", ")}`);
251278
- }
251279
251289
  return provider;
251280
251290
  }
251281
- async function ssoEnableAction({ isNonInteractive, log, runTask: runTask2 }, options) {
251291
+ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options) {
251282
251292
  let merged = options;
251283
251293
  if (options.file) {
251284
251294
  const fileConfig = await loadSSOConfigFile(options.file);
@@ -251338,7 +251348,23 @@ async function ssoEnableAction({ isNonInteractive, log, runTask: runTask2 }, opt
251338
251348
  jwksUri: merged.jwksUri,
251339
251349
  ssoName: merged.ssoName
251340
251350
  };
251341
- 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
+ }
251342
251368
  const { project: project2 } = await readProjectConfig();
251343
251369
  const configDir = dirname11(project2.configPath);
251344
251370
  const authDir = join16(configDir, project2.authDir);
@@ -251349,7 +251375,6 @@ async function ssoEnableAction({ isNonInteractive, log, runTask: runTask2 }, opt
251349
251375
  };
251350
251376
  }
251351
251377
  async function ssoDisableAction({
251352
- log,
251353
251378
  runTask: runTask2
251354
251379
  }) {
251355
251380
  const { project: project2 } = await readProjectConfig();
@@ -251371,7 +251396,7 @@ function getSSOCommand() {
251371
251396
  return new Base44Command("sso").description("Configure SSO identity provider (google, microsoft, github, okta, custom)").addArgument(new Argument("<action>", "enable or disable SSO").choices([
251372
251397
  "enable",
251373
251398
  "disable"
251374
- ])).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);
251375
251400
  }
251376
251401
 
251377
251402
  // src/cli/commands/auth/index.ts
@@ -261006,4 +261031,4 @@ export {
261006
261031
  CLIExitError
261007
261032
  };
261008
261033
 
261009
- //# debugId=2639C9D09C44A37C64756E2164756E21
261034
+ //# debugId=CDE136D996499A7364756E2164756E21