@fern-api/fern-api-dev 5.65.1 → 5.65.3

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 +54 -43
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -460376,6 +460376,7 @@ var init_DocsDefinitionResolver = __esm({
460376
460376
  registerApi;
460377
460377
  targetAudiences;
460378
460378
  buildTranslatedApiDefinitions;
460379
+ markdownFilesToPathName = {};
460379
460380
  constructor({ domain: domain3, docsWorkspace, ossWorkspaces, apiWorkspaces, taskContext, editThisPage, uploadFiles: uploadFiles2 = defaultUploadFiles, registerApi: registerApi2 = defaultRegisterApi, targetAudiences, buildTranslatedApiDefinitions = false }) {
460380
460381
  this.domain = domain3;
460381
460382
  this.docsWorkspace = docsWorkspace;
@@ -460503,6 +460504,14 @@ var init_DocsDefinitionResolver = __esm({
460503
460504
  getTranslatedApiSpecs() {
460504
460505
  return this.translatedApiSpecs;
460505
460506
  }
460507
+ /**
460508
+ * Returns the map of absolute file paths to their fully qualified slug pathnames.
460509
+ * Used by translation processing to resolve relative .md/.mdx links.
460510
+ * Must be called after `resolve()`.
460511
+ */
460512
+ getMarkdownFilesToPathName() {
460513
+ return this.markdownFilesToPathName;
460514
+ }
460506
460515
  getDocsTranslationsConfig() {
460507
460516
  const translations = this.parsedDocsConfig.translations;
460508
460517
  if (translations == null || translations.length === 0) {
@@ -460678,6 +460687,7 @@ var init_DocsDefinitionResolver = __esm({
460678
460687
  this.taskContext.logger.debug("Getting fully qualified path names...");
460679
460688
  const pathNameStart = performance.now();
460680
460689
  const markdownFilesToPathName = await this.getMarkdownFilesToFullyQualifiedPathNames(root6);
460690
+ this.markdownFilesToPathName = markdownFilesToPathName;
460681
460691
  const pathNameTime = performance.now() - pathNameStart;
460682
460692
  this.taskContext.logger.debug(`Got path names in ${pathNameTime.toFixed(0)}ms`);
460683
460693
  if (this.pendingApiRegistrations.length > 0) {
@@ -590253,6 +590263,7 @@ __export(buildTranslatedDocsDefinition_exports, {
590253
590263
  async function buildTranslatedDocsDefinition({ docsDefinition, locale, localePages, translationNavigationOverlays, resolver: resolver2, context: context3 }) {
590254
590264
  const collectedFileIds = resolver2.getCollectedFileIds();
590255
590265
  const docsWorkspacePath = resolver2.getDocsWorkspacePath();
590266
+ const markdownFilesToPathName = resolver2.getMarkdownFilesToPathName();
590256
590267
  const resolveLocalePath = async (filepath) => {
590257
590268
  const relPath = relative4(docsWorkspacePath, filepath);
590258
590269
  const translatedPath = resolve6(docsWorkspacePath, RelativeFilePath2.of(`translations/${locale}/${relPath}`));
@@ -590292,7 +590303,7 @@ async function buildTranslatedDocsDefinition({ docsDefinition, locale, localePag
590292
590303
  absolutePathToMarkdownFile
590293
590304
  });
590294
590305
  let processedMarkdown = stripMdxComments(importsResolved);
590295
- processedMarkdown = replaceImagePathsAndUrls(processedMarkdown, collectedFileIds, {}, {
590306
+ processedMarkdown = replaceImagePathsAndUrls(processedMarkdown, collectedFileIds, markdownFilesToPathName, {
590296
590307
  absolutePathToMarkdownFile,
590297
590308
  absolutePathToFernFolder: docsWorkspacePath
590298
590309
  }, context3);
@@ -688404,7 +688415,7 @@ var AccessTokenPosthogManager = class {
688404
688415
  properties: {
688405
688416
  ...event,
688406
688417
  ...event.properties,
688407
- version: "5.65.1",
688418
+ version: "5.65.3",
688408
688419
  usingAccessToken: true,
688409
688420
  ...getRunIdProperties()
688410
688421
  }
@@ -688470,7 +688481,7 @@ var UserPosthogManager = class {
688470
688481
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
688471
688482
  event: "CLI",
688472
688483
  properties: {
688473
- version: "5.65.1",
688484
+ version: "5.65.3",
688474
688485
  ...event,
688475
688486
  ...event.properties,
688476
688487
  usingAccessToken: false,
@@ -869566,7 +869577,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
869566
869577
  var LOGS_FOLDER_NAME = "logs";
869567
869578
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
869568
869579
  function getCliSource() {
869569
- const version7 = "5.65.1";
869580
+ const version7 = "5.65.3";
869570
869581
  return `cli@${version7}`;
869571
869582
  }
869572
869583
  var DebugLogger = class {
@@ -872445,6 +872456,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
872445
872456
  translationNavigationOverlays: previousPreviewResult.translationNavigationOverlays,
872446
872457
  collectedFileIds: previousPreviewResult.collectedFileIds,
872447
872458
  docsWorkspacePath: previousPreviewResult.docsWorkspacePath,
872459
+ markdownFilesToPathName: previousPreviewResult.markdownFilesToPathName,
872448
872460
  translatedApiDefinitions: previousPreviewResult.translatedApiDefinitions
872449
872461
  };
872450
872462
  }
@@ -872518,6 +872530,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
872518
872530
  const translationPages = resolver2.getTranslationPages();
872519
872531
  const translationNavigationOverlays = resolver2.getTranslationNavigationOverlays();
872520
872532
  const collectedFileIds = resolver2.getCollectedFileIds();
872533
+ const markdownFilesToPathName = resolver2.getMarkdownFilesToPathName();
872521
872534
  const translatedApiSpecs = resolver2.getTranslatedApiSpecs();
872522
872535
  let translatedApiDefinitions;
872523
872536
  if (translatedApiSpecs.size > 0) {
@@ -872545,6 +872558,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
872545
872558
  translationNavigationOverlays,
872546
872559
  collectedFileIds,
872547
872560
  docsWorkspacePath: docsWorkspace.absoluteFilePath,
872561
+ markdownFilesToPathName,
872548
872562
  translatedApiDefinitions
872549
872563
  };
872550
872564
  }
@@ -873190,7 +873204,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
873190
873204
  const RELOAD_DEBOUNCE_MS = 500;
873191
873205
  async function computeTranslatedDefinitions(result) {
873192
873206
  const translations = /* @__PURE__ */ new Map();
873193
- const { docsDefinition, translationPages, translationNavigationOverlays, translatedApiDefinitions, collectedFileIds, docsWorkspacePath } = result;
873207
+ const { docsDefinition, translationPages, translationNavigationOverlays, translatedApiDefinitions, collectedFileIds, docsWorkspacePath, markdownFilesToPathName } = result;
873194
873208
  const hasTranslatedPages = translationPages != null && Object.keys(translationPages).length > 0;
873195
873209
  const hasTranslatedApis = translatedApiDefinitions != null && Object.keys(translatedApiDefinitions).length > 0;
873196
873210
  if (!hasTranslatedPages && !hasTranslatedApis) {
@@ -873252,17 +873266,10 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
873252
873266
  absolutePathToMarkdownFile
873253
873267
  });
873254
873268
  let processedMarkdown = stripMdxComments(importsResolved);
873255
- processedMarkdown = replaceImagePathsAndUrls(
873256
- processedMarkdown,
873257
- collectedFileIds,
873258
- {},
873259
- // markdownFilesToPathName not needed for translations
873260
- {
873261
- absolutePathToMarkdownFile,
873262
- absolutePathToFernFolder: docsWorkspacePath
873263
- },
873264
- context3
873265
- );
873269
+ processedMarkdown = replaceImagePathsAndUrls(processedMarkdown, collectedFileIds, markdownFilesToPathName, {
873270
+ absolutePathToMarkdownFile,
873271
+ absolutePathToFernFolder: docsWorkspacePath
873272
+ }, context3);
873266
873273
  translatedPages[pagePath] = {
873267
873274
  markdown: processedMarkdown,
873268
873275
  rawMarkdown: processedMarkdown,
@@ -873827,7 +873834,7 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
873827
873834
  const RELOAD_DEBOUNCE_MS = 1e3;
873828
873835
  async function computeTranslatedDefinitions(result) {
873829
873836
  const translations = /* @__PURE__ */ new Map();
873830
- const { docsDefinition, translationPages, translationNavigationOverlays, collectedFileIds, docsWorkspacePath } = result;
873837
+ const { docsDefinition, translationPages, translationNavigationOverlays, collectedFileIds, docsWorkspacePath, markdownFilesToPathName } = result;
873831
873838
  if (translationPages == null || Object.keys(translationPages).length === 0) {
873832
873839
  return translations;
873833
873840
  }
@@ -873882,17 +873889,10 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
873882
873889
  absolutePathToMarkdownFile
873883
873890
  });
873884
873891
  let processedMarkdown = stripMdxComments(importsResolved);
873885
- processedMarkdown = replaceImagePathsAndUrls(
873886
- processedMarkdown,
873887
- collectedFileIds,
873888
- {},
873889
- // markdownFilesToPathName not needed for translations
873890
- {
873891
- absolutePathToMarkdownFile,
873892
- absolutePathToFernFolder: docsWorkspacePath
873893
- },
873894
- context3
873895
- );
873892
+ processedMarkdown = replaceImagePathsAndUrls(processedMarkdown, collectedFileIds, markdownFilesToPathName, {
873893
+ absolutePathToMarkdownFile,
873894
+ absolutePathToFernFolder: docsWorkspacePath
873895
+ }, context3);
873896
873896
  translatedPages[pagePath] = {
873897
873897
  markdown: processedMarkdown,
873898
873898
  rawMarkdown: processedMarkdown,
@@ -900760,6 +900760,22 @@ function sanitizePreviewId2(id) {
900760
900760
  }
900761
900761
  return sanitized;
900762
900762
  }
900763
+ function formatLedgerError(error50) {
900764
+ if (error50 == null) {
900765
+ return "Unknown error";
900766
+ }
900767
+ const msg = error50 instanceof Error ? error50.message : String(error50);
900768
+ const data2 = error50.data;
900769
+ if (data2?.issues != null && Array.isArray(data2.issues) && data2.issues.length > 0) {
900770
+ const issueLines = data2.issues.map((issue2) => {
900771
+ const path119 = issue2.path?.join(".") ?? "";
900772
+ const message = issue2.message ?? "invalid";
900773
+ return path119 ? ` - ${path119}: ${message}` : ` - ${message}`;
900774
+ }).join("\n");
900775
+ return msg + "\n" + issueLines;
900776
+ }
900777
+ return msg;
900778
+ }
900763
900779
  var DocsPublishConflictError = class extends Error {
900764
900780
  constructor() {
900765
900781
  super("Another docs publish is currently in progress for this domain.");
@@ -901227,7 +901243,8 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
901227
901243
  try {
901228
901244
  await runLedgerPublish();
901229
901245
  } catch (error50) {
901230
- return context3.failAndThrow("Failed to publish docs via ledger to " + domain3, error50, {
901246
+ const detail = formatLedgerError(error50);
901247
+ return context3.failAndThrow("Failed to publish docs via ledger to " + domain3 + ": " + detail, error50, {
901231
901248
  code: CliError.Code.NetworkError
901232
901249
  });
901233
901250
  }
@@ -901270,6 +901287,7 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
901270
901287
  try {
901271
901288
  const collectedFileIds = resolver2.getCollectedFileIds();
901272
901289
  const docsWorkspacePath = resolver2.getDocsWorkspacePath();
901290
+ const markdownFilesToPathName = resolver2.getMarkdownFilesToPathName();
901273
901291
  const resolveLocalePath = async (filepath) => {
901274
901292
  const relPath = relative4(docsWorkspacePath, filepath);
901275
901293
  const translatedPath = resolve6(docsWorkspacePath, RelativeFilePath2.of(`translations/${locale}/${relPath}`));
@@ -901309,17 +901327,10 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
901309
901327
  absolutePathToMarkdownFile
901310
901328
  });
901311
901329
  let processedMarkdown = stripMdxComments(importsResolved);
901312
- processedMarkdown = replaceImagePathsAndUrls(
901313
- processedMarkdown,
901314
- collectedFileIds,
901315
- {},
901316
- // markdownFilesToPathName not needed for translations
901317
- {
901318
- absolutePathToMarkdownFile,
901319
- absolutePathToFernFolder: docsWorkspacePath
901320
- },
901321
- context3
901322
- );
901330
+ processedMarkdown = replaceImagePathsAndUrls(processedMarkdown, collectedFileIds, markdownFilesToPathName, {
901331
+ absolutePathToMarkdownFile,
901332
+ absolutePathToFernFolder: docsWorkspacePath
901333
+ }, context3);
901323
901334
  let editThisPageUrl = basePage?.editThisPageUrl;
901324
901335
  if (editThisPageUrl != null) {
901325
901336
  const fernPathPattern = `/fern/${path119}`;
@@ -902128,7 +902139,7 @@ var LegacyDocsPublisher = class {
902128
902139
  previewId,
902129
902140
  disableTemplates: void 0,
902130
902141
  skipUpload,
902131
- cliVersion: "5.65.1",
902142
+ cliVersion: "5.65.3",
902132
902143
  loginCommand: "fern auth login"
902133
902144
  });
902134
902145
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -968462,7 +968473,7 @@ function getAutomationContextFromEnv() {
968462
968473
  config_branch: process.env.FERN_CONFIG_BRANCH,
968463
968474
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
968464
968475
  trigger: process.env.GITHUB_EVENT_NAME,
968465
- cli_version: "5.65.1"
968476
+ cli_version: "5.65.3"
968466
968477
  };
968467
968478
  }
968468
968479
  function isAutomationMode() {
@@ -969294,7 +969305,7 @@ var CliContext = class _CliContext {
969294
969305
  if (false) {
969295
969306
  this.logger.error("CLI_VERSION is not defined");
969296
969307
  }
969297
- return "5.65.1";
969308
+ return "5.65.3";
969298
969309
  }
969299
969310
  getCliName() {
969300
969311
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.65.1",
2
+ "version": "5.65.3",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",