@fern-api/fern-api-dev 5.33.2 → 5.33.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 +61 -29
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -658834,25 +658834,36 @@ async function detectAirGappedMode(url3, logger4, timeoutMs = 5e3) {
658834
658834
  }
658835
658835
  async function performAirGapDetection(url3, logger4, timeoutMs) {
658836
658836
  logger4.debug(`Detecting air-gapped mode by checking connectivity to ${url3}`);
658837
- try {
658838
- const res = await fetch(url3, {
658839
- method: "GET",
658840
- signal: AbortSignal.timeout(timeoutMs)
658841
- });
658842
- await res.body?.cancel().catch(() => void 0);
658843
- airGapDetectionResult = false;
658844
- logger4.debug("Network check succeeded - not in air-gapped mode");
658845
- return false;
658846
- } catch (error50) {
658847
- const errorMessage = extractErrorMessage(error50);
658848
- if (isNetworkError(errorMessage)) {
658849
- airGapDetectionResult = true;
658850
- logger4.debug(`Network check failed - entering air-gapped mode: ${errorMessage}`);
658851
- return true;
658837
+ const maxAttempts = 3;
658838
+ let lastErrorMessage;
658839
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
658840
+ try {
658841
+ const res = await fetch(url3, {
658842
+ method: "GET",
658843
+ signal: AbortSignal.timeout(timeoutMs)
658844
+ });
658845
+ await res.body?.cancel().catch(() => void 0);
658846
+ airGapDetectionResult = false;
658847
+ logger4.debug("Network check succeeded - not in air-gapped mode");
658848
+ return false;
658849
+ } catch (error50) {
658850
+ const errorMessage = extractErrorMessage(error50);
658851
+ const causeMessage = error50 instanceof Error && error50.cause ? ` (cause: ${extractErrorMessage(error50.cause)})` : "";
658852
+ lastErrorMessage = `${errorMessage}${causeMessage}`;
658853
+ if (!isNetworkError(errorMessage)) {
658854
+ airGapDetectionResult = false;
658855
+ return false;
658856
+ }
658857
+ if (attempt < maxAttempts) {
658858
+ const delayMs = attempt * 500;
658859
+ logger4.debug(`Network check attempt ${attempt}/${maxAttempts} failed: ${lastErrorMessage} \u2014 retrying in ${delayMs}ms`);
658860
+ await new Promise((resolve15) => setTimeout(resolve15, delayMs));
658861
+ }
658852
658862
  }
658853
- airGapDetectionResult = false;
658854
- return false;
658855
658863
  }
658864
+ airGapDetectionResult = true;
658865
+ logger4.debug(`Network check failed after ${maxAttempts} attempts - entering air-gapped mode: ${lastErrorMessage}`);
658866
+ return true;
658856
658867
  }
658857
658868
  async function detectAirGappedModeForProtobuf(absoluteFilepathToProtobufRoot, logger4, bufCommand = "buf") {
658858
658869
  const bufLockPath = join8(absoluteFilepathToProtobufRoot, RelativeFilePath2.of("buf.lock"));
@@ -668443,7 +668454,7 @@ var AccessTokenPosthogManager = class {
668443
668454
  properties: {
668444
668455
  ...event,
668445
668456
  ...event.properties,
668446
- version: "5.33.2",
668457
+ version: "5.33.4",
668447
668458
  usingAccessToken: true,
668448
668459
  ...getRunIdProperties()
668449
668460
  }
@@ -668507,7 +668518,7 @@ var UserPosthogManager = class {
668507
668518
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
668508
668519
  event: "CLI",
668509
668520
  properties: {
668510
- version: "5.33.2",
668521
+ version: "5.33.4",
668511
668522
  ...event,
668512
668523
  ...event.properties,
668513
668524
  usingAccessToken: false,
@@ -668555,12 +668566,19 @@ var UserPosthogManager = class {
668555
668566
  persistedDistinctId;
668556
668567
  async getPersistedDistinctId() {
668557
668568
  if (this.persistedDistinctId == null) {
668569
+ const generatedDistinctId = v4_default();
668558
668570
  const pathToFile = join8(AbsoluteFilePath2.of((0, import_os5.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER3), RelativeFilePath2.of(DISTINCT_ID_FILENAME));
668559
- if (!await doesPathExist(pathToFile)) {
668560
- await (0, import_promises44.mkdir)((0, import_path46.dirname)(pathToFile), { recursive: true });
668561
- await (0, import_promises44.writeFile)(pathToFile, v4_default());
668571
+ try {
668572
+ if (!await doesPathExist(pathToFile)) {
668573
+ await (0, import_promises44.mkdir)((0, import_path46.dirname)(pathToFile), { recursive: true });
668574
+ await (0, import_promises44.writeFile)(pathToFile, generatedDistinctId);
668575
+ this.persistedDistinctId = generatedDistinctId;
668576
+ } else {
668577
+ this.persistedDistinctId = (await (0, import_promises44.readFile)(pathToFile)).toString();
668578
+ }
668579
+ } catch {
668580
+ this.persistedDistinctId = generatedDistinctId;
668562
668581
  }
668563
- this.persistedDistinctId = (await (0, import_promises44.readFile)(pathToFile)).toString();
668564
668582
  }
668565
668583
  return this.persistedDistinctId;
668566
668584
  }
@@ -672675,6 +672693,14 @@ var TtyAwareLogger2 = class {
672675
672693
  this.stdout = stdout;
672676
672694
  this.stderr = stderr;
672677
672695
  this.isTTY = stdout.isTTY === true && !import_is_ci3.default;
672696
+ for (const stream5 of [this.stdout, this.stderr]) {
672697
+ stream5.on("error", (error50) => {
672698
+ if (isEpipeError(error50)) {
672699
+ return;
672700
+ }
672701
+ throw error50;
672702
+ });
672703
+ }
672678
672704
  }
672679
672705
  /**
672680
672706
  * Register a paintable. The first registration starts the repaint loop.
@@ -672782,6 +672808,12 @@ var TtyAwareLogger2 = class {
672782
672808
  return paint;
672783
672809
  }
672784
672810
  };
672811
+ function isEpipeError(error50) {
672812
+ return hasErrnoCode(error50) && error50.code === "EPIPE";
672813
+ }
672814
+ function hasErrnoCode(error50) {
672815
+ return "code" in error50 && typeof error50.code === "string";
672816
+ }
672785
672817
 
672786
672818
  // ../cli-v2/lib/api/config/converter/ApiDefinitionConverter.js
672787
672819
  init_lib8();
@@ -822499,7 +822531,7 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
822499
822531
  if (endpointBaseUrl == null) {
822500
822532
  throw new CliError({
822501
822533
  message: `Encountered undefined server name "${baseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${baseUrlId}`,
822502
- code: CliError.Code.IrConversionError
822534
+ code: CliError.Code.ValidationError
822503
822535
  });
822504
822536
  }
822505
822537
  return {
@@ -822522,7 +822554,7 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
822522
822554
  if (endpointBaseUrl == null) {
822523
822555
  throw new CliError({
822524
822556
  message: `Encountered undefined server name "${endpointBaseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${endpointBaseUrlId}`,
822525
- code: CliError.Code.IrConversionError
822557
+ code: CliError.Code.ValidationError
822526
822558
  });
822527
822559
  }
822528
822560
  return {
@@ -860283,7 +860315,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860283
860315
  var LOGS_FOLDER_NAME = "logs";
860284
860316
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860285
860317
  function getCliSource() {
860286
- const version7 = "5.33.2";
860318
+ const version7 = "5.33.4";
860287
860319
  return `cli@${version7}`;
860288
860320
  }
860289
860321
  var DebugLogger = class {
@@ -879129,7 +879161,7 @@ var LegacyDocsPublisher = class {
879129
879161
  previewId,
879130
879162
  disableTemplates: void 0,
879131
879163
  skipUpload,
879132
- cliVersion: "5.33.2",
879164
+ cliVersion: "5.33.4",
879133
879165
  loginCommand: "fern auth login"
879134
879166
  });
879135
879167
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -953829,7 +953861,7 @@ function getAutomationContextFromEnv() {
953829
953861
  config_branch: process.env.FERN_CONFIG_BRANCH,
953830
953862
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
953831
953863
  trigger: process.env.GITHUB_EVENT_NAME,
953832
- cli_version: "5.33.2"
953864
+ cli_version: "5.33.4"
953833
953865
  };
953834
953866
  }
953835
953867
  function isAutomationMode() {
@@ -954655,7 +954687,7 @@ var CliContext = class _CliContext {
954655
954687
  if (false) {
954656
954688
  this.logger.error("CLI_VERSION is not defined");
954657
954689
  }
954658
- return "5.33.2";
954690
+ return "5.33.4";
954659
954691
  }
954660
954692
  getCliName() {
954661
954693
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.33.2",
2
+ "version": "5.33.4",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",