@fern-api/fern-api-dev 4.63.3 → 4.63.4

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 +166 -12
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -551564,6 +551564,7 @@ var NoConflictingEndpointPathsRule = {
551564
551564
 
551565
551565
  // ../fern-definition/validator/lib/rules/no-conflicting-request-wrapper-properties/no-conflicting-request-wrapper-properties.js
551566
551566
  init_lib4();
551567
+ init_lodash();
551567
551568
  var NoConflictingRequestWrapperPropertiesRule = {
551568
551569
  name: "no-conflicting-request-wrapper-properties",
551569
551570
  create: ({ workspace }) => {
@@ -551588,6 +551589,8 @@ var NoConflictingRequestWrapperPropertiesRule = {
551588
551589
  ` + propertiesWithName.map((property23) => ` - ${convertRequestWrapperPropertyToString(property23)}`).join("\n")
551589
551590
  });
551590
551591
  }
551592
+ const camelCaseViolations = getCamelCaseNormalizedCollisions(nameToProperties);
551593
+ violations.push(...camelCaseViolations);
551591
551594
  return violations;
551592
551595
  }
551593
551596
  }
@@ -551688,6 +551691,32 @@ function convertRequestWrapperPropertyToString(property23) {
551688
551691
  assertNever(property23);
551689
551692
  }
551690
551693
  }
551694
+ function getCamelCaseNormalizedCollisions(nameToProperties) {
551695
+ const camelCaseToEntries = {};
551696
+ for (const [rawName, properties7] of Object.entries(nameToProperties)) {
551697
+ for (const property23 of properties7) {
551698
+ const normalizedName = camelCase_default(rawName);
551699
+ const entries22 = camelCaseToEntries[normalizedName] ??= [];
551700
+ entries22.push({ rawName, property: property23 });
551701
+ }
551702
+ }
551703
+ const violations = [];
551704
+ for (const [normalizedName, entries22] of Object.entries(camelCaseToEntries)) {
551705
+ if (entries22.length <= 1) {
551706
+ continue;
551707
+ }
551708
+ const distinctRawNames = new Set(entries22.map((e6) => e6.rawName));
551709
+ if (distinctRawNames.size <= 1) {
551710
+ continue;
551711
+ }
551712
+ violations.push({
551713
+ severity: "fatal",
551714
+ message: `Multiple request properties resolve to the same generated name ${source_default.bold(normalizedName)} after camelCase normalization. This causes broken generated code. Use the "name" property to disambiguate.
551715
+ ` + entries22.map((entry) => ` - ${convertRequestWrapperPropertyToString(entry.property)} (name: "${entry.rawName}")`).join("\n")
551716
+ });
551717
+ }
551718
+ return violations;
551719
+ }
551691
551720
 
551692
551721
  // ../fern-definition/validator/lib/rules/no-duplicate-declarations/no-duplicate-declarations.js
551693
551722
  var import_path22 = __toESM(require("path"), 1);
@@ -594441,6 +594470,130 @@ var NoComponentSchemaCollisionsRule = {
594441
594470
  }
594442
594471
  };
594443
594472
 
594473
+ // ../workspace/oss-validator/lib/rules/no-conflicting-parameter-names/no-conflicting-parameter-names.js
594474
+ init_lib6();
594475
+ var NoConflictingParameterNamesRule = {
594476
+ name: "no-conflicting-parameter-names",
594477
+ run: async ({ workspace, specs, loadedDocuments }) => {
594478
+ const violations = [];
594479
+ for (const spec of specs) {
594480
+ if (spec.type !== "openapi") {
594481
+ continue;
594482
+ }
594483
+ const openAPI = loadedDocuments.get(spec.absoluteFilepath);
594484
+ if (openAPI == null) {
594485
+ continue;
594486
+ }
594487
+ const apiToValidate = isOpenAPIV2(openAPI) ? await convertOpenAPIV2ToV3(openAPI) : openAPI;
594488
+ const relativeFilepath = relative3(workspace.absoluteFilePath, spec.source.file);
594489
+ for (const [path97, pathItem] of Object.entries(apiToValidate.paths ?? {})) {
594490
+ if (pathItem == null || typeof pathItem !== "object") {
594491
+ continue;
594492
+ }
594493
+ const pathItemObj = pathItem;
594494
+ const pathLevelParams = resolveAllParams(pathItemObj.parameters, apiToValidate);
594495
+ for (const method8 of ["get", "put", "post", "delete", "options", "head", "patch", "trace"]) {
594496
+ const operation = pathItemObj[method8];
594497
+ if (operation == null) {
594498
+ continue;
594499
+ }
594500
+ const operationParams = resolveAllParams(operation.parameters, apiToValidate);
594501
+ const mergedParams = mergeParameters(pathLevelParams, operationParams);
594502
+ const nameToParams = {};
594503
+ for (const param of mergedParams) {
594504
+ const normalizedName = toCamelCase3(param.name);
594505
+ if (normalizedName === "") {
594506
+ continue;
594507
+ }
594508
+ const existing = nameToParams[normalizedName] ??= [];
594509
+ existing.push(param);
594510
+ }
594511
+ for (const [normalizedName, params2] of Object.entries(nameToParams)) {
594512
+ if (params2.length <= 1) {
594513
+ continue;
594514
+ }
594515
+ const distinctTypes = new Set(params2.map((p10) => p10.in));
594516
+ if (distinctTypes.size <= 1) {
594517
+ continue;
594518
+ }
594519
+ const paramDescriptions = params2.map((p10) => `${p10.in} parameter '${p10.name}'`).join(", ");
594520
+ violations.push({
594521
+ name: "no-conflicting-parameter-names",
594522
+ severity: "error",
594523
+ relativeFilepath,
594524
+ nodePath: ["paths", path97, method8],
594525
+ message: `Parameters ${paramDescriptions} all normalize to '${normalizedName}' in generated SDKs. This causes broken code (duplicate keyword arguments in Python, duplicate properties in TypeScript). Rename one of the parameters to avoid the collision.`
594526
+ });
594527
+ }
594528
+ }
594529
+ }
594530
+ }
594531
+ return violations;
594532
+ }
594533
+ };
594534
+ function resolveAllParams(params2, api) {
594535
+ if (!Array.isArray(params2)) {
594536
+ return [];
594537
+ }
594538
+ const result = [];
594539
+ for (const param of params2) {
594540
+ const resolved = resolveParam(param, api);
594541
+ if (resolved != null) {
594542
+ result.push(resolved);
594543
+ }
594544
+ }
594545
+ return result;
594546
+ }
594547
+ function resolveParam(param, api, visited = /* @__PURE__ */ new Set()) {
594548
+ if (typeof param !== "object" || param == null) {
594549
+ return void 0;
594550
+ }
594551
+ const paramObj = param;
594552
+ if (typeof paramObj.$ref === "string") {
594553
+ const refPath = paramObj.$ref;
594554
+ if (visited.has(refPath)) {
594555
+ return void 0;
594556
+ }
594557
+ if (refPath.startsWith("#/components/parameters/")) {
594558
+ const paramName = refPath.substring("#/components/parameters/".length);
594559
+ const components = api.components;
594560
+ const resolved = components?.parameters?.[paramName];
594561
+ if (resolved != null) {
594562
+ visited.add(refPath);
594563
+ return resolveParam(resolved, api, visited);
594564
+ }
594565
+ }
594566
+ if (refPath.startsWith("#/parameters/")) {
594567
+ const paramName = refPath.substring("#/parameters/".length);
594568
+ const parameters2 = api.parameters;
594569
+ const resolved = parameters2?.[paramName];
594570
+ if (resolved != null) {
594571
+ visited.add(refPath);
594572
+ return resolveParam(resolved, api, visited);
594573
+ }
594574
+ }
594575
+ return void 0;
594576
+ }
594577
+ if (typeof paramObj.in === "string" && typeof paramObj.name === "string") {
594578
+ return { in: paramObj.in, name: paramObj.name };
594579
+ }
594580
+ return void 0;
594581
+ }
594582
+ function mergeParameters(pathParams, operationParams) {
594583
+ const operationParamKeys = new Set(operationParams.map((p10) => `${p10.in}:${p10.name}`));
594584
+ const merged = [...operationParams];
594585
+ for (const pathParam of pathParams) {
594586
+ const key2 = `${pathParam.in}:${pathParam.name}`;
594587
+ if (!operationParamKeys.has(key2)) {
594588
+ merged.push(pathParam);
594589
+ }
594590
+ }
594591
+ return merged;
594592
+ }
594593
+ function toCamelCase3(input3) {
594594
+ return input3.replace(/[-_]+(.)?/g, (_16, char) => char != null ? char.toUpperCase() : "").replace(/^[A-Z]/, (char) => char.toLowerCase());
594595
+ }
594596
+
594444
594597
  // ../workspace/oss-validator/lib/rules/no-duplicate-auth-header-parameters/no-duplicate-auth-header-parameters.js
594445
594598
  init_lib6();
594446
594599
  var NoDuplicateAuthHeaderParametersRule = {
@@ -594469,7 +594622,7 @@ var NoDuplicateAuthHeaderParametersRule = {
594469
594622
  const pathLevelParams = pathItemObj.parameters;
594470
594623
  if (Array.isArray(pathLevelParams)) {
594471
594624
  for (const param of pathLevelParams) {
594472
- const resolved = resolveParam(param, apiToValidate);
594625
+ const resolved = resolveParam2(param, apiToValidate);
594473
594626
  if (resolved != null && isDuplicateAuthHeader(resolved, authHeaderNames)) {
594474
594627
  violations.push({
594475
594628
  name: "no-duplicate-auth-header-parameters",
@@ -594487,7 +594640,7 @@ var NoDuplicateAuthHeaderParametersRule = {
594487
594640
  continue;
594488
594641
  }
594489
594642
  for (const param of operation.parameters) {
594490
- const resolved = resolveParam(param, apiToValidate);
594643
+ const resolved = resolveParam2(param, apiToValidate);
594491
594644
  if (resolved != null && isDuplicateAuthHeader(resolved, authHeaderNames)) {
594492
594645
  violations.push({
594493
594646
  name: "no-duplicate-auth-header-parameters",
@@ -594531,7 +594684,7 @@ function getAuthHeaderNames(api) {
594531
594684
  }
594532
594685
  return headerNames;
594533
594686
  }
594534
- function resolveParam(param, api, visited = /* @__PURE__ */ new Set()) {
594687
+ function resolveParam2(param, api, visited = /* @__PURE__ */ new Set()) {
594535
594688
  if (typeof param !== "object" || param == null) {
594536
594689
  return void 0;
594537
594690
  }
@@ -594547,7 +594700,7 @@ function resolveParam(param, api, visited = /* @__PURE__ */ new Set()) {
594547
594700
  const resolved = components?.parameters?.[paramName];
594548
594701
  if (resolved != null) {
594549
594702
  visited.add(refPath);
594550
- return resolveParam(resolved, api, visited);
594703
+ return resolveParam2(resolved, api, visited);
594551
594704
  }
594552
594705
  }
594553
594706
  return void 0;
@@ -594753,7 +594906,8 @@ function getAllRules2() {
594753
594906
  NoDuplicateOverridesRule,
594754
594907
  NoSchemaTitleCollisionsRule,
594755
594908
  NoComponentSchemaCollisionsRule,
594756
- NoInvalidTagNamesOrFrontmatterRule
594909
+ NoInvalidTagNamesOrFrontmatterRule,
594910
+ NoConflictingParameterNamesRule
594757
594911
  ];
594758
594912
  }
594759
594913
 
@@ -603124,7 +603278,7 @@ var AccessTokenPosthogManager = class {
603124
603278
  properties: {
603125
603279
  ...event,
603126
603280
  ...event.properties,
603127
- version: "4.63.3",
603281
+ version: "4.63.4",
603128
603282
  usingAccessToken: true
603129
603283
  }
603130
603284
  });
@@ -603175,7 +603329,7 @@ var UserPosthogManager = class {
603175
603329
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
603176
603330
  event: "CLI",
603177
603331
  properties: {
603178
- version: "4.63.3",
603332
+ version: "4.63.4",
603179
603333
  ...event,
603180
603334
  ...event.properties,
603181
603335
  usingAccessToken: false,
@@ -839769,7 +839923,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
839769
839923
  var LOGS_FOLDER_NAME = "logs";
839770
839924
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
839771
839925
  function getCliSource() {
839772
- const version7 = "4.63.3";
839926
+ const version7 = "4.63.4";
839773
839927
  return `cli@${version7}`;
839774
839928
  }
839775
839929
  var DebugLogger = class {
@@ -850967,7 +851121,7 @@ var LegacyDocsPublisher = class {
850967
851121
  previewId,
850968
851122
  disableTemplates: void 0,
850969
851123
  skipUpload,
850970
- cliVersion: "4.63.3"
851124
+ cliVersion: "4.63.4"
850971
851125
  });
850972
851126
  if (taskContext.getResult() === TaskResult.Failure) {
850973
851127
  return { success: false };
@@ -874356,11 +874510,11 @@ function getMajorVersionSuffix({ config: config5 }) {
874356
874510
  }
874357
874511
  function parseMajorVersion({ config: config5 }) {
874358
874512
  const version7 = getVersion(config5);
874359
- if (version7 == null) {
874513
+ if (version7 == null || version7 === "") {
874360
874514
  return void 0;
874361
874515
  }
874362
874516
  const split2 = version7.split(".");
874363
- if (split2[0] == null) {
874517
+ if (split2[0] == null || split2[0] === "" || split2[0] === "v") {
874364
874518
  return void 0;
874365
874519
  }
874366
874520
  const majorVersion2 = split2[0];
@@ -924345,7 +924499,7 @@ var CliContext = class {
924345
924499
  if (false) {
924346
924500
  this.logger.error("CLI_VERSION is not defined");
924347
924501
  }
924348
- return "4.63.3";
924502
+ return "4.63.4";
924349
924503
  }
924350
924504
  getCliName() {
924351
924505
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.63.3",
2
+ "version": "4.63.4",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",