fern-api 0.19.26 → 0.19.28

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 +154 -60
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -340817,9 +340817,53 @@ var init_SupportedSdkLanguage3 = __esm({
340817
340817
  }
340818
340818
  });
340819
340819
 
340820
+ // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/FernExample.js
340821
+ var init_FernExample = __esm({
340822
+ "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/FernExample.js"() {
340823
+ }
340824
+ });
340825
+
340820
340826
  // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/EndpointExample.js
340827
+ var EndpointExample;
340821
340828
  var init_EndpointExample = __esm({
340822
340829
  "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/EndpointExample.js"() {
340830
+ init_api2();
340831
+ EndpointExample = {
340832
+ unknown: (value) => {
340833
+ return {
340834
+ value,
340835
+ type: "unknown",
340836
+ _visit: function(visitor) {
340837
+ return EndpointExample._visit(this, visitor);
340838
+ }
340839
+ };
340840
+ },
340841
+ full: (value) => {
340842
+ return {
340843
+ ...value,
340844
+ type: "full",
340845
+ _visit: function(visitor) {
340846
+ return EndpointExample._visit(this, visitor);
340847
+ }
340848
+ };
340849
+ },
340850
+ _visit: (value, visitor) => {
340851
+ switch (value.type) {
340852
+ case "unknown":
340853
+ return visitor.unknown(value.value);
340854
+ case "full":
340855
+ return visitor.full(value);
340856
+ default:
340857
+ return visitor._other(value);
340858
+ }
340859
+ }
340860
+ };
340861
+ }
340862
+ });
340863
+
340864
+ // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/FullEndpointExample.js
340865
+ var init_FullEndpointExample = __esm({
340866
+ "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/FullEndpointExample.js"() {
340823
340867
  }
340824
340868
  });
340825
340869
 
@@ -341558,7 +341602,9 @@ var init_types28 = __esm({
341558
341602
  init_CustomCodeSampleLanguage();
341559
341603
  init_CustomCodeSampleSdk();
341560
341604
  init_SupportedSdkLanguage3();
341605
+ init_FernExample();
341561
341606
  init_EndpointExample();
341607
+ init_FullEndpointExample();
341562
341608
  init_PathParameterExample();
341563
341609
  init_QueryParameterExample();
341564
341610
  init_HeaderExample();
@@ -341608,6 +341654,7 @@ var finalIr_exports = {};
341608
341654
  __export(finalIr_exports, {
341609
341655
  CustomCodeSample: () => CustomCodeSample,
341610
341656
  EndpointAvailability: () => EndpointAvailability,
341657
+ EndpointExample: () => EndpointExample,
341611
341658
  HttpMethod: () => HttpMethod5,
341612
341659
  LiteralSchemaValue: () => LiteralSchemaValue,
341613
341660
  MultipartSchema: () => MultipartSchema,
@@ -342283,6 +342330,7 @@ var api_exports5 = {};
342283
342330
  __export(api_exports5, {
342284
342331
  CustomCodeSample: () => CustomCodeSample,
342285
342332
  EndpointAvailability: () => EndpointAvailability,
342333
+ EndpointExample: () => EndpointExample,
342286
342334
  FullExample: () => FullExample,
342287
342335
  FullOneOfExample: () => FullOneOfExample,
342288
342336
  HttpMethod: () => HttpMethod5,
@@ -344489,7 +344537,7 @@ var init_Endpoint2 = __esm({
344489
344537
  response: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Response).optional(),
344490
344538
  errorStatusCode: schemas_exports5.list(schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).StatusCode)),
344491
344539
  server: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Server)),
344492
- examples: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).EndpointExample))
344540
+ examples: schemas_exports5.list(schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).EndpointExample))
344493
344541
  }).extend(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).WithDescription));
344494
344542
  }
344495
344543
  });
@@ -344571,12 +344619,48 @@ var init_SupportedSdkLanguage4 = __esm({
344571
344619
  }
344572
344620
  });
344573
344621
 
344622
+ // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/FernExample.js
344623
+ var FernExample;
344624
+ var init_FernExample2 = __esm({
344625
+ "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/FernExample.js"() {
344626
+ init_core3();
344627
+ FernExample = schemas_exports5.unknown();
344628
+ }
344629
+ });
344630
+
344574
344631
  // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/EndpointExample.js
344575
- var EndpointExample;
344632
+ var EndpointExample2;
344576
344633
  var init_EndpointExample2 = __esm({
344577
344634
  "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/EndpointExample.js"() {
344635
+ init_api2();
344636
+ init_core3();
344637
+ EndpointExample2 = schemas_exports5.union("type", {
344638
+ unknown: schemas_exports5.object({
344639
+ value: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).FernExample)
344640
+ }),
344641
+ full: schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).FullEndpointExample)
344642
+ }).transform({
344643
+ transform: (value) => {
344644
+ switch (value.type) {
344645
+ case "unknown":
344646
+ return EndpointExample.unknown(value.value);
344647
+ case "full":
344648
+ return EndpointExample.full(value);
344649
+ default:
344650
+ return value;
344651
+ }
344652
+ },
344653
+ untransform: ({ _visit, ...value }) => value
344654
+ });
344655
+ }
344656
+ });
344657
+
344658
+ // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/FullEndpointExample.js
344659
+ var FullEndpointExample;
344660
+ var init_FullEndpointExample2 = __esm({
344661
+ "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/FullEndpointExample.js"() {
344578
344662
  init_core3();
344579
- EndpointExample = schemas_exports5.objectWithoutOptionalProperties({
344663
+ FullEndpointExample = schemas_exports5.objectWithoutOptionalProperties({
344580
344664
  name: schemas_exports5.string().optional(),
344581
344665
  pathParameters: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).PathParameterExample)).optional(),
344582
344666
  queryParameters: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).QueryParameterExample)).optional(),
@@ -345252,7 +345336,9 @@ var init_types32 = __esm({
345252
345336
  init_CustomCodeSampleLanguage2();
345253
345337
  init_CustomCodeSampleSdk2();
345254
345338
  init_SupportedSdkLanguage4();
345339
+ init_FernExample2();
345255
345340
  init_EndpointExample2();
345341
+ init_FullEndpointExample2();
345256
345342
  init_PathParameterExample2();
345257
345343
  init_QueryParameterExample2();
345258
345344
  init_HeaderExample2();
@@ -345310,12 +345396,14 @@ __export(finalIr_exports2, {
345310
345396
  DiscriminatedOneOfSchema: () => DiscriminatedOneOfSchema,
345311
345397
  Endpoint: () => Endpoint,
345312
345398
  EndpointAvailability: () => EndpointAvailability2,
345313
- EndpointExample: () => EndpointExample,
345399
+ EndpointExample: () => EndpointExample2,
345314
345400
  EndpointSdkName: () => EndpointSdkName,
345315
345401
  EnumSchema: () => EnumSchema2,
345316
345402
  EnumValue: () => EnumValue2,
345403
+ FernExample: () => FernExample,
345317
345404
  FileResponse: () => FileResponse,
345318
345405
  FileSchema: () => FileSchema,
345406
+ FullEndpointExample: () => FullEndpointExample,
345319
345407
  GlobalHeader: () => GlobalHeader,
345320
345408
  Header: () => Header,
345321
345409
  HeaderExample: () => HeaderExample,
@@ -345415,7 +345503,7 @@ var init_EndpointWithExample2 = __esm({
345415
345503
  response: schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).ResponseWithExample).optional(),
345416
345504
  errorStatusCode: schemas_exports5.list(schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).StatusCode)),
345417
345505
  server: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Server)),
345418
- examples: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).EndpointExample))
345506
+ examples: schemas_exports5.list(schemas_exports5.lazy(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).EndpointExample))
345419
345507
  }).extend(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).WithDescription));
345420
345508
  }
345421
345509
  });
@@ -346039,15 +346127,17 @@ __export(serialization_exports3, {
346039
346127
  DoubleWithExample: () => DoubleWithExample,
346040
346128
  Endpoint: () => Endpoint,
346041
346129
  EndpointAvailability: () => EndpointAvailability2,
346042
- EndpointExample: () => EndpointExample,
346130
+ EndpointExample: () => EndpointExample2,
346043
346131
  EndpointSdkName: () => EndpointSdkName,
346044
346132
  EndpointWithExample: () => EndpointWithExample,
346045
346133
  EnumSchema: () => EnumSchema2,
346046
346134
  EnumSchemaWithExample: () => EnumSchemaWithExample,
346047
346135
  EnumValue: () => EnumValue2,
346136
+ FernExample: () => FernExample,
346048
346137
  FileResponse: () => FileResponse,
346049
346138
  FileSchema: () => FileSchema,
346050
346139
  FloatWithExample: () => FloatWithExample,
346140
+ FullEndpointExample: () => FullEndpointExample,
346051
346141
  FullExample: () => FullExample2,
346052
346142
  FullObjectExample: () => FullObjectExample,
346053
346143
  FullOneOfExample: () => FullOneOfExample2,
@@ -827037,7 +827127,7 @@ var AccessTokenPosthogManager = class {
827037
827127
  properties: {
827038
827128
  ...event,
827039
827129
  ...event.properties,
827040
- version: "0.19.26",
827130
+ version: "0.19.28",
827041
827131
  usingAccessToken: true
827042
827132
  }
827043
827133
  });
@@ -827099,7 +827189,7 @@ var UserPosthogManager = class {
827099
827189
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
827100
827190
  event: "CLI",
827101
827191
  properties: {
827102
- version: "0.19.26",
827192
+ version: "0.19.28",
827103
827193
  ...event,
827104
827194
  ...event.properties
827105
827195
  }
@@ -839712,7 +839802,7 @@ function buildAuthSchemes(context) {
839712
839802
  context.builder.setAuth(BEARER_AUTH_SCHEME);
839713
839803
  setAuth = true;
839714
839804
  }
839715
- if (securityScheme.scopesEnum != null) {
839805
+ if (securityScheme.scopesEnum != null && securityScheme.scopesEnum.values.length > 0) {
839716
839806
  context.builder.addType(RelativeFilePath.of("__package__.yml"), {
839717
839807
  name: "OauthScope",
839718
839808
  schema: buildEnumTypeDeclaration(securityScheme.scopesEnum).schema
@@ -842707,7 +842797,12 @@ function isSchemaRequired4(schema2) {
842707
842797
 
842708
842798
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/hasIncompleteExample.js
842709
842799
  function hasIncompleteExample(example) {
842710
- return example.request == null && example.response == null && example.queryParameters == null && example.pathParameters == null && example.headers == null;
842800
+ if (example.type === "full") {
842801
+ return example.request == null && example.response == null && example.queryParameters == null && example.pathParameters == null && example.headers == null;
842802
+ } else {
842803
+ const castExample = example.value;
842804
+ return castExample.request == null && castExample.response == null && castExample["query-parameters"] == null && castExample["path-parameters"] == null && castExample.headers == null;
842805
+ }
842711
842806
  }
842712
842807
 
842713
842808
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/converters/ExampleEndpointFactory.js
@@ -842835,8 +842930,20 @@ var ExampleEndpointFactory = class {
842835
842930
  exampleName = getNameFromSchemaWithExample(requestSchemaIdResponse.schema);
842836
842931
  }
842837
842932
  }
842838
- const codeSamples = endpoint.examples.filter(hasIncompleteExample).flatMap((example) => example.codeSamples);
842839
- return {
842933
+ const codeSamples = endpoint.examples.filter((ex) => hasIncompleteExample(ex)).flatMap((ex) => {
842934
+ if (ex.type === "unknown") {
842935
+ if (ex.value != null) {
842936
+ const samples = ex.value["code-samples"];
842937
+ if (samples != null) {
842938
+ return this.convertCodeSamples(samples);
842939
+ }
842940
+ }
842941
+ return void 0;
842942
+ } else {
842943
+ return ex.codeSamples;
842944
+ }
842945
+ }).filter((ex) => isNonNullish(ex));
842946
+ return EndpointExample.full({
842840
842947
  name: exampleName,
842841
842948
  description: void 0,
842842
842949
  pathParameters,
@@ -842845,7 +842952,27 @@ var ExampleEndpointFactory = class {
842845
842952
  request: requestExample,
842846
842953
  response: responseExample,
842847
842954
  codeSamples
842848
- };
842955
+ });
842956
+ }
842957
+ convertCodeSamples(codeSamples) {
842958
+ return codeSamples.map((codeSample) => {
842959
+ if ("language" in codeSample) {
842960
+ return CustomCodeSample.language({
842961
+ name: codeSample.name ?? void 0,
842962
+ description: codeSample.docs ?? void 0,
842963
+ language: codeSample.language,
842964
+ code: codeSample.code,
842965
+ install: codeSample.install ?? void 0
842966
+ });
842967
+ } else {
842968
+ return CustomCodeSample.sdk({
842969
+ name: codeSample.name ?? void 0,
842970
+ description: codeSample.docs ?? void 0,
842971
+ sdk: codeSample.sdk === "c#" ? SupportedSdkLanguage3.Csharp : codeSample.sdk,
842972
+ code: codeSample.code
842973
+ });
842974
+ }
842975
+ }).filter(isNonNullish);
842849
842976
  }
842850
842977
  isSchemaRequired(schema2) {
842851
842978
  return isSchemaRequired4(this.getResolvedSchema(schema2));
@@ -843819,36 +843946,6 @@ var RedoclyCodeSampleArraySchema = z.array(RedoclyCodeSampleSchema);
843819
843946
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getExamplesFromExtension.js
843820
843947
  function getExamplesFromExtension(operationContext, operationObject, context) {
843821
843948
  const exampleEndpointCalls = getExtensionAndValidate(operationObject, FernOpenAPIExtension.EXAMPLES, schemas_exports3.ExampleEndpointCallArraySchema, context, [...operationContext.baseBreadcrumbs, `${operationContext.method} ${operationContext.path}`]) ?? [];
843822
- const fernExamples = exampleEndpointCalls.map((value) => ({
843823
- name: value.name,
843824
- pathParameters: value["path-parameters"] ? Object.entries(value["path-parameters"]).map(([name2, value2]) => ({
843825
- name: name2,
843826
- value: value2
843827
- })) : void 0,
843828
- queryParameters: value["query-parameters"] ? Object.entries(value["query-parameters"]).map(([name2, value2]) => ({
843829
- name: name2,
843830
- value: value2
843831
- })) : void 0,
843832
- headers: value.headers ? Object.entries(value.headers).map(([name2, value2]) => ({
843833
- name: name2,
843834
- value: value2
843835
- })) : void 0,
843836
- request: value.request,
843837
- response: value.response,
843838
- codeSamples: (value["code-samples"] ?? []).map((value2) => "language" in value2 ? api_exports5.CustomCodeSample.language({
843839
- name: value2.name,
843840
- language: value2.language,
843841
- code: value2.code,
843842
- install: value2.install,
843843
- description: value2.docs
843844
- }) : api_exports5.CustomCodeSample.sdk({
843845
- name: value2.name,
843846
- sdk: value2.sdk === "c#" ? "csharp" : value2.sdk,
843847
- code: value2.code,
843848
- description: value2.docs
843849
- })),
843850
- description: void 0
843851
- }));
843852
843949
  const redoclyCodeSamplesKebabCase = getExtensionAndValidate(operationObject, OpenAPIExtension.REDOCLY_CODE_SAMPLES_KEBAB, RedoclyCodeSampleArraySchema, context, [...operationContext.baseBreadcrumbs, `${operationContext.method} ${operationContext.path}`]) ?? [];
843853
843950
  const redoclyCodeSamplesCamelCase = getExtensionAndValidate(operationObject, OpenAPIExtension.REDOCLY_CODE_SAMPLES_CAMEL, RedoclyCodeSampleArraySchema, context, [...operationContext.baseBreadcrumbs, `${operationContext.method} ${operationContext.path}`]) ?? [];
843854
843951
  const redoclyCodeSamples = [
@@ -843856,24 +843953,17 @@ function getExamplesFromExtension(operationContext, operationObject, context) {
843856
843953
  ...redoclyCodeSamplesKebabCase
843857
843954
  ];
843858
843955
  if (redoclyCodeSamples.length > 0) {
843859
- fernExamples.push({
843860
- name: void 0,
843861
- pathParameters: void 0,
843862
- queryParameters: void 0,
843863
- headers: void 0,
843864
- request: void 0,
843865
- response: void 0,
843866
- codeSamples: redoclyCodeSamples.map((value) => api_exports5.CustomCodeSample.language({
843956
+ exampleEndpointCalls.push({
843957
+ "code-samples": redoclyCodeSamples.map((value) => ({
843867
843958
  name: value.label ?? value.lang,
843868
843959
  language: value.lang,
843869
843960
  code: value.source,
843870
843961
  install: void 0,
843871
- description: void 0
843872
- })),
843873
- description: void 0
843962
+ docs: void 0
843963
+ }))
843874
843964
  });
843875
843965
  }
843876
- return fernExamples;
843966
+ return exampleEndpointCalls.map(EndpointExample.unknown);
843877
843967
  }
843878
843968
 
843879
843969
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getFernAvailability.js
@@ -845079,13 +845169,14 @@ function generateIr({ openApi, taskContext, disableExamples }) {
845079
845169
  }).filter((entry) => entry.length > 0));
845080
845170
  const exampleEndpointFactory = new ExampleEndpointFactory(schemasWithExample, context.logger);
845081
845171
  const endpoints = endpointsWithExample.map((endpointWithExample) => {
845082
- let examples = endpointWithExample.examples;
845083
- if (!disableExamples && (examples.length === 0 || examples.every(hasIncompleteExample))) {
845172
+ const extensionExamples = endpointWithExample.examples;
845173
+ let examples = extensionExamples;
845174
+ if (!disableExamples && (extensionExamples.length === 0 || extensionExamples.every(hasIncompleteExample))) {
845084
845175
  const endpointExample = exampleEndpointFactory.buildEndpointExample(endpointWithExample);
845085
845176
  if (endpointExample != null) {
845086
845177
  examples = [
845087
845178
  endpointExample,
845088
- ...endpointWithExample.examples.filter((example) => !hasIncompleteExample(example))
845179
+ ...extensionExamples.filter((example) => !hasIncompleteExample(example))
845089
845180
  ];
845090
845181
  }
845091
845182
  }
@@ -845931,6 +846022,9 @@ function buildGlobalHeaders(context) {
845931
846022
  // pnp:/home/circleci/project/packages/cli/openapi-ir-to-fern/lib/buildEndpointExample.js
845932
846023
  function buildEndpointExample({ endpointExample, context }) {
845933
846024
  const example = {};
846025
+ if (endpointExample.type !== "full") {
846026
+ return endpointExample.value;
846027
+ }
845934
846028
  if (endpointExample.name != null) {
845935
846029
  example.name = endpointExample.name;
845936
846030
  }
@@ -851128,10 +851222,10 @@ var CliContext = class {
851128
851222
  return "fern-api";
851129
851223
  }
851130
851224
  getPackageVersion() {
851131
- if ("0.19.26" == null) {
851225
+ if ("0.19.28" == null) {
851132
851226
  this.logger.error("CLI_VERSION is not defined");
851133
851227
  }
851134
- return "0.19.26";
851228
+ return "0.19.28";
851135
851229
  }
851136
851230
  getCliName() {
851137
851231
  if ("fern" == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.19.26",
3
+ "version": "0.19.28",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",