@fern-api/fern-api-dev 5.34.0 → 5.35.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 +597 -237
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -6865,14 +6865,14 @@ var init_RequireInTheMiddleSingleton = __esm({
6865
6865
  { internals: true },
6866
6866
  (exports2, name2, basedir) => {
6867
6867
  const normalizedModuleName = normalizePathSeparators(name2);
6868
- const matches = this._moduleNameTrie.search(normalizedModuleName, {
6868
+ const matches2 = this._moduleNameTrie.search(normalizedModuleName, {
6869
6869
  maintainInsertionOrder: true,
6870
6870
  // For core modules (e.g. `fs`), do not match on sub-paths (e.g. `fs/promises').
6871
6871
  // This matches the behavior of `require-in-the-middle`.
6872
6872
  // `basedir` is always `undefined` for core modules.
6873
6873
  fullOnly: basedir === void 0
6874
6874
  });
6875
- for (const { onRequire } of matches) {
6875
+ for (const { onRequire } of matches2) {
6876
6876
  exports2 = onRequire(exports2, name2, basedir);
6877
6877
  }
6878
6878
  return exports2;
@@ -7939,12 +7939,12 @@ var require_utils = __commonJS({
7939
7939
  if (requestOptions.hostname && requestOptions.port) {
7940
7940
  return { hostname: requestOptions.hostname, port: requestOptions.port };
7941
7941
  }
7942
- const matches = requestOptions.host?.match(/^([^:/ ]+)(:\d{1,5})?/) || null;
7943
- const hostname4 = requestOptions.hostname || (matches === null ? "localhost" : matches[1]);
7942
+ const matches2 = requestOptions.host?.match(/^([^:/ ]+)(:\d{1,5})?/) || null;
7943
+ const hostname4 = requestOptions.hostname || (matches2 === null ? "localhost" : matches2[1]);
7944
7944
  let port = requestOptions.port;
7945
7945
  if (!port) {
7946
- if (matches && matches[2]) {
7947
- port = matches[2].substring(1);
7946
+ if (matches2 && matches2[2]) {
7947
+ port = matches2[2].substring(1);
7948
7948
  } else {
7949
7949
  port = requestOptions.protocol === "https:" ? "443" : "80";
7950
7950
  }
@@ -10249,14 +10249,14 @@ var init_RequireInTheMiddleSingleton2 = __esm({
10249
10249
  { internals: true },
10250
10250
  (exports2, name2, basedir) => {
10251
10251
  const normalizedModuleName = normalizePathSeparators2(name2);
10252
- const matches = this._moduleNameTrie.search(normalizedModuleName, {
10252
+ const matches2 = this._moduleNameTrie.search(normalizedModuleName, {
10253
10253
  maintainInsertionOrder: true,
10254
10254
  // For core modules (e.g. `fs`), do not match on sub-paths (e.g. `fs/promises').
10255
10255
  // This matches the behavior of `require-in-the-middle`.
10256
10256
  // `basedir` is always `undefined` for core modules.
10257
10257
  fullOnly: basedir === void 0
10258
10258
  });
10259
- for (const { onRequire } of matches) {
10259
+ for (const { onRequire } of matches2) {
10260
10260
  exports2 = onRequire(exports2, name2, basedir);
10261
10261
  }
10262
10262
  return exports2;
@@ -32977,18 +32977,18 @@ var require_ua_parser = __commonJS({
32977
32977
  }
32978
32978
  };
32979
32979
  var rgxMapper = function(ua7, arrays) {
32980
- var i9 = 0, j7, k5, p14, q6, matches, match3;
32981
- while (i9 < arrays.length && !matches) {
32980
+ var i9 = 0, j7, k5, p14, q6, matches2, match3;
32981
+ while (i9 < arrays.length && !matches2) {
32982
32982
  var regex5 = arrays[i9], props = arrays[i9 + 1];
32983
32983
  j7 = k5 = 0;
32984
- while (j7 < regex5.length && !matches) {
32984
+ while (j7 < regex5.length && !matches2) {
32985
32985
  if (!regex5[j7]) {
32986
32986
  break;
32987
32987
  }
32988
- matches = regex5[j7++].exec(ua7);
32989
- if (!!matches) {
32988
+ matches2 = regex5[j7++].exec(ua7);
32989
+ if (!!matches2) {
32990
32990
  for (p14 = 0; p14 < props.length; p14++) {
32991
- match3 = matches[++k5];
32991
+ match3 = matches2[++k5];
32992
32992
  q6 = props[p14];
32993
32993
  if (typeof q6 === OBJ_TYPE && q6.length > 0) {
32994
32994
  if (q6.length === 2) {
@@ -39983,11 +39983,11 @@ var require_validate = __commonJS({
39983
39983
  jsonPointer = $data;
39984
39984
  data2 = names_1.default.rootData;
39985
39985
  } else {
39986
- const matches = RELATIVE_JSON_POINTER.exec($data);
39987
- if (!matches)
39986
+ const matches2 = RELATIVE_JSON_POINTER.exec($data);
39987
+ if (!matches2)
39988
39988
  throw new Error(`Invalid JSON-pointer: ${$data}`);
39989
- const up4 = +matches[1];
39990
- jsonPointer = matches[2];
39989
+ const up4 = +matches2[1];
39990
+ jsonPointer = matches2[2];
39991
39991
  if (jsonPointer === "#") {
39992
39992
  if (up4 >= dataLevel)
39993
39993
  throw new Error(errorMsg("property/index", up4));
@@ -40684,11 +40684,11 @@ var require_schemes = __commonJS({
40684
40684
  urnComponent.error = "URN can not be parsed";
40685
40685
  return urnComponent;
40686
40686
  }
40687
- const matches = urnComponent.path.match(URN_REG);
40688
- if (matches) {
40687
+ const matches2 = urnComponent.path.match(URN_REG);
40688
+ if (matches2) {
40689
40689
  const scheme = options2.scheme || urnComponent.scheme || "urn";
40690
- urnComponent.nid = matches[1].toLowerCase();
40691
- urnComponent.nss = matches[2];
40690
+ urnComponent.nid = matches2[1].toLowerCase();
40691
+ urnComponent.nss = matches2[2];
40692
40692
  const urnScheme = `${scheme}:${options2.nid || urnComponent.nid}`;
40693
40693
  const schemeHandler = getSchemeHandler(urnScheme);
40694
40694
  urnComponent.path = void 0;
@@ -40958,8 +40958,8 @@ var require_fast_uri = __commonJS({
40958
40958
  return uriTokens.join("");
40959
40959
  }
40960
40960
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
40961
- function getParseError(parsed, matches) {
40962
- if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
40961
+ function getParseError(parsed, matches2) {
40962
+ if (matches2[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
40963
40963
  return 'URI path must start with "/" when authority is present.';
40964
40964
  }
40965
40965
  if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
@@ -40987,19 +40987,19 @@ var require_fast_uri = __commonJS({
40987
40987
  uri = "//" + uri;
40988
40988
  }
40989
40989
  }
40990
- const matches = uri.match(URI_PARSE);
40991
- if (matches) {
40992
- parsed.scheme = matches[1];
40993
- parsed.userinfo = matches[3];
40994
- parsed.host = matches[4];
40995
- parsed.port = parseInt(matches[5], 10);
40996
- parsed.path = matches[6] || "";
40997
- parsed.query = matches[7];
40998
- parsed.fragment = matches[8];
40990
+ const matches2 = uri.match(URI_PARSE);
40991
+ if (matches2) {
40992
+ parsed.scheme = matches2[1];
40993
+ parsed.userinfo = matches2[3];
40994
+ parsed.host = matches2[4];
40995
+ parsed.port = parseInt(matches2[5], 10);
40996
+ parsed.path = matches2[6] || "";
40997
+ parsed.query = matches2[7];
40998
+ parsed.fragment = matches2[8];
40999
40999
  if (isNaN(parsed.port)) {
41000
- parsed.port = matches[5];
41000
+ parsed.port = matches2[5];
41001
41001
  }
41002
- const parseError = getParseError(parsed, matches);
41002
+ const parseError = getParseError(parsed, matches2);
41003
41003
  if (parseError !== void 0) {
41004
41004
  parsed.error = parsed.error || parseError;
41005
41005
  malformedAuthorityOrPort = true;
@@ -58243,6 +58243,11 @@ var init_ClonedRepository = __esm({
58243
58243
  }
58244
58244
  await this.git.raw([...args, ...Array.isArray(files) ? files : [files]]);
58245
58245
  }
58246
+ async listTrackedFiles() {
58247
+ await this.git.cwd(this.clonePath);
58248
+ const result = await this.git.raw(["ls-tree", "-r", "HEAD", "--name-only"]);
58249
+ return result.split("\n").filter((line) => line.length > 0);
58250
+ }
58246
58251
  async restoreFilesFromCommit(commitSha, files) {
58247
58252
  await this.git.cwd(this.clonePath);
58248
58253
  const fileList = Array.isArray(files) ? files : [files];
@@ -58767,6 +58772,25 @@ var init_deleteBranch = __esm({
58767
58772
  }
58768
58773
  });
58769
58774
 
58775
+ // ../../commons/github/lib/expandFernignorePatterns.js
58776
+ function expandFernignorePatterns(fernignoreContent, candidatePaths) {
58777
+ const patterns = fernignoreContent.split("\n").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
58778
+ return candidatePaths.filter((candidate) => patterns.some((pattern) => matches(candidate, pattern)));
58779
+ }
58780
+ function matches(candidate, pattern) {
58781
+ const normalized = pattern.endsWith("/") ? pattern.slice(0, -1) : pattern;
58782
+ if (minimatch(candidate, normalized, { dot: true, nonegate: true })) {
58783
+ return true;
58784
+ }
58785
+ return candidate === normalized || candidate.startsWith(normalized + "/");
58786
+ }
58787
+ var init_expandFernignorePatterns = __esm({
58788
+ "../../commons/github/lib/expandFernignorePatterns.js"() {
58789
+ "use strict";
58790
+ init_esm11();
58791
+ }
58792
+ });
58793
+
58770
58794
  // ../../../node_modules/.pnpm/universal-user-agent@7.0.3/node_modules/universal-user-agent/index.js
58771
58795
  function getUserAgent() {
58772
58796
  if (typeof navigator === "object" && "userAgent" in navigator) {
@@ -58989,11 +59013,11 @@ function removeNonChars(variableName) {
58989
59013
  return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
58990
59014
  }
58991
59015
  function extractUrlVariableNames(url3) {
58992
- const matches = url3.match(urlVariableRegex);
58993
- if (!matches) {
59016
+ const matches2 = url3.match(urlVariableRegex);
59017
+ if (!matches2) {
58994
59018
  return [];
58995
59019
  }
58996
- return matches.map(removeNonChars).reduce((a3, b8) => a3.concat(b8), []);
59020
+ return matches2.map(removeNonChars).reduce((a3, b8) => a3.concat(b8), []);
58997
59021
  }
58998
59022
  function omit2(object23, keysToOmit) {
58999
59023
  const result = { __proto__: null };
@@ -59446,8 +59470,8 @@ async function fetchWrapper(requestOptions) {
59446
59470
  data: ""
59447
59471
  };
59448
59472
  if ("deprecation" in responseHeaders) {
59449
- const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
59450
- const deprecationLink = matches && matches.pop();
59473
+ const matches2 = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
59474
+ const deprecationLink = matches2 && matches2.pop();
59451
59475
  log4.warn(
59452
59476
  `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
59453
59477
  );
@@ -67050,6 +67074,7 @@ __export(lib_exports5, {
67050
67074
  cloneRepository: () => cloneRepository,
67051
67075
  createOrUpdatePullRequest: () => createOrUpdatePullRequest,
67052
67076
  deleteBranch: () => deleteBranch,
67077
+ expandFernignorePatterns: () => expandFernignorePatterns,
67053
67078
  getFileContent: () => getFileContent,
67054
67079
  getGithubApiBaseUrl: () => getGithubApiBaseUrl,
67055
67080
  getLatestRelease: () => getLatestRelease,
@@ -67063,6 +67088,7 @@ var init_lib9 = __esm({
67063
67088
  init_cloneRepository();
67064
67089
  init_createOrUpdatePullRequest();
67065
67090
  init_deleteBranch();
67091
+ init_expandFernignorePatterns();
67066
67092
  init_getFileContent();
67067
67093
  init_getGithubApiBaseUrl();
67068
67094
  init_getLatestRelease();
@@ -88676,11 +88702,11 @@ var require_validate2 = __commonJS({
88676
88702
  jsonPointer = $data;
88677
88703
  data2 = names_1.default.rootData;
88678
88704
  } else {
88679
- const matches = RELATIVE_JSON_POINTER.exec($data);
88680
- if (!matches)
88705
+ const matches2 = RELATIVE_JSON_POINTER.exec($data);
88706
+ if (!matches2)
88681
88707
  throw new Error(`Invalid JSON-pointer: ${$data}`);
88682
- const up4 = +matches[1];
88683
- jsonPointer = matches[2];
88708
+ const up4 = +matches2[1];
88709
+ jsonPointer = matches2[2];
88684
88710
  if (jsonPointer === "#") {
88685
88711
  if (up4 >= dataLevel)
88686
88712
  throw new Error(errorMsg("property/index", up4));
@@ -96478,8 +96504,8 @@ var require_utils21 = __commonJS({
96478
96504
  }
96479
96505
  }
96480
96506
  function regexFromString(input3) {
96481
- const matches = input3.match(/^\/(.*)\/(.*)|(.*)/);
96482
- return matches && new RegExp(matches[1] || matches[3], matches[2]);
96507
+ const matches2 = input3.match(/^\/(.*)\/(.*)|(.*)/);
96508
+ return matches2 && new RegExp(matches2[1] || matches2[3], matches2[2]);
96483
96509
  }
96484
96510
  }
96485
96511
  });
@@ -98164,8 +98190,8 @@ var require_path_excludes_patterns = __commonJS({
98164
98190
  throw new Error(`Parameter "patterns" is not provided for "path-excludes-patterns" rule`);
98165
98191
  const pathKey = key2.toString();
98166
98192
  if (pathKey.startsWith("/")) {
98167
- const matches = patterns.filter((pattern) => pathKey.match(pattern));
98168
- for (const match3 of matches) {
98193
+ const matches2 = patterns.filter((pattern) => pathKey.match(pattern));
98194
+ for (const match3 of matches2) {
98169
98195
  report({
98170
98196
  message: `path \`${pathKey}\` should not match regex pattern: \`${match3}\``,
98171
98197
  location: location2.key()
@@ -236720,10 +236746,28 @@ var init_GraphQLConverter = __esm({
236720
236746
  namespace;
236721
236747
  processingTypes = /* @__PURE__ */ new Set();
236722
236748
  types = {};
236723
- constructor({ context: context3, filePath, namespace }) {
236749
+ examplesByOperation = /* @__PURE__ */ new Map();
236750
+ constructor({ context: context3, filePath, namespace, examples }) {
236724
236751
  this.context = context3;
236725
236752
  this.filePath = filePath;
236726
236753
  this.namespace = namespace;
236754
+ if (examples != null) {
236755
+ for (const entry of examples) {
236756
+ const mapped = entry.examples.map((ex) => ({
236757
+ name: ex.name ?? void 0,
236758
+ description: ex.description ?? void 0,
236759
+ query: ex.query,
236760
+ variables: ex.variables ?? void 0,
236761
+ response: ex.response ?? void 0
236762
+ }));
236763
+ if (entry.operationType != null) {
236764
+ const key2 = `${entry.operationType.toLowerCase()}:${entry.operation}`;
236765
+ this.examplesByOperation.set(key2, mapped);
236766
+ } else {
236767
+ this.examplesByOperation.set(entry.operation, mapped);
236768
+ }
236769
+ }
236770
+ }
236727
236771
  }
236728
236772
  isBuiltInScalar(typeName) {
236729
236773
  return ["String", "Int", "Float", "Boolean", "ID"].includes(typeName);
@@ -236887,6 +236931,7 @@ var init_GraphQLConverter = __esm({
236887
236931
  }
236888
236932
  convertField(field5, name2, operationType) {
236889
236933
  const args = field5.args.map((arg) => this.convertArgument(arg));
236934
+ const examples = this.examplesByOperation.get(`${operationType.toLowerCase()}:${name2}`) ?? this.examplesByOperation.get(name2);
236890
236935
  return {
236891
236936
  id: this.getNamespacedOperationId(`${operationType.toLowerCase()}_${name2}`),
236892
236937
  operationType,
@@ -236896,7 +236941,7 @@ var init_GraphQLConverter = __esm({
236896
236941
  availability: void 0,
236897
236942
  arguments: args.length > 0 ? args : void 0,
236898
236943
  returnType: this.convertOutputType(field5.type),
236899
- examples: void 0,
236944
+ examples: examples != null && examples.length > 0 ? examples : void 0,
236900
236945
  snippets: void 0
236901
236946
  };
236902
236947
  }
@@ -257613,13 +257658,13 @@ var require_templates = __commonJS({
257613
257658
  function parseArguments(name2, arguments_) {
257614
257659
  const results = [];
257615
257660
  const chunks = arguments_.trim().split(/\s*,\s*/g);
257616
- let matches;
257661
+ let matches2;
257617
257662
  for (const chunk2 of chunks) {
257618
257663
  const number26 = Number(chunk2);
257619
257664
  if (!Number.isNaN(number26)) {
257620
257665
  results.push(number26);
257621
- } else if (matches = chunk2.match(STRING_REGEX)) {
257622
- results.push(matches[2].replace(ESCAPE_REGEX3, (m7, escape6, character) => escape6 ? unescape3(escape6) : character));
257666
+ } else if (matches2 = chunk2.match(STRING_REGEX)) {
257667
+ results.push(matches2[2].replace(ESCAPE_REGEX3, (m7, escape6, character) => escape6 ? unescape3(escape6) : character));
257623
257668
  } else {
257624
257669
  throw new Error(`Invalid Chalk template style argument: ${chunk2} (in style '${name2}')`);
257625
257670
  }
@@ -257629,11 +257674,11 @@ var require_templates = __commonJS({
257629
257674
  function parseStyle2(style2) {
257630
257675
  STYLE_REGEX.lastIndex = 0;
257631
257676
  const results = [];
257632
- let matches;
257633
- while ((matches = STYLE_REGEX.exec(style2)) !== null) {
257634
- const name2 = matches[1];
257635
- if (matches[2]) {
257636
- const args = parseArguments(name2, matches[2]);
257677
+ let matches2;
257678
+ while ((matches2 = STYLE_REGEX.exec(style2)) !== null) {
257679
+ const name2 = matches2[1];
257680
+ if (matches2[2]) {
257681
+ const args = parseArguments(name2, matches2[2]);
257637
257682
  results.push([name2].concat(args));
257638
257683
  } else {
257639
257684
  results.push([name2]);
@@ -264551,8 +264596,8 @@ var require_lib9 = __commonJS({
264551
264596
  new ascii_1.default()
264552
264597
  ];
264553
264598
  var detect2 = (buffer) => {
264554
- const matches = (0, exports2.analyse)(buffer);
264555
- return matches.length > 0 ? matches[0].name : null;
264599
+ const matches2 = (0, exports2.analyse)(buffer);
264600
+ return matches2.length > 0 ? matches2[0].name : null;
264556
264601
  };
264557
264602
  exports2.detect = detect2;
264558
264603
  var analyse = (buffer) => {
@@ -264579,14 +264624,14 @@ var require_lib9 = __commonJS({
264579
264624
  inputBytes: buffer,
264580
264625
  inputLen: buffer.length
264581
264626
  };
264582
- const matches = recognisers.map((rec) => {
264627
+ const matches2 = recognisers.map((rec) => {
264583
264628
  return rec.match(context3);
264584
264629
  }).filter((match3) => {
264585
264630
  return !!match3;
264586
264631
  }).sort((a3, b8) => {
264587
264632
  return b8.confidence - a3.confidence;
264588
264633
  });
264589
- return matches;
264634
+ return matches2;
264590
264635
  };
264591
264636
  exports2.analyse = analyse;
264592
264637
  var detectFile = (filepath, opts = {}) => new Promise((resolve15, reject) => {
@@ -328664,9 +328709,9 @@ var require_fresh = __commonJS({
328664
328709
  return false;
328665
328710
  }
328666
328711
  var etagStale = true;
328667
- var matches = parseTokenList(noneMatch);
328668
- for (var i9 = 0; i9 < matches.length; i9++) {
328669
- var match3 = matches[i9];
328712
+ var matches2 = parseTokenList(noneMatch);
328713
+ for (var i9 = 0; i9 < matches2.length; i9++) {
328714
+ var match3 = matches2[i9];
328670
328715
  if (match3 === etag || match3 === "W/" + etag || "W/" + match3 === etag) {
328671
328716
  etagStale = false;
328672
328717
  break;
@@ -360347,9 +360392,9 @@ var require_diff3 = __commonJS({
360347
360392
  }
360348
360393
  });
360349
360394
 
360350
- // ../../../node_modules/.pnpm/@fern-api+replay@0.16.1/node_modules/@fern-api/replay/dist/index.cjs
360395
+ // ../../../node_modules/.pnpm/@fern-api+replay@0.16.2/node_modules/@fern-api/replay/dist/index.cjs
360351
360396
  var require_dist14 = __commonJS({
360352
- "../../../node_modules/.pnpm/@fern-api+replay@0.16.1/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
360397
+ "../../../node_modules/.pnpm/@fern-api+replay@0.16.2/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
360353
360398
  "use strict";
360354
360399
  var __defProp4 = Object.defineProperty;
360355
360400
  var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
@@ -360866,13 +360911,13 @@ var require_dist14 = __commonJS({
360866
360911
  return SENSITIVE_FILE_PATTERNS.some((re10) => re10.test(filePath));
360867
360912
  }
360868
360913
  function scanForCredentials(content5) {
360869
- const matches = [];
360914
+ const matches2 = [];
360870
360915
  for (const { name: name2, re: re10 } of CREDENTIAL_PATTERNS) {
360871
360916
  if (re10.test(content5)) {
360872
- matches.push(name2);
360917
+ matches2.push(name2);
360873
360918
  }
360874
360919
  }
360875
- return matches;
360920
+ return matches2;
360876
360921
  }
360877
360922
  init_GitClient();
360878
360923
  var FERN_BOT_NAME = "fern-api";
@@ -360917,7 +360962,7 @@ var require_dist14 = __commonJS({
360917
360962
  }
360918
360963
  var import_node_fs32 = require("fs");
360919
360964
  var import_node_path42 = require("path");
360920
- var import_minimatch8 = require_commonjs3();
360965
+ var import_minimatch9 = require_commonjs3();
360921
360966
  var import_yaml18 = require_dist11();
360922
360967
  var LOCKFILE_HEADER = "# DO NOT EDIT MANUALLY - Managed by Fern Replay\n";
360923
360968
  var LockfileNotFoundError = class extends Error {
@@ -361015,7 +361060,7 @@ var require_dist14 = __commonJS({
361015
361060
  reasons.push(`sensitive files: ${sensitiveFiles.join(", ")}`);
361016
361061
  }
361017
361062
  const allProtected = patch5.files.length > 0 && patch5.files.every(
361018
- (f4) => this.fernignorePatterns.some((p14) => f4 === p14 || (0, import_minimatch8.minimatch)(f4, p14))
361063
+ (f4) => this.fernignorePatterns.some((p14) => f4 === p14 || (0, import_minimatch9.minimatch)(f4, p14))
361019
361064
  );
361020
361065
  if (!allProtected) {
361021
361066
  this.warnings.push(
@@ -361128,6 +361173,7 @@ var require_dist14 = __commonJS({
361128
361173
  }
361129
361174
  };
361130
361175
  var import_node_crypto7 = require("crypto");
361176
+ var import_minimatch22 = require_commonjs3();
361131
361177
  var import_node_path210 = require("path");
361132
361178
  var BINARY_EXTENSIONS2 = /* @__PURE__ */ new Set([
361133
361179
  ".png",
@@ -361183,6 +361229,15 @@ var require_dist14 = __commonJS({
361183
361229
  return BINARY_EXTENSIONS2.has(ext2);
361184
361230
  }
361185
361231
  var INFRASTRUCTURE_FILES = /* @__PURE__ */ new Set([".fernignore"]);
361232
+ function matchesFernignorePattern(filePath, patterns) {
361233
+ if (patterns.length === 0) return false;
361234
+ return patterns.some((p14) => {
361235
+ if (filePath === p14) return true;
361236
+ if ((0, import_minimatch22.minimatch)(filePath, p14)) return true;
361237
+ if (!p14.includes("*") && !p14.includes("?") && filePath.startsWith(p14 + "/")) return true;
361238
+ return false;
361239
+ });
361240
+ }
361186
361241
  function parsePatchFileHeaders(patchContent) {
361187
361242
  const results = [];
361188
361243
  let currentPath = null;
@@ -361223,21 +361278,25 @@ var require_dist14 = __commonJS({
361223
361278
  }
361224
361279
  return snapshot;
361225
361280
  }
361226
- function filterInfrastructureAndSensitiveFiles(rawFilesOutput) {
361281
+ function filterInfrastructureAndSensitiveFiles(rawFilesOutput, fernignorePatterns) {
361227
361282
  const allFiles = rawFilesOutput.trim().split("\n").filter(Boolean).filter((f4) => !INFRASTRUCTURE_FILES.has(f4)).filter((f4) => !f4.startsWith(".fern/"));
361228
361283
  const sensitiveFiles = allFiles.filter((f4) => isSensitiveFile(f4));
361229
- const files = allFiles.filter((f4) => !isSensitiveFile(f4));
361230
- return { files, sensitiveFiles };
361284
+ const nonSensitive = allFiles.filter((f4) => !isSensitiveFile(f4));
361285
+ const fernignoredFiles = nonSensitive.filter((f4) => matchesFernignorePattern(f4, fernignorePatterns));
361286
+ const files = nonSensitive.filter((f4) => !matchesFernignorePattern(f4, fernignorePatterns));
361287
+ return { files, sensitiveFiles, fernignoredFiles };
361231
361288
  }
361232
361289
  var ReplayDetector = class {
361233
361290
  git;
361234
361291
  lockManager;
361235
361292
  sdkOutputDir;
361293
+ fernignorePatterns;
361236
361294
  warnings = [];
361237
- constructor(git, lockManager, sdkOutputDir) {
361295
+ constructor(git, lockManager, sdkOutputDir, fernignorePatterns = []) {
361238
361296
  this.git = git;
361239
361297
  this.lockManager = lockManager;
361240
361298
  this.sdkOutputDir = sdkOutputDir;
361299
+ this.fernignorePatterns = fernignorePatterns;
361241
361300
  }
361242
361301
  /**
361243
361302
  * Derive the previous-generation SHA from git history instead of trusting
@@ -361344,22 +361403,30 @@ var require_dist14 = __commonJS({
361344
361403
  continue;
361345
361404
  }
361346
361405
  const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
361347
- const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(filesOutput);
361406
+ const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
361407
+ filesOutput,
361408
+ this.fernignorePatterns
361409
+ );
361348
361410
  if (sensitiveFiles.length > 0) {
361349
361411
  this.warnings.push(
361350
361412
  `Sensitive file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
361351
361413
  );
361352
- if (files.length > 0) {
361353
- const parentSha = parents[0];
361354
- if (parentSha) {
361355
- try {
361356
- patchContent = await this.git.exec(["diff", parentSha, commit.sha, "--", ...files]);
361357
- } catch {
361358
- continue;
361359
- }
361360
- if (!patchContent.trim()) continue;
361361
- contentHash = this.computeContentHash(patchContent);
361414
+ }
361415
+ if (fernignoredFiles.length > 0) {
361416
+ this.warnings.push(
361417
+ `.fernignore-protected file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
361418
+ );
361419
+ }
361420
+ if ((sensitiveFiles.length > 0 || fernignoredFiles.length > 0) && files.length > 0) {
361421
+ const parentSha = parents[0];
361422
+ if (parentSha) {
361423
+ try {
361424
+ patchContent = await this.git.exec(["diff", parentSha, commit.sha, "--", ...files]);
361425
+ } catch {
361426
+ continue;
361362
361427
  }
361428
+ if (!patchContent.trim()) continue;
361429
+ contentHash = this.computeContentHash(patchContent);
361363
361430
  }
361364
361431
  }
361365
361432
  if (files.length === 0) {
@@ -361558,12 +361625,20 @@ var require_dist14 = __commonJS({
361558
361625
  resolvedBaseGeneration = fallback2;
361559
361626
  }
361560
361627
  const filesOutput = await this.git.exec(["diff", "--name-only", diffBase, "HEAD"]);
361561
- const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(filesOutput);
361628
+ const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
361629
+ filesOutput,
361630
+ this.fernignorePatterns
361631
+ );
361562
361632
  if (sensitiveFiles.length > 0) {
361563
361633
  this.warnings.push(
361564
361634
  `Sensitive file(s) excluded from composite patch: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
361565
361635
  );
361566
361636
  }
361637
+ if (fernignoredFiles.length > 0) {
361638
+ this.warnings.push(
361639
+ `.fernignore-protected file(s) excluded from composite patch: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
361640
+ );
361641
+ }
361567
361642
  if (files.length === 0) return { patches: [], revertedPatchIds: [] };
361568
361643
  const diff2 = await this.git.exec(["diff", diffBase, "HEAD", "--", ...files]);
361569
361644
  if (!diff2.trim()) return { patches: [], revertedPatchIds: [] };
@@ -361646,23 +361721,31 @@ var require_dist14 = __commonJS({
361646
361721
  continue;
361647
361722
  }
361648
361723
  const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
361649
- const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(filesOutput);
361724
+ const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
361725
+ filesOutput,
361726
+ this.fernignorePatterns
361727
+ );
361650
361728
  if (sensitiveFiles.length > 0) {
361651
361729
  this.warnings.push(
361652
361730
  `Sensitive file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
361653
361731
  );
361654
- if (files.length > 0) {
361655
- if (parents.length === 0) {
361656
- continue;
361657
- }
361658
- try {
361659
- patchContent = await this.git.exec(["diff", parents[0], commit.sha, "--", ...files]);
361660
- } catch {
361661
- continue;
361662
- }
361663
- if (!patchContent.trim()) continue;
361664
- contentHash = this.computeContentHash(patchContent);
361732
+ }
361733
+ if (fernignoredFiles.length > 0) {
361734
+ this.warnings.push(
361735
+ `.fernignore-protected file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
361736
+ );
361737
+ }
361738
+ if ((sensitiveFiles.length > 0 || fernignoredFiles.length > 0) && files.length > 0) {
361739
+ if (parents.length === 0) {
361740
+ continue;
361665
361741
  }
361742
+ try {
361743
+ patchContent = await this.git.exec(["diff", parents[0], commit.sha, "--", ...files]);
361744
+ } catch {
361745
+ continue;
361746
+ }
361747
+ if (!patchContent.trim()) continue;
361748
+ contentHash = this.computeContentHash(patchContent);
361666
361749
  }
361667
361750
  if (files.length === 0) {
361668
361751
  continue;
@@ -361894,7 +361977,7 @@ var require_dist14 = __commonJS({
361894
361977
  var import_promises310 = require("fs/promises");
361895
361978
  var import_node_os15 = require("os");
361896
361979
  var import_node_path52 = require("path");
361897
- var import_minimatch22 = require_commonjs3();
361980
+ var import_minimatch32 = require_commonjs3();
361898
361981
  var MergeAccumulator = class {
361899
361982
  constructor(mode, sharedFiles) {
361900
361983
  this.mode = mode;
@@ -362598,13 +362681,13 @@ var require_dist14 = __commonJS({
362598
362681
  isExcluded(patch5) {
362599
362682
  const config5 = this.lockManager.getCustomizationsConfig();
362600
362683
  if (!config5.exclude) return false;
362601
- return patch5.files.some((file4) => config5.exclude.some((pattern) => (0, import_minimatch22.minimatch)(file4, pattern)));
362684
+ return patch5.files.some((file4) => config5.exclude.some((pattern) => (0, import_minimatch32.minimatch)(file4, pattern)));
362602
362685
  }
362603
362686
  async resolveFilePath(filePath, baseTreeHash, currentTreeHash) {
362604
362687
  const config5 = this.lockManager.getCustomizationsConfig();
362605
362688
  if (config5.moves) {
362606
362689
  for (const move of config5.moves) {
362607
- if ((0, import_minimatch22.minimatch)(filePath, move.from) || filePath === move.from) {
362690
+ if ((0, import_minimatch32.minimatch)(filePath, move.from) || filePath === move.from) {
362608
362691
  if (filePath === move.from) {
362609
362692
  return move.to;
362610
362693
  }
@@ -362891,7 +362974,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
362891
362974
  var import_node_fs210 = require("fs");
362892
362975
  var import_promises610 = require("fs/promises");
362893
362976
  var import_node_path82 = require("path");
362894
- var import_minimatch42 = require_commonjs3();
362977
+ var import_minimatch52 = require_commonjs3();
362895
362978
  init_GitClient();
362896
362979
  var import_promises410 = require("fs/promises");
362897
362980
  var import_node_os22 = require("os");
@@ -363194,7 +363277,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363194
363277
  const trailer = hasTrailingNewline ? "" : "\n\";
363195
363278
  return header + "\n" + body + trailer + "\n";
363196
363279
  }
363197
- var import_minimatch32 = require_commonjs3();
363280
+ var import_minimatch42 = require_commonjs3();
363198
363281
  var FileOwnership = class {
363199
363282
  constructor(git) {
363200
363283
  this.git = git;
@@ -363218,7 +363301,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363218
363301
  const { file: file4, originalFileName, patch: patch5, currentGenSha, fernignorePatterns, warnedGens, warnings } = ctx;
363219
363302
  if (patch5.user_owned) return true;
363220
363303
  if (file4 === ".fernignore") return true;
363221
- if (fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch32.minimatch)(file4, p14))) return true;
363304
+ if (fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))) return true;
363222
363305
  if (fileIsCreationInPatchContent(patch5.patch_content, originalFileName ?? file4)) {
363223
363306
  return true;
363224
363307
  }
@@ -363714,7 +363797,8 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363714
363797
  this.git = git;
363715
363798
  this.outputDir = outputDir;
363716
363799
  this.lockManager = new LockfileManager(outputDir);
363717
- this.detector = new ReplayDetector(git, this.lockManager, outputDir);
363800
+ const fernignorePatterns = this.readFernignorePatterns();
363801
+ this.detector = new ReplayDetector(git, this.lockManager, outputDir, fernignorePatterns);
363718
363802
  this.applicator = new ReplayApplicator(git, this.lockManager, outputDir);
363719
363803
  this.committer = new ReplayCommitter(git, outputDir);
363720
363804
  this.fileOwnership = new FileOwnership(git);
@@ -363734,8 +363818,60 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363734
363818
  async prepareReplay(options2) {
363735
363819
  this.warnings = [];
363736
363820
  this.detector.warnings.length = 0;
363821
+ this.cleanseLegacyFernignoreEntries();
363737
363822
  return this.selectFlow(options2).prepare(options2);
363738
363823
  }
363824
+ /**
363825
+ * ADR 0002 migration step. Strips `.fernignore`-matched entries from
363826
+ * `patch.files`, `patch.theirs_snapshot` keys, and `diff --git` sections
363827
+ * in `patch.patch_content` for every patch in the lockfile. Patches that
363828
+ * end up with no surviving files are removed entirely.
363829
+ *
363830
+ * Idempotent: a second run is a no-op because the first run already
363831
+ * matches the contract. Per-patch try/catch ensures one bad patch does
363832
+ * not block the rest. Each affected patch emits a warning naming the
363833
+ * stripped paths. `patch_content` is left untouched if no parseable
363834
+ * `diff --git` headers are found (fail-safe for exotic legacy formats).
363835
+ */
363836
+ cleanseLegacyFernignoreEntries() {
363837
+ const patterns = this.readFernignorePatterns();
363838
+ if (patterns.length === 0) return;
363839
+ if (!this.lockManager.exists()) return;
363840
+ this.lockManager.read();
363841
+ let lockfileMutated = false;
363842
+ const patches = this.lockManager.getPatches();
363843
+ for (const patch5 of patches) {
363844
+ try {
363845
+ const result = computeLegacyFernignoreCleanse(
363846
+ patch5,
363847
+ patterns,
363848
+ (content5) => this.detector.computeContentHash(content5)
363849
+ );
363850
+ if (result.unchanged) continue;
363851
+ if (result.remove) {
363852
+ this.lockManager.removePatch(patch5.id);
363853
+ this.warnings.push(
363854
+ `Cleansed legacy patch ${patch5.id}: all referenced files match .fernignore \u2014 patch removed. Customer's on-disk content for those files is preserved by .fernignore. (ADR 0002: .fernignore-protected files are not tracked by Replay.)`
363855
+ );
363856
+ } else {
363857
+ this.lockManager.updatePatch(patch5.id, {
363858
+ files: result.files,
363859
+ patch_content: result.patch_content,
363860
+ content_hash: result.content_hash,
363861
+ ...result.theirs_snapshot !== void 0 ? { theirs_snapshot: result.theirs_snapshot } : {}
363862
+ });
363863
+ this.warnings.push(
363864
+ `Cleansed legacy patch ${patch5.id}: stripped .fernignore-matched entries (${result.strippedPaths.join(", ")}). Customer's on-disk content for those files is preserved by .fernignore. (ADR 0002.)`
363865
+ );
363866
+ }
363867
+ lockfileMutated = true;
363868
+ } catch {
363869
+ }
363870
+ }
363871
+ if (lockfileMutated) {
363872
+ this.lockManager.save();
363873
+ }
363874
+ }
363739
363875
  /**
363740
363876
  * Phase 2 of the two-phase replay flow. Applies patches, rebases them against
363741
363877
  * the generation, saves the lockfile, and commits `[fern-replay]` (or stages
@@ -363867,7 +364003,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363867
364003
  )
363868
364004
  );
363869
364005
  const hasProtectedFiles = patch5.files.some(
363870
- (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
364006
+ (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch52.minimatch)(file4, p14))
363871
364007
  );
363872
364008
  const allUserOwned = isUserOwnedPerFile.every(Boolean);
363873
364009
  if (allUserOwned && patch5.files.length > 0) {
@@ -364307,7 +364443,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
364307
364443
  );
364308
364444
  if (snapHasStaleMarkers) continue;
364309
364445
  const isProtectedSnap = patch5.files.some(
364310
- (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
364446
+ (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch52.minimatch)(file4, p14))
364311
364447
  );
364312
364448
  if (isProtectedSnap) continue;
364313
364449
  const snapHash = this.detector.computeContentHash(snapshotDiff);
@@ -364347,7 +364483,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
364347
364483
  continue;
364348
364484
  }
364349
364485
  const isProtected = patch5.files.some(
364350
- (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
364486
+ (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch52.minimatch)(file4, p14))
364351
364487
  );
364352
364488
  if (isProtected) {
364353
364489
  continue;
@@ -364511,7 +364647,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364511
364647
  if (files.length === 0) return;
364512
364648
  const fernignorePatterns = this.readFernignorePatterns();
364513
364649
  for (const file4 of files) {
364514
- if (fernignorePatterns.some((pattern) => (0, import_minimatch42.minimatch)(file4, pattern))) continue;
364650
+ if (fernignorePatterns.some((pattern) => (0, import_minimatch52.minimatch)(file4, pattern))) continue;
364515
364651
  try {
364516
364652
  await this.git.exec(["checkout", "HEAD", "--", file4]);
364517
364653
  } catch {
@@ -364596,10 +364732,97 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364596
364732
  }
364597
364733
  return { applied, unresolved, absorbed };
364598
364734
  }
364735
+ function computeLegacyFernignoreCleanse(patch5, fernignorePatterns, computeContentHash2) {
364736
+ const matchesFernignore = (filePath) => fernignorePatterns.some((p14) => {
364737
+ if (filePath === p14) return true;
364738
+ if ((0, import_minimatch52.minimatch)(filePath, p14)) return true;
364739
+ if (!p14.includes("*") && !p14.includes("?") && filePath.startsWith(p14 + "/")) return true;
364740
+ return false;
364741
+ });
364742
+ const strippedFromFiles = patch5.files.filter(matchesFernignore);
364743
+ const survivingFiles = patch5.files.filter((f4) => !matchesFernignore(f4));
364744
+ let survivingSnapshot = void 0;
364745
+ let snapshotChanged = false;
364746
+ if (patch5.theirs_snapshot) {
364747
+ survivingSnapshot = {};
364748
+ for (const [key2, value2] of Object.entries(patch5.theirs_snapshot)) {
364749
+ if (matchesFernignore(key2)) {
364750
+ snapshotChanged = true;
364751
+ } else {
364752
+ survivingSnapshot[key2] = value2;
364753
+ }
364754
+ }
364755
+ }
364756
+ const { stripped: patchContentStripped, content: newPatchContent, strippedSectionPaths } = stripFernignoreDiffSections(patch5.patch_content, matchesFernignore);
364757
+ const unchanged = strippedFromFiles.length === 0 && !snapshotChanged && !patchContentStripped;
364758
+ if (unchanged) {
364759
+ return {
364760
+ unchanged: true,
364761
+ remove: false,
364762
+ files: patch5.files,
364763
+ patch_content: patch5.patch_content,
364764
+ content_hash: patch5.content_hash,
364765
+ theirs_snapshot: patch5.theirs_snapshot,
364766
+ strippedPaths: []
364767
+ };
364768
+ }
364769
+ const strippedPaths = Array.from(/* @__PURE__ */ new Set([...strippedFromFiles, ...strippedSectionPaths]));
364770
+ if (survivingFiles.length === 0 || newPatchContent.trim() === "") {
364771
+ return {
364772
+ unchanged: false,
364773
+ remove: true,
364774
+ files: [],
364775
+ patch_content: "",
364776
+ content_hash: "",
364777
+ strippedPaths
364778
+ };
364779
+ }
364780
+ const newContentHash = patchContentStripped ? computeContentHash2(newPatchContent) : patch5.content_hash;
364781
+ return {
364782
+ unchanged: false,
364783
+ remove: false,
364784
+ files: survivingFiles,
364785
+ patch_content: newPatchContent,
364786
+ content_hash: newContentHash,
364787
+ ...survivingSnapshot !== void 0 ? { theirs_snapshot: survivingSnapshot } : {},
364788
+ strippedPaths
364789
+ };
364790
+ }
364791
+ function stripFernignoreDiffSections(patchContent, matchesFernignore) {
364792
+ const lines = patchContent.split("\n");
364793
+ const sectionStarts = [];
364794
+ for (let i9 = 0; i9 < lines.length; i9++) {
364795
+ const line = lines[i9];
364796
+ if (line.startsWith("diff --git ")) {
364797
+ const match3 = line.match(/^diff --git a\/(.+?) b\/(.+?)$/);
364798
+ const path115 = match3 ? match3[2] : null;
364799
+ sectionStarts.push({ idx: i9, path: path115 });
364800
+ }
364801
+ }
364802
+ if (sectionStarts.length === 0) {
364803
+ return { stripped: false, content: patchContent, strippedSectionPaths: [] };
364804
+ }
364805
+ const preamble = lines.slice(0, sectionStarts[0].idx);
364806
+ const newLines = [...preamble];
364807
+ const strippedSectionPaths = [];
364808
+ let stripped = false;
364809
+ for (let i9 = 0; i9 < sectionStarts.length; i9++) {
364810
+ const section = sectionStarts[i9];
364811
+ const next2 = sectionStarts[i9 + 1];
364812
+ const endIdx = next2 ? next2.idx : lines.length;
364813
+ if (section.path !== null && matchesFernignore(section.path)) {
364814
+ stripped = true;
364815
+ strippedSectionPaths.push(section.path);
364816
+ continue;
364817
+ }
364818
+ newLines.push(...lines.slice(section.idx, endIdx));
364819
+ }
364820
+ return { stripped, content: newLines.join("\n"), strippedSectionPaths };
364821
+ }
364599
364822
  var import_node_crypto22 = require("crypto");
364600
364823
  var import_node_fs33 = require("fs");
364601
364824
  var import_node_path92 = require("path");
364602
- var import_minimatch52 = require_commonjs3();
364825
+ var import_minimatch62 = require_commonjs3();
364603
364826
  var import_yaml22 = require_dist11();
364604
364827
  var FernignoreMigrator = class {
364605
364828
  git;
@@ -364631,7 +364854,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364631
364854
  const commitsOnly = [];
364632
364855
  const syntheticPatches = [];
364633
364856
  for (const pattern of patterns) {
364634
- const matchingPatch = patches.find((p14) => p14.files.some((f4) => (0, import_minimatch52.minimatch)(f4, pattern) || f4 === pattern));
364857
+ const matchingPatch = patches.find((p14) => p14.files.some((f4) => (0, import_minimatch62.minimatch)(f4, pattern) || f4 === pattern));
364635
364858
  if (matchingPatch) {
364636
364859
  trackedByBoth.push({
364637
364860
  file: pattern,
@@ -364704,7 +364927,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364704
364927
  fernignoreOnly.push(...remainingFernignoreOnly);
364705
364928
  }
364706
364929
  for (const patch5 of patches) {
364707
- const hasUnprotectedFiles = patch5.files.some((f4) => !patterns.some((p14) => (0, import_minimatch52.minimatch)(f4, p14) || f4 === p14));
364930
+ const hasUnprotectedFiles = patch5.files.some((f4) => !patterns.some((p14) => (0, import_minimatch62.minimatch)(f4, p14) || f4 === p14));
364708
364931
  if (hasUnprotectedFiles) {
364709
364932
  commitsOnly.push(patch5);
364710
364933
  }
@@ -364716,7 +364939,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364716
364939
  const results = [];
364717
364940
  for (const pattern of patterns) {
364718
364941
  const matching = allFiles.filter(
364719
- (f4) => (0, import_minimatch52.minimatch)(f4, pattern) || f4 === pattern || f4.startsWith(pattern + "/")
364942
+ (f4) => (0, import_minimatch62.minimatch)(f4, pattern) || f4 === pattern || f4.startsWith(pattern + "/")
364720
364943
  );
364721
364944
  results.push({ pattern, files: matching.length > 0 ? matching : [pattern] });
364722
364945
  }
@@ -365025,7 +365248,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
365025
365248
  const normalized = relevantLines.filter((line) => !line.startsWith("index ")).join("\n").replace(/\n-- \n[\d]+\.[\d]+[^\n]*\s*$/, "");
365026
365249
  return `sha256:${(0, import_node_crypto32.createHash)("sha256").update(normalized).digest("hex")}`;
365027
365250
  }
365028
- var import_minimatch62 = require_commonjs3();
365251
+ var import_minimatch72 = require_commonjs3();
365029
365252
  function parseDiffStat(patchContent) {
365030
365253
  let additions = 0;
365031
365254
  let deletions = 0;
@@ -365055,7 +365278,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
365055
365278
  }
365056
365279
  function matchesPatch(patch5, pattern) {
365057
365280
  const fileMatch = patch5.files.some(
365058
- (file4) => file4 === pattern || (0, import_minimatch62.minimatch)(file4, pattern)
365281
+ (file4) => file4 === pattern || (0, import_minimatch72.minimatch)(file4, pattern)
365059
365282
  );
365060
365283
  if (fileMatch) return true;
365061
365284
  return patch5.original_message.toLowerCase().includes(pattern.toLowerCase());
@@ -365916,11 +366139,11 @@ function removeNonChars2(variableName) {
365916
366139
  return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
365917
366140
  }
365918
366141
  function extractUrlVariableNames2(url3) {
365919
- const matches = url3.match(urlVariableRegex2);
365920
- if (!matches) {
366142
+ const matches2 = url3.match(urlVariableRegex2);
366143
+ if (!matches2) {
365921
366144
  return [];
365922
366145
  }
365923
- return matches.map(removeNonChars2).reduce((a3, b8) => a3.concat(b8), []);
366146
+ return matches2.map(removeNonChars2).reduce((a3, b8) => a3.concat(b8), []);
365924
366147
  }
365925
366148
  function omit4(object23, keysToOmit) {
365926
366149
  const result = { __proto__: null };
@@ -366482,8 +366705,8 @@ async function fetchWrapper2(requestOptions) {
366482
366705
  data: ""
366483
366706
  };
366484
366707
  if ("deprecation" in responseHeaders) {
366485
- const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
366486
- const deprecationLink = matches && matches.pop();
366708
+ const matches2 = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
366709
+ const deprecationLink = matches2 && matches2.pop();
366487
366710
  log4.warn(
366488
366711
  `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
366489
366712
  );
@@ -373087,12 +373310,12 @@ var require_isMatchWith = __commonJS({
373087
373310
  continue;
373088
373311
  }
373089
373312
  const targetItem = target[j7];
373090
- let matches = false;
373313
+ let matches2 = false;
373091
373314
  const isEqual3 = compare2(targetItem, sourceItem, i9, target, source2, stack);
373092
373315
  if (isEqual3) {
373093
- matches = true;
373316
+ matches2 = true;
373094
373317
  }
373095
- if (matches) {
373318
+ if (matches2) {
373096
373319
  countedIndex.add(j7);
373097
373320
  found = true;
373098
373321
  break;
@@ -373430,13 +373653,13 @@ var require_matches = __commonJS({
373430
373653
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
373431
373654
  var isMatch = require_isMatch();
373432
373655
  var cloneDeep = require_cloneDeep();
373433
- function matches(source2) {
373656
+ function matches2(source2) {
373434
373657
  source2 = cloneDeep.cloneDeep(source2);
373435
373658
  return (target) => {
373436
373659
  return isMatch.isMatch(target, source2);
373437
373660
  };
373438
373661
  }
373439
- exports2.matches = matches;
373662
+ exports2.matches = matches2;
373440
373663
  }
373441
373664
  });
373442
373665
 
@@ -373621,7 +373844,7 @@ var require_iteratee = __commonJS({
373621
373844
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
373622
373845
  var identity5 = require_identity3();
373623
373846
  var property24 = require_property2();
373624
- var matches = require_matches();
373847
+ var matches2 = require_matches();
373625
373848
  var matchesProperty = require_matchesProperty();
373626
373849
  function iteratee(value2) {
373627
373850
  if (value2 == null) {
@@ -373635,7 +373858,7 @@ var require_iteratee = __commonJS({
373635
373858
  if (Array.isArray(value2) && value2.length === 2) {
373636
373859
  return matchesProperty.matchesProperty(value2[0], value2[1]);
373637
373860
  }
373638
- return matches.matches(value2);
373861
+ return matches2.matches(value2);
373639
373862
  }
373640
373863
  case "string":
373641
373864
  case "symbol":
@@ -374032,7 +374255,7 @@ var require_dropRightWhile2 = __commonJS({
374032
374255
  var identity5 = require_identity3();
374033
374256
  var property24 = require_property2();
374034
374257
  var isArrayLike4 = require_isArrayLike2();
374035
- var matches = require_matches();
374258
+ var matches2 = require_matches();
374036
374259
  var matchesProperty = require_matchesProperty();
374037
374260
  function dropRightWhile(arr, predicate = identity5.identity) {
374038
374261
  if (!isArrayLike4.isArrayLike(arr)) {
@@ -374051,7 +374274,7 @@ var require_dropRightWhile2 = __commonJS({
374051
374274
  const value2 = predicate[1];
374052
374275
  return dropRightWhile$1.dropRightWhile(arr, matchesProperty.matchesProperty(key2, value2));
374053
374276
  } else {
374054
- return dropRightWhile$1.dropRightWhile(arr, matches.matches(predicate));
374277
+ return dropRightWhile$1.dropRightWhile(arr, matches2.matches(predicate));
374055
374278
  }
374056
374279
  }
374057
374280
  case "symbol":
@@ -374091,7 +374314,7 @@ var require_dropWhile2 = __commonJS({
374091
374314
  var toArray4 = require_toArray2();
374092
374315
  var property24 = require_property2();
374093
374316
  var isArrayLike4 = require_isArrayLike2();
374094
- var matches = require_matches();
374317
+ var matches2 = require_matches();
374095
374318
  var matchesProperty = require_matchesProperty();
374096
374319
  function dropWhile(arr, predicate = identity5.identity) {
374097
374320
  if (!isArrayLike4.isArrayLike(arr)) {
@@ -374110,7 +374333,7 @@ var require_dropWhile2 = __commonJS({
374110
374333
  const value2 = predicate[1];
374111
374334
  return dropWhile$1.dropWhile(arr, matchesProperty.matchesProperty(key2, value2));
374112
374335
  } else {
374113
- return dropWhile$1.dropWhile(arr, matches.matches(predicate));
374336
+ return dropWhile$1.dropWhile(arr, matches2.matches(predicate));
374114
374337
  }
374115
374338
  }
374116
374339
  case "number":
@@ -374233,7 +374456,7 @@ var require_every2 = __commonJS({
374233
374456
  var isIterateeCall2 = require_isIterateeCall();
374234
374457
  var property24 = require_property2();
374235
374458
  var isArrayLike4 = require_isArrayLike2();
374236
- var matches = require_matches();
374459
+ var matches2 = require_matches();
374237
374460
  var matchesProperty = require_matchesProperty();
374238
374461
  function every(source2, doesMatch, guard) {
374239
374462
  if (!source2) {
@@ -374257,7 +374480,7 @@ var require_every2 = __commonJS({
374257
374480
  const value2 = doesMatch[1];
374258
374481
  predicate = matchesProperty.matchesProperty(key2, value2);
374259
374482
  } else {
374260
- predicate = matches.matches(doesMatch);
374483
+ predicate = matches2.matches(doesMatch);
374261
374484
  }
374262
374485
  break;
374263
374486
  }
@@ -374439,7 +374662,7 @@ var require_findIndex2 = __commonJS({
374439
374662
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
374440
374663
  var identity5 = require_identity4();
374441
374664
  var property24 = require_property2();
374442
- var matches = require_matches();
374665
+ var matches2 = require_matches();
374443
374666
  var matchesProperty = require_matchesProperty();
374444
374667
  function findIndex(arr, doesMatch = identity5.identity, fromIndex = 0) {
374445
374668
  if (!arr) {
@@ -374461,7 +374684,7 @@ var require_findIndex2 = __commonJS({
374461
374684
  const value2 = doesMatch[1];
374462
374685
  index3 = subArray.findIndex(matchesProperty.matchesProperty(key2, value2));
374463
374686
  } else {
374464
- index3 = subArray.findIndex(matches.matches(doesMatch));
374687
+ index3 = subArray.findIndex(matches2.matches(doesMatch));
374465
374688
  }
374466
374689
  break;
374467
374690
  }
@@ -374522,7 +374745,7 @@ var require_findLastIndex = __commonJS({
374522
374745
  var identity5 = require_identity3();
374523
374746
  var toArray4 = require_toArray2();
374524
374747
  var property24 = require_property2();
374525
- var matches = require_matches();
374748
+ var matches2 = require_matches();
374526
374749
  var matchesProperty = require_matchesProperty();
374527
374750
  function findLastIndex(arr, doesMatch = identity5.identity, fromIndex = arr ? arr.length - 1 : 0) {
374528
374751
  if (!arr) {
@@ -374544,7 +374767,7 @@ var require_findLastIndex = __commonJS({
374544
374767
  const value2 = doesMatch[1];
374545
374768
  return subArray.findLastIndex(matchesProperty.matchesProperty(key2, value2));
374546
374769
  } else {
374547
- return subArray.findLastIndex(matches.matches(doesMatch));
374770
+ return subArray.findLastIndex(matches2.matches(doesMatch));
374548
374771
  }
374549
374772
  }
374550
374773
  case "number":
@@ -376193,7 +376416,7 @@ var require_some = __commonJS({
376193
376416
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
376194
376417
  var identity5 = require_identity3();
376195
376418
  var property24 = require_property2();
376196
- var matches = require_matches();
376419
+ var matches2 = require_matches();
376197
376420
  var matchesProperty = require_matchesProperty();
376198
376421
  function some(source2, predicate, guard) {
376199
376422
  if (!source2) {
@@ -376241,7 +376464,7 @@ var require_some = __commonJS({
376241
376464
  }
376242
376465
  return values2.some(matchFunc);
376243
376466
  } else {
376244
- const matchFunc = matches.matches(predicate);
376467
+ const matchFunc = matches2.matches(predicate);
376245
376468
  if (Array.isArray(source2)) {
376246
376469
  for (let i9 = 0; i9 < source2.length; i9++) {
376247
376470
  if (matchFunc(source2[i9])) {
@@ -382726,7 +382949,7 @@ var require_compat = __commonJS({
382726
382949
  var isTypedArray3 = require_isTypedArray2();
382727
382950
  var isWeakMap = require_isWeakMap2();
382728
382951
  var isWeakSet = require_isWeakSet2();
382729
- var matches = require_matches();
382952
+ var matches2 = require_matches();
382730
382953
  var matchesProperty = require_matchesProperty();
382731
382954
  var capitalize2 = require_capitalize2();
382732
382955
  var bindAll = require_bindAll();
@@ -383022,7 +383245,7 @@ var require_compat = __commonJS({
383022
383245
  exports2.isTypedArray = isTypedArray3.isTypedArray;
383023
383246
  exports2.isWeakMap = isWeakMap.isWeakMap;
383024
383247
  exports2.isWeakSet = isWeakSet.isWeakSet;
383025
- exports2.matches = matches.matches;
383248
+ exports2.matches = matches2.matches;
383026
383249
  exports2.matchesProperty = matchesProperty.matchesProperty;
383027
383250
  exports2.capitalize = capitalize2.capitalize;
383028
383251
  exports2.bindAll = bindAll.bindAll;
@@ -383338,7 +383561,7 @@ var require_compat2 = __commonJS({
383338
383561
  var isTypedArray3 = require_isTypedArray2();
383339
383562
  var isWeakMap = require_isWeakMap2();
383340
383563
  var isWeakSet = require_isWeakSet2();
383341
- var matches = require_matches();
383564
+ var matches2 = require_matches();
383342
383565
  var matchesProperty = require_matchesProperty();
383343
383566
  var capitalize2 = require_capitalize2();
383344
383567
  var bindAll = require_bindAll();
@@ -383635,7 +383858,7 @@ var require_compat2 = __commonJS({
383635
383858
  exports2.isTypedArray = isTypedArray3.isTypedArray;
383636
383859
  exports2.isWeakMap = isWeakMap.isWeakMap;
383637
383860
  exports2.isWeakSet = isWeakSet.isWeakSet;
383638
- exports2.matches = matches.matches;
383861
+ exports2.matches = matches2.matches;
383639
383862
  exports2.matchesProperty = matchesProperty.matchesProperty;
383640
383863
  exports2.capitalize = capitalize2.capitalize;
383641
383864
  exports2.bindAll = bindAll.bindAll;
@@ -392345,15 +392568,8 @@ var require_GitHub = __commonJS({
392345
392568
  if (fernignore === void 0) {
392346
392569
  return [];
392347
392570
  }
392348
- const fernignoreLines = fernignore.split("\n");
392349
- const fernignoreFiles = [];
392350
- for (const line of fernignoreLines) {
392351
- const trimmedLine = line.trim();
392352
- if (!trimmedLine.startsWith("#") && trimmedLine.length > 0 && await repository.fileExists({ relativeFilePath: trimmedLine })) {
392353
- fernignoreFiles.push(trimmedLine);
392354
- }
392355
- }
392356
- return fernignoreFiles;
392571
+ const tracked = await repository.listTrackedFiles();
392572
+ return (0, github_1.expandFernignorePatterns)(fernignore, tracked);
392357
392573
  }
392358
392574
  async restoreFiles(repository, files) {
392359
392575
  if (files.length === 0) {
@@ -459559,14 +459775,14 @@ var require_localHostOrDomainIs = __commonJS({
459559
459775
  function localHostOrDomainIs(host, hostdom) {
459560
459776
  const parts = host.split(".");
459561
459777
  const domparts = hostdom.split(".");
459562
- let matches = true;
459778
+ let matches2 = true;
459563
459779
  for (let i9 = 0; i9 < parts.length; i9++) {
459564
459780
  if (parts[i9] !== domparts[i9]) {
459565
- matches = false;
459781
+ matches2 = false;
459566
459782
  break;
459567
459783
  }
459568
459784
  }
459569
- return matches;
459785
+ return matches2;
459570
459786
  }
459571
459787
  exports2.default = localHostOrDomainIs;
459572
459788
  }
@@ -502781,20 +502997,20 @@ function extractTraceparentData(traceparent) {
502781
502997
  if (!traceparent) {
502782
502998
  return void 0;
502783
502999
  }
502784
- const matches = traceparent.match(TRACEPARENT_REGEXP);
502785
- if (!matches) {
503000
+ const matches2 = traceparent.match(TRACEPARENT_REGEXP);
503001
+ if (!matches2) {
502786
503002
  return void 0;
502787
503003
  }
502788
503004
  let parentSampled;
502789
- if (matches[3] === "1") {
503005
+ if (matches2[3] === "1") {
502790
503006
  parentSampled = true;
502791
- } else if (matches[3] === "0") {
503007
+ } else if (matches2[3] === "0") {
502792
503008
  parentSampled = false;
502793
503009
  }
502794
503010
  return {
502795
- traceId: matches[1],
503011
+ traceId: matches2[1],
502796
503012
  parentSampled,
502797
- parentSpanId: matches[2]
503013
+ parentSpanId: matches2[2]
502798
503014
  };
502799
503015
  }
502800
503016
  function propagationContextFromHeaders(sentryTrace, baggage) {
@@ -520063,14 +520279,14 @@ var RequireInTheMiddleSingleton3 = class _RequireInTheMiddleSingleton {
520063
520279
  { internals: true },
520064
520280
  (exports2, name2, basedir) => {
520065
520281
  const normalizedModuleName = normalizePathSeparators3(name2);
520066
- const matches = this._moduleNameTrie.search(normalizedModuleName, {
520282
+ const matches2 = this._moduleNameTrie.search(normalizedModuleName, {
520067
520283
  maintainInsertionOrder: true,
520068
520284
  // For core modules (e.g. `fs`), do not match on sub-paths (e.g. `fs/promises').
520069
520285
  // This matches the behavior of `require-in-the-middle`.
520070
520286
  // `basedir` is always `undefined` for core modules.
520071
520287
  fullOnly: basedir === void 0
520072
520288
  });
520073
- for (const { onRequire } of matches) {
520289
+ for (const { onRequire } of matches2) {
520074
520290
  exports2 = onRequire(exports2, name2, basedir);
520075
520291
  }
520076
520292
  return exports2;
@@ -522591,11 +522807,11 @@ function assembleStyles() {
522591
522807
  },
522592
522808
  hexToRgb: {
522593
522809
  value(hex3) {
522594
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
522595
- if (!matches) {
522810
+ const matches2 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
522811
+ if (!matches2) {
522596
522812
  return [0, 0, 0];
522597
522813
  }
522598
- let [colorString] = matches;
522814
+ let [colorString] = matches2;
522599
522815
  if (colorString.length === 3) {
522600
522816
  colorString = [...colorString].map((character) => character + character).join("");
522601
522817
  }
@@ -561807,6 +562023,7 @@ var OpenApiSettingsSchema = schemas_exports8.object({
561807
562023
  "prefer-undiscriminated-unions-with-literals": schemas_exports8.boolean().optional(),
561808
562024
  "object-query-parameters": schemas_exports8.boolean().optional(),
561809
562025
  "respect-readonly-schemas": schemas_exports8.boolean().optional(),
562026
+ "use-read-variant-for-responses": schemas_exports8.boolean().optional(),
561810
562027
  "respect-forward-compatible-enums": schemas_exports8.boolean().optional(),
561811
562028
  "use-bytes-for-binary-response": schemas_exports8.boolean().optional(),
561812
562029
  "default-form-parameter-encoding": FormParameterEncoding2.optional(),
@@ -561844,6 +562061,7 @@ var GraphQlSpecSchema = schemas_exports8.object({
561844
562061
  graphql: schemas_exports8.string(),
561845
562062
  origin: schemas_exports8.string().optional(),
561846
562063
  overrides: schemas_exports8.string().optional(),
562064
+ examples: schemas_exports8.string().optional(),
561847
562065
  name: schemas_exports8.string().optional()
561848
562066
  });
561849
562067
 
@@ -562325,6 +562543,7 @@ var DEFAULT_CONVERT_OPENAPI_OPTIONS = {
562325
562543
  detectGlobalHeaders: true,
562326
562544
  objectQueryParameters: true,
562327
562545
  respectReadonlySchemas: false,
562546
+ useReadVariantForResponses: false,
562328
562547
  respectNullableSchemas: true,
562329
562548
  onlyIncludeReferencedSchemas: false,
562330
562549
  inlinePathParameters: true,
@@ -568049,9 +568268,9 @@ init_lodash();
568049
568268
 
568050
568269
  // ../api-importers/openapi/openapi-ir/lib/utils/replaceStartingNumber.js
568051
568270
  function replaceStartingNumber(input3) {
568052
- const matches = input3.match(NUMERIC_REGEX);
568053
- if (matches && matches[0] != null) {
568054
- const numericPart = matches[0];
568271
+ const matches2 = input3.match(NUMERIC_REGEX);
568272
+ if (matches2 && matches2[0] != null) {
568273
+ const numericPart = matches2[0];
568055
568274
  const nonNumericPart = input3.substring(numericPart.length);
568056
568275
  const parsedNumber = parseFloat(numericPart);
568057
568276
  if (!isNaN(parsedNumber) && isFinite(parsedNumber)) {
@@ -571958,7 +572177,8 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
571958
572177
  context: context3,
571959
572178
  fileContainingReference: declarationFile,
571960
572179
  namespace: maybeEndpointNamespace,
571961
- declarationDepth: 0
572180
+ declarationDepth: 0,
572181
+ variant: context3.options.respectReadonlySchemas && context3.options.useReadVariantForResponses ? "read" : void 0
571962
572182
  });
571963
572183
  convertedEndpoint.response = {
571964
572184
  docs: jsonResponse.description ?? void 0,
@@ -571977,7 +572197,8 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
571977
572197
  context: context3,
571978
572198
  fileContainingReference: declarationFile,
571979
572199
  namespace: maybeEndpointNamespace,
571980
- declarationDepth: 0
572200
+ declarationDepth: 0,
572201
+ variant: context3.options.respectReadonlySchemas && context3.options.useReadVariantForResponses ? "read" : void 0
571981
572202
  });
571982
572203
  convertedEndpoint["response-stream"] = {
571983
572204
  docs: jsonResponse.description ?? void 0,
@@ -571992,7 +572213,8 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
571992
572213
  context: context3,
571993
572214
  fileContainingReference: declarationFile,
571994
572215
  namespace: maybeEndpointNamespace,
571995
- declarationDepth: 0
572216
+ declarationDepth: 0,
572217
+ variant: context3.options.respectReadonlySchemas && context3.options.useReadVariantForResponses ? "read" : void 0
571996
572218
  });
571997
572219
  convertedEndpoint["response-stream"] = {
571998
572220
  docs: jsonResponse.description ?? void 0,
@@ -573321,8 +573543,18 @@ function buildFernDefinition(context3) {
573321
573543
  if (context3.ir.hasEndpointsMarkedInternal) {
573322
573544
  context3.builder.addAudience(EXTERNAL_AUDIENCE);
573323
573545
  }
573546
+ if (context3.options.respectReadonlySchemas && context3.options.useReadVariantForResponses) {
573547
+ const reachability = computeSchemaReachability(context3.ir);
573548
+ const variantPlan = computeVariantPlan(context3.ir, reachability);
573549
+ context3.setVariantPlan(variantPlan, reachability);
573550
+ }
573324
573551
  const convertedServices = buildServices(context3);
573325
573552
  const sdkGroups = convertedServices.sdkGroups;
573553
+ if (context3.options.respectReadonlySchemas && !context3.options.useReadVariantForResponses) {
573554
+ const reachability = computeSchemaReachability(context3.ir);
573555
+ const variantPlan = computeVariantPlan(context3.ir, reachability);
573556
+ context3.setVariantPlan(variantPlan, reachability);
573557
+ }
573326
573558
  context3.setInState(State.Webhook);
573327
573559
  buildWebhooks(context3);
573328
573560
  context3.unsetInState(State.Webhook);
@@ -573336,11 +573568,6 @@ function buildFernDefinition(context3) {
573336
573568
  context: context3,
573337
573569
  schemaIdsToExcludeFromServices: convertedServices.schemaIdsToExclude
573338
573570
  });
573339
- if (context3.options.respectReadonlySchemas) {
573340
- const reachability = computeSchemaReachability(context3.ir);
573341
- const variantPlan = computeVariantPlan(context3.ir, reachability);
573342
- context3.setVariantPlan(variantPlan, reachability);
573343
- }
573344
573571
  addSchemas({ schemas: context3.ir.groupedSchemas.rootSchemas, schemaIdsToExclude, namespace: void 0, context: context3 });
573345
573572
  for (const [namespace, schemas] of Object.entries(context3.ir.groupedSchemas.namespacedSchemas)) {
573346
573573
  addSchemas({ schemas, schemaIdsToExclude, namespace, context: context3 });
@@ -574241,6 +574468,7 @@ var BaseOpenAPIWorkspace = class extends AbstractAPIWorkspace {
574241
574468
  objectQueryParameters;
574242
574469
  onlyIncludeReferencedSchemas;
574243
574470
  respectReadonlySchemas;
574471
+ useReadVariantForResponses;
574244
574472
  respectNullableSchemas;
574245
574473
  wrapReferencesToNullableInOptional;
574246
574474
  coerceOptionalSchemasToNullable;
@@ -574264,6 +574492,7 @@ var BaseOpenAPIWorkspace = class extends AbstractAPIWorkspace {
574264
574492
  this.objectQueryParameters = args.objectQueryParameters;
574265
574493
  this.onlyIncludeReferencedSchemas = args.onlyIncludeReferencedSchemas;
574266
574494
  this.respectReadonlySchemas = args.respectReadonlySchemas;
574495
+ this.useReadVariantForResponses = args.useReadVariantForResponses;
574267
574496
  this.respectNullableSchemas = args.respectNullableSchemas;
574268
574497
  this.wrapReferencesToNullableInOptional = args.wrapReferencesToNullableInOptional;
574269
574498
  this.coerceOptionalSchemasToNullable = args.coerceOptionalSchemasToNullable;
@@ -579747,11 +579976,11 @@ var ExampleTypeFactory = class _ExampleTypeFactory {
579747
579976
  }
579748
579977
  return schema2.schemas[0];
579749
579978
  }
579750
- const matches = schema2.schemas.map((schema3) => ({
579979
+ const matches2 = schema2.schemas.map((schema3) => ({
579751
579980
  schema: schema3,
579752
579981
  heuristic: this.calcExampleHeuristic(schema3, fullExample)
579753
579982
  }));
579754
- const sortedMatches = matches.sort((a3, b8) => b8.heuristic - a3.heuristic);
579983
+ const sortedMatches = matches2.sort((a3, b8) => b8.heuristic - a3.heuristic);
579755
579984
  return sortedMatches[0]?.schema;
579756
579985
  }
579757
579986
  // this is not a perfect heuristic, but it's a start. algorithm is as follows:
@@ -579814,14 +580043,14 @@ var ExampleTypeFactory = class _ExampleTypeFactory {
579814
580043
  return this.calcExampleHeuristic(resolvedSchema, fullExample);
579815
580044
  }
579816
580045
  case "oneOf": {
579817
- const matches = Object.values(schema2.value.schemas).map((schema3) => this.calcExampleHeuristic(schema3, fullExample));
579818
- return matches.sort((a3, b8) => b8 - a3)[0] ?? 0;
580046
+ const matches2 = Object.values(schema2.value.schemas).map((schema3) => this.calcExampleHeuristic(schema3, fullExample));
580047
+ return matches2.sort((a3, b8) => b8 - a3)[0] ?? 0;
579819
580048
  }
579820
580049
  case "primitive": {
579821
580050
  if (fullExample == null) {
579822
580051
  return 0;
579823
580052
  }
579824
- const matches = schema2.schema._visit({
580053
+ const matches2 = schema2.schema._visit({
579825
580054
  int: () => typeof fullExample === "number",
579826
580055
  int64: () => typeof fullExample === "number",
579827
580056
  uint: () => typeof fullExample === "number",
@@ -579836,7 +580065,7 @@ var ExampleTypeFactory = class _ExampleTypeFactory {
579836
580065
  boolean: () => typeof fullExample === "boolean",
579837
580066
  _other: () => true
579838
580067
  });
579839
- return matches ? 1 : -1;
580068
+ return matches2 ? 1 : -1;
579840
580069
  }
579841
580070
  default:
579842
580071
  return 0;
@@ -586627,6 +586856,7 @@ var FIELD_MAPPINGS = {
586627
586856
  coerceEnumsToLiterals: "coerceEnumsToLiterals",
586628
586857
  objectQueryParameters: "objectQueryParameters",
586629
586858
  respectReadonlySchemas: "respectReadonlySchemas",
586859
+ useReadVariantForResponses: "useReadVariantForResponses",
586630
586860
  respectNullableSchemas: "respectNullableSchemas",
586631
586861
  onlyIncludeReferencedSchemas: "onlyIncludeReferencedSchemas",
586632
586862
  inlinePathParameters: "inlinePathParameters",
@@ -595882,6 +596112,7 @@ var UNDEFINED_API_DEFINITION_SETTINGS = {
595882
596112
  coerceEnumsToLiterals: void 0,
595883
596113
  objectQueryParameters: void 0,
595884
596114
  respectReadonlySchemas: void 0,
596115
+ useReadVariantForResponses: void 0,
595885
596116
  respectNullableSchemas: void 0,
595886
596117
  inlinePathParameters: void 0,
595887
596118
  useBytesForBinaryResponse: void 0,
@@ -595960,6 +596191,7 @@ function parseOpenApiDefinitionSettingsSchema(settings) {
595960
596191
  onlyIncludeReferencedSchemas: settings?.["only-include-referenced-schemas"],
595961
596192
  objectQueryParameters: settings?.["object-query-parameters"],
595962
596193
  respectReadonlySchemas: settings?.["respect-readonly-schemas"],
596194
+ useReadVariantForResponses: settings?.["use-read-variant-for-responses"],
595963
596195
  inlinePathParameters: settings?.["inline-path-parameters"],
595964
596196
  filter: settings?.filter,
595965
596197
  exampleGeneration: settings?.["example-generation"],
@@ -596233,7 +596465,8 @@ async function parseApiConfigurationV2Schema({ apiConfiguration, rawConfiguratio
596233
596465
  definitionLocation = {
596234
596466
  schema: {
596235
596467
  type: "graphql",
596236
- path: spec.graphql
596468
+ path: spec.graphql,
596469
+ examples: spec.examples
596237
596470
  },
596238
596471
  origin: spec.origin,
596239
596472
  overrides: spec.overrides,
@@ -597082,25 +597315,25 @@ async function findUpMultiple(name2, options2 = {}) {
597082
597315
  }
597083
597316
  return foundPath;
597084
597317
  };
597085
- const matches = [];
597318
+ const matches2 = [];
597086
597319
  while (true) {
597087
597320
  const foundPath = await runMatcher({ ...options2, cwd: directory });
597088
597321
  if (foundPath === findUpStop) {
597089
597322
  break;
597090
597323
  }
597091
597324
  if (foundPath) {
597092
- matches.push(import_node_path8.default.resolve(directory, foundPath));
597325
+ matches2.push(import_node_path8.default.resolve(directory, foundPath));
597093
597326
  }
597094
- if (directory === stopAt || matches.length >= limit) {
597327
+ if (directory === stopAt || matches2.length >= limit) {
597095
597328
  break;
597096
597329
  }
597097
597330
  directory = import_node_path8.default.dirname(directory);
597098
597331
  }
597099
- return matches;
597332
+ return matches2;
597100
597333
  }
597101
597334
  async function findUp(name2, options2 = {}) {
597102
- const matches = await findUpMultiple(name2, { ...options2, limit: 1 });
597103
- return matches[0];
597335
+ const matches2 = await findUpMultiple(name2, { ...options2, limit: 1 });
597336
+ return matches2[0];
597104
597337
  }
597105
597338
 
597106
597339
  // ../configuration-loader/lib/getFernDirectory.js
@@ -627210,10 +627443,10 @@ var forEachEntry = (obj, fn10) => {
627210
627443
  }
627211
627444
  };
627212
627445
  var matchAll = (regExp, str3) => {
627213
- let matches;
627446
+ let matches2;
627214
627447
  const arr = [];
627215
- while ((matches = regExp.exec(str3)) !== null) {
627216
- arr.push(matches);
627448
+ while ((matches2 = regExp.exec(str3)) !== null) {
627449
+ arr.push(matches2);
627217
627450
  }
627218
627451
  return arr;
627219
627452
  };
@@ -659832,6 +660065,7 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
659832
660065
  super({
659833
660066
  ...superArgs,
659834
660067
  respectReadonlySchemas: collapseSpecBooleanSetting(specs, (s9) => s9?.respectReadonlySchemas),
660068
+ useReadVariantForResponses: collapseSpecBooleanSetting(specs, (s9) => s9?.useReadVariantForResponses),
659835
660069
  respectNullableSchemas: collapseSpecBooleanSetting(specs, (s9) => s9?.respectNullableSchemas),
659836
660070
  wrapReferencesToNullableInOptional: collapseSpecBooleanSetting(specs, (s9) => s9?.wrapReferencesToNullableInOptional),
659837
660071
  removeDiscriminantsFromSchemas: convertRemoveDiscriminantsFromSchemas(specs),
@@ -659909,9 +660143,12 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
659909
660143
  const graphqlSpecs = this.allSpecs.filter((spec) => spec.type === "graphql");
659910
660144
  for (const spec of graphqlSpecs) {
659911
660145
  try {
660146
+ const examples = await loadGraphQlExamples(spec.absoluteFilepathToExamples, context3);
659912
660147
  const converter = new GraphQLConverter2({
659913
660148
  context: context3,
659914
- filePath: spec.absoluteFilepath
660149
+ filePath: spec.absoluteFilepath,
660150
+ namespace: spec.namespace,
660151
+ examples
659915
660152
  });
659916
660153
  const result = await converter.convert();
659917
660154
  Object.assign(this.graphqlOperations, result.graphqlOperations);
@@ -660245,7 +660482,8 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
660245
660482
  ...this.allSpecs.flatMap((spec) => {
660246
660483
  const mainPath = spec.type === "protobuf" ? spec.absoluteFilepathToProtobufTarget : spec.absoluteFilepath;
660247
660484
  const overridePaths = Array.isArray(spec.absoluteFilepathToOverrides) ? spec.absoluteFilepathToOverrides : spec.absoluteFilepathToOverrides != null ? [spec.absoluteFilepathToOverrides] : [];
660248
- return [mainPath, ...overridePaths];
660485
+ const examplesPath = spec.type === "graphql" ? spec.absoluteFilepathToExamples : void 0;
660486
+ return [mainPath, ...overridePaths, ...examplesPath != null ? [examplesPath] : []];
660249
660487
  }).filter(isNonNullish)
660250
660488
  ];
660251
660489
  }
@@ -660270,6 +660508,52 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
660270
660508
  }, result);
660271
660509
  }
660272
660510
  };
660511
+ async function loadGraphQlExamples(absoluteFilepathToExamples, context3) {
660512
+ if (absoluteFilepathToExamples == null) {
660513
+ return void 0;
660514
+ }
660515
+ try {
660516
+ const contents = (await (0, import_promises39.readFile)(absoluteFilepathToExamples)).toString();
660517
+ const parsed = jsYaml.load(contents);
660518
+ if (!Array.isArray(parsed)) {
660519
+ return void 0;
660520
+ }
660521
+ for (const entry of parsed) {
660522
+ if (typeof entry !== "object" || entry == null) {
660523
+ context3.logger.warn(`Skipping invalid entry in GraphQL examples file ${absoluteFilepathToExamples}: expected object`);
660524
+ continue;
660525
+ }
660526
+ if (typeof entry.operation !== "string") {
660527
+ context3.logger.warn(`Skipping entry in GraphQL examples file ${absoluteFilepathToExamples}: missing or invalid 'operation' field`);
660528
+ continue;
660529
+ }
660530
+ if (!Array.isArray(entry.examples)) {
660531
+ context3.logger.warn(`Skipping entry for operation '${entry.operation}' in ${absoluteFilepathToExamples}: 'examples' must be an array`);
660532
+ continue;
660533
+ }
660534
+ }
660535
+ const validEntries = parsed.filter((entry) => typeof entry === "object" && entry != null && typeof entry.operation === "string" && Array.isArray(entry.examples)).map((entry) => {
660536
+ const validExamples = entry.examples.filter((ex) => {
660537
+ if (typeof ex !== "object" || ex == null || typeof ex.query !== "string") {
660538
+ context3.logger.warn(`Skipping malformed example for operation '${entry.operation}' in ${absoluteFilepathToExamples}: missing or invalid 'query' field`);
660539
+ return false;
660540
+ }
660541
+ return true;
660542
+ });
660543
+ if (entry.operationType != null) {
660544
+ const lower = entry.operationType.toLowerCase();
660545
+ if (lower !== "query" && lower !== "mutation" && lower !== "subscription") {
660546
+ context3.logger.warn(`Invalid operationType '${entry.operationType}' for operation '${entry.operation}' in ${absoluteFilepathToExamples}: must be 'query', 'mutation', or 'subscription'`);
660547
+ }
660548
+ }
660549
+ return { ...entry, examples: validExamples };
660550
+ }).filter((entry) => entry.examples.length > 0);
660551
+ return validEntries.length > 0 ? validEntries : void 0;
660552
+ } catch (error50) {
660553
+ context3.logger.error(`Failed to load GraphQL examples from ${absoluteFilepathToExamples}:`, extractErrorMessage(error50));
660554
+ return void 0;
660555
+ }
660556
+ }
660273
660557
  async function getAuthFromOverrideFiles(specs) {
660274
660558
  for (const spec of specs) {
660275
660559
  if (spec.type !== "openapi") {
@@ -661303,6 +661587,8 @@ var GraphQlSpecSchema2 = external_exports.object({
661303
661587
  origin: external_exports.string().optional(),
661304
661588
  /** Path to overrides file for the GraphQL spec. */
661305
661589
  overrides: external_exports.union([external_exports.string(), external_exports.array(external_exports.string()).nonempty()]).optional(),
661590
+ /** Path to a YAML/JSON file containing named examples for GraphQL operations. */
661591
+ examples: external_exports.string().optional(),
661306
661592
  /** Name used to group this GraphQL spec in the docs (rendered as a top-level section). */
661307
661593
  name: external_exports.string().optional()
661308
661594
  });
@@ -661352,6 +661638,8 @@ var OpenApiSettingsSchema2 = BaseApiSettingsSchema2.extend({
661352
661638
  objectQueryParameters: external_exports.boolean().optional(),
661353
661639
  /** Enables exploring readonly schemas in OpenAPI specifications. */
661354
661640
  respectReadonlySchemas: external_exports.boolean().optional(),
661641
+ /** If true, endpoint response types will use the Read variant of schemas when respect-readonly-schemas is enabled. Defaults to false. */
661642
+ useReadVariantForResponses: external_exports.boolean().optional(),
661355
661643
  /** Enables respecting forward compatible enums in OpenAPI specifications. Defaults to false. */
661356
661644
  respectForwardCompatibleEnums: external_exports.boolean().optional(),
661357
661645
  /** Enables using the `bytes` type for binary responses in OpenAPI specifications. Defaults to a file stream. */
@@ -667120,9 +667408,9 @@ var FeatureFlagsPoller = class {
667120
667408
  if ((condition.properties || []).length > 0) {
667121
667409
  for (const prop of condition.properties) {
667122
667410
  const propertyType = prop.type;
667123
- let matches = false;
667124
- matches = "cohort" === propertyType ? matchCohort(prop, properties7, this.cohorts, this.debugMode) : "flag" === propertyType ? await this.evaluateFlagDependency(prop, properties7, evaluationContext) : matchProperty(prop, properties7, warnFunction);
667125
- if (!matches) return false;
667411
+ let matches2 = false;
667412
+ matches2 = "cohort" === propertyType ? matchCohort(prop, properties7, this.cohorts, this.debugMode) : "flag" === propertyType ? await this.evaluateFlagDependency(prop, properties7, evaluationContext) : matchProperty(prop, properties7, warnFunction);
667413
+ if (!matches2) return false;
667126
667414
  }
667127
667415
  if (void 0 == rolloutPercentage) return true;
667128
667416
  }
@@ -667449,10 +667737,10 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
667449
667737
  let errorMatchingLocally = false;
667450
667738
  if ("values" in properties7[0]) {
667451
667739
  for (const prop of properties7) try {
667452
- const matches = matchPropertyGroup(prop, propertyValues, cohortProperties, debugMode);
667740
+ const matches2 = matchPropertyGroup(prop, propertyValues, cohortProperties, debugMode);
667453
667741
  if ("AND" === propertyGroupType) {
667454
- if (!matches) return false;
667455
- } else if (matches) return true;
667742
+ if (!matches2) return false;
667743
+ } else if (matches2) return true;
667456
667744
  } catch (err) {
667457
667745
  if (err instanceof RequiresServerEvaluation) throw err;
667458
667746
  if (err instanceof InconclusiveMatchError) {
@@ -667464,19 +667752,19 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
667464
667752
  return "AND" === propertyGroupType;
667465
667753
  }
667466
667754
  for (const prop of properties7) try {
667467
- let matches;
667468
- if ("cohort" === prop.type) matches = matchCohort(prop, propertyValues, cohortProperties, debugMode);
667755
+ let matches2;
667756
+ if ("cohort" === prop.type) matches2 = matchCohort(prop, propertyValues, cohortProperties, debugMode);
667469
667757
  else if ("flag" === prop.type) {
667470
667758
  if (debugMode) console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${prop.key || "unknown"}'`);
667471
667759
  continue;
667472
- } else matches = matchProperty(prop, propertyValues);
667760
+ } else matches2 = matchProperty(prop, propertyValues);
667473
667761
  const negation = prop.negation || false;
667474
667762
  if ("AND" === propertyGroupType) {
667475
- if (!matches && !negation) return false;
667476
- if (matches && negation) return false;
667763
+ if (!matches2 && !negation) return false;
667764
+ if (matches2 && negation) return false;
667477
667765
  } else {
667478
- if (matches && !negation) return true;
667479
- if (!matches && negation) return true;
667766
+ if (matches2 && !negation) return true;
667767
+ if (!matches2 && negation) return true;
667480
667768
  }
667481
667769
  } catch (err) {
667482
667770
  if (err instanceof RequiresServerEvaluation) throw err;
@@ -668495,7 +668783,7 @@ var AccessTokenPosthogManager = class {
668495
668783
  properties: {
668496
668784
  ...event,
668497
668785
  ...event.properties,
668498
- version: "5.34.0",
668786
+ version: "5.35.1",
668499
668787
  usingAccessToken: true,
668500
668788
  ...getRunIdProperties()
668501
668789
  }
@@ -668559,7 +668847,7 @@ var UserPosthogManager = class {
668559
668847
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
668560
668848
  event: "CLI",
668561
668849
  properties: {
668562
- version: "5.34.0",
668850
+ version: "5.35.1",
668563
668851
  ...event,
668564
668852
  ...event.properties,
668565
668853
  usingAccessToken: false,
@@ -668919,11 +669207,11 @@ function assembleStyles2() {
668919
669207
  },
668920
669208
  hexToRgb: {
668921
669209
  value(hex3) {
668922
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
668923
- if (!matches) {
669210
+ const matches2 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
669211
+ if (!matches2) {
668924
669212
  return [0, 0, 0];
668925
669213
  }
668926
- let [colorString] = matches;
669214
+ let [colorString] = matches2;
668927
669215
  if (colorString.length === 3) {
668928
669216
  colorString = [...colorString].map((character) => character + character).join("");
668929
669217
  }
@@ -673153,6 +673441,13 @@ var ApiDefinitionConverter = class {
673153
673441
  sourced: sourced.overrides
673154
673442
  });
673155
673443
  }
673444
+ if (spec.examples != null && !isNullish2(sourced.examples)) {
673445
+ result.examples = await this.resolvePath({
673446
+ absoluteFernYmlPath,
673447
+ path: spec.examples,
673448
+ sourced: sourced.examples
673449
+ });
673450
+ }
673156
673451
  if (spec.name != null) {
673157
673452
  result.name = spec.name;
673158
673453
  }
@@ -674588,6 +674883,7 @@ var LegacyApiSpecAdapter = class {
674588
674883
  type: "graphql",
674589
674884
  absoluteFilepath: spec.graphql,
674590
674885
  absoluteFilepathToOverrides: spec.overrides,
674886
+ absoluteFilepathToExamples: spec.examples,
674591
674887
  namespace: spec.name
674592
674888
  };
674593
674889
  }
@@ -674610,6 +674906,7 @@ var LegacyApiSpecAdapter = class {
674610
674906
  pathParameterOrder: this.adaptPathParameterOrder(settings.pathParameterOrder),
674611
674907
  // OpenAPI-specific settings
674612
674908
  respectReadonlySchemas: settings.respectReadonlySchemas,
674909
+ useReadVariantForResponses: settings.useReadVariantForResponses,
674613
674910
  onlyIncludeReferencedSchemas: settings.onlyIncludeReferencedSchemas,
674614
674911
  inlinePathParameters: settings.inlinePathParameters,
674615
674912
  shouldUseUndiscriminatedUnionsWithLiterals: settings.preferUndiscriminatedUnionsWithLiterals,
@@ -825187,10 +825484,12 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
825187
825484
  const graphqlSpecs = workspace.allSpecs.filter((spec) => spec.type === "graphql");
825188
825485
  for (const spec of graphqlSpecs) {
825189
825486
  try {
825487
+ const examples = await this.loadGraphQlExamples(spec.absoluteFilepathToExamples);
825190
825488
  const converter = new GraphQLConverter({
825191
825489
  context: this.taskContext,
825192
825490
  filePath: spec.absoluteFilepath,
825193
- namespace: spec.namespace
825491
+ namespace: spec.namespace,
825492
+ examples
825194
825493
  });
825195
825494
  const graphqlResult = await converter.convert();
825196
825495
  Object.assign(graphqlOperations, graphqlResult.graphqlOperations);
@@ -825206,6 +825505,52 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
825206
825505
  }
825207
825506
  return { operations: graphqlOperations, types: graphqlTypes, namespacesByOperationId };
825208
825507
  }
825508
+ async loadGraphQlExamples(absoluteFilepathToExamples) {
825509
+ if (absoluteFilepathToExamples == null) {
825510
+ return void 0;
825511
+ }
825512
+ try {
825513
+ const contents = (await (0, import_promises65.readFile)(absoluteFilepathToExamples)).toString();
825514
+ const parsed = jsYaml.load(contents);
825515
+ if (!Array.isArray(parsed)) {
825516
+ return void 0;
825517
+ }
825518
+ for (const entry of parsed) {
825519
+ if (typeof entry !== "object" || entry == null) {
825520
+ this.taskContext.logger.warn(`Skipping invalid entry in GraphQL examples file ${absoluteFilepathToExamples}: expected object`);
825521
+ continue;
825522
+ }
825523
+ if (typeof entry.operation !== "string") {
825524
+ this.taskContext.logger.warn(`Skipping entry in GraphQL examples file ${absoluteFilepathToExamples}: missing or invalid 'operation' field`);
825525
+ continue;
825526
+ }
825527
+ if (!Array.isArray(entry.examples)) {
825528
+ this.taskContext.logger.warn(`Skipping entry for operation '${entry.operation}' in ${absoluteFilepathToExamples}: 'examples' must be an array`);
825529
+ continue;
825530
+ }
825531
+ }
825532
+ const validEntries = parsed.filter((entry) => typeof entry === "object" && entry != null && typeof entry.operation === "string" && Array.isArray(entry.examples)).map((entry) => {
825533
+ const validExamples = entry.examples.filter((ex) => {
825534
+ if (typeof ex !== "object" || ex == null || typeof ex.query !== "string") {
825535
+ this.taskContext.logger.warn(`Skipping malformed example for operation '${entry.operation}' in ${absoluteFilepathToExamples}: missing or invalid 'query' field`);
825536
+ return false;
825537
+ }
825538
+ return true;
825539
+ });
825540
+ if (entry.operationType != null) {
825541
+ const lower = entry.operationType.toLowerCase();
825542
+ if (lower !== "query" && lower !== "mutation" && lower !== "subscription") {
825543
+ this.taskContext.logger.warn(`Invalid operationType '${entry.operationType}' for operation '${entry.operation}' in ${absoluteFilepathToExamples}: must be 'query', 'mutation', or 'subscription'`);
825544
+ }
825545
+ }
825546
+ return { ...entry, examples: validExamples };
825547
+ }).filter((entry) => entry.examples.length > 0);
825548
+ return validEntries.length > 0 ? validEntries : void 0;
825549
+ } catch (error50) {
825550
+ this.taskContext.logger.error(`Failed to load GraphQL examples from ${absoluteFilepathToExamples}:`, String(error50));
825551
+ return void 0;
825552
+ }
825553
+ }
825209
825554
  /**
825210
825555
  * Handles librarySection navigation items by reading pre-generated MDX files
825211
825556
  * and _navigation.yml from the library's output directory.
@@ -831543,7 +831888,7 @@ function tokensToFunction(tokens, options2) {
831543
831888
  var _a12 = options2.encode, encode6 = _a12 === void 0 ? function(x5) {
831544
831889
  return x5;
831545
831890
  } : _a12, _b3 = options2.validate, validate3 = _b3 === void 0 ? true : _b3;
831546
- var matches = tokens.map(function(token) {
831891
+ var matches2 = tokens.map(function(token) {
831547
831892
  if (typeof token === "object") {
831548
831893
  return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
831549
831894
  }
@@ -831570,7 +831915,7 @@ function tokensToFunction(tokens, options2) {
831570
831915
  }
831571
831916
  for (var j7 = 0; j7 < value2.length; j7++) {
831572
831917
  var segment = encode6(value2[j7], token);
831573
- if (validate3 && !matches[i9].test(segment)) {
831918
+ if (validate3 && !matches2[i9].test(segment)) {
831574
831919
  throw new TypeError('Expected all "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
831575
831920
  }
831576
831921
  path115 += token.prefix + segment + token.suffix;
@@ -831579,7 +831924,7 @@ function tokensToFunction(tokens, options2) {
831579
831924
  }
831580
831925
  if (typeof value2 === "string" || typeof value2 === "number") {
831581
831926
  var segment = encode6(String(value2), token);
831582
- if (validate3 && !matches[i9].test(segment)) {
831927
+ if (validate3 && !matches2[i9].test(segment)) {
831583
831928
  throw new TypeError('Expected "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
831584
831929
  }
831585
831930
  path115 += token.prefix + segment + token.suffix;
@@ -856813,6 +857158,7 @@ var SETTINGS_KEY_MAP = {
856813
857158
  "prefer-undiscriminated-unions-with-literals": "preferUndiscriminatedUnionsWithLiterals",
856814
857159
  "object-query-parameters": "objectQueryParameters",
856815
857160
  "respect-readonly-schemas": "respectReadonlySchemas",
857161
+ "use-read-variant-for-responses": "useReadVariantForResponses",
856816
857162
  "respect-forward-compatible-enums": "respectForwardCompatibleEnums",
856817
857163
  "use-bytes-for-binary-response": "useBytesForBinaryResponse",
856818
857164
  "default-form-parameter-encoding": "defaultFormParameterEncoding",
@@ -860356,7 +860702,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860356
860702
  var LOGS_FOLDER_NAME = "logs";
860357
860703
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860358
860704
  function getCliSource() {
860359
- const version7 = "5.34.0";
860705
+ const version7 = "5.35.1";
860360
860706
  return `cli@${version7}`;
860361
860707
  }
860362
860708
  var DebugLogger = class {
@@ -867728,8 +868074,8 @@ function extractLinksFromTypes(typeStrings, ctx, currentModulePath) {
867728
868074
  if (!typeStr) {
867729
868075
  continue;
867730
868076
  }
867731
- const matches = typeStr.match(QUALIFIED_PATH_REGEX) || [];
867732
- for (const path115 of matches) {
868077
+ const matches2 = typeStr.match(QUALIFIED_PATH_REGEX) || [];
868078
+ for (const path115 of matches2) {
867733
868079
  if (links[path115]) {
867734
868080
  continue;
867735
868081
  }
@@ -869684,10 +870030,22 @@ async function loadSingleNamespaceAPIWorkspace({ absolutePathToWorkspace, namesp
869684
870030
  }
869685
870031
  };
869686
870032
  }
870033
+ const absoluteFilepathToExamples = definition3.schema.examples != null ? join8(absolutePathToWorkspace, RelativeFilePath2.of(definition3.schema.examples)) : void 0;
870034
+ if (definition3.schema.examples != null && absoluteFilepathToExamples != null && !await doesPathExist(absoluteFilepathToExamples)) {
870035
+ return {
870036
+ didSucceed: false,
870037
+ failures: {
870038
+ [RelativeFilePath2.of(definition3.schema.examples)]: {
870039
+ type: WorkspaceLoaderFailureType.FILE_MISSING
870040
+ }
870041
+ }
870042
+ };
870043
+ }
869687
870044
  specs.push({
869688
870045
  type: "graphql",
869689
870046
  absoluteFilepath: absoluteFilepathToGraphQL,
869690
870047
  absoluteFilepathToOverrides,
870048
+ absoluteFilepathToExamples,
869691
870049
  namespace
869692
870050
  });
869693
870051
  continue;
@@ -879216,7 +879574,7 @@ var LegacyDocsPublisher = class {
879216
879574
  previewId,
879217
879575
  disableTemplates: void 0,
879218
879576
  skipUpload,
879219
- cliVersion: "5.34.0",
879577
+ cliVersion: "5.35.1",
879220
879578
  loginCommand: "fern auth login"
879221
879579
  });
879222
879580
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -904633,7 +904991,7 @@ var EndpointSnippetGenerator3 = class {
904633
904991
  this.context.errors.scope(Scope4.PathParameters);
904634
904992
  const pathParameters = [...this.context.ir.pathParameters ?? [], ...request7.pathParameters ?? []];
904635
904993
  if (pathParameters.length > 0) {
904636
- otherArgs.push(...this.getPathParameters({ namedParameters: pathParameters, snippet: snippet2 }).map((field5) => field5.value));
904994
+ otherArgs.push(...this.getPathParameters({ namedParameters: pathParameters, snippet: snippet2, asPointer: true }).map((field5) => field5.value));
904637
904995
  }
904638
904996
  this.context.errors.unscope();
904639
904997
  this.context.errors.scope(Scope4.RequestBody);
@@ -904671,20 +905029,25 @@ var EndpointSnippetGenerator3 = class {
904671
905029
  inlinePathParameters: this.context.customConfig?.inlinePathParameters ?? true,
904672
905030
  inlineFileProperties: this.context.customConfig?.inlineFileProperties ?? true
904673
905031
  };
905032
+ const includePathParamsInRequest = this.context.includePathParametersInWrappedRequest({
905033
+ request: request7,
905034
+ inlinePathParameters
905035
+ });
904674
905036
  this.context.errors.scope(Scope4.PathParameters);
904675
905037
  const pathParameterFields = [];
904676
905038
  const pathParameters = [...this.context.ir.pathParameters ?? [], ...request7.pathParameters ?? []];
904677
905039
  if (pathParameters.length > 0) {
904678
905040
  pathParameterFields.push(...this.getPathParameters({
904679
905041
  namedParameters: pathParameters,
904680
- snippet: snippet2
905042
+ snippet: snippet2,
905043
+ asPointer: !includePathParamsInRequest
904681
905044
  }));
904682
905045
  }
904683
905046
  this.context.errors.unscope();
904684
905047
  this.context.errors.scope(Scope4.RequestBody);
904685
905048
  const filePropertyInfo = this.getFilePropertyInfo({ request: request7, snippet: snippet2 });
904686
905049
  this.context.errors.unscope();
904687
- if (!this.context.includePathParametersInWrappedRequest({ request: request7, inlinePathParameters })) {
905050
+ if (!includePathParamsInRequest) {
904688
905051
  otherArgs.push(...pathParameterFields.map((field5) => field5.value));
904689
905052
  }
904690
905053
  if (!inlineFileProperties) {
@@ -904697,10 +905060,7 @@ var EndpointSnippetGenerator3 = class {
904697
905060
  }) ? this.getInlinedRequestArg({
904698
905061
  request: request7,
904699
905062
  snippet: snippet2,
904700
- pathParameterFields: this.context.includePathParametersInWrappedRequest({
904701
- request: request7,
904702
- inlinePathParameters
904703
- }) ? pathParameterFields : [],
905063
+ pathParameterFields: includePathParamsInRequest ? pathParameterFields : [],
904704
905064
  filePropertyInfo
904705
905065
  }) : void 0;
904706
905066
  return { otherArgs, requestArg };
@@ -904802,7 +905162,7 @@ var EndpointSnippetGenerator3 = class {
904802
905162
  }
904803
905163
  return fields;
904804
905164
  }
904805
- getPathParameters({ namedParameters, snippet: snippet2 }) {
905165
+ getPathParameters({ namedParameters, snippet: snippet2, asPointer }) {
904806
905166
  const args = [];
904807
905167
  const pathParameters = this.context.associateByWireValueOrDefault({
904808
905168
  parameters: namedParameters,
@@ -904811,7 +905171,7 @@ var EndpointSnippetGenerator3 = class {
904811
905171
  for (const parameter6 of pathParameters) {
904812
905172
  args.push({
904813
905173
  name: this.context.getTypeName(parameter6.name.name),
904814
- value: this.context.dynamicTypeInstantiationMapper.convertToPointerIfPossible(parameter6)
905174
+ value: asPointer ? this.context.dynamicTypeInstantiationMapper.convertToPointerIfPossible(parameter6) : this.context.dynamicTypeInstantiationMapper.convert(parameter6)
904815
905175
  });
904816
905176
  }
904817
905177
  return args;
@@ -953954,7 +954314,7 @@ function getAutomationContextFromEnv() {
953954
954314
  config_branch: process.env.FERN_CONFIG_BRANCH,
953955
954315
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
953956
954316
  trigger: process.env.GITHUB_EVENT_NAME,
953957
- cli_version: "5.34.0"
954317
+ cli_version: "5.35.1"
953958
954318
  };
953959
954319
  }
953960
954320
  function isAutomationMode() {
@@ -954780,7 +955140,7 @@ var CliContext = class _CliContext {
954780
955140
  if (false) {
954781
955141
  this.logger.error("CLI_VERSION is not defined");
954782
955142
  }
954783
- return "5.34.0";
955143
+ return "5.35.1";
954784
955144
  }
954785
955145
  getCliName() {
954786
955146
  if (false) {
@@ -967107,7 +967467,7 @@ function findMatchingSpecPath(overridePath, specPaths) {
967107
967467
  if (specSegments.length !== overrideSegments.length) {
967108
967468
  continue;
967109
967469
  }
967110
- let matches = true;
967470
+ let matches2 = true;
967111
967471
  for (let i9 = 0; i9 < specSegments.length; i9++) {
967112
967472
  const specSeg = specSegments[i9];
967113
967473
  const overrideSeg = overrideSegments[i9];
@@ -967120,10 +967480,10 @@ function findMatchingSpecPath(overridePath, specPaths) {
967120
967480
  continue;
967121
967481
  }
967122
967482
  }
967123
- matches = false;
967483
+ matches2 = false;
967124
967484
  break;
967125
967485
  }
967126
- if (matches) {
967486
+ if (matches2) {
967127
967487
  return specPath;
967128
967488
  }
967129
967489
  }