@fern-api/fern-api-dev 4.95.0 → 4.96.0

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 +134 -26
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -478306,6 +478306,7 @@ var SingleUndiscriminatedUnionTypeSchema = schemas_exports.undiscriminatedUnion(
478306
478306
  // ../fern-definition/schema/lib/schemas/serialization/resources/types/types/UndiscriminatedUnionSchema.js
478307
478307
  var UndiscriminatedUnionSchema = schemas_exports.object({
478308
478308
  discriminated: schemas_exports.booleanLiteral(false),
478309
+ "base-properties": schemas_exports.record(schemas_exports.string(), TypeReferenceSchema).optional(),
478309
478310
  union: schemas_exports.list(SingleUndiscriminatedUnionTypeSchema)
478310
478311
  }).extend(BaseTypeDeclarationSchema);
478311
478312
 
@@ -489207,7 +489208,8 @@ var UndiscriminatedUnionMember = schemas_exports3.objectWithoutOptionalPropertie
489207
489208
 
489208
489209
  // ../../ir-sdk/lib/sdk/serialization/resources/types/types/UndiscriminatedUnionTypeDeclaration.js
489209
489210
  var UndiscriminatedUnionTypeDeclaration = schemas_exports3.objectWithoutOptionalProperties({
489210
- members: schemas_exports3.list(UndiscriminatedUnionMember)
489211
+ members: schemas_exports3.list(UndiscriminatedUnionMember),
489212
+ baseProperties: schemas_exports3.list(ObjectProperty).optional()
489211
489213
  });
489212
489214
 
489213
489215
  // ../../ir-sdk/lib/sdk/serialization/resources/types/types/SingleUnionTypeProperty.js
@@ -491587,6 +491589,7 @@ function visitTypeDeclaration({ typeName, declaration, visitor, nodePathForType
491587
491589
  visitObject(union22, {
491588
491590
  docs: createDocsVisitor(visitor, nodePathForType),
491589
491591
  discriminated: noop2,
491592
+ "base-properties": noop2,
491590
491593
  union: (unionMembers) => {
491591
491594
  for (const [index3, unionMember] of unionMembers.entries()) {
491592
491595
  const nodePathForUnionType = [...nodePathForType, `union[${index3}]`];
@@ -519799,6 +519802,7 @@ var Schema2 = schemas_exports9.union("type", {
519799
519802
 
519800
519803
  // ../api-importers/openapi/openapi-ir/lib/sdk/serialization/resources/finalIr/types/UnDiscriminatedOneOfSchema.js
519801
519804
  var UnDiscriminatedOneOfSchema = schemas_exports9.objectWithoutOptionalProperties({
519805
+ commonProperties: schemas_exports9.list(schemas_exports9.lazyObject(() => CommonProperty)).optional(),
519802
519806
  schemas: schemas_exports9.list(schemas_exports9.lazy(() => Schema2))
519803
519807
  }).extend(WithSdkGroupName).extend(WithNamespace).extend(WithName3).extend(WithDescription).extend(WithAvailability3).extend(WithEncoding).extend(WithSource).extend(WithTitle).extend(WithInline);
519804
519808
 
@@ -520286,6 +520290,7 @@ var SchemaWithExample2 = schemas_exports9.union("type", {
520286
520290
 
520287
520291
  // ../api-importers/openapi/openapi-ir/lib/sdk/serialization/resources/parseIr/types/UnDiscriminatedOneOfSchemaWithExample.js
520288
520292
  var UnDiscriminatedOneOfSchemaWithExample = schemas_exports9.objectWithoutOptionalProperties({
520293
+ commonProperties: schemas_exports9.list(schemas_exports9.lazyObject(() => CommonPropertyWithExample)).optional(),
520289
520294
  schemas: schemas_exports9.list(schemas_exports9.lazy(() => SchemaWithExample2))
520290
520295
  }).extend(WithSdkGroupName).extend(WithNamespace).extend(WithName3).extend(WithDescription).extend(WithAvailability3).extend(WithEncoding).extend(WithSource).extend(WithTitle).extend(WithInline);
520291
520296
 
@@ -521863,9 +521868,9 @@ function buildLiteralTypeDeclaration(schema2, nameOverride, generatedName) {
521863
521868
  function buildOneOfTypeDeclaration({ schema: schema2, context: context3, declarationFile, namespace, declarationDepth, variant }) {
521864
521869
  const encoding = schema2.encoding != null ? convertToEncodingSchema(schema2.encoding) : void 0;
521865
521870
  if (schema2.type === "discriminated") {
521866
- const baseProperties = {};
521871
+ const baseProperties2 = {};
521867
521872
  for (const property23 of schema2.commonProperties) {
521868
- baseProperties[property23.key] = buildTypeReference({
521873
+ baseProperties2[property23.key] = buildTypeReference({
521869
521874
  schema: property23.schema,
521870
521875
  fileContainingReference: declarationFile,
521871
521876
  context: context3,
@@ -521897,7 +521902,7 @@ function buildOneOfTypeDeclaration({ schema: schema2, context: context3, declara
521897
521902
  context: schema2.discriminatorContext
521898
521903
  }
521899
521904
  } : schema2.discriminantProperty,
521900
- "base-properties": baseProperties,
521905
+ "base-properties": baseProperties2,
521901
521906
  docs: schema2.description ?? void 0,
521902
521907
  availability: schema2.availability != null ? convertAvailability(schema2.availability) : void 0,
521903
521908
  union: union23,
@@ -521918,10 +521923,22 @@ function buildOneOfTypeDeclaration({ schema: schema2, context: context3, declara
521918
521923
  variant
521919
521924
  }));
521920
521925
  }
521926
+ const baseProperties = schema2.commonProperties != null && schema2.commonProperties.length > 0 ? Object.fromEntries(schema2.commonProperties.map((property23) => [
521927
+ property23.key,
521928
+ buildTypeReference({
521929
+ schema: property23.schema,
521930
+ fileContainingReference: declarationFile,
521931
+ context: context3,
521932
+ namespace,
521933
+ declarationDepth: declarationDepth + 1,
521934
+ variant
521935
+ })
521936
+ ])) : void 0;
521921
521937
  return {
521922
521938
  name: schema2.nameOverride ?? schema2.generatedName,
521923
521939
  schema: {
521924
521940
  discriminated: false,
521941
+ "base-properties": baseProperties,
521925
521942
  docs: schema2.description ?? void 0,
521926
521943
  union: union22,
521927
521944
  encoding,
@@ -528784,6 +528801,12 @@ function convertToOneOf(oneOfSchema) {
528784
528801
  generatedName: oneOfSchema.generatedName,
528785
528802
  title: oneOfSchema.title,
528786
528803
  nameOverride: oneOfSchema.nameOverride,
528804
+ commonProperties: oneOfSchema.commonProperties?.map((commonProperty) => {
528805
+ return {
528806
+ key: commonProperty.key,
528807
+ schema: convertSchemaWithExampleToSchema(commonProperty.schema)
528808
+ };
528809
+ }),
528787
528810
  schemas: oneOfSchema.schemas.map((oneOfSchema2) => convertSchemaWithExampleToSchema(oneOfSchema2)),
528788
528811
  namespace: oneOfSchema.namespace,
528789
528812
  groupName: oneOfSchema.groupName,
@@ -529176,7 +529199,7 @@ function getAllProperties({ schema: schema2, context: context3, breadcrumbs, sou
529176
529199
 
529177
529200
  // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertUndiscriminatedOneOf.js
529178
529201
  init_lodash();
529179
- function convertUndiscriminatedOneOf({ nameOverride, generatedName, title: title2, breadcrumbs, description, availability, wrapAsOptional, wrapAsNullable, context: context3, subtypes, namespace, groupName, encoding, source: source2, subtypeSuffixOverrides }) {
529202
+ function convertUndiscriminatedOneOf({ nameOverride, generatedName, title: title2, breadcrumbs, description, availability, wrapAsOptional, wrapAsNullable, context: context3, subtypes, namespace, groupName, encoding, source: source2, subtypeSuffixOverrides, properties: properties7, required: required6 }) {
529180
529203
  const derivedSubtypeSuffixes = getUniqueSubTypeNames({ schemas: subtypes });
529181
529204
  const convertedSubtypes = subtypes.flatMap((schema2, index3) => {
529182
529205
  if (!isReferenceObject(schema2) && schema2.enum != null && context3.options.coerceEnumsToLiterals && schema2.type === "string") {
@@ -529204,6 +529227,14 @@ function convertUndiscriminatedOneOf({ nameOverride, generatedName, title: title
529204
529227
  convertSchema2(schema2, false, false, context3, [...breadcrumbs, subtypeSuffix ?? `${index3}`], source2, namespace)
529205
529228
  ];
529206
529229
  });
529230
+ const convertedCommonProperties = properties7 != null && Object.keys(properties7).length > 0 ? Object.entries(properties7).map(([propertyName, propertySchema]) => {
529231
+ const isRequired = required6 != null && required6.includes(propertyName);
529232
+ const [isOptional, isNullable] = context3.options.coerceOptionalSchemasToNullable ? [false, !isRequired] : [!isRequired, false];
529233
+ return {
529234
+ key: propertyName,
529235
+ schema: convertSchema2(propertySchema, isOptional, isNullable, context3, [...breadcrumbs, propertyName], source2, namespace)
529236
+ };
529237
+ }) : void 0;
529207
529238
  const uniqueSubtypes = deduplicateSubtypes(convertedSubtypes);
529208
529239
  return processSubtypes({
529209
529240
  uniqueSubtypes,
@@ -529218,7 +529249,8 @@ function convertUndiscriminatedOneOf({ nameOverride, generatedName, title: title
529218
529249
  groupName,
529219
529250
  context: context3,
529220
529251
  encoding,
529221
- source: source2
529252
+ source: source2,
529253
+ commonProperties: convertedCommonProperties
529222
529254
  });
529223
529255
  }
529224
529256
  function deduplicateSubtypes(subtypes) {
@@ -529239,11 +529271,12 @@ function deduplicateSubtypes(subtypes) {
529239
529271
  }
529240
529272
  return uniqueSubtypes;
529241
529273
  }
529242
- function processSubtypes({ uniqueSubtypes, nameOverride, generatedName, title: title2, wrapAsOptional, wrapAsNullable, description, availability, namespace, groupName, context: context3, encoding, source: source2 }) {
529274
+ function processSubtypes({ uniqueSubtypes, nameOverride, generatedName, title: title2, wrapAsOptional, wrapAsNullable, description, availability, namespace, groupName, context: context3, encoding, source: source2, commonProperties }) {
529275
+ const hasCommonProperties = commonProperties != null && commonProperties.length > 0;
529243
529276
  const everySubTypeIsLiteral = Object.entries(uniqueSubtypes).every(([_7, schema2]) => {
529244
529277
  return schema2.type === "literal";
529245
529278
  });
529246
- if (everySubTypeIsLiteral) {
529279
+ if (everySubTypeIsLiteral && !hasCommonProperties) {
529247
529280
  const enumDescriptions = {};
529248
529281
  const enumValues = [];
529249
529282
  Object.entries(uniqueSubtypes).forEach(([_7, schema2]) => {
@@ -529275,7 +529308,7 @@ function processSubtypes({ uniqueSubtypes, nameOverride, generatedName, title: t
529275
529308
  inline: void 0
529276
529309
  });
529277
529310
  }
529278
- if (uniqueSubtypes.length === 1 && uniqueSubtypes[0] != null && !context3.options.preserveSingleSchemaOneOf) {
529311
+ if (uniqueSubtypes.length === 1 && uniqueSubtypes[0] != null && !context3.options.preserveSingleSchemaOneOf && !hasCommonProperties) {
529279
529312
  let result = uniqueSubtypes[0];
529280
529313
  if (wrapAsNullable) {
529281
529314
  result = SchemaWithExample.nullable({
@@ -529317,7 +529350,8 @@ function processSubtypes({ uniqueSubtypes, nameOverride, generatedName, title: t
529317
529350
  namespace,
529318
529351
  groupName,
529319
529352
  encoding,
529320
- source: source2
529353
+ source: source2,
529354
+ commonProperties
529321
529355
  });
529322
529356
  }
529323
529357
  function convertUndiscriminatedOneOfWithDiscriminant({ nameOverride, generatedName, title: title2, description, availability, wrapAsOptional, wrapAsNullable, context: context3, namespace, groupName, discriminator, encoding, source: source2 }) {
@@ -529445,13 +529479,14 @@ function getUniqueSubTypeNames({ schemas }) {
529445
529479
  });
529446
529480
  return prefixes;
529447
529481
  }
529448
- function wrapUndiscriminatedOneOf({ nameOverride, generatedName, title: title2, wrapAsOptional, wrapAsNullable, description, availability, subtypes, namespace, groupName, encoding, source: source2 }) {
529482
+ function wrapUndiscriminatedOneOf({ nameOverride, generatedName, title: title2, wrapAsOptional, wrapAsNullable, description, availability, subtypes, namespace, groupName, encoding, source: source2, commonProperties }) {
529449
529483
  let result = SchemaWithExample.oneOf(OneOfSchemaWithExample.undiscriminated({
529450
529484
  description,
529451
529485
  availability,
529452
529486
  nameOverride,
529453
529487
  generatedName,
529454
529488
  title: title2,
529489
+ commonProperties: commonProperties != null && commonProperties.length > 0 ? commonProperties : void 0,
529455
529490
  schemas: subtypes,
529456
529491
  namespace,
529457
529492
  groupName,
@@ -530378,7 +530413,9 @@ function convertSchemaObject(schema2, wrapAsOptional, wrapAsNullable, context3,
530378
530413
  encoding,
530379
530414
  namespace,
530380
530415
  groupName,
530381
- source: source2
530416
+ source: source2,
530417
+ properties: schema2.properties,
530418
+ required: schema2.required
530382
530419
  });
530383
530420
  }
530384
530421
  }
@@ -530444,7 +530481,9 @@ function convertSchemaObject(schema2, wrapAsOptional, wrapAsNullable, context3,
530444
530481
  encoding,
530445
530482
  namespace,
530446
530483
  groupName,
530447
- source: source2
530484
+ source: source2,
530485
+ properties: schema2.properties,
530486
+ required: schema2.required
530448
530487
  });
530449
530488
  }
530450
530489
  if (schema2.discriminator?.mapping != null && Object.keys(schema2.discriminator.mapping).length > 0 && schema2.oneOf == null && schema2.anyOf == null) {
@@ -532299,6 +532338,12 @@ function convertToOneOf2(oneOfSchema) {
532299
532338
  generatedName: oneOfSchema.generatedName,
532300
532339
  nameOverride: oneOfSchema.nameOverride,
532301
532340
  title: oneOfSchema.title,
532341
+ commonProperties: oneOfSchema.commonProperties?.map((commonProperty) => {
532342
+ return {
532343
+ key: commonProperty.key,
532344
+ schema: convertSchemaToSchemaWithExample(commonProperty.schema)
532345
+ };
532346
+ }),
532302
532347
  schemas: oneOfSchema.schemas.map((oneOfSchema2) => convertSchemaToSchemaWithExample(oneOfSchema2)),
532303
532348
  namespace: oneOfSchema.namespace,
532304
532349
  groupName: oneOfSchema.groupName,
@@ -561162,6 +561207,19 @@ function convertUndiscriminatedUnionTypeDeclaration({ union: union22, file: file
561162
561207
  }) === currentIndex;
561163
561208
  });
561164
561209
  return Type.undiscriminatedUnion({
561210
+ baseProperties: union22["base-properties"] != null ? Object.entries(union22["base-properties"]).map(([propertyKey, propertyDefinition]) => ({
561211
+ ...convertDeclaration(propertyDefinition),
561212
+ name: file4.casingsGenerator.generateNameAndWireValue({
561213
+ wireValue: propertyKey,
561214
+ name: getPropertyName({ propertyKey, property: propertyDefinition }).name
561215
+ }),
561216
+ valueType: file4.parseTypeReference(propertyDefinition),
561217
+ propertyAccess: getPropertyAccess2({ property: propertyDefinition }),
561218
+ v2Examples: {
561219
+ userSpecifiedExamples: {},
561220
+ autogeneratedExamples: {}
561221
+ }
561222
+ })) : void 0,
561165
561223
  members: uniqueMembers.map((member) => {
561166
561224
  const parsedType2 = file4.parseTypeReference(typeof member === "string" ? member : member.type);
561167
561225
  const typeWithDisplayName = parsedType2.type === "named" ? {
@@ -561226,13 +561284,18 @@ function getReferencedTypesFromRawDeclaration({ typeDeclaration: typeDeclaration
561226
561284
  return types4;
561227
561285
  },
561228
561286
  undiscriminatedUnion: (unionDeclaration) => {
561229
- return Object.values(unionDeclaration.union).reduce((types4, unionMember) => {
561287
+ const types4 = [];
561288
+ if (unionDeclaration["base-properties"] != null) {
561289
+ types4.push(...Object.values(unionDeclaration["base-properties"]).map((property23) => typeof property23 === "string" ? property23 : property23.type));
561290
+ }
561291
+ types4.push(...Object.values(unionDeclaration.union).reduce((memberTypes, unionMember) => {
561230
561292
  const rawType = typeof unionMember === "string" ? unionMember : unionMember.type;
561231
561293
  if (typeof rawType === "string") {
561232
- types4.push(rawType);
561294
+ memberTypes.push(rawType);
561233
561295
  }
561234
- return types4;
561235
- }, []);
561296
+ return memberTypes;
561297
+ }, []));
561298
+ return types4;
561236
561299
  },
561237
561300
  enum: () => []
561238
561301
  });
@@ -588591,6 +588654,19 @@ var definitions2 = {
588591
588654
  discriminated: {
588592
588655
  const: false
588593
588656
  },
588657
+ "base-properties": {
588658
+ oneOf: [
588659
+ {
588660
+ type: "object",
588661
+ additionalProperties: {
588662
+ $ref: "#/definitions/types.TypeReferenceSchema"
588663
+ }
588664
+ },
588665
+ {
588666
+ type: "null"
588667
+ }
588668
+ ]
588669
+ },
588594
588670
  union: {
588595
588671
  type: "array",
588596
588672
  items: {
@@ -592802,6 +592878,19 @@ var definitions3 = {
592802
592878
  discriminated: {
592803
592879
  const: false
592804
592880
  },
592881
+ "base-properties": {
592882
+ oneOf: [
592883
+ {
592884
+ type: "object",
592885
+ additionalProperties: {
592886
+ $ref: "#/definitions/types.TypeReferenceSchema"
592887
+ }
592888
+ },
592889
+ {
592890
+ type: "null"
592891
+ }
592892
+ ]
592893
+ },
592805
592894
  union: {
592806
592895
  type: "array",
592807
592896
  items: {
@@ -600486,7 +600575,8 @@ var OneOfSchemaConverter = class extends AbstractConverter {
600486
600575
  }
600487
600576
  continue;
600488
600577
  }
600489
- const extendedSubSchema = this.extendSubSchema(subSchema);
600578
+ const hasSiblingProperties = Object.keys(this.schema.properties ?? {}).length > 0;
600579
+ const extendedSubSchema = hasSiblingProperties ? void 0 : this.extendSubSchema(subSchema);
600490
600580
  const schemaId = this.context.convertBreadcrumbsToName([`${this.id}_${index3}`]);
600491
600581
  const displayName = subSchema.title;
600492
600582
  const schemaConverter = new SchemaConverter({
@@ -600529,12 +600619,29 @@ var OneOfSchemaConverter = class extends AbstractConverter {
600529
600619
  });
600530
600620
  }
600531
600621
  }
600622
+ const { convertedProperties: siblingProperties, referencedTypes: siblingReferencedTypes, inlinedTypesFromProperties: siblingInlinedTypes } = convertProperties({
600623
+ properties: this.schema.properties ?? {},
600624
+ required: this.schema.required ?? [],
600625
+ breadcrumbs: this.breadcrumbs,
600626
+ context: this.context,
600627
+ errorCollector: this.context.errorCollector
600628
+ });
600629
+ for (const typeId of Object.keys(siblingInlinedTypes)) {
600630
+ referencedTypes.add(typeId);
600631
+ }
600632
+ for (const ref2 of siblingReferencedTypes) {
600633
+ referencedTypes.add(ref2);
600634
+ }
600532
600635
  return {
600533
600636
  type: Type.undiscriminatedUnion({
600534
- members: unionTypes
600637
+ members: unionTypes,
600638
+ baseProperties: siblingProperties.length > 0 ? siblingProperties : void 0
600535
600639
  }),
600536
600640
  referencedTypes,
600537
- inlinedTypes
600641
+ inlinedTypes: {
600642
+ ...inlinedTypes,
600643
+ ...siblingInlinedTypes
600644
+ }
600538
600645
  };
600539
600646
  }
600540
600647
  shouldConvertAsNullableSchemaOrReference() {
@@ -618084,7 +618191,7 @@ var AccessTokenPosthogManager = class {
618084
618191
  properties: {
618085
618192
  ...event,
618086
618193
  ...event.properties,
618087
- version: "4.95.0",
618194
+ version: "4.96.0",
618088
618195
  usingAccessToken: true
618089
618196
  }
618090
618197
  });
@@ -618138,7 +618245,7 @@ var UserPosthogManager = class {
618138
618245
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
618139
618246
  event: "CLI",
618140
618247
  properties: {
618141
- version: "4.95.0",
618248
+ version: "4.96.0",
618142
618249
  ...event,
618143
618250
  ...event.properties,
618144
618251
  usingAccessToken: false,
@@ -829262,7 +829369,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
829262
829369
  var LOGS_FOLDER_NAME = "logs";
829263
829370
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
829264
829371
  function getCliSource() {
829265
- const version7 = "4.95.0";
829372
+ const version7 = "4.96.0";
829266
829373
  return `cli@${version7}`;
829267
829374
  }
829268
829375
  var DebugLogger = class {
@@ -841225,7 +841332,7 @@ var LegacyDocsPublisher = class {
841225
841332
  previewId,
841226
841333
  disableTemplates: void 0,
841227
841334
  skipUpload,
841228
- cliVersion: "4.95.0",
841335
+ cliVersion: "4.96.0",
841229
841336
  loginCommand: "fern auth login"
841230
841337
  });
841231
841338
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -911874,7 +911981,8 @@ var OneOfFieldConverter = class extends AbstractConverter {
911874
911981
  }
911875
911982
  return {
911876
911983
  type: Type.undiscriminatedUnion({
911877
- members: unionTypes
911984
+ members: unionTypes,
911985
+ baseProperties: void 0
911878
911986
  }),
911879
911987
  referencedTypes: /* @__PURE__ */ new Set(),
911880
911988
  inlinedTypes: {},
@@ -915717,7 +915825,7 @@ var CliContext = class _CliContext {
915717
915825
  if (false) {
915718
915826
  this.logger.error("CLI_VERSION is not defined");
915719
915827
  }
915720
- return "4.95.0";
915828
+ return "4.96.0";
915721
915829
  }
915722
915830
  getCliName() {
915723
915831
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.95.0",
2
+ "version": "4.96.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",