@fern-api/fern-api-dev 5.109.3 → 5.110.1

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 +55 -12
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -34611,12 +34611,31 @@ var init_removeSuffix = __esm({
34611
34611
  });
34612
34612
 
34613
34613
  // ../../commons/core-utils/lib/replaceEnvVars.js
34614
+ function getDeferredEnvVars() {
34615
+ const raw = process.env[DEFERRED_ENV_VARS_ENV_VAR];
34616
+ if (raw == null) {
34617
+ return /* @__PURE__ */ new Set();
34618
+ }
34619
+ return new Set(raw.split(/[,\s]+/).filter((name2) => /^\w+$/.test(name2)));
34620
+ }
34621
+ function deferredPlaceholder(name2, before, after) {
34622
+ const placeholder = `${DEFERRED_PLACEHOLDER_PREFIX}${name2}`;
34623
+ if (/:\/\/$/.test(before)) {
34624
+ return placeholder;
34625
+ }
34626
+ const isUrl3 = URL_POSITION_REGEX.test(before) || before === "" && (after === "" || after.startsWith("/"));
34627
+ return isUrl3 ? `https://${placeholder}` : placeholder;
34628
+ }
34614
34629
  function replaceEnvVariables(content5, context3, options2 = {}) {
34615
34630
  if (typeof content5 === "string") {
34631
+ const deferred2 = getDeferredEnvVars();
34616
34632
  let transformed2 = content5.replace(ESCAPED_ENV_VAR_REGEX, (_substring, varName) => {
34617
34633
  return `${PLACEHOLDER_PREFIX}${varName}\0`;
34618
34634
  });
34619
- transformed2 = transformed2.replace(ENV_VAR_REGEX, (_substring, envVarName) => {
34635
+ transformed2 = transformed2.replace(ENV_VAR_REGEX, (substring, envVarName, offset2, whole) => {
34636
+ if (deferred2.has(envVarName)) {
34637
+ return deferredPlaceholder(envVarName, whole.slice(0, offset2), whole.slice(offset2 + substring.length));
34638
+ }
34620
34639
  if (options2.substituteAsEmpty) {
34621
34640
  return "";
34622
34641
  }
@@ -34638,7 +34657,7 @@ function replaceEnvVariables(content5, context3, options2 = {}) {
34638
34657
  const transformed = mapValues2(content5, (value2) => replaceEnvVariables(value2, context3, options2));
34639
34658
  return transformed;
34640
34659
  }
34641
- var ENV_VAR_REGEX, ESCAPED_ENV_VAR_REGEX, PLACEHOLDER_PREFIX;
34660
+ var ENV_VAR_REGEX, ESCAPED_ENV_VAR_REGEX, PLACEHOLDER_PREFIX, DEFERRED_ENV_VARS_ENV_VAR, DEFERRED_PLACEHOLDER_PREFIX, URL_POSITION_REGEX;
34642
34661
  var init_replaceEnvVars = __esm({
34643
34662
  "../../commons/core-utils/lib/replaceEnvVars.js"() {
34644
34663
  "use strict";
@@ -34647,6 +34666,9 @@ var init_replaceEnvVars = __esm({
34647
34666
  ENV_VAR_REGEX = /\$\{(\w+)\}/g;
34648
34667
  ESCAPED_ENV_VAR_REGEX = /\\\$\\\{(\w+)\\}/g;
34649
34668
  PLACEHOLDER_PREFIX = "\0ESCAPED_ENV_VAR\0";
34669
+ DEFERRED_ENV_VARS_ENV_VAR = "FERN_RUNTIME_ENV_VARS";
34670
+ DEFERRED_PLACEHOLDER_PREFIX = "FERN_SELF_HOSTED_ENV_";
34671
+ URL_POSITION_REGEX = /(\]\(|\b(?:href|src|url|action|content)\s*[=:]\s*["']?)$/i;
34650
34672
  }
34651
34673
  });
34652
34674
 
@@ -374099,6 +374121,8 @@ var init_OSSWorkspace = __esm({
374099
374121
  // This avoids running buf generate twice when both toFernWorkspace() and
374100
374122
  // validateOSSWorkspace() need the same OpenAPI specs.
374101
374123
  openApiSpecsCache = /* @__PURE__ */ new Map();
374124
+ /** Guards the orphaned-`auth-schemes` warning so one command warns once. */
374125
+ hasWarnedOrphanedAuthSchemes = false;
374102
374126
  constructor({ allSpecs, specs, ...superArgs }) {
374103
374127
  const openapiSpecs = specs.filter((spec) => spec.type === "openapi" && spec.source.type === "openapi");
374104
374128
  super({
@@ -374238,10 +374262,7 @@ var init_OSSWorkspace = __esm({
374238
374262
  const specs = await this.getOpenAPISpecsCached({ context: context3 });
374239
374263
  const documents = await this.loader.loadDocuments({ context: context3, specs });
374240
374264
  let authOverrides = this.generatorsConfiguration?.api?.auth != null ? { ...this.generatorsConfiguration?.api } : void 0;
374241
- const orphanedAuthSchemeWarning = getOrphanedAuthSchemeWarning(this.generatorsConfiguration?.api);
374242
- if (orphanedAuthSchemeWarning != null) {
374243
- context3.logger.warn(orphanedAuthSchemeWarning);
374244
- }
374265
+ this.warnOnOrphanedAuthSchemes(context3);
374245
374266
  if (authOverrides == null) {
374246
374267
  authOverrides = await getAuthFromOverrideFiles(specs);
374247
374268
  }
@@ -374420,7 +374441,29 @@ var init_OSSWorkspace = __esm({
374420
374441
  }
374421
374442
  return results;
374422
374443
  }
374444
+ /**
374445
+ * Emit the orphaned-`auth-schemes` warning, at most once per workspace.
374446
+ *
374447
+ * Called from BOTH `toFernWorkspace` and `getIntermediateRepresentation`,
374448
+ * because they are different entry points: `fern generate` and plain
374449
+ * `fern check` go through the former, and only `fern check --from-openapi`
374450
+ * reaches the latter (see `validateWorkspaces.ts`, where that branch is
374451
+ * gated on `directFromOpenapi`). Warning from only one of them meant the
374452
+ * customer who hits this bug — silently, on `fern generate` — saw nothing,
374453
+ * which is the entire failure mode.
374454
+ */
374455
+ warnOnOrphanedAuthSchemes(context3) {
374456
+ if (this.hasWarnedOrphanedAuthSchemes) {
374457
+ return;
374458
+ }
374459
+ const warning = getOrphanedAuthSchemeWarning(this.generatorsConfiguration?.api);
374460
+ if (warning != null) {
374461
+ this.hasWarnedOrphanedAuthSchemes = true;
374462
+ context3.logger.warn(warning);
374463
+ }
374464
+ }
374423
374465
  async toFernWorkspace({ context: context3 }, settings, specsOverride) {
374466
+ this.warnOnOrphanedAuthSchemes(context3);
374424
374467
  if (specsOverride != null) {
374425
374468
  return this.createWorkspaceWithSpecsOverride({ context: context3 }, specsOverride, settings);
374426
374469
  }
@@ -705279,7 +705322,7 @@ var AccessTokenPosthogManager = class {
705279
705322
  properties: {
705280
705323
  ...event,
705281
705324
  ...event.properties,
705282
- version: "5.109.3",
705325
+ version: "5.110.1",
705283
705326
  usingAccessToken: true,
705284
705327
  ...getRunIdProperties()
705285
705328
  }
@@ -705345,7 +705388,7 @@ var UserPosthogManager = class {
705345
705388
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
705346
705389
  event: "CLI",
705347
705390
  properties: {
705348
- version: "5.109.3",
705391
+ version: "5.110.1",
705349
705392
  ...event,
705350
705393
  ...event.properties,
705351
705394
  usingAccessToken: false,
@@ -887019,7 +887062,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
887019
887062
  var LOGS_FOLDER_NAME = "logs";
887020
887063
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
887021
887064
  function getCliSource() {
887022
- const version7 = "5.109.3";
887065
+ const version7 = "5.110.1";
887023
887066
  return `cli@${version7}`;
887024
887067
  }
887025
887068
  var DebugLogger = class {
@@ -913983,7 +914026,7 @@ var LegacyDocsPublisher = class {
913983
914026
  previewId,
913984
914027
  disableTemplates: void 0,
913985
914028
  skipUpload,
913986
- cliVersion: "5.109.3",
914029
+ cliVersion: "5.110.1",
913987
914030
  loginCommand: "fern auth login"
913988
914031
  });
913989
914032
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -980903,7 +980946,7 @@ function getAutomationContextFromEnv() {
980903
980946
  config_branch: process.env.FERN_CONFIG_BRANCH,
980904
980947
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
980905
980948
  trigger: process.env.GITHUB_EVENT_NAME,
980906
- cli_version: "5.109.3"
980949
+ cli_version: "5.110.1"
980907
980950
  };
980908
980951
  }
980909
980952
  function isAutomationMode() {
@@ -981735,7 +981778,7 @@ var CliContext = class _CliContext {
981735
981778
  if (false) {
981736
981779
  this.logger.error("CLI_VERSION is not defined");
981737
981780
  }
981738
- return "5.109.3";
981781
+ return "5.110.1";
981739
981782
  }
981740
981783
  getCliName() {
981741
981784
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.109.3",
2
+ "version": "5.110.1",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",