@fern-api/fern-api-dev 4.62.3-50-gc32e032416e → 4.62.3-52-ga3924e34299

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 +43 -18
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -603088,7 +603088,7 @@ var AccessTokenPosthogManager = class {
603088
603088
  properties: {
603089
603089
  ...event,
603090
603090
  ...event.properties,
603091
- version: "4.62.3-50-gc32e032416e",
603091
+ version: "4.62.3-52-ga3924e34299",
603092
603092
  usingAccessToken: true
603093
603093
  }
603094
603094
  });
@@ -603139,7 +603139,7 @@ var UserPosthogManager = class {
603139
603139
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
603140
603140
  event: "CLI",
603141
603141
  properties: {
603142
- version: "4.62.3-50-gc32e032416e",
603142
+ version: "4.62.3-52-ga3924e34299",
603143
603143
  ...event,
603144
603144
  ...event.properties,
603145
603145
  usingAccessToken: false,
@@ -839730,7 +839730,7 @@ var import_path54 = __toESM(require("path"), 1);
839730
839730
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
839731
839731
  var LOGS_FOLDER_NAME = "logs";
839732
839732
  function getCliSource() {
839733
- const version7 = "4.62.3-50-gc32e032416e";
839733
+ const version7 = "4.62.3-52-ga3924e34299";
839734
839734
  return `cli@${version7}`;
839735
839735
  }
839736
839736
  var DebugLogger = class {
@@ -850838,7 +850838,7 @@ var LegacyDocsPublisher = class {
850838
850838
  previewId,
850839
850839
  disableTemplates: void 0,
850840
850840
  skipUpload,
850841
- cliVersion: "4.62.3-50-gc32e032416e"
850841
+ cliVersion: "4.62.3-52-ga3924e34299"
850842
850842
  });
850843
850843
  if (taskContext.getResult() === TaskResult.Failure) {
850844
850844
  return { success: false };
@@ -884660,11 +884660,15 @@ var DynamicTypeLiteralMapper3 = class {
884660
884660
  if (unionProperties == null) {
884661
884661
  return python_exports2.TypeInstantiation.nop();
884662
884662
  }
884663
- const discriminantProperty = {
884664
- name: this.context.getPropertyName(discriminatedUnion2.discriminant.name),
884665
- value: python_exports2.TypeInstantiation.str(unionVariant.discriminantValue.wireValue)
884666
- };
884667
- return python_exports2.TypeInstantiation.typedDict([discriminantProperty, ...unionProperties], { multiline: true });
884663
+ const variantClassReference = this.context.getDiscriminatedUnionVariantClassReference({
884664
+ unionDeclaration: discriminatedUnion2.declaration,
884665
+ discriminantValue: unionVariant.discriminantValue
884666
+ });
884667
+ return python_exports2.TypeInstantiation.reference(python_exports2.instantiateClass({
884668
+ classReference: variantClassReference,
884669
+ arguments_: unionProperties.map((entry) => python_exports2.methodArgument({ name: entry.name, value: entry.value })),
884670
+ multiline: true
884671
+ }));
884668
884672
  }
884669
884673
  convertDiscriminatedUnionProperties({ discriminatedUnionTypeInstance, unionVariant }) {
884670
884674
  const baseFields = this.getBaseFields({
@@ -884785,9 +884789,6 @@ var DynamicTypeLiteralMapper3 = class {
884785
884789
  }
884786
884790
  convertObject({ object_, value }) {
884787
884791
  const entries22 = this.convertObjectEntries({ object_, value });
884788
- if (this.context.useTypedDictRequests()) {
884789
- return python_exports2.TypeInstantiation.typedDict(entries22, { multiline: true });
884790
- }
884791
884792
  const classReference4 = this.context.getTypeClassReference(object_.declaration);
884792
884793
  return python_exports2.TypeInstantiation.reference(python_exports2.instantiateClass({
884793
884794
  classReference: classReference4,
@@ -884800,7 +884801,16 @@ var DynamicTypeLiteralMapper3 = class {
884800
884801
  if (enumValue == null) {
884801
884802
  return python_exports2.TypeInstantiation.nop();
884802
884803
  }
884803
- return python_exports2.TypeInstantiation.str(enumValue);
884804
+ const enumType2 = this.context.customConfig.pydantic_config?.enum_type;
884805
+ if (enumType2 === "python_enums" || enumType2 === "forward_compatible_python_enums") {
884806
+ const classReference4 = this.context.getTypeClassReference(enum_23.declaration);
884807
+ const memberName = enumValue.name.screamingSnakeCase.safeName;
884808
+ return python_exports2.TypeInstantiation.reference(python_exports2.accessAttribute({
884809
+ lhs: classReference4,
884810
+ rhs: python_exports2.codeBlock(memberName)
884811
+ }));
884812
+ }
884813
+ return python_exports2.TypeInstantiation.str(enumValue.wireValue);
884804
884814
  }
884805
884815
  getEnumValue({ enum_: enum_23, value }) {
884806
884816
  if (typeof value !== "string") {
@@ -884818,7 +884828,7 @@ var DynamicTypeLiteralMapper3 = class {
884818
884828
  });
884819
884829
  return void 0;
884820
884830
  }
884821
- return value;
884831
+ return enumValue;
884822
884832
  }
884823
884833
  convertUndiscriminatedUnion({ undiscriminatedUnion: undiscriminatedUnion20, value }) {
884824
884834
  const result = this.findMatchingUndiscriminatedUnionType({
@@ -884939,6 +884949,15 @@ var DynamicTypeLiteralMapper3 = class {
884939
884949
  if (firstValue == null) {
884940
884950
  return python_exports2.TypeInstantiation.nop();
884941
884951
  }
884952
+ const enumType2 = this.context.customConfig.pydantic_config?.enum_type;
884953
+ if (enumType2 === "python_enums" || enumType2 === "forward_compatible_python_enums") {
884954
+ const classReference4 = this.context.getTypeClassReference(named.declaration);
884955
+ const memberName = firstValue.name.screamingSnakeCase.safeName;
884956
+ return python_exports2.TypeInstantiation.reference(python_exports2.accessAttribute({
884957
+ lhs: classReference4,
884958
+ rhs: python_exports2.codeBlock(memberName)
884959
+ }));
884960
+ }
884942
884961
  return python_exports2.TypeInstantiation.str(firstValue.wireValue);
884943
884962
  }
884944
884963
  case "object": {
@@ -884955,9 +884974,6 @@ var DynamicTypeLiteralMapper3 = class {
884955
884974
  });
884956
884975
  }
884957
884976
  }
884958
- if (this.context.useTypedDictRequests()) {
884959
- return python_exports2.TypeInstantiation.typedDict(entries22, { multiline: true });
884960
- }
884961
884977
  const classReference4 = this.context.getTypeClassReference(named.declaration);
884962
884978
  return python_exports2.TypeInstantiation.reference(python_exports2.instantiateClass({
884963
884979
  classReference: classReference4,
@@ -885186,6 +885202,15 @@ var DynamicSnippetsGeneratorContext5 = class _DynamicSnippetsGeneratorContext ex
885186
885202
  ];
885187
885203
  return python_exports2.reference({ name: className, modulePath });
885188
885204
  }
885205
+ getDiscriminatedUnionVariantClassReference({ unionDeclaration, discriminantValue }) {
885206
+ const unionClassName = this.getClassName(unionDeclaration.name);
885207
+ const variantSuffix = discriminantValue.name.pascalCase.safeName;
885208
+ const modulePath = [
885209
+ ...this.getRootModulePath(),
885210
+ ...unionDeclaration.fernFilepath.allParts.map((part) => part.snakeCase.safeName)
885211
+ ];
885212
+ return python_exports2.reference({ name: `${unionClassName}_${variantSuffix}`, modulePath });
885213
+ }
885189
885214
  useTypedDictRequests() {
885190
885215
  return this.customConfig.use_typeddict_requests === true;
885191
885216
  }
@@ -924145,7 +924170,7 @@ var CliContext = class {
924145
924170
  if (false) {
924146
924171
  this.logger.error("CLI_VERSION is not defined");
924147
924172
  }
924148
- return "4.62.3-50-gc32e032416e";
924173
+ return "4.62.3-52-ga3924e34299";
924149
924174
  }
924150
924175
  getCliName() {
924151
924176
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.62.3-50-gc32e032416e",
2
+ "version": "4.62.3-52-ga3924e34299",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",