@fern-api/fern-api-dev 5.37.11 → 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 +93 -19
  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.11",
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.11",
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
@@ -832855,7 +832919,7 @@ function urlMatchesInstanceHost(url3, instanceUrls) {
832855
832919
  init_js();
832856
832920
  function buildPageIdToSlugMap2(root6) {
832857
832921
  const collector = navigation_exports.NodeCollector.collect(root6);
832858
- const pageIdToSlug = /* @__PURE__ */ new Map();
832922
+ const pageIdToSlugs = /* @__PURE__ */ new Map();
832859
832923
  for (const entry of collector.getSlugMapWithParents().values()) {
832860
832924
  const { node: node4, parents } = entry;
832861
832925
  if (!navigation_exports.isPage(node4)) {
@@ -832872,9 +832936,14 @@ function buildPageIdToSlugMap2(root6) {
832872
832936
  slug = changelogParent.canonicalSlug ?? changelogParent.slug;
832873
832937
  }
832874
832938
  }
832875
- pageIdToSlug.set(pageId, slug);
832939
+ const existing = pageIdToSlugs.get(pageId);
832940
+ if (existing != null) {
832941
+ existing.add(slug);
832942
+ } else {
832943
+ pageIdToSlugs.set(pageId, /* @__PURE__ */ new Set([slug]));
832944
+ }
832876
832945
  }
832877
- return pageIdToSlug;
832946
+ return pageIdToSlugs;
832878
832947
  }
832879
832948
 
832880
832949
  // ../../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist.es2015/index.js
@@ -833290,20 +833359,26 @@ function isSlugCoveredByRedirect(oldSlug, redirects, basePath) {
833290
833359
  return matchPath(source2, oldPath);
833291
833360
  });
833292
833361
  }
833293
- function findRemovedSlugs(publishedEntries, localPageIdToSlug) {
833294
- const activeSlugs = new Set(localPageIdToSlug.values());
833362
+ function findRemovedSlugs(publishedEntries, localPageIdToSlugs) {
833363
+ const activeSlugs = /* @__PURE__ */ new Set();
833364
+ for (const slugs of localPageIdToSlugs.values()) {
833365
+ for (const slug of slugs) {
833366
+ activeSlugs.add(slug);
833367
+ }
833368
+ }
833295
833369
  const removed = [];
833296
833370
  for (const publishedEntry of publishedEntries) {
833297
- const newSlug = localPageIdToSlug.get(publishedEntry.pageId);
833298
- if (newSlug === void 0) {
833371
+ const localSlugs = localPageIdToSlugs.get(publishedEntry.pageId);
833372
+ if (localSlugs == null) {
833299
833373
  if (activeSlugs.has(publishedEntry.slug)) {
833300
833374
  continue;
833301
833375
  }
833302
833376
  removed.push({ pageId: publishedEntry.pageId, oldSlug: publishedEntry.slug, newSlug: void 0 });
833303
- } else if (newSlug !== publishedEntry.slug) {
833377
+ } else if (!localSlugs.has(publishedEntry.slug)) {
833304
833378
  if (activeSlugs.has(publishedEntry.slug)) {
833305
833379
  continue;
833306
833380
  }
833381
+ const newSlug = localSlugs.values().next().value;
833307
833382
  removed.push({ pageId: publishedEntry.pageId, oldSlug: publishedEntry.slug, newSlug });
833308
833383
  }
833309
833384
  }
@@ -860219,7 +860294,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860219
860294
  var LOGS_FOLDER_NAME = "logs";
860220
860295
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860221
860296
  function getCliSource() {
860222
- const version7 = "5.37.11";
860297
+ const version7 = "5.38.0";
860223
860298
  return `cli@${version7}`;
860224
860299
  }
860225
860300
  var DebugLogger = class {
@@ -880820,7 +880895,7 @@ var LegacyDocsPublisher = class {
880820
880895
  previewId,
880821
880896
  disableTemplates: void 0,
880822
880897
  skipUpload,
880823
- cliVersion: "5.37.11",
880898
+ cliVersion: "5.38.0",
880824
880899
  loginCommand: "fern auth login"
880825
880900
  });
880826
880901
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -882141,7 +882216,6 @@ var Wizard = class {
882141
882216
  this.context.stderr.info(source_default.dim(" Skipping login. You can log in later with: fern auth login\n"));
882142
882217
  return void 0;
882143
882218
  }
882144
- this.context.stderr.info(` ${Icons.info} Opening browser to log in to Fern...`);
882145
882219
  const taskContext = new TaskContextAdapter({ context: this.context, logLevel: LogLevel.Info });
882146
882220
  const { accessToken, idToken } = await getTokenFromAuth0(taskContext, {
882147
882221
  useDeviceCodeFlow: false,
@@ -955741,7 +955815,7 @@ function getAutomationContextFromEnv() {
955741
955815
  config_branch: process.env.FERN_CONFIG_BRANCH,
955742
955816
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
955743
955817
  trigger: process.env.GITHUB_EVENT_NAME,
955744
- cli_version: "5.37.11"
955818
+ cli_version: "5.38.0"
955745
955819
  };
955746
955820
  }
955747
955821
  function isAutomationMode() {
@@ -956567,7 +956641,7 @@ var CliContext = class _CliContext {
956567
956641
  if (false) {
956568
956642
  this.logger.error("CLI_VERSION is not defined");
956569
956643
  }
956570
- return "5.37.11";
956644
+ return "5.38.0";
956571
956645
  }
956572
956646
  getCliName() {
956573
956647
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.37.11",
2
+ "version": "5.38.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",