@fern-api/fern-api-dev 5.37.12 → 5.38.0

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.
Files changed (2) hide show
  1. package/cli.cjs +74 -11
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -669322,7 +669322,7 @@ var AccessTokenPosthogManager = class {
669322
669322
  properties: {
669323
669323
  ...event,
669324
669324
  ...event.properties,
669325
- version: "5.37.12",
669325
+ version: "5.38.0",
669326
669326
  usingAccessToken: true,
669327
669327
  ...getRunIdProperties()
669328
669328
  }
@@ -669386,7 +669386,7 @@ var UserPosthogManager = class {
669386
669386
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
669387
669387
  event: "CLI",
669388
669388
  properties: {
669389
- version: "5.37.12",
669389
+ version: "5.38.0",
669390
669390
  ...event,
669391
669391
  ...event.properties,
669392
669392
  usingAccessToken: false,
@@ -670888,7 +670888,7 @@ function getAuth0BaseUrl(auth0Domain2) {
670888
670888
  const protocol2 = auth0Domain2.startsWith("localhost") ? "http" : "https";
670889
670889
  return `${protocol2}://${auth0Domain2}`;
670890
670890
  }
670891
- async function doAuth0DeviceAuthorizationFlow({ auth0Domain: auth0Domain2, auth0ClientId, audience, context: context3 }) {
670891
+ async function doAuth0DeviceAuthorizationFlow({ auth0Domain: auth0Domain2, auth0ClientId, audience, context: context3, connection }) {
670892
670892
  const deviceCodeResponse = await axios_default.request({
670893
670893
  method: "POST",
670894
670894
  url: `${getAuth0BaseUrl(auth0Domain2)}/oauth/device/code`,
@@ -670896,7 +670896,8 @@ async function doAuth0DeviceAuthorizationFlow({ auth0Domain: auth0Domain2, auth0
670896
670896
  data: import_qs9.default.stringify({
670897
670897
  client_id: auth0ClientId,
670898
670898
  audience,
670899
- scope: "openid profile email offline_access"
670899
+ scope: "openid profile email offline_access",
670900
+ ...connection != null ? { connection } : {}
670900
670901
  }),
670901
670902
  validateStatus: () => true
670902
670903
  });
@@ -671303,6 +671304,12 @@ var VENUS_AUDIENCE = "venus-dev";
671303
671304
  function getDashboardBaseUrl() {
671304
671305
  return process.env.FERN_DASHBOARD_URL ?? "https://dashboard-dev.buildwithfern.com" ?? "https://dashboard.buildwithfern.com";
671305
671306
  }
671307
+ var LOGIN_OPTIONS = [
671308
+ { label: "Continue with GitHub", connection: "github" },
671309
+ { label: "Continue with Google", connection: "google-oauth2" },
671310
+ { label: "Continue with Postman", connection: "postman" },
671311
+ { label: "Continue with SSO", connection: "enterprise-sso" }
671312
+ ];
671306
671313
 
671307
671314
  // ../login/lib/login.js
671308
671315
  async function login(context3, { useDeviceCodeFlow = false, email: email3 } = {}) {
@@ -671340,22 +671347,79 @@ async function getTokenFromAuth0(context3, { useDeviceCodeFlow, forceReauth = fa
671340
671347
  connection
671341
671348
  });
671342
671349
  }
671350
+ if (!forceReauth && process.stdout.isTTY && !await isLoggedIn()) {
671351
+ return await promptAndLogin(context3);
671352
+ }
671353
+ return await loginWithDeviceCodeFallback(context3, { forceReauth });
671354
+ }
671355
+ async function loginWithDeviceCodeFallback(context3, { forceReauth = false, connection } = {}) {
671343
671356
  try {
671344
671357
  return await doAuth0LoginFlow({
671345
671358
  context: context3,
671346
671359
  auth0Domain: AUTH0_DOMAIN,
671347
671360
  auth0ClientId: AUTH0_CLIENT_ID,
671348
671361
  audience: VENUS_AUDIENCE,
671349
- forceReauth
671362
+ forceReauth,
671363
+ connection
671350
671364
  });
671351
671365
  } catch {
671352
671366
  return await doAuth0DeviceAuthorizationFlow({
671353
671367
  auth0Domain: AUTH0_DOMAIN,
671354
671368
  auth0ClientId: AUTH0_CLIENT_ID,
671355
671369
  audience: VENUS_AUDIENCE,
671356
- context: context3
671370
+ context: context3,
671371
+ connection
671372
+ });
671373
+ }
671374
+ }
671375
+ async function promptAndLogin(context3) {
671376
+ const choices = LOGIN_OPTIONS.map((opt) => ({ name: opt.label, value: opt.connection }));
671377
+ const selectedConnection = await promptForConnection(context3, choices);
671378
+ if (selectedConnection === "enterprise-sso") {
671379
+ const ssoEmail = await promptForEmail(context3);
671380
+ const resolvedConnection = await resolveSsoConnection({
671381
+ dashboardBaseUrl: getDashboardBaseUrl(),
671382
+ email: ssoEmail
671357
671383
  });
671384
+ return await loginWithDeviceCodeFallback(context3, { connection: resolvedConnection });
671358
671385
  }
671386
+ return await loginWithDeviceCodeFallback(context3, { connection: selectedConnection });
671387
+ }
671388
+ async function promptForConnection(context3, choices) {
671389
+ let result = "";
671390
+ await context3.takeOverTerminal(async () => {
671391
+ const { connection } = await lib_default4.prompt([
671392
+ {
671393
+ type: "list",
671394
+ name: "connection",
671395
+ message: "How would you like to log in?",
671396
+ choices
671397
+ }
671398
+ ]);
671399
+ result = connection;
671400
+ });
671401
+ return result;
671402
+ }
671403
+ async function promptForEmail(context3) {
671404
+ let result = "";
671405
+ await context3.takeOverTerminal(async () => {
671406
+ const { email: email3 } = await lib_default4.prompt([
671407
+ {
671408
+ type: "input",
671409
+ name: "email",
671410
+ message: "Enter your email address:",
671411
+ validate: (input3) => {
671412
+ const trimmed2 = input3.trim();
671413
+ if (trimmed2.length === 0 || !trimmed2.includes("@")) {
671414
+ return "Please enter a valid email address.";
671415
+ }
671416
+ return true;
671417
+ }
671418
+ }
671419
+ ]);
671420
+ result = email3.trim();
671421
+ });
671422
+ return result;
671359
671423
  }
671360
671424
 
671361
671425
  // ../login/lib/askToLogin.js
@@ -860230,7 +860294,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860230
860294
  var LOGS_FOLDER_NAME = "logs";
860231
860295
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860232
860296
  function getCliSource() {
860233
- const version7 = "5.37.12";
860297
+ const version7 = "5.38.0";
860234
860298
  return `cli@${version7}`;
860235
860299
  }
860236
860300
  var DebugLogger = class {
@@ -880831,7 +880895,7 @@ var LegacyDocsPublisher = class {
880831
880895
  previewId,
880832
880896
  disableTemplates: void 0,
880833
880897
  skipUpload,
880834
- cliVersion: "5.37.12",
880898
+ cliVersion: "5.38.0",
880835
880899
  loginCommand: "fern auth login"
880836
880900
  });
880837
880901
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -882152,7 +882216,6 @@ var Wizard = class {
882152
882216
  this.context.stderr.info(source_default.dim(" Skipping login. You can log in later with: fern auth login\n"));
882153
882217
  return void 0;
882154
882218
  }
882155
- this.context.stderr.info(` ${Icons.info} Opening browser to log in to Fern...`);
882156
882219
  const taskContext = new TaskContextAdapter({ context: this.context, logLevel: LogLevel.Info });
882157
882220
  const { accessToken, idToken } = await getTokenFromAuth0(taskContext, {
882158
882221
  useDeviceCodeFlow: false,
@@ -955752,7 +955815,7 @@ function getAutomationContextFromEnv() {
955752
955815
  config_branch: process.env.FERN_CONFIG_BRANCH,
955753
955816
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
955754
955817
  trigger: process.env.GITHUB_EVENT_NAME,
955755
- cli_version: "5.37.12"
955818
+ cli_version: "5.38.0"
955756
955819
  };
955757
955820
  }
955758
955821
  function isAutomationMode() {
@@ -956578,7 +956641,7 @@ var CliContext = class _CliContext {
956578
956641
  if (false) {
956579
956642
  this.logger.error("CLI_VERSION is not defined");
956580
956643
  }
956581
- return "5.37.12";
956644
+ return "5.38.0";
956582
956645
  }
956583
956646
  getCliName() {
956584
956647
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.37.12",
2
+ "version": "5.38.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",