@fern-api/fern-api-dev 5.40.0 → 5.41.0

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 +165 -84
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -52657,9 +52657,9 @@ var init_streamObjectToFile = __esm({
52657
52657
  }
52658
52658
  });
52659
52659
 
52660
- // ../../../node_modules/.pnpm/tmp@0.2.5/node_modules/tmp/lib/tmp.js
52660
+ // ../../../node_modules/.pnpm/tmp@0.2.6/node_modules/tmp/lib/tmp.js
52661
52661
  var require_tmp = __commonJS({
52662
- "../../../node_modules/.pnpm/tmp@0.2.5/node_modules/tmp/lib/tmp.js"(exports2, module4) {
52662
+ "../../../node_modules/.pnpm/tmp@0.2.6/node_modules/tmp/lib/tmp.js"(exports2, module4) {
52663
52663
  "use strict";
52664
52664
  var fs38 = require("fs");
52665
52665
  var os24 = require("os");
@@ -52910,13 +52910,20 @@ var require_tmp = __commonJS({
52910
52910
  ].join("");
52911
52911
  return path117.join(tmpDir, opts.dir, name2);
52912
52912
  }
52913
+ function _assertPath(path118) {
52914
+ if (path118.includes("..")) {
52915
+ throw new Error("Relative value not allowed");
52916
+ }
52917
+ return path118;
52918
+ }
52913
52919
  function _assertOptionsBase(options2) {
52914
52920
  if (!_isUndefined(options2.name)) {
52915
52921
  const name2 = options2.name;
52916
52922
  if (path117.isAbsolute(name2)) throw new Error(`name option must not contain an absolute path, found "${name2}".`);
52917
52923
  const basename6 = path117.basename(name2);
52918
- if (basename6 === ".." || basename6 === "." || basename6 !== name2)
52924
+ if (basename6 === ".." || basename6 === "." || basename6 !== name2) {
52919
52925
  throw new Error(`name option must not contain a path, found "${name2}".`);
52926
+ }
52920
52927
  }
52921
52928
  if (!_isUndefined(options2.template) && !options2.template.match(TEMPLATE_PATTERN)) {
52922
52929
  throw new Error(`Invalid template, found "${options2.template}".`);
@@ -52929,15 +52936,16 @@ var require_tmp = __commonJS({
52929
52936
  options2.detachDescriptor = !!options2.detachDescriptor;
52930
52937
  options2.discardDescriptor = !!options2.discardDescriptor;
52931
52938
  options2.unsafeCleanup = !!options2.unsafeCleanup;
52932
- options2.prefix = _isUndefined(options2.prefix) ? "" : options2.prefix;
52933
- options2.postfix = _isUndefined(options2.postfix) ? "" : options2.postfix;
52939
+ options2.prefix = _isUndefined(options2.prefix) ? "" : _assertPath(options2.prefix);
52940
+ options2.postfix = _isUndefined(options2.postfix) ? "" : _assertPath(options2.postfix);
52941
+ options2.template = _isUndefined(options2.template) ? void 0 : _assertPath(options2.template);
52934
52942
  }
52935
52943
  function _getRelativePath(option, name2, tmpDir, cb) {
52936
52944
  if (_isUndefined(name2)) return cb(null);
52937
52945
  _resolvePath(name2, tmpDir, function(err, resolvedPath) {
52938
52946
  if (err) return cb(err);
52939
52947
  const relativePath = path117.relative(tmpDir, resolvedPath);
52940
- if (!resolvedPath.startsWith(tmpDir)) {
52948
+ if (relativePath.startsWith("..") || path117.isAbsolute(relativePath)) {
52941
52949
  return cb(new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`));
52942
52950
  }
52943
52951
  cb(null, relativePath);
@@ -52947,7 +52955,7 @@ var require_tmp = __commonJS({
52947
52955
  if (_isUndefined(name2)) return;
52948
52956
  const resolvedPath = _resolvePathSync(name2, tmpDir);
52949
52957
  const relativePath = path117.relative(tmpDir, resolvedPath);
52950
- if (!resolvedPath.startsWith(tmpDir)) {
52958
+ if (relativePath.startsWith("..") || path117.isAbsolute(relativePath)) {
52951
52959
  throw new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`);
52952
52960
  }
52953
52961
  return relativePath;
@@ -108916,9 +108924,9 @@ var require_object_inspect = __commonJS({
108916
108924
  }
108917
108925
  });
108918
108926
 
108919
- // ../../../node_modules/.pnpm/side-channel-list@1.0.0/node_modules/side-channel-list/index.js
108927
+ // ../../../node_modules/.pnpm/side-channel-list@1.0.1/node_modules/side-channel-list/index.js
108920
108928
  var require_side_channel_list = __commonJS({
108921
- "../../../node_modules/.pnpm/side-channel-list@1.0.0/node_modules/side-channel-list/index.js"(exports2, module4) {
108929
+ "../../../node_modules/.pnpm/side-channel-list@1.0.1/node_modules/side-channel-list/index.js"(exports2, module4) {
108922
108930
  "use strict";
108923
108931
  var inspect6 = require_object_inspect();
108924
108932
  var $TypeError = require_type3();
@@ -108978,9 +108986,8 @@ var require_side_channel_list = __commonJS({
108978
108986
  }
108979
108987
  },
108980
108988
  "delete": function(key2) {
108981
- var root6 = $o8 && $o8.next;
108982
108989
  var deletedNode = listDelete($o8, key2);
108983
- if (deletedNode && root6 && root6 === deletedNode) {
108990
+ if (deletedNode && $o8 && !$o8.next) {
108984
108991
  $o8 = void 0;
108985
108992
  }
108986
108993
  return !!deletedNode;
@@ -109996,9 +110003,9 @@ var require_side_channel = __commonJS({
109996
110003
  }
109997
110004
  });
109998
110005
 
109999
- // ../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/formats.js
110006
+ // ../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/formats.js
110000
110007
  var require_formats = __commonJS({
110001
- "../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/formats.js"(exports2, module4) {
110008
+ "../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/formats.js"(exports2, module4) {
110002
110009
  "use strict";
110003
110010
  var replace2 = String.prototype.replace;
110004
110011
  var percentTwenties = /%20/g;
@@ -110022,9 +110029,9 @@ var require_formats = __commonJS({
110022
110029
  }
110023
110030
  });
110024
110031
 
110025
- // ../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/utils.js
110032
+ // ../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/utils.js
110026
110033
  var require_utils22 = __commonJS({
110027
- "../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/utils.js"(exports2, module4) {
110034
+ "../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/utils.js"(exports2, module4) {
110028
110035
  "use strict";
110029
110036
  var formats = require_formats();
110030
110037
  var getSideChannel = require_side_channel();
@@ -110286,9 +110293,9 @@ var require_utils22 = __commonJS({
110286
110293
  }
110287
110294
  });
110288
110295
 
110289
- // ../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/stringify.js
110296
+ // ../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/stringify.js
110290
110297
  var require_stringify = __commonJS({
110291
- "../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/stringify.js"(exports2, module4) {
110298
+ "../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/stringify.js"(exports2, module4) {
110292
110299
  "use strict";
110293
110300
  var getSideChannel = require_side_channel();
110294
110301
  var utils2 = require_utils22();
@@ -110374,7 +110381,7 @@ var require_stringify = __commonJS({
110374
110381
  }
110375
110382
  if (obj === null) {
110376
110383
  if (strictNullHandling) {
110377
- return encoder && !encodeValuesOnly ? encoder(prefix2, defaults3.encoder, charset, "key", format3) : prefix2;
110384
+ return formatter(encoder && !encodeValuesOnly ? encoder(prefix2, defaults3.encoder, charset, "key", format3) : prefix2);
110378
110385
  }
110379
110386
  obj = "";
110380
110387
  }
@@ -110392,7 +110399,9 @@ var require_stringify = __commonJS({
110392
110399
  var objKeys;
110393
110400
  if (generateArrayPrefix === "comma" && isArray7(obj)) {
110394
110401
  if (encodeValuesOnly && encoder) {
110395
- obj = utils2.maybeMap(obj, encoder);
110402
+ obj = utils2.maybeMap(obj, function(v9) {
110403
+ return v9 == null ? v9 : encoder(v9);
110404
+ });
110396
110405
  }
110397
110406
  objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }];
110398
110407
  } else if (isArray7(filter8)) {
@@ -110530,6 +110539,9 @@ var require_stringify = __commonJS({
110530
110539
  var sideChannel = getSideChannel();
110531
110540
  for (var i9 = 0; i9 < objKeys.length; ++i9) {
110532
110541
  var key2 = objKeys[i9];
110542
+ if (typeof key2 === "undefined" || key2 === null) {
110543
+ continue;
110544
+ }
110533
110545
  var value2 = obj[key2];
110534
110546
  if (options2.skipNulls && value2 === null) {
110535
110547
  continue;
@@ -110559,9 +110571,9 @@ var require_stringify = __commonJS({
110559
110571
  var prefix2 = options2.addQueryPrefix === true ? "?" : "";
110560
110572
  if (options2.charsetSentinel) {
110561
110573
  if (options2.charset === "iso-8859-1") {
110562
- prefix2 += "utf8=%26%2310003%3B&";
110574
+ prefix2 += "utf8=%26%2310003%3B" + options2.delimiter;
110563
110575
  } else {
110564
- prefix2 += "utf8=%E2%9C%93&";
110576
+ prefix2 += "utf8=%E2%9C%93" + options2.delimiter;
110565
110577
  }
110566
110578
  }
110567
110579
  return joined.length > 0 ? prefix2 + joined : "";
@@ -110569,9 +110581,9 @@ var require_stringify = __commonJS({
110569
110581
  }
110570
110582
  });
110571
110583
 
110572
- // ../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/parse.js
110584
+ // ../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/parse.js
110573
110585
  var require_parse2 = __commonJS({
110574
- "../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/parse.js"(exports2, module4) {
110586
+ "../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/parse.js"(exports2, module4) {
110575
110587
  "use strict";
110576
110588
  var utils2 = require_utils22();
110577
110589
  var has2 = Object.prototype.hasOwnProperty;
@@ -110623,9 +110635,9 @@ var require_parse2 = __commonJS({
110623
110635
  var limit = options2.parameterLimit === Infinity ? void 0 : options2.parameterLimit;
110624
110636
  var parts = cleanStr.split(
110625
110637
  options2.delimiter,
110626
- options2.throwOnLimitExceeded ? limit + 1 : limit
110638
+ options2.throwOnLimitExceeded && typeof limit !== "undefined" ? limit + 1 : limit
110627
110639
  );
110628
- if (options2.throwOnLimitExceeded && parts.length > limit) {
110640
+ if (options2.throwOnLimitExceeded && typeof limit !== "undefined" && parts.length > limit) {
110629
110641
  throw new RangeError("Parameter limit exceeded. Only " + limit + " parameter" + (limit === 1 ? "" : "s") + " allowed.");
110630
110642
  }
110631
110643
  var skipIndex = -1;
@@ -110744,8 +110756,8 @@ var require_parse2 = __commonJS({
110744
110756
  }
110745
110757
  return leaf;
110746
110758
  };
110747
- var splitKeyIntoSegments = function splitKeyIntoSegments2(givenKey, options2) {
110748
- var key2 = options2.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
110759
+ var splitKeyIntoSegments = function splitKeyIntoSegments2(originalKey, options2) {
110760
+ var key2 = options2.allowDots ? originalKey.replace(/\.([^.[]+)/g, "[$1]") : originalKey;
110749
110761
  if (options2.depth <= 0) {
110750
110762
  if (!options2.plainObjects && has2.call(Object.prototype, key2)) {
110751
110763
  if (!options2.allowPrototypes) {
@@ -110754,37 +110766,56 @@ var require_parse2 = __commonJS({
110754
110766
  }
110755
110767
  return [key2];
110756
110768
  }
110757
- var brackets = /(\[[^[\]]*])/;
110758
- var child = /(\[[^[\]]*])/g;
110759
- var segment = brackets.exec(key2);
110760
- var parent = segment ? key2.slice(0, segment.index) : key2;
110761
- var keys25 = [];
110769
+ var segments = [];
110770
+ var first3 = key2.indexOf("[");
110771
+ var parent = first3 >= 0 ? key2.slice(0, first3) : key2;
110762
110772
  if (parent) {
110763
110773
  if (!options2.plainObjects && has2.call(Object.prototype, parent)) {
110764
110774
  if (!options2.allowPrototypes) {
110765
110775
  return;
110766
110776
  }
110767
110777
  }
110768
- keys25[keys25.length] = parent;
110778
+ segments[segments.length] = parent;
110769
110779
  }
110770
- var i9 = 0;
110771
- while ((segment = child.exec(key2)) !== null && i9 < options2.depth) {
110772
- i9 += 1;
110773
- var segmentContent = segment[1].slice(1, -1);
110774
- if (!options2.plainObjects && has2.call(Object.prototype, segmentContent)) {
110775
- if (!options2.allowPrototypes) {
110776
- return;
110780
+ var n19 = key2.length;
110781
+ var open5 = first3;
110782
+ var collected = 0;
110783
+ while (open5 >= 0 && collected < options2.depth) {
110784
+ var level = 1;
110785
+ var i9 = open5 + 1;
110786
+ var close3 = -1;
110787
+ while (i9 < n19 && close3 < 0) {
110788
+ var cu5 = key2.charCodeAt(i9);
110789
+ if (cu5 === 91) {
110790
+ level += 1;
110791
+ } else if (cu5 === 93) {
110792
+ level -= 1;
110793
+ if (level === 0) {
110794
+ close3 = i9;
110795
+ }
110777
110796
  }
110797
+ i9 += 1;
110798
+ }
110799
+ if (close3 < 0) {
110800
+ segments[segments.length] = "[" + key2.slice(open5) + "]";
110801
+ return segments;
110778
110802
  }
110779
- keys25[keys25.length] = segment[1];
110803
+ var seg = key2.slice(open5, close3 + 1);
110804
+ var content5 = seg.slice(1, -1);
110805
+ if (!options2.plainObjects && has2.call(Object.prototype, content5) && !options2.allowPrototypes) {
110806
+ return;
110807
+ }
110808
+ segments[segments.length] = seg;
110809
+ collected += 1;
110810
+ open5 = key2.indexOf("[", close3 + 1);
110780
110811
  }
110781
- if (segment) {
110812
+ if (open5 >= 0) {
110782
110813
  if (options2.strictDepth === true) {
110783
110814
  throw new RangeError("Input depth exceeded depth option of " + options2.depth + " and strictDepth is true");
110784
110815
  }
110785
- keys25[keys25.length] = "[" + key2.slice(segment.index) + "]";
110816
+ segments[segments.length] = "[" + key2.slice(open5) + "]";
110786
110817
  }
110787
- return keys25;
110818
+ return segments;
110788
110819
  };
110789
110820
  var parseKeys = function parseQueryStringKeys(givenKey, val, options2, valuesParsed) {
110790
110821
  if (!givenKey) {
@@ -110868,9 +110899,9 @@ var require_parse2 = __commonJS({
110868
110899
  }
110869
110900
  });
110870
110901
 
110871
- // ../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/index.js
110902
+ // ../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/index.js
110872
110903
  var require_lib3 = __commonJS({
110873
- "../../../node_modules/.pnpm/qs@6.15.0/node_modules/qs/lib/index.js"(exports2, module4) {
110904
+ "../../../node_modules/.pnpm/qs@6.15.2/node_modules/qs/lib/index.js"(exports2, module4) {
110874
110905
  "use strict";
110875
110906
  var stringify5 = require_stringify();
110876
110907
  var parse19 = require_parse2();
@@ -620079,10 +620110,11 @@ var FIDDLE_ORIGIN = process.env.FERN_FIDDLE_ORIGIN ?? "https://fiddle-coordinato
620079
620110
  function getFiddleOrigin() {
620080
620111
  return FIDDLE_ORIGIN;
620081
620112
  }
620082
- function createFiddleService({ token } = {}) {
620113
+ function createFiddleService({ token, headers: headers2 } = {}) {
620083
620114
  return new FernFiddleClient({
620084
620115
  environment: FIDDLE_ORIGIN,
620085
- token
620116
+ token,
620117
+ headers: headers2
620086
620118
  });
620087
620119
  }
620088
620120
 
@@ -626784,10 +626816,11 @@ var FernVenusApiClient = class {
626784
626816
  };
626785
626817
 
626786
626818
  // ../../core/lib/services/venus.js
626787
- function createVenusService({ environment: environment2 = "https://venus-dev2.buildwithfern.com", token } = {}) {
626819
+ function createVenusService({ environment: environment2 = "https://venus-dev2.buildwithfern.com", token, headers: headers2 } = {}) {
626788
626820
  return new FernVenusApiClient({
626789
626821
  environment: environment2,
626790
- token
626822
+ token,
626823
+ headers: headers2
626791
626824
  });
626792
626825
  }
626793
626826
 
@@ -662690,8 +662723,8 @@ function printIfUpgradeAvailable(context3, currentVersion, latestVersion2) {
662690
662723
  }
662691
662724
 
662692
662725
  // ../auth/lib/orgs/checkOrganizationMembership.js
662693
- async function checkOrganizationMembership({ organization, token }) {
662694
- const venus = createVenusService({ token: token.value });
662726
+ async function checkOrganizationMembership({ organization, token, headers: headers2 }) {
662727
+ const venus = createVenusService({ token: token.value, headers: headers2 });
662695
662728
  const isMemberResponse = await venus.organization.isMember(organization);
662696
662729
  if (isMemberResponse.ok && isMemberResponse.body) {
662697
662730
  return { type: "member" };
@@ -662728,8 +662761,8 @@ function getOrganizationNameValidationError(organizationName) {
662728
662761
  }
662729
662762
 
662730
662763
  // ../auth/lib/orgs/createOrganizationIfDoesNotExist.js
662731
- async function createOrganizationIfDoesNotExist({ organization, token, context: context3 }) {
662732
- const venus = createVenusService({ token: token.value });
662764
+ async function createOrganizationIfDoesNotExist({ organization, token, context: context3, headers: headers2 }) {
662765
+ const venus = createVenusService({ token: token.value, headers: headers2 });
662733
662766
  const getOrganizationResponse = await venus.organization.get(organization);
662734
662767
  if (getOrganizationResponse.ok) {
662735
662768
  return false;
@@ -669350,7 +669383,7 @@ var AccessTokenPosthogManager = class {
669350
669383
  properties: {
669351
669384
  ...event,
669352
669385
  ...event.properties,
669353
- version: "5.40.0",
669386
+ version: "5.41.0",
669354
669387
  usingAccessToken: true,
669355
669388
  ...getRunIdProperties()
669356
669389
  }
@@ -669414,7 +669447,7 @@ var UserPosthogManager = class {
669414
669447
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
669415
669448
  event: "CLI",
669416
669449
  properties: {
669417
- version: "5.40.0",
669450
+ version: "5.41.0",
669418
669451
  ...event,
669419
669452
  ...event.properties,
669420
669453
  usingAccessToken: false,
@@ -672189,8 +672222,10 @@ var import_promises52 = require("fs/promises");
672189
672222
  var DEFAULT_USER = "default";
672190
672223
  var LegacyTokenMigrator = class {
672191
672224
  loader;
672192
- constructor({ loader: loader2 }) {
672225
+ headers;
672226
+ constructor({ loader: loader2, headers: headers2 }) {
672193
672227
  this.loader = loader2;
672228
+ this.headers = headers2;
672194
672229
  }
672195
672230
  /**
672196
672231
  * Performs the migration from ~/.fern/token to ~/.fernrc + keyring.
@@ -672227,7 +672262,7 @@ var LegacyTokenMigrator = class {
672227
672262
  */
672228
672263
  async fetchUserEmail(token) {
672229
672264
  try {
672230
- const venus = createVenusService({ token });
672265
+ const venus = createVenusService({ token, headers: this.headers });
672231
672266
  const response = await venus.user.getMyself();
672232
672267
  if (response.ok && response.body.email != null) {
672233
672268
  return response.body.email;
@@ -672246,11 +672281,11 @@ var TokenService = class {
672246
672281
  migrator;
672247
672282
  // Tracks whether or not we've already performed the migration.
672248
672283
  migrationPromise = null;
672249
- constructor({ credential }) {
672284
+ constructor({ credential, headers: headers2 }) {
672250
672285
  this.credential = credential;
672251
672286
  const loader2 = new FernRcSchemaLoader();
672252
672287
  this.accountManager = new FernRcAccountManager({ loader: loader2 });
672253
- this.migrator = new LegacyTokenMigrator({ loader: loader2 });
672288
+ this.migrator = new LegacyTokenMigrator({ loader: loader2, headers: headers2 });
672254
672289
  }
672255
672290
  /**
672256
672291
  * Adds a new account with its token.
@@ -675311,6 +675346,7 @@ var Context = class _Context {
675311
675346
  isShuttingDown = false;
675312
675347
  logFilePathPrinted = false;
675313
675348
  createdAt = Date.now();
675349
+ requestId = v4_default();
675314
675350
  cwd;
675315
675351
  logLevel;
675316
675352
  info;
@@ -675336,7 +675372,7 @@ var Context = class _Context {
675336
675372
  this.logs = new LogFileWriter(this.cache.logs.absoluteFilePath);
675337
675373
  this.ttyAwareLogger = ttyAwareLogger;
675338
675374
  this.telemetry = telemetry;
675339
- this.tokenService = new TokenService({ credential: new CredentialStore() });
675375
+ this.tokenService = new TokenService({ credential: new CredentialStore(), headers: this.headers });
675340
675376
  }
675341
675377
  /**
675342
675378
  * Returns true if running in an interactive TTY environment (not CI).
@@ -675344,6 +675380,12 @@ var Context = class _Context {
675344
675380
  get isTTY() {
675345
675381
  return this.ttyAwareLogger.isTTY;
675346
675382
  }
675383
+ /**
675384
+ * Returns headers that should be included with every outbound API request.
675385
+ */
675386
+ get headers() {
675387
+ return { "X-Request-Id": this.requestId };
675388
+ }
675347
675389
  /**
675348
675390
  * Resolves the org from the local Fern config. Tries `fern.yml` first
675349
675391
  * (`org` field), then falls back to `fern/fern.config.json` (`organization`
@@ -675472,18 +675514,18 @@ var Context = class _Context {
675472
675514
  if (token.type === "organization") {
675473
675515
  return;
675474
675516
  }
675475
- const result = await checkOrganizationMembership({ organization, token });
675517
+ const result = await checkOrganizationMembership({ organization, token, headers: this.headers });
675476
675518
  switch (result.type) {
675477
675519
  case "member":
675478
675520
  return;
675479
- case "not-found":
675480
- throw CliError.notFound(`Organization "${organization}" does not exist.
675481
-
675482
- To create it, run: fern org create ${organization}`);
675483
675521
  case "no-access":
675484
675522
  throw CliError.unauthorized(`You do not have access to organization "${organization}".
675485
675523
 
675486
675524
  Contact an organization admin to request access.`);
675525
+ case "not-found":
675526
+ throw CliError.notFound(`Organization "${organization}" does not exist.
675527
+
675528
+ To create it, run: fern org create ${organization}`);
675487
675529
  case "unknown-error":
675488
675530
  throw CliError.internalError(`Failed to verify access to organization "${organization}".`);
675489
675531
  }
@@ -816819,10 +816861,11 @@ var TokenCommand = class {
816819
816861
  await createOrganizationIfDoesNotExist({
816820
816862
  organization: orgId,
816821
816863
  token,
816822
- context: new TaskContextAdapter({ context: context3 })
816864
+ context: new TaskContextAdapter({ context: context3 }),
816865
+ headers: context3.headers
816823
816866
  });
816824
816867
  }
816825
- const venus = createVenusService({ token: token.value });
816868
+ const venus = createVenusService({ token: token.value, headers: context3.headers });
816826
816869
  const response = await venus.registry.generateRegistryTokens({
816827
816870
  organizationId: orgId
816828
816871
  });
@@ -854957,6 +855000,22 @@ var import_path58 = __toESM(require("path"), 1);
854957
855000
  // ../yaml/docs-validator/lib/rules/valid-markdown-link/check-if-pathname-exists.js
854958
855001
  init_lib8();
854959
855002
 
855003
+ // ../yaml/docs-validator/lib/rules/valid-markdown-link/dynamic-special-doc-page.js
855004
+ var DYNAMIC_SPEC_PATTERN = /^\/(openapi|asyncapi)\/.+\.(json|ya?ml)$/;
855005
+ function isDynamicSpecialDocPage(pathname, basePath) {
855006
+ if (DYNAMIC_SPEC_PATTERN.test(pathname)) {
855007
+ return true;
855008
+ }
855009
+ if (basePath != null) {
855010
+ const normalizedBase = basePath.startsWith("/") ? basePath : `/${basePath}`;
855011
+ if (pathname.startsWith(normalizedBase)) {
855012
+ const withoutBase = pathname.slice(normalizedBase.length);
855013
+ return DYNAMIC_SPEC_PATTERN.test(withoutBase);
855014
+ }
855015
+ }
855016
+ return false;
855017
+ }
855018
+
854960
855019
  // ../yaml/docs-validator/lib/rules/valid-markdown-link/redirect-for-path.js
854961
855020
  var import_url_join22 = __toESM(require_url_join(), 1);
854962
855021
  function matchPath2(pattern, path117) {
@@ -855046,6 +855105,9 @@ async function checkIfPathnameExists({ pathname, markdown, absoluteFilepath, wor
855046
855105
  if (isExternalUrl2(redirectedPath)) {
855047
855106
  return true;
855048
855107
  }
855108
+ if (isDynamicSpecialDocPage(redirectedPath, baseUrl.basePath)) {
855109
+ return true;
855110
+ }
855049
855111
  if (markdown && pageSlugs.has(removeLeadingSlash(redirectedPath))) {
855050
855112
  return true;
855051
855113
  }
@@ -855441,7 +855503,16 @@ var ValidMarkdownLinks = {
855441
855503
  });
855442
855504
  const versionSlugs = collector.getVersionNodes().map((v9) => v9.slug);
855443
855505
  const productSlugs = collector.getProductNodes().filter(navigation_exports.isInternalProductNode).map((p14) => p14.slug);
855444
- const specialDocPages = ["/llms-full.txt", "/llms.txt"];
855506
+ const specialDocPages = [
855507
+ "/llms-full.txt",
855508
+ "/llms.txt",
855509
+ "/openapi.json",
855510
+ "/openapi.yaml",
855511
+ "/openapi.yml",
855512
+ "/asyncapi.json",
855513
+ "/asyncapi.yaml",
855514
+ "/asyncapi.yml"
855515
+ ];
855445
855516
  for (const specialPage of specialDocPages) {
855446
855517
  const pageWithBasePath = baseUrl.basePath ? `${removeLeadingSlash(baseUrl.basePath)}${specialPage}` : removeLeadingSlash(specialPage);
855447
855518
  visitableSlugs.add(pageWithBasePath);
@@ -860327,7 +860398,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860327
860398
  var LOGS_FOLDER_NAME = "logs";
860328
860399
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860329
860400
  function getCliSource() {
860330
- const version7 = "5.40.0";
860401
+ const version7 = "5.41.0";
860331
860402
  return `cli@${version7}`;
860332
860403
  }
860333
860404
  var DebugLogger = class {
@@ -880967,7 +881038,7 @@ var LegacyDocsPublisher = class {
880967
881038
  previewId,
880968
881039
  disableTemplates: void 0,
880969
881040
  skipUpload,
880970
- cliVersion: "5.40.0",
881041
+ cliVersion: "5.41.0",
880971
881042
  loginCommand: "fern auth login"
880972
881043
  });
880973
881044
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -881817,7 +881888,7 @@ var DeleteCommand = class {
881817
881888
  });
881818
881889
  }
881819
881890
  const token = await context3.getTokenOrPrompt();
881820
- const fdr = createFdrService({ token: token.value });
881891
+ const fdr = createFdrService({ token: token.value, headers: context3.headers });
881821
881892
  context3.stderr.debug(`Deleting preview site: ${resolvedUrl}`);
881822
881893
  try {
881823
881894
  await fdr.docs.v2.write.deleteDocsSite({
@@ -882312,7 +882383,11 @@ var Wizard = class {
882312
882383
  return;
882313
882384
  }
882314
882385
  try {
882315
- const result = await checkOrganizationMembership({ organization, token });
882386
+ const result = await checkOrganizationMembership({
882387
+ organization,
882388
+ token,
882389
+ headers: this.context.headers
882390
+ });
882316
882391
  switch (result.type) {
882317
882392
  case "member":
882318
882393
  this.context.stderr.info(` ${Icons.success} Organization "${organization}" found
@@ -882322,7 +882397,12 @@ var Wizard = class {
882322
882397
  const taskContext = new TaskContextAdapter({ context: this.context });
882323
882398
  const created = await withSpinner({
882324
882399
  message: `Creating organization "${organization}"`,
882325
- operation: () => createOrganizationIfDoesNotExist({ organization, token, context: taskContext }),
882400
+ operation: () => createOrganizationIfDoesNotExist({
882401
+ organization,
882402
+ token,
882403
+ context: taskContext,
882404
+ headers: this.context.headers
882405
+ }),
882326
882406
  indent: 2
882327
882407
  });
882328
882408
  if (created) {
@@ -882925,7 +883005,8 @@ var CreateCommand = class {
882925
883005
  operation: () => createOrganizationIfDoesNotExist({
882926
883006
  organization: args.name,
882927
883007
  token,
882928
- context: new TaskContextAdapter({ context: context3 })
883008
+ context: new TaskContextAdapter({ context: context3 }),
883009
+ headers: context3.headers
882929
883010
  })
882930
883011
  });
882931
883012
  if (created) {
@@ -882954,7 +883035,7 @@ var ListCommand = class {
882954
883035
  context3.stderr.error(`${Icons.error} Organization tokens cannot list organizations. Unset the FERN_TOKEN environment variable and run 'fern auth login' to list your organizations.`);
882955
883036
  throw new CliError({ code: CliError.Code.AuthError });
882956
883037
  }
882957
- const venus = createVenusService({ token: token.value });
883038
+ const venus = createVenusService({ token: token.value, headers: context3.headers });
882958
883039
  const firstPage = await this.fetchPage({ venus, pageId: 1 });
882959
883040
  if (firstPage.organizations.length === 0) {
882960
883041
  context3.stderr.info(`${Icons.info} You are not a member of any organizations.`);
@@ -883083,7 +883164,7 @@ var InviteMemberCommand = class {
883083
883164
  context3.stderr.error(`${Icons.error} Organization tokens cannot manage members. Unset the FERN_TOKEN environment variable and run 'fern auth login' to manage members.`);
883084
883165
  throw new CliError({ code: CliError.Code.AuthError });
883085
883166
  }
883086
- const venus = createVenusService({ token: token.value });
883167
+ const venus = createVenusService({ token: token.value, headers: context3.headers });
883087
883168
  const orgLookup = await venus.organization.get(args.org);
883088
883169
  if (!orgLookup.ok) {
883089
883170
  orgLookup.error._visit({
@@ -883158,7 +883239,7 @@ var ListMembersCommand = class {
883158
883239
  context3.stderr.error(`${Icons.error} Organization tokens cannot list members. Unset the FERN_TOKEN environment variable and run 'fern auth login' to list members.`);
883159
883240
  throw new CliError({ code: CliError.Code.AuthError });
883160
883241
  }
883161
- const venus = createVenusService({ token: token.value });
883242
+ const venus = createVenusService({ token: token.value, headers: context3.headers });
883162
883243
  const response = await withSpinner({
883163
883244
  message: `Fetching members of organization "${args.org}"`,
883164
883245
  operation: () => venus.organization.get(args.org)
@@ -883221,7 +883302,7 @@ var RemoveMemberCommand = class {
883221
883302
  context3.stderr.error(`${Icons.error} Organization tokens cannot remove members. Unset the FERN_TOKEN environment variable and run 'fern auth login' to remove members.`);
883222
883303
  throw new CliError({ code: CliError.Code.AuthError });
883223
883304
  }
883224
- const venus = createVenusService({ token: token.value });
883305
+ const venus = createVenusService({ token: token.value, headers: context3.headers });
883225
883306
  const orgLookup = await venus.organization.get(args.org);
883226
883307
  if (!orgLookup.ok) {
883227
883308
  orgLookup.error._visit({
@@ -883307,7 +883388,7 @@ var CreateTokenCommand = class {
883307
883388
  context3.stderr.error(`${Icons.error} Organization tokens cannot manage API tokens. Unset the FERN_TOKEN environment variable and run 'fern auth login' to manage tokens.`);
883308
883389
  throw new CliError({ code: CliError.Code.AuthError });
883309
883390
  }
883310
- const venus = createVenusService({ token: token.value });
883391
+ const venus = createVenusService({ token: token.value, headers: context3.headers });
883311
883392
  const orgLookup = await venus.organization.get(args.org);
883312
883393
  if (!orgLookup.ok) {
883313
883394
  orgLookup.error._visit({
@@ -883387,7 +883468,7 @@ var ListTokensCommand = class {
883387
883468
  context3.stderr.error(`${Icons.error} Organization tokens cannot list API tokens. Unset the FERN_TOKEN environment variable and run 'fern auth login' to list tokens.`);
883388
883469
  throw new CliError({ code: CliError.Code.AuthError });
883389
883470
  }
883390
- const venus = createVenusService({ token: token.value });
883471
+ const venus = createVenusService({ token: token.value, headers: context3.headers });
883391
883472
  const orgLookup = await venus.organization.get(args.org);
883392
883473
  if (!orgLookup.ok) {
883393
883474
  orgLookup.error._visit({
@@ -883485,7 +883566,7 @@ var RevokeTokenCommand = class {
883485
883566
  context3.stderr.error(`${Icons.error} Organization tokens cannot revoke API tokens. Unset the FERN_TOKEN environment variable and run 'fern auth login' to revoke tokens.`);
883486
883567
  throw new CliError({ code: CliError.Code.AuthError });
883487
883568
  }
883488
- const venus = createVenusService({ token: token.value });
883569
+ const venus = createVenusService({ token: token.value, headers: context3.headers });
883489
883570
  const tokenId = args.tokenId;
883490
883571
  const response = await withSpinner({
883491
883572
  message: `Revoking token "${tokenId}"`,
@@ -955887,7 +955968,7 @@ function getAutomationContextFromEnv() {
955887
955968
  config_branch: process.env.FERN_CONFIG_BRANCH,
955888
955969
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
955889
955970
  trigger: process.env.GITHUB_EVENT_NAME,
955890
- cli_version: "5.40.0"
955971
+ cli_version: "5.41.0"
955891
955972
  };
955892
955973
  }
955893
955974
  function isAutomationMode() {
@@ -956713,7 +956794,7 @@ var CliContext = class _CliContext {
956713
956794
  if (false) {
956714
956795
  this.logger.error("CLI_VERSION is not defined");
956715
956796
  }
956716
- return "5.40.0";
956797
+ return "5.41.0";
956717
956798
  }
956718
956799
  getCliName() {
956719
956800
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.40.0",
2
+ "version": "5.41.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",