@fern-api/fern-api-dev 5.47.2 → 5.47.4

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 +244 -85
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -25368,7 +25368,7 @@ var init_CliError = __esm({
25368
25368
  if (Error.captureStackTrace) {
25369
25369
  Error.captureStackTrace(this, this.constructor);
25370
25370
  }
25371
- this.name = this.constructor.name;
25371
+ this.name = "CliError";
25372
25372
  this.code = code5;
25373
25373
  this.docsLink = docsLink;
25374
25374
  }
@@ -237620,6 +237620,11 @@ var init_GraphQLConverter = __esm({
237620
237620
  }
237621
237621
  return true;
237622
237622
  }
237623
+ // NOTE: This heuristic treats a type as a namespace (operation-grouping type) when ALL
237624
+ // of its fields accept arguments. This can produce a false positive for regular data
237625
+ // types where every field happens to be parameterized. If that becomes a problem,
237626
+ // introduce an explicit config option (e.g. namespacedRootTypes: [...]) rather than
237627
+ // relying on field-arg counts alone.
237623
237628
  isNamespaceType(type8) {
237624
237629
  const fields = Object.values(type8.getFields());
237625
237630
  if (fields.length === 0) {
@@ -237627,29 +237632,81 @@ var init_GraphQLConverter = __esm({
237627
237632
  }
237628
237633
  return fields.every((f4) => f4.args.length > 0);
237629
237634
  }
237635
+ // Returns the names of object types that will be consumed as namespace groupings by
237636
+ // convertOperations — i.e. types that appear as the return type of a zero-arg root
237637
+ // field whose own fields all accept arguments. These types must be excluded from the
237638
+ // type registry in collectTypeDefinitions to prevent their fields from showing up
237639
+ // both as object properties and as standalone operations.
237640
+ collectNamespaceTypeNames() {
237641
+ if (!this.schema) {
237642
+ return /* @__PURE__ */ new Set();
237643
+ }
237644
+ const namespaceTypeNames = /* @__PURE__ */ new Set();
237645
+ const rootTypes = [];
237646
+ const queryType = this.schema.getQueryType();
237647
+ if (queryType) {
237648
+ rootTypes.push(queryType);
237649
+ }
237650
+ const mutationType = this.schema.getMutationType();
237651
+ if (mutationType) {
237652
+ rootTypes.push(mutationType);
237653
+ }
237654
+ const subscriptionType = this.schema.getSubscriptionType();
237655
+ if (subscriptionType && this.isActualSubscriptionRootType(subscriptionType)) {
237656
+ rootTypes.push(subscriptionType);
237657
+ }
237658
+ for (const rootType of rootTypes) {
237659
+ for (const field5 of Object.values(rootType.getFields())) {
237660
+ const returnRawType = this.unwrapNonNull(field5.type);
237661
+ if (returnRawType instanceof GraphQLObjectType && field5.args.length === 0 && this.isNamespaceType(returnRawType)) {
237662
+ namespaceTypeNames.add(returnRawType.name);
237663
+ }
237664
+ }
237665
+ }
237666
+ return namespaceTypeNames;
237667
+ }
237630
237668
  async convert() {
237631
237669
  const sdlContent = await (0, import_promises38.readFile)(this.filePath, "utf-8");
237632
237670
  this.schema = buildSchema(sdlContent);
237633
237671
  this.collectTypeDefinitions();
237634
- const graphqlOperations = {};
237672
+ const pendingOperations = [];
237635
237673
  const queryType = this.schema.getQueryType();
237636
237674
  if (queryType) {
237637
- this.convertOperations(queryType, "QUERY", graphqlOperations);
237675
+ this.convertOperations(queryType, "QUERY", pendingOperations);
237638
237676
  }
237639
237677
  const mutationType = this.schema.getMutationType();
237640
237678
  if (mutationType) {
237641
- this.convertOperations(mutationType, "MUTATION", graphqlOperations);
237679
+ this.convertOperations(mutationType, "MUTATION", pendingOperations);
237642
237680
  }
237643
237681
  const subscriptionType = this.schema.getSubscriptionType();
237644
237682
  if (subscriptionType && this.isActualSubscriptionRootType(subscriptionType)) {
237645
- this.convertOperations(subscriptionType, "SUBSCRIPTION", graphqlOperations);
237683
+ this.convertOperations(subscriptionType, "SUBSCRIPTION", pendingOperations);
237646
237684
  }
237685
+ const graphqlOperations = this.resolveOperationIds(pendingOperations);
237647
237686
  return { graphqlOperations, types: this.types };
237648
237687
  }
237688
+ resolveOperationIds(pending) {
237689
+ const flatIdCounts = /* @__PURE__ */ new Map();
237690
+ for (const op4 of pending) {
237691
+ flatIdCounts.set(op4.flatId, (flatIdCounts.get(op4.flatId) ?? 0) + 1);
237692
+ }
237693
+ const result = {};
237694
+ for (const op4 of pending) {
237695
+ const hasCollision = (flatIdCounts.get(op4.flatId) ?? 0) > 1;
237696
+ const finalId = hasCollision ? op4.namespacedId : op4.flatId;
237697
+ const operationId = this.getNamespacedOperationId(finalId);
237698
+ result[operationId] = {
237699
+ ...op4.operation,
237700
+ id: operationId
237701
+ };
237702
+ }
237703
+ return result;
237704
+ }
237649
237705
  collectTypeDefinitions() {
237650
237706
  if (!this.schema) {
237651
237707
  return;
237652
237708
  }
237709
+ const namespaceTypeNames = this.collectNamespaceTypeNames();
237653
237710
  const typeMap = this.schema.getTypeMap();
237654
237711
  for (const [typeName, type8] of Object.entries(typeMap)) {
237655
237712
  if (typeName.startsWith("__")) {
@@ -237661,6 +237718,9 @@ var init_GraphQLConverter = __esm({
237661
237718
  if (type8 === this.schema.getSubscriptionType() && type8 instanceof GraphQLObjectType && this.isActualSubscriptionRootType(type8)) {
237662
237719
  continue;
237663
237720
  }
237721
+ if (type8 instanceof GraphQLObjectType && namespaceTypeNames.has(typeName)) {
237722
+ continue;
237723
+ }
237664
237724
  if (type8 instanceof GraphQLScalarType && this.isBuiltInScalar(typeName)) {
237665
237725
  continue;
237666
237726
  }
@@ -237746,23 +237806,32 @@ var init_GraphQLConverter = __esm({
237746
237806
  }
237747
237807
  }
237748
237808
  }
237749
- convertOperations(type8, operationType, operations) {
237809
+ convertOperations(type8, operationType, pending) {
237750
237810
  const fields = type8.getFields();
237751
237811
  for (const [fieldName, field5] of Object.entries(fields)) {
237752
237812
  const returnRawType = this.unwrapNonNull(field5.type);
237753
237813
  if (returnRawType instanceof GraphQLObjectType && field5.args.length === 0 && this.isNamespaceType(returnRawType)) {
237754
- this.convertNamespaceOperations(returnRawType, fieldName, operationType, operations);
237814
+ this.convertNamespaceOperations(returnRawType, operationType, pending, [fieldName]);
237755
237815
  } else {
237756
- const operationId = this.getNamespacedOperationId(`${operationType.toLowerCase()}_${fieldName}`);
237757
- operations[operationId] = this.convertField(field5, fieldName, operationType);
237816
+ const flatId = `${operationType.toLowerCase()}_${fieldName}`;
237817
+ pending.push({
237818
+ flatId,
237819
+ namespacedId: flatId,
237820
+ operation: this.convertField(field5, fieldName, operationType)
237821
+ });
237758
237822
  }
237759
237823
  }
237760
237824
  }
237761
- convertNamespaceOperations(namespaceType, _parentName, operationType, operations) {
237825
+ convertNamespaceOperations(namespaceType, operationType, pending, fieldPath) {
237762
237826
  const fields = namespaceType.getFields();
237763
237827
  for (const [fieldName, field5] of Object.entries(fields)) {
237764
- const operationId = this.getNamespacedOperationId(`${operationType.toLowerCase()}_${fieldName}`);
237765
- operations[operationId] = this.convertField(field5, fieldName, operationType);
237828
+ const flatId = `${operationType.toLowerCase()}_${fieldName}`;
237829
+ const namespacedId = `${operationType.toLowerCase()}_${[...fieldPath, fieldName].join(".")}`;
237830
+ pending.push({
237831
+ flatId,
237832
+ namespacedId,
237833
+ operation: this.convertField(field5, fieldName, operationType, fieldPath)
237834
+ });
237766
237835
  }
237767
237836
  }
237768
237837
  unwrapNonNull(type8) {
@@ -237771,16 +237840,18 @@ var init_GraphQLConverter = __esm({
237771
237840
  }
237772
237841
  return type8;
237773
237842
  }
237774
- convertField(field5, name2, operationType) {
237843
+ convertField(field5, name2, operationType, fieldPath) {
237775
237844
  const args = field5.args.map((arg) => this.convertArgument(arg));
237776
237845
  const examples = this.examplesByOperation.get(`${operationType.toLowerCase()}:${name2}`) ?? this.examplesByOperation.get(name2);
237777
237846
  return {
237778
- id: this.getNamespacedOperationId(`${operationType.toLowerCase()}_${name2}`),
237847
+ id: FdrAPI_exports.GraphQlOperationId(""),
237848
+ // placeholder, resolved in resolveOperationIds
237779
237849
  operationType,
237780
237850
  name: name2,
237781
237851
  displayName: void 0,
237782
237852
  description: field5.description ?? void 0,
237783
237853
  availability: void 0,
237854
+ fieldPath: fieldPath != null && fieldPath.length > 0 ? fieldPath : void 0,
237784
237855
  arguments: args.length > 0 ? args : void 0,
237785
237856
  returnType: this.convertOutputType(field5.type),
237786
237857
  examples: examples != null && examples.length > 0 ? examples : void 0,
@@ -237974,7 +238045,8 @@ var init_GraphQLConverter = __esm({
237974
238045
  valueType: this.convertOutputType(field5.type),
237975
238046
  description: field5.description ?? void 0,
237976
238047
  availability: void 0,
237977
- propertyAccess: void 0
238048
+ propertyAccess: void 0,
238049
+ arguments: field5.args.length > 0 ? field5.args.map((arg) => this.convertArgument(arg)) : void 0
237978
238050
  }));
237979
238051
  const interfaces = type8.getInterfaces();
237980
238052
  const extendsIds = interfaces.filter((iface) => {
@@ -238021,7 +238093,8 @@ var init_GraphQLConverter = __esm({
238021
238093
  valueType: this.convertOutputType(field5.type),
238022
238094
  description: field5.description ?? void 0,
238023
238095
  availability: void 0,
238024
- propertyAccess: void 0
238096
+ propertyAccess: void 0,
238097
+ arguments: field5.args.length > 0 ? field5.args.map((arg) => this.convertArgument(arg)) : void 0
238025
238098
  }));
238026
238099
  return {
238027
238100
  type: "object",
@@ -434559,7 +434632,7 @@ var require_replay_run = __commonJS({
434559
434632
  if (Error.captureStackTrace) {
434560
434633
  Error.captureStackTrace(this, this.constructor);
434561
434634
  }
434562
- this.name = this.constructor.name;
434635
+ this.name = "ReplayPrepareError";
434563
434636
  this.reason = reason;
434564
434637
  }
434565
434638
  };
@@ -524683,24 +524756,24 @@ function stringifyValidationError(error50) {
524683
524756
  }
524684
524757
 
524685
524758
  // ../fern-definition/schema/lib/schemas/core/schemas/builders/schema-utils/JsonError.js
524686
- var JsonError = class extends Error {
524759
+ var JsonError = class _JsonError extends Error {
524687
524760
  errors;
524688
524761
  constructor(errors4) {
524689
524762
  super(errors4.map(stringifyValidationError).join("; "));
524690
524763
  this.errors = errors4;
524691
- Object.setPrototypeOf(this, new.target.prototype);
524692
- this.name = this.constructor.name;
524764
+ Object.setPrototypeOf(this, _JsonError.prototype);
524765
+ this.name = "JsonError";
524693
524766
  }
524694
524767
  };
524695
524768
 
524696
524769
  // ../fern-definition/schema/lib/schemas/core/schemas/builders/schema-utils/ParseError.js
524697
- var ParseError = class extends Error {
524770
+ var ParseError = class _ParseError extends Error {
524698
524771
  errors;
524699
524772
  constructor(errors4) {
524700
524773
  super(errors4.map(stringifyValidationError).join("; "));
524701
524774
  this.errors = errors4;
524702
- Object.setPrototypeOf(this, new.target.prototype);
524703
- this.name = this.constructor.name;
524775
+ Object.setPrototypeOf(this, _ParseError.prototype);
524776
+ this.name = "ParseError";
524704
524777
  }
524705
524778
  };
524706
524779
 
@@ -526613,7 +526686,8 @@ var HttpRequest = schemas_exports.undiscriminatedUnion([schemas_exports.string()
526613
526686
  var HttpResponseSchemaDetailed = schemas_exports.object({
526614
526687
  type: schemas_exports.string().optional(),
526615
526688
  property: schemas_exports.string().optional(),
526616
- "status-code": schemas_exports.number().optional()
526689
+ "status-code": schemas_exports.number().optional(),
526690
+ "content-type": schemas_exports.string().optional()
526617
526691
  }).extend(WithDocsSchema);
526618
526692
 
526619
526693
  // ../fern-definition/schema/lib/schemas/serialization/resources/service/types/HttpResponseSchema.js
@@ -536856,7 +536930,9 @@ var StreamingResponse2 = schemas_exports3.union("type", {
536856
536930
  });
536857
536931
 
536858
536932
  // ../../ir-sdk/lib/sdk/serialization/resources/http/types/TextResponse.js
536859
- var TextResponse = schemas_exports3.objectWithoutOptionalProperties({}).extend(WithDocs).extend(WithV2Examples);
536933
+ var TextResponse = schemas_exports3.objectWithoutOptionalProperties({
536934
+ contentType: schemas_exports3.string().optional()
536935
+ }).extend(WithDocs).extend(WithV2Examples);
536860
536936
 
536861
536937
  // ../../ir-sdk/lib/sdk/serialization/resources/http/types/NonStreamHttpResponseBody.js
536862
536938
  var NonStreamHttpResponseBody2 = schemas_exports3.union("type", {
@@ -539816,7 +539892,8 @@ function visitEndpoint({ endpointId, endpoint: endpoint3, service, visitor, node
539816
539892
  }
539817
539893
  },
539818
539894
  property: noop2,
539819
- "status-code": noop2
539895
+ "status-code": noop2,
539896
+ "content-type": noop2
539820
539897
  });
539821
539898
  }
539822
539899
  },
@@ -568101,7 +568178,9 @@ var JsonResponse3 = schemas_exports9.objectWithoutOptionalProperties({
568101
568178
  }).extend(WithDescription).extend(WithSource).extend(WithStatusCode);
568102
568179
 
568103
568180
  // ../api-importers/openapi/openapi-ir/lib/sdk/serialization/resources/finalIr/types/TextResponse.js
568104
- var TextResponse2 = schemas_exports9.objectWithoutOptionalProperties({}).extend(WithDescription).extend(WithSource).extend(WithStatusCode);
568181
+ var TextResponse2 = schemas_exports9.objectWithoutOptionalProperties({
568182
+ contentType: schemas_exports9.string().optional()
568183
+ }).extend(WithDescription).extend(WithSource).extend(WithStatusCode);
568105
568184
 
568106
568185
  // ../api-importers/openapi/openapi-ir/lib/sdk/serialization/resources/finalIr/types/Response.js
568107
568186
  var Response5 = schemas_exports9.union("type", {
@@ -573169,7 +573248,8 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
573169
573248
  convertedEndpoint.response = {
573170
573249
  docs: textResponse.description ?? void 0,
573171
573250
  type: "text",
573172
- "status-code": textResponse.statusCode
573251
+ "status-code": textResponse.statusCode,
573252
+ "content-type": textResponse.contentType ?? void 0
573173
573253
  };
573174
573254
  },
573175
573255
  _other: () => {
@@ -573916,7 +573996,8 @@ function buildWebhooks(context3) {
573916
573996
  webhookDefinition.response = {
573917
573997
  docs: textResponse.description ?? void 0,
573918
573998
  type: "text",
573919
- "status-code": textResponse.statusCode
573999
+ "status-code": textResponse.statusCode,
574000
+ "content-type": textResponse.contentType ?? void 0
573920
574001
  };
573921
574002
  },
573922
574003
  streamingJson: (jsonResponse) => {
@@ -585359,14 +585440,25 @@ function convertResolvedResponse({ operationContext, streamFormat, streamTermina
585359
585440
  }
585360
585441
  if (mimeType.isText() && !mediaType.includes("event-stream")) {
585361
585442
  const textPlainSchema = mediaObject.schema;
585443
+ const contentType = !mimeType.isPlainText() ? mediaType : void 0;
585362
585444
  if (textPlainSchema == null) {
585363
- return ResponseWithExample.text({ description: resolvedResponse.description, source: source2, statusCode });
585445
+ return ResponseWithExample.text({
585446
+ description: resolvedResponse.description,
585447
+ source: source2,
585448
+ statusCode,
585449
+ contentType
585450
+ });
585364
585451
  }
585365
585452
  const resolvedTextPlainSchema = isReferenceObject(textPlainSchema) ? context3.resolveSchemaReference(textPlainSchema) : textPlainSchema;
585366
585453
  if (resolvedTextPlainSchema.type === "string" && resolvedTextPlainSchema.format === "byte") {
585367
585454
  return ResponseWithExample.file({ description: resolvedResponse.description, source: source2, statusCode });
585368
585455
  }
585369
- return ResponseWithExample.text({ description: resolvedResponse.description, source: source2, statusCode });
585456
+ return ResponseWithExample.text({
585457
+ description: resolvedResponse.description,
585458
+ source: source2,
585459
+ statusCode,
585460
+ contentType
585461
+ });
585370
585462
  }
585371
585463
  }
585372
585464
  return void 0;
@@ -608070,9 +608162,11 @@ function convertNonStreamHttpResponseBody({ endpoint: endpoint3, file: file4, ty
608070
608162
  v2Examples: void 0
608071
608163
  });
608072
608164
  } else if (parseRawTextType(responseType) != null) {
608165
+ const contentType = typeof response !== "string" ? response["content-type"] : void 0;
608073
608166
  return HttpResponseBody.text({
608074
608167
  docs: docs2,
608075
- v2Examples: void 0
608168
+ v2Examples: void 0,
608169
+ contentType: contentType ?? void 0
608076
608170
  });
608077
608171
  } else if (parseRawBytesType(responseType) != null) {
608078
608172
  return HttpResponseBody.bytes({
@@ -610881,9 +610975,11 @@ function convertWebhookResponseBody({ response, file: file4, typeResolver }) {
610881
610975
  v2Examples: void 0
610882
610976
  });
610883
610977
  } else if (parseRawTextType(responseType) != null) {
610978
+ const contentType = typeof response !== "string" ? response["content-type"] : void 0;
610884
610979
  return HttpResponseBody.text({
610885
610980
  docs: docs2,
610886
- v2Examples: void 0
610981
+ v2Examples: void 0,
610982
+ contentType: contentType ?? void 0
610887
610983
  });
610888
610984
  } else if (parseRawBytesType(responseType) != null) {
610889
610985
  return HttpResponseBody.bytes({
@@ -640009,6 +640105,16 @@ var definitions2 = {
640009
640105
  type: "null"
640010
640106
  }
640011
640107
  ]
640108
+ },
640109
+ "content-type": {
640110
+ oneOf: [
640111
+ {
640112
+ type: "string"
640113
+ },
640114
+ {
640115
+ type: "null"
640116
+ }
640117
+ ]
640012
640118
  }
640013
640119
  },
640014
640120
  additionalProperties: false
@@ -644289,6 +644395,16 @@ var definitions3 = {
644289
644395
  type: "null"
644290
644396
  }
644291
644397
  ]
644398
+ },
644399
+ "content-type": {
644400
+ oneOf: [
644401
+ {
644402
+ type: "string"
644403
+ },
644404
+ {
644405
+ type: "null"
644406
+ }
644407
+ ]
644292
644408
  }
644293
644409
  },
644294
644410
  additionalProperties: false
@@ -656800,7 +656916,8 @@ var ResponseBodyConverter = class extends converters_exports.AbstractConverters.
656800
656916
  }
656801
656917
  if (this.shouldReturnTextResponse(contentType)) {
656802
656918
  return this.returnTextResponse({
656803
- mediaTypeObject
656919
+ mediaTypeObject,
656920
+ contentType
656804
656921
  });
656805
656922
  }
656806
656923
  }
@@ -656956,7 +657073,7 @@ var ResponseBodyConverter = class extends converters_exports.AbstractConverters.
656956
657073
  headers: this.convertResponseHeaders()
656957
657074
  };
656958
657075
  }
656959
- returnTextResponse({ mediaTypeObject }) {
657076
+ returnTextResponse({ mediaTypeObject, contentType }) {
656960
657077
  return {
656961
657078
  responseBody: HttpResponseBody.text({
656962
657079
  docs: this.responseBody.description,
@@ -656964,7 +657081,8 @@ var ResponseBodyConverter = class extends converters_exports.AbstractConverters.
656964
657081
  mediaTypeObject,
656965
657082
  generateOptionalProperties: true,
656966
657083
  exampleGenerationStrategy: "response"
656967
- })
657084
+ }),
657085
+ contentType: MediaType.parse(contentType)?.isPlainText() ? void 0 : contentType
656968
657086
  }),
656969
657087
  streamResponseBody: void 0,
656970
657088
  inlinedTypes: {},
@@ -670346,7 +670464,7 @@ var AccessTokenPosthogManager = class {
670346
670464
  properties: {
670347
670465
  ...event,
670348
670466
  ...event.properties,
670349
- version: "5.47.2",
670467
+ version: "5.47.4",
670350
670468
  usingAccessToken: true,
670351
670469
  ...getRunIdProperties()
670352
670470
  }
@@ -670410,7 +670528,7 @@ var UserPosthogManager = class {
670410
670528
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
670411
670529
  event: "CLI",
670412
670530
  properties: {
670413
- version: "5.47.2",
670531
+ version: "5.47.4",
670414
670532
  ...event,
670415
670533
  ...event.properties,
670416
670534
  usingAccessToken: false,
@@ -821679,6 +821797,9 @@ function toPageNode({ docsWorkspace, page, parentSlug, idgen, markdownFilesToFul
821679
821797
  }
821680
821798
 
821681
821799
  // ../docs-resolver/lib/ApiReferenceNodeConverter.js
821800
+ function getFieldPath(operation) {
821801
+ return operation.fieldPath;
821802
+ }
821682
821803
  var ApiReferenceNodeConverter = class {
821683
821804
  apiSection;
821684
821805
  docsWorkspace;
@@ -822460,27 +822581,7 @@ ${tagInfo.description}`;
822460
822581
  }
822461
822582
  const sectionTitle = operationTypeLabels[operationType];
822462
822583
  const sectionSlug = namespaceSlug.append(kebabCase_default(sectionTitle));
822463
- const children2 = operations.map((operation) => {
822464
- const operationSlug = sectionSlug.append(operation.name ?? operation.id);
822465
- return {
822466
- id: navigation_exports.V1.NodeId(`${this.apiDefinitionId}:${operation.id}`),
822467
- type: "graphql",
822468
- collapsed: void 0,
822469
- operationType: operation.operationType,
822470
- graphqlOperationId: APIV1Read_exports.GraphQlOperationId(operation.id),
822471
- apiDefinitionId: this.apiDefinitionId,
822472
- availability: convertDocsAvailability(parentAvailability),
822473
- title: operation.displayName ?? operation.name ?? operation.id,
822474
- slug: operationSlug.get(),
822475
- icon: void 0,
822476
- hidden: this.hideChildren,
822477
- playground: void 0,
822478
- authed: void 0,
822479
- viewers: void 0,
822480
- orphaned: void 0,
822481
- featureFlags: void 0
822482
- };
822483
- });
822584
+ const children2 = this.#buildFieldPathGroupedChildren(operations, sectionSlug, parentAvailability, operationType);
822484
822585
  const sectionNode = {
822485
822586
  id: this.#idgen.get(`${this.apiDefinitionId}:graphql:${namespace}:${operationType}`),
822486
822587
  type: "apiPackage",
@@ -822536,27 +822637,7 @@ ${tagInfo.description}`;
822536
822637
  }
822537
822638
  const sectionTitle = operationTypeLabels[operationType];
822538
822639
  const sectionSlug = parentSlug.append(kebabCase_default(sectionTitle));
822539
- const children2 = operations.map((operation) => {
822540
- const operationSlug = sectionSlug.append(operation.name ?? operation.id);
822541
- return {
822542
- id: navigation_exports.V1.NodeId(`${this.apiDefinitionId}:${operation.id}`),
822543
- type: "graphql",
822544
- collapsed: void 0,
822545
- operationType: operation.operationType,
822546
- graphqlOperationId: APIV1Read_exports.GraphQlOperationId(operation.id),
822547
- apiDefinitionId: this.apiDefinitionId,
822548
- availability: convertDocsAvailability(parentAvailability),
822549
- title: operation.displayName ?? operation.name ?? operation.id,
822550
- slug: operationSlug.get(),
822551
- icon: void 0,
822552
- hidden: this.hideChildren,
822553
- playground: void 0,
822554
- authed: void 0,
822555
- viewers: void 0,
822556
- orphaned: void 0,
822557
- featureFlags: void 0
822558
- };
822559
- });
822640
+ const children2 = this.#buildFieldPathGroupedChildren(operations, sectionSlug, parentAvailability, operationType);
822560
822641
  const sectionNode = {
822561
822642
  id: this.#idgen.get(`${this.apiDefinitionId}:graphql:${operationType}`),
822562
822643
  type: "apiPackage",
@@ -822583,6 +822664,83 @@ ${tagInfo.description}`;
822583
822664
  }
822584
822665
  return sections;
822585
822666
  }
822667
+ #buildFieldPathGroupedChildren(operations, parentSlug, parentAvailability, operationType) {
822668
+ const shouldGroup = operationType === "QUERY";
822669
+ const groupedByParent = /* @__PURE__ */ new Map();
822670
+ const insertionOrder = [];
822671
+ for (const operation of operations) {
822672
+ const parentField = getFieldPath(operation)?.[0];
822673
+ if (shouldGroup && parentField != null) {
822674
+ const group = groupedByParent.get(parentField);
822675
+ if (group != null) {
822676
+ group.push(operation);
822677
+ } else {
822678
+ groupedByParent.set(parentField, [operation]);
822679
+ insertionOrder.push({ type: "group", parentField });
822680
+ }
822681
+ } else {
822682
+ insertionOrder.push({ type: "flat", operation });
822683
+ }
822684
+ }
822685
+ const children2 = [];
822686
+ for (const entry of insertionOrder) {
822687
+ if (entry.type === "flat") {
822688
+ const fieldPath = getFieldPath(entry.operation);
822689
+ const leafName = entry.operation.name ?? entry.operation.id;
822690
+ let operationSlug = parentSlug;
822691
+ if (fieldPath != null && fieldPath.length > 0) {
822692
+ for (const segment of fieldPath) {
822693
+ operationSlug = operationSlug.append(kebabCase_default(segment));
822694
+ }
822695
+ }
822696
+ operationSlug = operationSlug.append(kebabCase_default(leafName));
822697
+ children2.push({
822698
+ id: navigation_exports.V1.NodeId(`${this.apiDefinitionId}:${entry.operation.id}`),
822699
+ type: "graphql",
822700
+ collapsed: void 0,
822701
+ operationType: entry.operation.operationType,
822702
+ graphqlOperationId: APIV1Read_exports.GraphQlOperationId(entry.operation.id),
822703
+ apiDefinitionId: this.apiDefinitionId,
822704
+ availability: convertDocsAvailability(parentAvailability),
822705
+ title: entry.operation.displayName ?? entry.operation.name ?? entry.operation.id,
822706
+ slug: operationSlug.get(),
822707
+ icon: void 0,
822708
+ hidden: this.hideChildren,
822709
+ playground: void 0,
822710
+ authed: void 0,
822711
+ viewers: void 0,
822712
+ orphaned: void 0,
822713
+ featureFlags: void 0
822714
+ });
822715
+ } else {
822716
+ const groupOps = groupedByParent.get(entry.parentField) ?? [];
822717
+ const firstOp = groupOps[0];
822718
+ if (firstOp == null) {
822719
+ continue;
822720
+ }
822721
+ const fieldSlug = parentSlug.append(kebabCase_default(entry.parentField));
822722
+ children2.push({
822723
+ id: navigation_exports.V1.NodeId(`${this.apiDefinitionId}:${firstOp.id}`),
822724
+ type: "graphql",
822725
+ collapsed: void 0,
822726
+ operationType: firstOp.operationType,
822727
+ graphqlOperationId: APIV1Read_exports.GraphQlOperationId(firstOp.id),
822728
+ apiDefinitionId: this.apiDefinitionId,
822729
+ availability: convertDocsAvailability(parentAvailability),
822730
+ title: entry.parentField,
822731
+ slug: fieldSlug.get(),
822732
+ icon: void 0,
822733
+ hidden: this.hideChildren,
822734
+ playground: void 0,
822735
+ authed: void 0,
822736
+ viewers: void 0,
822737
+ orphaned: void 0,
822738
+ featureFlags: void 0
822739
+ });
822740
+ }
822741
+ }
822742
+ return children2;
822743
+ }
822586
822744
  #convertApiDefinitionPackageId(packageId, parentSlug, parentAvailability) {
822587
822745
  const pkg2 = packageId != null ? this.#holder.resolveSubpackage(this.#holder.getSubpackageByIdOrLocator(packageId)) : void 0;
822588
822746
  if (pkg2 == null) {
@@ -862379,7 +862537,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
862379
862537
  var LOGS_FOLDER_NAME = "logs";
862380
862538
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
862381
862539
  function getCliSource() {
862382
- const version7 = "5.47.2";
862540
+ const version7 = "5.47.4";
862383
862541
  return `cli@${version7}`;
862384
862542
  }
862385
862543
  var DebugLogger = class {
@@ -893608,7 +893766,7 @@ var LegacyDocsPublisher = class {
893608
893766
  previewId,
893609
893767
  disableTemplates: void 0,
893610
893768
  skipUpload,
893611
- cliVersion: "5.47.2",
893769
+ cliVersion: "5.47.4",
893612
893770
  loginCommand: "fern auth login"
893613
893771
  });
893614
893772
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -958989,7 +959147,7 @@ function getAutomationContextFromEnv() {
958989
959147
  config_branch: process.env.FERN_CONFIG_BRANCH,
958990
959148
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
958991
959149
  trigger: process.env.GITHUB_EVENT_NAME,
958992
- cli_version: "5.47.2"
959150
+ cli_version: "5.47.4"
958993
959151
  };
958994
959152
  }
958995
959153
  function isAutomationMode() {
@@ -959815,7 +959973,7 @@ var CliContext = class _CliContext {
959815
959973
  if (false) {
959816
959974
  this.logger.error("CLI_VERSION is not defined");
959817
959975
  }
959818
- return "5.47.2";
959976
+ return "5.47.4";
959819
959977
  }
959820
959978
  getCliName() {
959821
959979
  if (false) {
@@ -970069,10 +970227,11 @@ function convertResponse3({
970069
970227
  }
970070
970228
  };
970071
970229
  } else if (httpResponse?.body?.type === "text") {
970230
+ const textContentType = httpResponse.body.contentType ?? "text/plain";
970072
970231
  responseByStatusCode[String(httpResponse.statusCode ?? 200)] = {
970073
970232
  description: httpResponse.body.docs ?? "",
970074
970233
  content: {
970075
- "text/plain": {
970234
+ [textContentType]: {
970076
970235
  schema: {
970077
970236
  type: "string"
970078
970237
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.47.2",
2
+ "version": "5.47.4",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",