@fern-api/fern-api-dev 5.33.1 → 5.33.3

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 +74 -39
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -668443,7 +668443,7 @@ var AccessTokenPosthogManager = class {
668443
668443
  properties: {
668444
668444
  ...event,
668445
668445
  ...event.properties,
668446
- version: "5.33.1",
668446
+ version: "5.33.3",
668447
668447
  usingAccessToken: true,
668448
668448
  ...getRunIdProperties()
668449
668449
  }
@@ -668507,7 +668507,7 @@ var UserPosthogManager = class {
668507
668507
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
668508
668508
  event: "CLI",
668509
668509
  properties: {
668510
- version: "5.33.1",
668510
+ version: "5.33.3",
668511
668511
  ...event,
668512
668512
  ...event.properties,
668513
668513
  usingAccessToken: false,
@@ -668555,12 +668555,19 @@ var UserPosthogManager = class {
668555
668555
  persistedDistinctId;
668556
668556
  async getPersistedDistinctId() {
668557
668557
  if (this.persistedDistinctId == null) {
668558
+ const generatedDistinctId = v4_default();
668558
668559
  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());
668560
+ try {
668561
+ if (!await doesPathExist(pathToFile)) {
668562
+ await (0, import_promises44.mkdir)((0, import_path46.dirname)(pathToFile), { recursive: true });
668563
+ await (0, import_promises44.writeFile)(pathToFile, generatedDistinctId);
668564
+ this.persistedDistinctId = generatedDistinctId;
668565
+ } else {
668566
+ this.persistedDistinctId = (await (0, import_promises44.readFile)(pathToFile)).toString();
668567
+ }
668568
+ } catch {
668569
+ this.persistedDistinctId = generatedDistinctId;
668562
668570
  }
668563
- this.persistedDistinctId = (await (0, import_promises44.readFile)(pathToFile)).toString();
668564
668571
  }
668565
668572
  return this.persistedDistinctId;
668566
668573
  }
@@ -672675,6 +672682,14 @@ var TtyAwareLogger2 = class {
672675
672682
  this.stdout = stdout;
672676
672683
  this.stderr = stderr;
672677
672684
  this.isTTY = stdout.isTTY === true && !import_is_ci3.default;
672685
+ for (const stream5 of [this.stdout, this.stderr]) {
672686
+ stream5.on("error", (error50) => {
672687
+ if (isEpipeError(error50)) {
672688
+ return;
672689
+ }
672690
+ throw error50;
672691
+ });
672692
+ }
672678
672693
  }
672679
672694
  /**
672680
672695
  * Register a paintable. The first registration starts the repaint loop.
@@ -672782,6 +672797,12 @@ var TtyAwareLogger2 = class {
672782
672797
  return paint;
672783
672798
  }
672784
672799
  };
672800
+ function isEpipeError(error50) {
672801
+ return hasErrnoCode(error50) && error50.code === "EPIPE";
672802
+ }
672803
+ function hasErrnoCode(error50) {
672804
+ return "code" in error50 && typeof error50.code === "string";
672805
+ }
672785
672806
 
672786
672807
  // ../cli-v2/lib/api/config/converter/ApiDefinitionConverter.js
672787
672808
  init_lib8();
@@ -822499,7 +822520,7 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
822499
822520
  if (endpointBaseUrl == null) {
822500
822521
  throw new CliError({
822501
822522
  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
822523
+ code: CliError.Code.ValidationError
822503
822524
  });
822504
822525
  }
822505
822526
  return {
@@ -822522,7 +822543,7 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
822522
822543
  if (endpointBaseUrl == null) {
822523
822544
  throw new CliError({
822524
822545
  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
822546
+ code: CliError.Code.ValidationError
822526
822547
  });
822527
822548
  }
822528
822549
  return {
@@ -860283,7 +860304,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860283
860304
  var LOGS_FOLDER_NAME = "logs";
860284
860305
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860285
860306
  function getCliSource() {
860286
- const version7 = "5.33.1";
860307
+ const version7 = "5.33.3";
860287
860308
  return `cli@${version7}`;
860288
860309
  }
860289
860310
  var DebugLogger = class {
@@ -877858,6 +877879,43 @@ async function generateOne({ generatorInvocation, interactiveTaskContext, projec
877858
877879
  init_lib4();
877859
877880
  init_lib6();
877860
877881
 
877882
+ // ../generation/remote-generation/remote-workspace-runner/lib/customDomainValidation.js
877883
+ init_lib6();
877884
+ var HTTPS_PREFIX = "https://";
877885
+ var HTTP_PREFIX = "http://";
877886
+ function stripCustomDomainProtocol(customDomain) {
877887
+ if (customDomain.startsWith(HTTPS_PREFIX)) {
877888
+ return customDomain.slice(HTTPS_PREFIX.length);
877889
+ }
877890
+ if (customDomain.startsWith(HTTP_PREFIX)) {
877891
+ return customDomain.slice(HTTP_PREFIX.length);
877892
+ }
877893
+ return customDomain;
877894
+ }
877895
+ function getBasepath(domain3) {
877896
+ try {
877897
+ const url3 = domain3.startsWith(HTTPS_PREFIX) || domain3.startsWith(HTTP_PREFIX) ? domain3 : `${HTTPS_PREFIX}${domain3}`;
877898
+ return normalizeBasepath(new URL(url3).pathname);
877899
+ } catch {
877900
+ return "/";
877901
+ }
877902
+ }
877903
+ function normalizeBasepath(pathname) {
877904
+ if (pathname === "" || pathname === "/") {
877905
+ return "/";
877906
+ }
877907
+ return pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
877908
+ }
877909
+ function validateBasepathAlignment(instanceUrl, customDomains, context3) {
877910
+ const urlBasepath = getBasepath(instanceUrl);
877911
+ for (const customDomain of customDomains) {
877912
+ const customDomainBasepath = getBasepath(customDomain);
877913
+ if (urlBasepath !== customDomainBasepath) {
877914
+ context3.failAndThrow(`Basepath mismatch between Fern url and custom-domain. When basepath-aware mode is enabled (via 'multi-source: true' or the deprecated 'experimental.basepath-aware: true'), the instance 'url' and 'custom-domain' must share the same basepath, otherwise docs will fail to resolve after DNS cutover. Instance url '${instanceUrl}' has basepath '${urlBasepath}' but custom-domain '${customDomain}' has basepath '${customDomainBasepath}'.`, void 0, { code: CliError.Code.ConfigError });
877915
+ }
877916
+ }
877917
+ }
877918
+
877861
877919
  // ../generation/remote-generation/remote-workspace-runner/lib/publishDocs.js
877862
877920
  init_lib4();
877863
877921
  init_js();
@@ -879000,16 +879058,10 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
879000
879058
  });
879001
879059
  return;
879002
879060
  }
879003
- const customDomains = [];
879004
- if (maybeInstance.customDomain != null) {
879005
- if (typeof maybeInstance.customDomain === "string") {
879006
- customDomains.push(maybeInstance.customDomain);
879007
- } else if (Array.isArray(maybeInstance.customDomain)) {
879008
- customDomains.push(...maybeInstance.customDomain);
879009
- }
879010
- }
879011
- if (maybeInstance.multiSource === true) {
879012
- validateMultiSourceBasepaths(maybeInstance.url, customDomains, context3);
879061
+ const customDomains = (typeof maybeInstance.customDomain === "string" ? [maybeInstance.customDomain] : maybeInstance.customDomain ?? []).map(stripCustomDomainProtocol);
879062
+ const isBasepathAware = maybeInstance.multiSource === true || docsWorkspace.config.experimental?.basepathAware === true;
879063
+ if (isBasepathAware) {
879064
+ validateBasepathAlignment(maybeInstance.url, customDomains, context3);
879013
879065
  }
879014
879066
  context3.logger.info(`Starting docs publishing for ${preview ? "preview" : "production"}: ${maybeInstance.url}`);
879015
879067
  context3.logger.debug(`Organization: ${organization}, Preview: ${preview}, APIs: ${apiWorkspaces.length}, OSS: ${ossWorkspaces.length}`);
@@ -879062,23 +879114,6 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
879062
879114
  });
879063
879115
  return publishedUrl;
879064
879116
  }
879065
- function getBasepath(domain3) {
879066
- try {
879067
- const url3 = domain3.startsWith("https://") || domain3.startsWith("http://") ? domain3 : `https://${domain3}`;
879068
- return new URL(url3).pathname;
879069
- } catch {
879070
- return "/";
879071
- }
879072
- }
879073
- function validateMultiSourceBasepaths(instanceUrl, customDomains, context3) {
879074
- const urlBasepath = getBasepath(instanceUrl);
879075
- for (const customDomain of customDomains) {
879076
- const customDomainBasepath = getBasepath(customDomain);
879077
- if (customDomainBasepath !== "/" && urlBasepath !== customDomainBasepath) {
879078
- context3.failAndThrow(`When multi-source is enabled, the url and custom-domain must share the same basepath. Instance url '${instanceUrl}' has basepath '${urlBasepath}' but custom-domain '${customDomain}' has basepath '${customDomainBasepath}'.`, void 0, { code: CliError.Code.ConfigError });
879079
- }
879080
- }
879081
- }
879082
879117
 
879083
879118
  // ../cli-v2/lib/docs/publisher/LegacyDocsPublisher.js
879084
879119
  init_lib6();
@@ -879115,7 +879150,7 @@ var LegacyDocsPublisher = class {
879115
879150
  previewId,
879116
879151
  disableTemplates: void 0,
879117
879152
  skipUpload,
879118
- cliVersion: "5.33.1",
879153
+ cliVersion: "5.33.3",
879119
879154
  loginCommand: "fern auth login"
879120
879155
  });
879121
879156
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -953815,7 +953850,7 @@ function getAutomationContextFromEnv() {
953815
953850
  config_branch: process.env.FERN_CONFIG_BRANCH,
953816
953851
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
953817
953852
  trigger: process.env.GITHUB_EVENT_NAME,
953818
- cli_version: "5.33.1"
953853
+ cli_version: "5.33.3"
953819
953854
  };
953820
953855
  }
953821
953856
  function isAutomationMode() {
@@ -954641,7 +954676,7 @@ var CliContext = class _CliContext {
954641
954676
  if (false) {
954642
954677
  this.logger.error("CLI_VERSION is not defined");
954643
954678
  }
954644
- return "5.33.1";
954679
+ return "5.33.3";
954645
954680
  }
954646
954681
  getCliName() {
954647
954682
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.33.1",
2
+ "version": "5.33.3",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",