@fern-api/fern-api-dev 5.1.0 → 5.2.0-3-gd80171d98cd

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 +78 -31
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -511106,7 +511106,8 @@ var DocsInstance = external_exports.object({
511106
511106
  url: external_exports.string(),
511107
511107
  "custom-domain": CustomDomain.optional(),
511108
511108
  "edit-this-page": EditThisPageConfig.optional(),
511109
- audiences: Audience.optional()
511109
+ audiences: Audience.optional(),
511110
+ "multi-source": external_exports.boolean().optional()
511110
511111
  });
511111
511112
  var LogoConfiguration = external_exports.object({
511112
511113
  dark: external_exports.string().optional(),
@@ -514301,7 +514302,8 @@ var DocsInstance2 = schemas_exports6.object({
514301
514302
  url: schemas_exports6.string(),
514302
514303
  customDomain: schemas_exports6.property("custom-domain", CustomDomain2.optional()),
514303
514304
  editThisPage: schemas_exports6.property("edit-this-page", EditThisPageConfig2.optional()),
514304
- audiences: Audience2.optional()
514305
+ audiences: Audience2.optional(),
514306
+ multiSource: schemas_exports6.property("multi-source", schemas_exports6.boolean().optional())
514305
514307
  });
514306
514308
 
514307
514309
  // ../configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/HttpSnippetLanguage.js
@@ -552504,10 +552506,11 @@ function convertSchemeReference({ reference: reference4, authSchemeDeclarations,
552504
552506
  if (declaration == null) {
552505
552507
  throw new Error("Unknown auth scheme: " + reference5);
552506
552508
  }
552509
+ const effectiveDocs = docs2 ?? (typeof declaration === "object" ? declaration.docs : void 0);
552507
552510
  return visitRawAuthSchemeDeclaration(declaration, {
552508
552511
  header: (rawHeader) => AuthScheme.header({
552509
552512
  key: reference5,
552510
- docs: docs2,
552513
+ docs: effectiveDocs,
552511
552514
  name: casingsGenerator.generateNameAndWireValue({
552512
552515
  name: rawHeader.name ?? reference5,
552513
552516
  wireValue: rawHeader.header
@@ -552523,27 +552526,27 @@ function convertSchemeReference({ reference: reference4, authSchemeDeclarations,
552523
552526
  basic: (rawScheme) => generateBasicAuth({
552524
552527
  key: reference5,
552525
552528
  casingsGenerator,
552526
- docs: docs2,
552529
+ docs: effectiveDocs,
552527
552530
  rawScheme
552528
552531
  }),
552529
552532
  tokenBearer: (rawScheme) => generateBearerAuth({
552530
552533
  key: reference5,
552531
552534
  casingsGenerator,
552532
- docs: docs2,
552535
+ docs: effectiveDocs,
552533
552536
  rawScheme
552534
552537
  }),
552535
552538
  inferredBearer(authScheme) {
552536
552539
  return generateBearerAuth({
552537
552540
  key: reference5,
552538
552541
  casingsGenerator,
552539
- docs: docs2,
552542
+ docs: effectiveDocs,
552540
552543
  rawScheme: void 0
552541
552544
  });
552542
552545
  },
552543
552546
  oauth: (rawScheme) => generateBearerAuth({
552544
552547
  key: reference5,
552545
552548
  casingsGenerator,
552546
- docs: docs2,
552549
+ docs: effectiveDocs,
552547
552550
  rawScheme: void 0
552548
552551
  })
552549
552552
  });
@@ -611129,19 +611132,12 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
611129
611132
  }
611130
611133
  }
611131
611134
  convertSecuritySchemes() {
611135
+ const openApiSchemes = this.convertOpenApiSecuritySchemes();
611132
611136
  if (this.context.authOverrides) {
611133
- const overrideAuth = convertApiAuth({
611134
- rawApiFileSchema: this.context.authOverrides,
611135
- casingsGenerator: this.context.casingsGenerator
611136
- });
611137
- this.addAuthToIR({
611138
- requirement: overrideAuth.requirement,
611139
- schemes: overrideAuth.schemes,
611140
- docs: overrideAuth.docs
611141
- });
611137
+ const descriptions = new Map(openApiSchemes.map((scheme) => [scheme.key, scheme.docs]));
611138
+ this.convertAuthOverrides(descriptions, this.context.authOverrides);
611142
611139
  return;
611143
611140
  }
611144
- const openApiSchemes = this.convertOpenApiSecuritySchemes();
611145
611141
  if (openApiSchemes.length > 0) {
611146
611142
  this.addAuthToIR({
611147
611143
  requirement: openApiSchemes.length === 1 ? "ALL" : "ANY",
@@ -611150,6 +611146,26 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
611150
611146
  });
611151
611147
  }
611152
611148
  }
611149
+ convertAuthOverrides(descriptions, authOverrides) {
611150
+ const enriched = {
611151
+ ...authOverrides,
611152
+ "auth-schemes": Object.fromEntries(Object.entries(authOverrides["auth-schemes"] ?? {}).map(([id2, scheme]) => [id2, { ...scheme }]))
611153
+ };
611154
+ for (const [schemeId, scheme] of Object.entries(enriched["auth-schemes"])) {
611155
+ if (!scheme.docs && descriptions.has(schemeId)) {
611156
+ scheme.docs = descriptions.get(schemeId);
611157
+ }
611158
+ }
611159
+ const auth8 = convertApiAuth({
611160
+ rawApiFileSchema: enriched,
611161
+ casingsGenerator: this.context.casingsGenerator
611162
+ });
611163
+ this.addAuthToIR({
611164
+ requirement: auth8.requirement,
611165
+ schemes: auth8.schemes,
611166
+ docs: auth8.docs
611167
+ });
611168
+ }
611153
611169
  convertOpenApiSecuritySchemes() {
611154
611170
  const securitySchemes = [];
611155
611171
  for (const [id2, securityScheme] of Object.entries(this.context.spec.components?.securitySchemes ?? {})) {
@@ -611320,13 +611336,8 @@ var OpenAPIConverter = class extends AbstractSpecConverter {
611320
611336
  if (!this.context.authOverrides?.["auth-schemes"]) {
611321
611337
  return;
611322
611338
  }
611323
- if (!this.context.spec.components) {
611324
- this.context.spec.components = {};
611325
- }
611326
- this.context.spec.components.securitySchemes = {};
611327
611339
  const securityRequirement = {};
611328
611340
  for (const schemeId of Object.keys(this.context.authOverrides["auth-schemes"])) {
611329
- this.context.spec.components.securitySchemes[schemeId] = { type: "http", scheme: "bearer" };
611330
611341
  securityRequirement[schemeId] = [];
611331
611342
  }
611332
611343
  this.context.spec.security = [securityRequirement];
@@ -621990,7 +622001,7 @@ var AccessTokenPosthogManager = class {
621990
622001
  properties: {
621991
622002
  ...event,
621992
622003
  ...event.properties,
621993
- version: "5.1.0",
622004
+ version: "5.2.0-3-gd80171d98cd",
621994
622005
  usingAccessToken: true
621995
622006
  }
621996
622007
  });
@@ -622044,7 +622055,7 @@ var UserPosthogManager = class {
622044
622055
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
622045
622056
  event: "CLI",
622046
622057
  properties: {
622047
- version: "5.1.0",
622058
+ version: "5.2.0-3-gd80171d98cd",
622048
622059
  ...event,
622049
622060
  ...event.properties,
622050
622061
  usingAccessToken: false,
@@ -833919,7 +833930,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
833919
833930
  var LOGS_FOLDER_NAME = "logs";
833920
833931
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
833921
833932
  function getCliSource() {
833922
- const version7 = "5.1.0";
833933
+ const version7 = "5.2.0-3-gd80171d98cd";
833923
833934
  return `cli@${version7}`;
833924
833935
  }
833925
833936
  var DebugLogger = class {
@@ -838237,6 +838248,16 @@ var definitions6 = {
838237
838248
  type: "null"
838238
838249
  }
838239
838250
  ]
838251
+ },
838252
+ "multi-source": {
838253
+ oneOf: [
838254
+ {
838255
+ type: "boolean"
838256
+ },
838257
+ {
838258
+ type: "null"
838259
+ }
838260
+ ]
838240
838261
  }
838241
838262
  },
838242
838263
  required: [
@@ -845248,7 +845269,7 @@ async function calculateFileHash(absoluteFilePath) {
845248
845269
  function sanitizeRelativePathForS3(relativeFilePath) {
845249
845270
  return relativeFilePath.replace(/\.\.\//g, "_dot_dot_/");
845250
845271
  }
845251
- async function publishDocs({ token, organization, docsWorkspace, domain: domain3, customDomains, apiWorkspaces, ossWorkspaces, context: context3, preview, previewId, editThisPage, disableTemplates = false, skipUpload = false, withAiExamples = true, excludeApis = false, targetAudiences, docsUrl, cliVersion, ciSource, deployerAuthor, loginCommand = "fern login" }) {
845272
+ async function publishDocs({ token, organization, docsWorkspace, domain: domain3, customDomains, apiWorkspaces, ossWorkspaces, context: context3, preview, previewId, editThisPage, disableTemplates = false, skipUpload = false, withAiExamples = true, excludeApis = false, targetAudiences, docsUrl, cliVersion, ciSource, deployerAuthor, loginCommand = "fern login", multiSource = false }) {
845252
845273
  const fdrOrigin = "https://registry-dev2.buildwithfern.com";
845253
845274
  const isAirGapped = await detectAirGappedMode(`${fdrOrigin}/health`, context3.logger);
845254
845275
  if (isAirGapped) {
@@ -845280,9 +845301,12 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain3
845280
845301
  let urlToOutput = customDomains[0] ?? domain3;
845281
845302
  const basePath = parseBasePath(domain3);
845282
845303
  const disableDynamicSnippets = docsWorkspace.config.experimental && docsWorkspace.config.experimental.dynamicSnippets === false;
845283
- const isBasepathAware = docsWorkspace.config.experimental?.basepathAware === true;
845304
+ if (docsWorkspace.config.experimental?.basepathAware === true) {
845305
+ context3.logger.warn("experimental.basepath-aware is deprecated. Use 'multi-source: true' on the instance instead.");
845306
+ }
845307
+ const isBasepathAware = multiSource || docsWorkspace.config.experimental?.basepathAware === true;
845284
845308
  if (isBasepathAware) {
845285
- context3.logger.debug("Experimental flag 'basepath-aware' is enabled - using basepath-aware S3 key format");
845309
+ context3.logger.debug("Basepath-aware mode is enabled - using basepath-aware S3 key format");
845286
845310
  }
845287
845311
  let deployLocked = false;
845288
845312
  const doUnlock = () => {
@@ -846252,6 +846276,9 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
846252
846276
  customDomains.push(...maybeInstance.customDomain);
846253
846277
  }
846254
846278
  }
846279
+ if (maybeInstance.multiSource === true) {
846280
+ validateMultiSourceBasepaths(maybeInstance.url, customDomains, context3);
846281
+ }
846255
846282
  context3.logger.info(`Starting docs publishing for ${preview ? "preview" : "production"}: ${maybeInstance.url}`);
846256
846283
  context3.logger.debug(`Organization: ${organization}, Preview: ${preview}, APIs: ${apiWorkspaces.length}, OSS: ${ossWorkspaces.length}`);
846257
846284
  let publishedUrl;
@@ -846278,7 +846305,8 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
846278
846305
  cliVersion,
846279
846306
  ciSource,
846280
846307
  deployerAuthor,
846281
- loginCommand
846308
+ loginCommand,
846309
+ multiSource: maybeInstance.multiSource ?? false
846282
846310
  });
846283
846311
  for (let attempt = 0; ; attempt++) {
846284
846312
  try {
@@ -846302,6 +846330,23 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
846302
846330
  });
846303
846331
  return publishedUrl;
846304
846332
  }
846333
+ function getBasepath(domain3) {
846334
+ try {
846335
+ const url3 = domain3.startsWith("https://") || domain3.startsWith("http://") ? domain3 : `https://${domain3}`;
846336
+ return new URL(url3).pathname;
846337
+ } catch {
846338
+ return "/";
846339
+ }
846340
+ }
846341
+ function validateMultiSourceBasepaths(instanceUrl, customDomains, context3) {
846342
+ const urlBasepath = getBasepath(instanceUrl);
846343
+ for (const customDomain of customDomains) {
846344
+ const customDomainBasepath = getBasepath(customDomain);
846345
+ if (customDomainBasepath !== "/" && urlBasepath !== customDomainBasepath) {
846346
+ context3.failAndThrow(`When multi-source is enabled, the url and custom-domain must share the same basepath. Instance url '${instanceUrl}' has basepath '${urlBasepath}' but custom-domain '${customDomain}' has basepath '${customDomainBasepath}'.`, void 0, { code: CliError.Code.ConfigError });
846347
+ }
846348
+ }
846349
+ }
846305
846350
 
846306
846351
  // ../cli-v2/lib/docs/publisher/LegacyDocsPublisher.js
846307
846352
  var LegacyDocsPublisher = class {
@@ -846337,7 +846382,7 @@ var LegacyDocsPublisher = class {
846337
846382
  previewId,
846338
846383
  disableTemplates: void 0,
846339
846384
  skipUpload,
846340
- cliVersion: "5.1.0",
846385
+ cliVersion: "5.2.0-3-gd80171d98cd",
846341
846386
  loginCommand: "fern auth login"
846342
846387
  });
846343
846388
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -865752,6 +865797,8 @@ var Generation = class {
865752
865797
  explicitNamespaces: () => this.customConfig["explicit-namespaces"] === true,
865753
865798
  /** Override the default max retries for the SDK client. Default: 2. */
865754
865799
  maxRetries: () => this.customConfig.maxRetries,
865800
+ /** Controls which HTTP status codes trigger automatic retries. Default: "legacy". */
865801
+ retryStatusCodes: () => this.customConfig.retryStatusCodes ?? "legacy",
865755
865802
  /**
865756
865803
  * Output path configuration for generated files.
865757
865804
  * Returns normalized paths for library, test, solution, and other files.
@@ -920664,7 +920711,7 @@ var CliContext = class _CliContext {
920664
920711
  if (false) {
920665
920712
  this.logger.error("CLI_VERSION is not defined");
920666
920713
  }
920667
- return "5.1.0";
920714
+ return "5.2.0-3-gd80171d98cd";
920668
920715
  }
920669
920716
  getCliName() {
920670
920717
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.1.0",
2
+ "version": "5.2.0-3-gd80171d98cd",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",