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

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 +84 -16
  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.1",
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.1",
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,23 +671347,80 @@ 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
671357
671372
  });
671358
671373
  }
671359
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
671383
+ });
671384
+ return await loginWithDeviceCodeFallback(context3, { connection: resolvedConnection });
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;
671423
+ }
671360
671424
 
671361
671425
  // ../login/lib/askToLogin.js
671362
671426
  async function askToLogin(context3) {
@@ -855433,6 +855497,7 @@ var ValidMarkdownLinks = {
855433
855497
  }
855434
855498
  }
855435
855499
  }
855500
+ const apiReferenceTitle = typeof config5.api === "string" ? config5.api : "API Reference";
855436
855501
  const pathToCheckViolations = await Promise.all([...uniquePathnames.values()].map(async (pathnameToCheck) => {
855437
855502
  const exists2 = await checkIfPathnameExists({
855438
855503
  pathname: pathnameToCheck.pathname,
@@ -855448,17 +855513,17 @@ var ValidMarkdownLinks = {
855448
855513
  if (exists2 === true) {
855449
855514
  return [];
855450
855515
  }
855451
- return exists2.map((brokenPathname) => {
855452
- const [message, relFilePath] = createLinkViolationMessage({
855516
+ const numBrokenSourceContexts = exists2.length > 0 ? exists2.length : 1;
855517
+ return Array.from({ length: numBrokenSourceContexts }, () => {
855518
+ const [message, relFilePath] = createApiReferenceLinkViolationMessage({
855453
855519
  pathnameToCheck,
855454
- targetPathname: brokenPathname,
855455
- absoluteFilepathToWorkspace: workspace.absoluteFilePath
855520
+ apiReferenceTitle
855456
855521
  });
855457
855522
  return {
855458
855523
  name: ValidMarkdownLinks.name,
855459
855524
  severity: "error",
855460
855525
  message,
855461
- relFilepath: relFilePath
855526
+ relativeFilepath: relFilePath
855462
855527
  };
855463
855528
  });
855464
855529
  }));
@@ -855483,6 +855548,10 @@ function createLinkViolationMessage({ pathnameToCheck, targetPathname, absoluteF
855483
855548
  fix here: ${relativeFilepath}:${position4.start.line}:${position4.start.column}`;
855484
855549
  return [msg, relativeFilepath];
855485
855550
  }
855551
+ function createApiReferenceLinkViolationMessage({ pathnameToCheck, apiReferenceTitle }) {
855552
+ const msg = `broken link to ${source_default.bold(pathnameToCheck.pathname)} in ${apiReferenceTitle} description`;
855553
+ return [msg, RelativeFilePath2.of("")];
855554
+ }
855486
855555
  function toLatest(apiDefinition) {
855487
855556
  const latest2 = api_definition_exports.ApiDefinitionV1ToLatest.from(apiDefinition).migrate();
855488
855557
  return latest2;
@@ -860230,7 +860299,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860230
860299
  var LOGS_FOLDER_NAME = "logs";
860231
860300
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860232
860301
  function getCliSource() {
860233
- const version7 = "5.37.12";
860302
+ const version7 = "5.38.1";
860234
860303
  return `cli@${version7}`;
860235
860304
  }
860236
860305
  var DebugLogger = class {
@@ -880831,7 +880900,7 @@ var LegacyDocsPublisher = class {
880831
880900
  previewId,
880832
880901
  disableTemplates: void 0,
880833
880902
  skipUpload,
880834
- cliVersion: "5.37.12",
880903
+ cliVersion: "5.38.1",
880835
880904
  loginCommand: "fern auth login"
880836
880905
  });
880837
880906
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -882152,7 +882221,6 @@ var Wizard = class {
882152
882221
  this.context.stderr.info(source_default.dim(" Skipping login. You can log in later with: fern auth login\n"));
882153
882222
  return void 0;
882154
882223
  }
882155
- this.context.stderr.info(` ${Icons.info} Opening browser to log in to Fern...`);
882156
882224
  const taskContext = new TaskContextAdapter({ context: this.context, logLevel: LogLevel.Info });
882157
882225
  const { accessToken, idToken } = await getTokenFromAuth0(taskContext, {
882158
882226
  useDeviceCodeFlow: false,
@@ -955752,7 +955820,7 @@ function getAutomationContextFromEnv() {
955752
955820
  config_branch: process.env.FERN_CONFIG_BRANCH,
955753
955821
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
955754
955822
  trigger: process.env.GITHUB_EVENT_NAME,
955755
- cli_version: "5.37.12"
955823
+ cli_version: "5.38.1"
955756
955824
  };
955757
955825
  }
955758
955826
  function isAutomationMode() {
@@ -956578,7 +956646,7 @@ var CliContext = class _CliContext {
956578
956646
  if (false) {
956579
956647
  this.logger.error("CLI_VERSION is not defined");
956580
956648
  }
956581
- return "5.37.12";
956649
+ return "5.38.1";
956582
956650
  }
956583
956651
  getCliName() {
956584
956652
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.37.12",
2
+ "version": "5.38.1",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",