@fern-api/fern-api-dev 5.13.0 → 5.13.1-1-gbbdc59fd134

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 +28 -18
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -623368,7 +623368,7 @@ var AccessTokenPosthogManager = class {
623368
623368
  properties: {
623369
623369
  ...event,
623370
623370
  ...event.properties,
623371
- version: "5.13.0",
623371
+ version: "5.13.1-1-gbbdc59fd134",
623372
623372
  usingAccessToken: true
623373
623373
  }
623374
623374
  });
@@ -623422,7 +623422,7 @@ var UserPosthogManager = class {
623422
623422
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
623423
623423
  event: "CLI",
623424
623424
  properties: {
623425
- version: "5.13.0",
623425
+ version: "5.13.1-1-gbbdc59fd134",
623426
623426
  ...event,
623427
623427
  ...event.properties,
623428
623428
  usingAccessToken: false,
@@ -848373,7 +848373,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
848373
848373
  var LOGS_FOLDER_NAME = "logs";
848374
848374
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
848375
848375
  function getCliSource() {
848376
- const version7 = "5.13.0";
848376
+ const version7 = "5.13.1-1-gbbdc59fd134";
848377
848377
  return `cli@${version7}`;
848378
848378
  }
848379
848379
  var DebugLogger = class {
@@ -858504,12 +858504,14 @@ var import_zlib5 = require("zlib");
858504
858504
  // ../generation/remote-generation/remote-workspace-runner/lib/retryWithRateLimit.js
858505
858505
  var RATE_LIMIT_INITIAL_RETRY_DELAY_MS = 2e3;
858506
858506
  var RATE_LIMIT_MAX_RETRY_DELAY_MS = 12e4;
858507
- var RATE_LIMIT_MAX_RETRIES = 3;
858508
- var RATE_LIMIT_JITTER_FACTOR = 0.2;
858507
+ var RATE_LIMIT_MAX_RETRIES = 5;
858508
+ var RATE_LIMIT_JITTER_FACTOR = 0.5;
858509
858509
  var TooManyRequestsError = class _TooManyRequestsError extends Error {
858510
- constructor() {
858510
+ retryAfterSeconds;
858511
+ constructor(retryAfterSeconds) {
858511
858512
  super("Received 429 Too Many Requests");
858512
858513
  Object.setPrototypeOf(this, _TooManyRequestsError.prototype);
858514
+ this.retryAfterSeconds = retryAfterSeconds;
858513
858515
  }
858514
858516
  };
858515
858517
  async function retryWithRateLimit({ fn: fn10, retryRateLimited, logger: logger4, onRateLimitedWithoutRetry, delayFn = (ms6) => new Promise((resolve15) => setTimeout(resolve15, ms6)) }) {
@@ -858529,8 +858531,10 @@ async function retryWithRateLimit({ fn: fn10, retryRateLimited, logger: logger4,
858529
858531
  } catch (error50) {
858530
858532
  if (error50 instanceof TooManyRequestsError && attempt < RATE_LIMIT_MAX_RETRIES) {
858531
858533
  const baseDelay = Math.min(RATE_LIMIT_INITIAL_RETRY_DELAY_MS * 2 ** attempt, RATE_LIMIT_MAX_RETRY_DELAY_MS);
858534
+ const serverHintMs = error50.retryAfterSeconds != null ? error50.retryAfterSeconds * 1e3 : void 0;
858535
+ const effectiveBase = serverHintMs != null ? Math.max(baseDelay, serverHintMs) : baseDelay;
858532
858536
  const jitter = 1 + (Math.random() - 0.5) * RATE_LIMIT_JITTER_FACTOR;
858533
- const delay4 = Math.round(baseDelay * jitter);
858537
+ const delay4 = Math.round(Math.min(Math.max(effectiveBase * jitter, serverHintMs ?? 0), RATE_LIMIT_MAX_RETRY_DELAY_MS));
858534
858538
  logger4.warn(`Received 429 Too Many Requests. Retrying in ${(delay4 / 1e3).toFixed(1)}s (attempt ${attempt + 1}/${RATE_LIMIT_MAX_RETRIES})...`);
858535
858539
  await delayFn(delay4);
858536
858540
  } else {
@@ -858631,7 +858635,8 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
858631
858635
  if (!createResponse.ok) {
858632
858636
  const rawError = createResponse.error;
858633
858637
  if (rawError?.content?.reason === "status-code" && rawError.content.statusCode === 429) {
858634
- throw new TooManyRequestsError();
858638
+ const retryAfter = extractRetryAfterSeconds(rawError);
858639
+ throw new TooManyRequestsError(retryAfter);
858635
858640
  }
858636
858641
  const githubAppNotInstalledMessage = extractGithubAppNotInstalledMessage(rawError);
858637
858642
  if (githubAppNotInstalledMessage != null) {
@@ -858754,6 +858759,10 @@ function extractGithubAppNotInstalledMessage(error50) {
858754
858759
  const repo = typeof body?.content?.repositoryName === "string" ? body.content.repositoryName : "the target repository";
858755
858760
  return `The Fern GitHub App is not installed on ${repo}. Please install it (https://github.com/apps/fern-api) and try again.`;
858756
858761
  }
858762
+ function extractRetryAfterSeconds(rawError) {
858763
+ const retryAfter = rawError?.content?.body?.content?.retryAfter;
858764
+ return typeof retryAfter === "number" && retryAfter > 0 ? retryAfter : void 0;
858765
+ }
858757
858766
  function convertCreateJobError(error50) {
858758
858767
  if (error50?.content?.reason === "status-code") {
858759
858768
  const body = error50.content.body;
@@ -859564,11 +859573,11 @@ async function uploadDynamicIRForSdkGeneration({ fdr, organization, version: ver
859564
859573
  try {
859565
859574
  uploadUrlsResponse = await fdr.api.register.getSdkDynamicIrUploadUrls({
859566
859575
  orgId: FdrAPI_exports.OrgId(organization),
859567
- apiId: "",
859568
- irVersions: []
859576
+ apiId: getOriginalName(ir11.apiName),
859577
+ irVersions: [language]
859569
859578
  });
859570
859579
  } catch (error50) {
859571
- context3.logger.warn(`Failed to get dynamic IR upload URLs: ${error50}`);
859580
+ context3.logger.warn(`Failed to get dynamic IR upload URLs (non-fatal, dynamic snippets may be stale): ${error50}`);
859572
859581
  return;
859573
859582
  }
859574
859583
  const uploadUrl = uploadUrlsResponse.uploadUrls[language]?.uploadUrl;
@@ -860541,8 +860550,8 @@ async function checkAndDownloadExistingSdkDynamicIRs({ fdr, workspace, organizat
860541
860550
  try {
860542
860551
  const response = await fdr.api.register.checkSdkDynamicIrExists({
860543
860552
  orgId: FdrAPI_exports.OrgId(organization),
860544
- apiId: "",
860545
- irVersions: []
860553
+ apiId: workspace.definition.rootApiFile.contents.name,
860554
+ irVersions: Object.keys(snippetConfigWithVersions)
860546
860555
  });
860547
860556
  const existingDynamicIrs = response.existingDynamicIrs ?? {};
860548
860557
  if (Object.keys(existingDynamicIrs).length === 0) {
@@ -861037,7 +861046,7 @@ var LegacyDocsPublisher = class {
861037
861046
  previewId,
861038
861047
  disableTemplates: void 0,
861039
861048
  skipUpload,
861040
- cliVersion: "5.13.0",
861049
+ cliVersion: "5.13.1-1-gbbdc59fd134",
861041
861050
  loginCommand: "fern auth login"
861042
861051
  });
861043
861052
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -935638,7 +935647,7 @@ var CliContext = class _CliContext {
935638
935647
  if (false) {
935639
935648
  this.logger.error("CLI_VERSION is not defined");
935640
935649
  }
935641
- return "5.13.0";
935650
+ return "5.13.1-1-gbbdc59fd134";
935642
935651
  }
935643
935652
  getCliName() {
935644
935653
  if (false) {
@@ -938572,9 +938581,10 @@ async function executeAutomationsGenerate({
938572
938581
  noReplay: false,
938573
938582
  // Automation runs are unattended; transient 429s should be retried
938574
938583
  // automatically rather than failing the run and asking a human to
938575
- // re-trigger with a flag. The retry policy is bounded (3 attempts,
938576
- // 2s→120s exponential backoff with jitter) so a real outage still
938577
- // surfaces as a failure rather than a hang.
938584
+ // re-trigger with a flag. The retry policy is bounded (5 attempts,
938585
+ // 2s→120s exponential backoff with jitter, respecting server
938586
+ // retryAfter hints) so a real outage still surfaces as a failure
938587
+ // rather than a hang.
938578
938588
  retryRateLimited: true,
938579
938589
  requireEnvVars: false,
938580
938590
  automationMode: true,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.13.0",
2
+ "version": "5.13.1-1-gbbdc59fd134",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",