@fern-api/fern-api-dev 5.2.0 → 5.2.1-5-geb7105beec4

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 +59 -33
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -544029,11 +544029,14 @@ async function loadTranslationNavigationOverlays({ translations, defaultLocale,
544029
544029
  if (lang === defaultLocale) {
544030
544030
  return;
544031
544031
  }
544032
- const langFernDir = import_path22.default.join(translationsRootDir, lang, "fern");
544033
- const overlayDocsYmlPath = import_path22.default.join(langFernDir, "docs.yml");
544034
- if (!await doesPathExist(overlayDocsYmlPath)) {
544032
+ const overlayLookup = await resolveTranslationOverlayDocsYml({
544033
+ translationsRootDir,
544034
+ lang
544035
+ });
544036
+ if (overlayLookup == null) {
544035
544037
  return;
544036
544038
  }
544039
+ const { overlayDocsYmlPath, overlayDir } = overlayLookup;
544037
544040
  try {
544038
544041
  const overlayContent = jsYaml.load(await (0, import_promises14.readFile)(overlayDocsYmlPath, "utf-8"));
544039
544042
  if (!isPlainObject4(overlayContent)) {
@@ -544042,7 +544045,7 @@ async function loadTranslationNavigationOverlays({ translations, defaultLocale,
544042
544045
  }
544043
544046
  const overlay = await parseNavigationOverlayFromDocsYml({
544044
544047
  docsYmlContent: overlayContent,
544045
- langFernDir,
544048
+ langFernDir: overlayDir,
544046
544049
  context: context3
544047
544050
  });
544048
544051
  result[lang] = overlay;
@@ -544055,6 +544058,19 @@ async function loadTranslationNavigationOverlays({ translations, defaultLocale,
544055
544058
  }
544056
544059
  return result;
544057
544060
  }
544061
+ async function resolveTranslationOverlayDocsYml({ translationsRootDir, lang }) {
544062
+ const langDir = import_path22.default.join(translationsRootDir, lang);
544063
+ const directDocsYmlPath = import_path22.default.join(langDir, "docs.yml");
544064
+ if (await doesPathExist(directDocsYmlPath)) {
544065
+ return { overlayDocsYmlPath: directDocsYmlPath, overlayDir: langDir };
544066
+ }
544067
+ const legacyFernDir = import_path22.default.join(langDir, "fern");
544068
+ const legacyDocsYmlPath = import_path22.default.join(legacyFernDir, "docs.yml");
544069
+ if (await doesPathExist(legacyDocsYmlPath)) {
544070
+ return { overlayDocsYmlPath: legacyDocsYmlPath, overlayDir: legacyFernDir };
544071
+ }
544072
+ return void 0;
544073
+ }
544058
544074
  function extractString(obj, key2) {
544059
544075
  if (isPlainObject4(obj)) {
544060
544076
  const value2 = obj[key2];
@@ -544064,7 +544080,7 @@ function extractString(obj, key2) {
544064
544080
  }
544065
544081
  return void 0;
544066
544082
  }
544067
- async function parseNavigationOverlayFromDocsYml({ docsYmlContent, langFernDir, context: context3 }) {
544083
+ async function parseNavigationOverlayFromDocsYml({ docsYmlContent, langFernDir: overlayDir, context: context3 }) {
544068
544084
  const overlay = {
544069
544085
  tabs: void 0,
544070
544086
  products: void 0,
@@ -544103,8 +544119,8 @@ async function parseNavigationOverlayFromDocsYml({ docsYmlContent, langFernDir,
544103
544119
  }
544104
544120
  }
544105
544121
  if (typeof productObj.path === "string") {
544106
- const resolvedNavFilePath = import_path22.default.resolve(langFernDir, productObj.path);
544107
- if (!resolvedNavFilePath.startsWith(langFernDir)) {
544122
+ const resolvedNavFilePath = import_path22.default.resolve(overlayDir, productObj.path);
544123
+ if (!resolvedNavFilePath.startsWith(overlayDir)) {
544108
544124
  context3.logger.warn(`Invalid path in product overlay: "${productObj.path}" escapes the translations directory. Skipping.`);
544109
544125
  overlay.products.push(productOverlay);
544110
544126
  continue;
@@ -552506,10 +552522,11 @@ function convertSchemeReference({ reference: reference4, authSchemeDeclarations,
552506
552522
  if (declaration == null) {
552507
552523
  throw new Error("Unknown auth scheme: " + reference5);
552508
552524
  }
552525
+ const effectiveDocs = docs2 ?? (typeof declaration === "object" ? declaration.docs : void 0);
552509
552526
  return visitRawAuthSchemeDeclaration(declaration, {
552510
552527
  header: (rawHeader) => AuthScheme.header({
552511
552528
  key: reference5,
552512
- docs: docs2,
552529
+ docs: effectiveDocs,
552513
552530
  name: casingsGenerator.generateNameAndWireValue({
552514
552531
  name: rawHeader.name ?? reference5,
552515
552532
  wireValue: rawHeader.header
@@ -552525,27 +552542,27 @@ function convertSchemeReference({ reference: reference4, authSchemeDeclarations,
552525
552542
  basic: (rawScheme) => generateBasicAuth({
552526
552543
  key: reference5,
552527
552544
  casingsGenerator,
552528
- docs: docs2,
552545
+ docs: effectiveDocs,
552529
552546
  rawScheme
552530
552547
  }),
552531
552548
  tokenBearer: (rawScheme) => generateBearerAuth({
552532
552549
  key: reference5,
552533
552550
  casingsGenerator,
552534
- docs: docs2,
552551
+ docs: effectiveDocs,
552535
552552
  rawScheme
552536
552553
  }),
552537
552554
  inferredBearer(authScheme) {
552538
552555
  return generateBearerAuth({
552539
552556
  key: reference5,
552540
552557
  casingsGenerator,
552541
- docs: docs2,
552558
+ docs: effectiveDocs,
552542
552559
  rawScheme: void 0
552543
552560
  });
552544
552561
  },
552545
552562
  oauth: (rawScheme) => generateBearerAuth({
552546
552563
  key: reference5,
552547
552564
  casingsGenerator,
552548
- docs: docs2,
552565
+ docs: effectiveDocs,
552549
552566
  rawScheme: void 0
552550
552567
  })
552551
552568
  });
@@ -611131,19 +611148,12 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
611131
611148
  }
611132
611149
  }
611133
611150
  convertSecuritySchemes() {
611151
+ const openApiSchemes = this.convertOpenApiSecuritySchemes();
611134
611152
  if (this.context.authOverrides) {
611135
- const overrideAuth = convertApiAuth({
611136
- rawApiFileSchema: this.context.authOverrides,
611137
- casingsGenerator: this.context.casingsGenerator
611138
- });
611139
- this.addAuthToIR({
611140
- requirement: overrideAuth.requirement,
611141
- schemes: overrideAuth.schemes,
611142
- docs: overrideAuth.docs
611143
- });
611153
+ const descriptions = new Map(openApiSchemes.map((scheme) => [scheme.key, scheme.docs]));
611154
+ this.convertAuthOverrides(descriptions, this.context.authOverrides);
611144
611155
  return;
611145
611156
  }
611146
- const openApiSchemes = this.convertOpenApiSecuritySchemes();
611147
611157
  if (openApiSchemes.length > 0) {
611148
611158
  this.addAuthToIR({
611149
611159
  requirement: openApiSchemes.length === 1 ? "ALL" : "ANY",
@@ -611152,6 +611162,26 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
611152
611162
  });
611153
611163
  }
611154
611164
  }
611165
+ convertAuthOverrides(descriptions, authOverrides) {
611166
+ const enriched = {
611167
+ ...authOverrides,
611168
+ "auth-schemes": Object.fromEntries(Object.entries(authOverrides["auth-schemes"] ?? {}).map(([id2, scheme]) => [id2, { ...scheme }]))
611169
+ };
611170
+ for (const [schemeId, scheme] of Object.entries(enriched["auth-schemes"])) {
611171
+ if (!scheme.docs && descriptions.has(schemeId)) {
611172
+ scheme.docs = descriptions.get(schemeId);
611173
+ }
611174
+ }
611175
+ const auth8 = convertApiAuth({
611176
+ rawApiFileSchema: enriched,
611177
+ casingsGenerator: this.context.casingsGenerator
611178
+ });
611179
+ this.addAuthToIR({
611180
+ requirement: auth8.requirement,
611181
+ schemes: auth8.schemes,
611182
+ docs: auth8.docs
611183
+ });
611184
+ }
611155
611185
  convertOpenApiSecuritySchemes() {
611156
611186
  const securitySchemes = [];
611157
611187
  for (const [id2, securityScheme] of Object.entries(this.context.spec.components?.securitySchemes ?? {})) {
@@ -611322,13 +611352,8 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
611322
611352
  if (!this.context.authOverrides?.["auth-schemes"]) {
611323
611353
  return;
611324
611354
  }
611325
- if (!this.context.spec.components) {
611326
- this.context.spec.components = {};
611327
- }
611328
- this.context.spec.components.securitySchemes = {};
611329
611355
  const securityRequirement = {};
611330
611356
  for (const schemeId of Object.keys(this.context.authOverrides["auth-schemes"])) {
611331
- this.context.spec.components.securitySchemes[schemeId] = { type: "http", scheme: "bearer" };
611332
611357
  securityRequirement[schemeId] = [];
611333
611358
  }
611334
611359
  this.context.spec.security = [securityRequirement];
@@ -621992,7 +622017,7 @@ var AccessTokenPosthogManager = class {
621992
622017
  properties: {
621993
622018
  ...event,
621994
622019
  ...event.properties,
621995
- version: "5.2.0",
622020
+ version: "5.2.1-5-geb7105beec4",
621996
622021
  usingAccessToken: true
621997
622022
  }
621998
622023
  });
@@ -622046,7 +622071,7 @@ var UserPosthogManager = class {
622046
622071
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
622047
622072
  event: "CLI",
622048
622073
  properties: {
622049
- version: "5.2.0",
622074
+ version: "5.2.1-5-geb7105beec4",
622050
622075
  ...event,
622051
622076
  ...event.properties,
622052
622077
  usingAccessToken: false,
@@ -800063,7 +800088,8 @@ var DocsDefinitionResolver = class {
800063
800088
  }
800064
800089
  /**
800065
800090
  * Returns per-locale translated navigation overlays loaded from
800066
- * `translations/<lang>/fern/docs.yml` and referenced nav YAML files.
800091
+ * `translations/<lang>/docs.yml` (or `translations/<lang>/fern/docs.yml` for
800092
+ * backwards compatibility) and referenced nav YAML files.
800067
800093
  * Must be called after `resolve()`.
800068
800094
  */
800069
800095
  getTranslationNavigationOverlays() {
@@ -833921,7 +833947,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
833921
833947
  var LOGS_FOLDER_NAME = "logs";
833922
833948
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
833923
833949
  function getCliSource() {
833924
- const version7 = "5.2.0";
833950
+ const version7 = "5.2.1-5-geb7105beec4";
833925
833951
  return `cli@${version7}`;
833926
833952
  }
833927
833953
  var DebugLogger = class {
@@ -846373,7 +846399,7 @@ var LegacyDocsPublisher = class {
846373
846399
  previewId,
846374
846400
  disableTemplates: void 0,
846375
846401
  skipUpload,
846376
- cliVersion: "5.2.0",
846402
+ cliVersion: "5.2.1-5-geb7105beec4",
846377
846403
  loginCommand: "fern auth login"
846378
846404
  });
846379
846405
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -920702,7 +920728,7 @@ var CliContext = class _CliContext {
920702
920728
  if (false) {
920703
920729
  this.logger.error("CLI_VERSION is not defined");
920704
920730
  }
920705
- return "5.2.0";
920731
+ return "5.2.1-5-geb7105beec4";
920706
920732
  }
920707
920733
  getCliName() {
920708
920734
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.2.0",
2
+ "version": "5.2.1-5-geb7105beec4",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",