@fern-api/fern-api-dev 5.47.3 → 5.47.5

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 +337 -224
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -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",
@@ -650617,6 +650690,7 @@ var MapSchemaConverter = class extends AbstractConverter {
650617
650690
  for (const typeId of Object.keys(convertedAdditionalProperties.inlinedTypes)) {
650618
650691
  referencedTypes.add(typeId);
650619
650692
  }
650693
+ collectNamedTypeIdsFromTypeReference(convertedAdditionalProperties.type, referencedTypes);
650620
650694
  return {
650621
650695
  type: Type.alias({
650622
650696
  aliasOf: additionalPropertiesType,
@@ -650801,167 +650875,6 @@ function isPlainObject18(value2) {
650801
650875
 
650802
650876
  // ../api-importers/v3-importer-commons/lib/converters/schema/ObjectSchemaConverter.js
650803
650877
  init_lib4();
650804
-
650805
- // ../api-importers/v3-importer-commons/lib/utils/ConvertProperties.js
650806
- function convertProperties({ properties: properties7, required: required6, breadcrumbs, context: context3, errorCollector }) {
650807
- const convertedProperties = [];
650808
- let inlinedTypesFromProperties = {};
650809
- const propertiesByAudience = {};
650810
- const referencedTypes = /* @__PURE__ */ new Set();
650811
- for (const [propertyName, propertySchema] of Object.entries(properties7 ?? {})) {
650812
- const propertyBreadcrumbs = [...breadcrumbs, "properties", propertyName];
650813
- if (typeof propertySchema !== "object") {
650814
- errorCollector.collect({
650815
- message: `Schema property ${propertyName} should be an object`,
650816
- path: propertyBreadcrumbs
650817
- });
650818
- continue;
650819
- }
650820
- const propertyId = maybeGetFernTypeNameExtension(breadcrumbs, propertySchema, context3) ?? context3.convertBreadcrumbsToName(propertyBreadcrumbs);
650821
- const isNullable = "nullable" in propertySchema ? propertySchema.nullable : false;
650822
- const propertySchemaConverter = new SchemaOrReferenceConverter({
650823
- context: context3,
650824
- breadcrumbs: propertyBreadcrumbs,
650825
- schemaOrReference: propertySchema,
650826
- schemaIdOverride: propertyId,
650827
- wrapAsOptional: !required6.includes(propertyName),
650828
- wrapAsNullable: isNullable
650829
- });
650830
- const convertedProperty = propertySchemaConverter.convert();
650831
- if (convertedProperty != null) {
650832
- const resolvedPropertySchema = context3.resolveMaybeReference({
650833
- schemaOrReference: propertySchema,
650834
- breadcrumbs: propertyBreadcrumbs,
650835
- skipErrorCollector: true
650836
- });
650837
- convertedProperties.push({
650838
- name: context3.casingsGenerator.generateNameAndWireValue({
650839
- name: propertyName,
650840
- wireValue: propertyName
650841
- }),
650842
- valueType: convertedProperty.type,
650843
- docs: propertySchema.description,
650844
- availability: convertedProperty.availability,
650845
- propertyAccess: context3.getPropertyAccess(propertySchema),
650846
- defaultValue: resolvedPropertySchema?.default,
650847
- v2Examples: convertedProperty.schema?.typeDeclaration?.v2Examples ?? generatePropertyV2Examples({
650848
- propertySchema,
650849
- breadcrumbs: propertyBreadcrumbs,
650850
- context: context3,
650851
- propertyId
650852
- })
650853
- });
650854
- inlinedTypesFromProperties = {
650855
- ...inlinedTypesFromProperties,
650856
- ...convertedProperty.inlinedTypes
650857
- };
650858
- if (convertedProperty.schema?.typeDeclaration.referencedTypes != null) {
650859
- convertedProperty.schema.typeDeclaration.referencedTypes.forEach((type8) => {
650860
- referencedTypes.add(type8);
650861
- });
650862
- }
650863
- collectNamedTypeIdsFromTypeReference(convertedProperty.type, referencedTypes);
650864
- for (const audience of convertedProperty.schema?.audiences ?? []) {
650865
- if (propertiesByAudience[audience] == null) {
650866
- propertiesByAudience[audience] = /* @__PURE__ */ new Set();
650867
- }
650868
- propertiesByAudience[audience].add(propertyName);
650869
- }
650870
- }
650871
- }
650872
- for (const typeId of Object.keys(inlinedTypesFromProperties)) {
650873
- referencedTypes.add(typeId);
650874
- }
650875
- return { convertedProperties, propertiesByAudience, inlinedTypesFromProperties, referencedTypes };
650876
- }
650877
- function generatePropertyV2Examples({ propertySchema, breadcrumbs, context: context3, propertyId }) {
650878
- const resolvedSchema = context3.resolveMaybeReference({
650879
- schemaOrReference: propertySchema,
650880
- breadcrumbs,
650881
- skipErrorCollector: true
650882
- });
650883
- const examples = context3.getExamplesFromSchema({
650884
- schema: resolvedSchema ?? void 0,
650885
- breadcrumbs
650886
- });
650887
- if (examples.length > 0) {
650888
- const userSpecifiedExamples = {};
650889
- for (const [index3, example] of examples.entries()) {
650890
- const resolvedExample = context3.resolveExample(example);
650891
- const exampleName2 = `${propertyId}_example_${index3}`;
650892
- const exampleConverter2 = new ExampleConverter({
650893
- breadcrumbs,
650894
- context: context3,
650895
- schema: propertySchema,
650896
- example: resolvedExample
650897
- });
650898
- const { validExample: validExample2 } = exampleConverter2.convert();
650899
- userSpecifiedExamples[exampleName2] = validExample2;
650900
- }
650901
- return { userSpecifiedExamples, autogeneratedExamples: {} };
650902
- }
650903
- const exampleName = `${propertyId}_example_autogenerated`;
650904
- const exampleConverter = new ExampleConverter({
650905
- breadcrumbs,
650906
- context: context3,
650907
- schema: propertySchema,
650908
- example: void 0,
650909
- generateOptionalProperties: true
650910
- });
650911
- const { validExample } = exampleConverter.convert();
650912
- return {
650913
- userSpecifiedExamples: {},
650914
- autogeneratedExamples: { [exampleName]: validExample }
650915
- };
650916
- }
650917
- function maybeGetFernTypeNameExtension(breadcrumbs, schema2, context3) {
650918
- if (context3.isReferenceObject(schema2)) {
650919
- return void 0;
650920
- }
650921
- const fernTypeNameConverter = new extensions_exports.FernTypeNameExtension({
650922
- breadcrumbs,
650923
- schema: schema2,
650924
- context: context3
650925
- });
650926
- return fernTypeNameConverter.convert();
650927
- }
650928
- function collectNamedTypeIdsFromTypeReference(typeReference2, referencedTypes) {
650929
- switch (typeReference2.type) {
650930
- case "named":
650931
- referencedTypes.add(typeReference2.typeId);
650932
- return;
650933
- case "primitive":
650934
- case "unknown":
650935
- return;
650936
- case "container":
650937
- collectNamedTypeIdsFromContainer(typeReference2.container, referencedTypes);
650938
- return;
650939
- }
650940
- }
650941
- function collectNamedTypeIdsFromContainer(container, referencedTypes) {
650942
- switch (container.type) {
650943
- case "list":
650944
- collectNamedTypeIdsFromTypeReference(container.list, referencedTypes);
650945
- return;
650946
- case "set":
650947
- collectNamedTypeIdsFromTypeReference(container.set, referencedTypes);
650948
- return;
650949
- case "optional":
650950
- collectNamedTypeIdsFromTypeReference(container.optional, referencedTypes);
650951
- return;
650952
- case "nullable":
650953
- collectNamedTypeIdsFromTypeReference(container.nullable, referencedTypes);
650954
- return;
650955
- case "map":
650956
- collectNamedTypeIdsFromTypeReference(container.keyType, referencedTypes);
650957
- collectNamedTypeIdsFromTypeReference(container.valueType, referencedTypes);
650958
- return;
650959
- case "literal":
650960
- return;
650961
- }
650962
- }
650963
-
650964
- // ../api-importers/v3-importer-commons/lib/converters/schema/ObjectSchemaConverter.js
650965
650878
  var ObjectSchemaConverter = class extends AbstractConverter {
650966
650879
  schema;
650967
650880
  constructor({ context: context3, breadcrumbs, schema: schema2 }) {
@@ -652610,6 +652523,165 @@ function isMetadataOnlySchema(schema2) {
652610
652523
  return Object.keys(schema2).every((key2) => METADATA_ONLY_FIELDS.has(key2));
652611
652524
  }
652612
652525
 
652526
+ // ../api-importers/v3-importer-commons/lib/utils/ConvertProperties.js
652527
+ function convertProperties({ properties: properties7, required: required6, breadcrumbs, context: context3, errorCollector }) {
652528
+ const convertedProperties = [];
652529
+ let inlinedTypesFromProperties = {};
652530
+ const propertiesByAudience = {};
652531
+ const referencedTypes = /* @__PURE__ */ new Set();
652532
+ for (const [propertyName, propertySchema] of Object.entries(properties7 ?? {})) {
652533
+ const propertyBreadcrumbs = [...breadcrumbs, "properties", propertyName];
652534
+ if (typeof propertySchema !== "object") {
652535
+ errorCollector.collect({
652536
+ message: `Schema property ${propertyName} should be an object`,
652537
+ path: propertyBreadcrumbs
652538
+ });
652539
+ continue;
652540
+ }
652541
+ const propertyId = maybeGetFernTypeNameExtension(breadcrumbs, propertySchema, context3) ?? context3.convertBreadcrumbsToName(propertyBreadcrumbs);
652542
+ const isNullable = "nullable" in propertySchema ? propertySchema.nullable : false;
652543
+ const propertySchemaConverter = new SchemaOrReferenceConverter({
652544
+ context: context3,
652545
+ breadcrumbs: propertyBreadcrumbs,
652546
+ schemaOrReference: propertySchema,
652547
+ schemaIdOverride: propertyId,
652548
+ wrapAsOptional: !required6.includes(propertyName),
652549
+ wrapAsNullable: isNullable
652550
+ });
652551
+ const convertedProperty = propertySchemaConverter.convert();
652552
+ if (convertedProperty != null) {
652553
+ const resolvedPropertySchema = context3.resolveMaybeReference({
652554
+ schemaOrReference: propertySchema,
652555
+ breadcrumbs: propertyBreadcrumbs,
652556
+ skipErrorCollector: true
652557
+ });
652558
+ convertedProperties.push({
652559
+ name: context3.casingsGenerator.generateNameAndWireValue({
652560
+ name: propertyName,
652561
+ wireValue: propertyName
652562
+ }),
652563
+ valueType: convertedProperty.type,
652564
+ docs: propertySchema.description,
652565
+ availability: convertedProperty.availability,
652566
+ propertyAccess: context3.getPropertyAccess(propertySchema),
652567
+ defaultValue: resolvedPropertySchema?.default,
652568
+ v2Examples: convertedProperty.schema?.typeDeclaration?.v2Examples ?? generatePropertyV2Examples({
652569
+ propertySchema,
652570
+ breadcrumbs: propertyBreadcrumbs,
652571
+ context: context3,
652572
+ propertyId
652573
+ })
652574
+ });
652575
+ inlinedTypesFromProperties = {
652576
+ ...inlinedTypesFromProperties,
652577
+ ...convertedProperty.inlinedTypes
652578
+ };
652579
+ if (convertedProperty.schema?.typeDeclaration.referencedTypes != null) {
652580
+ convertedProperty.schema.typeDeclaration.referencedTypes.forEach((type8) => {
652581
+ referencedTypes.add(type8);
652582
+ });
652583
+ }
652584
+ collectNamedTypeIdsFromTypeReference(convertedProperty.type, referencedTypes);
652585
+ for (const audience of convertedProperty.schema?.audiences ?? []) {
652586
+ if (propertiesByAudience[audience] == null) {
652587
+ propertiesByAudience[audience] = /* @__PURE__ */ new Set();
652588
+ }
652589
+ propertiesByAudience[audience].add(propertyName);
652590
+ }
652591
+ }
652592
+ }
652593
+ for (const typeId of Object.keys(inlinedTypesFromProperties)) {
652594
+ referencedTypes.add(typeId);
652595
+ }
652596
+ return { convertedProperties, propertiesByAudience, inlinedTypesFromProperties, referencedTypes };
652597
+ }
652598
+ function generatePropertyV2Examples({ propertySchema, breadcrumbs, context: context3, propertyId }) {
652599
+ const resolvedSchema = context3.resolveMaybeReference({
652600
+ schemaOrReference: propertySchema,
652601
+ breadcrumbs,
652602
+ skipErrorCollector: true
652603
+ });
652604
+ const examples = context3.getExamplesFromSchema({
652605
+ schema: resolvedSchema ?? void 0,
652606
+ breadcrumbs
652607
+ });
652608
+ if (examples.length > 0) {
652609
+ const userSpecifiedExamples = {};
652610
+ for (const [index3, example] of examples.entries()) {
652611
+ const resolvedExample = context3.resolveExample(example);
652612
+ const exampleName2 = `${propertyId}_example_${index3}`;
652613
+ const exampleConverter2 = new ExampleConverter({
652614
+ breadcrumbs,
652615
+ context: context3,
652616
+ schema: propertySchema,
652617
+ example: resolvedExample
652618
+ });
652619
+ const { validExample: validExample2 } = exampleConverter2.convert();
652620
+ userSpecifiedExamples[exampleName2] = validExample2;
652621
+ }
652622
+ return { userSpecifiedExamples, autogeneratedExamples: {} };
652623
+ }
652624
+ const exampleName = `${propertyId}_example_autogenerated`;
652625
+ const exampleConverter = new ExampleConverter({
652626
+ breadcrumbs,
652627
+ context: context3,
652628
+ schema: propertySchema,
652629
+ example: void 0,
652630
+ generateOptionalProperties: true
652631
+ });
652632
+ const { validExample } = exampleConverter.convert();
652633
+ return {
652634
+ userSpecifiedExamples: {},
652635
+ autogeneratedExamples: { [exampleName]: validExample }
652636
+ };
652637
+ }
652638
+ function maybeGetFernTypeNameExtension(breadcrumbs, schema2, context3) {
652639
+ if (context3.isReferenceObject(schema2)) {
652640
+ return void 0;
652641
+ }
652642
+ const fernTypeNameConverter = new extensions_exports.FernTypeNameExtension({
652643
+ breadcrumbs,
652644
+ schema: schema2,
652645
+ context: context3
652646
+ });
652647
+ return fernTypeNameConverter.convert();
652648
+ }
652649
+ function collectNamedTypeIdsFromTypeReference(typeReference2, referencedTypes) {
652650
+ switch (typeReference2.type) {
652651
+ case "named":
652652
+ referencedTypes.add(typeReference2.typeId);
652653
+ return;
652654
+ case "primitive":
652655
+ case "unknown":
652656
+ return;
652657
+ case "container":
652658
+ collectNamedTypeIdsFromContainer(typeReference2.container, referencedTypes);
652659
+ return;
652660
+ }
652661
+ }
652662
+ function collectNamedTypeIdsFromContainer(container, referencedTypes) {
652663
+ switch (container.type) {
652664
+ case "list":
652665
+ collectNamedTypeIdsFromTypeReference(container.list, referencedTypes);
652666
+ return;
652667
+ case "set":
652668
+ collectNamedTypeIdsFromTypeReference(container.set, referencedTypes);
652669
+ return;
652670
+ case "optional":
652671
+ collectNamedTypeIdsFromTypeReference(container.optional, referencedTypes);
652672
+ return;
652673
+ case "nullable":
652674
+ collectNamedTypeIdsFromTypeReference(container.nullable, referencedTypes);
652675
+ return;
652676
+ case "map":
652677
+ collectNamedTypeIdsFromTypeReference(container.keyType, referencedTypes);
652678
+ collectNamedTypeIdsFromTypeReference(container.valueType, referencedTypes);
652679
+ return;
652680
+ case "literal":
652681
+ return;
652682
+ }
652683
+ }
652684
+
652613
652685
  // ../api-importers/v3-importer-commons/lib/converters/schema/ArraySchemaConverter.js
652614
652686
  var ArraySchemaConverter = class _ArraySchemaConverter extends AbstractConverter {
652615
652687
  static LIST_UNKNOWN = TypeReference2.container(ContainerType.list(TypeReference2.unknown()));
@@ -652643,6 +652715,7 @@ var ArraySchemaConverter = class _ArraySchemaConverter extends AbstractConverter
652643
652715
  });
652644
652716
  });
652645
652717
  }
652718
+ collectNamedTypeIdsFromTypeReference(convertedSchema.type, referencedTypes);
652646
652719
  return {
652647
652720
  typeReference: TypeReference2.container(ContainerType.list(convertedSchema.type)),
652648
652721
  referencedTypes,
@@ -670391,7 +670464,7 @@ var AccessTokenPosthogManager = class {
670391
670464
  properties: {
670392
670465
  ...event,
670393
670466
  ...event.properties,
670394
- version: "5.47.3",
670467
+ version: "5.47.5",
670395
670468
  usingAccessToken: true,
670396
670469
  ...getRunIdProperties()
670397
670470
  }
@@ -670455,7 +670528,7 @@ var UserPosthogManager = class {
670455
670528
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
670456
670529
  event: "CLI",
670457
670530
  properties: {
670458
- version: "5.47.3",
670531
+ version: "5.47.5",
670459
670532
  ...event,
670460
670533
  ...event.properties,
670461
670534
  usingAccessToken: false,
@@ -821724,6 +821797,9 @@ function toPageNode({ docsWorkspace, page, parentSlug, idgen, markdownFilesToFul
821724
821797
  }
821725
821798
 
821726
821799
  // ../docs-resolver/lib/ApiReferenceNodeConverter.js
821800
+ function getFieldPath(operation) {
821801
+ return operation.fieldPath;
821802
+ }
821727
821803
  var ApiReferenceNodeConverter = class {
821728
821804
  apiSection;
821729
821805
  docsWorkspace;
@@ -822505,27 +822581,7 @@ ${tagInfo.description}`;
822505
822581
  }
822506
822582
  const sectionTitle = operationTypeLabels[operationType];
822507
822583
  const sectionSlug = namespaceSlug.append(kebabCase_default(sectionTitle));
822508
- const children2 = operations.map((operation) => {
822509
- const operationSlug = sectionSlug.append(operation.name ?? operation.id);
822510
- return {
822511
- id: navigation_exports.V1.NodeId(`${this.apiDefinitionId}:${operation.id}`),
822512
- type: "graphql",
822513
- collapsed: void 0,
822514
- operationType: operation.operationType,
822515
- graphqlOperationId: APIV1Read_exports.GraphQlOperationId(operation.id),
822516
- apiDefinitionId: this.apiDefinitionId,
822517
- availability: convertDocsAvailability(parentAvailability),
822518
- title: operation.displayName ?? operation.name ?? operation.id,
822519
- slug: operationSlug.get(),
822520
- icon: void 0,
822521
- hidden: this.hideChildren,
822522
- playground: void 0,
822523
- authed: void 0,
822524
- viewers: void 0,
822525
- orphaned: void 0,
822526
- featureFlags: void 0
822527
- };
822528
- });
822584
+ const children2 = this.#buildFieldPathGroupedChildren(operations, sectionSlug, parentAvailability, operationType);
822529
822585
  const sectionNode = {
822530
822586
  id: this.#idgen.get(`${this.apiDefinitionId}:graphql:${namespace}:${operationType}`),
822531
822587
  type: "apiPackage",
@@ -822581,27 +822637,7 @@ ${tagInfo.description}`;
822581
822637
  }
822582
822638
  const sectionTitle = operationTypeLabels[operationType];
822583
822639
  const sectionSlug = parentSlug.append(kebabCase_default(sectionTitle));
822584
- const children2 = operations.map((operation) => {
822585
- const operationSlug = sectionSlug.append(operation.name ?? operation.id);
822586
- return {
822587
- id: navigation_exports.V1.NodeId(`${this.apiDefinitionId}:${operation.id}`),
822588
- type: "graphql",
822589
- collapsed: void 0,
822590
- operationType: operation.operationType,
822591
- graphqlOperationId: APIV1Read_exports.GraphQlOperationId(operation.id),
822592
- apiDefinitionId: this.apiDefinitionId,
822593
- availability: convertDocsAvailability(parentAvailability),
822594
- title: operation.displayName ?? operation.name ?? operation.id,
822595
- slug: operationSlug.get(),
822596
- icon: void 0,
822597
- hidden: this.hideChildren,
822598
- playground: void 0,
822599
- authed: void 0,
822600
- viewers: void 0,
822601
- orphaned: void 0,
822602
- featureFlags: void 0
822603
- };
822604
- });
822640
+ const children2 = this.#buildFieldPathGroupedChildren(operations, sectionSlug, parentAvailability, operationType);
822605
822641
  const sectionNode = {
822606
822642
  id: this.#idgen.get(`${this.apiDefinitionId}:graphql:${operationType}`),
822607
822643
  type: "apiPackage",
@@ -822628,6 +822664,83 @@ ${tagInfo.description}`;
822628
822664
  }
822629
822665
  return sections;
822630
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
+ }
822631
822744
  #convertApiDefinitionPackageId(packageId, parentSlug, parentAvailability) {
822632
822745
  const pkg2 = packageId != null ? this.#holder.resolveSubpackage(this.#holder.getSubpackageByIdOrLocator(packageId)) : void 0;
822633
822746
  if (pkg2 == null) {
@@ -862424,7 +862537,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
862424
862537
  var LOGS_FOLDER_NAME = "logs";
862425
862538
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
862426
862539
  function getCliSource() {
862427
- const version7 = "5.47.3";
862540
+ const version7 = "5.47.5";
862428
862541
  return `cli@${version7}`;
862429
862542
  }
862430
862543
  var DebugLogger = class {
@@ -893653,7 +893766,7 @@ var LegacyDocsPublisher = class {
893653
893766
  previewId,
893654
893767
  disableTemplates: void 0,
893655
893768
  skipUpload,
893656
- cliVersion: "5.47.3",
893769
+ cliVersion: "5.47.5",
893657
893770
  loginCommand: "fern auth login"
893658
893771
  });
893659
893772
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -959034,7 +959147,7 @@ function getAutomationContextFromEnv() {
959034
959147
  config_branch: process.env.FERN_CONFIG_BRANCH,
959035
959148
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
959036
959149
  trigger: process.env.GITHUB_EVENT_NAME,
959037
- cli_version: "5.47.3"
959150
+ cli_version: "5.47.5"
959038
959151
  };
959039
959152
  }
959040
959153
  function isAutomationMode() {
@@ -959860,7 +959973,7 @@ var CliContext = class _CliContext {
959860
959973
  if (false) {
959861
959974
  this.logger.error("CLI_VERSION is not defined");
959862
959975
  }
959863
- return "5.47.3";
959976
+ return "5.47.5";
959864
959977
  }
959865
959978
  getCliName() {
959866
959979
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.47.3",
2
+ "version": "5.47.5",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",