@fern-api/fern-api-dev 3.47.3 → 3.47.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +1112 -638
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -26912,7 +26912,7 @@ var require_public_api = __commonJS({
26912
26912
  return docs;
26913
26913
  return Object.assign([], { empty: true }, composer$1.streamInfo());
26914
26914
  }
26915
- function parseDocument3(source2, options2 = {}) {
26915
+ function parseDocument4(source2, options2 = {}) {
26916
26916
  const { lineCounter: lineCounter2, prettyErrors } = parseOptions2(options2);
26917
26917
  const parser$1 = new parser4.Parser(lineCounter2?.addNewLine);
26918
26918
  const composer$1 = new composer.Composer(options2);
@@ -26938,7 +26938,7 @@ var require_public_api = __commonJS({
26938
26938
  } else if (options2 === void 0 && reviver && typeof reviver === "object") {
26939
26939
  options2 = reviver;
26940
26940
  }
26941
- const doc = parseDocument3(src, options2);
26941
+ const doc = parseDocument4(src, options2);
26942
26942
  if (!doc)
26943
26943
  return null;
26944
26944
  doc.warnings.forEach((warning) => log2.warn(doc.options.logLevel, warning));
@@ -26972,7 +26972,7 @@ var require_public_api = __commonJS({
26972
26972
  }
26973
26973
  exports2.parse = parse18;
26974
26974
  exports2.parseAllDocuments = parseAllDocuments;
26975
- exports2.parseDocument = parseDocument3;
26975
+ exports2.parseDocument = parseDocument4;
26976
26976
  exports2.stringify = stringify5;
26977
26977
  }
26978
26978
  });
@@ -74452,8 +74452,8 @@ var require_graceful_fs = __commonJS({
74452
74452
  fs34.createReadStream = createReadStream3;
74453
74453
  fs34.createWriteStream = createWriteStream7;
74454
74454
  var fs$readFile = fs34.readFile;
74455
- fs34.readFile = readFile84;
74456
- function readFile84(path76, options2, cb2) {
74455
+ fs34.readFile = readFile85;
74456
+ function readFile85(path76, options2, cb2) {
74457
74457
  if (typeof options2 === "function")
74458
74458
  cb2 = options2, options2 = null;
74459
74459
  return go$readFile(path76, options2, cb2);
@@ -75818,7 +75818,7 @@ var require_jsonfile = __commonJS({
75818
75818
  }
75819
75819
  return obj;
75820
75820
  }
75821
- var readFile84 = universalify.fromPromise(_readFile);
75821
+ var readFile85 = universalify.fromPromise(_readFile);
75822
75822
  function readFileSync12(file2, options2 = {}) {
75823
75823
  if (typeof options2 === "string") {
75824
75824
  options2 = { encoding: options2 };
@@ -75850,7 +75850,7 @@ var require_jsonfile = __commonJS({
75850
75850
  return fs33.writeFileSync(file2, str3, options2);
75851
75851
  }
75852
75852
  module2.exports = {
75853
- readFile: readFile84,
75853
+ readFile: readFile85,
75854
75854
  readFileSync: readFileSync12,
75855
75855
  writeFile: writeFile68,
75856
75856
  writeFileSync: writeFileSync4
@@ -185194,8 +185194,8 @@ var require_graceful_fs2 = __commonJS({
185194
185194
  fs34.createReadStream = createReadStream3;
185195
185195
  fs34.createWriteStream = createWriteStream7;
185196
185196
  var fs$readFile = fs34.readFile;
185197
- fs34.readFile = readFile84;
185198
- function readFile84(path76, options2, cb2) {
185197
+ fs34.readFile = readFile85;
185198
+ function readFile85(path76, options2, cb2) {
185199
185199
  if (typeof options2 === "function")
185200
185200
  cb2 = options2, options2 = null;
185201
185201
  return go$readFile(path76, options2, cb2);
@@ -1302292,6 +1302292,7 @@ function withContext(handler3) {
1302292
1302292
  const context2 = createContext(args);
1302293
1302293
  try {
1302294
1302294
  await handler3(context2, args);
1302295
+ process.exit(0);
1302295
1302296
  } catch (error49) {
1302296
1302297
  handleError(context2, error49);
1302297
1302298
  process.exit(1);
@@ -1323757,36 +1323758,6 @@ async function stringifyLargeObject(obj, { pretty, onWrite } = {}) {
1323757
1323758
  return fileContents.toString();
1323758
1323759
  }
1323759
1323760
 
1323760
- // ../yaml/loader/lib/ValidationIssue.js
1323761
- var ValidationIssue = class {
1323762
- /** The validation error message */
1323763
- message;
1323764
- /** The source location where the issue was found */
1323765
- location;
1323766
- /** The path to the value in the YAML document (e.g., ["cli", "version"]) */
1323767
- yamlPath;
1323768
- constructor({ message, location: location2, yamlPath }) {
1323769
- this.message = message;
1323770
- this.location = location2;
1323771
- this.yamlPath = yamlPath;
1323772
- }
1323773
- /**
1323774
- * Formats as `<file>:<line>:<col>: <message>` for CLI output.
1323775
- *
1323776
- * @example
1323777
- * ```
1323778
- * fern.yml:6:13: org must be a string
1323779
- * ```
1323780
- */
1323781
- toString() {
1323782
- return `${this.location}: ${this.message}`;
1323783
- }
1323784
- };
1323785
-
1323786
- // ../yaml/loader/lib/YamlParser.js
1323787
- var import_promises6 = require("fs/promises");
1323788
- var import_yaml2 = __toESM(require_dist(), 1);
1323789
-
1323790
1323761
  // ../source/lib/constants.js
1323791
1323762
  var LOCATION_PROPERTY = "$loc";
1323792
1323763
 
@@ -1323952,16 +1323923,22 @@ var SourcedNullish = class {
1323952
1323923
  };
1323953
1323924
 
1323954
1323925
  // ../source/lib/SourceLocation.js
1323955
- var SourceLocation = class {
1323926
+ var SourceLocation = class _SourceLocation {
1323956
1323927
  absoluteFilePath;
1323957
1323928
  relativeFilePath;
1323958
1323929
  line;
1323959
1323930
  column;
1323960
- constructor({ absoluteFilePath, relativeFilePath, line, column }) {
1323931
+ /**
1323932
+ * If this location was resolved from a `$ref`, this contains the location
1323933
+ * of the file that contained the `$ref` reference.
1323934
+ */
1323935
+ refFrom;
1323936
+ constructor({ absoluteFilePath, relativeFilePath, line, column, refFrom }) {
1323961
1323937
  this.absoluteFilePath = absoluteFilePath;
1323962
1323938
  this.relativeFilePath = relativeFilePath;
1323963
1323939
  this.line = line;
1323964
1323940
  this.column = column;
1323941
+ this.refFrom = refFrom;
1323965
1323942
  }
1323966
1323943
  /**
1323967
1323944
  * Formats as "filepath:line:column" using the relative file path.
@@ -1323981,6 +1323958,50 @@ var SourceLocation = class {
1323981
1323958
  toAbsoluteString() {
1323982
1323959
  return `${this.absoluteFilePath}:${this.line}:${this.column}`;
1323983
1323960
  }
1323961
+ /**
1323962
+ * Creates a new SourceLocation with the given `$ref` location.
1323963
+ * This is used when resolving `$ref` references to track where
1323964
+ * the reference originated.
1323965
+ */
1323966
+ withRefFrom(refFrom) {
1323967
+ return new _SourceLocation({
1323968
+ absoluteFilePath: this.absoluteFilePath,
1323969
+ relativeFilePath: this.relativeFilePath,
1323970
+ line: this.line,
1323971
+ column: this.column,
1323972
+ refFrom
1323973
+ });
1323974
+ }
1323975
+ };
1323976
+
1323977
+ // ../yaml/loader/lib/ReferenceResolver.js
1323978
+ var import_promises6 = require("fs/promises");
1323979
+ var import_yaml2 = __toESM(require_dist(), 1);
1323980
+
1323981
+ // ../yaml/loader/lib/ValidationIssue.js
1323982
+ var ValidationIssue = class {
1323983
+ /** The validation error message */
1323984
+ message;
1323985
+ /** The source location where the issue was found */
1323986
+ location;
1323987
+ /** The path to the value in the YAML document (e.g., ["cli", "version"]) */
1323988
+ yamlPath;
1323989
+ constructor({ message, location: location2, yamlPath }) {
1323990
+ this.message = message;
1323991
+ this.location = location2;
1323992
+ this.yamlPath = yamlPath;
1323993
+ }
1323994
+ /**
1323995
+ * Formats as `<file>:<line>:<col>: <message>` for CLI output.
1323996
+ *
1323997
+ * @example
1323998
+ * ```
1323999
+ * fern.yml:6:13: org must be a string
1324000
+ * ```
1324001
+ */
1324002
+ toString() {
1324003
+ return `${this.location}: ${this.message}`;
1324004
+ }
1323984
1324005
  };
1323985
1324006
 
1323986
1324007
  // ../yaml/loader/lib/YamlDocument.js
@@ -1324049,7 +1324070,276 @@ var YamlDocument = class {
1324049
1324070
  }
1324050
1324071
  };
1324051
1324072
 
1324073
+ // ../yaml/loader/lib/ReferenceResolver.js
1324074
+ var REF_KEY = "$ref";
1324075
+ var ReferenceResolver = class {
1324076
+ cwd;
1324077
+ constructor({ cwd: cwd2 }) {
1324078
+ this.cwd = cwd2;
1324079
+ }
1324080
+ /**
1324081
+ * Resolves all `$ref` references in the given YAML document.
1324082
+ *
1324083
+ * @param document - The parsed YAML document
1324084
+ * @returns Result with either the resolved data or resolution issues
1324085
+ */
1324086
+ async resolve({ document: document4 }) {
1324087
+ const originalFile = document4.absoluteFilePath;
1324088
+ const context2 = {
1324089
+ cwd: this.cwd,
1324090
+ document: document4,
1324091
+ originalFile,
1324092
+ currentFile: originalFile,
1324093
+ resolutionStack: /* @__PURE__ */ new Set([originalFile]),
1324094
+ referencedDocuments: {},
1324095
+ issues: [],
1324096
+ pathMappings: [],
1324097
+ yamlPathIndex: 0,
1324098
+ refFromLocation: void 0
1324099
+ };
1324100
+ const resolved = await this.resolveValue({ context: context2, yamlPath: [], value: document4.toJS() });
1324101
+ if (context2.issues.length > 0) {
1324102
+ return {
1324103
+ success: false,
1324104
+ issues: context2.issues
1324105
+ };
1324106
+ }
1324107
+ return {
1324108
+ success: true,
1324109
+ data: resolved,
1324110
+ pathMappings: context2.pathMappings
1324111
+ };
1324112
+ }
1324113
+ /**
1324114
+ * Looks up the source location for a path, checking path mappings for referenced files.
1324115
+ *
1324116
+ * @param document - The original document.
1324117
+ * @param pathMappings - Path mappings returned from resolution.
1324118
+ * @param yamlPath - The path to look up.
1324119
+ * @returns The source location, with refFrom attached if the path is in a referenced file.
1324120
+ */
1324121
+ getSourceLocationWithMappings({ document: document4, pathMappings, yamlPath }) {
1324122
+ let bestMatch;
1324123
+ for (const mapping of pathMappings) {
1324124
+ if (this.yamlPathStartsWith(yamlPath, mapping.yamlPath)) {
1324125
+ if (bestMatch == null || mapping.yamlPath.length > bestMatch.yamlPath.length) {
1324126
+ bestMatch = mapping;
1324127
+ }
1324128
+ }
1324129
+ }
1324130
+ if (bestMatch != null) {
1324131
+ const localYamlPath = yamlPath.slice(bestMatch.yamlPath.length);
1324132
+ const location2 = bestMatch.document.getSourceLocation(localYamlPath);
1324133
+ return location2.withRefFrom(bestMatch.refFromLocation);
1324134
+ }
1324135
+ return document4.getSourceLocation(yamlPath);
1324136
+ }
1324137
+ async resolveValue({ context: context2, yamlPath, value }) {
1324138
+ if (value == null) {
1324139
+ return value;
1324140
+ }
1324141
+ if (Array.isArray(value)) {
1324142
+ return Promise.all(value.map((item, index3) => this.resolveValue({ context: context2, yamlPath: [...yamlPath, index3], value: item })));
1324143
+ }
1324144
+ if (typeof value === "object") {
1324145
+ const obj = value;
1324146
+ if (REF_KEY in obj) {
1324147
+ const refYamlPath = [...yamlPath, REF_KEY];
1324148
+ return this.resolveRef({
1324149
+ context: context2,
1324150
+ yamlPath: refYamlPath,
1324151
+ location: this.getSourceLocation({ context: context2, yamlPath: refYamlPath }),
1324152
+ obj,
1324153
+ refValue: obj[REF_KEY]
1324154
+ });
1324155
+ }
1324156
+ const resolved = {};
1324157
+ for (const key of Object.keys(obj)) {
1324158
+ resolved[key] = await this.resolveValue({ context: context2, yamlPath: [...yamlPath, key], value: obj[key] });
1324159
+ }
1324160
+ return resolved;
1324161
+ }
1324162
+ return value;
1324163
+ }
1324164
+ async resolveRef({ context: context2, yamlPath, location: location2, obj, refValue }) {
1324165
+ if (typeof refValue !== "string") {
1324166
+ context2.issues.push(new ValidationIssue({
1324167
+ message: `$ref must be a string, got ${typeof refValue}`,
1324168
+ location: location2,
1324169
+ yamlPath
1324170
+ }));
1324171
+ return obj;
1324172
+ }
1324173
+ const keys11 = Object.keys(obj);
1324174
+ if (keys11.length > 1) {
1324175
+ const siblingKeys = keys11.filter((k18) => k18 !== REF_KEY);
1324176
+ context2.issues.push(new ValidationIssue({
1324177
+ message: `$ref cannot have sibling keys; found ${siblingKeys.join(", ")}`,
1324178
+ location: location2,
1324179
+ yamlPath
1324180
+ }));
1324181
+ return obj;
1324182
+ }
1324183
+ if (refValue.includes("#")) {
1324184
+ context2.issues.push(new ValidationIssue({
1324185
+ message: `JSON pointer and in-document references are not supported: ${refValue}`,
1324186
+ location: location2,
1324187
+ yamlPath
1324188
+ }));
1324189
+ return obj;
1324190
+ }
1324191
+ const referencedFilePath = this.resolveFilePath({ currentFile: context2.currentFile, refValue });
1324192
+ if (context2.resolutionStack.has(referencedFilePath)) {
1324193
+ const cycle = [...context2.resolutionStack, referencedFilePath].join(" -> ");
1324194
+ context2.issues.push(new ValidationIssue({
1324195
+ message: `Circular $ref detected: ${cycle}`,
1324196
+ location: location2,
1324197
+ yamlPath
1324198
+ }));
1324199
+ return obj;
1324200
+ }
1324201
+ const resolvedReference = await this.parseFile({
1324202
+ context: context2,
1324203
+ referencedFilePath,
1324204
+ yamlPath,
1324205
+ location: location2,
1324206
+ refValue
1324207
+ });
1324208
+ if (resolvedReference === void 0) {
1324209
+ return obj;
1324210
+ }
1324211
+ if (resolvedReference === null) {
1324212
+ context2.issues.push(new ValidationIssue({
1324213
+ message: `$ref resolves to null: ${refValue}`,
1324214
+ location: location2,
1324215
+ yamlPath
1324216
+ }));
1324217
+ return obj;
1324218
+ }
1324219
+ const parentYamlPath = yamlPath.slice(0, -1);
1324220
+ const referencedDocument = context2.referencedDocuments[referencedFilePath];
1324221
+ if (referencedDocument != null) {
1324222
+ context2.pathMappings.push({
1324223
+ yamlPath: parentYamlPath,
1324224
+ document: referencedDocument,
1324225
+ refFromLocation: location2
1324226
+ });
1324227
+ }
1324228
+ const fullyResolvedReference = await this.resolveReferencedFile({
1324229
+ context: context2,
1324230
+ referencedFilePath,
1324231
+ refFromLocation: location2,
1324232
+ yamlPath: parentYamlPath,
1324233
+ value: resolvedReference
1324234
+ });
1324235
+ return fullyResolvedReference;
1324236
+ }
1324237
+ /**
1324238
+ * Resolves a value within the context of a referenced file, handling
1324239
+ * the bookkeeping for tracking the current file and YAML path index.
1324240
+ */
1324241
+ async resolveReferencedFile({ context: context2, referencedFilePath, refFromLocation, yamlPath, value }) {
1324242
+ const previousFile = context2.currentFile;
1324243
+ const previousYamlPathIndex = context2.yamlPathIndex;
1324244
+ const previousRefFromLocation = context2.refFromLocation;
1324245
+ context2.currentFile = referencedFilePath;
1324246
+ context2.yamlPathIndex = yamlPath.length;
1324247
+ context2.refFromLocation = refFromLocation;
1324248
+ context2.resolutionStack.add(referencedFilePath);
1324249
+ try {
1324250
+ return await this.resolveValue({ context: context2, yamlPath, value });
1324251
+ } finally {
1324252
+ context2.resolutionStack.delete(referencedFilePath);
1324253
+ context2.currentFile = previousFile;
1324254
+ context2.yamlPathIndex = previousYamlPathIndex;
1324255
+ context2.refFromLocation = previousRefFromLocation;
1324256
+ }
1324257
+ }
1324258
+ async parseFile({ context: context2, referencedFilePath, yamlPath, location: location2, refValue }) {
1324259
+ if (!await doesPathExist(referencedFilePath)) {
1324260
+ context2.issues.push(new ValidationIssue({
1324261
+ message: `Referenced file does not exist: ${refValue}`,
1324262
+ location: location2,
1324263
+ yamlPath
1324264
+ }));
1324265
+ return void 0;
1324266
+ }
1324267
+ const content5 = await (0, import_promises6.readFile)(referencedFilePath, "utf-8");
1324268
+ const parsedDocument = (0, import_yaml2.parseDocument)(content5);
1324269
+ if (parsedDocument.errors.length > 0) {
1324270
+ const errorMessages = parsedDocument.errors.map((e6) => e6.message).join("; ");
1324271
+ context2.issues.push(new ValidationIssue({
1324272
+ message: `Failed to parse referenced file ${refValue}: ${errorMessages}`,
1324273
+ location: location2,
1324274
+ yamlPath
1324275
+ }));
1324276
+ return void 0;
1324277
+ }
1324278
+ const yamlDocument = new YamlDocument({
1324279
+ absoluteFilePath: referencedFilePath,
1324280
+ relativeFilePath: RelativeFilePath2.of(relative3(context2.cwd, referencedFilePath)),
1324281
+ document: parsedDocument,
1324282
+ source: content5
1324283
+ });
1324284
+ context2.referencedDocuments[referencedFilePath] = yamlDocument;
1324285
+ return yamlDocument.toJS();
1324286
+ }
1324287
+ /**
1324288
+ * Returns the source location for a value at the given path.
1324289
+ *
1324290
+ * For the original document, we use the YamlDocument's precise location tracking.
1324291
+ * For referenced files, we look up the cached YamlDocument and compute the
1324292
+ * local path within that file, attaching the original `$ref` location via `withRefFrom`.
1324293
+ */
1324294
+ getSourceLocation({ context: context2, yamlPath }) {
1324295
+ if (context2.currentFile === context2.originalFile) {
1324296
+ return context2.document.getSourceLocation(yamlPath);
1324297
+ }
1324298
+ const location2 = this.getSourceLocationFromCurrentFile({ context: context2, yamlPath });
1324299
+ if (context2.refFromLocation != null) {
1324300
+ return location2.withRefFrom(context2.refFromLocation);
1324301
+ }
1324302
+ return location2;
1324303
+ }
1324304
+ /**
1324305
+ * Checks if a YAML path starts with a given prefix.
1324306
+ */
1324307
+ yamlPathStartsWith(path76, prefix2) {
1324308
+ if (prefix2.length > path76.length) {
1324309
+ return false;
1324310
+ }
1324311
+ for (let i11 = 0; i11 < prefix2.length; i11++) {
1324312
+ if (path76[i11] !== prefix2[i11]) {
1324313
+ return false;
1324314
+ }
1324315
+ }
1324316
+ return true;
1324317
+ }
1324318
+ getSourceLocationFromCurrentFile({ context: context2, yamlPath }) {
1324319
+ const doc = context2.referencedDocuments[context2.currentFile];
1324320
+ if (doc != null) {
1324321
+ const localYamlPath = yamlPath.slice(context2.yamlPathIndex);
1324322
+ return doc.getSourceLocation(localYamlPath);
1324323
+ }
1324324
+ return this.createLocationForReferencedFile({ context: context2, absoluteFilePath: context2.currentFile });
1324325
+ }
1324326
+ createLocationForReferencedFile({ context: context2, absoluteFilePath }) {
1324327
+ return new SourceLocation({
1324328
+ absoluteFilePath,
1324329
+ relativeFilePath: RelativeFilePath2.of(relative3(context2.cwd, absoluteFilePath)),
1324330
+ line: 1,
1324331
+ column: 1
1324332
+ });
1324333
+ }
1324334
+ resolveFilePath({ currentFile, refValue }) {
1324335
+ const currentDir = dirname4(currentFile);
1324336
+ return join2(currentDir, RelativeFilePath2.of(refValue));
1324337
+ }
1324338
+ };
1324339
+
1324052
1324340
  // ../yaml/loader/lib/YamlParser.js
1324341
+ var import_promises7 = require("fs/promises");
1324342
+ var import_yaml3 = __toESM(require_dist(), 1);
1324053
1324343
  var YamlParser = class {
1324054
1324344
  /**
1324055
1324345
  * Loads and parses a YAML file.
@@ -1324059,8 +1324349,8 @@ var YamlParser = class {
1324059
1324349
  * @throws Error if the file cannot be read or contains invalid YAML.
1324060
1324350
  */
1324061
1324351
  async parse(absoluteFilePath) {
1324062
- const source2 = await (0, import_promises6.readFile)(absoluteFilePath, "utf-8");
1324063
- return (0, import_yaml2.parse)(source2);
1324352
+ const source2 = await (0, import_promises7.readFile)(absoluteFilePath, "utf-8");
1324353
+ return (0, import_yaml3.parse)(source2);
1324064
1324354
  }
1324065
1324355
  /**
1324066
1324356
  * Loads and parses a YAML file, preserving source location information.
@@ -1324073,8 +1324363,8 @@ var YamlParser = class {
1324073
1324363
  * @throws Error if the file cannot be read or contains invalid YAML.
1324074
1324364
  */
1324075
1324365
  async parseDocument({ absoluteFilePath, cwd: cwd2 }) {
1324076
- const source2 = await (0, import_promises6.readFile)(absoluteFilePath, "utf-8");
1324077
- const document4 = (0, import_yaml2.parseDocument)(source2);
1324366
+ const source2 = await (0, import_promises7.readFile)(absoluteFilePath, "utf-8");
1324367
+ const document4 = (0, import_yaml3.parseDocument)(source2);
1324078
1324368
  const relativeFilePath = RelativeFilePath.of(relative2(cwd2, absoluteFilePath));
1324079
1324369
  return new YamlDocument({
1324080
1324370
  absoluteFilePath,
@@ -1324133,15 +1324423,18 @@ var YamlSourceResolver = class {
1324133
1324423
  var YamlConfigLoader = class {
1324134
1324424
  parser;
1324135
1324425
  cwd;
1324426
+ referenceResolver;
1324136
1324427
  constructor({ cwd: cwd2 }) {
1324137
1324428
  this.parser = new YamlParser();
1324138
1324429
  this.cwd = cwd2;
1324430
+ this.referenceResolver = new ReferenceResolver({ cwd: cwd2 });
1324139
1324431
  }
1324140
1324432
  /**
1324141
1324433
  * Loads and validates a YAML configuration file with source location tracking.
1324142
1324434
  *
1324143
1324435
  * @param absoluteFilePath - The absolute path to the YAML file.
1324144
1324436
  * @param schema - The zod schema to validate against.
1324437
+ * @param resolveReferences - Whether to resolve `$ref` references before validation (default: true).
1324145
1324438
  * @returns Result with either the parsed config (both plain and sourced) or validation errors.
1324146
1324439
  *
1324147
1324440
  * @example
@@ -1324154,16 +1324447,27 @@ var YamlConfigLoader = class {
1324154
1324447
  * }
1324155
1324448
  * ```
1324156
1324449
  */
1324157
- async load({ absoluteFilePath, schema: schema2 }) {
1324450
+ async load({ absoluteFilePath, schema: schema2, resolveReferences = true }) {
1324158
1324451
  const document4 = await this.parseDocument(absoluteFilePath);
1324159
- const parseResult = schema2.safeParse(document4.toJS());
1324452
+ const resolved = await this.resolveReferences({ document: document4, resolveReferences });
1324453
+ if (!resolved.success) {
1324454
+ return {
1324455
+ success: false,
1324456
+ issues: resolved.issues
1324457
+ };
1324458
+ }
1324459
+ const parseResult = schema2.safeParse(resolved.data);
1324160
1324460
  if (!parseResult.success) {
1324161
1324461
  const issues = parseResult.error.issues.map((issue2) => {
1324162
1324462
  const yamlPath = issue2.path.filter((p9) => typeof p9 !== "symbol");
1324163
1324463
  return new ValidationIssue({
1324164
1324464
  yamlPath,
1324165
1324465
  message: this.formatZodIssue(issue2),
1324166
- location: document4.getSourceLocation(yamlPath)
1324466
+ location: this.referenceResolver.getSourceLocationWithMappings({
1324467
+ document: document4,
1324468
+ pathMappings: resolved.pathMappings,
1324469
+ yamlPath
1324470
+ })
1324167
1324471
  });
1324168
1324472
  });
1324169
1324473
  return {
@@ -1324171,11 +1324475,11 @@ var YamlConfigLoader = class {
1324171
1324475
  issues
1324172
1324476
  };
1324173
1324477
  }
1324174
- const resolver2 = new YamlSourceResolver(document4);
1324478
+ const sourceResolver = new YamlSourceResolver(document4);
1324175
1324479
  return {
1324176
1324480
  success: true,
1324177
1324481
  data: parseResult.data,
1324178
- sourced: resolver2.toSourced(parseResult.data),
1324482
+ sourced: sourceResolver.toSourced(parseResult.data),
1324179
1324483
  absoluteFilePath,
1324180
1324484
  relativeFilePath: RelativeFilePath2.of(relative3(this.cwd, absoluteFilePath))
1324181
1324485
  };
@@ -1324187,6 +1324491,23 @@ var YamlConfigLoader = class {
1324187
1324491
  throw new Error(`Failed to parse YAML file ${absoluteFilePath}: ${err instanceof Error ? err.message : String(err)}`);
1324188
1324492
  }
1324189
1324493
  }
1324494
+ async resolveReferences({ document: document4, resolveReferences }) {
1324495
+ if (!resolveReferences) {
1324496
+ return {
1324497
+ success: true,
1324498
+ data: document4.toJS(),
1324499
+ pathMappings: []
1324500
+ };
1324501
+ }
1324502
+ const resolveResult = await this.referenceResolver.resolve({ document: document4 });
1324503
+ if (!resolveResult.success) {
1324504
+ return {
1324505
+ success: false,
1324506
+ issues: resolveResult.issues
1324507
+ };
1324508
+ }
1324509
+ return resolveResult;
1324510
+ }
1324190
1324511
  formatZodIssue(issue2) {
1324191
1324512
  const path76 = issue2.path.join(".");
1324192
1324513
  switch (issue2.code) {
@@ -1324513,13 +1324834,18 @@ var FernYmlSchemaLoader = class {
1324513
1324834
  }
1324514
1324835
  /**
1324515
1324836
  * Finds, loads, and validates a fern.yml configuration file.
1324837
+ * This also resolves and validates any `$ref` nodes in the
1324838
+ * configuration.
1324516
1324839
  *
1324517
1324840
  * @returns Result with either the parsed config or validation errors.
1324518
1324841
  * @throws Error if fern.yml is not found.
1324519
1324842
  */
1324520
1324843
  async load() {
1324521
1324844
  const absoluteFilePath = await this.finder.findOrThrow(FernYml.FILENAME);
1324522
- return await this.loader.load({ absoluteFilePath, schema: FernYmlSchema });
1324845
+ return await this.loader.load({
1324846
+ absoluteFilePath,
1324847
+ schema: FernYmlSchema
1324848
+ });
1324523
1324849
  }
1324524
1324850
  };
1324525
1324851
 
@@ -1331450,10 +1331776,10 @@ var ProductFileConfig = schemas_exports4.object({
1331450
1331776
  });
1331451
1331777
 
1331452
1331778
  // ../configuration/lib/fernignoreUtils.js
1331453
- var import_promises7 = require("fs/promises");
1331779
+ var import_promises8 = require("fs/promises");
1331454
1331780
  var NEW_LINE_REGEX = /\r?\n/;
1331455
1331781
  async function getFernIgnorePaths({ absolutePathToFernignore }) {
1331456
- const fernIgnoreFileContents = (await (0, import_promises7.readFile)(absolutePathToFernignore)).toString();
1331782
+ const fernIgnoreFileContents = (await (0, import_promises8.readFile)(absolutePathToFernignore)).toString();
1331457
1331783
  return parseFernIgnoreContents(fernIgnoreFileContents);
1331458
1331784
  }
1331459
1331785
  function parseFernIgnoreContents(fernIgnoreFileContents) {
@@ -1334289,7 +1334615,7 @@ function isPath(value) {
1334289
1334615
  }
1334290
1334616
 
1334291
1334617
  // ../configuration-loader/lib/dependencies-yml/loadRawDependenciesConfiguration.js
1334292
- var import_promises8 = require("fs/promises");
1334618
+ var import_promises9 = require("fs/promises");
1334293
1334619
 
1334294
1334620
  // ../../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
1334295
1334621
  function isNothing(subject) {
@@ -1336926,7 +1337252,7 @@ async function loadRawDependenciesConfiguration({ absolutePathToWorkspace, conte
1336926
1337252
  if (!await doesPathExist(absolutePathToDependenciesConfiguration)) {
1336927
1337253
  return void 0;
1336928
1337254
  }
1336929
- const contentsStr = await (0, import_promises8.readFile)(absolutePathToDependenciesConfiguration);
1337255
+ const contentsStr = await (0, import_promises9.readFile)(absolutePathToDependenciesConfiguration);
1336930
1337256
  const contentsParsed = jsYaml.load(contentsStr.toString());
1336931
1337257
  return await validateSchema({
1336932
1337258
  schema: DependenciesConfigurationSchema,
@@ -1410577,15 +1410903,15 @@ var Pruner = class _Pruner {
1410577
1410903
  };
1410578
1410904
 
1410579
1410905
  // ../configuration-loader/lib/docs-yml/parseDocsConfiguration.js
1410580
- var import_promises11 = require("fs/promises");
1410906
+ var import_promises12 = require("fs/promises");
1410581
1410907
  var import_path16 = __toESM(require("path"), 1);
1410582
1410908
 
1410583
1410909
  // ../configuration-loader/lib/docs-yml/getAllPages.js
1410584
- var import_promises9 = require("fs/promises");
1410910
+ var import_promises10 = require("fs/promises");
1410585
1410911
  var BATCH_SIZE = 100;
1410586
1410912
  async function loadBatch({ files, absolutePathToFernFolder }) {
1410587
1410913
  const pairs2 = await Promise.all(files.map(async (file2) => {
1410588
- const content5 = await (0, import_promises9.readFile)(file2, "utf-8");
1410914
+ const content5 = await (0, import_promises10.readFile)(file2, "utf-8");
1410589
1410915
  return [relativize(absolutePathToFernFolder, file2), content5];
1410590
1410916
  }));
1410591
1410917
  return Object.fromEntries(pairs2);
@@ -1410694,7 +1411020,7 @@ function getAllPagesFromApiReferenceLayoutItem({ item }) {
1410694
1411020
  }
1410695
1411021
 
1410696
1411022
  // ../configuration-loader/lib/docs-yml/navigationUtils.js
1410697
- var import_promises10 = require("fs/promises");
1411023
+ var import_promises11 = require("fs/promises");
1410698
1411024
  var import_gray_matter = __toESM(require_gray_matter(), 1);
1410699
1411025
  function nameToSlug({ name: name3 }) {
1410700
1411026
  return name3.replace(/\.(md|mdx)$/i, "").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
@@ -1410702,7 +1411028,7 @@ function nameToSlug({ name: name3 }) {
1410702
1411028
  function nameToTitle({ name: name3 }) {
1410703
1411029
  return name3.replace(/\.(md|mdx)$/i, "").replace(/[-_]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
1410704
1411030
  }
1410705
- async function getFrontmatterPosition({ absolutePath, readFileFn = (path76, encoding) => (0, import_promises10.readFile)(path76, encoding) }) {
1411031
+ async function getFrontmatterPosition({ absolutePath, readFileFn = (path76, encoding) => (0, import_promises11.readFile)(path76, encoding) }) {
1410706
1411032
  try {
1410707
1411033
  const content5 = await readFileFn(absolutePath, "utf-8");
1410708
1411034
  const { data: data2 } = (0, import_gray_matter.default)(content5);
@@ -1410718,7 +1411044,7 @@ async function getFrontmatterPosition({ absolutePath, readFileFn = (path76, enco
1410718
1411044
  return void 0;
1410719
1411045
  }
1410720
1411046
  }
1410721
- async function buildNavigationForDirectory({ directoryPath, getDir = getDirectoryContents, readFileFn = (path76, encoding) => (0, import_promises10.readFile)(path76, encoding) }) {
1411047
+ async function buildNavigationForDirectory({ directoryPath, getDir = getDirectoryContents, readFileFn = (path76, encoding) => (0, import_promises11.readFile)(path76, encoding) }) {
1410722
1411048
  const contents = await getDir(directoryPath);
1410723
1411049
  const markdownFiles = contents.filter((item) => item.type === "file" && (item.name.endsWith(".md") || item.name.endsWith(".mdx")));
1410724
1411050
  const subdirectories = contents.filter((item) => item.type === "directory");
@@ -1410975,7 +1411301,7 @@ async function convertCssConfig(css, absoluteFilepathToDocsConfig) {
1410975
1411301
  const cssFilePaths = typeof css === "string" ? [css] : css;
1410976
1411302
  return {
1410977
1411303
  inline: await Promise.all(cssFilePaths.map(async (cssFilePath) => {
1410978
- const content5 = await (0, import_promises11.readFile)(resolveFilepath(cssFilePath, absoluteFilepathToDocsConfig));
1411304
+ const content5 = await (0, import_promises12.readFile)(resolveFilepath(cssFilePath, absoluteFilepathToDocsConfig));
1410979
1411305
  return content5.toString();
1410980
1411306
  }))
1410981
1411307
  };
@@ -1411134,7 +1411460,7 @@ async function getVersionedNavigationConfiguration({ versions, absolutePathToFer
1411134
1411460
  const versionedNavbars = [];
1411135
1411461
  for (const version7 of versions) {
1411136
1411462
  const absoluteFilepathToVersionFile = resolve5(absolutePathToFernFolder, version7.path);
1411137
- const versionContent = jsYaml.load((await (0, import_promises11.readFile)(absoluteFilepathToVersionFile)).toString());
1411463
+ const versionContent = jsYaml.load((await (0, import_promises12.readFile)(absoluteFilepathToVersionFile)).toString());
1411138
1411464
  const removedPaths = [];
1411139
1411465
  const sanitizedVersionContent = sanitizeNullValues(versionContent, [], removedPaths);
1411140
1411466
  if (removedPaths.length > 0) {
@@ -1411182,7 +1411508,7 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
1411182
1411508
  if ("path" in product) {
1411183
1411509
  let navigation2;
1411184
1411510
  const absoluteFilepathToProductFile = resolve5(absolutePathToFernFolder, product.path);
1411185
- const content5 = jsYaml.load((await (0, import_promises11.readFile)(absoluteFilepathToProductFile)).toString());
1411511
+ const content5 = jsYaml.load((await (0, import_promises12.readFile)(absoluteFilepathToProductFile)).toString());
1411186
1411512
  const removedPaths = [];
1411187
1411513
  const sanitizedContent = sanitizeNullValues(content5, [], removedPaths);
1411188
1411514
  if (removedPaths.length > 0) {
@@ -1411876,7 +1412202,7 @@ function parseAudiences(raw2) {
1411876
1412202
  }
1411877
1412203
 
1411878
1412204
  // ../configuration-loader/lib/fern-config-json/loadProjectConfig.js
1411879
- var import_promises12 = require("fs/promises");
1412205
+ var import_promises13 = require("fs/promises");
1411880
1412206
 
1411881
1412207
  // ../configuration-loader/lib/fern-config-json/schema/ProjectConfigSchema.js
1411882
1412208
  var ProjectConfigSchema = external_exports2.strictObject({
@@ -1411887,7 +1412213,7 @@ var ProjectConfigSchema = external_exports2.strictObject({
1411887
1412213
  // ../configuration-loader/lib/fern-config-json/loadProjectConfig.js
1411888
1412214
  async function loadProjectConfig({ directory, context: context2 }) {
1411889
1412215
  const pathToConfig = join2(directory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME));
1411890
- const projectConfigStr = await (0, import_promises12.readFile)(pathToConfig);
1412216
+ const projectConfigStr = await (0, import_promises13.readFile)(pathToConfig);
1411891
1412217
  const projectConfigParsed = JSON.parse(projectConfigStr.toString());
1411892
1412218
  const rawProjectConfig = await validateSchema({
1411893
1412219
  schema: ProjectConfigSchema,
@@ -1412289,7 +1412615,7 @@ async function addGenerator({ generatorName, generatorsConfiguration, groupName
1412289
1412615
  }
1412290
1412616
 
1412291
1412617
  // ../../commons/github/lib/ClonedRepository.js
1412292
- var import_promises13 = require("fs/promises");
1412618
+ var import_promises14 = require("fs/promises");
1412293
1412619
  var import_path17 = __toESM(require("path"), 1);
1412294
1412620
 
1412295
1412621
  // ../../../node_modules/.pnpm/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
@@ -1417037,18 +1417363,18 @@ var ClonedRepository = class _ClonedRepository {
1417037
1417363
  }
1417038
1417364
  async overwriteLocalContents(sourceDirectoryPath) {
1417039
1417365
  const [sourceContents, destContents] = await Promise.all([
1417040
- (0, import_promises13.readdir)(sourceDirectoryPath),
1417041
- (0, import_promises13.readdir)(this.clonePath)
1417366
+ (0, import_promises14.readdir)(sourceDirectoryPath),
1417367
+ (0, import_promises14.readdir)(this.clonePath)
1417042
1417368
  ]);
1417043
1417369
  await Promise.all(destContents.filter((content5) => !DEFAULT_IGNORED_FILES.includes(content5)).map(async (content5) => {
1417044
- await (0, import_promises13.rm)((0, import_path17.resolve)(this.clonePath, content5), {
1417370
+ await (0, import_promises14.rm)((0, import_path17.resolve)(this.clonePath, content5), {
1417045
1417371
  recursive: true,
1417046
1417372
  force: true
1417047
1417373
  });
1417048
1417374
  }));
1417049
1417375
  await Promise.all(sourceContents.filter((content5) => !DEFAULT_IGNORED_FILES.includes(content5)).map(async (content5) => {
1417050
1417376
  const path76 = (0, import_path17.resolve)(sourceDirectoryPath, content5);
1417051
- await (0, import_promises13.cp)(path76, (0, import_path17.resolve)(this.clonePath, content5), { recursive: true });
1417377
+ await (0, import_promises14.cp)(path76, (0, import_path17.resolve)(this.clonePath, content5), { recursive: true });
1417052
1417378
  }));
1417053
1417379
  }
1417054
1417380
  async readFile({ relativeFilePath }) {
@@ -1417056,12 +1417382,12 @@ var ClonedRepository = class _ClonedRepository {
1417056
1417382
  if (!await doesPathExist2(absoluteFilePath)) {
1417057
1417383
  return void 0;
1417058
1417384
  }
1417059
- return await (0, import_promises13.readFile)(absoluteFilePath, "utf-8");
1417385
+ return await (0, import_promises14.readFile)(absoluteFilePath, "utf-8");
1417060
1417386
  }
1417061
1417387
  };
1417062
1417388
  async function doesPathExist2(filepath) {
1417063
1417389
  try {
1417064
- await (0, import_promises13.lstat)(filepath);
1417390
+ await (0, import_promises14.lstat)(filepath);
1417065
1417391
  return true;
1417066
1417392
  } catch {
1417067
1417393
  return false;
@@ -1417394,7 +1417720,7 @@ var LruObject = class {
1417394
1417720
  // ../configuration-loader/lib/generators-yml/convertGeneratorsConfiguration.js
1417395
1417721
  var import_fiddle_sdk = __toESM(require_fiddle_sdk(), 1);
1417396
1417722
  var import_api = __toESM(require_api2(), 1);
1417397
- var import_promises14 = require("fs/promises");
1417723
+ var import_promises15 = require("fs/promises");
1417398
1417724
  var import_path18 = __toESM(require("path"), 1);
1417399
1417725
  var UNDEFINED_API_DEFINITION_SETTINGS = {
1417400
1417726
  shouldUseTitleAsName: void 0,
@@ -1418031,7 +1418357,7 @@ async function getGithubLicense({ absolutePathToGeneratorsConfiguration, githubL
1418031
1418357
  }
1418032
1418358
  }
1418033
1418359
  const absolutePathToLicense = join2(AbsoluteFilePath2.of(import_path18.default.dirname(absolutePathToGeneratorsConfiguration)), RelativeFilePath2.of(githubLicense.custom));
1418034
- const licenseContent = await (0, import_promises14.readFile)(absolutePathToLicense);
1418360
+ const licenseContent = await (0, import_promises15.readFile)(absolutePathToLicense);
1418035
1418361
  return import_fiddle_sdk.FernFiddle.GithubLicense.custom({
1418036
1418362
  contents: licenseContent.toString()
1418037
1418363
  });
@@ -1418210,14 +1418536,14 @@ function isGithubSelfhosted(github) {
1418210
1418536
  }
1418211
1418537
 
1418212
1418538
  // ../configuration-loader/lib/generators-yml/loadGeneratorsConfiguration.js
1418213
- var import_promises15 = require("fs/promises");
1418539
+ var import_promises16 = require("fs/promises");
1418214
1418540
  var import_path19 = __toESM(require("path"), 1);
1418215
1418541
  async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context: context2 }) {
1418216
1418542
  const filepath = await getPathToGeneratorsConfiguration({ absolutePathToWorkspace });
1418217
1418543
  if (filepath == null) {
1418218
1418544
  return void 0;
1418219
1418545
  }
1418220
- const contentsStr = await (0, import_promises15.readFile)(filepath);
1418546
+ const contentsStr = await (0, import_promises16.readFile)(filepath);
1418221
1418547
  try {
1418222
1418548
  const contentsParsed = jsYaml.load(contentsStr.toString());
1418223
1418549
  const parsed = generators_yml_exports.serialization.GeneratorsConfigurationSchema.parse(contentsParsed, {
@@ -1418294,7 +1418620,7 @@ async function getFernDirectory(nameOverride) {
1418294
1418620
  }
1418295
1418621
 
1418296
1418622
  // ../init/lib/initializeAPI.js
1418297
- var import_promises23 = require("fs/promises");
1418623
+ var import_promises24 = require("fs/promises");
1418298
1418624
  var import_fs_extra = __toESM(require_lib6(), 1);
1418299
1418625
  var import_path23 = __toESM(require("path"), 1);
1418300
1418626
 
@@ -1422888,7 +1423214,7 @@ async function createOrganizationIfDoesNotExist({ organization, token, context:
1422888
1423214
  }
1422889
1423215
 
1422890
1423216
  // ../auth/lib/persistence/getToken.js
1422891
- var import_promises16 = require("fs/promises");
1423217
+ var import_promises17 = require("fs/promises");
1422892
1423218
 
1422893
1423219
  // ../auth/lib/persistence/getPathToTokenFile.js
1422894
1423220
  var import_os = require("os");
@@ -1422919,7 +1423245,7 @@ async function getUserToken() {
1422919
1423245
  if (!doesTokenFileExist) {
1422920
1423246
  return void 0;
1422921
1423247
  }
1422922
- const tokenFileContents = await (0, import_promises16.readFile)(pathToTokenFile);
1423248
+ const tokenFileContents = await (0, import_promises17.readFile)(pathToTokenFile);
1422923
1423249
  const tokenString = tokenFileContents.toString().trim();
1422924
1423250
  if (tokenString.length === 0) {
1422925
1423251
  return void 0;
@@ -1422931,11 +1423257,11 @@ async function getUserToken() {
1422931
1423257
  }
1422932
1423258
 
1422933
1423259
  // ../auth/lib/persistence/removeToken.js
1422934
- var import_promises17 = require("fs/promises");
1423260
+ var import_promises18 = require("fs/promises");
1422935
1423261
  async function removeToken() {
1422936
1423262
  const pathToTokenFile = getPathToTokenFile();
1422937
1423263
  try {
1422938
- await (0, import_promises17.unlink)(pathToTokenFile);
1423264
+ await (0, import_promises18.unlink)(pathToTokenFile);
1422939
1423265
  } catch (error49) {
1422940
1423266
  if (error49.code !== "ENOENT") {
1422941
1423267
  throw error49;
@@ -1422944,12 +1423270,12 @@ async function removeToken() {
1422944
1423270
  }
1422945
1423271
 
1422946
1423272
  // ../auth/lib/persistence/storeToken.js
1422947
- var import_promises18 = require("fs/promises");
1423273
+ var import_promises19 = require("fs/promises");
1422948
1423274
  var import_path20 = __toESM(require("path"), 1);
1422949
1423275
  async function storeToken(token) {
1422950
1423276
  const pathToTokenFile = getPathToTokenFile();
1422951
- await (0, import_promises18.mkdir)(import_path20.default.dirname(pathToTokenFile), { recursive: true });
1422952
- await (0, import_promises18.writeFile)(pathToTokenFile, token);
1423277
+ await (0, import_promises19.mkdir)(import_path20.default.dirname(pathToTokenFile), { recursive: true });
1423278
+ await (0, import_promises19.writeFile)(pathToTokenFile, token);
1422953
1423279
  }
1422954
1423280
 
1422955
1423281
  // ../auth/lib/users/getCurrentUser.js
@@ -1428934,7 +1429260,7 @@ var AccessTokenPosthogManager = class {
1428934
1429260
  properties: {
1428935
1429261
  ...event,
1428936
1429262
  ...event.properties,
1428937
- version: "3.47.3",
1429263
+ version: "3.47.4",
1428938
1429264
  usingAccessToken: true
1428939
1429265
  }
1428940
1429266
  });
@@ -1428956,7 +1429282,7 @@ var NoopPosthogManager = class {
1428956
1429282
  };
1428957
1429283
 
1428958
1429284
  // ../posthog-manager/lib/UserPosthogManager.js
1428959
- var import_promises19 = require("fs/promises");
1429285
+ var import_promises20 = require("fs/promises");
1428960
1429286
  var import_os2 = require("os");
1428961
1429287
  var import_path22 = require("path");
1428962
1429288
 
@@ -1429033,7 +1429359,7 @@ var UserPosthogManager = class {
1429033
1429359
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1429034
1429360
  event: "CLI",
1429035
1429361
  properties: {
1429036
- version: "3.47.3",
1429362
+ version: "3.47.4",
1429037
1429363
  ...event,
1429038
1429364
  ...event.properties,
1429039
1429365
  usingAccessToken: false,
@@ -1429072,10 +1429398,10 @@ var UserPosthogManager = class {
1429072
1429398
  if (this.persistedDistinctId == null) {
1429073
1429399
  const pathToFile = join2(AbsoluteFilePath2.of((0, import_os2.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER2), RelativeFilePath2.of(DISTINCT_ID_FILENAME));
1429074
1429400
  if (!await doesPathExist(pathToFile)) {
1429075
- await (0, import_promises19.mkdir)((0, import_path22.dirname)(pathToFile), { recursive: true });
1429076
- await (0, import_promises19.writeFile)(pathToFile, v4_default());
1429401
+ await (0, import_promises20.mkdir)((0, import_path22.dirname)(pathToFile), { recursive: true });
1429402
+ await (0, import_promises20.writeFile)(pathToFile, v4_default());
1429077
1429403
  }
1429078
- this.persistedDistinctId = (await (0, import_promises19.readFile)(pathToFile)).toString();
1429404
+ this.persistedDistinctId = (await (0, import_promises20.readFile)(pathToFile)).toString();
1429079
1429405
  }
1429080
1429406
  return this.persistedDistinctId;
1429081
1429407
  }
@@ -1433606,7 +1433932,7 @@ function constructAuth0LogoutUrl() {
1433606
1433932
  }
1433607
1433933
 
1433608
1433934
  // ../init/lib/createFernDirectoryAndOrganization.js
1433609
- var import_promises20 = require("fs/promises");
1433935
+ var import_promises21 = require("fs/promises");
1433610
1433936
  var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
1433611
1433937
  async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
1433612
1433938
  const pathToFernDirectory = join2(cwd(), RelativeFilePath2.of(FERN_DIRECTORY));
@@ -1433635,7 +1433961,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
1433635
1433961
  }
1433636
1433962
  }
1433637
1433963
  }
1433638
- await (0, import_promises20.mkdir)(FERN_DIRECTORY);
1433964
+ await (0, import_promises21.mkdir)(FERN_DIRECTORY);
1433639
1433965
  await writeProjectConfig({
1433640
1433966
  filepath: join2(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
1433641
1433967
  organization,
@@ -1433659,11 +1433985,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
1433659
1433985
  organization,
1433660
1433986
  version: versionOfCli
1433661
1433987
  };
1433662
- await (0, import_promises20.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
1433988
+ await (0, import_promises21.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
1433663
1433989
  }
1433664
1433990
  async function writeGitignore({ absolutePathToFernDirectory }) {
1433665
1433991
  const gitignorePath = join2(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
1433666
- await (0, import_promises20.writeFile)(gitignorePath, GITIGNORE_CONTENT);
1433992
+ await (0, import_promises21.writeFile)(gitignorePath, GITIGNORE_CONTENT);
1433667
1433993
  }
1433668
1433994
 
1433669
1433995
  // ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
@@ -1433847,7 +1434173,7 @@ async function formatDefinitionFile({ fileContents }) {
1433847
1434173
  }
1433848
1434174
 
1433849
1434175
  // ../fern-definition/formatter/lib/formatWorkspace.js
1433850
- var import_promises21 = require("fs/promises");
1434176
+ var import_promises22 = require("fs/promises");
1433851
1434177
  async function formatFernWorkspace({ workspace, context: context2, shouldFix }) {
1433852
1434178
  for (const [relativeFilepath, file2] of entries(workspace.definition.namedDefinitionFiles)) {
1433853
1434179
  const formatted = await formatDefinitionFile({
@@ -1433855,7 +1434181,7 @@ async function formatFernWorkspace({ workspace, context: context2, shouldFix })
1433855
1434181
  });
1433856
1434182
  if (formatted !== file2.rawContents) {
1433857
1434183
  if (shouldFix) {
1433858
- await (0, import_promises21.writeFile)(file2.absoluteFilePath, formatted);
1434184
+ await (0, import_promises22.writeFile)(file2.absoluteFilePath, formatted);
1433859
1434185
  context2.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
1433860
1434186
  } else {
1433861
1434187
  context2.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
@@ -1433866,7 +1434192,7 @@ async function formatFernWorkspace({ workspace, context: context2, shouldFix })
1433866
1434192
  }
1433867
1434193
 
1433868
1434194
  // ../init/lib/createWorkspace.js
1433869
- var import_promises22 = require("fs/promises");
1434195
+ var import_promises23 = require("fs/promises");
1433870
1434196
 
1433871
1434197
  // ../init/lib/sampleImdbApi.js
1433872
1434198
  var SAMPLE_IMDB_API = `
@@ -1433934,7 +1434260,7 @@ errors:
1433934
1434260
  // ../init/lib/createWorkspace.js
1433935
1434261
  async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context2 }) {
1433936
1434262
  if (!await doesPathExist(directoryOfWorkspace)) {
1433937
- await (0, import_promises22.mkdir)(directoryOfWorkspace);
1434263
+ await (0, import_promises23.mkdir)(directoryOfWorkspace);
1433938
1434264
  }
1433939
1434265
  await writeGeneratorsConfiguration({
1433940
1434266
  filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
@@ -1433948,7 +1434274,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
1433948
1434274
  }
1433949
1434275
  async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context2 }) {
1433950
1434276
  if (!await doesPathExist(directoryOfWorkspace)) {
1433951
- await (0, import_promises22.mkdir)(directoryOfWorkspace);
1434277
+ await (0, import_promises23.mkdir)(directoryOfWorkspace);
1433952
1434278
  }
1433953
1434279
  await writeGeneratorsConfiguration({
1433954
1434280
  filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
@@ -1433994,7 +1434320,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context2
1433994
1434320
  return config3;
1433995
1434321
  }
1433996
1434322
  async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context2, apiConfiguration }) {
1433997
- await (0, import_promises22.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context2, apiConfiguration }), {
1434323
+ await (0, import_promises23.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context2, apiConfiguration }), {
1433998
1434324
  sortKeys: (a10, b18) => {
1433999
1434325
  if (a10 === "api") {
1434000
1434326
  return -1;
@@ -1434013,10 +1434339,10 @@ var ROOT_API = {
1434013
1434339
  }
1434014
1434340
  };
1434015
1434341
  async function writeSampleApiDefinition({ directoryOfDefinition }) {
1434016
- await (0, import_promises22.mkdir)(directoryOfDefinition);
1434017
- await (0, import_promises22.writeFile)(join2(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(ROOT_API));
1434342
+ await (0, import_promises23.mkdir)(directoryOfDefinition);
1434343
+ await (0, import_promises23.writeFile)(join2(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(ROOT_API));
1434018
1434344
  const absoluteFilepathToImdbYaml = join2(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
1434019
- await (0, import_promises22.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
1434345
+ await (0, import_promises23.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
1434020
1434346
  fileContents: SAMPLE_IMDB_API
1434021
1434347
  }));
1434022
1434348
  }
@@ -1434062,13 +1434388,13 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
1434062
1434388
  const apiWorkspaceDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
1434063
1434389
  const inlinedDefinitionDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
1434064
1434390
  const workspaceDefinitionDirectory = join2(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
1434065
- await (0, import_promises23.mkdir)(apiWorkspaceDirectory, { recursive: true });
1434391
+ await (0, import_promises24.mkdir)(apiWorkspaceDirectory, { recursive: true });
1434066
1434392
  await import_fs_extra.default.move(inlinedDefinitionDirectory, workspaceDefinitionDirectory);
1434067
1434393
  const inlinedGeneratorsYml = join2(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME));
1434068
1434394
  const workspaceGeneratorsYml = join2(apiWorkspaceDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME));
1434069
1434395
  await import_fs_extra.default.move(inlinedGeneratorsYml, workspaceGeneratorsYml);
1434070
1434396
  const newApiDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api1"));
1434071
- await (0, import_promises23.mkdir)(workspaceDefinitionDirectory, { recursive: true });
1434397
+ await (0, import_promises24.mkdir)(workspaceDefinitionDirectory, { recursive: true });
1434072
1434398
  return newApiDirectory;
1434073
1434399
  }
1434074
1434400
  return absolutePathToFernDirectory;
@@ -1434083,7 +1434409,7 @@ async function hasInlinedAPIDefinitions({ absolutePathToFernDirectory }) {
1434083
1434409
  }
1434084
1434410
 
1434085
1434411
  // ../init/lib/initializeDocs.js
1434086
- var import_promises24 = require("fs/promises");
1434412
+ var import_promises25 = require("fs/promises");
1434087
1434413
 
1434088
1434414
  // ../../commons/core-utils/src/titleCase.ts
1434089
1434415
  var import_title3 = __toESM(require_lib(), 1);
@@ -1434499,7 +1434825,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
1434499
1434825
  } else {
1434500
1434826
  try {
1434501
1434827
  const docsConfig = getDocsConfig(createDirectoryResponse.organization);
1434502
- await (0, import_promises24.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
1434828
+ await (0, import_promises25.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
1434503
1434829
  taskContext.logger.info(source_default.green("Created docs configuration"));
1434504
1434830
  return;
1434505
1434831
  } catch (writeError) {
@@ -1434547,7 +1434873,7 @@ var FernDocsBuilder = class {
1434547
1434873
  };
1434548
1434874
 
1434549
1434875
  // ../docs-importers/commons/lib/FernDocsBuilderImpl.js
1434550
- var import_promises25 = require("fs/promises");
1434876
+ var import_promises26 = require("fs/promises");
1434551
1434877
  var FernDocsBuilderImpl = class extends FernDocsBuilder {
1434552
1434878
  openApiSpecs = {};
1434553
1434879
  nonTabbedNavigation = new NonTabbedNavigationBuilderImpl();
@@ -1434606,7 +1434932,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
1434606
1434932
  }
1434607
1434933
  async build({ outputDirectory }) {
1434608
1434934
  const absolutePathToFernDirectory = join2(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
1434609
- await (0, import_promises25.mkdir)(absolutePathToFernDirectory, { recursive: true });
1434935
+ await (0, import_promises26.mkdir)(absolutePathToFernDirectory, { recursive: true });
1434610
1434936
  if (Object.keys(this.tabbedNavigation).length > 0) {
1434611
1434937
  this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key, value]) => {
1434612
1434938
  return [value.tabId, value.tabConfig];
@@ -1434631,27 +1434957,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
1434631
1434957
  }))
1434632
1434958
  };
1434633
1434959
  }
1434634
- await (0, import_promises25.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
1434960
+ await (0, import_promises26.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
1434635
1434961
  await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
1434636
1434962
  const absolutePathToOpenAPI = join2(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
1434637
- await (0, import_promises25.mkdir)(dirname4(absolutePathToOpenAPI), { recursive: true });
1434638
- await (0, import_promises25.cp)(absolutePath, absolutePathToOpenAPI);
1434963
+ await (0, import_promises26.mkdir)(dirname4(absolutePathToOpenAPI), { recursive: true });
1434964
+ await (0, import_promises26.cp)(absolutePath, absolutePathToOpenAPI);
1434639
1434965
  }));
1434640
1434966
  }
1434641
- await (0, import_promises25.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
1434967
+ await (0, import_promises26.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
1434642
1434968
  await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
1434643
1434969
  const absoluteFilepathToMarkdownPage = join2(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
1434644
- await (0, import_promises25.mkdir)(dirname4(absoluteFilepathToMarkdownPage), { recursive: true });
1434970
+ await (0, import_promises26.mkdir)(dirname4(absoluteFilepathToMarkdownPage), { recursive: true });
1434645
1434971
  const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
1434646
1434972
  ${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
1434647
1434973
 
1434648
1434974
  ` : "";
1434649
- await (0, import_promises25.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
1434975
+ await (0, import_promises26.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
1434650
1434976
  }));
1434651
1434977
  await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
1434652
1434978
  const absolutePathToAsset = join2(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
1434653
- await (0, import_promises25.mkdir)(dirname4(absolutePathToAsset), { recursive: true });
1434654
- await (0, import_promises25.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
1434979
+ await (0, import_promises26.mkdir)(dirname4(absolutePathToAsset), { recursive: true });
1434980
+ await (0, import_promises26.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
1434655
1434981
  }));
1434656
1434982
  }
1434657
1434983
  setInstance({ companyName }) {
@@ -1434683,7 +1435009,7 @@ var NonTabbedNavigationBuilderImpl = class {
1434683
1435009
  };
1434684
1435010
 
1434685
1435011
  // ../docs-importers/mintlify/lib/MintlifyImporter.js
1434686
- var import_promises27 = require("fs/promises");
1435012
+ var import_promises28 = require("fs/promises");
1434687
1435013
 
1434688
1435014
  // ../docs-importers/mintlify/lib/convertColors.js
1434689
1435015
  function convertColors(colors19) {
@@ -1434737,10 +1435063,10 @@ function convertLogo({ logo, builder, absolutePathToMintJson }) {
1434737
1435063
  }
1434738
1435064
 
1434739
1435065
  // ../docs-importers/mintlify/lib/convertMarkdown.js
1434740
- var import_promises26 = require("fs/promises");
1435066
+ var import_promises27 = require("fs/promises");
1434741
1435067
  var import_gray_matter2 = __toESM(require_gray_matter(), 1);
1434742
1435068
  async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
1434743
- const text9 = await (0, import_promises26.readFile)(absoluteFilepathToMarkdown, "utf-8");
1435069
+ const text9 = await (0, import_promises27.readFile)(absoluteFilepathToMarkdown, "utf-8");
1434744
1435070
  const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
1434745
1435071
  const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
1434746
1435072
  const transformedContent = markReferencedAssets({
@@ -1434903,7 +1435229,7 @@ var MintlifyImporter = class extends DocsImporter {
1434903
1435229
  documentationTab = void 0;
1434904
1435230
  tabUrlToInfo = {};
1434905
1435231
  async import({ args, builder }) {
1434906
- const mintJsonContent = await (0, import_promises27.readFile)(args.absolutePathToMintJson, "utf-8");
1435232
+ const mintJsonContent = await (0, import_promises28.readFile)(args.absolutePathToMintJson, "utf-8");
1434907
1435233
  const mint = JSON.parse(mintJsonContent);
1434908
1435234
  builder.setTitle({ title: mint.name });
1434909
1435235
  const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
@@ -1435028,7 +1435354,7 @@ var MintlifyImporter = class extends DocsImporter {
1435028
1435354
  };
1435029
1435355
 
1435030
1435356
  // ../docs-importers/mintlify/lib/runMintlifyMigration.js
1435031
- var import_promises28 = require("fs/promises");
1435357
+ var import_promises29 = require("fs/promises");
1435032
1435358
  async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
1435033
1435359
  const mintlifyImporter = new MintlifyImporter({
1435034
1435360
  context: taskContext
@@ -1435039,7 +1435365,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
1435039
1435365
  builder
1435040
1435366
  });
1435041
1435367
  await builder.build({ outputDirectory: outputPath });
1435042
- await (0, import_promises28.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
1435368
+ await (0, import_promises29.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
1435043
1435369
  version: versionOfCli,
1435044
1435370
  organization
1435045
1435371
  }, void 0, 4));
@@ -1435284,7 +1435610,7 @@ function assertIsStringArray(val) {
1435284
1435610
  }
1435285
1435611
 
1435286
1435612
  // ../docs-importers/readme/lib/ReadmeImporter.js
1435287
- var import_promises33 = require("fs/promises");
1435613
+ var import_promises34 = require("fs/promises");
1435288
1435614
 
1435289
1435615
  // ../docs-importers/readme/lib/extract/favicon.js
1435290
1435616
  async function getFavicon(hast) {
@@ -1475136,7 +1475462,7 @@ init_AsyncIterableUtil();
1475136
1475462
  init_disposable();
1475137
1475463
 
1475138
1475464
  // ../../../node_modules/.pnpm/puppeteer-core@24.23.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
1475139
- var import_promises31 = require("fs/promises");
1475465
+ var import_promises32 = require("fs/promises");
1475140
1475466
  var import_node_os8 = __toESM(require("os"), 1);
1475141
1475467
  var import_node_path16 = __toESM(require("path"), 1);
1475142
1475468
 
@@ -1476552,7 +1476878,7 @@ var TimeoutError2 = class extends Error {
1476552
1476878
  var import_node_assert2 = __toESM(require("assert"), 1);
1476553
1476879
  var import_node_child_process3 = require("child_process");
1476554
1476880
  var import_node_fs10 = require("fs");
1476555
- var import_promises30 = require("fs/promises");
1476881
+ var import_promises31 = require("fs/promises");
1476556
1476882
  var import_node_os6 = __toESM(require("os"), 1);
1476557
1476883
  var import_node_path14 = __toESM(require("path"), 1);
1476558
1476884
  var import_progress = __toESM(require_progress(), 1);
@@ -1476560,7 +1476886,7 @@ var import_progress = __toESM(require_progress(), 1);
1476560
1476886
  // ../../../node_modules/.pnpm/@puppeteer+browsers@2.10.10/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js
1476561
1476887
  var import_node_child_process2 = require("child_process");
1476562
1476888
  var import_node_fs9 = require("fs");
1476563
- var import_promises29 = require("fs/promises");
1476889
+ var import_promises30 = require("fs/promises");
1476564
1476890
  var path28 = __toESM(require("path"), 1);
1476565
1476891
  var import_node_stream3 = require("stream");
1476566
1476892
  var import_debug5 = __toESM(require_src(), 1);
@@ -1476994,7 +1477320,7 @@ var ChromeLauncher = class extends BrowserLauncher {
1476994
1477320
  });
1476995
1477321
  if (userDataDirIndex < 0) {
1476996
1477322
  isTempUserDataDir = true;
1476997
- chromeArguments.push(`--user-data-dir=${await (0, import_promises31.mkdtemp)(this.getProfilePath())}`);
1477323
+ chromeArguments.push(`--user-data-dir=${await (0, import_promises32.mkdtemp)(this.getProfilePath())}`);
1476998
1477324
  userDataDirIndex = chromeArguments.length - 1;
1476999
1477325
  }
1477000
1477326
  const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
@@ -1477158,7 +1477484,7 @@ function removeMatchingFlags(array2, flag) {
1477158
1477484
 
1477159
1477485
  // ../../../node_modules/.pnpm/puppeteer-core@24.23.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
1477160
1477486
  var import_node_fs13 = __toESM(require("fs"), 1);
1477161
- var import_promises32 = require("fs/promises");
1477487
+ var import_promises33 = require("fs/promises");
1477162
1477488
  var import_node_os9 = __toESM(require("os"), 1);
1477163
1477489
  var import_node_path17 = __toESM(require("path"), 1);
1477164
1477490
  init_util2();
@@ -1477211,7 +1477537,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
1477211
1477537
  }
1477212
1477538
  isTempUserDataDir = false;
1477213
1477539
  } else {
1477214
- userDataDir = await (0, import_promises32.mkdtemp)(this.getProfilePath());
1477540
+ userDataDir = await (0, import_promises33.mkdtemp)(this.getProfilePath());
1477215
1477541
  firefoxArguments.push("--profile");
1477216
1477542
  firefoxArguments.push(userDataDir);
1477217
1477543
  }
@@ -1477252,8 +1477578,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
1477252
1477578
  const prefsBackupPath = import_node_path17.default.join(userDataDir, file2 + backupSuffix);
1477253
1477579
  if (import_node_fs13.default.existsSync(prefsBackupPath)) {
1477254
1477580
  const prefsPath = import_node_path17.default.join(userDataDir, file2);
1477255
- await (0, import_promises32.unlink)(prefsPath);
1477256
- await (0, import_promises32.rename)(prefsBackupPath, prefsPath);
1477581
+ await (0, import_promises33.unlink)(prefsPath);
1477582
+ await (0, import_promises33.rename)(prefsBackupPath, prefsPath);
1477257
1477583
  }
1477258
1477584
  }));
1477259
1477585
  for (const result of results) {
@@ -1478285,7 +1478611,7 @@ var ReadmeImporter = class extends DocsImporter {
1478285
1478611
  if (response.ok) {
1478286
1478612
  const imageBuffer = Buffer.from(await response.arrayBuffer());
1478287
1478613
  const faviconPath = join2(assetsDirectory, RelativeFilePath2.of("favicon"));
1478288
- await (0, import_promises33.writeFile)(faviconPath, new Uint8Array(imageBuffer));
1478614
+ await (0, import_promises34.writeFile)(faviconPath, new Uint8Array(imageBuffer));
1478289
1478615
  builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
1478290
1478616
  }
1478291
1478617
  }
@@ -1478302,7 +1478628,7 @@ var ReadmeImporter = class extends DocsImporter {
1478302
1478628
  */
1478303
1478629
  async getAndCreateAssetsDirectory() {
1478304
1478630
  const assetsDirectory = join2(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
1478305
- await (0, import_promises33.mkdir)(assetsDirectory, { recursive: true });
1478631
+ await (0, import_promises34.mkdir)(assetsDirectory, { recursive: true });
1478306
1478632
  return assetsDirectory;
1478307
1478633
  }
1478308
1478634
  /**
@@ -1478352,7 +1478678,7 @@ var ReadmeImporter = class extends DocsImporter {
1478352
1478678
  absolutePathToOutputDirectory,
1478353
1478679
  section
1478354
1478680
  });
1478355
- await (0, import_promises33.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
1478681
+ await (0, import_promises34.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
1478356
1478682
  await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
1478357
1478683
  const url3 = new URL(page.slug.toString(), this.url);
1478358
1478684
  this.logger.debug(`Fetching page: ${url3.toString()}`);
@@ -1478367,7 +1478693,7 @@ var ReadmeImporter = class extends DocsImporter {
1478367
1478693
  absolutePathToOutputDirectoryForSection,
1478368
1478694
  page: page.slug
1478369
1478695
  });
1478370
- await (0, import_promises33.writeFile)(absolutePathForPage, result.data.mdx);
1478696
+ await (0, import_promises34.writeFile)(absolutePathForPage, result.data.mdx);
1478371
1478697
  if (result.data.images.imageURLs.length > 0) {
1478372
1478698
  this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
1478373
1478699
  await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
@@ -1478380,8 +1478706,8 @@ var ReadmeImporter = class extends DocsImporter {
1478380
1478706
  const imageBuffer = Buffer.from(await response.arrayBuffer());
1478381
1478707
  const imagePath = join2(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
1478382
1478708
  const imageDir = dirname4(imagePath);
1478383
- await (0, import_promises33.mkdir)(imageDir, { recursive: true });
1478384
- await (0, import_promises33.writeFile)(imagePath, new Uint8Array(imageBuffer));
1478709
+ await (0, import_promises34.mkdir)(imageDir, { recursive: true });
1478710
+ await (0, import_promises34.writeFile)(imagePath, new Uint8Array(imageBuffer));
1478385
1478711
  this.logger.debug(`Saved image to ${imagePath}`);
1478386
1478712
  } catch (error49) {
1478387
1478713
  this.logger.warn(`Error downloading image ${imageUrl}: ${error49}`);
@@ -1478463,7 +1478789,7 @@ var ReadmeImporter = class extends DocsImporter {
1478463
1478789
  };
1478464
1478790
 
1478465
1478791
  // ../docs-importers/readme/lib/runReadmeMigration.js
1478466
- var import_promises34 = require("fs/promises");
1478792
+ var import_promises35 = require("fs/promises");
1478467
1478793
  async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
1478468
1478794
  const builder = new FernDocsBuilderImpl();
1478469
1478795
  builder.setInstance({ companyName: organization });
@@ -1478478,7 +1478804,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
1478478
1478804
  builder
1478479
1478805
  });
1478480
1478806
  await builder.build({ outputDirectory: outputPath });
1478481
- await (0, import_promises34.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
1478807
+ await (0, import_promises35.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
1478482
1478808
  version: versionOfCli,
1478483
1478809
  organization
1478484
1478810
  }, void 0, 4));
@@ -1498096,7 +1498422,7 @@ var AbstractConverter = class _AbstractConverter {
1498096
1498422
  };
1498097
1498423
 
1498098
1498424
  // ../api-importers/v3-importer-commons/lib/ErrorCollector.js
1498099
- var import_promises35 = require("fs/promises");
1498425
+ var import_promises36 = require("fs/promises");
1498100
1498426
 
1498101
1498427
  // ../../../node_modules/.pnpm/js-yaml-source-map@0.2.2_js-yaml@4.1.1/node_modules/js-yaml-source-map/dist/esm/index.js
1498102
1498428
  var SourceMap = class {
@@ -1498383,7 +1498709,7 @@ var BreadcrumbToLineNumber = class {
1498383
1498709
  return;
1498384
1498710
  }
1498385
1498711
  try {
1498386
- const fileContent = await (0, import_promises35.readFile)(this.relativePathToFile, "utf-8");
1498712
+ const fileContent = await (0, import_promises36.readFile)(this.relativePathToFile, "utf-8");
1498387
1498713
  jsYaml.load(fileContent, { listener: this.map.listen() });
1498388
1498714
  this.initialized = true;
1498389
1498715
  } catch (error49) {
@@ -1505104,7 +1505430,7 @@ Yargs2.Parser = Parser5;
1505104
1505430
  var yargs_default2 = Yargs2;
1505105
1505431
 
1505106
1505432
  // ../init/src/utils/loadOpenApiFromUrl.ts
1505107
- var import_promises36 = require("fs/promises");
1505433
+ var import_promises37 = require("fs/promises");
1505108
1505434
  var import_path24 = require("path");
1505109
1505435
  var import_tmp_promise3 = __toESM(require_tmp_promise(), 1);
1505110
1505436
  async function loadOpenAPIFromUrl({ url: url3, logger }) {
@@ -1505114,7 +1505440,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger }) {
1505114
1505440
  const filePath = (0, import_path24.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
1505115
1505441
  logger.debug("tmpDir", tmpDir.path);
1505116
1505442
  logger.debug("filePath", filePath);
1505117
- await (0, import_promises36.writeFile)(filePath, data2);
1505443
+ await (0, import_promises37.writeFile)(filePath, data2);
1505118
1505444
  return {
1505119
1505445
  status: "success" /* Success */,
1505120
1505446
  filePath
@@ -1508406,7 +1508732,7 @@ var CliContext = class {
1508406
1508732
  if (false) {
1508407
1508733
  this.logger.error("CLI_VERSION is not defined");
1508408
1508734
  }
1508409
- return "3.47.3";
1508735
+ return "3.47.4";
1508410
1508736
  }
1508411
1508737
  getCliName() {
1508412
1508738
  if (false) {
@@ -1537781,7 +1538107,7 @@ __export(types_exports10, {
1537781
1538107
  });
1537782
1538108
 
1537783
1538109
  // ../api-importers/conjure/conjure-to-fern/lib/utils/listConjureFiles.js
1537784
- var import_promises37 = require("fs/promises");
1538110
+ var import_promises38 = require("fs/promises");
1537785
1538111
  async function listConjureFiles(root6, extensionGlob) {
1537786
1538112
  const files = [];
1537787
1538113
  for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
@@ -1537793,7 +1538119,7 @@ async function listConjureFiles(root6, extensionGlob) {
1537793
1538119
  return files;
1537794
1538120
  }
1537795
1538121
  async function createConjureFile({ relativeFilepath, absoluteFilepath }) {
1537796
- const rawContents = (await (0, import_promises37.readFile)(absoluteFilepath)).toString().replaceAll(/: rid(?:$|\s)/g, ": string\n").replaceAll("<rid>", "<string>").replaceAll("rid>", "string>").replaceAll(": safelong", ": long").replaceAll("<safelong>", "<long>").replaceAll("safelong>", "long>").replaceAll(": any", ": unknown").replaceAll("<any>", "<unknown>").replaceAll("any>", "unknown>");
1538122
+ const rawContents = (await (0, import_promises38.readFile)(absoluteFilepath)).toString().replaceAll(/: rid(?:$|\s)/g, ": string\n").replaceAll("<rid>", "<string>").replaceAll("rid>", "string>").replaceAll(": safelong", ": long").replaceAll("<safelong>", "<long>").replaceAll("safelong>", "long>").replaceAll(": any", ": unknown").replaceAll("<any>", "<unknown>").replaceAll("any>", "unknown>");
1537797
1538123
  return {
1537798
1538124
  relativeFilepath,
1537799
1538125
  absoluteFilepath,
@@ -1538295,7 +1538621,7 @@ function parseZodIssue(issue2) {
1538295
1538621
  }
1538296
1538622
 
1538297
1538623
  // ../workspace/lazy-fern-workspace/lib/utils/listFernFiles.js
1538298
- var import_promises38 = require("fs/promises");
1538624
+ var import_promises39 = require("fs/promises");
1538299
1538625
  async function listFernFiles(root6, extensionGlob) {
1538300
1538626
  const files = [];
1538301
1538627
  for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
@@ -1538310,7 +1538636,7 @@ async function createFernFile({ relativeFilepath, absoluteFilepath }) {
1538310
1538636
  return {
1538311
1538637
  relativeFilepath,
1538312
1538638
  absoluteFilepath,
1538313
- fileContents: (await (0, import_promises38.readFile)(absoluteFilepath)).toString()
1538639
+ fileContents: (await (0, import_promises39.readFile)(absoluteFilepath)).toString()
1538314
1538640
  };
1538315
1538641
  }
1538316
1538642
 
@@ -1538351,10 +1538677,10 @@ async function parseYamlFiles(files) {
1538351
1538677
  // ../workspace/lazy-fern-workspace/lib/utils/loadDependency.js
1538352
1538678
  var import_fiddle_sdk3 = __toESM(require_fiddle_sdk(), 1);
1538353
1538679
  var import_fs16 = require("fs");
1538354
- var import_promises40 = require("fs/promises");
1538680
+ var import_promises41 = require("fs/promises");
1538355
1538681
  var import_os3 = require("os");
1538356
1538682
  var import_path29 = __toESM(require("path"), 1);
1538357
- var import_promises41 = require("stream/promises");
1538683
+ var import_promises42 = require("stream/promises");
1538358
1538684
 
1538359
1538685
  // ../../../node_modules/.pnpm/@isaacs+fs-minipass@4.0.1/node_modules/@isaacs/fs-minipass/dist/esm/index.js
1538360
1538686
  var import_events10 = __toESM(require("events"), 1);
@@ -1542001,7 +1542327,7 @@ var chownrSync = (p9, uid, gid) => {
1542001
1542327
 
1542002
1542328
  // ../../../node_modules/.pnpm/tar@7.5.3/node_modules/tar/dist/esm/mkdir.js
1542003
1542329
  var import_node_fs19 = __toESM(require("fs"), 1);
1542004
- var import_promises39 = __toESM(require("fs/promises"), 1);
1542330
+ var import_promises40 = __toESM(require("fs/promises"), 1);
1542005
1542331
  var import_node_path27 = __toESM(require("path"), 1);
1542006
1542332
 
1542007
1542333
  // ../../../node_modules/.pnpm/tar@7.5.3/node_modules/tar/dist/esm/cwd-error.js
@@ -1542072,7 +1542398,7 @@ var mkdir11 = (dir, opt, cb2) => {
1542072
1542398
  return checkCwd(dir, done);
1542073
1542399
  }
1542074
1542400
  if (preserve) {
1542075
- return import_promises39.default.mkdir(dir, { mode, recursive: true }).then(
1542401
+ return import_promises40.default.mkdir(dir, { mode, recursive: true }).then(
1542076
1542402
  (made) => done(null, made ?? void 0),
1542077
1542403
  // oh, ts
1542078
1542404
  done
@@ -1543391,7 +1543717,7 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
1543391
1543717
  }
1543392
1543718
  context2.logger.info("Downloading...");
1543393
1543719
  context2.logger.debug("Remote URL: " + response.body.definitionS3DownloadUrl);
1543394
- await (0, import_promises40.mkdir)(pathToDefinition, { recursive: true });
1543720
+ await (0, import_promises41.mkdir)(pathToDefinition, { recursive: true });
1543395
1543721
  try {
1543396
1543722
  await downloadDependency({
1543397
1543723
  s3PreSignedReadUrl: response.body.definitionS3DownloadUrl,
@@ -1543402,9 +1543728,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
1543402
1543728
  return void 0;
1543403
1543729
  }
1543404
1543730
  metadata = response.body;
1543405
- await (0, import_promises40.writeFile)(pathToMetadata, JSON.stringify(metadata));
1543731
+ await (0, import_promises41.writeFile)(pathToMetadata, JSON.stringify(metadata));
1543406
1543732
  } else {
1543407
- metadata = JSON.parse((await (0, import_promises40.readFile)(pathToMetadata)).toString());
1543733
+ metadata = JSON.parse((await (0, import_promises41.readFile)(pathToMetadata)).toString());
1543408
1543734
  }
1543409
1543735
  context2.logger.info("Parsing...");
1543410
1543736
  if (loadAPIWorkspace2 == null) {
@@ -1543434,7 +1543760,7 @@ async function downloadDependency({ s3PreSignedReadUrl, absolutePathToLocalOutpu
1543434
1543760
  });
1543435
1543761
  const tmpDir = await import_tmp_promise4.default.dir();
1543436
1543762
  const outputTarPath = import_path29.default.join(tmpDir.path, "api.tgz");
1543437
- await (0, import_promises41.pipeline)(request6.data, (0, import_fs16.createWriteStream)(outputTarPath));
1543763
+ await (0, import_promises42.pipeline)(request6.data, (0, import_fs16.createWriteStream)(outputTarPath));
1543438
1543764
  await extract({ file: outputTarPath, cwd: absolutePathToLocalOutput });
1543439
1543765
  }
1543440
1543766
  function stringifyDependency(dependency) {
@@ -1552888,7 +1553214,7 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
1552888
1553214
  };
1552889
1553215
 
1552890
1553216
  // ../workspace/lazy-fern-workspace/lib/loaders/OpenAPILoader.js
1552891
- var import_promises46 = require("fs/promises");
1553217
+ var import_promises47 = require("fs/promises");
1552892
1553218
 
1552893
1553219
  // ../workspace/lazy-fern-workspace/lib/utils/convertOpenAPIV2ToV3.js
1552894
1553220
  var import_swagger2openapi = __toESM(require_swagger2openapi(), 1);
@@ -1552898,14 +1553224,14 @@ async function convertOpenAPIV2ToV3(openAPI) {
1552898
1553224
  }
1552899
1553225
 
1552900
1553226
  // ../workspace/lazy-fern-workspace/lib/utils/loadAsyncAPI.js
1552901
- var import_promises43 = require("fs/promises");
1553227
+ var import_promises44 = require("fs/promises");
1552902
1553228
 
1552903
1553229
  // ../workspace/lazy-fern-workspace/lib/loaders/mergeWithOverrides.js
1552904
- var import_promises42 = require("fs/promises");
1553230
+ var import_promises43 = require("fs/promises");
1552905
1553231
  async function mergeWithOverrides2({ absoluteFilePathToOverrides, data: data2, context: context2, allowNullKeys }) {
1552906
1553232
  let parsedOverrides = null;
1552907
1553233
  try {
1552908
- const contents = (await (0, import_promises42.readFile)(absoluteFilePathToOverrides, "utf8")).toString();
1553234
+ const contents = (await (0, import_promises43.readFile)(absoluteFilePathToOverrides, "utf8")).toString();
1552909
1553235
  try {
1552910
1553236
  parsedOverrides = JSON.parse(contents);
1552911
1553237
  } catch (err) {
@@ -1552919,7 +1553245,7 @@ async function mergeWithOverrides2({ absoluteFilePathToOverrides, data: data2, c
1552919
1553245
 
1552920
1553246
  // ../workspace/lazy-fern-workspace/lib/utils/loadAsyncAPI.js
1552921
1553247
  async function loadAsyncAPI({ context: context2, absoluteFilePath, absoluteFilePathToOverrides }) {
1552922
- const contents = (await (0, import_promises43.readFile)(absoluteFilePath)).toString();
1553248
+ const contents = (await (0, import_promises44.readFile)(absoluteFilePath)).toString();
1552923
1553249
  const parsed = await jsYaml.load(contents);
1552924
1553250
  if (absoluteFilePathToOverrides != null) {
1552925
1553251
  return await mergeWithOverrides2({
@@ -1552932,10 +1553258,10 @@ async function loadAsyncAPI({ context: context2, absoluteFilePath, absoluteFileP
1552932
1553258
  }
1552933
1553259
 
1552934
1553260
  // ../workspace/lazy-fern-workspace/lib/utils/loadOpenAPI.js
1552935
- var import_promises45 = require("fs/promises");
1553261
+ var import_promises46 = require("fs/promises");
1552936
1553262
 
1552937
1553263
  // ../workspace/lazy-fern-workspace/lib/loaders/applyOverlays.js
1552938
- var import_promises44 = require("fs/promises");
1553264
+ var import_promises45 = require("fs/promises");
1552939
1553265
  var import_path31 = __toESM(require("path"), 1);
1552940
1553266
  var import_tmp_promise5 = __toESM(require_tmp_promise(), 1);
1552941
1553267
  var tempDir;
@@ -1552960,14 +1553286,14 @@ async function applyOverlays({ absoluteFilePathToOverlay, absoluteFilePathToOpen
1552960
1553286
  const originalFileName = import_path31.default.basename(absoluteFilePathToOpenAPI);
1552961
1553287
  const outputFileName = `${import_path31.default.parse(originalFileName).name}.overlaid.json`;
1552962
1553288
  const outputPath = import_path31.default.join(dir, outputFileName);
1552963
- await (0, import_promises44.writeFile)(outputPath, JSON.stringify(result, null, 2), "utf8");
1553289
+ await (0, import_promises45.writeFile)(outputPath, JSON.stringify(result, null, 2), "utf8");
1552964
1553290
  context2.logger.info(`Wrote overlaid OpenAPI spec to: ${outputPath}`);
1552965
1553291
  return result;
1552966
1553292
  }
1552967
1553293
  async function parseOverlayFile(absoluteFilePathToOverlay, context2) {
1552968
1553294
  let contents;
1552969
1553295
  try {
1552970
- contents = await (0, import_promises44.readFile)(absoluteFilePathToOverlay, "utf8");
1553296
+ contents = await (0, import_promises45.readFile)(absoluteFilePathToOverlay, "utf8");
1552971
1553297
  } catch (err) {
1552972
1553298
  return context2.failAndThrow(`Failed to read overlay file at ${absoluteFilePathToOverlay}: ${err}`);
1552973
1553299
  }
@@ -1553122,7 +1553448,7 @@ async function loadOpenAPI({ context: context2, absolutePathToOpenAPI, absoluteP
1553122
1553448
  if (loadAiExamples) {
1553123
1553449
  const aiExamplesOverrideFilepath = join2(dirname4(absolutePathToOpenAPI), RelativeFilePath2.of("ai_examples_override.yml"));
1553124
1553450
  try {
1553125
- const overrideContent = await (0, import_promises45.readFile)(aiExamplesOverrideFilepath, "utf-8");
1553451
+ const overrideContent = await (0, import_promises46.readFile)(aiExamplesOverrideFilepath, "utf-8");
1553126
1553452
  const overrideData = jsYaml.load(overrideContent);
1553127
1553453
  if (overrideData?.paths && result.paths) {
1553128
1553454
  for (const [path76, methods] of Object.entries(overrideData.paths)) {
@@ -1553177,7 +1553503,7 @@ var OpenAPILoader = class {
1553177
1553503
  const documents = [];
1553178
1553504
  for (const spec of specs) {
1553179
1553505
  try {
1553180
- const contents = (await (0, import_promises46.readFile)(spec.absoluteFilepath)).toString();
1553506
+ const contents = (await (0, import_promises47.readFile)(spec.absoluteFilepath)).toString();
1553181
1553507
  let sourceRelativePath = relative3(this.absoluteFilePath, spec.source.file);
1553182
1553508
  if (spec.source.relativePathToDependency != null) {
1553183
1553509
  sourceRelativePath = join2(spec.source.relativePathToDependency, sourceRelativePath);
@@ -1557877,7 +1558203,7 @@ var OpenRPCConverterContext3_1 = class extends AbstractConverterContext {
1557877
1558203
  };
1557878
1558204
 
1557879
1558205
  // ../workspace/lazy-fern-workspace/lib/OSSWorkspace.js
1557880
- var import_promises50 = require("fs/promises");
1558206
+ var import_promises51 = require("fs/promises");
1557881
1558207
 
1557882
1558208
  // ../../commons/casings-generator/src/reserved.ts
1557883
1558209
  var RESERVED_KEYWORDS2 = {
@@ -1558638,9 +1558964,9 @@ function preprocessName2(name3) {
1558638
1558964
  }
1558639
1558965
 
1558640
1558966
  // ../workspace/lazy-fern-workspace/lib/utils/loadOpenRpc.js
1558641
- var import_promises47 = require("fs/promises");
1558967
+ var import_promises48 = require("fs/promises");
1558642
1558968
  async function loadOpenRpc({ context: context2, absoluteFilePath, absoluteFilePathToOverrides }) {
1558643
- const contents = (await (0, import_promises47.readFile)(absoluteFilePath)).toString();
1558969
+ const contents = (await (0, import_promises48.readFile)(absoluteFilePath)).toString();
1558644
1558970
  let parsed;
1558645
1558971
  try {
1558646
1558972
  parsed = JSON.parse(contents);
@@ -1558693,7 +1559019,7 @@ function createLoggingExecutable(executable, { logger, ...loggingExecaOptions }
1558693
1559019
  }
1558694
1559020
 
1558695
1559021
  // ../workspace/lazy-fern-workspace/lib/protobuf/ProtobufIRGenerator.js
1558696
- var import_promises48 = require("fs/promises");
1559022
+ var import_promises49 = require("fs/promises");
1558697
1559023
  var import_path35 = __toESM(require("path"), 1);
1558698
1559024
  var import_tmp_promise7 = __toESM(require_tmp_promise(), 1);
1558699
1559025
 
@@ -1558849,7 +1559175,7 @@ var ProtobufIRGenerator = class {
1558849
1559175
  this.context.logger.info(`Using buf export with version: ${version7}`);
1558850
1559176
  const tmpBufConfigFile = await import_tmp_promise7.default.file({ postfix: ".yaml" });
1558851
1559177
  const configContent = version7 === "v1" ? PROTOBUF_EXPORT_CONFIG_V1 : PROTOBUF_EXPORT_CONFIG_V2;
1558852
- await (0, import_promises48.writeFile)(tmpBufConfigFile.path, configContent, "utf8");
1559178
+ await (0, import_promises49.writeFile)(tmpBufConfigFile.path, configContent, "utf8");
1558853
1559179
  try {
1558854
1559180
  const result = await runExeca(this.context.logger, "buf", [
1558855
1559181
  "export",
@@ -1558878,7 +1559204,7 @@ var ProtobufIRGenerator = class {
1558878
1559204
  }
1558879
1559205
  }
1558880
1559206
  async copyProtobufFilesFromRoot({ protobufGeneratorConfigPath, absoluteFilepathToProtobufRoot }) {
1558881
- await (0, import_promises48.cp)(absoluteFilepathToProtobufRoot, protobufGeneratorConfigPath, {
1559207
+ await (0, import_promises49.cp)(absoluteFilepathToProtobufRoot, protobufGeneratorConfigPath, {
1558882
1559208
  recursive: true,
1558883
1559209
  filter: (src) => {
1558884
1559210
  const basename6 = import_path35.default.basename(src);
@@ -1558887,7 +1559213,7 @@ var ProtobufIRGenerator = class {
1558887
1559213
  });
1558888
1559214
  }
1558889
1559215
  async setupRemainingProtobufConfig({ protobufGeneratorConfigPath }) {
1558890
- await (0, import_promises48.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of("package.json")), PROTOBUF_MODULE_PACKAGE_JSON);
1559216
+ await (0, import_promises49.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of("package.json")), PROTOBUF_MODULE_PACKAGE_JSON);
1558891
1559217
  await runExeca(void 0, "npm", ["install"], {
1558892
1559218
  cwd: protobufGeneratorConfigPath,
1558893
1559219
  stdout: "ignore",
@@ -1558898,10 +1559224,10 @@ var ProtobufIRGenerator = class {
1558898
1559224
  stdout: "ignore",
1558899
1559225
  stderr: "pipe"
1558900
1559226
  });
1558901
- await (0, import_promises48.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of(PROTOBUF_GENERATOR_CONFIG_FILENAME)), PROTOBUF_GEN_CONFIG);
1559227
+ await (0, import_promises49.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of(PROTOBUF_GENERATOR_CONFIG_FILENAME)), PROTOBUF_GEN_CONFIG);
1558902
1559228
  const shellProxyPath = join2(protobufGeneratorConfigPath, RelativeFilePath2.of(PROTOBUF_SHELL_PROXY_FILENAME));
1558903
- await (0, import_promises48.writeFile)(shellProxyPath, PROTOBUF_SHELL_PROXY);
1558904
- await (0, import_promises48.chmod)(shellProxyPath, 493);
1559229
+ await (0, import_promises49.writeFile)(shellProxyPath, PROTOBUF_SHELL_PROXY);
1559230
+ await (0, import_promises49.chmod)(shellProxyPath, 493);
1558905
1559231
  }
1558906
1559232
  async doGenerateLocal({ cwd: cwd2, deps }) {
1558907
1559233
  const which = createLoggingExecutable("which", {
@@ -1558923,13 +1559249,13 @@ var ProtobufIRGenerator = class {
1558923
1559249
  stderr: "pipe"
1558924
1559250
  });
1558925
1559251
  try {
1558926
- await (0, import_promises48.writeFile)(bufYamlPath, configContent);
1559252
+ await (0, import_promises49.writeFile)(bufYamlPath, configContent);
1558927
1559253
  if (deps.length > 0) {
1558928
1559254
  if (this.isAirGapped) {
1558929
1559255
  this.context.logger.debug("Air-gapped mode: skipping buf dep update");
1558930
1559256
  const bufLockPath = join2(cwd2, RelativeFilePath2.of("buf.lock"));
1558931
1559257
  try {
1558932
- await (0, import_promises48.access)(bufLockPath);
1559258
+ await (0, import_promises49.access)(bufLockPath);
1558933
1559259
  } catch {
1558934
1559260
  this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
1558935
1559261
  }
@@ -1558941,9 +1559267,9 @@ var ProtobufIRGenerator = class {
1558941
1559267
  if (bufGenerateResult.exitCode !== 0) {
1558942
1559268
  this.context.failAndThrow(bufGenerateResult.stderr);
1558943
1559269
  }
1558944
- await (0, import_promises48.unlink)(bufYamlPath);
1559270
+ await (0, import_promises49.unlink)(bufYamlPath);
1558945
1559271
  } catch (error49) {
1558946
- await (0, import_promises48.unlink)(bufYamlPath);
1559272
+ await (0, import_promises49.unlink)(bufYamlPath);
1558947
1559273
  throw error49;
1558948
1559274
  }
1558949
1559275
  return join2(cwd2, RelativeFilePath2.of(PROTOBUF_GENERATOR_OUTPUT_FILEPATH));
@@ -1558954,7 +1559280,7 @@ var ProtobufIRGenerator = class {
1558954
1559280
  };
1558955
1559281
 
1558956
1559282
  // ../workspace/lazy-fern-workspace/lib/protobuf/ProtobufOpenAPIGenerator.js
1558957
- var import_promises49 = require("fs/promises");
1559283
+ var import_promises50 = require("fs/promises");
1558958
1559284
  var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
1558959
1559285
  var PROTOBUF_GENERATOR_CONFIG_FILENAME2 = "buf.gen.yaml";
1558960
1559286
  var PROTOBUF_GENERATOR_OUTPUT_PATH2 = "output";
@@ -1558995,8 +1559321,8 @@ var ProtobufOpenAPIGenerator = class {
1558995
1559321
  }
1558996
1559322
  async setupProtobufGeneratorConfig({ absoluteFilepathToProtobufRoot, relativeFilepathToProtobufRoot }) {
1558997
1559323
  const protobufGeneratorConfigPath = AbsoluteFilePath2.of((await import_tmp_promise8.default.dir()).path);
1558998
- await (0, import_promises49.cp)(absoluteFilepathToProtobufRoot, protobufGeneratorConfigPath, { recursive: true });
1558999
- await (0, import_promises49.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of(PROTOBUF_GENERATOR_CONFIG_FILENAME2)), getProtobufGeneratorConfig({ relativeFilepathToProtobufRoot }));
1559324
+ await (0, import_promises50.cp)(absoluteFilepathToProtobufRoot, protobufGeneratorConfigPath, { recursive: true });
1559325
+ await (0, import_promises50.writeFile)(join2(protobufGeneratorConfigPath, RelativeFilePath2.of(PROTOBUF_GENERATOR_CONFIG_FILENAME2)), getProtobufGeneratorConfig({ relativeFilepathToProtobufRoot }));
1559000
1559326
  return protobufGeneratorConfigPath;
1559001
1559327
  }
1559002
1559328
  async doGenerateLocal({ cwd: cwd2, target, deps, existingBufLockContents }) {
@@ -1559027,15 +1559353,15 @@ var ProtobufOpenAPIGenerator = class {
1559027
1559353
  stderr: "pipe"
1559028
1559354
  });
1559029
1559355
  try {
1559030
- await (0, import_promises49.writeFile)(bufYamlPath, configContent);
1559356
+ await (0, import_promises50.writeFile)(bufYamlPath, configContent);
1559031
1559357
  if (existingBufLockContents != null) {
1559032
- await (0, import_promises49.writeFile)(bufLockPath, existingBufLockContents);
1559358
+ await (0, import_promises50.writeFile)(bufLockPath, existingBufLockContents);
1559033
1559359
  cleanupBufLock = true;
1559034
1559360
  } else if (deps.length > 0) {
1559035
1559361
  if (this.isAirGapped) {
1559036
1559362
  this.context.logger.debug("Air-gapped mode: skipping buf dep update");
1559037
1559363
  try {
1559038
- await (0, import_promises49.access)(bufLockPath);
1559364
+ await (0, import_promises50.access)(bufLockPath);
1559039
1559365
  } catch {
1559040
1559366
  this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
1559041
1559367
  }
@@ -1559043,7 +1559369,7 @@ var ProtobufOpenAPIGenerator = class {
1559043
1559369
  await buf(["dep", "update"]);
1559044
1559370
  }
1559045
1559371
  try {
1559046
- bufLockContents = await (0, import_promises49.readFile)(bufLockPath, "utf-8");
1559372
+ bufLockContents = await (0, import_promises50.readFile)(bufLockPath, "utf-8");
1559047
1559373
  } catch {
1559048
1559374
  bufLockContents = void 0;
1559049
1559375
  }
@@ -1559053,14 +1559379,14 @@ var ProtobufOpenAPIGenerator = class {
1559053
1559379
  this.context.failAndThrow(bufGenerateResult.stderr);
1559054
1559380
  }
1559055
1559381
  if (cleanupBufLock) {
1559056
- await (0, import_promises49.unlink)(bufLockPath);
1559382
+ await (0, import_promises50.unlink)(bufLockPath);
1559057
1559383
  }
1559058
- await (0, import_promises49.unlink)(bufYamlPath);
1559384
+ await (0, import_promises50.unlink)(bufYamlPath);
1559059
1559385
  } catch (error49) {
1559060
1559386
  if (cleanupBufLock) {
1559061
- await (0, import_promises49.unlink)(bufLockPath);
1559387
+ await (0, import_promises50.unlink)(bufLockPath);
1559062
1559388
  }
1559063
- await (0, import_promises49.unlink)(bufYamlPath);
1559389
+ await (0, import_promises50.unlink)(bufYamlPath);
1559064
1559390
  throw error49;
1559065
1559391
  }
1559066
1559392
  return {
@@ -1559361,7 +1559687,7 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
1559361
1559687
  local: true,
1559362
1559688
  deps: spec.dependencies
1559363
1559689
  });
1559364
- const result = await (0, import_promises50.readFile)(protobufIRFilepath, "utf-8");
1559690
+ const result = await (0, import_promises51.readFile)(protobufIRFilepath, "utf-8");
1559365
1559691
  const casingsGenerator = constructCasingsGenerator2({
1559366
1559692
  generationLanguage: "typescript",
1559367
1559693
  keywords: void 0,
@@ -1559618,7 +1559944,7 @@ function parseIssue(issue2) {
1559618
1559944
  }
1559619
1559945
 
1559620
1559946
  // ../workspace/loader/lib/listFernFiles.js
1559621
- var import_promises51 = require("fs/promises");
1559947
+ var import_promises52 = require("fs/promises");
1559622
1559948
  async function listFernFiles2(root6, extensionGlob) {
1559623
1559949
  const files = [];
1559624
1559950
  for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
@@ -1559633,7 +1559959,7 @@ async function createFernFile2({ relativeFilepath, absoluteFilepath }) {
1559633
1559959
  return {
1559634
1559960
  relativeFilepath,
1559635
1559961
  absoluteFilepath,
1559636
- fileContents: (await (0, import_promises51.readFile)(absoluteFilepath)).toString()
1559962
+ fileContents: (await (0, import_promises52.readFile)(absoluteFilepath)).toString()
1559637
1559963
  };
1559638
1559964
  }
1559639
1559965
 
@@ -1559885,7 +1560211,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context: context2, cl
1559885
1560211
  }
1559886
1560212
 
1559887
1560213
  // ../workspace/loader/lib/loadDocsWorkspace.js
1559888
- var import_promises52 = require("fs/promises");
1560214
+ var import_promises53 = require("fs/promises");
1559889
1560215
 
1559890
1560216
  // ../workspace/loader/lib/docs-yml.schema.json
1559891
1560217
  var docs_yml_schema_exports = {};
@@ -1565063,7 +1565389,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context: co
1565063
1565389
  });
1565064
1565390
  }
1565065
1565391
  async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context: context2 }) {
1565066
- const contentsStr = await (0, import_promises52.readFile)(absolutePathOfConfiguration);
1565392
+ const contentsStr = await (0, import_promises53.readFile)(absolutePathOfConfiguration);
1565067
1565393
  const contentsJson = jsYaml.load(contentsStr.toString());
1565068
1565394
  const result = validateAgainstJsonSchema(contentsJson, docs_yml_schema_exports, {
1565069
1565395
  filePath: absolutePathOfConfiguration
@@ -1565092,7 +1565418,7 @@ ${result.error?.message ?? "Unknown error"}`);
1565092
1565418
  }
1565093
1565419
 
1565094
1565420
  // ../project-loader/lib/loadProject.js
1565095
- var import_promises53 = require("fs/promises");
1565421
+ var import_promises54 = require("fs/promises");
1565096
1565422
  async function loadProject({ context: context2, nameOverride, ...args }) {
1565097
1565423
  const fernDirectory = await getFernDirectory(nameOverride);
1565098
1565424
  if (fernDirectory == null) {
@@ -1565147,7 +1565473,7 @@ async function loadApis({ cliName, fernDirectory, context: context2, cliVersion,
1565147
1565473
  const apisDirectory = join2(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
1565148
1565474
  const apisDirectoryExists = await doesPathExist(apisDirectory);
1565149
1565475
  if (apisDirectoryExists) {
1565150
- const apiDirectoryContents = await (0, import_promises53.readdir)(apisDirectory, { withFileTypes: true });
1565476
+ const apiDirectoryContents = await (0, import_promises54.readdir)(apisDirectory, { withFileTypes: true });
1565151
1565477
  const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
1565152
1565478
  if (item.isDirectory()) {
1565153
1565479
  all9.push(item.name);
@@ -1565224,10 +1565550,10 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
1565224
1565550
 
1565225
1565551
  // src/cliV2.ts
1565226
1565552
  var import_generators_sdk4 = __toESM(require_generators_sdk(), 1);
1565227
- var import_promises58 = require("fs/promises");
1565553
+ var import_promises59 = require("fs/promises");
1565228
1565554
 
1565229
1565555
  // src/commands/generator-list/getGeneratorList.ts
1565230
- var import_promises54 = require("fs/promises");
1565556
+ var import_promises55 = require("fs/promises");
1565231
1565557
  var GenerationModeFilter = {
1565232
1565558
  GitHub: "github",
1565233
1565559
  Local: "local-file-system",
@@ -1565287,7 +1565613,7 @@ async function getGeneratorList({
1565287
1565613
  return;
1565288
1565614
  }
1565289
1565615
  try {
1565290
- await (0, import_promises54.writeFile)(outputLocation, generatorsListYaml);
1565616
+ await (0, import_promises55.writeFile)(outputLocation, generatorsListYaml);
1565291
1565617
  } catch (error49) {
1565292
1565618
  cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error49);
1565293
1565619
  }
@@ -1565353,7 +1565679,7 @@ async function getGeneratorMetadata({
1565353
1565679
  }
1565354
1565680
 
1565355
1565681
  // src/commands/organization/getOrganization.ts
1565356
- var import_promises55 = require("fs/promises");
1565682
+ var import_promises56 = require("fs/promises");
1565357
1565683
  async function getOrganization({
1565358
1565684
  project,
1565359
1565685
  outputLocation,
@@ -1565365,20 +1565691,20 @@ async function getOrganization({
1565365
1565691
  return;
1565366
1565692
  }
1565367
1565693
  try {
1565368
- await (0, import_promises55.writeFile)(outputLocation, org);
1565694
+ await (0, import_promises56.writeFile)(outputLocation, org);
1565369
1565695
  } catch (error49) {
1565370
1565696
  context2.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error49);
1565371
1565697
  }
1565372
1565698
  }
1565373
1565699
 
1565374
1565700
  // src/commands/upgrade/upgradeGenerator.ts
1565375
- var import_promises57 = require("fs/promises");
1565701
+ var import_promises58 = require("fs/promises");
1565376
1565702
  var import_path37 = __toESM(require("path"), 1);
1565377
1565703
  var import_semver8 = __toESM(require_semver2(), 1);
1565378
- var import_yaml3 = __toESM(require_dist(), 1);
1565704
+ var import_yaml4 = __toESM(require_dist(), 1);
1565379
1565705
 
1565380
1565706
  // src/commands/upgrade/migrations/loader.ts
1565381
- var import_promises56 = require("fs/promises");
1565707
+ var import_promises57 = require("fs/promises");
1565382
1565708
  var import_os4 = require("os");
1565383
1565709
  var import_path36 = require("path");
1565384
1565710
  var import_semver7 = __toESM(require_semver2(), 1);
@@ -1565389,7 +1565715,7 @@ function getMigrationCacheDir() {
1565389
1565715
  async function loadMigrationModule(params2) {
1565390
1565716
  const { generatorName, logger } = params2;
1565391
1565717
  const cacheDir = getMigrationCacheDir();
1565392
- await (0, import_promises56.mkdir)(cacheDir, { recursive: true });
1565718
+ await (0, import_promises57.mkdir)(cacheDir, { recursive: true });
1565393
1565719
  try {
1565394
1565720
  await loggingExeca(logger, "npm", [
1565395
1565721
  "install",
@@ -1565402,7 +1565728,7 @@ async function loadMigrationModule(params2) {
1565402
1565728
  ]);
1565403
1565729
  const packageDir = (0, import_path36.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
1565404
1565730
  const packageJsonPath = (0, import_path36.join)(packageDir, "package.json");
1565405
- const packageJsonContent = await (0, import_promises56.readFile)(packageJsonPath, "utf-8");
1565731
+ const packageJsonContent = await (0, import_promises57.readFile)(packageJsonPath, "utf-8");
1565406
1565732
  const packageJson2 = JSON.parse(packageJsonContent);
1565407
1565733
  if (packageJson2.main == null) {
1565408
1565734
  throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`);
@@ -1565553,15 +1565879,15 @@ async function loadAndUpdateGenerators({
1565553
1565879
  context2.logger.debug("Generators configuration file was not found, no generators to upgrade.");
1565554
1565880
  return { updatedConfiguration: void 0, skippedMajorUpgrades: [], appliedUpgrades: [], alreadyUpToDate: [] };
1565555
1565881
  }
1565556
- const contents = await (0, import_promises57.readFile)(filepath);
1565882
+ const contents = await (0, import_promises58.readFile)(filepath);
1565557
1565883
  context2.logger.debug(`Found generators: ${contents.toString()}`);
1565558
- const parsedDocument = import_yaml3.default.parseDocument(contents.toString());
1565884
+ const parsedDocument = import_yaml4.default.parseDocument(contents.toString());
1565559
1565885
  const generatorGroups = parsedDocument.get("groups");
1565560
1565886
  if (generatorGroups == null) {
1565561
1565887
  context2.logger.debug("No groups were found within the generators configuration, no generators to upgrade.");
1565562
1565888
  return { updatedConfiguration: void 0, skippedMajorUpgrades: [], appliedUpgrades: [], alreadyUpToDate: [] };
1565563
1565889
  }
1565564
- if (!import_yaml3.default.isMap(generatorGroups)) {
1565890
+ if (!import_yaml4.default.isMap(generatorGroups)) {
1565565
1565891
  context2.failAndThrow(`Expected 'groups' to be a map in ${import_path37.default.relative(process.cwd(), filepath)}`);
1565566
1565892
  return { updatedConfiguration: void 0, skippedMajorUpgrades: [], appliedUpgrades: [], alreadyUpToDate: [] };
1565567
1565893
  }
@@ -1565572,7 +1565898,7 @@ async function loadAndUpdateGenerators({
1565572
1565898
  for (const groupBlock of generatorGroups.items) {
1565573
1565899
  const groupName = groupBlock.key.value;
1565574
1565900
  const group = groupBlock.value;
1565575
- if (!import_yaml3.default.isMap(group)) {
1565901
+ if (!import_yaml4.default.isMap(group)) {
1565576
1565902
  context2.failAndThrow(
1565577
1565903
  `Expected group ${groupName} to be a map in ${import_path37.default.relative(process.cwd(), filepath)}`
1565578
1565904
  );
@@ -1565583,7 +1565909,7 @@ async function loadAndUpdateGenerators({
1565583
1565909
  continue;
1565584
1565910
  }
1565585
1565911
  const generators = group.get("generators");
1565586
- if (!import_yaml3.default.isSeq(generators)) {
1565912
+ if (!import_yaml4.default.isSeq(generators)) {
1565587
1565913
  context2.failAndThrow(
1565588
1565914
  `Expected group ${groupName} to have a 'generators' key in ${import_path37.default.relative(process.cwd(), filepath)}`
1565589
1565915
  );
@@ -1565591,7 +1565917,7 @@ async function loadAndUpdateGenerators({
1565591
1565917
  }
1565592
1565918
  context2.logger.debug(`Generators found: ${generators.toString()}`);
1565593
1565919
  for (const generator of generators.items) {
1565594
- if (!import_yaml3.default.isMap(generator)) {
1565920
+ if (!import_yaml4.default.isMap(generator)) {
1565595
1565921
  context2.failAndThrow(
1565596
1565922
  `Expected generator in group ${groupName} to be a map in ${import_path37.default.relative(process.cwd(), filepath)}`
1565597
1565923
  );
@@ -1565734,7 +1566060,7 @@ async function upgradeGenerator({
1565734
1566060
  absolutePathToWorkspace: workspace.absoluteFilePath
1565735
1566061
  });
1565736
1566062
  if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
1565737
- await (0, import_promises57.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
1566063
+ await (0, import_promises58.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
1565738
1566064
  }
1565739
1566065
  allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
1565740
1566066
  if (result.appliedUpgrades.length > 0) {
@@ -1566088,7 +1566414,7 @@ function addGeneratorCommands(cli, cliContext) {
1566088
1566414
  }
1566089
1566415
  if (argv.output) {
1566090
1566416
  try {
1566091
- await (0, import_promises58.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
1566417
+ await (0, import_promises59.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
1566092
1566418
  } catch (error49) {
1566093
1566419
  cliContext.failAndThrow(
1566094
1566420
  `Could not write file to the specified location: ${argv.output}`,
@@ -1566102,7 +1566428,7 @@ function addGeneratorCommands(cli, cliContext) {
1566102
1566428
  }
1566103
1566429
 
1566104
1566430
  // src/commands/add-generator/addGeneratorToWorkspaces.ts
1566105
- var import_promises59 = require("fs/promises");
1566431
+ var import_promises60 = require("fs/promises");
1566106
1566432
  async function addGeneratorToWorkspaces({
1566107
1566433
  project: { apiWorkspaces },
1566108
1566434
  generatorName,
@@ -1566129,7 +1566455,7 @@ async function addGeneratorToWorkspaces({
1566129
1566455
  if (absolutePathToGeneratorsConfiguration == null) {
1566130
1566456
  return;
1566131
1566457
  }
1566132
- await (0, import_promises59.writeFile)(
1566458
+ await (0, import_promises60.writeFile)(
1566133
1566459
  absolutePathToGeneratorsConfiguration,
1566134
1566460
  "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
1566135
1566461
  );
@@ -1566140,7 +1566466,7 @@ async function addGeneratorToWorkspaces({
1566140
1566466
  }
1566141
1566467
 
1566142
1566468
  // src/commands/diff/diff.ts
1566143
- var import_promises60 = require("fs/promises");
1566469
+ var import_promises61 = require("fs/promises");
1566144
1566470
  var import_semver9 = __toESM(require_semver2(), 1);
1566145
1566471
  async function diff({
1566146
1566472
  context: context2,
@@ -1566183,7 +1566509,7 @@ async function readIr({
1566183
1566509
  context2.failWithoutThrowing(`File not found: ${absoluteFilepath}`);
1566184
1566510
  throw new FernCliError();
1566185
1566511
  }
1566186
- const ir14 = await (0, import_promises60.readFile)(absoluteFilepath, "utf-8");
1566512
+ const ir14 = await (0, import_promises61.readFile)(absoluteFilepath, "utf-8");
1566187
1566513
  const parsed = serialization_exports4.IntermediateRepresentation.parse(JSON.parse(ir14));
1566188
1566514
  if (!parsed.ok) {
1566189
1566515
  context2.failWithoutThrowing(`Invalid --${flagName}; expected a filepath containing a valid IR`);
@@ -1583936,9 +1584262,9 @@ function replaceFrontmatterImagesforLogo(data2, mapImage) {
1583936
1584262
  }
1583937
1584263
 
1583938
1584264
  // ../docs-markdown-utils/lib/replaceReferencedCode.js
1583939
- var import_promises61 = require("fs/promises");
1584265
+ var import_promises62 = require("fs/promises");
1583940
1584266
  async function defaultFileLoader(filepath) {
1583941
- const file2 = await (0, import_promises61.readFile)(filepath);
1584267
+ const file2 = await (0, import_promises62.readFile)(filepath);
1583942
1584268
  return file2.toString();
1583943
1584269
  }
1583944
1584270
  function isUrl2(src) {
@@ -1584105,10 +1584431,10 @@ ${replacement}
1584105
1584431
  }
1584106
1584432
 
1584107
1584433
  // ../docs-markdown-utils/lib/replaceReferencedMarkdown.js
1584108
- var import_promises62 = require("fs/promises");
1584434
+ var import_promises63 = require("fs/promises");
1584109
1584435
  var import_gray_matter5 = __toESM(require_gray_matter(), 1);
1584110
1584436
  async function defaultMarkdownLoader(filepath) {
1584111
- const { content: content5 } = (0, import_gray_matter5.default)(await (0, import_promises62.readFile)(filepath));
1584437
+ const { content: content5 } = (0, import_gray_matter5.default)(await (0, import_promises63.readFile)(filepath));
1584112
1584438
  return content5;
1584113
1584439
  }
1584114
1584440
  function extractAttributes(markdownTag) {
@@ -1591860,7 +1592186,7 @@ function computeServiceTypeReferenceInfo(irGraph) {
1591860
1592186
  // ../docs-resolver/lib/DocsDefinitionResolver.js
1591861
1592187
  var import_dayjs3 = __toESM(require_dayjs_min(), 1);
1591862
1592188
  var import_utc3 = __toESM(require_utc(), 1);
1591863
- var import_promises66 = require("fs/promises");
1592189
+ var import_promises67 = require("fs/promises");
1591864
1592190
  var import_gray_matter6 = __toESM(require_gray_matter(), 1);
1591865
1592191
 
1591866
1592192
  // ../../../node_modules/.pnpm/@fern-api+ui-core-utils@0.129.4-b6c699ad2/node_modules/@fern-api/ui-core-utils/dist/assertNever.js
@@ -1595974,7 +1596300,111 @@ var OpenAPIPruner = class {
1595974
1596300
  };
1595975
1596301
 
1595976
1596302
  // ../register/lib/ai-example-enhancer/enhanceExamplesWithAI.js
1595977
- var import_promises65 = require("fs/promises");
1596303
+ var import_promises66 = require("fs/promises");
1596304
+
1596305
+ // ../register/lib/ai-example-enhancer/filterHelpers.js
1596306
+ function isFdrTypedValueWrapper(value) {
1596307
+ if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) {
1596308
+ return false;
1596309
+ }
1596310
+ const obj = value;
1596311
+ const keys11 = Object.keys(obj);
1596312
+ if (keys11.length === 0 || keys11.length > 2) {
1596313
+ return false;
1596314
+ }
1596315
+ const hasType = "type" in obj && typeof obj.type === "string";
1596316
+ const hasValue = "value" in obj;
1596317
+ return hasType && keys11.length === 1 || hasType && hasValue && keys11.length === 2 || hasValue && keys11.length === 1;
1596318
+ }
1596319
+ function unwrapExampleValue(value) {
1596320
+ if (value === null || value === void 0) {
1596321
+ return value;
1596322
+ }
1596323
+ if (Array.isArray(value)) {
1596324
+ return value.map(unwrapExampleValue);
1596325
+ }
1596326
+ if (typeof value !== "object") {
1596327
+ return value;
1596328
+ }
1596329
+ const obj = value;
1596330
+ if (isFdrTypedValueWrapper(obj)) {
1596331
+ if ("value" in obj) {
1596332
+ return unwrapExampleValue(obj.value);
1596333
+ }
1596334
+ return void 0;
1596335
+ }
1596336
+ const result = {};
1596337
+ for (const [key, val] of Object.entries(obj)) {
1596338
+ const unwrapped = unwrapExampleValue(val);
1596339
+ if (unwrapped !== void 0) {
1596340
+ result[key] = unwrapped;
1596341
+ }
1596342
+ }
1596343
+ return result;
1596344
+ }
1596345
+ function isEmptyObject2(value) {
1596346
+ if (value === null || value === void 0) {
1596347
+ return true;
1596348
+ }
1596349
+ if (typeof value !== "object") {
1596350
+ return false;
1596351
+ }
1596352
+ if (Array.isArray(value)) {
1596353
+ return value.length === 0;
1596354
+ }
1596355
+ return Object.keys(value).length === 0;
1596356
+ }
1596357
+ function filterRequestBody(requestBody, pathParameters, queryParameters, headers2) {
1596358
+ const extractedPathParams = {};
1596359
+ const extractedQueryParams = {};
1596360
+ const extractedHeaders = {};
1596361
+ if (requestBody === null || requestBody === void 0 || typeof requestBody !== "object" || Array.isArray(requestBody)) {
1596362
+ return { filteredBody: requestBody, extractedPathParams, extractedQueryParams, extractedHeaders };
1596363
+ }
1596364
+ const bodyRecord = requestBody;
1596365
+ const filteredBody = {};
1596366
+ const pathParamKeys = new Set(Object.keys(pathParameters ?? {}));
1596367
+ const queryParamKeys = new Set(Object.keys(queryParameters ?? {}));
1596368
+ const headerKeys = new Set(Object.keys(headers2 ?? {}));
1596369
+ for (const [key, value] of Object.entries(bodyRecord)) {
1596370
+ const normalizedKey = key.toLowerCase().replace(/[-_]/g, "");
1596371
+ let isPathParam = false;
1596372
+ let isQueryParam = false;
1596373
+ let isHeader = false;
1596374
+ for (const pathKey of pathParamKeys) {
1596375
+ const normalizedPathKey = pathKey.toLowerCase().replace(/[-_]/g, "");
1596376
+ if (normalizedKey === normalizedPathKey) {
1596377
+ isPathParam = true;
1596378
+ extractedPathParams[pathKey] = value;
1596379
+ break;
1596380
+ }
1596381
+ }
1596382
+ if (!isPathParam) {
1596383
+ for (const queryKey of queryParamKeys) {
1596384
+ const normalizedQueryKey = queryKey.toLowerCase().replace(/[-_]/g, "");
1596385
+ if (normalizedKey === normalizedQueryKey) {
1596386
+ isQueryParam = true;
1596387
+ extractedQueryParams[queryKey] = value;
1596388
+ break;
1596389
+ }
1596390
+ }
1596391
+ }
1596392
+ if (!isPathParam && !isQueryParam) {
1596393
+ for (const headerKey of headerKeys) {
1596394
+ const normalizedHeaderKey = headerKey.toLowerCase().replace(/[-_]/g, "");
1596395
+ if (normalizedKey === normalizedHeaderKey) {
1596396
+ isHeader = true;
1596397
+ extractedHeaders[headerKey] = value;
1596398
+ break;
1596399
+ }
1596400
+ }
1596401
+ }
1596402
+ if (!isPathParam && !isQueryParam && !isHeader) {
1596403
+ filteredBody[key] = value;
1596404
+ }
1596405
+ }
1596406
+ return { filteredBody, extractedPathParams, extractedQueryParams, extractedHeaders };
1596407
+ }
1595978
1596408
 
1595979
1596409
  // ../register/lib/ai-example-enhancer/lambdaClient.js
1595980
1596410
  var DEFAULT_AI_ENHANCEMENT_MAX_RETRIES = 0;
@@ -1596191,12 +1596621,12 @@ var SpinnerStatusCoordinator = class _SpinnerStatusCoordinator {
1596191
1596621
  };
1596192
1596622
 
1596193
1596623
  // ../register/lib/ai-example-enhancer/validateAiExamples.js
1596194
- var import_promises63 = require("fs/promises");
1596624
+ var import_promises64 = require("fs/promises");
1596195
1596625
  async function parseAiExamplesOverride(sourceFilePath, context2) {
1596196
1596626
  const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
1596197
1596627
  const aiExamples = [];
1596198
1596628
  try {
1596199
- const existingContent = await (0, import_promises63.readFile)(overrideFilePath, "utf-8");
1596629
+ const existingContent = await (0, import_promises64.readFile)(overrideFilePath, "utf-8");
1596200
1596630
  const parsed = jsYaml.load(existingContent);
1596201
1596631
  if (parsed && typeof parsed === "object" && "paths" in parsed) {
1596202
1596632
  const paths = parsed.paths;
@@ -1596245,7 +1596675,7 @@ async function validateAiExamplesFromFile({ sourceFilePath, context: context2 })
1596245
1596675
  }
1596246
1596676
  let spec;
1596247
1596677
  try {
1596248
- const specContent = await (0, import_promises63.readFile)(sourceFilePath, "utf-8");
1596678
+ const specContent = await (0, import_promises64.readFile)(sourceFilePath, "utf-8");
1596249
1596679
  try {
1596250
1596680
  spec = JSON.parse(specContent);
1596251
1596681
  } catch {
@@ -1596304,7 +1596734,7 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context2 }) {
1596304
1596734
  }
1596305
1596735
  const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
1596306
1596736
  try {
1596307
- const existingContent = await (0, import_promises63.readFile)(overrideFilePath, "utf-8");
1596737
+ const existingContent = await (0, import_promises64.readFile)(overrideFilePath, "utf-8");
1596308
1596738
  const parsed = jsYaml.load(existingContent);
1596309
1596739
  if (!parsed || !parsed.paths) {
1596310
1596740
  return {
@@ -1596348,79 +1596778,12 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context2 }) {
1596348
1596778
  }
1596349
1596779
 
1596350
1596780
  // ../register/lib/ai-example-enhancer/writeAiExamplesOverride.js
1596351
- var import_promises64 = require("fs/promises");
1596352
-
1596353
- // ../register/lib/ai-example-enhancer/filterHelpers.js
1596354
- function isEmptyObject2(value) {
1596355
- if (value === null || value === void 0) {
1596356
- return true;
1596357
- }
1596358
- if (typeof value !== "object") {
1596359
- return false;
1596360
- }
1596361
- if (Array.isArray(value)) {
1596362
- return value.length === 0;
1596363
- }
1596364
- return Object.keys(value).length === 0;
1596365
- }
1596366
- function filterRequestBody(requestBody, pathParameters, queryParameters, headers2) {
1596367
- const extractedPathParams = {};
1596368
- const extractedQueryParams = {};
1596369
- const extractedHeaders = {};
1596370
- if (requestBody === null || requestBody === void 0 || typeof requestBody !== "object" || Array.isArray(requestBody)) {
1596371
- return { filteredBody: requestBody, extractedPathParams, extractedQueryParams, extractedHeaders };
1596372
- }
1596373
- const bodyRecord = requestBody;
1596374
- const filteredBody = {};
1596375
- const pathParamKeys = new Set(Object.keys(pathParameters ?? {}));
1596376
- const queryParamKeys = new Set(Object.keys(queryParameters ?? {}));
1596377
- const headerKeys = new Set(Object.keys(headers2 ?? {}));
1596378
- for (const [key, value] of Object.entries(bodyRecord)) {
1596379
- const normalizedKey = key.toLowerCase().replace(/[-_]/g, "");
1596380
- let isPathParam = false;
1596381
- let isQueryParam = false;
1596382
- let isHeader = false;
1596383
- for (const pathKey of pathParamKeys) {
1596384
- const normalizedPathKey = pathKey.toLowerCase().replace(/[-_]/g, "");
1596385
- if (normalizedKey === normalizedPathKey) {
1596386
- isPathParam = true;
1596387
- extractedPathParams[pathKey] = value;
1596388
- break;
1596389
- }
1596390
- }
1596391
- if (!isPathParam) {
1596392
- for (const queryKey of queryParamKeys) {
1596393
- const normalizedQueryKey = queryKey.toLowerCase().replace(/[-_]/g, "");
1596394
- if (normalizedKey === normalizedQueryKey) {
1596395
- isQueryParam = true;
1596396
- extractedQueryParams[queryKey] = value;
1596397
- break;
1596398
- }
1596399
- }
1596400
- }
1596401
- if (!isPathParam && !isQueryParam) {
1596402
- for (const headerKey of headerKeys) {
1596403
- const normalizedHeaderKey = headerKey.toLowerCase().replace(/[-_]/g, "");
1596404
- if (normalizedKey === normalizedHeaderKey) {
1596405
- isHeader = true;
1596406
- extractedHeaders[headerKey] = value;
1596407
- break;
1596408
- }
1596409
- }
1596410
- }
1596411
- if (!isPathParam && !isQueryParam && !isHeader) {
1596412
- filteredBody[key] = value;
1596413
- }
1596414
- }
1596415
- return { filteredBody, extractedPathParams, extractedQueryParams, extractedHeaders };
1596416
- }
1596417
-
1596418
- // ../register/lib/ai-example-enhancer/writeAiExamplesOverride.js
1596781
+ var import_promises65 = require("fs/promises");
1596419
1596782
  async function loadExistingOverrideCoverage(sourceFilePath, context2) {
1596420
1596783
  const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
1596421
1596784
  const coveredEndpoints = /* @__PURE__ */ new Set();
1596422
1596785
  try {
1596423
- const existingContent = await (0, import_promises64.readFile)(overrideFilePath, "utf-8");
1596786
+ const existingContent = await (0, import_promises65.readFile)(overrideFilePath, "utf-8");
1596424
1596787
  const parsed = jsYaml.load(existingContent);
1596425
1596788
  if (parsed && typeof parsed === "object" && "paths" in parsed) {
1596426
1596789
  const paths = parsed.paths;
@@ -1596477,9 +1596840,26 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
1596477
1596840
  }
1596478
1596841
  }
1596479
1596842
  }
1596480
- let filteredRequestBody = example.requestBody;
1596481
- if (example.requestBody !== void 0) {
1596482
- const { filteredBody, extractedPathParams, extractedQueryParams, extractedHeaders } = filterRequestBody(example.requestBody, pathParams, queryParams, headersForFiltering);
1596843
+ const queryParamsForFiltering = {};
1596844
+ if (example.queryParameterNames) {
1596845
+ for (const queryName of example.queryParameterNames) {
1596846
+ queryParamsForFiltering[queryName] = queryParams[queryName] ?? "";
1596847
+ }
1596848
+ }
1596849
+ const pathParamsForFiltering = {};
1596850
+ if (example.pathParameterNames) {
1596851
+ for (const pathName of example.pathParameterNames) {
1596852
+ pathParamsForFiltering[pathName] = pathParams[pathName] ?? "";
1596853
+ }
1596854
+ }
1596855
+ let requestBodyToProcess = example.requestBody;
1596856
+ if (requestBodyToProcess !== null && requestBodyToProcess !== void 0 && typeof requestBodyToProcess === "object" && !Array.isArray(requestBodyToProcess) && "body" in requestBodyToProcess) {
1596857
+ requestBodyToProcess = requestBodyToProcess.body;
1596858
+ }
1596859
+ const unwrappedRequestBody = unwrapExampleValue(requestBodyToProcess);
1596860
+ let filteredRequestBody = unwrappedRequestBody;
1596861
+ if (unwrappedRequestBody !== void 0) {
1596862
+ const { filteredBody, extractedPathParams, extractedQueryParams, extractedHeaders } = filterRequestBody(unwrappedRequestBody, pathParamsForFiltering, queryParamsForFiltering, headersForFiltering);
1596483
1596863
  filteredRequestBody = filteredBody;
1596484
1596864
  for (const [key, value] of Object.entries(extractedPathParams)) {
1596485
1596865
  if (value !== void 0 && value !== null && value !== "") {
@@ -1596507,13 +1596887,12 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
1596507
1596887
  fernExample.headers = headerParams;
1596508
1596888
  }
1596509
1596889
  if (filteredRequestBody !== void 0 && !isEmptyObject2(filteredRequestBody)) {
1596510
- fernExample.request = {
1596511
- body: filteredRequestBody
1596512
- };
1596890
+ fernExample.request = filteredRequestBody;
1596513
1596891
  }
1596514
- if (example.responseBody !== void 0 && !isEmptyObject2(example.responseBody)) {
1596892
+ const unwrappedResponseBody = unwrapExampleValue(example.responseBody);
1596893
+ if (unwrappedResponseBody !== void 0 && !isEmptyObject2(unwrappedResponseBody)) {
1596515
1596894
  fernExample.response = {
1596516
- body: example.responseBody
1596895
+ body: unwrappedResponseBody
1596517
1596896
  };
1596518
1596897
  }
1596519
1596898
  return fernExample;
@@ -1596530,7 +1596909,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
1596530
1596909
  try {
1596531
1596910
  let existingOverride = {};
1596532
1596911
  try {
1596533
- const existingContent = await (0, import_promises64.readFile)(overrideFilePath, "utf-8");
1596912
+ const existingContent = await (0, import_promises65.readFile)(overrideFilePath, "utf-8");
1596534
1596913
  const parsed = jsYaml.load(existingContent);
1596535
1596914
  if (parsed && typeof parsed === "object") {
1596536
1596915
  existingOverride = parsed;
@@ -1596573,7 +1596952,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
1596573
1596952
  lineWidth: -1,
1596574
1596953
  noRefs: true
1596575
1596954
  });
1596576
- await (0, import_promises64.writeFile)(overrideFilePath, yamlContent, "utf-8");
1596955
+ await (0, import_promises65.writeFile)(overrideFilePath, yamlContent, "utf-8");
1596577
1596956
  context2.logger.debug(`AI enhanced examples written to: ${overrideFilePath}`);
1596578
1596957
  } catch (error49) {
1596579
1596958
  context2.logger.warn(`Failed to write AI examples override file: ${error49}`);
@@ -1596663,7 +1597042,10 @@ var ConcurrentEndpointProcessor = class {
1596663
1597042
  this.stats.completed++;
1596664
1597043
  this.results.set(result.endpointKey, {
1596665
1597044
  enhancedReq: result.enhancedReq,
1596666
- enhancedRes: result.enhancedRes
1597045
+ enhancedRes: result.enhancedRes,
1597046
+ extractedHeaders: result.extractedHeaders,
1597047
+ extractedPathParams: result.extractedPathParams,
1597048
+ extractedQueryParams: result.extractedQueryParams
1596667
1597049
  });
1596668
1597050
  } else {
1596669
1597051
  this.stats.failed++;
@@ -1596705,7 +1597087,7 @@ function findMatchingOpenAPIPath2(examplePath, availablePaths) {
1596705
1597087
  }
1596706
1597088
  return void 0;
1596707
1597089
  }
1596708
- function extractHeaderParameterNames(openApiSpecJson, endpointPath, method) {
1597090
+ function extractParameterNamesByType(openApiSpecJson, endpointPath, method, paramType) {
1596709
1597091
  try {
1596710
1597092
  const spec = JSON.parse(openApiSpecJson);
1596711
1597093
  if (!spec.paths) {
@@ -1596724,21 +1597106,30 @@ function extractHeaderParameterNames(openApiSpecJson, endpointPath, method) {
1596724
1597106
  if (!operation) {
1596725
1597107
  return [];
1596726
1597108
  }
1596727
- const headerNames = [];
1597109
+ const paramNames = [];
1596728
1597110
  const allParameters = [...pathItem.parameters ?? [], ...operation.parameters ?? []];
1596729
1597111
  for (const param of allParameters) {
1596730
1597112
  if ("$ref" in param) {
1596731
1597113
  continue;
1596732
1597114
  }
1596733
- if (param.in === "header") {
1596734
- headerNames.push(param.name);
1597115
+ if (param.in === paramType) {
1597116
+ paramNames.push(param.name);
1596735
1597117
  }
1596736
1597118
  }
1596737
- return headerNames;
1597119
+ return paramNames;
1596738
1597120
  } catch {
1596739
1597121
  return [];
1596740
1597122
  }
1596741
1597123
  }
1597124
+ function extractHeaderParameterNames(openApiSpecJson, endpointPath, method) {
1597125
+ return extractParameterNamesByType(openApiSpecJson, endpointPath, method, "header");
1597126
+ }
1597127
+ function extractQueryParameterNames(openApiSpecJson, endpointPath, method) {
1597128
+ return extractParameterNamesByType(openApiSpecJson, endpointPath, method, "query");
1597129
+ }
1597130
+ function extractPathParameterNames(openApiSpecJson, endpointPath, method) {
1597131
+ return extractParameterNamesByType(openApiSpecJson, endpointPath, method, "path");
1597132
+ }
1596742
1597133
  async function pruneOpenAPISpecForBatch(openApiSpecContent, endpointSelectors, context2) {
1596743
1597134
  try {
1596744
1597135
  let parsedSpec;
@@ -1596810,7 +1597201,7 @@ async function performAIEnhancement(apiDefinition, config3, context2, token, org
1596810
1597201
  let endpointsNeedingRegeneration = /* @__PURE__ */ new Set();
1596811
1597202
  if (sourceFilePath != null) {
1596812
1597203
  try {
1596813
- const specContent = await (0, import_promises65.readFile)(sourceFilePath, "utf-8");
1597204
+ const specContent = await (0, import_promises66.readFile)(sourceFilePath, "utf-8");
1596814
1597205
  if (!isOpenApiSpec(specContent)) {
1596815
1597206
  context2.logger.debug("Non-OpenAPI spec detected, skipping AI example enhancement");
1596816
1597207
  return apiDefinition;
@@ -1597022,6 +1597413,9 @@ async function processEndpointsConcurrently(allWorkItems, enhancer, context2, or
1597022
1597413
  endpointKey: result.endpointKey,
1597023
1597414
  enhancedReq: result.enhancedReq,
1597024
1597415
  enhancedRes: result.enhancedRes,
1597416
+ extractedHeaders: result.extractedHeaders,
1597417
+ extractedPathParams: result.extractedPathParams,
1597418
+ extractedQueryParams: result.extractedQueryParams,
1597025
1597419
  success: true
1597026
1597420
  };
1597027
1597421
  } else {
@@ -1597086,6 +1597480,44 @@ async function processEndpoint(workItem, enhancer, context2, organizationId, sta
1597086
1597480
  const responseChanged = result.enhancedResponseExample !== request6.originalResponseExample;
1597087
1597481
  if (requestChanged || responseChanged) {
1597088
1597482
  const headerParameterNames = prunedOpenApiSpec ? extractHeaderParameterNames(prunedOpenApiSpec, workItem.example.path, workItem.endpoint.method) : [];
1597483
+ const queryParameterNames = prunedOpenApiSpec ? extractQueryParameterNames(prunedOpenApiSpec, workItem.example.path, workItem.endpoint.method) : [];
1597484
+ const pathParameterNames = prunedOpenApiSpec ? extractPathParameterNames(prunedOpenApiSpec, workItem.example.path, workItem.endpoint.method) : [];
1597485
+ const headersForFiltering = { ...workItem.example.headers ?? {} };
1597486
+ if (headerParameterNames.length > 0) {
1597487
+ for (const headerName of headerParameterNames) {
1597488
+ if (!(headerName in headersForFiltering)) {
1597489
+ headersForFiltering[headerName] = "";
1597490
+ }
1597491
+ }
1597492
+ }
1597493
+ const queryParamsForFiltering = {};
1597494
+ for (const queryName of queryParameterNames) {
1597495
+ queryParamsForFiltering[queryName] = workItem.example.queryParameters?.[queryName] ?? "";
1597496
+ }
1597497
+ const pathParamsForFiltering = {};
1597498
+ for (const pathName of pathParameterNames) {
1597499
+ pathParamsForFiltering[pathName] = workItem.example.pathParameters?.[pathName] ?? "";
1597500
+ }
1597501
+ const unwrappedRequestBody = unwrapExampleValue(result.enhancedRequestExample);
1597502
+ const { filteredBody, extractedPathParams, extractedQueryParams, extractedHeaders } = filterRequestBody(unwrappedRequestBody, pathParamsForFiltering, queryParamsForFiltering, headersForFiltering);
1597503
+ const mergedHeaders = { ...workItem.example.headers ?? {} };
1597504
+ for (const [key, value] of Object.entries(extractedHeaders)) {
1597505
+ if (value !== void 0 && value !== null && value !== "") {
1597506
+ mergedHeaders[key] = value;
1597507
+ }
1597508
+ }
1597509
+ const mergedPathParams = { ...workItem.example.pathParameters ?? {} };
1597510
+ for (const [key, value] of Object.entries(extractedPathParams)) {
1597511
+ if (value !== void 0 && value !== null && value !== "") {
1597512
+ mergedPathParams[key] = value;
1597513
+ }
1597514
+ }
1597515
+ const mergedQueryParams = { ...workItem.example.queryParameters ?? {} };
1597516
+ for (const [key, value] of Object.entries(extractedQueryParams)) {
1597517
+ if (value !== void 0 && value !== null && value !== "") {
1597518
+ mergedQueryParams[key] = value;
1597519
+ }
1597520
+ }
1597089
1597521
  const enhancedExampleRecord = {
1597090
1597522
  endpoint: workItem.example.path,
1597091
1597523
  method: workItem.endpoint.method,
@@ -1597094,7 +1597526,9 @@ async function processEndpoint(workItem, enhancer, context2, organizationId, sta
1597094
1597526
  headers: workItem.example.headers,
1597095
1597527
  requestBody: requestChanged ? result.enhancedRequestExample : void 0,
1597096
1597528
  responseBody: responseChanged ? result.enhancedResponseExample : void 0,
1597097
- headerParameterNames: headerParameterNames.length > 0 ? headerParameterNames : void 0
1597529
+ headerParameterNames: headerParameterNames.length > 0 ? headerParameterNames : void 0,
1597530
+ queryParameterNames: queryParameterNames.length > 0 ? queryParameterNames : void 0,
1597531
+ pathParameterNames: pathParameterNames.length > 0 ? pathParameterNames : void 0
1597098
1597532
  };
1597099
1597533
  enhancedExampleRecords.push(enhancedExampleRecord);
1597100
1597534
  stats.count++;
@@ -1597108,8 +1597542,11 @@ async function processEndpoint(workItem, enhancer, context2, organizationId, sta
1597108
1597542
  }
1597109
1597543
  return {
1597110
1597544
  endpointKey,
1597111
- enhancedReq: result.enhancedRequestExample,
1597112
- enhancedRes: result.enhancedResponseExample
1597545
+ enhancedReq: filteredBody,
1597546
+ enhancedRes: result.enhancedResponseExample,
1597547
+ extractedHeaders: Object.keys(mergedHeaders).length > 0 ? mergedHeaders : void 0,
1597548
+ extractedPathParams: Object.keys(mergedPathParams).length > 0 ? mergedPathParams : void 0,
1597549
+ extractedQueryParams: Object.keys(mergedQueryParams).length > 0 ? mergedQueryParams : void 0
1597113
1597550
  };
1597114
1597551
  }
1597115
1597552
  context2.logger.debug(`No changes needed for ${workItem.endpoint.method} ${workItem.example.path}`);
@@ -1597135,18 +1597572,55 @@ function applyEnhancementResults(pkg2, enhancementResults) {
1597135
1597572
  const enhancedExample = {
1597136
1597573
  ...example
1597137
1597574
  };
1597138
- if (enhancementResult.enhancedReq !== void 0 && example.requestBodyV3) {
1597575
+ if (enhancementResult.enhancedReq !== void 0) {
1597139
1597576
  enhancedExample.requestBody = enhancementResult.enhancedReq;
1597140
- enhancedExample.requestBodyV3 = {
1597141
- ...example.requestBodyV3,
1597142
- value: enhancementResult.enhancedReq
1597143
- };
1597577
+ if (example.requestBodyV3) {
1597578
+ const isFormData2 = typeof example.requestBodyV3.value === "object" && example.requestBodyV3.value !== null && !Array.isArray(example.requestBodyV3.value) && Object.values(example.requestBodyV3.value).some((v21) => isFdrTypedValueWrapper(v21));
1597579
+ if (isFormData2) {
1597580
+ const enhancedReq = enhancementResult.enhancedReq;
1597581
+ const originalValue = example.requestBodyV3.value;
1597582
+ const updatedValue = {};
1597583
+ for (const [key, wrapper] of Object.entries(originalValue)) {
1597584
+ if (key in enhancedReq) {
1597585
+ updatedValue[key] = { ...wrapper, value: enhancedReq[key] };
1597586
+ } else {
1597587
+ updatedValue[key] = wrapper;
1597588
+ }
1597589
+ }
1597590
+ enhancedExample.requestBodyV3 = {
1597591
+ ...example.requestBodyV3,
1597592
+ value: updatedValue
1597593
+ };
1597594
+ } else {
1597595
+ enhancedExample.requestBodyV3 = {
1597596
+ ...example.requestBodyV3,
1597597
+ value: enhancementResult.enhancedReq
1597598
+ };
1597599
+ }
1597600
+ } else {
1597601
+ enhancedExample.requestBodyV3 = { type: "json", value: enhancementResult.enhancedReq };
1597602
+ }
1597144
1597603
  }
1597145
- if (enhancementResult.enhancedRes !== void 0 && example.responseBodyV3) {
1597604
+ if (enhancementResult.enhancedRes !== void 0) {
1597146
1597605
  enhancedExample.responseBody = enhancementResult.enhancedRes;
1597147
- enhancedExample.responseBodyV3 = {
1597148
- ...example.responseBodyV3,
1597149
- value: enhancementResult.enhancedRes
1597606
+ enhancedExample.responseBodyV3 = example.responseBodyV3 ? { ...example.responseBodyV3, value: enhancementResult.enhancedRes } : { type: "json", value: enhancementResult.enhancedRes };
1597607
+ }
1597608
+ if (enhancementResult.extractedHeaders !== void 0) {
1597609
+ enhancedExample.headers = {
1597610
+ ...example.headers ?? {},
1597611
+ ...enhancementResult.extractedHeaders
1597612
+ };
1597613
+ }
1597614
+ if (enhancementResult.extractedPathParams !== void 0) {
1597615
+ enhancedExample.pathParameters = {
1597616
+ ...example.pathParameters ?? {},
1597617
+ ...enhancementResult.extractedPathParams
1597618
+ };
1597619
+ }
1597620
+ if (enhancementResult.extractedQueryParams !== void 0) {
1597621
+ enhancedExample.queryParameters = {
1597622
+ ...example.queryParameters ?? {},
1597623
+ ...enhancementResult.extractedQueryParams
1597150
1597624
  };
1597151
1597625
  }
1597152
1597626
  return enhancedExample;
@@ -1599673,7 +1600147,7 @@ var DocsDefinitionResolver = class {
1599673
1600147
  const jsFilePaths = /* @__PURE__ */ new Set();
1599674
1600148
  await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async (filepath) => {
1599675
1600149
  const absoluteFilePath = resolve5(this.docsWorkspace.absoluteFilePath, filepath);
1599676
- const stats = await (0, import_promises66.stat)(absoluteFilePath);
1600150
+ const stats = await (0, import_promises67.stat)(absoluteFilePath);
1599677
1600151
  if (stats.isDirectory()) {
1599678
1600152
  const files = await listFiles(absoluteFilePath, "{js,ts,jsx,tsx,md,mdx}");
1599679
1600153
  files.forEach((file2) => {
@@ -1599685,7 +1600159,7 @@ var DocsDefinitionResolver = class {
1599685
1600159
  }));
1599686
1600160
  jsFiles = Object.fromEntries(await Promise.all([...jsFilePaths].map(async (filePath) => {
1599687
1600161
  const relativeFilePath = this.toRelativeFilepath(filePath);
1599688
- const contents = (await (0, import_promises66.readFile)(filePath)).toString();
1600162
+ const contents = (await (0, import_promises67.readFile)(filePath)).toString();
1599689
1600163
  return [relativeFilePath, contents];
1599690
1600164
  })));
1599691
1600165
  const mdxTime = performance.now() - mdxStart;
@@ -1607732,7 +1608206,7 @@ async function generateFdrFromOpenApiWorkspace(workspace, context2) {
1607732
1608206
  // ../docs-preview/lib/runAppPreviewServer.js
1607733
1608207
  var import_cors = __toESM(require_lib16(), 1);
1607734
1608208
  var import_express = __toESM(require_express3(), 1);
1607735
- var import_promises72 = require("fs/promises");
1608209
+ var import_promises73 = require("fs/promises");
1607736
1608210
  var import_http6 = __toESM(require("http"), 1);
1607737
1608211
  var import_path42 = __toESM(require("path"), 1);
1607738
1608212
 
@@ -1609404,13 +1609878,13 @@ var watcher_default = Watcher;
1609404
1609878
  init_wrapper();
1609405
1609879
 
1609406
1609880
  // ../docs-preview/lib/DebugLogger.js
1609407
- var import_promises67 = require("fs/promises");
1609881
+ var import_promises68 = require("fs/promises");
1609408
1609882
  var import_os5 = require("os");
1609409
1609883
  var import_path40 = __toESM(require("path"), 1);
1609410
1609884
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
1609411
1609885
  var LOGS_FOLDER_NAME = "logs";
1609412
1609886
  function getCliSource() {
1609413
- const version7 = "3.47.3";
1609887
+ const version7 = "3.47.4";
1609414
1609888
  return `cli@${version7}`;
1609415
1609889
  }
1609416
1609890
  var DebugLogger = class {
@@ -1609430,7 +1609904,7 @@ var DebugLogger = class {
1609430
1609904
  const localStorageFolder = join2(AbsoluteFilePath2.of((0, import_os5.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER4));
1609431
1609905
  const logsDir = join2(localStorageFolder, RelativeFilePath2.of(LOGS_FOLDER_NAME));
1609432
1609906
  if (!await doesPathExist(logsDir)) {
1609433
- await (0, import_promises67.mkdir)(logsDir, { recursive: true });
1609907
+ await (0, import_promises68.mkdir)(logsDir, { recursive: true });
1609434
1609908
  }
1609435
1609909
  const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
1609436
1609910
  const logFileName = `${timestamp2}.debug.log`;
@@ -1609443,7 +1609917,7 @@ var DebugLogger = class {
1609443
1609917
  "================================================================================",
1609444
1609918
  ""
1609445
1609919
  ].join("\n");
1609446
- await (0, import_promises67.writeFile)(this.logFilePath, header, "utf-8");
1609920
+ await (0, import_promises68.writeFile)(this.logFilePath, header, "utf-8");
1609447
1609921
  this.initialized = true;
1609448
1609922
  }
1609449
1609923
  /**
@@ -1609461,7 +1609935,7 @@ var DebugLogger = class {
1609461
1609935
  }
1609462
1609936
  const line = JSON.stringify(entry) + "\n";
1609463
1609937
  try {
1609464
- await (0, import_promises67.appendFile)(this.logFilePath, line, "utf-8");
1609938
+ await (0, import_promises68.appendFile)(this.logFilePath, line, "utf-8");
1609465
1609939
  } catch (error49) {
1609466
1609940
  }
1609467
1609941
  }
@@ -1609585,7 +1610059,7 @@ var DebugLogger = class {
1609585
1610059
  // ../docs-preview/lib/downloadLocalDocsBundle.js
1609586
1610060
  var import_cli_progress = __toESM(require_cli_progress(), 1);
1609587
1610061
  var import_decompress = __toESM(require_decompress(), 1);
1609588
- var import_promises68 = require("fs/promises");
1610062
+ var import_promises69 = require("fs/promises");
1609589
1610063
  var import_os6 = require("os");
1609590
1610064
  var import_tmp_promise9 = __toESM(require_tmp_promise(), 1);
1609591
1610065
  var import_xml2js = __toESM(require_xml2js(), 1);
@@ -1609673,7 +1610147,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
1609673
1610147
  let currentETag = void 0;
1609674
1610148
  if (currentETagExists) {
1609675
1610149
  logger.debug("Reading existing ETag");
1609676
- currentETag = (await (0, import_promises68.readFile)(eTagFilepath)).toString();
1610150
+ currentETag = (await (0, import_promises69.readFile)(eTagFilepath)).toString();
1609677
1610151
  }
1609678
1610152
  if (currentETag != null && currentETag === eTag) {
1609679
1610153
  logger.debug("ETag matches. Using already downloaded bundle");
@@ -1609737,16 +1610211,16 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
1609737
1610211
  }
1609738
1610212
  }
1609739
1610213
  const nodeBuffer = Buffer.concat(chunks);
1609740
- await (0, import_promises68.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
1610214
+ await (0, import_promises69.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
1609741
1610215
  logger.debug(`Wrote ${tryTar ? "output.tar.gz" : "output.zip"} to ${outputZipPath}`);
1609742
1610216
  const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
1609743
1610217
  if (await doesPathExist(absolutePathToPreviewFolder)) {
1609744
1610218
  logger.debug(`Removing previously cached bundle at: ${absolutePathToPreviewFolder}`);
1609745
- await (0, import_promises68.rm)(absolutePathToPreviewFolder, { recursive: true });
1610219
+ await (0, import_promises69.rm)(absolutePathToPreviewFolder, { recursive: true });
1609746
1610220
  }
1609747
- await (0, import_promises68.mkdir)(absolutePathToPreviewFolder, { recursive: true });
1610221
+ await (0, import_promises69.mkdir)(absolutePathToPreviewFolder, { recursive: true });
1609748
1610222
  const absolutePathToBundleFolder = getPathToBundleFolder({ app });
1609749
- await (0, import_promises68.mkdir)(absolutePathToBundleFolder, { recursive: true });
1610223
+ await (0, import_promises69.mkdir)(absolutePathToBundleFolder, { recursive: true });
1609750
1610224
  logger.debug(`Decompressing bundle from ${outputZipPath} to ${absolutePathToBundleFolder}`);
1609751
1610225
  let unzipProgressBar;
1609752
1610226
  let unzipInterval;
@@ -1609781,7 +1610255,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
1609781
1610255
  unzipProgressBar.stop();
1609782
1610256
  }
1609783
1610257
  }
1609784
- await (0, import_promises68.writeFile)(eTagFilepath, eTag);
1610258
+ await (0, import_promises69.writeFile)(eTagFilepath, eTag);
1609785
1610259
  logger.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
1609786
1610260
  if (app) {
1609787
1610261
  logger.debug("Checking if pnpm is installed");
@@ -1609863,15 +1610337,15 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
1609863
1610337
  }
1609864
1610338
  if (!pnpmfileExists) {
1609865
1610339
  logger.debug(`Writing pnpmfile.cjs at ${pnpmfilePath}`);
1609866
- await (0, import_promises68.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
1610340
+ await (0, import_promises69.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
1609867
1610341
  }
1609868
1610342
  if (!npmrcExists) {
1609869
1610343
  logger.debug(`Writing .npmrc at ${npmrcPath}`);
1609870
- await (0, import_promises68.writeFile)(npmrcPath, NPMRC_CONTENTS);
1610344
+ await (0, import_promises69.writeFile)(npmrcPath, NPMRC_CONTENTS);
1609871
1610345
  }
1609872
1610346
  if (instrumentationJsExists) {
1609873
1610347
  logger.debug(`Removing instrumentation.js at ${absPathToInstrumentationJs}`);
1609874
- await (0, import_promises68.rm)(absPathToInstrumentationJs);
1610348
+ await (0, import_promises69.rm)(absPathToInstrumentationJs);
1609875
1610349
  }
1609876
1610350
  try {
1609877
1610351
  logger.debug("Running pnpm install within standalone");
@@ -1609891,7 +1610365,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
1609891
1610365
  logger.error(`Error: ${error49}`);
1609892
1610366
  const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
1609893
1610367
  if (await doesPathExist(absolutePathToPreviewFolder)) {
1609894
- await (0, import_promises68.rm)(absolutePathToPreviewFolder, { recursive: true });
1610368
+ await (0, import_promises69.rm)(absolutePathToPreviewFolder, { recursive: true });
1609895
1610369
  }
1609896
1610370
  logger.debug(`Removing incomplete bundle: rm -rf ${absolutePathToPreviewFolder}`);
1609897
1610371
  return {
@@ -1609901,7 +1610375,7 @@ async function downloadBundle({ bucketUrl, logger, preferCached, app = false, tr
1609901
1610375
  }
1609902
1610376
 
1609903
1610377
  // ../docs-preview/lib/previewDocs.js
1609904
- var import_promises71 = require("fs/promises");
1610378
+ var import_promises72 = require("fs/promises");
1609905
1610379
  var import_gray_matter10 = __toESM(require_gray_matter(), 1);
1609906
1610380
 
1609907
1610381
  // ../docs-markdown-utils/src/extract-literals.ts
@@ -1610744,9 +1611218,9 @@ function replaceFrontmatterImagesforLogo2(data2, mapImage) {
1610744
1611218
  }
1610745
1611219
 
1610746
1611220
  // ../docs-markdown-utils/src/replaceReferencedCode.ts
1610747
- var import_promises69 = require("fs/promises");
1611221
+ var import_promises70 = require("fs/promises");
1610748
1611222
  async function defaultFileLoader2(filepath) {
1610749
- const file2 = await (0, import_promises69.readFile)(filepath);
1611223
+ const file2 = await (0, import_promises70.readFile)(filepath);
1610750
1611224
  return file2.toString();
1610751
1611225
  }
1610752
1611226
  function isUrl3(src) {
@@ -1610920,10 +1611394,10 @@ ${replacement}
1610920
1611394
  }
1610921
1611395
 
1610922
1611396
  // ../docs-markdown-utils/src/replaceReferencedMarkdown.ts
1610923
- var import_promises70 = require("fs/promises");
1611397
+ var import_promises71 = require("fs/promises");
1610924
1611398
  var import_gray_matter9 = __toESM(require_gray_matter(), 1);
1610925
1611399
  async function defaultMarkdownLoader2(filepath) {
1610926
- const { content: content5 } = (0, import_gray_matter9.default)(await (0, import_promises70.readFile)(filepath));
1611400
+ const { content: content5 } = (0, import_gray_matter9.default)(await (0, import_promises71.readFile)(filepath));
1610927
1611401
  return content5;
1610928
1611402
  }
1610929
1611403
  function extractAttributes2(markdownTag) {
@@ -1611122,7 +1611596,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
1611122
1611596
  navAffectingChange = true;
1611123
1611597
  continue;
1611124
1611598
  }
1611125
- const markdown = (await (0, import_promises71.readFile)(absoluteFilePath)).toString();
1611599
+ const markdown = (await (0, import_promises72.readFile)(absoluteFilePath)).toString();
1611126
1611600
  const isNewFile = previousValue == null;
1611127
1611601
  if (isNewFile) {
1611128
1611602
  navAffectingChange = true;
@@ -1611512,7 +1611986,7 @@ var SnippetDependencyTracker = class {
1611512
1611986
  const markdownFiles = await this.findMarkdownFiles(docsWorkspace.absoluteFilePath);
1611513
1611987
  for (const markdownFile of markdownFiles) {
1611514
1611988
  try {
1611515
- const content5 = await (0, import_promises72.readFile)(markdownFile, "utf-8");
1611989
+ const content5 = await (0, import_promises73.readFile)(markdownFile, "utf-8");
1611516
1611990
  const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
1611517
1611991
  this.pageToSnippets.set(markdownFile, referencedFiles);
1611518
1611992
  for (const referencedFile of referencedFiles) {
@@ -1611594,7 +1612068,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
1611594
1612068
  const appPreviewFolder = getPathToPreviewFolder({ app: true });
1611595
1612069
  if (await doesPathExist(appPreviewFolder)) {
1611596
1612070
  context2.logger.info("Force download requested. Deleting cached bundle...");
1611597
- await (0, import_promises72.rm)(appPreviewFolder, { recursive: true });
1612071
+ await (0, import_promises73.rm)(appPreviewFolder, { recursive: true });
1611598
1612072
  }
1611599
1612073
  }
1611600
1612074
  if (bundlePath != null) {
@@ -1614088,7 +1614562,7 @@ async function validateVersionConfigFileSchema({ value }) {
1614088
1614562
  }
1614089
1614563
 
1614090
1614564
  // ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileYamlAst.js
1614091
- var import_promises74 = require("fs/promises");
1614565
+ var import_promises75 = require("fs/promises");
1614092
1614566
 
1614093
1614567
  // ../yaml/docs-validator/lib/docsAst/products-yml.schema.json
1614094
1614568
  var products_yml_schema_exports = {};
@@ -1615939,7 +1616413,7 @@ async function visitFilepath({ absoluteFilepathToConfiguration, rawUnresolvedFil
1615939
1616413
  }
1615940
1616414
 
1615941
1616415
  // ../yaml/docs-validator/lib/docsAst/visitNavigationAst.js
1615942
- var import_promises73 = require("fs/promises");
1616416
+ var import_promises74 = require("fs/promises");
1615943
1616417
 
1615944
1616418
  // ../yaml/docs-validator/lib/utils/asyncPool.js
1615945
1616419
  async function asyncPool(limit, items, fn4) {
@@ -1616090,13 +1616564,13 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
1616090
1616564
  if (navigationItemIsPage(navigationItem)) {
1616091
1616565
  const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), navigationItem.path);
1616092
1616566
  if (await doesPathExist(absoluteFilepath)) {
1616093
- const fileStats = await (0, import_promises73.stat)(absoluteFilepath);
1616567
+ const fileStats = await (0, import_promises74.stat)(absoluteFilepath);
1616094
1616568
  const fileSizeMB = fileStats.size / (1024 * 1024);
1616095
1616569
  if (fileSizeMB > 1) {
1616096
1616570
  context2.logger.trace(`Processing large markdown file: ${navigationItem.path} (${fileSizeMB.toFixed(2)} MB)`);
1616097
1616571
  }
1616098
1616572
  const startTime = performance.now();
1616099
- const content5 = (await (0, import_promises73.readFile)(absoluteFilepath, "utf8")).toString();
1616573
+ const content5 = (await (0, import_promises74.readFile)(absoluteFilepath, "utf8")).toString();
1616100
1616574
  const readTime = performance.now() - startTime;
1616101
1616575
  if (readTime > 2e3) {
1616102
1616576
  context2.logger.debug(`Slow file read: ${navigationItem.path} took ${readTime.toFixed(0)}ms`);
@@ -1616143,12 +1616617,12 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
1616143
1616617
  context2.logger.trace(`Starting changelog processing for directory: ${changelogDir}`);
1616144
1616618
  if (await doesPathExist(changelogDir)) {
1616145
1616619
  const startTime = performance.now();
1616146
- const files = await (0, import_promises73.readdir)(changelogDir);
1616620
+ const files = await (0, import_promises74.readdir)(changelogDir);
1616147
1616621
  const markdownFiles = files.filter((file2) => file2.endsWith(".md") || file2.endsWith(".mdx"));
1616148
1616622
  context2.logger.debug(`Processing ${markdownFiles.length} changelog files in ${changelogDir}`);
1616149
1616623
  await asyncPool(VALIDATION_CONCURRENCY, markdownFiles, async (file2) => {
1616150
1616624
  const absoluteFilepath = resolve5(changelogDir, file2);
1616151
- const content5 = (await (0, import_promises73.readFile)(absoluteFilepath, "utf8")).toString();
1616625
+ const content5 = (await (0, import_promises74.readFile)(absoluteFilepath, "utf8")).toString();
1616152
1616626
  context2.logger.trace(`Validating changelog file: ${file2}`);
1616153
1616627
  await visitor.markdownPage?.({
1616154
1616628
  title: file2,
@@ -1616338,7 +1616812,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
1616338
1616812
  willBeUploaded: false
1616339
1616813
  });
1616340
1616814
  const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), product.path);
1616341
- const content5 = jsYaml.load((await (0, import_promises74.readFile)(absoluteFilepath)).toString());
1616815
+ const content5 = jsYaml.load((await (0, import_promises75.readFile)(absoluteFilepath)).toString());
1616342
1616816
  if (await doesPathExist(absoluteFilepath)) {
1616343
1616817
  await visitor.productFile?.({
1616344
1616818
  path: product.path,
@@ -1616416,7 +1616890,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
1616416
1616890
  willBeUploaded: false
1616417
1616891
  });
1616418
1616892
  const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), version7.path);
1616419
- const content5 = jsYaml.load((await (0, import_promises74.readFile)(absoluteFilepath)).toString());
1616893
+ const content5 = jsYaml.load((await (0, import_promises75.readFile)(absoluteFilepath)).toString());
1616420
1616894
  if (await doesPathExist(absoluteFilepath)) {
1616421
1616895
  await visitor.versionFile?.({
1616422
1616896
  path: version7.path,
@@ -1616850,7 +1617324,7 @@ var import_web = require("stream/web");
1616850
1617324
  var import_node_stream5 = require("stream");
1616851
1617325
 
1616852
1617326
  // ../../../node_modules/.pnpm/strtok3@9.1.1/node_modules/strtok3/lib/index.js
1616853
- var import_promises76 = require("fs/promises");
1617327
+ var import_promises77 = require("fs/promises");
1616854
1617328
 
1616855
1617329
  // ../../../node_modules/.pnpm/peek-readable@5.4.2/node_modules/peek-readable/lib/EndOfStreamError.js
1616856
1617330
  var defaultMessages = "End-Of-Stream";
@@ -1617221,14 +1617695,14 @@ function fromBuffer(uint8Array, options2) {
1617221
1617695
  }
1617222
1617696
 
1617223
1617697
  // ../../../node_modules/.pnpm/strtok3@9.1.1/node_modules/strtok3/lib/FileTokenizer.js
1617224
- var import_promises75 = require("fs/promises");
1617698
+ var import_promises76 = require("fs/promises");
1617225
1617699
  var FileTokenizer = class _FileTokenizer extends AbstractTokenizer {
1617226
1617700
  /**
1617227
1617701
  * Create tokenizer from provided file path
1617228
1617702
  * @param sourceFilePath File path
1617229
1617703
  */
1617230
1617704
  static async fromFile(sourceFilePath) {
1617231
- const fileHandle = await (0, import_promises75.open)(sourceFilePath, "r");
1617705
+ const fileHandle = await (0, import_promises76.open)(sourceFilePath, "r");
1617232
1617706
  const stat3 = await fileHandle.stat();
1617233
1617707
  return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat3.size } });
1617234
1617708
  }
@@ -1619190,7 +1619664,7 @@ var supportedExtensions = new Set(extensions);
1619190
1619664
  var supportedMimeTypes = new Set(mimeTypes);
1619191
1619665
 
1619192
1619666
  // ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
1619193
- var import_promises77 = require("fs/promises");
1619667
+ var import_promises78 = require("fs/promises");
1619194
1619668
  var import_path44 = __toESM(require("path"), 1);
1619195
1619669
  var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
1619196
1619670
  // image files
@@ -1619311,7 +1619785,7 @@ var ValidFileTypes = {
1619311
1619785
  }
1619312
1619786
  };
1619313
1619787
  var getViolationsForFile = async (absoluteFilepath) => {
1619314
- const file2 = new Uint8Array(await (0, import_promises77.readFile)(absoluteFilepath));
1619788
+ const file2 = new Uint8Array(await (0, import_promises78.readFile)(absoluteFilepath));
1619315
1619789
  const fileType = await fileTypeFromBuffer(file2);
1619316
1619790
  if (fileType != null) {
1619317
1619791
  if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
@@ -1619350,7 +1619824,7 @@ var getViolationsForFile = async (absoluteFilepath) => {
1619350
1619824
  };
1619351
1619825
 
1619352
1619826
  // ../yaml/docs-validator/lib/rules/valid-frontmatter/valid-frontmatter.js
1619353
- var import_promises78 = require("fs/promises");
1619827
+ var import_promises79 = require("fs/promises");
1619354
1619828
  var import_gray_matter11 = __toESM(require_gray_matter(), 1);
1619355
1619829
  var ValidFrontmatter = {
1619356
1619830
  name: "valid-frontmatter",
@@ -1619361,7 +1619835,7 @@ var ValidFrontmatter = {
1619361
1619835
  return [];
1619362
1619836
  }
1619363
1619837
  try {
1619364
- const fileContents = await (0, import_promises78.readFile)(absoluteFilepath, "utf-8");
1619838
+ const fileContents = await (0, import_promises79.readFile)(absoluteFilepath, "utf-8");
1619365
1619839
  (0, import_gray_matter11.default)(fileContents);
1619366
1619840
  return [];
1619367
1619841
  } catch (error49) {
@@ -1623818,7 +1624292,7 @@ function compile(vfileCompatible, compileOptions) {
1623818
1624292
  }
1623819
1624293
 
1623820
1624294
  // ../../../node_modules/.pnpm/vfile-matter@5.0.1/node_modules/vfile-matter/lib/index.js
1623821
- var import_yaml4 = __toESM(require_dist(), 1);
1624295
+ var import_yaml5 = __toESM(require_dist(), 1);
1623822
1624296
  var regex4 = /^---(?:\r?\n|\r)(?:([\s\S]*?)(?:\r?\n|\r))?---(?:\r?\n|\r|$)/;
1623823
1624297
  var emptyOptions10 = {};
1623824
1624298
  var emptyYamlOptions = {};
@@ -1623829,7 +1624303,7 @@ function matter2(file2, options2) {
1623829
1624303
  let document4 = String(file2);
1623830
1624304
  const match3 = regex4.exec(document4);
1623831
1624305
  if (match3) {
1623832
- file2.data.matter = import_yaml4.default.parse(match3[1] || "", yamlOptions) || {};
1624306
+ file2.data.matter = import_yaml5.default.parse(match3[1] || "", yamlOptions) || {};
1623833
1624307
  if (strip) {
1623834
1624308
  document4 = document4.slice(match3[0].length);
1623835
1624309
  file2.value = file2.value && typeof file2.value === "object" ? new TextEncoder().encode(document4) : document4;
@@ -1624237,7 +1624711,7 @@ async function parseMarkdown({ markdown, absoluteFilepath, absolutePathToFernFol
1624237
1624711
  }
1624238
1624712
 
1624239
1624713
  // ../yaml/docs-validator/lib/rules/valid-markdown-file-reference/valid-markdown-file-reference.js
1624240
- var import_promises79 = require("fs/promises");
1624714
+ var import_promises80 = require("fs/promises");
1624241
1624715
  var import_gray_matter12 = __toESM(require_gray_matter(), 1);
1624242
1624716
  var ValidMarkdownFileReferences = {
1624243
1624717
  name: "valid-markdown-file-references",
@@ -1624248,7 +1624722,7 @@ var ValidMarkdownFileReferences = {
1624248
1624722
  return [];
1624249
1624723
  }
1624250
1624724
  try {
1624251
- const fileContents = await (0, import_promises79.readFile)(absoluteFilepath, "utf-8");
1624725
+ const fileContents = await (0, import_promises80.readFile)(absoluteFilepath, "utf-8");
1624252
1624726
  const { content: content5 } = (0, import_gray_matter12.default)(fileContents, {});
1624253
1624727
  const tree = parseMarkdownToTree(content5);
1624254
1624728
  const errors4 = [];
@@ -1624925,7 +1625399,7 @@ var MDX_NODE_TYPES = [
1624925
1625399
  "mdxTextExpression",
1624926
1625400
  "mdxjsEsm"
1624927
1625401
  ];
1624928
- function collectLinksAndSources({ readFile: readFile84 = (path76) => (0, import_node_fs27.readFileSync)(path76, "utf-8"), ...opts }) {
1625402
+ function collectLinksAndSources({ readFile: readFile85 = (path76) => (0, import_node_fs27.readFileSync)(path76, "utf-8"), ...opts }) {
1624929
1625403
  const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
1624930
1625404
  const contentQueue = [opts];
1624931
1625405
  const links = [];
@@ -1624963,7 +1625437,7 @@ function collectLinksAndSources({ readFile: readFile84 = (path76) => (0, import_
1624963
1625437
  const resolvedImportPath = resolve5(dirname4(absoluteFilepath), importPath);
1624964
1625438
  if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
1624965
1625439
  contentQueue.push({
1624966
- content: readFile84(resolvedImportPath),
1625440
+ content: readFile85(resolvedImportPath),
1624967
1625441
  absoluteFilepath: resolvedImportPath
1624968
1625442
  });
1624969
1625443
  }
@@ -1625006,7 +1625480,7 @@ function collectLinksAndSources({ readFile: readFile84 = (path76) => (0, import_
1625006
1625480
  if (absoluteFilepath && typeof src === "string") {
1625007
1625481
  const resolvedImportPath = resolve5(dirname4(absoluteFilepath), src);
1625008
1625482
  contentQueue.push({
1625009
- content: readFile84(resolvedImportPath),
1625483
+ content: readFile85(resolvedImportPath),
1625010
1625484
  absoluteFilepath: resolvedImportPath
1625011
1625485
  });
1625012
1625486
  }
@@ -1625390,7 +1625864,7 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRuleVisit
1625390
1625864
  }
1625391
1625865
 
1625392
1625866
  // ../yaml/docs-validator/lib/rules/no-non-component-refs/no-non-component-refs.js
1625393
- var import_promises80 = require("fs/promises");
1625867
+ var import_promises81 = require("fs/promises");
1625394
1625868
  var NoNonComponentRefsRule = {
1625395
1625869
  name: "no-non-component-refs",
1625396
1625870
  create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
@@ -1625404,7 +1625878,7 @@ var NoNonComponentRefsRule = {
1625404
1625878
  if (!processedFiles.has(spec.absoluteFilepath)) {
1625405
1625879
  processedFiles.add(spec.absoluteFilepath);
1625406
1625880
  try {
1625407
- const contents = (await (0, import_promises80.readFile)(spec.absoluteFilepath)).toString();
1625881
+ const contents = (await (0, import_promises81.readFile)(spec.absoluteFilepath)).toString();
1625408
1625882
  const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
1625409
1625883
  const isOpenApiV2 = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
1625410
1625884
  if (isOpenApiV2) {
@@ -1625444,7 +1625918,7 @@ var NoNonComponentRefsRule = {
1625444
1625918
  };
1625445
1625919
 
1625446
1625920
  // ../yaml/docs-validator/lib/rules/no-openapi-v2-in-docs/no-openapi-v2-in-docs.js
1625447
- var import_promises81 = require("fs/promises");
1625921
+ var import_promises82 = require("fs/promises");
1625448
1625922
  var NoOpenApiV2InDocsRule = {
1625449
1625923
  name: "no-openapi-v2-in-docs",
1625450
1625924
  create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
@@ -1625457,7 +1625931,7 @@ var NoOpenApiV2InDocsRule = {
1625457
1625931
  if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
1625458
1625932
  processedFiles.add(spec.absoluteFilepath);
1625459
1625933
  try {
1625460
- const contents = (await (0, import_promises81.readFile)(spec.absoluteFilepath)).toString();
1625934
+ const contents = (await (0, import_promises82.readFile)(spec.absoluteFilepath)).toString();
1625461
1625935
  const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
1625462
1625936
  if (contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"))) {
1625463
1625937
  violations.push({
@@ -1625580,7 +1626054,7 @@ var ValidInstanceUrlRule = {
1625580
1626054
  };
1625581
1626055
 
1625582
1626056
  // ../yaml/docs-validator/lib/rules/valid-local-references/valid-local-references.js
1625583
- var import_promises82 = require("fs/promises");
1626057
+ var import_promises83 = require("fs/promises");
1625584
1626058
  function validateReference(ref2, spec) {
1625585
1626059
  const pathParts = ref2.replace(/^#\//, "").split("/").map((part) => (
1625586
1626060
  // Decode JSON Pointer escapes: ~1 -> /, ~0 -> ~
@@ -1625647,7 +1626121,7 @@ var ValidLocalReferencesRule = {
1625647
1626121
  if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
1625648
1626122
  processedFiles.add(spec.absoluteFilepath);
1625649
1626123
  try {
1625650
- const contents = (await (0, import_promises82.readFile)(spec.absoluteFilepath)).toString();
1626124
+ const contents = (await (0, import_promises83.readFile)(spec.absoluteFilepath)).toString();
1625651
1626125
  const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
1625652
1626126
  const isOpenApiV2 = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
1625653
1626127
  if (isOpenApiV2) {
@@ -1625700,7 +1626174,7 @@ var ValidLocalReferencesRule = {
1625700
1626174
  };
1625701
1626175
 
1625702
1626176
  // ../yaml/docs-validator/lib/rules/valid-openapi-examples/valid-openapi-examples.js
1625703
- var import_promises83 = require("fs/promises");
1626177
+ var import_promises84 = require("fs/promises");
1625704
1626178
  var ValidOpenApiExamples = {
1625705
1626179
  name: "valid-openapi-examples",
1625706
1626180
  create: ({ ossWorkspaces, logger, workspace: docsWorkspace }) => {
@@ -1625798,7 +1626272,7 @@ var ValidOpenApiExamples = {
1625798
1626272
  };
1625799
1626273
  async function validateOpenApiExamples({ specPath, logger }) {
1625800
1626274
  try {
1625801
- const specContent = await (0, import_promises83.readFile)(specPath, "utf-8");
1626275
+ const specContent = await (0, import_promises84.readFile)(specPath, "utf-8");
1625802
1626276
  let spec;
1625803
1626277
  try {
1625804
1626278
  spec = JSON.parse(specContent);
@@ -1626492,7 +1626966,7 @@ Found ${previewDeployments.length} preview deployment(s):
1626492
1626966
  }
1626493
1626967
 
1626494
1626968
  // src/commands/downgrade/downgrade.ts
1626495
- var import_promises84 = require("fs/promises");
1626969
+ var import_promises85 = require("fs/promises");
1626496
1626970
 
1626497
1626971
  // ../../../node_modules/.pnpm/immer@10.1.3/node_modules/immer/dist/immer.mjs
1626498
1626972
  var NOTHING = Symbol.for("immer-nothing");
@@ -1627181,12 +1627655,12 @@ async function downgrade({
1627181
1627655
  const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
1627182
1627656
  draft.version = targetVersion;
1627183
1627657
  });
1627184
- await (0, import_promises84.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
1627658
+ await (0, import_promises85.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
1627185
1627659
  cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
1627186
1627660
  }
1627187
1627661
 
1627188
1627662
  // src/commands/export/generateOpenAPIForWorkspaces.ts
1627189
- var import_promises85 = require("fs/promises");
1627663
+ var import_promises86 = require("fs/promises");
1627190
1627664
 
1627191
1627665
  // src/commands/export/converters/servicesConverter.ts
1627192
1627666
  var import_openapi_types3 = __toESM(require_dist20(), 1);
@@ -1628439,8 +1628913,8 @@ async function generateOpenAPIForWorkspaces({
1628439
1628913
  ir: ir14,
1628440
1628914
  mode: "openapi"
1628441
1628915
  });
1628442
- await (0, import_promises85.mkdir)(dirname4(outputPath), { recursive: true });
1628443
- await (0, import_promises85.writeFile)(
1628916
+ await (0, import_promises86.mkdir)(dirname4(outputPath), { recursive: true });
1628917
+ await (0, import_promises86.writeFile)(
1628444
1628918
  outputPath,
1628445
1628919
  outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent3) : jsYaml.dump(openapi, { indent: indent3 })
1628446
1628920
  );
@@ -1628479,10 +1628953,10 @@ var APPROVED_DIRECTORIES_FILENAME = "approved-output-directories";
1628479
1628953
  var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
1628480
1628954
 
1628481
1628955
  // src/commands/generate/checkOutputDirectory.ts
1628482
- var import_promises88 = require("fs/promises");
1628956
+ var import_promises89 = require("fs/promises");
1628483
1628957
 
1628484
1628958
  // src/persistence/output-directories/getOutputDirectories.ts
1628485
- var import_promises86 = require("fs/promises");
1628959
+ var import_promises87 = require("fs/promises");
1628486
1628960
 
1628487
1628961
  // src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
1628488
1628962
  var import_os7 = require("os");
@@ -1628501,17 +1628975,17 @@ async function getOutputDirectories() {
1628501
1628975
  if (!doesOutputDirectoriesFileExist) {
1628502
1628976
  return [];
1628503
1628977
  }
1628504
- const outputDirectoriesFileContents = await (0, import_promises86.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
1628978
+ const outputDirectoriesFileContents = await (0, import_promises87.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
1628505
1628979
  const outputDirectories = JSON.parse(outputDirectoriesFileContents);
1628506
1628980
  return outputDirectories;
1628507
1628981
  }
1628508
1628982
 
1628509
1628983
  // src/persistence/output-directories/storeOutputDirectories.ts
1628510
- var import_promises87 = require("fs/promises");
1628984
+ var import_promises88 = require("fs/promises");
1628511
1628985
  var import_path46 = __toESM(require("path"), 1);
1628512
1628986
  async function storeOutputDirectories(outputDirectories) {
1628513
- await (0, import_promises87.mkdir)(import_path46.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
1628514
- await (0, import_promises87.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
1628987
+ await (0, import_promises88.mkdir)(import_path46.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
1628988
+ await (0, import_promises88.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
1628515
1628989
  }
1628516
1628990
 
1628517
1628991
  // src/commands/generate/checkOutputDirectory.ts
@@ -1628533,7 +1629007,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
1628533
1629007
  shouldProceed: true
1628534
1629008
  };
1628535
1629009
  }
1628536
- const files = await (0, import_promises88.readdir)(outputPath);
1629010
+ const files = await (0, import_promises89.readdir)(outputPath);
1628537
1629011
  if (files.length === 0) {
1628538
1629012
  return {
1628539
1629013
  shouldProceed: true
@@ -1628895,7 +1629369,7 @@ var AutoVersioningService = class {
1628895
1629369
  };
1628896
1629370
 
1628897
1629371
  // ../generation/local-generation/docker-utils/lib/runDocker.js
1628898
- var import_promises89 = require("fs/promises");
1629372
+ var import_promises90 = require("fs/promises");
1628899
1629373
  var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
1628900
1629374
  async function runContainer({ logger, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner }) {
1628901
1629375
  const tryRun = () => tryRunContainer({
@@ -1628944,7 +1629418,7 @@ async function tryRunContainer({ logger, imageName, args, binds, envVars = {}, p
1628944
1629418
  const logs = stdout + stderr;
1628945
1629419
  if (writeLogsToFile) {
1628946
1629420
  const tmpFile = await import_tmp_promise10.default.file();
1628947
- await (0, import_promises89.writeFile)(tmpFile.path, logs);
1629421
+ await (0, import_promises90.writeFile)(tmpFile.path, logs);
1628948
1629422
  logger.info(`Generator logs here: ${tmpFile.path}`);
1628949
1629423
  }
1628950
1629424
  if (exitCode == null) {
@@ -1629037,7 +1629511,7 @@ var ContainerExecutionEnvironment = class {
1629037
1629511
 
1629038
1629512
  // ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
1629039
1629513
  var import_serialization = __toESM(require_serialization3(), 1);
1629040
- var import_promises91 = require("fs/promises");
1629514
+ var import_promises92 = require("fs/promises");
1629041
1629515
  var path61 = __toESM(require("path"), 1);
1629042
1629516
  var import_path49 = require("path");
1629043
1629517
  var import_tmp_promise12 = __toESM(require_tmp_promise(), 1);
@@ -1642864,7 +1643338,7 @@ function configureBamlClient(config3) {
1642864
1643338
 
1642865
1643339
  // ../generation/local-generation/local-workspace-runner/lib/LocalTaskHandler.js
1642866
1643340
  var import_decompress2 = __toESM(require_decompress(), 1);
1642867
- var import_promises90 = require("fs/promises");
1643341
+ var import_promises91 = require("fs/promises");
1642868
1643342
  var import_os8 = require("os");
1642869
1643343
  var import_path48 = require("path");
1642870
1643344
  var import_semver10 = __toESM(require_semver2(), 1);
@@ -1642947,7 +1643421,7 @@ var LocalTaskHandler = class {
1642947
1643421
  try {
1642948
1643422
  this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
1642949
1643423
  diffFile = await this.generateDiffFile();
1642950
- const diffContent = await (0, import_promises90.readFile)(diffFile, "utf-8");
1643424
+ const diffContent = await (0, import_promises91.readFile)(diffFile, "utf-8");
1642951
1643425
  if (diffContent.trim().length === 0) {
1642952
1643426
  this.context.logger.info("No changes detected in generated SDK");
1642953
1643427
  return null;
@@ -1642994,7 +1643468,7 @@ var LocalTaskHandler = class {
1642994
1643468
  } finally {
1642995
1643469
  if (diffFile) {
1642996
1643470
  try {
1642997
- await (0, import_promises90.rm)(diffFile);
1643471
+ await (0, import_promises91.rm)(diffFile);
1642998
1643472
  } catch (cleanupError) {
1642999
1643473
  this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
1643000
1643474
  }
@@ -1643073,7 +1643547,7 @@ var LocalTaskHandler = class {
1643073
1643547
  const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise11.default.dir({})).path);
1643074
1643548
  const absolutePathToFernignore = AbsoluteFilePath2.of(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
1643075
1643549
  const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
1643076
- await (0, import_promises90.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
1643550
+ await (0, import_promises91.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
1643077
1643551
  await this.runGitCommand(["init"], tmpOutputResolutionDir);
1643078
1643552
  await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
1643079
1643553
  const response = await this.runGitCommand(["config", "--list"], tmpOutputResolutionDir);
@@ -1643087,13 +1643561,13 @@ var LocalTaskHandler = class {
1643087
1643561
  await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
1643088
1643562
  await this.runGitCommand(["reset", "--", ...fernIgnorePaths], tmpOutputResolutionDir);
1643089
1643563
  await this.runGitCommand(["restore", "."], tmpOutputResolutionDir);
1643090
- await (0, import_promises90.rm)(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
1643091
- await (0, import_promises90.rm)(this.absolutePathToLocalOutput, { recursive: true });
1643092
- await (0, import_promises90.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
1643564
+ await (0, import_promises91.rm)(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
1643565
+ await (0, import_promises91.rm)(this.absolutePathToLocalOutput, { recursive: true });
1643566
+ await (0, import_promises91.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
1643093
1643567
  }
1643094
1643568
  async copyGeneratedFilesNoFernIgnorePreservingGit() {
1643095
- const contents = await (0, import_promises90.readdir)(this.absolutePathToLocalOutput);
1643096
- await Promise.all(contents.filter((item) => item !== ".git").map((item) => (0, import_promises90.rm)(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
1643569
+ const contents = await (0, import_promises91.readdir)(this.absolutePathToLocalOutput);
1643570
+ await Promise.all(contents.filter((item) => item !== ".git").map((item) => (0, import_promises91.rm)(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
1643097
1643571
  force: true,
1643098
1643572
  recursive: true
1643099
1643573
  })));
@@ -1643101,11 +1643575,11 @@ var LocalTaskHandler = class {
1643101
1643575
  }
1643102
1643576
  async copyGeneratedFilesNoFernIgnoreDeleteAll() {
1643103
1643577
  this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
1643104
- await (0, import_promises90.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
1643578
+ await (0, import_promises91.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
1643105
1643579
  await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
1643106
1643580
  }
1643107
1643581
  async copyGeneratedFilesToDirectory(outputPath) {
1643108
- const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises90.readdir)(this.absolutePathToTmpOutputDirectory);
1643582
+ const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises91.readdir)(this.absolutePathToTmpOutputDirectory);
1643109
1643583
  if (firstLocalOutputItem == null) {
1643110
1643584
  return;
1643111
1643585
  }
@@ -1643113,15 +1643587,15 @@ var LocalTaskHandler = class {
1643113
1643587
  if (firstLocalOutputItem.endsWith(".zip")) {
1643114
1643588
  await (0, import_decompress2.default)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
1643115
1643589
  for (const localOutputItem of remaininglocalOutputItems) {
1643116
- await (0, import_promises90.cp)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join2(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
1643590
+ await (0, import_promises91.cp)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join2(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
1643117
1643591
  }
1643118
1643592
  } else {
1643119
- await (0, import_promises90.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
1643593
+ await (0, import_promises91.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
1643120
1643594
  }
1643121
1643595
  }
1643122
1643596
  async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
1643123
1643597
  this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
1643124
- await (0, import_promises90.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
1643598
+ await (0, import_promises91.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
1643125
1643599
  }
1643126
1643600
  async runGitCommand(options2, cwd2) {
1643127
1643601
  const response = await loggingExeca(this.context.logger, "git", options2, {
@@ -1643176,24 +1643650,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
1643176
1643650
  context2.logger.debug("Wrote IR to: " + absolutePathToIr);
1643177
1643651
  const configJsonFile = (0, import_path49.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
1643178
1643652
  const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
1643179
- await (0, import_promises91.writeFile)(configJsonFile, "");
1643653
+ await (0, import_promises92.writeFile)(configJsonFile, "");
1643180
1643654
  context2.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
1643181
1643655
  const tmpOutputDirectory = (0, import_path49.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
1643182
1643656
  const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
1643183
- await (0, import_promises91.mkdir)(tmpOutputDirectory, { recursive: true });
1643657
+ await (0, import_promises92.mkdir)(tmpOutputDirectory, { recursive: true });
1643184
1643658
  context2.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
1643185
1643659
  let absolutePathToTmpSnippetJSON = void 0;
1643186
1643660
  if (absolutePathToLocalSnippetJSON != null) {
1643187
1643661
  const snippetJsonFile = (0, import_path49.join)(workspaceTempDir.path, "snippet.json");
1643188
1643662
  absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
1643189
- await (0, import_promises91.writeFile)(snippetJsonFile, "");
1643663
+ await (0, import_promises92.writeFile)(snippetJsonFile, "");
1643190
1643664
  context2.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
1643191
1643665
  }
1643192
1643666
  let absolutePathToTmpSnippetTemplatesJSON = void 0;
1643193
1643667
  if (absolutePathToLocalSnippetTemplateJSON != null) {
1643194
1643668
  const snippetTemplatesJsonFile = (0, import_path49.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
1643195
1643669
  absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
1643196
- await (0, import_promises91.writeFile)(snippetTemplatesJsonFile, "");
1643670
+ await (0, import_promises92.writeFile)(snippetTemplatesJsonFile, "");
1643197
1643671
  context2.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
1643198
1643672
  }
1643199
1643673
  const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
@@ -1643229,7 +1643703,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
1643229
1643703
  whiteLabel,
1643230
1643704
  paths
1643231
1643705
  });
1643232
- await (0, import_promises91.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config3), void 0, 4));
1643706
+ await (0, import_promises92.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config3), void 0, 4));
1643233
1643707
  const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
1643234
1643708
  await environment2.execute({
1643235
1643709
  generatorName: generatorInvocation.name,
@@ -1643471,8 +1643945,8 @@ var import_fiddle_sdk5 = __toESM(require_fiddle_sdk(), 1);
1643471
1643945
 
1643472
1643946
  // ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
1643473
1643947
  var import_fs21 = require("fs");
1643474
- var import_promises92 = require("fs/promises");
1643475
- var import_promises93 = require("stream/promises");
1643948
+ var import_promises93 = require("fs/promises");
1643949
+ var import_promises94 = require("stream/promises");
1643476
1643950
  async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context: context2 }) {
1643477
1643951
  try {
1643478
1643952
  await downloadFileForTask({
@@ -1643489,22 +1643963,22 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
1643489
1643963
  responseType: "stream"
1643490
1643964
  });
1643491
1643965
  if (await doesPathExist(absolutePathToLocalOutput)) {
1643492
- await (0, import_promises92.rm)(absolutePathToLocalOutput, { recursive: true });
1643966
+ await (0, import_promises93.rm)(absolutePathToLocalOutput, { recursive: true });
1643493
1643967
  }
1643494
- await (0, import_promises92.mkdir)(dirname4(absolutePathToLocalOutput), { recursive: true });
1643495
- await (0, import_promises93.pipeline)(request6.data, (0, import_fs21.createWriteStream)(absolutePathToLocalOutput));
1643968
+ await (0, import_promises93.mkdir)(dirname4(absolutePathToLocalOutput), { recursive: true });
1643969
+ await (0, import_promises94.pipeline)(request6.data, (0, import_fs21.createWriteStream)(absolutePathToLocalOutput));
1643496
1643970
  }
1643497
1643971
 
1643498
1643972
  // ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
1643499
1643973
  var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
1643500
1643974
  var import_form_data4 = __toESM(require_form_data(), 1);
1643501
- var import_promises94 = require("fs/promises");
1643975
+ var import_promises95 = require("fs/promises");
1643502
1643976
  var import_url_join23 = __toESM(require_url_join(), 1);
1643503
1643977
  async function createAndStartJob({ projectConfig, workspace, organization, intermediateRepresentation, generatorInvocation, version: version7, context: context2, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview, fernignorePath }) {
1643504
1643978
  let fernignoreContents;
1643505
1643979
  if (fernignorePath != null) {
1643506
1643980
  try {
1643507
- fernignoreContents = await (0, import_promises94.readFile)(fernignorePath, "utf-8");
1643981
+ fernignoreContents = await (0, import_promises95.readFile)(fernignorePath, "utf-8");
1643508
1643982
  } catch (error49) {
1643509
1643983
  context2.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error49}`);
1643510
1643984
  }
@@ -1643698,9 +1644172,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context2 })
1643698
1644172
  // ../generation/remote-generation/remote-workspace-runner/lib/RemoteTaskHandler.js
1643699
1644173
  var import_decompress3 = __toESM(require_decompress(), 1);
1643700
1644174
  var import_fs22 = require("fs");
1643701
- var import_promises95 = require("fs/promises");
1644175
+ var import_promises96 = require("fs/promises");
1643702
1644176
  var import_path50 = __toESM(require("path"), 1);
1643703
- var import_promises96 = require("stream/promises");
1644177
+ var import_promises97 = require("stream/promises");
1643704
1644178
 
1643705
1644179
  // ../../../node_modules/.pnpm/terminal-link@3.0.0/node_modules/terminal-link/index.js
1643706
1644180
  var import_supports_hyperlinks = __toESM(require_supports_hyperlinks(), 1);
@@ -1643868,9 +1644342,9 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
1643868
1644342
  });
1643869
1644343
  const tmpDir = await import_tmp_promise13.default.dir({ prefix: "fern", unsafeCleanup: true });
1643870
1644344
  const outputZipPath = import_path50.default.join(tmpDir.path, "output.zip");
1643871
- await (0, import_promises96.pipeline)(request6.data, (0, import_fs22.createWriteStream)(outputZipPath));
1644345
+ await (0, import_promises97.pipeline)(request6.data, (0, import_fs22.createWriteStream)(outputZipPath));
1643872
1644346
  await forceRemoveDirectory(absolutePathToLocalOutput);
1643873
- await (0, import_promises95.mkdir)(absolutePathToLocalOutput, { recursive: true });
1644347
+ await (0, import_promises96.mkdir)(absolutePathToLocalOutput, { recursive: true });
1643874
1644348
  await (0, import_decompress3.default)(outputZipPath, absolutePathToLocalOutput);
1643875
1644349
  }
1643876
1644350
  async function forceRemoveDirectory(dirPath) {
@@ -1643878,22 +1644352,22 @@ async function forceRemoveDirectory(dirPath) {
1643878
1644352
  return;
1643879
1644353
  }
1643880
1644354
  await makeWritableRecursive(dirPath);
1643881
- await (0, import_promises95.rm)(dirPath, { recursive: true, force: true });
1644355
+ await (0, import_promises96.rm)(dirPath, { recursive: true, force: true });
1643882
1644356
  }
1643883
1644357
  async function makeWritableRecursive(dirPath) {
1643884
1644358
  try {
1643885
- const entries10 = await (0, import_promises95.readdir)(dirPath, { withFileTypes: true });
1644359
+ const entries10 = await (0, import_promises96.readdir)(dirPath, { withFileTypes: true });
1643886
1644360
  for (const entry of entries10) {
1643887
1644361
  const fullPath = AbsoluteFilePath2.of(import_path50.default.join(dirPath, entry.name));
1643888
1644362
  if (entry.isDirectory()) {
1643889
1644363
  await makeWritableRecursive(fullPath);
1643890
1644364
  }
1643891
1644365
  try {
1643892
- await (0, import_promises95.chmod)(fullPath, 493);
1644366
+ await (0, import_promises96.chmod)(fullPath, 493);
1643893
1644367
  } catch {
1643894
1644368
  }
1643895
1644369
  }
1643896
- await (0, import_promises95.chmod)(dirPath, 493);
1644370
+ await (0, import_promises96.chmod)(dirPath, 493);
1643897
1644371
  } catch {
1643898
1644372
  }
1643899
1644373
  }
@@ -1643944,7 +1644418,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
1643944
1644418
  const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise13.default.dir({})).path);
1643945
1644419
  const absolutePathToFernignore = join2(absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME));
1643946
1644420
  const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
1643947
- await (0, import_promises95.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
1644421
+ await (0, import_promises96.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
1643948
1644422
  await runGitCommand(["init"], tmpOutputResolutionDir, context2);
1643949
1644423
  await runGitCommand(["add", "."], tmpOutputResolutionDir, context2);
1643950
1644424
  const gitConfigResponse = await runGitCommand(["config", "--list"], tmpOutputResolutionDir, context2);
@@ -1643960,7 +1644434,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
1643960
1644434
  await runGitCommand(["restore", "."], tmpOutputResolutionDir, context2);
1643961
1644435
  await forceRemoveDirectory(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")));
1643962
1644436
  await forceRemoveDirectory(absolutePathToLocalOutput);
1643963
- await (0, import_promises95.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
1644437
+ await (0, import_promises96.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
1643964
1644438
  }
1643965
1644439
  async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
1643966
1644440
  const request6 = await axios_default.get(s3PreSignedReadUrl, {
@@ -1643968,12 +1644442,12 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
1643968
1644442
  });
1643969
1644443
  const tmpDir = await import_tmp_promise13.default.dir({ prefix: "fern", unsafeCleanup: true });
1643970
1644444
  const outputZipPath = import_path50.default.join(tmpDir.path, "output.zip");
1643971
- await (0, import_promises96.pipeline)(request6.data, (0, import_fs22.createWriteStream)(outputZipPath));
1644445
+ await (0, import_promises97.pipeline)(request6.data, (0, import_fs22.createWriteStream)(outputZipPath));
1643972
1644446
  await (0, import_decompress3.default)(outputZipPath, outputPath);
1643973
1644447
  }
1643974
1644448
 
1643975
1644449
  // ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
1643976
- var import_promises97 = require("fs/promises");
1644450
+ var import_promises98 = require("fs/promises");
1643977
1644451
  var import_tmp_promise14 = __toESM(require_tmp_promise(), 1);
1643978
1644452
  var PROTOBUF_ZIP_FILENAME = "proto.zip";
1643979
1644453
  var SourceUploader = class {
@@ -1643994,7 +1644468,7 @@ var SourceUploader = class {
1643994
1644468
  }
1643995
1644469
  async uploadSource(source2, uploadURL) {
1643996
1644470
  const uploadCommand = await this.getUploadCommand(source2);
1643997
- const fileData = await (0, import_promises97.readFile)(uploadCommand.absoluteFilePath);
1644471
+ const fileData = await (0, import_promises98.readFile)(uploadCommand.absoluteFilePath);
1643998
1644472
  const response = await fetch(uploadURL, {
1643999
1644473
  method: "PUT",
1644000
1644474
  body: fileData,
@@ -1644014,7 +1644488,7 @@ var SourceUploader = class {
1644014
1644488
  absoluteFilePath,
1644015
1644489
  cleanup: async () => {
1644016
1644490
  this.context.logger.debug(`Removing ${absoluteFilePath}`);
1644017
- await (0, import_promises97.unlink)(absoluteFilePath);
1644491
+ await (0, import_promises98.unlink)(absoluteFilePath);
1644018
1644492
  }
1644019
1644493
  };
1644020
1644494
  }
@@ -1644456,7 +1644930,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
1644456
1644930
 
1644457
1644931
  // ../generation/remote-generation/remote-workspace-runner/lib/publishDocs.js
1644458
1644932
  var import_crypto9 = require("crypto");
1644459
- var import_promises98 = require("fs/promises");
1644933
+ var import_promises99 = require("fs/promises");
1644460
1644934
  var mime = __toESM(require_mime_types(), 1);
1644461
1644935
 
1644462
1644936
  // ../generation/remote-generation/remote-workspace-runner/lib/measureImageSizes.js
@@ -1644513,7 +1644987,7 @@ var MEASURE_IMAGE_BATCH_SIZE = 10;
1644513
1644987
  var UPLOAD_FILE_BATCH_SIZE = 10;
1644514
1644988
  var HASH_CONCURRENCY = parseInt(process.env.FERN_DOCS_ASSET_HASH_CONCURRENCY ?? "32", 10);
1644515
1644989
  async function calculateFileHash(absoluteFilePath) {
1644516
- const fileBuffer = await (0, import_promises98.readFile)(absoluteFilePath);
1644990
+ const fileBuffer = await (0, import_promises99.readFile)(absoluteFilePath);
1644517
1644991
  return (0, import_crypto9.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
1644518
1644992
  }
1644519
1644993
  async function publishDocs({ token, organization, docsWorkspace, domain: domain3, customDomains, apiWorkspaces, ossWorkspaces, context: context2, preview, editThisPage, isPrivate = false, disableTemplates = false, skipUpload = false, withAiExamples = true, excludeApis = false, targetAudiences }) {
@@ -1644832,7 +1645306,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context2, batchSize
1644832
1645306
  const absoluteFilePath = resolve5(docsWorkspacePath, relativeFilePath);
1644833
1645307
  try {
1644834
1645308
  const mimeType = mime.lookup(absoluteFilePath);
1644835
- await axios_default.put(uploadUrl, await (0, import_promises98.readFile)(absoluteFilePath), {
1645309
+ await axios_default.put(uploadUrl, await (0, import_promises99.readFile)(absoluteFilePath), {
1644836
1645310
  headers: {
1644837
1645311
  "Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
1644838
1645312
  // Set max cache control for S3 uploads
@@ -1654824,14 +1655298,14 @@ async function validateGeneratorsYmlFile({ contents, allRuleVisitors, cliVersion
1654824
1655298
  }
1654825
1655299
 
1654826
1655300
  // ../workspace/oss-validator/lib/rules/no-duplicate-overrides/no-duplicate-overrides.js
1654827
- var import_promises99 = require("fs/promises");
1655301
+ var import_promises100 = require("fs/promises");
1654828
1655302
  var NoDuplicateOverridesRule = {
1654829
1655303
  name: "no-duplicate-overrides",
1654830
1655304
  run: async ({ workspace, specs, context: context2 }) => {
1654831
1655305
  const violations = [];
1654832
1655306
  const seenMethodsByAudience = /* @__PURE__ */ new Map();
1654833
1655307
  for (const spec of specs) {
1654834
- const contents = (await (0, import_promises99.readFile)(spec.absoluteFilepath)).toString();
1655308
+ const contents = (await (0, import_promises100.readFile)(spec.absoluteFilepath)).toString();
1654835
1655309
  if (contents.includes("openapi") || contents.includes("swagger")) {
1654836
1655310
  const openAPI = await loadOpenAPI({
1654837
1655311
  absolutePathToOpenAPI: spec.absoluteFilepath,
@@ -1655657,7 +1656131,7 @@ async function generateOpenAPIIrForWorkspaces({
1655657
1656131
  }
1655658
1656132
 
1655659
1656133
  // src/commands/generate-overrides/compareOpenAPISpecs.ts
1655660
- var import_promises100 = require("fs/promises");
1656134
+ var import_promises101 = require("fs/promises");
1655661
1656135
  async function compareOpenAPISpecs({
1655662
1656136
  originalPath,
1655663
1656137
  modifiedPath,
@@ -1655694,12 +1656168,12 @@ async function compareOpenAPISpecs({
1655694
1656168
  }
1655695
1656169
  outputPath = join2(dirname4(originalPath), RelativeFilePath2.of(overridesFilename));
1655696
1656170
  }
1655697
- await (0, import_promises100.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
1656171
+ await (0, import_promises101.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
1655698
1656172
  context2.logger.info(`Overrides written to ${outputPath}`);
1655699
1656173
  });
1655700
1656174
  }
1655701
1656175
  async function loadSpec(filepath, context2) {
1655702
- const contents = await (0, import_promises100.readFile)(filepath, "utf8");
1656176
+ const contents = await (0, import_promises101.readFile)(filepath, "utf8");
1655703
1656177
  try {
1655704
1656178
  return JSON.parse(contents);
1655705
1656179
  } catch {
@@ -1655800,7 +1656274,7 @@ function deepEqual(a10, b18) {
1655800
1656274
  }
1655801
1656275
 
1655802
1656276
  // src/commands/generate-overrides/writeOverridesForWorkspaces.ts
1655803
- var import_promises101 = require("fs/promises");
1656277
+ var import_promises102 = require("fs/promises");
1655804
1656278
  async function writeOverridesForWorkspaces({
1655805
1656279
  project,
1655806
1656280
  includeModels,
@@ -1655825,7 +1656299,7 @@ async function writeOverridesForWorkspaces({
1655825
1656299
  async function readExistingOverrides(overridesFilepath, context2) {
1655826
1656300
  let parsedOverrides = null;
1655827
1656301
  try {
1655828
- const contents = (await (0, import_promises101.readFile)(overridesFilepath, "utf8")).toString();
1656302
+ const contents = (await (0, import_promises102.readFile)(overridesFilepath, "utf8")).toString();
1655829
1656303
  try {
1655830
1656304
  parsedOverrides = JSON.parse(contents);
1655831
1656305
  } catch (err) {
@@ -1655889,7 +1656363,7 @@ async function writeDefinitionForOpenAPIWorkspace({
1655889
1656363
  overridesFilename = `${nameWithoutExt}-overrides${extension2}`;
1655890
1656364
  }
1655891
1656365
  }
1655892
- await (0, import_promises101.writeFile)(
1656366
+ await (0, import_promises102.writeFile)(
1655893
1656367
  join2(dirname4(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
1655894
1656368
  jsYaml.dump({ paths, components })
1655895
1656369
  );
@@ -1656254,7 +1656728,7 @@ function convertIRtoJsonSchema(args) {
1656254
1656728
  }
1656255
1656729
 
1656256
1656730
  // src/commands/jsonschema/generateJsonschemaForWorkspace.ts
1656257
- var import_promises102 = require("fs/promises");
1656731
+ var import_promises103 = require("fs/promises");
1656258
1656732
  async function generateJsonschemaForWorkspaces({
1656259
1656733
  typeLocator,
1656260
1656734
  project,
@@ -1656302,9 +1656776,9 @@ async function generateJsonschemaForWorkspaces({
1656302
1656776
  context: context2
1656303
1656777
  });
1656304
1656778
  if (!await doesPathExist(dirname4(jsonschemaFilepath))) {
1656305
- await (0, import_promises102.mkdir)(dirname4(jsonschemaFilepath), { recursive: true });
1656779
+ await (0, import_promises103.mkdir)(dirname4(jsonschemaFilepath), { recursive: true });
1656306
1656780
  }
1656307
- await (0, import_promises102.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
1656781
+ await (0, import_promises103.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
1656308
1656782
  context2.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
1656309
1656783
  });
1656310
1656784
  })
@@ -1656661,7 +1657135,7 @@ async function mockServer({
1656661
1657135
 
1656662
1657136
  // src/commands/register/registerWorkspacesV1.ts
1656663
1657137
  var import_fiddle_sdk7 = __toESM(require_fiddle_sdk(), 1);
1656664
- var import_promises103 = require("fs/promises");
1657138
+ var import_promises104 = require("fs/promises");
1656665
1657139
  var import_path59 = __toESM(require("path"), 1);
1656666
1657140
  var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
1656667
1657141
  async function registerWorkspacesV1({
@@ -1656710,7 +1657184,7 @@ async function registerWorkspacesV1({
1656710
1657184
  context2.logger.debug(`Compressing definition at ${tmpDir.path}`);
1656711
1657185
  await create6({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
1656712
1657186
  context2.logger.info("Uploading definition...");
1656713
- await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises103.readFile)(tarPath));
1657187
+ await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises104.readFile)(tarPath));
1656714
1657188
  context2.logger.info(
1656715
1657189
  `Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
1656716
1657190
  );
@@ -1656848,7 +1657322,7 @@ async function generateDiff({
1656848
1657322
  }
1656849
1657323
 
1656850
1657324
  // src/commands/self-update/selfUpdate.ts
1656851
- var import_promises104 = require("fs/promises");
1657325
+ var import_promises105 = require("fs/promises");
1656852
1657326
  var import_path60 = require("path");
1656853
1657327
  async function getPackageManagerBinDir(logger, pm) {
1656854
1657328
  let command3;
@@ -1656894,7 +1657368,7 @@ async function detectInstallationMethod(logger) {
1656894
1657368
  logger.debug(`Found fern at: ${fernPath}`);
1656895
1657369
  let resolvedPath;
1656896
1657370
  try {
1656897
- resolvedPath = await (0, import_promises104.realpath)(fernPath);
1657371
+ resolvedPath = await (0, import_promises105.realpath)(fernPath);
1656898
1657372
  logger.debug(`Resolved to: ${resolvedPath}`);
1656899
1657373
  } catch (error49) {
1656900
1657374
  logger.debug(`Failed to resolve symlink: ${error49}`);
@@ -1657175,20 +1657649,20 @@ async function generateToken({
1657175
1657649
 
1657176
1657650
  // src/commands/upgrade/updateApiSpec.ts
1657177
1657651
  var fs31 = __toESM(require("fs"), 1);
1657178
- var import_promises105 = require("fs/promises");
1657652
+ var import_promises106 = require("fs/promises");
1657179
1657653
  var import_stream9 = require("stream");
1657180
- var import_promises106 = require("stream/promises");
1657654
+ var import_promises107 = require("stream/promises");
1657181
1657655
  async function fetchAndWriteFile(url3, path76, logger, indent3) {
1657182
1657656
  const resp = await fetch(url3);
1657183
1657657
  if (resp.ok && resp.body) {
1657184
1657658
  logger.debug("Origin successfully fetched, writing to file");
1657185
1657659
  const fileStream = fs31.createWriteStream(path76);
1657186
- await (0, import_promises106.finished)(import_stream9.Readable.fromWeb(resp.body).pipe(fileStream));
1657187
- const fileContents = await (0, import_promises105.readFile)(path76, "utf8");
1657660
+ await (0, import_promises107.finished)(import_stream9.Readable.fromWeb(resp.body).pipe(fileStream));
1657661
+ const fileContents = await (0, import_promises106.readFile)(path76, "utf8");
1657188
1657662
  try {
1657189
- await (0, import_promises105.writeFile)(path76, JSON.stringify(JSON.parse(fileContents), void 0, indent3), "utf8");
1657663
+ await (0, import_promises106.writeFile)(path76, JSON.stringify(JSON.parse(fileContents), void 0, indent3), "utf8");
1657190
1657664
  } catch (e6) {
1657191
- await (0, import_promises105.writeFile)(path76, jsYaml.dump(jsYaml.load(fileContents), { indent: indent3 }), "utf8");
1657665
+ await (0, import_promises106.writeFile)(path76, jsYaml.dump(jsYaml.load(fileContents), { indent: indent3 }), "utf8");
1657192
1657666
  }
1657193
1657667
  logger.debug("File written successfully");
1657194
1657668
  }
@@ -1657284,7 +1657758,7 @@ async function processDefinitions({
1657284
1657758
  }
1657285
1657759
 
1657286
1657760
  // ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
1657287
- var import_promises107 = require("fs/promises");
1657761
+ var import_promises108 = require("fs/promises");
1657288
1657762
 
1657289
1657763
  // ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
1657290
1657764
  var FERN_DIRECTORY2 = "fern";
@@ -1657318,7 +1657792,7 @@ var migration = {
1657318
1657792
  try {
1657319
1657793
  const fileContents = await getFileContents(yamlFilepath);
1657320
1657794
  const newContents = addDiscriminantToFile(fileContents);
1657321
- await (0, import_promises107.writeFile)(yamlFilepath, newContents);
1657795
+ await (0, import_promises108.writeFile)(yamlFilepath, newContents);
1657322
1657796
  } catch (error49) {
1657323
1657797
  context2.failAndThrow("Failed to migrate " + yamlFilepath, error49);
1657324
1657798
  }
@@ -1657326,7 +1657800,7 @@ var migration = {
1657326
1657800
  }
1657327
1657801
  };
1657328
1657802
  async function getFileContents(filepath) {
1657329
- const buffer = await (0, import_promises107.readFile)(filepath);
1657803
+ const buffer = await (0, import_promises108.readFile)(filepath);
1657330
1657804
  return buffer.toString();
1657331
1657805
  }
1657332
1657806
  var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
@@ -1657355,8 +1657829,8 @@ var versionMigrations = {
1657355
1657829
  var __default = versionMigrations;
1657356
1657830
 
1657357
1657831
  // ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
1657358
- var import_promises108 = require("fs/promises");
1657359
- var import_yaml5 = __toESM(require_dist(), 1);
1657832
+ var import_promises109 = require("fs/promises");
1657833
+ var import_yaml6 = __toESM(require_dist(), 1);
1657360
1657834
 
1657361
1657835
  // ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
1657362
1657836
  var FERN_DIRECTORY3 = "fern";
@@ -1657396,39 +1657870,39 @@ var migration2 = {
1657396
1657870
  }
1657397
1657871
  };
1657398
1657872
  async function migrateFile(filepath, context2) {
1657399
- const contents = await (0, import_promises108.readFile)(filepath);
1657400
- const parsedDocument = import_yaml5.default.parseDocument(contents.toString());
1657873
+ const contents = await (0, import_promises109.readFile)(filepath);
1657874
+ const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
1657401
1657875
  const types4 = parsedDocument.get("types");
1657402
1657876
  if (types4 == null) {
1657403
1657877
  return;
1657404
1657878
  }
1657405
- if (!import_yaml5.default.isMap(types4)) {
1657879
+ if (!import_yaml6.default.isMap(types4)) {
1657406
1657880
  context2.failWithoutThrowing(`"types" is not a map in ${filepath}`);
1657407
1657881
  return;
1657408
1657882
  }
1657409
1657883
  for (const typeDeclaration of types4.items) {
1657410
- if (import_yaml5.default.isMap(typeDeclaration.value)) {
1657884
+ if (import_yaml6.default.isMap(typeDeclaration.value)) {
1657411
1657885
  const union9 = typeDeclaration.value.get("union");
1657412
1657886
  if (union9 == null) {
1657413
1657887
  continue;
1657414
1657888
  }
1657415
- if (!import_yaml5.default.isMap(union9)) {
1657889
+ if (!import_yaml6.default.isMap(union9)) {
1657416
1657890
  context2.failWithoutThrowing(`"union" is not a map in ${filepath}`);
1657417
1657891
  continue;
1657418
1657892
  }
1657419
1657893
  for (const singleUnionType of union9.items) {
1657420
- if (import_yaml5.default.isScalar(singleUnionType.value)) {
1657894
+ if (import_yaml6.default.isScalar(singleUnionType.value)) {
1657421
1657895
  singleUnionType.value = {
1657422
1657896
  type: singleUnionType.value,
1657423
1657897
  key: singleUnionType.key
1657424
1657898
  };
1657425
- } else if (import_yaml5.default.isMap(singleUnionType.value)) {
1657426
- singleUnionType.value.add(new import_yaml5.default.Pair("key", singleUnionType.key));
1657899
+ } else if (import_yaml6.default.isMap(singleUnionType.value)) {
1657900
+ singleUnionType.value.add(new import_yaml6.default.Pair("key", singleUnionType.key));
1657427
1657901
  }
1657428
1657902
  }
1657429
1657903
  }
1657430
1657904
  }
1657431
- await (0, import_promises108.writeFile)(filepath, parsedDocument.toString());
1657905
+ await (0, import_promises109.writeFile)(filepath, parsedDocument.toString());
1657432
1657906
  }
1657433
1657907
 
1657434
1657908
  // ../cli-migrations/lib/migrations/0.0.203/index.js
@@ -1657439,8 +1657913,8 @@ var versionMigrations2 = {
1657439
1657913
  var __default2 = versionMigrations2;
1657440
1657914
 
1657441
1657915
  // ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
1657442
- var import_promises109 = require("fs/promises");
1657443
- var import_yaml6 = __toESM(require_dist(), 1);
1657916
+ var import_promises110 = require("fs/promises");
1657917
+ var import_yaml7 = __toESM(require_dist(), 1);
1657444
1657918
 
1657445
1657919
  // ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
1657446
1657920
  var FERN_DIRECTORY4 = "fern";
@@ -1657480,18 +1657954,18 @@ var migration3 = {
1657480
1657954
  }
1657481
1657955
  };
1657482
1657956
  async function migrateGeneratorsYml(filepath, context2) {
1657483
- const contents = await (0, import_promises109.readFile)(filepath);
1657484
- const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
1657957
+ const contents = await (0, import_promises110.readFile)(filepath);
1657958
+ const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
1657485
1657959
  const draftGenerators = parsedDocument.get("draft");
1657486
1657960
  if (draftGenerators == null) {
1657487
1657961
  return;
1657488
1657962
  }
1657489
- if (!import_yaml6.default.isSeq(draftGenerators)) {
1657963
+ if (!import_yaml7.default.isSeq(draftGenerators)) {
1657490
1657964
  context2.failWithoutThrowing(`draft generators are not a list in ${filepath}`);
1657491
1657965
  return;
1657492
1657966
  }
1657493
1657967
  draftGenerators.items.forEach((draftGenerator) => {
1657494
- if (!import_yaml6.default.isMap(draftGenerator)) {
1657968
+ if (!import_yaml7.default.isMap(draftGenerator)) {
1657495
1657969
  context2.failWithoutThrowing(`draft generator is not an object in ${filepath}`);
1657496
1657970
  return;
1657497
1657971
  }
@@ -1657507,7 +1657981,7 @@ async function migrateGeneratorsYml(filepath, context2) {
1657507
1657981
  draftGenerator.set("output-path", name3.value.includes("openapi") ? "./generated-openapi" : name3.value.includes("postman") ? "./generated-postman" : localOutput);
1657508
1657982
  }
1657509
1657983
  });
1657510
- await (0, import_promises109.writeFile)(filepath, parsedDocument.toString());
1657984
+ await (0, import_promises110.writeFile)(filepath, parsedDocument.toString());
1657511
1657985
  }
1657512
1657986
 
1657513
1657987
  // ../cli-migrations/lib/migrations/0.0.207/index.js
@@ -1657518,8 +1657992,8 @@ var versionMigrations3 = {
1657518
1657992
  var __default3 = versionMigrations3;
1657519
1657993
 
1657520
1657994
  // ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
1657521
- var import_promises110 = require("fs/promises");
1657522
- var import_yaml7 = __toESM(require_dist(), 1);
1657995
+ var import_promises111 = require("fs/promises");
1657996
+ var import_yaml8 = __toESM(require_dist(), 1);
1657523
1657997
 
1657524
1657998
  // ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
1657525
1657999
  var FERN_DIRECTORY5 = "fern";
@@ -1657559,15 +1658033,15 @@ var migration4 = {
1657559
1658033
  }
1657560
1658034
  };
1657561
1658035
  async function migrateFile2(filepath, context2) {
1657562
- const contents = await (0, import_promises110.readFile)(filepath);
1657563
- const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
1658036
+ const contents = await (0, import_promises111.readFile)(filepath);
1658037
+ const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
1657564
1658038
  const addType = (typeName, typeDeclaration) => {
1657565
1658039
  const types4 = parsedDocument.get("types");
1657566
1658040
  if (types4 == null) {
1657567
1658041
  parsedDocument.set("types", {
1657568
1658042
  [typeName]: typeDeclaration
1657569
1658043
  });
1657570
- } else if (!import_yaml7.default.isMap(types4)) {
1658044
+ } else if (!import_yaml8.default.isMap(types4)) {
1657571
1658045
  context2.failWithoutThrowing(`"types" is not a map in ${filepath}`);
1657572
1658046
  } else {
1657573
1658047
  types4.set(typeName, typeDeclaration);
@@ -1657577,12 +1658051,12 @@ async function migrateFile2(filepath, context2) {
1657577
1658051
  if (errors4 == null) {
1657578
1658052
  return;
1657579
1658053
  }
1657580
- if (!import_yaml7.default.isMap(errors4)) {
1658054
+ if (!import_yaml8.default.isMap(errors4)) {
1657581
1658055
  context2.failWithoutThrowing(`"errors" is not a map in ${filepath}`);
1657582
1658056
  return;
1657583
1658057
  }
1657584
1658058
  for (const errorDeclaration of errors4.items) {
1657585
- if (!import_yaml7.default.isMap(errorDeclaration.value)) {
1658059
+ if (!import_yaml8.default.isMap(errorDeclaration.value)) {
1657586
1658060
  context2.failWithoutThrowing(`Error "${errorDeclaration.key}" is not a map in ${filepath}`);
1657587
1658061
  continue;
1657588
1658062
  }
@@ -1657594,7 +1658068,7 @@ async function migrateFile2(filepath, context2) {
1657594
1658068
  }
1657595
1658069
  const httpSection = errorDeclaration.value.get("http");
1657596
1658070
  if (httpSection != null) {
1657597
- if (!import_yaml7.default.isMap(httpSection)) {
1658071
+ if (!import_yaml8.default.isMap(httpSection)) {
1657598
1658072
  context2.failWithoutThrowing(`http in "${errorDeclaration.key}" is not a map in ${filepath}`);
1657599
1658073
  } else {
1657600
1658074
  const statusCode = httpSection.get("statusCode", true);
@@ -1657603,7 +1658077,7 @@ async function migrateFile2(filepath, context2) {
1657603
1658077
  }
1657604
1658078
  }
1657605
1658079
  }
1657606
- await (0, import_promises110.writeFile)(filepath, parsedDocument.toString());
1658080
+ await (0, import_promises111.writeFile)(filepath, parsedDocument.toString());
1657607
1658081
  }
1657608
1658082
 
1657609
1658083
  // ../cli-migrations/lib/migrations/0.0.210/index.js
@@ -1657614,8 +1658088,8 @@ var versionMigrations4 = {
1657614
1658088
  var __default4 = versionMigrations4;
1657615
1658089
 
1657616
1658090
  // ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
1657617
- var import_promises111 = require("fs/promises");
1657618
- var import_yaml8 = __toESM(require_dist(), 1);
1658091
+ var import_promises112 = require("fs/promises");
1658092
+ var import_yaml9 = __toESM(require_dist(), 1);
1657619
1658093
 
1657620
1658094
  // ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
1657621
1658095
  var FERN_DIRECTORY6 = "fern";
@@ -1657655,37 +1658129,37 @@ var migration5 = {
1657655
1658129
  }
1657656
1658130
  };
1657657
1658131
  async function migrateGeneratorsYml2(filepath, context2) {
1657658
- const contents = await (0, import_promises111.readFile)(filepath);
1657659
- const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
1658132
+ const contents = await (0, import_promises112.readFile)(filepath);
1658133
+ const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
1657660
1658134
  const releaseGenerators = parsedDocument.get("release");
1657661
1658135
  if (releaseGenerators == null) {
1657662
1658136
  return;
1657663
1658137
  }
1657664
- if (!import_yaml8.default.isSeq(releaseGenerators)) {
1658138
+ if (!import_yaml9.default.isSeq(releaseGenerators)) {
1657665
1658139
  context2.failWithoutThrowing(`release generators are not a list in ${filepath}`);
1657666
1658140
  return;
1657667
1658141
  }
1657668
1658142
  releaseGenerators.items.forEach((releaseGenerator) => {
1657669
- if (!import_yaml8.default.isMap(releaseGenerator)) {
1658143
+ if (!import_yaml9.default.isMap(releaseGenerator)) {
1657670
1658144
  context2.failWithoutThrowing(`release generator is not an object in ${filepath}`);
1657671
1658145
  return;
1657672
1658146
  }
1657673
1658147
  const outputs = releaseGenerator.get("outputs");
1657674
- if (!import_yaml8.default.isMap(outputs)) {
1658148
+ if (!import_yaml9.default.isMap(outputs)) {
1657675
1658149
  context2.failWithoutThrowing(`outputs is not an object in ${filepath}`);
1657676
1658150
  return;
1657677
1658151
  }
1657678
1658152
  const githubOutput = outputs.get("github");
1657679
- if (import_yaml8.default.isMap(githubOutput) && githubOutput.has("repository")) {
1658153
+ if (import_yaml9.default.isMap(githubOutput) && githubOutput.has("repository")) {
1657680
1658154
  releaseGenerator.set("github", githubOutput);
1657681
1658155
  }
1657682
1658156
  const publishing = {};
1657683
1658157
  const npmOutput = outputs.get("npm");
1657684
- if (import_yaml8.default.isMap(npmOutput)) {
1658158
+ if (import_yaml9.default.isMap(npmOutput)) {
1657685
1658159
  publishing.npm = npmOutput;
1657686
1658160
  }
1657687
1658161
  const mavenOutput = outputs.get("maven");
1657688
- if (import_yaml8.default.isMap(mavenOutput)) {
1658162
+ if (import_yaml9.default.isMap(mavenOutput)) {
1657689
1658163
  publishing.maven = mavenOutput;
1657690
1658164
  }
1657691
1658165
  if (Object.keys(publishing).length > 0) {
@@ -1657693,7 +1658167,7 @@ async function migrateGeneratorsYml2(filepath, context2) {
1657693
1658167
  }
1657694
1658168
  releaseGenerator.delete("outputs");
1657695
1658169
  });
1657696
- await (0, import_promises111.writeFile)(filepath, parsedDocument.toString());
1658170
+ await (0, import_promises112.writeFile)(filepath, parsedDocument.toString());
1657697
1658171
  }
1657698
1658172
 
1657699
1658173
  // ../cli-migrations/lib/migrations/0.0.212/index.js
@@ -1657704,7 +1658178,7 @@ var versionMigrations5 = {
1657704
1658178
  var __default5 = versionMigrations5;
1657705
1658179
 
1657706
1658180
  // ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
1657707
- var import_promises112 = require("fs/promises");
1658181
+ var import_promises113 = require("fs/promises");
1657708
1658182
 
1657709
1658183
  // ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
1657710
1658184
  var FERN_DIRECTORY7 = "fern";
@@ -1657735,9 +1658209,9 @@ var migration6 = {
1657735
1658209
  run: async ({ context: context2 }) => {
1657736
1658210
  const yamlFiles = await getAllYamlFiles4(context2);
1657737
1658211
  for (const filepath of yamlFiles) {
1657738
- const contents = await (0, import_promises112.readFile)(filepath);
1658212
+ const contents = await (0, import_promises113.readFile)(filepath);
1657739
1658213
  const newContents = contents.toString().replaceAll(" alias:", " type:");
1657740
- await (0, import_promises112.writeFile)(filepath, newContents);
1658214
+ await (0, import_promises113.writeFile)(filepath, newContents);
1657741
1658215
  }
1657742
1658216
  }
1657743
1658217
  };
@@ -1657750,7 +1658224,7 @@ var versionMigrations6 = {
1657750
1658224
  var __default6 = versionMigrations6;
1657751
1658225
 
1657752
1658226
  // ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
1657753
- var import_promises113 = require("fs/promises");
1658227
+ var import_promises114 = require("fs/promises");
1657754
1658228
 
1657755
1658229
  // ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
1657756
1658230
  var FERN_DIRECTORY8 = "fern";
@@ -1657781,9 +1658255,9 @@ var migration7 = {
1657781
1658255
  run: async ({ context: context2 }) => {
1657782
1658256
  const yamlFiles = await getAllRootApiYamlFiles(context2);
1657783
1658257
  for (const filepath of yamlFiles) {
1657784
- const contents = await (0, import_promises113.readFile)(filepath);
1658258
+ const contents = await (0, import_promises114.readFile)(filepath);
1657785
1658259
  const newContents = contents.toString() + "\nerror-discriminant: error";
1657786
- await (0, import_promises113.writeFile)(filepath, newContents);
1658260
+ await (0, import_promises114.writeFile)(filepath, newContents);
1657787
1658261
  }
1657788
1658262
  }
1657789
1658263
  };
@@ -1657796,7 +1658270,7 @@ var versionMigrations7 = {
1657796
1658270
  var __default7 = versionMigrations7;
1657797
1658271
 
1657798
1658272
  // ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
1657799
- var import_promises114 = require("fs/promises");
1658273
+ var import_promises115 = require("fs/promises");
1657800
1658274
 
1657801
1658275
  // ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
1657802
1658276
  var FERN_DIRECTORY9 = "fern";
@@ -1657903,7 +1658377,7 @@ var migration8 = {
1657903
1658377
  }
1657904
1658378
  };
1657905
1658379
  async function migrateGeneratorsYml3(filepath) {
1657906
- const contentsStr = await (0, import_promises114.readFile)(filepath);
1658380
+ const contentsStr = await (0, import_promises115.readFile)(filepath);
1657907
1658381
  const contents = jsYaml.load(contentsStr.toString());
1657908
1658382
  const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
1657909
1658383
  let newGeneratorsConfiguration = {};
@@ -1657921,7 +1658395,7 @@ async function migrateGeneratorsYml3(filepath) {
1657921
1658395
  generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
1657922
1658396
  };
1657923
1658397
  }
1657924
- await (0, import_promises114.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
1658398
+ await (0, import_promises115.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
1657925
1658399
  }
1657926
1658400
  function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
1657927
1658401
  const newSchema = {
@@ -1657996,8 +1658470,8 @@ var versionMigrations8 = {
1657996
1658470
  var __default8 = versionMigrations8;
1657997
1658471
 
1657998
1658472
  // ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
1657999
- var import_promises115 = require("fs/promises");
1658000
- var import_yaml9 = __toESM(require_dist(), 1);
1658473
+ var import_promises116 = require("fs/promises");
1658474
+ var import_yaml10 = __toESM(require_dist(), 1);
1658001
1658475
 
1658002
1658476
  // ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
1658003
1658477
  var FERN_DIRECTORY10 = "fern";
@@ -1658037,10 +1658511,10 @@ var migration9 = {
1658037
1658511
  }
1658038
1658512
  };
1658039
1658513
  async function migrateRootApiFile(filepath) {
1658040
- const contents = await (0, import_promises115.readFile)(filepath);
1658041
- const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
1658514
+ const contents = await (0, import_promises116.readFile)(filepath);
1658515
+ const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
1658042
1658516
  const errorDiscriminant = parsedDocument.get("error-discriminant", true);
1658043
- if (errorDiscriminant == null || !import_yaml9.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
1658517
+ if (errorDiscriminant == null || !import_yaml10.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
1658044
1658518
  return;
1658045
1658519
  }
1658046
1658520
  parsedDocument.set("error-discrimination", {
@@ -1658048,7 +1658522,7 @@ async function migrateRootApiFile(filepath) {
1658048
1658522
  "property-name": errorDiscriminant.value
1658049
1658523
  });
1658050
1658524
  parsedDocument.delete("error-discriminant");
1658051
- await (0, import_promises115.writeFile)(filepath, parsedDocument.toString());
1658525
+ await (0, import_promises116.writeFile)(filepath, parsedDocument.toString());
1658052
1658526
  }
1658053
1658527
 
1658054
1658528
  // ../cli-migrations/lib/migrations/0.0.248/index.js
@@ -1658059,8 +1658533,8 @@ var versionMigrations9 = {
1658059
1658533
  var __default9 = versionMigrations9;
1658060
1658534
 
1658061
1658535
  // ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
1658062
- var import_promises116 = require("fs/promises");
1658063
- var import_yaml10 = __toESM(require_dist(), 1);
1658536
+ var import_promises117 = require("fs/promises");
1658537
+ var import_yaml11 = __toESM(require_dist(), 1);
1658064
1658538
 
1658065
1658539
  // ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
1658066
1658540
  var FERN_DIRECTORY11 = "fern";
@@ -1658100,24 +1658574,24 @@ var migration10 = {
1658100
1658574
  }
1658101
1658575
  };
1658102
1658576
  async function migrateYamlFile(filepath, context2) {
1658103
- const contents = await (0, import_promises116.readFile)(filepath);
1658104
- const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
1658577
+ const contents = await (0, import_promises117.readFile)(filepath);
1658578
+ const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
1658105
1658579
  const services = parsedDocument.get("services");
1658106
1658580
  if (services == null) {
1658107
1658581
  return;
1658108
1658582
  }
1658109
- if (!import_yaml10.default.isMap(services)) {
1658583
+ if (!import_yaml11.default.isMap(services)) {
1658110
1658584
  throw new Error("'services' is not a map");
1658111
1658585
  }
1658112
1658586
  const httpServices = services.get("http");
1658113
1658587
  if (httpServices == null) {
1658114
1658588
  return;
1658115
1658589
  }
1658116
- if (!import_yaml10.default.isMap(httpServices)) {
1658590
+ if (!import_yaml11.default.isMap(httpServices)) {
1658117
1658591
  throw new Error("'http' is not a map");
1658118
1658592
  }
1658119
1658593
  for (const service of httpServices.items) {
1658120
- if (!import_yaml10.default.isMap(service.value)) {
1658594
+ if (!import_yaml11.default.isMap(service.value)) {
1658121
1658595
  context2.failWithoutThrowing(`Service '${service.key}' is not a map`);
1658122
1658596
  continue;
1658123
1658597
  }
@@ -1658125,12 +1658599,12 @@ async function migrateYamlFile(filepath, context2) {
1658125
1658599
  if (endpoints == null) {
1658126
1658600
  continue;
1658127
1658601
  }
1658128
- if (!import_yaml10.default.isMap(endpoints)) {
1658602
+ if (!import_yaml11.default.isMap(endpoints)) {
1658129
1658603
  context2.failWithoutThrowing(`Endpoints are not a map in service '${service.key}'`);
1658130
1658604
  continue;
1658131
1658605
  }
1658132
1658606
  for (const endpoint3 of endpoints.items) {
1658133
- if (!import_yaml10.default.isMap(endpoint3.value)) {
1658607
+ if (!import_yaml11.default.isMap(endpoint3.value)) {
1658134
1658608
  context2.failWithoutThrowing(`Endpoint ${endpoint3.key} is not a map in service '${service.key}'`);
1658135
1658609
  continue;
1658136
1658610
  }
@@ -1658140,14 +1658614,14 @@ async function migrateYamlFile(filepath, context2) {
1658140
1658614
  context2.failWithoutThrowing("Failed to convert endpoint", e6);
1658141
1658615
  }
1658142
1658616
  }
1658143
- await (0, import_promises116.writeFile)(filepath, parsedDocument.toString());
1658617
+ await (0, import_promises117.writeFile)(filepath, parsedDocument.toString());
1658144
1658618
  }
1658145
1658619
  }
1658146
1658620
  function convertEndpoint20({ document: document4, endpoint: endpoint3 }) {
1658147
- const newRequest = new import_yaml10.default.YAMLMap();
1658621
+ const newRequest = new import_yaml11.default.YAMLMap();
1658148
1658622
  const parsedRequestBody = parseRequestBody(endpoint3);
1658149
1658623
  if (parsedRequestBody != null) {
1658150
- let newBody = new import_yaml10.default.YAMLMap();
1658624
+ let newBody = new import_yaml11.default.YAMLMap();
1658151
1658625
  const { requestBodyType, docs: originalRequestDocs } = parsedRequestBody;
1658152
1658626
  if (originalRequestDocs != null) {
1658153
1658627
  newBody.set("docs", originalRequestDocs);
@@ -1658155,11 +1658629,11 @@ function convertEndpoint20({ document: document4, endpoint: endpoint3 }) {
1658155
1658629
  newBody.set("type", requestBodyType);
1658156
1658630
  const documentTypes = document4.get("types");
1658157
1658631
  if (documentTypes != null) {
1658158
- if (!import_yaml10.default.isMap(documentTypes)) {
1658632
+ if (!import_yaml11.default.isMap(documentTypes)) {
1658159
1658633
  throw new Error("types are not a map");
1658160
1658634
  }
1658161
1658635
  const maybeTypeDeclarationForRequest = documentTypes.get(requestBodyType);
1658162
- if (maybeTypeDeclarationForRequest != null && import_yaml10.default.isMap(maybeTypeDeclarationForRequest)) {
1658636
+ if (maybeTypeDeclarationForRequest != null && import_yaml11.default.isMap(maybeTypeDeclarationForRequest)) {
1658163
1658637
  const objectExtends = maybeTypeDeclarationForRequest.get("extends");
1658164
1658638
  const objectProperties = maybeTypeDeclarationForRequest.get("properties");
1658165
1658639
  if (objectExtends != null || objectProperties != null) {
@@ -1658194,7 +1658668,7 @@ function parseRequestBody(endpoint3) {
1658194
1658668
  if (typeof requestBody === "string") {
1658195
1658669
  return { requestBodyType: requestBody, docs: void 0 };
1658196
1658670
  }
1658197
- if (import_yaml10.default.isMap(requestBody)) {
1658671
+ if (import_yaml11.default.isMap(requestBody)) {
1658198
1658672
  const type8 = requestBody.get("type");
1658199
1658673
  if (type8 == null) {
1658200
1658674
  throw new Error("request type does not exist");
@@ -1658219,8 +1658693,8 @@ var versionMigrations10 = {
1658219
1658693
  var __default10 = versionMigrations10;
1658220
1658694
 
1658221
1658695
  // ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
1658222
- var import_promises117 = require("fs/promises");
1658223
- var import_yaml11 = __toESM(require_dist(), 1);
1658696
+ var import_promises118 = require("fs/promises");
1658697
+ var import_yaml12 = __toESM(require_dist(), 1);
1658224
1658698
 
1658225
1658699
  // ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
1658226
1658700
  var FERN_DIRECTORY12 = "fern";
@@ -1658260,24 +1658734,24 @@ var migration11 = {
1658260
1658734
  }
1658261
1658735
  };
1658262
1658736
  async function migrateYamlFile2(filepath, context2) {
1658263
- const contents = await (0, import_promises117.readFile)(filepath);
1658264
- const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
1658737
+ const contents = await (0, import_promises118.readFile)(filepath);
1658738
+ const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
1658265
1658739
  const types4 = parsedDocument.get("types");
1658266
1658740
  if (types4 == null) {
1658267
1658741
  return;
1658268
1658742
  }
1658269
- if (!import_yaml11.default.isMap(types4)) {
1658743
+ if (!import_yaml12.default.isMap(types4)) {
1658270
1658744
  throw new Error("'types' is not a map");
1658271
1658745
  }
1658272
1658746
  for (const type8 of types4.items) {
1658273
- if (!import_yaml11.default.isMap(type8.value)) {
1658747
+ if (!import_yaml12.default.isMap(type8.value)) {
1658274
1658748
  continue;
1658275
1658749
  }
1658276
1658750
  const examples = type8.value.get("examples");
1658277
1658751
  if (examples == null) {
1658278
1658752
  continue;
1658279
1658753
  }
1658280
- if (!import_yaml11.default.isSeq(examples)) {
1658754
+ if (!import_yaml12.default.isSeq(examples)) {
1658281
1658755
  context2.failWithoutThrowing("'examples' are not a list");
1658282
1658756
  continue;
1658283
1658757
  }
@@ -1658286,7 +1658760,7 @@ async function migrateYamlFile2(filepath, context2) {
1658286
1658760
  examples.set(i11, { value });
1658287
1658761
  }
1658288
1658762
  }
1658289
- await (0, import_promises117.writeFile)(filepath, parsedDocument.toString());
1658763
+ await (0, import_promises118.writeFile)(filepath, parsedDocument.toString());
1658290
1658764
  }
1658291
1658765
 
1658292
1658766
  // ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
@@ -1658297,8 +1658771,8 @@ var versionMigrations11 = {
1658297
1658771
  var __default11 = versionMigrations11;
1658298
1658772
 
1658299
1658773
  // ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
1658300
- var import_promises118 = require("fs/promises");
1658301
- var import_yaml12 = __toESM(require_dist(), 1);
1658774
+ var import_promises119 = require("fs/promises");
1658775
+ var import_yaml13 = __toESM(require_dist(), 1);
1658302
1658776
 
1658303
1658777
  // ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
1658304
1658778
  var FERN_DIRECTORY13 = "fern";
@@ -1658338,14 +1658812,14 @@ var migration12 = {
1658338
1658812
  }
1658339
1658813
  };
1658340
1658814
  async function migrateYamlFile3(filepath, context2) {
1658341
- const contents = await (0, import_promises118.readFile)(filepath);
1658342
- const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
1658343
- if (!import_yaml12.default.isMap(parsedDocument.contents)) {
1658815
+ const contents = await (0, import_promises119.readFile)(filepath);
1658816
+ const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
1658817
+ if (!import_yaml13.default.isMap(parsedDocument.contents)) {
1658344
1658818
  return context2.failAndThrow("File is not a map");
1658345
1658819
  }
1658346
1658820
  for (const pair of parsedDocument.contents.items) {
1658347
- if (import_yaml12.default.isScalar(pair.key) && pair.key.value === "services") {
1658348
- if (!import_yaml12.default.isMap(pair.value)) {
1658821
+ if (import_yaml13.default.isScalar(pair.key) && pair.key.value === "services") {
1658822
+ if (!import_yaml13.default.isMap(pair.value)) {
1658349
1658823
  return context2.failAndThrow("Services are not a map");
1658350
1658824
  }
1658351
1658825
  const httpServices = pair.value.get("http");
@@ -1658353,7 +1658827,7 @@ async function migrateYamlFile3(filepath, context2) {
1658353
1658827
  parsedDocument.contents.delete("services");
1658354
1658828
  return;
1658355
1658829
  }
1658356
- if (!import_yaml12.default.isMap(httpServices)) {
1658830
+ if (!import_yaml13.default.isMap(httpServices)) {
1658357
1658831
  return context2.failAndThrow("http is not a map");
1658358
1658832
  }
1658359
1658833
  const [firstService, ...remainingServices] = httpServices.items;
@@ -1658368,7 +1658842,7 @@ async function migrateYamlFile3(filepath, context2) {
1658368
1658842
  pair.value = firstService.value;
1658369
1658843
  }
1658370
1658844
  }
1658371
- await (0, import_promises118.writeFile)(filepath, parsedDocument.toString());
1658845
+ await (0, import_promises119.writeFile)(filepath, parsedDocument.toString());
1658372
1658846
  }
1658373
1658847
 
1658374
1658848
  // ../cli-migrations/lib/migrations/0.3.23/index.js
@@ -1658379,8 +1658853,8 @@ var versionMigrations12 = {
1658379
1658853
  var __default12 = versionMigrations12;
1658380
1658854
 
1658381
1658855
  // ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
1658382
- var import_promises119 = require("fs/promises");
1658383
- var import_yaml13 = __toESM(require_dist(), 1);
1658856
+ var import_promises120 = require("fs/promises");
1658857
+ var import_yaml14 = __toESM(require_dist(), 1);
1658384
1658858
 
1658385
1658859
  // ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
1658386
1658860
  var FERN_DIRECTORY14 = "fern";
@@ -1658420,26 +1658894,26 @@ var migration13 = {
1658420
1658894
  }
1658421
1658895
  };
1658422
1658896
  async function migrateYamlFile4(filepath, context2) {
1658423
- const contents = await (0, import_promises119.readFile)(filepath);
1658424
- const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
1658425
- if (!import_yaml13.default.isMap(parsedDocument.contents)) {
1658897
+ const contents = await (0, import_promises120.readFile)(filepath);
1658898
+ const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
1658899
+ if (!import_yaml14.default.isMap(parsedDocument.contents)) {
1658426
1658900
  return context2.failAndThrow("File is not a map");
1658427
1658901
  }
1658428
1658902
  const service = parsedDocument.contents.get("service");
1658429
1658903
  if (service == null) {
1658430
1658904
  return;
1658431
1658905
  }
1658432
- if (!import_yaml13.default.isMap(service)) {
1658906
+ if (!import_yaml14.default.isMap(service)) {
1658433
1658907
  return context2.failAndThrow("service is not a map");
1658434
1658908
  }
1658435
- const indexOfServiceDocsPair = service.items.findIndex((item) => import_yaml13.default.isScalar(item.key) && item.key.value === "docs");
1658909
+ const indexOfServiceDocsPair = service.items.findIndex((item) => import_yaml14.default.isScalar(item.key) && item.key.value === "docs");
1658436
1658910
  const docsPair = service.items[indexOfServiceDocsPair];
1658437
1658911
  if (docsPair == null) {
1658438
1658912
  return;
1658439
1658913
  }
1658440
1658914
  service.items.splice(indexOfServiceDocsPair, 1);
1658441
1658915
  parsedDocument.contents.items.unshift(docsPair);
1658442
- await (0, import_promises119.writeFile)(filepath, parsedDocument.toString());
1658916
+ await (0, import_promises120.writeFile)(filepath, parsedDocument.toString());
1658443
1658917
  }
1658444
1658918
 
1658445
1658919
  // ../cli-migrations/lib/migrations/0.5.4/index.js
@@ -1658450,7 +1658924,7 @@ var versionMigrations13 = {
1658450
1658924
  var __default13 = versionMigrations13;
1658451
1658925
 
1658452
1658926
  // ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
1658453
- var import_promises120 = require("fs/promises");
1658927
+ var import_promises121 = require("fs/promises");
1658454
1658928
 
1658455
1658929
  // ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
1658456
1658930
  var FERN_DIRECTORY15 = "fern";
@@ -1658490,14 +1658964,14 @@ var migration14 = {
1658490
1658964
  }
1658491
1658965
  };
1658492
1658966
  async function migrateYamlFile5(filepath) {
1658493
- const contents = await (0, import_promises120.readFile)(filepath);
1658967
+ const contents = await (0, import_promises121.readFile)(filepath);
1658494
1658968
  const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
1658495
1658969
  const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
1658496
1658970
  const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
1658497
1658971
  return `docs:
1658498
1658972
  domain: "${domain3}.${domainSuffix}"`;
1658499
1658973
  });
1658500
- await (0, import_promises120.writeFile)(filepath, updatedSnapshot.toString());
1658974
+ await (0, import_promises121.writeFile)(filepath, updatedSnapshot.toString());
1658501
1658975
  }
1658502
1658976
 
1658503
1658977
  // ../cli-migrations/lib/migrations/0.9.10/index.js
@@ -1658513,10 +1658987,10 @@ var import_legacy_docs_config = __toESM(require_legacy_docs_config(), 1);
1658513
1658987
  var LegacyDocsSerializers = __toESM(require_serialization44(), 1);
1658514
1658988
 
1658515
1658989
  // ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
1658516
- var import_promises121 = require("fs/promises");
1658990
+ var import_promises122 = require("fs/promises");
1658517
1658991
  async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
1658518
1658992
  const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
1658519
- const contentsStr = await (0, import_promises121.readFile)(filepath);
1658993
+ const contentsStr = await (0, import_promises122.readFile)(filepath);
1658520
1658994
  const contentsParsed = jsYaml.load(contentsStr.toString());
1658521
1658995
  const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
1658522
1658996
  if (result.ok) {
@@ -1658534,7 +1659008,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
1658534
1659008
  }
1658535
1659009
 
1658536
1659010
  // ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
1658537
- var import_promises123 = require("fs/promises");
1659011
+ var import_promises124 = require("fs/promises");
1658538
1659012
 
1658539
1659013
  // ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
1658540
1659014
  function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
@@ -1658712,10 +1659186,10 @@ __export(legacy_exports, {
1658712
1659186
  });
1658713
1659187
 
1658714
1659188
  // ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
1658715
- var import_promises122 = require("fs/promises");
1659189
+ var import_promises123 = require("fs/promises");
1658716
1659190
  async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
1658717
1659191
  const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
1658718
- const contentsStr = await (0, import_promises122.readFile)(filepath);
1659192
+ const contentsStr = await (0, import_promises123.readFile)(filepath);
1658719
1659193
  const contentsParsed = jsYaml.load(contentsStr.toString());
1658720
1659194
  const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
1658721
1659195
  if (result.success) {
@@ -1658745,7 +1659219,7 @@ function migrateDocsInstances(docsURLs) {
1658745
1659219
  var APIS_DIRECTORY2 = "apis";
1658746
1659220
  async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
1658747
1659221
  const absolutePathToApisDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
1658748
- await (0, import_promises123.mkdir)(absolutePathToApisDirectory);
1659222
+ await (0, import_promises124.mkdir)(absolutePathToApisDirectory);
1658749
1659223
  for (const workspace of workspaces) {
1658750
1659224
  const absolutePathToWorkspace = join2(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
1658751
1659225
  const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
@@ -1658753,11 +1659227,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
1658753
1659227
  await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
1658754
1659228
  const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
1658755
1659229
  await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
1658756
- await (0, import_promises123.rm)(absolutePathToDocsFolder, { recursive: true });
1659230
+ await (0, import_promises124.rm)(absolutePathToDocsFolder, { recursive: true });
1658757
1659231
  }
1658758
1659232
  const absolutePathToNestedWorkspace = join2(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
1658759
1659233
  await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
1658760
- await (0, import_promises123.rm)(absolutePathToWorkspace, { recursive: true });
1659234
+ await (0, import_promises124.rm)(absolutePathToWorkspace, { recursive: true });
1658761
1659235
  }
1658762
1659236
  }
1658763
1659237
  async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
@@ -1658770,7 +1659244,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
1658770
1659244
  generatorsConfiguration,
1658771
1659245
  pathModificationStrategy: PathModificationStrategy.Nest
1658772
1659246
  });
1658773
- await (0, import_promises123.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
1659247
+ await (0, import_promises124.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
1658774
1659248
  return convertedResponse.docsURLs;
1658775
1659249
  }
1658776
1659250
  async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
@@ -1658784,19 +1659258,19 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
1658784
1659258
  apiName
1658785
1659259
  });
1658786
1659260
  const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
1658787
- await (0, import_promises123.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
1659261
+ await (0, import_promises124.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
1658788
1659262
  }
1658789
1659263
 
1658790
1659264
  // ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
1658791
- var import_promises124 = require("fs/promises");
1659265
+ var import_promises125 = require("fs/promises");
1658792
1659266
  async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
1658793
1659267
  const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
1658794
1659268
  await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
1658795
1659269
  const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
1658796
1659270
  await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
1658797
1659271
  await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
1658798
- await (0, import_promises124.rm)(absolutePathToDocsFolder, { recursive: true });
1658799
- await (0, import_promises124.rm)(absolutePathToWorkspace, { recursive: true });
1659272
+ await (0, import_promises125.rm)(absolutePathToDocsFolder, { recursive: true });
1659273
+ await (0, import_promises125.rm)(absolutePathToWorkspace, { recursive: true });
1658800
1659274
  }
1658801
1659275
  async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
1658802
1659276
  const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
@@ -1658809,7 +1659283,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
1658809
1659283
  apiName: void 0
1658810
1659284
  });
1658811
1659285
  const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
1658812
- await (0, import_promises124.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
1659286
+ await (0, import_promises125.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
1658813
1659287
  }
1658814
1659288
  async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
1658815
1659289
  const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
@@ -1658821,22 +1659295,22 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
1658821
1659295
  generatorsConfiguration,
1658822
1659296
  pathModificationStrategy: "MoveUp"
1658823
1659297
  });
1658824
- await (0, import_promises124.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
1659298
+ await (0, import_promises125.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
1658825
1659299
  return convertedResponse.docsURLs;
1658826
1659300
  }
1658827
1659301
 
1658828
1659302
  // ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
1658829
- var import_promises125 = require("fs/promises");
1659303
+ var import_promises126 = require("fs/promises");
1658830
1659304
  var APIS_DIRECTORY3 = "apis";
1658831
1659305
  async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
1658832
1659306
  const absolutePathToApisDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
1658833
- await (0, import_promises125.mkdir)(absolutePathToApisDirectory);
1659307
+ await (0, import_promises126.mkdir)(absolutePathToApisDirectory);
1658834
1659308
  for (const workspace of workspaces) {
1658835
1659309
  const absolutePathToWorkspace = join2(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
1658836
1659310
  await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
1658837
1659311
  const absolutePathToNestedWorkspace = join2(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
1658838
1659312
  await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
1658839
- await (0, import_promises125.rm)(absolutePathToWorkspace, { recursive: true });
1659313
+ await (0, import_promises126.rm)(absolutePathToWorkspace, { recursive: true });
1658840
1659314
  }
1658841
1659315
  }
1658842
1659316
  async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
@@ -1658849,15 +1659323,15 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
1658849
1659323
  generatorsConfiguration,
1658850
1659324
  pathModificationStrategy: PathModificationStrategy.Nest
1658851
1659325
  });
1658852
- await (0, import_promises125.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
1659326
+ await (0, import_promises126.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
1658853
1659327
  }
1658854
1659328
 
1658855
1659329
  // ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
1658856
- var import_promises126 = require("fs/promises");
1659330
+ var import_promises127 = require("fs/promises");
1658857
1659331
  async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
1658858
1659332
  await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
1658859
1659333
  await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
1658860
- await (0, import_promises126.rm)(absolutePathToWorkspace, { recursive: true });
1659334
+ await (0, import_promises127.rm)(absolutePathToWorkspace, { recursive: true });
1658861
1659335
  }
1658862
1659336
  async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
1658863
1659337
  const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
@@ -1658869,7 +1659343,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
1658869
1659343
  generatorsConfiguration,
1658870
1659344
  pathModificationStrategy: "MoveUp"
1658871
1659345
  });
1658872
- await (0, import_promises126.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
1659346
+ await (0, import_promises127.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
1658873
1659347
  }
1658874
1659348
 
1658875
1659349
  // ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
@@ -1658946,8 +1659420,8 @@ var versionMigrations15 = {
1658946
1659420
  var __default15 = versionMigrations15;
1658947
1659421
 
1658948
1659422
  // ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
1658949
- var import_promises127 = require("fs/promises");
1658950
- var import_yaml14 = __toESM(require_dist(), 1);
1659423
+ var import_promises128 = require("fs/promises");
1659424
+ var import_yaml15 = __toESM(require_dist(), 1);
1658951
1659425
  var migration16 = {
1658952
1659426
  name: "require-generators-yml",
1658953
1659427
  summary: "A generators.yml file is now required if you are using OpenAPI, AsyncAPI, or gRPC.",
@@ -1658989,7 +1659463,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
1658989
1659463
  if (existingGeneratorsYml == null) {
1658990
1659464
  if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
1658991
1659465
  const absolutePathToGeneratorsYml = join2(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
1658992
- await (0, import_promises127.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
1659466
+ await (0, import_promises128.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
1658993
1659467
  api: {
1658994
1659468
  path: join2(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
1658995
1659469
  }
@@ -1659000,11 +1659474,11 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
1659000
1659474
  const generatorsYmlContents = jsYaml.load(existingGeneratorsYml.contents);
1659001
1659475
  if (generatorsYmlContents?.api != null) {
1659002
1659476
  } else if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
1659003
- const parsedDocument = import_yaml14.default.parseDocument(existingGeneratorsYml.contents);
1659477
+ const parsedDocument = import_yaml15.default.parseDocument(existingGeneratorsYml.contents);
1659004
1659478
  parsedDocument.set("api", {
1659005
1659479
  path: join2(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
1659006
1659480
  });
1659007
- await (0, import_promises127.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
1659481
+ await (0, import_promises128.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
1659008
1659482
  context2.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
1659009
1659483
  }
1659010
1659484
  }
@@ -1659031,8 +1659505,8 @@ var versionMigrations16 = {
1659031
1659505
  var __default16 = versionMigrations16;
1659032
1659506
 
1659033
1659507
  // ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
1659034
- var import_promises128 = require("fs/promises");
1659035
- var import_yaml15 = __toESM(require_dist(), 1);
1659508
+ var import_promises129 = require("fs/promises");
1659509
+ var import_yaml16 = __toESM(require_dist(), 1);
1659036
1659510
  var migration17 = {
1659037
1659511
  name: "generators-yml-use-api-specs",
1659038
1659512
  summary: "API specification must use the api.specs[] array syntax.",
@@ -1659200,7 +1659674,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
1659200
1659674
  if (firstLine?.startsWith("# yaml-language-server:")) {
1659201
1659675
  schemaComment = firstLine;
1659202
1659676
  }
1659203
- const parsedDocument = import_yaml15.default.parseDocument(generatorsYmlFile.contents);
1659677
+ const parsedDocument = import_yaml16.default.parseDocument(generatorsYmlFile.contents);
1659204
1659678
  parsedDocument.delete("api-settings");
1659205
1659679
  parsedDocument.delete("openapi");
1659206
1659680
  parsedDocument.delete("openapi-overrides");
@@ -1659211,7 +1659685,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
1659211
1659685
  if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
1659212
1659686
  documentToWrite = `${schemaComment}${documentToWrite}`;
1659213
1659687
  }
1659214
- await (0, import_promises128.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1659688
+ await (0, import_promises129.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1659215
1659689
  context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
1659216
1659690
  }
1659217
1659691
  async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context2, namespace }) {
@@ -1659258,7 +1659732,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
1659258
1659732
  }
1659259
1659733
  let specContent;
1659260
1659734
  try {
1659261
- const fileContents = await (0, import_promises128.readFile)(absoluteSpecPath, { encoding: "utf-8" });
1659735
+ const fileContents = await (0, import_promises129.readFile)(absoluteSpecPath, { encoding: "utf-8" });
1659262
1659736
  specContent = jsYaml.load(fileContents);
1659263
1659737
  } catch (e6) {
1659264
1659738
  context2.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e6}. Skipping...`);
@@ -1659361,7 +1659835,7 @@ var versionMigrations17 = {
1659361
1659835
  var __default17 = versionMigrations17;
1659362
1659836
 
1659363
1659837
  // ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
1659364
- var import_promises129 = require("fs/promises");
1659838
+ var import_promises130 = require("fs/promises");
1659365
1659839
  var migration18 = {
1659366
1659840
  name: "add-path-parameter-order-setting",
1659367
1659841
  summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
@@ -1659449,7 +1659923,7 @@ async function updateGeneratorsYml({ context: context2, files }) {
1659449
1659923
  documentToWrite = `${schemaComment}
1659450
1659924
  ${documentToWrite}`;
1659451
1659925
  }
1659452
- await (0, import_promises129.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1659926
+ await (0, import_promises130.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1659453
1659927
  context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
1659454
1659928
  }
1659455
1659929
  async function getFilesAndDirectories3(absoluteFilepath) {
@@ -1659485,7 +1659959,7 @@ var versionMigrations18 = {
1659485
1659959
  var __default18 = versionMigrations18;
1659486
1659960
 
1659487
1659961
  // ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
1659488
- var import_promises130 = require("fs/promises");
1659962
+ var import_promises131 = require("fs/promises");
1659489
1659963
  var migration19 = {
1659490
1659964
  name: "update-1_0_0-defaults",
1659491
1659965
  summary: `The defaults of the API spec settings have changed.
@@ -1659660,7 +1660134,7 @@ async function updateGeneratorsYml2({ context: context2, files }) {
1659660
1660134
  documentToWrite = `${schemaComment}
1659661
1660135
  ${documentToWrite}`;
1659662
1660136
  }
1659663
- await (0, import_promises130.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1660137
+ await (0, import_promises131.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1659664
1660138
  context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
1659665
1660139
  }
1659666
1660140
  async function getFilesAndDirectories4(absoluteFilepath) {
@@ -1659729,7 +1660203,7 @@ var versionMigrations19 = {
1659729
1660203
  var __default19 = versionMigrations19;
1659730
1660204
 
1659731
1660205
  // ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
1659732
- var import_promises131 = require("fs/promises");
1660206
+ var import_promises132 = require("fs/promises");
1659733
1660207
  var migration20 = {
1659734
1660208
  name: "update-2_0_0-defaults",
1659735
1660209
  summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
@@ -1659904,7 +1660378,7 @@ async function updateGeneratorsYml3({ context: context2, files }) {
1659904
1660378
  documentToWrite = `${schemaComment}
1659905
1660379
  ${documentToWrite}`;
1659906
1660380
  }
1659907
- await (0, import_promises131.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1660381
+ await (0, import_promises132.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1659908
1660382
  context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
1659909
1660383
  }
1659910
1660384
  async function getFilesAndDirectories5(absoluteFilepath) {
@@ -1659950,7 +1660424,7 @@ var versionMigrations20 = {
1659950
1660424
  var __default20 = versionMigrations20;
1659951
1660425
 
1659952
1660426
  // ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
1659953
- var import_promises132 = require("fs/promises");
1660427
+ var import_promises133 = require("fs/promises");
1659954
1660428
  var migration21 = {
1659955
1660429
  name: "migrate-deprecated-generator-api-settings",
1659956
1660430
  summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
@@ -1660041,7 +1660515,7 @@ async function updateGeneratorsYml4({ context: context2, files }) {
1660041
1660515
  documentToWrite = `${schemaComment}
1660042
1660516
  ${documentToWrite}`;
1660043
1660517
  }
1660044
- await (0, import_promises132.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1660518
+ await (0, import_promises133.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1660045
1660519
  context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
1660046
1660520
  }
1660047
1660521
  function migrateDeprecatedSettings(settings, context2) {
@@ -1660087,7 +1660561,7 @@ var versionMigrations21 = {
1660087
1660561
  var __default21 = versionMigrations21;
1660088
1660562
 
1660089
1660563
  // ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
1660090
- var import_promises133 = require("fs/promises");
1660564
+ var import_promises134 = require("fs/promises");
1660091
1660565
  var migration22 = {
1660092
1660566
  name: "enable-smart-casing",
1660093
1660567
  summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
@@ -1660171,7 +1660645,7 @@ async function updateGeneratorsYml5({ context: context2, files }) {
1660171
1660645
  documentToWrite = `${schemaComment}
1660172
1660646
  ${documentToWrite}`;
1660173
1660647
  }
1660174
- await (0, import_promises133.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1660648
+ await (0, import_promises134.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
1660175
1660649
  context2.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
1660176
1660650
  }
1660177
1660651
  function setSmartCasingFalseIfNotConfigured(generator, context2) {
@@ -1660312,7 +1660786,7 @@ ${source_default.dim(migration23.summary)}`
1660312
1660786
  }
1660313
1660787
 
1660314
1660788
  // src/commands/upgrade/upgrade.ts
1660315
- var import_promises134 = require("fs/promises");
1660789
+ var import_promises135 = require("fs/promises");
1660316
1660790
 
1660317
1660791
  // src/cwd.ts
1660318
1660792
  var FERN_CWD_ENV_VAR = "FERN_CWD";
@@ -1660629,7 +1661103,7 @@ async function upgrade({
1660629
1661103
  const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
1660630
1661104
  draft.version = resolvedTargetVersion;
1660631
1661105
  });
1660632
- await (0, import_promises134.writeFile)(
1661106
+ await (0, import_promises135.writeFile)(
1660633
1661107
  projectConfig2._absolutePath,
1660634
1661108
  ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
1660635
1661109
  );
@@ -1661054,7 +1661528,7 @@ async function validateWorkspaces({
1661054
1661528
  }
1661055
1661529
 
1661056
1661530
  // src/commands/write-definition/writeDefinitionForWorkspaces.ts
1661057
- var import_promises135 = require("fs/promises");
1661531
+ var import_promises136 = require("fs/promises");
1661058
1661532
  var import_path61 = __toESM(require("path"), 1);
1661059
1661533
  async function writeDefinitionForWorkspaces({
1661060
1661534
  project,
@@ -1661135,27 +1661609,27 @@ async function writeFernDefinition({
1661135
1661609
  return a10.localeCompare(b18);
1661136
1661610
  };
1661137
1661611
  if (await doesPathExist(absolutePathToOutputDirectory)) {
1661138
- await (0, import_promises135.rm)(absolutePathToOutputDirectory, { recursive: true });
1661612
+ await (0, import_promises136.rm)(absolutePathToOutputDirectory, { recursive: true });
1661139
1661613
  }
1661140
- await (0, import_promises135.mkdir)(absolutePathToOutputDirectory, { recursive: true });
1661141
- await (0, import_promises135.writeFile)(
1661614
+ await (0, import_promises136.mkdir)(absolutePathToOutputDirectory, { recursive: true });
1661615
+ await (0, import_promises136.writeFile)(
1661142
1661616
  join2(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
1661143
1661617
  jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
1661144
1661618
  );
1661145
1661619
  for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
1661146
1661620
  const absoluteFilepath = join2(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
1661147
- await (0, import_promises135.mkdir)(dirname4(absoluteFilepath), { recursive: true });
1661148
- await (0, import_promises135.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
1661621
+ await (0, import_promises136.mkdir)(dirname4(absoluteFilepath), { recursive: true });
1661622
+ await (0, import_promises136.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
1661149
1661623
  }
1661150
1661624
  for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
1661151
1661625
  const absoluteFilepath = join2(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
1661152
- await (0, import_promises135.mkdir)(dirname4(absoluteFilepath), { recursive: true });
1661153
- await (0, import_promises135.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
1661626
+ await (0, import_promises136.mkdir)(dirname4(absoluteFilepath), { recursive: true });
1661627
+ await (0, import_promises136.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
1661154
1661628
  }
1661155
1661629
  }
1661156
1661630
 
1661157
1661631
  // src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
1661158
- var import_promises136 = require("fs/promises");
1661632
+ var import_promises137 = require("fs/promises");
1661159
1661633
  async function writeDocsDefinitionForProject({
1661160
1661634
  project,
1661161
1661635
  outputPath,
@@ -1661187,7 +1661661,7 @@ async function writeDocsDefinitionForProject({
1661187
1661661
  targetAudiences: docsWorkspace.config.instances[0]?.audiences ? Array.isArray(docsWorkspace.config.instances[0].audiences) ? docsWorkspace.config.instances[0].audiences : [docsWorkspace.config.instances[0].audiences] : void 0
1661188
1661662
  });
1661189
1661663
  const docsDefinition = await docsResolver.resolve();
1661190
- await (0, import_promises136.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
1661664
+ await (0, import_promises137.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
1661191
1661665
  context2.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
1661192
1661666
  });
1661193
1661667
  }
@@ -1661195,7 +1661669,7 @@ async function writeDocsDefinitionForProject({
1661195
1661669
  // src/commands/write-translation/writeTranslationForProject.ts
1661196
1661670
  var import_cli_progress2 = __toESM(require_cli_progress(), 1);
1661197
1661671
  var import_fs25 = require("fs");
1661198
- var import_promises140 = require("fs/promises");
1661672
+ var import_promises141 = require("fs/promises");
1661199
1661673
  var import_is_ci2 = __toESM(require_is_ci(), 1);
1661200
1661674
  var import_path64 = __toESM(require("path"), 1);
1661201
1661675
 
@@ -1661680,7 +1662154,7 @@ function shouldProcessFile(filePath, stub) {
1661680
1662154
  }
1661681
1662155
 
1661682
1662156
  // src/commands/write-translation/docs-config-utils.ts
1661683
- var import_promises137 = require("fs/promises");
1662157
+ var import_promises138 = require("fs/promises");
1661684
1662158
 
1661685
1662159
  // src/commands/write-translation/url-utils.ts
1661686
1662160
  function addLanguageSuffixToUrl(url3, language) {
@@ -1661837,7 +1662311,7 @@ async function createLanguageSpecificDocsConfig({
1661837
1662311
  stub = false
1661838
1662312
  }) {
1661839
1662313
  try {
1661840
- const originalConfigContent = await (0, import_promises137.readFile)(originalDocsConfigPath, "utf-8");
1662314
+ const originalConfigContent = await (0, import_promises138.readFile)(originalDocsConfigPath, "utf-8");
1661841
1662315
  const transformation = {
1661842
1662316
  filePath: DOCS_CONFIGURATION_FILENAME,
1661843
1662317
  language,
@@ -1661851,7 +1662325,7 @@ async function createLanguageSpecificDocsConfig({
1661851
1662325
  const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
1661852
1662326
  sortKeys: false
1661853
1662327
  });
1661854
- await (0, import_promises137.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
1662328
+ await (0, import_promises138.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
1661855
1662329
  context2.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
1661856
1662330
  } catch (error49) {
1661857
1662331
  if (error49 instanceof Error && error49.message.includes("403")) {
@@ -1661863,11 +1662337,11 @@ async function createLanguageSpecificDocsConfig({
1661863
1662337
 
1661864
1662338
  // src/commands/write-translation/file-collection-utils.ts
1661865
1662339
  var import_fs23 = require("fs");
1661866
- var import_promises138 = require("fs/promises");
1662340
+ var import_promises139 = require("fs/promises");
1661867
1662341
  var import_path62 = __toESM(require("path"), 1);
1661868
1662342
  async function collectFiles(baseDirectory, relativeBase) {
1661869
1662343
  const discoveredFiles = {};
1661870
- const entries10 = await (0, import_promises138.readdir)(baseDirectory);
1662344
+ const entries10 = await (0, import_promises139.readdir)(baseDirectory);
1661871
1662345
  for (const entry of entries10) {
1661872
1662346
  if (entry === "translations") {
1661873
1662347
  continue;
@@ -1661890,7 +1662364,7 @@ async function collectFiles(baseDirectory, relativeBase) {
1661890
1662364
  // src/commands/write-translation/hash-utils.ts
1661891
1662365
  var import_crypto10 = require("crypto");
1661892
1662366
  var import_fs24 = require("fs");
1661893
- var import_promises139 = require("fs/promises");
1662367
+ var import_promises140 = require("fs/promises");
1661894
1662368
  var import_path63 = __toESM(require("path"), 1);
1661895
1662369
  function calculateContentHash(content5) {
1661896
1662370
  return (0, import_crypto10.createHash)("sha256").update(content5, "utf-8").digest("hex");
@@ -1661901,7 +1662375,7 @@ async function loadHashMappings(translationsDirectory) {
1661901
1662375
  return {};
1661902
1662376
  }
1661903
1662377
  try {
1661904
- const hashesContent = await (0, import_promises139.readFile)(hashesFilePath, "utf-8");
1662378
+ const hashesContent = await (0, import_promises140.readFile)(hashesFilePath, "utf-8");
1661905
1662379
  const parsed = JSON.parse(hashesContent);
1661906
1662380
  const { _comment, ...hashMappings } = parsed;
1661907
1662381
  return hashMappings;
@@ -1661922,11 +1662396,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
1661922
1662396
  _comment: "This file is auto-generated by Fern to track source file changes for translation purposes. Do not edit manually - it will be overwritten on the next translation update.",
1661923
1662397
  ...sortedMappings
1661924
1662398
  };
1661925
- await (0, import_promises139.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
1662399
+ await (0, import_promises140.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
1661926
1662400
  }
1661927
1662401
  async function hasFileChanged(filePath, relativePath, previousHashes) {
1661928
1662402
  try {
1661929
- const content5 = await (0, import_promises139.readFile)(filePath, "utf-8");
1662403
+ const content5 = await (0, import_promises140.readFile)(filePath, "utf-8");
1661930
1662404
  const currentHash = calculateContentHash(content5);
1661931
1662405
  const previousHash = previousHashes[relativePath];
1661932
1662406
  return currentHash !== previousHash;
@@ -1661979,7 +1662453,7 @@ async function writeTranslationForProject({
1661979
1662453
  }
1661980
1662454
  if (!(0, import_fs25.existsSync)(translationsDirectory)) {
1661981
1662455
  context2.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
1661982
- await (0, import_promises140.mkdir)(translationsDirectory, { recursive: true });
1662456
+ await (0, import_promises141.mkdir)(translationsDirectory, { recursive: true });
1661983
1662457
  }
1661984
1662458
  const languageStats = {};
1661985
1662459
  const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
@@ -1661992,7 +1662466,7 @@ async function writeTranslationForProject({
1661992
1662466
  RelativeFilePath2.of("fern")
1661993
1662467
  );
1661994
1662468
  if (!(0, import_fs25.existsSync)(languageDirectory)) {
1661995
- await (0, import_promises140.mkdir)(languageDirectory, { recursive: true });
1662469
+ await (0, import_promises141.mkdir)(languageDirectory, { recursive: true });
1661996
1662470
  }
1661997
1662471
  languageStats[language] = {
1661998
1662472
  filesProcessed: 0,
@@ -1662094,7 +1662568,7 @@ async function writeTranslationForProject({
1662094
1662568
  `[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
1662095
1662569
  );
1662096
1662570
  }
1662097
- const originalConfigContent = await (0, import_promises140.readFile)(originalDocsConfigPath, "utf-8");
1662571
+ const originalConfigContent = await (0, import_promises141.readFile)(originalDocsConfigPath, "utf-8");
1662098
1662572
  await updateAndSaveHashForFile(
1662099
1662573
  translationsDirectory,
1662100
1662574
  hashMappings,
@@ -1662139,7 +1662613,7 @@ async function writeTranslationForProject({
1662139
1662613
  continue;
1662140
1662614
  }
1662141
1662615
  cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
1662142
- const originalContent = await (0, import_promises140.readFile)(filePath, "utf-8");
1662616
+ const originalContent = await (0, import_promises141.readFile)(filePath, "utf-8");
1662143
1662617
  await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
1662144
1662618
  const sourceStats = languageStats[sourceLanguage];
1662145
1662619
  if (sourceStats) {
@@ -1662164,7 +1662638,7 @@ async function writeTranslationForProject({
1662164
1662638
  const destPath = join2(languageDirectory, relativePath);
1662165
1662639
  const destDir = import_path64.default.dirname(destPath);
1662166
1662640
  if (!(0, import_fs25.existsSync)(destDir)) {
1662167
- await (0, import_promises140.mkdir)(destDir, { recursive: true });
1662641
+ await (0, import_promises141.mkdir)(destDir, { recursive: true });
1662168
1662642
  }
1662169
1662643
  const transformation = {
1662170
1662644
  filePath: relativePath,
@@ -1662177,7 +1662651,7 @@ async function writeTranslationForProject({
1662177
1662651
  cliContext,
1662178
1662652
  stub
1662179
1662653
  });
1662180
- await (0, import_promises140.writeFile)(destPath, transformedContent, "utf-8");
1662654
+ await (0, import_promises141.writeFile)(destPath, transformedContent, "utf-8");
1662181
1662655
  const languageStatsForLang = languageStats[language];
1662182
1662656
  if (languageStatsForLang) {
1662183
1662657
  languageStatsForLang.filesProcessed++;
@@ -1662208,9 +1662682,9 @@ async function writeTranslationForProject({
1662208
1662682
  const destPath = join2(languageDirectory, relativePath);
1662209
1662683
  const destDir = import_path64.default.dirname(destPath);
1662210
1662684
  if (!(0, import_fs25.existsSync)(destDir)) {
1662211
- await (0, import_promises140.mkdir)(destDir, { recursive: true });
1662685
+ await (0, import_promises141.mkdir)(destDir, { recursive: true });
1662212
1662686
  }
1662213
- await (0, import_promises140.copyFile)(filePath, destPath);
1662687
+ await (0, import_promises141.copyFile)(filePath, destPath);
1662214
1662688
  assetsCopied++;
1662215
1662689
  cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
1662216
1662690
  }