@fern-api/fern-api-dev 5.65.5 → 5.65.7

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 +117 -50
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -89377,6 +89377,26 @@ var init_ClonedRepository = __esm({
89377
89377
  const result = await this.git.raw(["rev-parse", `${commitSha}^{tree}`]);
89378
89378
  return result.trim();
89379
89379
  }
89380
+ async getCommitMessage(commitSha) {
89381
+ await this.git.cwd(this.clonePath);
89382
+ const result = await this.git.raw(["log", "-1", "--format=%B", commitSha]);
89383
+ return result.replace(/\n$/, "");
89384
+ }
89385
+ async getCommitParents(commitSha) {
89386
+ await this.git.cwd(this.clonePath);
89387
+ const result = await this.git.raw(["rev-list", "--parents", "-n", "1", commitSha]);
89388
+ const parts = result.trim().split(/\s+/);
89389
+ return parts.slice(1);
89390
+ }
89391
+ /**
89392
+ * Returns the SHAs of commits reachable from HEAD but not from any remote-tracking ref,
89393
+ * ordered oldest-first. These are the commits created locally that have not been pushed.
89394
+ */
89395
+ async getLocalOnlyCommits() {
89396
+ await this.git.cwd(this.clonePath);
89397
+ const result = await this.git.raw(["rev-list", "--reverse", "HEAD", "--not", "--remotes=origin"]);
89398
+ return result.trim().split("\n").filter((line) => line.length > 0);
89399
+ }
89380
89400
  /**
89381
89401
  * Returns true if the working tree has uncommitted changes (staged or unstaged).
89382
89402
  */
@@ -581439,29 +581459,24 @@ var require_pushSignedCommit = __commonJS({
581439
581459
  exports2.isNonFastForwardError = isNonFastForwardError;
581440
581460
  var core_utils_1 = (init_lib4(), __toCommonJS(lib_exports));
581441
581461
  var MAX_CONCURRENT_PUSH_RETRIES = 3;
581462
+ var MAX_SIGNED_CHAIN_LENGTH = 20;
581442
581463
  async function pushSignedCommit({ repository, octokit, owner, repo, branch, force, rebaseOnConflict = false, author, logger: logger4 }) {
581443
581464
  const tempRef = `refs/temp/fern-${Date.now()}`;
581444
581465
  let tempRefPushed = false;
581445
581466
  try {
581446
- let [localHeadSha, treeSha, message, parents] = await Promise.all([
581447
- repository.getHeadSha(),
581448
- repository.getHeadTreeHash(),
581449
- repository.getHeadCommitMessage(),
581450
- repository.getHeadParents()
581451
- ]);
581467
+ let localHeadSha = await repository.getHeadSha();
581452
581468
  await repository.pushObjectToRef(localHeadSha, tempRef);
581453
581469
  tempRefPushed = true;
581454
581470
  for (let attempt = 0; attempt < MAX_CONCURRENT_PUSH_RETRIES; attempt++) {
581455
- const identityFields = author != null ? { author, committer: author } : {};
581456
- const { data: signedCommit } = await octokit.git.createCommit({
581471
+ const signedSha = await signLocalCommitChain({
581472
+ repository,
581473
+ octokit,
581457
581474
  owner,
581458
581475
  repo,
581459
- message,
581460
- tree: treeSha,
581461
- parents,
581462
- ...identityFields
581476
+ localHeadSha,
581477
+ author,
581478
+ logger: logger4
581463
581479
  });
581464
- const signedSha = signedCommit.sha;
581465
581480
  try {
581466
581481
  await upsertBranchRef({ octokit, owner, repo, branch, sha: signedSha, force });
581467
581482
  logger4.debug(`Updated refs/heads/${branch} to signed commit ${signedSha}`);
@@ -581474,12 +581489,7 @@ var require_pushSignedCommit = __commonJS({
581474
581489
  if (rebaseOnConflict) {
581475
581490
  logger4.warn(`Non-fast-forward on refs/heads/${branch} (attempt ${attempt + 1}/${MAX_CONCURRENT_PUSH_RETRIES}); rebasing locally and retrying.`);
581476
581491
  await repository.pullWithRebase(branch);
581477
- [localHeadSha, treeSha, message, parents] = await Promise.all([
581478
- repository.getHeadSha(),
581479
- repository.getHeadTreeHash(),
581480
- repository.getHeadCommitMessage(),
581481
- repository.getHeadParents()
581482
- ]);
581492
+ localHeadSha = await repository.getHeadSha();
581483
581493
  await repository.pushObjectToRef(localHeadSha, tempRef, { force: true });
581484
581494
  } else {
581485
581495
  throw err;
@@ -581497,6 +581507,39 @@ var require_pushSignedCommit = __commonJS({
581497
581507
  }
581498
581508
  }
581499
581509
  }
581510
+ async function signLocalCommitChain({ repository, octokit, owner, repo, localHeadSha, author, logger: logger4 }) {
581511
+ let chain = await repository.getLocalOnlyCommits();
581512
+ if (chain.length === 0 || chain[chain.length - 1] !== localHeadSha) {
581513
+ chain = [localHeadSha];
581514
+ } else if (chain.length > MAX_SIGNED_CHAIN_LENGTH) {
581515
+ logger4.warn(`Local commit chain has ${chain.length} commits (limit ${MAX_SIGNED_CHAIN_LENGTH}); signing HEAD only.`);
581516
+ chain = [localHeadSha];
581517
+ }
581518
+ const identityFields = author != null ? { author, committer: author } : {};
581519
+ const signedShaByLocalSha = /* @__PURE__ */ new Map();
581520
+ let signedSha = localHeadSha;
581521
+ for (const sha of chain) {
581522
+ const [treeSha, message, parents] = await Promise.all([
581523
+ repository.getCommitTreeHash(sha),
581524
+ repository.getCommitMessage(sha),
581525
+ repository.getCommitParents(sha)
581526
+ ]);
581527
+ const { data: signedCommit } = await octokit.git.createCommit({
581528
+ owner,
581529
+ repo,
581530
+ message,
581531
+ tree: treeSha,
581532
+ parents: parents.map((parent) => signedShaByLocalSha.get(parent) ?? parent),
581533
+ ...identityFields
581534
+ });
581535
+ signedShaByLocalSha.set(sha, signedCommit.sha);
581536
+ signedSha = signedCommit.sha;
581537
+ }
581538
+ if (chain.length > 1) {
581539
+ logger4.debug(`Signed ${chain.length} local commits via the GitHub API`);
581540
+ }
581541
+ return signedSha;
581542
+ }
581500
581543
  async function upsertBranchRef({ octokit, owner, repo, branch, sha, force }) {
581501
581544
  try {
581502
581545
  await octokit.git.updateRef({
@@ -688596,7 +688639,7 @@ var AccessTokenPosthogManager = class {
688596
688639
  properties: {
688597
688640
  ...event,
688598
688641
  ...event.properties,
688599
- version: "5.65.5",
688642
+ version: "5.65.7",
688600
688643
  usingAccessToken: true,
688601
688644
  ...getRunIdProperties()
688602
688645
  }
@@ -688662,7 +688705,7 @@ var UserPosthogManager = class {
688662
688705
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
688663
688706
  event: "CLI",
688664
688707
  properties: {
688665
- version: "5.65.5",
688708
+ version: "5.65.7",
688666
688709
  ...event,
688667
688710
  ...event.properties,
688668
688711
  usingAccessToken: false,
@@ -841837,8 +841880,8 @@ __export(rules_exports, {
841837
841880
  CHANGELOG_FEED_ALLOWED_SLUGS: () => CHANGELOG_FEED_ALLOWED_SLUGS,
841838
841881
  FilepathsExistRule: () => FilepathsExistRule,
841839
841882
  MissingRedirectsRule: () => MissingRedirectsRule,
841883
+ NavigationConflicts: () => NavigationConflicts,
841840
841884
  NoCircularRedirectsRule: () => NoCircularRedirectsRule,
841841
- OnlyVersionedNavigation: () => OnlyVersionedNavigation,
841842
841885
  TabWithHrefRule: () => TabWithHrefRule,
841843
841886
  TranslationDirectoriesExistRule: () => TranslationDirectoriesExistRule,
841844
841887
  ValidChangelogSlugRule: () => ValidChangelogSlugRule,
@@ -842704,6 +842747,31 @@ function makeSkipVisitor(fetchResult) {
842704
842747
  }
842705
842748
  }
842706
842749
 
842750
+ // ../yaml/docs-validator/lib/rules/navigation-conflicts/navigation-conflicts.js
842751
+ var NavigationConflicts = {
842752
+ name: "navigation-conflicts",
842753
+ create: () => {
842754
+ return {
842755
+ file: async ({ config: config5 }) => {
842756
+ const violations = [];
842757
+ if (config5.navigation != null && config5.versions != null) {
842758
+ violations.push({
842759
+ severity: "fatal",
842760
+ message: "Cannot contain both navigation and versions. If you want versioned docs, use versions. Otherwise use navigation."
842761
+ });
842762
+ }
842763
+ if (config5.navigation != null && config5.products != null) {
842764
+ violations.push({
842765
+ severity: "fatal",
842766
+ message: "Cannot contain both navigation and products. If you want multi-product docs, define navigation inside each product file. Otherwise use navigation."
842767
+ });
842768
+ }
842769
+ return violations;
842770
+ }
842771
+ };
842772
+ }
842773
+ };
842774
+
842707
842775
  // ../yaml/docs-validator/lib/rules/no-circular-redirects/no-circular-redirects.js
842708
842776
  function normalizeRedirectPath(path119) {
842709
842777
  if (path119 !== "/" && path119.endsWith("/")) {
@@ -842801,26 +842869,6 @@ var NoCircularRedirectsRule = {
842801
842869
  }
842802
842870
  };
842803
842871
 
842804
- // ../yaml/docs-validator/lib/rules/only-versioned-navigation/only-versioned-navigation.js
842805
- var OnlyVersionedNavigation = {
842806
- name: "only-versioned-navigation",
842807
- create: () => {
842808
- return {
842809
- file: async ({ config: config5 }) => {
842810
- if (config5.navigation != null && config5.versions != null) {
842811
- return [
842812
- {
842813
- severity: "fatal",
842814
- message: "Cannot contain both navigation and versions. If you want versioned docs, use versions. Otherwise use navigation."
842815
- }
842816
- ];
842817
- }
842818
- return [];
842819
- }
842820
- };
842821
- }
842822
- };
842823
-
842824
842872
  // ../yaml/docs-validator/lib/rules/tab-with-href/index.js
842825
842873
  var TabWithHrefRule = {
842826
842874
  name: "tab-with-href",
@@ -865934,7 +865982,7 @@ var allRules = [
865934
865982
  // Check non-component references (will skip v2 files)
865935
865983
  ValidLocalReferencesRule,
865936
865984
  // Validate that local references actually exist
865937
- OnlyVersionedNavigation,
865985
+ NavigationConflicts,
865938
865986
  ValidateVersionFileRule,
865939
865987
  ValidateProductFileRule,
865940
865988
  ValidInstanceUrlRule,
@@ -869758,7 +869806,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
869758
869806
  var LOGS_FOLDER_NAME = "logs";
869759
869807
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
869760
869808
  function getCliSource() {
869761
- const version7 = "5.65.5";
869809
+ const version7 = "5.65.7";
869762
869810
  return `cli@${version7}`;
869763
869811
  }
869764
869812
  var DebugLogger = class {
@@ -902320,7 +902368,7 @@ var LegacyDocsPublisher = class {
902320
902368
  previewId,
902321
902369
  disableTemplates: void 0,
902322
902370
  skipUpload,
902323
- cliVersion: "5.65.5",
902371
+ cliVersion: "5.65.7",
902324
902372
  loginCommand: "fern auth login"
902325
902373
  });
902326
902374
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -921898,8 +921946,22 @@ var Generation = class {
921898
921946
  maxRetries: () => this.customConfig.maxRetries,
921899
921947
  /** Controls which HTTP status codes trigger automatic retries. Default: "legacy". */
921900
921948
  retryStatusCodes: () => this.customConfig.retryStatusCodes ?? "legacy",
921901
- /** Override the default request timeout (in seconds) for the generated SDK client. `"infinity"` disables the default timeout. Default: 30. */
921902
- defaultTimeoutInSeconds: () => this.customConfig["default-timeout-in-seconds"],
921949
+ /**
921950
+ * Override the default request timeout (in milliseconds) for the generated SDK client. `"infinity"` disables
921951
+ * the default timeout. Resolves the new `default-timeout-in-milliseconds` key when set, otherwise falls back
921952
+ * to the deprecated `default-timeout-in-seconds` (converted to milliseconds). Default: 30000.
921953
+ */
921954
+ defaultTimeoutInMilliseconds: () => {
921955
+ const milliseconds = this.customConfig["default-timeout-in-milliseconds"];
921956
+ if (milliseconds != null) {
921957
+ return milliseconds;
921958
+ }
921959
+ const seconds = this.customConfig["default-timeout-in-seconds"];
921960
+ if (seconds == null) {
921961
+ return void 0;
921962
+ }
921963
+ return seconds === "infinity" ? "infinity" : seconds * 1e3;
921964
+ },
921903
921965
  /**
921904
921966
  * Output path configuration for generated files.
921905
921967
  * Returns normalized paths for library, test, solution, and other files.
@@ -952263,7 +952325,9 @@ var TypescriptCustomConfigSchema = external_exports2.strictObject({
952263
952325
  bundle: external_exports2.optional(external_exports2.boolean()),
952264
952326
  allowCustomFetcher: external_exports2.optional(external_exports2.boolean()),
952265
952327
  generateWebSocketClients: external_exports2.optional(external_exports2.boolean()),
952266
- defaultTimeoutInSeconds: external_exports2.optional(external_exports2.union([external_exports2.literal("infinity"), external_exports2.number()])),
952328
+ // Default request timeout, expressed in milliseconds (idiomatic for JS/TS, e.g.
952329
+ // `setTimeout` / `AbortSignal.timeout(ms)`). Use "infinity" to disable the timeout.
952330
+ defaultTimeout: external_exports2.optional(external_exports2.union([external_exports2.literal("infinity"), external_exports2.number()])),
952267
952331
  skipResponseValidation: external_exports2.optional(external_exports2.boolean()),
952268
952332
  extraDependencies: external_exports2.optional(external_exports2.record(external_exports2.string())),
952269
952333
  extraDevDependencies: external_exports2.optional(external_exports2.record(external_exports2.string())),
@@ -952327,6 +952391,9 @@ var TypescriptCustomConfigSchema = external_exports2.strictObject({
952327
952391
  skipNpmPkgFix: external_exports2.optional(external_exports2.boolean()),
952328
952392
  experimentalGenerateReadWriteOnlyTypes: external_exports2.optional(external_exports2.boolean()),
952329
952393
  // deprecated
952394
+ // @deprecated Use `defaultTimeout` (milliseconds) instead. Converted to milliseconds (× 1000).
952395
+ defaultTimeoutInSeconds: external_exports2.optional(external_exports2.union([external_exports2.literal("infinity"), external_exports2.number()])),
952396
+ // @deprecated Use `defaultTimeout` (milliseconds) instead. Converted to milliseconds (× 1000).
952330
952397
  timeoutInSeconds: external_exports2.optional(external_exports2.union([external_exports2.literal("infinity"), external_exports2.number()])),
952331
952398
  includeApiReference: external_exports2.optional(external_exports2.boolean()),
952332
952399
  // @deprecated Use generateWebSocketClients instead
@@ -968630,7 +968697,7 @@ function getAutomationContextFromEnv() {
968630
968697
  config_branch: process.env.FERN_CONFIG_BRANCH,
968631
968698
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
968632
968699
  trigger: process.env.GITHUB_EVENT_NAME,
968633
- cli_version: "5.65.5"
968700
+ cli_version: "5.65.7"
968634
968701
  };
968635
968702
  }
968636
968703
  function isAutomationMode() {
@@ -969462,7 +969529,7 @@ var CliContext = class _CliContext {
969462
969529
  if (false) {
969463
969530
  this.logger.error("CLI_VERSION is not defined");
969464
969531
  }
969465
- return "5.65.5";
969532
+ return "5.65.7";
969466
969533
  }
969467
969534
  getCliName() {
969468
969535
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.65.5",
2
+ "version": "5.65.7",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",