fern-api 0.19.23 → 0.19.24-rc0

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/bundle.cjs +316 -23
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -827033,7 +827033,7 @@ var AccessTokenPosthogManager = class {
827033
827033
  properties: {
827034
827034
  ...event,
827035
827035
  ...event.properties,
827036
- version: "0.19.23",
827036
+ version: "0.19.24-rc0",
827037
827037
  usingAccessToken: true
827038
827038
  }
827039
827039
  });
@@ -827095,7 +827095,7 @@ var UserPosthogManager = class {
827095
827095
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
827096
827096
  event: "CLI",
827097
827097
  properties: {
827098
- version: "0.19.23",
827098
+ version: "0.19.24-rc0",
827099
827099
  ...event,
827100
827100
  ...event.properties
827101
827101
  }
@@ -842499,6 +842499,191 @@ function enumContainsValue({ schema: schema2, value }) {
842499
842499
  }).includes(value);
842500
842500
  }
842501
842501
 
842502
+ // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/schema/utils/convertSchemaToSchemaWithExample.js
842503
+ function convertSchemaToSchemaWithExample(schema2) {
842504
+ switch (schema2.type) {
842505
+ case "object":
842506
+ return SchemaWithExample.object({
842507
+ allOf: schema2.allOf,
842508
+ properties: schema2.properties.map((objectProperty) => convertToObjectProperty2(objectProperty)),
842509
+ allOfPropertyConflicts: schema2.allOfPropertyConflicts,
842510
+ description: schema2.description,
842511
+ generatedName: schema2.generatedName,
842512
+ nameOverride: schema2.nameOverride,
842513
+ groupName: schema2.groupName,
842514
+ fullExamples: void 0
842515
+ });
842516
+ case "array":
842517
+ return SchemaWithExample.array({
842518
+ description: schema2.description,
842519
+ value: convertSchemaToSchemaWithExample(schema2.value),
842520
+ generatedName: schema2.generatedName,
842521
+ nameOverride: schema2.nameOverride,
842522
+ groupName: schema2.groupName
842523
+ });
842524
+ case "enum":
842525
+ return SchemaWithExample.enum({
842526
+ description: schema2.description,
842527
+ generatedName: schema2.generatedName,
842528
+ nameOverride: schema2.nameOverride,
842529
+ values: schema2.values,
842530
+ groupName: schema2.groupName,
842531
+ example: void 0
842532
+ });
842533
+ case "literal":
842534
+ return SchemaWithExample.literal({
842535
+ description: schema2.description,
842536
+ value: schema2.value,
842537
+ generatedName: schema2.generatedName,
842538
+ nameOverride: schema2.nameOverride,
842539
+ groupName: schema2.groupName
842540
+ });
842541
+ case "nullable":
842542
+ return SchemaWithExample.nullable({
842543
+ generatedName: schema2.generatedName,
842544
+ nameOverride: schema2.nameOverride,
842545
+ description: schema2.description,
842546
+ value: convertSchemaToSchemaWithExample(schema2.value),
842547
+ groupName: schema2.groupName
842548
+ });
842549
+ case "optional":
842550
+ return SchemaWithExample.optional({
842551
+ generatedName: schema2.generatedName,
842552
+ nameOverride: schema2.nameOverride,
842553
+ description: schema2.description,
842554
+ value: convertSchemaToSchemaWithExample(schema2.value),
842555
+ groupName: schema2.groupName
842556
+ });
842557
+ case "primitive":
842558
+ return SchemaWithExample.primitive({
842559
+ description: schema2.description,
842560
+ schema: convertToPrimitiveSchemaValue2(schema2.schema),
842561
+ generatedName: schema2.generatedName,
842562
+ nameOverride: schema2.nameOverride,
842563
+ groupName: schema2.groupName
842564
+ });
842565
+ case "map":
842566
+ return SchemaWithExample.map({
842567
+ description: schema2.description,
842568
+ key: SchemaWithExample.primitive({
842569
+ description: schema2.key.description,
842570
+ schema: convertToPrimitiveSchemaValue2(schema2.key.schema),
842571
+ generatedName: schema2.key.generatedName,
842572
+ nameOverride: schema2.key.nameOverride,
842573
+ groupName: schema2.groupName
842574
+ }),
842575
+ value: convertSchemaToSchemaWithExample(schema2.value),
842576
+ generatedName: schema2.generatedName,
842577
+ nameOverride: schema2.nameOverride,
842578
+ groupName: schema2.groupName
842579
+ });
842580
+ case "reference":
842581
+ return SchemaWithExample.reference({
842582
+ description: schema2.description,
842583
+ generatedName: schema2.generatedName,
842584
+ nameOverride: schema2.nameOverride,
842585
+ schema: schema2.schema,
842586
+ groupName: schema2.groupName
842587
+ });
842588
+ case "oneOf":
842589
+ return SchemaWithExample.oneOf(convertToOneOf2(schema2.value));
842590
+ case "unknown":
842591
+ return SchemaWithExample.unknown({
842592
+ nameOverride: schema2.nameOverride,
842593
+ generatedName: schema2.generatedName,
842594
+ example: void 0,
842595
+ groupName: void 0,
842596
+ description: void 0
842597
+ });
842598
+ default:
842599
+ assertNever(schema2);
842600
+ }
842601
+ }
842602
+ function convertToOneOf2(oneOfSchema) {
842603
+ switch (oneOfSchema.type) {
842604
+ case "discriminated":
842605
+ return OneOfSchemaWithExample.discriminated({
842606
+ commonProperties: oneOfSchema.commonProperties.map((commonProperty) => {
842607
+ return {
842608
+ key: commonProperty.key,
842609
+ schema: convertSchemaToSchemaWithExample(commonProperty.schema)
842610
+ };
842611
+ }),
842612
+ description: oneOfSchema.description,
842613
+ discriminantProperty: oneOfSchema.discriminantProperty,
842614
+ generatedName: oneOfSchema.generatedName,
842615
+ nameOverride: oneOfSchema.nameOverride,
842616
+ schemas: Object.fromEntries(Object.entries(oneOfSchema.schemas).map(([discriminantValue, schemaWithExample]) => {
842617
+ return [discriminantValue, convertSchemaToSchemaWithExample(schemaWithExample)];
842618
+ })),
842619
+ groupName: oneOfSchema.groupName
842620
+ });
842621
+ case "undisciminated":
842622
+ return OneOfSchemaWithExample.undisciminated({
842623
+ description: oneOfSchema.description,
842624
+ generatedName: oneOfSchema.generatedName,
842625
+ nameOverride: oneOfSchema.nameOverride,
842626
+ schemas: oneOfSchema.schemas.map((oneOfSchema2) => convertSchemaToSchemaWithExample(oneOfSchema2)),
842627
+ groupName: oneOfSchema.groupName
842628
+ });
842629
+ default:
842630
+ assertNever(oneOfSchema);
842631
+ }
842632
+ }
842633
+ function convertToPrimitiveSchemaValue2(primitiveSchema) {
842634
+ switch (primitiveSchema.type) {
842635
+ case "string":
842636
+ return PrimitiveSchemaValueWithExample.string({
842637
+ maxLength: primitiveSchema.maxLength,
842638
+ minLength: primitiveSchema.minLength,
842639
+ example: void 0
842640
+ });
842641
+ case "base64":
842642
+ return PrimitiveSchemaValueWithExample.base64({
842643
+ example: void 0
842644
+ });
842645
+ case "boolean":
842646
+ return PrimitiveSchemaValueWithExample.boolean({
842647
+ example: void 0
842648
+ });
842649
+ case "date":
842650
+ return PrimitiveSchemaValueWithExample.date({
842651
+ example: void 0
842652
+ });
842653
+ case "datetime":
842654
+ return PrimitiveSchemaValueWithExample.datetime({
842655
+ example: void 0
842656
+ });
842657
+ case "double":
842658
+ return PrimitiveSchemaValueWithExample.double({
842659
+ example: void 0
842660
+ });
842661
+ case "float":
842662
+ return PrimitiveSchemaValueWithExample.float({
842663
+ example: void 0
842664
+ });
842665
+ case "int":
842666
+ return PrimitiveSchemaValueWithExample.int({
842667
+ example: void 0
842668
+ });
842669
+ case "int64":
842670
+ return PrimitiveSchemaValueWithExample.int64({
842671
+ example: void 0
842672
+ });
842673
+ default:
842674
+ assertNever(primitiveSchema);
842675
+ }
842676
+ }
842677
+ function convertToObjectProperty2(objectProperty) {
842678
+ return {
842679
+ conflict: objectProperty.conflict,
842680
+ generatedName: objectProperty.generatedName,
842681
+ key: objectProperty.key,
842682
+ schema: convertSchemaToSchemaWithExample(objectProperty.schema),
842683
+ audiences: objectProperty.audiences
842684
+ };
842685
+ }
842686
+
842502
842687
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/schema/utils/isSchemaRequired.js
842503
842688
  function isSchemaRequired4(schema2) {
842504
842689
  return schema2.type !== "optional" && schema2.type !== "nullable";
@@ -842524,11 +842709,8 @@ var ExampleEndpointFactory = class {
842524
842709
  this.logger.debug(`Building endpoint example for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
842525
842710
  const requestSchemaIdResponse = getRequestSchema(endpoint.request);
842526
842711
  const responseSchemaIdResponse = getResponseSchema(endpoint.response);
842527
- if ((requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.type) === "unsupported" || (responseSchemaIdResponse == null ? void 0 : responseSchemaIdResponse.type) === "unsupported") {
842528
- return void 0;
842529
- }
842530
842712
  let requestExample = void 0;
842531
- if (requestSchemaIdResponse != null) {
842713
+ if (requestSchemaIdResponse != null && requestSchemaIdResponse.type === "present") {
842532
842714
  const required = this.isSchemaRequired(requestSchemaIdResponse.schema);
842533
842715
  requestExample = this.exampleTypeFactory.buildExample({
842534
842716
  schema: requestSchemaIdResponse.schema,
@@ -842543,7 +842725,7 @@ var ExampleEndpointFactory = class {
842543
842725
  }
842544
842726
  }
842545
842727
  let responseExample = void 0;
842546
- if (responseSchemaIdResponse != null) {
842728
+ if (responseSchemaIdResponse != null && responseSchemaIdResponse.type === "present") {
842547
842729
  const required = this.isSchemaRequired(responseSchemaIdResponse.schema);
842548
842730
  responseExample = this.exampleTypeFactory.buildExample({
842549
842731
  schema: responseSchemaIdResponse.schema,
@@ -842630,9 +842812,12 @@ var ExampleEndpointFactory = class {
842630
842812
  });
842631
842813
  }
842632
842814
  }
842633
- let exampleName = (_c3 = requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.example) == null ? void 0 : _c3.name;
842634
- if (exampleName == null && (requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.schema) != null) {
842635
- exampleName = getNameFromSchemaWithExample(requestSchemaIdResponse.schema);
842815
+ let exampleName = void 0;
842816
+ if ((requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.type) === "present") {
842817
+ exampleName = (_c3 = requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.example) == null ? void 0 : _c3.name;
842818
+ if (exampleName == null && (requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.schema) != null) {
842819
+ exampleName = getNameFromSchemaWithExample(requestSchemaIdResponse.schema);
842820
+ }
842636
842821
  }
842637
842822
  const codeSamples = endpoint.examples.filter(hasIncompleteExample).flatMap((example) => example.codeSamples);
842638
842823
  return {
@@ -842665,10 +842850,17 @@ function getRequestSchema(request) {
842665
842850
  if (request == null) {
842666
842851
  return void 0;
842667
842852
  }
842668
- if (request.type !== "json") {
842669
- return { type: "unsupported" };
842853
+ if (request.type === "multipart") {
842854
+ return {
842855
+ type: "present",
842856
+ schema: convertMultipartRequestToSchema(request),
842857
+ example: void 0
842858
+ };
842670
842859
  }
842671
- return { type: "present", schema: request.schema, example: ((_a4 = request.fullExamples) == null ? void 0 : _a4[0]) ?? void 0 };
842860
+ if (request.type === "json") {
842861
+ return { type: "present", schema: request.schema, example: ((_a4 = request.fullExamples) == null ? void 0 : _a4[0]) ?? void 0 };
842862
+ }
842863
+ return { type: "unsupported" };
842672
842864
  }
842673
842865
  function getResponseSchema(response) {
842674
842866
  var _a4;
@@ -842733,6 +842925,60 @@ function getNameFromSchemaWithExample(schema2) {
842733
842925
  assertNever(schema2);
842734
842926
  }
842735
842927
  }
842928
+ function convertMultipartRequestToSchema(request) {
842929
+ return SchemaWithExample.object({
842930
+ properties: request.properties.map((property5) => {
842931
+ if (property5.schema.type === "file") {
842932
+ const innerSchema = SchemaWithExample.primitive({
842933
+ schema: api_exports5.PrimitiveSchemaValueWithExample.string({
842934
+ minLength: void 0,
842935
+ maxLength: void 0,
842936
+ example: void 0
842937
+ }),
842938
+ description: property5.description,
842939
+ nameOverride: void 0,
842940
+ generatedName: "",
842941
+ groupName: void 0
842942
+ });
842943
+ const maybeArraySchema = property5.schema.isArray ? SchemaWithExample.array({
842944
+ value: innerSchema,
842945
+ groupName: void 0,
842946
+ nameOverride: void 0,
842947
+ generatedName: "",
842948
+ description: void 0
842949
+ }) : innerSchema;
842950
+ const maybeOptionalSchema = property5.schema.isOptional ? SchemaWithExample.optional({
842951
+ value: maybeArraySchema,
842952
+ groupName: void 0,
842953
+ nameOverride: void 0,
842954
+ generatedName: "",
842955
+ description: void 0
842956
+ }) : maybeArraySchema;
842957
+ return {
842958
+ key: property5.key,
842959
+ schema: maybeOptionalSchema,
842960
+ audiences: [],
842961
+ conflict: {},
842962
+ generatedName: property5.key
842963
+ };
842964
+ }
842965
+ return {
842966
+ key: property5.key,
842967
+ schema: convertSchemaToSchemaWithExample(property5.schema.value),
842968
+ audiences: [],
842969
+ conflict: {},
842970
+ generatedName: property5.key
842971
+ };
842972
+ }).filter(isNonNullish),
842973
+ allOf: [],
842974
+ allOfPropertyConflicts: [],
842975
+ fullExamples: void 0,
842976
+ description: request.description,
842977
+ nameOverride: void 0,
842978
+ generatedName: "",
842979
+ groupName: void 0
842980
+ });
842981
+ }
842736
842982
 
842737
842983
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/asyncapi/ExampleWebsocketSessionFactory.js
842738
842984
  var ExampleWebsocketSessionFactory = class {
@@ -846170,7 +846416,8 @@ function getRequest({ declarationFile, context, request, requestNameOverride, ge
846170
846416
  headers,
846171
846417
  body: {
846172
846418
  properties
846173
- }
846419
+ },
846420
+ "content-type": "multipart/form-data"
846174
846421
  }
846175
846422
  };
846176
846423
  }
@@ -850865,10 +851112,10 @@ var CliContext = class {
850865
851112
  return "fern-api";
850866
851113
  }
850867
851114
  getPackageVersion() {
850868
- if ("0.19.23" == null) {
851115
+ if ("0.19.24-rc0" == null) {
850869
851116
  this.logger.error("CLI_VERSION is not defined");
850870
851117
  }
850871
- return "0.19.23";
851118
+ return "0.19.24-rc0";
850872
851119
  }
850873
851120
  getCliName() {
850874
851121
  if ("fern" == null) {
@@ -851476,7 +851723,7 @@ function convertService(irService, ir) {
851476
851723
  response: irEndpoint.response != null ? convertResponse2(irEndpoint.response) : void 0,
851477
851724
  errors: convertResponseErrors(irEndpoint.errors, ir),
851478
851725
  errorsV2: convertResponseErrorsV2(irEndpoint.errors, ir),
851479
- examples: irEndpoint.examples.filter((example) => example.exampleType === "userProvided").map((example) => convertHttpEndpointExample(example, ir))
851726
+ examples: irEndpoint.examples.filter((example) => example.exampleType === "userProvided").map((example) => convertHttpEndpointExample(example, irEndpoint, ir))
851480
851727
  };
851481
851728
  });
851482
851729
  }
@@ -851816,8 +852063,8 @@ function convertResponseErrorsV2(irResponseErrors, ir) {
851816
852063
  }
851817
852064
  return errors;
851818
852065
  }
851819
- function convertHttpEndpointExample(irExample, ir) {
851820
- var _a4, _b3, _c3, _d;
852066
+ function convertHttpEndpointExample(irExample, irEndpoint, ir) {
852067
+ var _a4, _b3, _c3, _d, _e;
851821
852068
  return {
851822
852069
  name: (_a4 = irExample.name) == null ? void 0 : _a4.originalName,
851823
852070
  description: irExample.docs ?? void 0,
@@ -851835,7 +852082,46 @@ function convertHttpEndpointExample(irExample, ir) {
851835
852082
  return headers;
851836
852083
  }, {}),
851837
852084
  requestBody: (_b3 = irExample.request) == null ? void 0 : _b3.jsonExample,
851838
- requestBodyV3: irExample.request != null ? { type: "json", value: irExample.request.jsonExample } : void 0,
852085
+ requestBodyV3: (_c3 = irEndpoint.requestBody) == null ? void 0 : _c3._visit({
852086
+ inlinedRequestBody: () => irExample.request != null ? { type: "json", value: irExample.request.jsonExample } : void 0,
852087
+ reference: () => irExample.request != null ? { type: "json", value: irExample.request.jsonExample } : void 0,
852088
+ fileUpload: (fileUploadSchema) => {
852089
+ if (irExample.request == null) {
852090
+ return void 0;
852091
+ }
852092
+ const value = {};
852093
+ if (isPlainObject(irExample.request.jsonExample)) {
852094
+ const fullExample = irExample.request.jsonExample;
852095
+ for (const property5 of fileUploadSchema.properties) {
852096
+ property5._visit({
852097
+ file: (file) => {
852098
+ if (file.type === "file") {
852099
+ value[file.key.wireValue] = {
852100
+ type: "filename",
852101
+ value: "<file1>"
852102
+ };
852103
+ } else if (file.type === "fileArray") {
852104
+ value[file.key.wireValue] = {
852105
+ type: "filename",
852106
+ value: "<file1>"
852107
+ };
852108
+ }
852109
+ },
852110
+ bodyProperty: (bodyProperty) => {
852111
+ value[bodyProperty.name.wireValue] = {
852112
+ type: "json",
852113
+ value: fullExample[bodyProperty.name.wireValue]
852114
+ };
852115
+ },
852116
+ _other: noop_default
852117
+ });
852118
+ }
852119
+ }
852120
+ return { type: "form", value };
852121
+ },
852122
+ bytes: () => void 0,
852123
+ _other: () => void 0
852124
+ }),
851839
852125
  responseStatusCode: api_exports4.http.ExampleResponse._visit(irExample.response, {
851840
852126
  ok: ({ body }) => body != null ? 200 : 204,
851841
852127
  error: ({ error: errorName }) => {
@@ -851849,9 +852135,9 @@ function convertHttpEndpointExample(irExample, ir) {
851849
852135
  throw new Error("Unknown ExampleResponse: " + irExample.response.type);
851850
852136
  }
851851
852137
  }),
851852
- responseBody: (_c3 = irExample.response.body) == null ? void 0 : _c3.jsonExample,
852138
+ responseBody: (_d = irExample.response.body) == null ? void 0 : _d.jsonExample,
851853
852139
  responseBodyV3: irExample.response.body != null ? { type: "json", value: irExample.response.body.jsonExample } : void 0,
851854
- codeSamples: (_d = irExample.codeSamples) == null ? void 0 : _d.map((codeSample) => ExampleCodeSample._visit(codeSample, {
852140
+ codeSamples: (_e = irExample.codeSamples) == null ? void 0 : _e.map((codeSample) => ExampleCodeSample._visit(codeSample, {
851855
852141
  language: (value) => {
851856
852142
  var _a5;
851857
852143
  return {
@@ -854347,6 +854633,9 @@ function convertExampleRequestBody({ endpoint, example, typeResolver, exampleRes
854347
854633
  if (requestType == null) {
854348
854634
  return void 0;
854349
854635
  }
854636
+ if (typeof requestType === "string" && parseBytesRequest(requestType) != null) {
854637
+ return void 0;
854638
+ }
854350
854639
  if (!isInlineRequestBody(requestType)) {
854351
854640
  return ExampleRequestBody.reference(convertTypeReferenceExample({
854352
854641
  example: example.request,
@@ -854367,6 +854656,10 @@ function convertExampleRequestBody({ endpoint, example, typeResolver, exampleRes
854367
854656
  const exampleProperties = [];
854368
854657
  for (const [wireKey, propertyExample] of Object.entries(example.request)) {
854369
854658
  const inlinedRequestPropertyDeclaration = (_b3 = requestType.properties) == null ? void 0 : _b3[wireKey];
854659
+ const inilnedRequestPropertyType = typeof inlinedRequestPropertyDeclaration === "string" ? inlinedRequestPropertyDeclaration : inlinedRequestPropertyDeclaration == null ? void 0 : inlinedRequestPropertyDeclaration.type;
854660
+ if (inilnedRequestPropertyType != null && parseRawFileType(inilnedRequestPropertyType) != null) {
854661
+ continue;
854662
+ }
854370
854663
  if (inlinedRequestPropertyDeclaration != null) {
854371
854664
  exampleProperties.push({
854372
854665
  name: file.casingsGenerator.generateNameAndWireValue({
@@ -857089,7 +857382,7 @@ var TypeResolverImpl = class {
857089
857382
  resolveTypeOrThrow({ type: type2, file }) {
857090
857383
  const resolvedType = this.resolveType({ type: type2, file });
857091
857384
  if (resolvedType == null) {
857092
- throw new Error("Cannot resolve type: " + type2);
857385
+ throw new Error("Cannot resolve type: " + type2 + " in file " + file.relativeFilepath);
857093
857386
  }
857094
857387
  return resolvedType;
857095
857388
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.19.23",
3
+ "version": "0.19.24-rc0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",