@fern-api/fern-api-dev 4.103.1 → 4.104.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 +104 -30
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -510181,6 +510181,7 @@ __export(DocsYmlSchemas_exports, {
510181
510181
  ThemeConfig: () => ThemeConfig,
510182
510182
  TitleSource: () => TitleSource,
510183
510183
  TranslationConfig: () => TranslationConfig,
510184
+ TranslationConfigObject: () => TranslationConfigObject,
510184
510185
  TwitterCardSetting: () => TwitterCardSetting,
510185
510186
  UntabbedNavigationConfig: () => UntabbedNavigationConfig,
510186
510187
  VersionAvailability: () => VersionAvailability,
@@ -510189,7 +510190,8 @@ __export(DocsYmlSchemas_exports, {
510189
510190
  VersionedSnippetLanguageConfiguration: () => VersionedSnippetLanguageConfiguration,
510190
510191
  WithFeatureFlags: () => WithFeatureFlags,
510191
510192
  WithPermissions: () => WithPermissions,
510192
- WithViewers: () => WithViewers
510193
+ WithViewers: () => WithViewers,
510194
+ normalizeTranslationConfig: () => normalizeTranslationConfig
510193
510195
  });
510194
510196
  var TabId = external_exports.string();
510195
510197
  var ChangelogFolderRelativePath = external_exports.string();
@@ -510853,10 +510855,17 @@ var ProductFileConfig = external_exports.object({
510853
510855
  "landing-page": PageConfiguration.optional(),
510854
510856
  navigation: NavigationConfig
510855
510857
  });
510856
- var TranslationConfig = external_exports.object({
510858
+ var TranslationConfigObject = external_exports.object({
510857
510859
  lang: Language,
510858
510860
  default: external_exports.boolean().optional()
510859
510861
  });
510862
+ var TranslationConfig = external_exports.union([Language, TranslationConfigObject]);
510863
+ function normalizeTranslationConfig(config5) {
510864
+ if (typeof config5 === "string") {
510865
+ return { lang: config5 };
510866
+ }
510867
+ return config5;
510868
+ }
510860
510869
  var DocsConfiguration = external_exports.object({
510861
510870
  instances: external_exports.array(DocsInstance),
510862
510871
  title: external_exports.string().optional(),
@@ -510879,7 +510888,8 @@ var DocsConfiguration = external_exports.object({
510879
510888
  if (translations == null) {
510880
510889
  return;
510881
510890
  }
510882
- const defaultCount = translations.filter((t3) => t3.default === true).length;
510891
+ const normalizedTranslations = translations.map(normalizeTranslationConfig);
510892
+ const defaultCount = normalizedTranslations.filter((t3) => t3.default === true).length;
510883
510893
  if (defaultCount > 1) {
510884
510894
  ctx.addIssue({
510885
510895
  code: external_exports.ZodIssueCode.custom,
@@ -511311,7 +511321,8 @@ var FernDocsConfigError = class extends Error {
511311
511321
  statusCode;
511312
511322
  body;
511313
511323
  rawResponse;
511314
- constructor({ message, statusCode, body, rawResponse }) {
511324
+ cause;
511325
+ constructor({ message, statusCode, body, rawResponse, cause }) {
511315
511326
  super(buildMessage2({ message, statusCode, body }));
511316
511327
  Object.setPrototypeOf(this, new.target.prototype);
511317
511328
  if (Error.captureStackTrace) {
@@ -511321,6 +511332,9 @@ var FernDocsConfigError = class extends Error {
511321
511332
  this.statusCode = statusCode;
511322
511333
  this.body = body;
511323
511334
  this.rawResponse = rawResponse;
511335
+ if (cause != null) {
511336
+ this.cause = cause;
511337
+ }
511324
511338
  }
511325
511339
  };
511326
511340
  function buildMessage2({ message, statusCode, body }) {
@@ -511339,13 +511353,17 @@ function buildMessage2({ message, statusCode, body }) {
511339
511353
 
511340
511354
  // ../configuration/lib/docs-yml/schemas/sdk/errors/FernDocsConfigTimeoutError.js
511341
511355
  var FernDocsConfigTimeoutError = class extends Error {
511342
- constructor(message) {
511356
+ cause;
511357
+ constructor(message, opts) {
511343
511358
  super(message);
511344
511359
  Object.setPrototypeOf(this, new.target.prototype);
511345
511360
  if (Error.captureStackTrace) {
511346
511361
  Error.captureStackTrace(this, this.constructor);
511347
511362
  }
511348
511363
  this.name = this.constructor.name;
511364
+ if (opts?.cause != null) {
511365
+ this.cause = opts.cause;
511366
+ }
511349
511367
  }
511350
511368
  };
511351
511369
 
@@ -511619,6 +511637,7 @@ __export(serialization_exports3, {
511619
511637
  ThemeConfig: () => ThemeConfig2,
511620
511638
  TitleSource: () => TitleSource3,
511621
511639
  TranslationConfig: () => TranslationConfig2,
511640
+ TranslationConfigObject: () => TranslationConfigObject2,
511622
511641
  TwitterCardSetting: () => TwitterCardSetting3,
511623
511642
  UntabbedNavigationConfig: () => UntabbedNavigationConfig2,
511624
511643
  VersionAvailability: () => VersionAvailability3,
@@ -511772,6 +511791,7 @@ __export(docs_exports2, {
511772
511791
  ThemeConfig: () => ThemeConfig2,
511773
511792
  TitleSource: () => TitleSource3,
511774
511793
  TranslationConfig: () => TranslationConfig2,
511794
+ TranslationConfigObject: () => TranslationConfigObject2,
511775
511795
  TwitterCardSetting: () => TwitterCardSetting3,
511776
511796
  UntabbedNavigationConfig: () => UntabbedNavigationConfig2,
511777
511797
  VersionAvailability: () => VersionAvailability3,
@@ -511808,6 +511828,7 @@ __export(schemas_exports6, {
511808
511828
  object: () => object4,
511809
511829
  objectWithoutOptionalProperties: () => objectWithoutOptionalProperties3,
511810
511830
  optional: () => optional4,
511831
+ partialRecord: () => partialRecord2,
511811
511832
  property: () => property4,
511812
511833
  record: () => record4,
511813
511834
  set: () => set6,
@@ -511906,22 +511927,24 @@ function stringifyValidationError3(error50) {
511906
511927
  }
511907
511928
 
511908
511929
  // ../configuration/lib/docs-yml/schemas/sdk/core/schemas/builders/schema-utils/JsonError.js
511909
- var JsonError3 = class _JsonError extends Error {
511930
+ var JsonError3 = class extends Error {
511910
511931
  errors;
511911
511932
  constructor(errors4) {
511912
511933
  super(errors4.map(stringifyValidationError3).join("; "));
511913
511934
  this.errors = errors4;
511914
- Object.setPrototypeOf(this, _JsonError.prototype);
511935
+ Object.setPrototypeOf(this, new.target.prototype);
511936
+ this.name = this.constructor.name;
511915
511937
  }
511916
511938
  };
511917
511939
 
511918
511940
  // ../configuration/lib/docs-yml/schemas/sdk/core/schemas/builders/schema-utils/ParseError.js
511919
- var ParseError3 = class _ParseError extends Error {
511941
+ var ParseError3 = class extends Error {
511920
511942
  errors;
511921
511943
  constructor(errors4) {
511922
511944
  super(errors4.map(stringifyValidationError3).join("; "));
511923
511945
  this.errors = errors4;
511924
- Object.setPrototypeOf(this, _ParseError.prototype);
511946
+ Object.setPrototypeOf(this, new.target.prototype);
511947
+ this.name = this.constructor.name;
511925
511948
  }
511926
511949
  };
511927
511950
 
@@ -512947,6 +512970,45 @@ function record4(keySchema, valueSchema) {
512947
512970
  ...getSchemaUtils3(baseSchema)
512948
512971
  };
512949
512972
  }
512973
+ function partialRecord2(keySchema, valueSchema) {
512974
+ const baseSchema = {
512975
+ parse: (raw, opts) => {
512976
+ return validateAndTransformRecord3({
512977
+ value: raw,
512978
+ isKeyNumeric: keySchema.getType() === SchemaType3.NUMBER,
512979
+ transformKey: (key2) => keySchema.parse(key2, {
512980
+ ...opts,
512981
+ breadcrumbsPrefix: [...opts?.breadcrumbsPrefix ?? [], `${key2} (key)`]
512982
+ }),
512983
+ transformValue: (value2, key2) => valueSchema.parse(value2, {
512984
+ ...opts,
512985
+ breadcrumbsPrefix: [...opts?.breadcrumbsPrefix ?? [], `${key2}`]
512986
+ }),
512987
+ breadcrumbsPrefix: opts?.breadcrumbsPrefix
512988
+ });
512989
+ },
512990
+ json: (parsed, opts) => {
512991
+ return validateAndTransformRecord3({
512992
+ value: parsed,
512993
+ isKeyNumeric: keySchema.getType() === SchemaType3.NUMBER,
512994
+ transformKey: (key2) => keySchema.json(key2, {
512995
+ ...opts,
512996
+ breadcrumbsPrefix: [...opts?.breadcrumbsPrefix ?? [], `${key2} (key)`]
512997
+ }),
512998
+ transformValue: (value2, key2) => valueSchema.json(value2, {
512999
+ ...opts,
513000
+ breadcrumbsPrefix: [...opts?.breadcrumbsPrefix ?? [], `${key2}`]
513001
+ }),
513002
+ breadcrumbsPrefix: opts?.breadcrumbsPrefix
513003
+ });
513004
+ },
513005
+ getType: () => SchemaType3.RECORD
513006
+ };
513007
+ return {
513008
+ ...maybeSkipValidation3(baseSchema),
513009
+ ...getSchemaUtils3(baseSchema)
513010
+ };
513011
+ }
512950
513012
  function validateAndTransformRecord3({ value: value2, isKeyNumeric, transformKey, transformValue, breadcrumbsPrefix = [] }) {
512951
513013
  if (!isPlainObject10(value2)) {
512952
513014
  return {
@@ -514121,12 +514183,15 @@ var ThemeConfig2 = schemas_exports6.object({
514121
514183
  productSwitcher: schemas_exports6.property("product-switcher", ProductSwitcherThemeConfig3.optional())
514122
514184
  });
514123
514185
 
514124
- // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/TranslationConfig.js
514125
- var TranslationConfig2 = schemas_exports6.object({
514186
+ // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/TranslationConfigObject.js
514187
+ var TranslationConfigObject2 = schemas_exports6.object({
514126
514188
  lang: Language3,
514127
514189
  default: schemas_exports6.boolean().optional()
514128
514190
  });
514129
514191
 
514192
+ // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/TranslationConfig.js
514193
+ var TranslationConfig2 = schemas_exports6.undiscriminatedUnion([Language3, TranslationConfigObject2]);
514194
+
514130
514195
  // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/DocsConfiguration.js
514131
514196
  var DocsConfiguration2 = schemas_exports6.object({
514132
514197
  instances: schemas_exports6.list(DocsInstance2),
@@ -541924,7 +541989,7 @@ async function parseDocsConfiguration({ rawDocsConfiguration, absolutePathToFern
541924
541989
  rawPath: agents?.llmsFullTxt,
541925
541990
  absoluteFilepathToDocsConfig
541926
541991
  });
541927
- const defaultLocale = rawDocsConfiguration.translations?.find((t3) => t3.default === true)?.lang ?? rawDocsConfiguration.translations?.[0]?.lang;
541992
+ const defaultLocale = rawDocsConfiguration.translations?.map((t3) => docs_yml_exports.DocsYmlSchemas.normalizeTranslationConfig(t3)).find((t3) => t3.default === true)?.lang ?? (rawDocsConfiguration.translations?.[0] != null ? docs_yml_exports.DocsYmlSchemas.normalizeTranslationConfig(rawDocsConfiguration.translations[0]).lang : void 0);
541928
541993
  const translationPagesPromise = pagesPromise.then((resolvedPages) => loadTranslationPages({
541929
541994
  translations: rawDocsConfiguration.translations,
541930
541995
  defaultLocale,
@@ -542018,12 +542083,7 @@ async function parseDocsConfiguration({ rawDocsConfiguration, absolutePathToFern
542018
542083
  heap: void 0
542019
542084
  },
542020
542085
  /* integrations */
542021
- integrations: {
542022
- ...integrations,
542023
- // context7 is handled separately via context7File (resolved to AbsoluteFilePath)
542024
- context7: void 0,
542025
- intercom: integrations?.intercom ? integrations.intercom : void 0
542026
- },
542086
+ integrations: integrations != null ? { intercom: integrations.intercom ?? void 0 } : void 0,
542027
542087
  /* scripts */
542028
542088
  css,
542029
542089
  js: js7,
@@ -543197,7 +543257,8 @@ async function loadTranslationPages({ translations, defaultLocale, pages, absolu
543197
543257
  }
543198
543258
  const translationsRootDir = import_path22.default.join(absolutePathToFernFolder, "translations");
543199
543259
  const result = {};
543200
- await Promise.all(translations.map(async ({ lang }) => {
543260
+ const normalizedTranslations = translations.map((t3) => docs_yml_exports.DocsYmlSchemas.normalizeTranslationConfig(t3));
543261
+ await Promise.all(normalizedTranslations.map(async ({ lang }) => {
543201
543262
  if (lang === defaultLocale) {
543202
543263
  return;
543203
543264
  }
@@ -620917,7 +620978,7 @@ var AccessTokenPosthogManager = class {
620917
620978
  properties: {
620918
620979
  ...event,
620919
620980
  ...event.properties,
620920
- version: "4.103.1",
620981
+ version: "4.104.0",
620921
620982
  usingAccessToken: true
620922
620983
  }
620923
620984
  });
@@ -620971,7 +621032,7 @@ var UserPosthogManager = class {
620971
621032
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
620972
621033
  event: "CLI",
620973
621034
  properties: {
620974
- version: "4.103.1",
621035
+ version: "4.104.0",
620975
621036
  ...event,
620976
621037
  ...event.properties,
620977
621038
  usingAccessToken: false,
@@ -798491,13 +798552,14 @@ var DocsDefinitionResolver = class {
798491
798552
  if (translations == null || translations.length === 0) {
798492
798553
  return void 0;
798493
798554
  }
798494
- const defaultTranslation = translations.find((translation) => translation.default === true) ?? translations[0];
798555
+ const normalizedTranslations = translations.map((t3) => docs_yml_exports.DocsYmlSchemas.normalizeTranslationConfig(t3));
798556
+ const defaultTranslation = normalizedTranslations.find((translation) => translation.default === true) ?? normalizedTranslations[0];
798495
798557
  if (defaultTranslation == null) {
798496
798558
  return void 0;
798497
798559
  }
798498
798560
  return {
798499
798561
  defaultLocale: defaultTranslation.lang,
798500
- translations: translations.map((translation) => translation.lang)
798562
+ translations: normalizedTranslations.map((translation) => translation.lang)
798501
798563
  };
798502
798564
  }
798503
798565
  collectedFileIds = /* @__PURE__ */ new Map();
@@ -806085,11 +806147,12 @@ var TranslationDirectoriesExistRule = {
806085
806147
  if (translations == null || translations.length === 0) {
806086
806148
  return violations;
806087
806149
  }
806088
- const defaultLocale = (translations.find((t3) => t3.default === true) ?? translations[0])?.lang;
806150
+ const normalizedTranslations = translations.map((t3) => docs_yml_exports.DocsYmlSchemas.normalizeTranslationConfig(t3));
806151
+ const defaultLocale = (normalizedTranslations.find((t3) => t3.default === true) ?? normalizedTranslations[0])?.lang;
806089
806152
  const translationsDir = join8(workspace.absoluteFilePath, RelativeFilePath2.of("translations"));
806090
806153
  const translationsDirExists = await doesPathExist(translationsDir);
806091
806154
  const missingDirs = [];
806092
- for (const translation of translations) {
806155
+ for (const translation of normalizedTranslations) {
806093
806156
  if (translation.lang === defaultLocale) {
806094
806157
  continue;
806095
806158
  }
@@ -832265,7 +832328,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
832265
832328
  var LOGS_FOLDER_NAME = "logs";
832266
832329
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
832267
832330
  function getCliSource() {
832268
- const version7 = "4.103.1";
832331
+ const version7 = "4.104.0";
832269
832332
  return `cli@${version7}`;
832270
832333
  }
832271
832334
  var DebugLogger = class {
@@ -840270,7 +840333,7 @@ var definitions6 = {
840270
840333
  "tr"
840271
840334
  ]
840272
840335
  },
840273
- "docs.TranslationConfig": {
840336
+ "docs.TranslationConfigObject": {
840274
840337
  type: "object",
840275
840338
  properties: {
840276
840339
  lang: {
@@ -840292,6 +840355,16 @@ var definitions6 = {
840292
840355
  ],
840293
840356
  additionalProperties: false
840294
840357
  },
840358
+ "docs.TranslationConfig": {
840359
+ anyOf: [
840360
+ {
840361
+ $ref: "#/definitions/docs.Language"
840362
+ },
840363
+ {
840364
+ $ref: "#/definitions/docs.TranslationConfigObject"
840365
+ }
840366
+ ]
840367
+ },
840295
840368
  "docs.AIChatModel": {
840296
840369
  type: "string",
840297
840370
  enum: [
@@ -843913,7 +843986,8 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
843913
843986
  root: updatedRoot
843914
843987
  }
843915
843988
  };
843916
- context3.logger.info(`Sending translation for locale "${locale}": pages=${JSON.stringify(Object.keys(localePages))}`);
843989
+ const pageCount2 = Object.keys(localePages).length;
843990
+ context3.logger.debug(`Sending translation for locale "${locale}" (${pageCount2} page${pageCount2 === 1 ? "" : "s"})`);
843917
843991
  const translationResponse = await fetch(`${fdrOrigin}/v2/registry/docs/translations/register`, {
843918
843992
  method: "POST",
843919
843993
  headers: {
@@ -844621,7 +844695,7 @@ var LegacyDocsPublisher = class {
844621
844695
  previewId,
844622
844696
  disableTemplates: void 0,
844623
844697
  skipUpload,
844624
- cliVersion: "4.103.1",
844698
+ cliVersion: "4.104.0",
844625
844699
  loginCommand: "fern auth login"
844626
844700
  });
844627
844701
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -918712,7 +918786,7 @@ var CliContext = class _CliContext {
918712
918786
  if (false) {
918713
918787
  this.logger.error("CLI_VERSION is not defined");
918714
918788
  }
918715
- return "4.103.1";
918789
+ return "4.104.0";
918716
918790
  }
918717
918791
  getCliName() {
918718
918792
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.103.1",
2
+ "version": "4.104.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",