@fern-api/fern-api-dev 5.103.0 → 5.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 +70 -37
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -131007,7 +131007,8 @@ var init_OpenApiSettingsSchema2 = __esm({
131007
131007
  "infer-discriminated-union-base-properties": schemas_exports8.boolean().optional(),
131008
131008
  "disambiguate-request-names": schemas_exports8.boolean().optional(),
131009
131009
  "ignore-tags": schemas_exports8.boolean().optional(),
131010
- "respect-parameter-content": schemas_exports8.boolean().optional()
131010
+ "respect-parameter-content": schemas_exports8.boolean().optional(),
131011
+ "respect-per-spec-base-path": schemas_exports8.boolean().optional()
131011
131012
  }).extend(BaseApiSettingsSchema);
131012
131013
  }
131013
131014
  });
@@ -152873,7 +152874,8 @@ var init_options2 = __esm({
152873
152874
  shouldInferDiscriminatedUnionBaseProperties: false,
152874
152875
  disambiguateRequestNames: true,
152875
152876
  ignoreTags: false,
152876
- respectParameterContent: false
152877
+ respectParameterContent: false,
152878
+ respectPerSpecBasePath: false
152877
152879
  };
152878
152880
  }
152879
152881
  });
@@ -168685,6 +168687,7 @@ function generateIr({ openApi, taskContext, options: options2, source: source2,
168685
168687
  taskContext.logger.warn(message);
168686
168688
  }
168687
168689
  }
168690
+ const plainBasePath = options2.respectPerSpecBasePath && fernBasePathParsed != null && fernBasePathParsed.pathParameters.length === 0 ? fernBasePathParsed.basePath : void 0;
168688
168691
  Object.entries(openApi.paths ?? {}).forEach(([path122, pathItem]) => {
168689
168692
  if (pathItem == null) {
168690
168693
  return;
@@ -168697,16 +168700,16 @@ function generateIr({ openApi, taskContext, options: options2, source: source2,
168697
168700
  }
168698
168701
  switch (operation.type) {
168699
168702
  case "async":
168700
- endpointsWithExample.push(...operation.sync);
168701
- endpointsWithExample.push(...operation.async);
168703
+ endpointsWithExample.push(...prependBasePathToEndpoints(operation.sync, plainBasePath));
168704
+ endpointsWithExample.push(...prependBasePathToEndpoints(operation.async, plainBasePath));
168702
168705
  break;
168703
168706
  case "http":
168704
- endpointsWithExample.push(...operation.value);
168707
+ endpointsWithExample.push(...prependBasePathToEndpoints(operation.value, plainBasePath));
168705
168708
  break;
168706
168709
  case "streaming":
168707
- endpointsWithExample.push(...operation.streaming);
168710
+ endpointsWithExample.push(...prependBasePathToEndpoints(operation.streaming, plainBasePath));
168708
168711
  if (operation.nonStreaming) {
168709
- endpointsWithExample.push(...operation.nonStreaming);
168712
+ endpointsWithExample.push(...prependBasePathToEndpoints(operation.nonStreaming, plainBasePath));
168710
168713
  }
168711
168714
  break;
168712
168715
  case "webhook":
@@ -168914,17 +168917,8 @@ function generateIr({ openApi, taskContext, options: options2, source: source2,
168914
168917
  document: openApi
168915
168918
  }),
168916
168919
  specVersion: openApi.info.version != null && openApi.info.version.length > 0 ? openApi.info.version : void 0,
168917
- basePath: (() => {
168918
- const parsed = getFernBasePath(openApi);
168919
- return parsed?.basePath;
168920
- })(),
168921
- basePathParameters: (() => {
168922
- const parsed = getFernBasePath(openApi);
168923
- if (parsed == null || parsed.pathParameters.length === 0) {
168924
- return void 0;
168925
- }
168926
- return parsed.pathParameters;
168927
- })(),
168920
+ basePath: fernBasePathParsed != null && (!options2.respectPerSpecBasePath || fernBasePathParsed.pathParameters.length > 0) ? fernBasePathParsed.basePath : void 0,
168921
+ basePathParameters: fernBasePathParsed != null && fernBasePathParsed.pathParameters.length > 0 ? fernBasePathParsed.pathParameters : void 0,
168928
168922
  title: openApi.info.title ?? "",
168929
168923
  description: openApi.info.description,
168930
168924
  groups: Object.fromEntries(Object.entries(groupInfo ?? {}).map(([key2, value2]) => {
@@ -169012,6 +169006,26 @@ function maybeRemoveDiscriminantsFromSchemas(schemas, context3, source2) {
169012
169006
  }
169013
169007
  return result;
169014
169008
  }
169009
+ function prependBasePath(path122, basePath) {
169010
+ if (basePath == null || basePath === "/") {
169011
+ return path122;
169012
+ }
169013
+ const normalizedBasePath = basePath.replace(/\/+$/, "");
169014
+ if (path122 === normalizedBasePath || path122.startsWith(`${normalizedBasePath}/`)) {
169015
+ return path122;
169016
+ }
169017
+ const normalizedPath = path122.replace(/^\/+/, "");
169018
+ return normalizedPath.length > 0 ? `${normalizedBasePath}/${normalizedPath}` : normalizedBasePath;
169019
+ }
169020
+ function prependBasePathToEndpoints(endpoints, basePath) {
169021
+ if (basePath == null || basePath === "/") {
169022
+ return endpoints;
169023
+ }
169024
+ return endpoints.map((endpoint3) => ({
169025
+ ...endpoint3,
169026
+ path: prependBasePath(endpoint3.path, basePath)
169027
+ }));
169028
+ }
169015
169029
  function getParentSchemaIdsWithNonUnionChildren(schemas, context3) {
169016
169030
  const protectedParents = /* @__PURE__ */ new Set();
169017
169031
  for (const [schemaId, schema] of Object.entries(schemas)) {
@@ -169191,7 +169205,7 @@ function parse8({ context: context3, documents, options: options2 }) {
169191
169205
  source: source2,
169192
169206
  namespace: document4.namespace
169193
169207
  });
169194
- ir3 = merge6(ir3, openapiIr, getParseOptions({ options: document4.settings, overrides: options2 }));
169208
+ ir3 = merge6(ir3, openapiIr, getParseOptions({ options: document4.settings, overrides: options2 }), context3);
169195
169209
  documentIndex++;
169196
169210
  break;
169197
169211
  }
@@ -169388,7 +169402,17 @@ function extractApiNameFromServers(servers) {
169388
169402
  function hasGroupedServers(servers) {
169389
169403
  return servers.some((server) => server.type === "grouped");
169390
169404
  }
169391
- function merge6(ir1, ir22, options2) {
169405
+ function mergeBasePath(ir1, ir22, options2, context3) {
169406
+ if (options2?.respectPerSpecBasePath === true && ir1.basePath != null && ir22.basePath != null && ir1.basePath !== ir22.basePath) {
169407
+ context3.failWithoutThrowing(`Conflicting parameterized x-fern-base-path values: '${ir1.basePath}' and '${ir22.basePath}'.`);
169408
+ }
169409
+ return {
169410
+ basePath: ir1.basePath ?? ir22.basePath,
169411
+ basePathParameters: ir1.basePathParameters ?? ir22.basePathParameters
169412
+ };
169413
+ }
169414
+ function merge6(ir1, ir22, options2, context3) {
169415
+ const mergedBasePath = mergeBasePath(ir1, ir22, options2, context3);
169392
169416
  const shouldGroupEnvironments = options2?.groupMultiApiEnvironments === true;
169393
169417
  if (!shouldGroupEnvironments) {
169394
169418
  return {
@@ -169396,8 +169420,8 @@ function merge6(ir1, ir22, options2) {
169396
169420
  specVersion: ir1.specVersion ?? ir22.specVersion,
169397
169421
  title: ir1.title ?? ir22.title,
169398
169422
  description: ir1.description ?? ir22.description,
169399
- basePath: ir1.basePath ?? ir22.basePath,
169400
- basePathParameters: ir1.basePathParameters ?? ir22.basePathParameters,
169423
+ basePath: mergedBasePath.basePath,
169424
+ basePathParameters: mergedBasePath.basePathParameters,
169401
169425
  servers: [...ir1.servers, ...ir22.servers],
169402
169426
  websocketServers: [...ir1.websocketServers, ...ir22.websocketServers],
169403
169427
  tags: {
@@ -169539,8 +169563,8 @@ function merge6(ir1, ir22, options2) {
169539
169563
  specVersion: ir1.specVersion ?? ir22.specVersion,
169540
169564
  title: ir1.title ?? ir22.title,
169541
169565
  description: ir1.description ?? ir22.description,
169542
- basePath: ir1.basePath ?? ir22.basePath,
169543
- basePathParameters: ir1.basePathParameters ?? ir22.basePathParameters,
169566
+ basePath: mergedBasePath.basePath,
169567
+ basePathParameters: mergedBasePath.basePathParameters,
169544
169568
  // Cast grouped servers to Server[] - buildEnvironments.ts handles the grouped structure
169545
169569
  // biome-ignore lint/suspicious/noExplicitAny: Required to preserve grouped server metadata through type system
169546
169570
  servers: mergedServers,
@@ -169594,8 +169618,8 @@ function merge6(ir1, ir22, options2) {
169594
169618
  specVersion: ir1.specVersion ?? ir22.specVersion,
169595
169619
  title: ir1.title ?? ir22.title,
169596
169620
  description: ir1.description ?? ir22.description,
169597
- basePath: ir1.basePath ?? ir22.basePath,
169598
- basePathParameters: ir1.basePathParameters ?? ir22.basePathParameters,
169621
+ basePath: mergedBasePath.basePath,
169622
+ basePathParameters: mergedBasePath.basePathParameters,
169599
169623
  servers: dedupeServers([...ir1.servers, ...ir22.servers]),
169600
169624
  websocketServers: [...ir1.websocketServers, ...ir22.websocketServers],
169601
169625
  tags: {
@@ -200071,7 +200095,8 @@ var init_getAPIDefinitionSettings = __esm({
200071
200095
  shouldInferDiscriminatedUnionBaseProperties: "shouldInferDiscriminatedUnionBaseProperties",
200072
200096
  disambiguateRequestNames: "disambiguateRequestNames",
200073
200097
  ignoreTags: "ignoreTags",
200074
- respectParameterContent: "respectParameterContent"
200098
+ respectParameterContent: "respectParameterContent",
200099
+ respectPerSpecBasePath: "respectPerSpecBasePath"
200075
200100
  };
200076
200101
  }
200077
200102
  });
@@ -264328,7 +264353,8 @@ function parseOpenApiDefinitionSettingsSchema(settings) {
264328
264353
  shouldInferDiscriminatedUnionBaseProperties: settings?.["infer-discriminated-union-base-properties"],
264329
264354
  disambiguateRequestNames: settings?.["disambiguate-request-names"],
264330
264355
  ignoreTags: settings?.["ignore-tags"],
264331
- respectParameterContent: settings?.["respect-parameter-content"]
264356
+ respectParameterContent: settings?.["respect-parameter-content"],
264357
+ respectPerSpecBasePath: settings?.["respect-per-spec-base-path"]
264332
264358
  };
264333
264359
  }
264334
264360
  function parseAsyncApiDefinitionSettingsSchema(settings) {
@@ -265196,7 +265222,8 @@ var init_convertGeneratorsConfiguration = __esm({
265196
265222
  shouldInferDiscriminatedUnionBaseProperties: void 0,
265197
265223
  disambiguateRequestNames: void 0,
265198
265224
  ignoreTags: void 0,
265199
- respectParameterContent: void 0
265225
+ respectParameterContent: void 0,
265226
+ respectPerSpecBasePath: void 0
265200
265227
  };
265201
265228
  }
265202
265229
  });
@@ -694858,7 +694885,12 @@ var OpenApiSettingsSchema2 = BaseApiSettingsSchema2.extend({
694858
694885
  * back to a string.
694859
694886
  * Defaults to false.
694860
694887
  */
694861
- "respect-parameter-content": external_exports.boolean().optional()
694888
+ "respect-parameter-content": external_exports.boolean().optional(),
694889
+ /**
694890
+ * If true, apply each OpenAPI document's plain `x-fern-base-path` to that document's endpoints.
694891
+ * Defaults to false.
694892
+ */
694893
+ "respect-per-spec-base-path": external_exports.boolean().optional()
694862
694894
  });
694863
694895
 
694864
694896
  // ../config/lib/schemas/specs/OpenApiSpecSchema.js
@@ -703447,7 +703479,7 @@ var AccessTokenPosthogManager = class {
703447
703479
  properties: {
703448
703480
  ...event,
703449
703481
  ...event.properties,
703450
- version: "5.103.0",
703482
+ version: "5.104.0",
703451
703483
  usingAccessToken: true,
703452
703484
  ...getRunIdProperties()
703453
703485
  }
@@ -703513,7 +703545,7 @@ var UserPosthogManager = class {
703513
703545
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
703514
703546
  event: "CLI",
703515
703547
  properties: {
703516
- version: "5.103.0",
703548
+ version: "5.104.0",
703517
703549
  ...event,
703518
703550
  ...event.properties,
703519
703551
  usingAccessToken: false,
@@ -710330,7 +710362,8 @@ var LegacyApiSpecAdapter = class {
710330
710362
  shouldInferDiscriminatedUnionBaseProperties: settings.inferDiscriminatedUnionBaseProperties,
710331
710363
  disambiguateRequestNames: settings["disambiguate-request-names"],
710332
710364
  ignoreTags: settings["ignore-tags"],
710333
- respectParameterContent: settings["respect-parameter-content"]
710365
+ respectParameterContent: settings["respect-parameter-content"],
710366
+ respectPerSpecBasePath: settings["respect-per-spec-base-path"]
710334
710367
  };
710335
710368
  const hasSettings = Object.values(result).some((v3) => v3 != null);
710336
710369
  return hasSettings ? result : void 0;
@@ -884895,7 +884928,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
884895
884928
  var LOGS_FOLDER_NAME = "logs";
884896
884929
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
884897
884930
  function getCliSource() {
884898
- const version7 = "5.103.0";
884931
+ const version7 = "5.104.0";
884899
884932
  return `cli@${version7}`;
884900
884933
  }
884901
884934
  var DebugLogger = class {
@@ -910981,7 +911014,7 @@ var LegacyDocsPublisher = class {
910981
911014
  previewId,
910982
911015
  disableTemplates: void 0,
910983
911016
  skipUpload,
910984
- cliVersion: "5.103.0",
911017
+ cliVersion: "5.104.0",
910985
911018
  loginCommand: "fern auth login"
910986
911019
  });
910987
911020
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -978352,7 +978385,7 @@ function getAutomationContextFromEnv() {
978352
978385
  config_branch: process.env.FERN_CONFIG_BRANCH,
978353
978386
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
978354
978387
  trigger: process.env.GITHUB_EVENT_NAME,
978355
- cli_version: "5.103.0"
978388
+ cli_version: "5.104.0"
978356
978389
  };
978357
978390
  }
978358
978391
  function isAutomationMode() {
@@ -979184,7 +979217,7 @@ var CliContext = class _CliContext {
979184
979217
  if (false) {
979185
979218
  this.logger.error("CLI_VERSION is not defined");
979186
979219
  }
979187
- return "5.103.0";
979220
+ return "5.104.0";
979188
979221
  }
979189
979222
  getCliName() {
979190
979223
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.103.0",
2
+ "version": "5.104.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",