@fern-api/fern-api-dev 3.50.3 → 3.51.0-2-g73891ac737a

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 +157 -112
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1430941,7 +1430941,7 @@ var AccessTokenPosthogManager = class {
1430941
1430941
  properties: {
1430942
1430942
  ...event,
1430943
1430943
  ...event.properties,
1430944
- version: "3.50.3",
1430944
+ version: "3.51.0-2-g73891ac737a",
1430945
1430945
  usingAccessToken: true
1430946
1430946
  }
1430947
1430947
  });
@@ -1431040,7 +1431040,7 @@ var UserPosthogManager = class {
1431040
1431040
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1431041
1431041
  event: "CLI",
1431042
1431042
  properties: {
1431043
- version: "3.50.3",
1431043
+ version: "3.51.0-2-g73891ac737a",
1431044
1431044
  ...event,
1431045
1431045
  ...event.properties,
1431046
1431046
  usingAccessToken: false,
@@ -1510475,7 +1510475,7 @@ var CliContext = class {
1510475
1510475
  if (false) {
1510476
1510476
  this.logger.error("CLI_VERSION is not defined");
1510477
1510477
  }
1510478
- return "3.50.3";
1510478
+ return "3.51.0-2-g73891ac737a";
1510479
1510479
  }
1510480
1510480
  getCliName() {
1510481
1510481
  if (false) {
@@ -1534814,6 +1534814,113 @@ function getFernPaginationExtension(document4, operation) {
1534814
1534814
  return convertPaginationExtension(pagination);
1534815
1534815
  }
1534816
1534816
 
1534817
+ // ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/converters/endpoint/getApplicationJsonSchema.js
1534818
+ function getTextEventStreamObject(media2, context2) {
1534819
+ for (const contentType of Object.keys(media2)) {
1534820
+ if (contentType.includes("text/event-stream")) {
1534821
+ const mediaObject = media2[contentType];
1534822
+ if (mediaObject == null) {
1534823
+ continue;
1534824
+ }
1534825
+ const mediaObjectWithItemSchema = mediaObject;
1534826
+ const schema2 = mediaObject.schema ?? mediaObjectWithItemSchema.itemSchema;
1534827
+ return {
1534828
+ contentType,
1534829
+ schema: schema2 ?? {},
1534830
+ examples: getExamples2(mediaObject, context2)
1534831
+ };
1534832
+ }
1534833
+ }
1534834
+ return void 0;
1534835
+ }
1534836
+ function hasTextEventStreamWithItemSchema(media2) {
1534837
+ for (const contentType of Object.keys(media2)) {
1534838
+ if (contentType.includes("text/event-stream")) {
1534839
+ const mediaObject = media2[contentType];
1534840
+ if (mediaObject == null) {
1534841
+ continue;
1534842
+ }
1534843
+ const mediaObjectWithItemSchema = mediaObject;
1534844
+ if (mediaObjectWithItemSchema.itemSchema != null) {
1534845
+ return true;
1534846
+ }
1534847
+ }
1534848
+ }
1534849
+ return false;
1534850
+ }
1534851
+ function isApplicationJsonMediaType(mediaType) {
1534852
+ return mediaType.includes("json") || mediaType === "*/*";
1534853
+ }
1534854
+ function findApplicationJsonRequest({ content: content5, context: context2 }) {
1534855
+ for (const [mediaType, mediaTypeObject] of Object.entries(content5)) {
1534856
+ const result = getApplicationJsonSchemaMediaObject({
1534857
+ mediaType,
1534858
+ mediaTypeObject,
1534859
+ context: context2
1534860
+ });
1534861
+ if (result != null) {
1534862
+ return [mediaType, mediaTypeObject];
1534863
+ }
1534864
+ }
1534865
+ return void 0;
1534866
+ }
1534867
+ function getApplicationJsonSchemaMediaObject({ mediaType, mediaTypeObject, context: context2 }) {
1534868
+ if (!isApplicationJsonMediaType(mediaType)) {
1534869
+ return void 0;
1534870
+ }
1534871
+ const schema2 = mediaTypeObject.schema;
1534872
+ return {
1534873
+ contentType: !mediaType.includes("*") ? mediaType : void 0,
1534874
+ schema: schema2 ?? {},
1534875
+ examples: getExamples2(mediaTypeObject, context2)
1534876
+ };
1534877
+ }
1534878
+ function getApplicationJsonSchemaMediaObjectFromContent({ content: content5, context: context2 }) {
1534879
+ const request6 = findApplicationJsonRequest({ content: content5, context: context2 });
1534880
+ if (!request6) {
1534881
+ return void 0;
1534882
+ }
1534883
+ const [mediaType, mediaTypeObject] = request6;
1534884
+ return getApplicationJsonSchemaMediaObject({ mediaType, mediaTypeObject, context: context2 });
1534885
+ }
1534886
+ function getSchemaMediaObject(media2, context2) {
1534887
+ for (const contentType of Object.keys(media2)) {
1534888
+ const mediaObject = media2[contentType];
1534889
+ if (mediaObject == null) {
1534890
+ continue;
1534891
+ }
1534892
+ const schema2 = mediaObject.schema;
1534893
+ return {
1534894
+ schema: schema2 ?? {},
1534895
+ examples: getExamples2(mediaObject, context2)
1534896
+ };
1534897
+ }
1534898
+ return void 0;
1534899
+ }
1534900
+ function getExamples2(mediaObject, context2) {
1534901
+ const fullExamples = [];
1534902
+ if (mediaObject.example != null) {
1534903
+ fullExamples.push({ name: void 0, value: mediaObject.example, description: void 0 });
1534904
+ }
1534905
+ const examples = getExtension(mediaObject, OpenAPIExtension.EXAMPLES);
1534906
+ if (examples != null && Object.keys(examples).length > 0) {
1534907
+ fullExamples.push(...Object.entries(examples).map(([name3, value]) => {
1534908
+ return { name: value.summary ?? name3, value: value.value, description: value.description };
1534909
+ }));
1534910
+ }
1534911
+ if (mediaObject.examples != null && Object.keys(mediaObject.examples).length > 0) {
1534912
+ fullExamples.push(...Object.entries(mediaObject.examples).map(([name3, example]) => {
1534913
+ const resolvedExample = isReferenceObject(example) ? context2.resolveExampleReference(example) : example;
1534914
+ return {
1534915
+ name: resolvedExample.summary ?? name3,
1534916
+ value: resolvedExample.value,
1534917
+ description: resolvedExample.description
1534918
+ };
1534919
+ }));
1534920
+ }
1534921
+ return fullExamples;
1534922
+ }
1534923
+
1534817
1534924
  // ../api-importers/openapi/openapi-ir-parser/lib/schema/utils/getReferenceOccurrences.js
1534818
1534925
  function getReferenceOccurrences(document4) {
1534819
1534926
  const contentConflictsRemovedDocument = removeApplicationJsonAndMultipartConflictsFromDocument(document4);
@@ -1535538,97 +1535645,6 @@ function getExplodeForPathParameter(parameter) {
1535538
1535645
  return explode === false ? void 0 : explode;
1535539
1535646
  }
1535540
1535647
 
1535541
- // ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/converters/endpoint/getApplicationJsonSchema.js
1535542
- function getTextEventStreamObject(media2, context2) {
1535543
- for (const contentType of Object.keys(media2)) {
1535544
- if (contentType.includes("text/event-stream")) {
1535545
- const mediaObject = media2[contentType];
1535546
- if (mediaObject == null) {
1535547
- continue;
1535548
- }
1535549
- const schema2 = mediaObject.schema;
1535550
- return {
1535551
- contentType,
1535552
- schema: schema2 ?? {},
1535553
- examples: getExamples2(mediaObject, context2)
1535554
- };
1535555
- }
1535556
- }
1535557
- return void 0;
1535558
- }
1535559
- function isApplicationJsonMediaType(mediaType) {
1535560
- return mediaType.includes("json") || mediaType === "*/*";
1535561
- }
1535562
- function findApplicationJsonRequest({ content: content5, context: context2 }) {
1535563
- for (const [mediaType, mediaTypeObject] of Object.entries(content5)) {
1535564
- const result = getApplicationJsonSchemaMediaObject({
1535565
- mediaType,
1535566
- mediaTypeObject,
1535567
- context: context2
1535568
- });
1535569
- if (result != null) {
1535570
- return [mediaType, mediaTypeObject];
1535571
- }
1535572
- }
1535573
- return void 0;
1535574
- }
1535575
- function getApplicationJsonSchemaMediaObject({ mediaType, mediaTypeObject, context: context2 }) {
1535576
- if (!isApplicationJsonMediaType(mediaType)) {
1535577
- return void 0;
1535578
- }
1535579
- const schema2 = mediaTypeObject.schema;
1535580
- return {
1535581
- contentType: !mediaType.includes("*") ? mediaType : void 0,
1535582
- schema: schema2 ?? {},
1535583
- examples: getExamples2(mediaTypeObject, context2)
1535584
- };
1535585
- }
1535586
- function getApplicationJsonSchemaMediaObjectFromContent({ content: content5, context: context2 }) {
1535587
- const request6 = findApplicationJsonRequest({ content: content5, context: context2 });
1535588
- if (!request6) {
1535589
- return void 0;
1535590
- }
1535591
- const [mediaType, mediaTypeObject] = request6;
1535592
- return getApplicationJsonSchemaMediaObject({ mediaType, mediaTypeObject, context: context2 });
1535593
- }
1535594
- function getSchemaMediaObject(media2, context2) {
1535595
- for (const contentType of Object.keys(media2)) {
1535596
- const mediaObject = media2[contentType];
1535597
- if (mediaObject == null) {
1535598
- continue;
1535599
- }
1535600
- const schema2 = mediaObject.schema;
1535601
- return {
1535602
- schema: schema2 ?? {},
1535603
- examples: getExamples2(mediaObject, context2)
1535604
- };
1535605
- }
1535606
- return void 0;
1535607
- }
1535608
- function getExamples2(mediaObject, context2) {
1535609
- const fullExamples = [];
1535610
- if (mediaObject.example != null) {
1535611
- fullExamples.push({ name: void 0, value: mediaObject.example, description: void 0 });
1535612
- }
1535613
- const examples = getExtension(mediaObject, OpenAPIExtension.EXAMPLES);
1535614
- if (examples != null && Object.keys(examples).length > 0) {
1535615
- fullExamples.push(...Object.entries(examples).map(([name3, value]) => {
1535616
- return { name: value.summary ?? name3, value: value.value, description: value.description };
1535617
- }));
1535618
- }
1535619
- if (mediaObject.examples != null && Object.keys(mediaObject.examples).length > 0) {
1535620
- fullExamples.push(...Object.entries(mediaObject.examples).map(([name3, example]) => {
1535621
- const resolvedExample = isReferenceObject(example) ? context2.resolveExampleReference(example) : example;
1535622
- return {
1535623
- name: resolvedExample.summary ?? name3,
1535624
- value: resolvedExample.value,
1535625
- description: resolvedExample.description
1535626
- };
1535627
- }));
1535628
- }
1535629
- return fullExamples;
1535630
- }
1535631
-
1535632
1535648
  // ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/converters/endpoint/convertRequest.js
1535633
1535649
  function findApplicationUrlFormEncodedRequest({ content: content5, context: context2 }) {
1535634
1535650
  for (const [mediaType, mediaTypeObject] of Object.entries(content5)) {
@@ -1536901,7 +1536917,13 @@ function convertOperation({ context: context2, pathItemContext, operation, conve
1536901
1536917
  });
1536902
1536918
  return { type: "webhook", value: webhooks2 };
1536903
1536919
  }
1536904
- const streamingExtension = getFernStreamingExtension(operation);
1536920
+ let streamingExtension = getFernStreamingExtension(operation);
1536921
+ if (streamingExtension == null) {
1536922
+ const hasItemSchemaStreaming = checkOperationForItemSchemaStreaming({ operation, context: context2 });
1536923
+ if (hasItemSchemaStreaming) {
1536924
+ streamingExtension = { type: "stream", format: "sse" };
1536925
+ }
1536926
+ }
1536905
1536927
  if (streamingExtension != null) {
1536906
1536928
  const streamingOperation = convertStreamingOperation({
1536907
1536929
  context: context2,
@@ -1536971,6 +1536993,21 @@ function getBaseBreadcrumbs({ sdkMethodName, operation, httpMethod, path: path76
1536971
1536993
  }
1536972
1536994
  return baseBreadcrumbs;
1536973
1536995
  }
1536996
+ function checkOperationForItemSchemaStreaming({ operation, context: context2 }) {
1536997
+ if (operation.responses == null) {
1536998
+ return false;
1536999
+ }
1537000
+ for (const response of Object.values(operation.responses)) {
1537001
+ const resolvedResponse = isReferenceObject(response) ? context2.resolveResponseReference(response) : response;
1537002
+ if (resolvedResponse.content == null) {
1537003
+ continue;
1537004
+ }
1537005
+ if (hasTextEventStreamWithItemSchema(resolvedResponse.content)) {
1537006
+ return true;
1537007
+ }
1537008
+ }
1537009
+ return false;
1537010
+ }
1536974
1537011
 
1536975
1537012
  // ../api-importers/openapi/openapi-ir-parser/lib/openapi/v3/converters/convertPathItem.js
1536976
1537013
  function convertPathItem(path76, pathItemObject, document4, context2) {
@@ -1602614,17 +1602651,14 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
1602614
1602651
  async toApiSectionNode({ item, parentSlug, hideChildren, parentAvailability }) {
1602615
1602652
  const snippetsConfig = convertDocsSnippetsConfigToFdr(item.snippetsConfiguration);
1602616
1602653
  let ir14 = void 0;
1602617
- const workspace = await this.getFernWorkspaceForApiSection(item).toFernWorkspace({ context: this.taskContext }, {
1602618
- enableUniqueErrorsPerEndpoint: true,
1602619
- detectGlobalHeaders: false,
1602620
- objectQueryParameters: true,
1602621
- preserveSchemaIds: true
1602622
- });
1602654
+ let workspace = void 0;
1602655
+ let openapiWorkspace = void 0;
1602656
+ let openapiError = void 0;
1602623
1602657
  const openapiParserV3 = this.parsedDocsConfig.experimental?.openapiParserV3;
1602624
1602658
  const useV3Parser = openapiParserV3 == null || openapiParserV3;
1602625
1602659
  if (useV3Parser) {
1602626
1602660
  try {
1602627
- const openapiWorkspace = this.getOpenApiWorkspaceForApiSection(item);
1602661
+ openapiWorkspace = this.getOpenApiWorkspaceForApiSection(item);
1602628
1602662
  ir14 = await openapiWorkspace.getIntermediateRepresentation({
1602629
1602663
  context: this.taskContext,
1602630
1602664
  audiences: item.audiences,
@@ -1602633,13 +1602667,14 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
1602633
1602667
  logWarnings: false
1602634
1602668
  });
1602635
1602669
  } catch (error49) {
1602670
+ openapiError = error49;
1602636
1602671
  }
1602637
1602672
  }
1602638
1602673
  let openApiTags;
1602639
1602674
  if (item.tagDescriptionPages && useV3Parser) {
1602640
1602675
  try {
1602641
- const openapiWorkspace = this.getOpenApiWorkspaceForApiSection(item);
1602642
- const openApiIr = await openapiWorkspace.getOpenAPIIr({
1602676
+ const workspaceForTags = openapiWorkspace ?? this.getOpenApiWorkspaceForApiSection(item);
1602677
+ const openApiIr = await workspaceForTags.getOpenAPIIr({
1602643
1602678
  context: this.taskContext,
1602644
1602679
  loadAiExamples: true
1602645
1602680
  });
@@ -1602654,6 +1602689,15 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
1602654
1602689
  }
1602655
1602690
  }
1602656
1602691
  if (ir14 == null) {
1602692
+ if (this.apiWorkspaces.length === 0 && openapiError != null) {
1602693
+ throw openapiError;
1602694
+ }
1602695
+ workspace = await this.getFernWorkspaceForApiSection(item).toFernWorkspace({ context: this.taskContext }, {
1602696
+ enableUniqueErrorsPerEndpoint: true,
1602697
+ detectGlobalHeaders: false,
1602698
+ objectQueryParameters: true,
1602699
+ preserveSchemaIds: true
1602700
+ });
1602657
1602701
  ir14 = generateIntermediateRepresentation({
1602658
1602702
  workspace,
1602659
1602703
  audiences: item.audiences,
@@ -1602677,7 +1602721,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
1602677
1602721
  onError: (e6) => this.taskContext.failAndThrow(`Error substituting environment variables in API spec: ${e6}`)
1602678
1602722
  }, { substituteAsEmpty: false });
1602679
1602723
  }
1602680
- const apiNameForRegistration = item.apiName ?? workspace.workspaceName;
1602724
+ const apiNameForRegistration = item.apiName ?? workspace?.workspaceName ?? openapiWorkspace?.workspaceName;
1602681
1602725
  const apiDefinitionId = await this.registerApi({
1602682
1602726
  ir: ir14,
1602683
1602727
  snippetsConfig,
@@ -1611583,7 +1611627,7 @@ var import_path40 = __toESM(require("path"), 1);
1611583
1611627
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
1611584
1611628
  var LOGS_FOLDER_NAME = "logs";
1611585
1611629
  function getCliSource() {
1611586
- const version7 = "3.50.3";
1611630
+ const version7 = "3.51.0-2-g73891ac737a";
1611587
1611631
  return `cli@${version7}`;
1611588
1611632
  }
1611589
1611633
  var DebugLogger = class {
@@ -1662964,13 +1663008,14 @@ async function validateDocsBrokenLinks({
1662964
1663008
  }
1662965
1663009
  await cliContext.runTaskForWorkspace(docsWorkspace, async (context2) => {
1662966
1663010
  const startTime = performance.now();
1662967
- const fernWorkspaces = await Promise.all(
1662968
- project.apiWorkspaces.map(async (workspace) => {
1662969
- return workspace.toFernWorkspace({ context: context2 });
1662970
- })
1662971
- );
1662972
1663011
  const ossWorkspaces = await filterOssWorkspaces(project);
1662973
- const violations = await validateDocsWorkspace(docsWorkspace, context2, fernWorkspaces, ossWorkspaces, true);
1663012
+ const violations = await validateDocsWorkspace(
1663013
+ docsWorkspace,
1663014
+ context2,
1663015
+ project.apiWorkspaces,
1663016
+ ossWorkspaces,
1663017
+ true
1663018
+ );
1662974
1663019
  const elapsedMillis = performance.now() - startTime;
1662975
1663020
  logViolations({
1662976
1663021
  violations,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.50.3",
2
+ "version": "3.51.0-2-g73891ac737a",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",