@fern-api/fern-api-dev 5.44.12 → 5.44.14

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 +101 -48
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -660747,7 +660747,7 @@ var NoConflictingParameterNamesRule = {
660747
660747
  const mergedParams = mergeParameters(pathLevelParams, operationParams);
660748
660748
  const nameToParams = {};
660749
660749
  for (const param of mergedParams) {
660750
- const normalizedName = toCamelCase3(param.name);
660750
+ const normalizedName = toCamelCase3(param.fernParameterName ?? param.name);
660751
660751
  if (normalizedName === "") {
660752
660752
  continue;
660753
660753
  }
@@ -660762,7 +660762,10 @@ var NoConflictingParameterNamesRule = {
660762
660762
  if (distinctTypes.size <= 1) {
660763
660763
  continue;
660764
660764
  }
660765
- const paramDescriptions = params2.map((p14) => `${p14.in} parameter '${p14.name}'`).join(", ");
660765
+ const paramDescriptions = params2.map((p14) => {
660766
+ const effectiveName = p14.fernParameterName ?? p14.name;
660767
+ return `${p14.in} parameter '${effectiveName}'`;
660768
+ }).join(", ");
660766
660769
  violations.push({
660767
660770
  name: "no-conflicting-parameter-names",
660768
660771
  severity: "error",
@@ -660821,7 +660824,8 @@ function resolveParam(param, api2, visited = /* @__PURE__ */ new Set()) {
660821
660824
  return void 0;
660822
660825
  }
660823
660826
  if (typeof paramObj.in === "string" && typeof paramObj.name === "string") {
660824
- return { in: paramObj.in, name: paramObj.name };
660827
+ const fernParameterName = typeof paramObj["x-fern-parameter-name"] === "string" ? paramObj["x-fern-parameter-name"] : void 0;
660828
+ return { in: paramObj.in, name: paramObj.name, fernParameterName };
660825
660829
  }
660826
660830
  return void 0;
660827
660831
  }
@@ -669562,7 +669566,7 @@ var AccessTokenPosthogManager = class {
669562
669566
  properties: {
669563
669567
  ...event,
669564
669568
  ...event.properties,
669565
- version: "5.44.12",
669569
+ version: "5.44.14",
669566
669570
  usingAccessToken: true,
669567
669571
  ...getRunIdProperties()
669568
669572
  }
@@ -669626,7 +669630,7 @@ var UserPosthogManager = class {
669626
669630
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
669627
669631
  event: "CLI",
669628
669632
  properties: {
669629
- version: "5.44.12",
669633
+ version: "5.44.14",
669630
669634
  ...event,
669631
669635
  ...event.properties,
669632
669636
  usingAccessToken: false,
@@ -861367,7 +861371,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
861367
861371
  var LOGS_FOLDER_NAME = "logs";
861368
861372
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
861369
861373
  function getCliSource() {
861370
- const version7 = "5.44.12";
861374
+ const version7 = "5.44.14";
861371
861375
  return `cli@${version7}`;
861372
861376
  }
861373
861377
  var DebugLogger = class {
@@ -892459,7 +892463,7 @@ var LegacyDocsPublisher = class {
892459
892463
  previewId,
892460
892464
  disableTemplates: void 0,
892461
892465
  skipUpload,
892462
- cliVersion: "5.44.12",
892466
+ cliVersion: "5.44.14",
892463
892467
  loginCommand: "fern auth login"
892464
892468
  });
892465
892469
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -923893,7 +923897,7 @@ var DynamicTypeLiteralMapper2 = class {
923893
923897
  name: this.context.getClassName(discriminatedUnion2.declaration.name),
923894
923898
  namespace: this.context.getTypesNamespace(discriminatedUnion2.declaration.fernFilepath)
923895
923899
  }),
923896
- method: this.context.getMethodName(unionVariant.discriminantValue.name),
923900
+ method: this.context.getPropertyName(unionVariant.discriminantValue.name),
923897
923901
  arguments_: this.convertDiscriminatedUnionVariantArgs({
923898
923902
  discriminatedUnionTypeInstance,
923899
923903
  unionVariant,
@@ -923938,12 +923942,14 @@ var DynamicTypeLiteralMapper2 = class {
923938
923942
  }
923939
923943
  ];
923940
923944
  }
923945
+ const wireValue = unionVariant.discriminantValue.wireValue;
923946
+ const singlePropertyValue = record23[wireValue] ?? record23["value"];
923941
923947
  return [
923942
923948
  {
923943
923949
  name: this.context.getPropertyName(unionVariant.discriminantValue.name),
923944
923950
  value: this.convert({
923945
923951
  typeReference: unionVariant.typeReference,
923946
- value: record23[unionVariant.discriminantValue.wireValue]
923952
+ value: singlePropertyValue
923947
923953
  })
923948
923954
  }
923949
923955
  ];
@@ -923958,20 +923964,14 @@ var DynamicTypeLiteralMapper2 = class {
923958
923964
  }
923959
923965
  }
923960
923966
  convertDiscriminatedUnionVariantArgs({ discriminatedUnionTypeInstance, unionVariant, unionProperties }) {
923961
- const baseFields = this.getBaseFields({
923967
+ const { required: requiredBaseFields, optional: optionalBaseFields } = this.getBaseFields({
923962
923968
  discriminatedUnionTypeInstance,
923963
923969
  singleDiscriminatedUnionType: unionVariant
923964
923970
  });
923965
923971
  if (unionVariant.type === "singleProperty") {
923966
- const record23 = this.context.getRecord(discriminatedUnionTypeInstance.value);
923967
- if (record23 == null && unionProperties.length === 1) {
923968
- return [
923969
- ...baseFields,
923970
- this.convert({
923971
- typeReference: unionVariant.typeReference,
923972
- value: discriminatedUnionTypeInstance.value
923973
- })
923974
- ];
923972
+ const singleProperty = unionProperties[0];
923973
+ if (singleProperty != null) {
923974
+ return [...requiredBaseFields, singleProperty.value, ...optionalBaseFields];
923975
923975
  }
923976
923976
  }
923977
923977
  if (unionVariant.type === "samePropertiesAsObject") {
@@ -923982,17 +923982,18 @@ var DynamicTypeLiteralMapper2 = class {
923982
923982
  return [];
923983
923983
  }
923984
923984
  return [
923985
- ...baseFields,
923985
+ ...requiredBaseFields,
923986
923986
  php_exports.TypeLiteral.class_({
923987
923987
  reference: php_exports.classReference({
923988
923988
  name: this.context.getClassName(named.declaration.name),
923989
923989
  namespace: this.context.getTypesNamespace(named.declaration.fernFilepath)
923990
923990
  }),
923991
923991
  fields: unionProperties
923992
- })
923992
+ }),
923993
+ ...optionalBaseFields
923993
923994
  ];
923994
923995
  }
923995
- return baseFields;
923996
+ return [...requiredBaseFields, ...optionalBaseFields];
923996
923997
  }
923997
923998
  getBaseFields({ discriminatedUnionTypeInstance, singleDiscriminatedUnionType }) {
923998
923999
  const properties7 = this.context.associateByWireValue({
@@ -924002,14 +924003,22 @@ var DynamicTypeLiteralMapper2 = class {
924002
924003
  // are handled by the union variant.
924003
924004
  ignoreMissingParameters: true
924004
924005
  });
924005
- return properties7.map((property24) => {
924006
+ const required6 = [];
924007
+ const optional23 = [];
924008
+ for (const property24 of properties7) {
924006
924009
  this.context.errors.scope(property24.name.wireValue);
924007
924010
  try {
924008
- return this.convert(property24);
924011
+ const converted = this.convert(property24);
924012
+ if (this.isOptionalOrNullable(property24.typeReference)) {
924013
+ optional23.push(converted);
924014
+ } else {
924015
+ required6.push(converted);
924016
+ }
924009
924017
  } finally {
924010
924018
  this.context.errors.unscope();
924011
924019
  }
924012
- });
924020
+ }
924021
+ return { required: required6, optional: optional23 };
924013
924022
  }
924014
924023
  convertObject({ object_, value: value2 }) {
924015
924024
  const record23 = this.context.getRecord(value2) ?? {};
@@ -925028,14 +925037,25 @@ var EndpointSnippetGenerator5 = class {
925028
925037
  getMethodArgsForBodyRequest({ request: request7, snippet: snippet2 }) {
925029
925038
  const args = [];
925030
925039
  this.context.errors.scope(Scope4.PathParameters);
925031
- const pathParameters = [...this.context.ir.pathParameters ?? [], ...request7.pathParameters ?? []];
925032
- if (pathParameters.length > 0) {
925033
- args.push(...this.getPathParameters({ namedParameters: pathParameters, snippet: snippet2 }).map((field5) => field5.value));
925040
+ const irPathParameters = this.context.ir.pathParameters ?? [];
925041
+ const requiredIrPathParameters = irPathParameters.filter((p14) => p14.variable == null);
925042
+ const optionalIrPathParameters = irPathParameters.filter((p14) => p14.variable != null);
925043
+ const requiredPathParameters = [...requiredIrPathParameters, ...request7.pathParameters ?? []];
925044
+ if (requiredPathParameters.length > 0) {
925045
+ args.push(...this.getPathParameters({ namedParameters: requiredPathParameters, snippet: snippet2 }).map((field5) => field5.value));
925034
925046
  }
925035
925047
  this.context.errors.unscope();
925036
925048
  this.context.errors.scope(Scope4.RequestBody);
925037
925049
  if (request7.body != null) {
925038
- args.push(this.getBodyRequestArg({ body: request7.body, value: snippet2.requestBody }));
925050
+ const bodyArg = this.getBodyRequestArg({ body: request7.body, value: snippet2.requestBody });
925051
+ if (!php_exports.TypeLiteral.isNop(bodyArg)) {
925052
+ args.push(bodyArg);
925053
+ }
925054
+ }
925055
+ this.context.errors.unscope();
925056
+ this.context.errors.scope(Scope4.PathParameters);
925057
+ if (optionalIrPathParameters.length > 0) {
925058
+ args.push(...this.getPathParameters({ namedParameters: optionalIrPathParameters, snippet: snippet2 }).map((field5) => field5.value));
925039
925059
  }
925040
925060
  this.context.errors.unscope();
925041
925061
  return args;
@@ -925062,17 +925082,25 @@ var EndpointSnippetGenerator5 = class {
925062
925082
  const args = [];
925063
925083
  const inlinePathParameters = this.context.customConfig?.inlinePathParameters ?? false;
925064
925084
  this.context.errors.scope(Scope4.PathParameters);
925065
- const pathParameterFields = [];
925066
- const pathParameters = [...this.context.ir.pathParameters ?? [], ...request7.pathParameters ?? []];
925067
- if (pathParameters.length > 0) {
925068
- pathParameterFields.push(...this.getPathParameters({ namedParameters: pathParameters, snippet: snippet2 }));
925069
- }
925085
+ const irPathParameters = this.context.ir.pathParameters ?? [];
925086
+ const requiredIrPathParameters = irPathParameters.filter((p14) => p14.variable == null);
925087
+ const optionalIrPathParameters = irPathParameters.filter((p14) => p14.variable != null);
925088
+ const requiredPathParameterFields = [];
925089
+ const requiredPathParams = [...requiredIrPathParameters, ...request7.pathParameters ?? []];
925090
+ if (requiredPathParams.length > 0) {
925091
+ requiredPathParameterFields.push(...this.getPathParameters({ namedParameters: requiredPathParams, snippet: snippet2 }));
925092
+ }
925093
+ const optionalPathParameterFields = [];
925094
+ if (optionalIrPathParameters.length > 0) {
925095
+ optionalPathParameterFields.push(...this.getPathParameters({ namedParameters: optionalIrPathParameters, snippet: snippet2 }));
925096
+ }
925097
+ const pathParameterFields = [...requiredPathParameterFields, ...optionalPathParameterFields];
925070
925098
  this.context.errors.unscope();
925071
925099
  this.context.errors.scope(Scope4.RequestBody);
925072
925100
  const filePropertyInfo = this.getFilePropertyInfo({ request: request7, snippet: snippet2 });
925073
925101
  this.context.errors.unscope();
925074
925102
  if (!this.context.includePathParametersInWrappedRequest({ request: request7, inlinePathParameters })) {
925075
- args.push(...pathParameterFields.map((field5) => field5.value));
925103
+ args.push(...requiredPathParameterFields.map((field5) => field5.value));
925076
925104
  }
925077
925105
  if (this.context.needsRequestParameter({
925078
925106
  request: request7,
@@ -925090,6 +925118,9 @@ var EndpointSnippetGenerator5 = class {
925090
925118
  filePropertyInfo
925091
925119
  }));
925092
925120
  }
925121
+ if (!this.context.includePathParametersInWrappedRequest({ request: request7, inlinePathParameters })) {
925122
+ args.push(...optionalPathParameterFields.map((field5) => field5.value));
925123
+ }
925093
925124
  return args;
925094
925125
  }
925095
925126
  getFilePropertyInfo({ request: request7, snippet: snippet2 }) {
@@ -957598,7 +957629,7 @@ function getAutomationContextFromEnv() {
957598
957629
  config_branch: process.env.FERN_CONFIG_BRANCH,
957599
957630
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
957600
957631
  trigger: process.env.GITHUB_EVENT_NAME,
957601
- cli_version: "5.44.12"
957632
+ cli_version: "5.44.14"
957602
957633
  };
957603
957634
  }
957604
957635
  function isAutomationMode() {
@@ -958424,7 +958455,7 @@ var CliContext = class _CliContext {
958424
958455
  if (false) {
958425
958456
  this.logger.error("CLI_VERSION is not defined");
958426
958457
  }
958427
- return "5.44.12";
958458
+ return "5.44.14";
958428
958459
  }
958429
958460
  getCliName() {
958430
958461
  if (false) {
@@ -968452,10 +968483,11 @@ function convertHttpEndpoint4({
968452
968483
  if (url3 == null) {
968453
968484
  throw new CliError({ message: "No URL defined for " + baseUrlId, code: CliError.Code.InternalError });
968454
968485
  }
968455
- const server = { url: url3 };
968456
- if (environment2.docs != null) {
968457
- server.description = environment2.docs;
968458
- }
968486
+ const envName = getOriginalName(environment2.name);
968487
+ const server = {
968488
+ url: url3,
968489
+ description: environment2.docs != null ? `${envName} (${environment2.docs})` : envName
968490
+ };
968459
968491
  return server;
968460
968492
  });
968461
968493
  }
@@ -969130,13 +969162,34 @@ function convertIrToOpenApi({
969130
969162
  securitySchemes: constructSecuritySchemes(ir11.auth)
969131
969163
  }
969132
969164
  };
969133
- if (ir11.environments != null && ir11.environments.environments.type === "singleBaseUrl") {
969134
- openAPISpec.servers = ir11.environments.environments.environments.map((environment2) => {
969135
- return {
969136
- url: environment2.url,
969137
- description: environment2.docs != null ? `${getOriginalName(environment2.name)} (${environment2.docs})` : getOriginalName(environment2.name)
969138
- };
969139
- });
969165
+ if (ir11.environments != null) {
969166
+ const envs = ir11.environments.environments;
969167
+ if (envs.type === "singleBaseUrl") {
969168
+ openAPISpec.servers = envs.environments.map((environment2) => {
969169
+ return {
969170
+ url: environment2.url,
969171
+ description: environment2.docs != null ? `${getOriginalName(environment2.name)} (${environment2.docs})` : getOriginalName(environment2.name)
969172
+ };
969173
+ });
969174
+ } else if (envs.type === "multipleBaseUrls") {
969175
+ const servers = [];
969176
+ for (const environment2 of envs.environments) {
969177
+ const envName = getOriginalName(environment2.name);
969178
+ for (const baseUrlDef of envs.baseUrls) {
969179
+ const url3 = environment2.urls[baseUrlDef.id];
969180
+ if (url3 != null) {
969181
+ const urlName = getOriginalName(baseUrlDef.name);
969182
+ servers.push({
969183
+ url: url3,
969184
+ description: environment2.docs != null ? `${envName} - ${urlName} (${environment2.docs})` : `${envName} (${urlName})`
969185
+ });
969186
+ }
969187
+ }
969188
+ }
969189
+ if (servers.length > 0) {
969190
+ openAPISpec.servers = servers;
969191
+ }
969192
+ }
969140
969193
  }
969141
969194
  return openAPISpec;
969142
969195
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.44.12",
2
+ "version": "5.44.14",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",