@fern-api/fern-api-dev 4.50.3 → 4.50.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.
- package/cli.cjs +576 -594
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -48657,8 +48657,8 @@ var require_graceful_fs = __commonJS({
|
|
|
48657
48657
|
fs28.createReadStream = createReadStream5;
|
|
48658
48658
|
fs28.createWriteStream = createWriteStream7;
|
|
48659
48659
|
var fs$readFile = fs28.readFile;
|
|
48660
|
-
fs28.readFile =
|
|
48661
|
-
function
|
|
48660
|
+
fs28.readFile = readFile102;
|
|
48661
|
+
function readFile102(path97, options2, cb2) {
|
|
48662
48662
|
if (typeof options2 === "function")
|
|
48663
48663
|
cb2 = options2, options2 = null;
|
|
48664
48664
|
return go$readFile(path97, options2, cb2);
|
|
@@ -307062,8 +307062,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
307062
307062
|
fs28.createReadStream = createReadStream5;
|
|
307063
307063
|
fs28.createWriteStream = createWriteStream7;
|
|
307064
307064
|
var fs$readFile = fs28.readFile;
|
|
307065
|
-
fs28.readFile =
|
|
307066
|
-
function
|
|
307065
|
+
fs28.readFile = readFile102;
|
|
307066
|
+
function readFile102(path97, options2, cb2) {
|
|
307067
307067
|
if (typeof options2 === "function")
|
|
307068
307068
|
cb2 = options2, options2 = null;
|
|
307069
307069
|
return go$readFile(path97, options2, cb2);
|
|
@@ -363995,7 +363995,7 @@ var require_dist11 = __commonJS({
|
|
|
363995
363995
|
conflicts: conflicts2
|
|
363996
363996
|
};
|
|
363997
363997
|
}
|
|
363998
|
-
var
|
|
363998
|
+
var import_promises181 = require("fs/promises");
|
|
363999
363999
|
var import_node_os15 = require("os");
|
|
364000
364000
|
var import_node_path210 = require("path");
|
|
364001
364001
|
var import_minimatch8 = require_commonjs3();
|
|
@@ -364087,7 +364087,7 @@ var require_dist11 = __commonJS({
|
|
|
364087
364087
|
/** Populate accumulator after git apply succeeds. */
|
|
364088
364088
|
async populateAccumulatorForPatch(patch5, baseGen, currentTreeHash) {
|
|
364089
364089
|
if (!baseGen) return;
|
|
364090
|
-
const tempDir2 = await (0,
|
|
364090
|
+
const tempDir2 = await (0, import_promises181.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-acc-"));
|
|
364091
364091
|
const { GitClient: GitClient22 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
364092
364092
|
const tempGit = new GitClient22(tempDir2);
|
|
364093
364093
|
await tempGit.exec(["init"]);
|
|
@@ -364107,7 +364107,7 @@ var require_dist11 = __commonJS({
|
|
|
364107
364107
|
}
|
|
364108
364108
|
}
|
|
364109
364109
|
} finally {
|
|
364110
|
-
await (0,
|
|
364110
|
+
await (0, import_promises181.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
364111
364111
|
});
|
|
364112
364112
|
}
|
|
364113
364113
|
}
|
|
@@ -364132,7 +364132,7 @@ var require_dist11 = __commonJS({
|
|
|
364132
364132
|
resolvedFiles[filePath] = resolvedPath;
|
|
364133
364133
|
}
|
|
364134
364134
|
const fullPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
364135
|
-
snapshots.set(resolvedPath, await (0,
|
|
364135
|
+
snapshots.set(resolvedPath, await (0, import_promises181.readFile)(fullPath, "utf-8").catch(() => null));
|
|
364136
364136
|
}
|
|
364137
364137
|
try {
|
|
364138
364138
|
await this.git.execWithInput(["apply", "--3way"], patch5.patch_content);
|
|
@@ -364146,7 +364146,7 @@ var require_dist11 = __commonJS({
|
|
|
364146
364146
|
} catch {
|
|
364147
364147
|
for (const [resolvedPath, content5] of snapshots) {
|
|
364148
364148
|
if (content5 != null) {
|
|
364149
|
-
await (0,
|
|
364149
|
+
await (0, import_promises181.writeFile)((0, import_node_path210.join)(this.outputDir, resolvedPath), content5);
|
|
364150
364150
|
}
|
|
364151
364151
|
}
|
|
364152
364152
|
}
|
|
@@ -364156,7 +364156,7 @@ var require_dist11 = __commonJS({
|
|
|
364156
364156
|
async applyWithThreeWayMerge(patch5) {
|
|
364157
364157
|
const fileResults = [];
|
|
364158
364158
|
const resolvedFiles = {};
|
|
364159
|
-
const tempDir2 = await (0,
|
|
364159
|
+
const tempDir2 = await (0, import_promises181.mkdtemp)((0, import_node_path210.join)((0, import_node_os15.tmpdir)(), "replay-"));
|
|
364160
364160
|
const { GitClient: GitClient22 } = await Promise.resolve().then(() => (init_GitClient(), GitClient_exports));
|
|
364161
364161
|
const tempGit = new GitClient22(tempDir2);
|
|
364162
364162
|
await tempGit.exec(["init"]);
|
|
@@ -364179,7 +364179,7 @@ var require_dist11 = __commonJS({
|
|
|
364179
364179
|
fileResults.push(result);
|
|
364180
364180
|
}
|
|
364181
364181
|
} finally {
|
|
364182
|
-
await (0,
|
|
364182
|
+
await (0, import_promises181.rm)(tempDir2, { recursive: true }).catch(() => {
|
|
364183
364183
|
});
|
|
364184
364184
|
}
|
|
364185
364185
|
const conflictFiles = fileResults.filter((r23) => r23.status === "conflict");
|
|
@@ -364220,7 +364220,7 @@ var require_dist11 = __commonJS({
|
|
|
364220
364220
|
}
|
|
364221
364221
|
}
|
|
364222
364222
|
const oursPath = (0, import_node_path210.join)(this.outputDir, resolvedPath);
|
|
364223
|
-
const ours = await (0,
|
|
364223
|
+
const ours = await (0, import_promises181.readFile)(oursPath, "utf-8").catch(() => null);
|
|
364224
364224
|
let theirs = await this.applyPatchToContent(
|
|
364225
364225
|
base4,
|
|
364226
364226
|
patch5.patch_content,
|
|
@@ -364263,15 +364263,15 @@ var require_dist11 = __commonJS({
|
|
|
364263
364263
|
}
|
|
364264
364264
|
if (!base4 && !ours && effective_theirs) {
|
|
364265
364265
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
364266
|
-
await (0,
|
|
364267
|
-
await (0,
|
|
364266
|
+
await (0, import_promises181.mkdir)(outDir2, { recursive: true });
|
|
364267
|
+
await (0, import_promises181.writeFile)(oursPath, effective_theirs);
|
|
364268
364268
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
364269
364269
|
}
|
|
364270
364270
|
if (!base4 && ours && effective_theirs) {
|
|
364271
364271
|
const merged2 = threeWayMerge("", ours, effective_theirs);
|
|
364272
364272
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
364273
|
-
await (0,
|
|
364274
|
-
await (0,
|
|
364273
|
+
await (0, import_promises181.mkdir)(outDir2, { recursive: true });
|
|
364274
|
+
await (0, import_promises181.writeFile)(oursPath, merged2.content);
|
|
364275
364275
|
if (merged2.hasConflicts) {
|
|
364276
364276
|
return {
|
|
364277
364277
|
file: resolvedPath,
|
|
@@ -364300,8 +364300,8 @@ var require_dist11 = __commonJS({
|
|
|
364300
364300
|
const mergeBase = useAccumulatorAsMergeBase && accumulatorEntry ? accumulatorEntry.content : base4;
|
|
364301
364301
|
const merged = threeWayMerge(mergeBase, ours, effective_theirs);
|
|
364302
364302
|
const outDir = (0, import_node_path210.dirname)(oursPath);
|
|
364303
|
-
await (0,
|
|
364304
|
-
await (0,
|
|
364303
|
+
await (0, import_promises181.mkdir)(outDir, { recursive: true });
|
|
364304
|
+
await (0, import_promises181.writeFile)(oursPath, merged.content);
|
|
364305
364305
|
if (effective_theirs && base4) {
|
|
364306
364306
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
364307
364307
|
content: effective_theirs,
|
|
@@ -364368,8 +364368,8 @@ var require_dist11 = __commonJS({
|
|
|
364368
364368
|
try {
|
|
364369
364369
|
if (sourceFilePath) {
|
|
364370
364370
|
const tempSourcePath = (0, import_node_path210.join)(tempDir2, sourceFilePath);
|
|
364371
|
-
await (0,
|
|
364372
|
-
await (0,
|
|
364371
|
+
await (0, import_promises181.mkdir)((0, import_node_path210.dirname)(tempSourcePath), { recursive: true });
|
|
364372
|
+
await (0, import_promises181.writeFile)(tempSourcePath, base4);
|
|
364373
364373
|
await tempGit.exec(["add", sourceFilePath]);
|
|
364374
364374
|
await tempGit.exec([
|
|
364375
364375
|
"commit",
|
|
@@ -364379,15 +364379,15 @@ var require_dist11 = __commonJS({
|
|
|
364379
364379
|
]);
|
|
364380
364380
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
364381
364381
|
const tempTargetPath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
364382
|
-
return await (0,
|
|
364382
|
+
return await (0, import_promises181.readFile)(tempTargetPath, "utf-8");
|
|
364383
364383
|
}
|
|
364384
364384
|
const tempFilePath = (0, import_node_path210.join)(tempDir2, filePath);
|
|
364385
|
-
await (0,
|
|
364386
|
-
await (0,
|
|
364385
|
+
await (0, import_promises181.mkdir)((0, import_node_path210.dirname)(tempFilePath), { recursive: true });
|
|
364386
|
+
await (0, import_promises181.writeFile)(tempFilePath, base4);
|
|
364387
364387
|
await tempGit.exec(["add", filePath]);
|
|
364388
364388
|
await tempGit.exec(["commit", "-m", `base for ${filePath}`, "--allow-empty"]);
|
|
364389
364389
|
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
364390
|
-
return await (0,
|
|
364390
|
+
return await (0, import_promises181.readFile)(tempFilePath, "utf-8");
|
|
364391
364391
|
} catch {
|
|
364392
364392
|
return null;
|
|
364393
364393
|
}
|
|
@@ -367404,7 +367404,7 @@ var require_jsonfile = __commonJS({
|
|
|
367404
367404
|
}
|
|
367405
367405
|
return obj;
|
|
367406
367406
|
}
|
|
367407
|
-
var
|
|
367407
|
+
var readFile102 = universalify.fromPromise(_readFile);
|
|
367408
367408
|
function readFileSync19(file4, options2 = {}) {
|
|
367409
367409
|
if (typeof options2 === "string") {
|
|
367410
367410
|
options2 = { encoding: options2 };
|
|
@@ -367436,7 +367436,7 @@ var require_jsonfile = __commonJS({
|
|
|
367436
367436
|
return fs27.writeFileSync(file4, str3, options2);
|
|
367437
367437
|
}
|
|
367438
367438
|
module4.exports = {
|
|
367439
|
-
readFile:
|
|
367439
|
+
readFile: readFile102,
|
|
367440
367440
|
readFileSync: readFileSync19,
|
|
367441
367441
|
writeFile: writeFile89,
|
|
367442
367442
|
writeFileSync: writeFileSync7
|
|
@@ -430422,7 +430422,7 @@ async function unpackArchive(archivePath, folderPath) {
|
|
|
430422
430422
|
} else if (archivePath.endsWith(".tar.bz2")) {
|
|
430423
430423
|
await extractTar(archivePath, folderPath, "bzip2");
|
|
430424
430424
|
} else if (archivePath.endsWith(".dmg")) {
|
|
430425
|
-
await (0,
|
|
430425
|
+
await (0, import_promises118.mkdir)(folderPath);
|
|
430426
430426
|
await installDMG(archivePath, folderPath);
|
|
430427
430427
|
} else if (archivePath.endsWith(".exe")) {
|
|
430428
430428
|
const result = (0, import_node_child_process4.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
|
|
@@ -430511,7 +430511,7 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
430511
430511
|
}
|
|
430512
430512
|
const mountPath = volumes[0];
|
|
430513
430513
|
try {
|
|
430514
|
-
const fileNames = await (0,
|
|
430514
|
+
const fileNames = await (0, import_promises118.readdir)(mountPath);
|
|
430515
430515
|
const appName = fileNames.find((item) => {
|
|
430516
430516
|
return typeof item === "string" && item.endsWith(".app");
|
|
430517
430517
|
});
|
|
@@ -430524,13 +430524,13 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
430524
430524
|
(0, import_node_child_process4.spawnSync)("hdiutil", ["detach", mountPath, "-quiet"]);
|
|
430525
430525
|
}
|
|
430526
430526
|
}
|
|
430527
|
-
var import_node_child_process4, import_node_fs24,
|
|
430527
|
+
var import_node_child_process4, import_node_fs24, import_promises118, path79, import_node_stream6, import_debug8, debugFileUtil, internalConstantsForTesting;
|
|
430528
430528
|
var init_fileUtil = __esm({
|
|
430529
430529
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js"() {
|
|
430530
430530
|
"use strict";
|
|
430531
430531
|
import_node_child_process4 = require("child_process");
|
|
430532
430532
|
import_node_fs24 = require("fs");
|
|
430533
|
-
|
|
430533
|
+
import_promises118 = require("fs/promises");
|
|
430534
430534
|
path79 = __toESM(require("path"), 1);
|
|
430535
430535
|
import_node_stream6 = require("stream");
|
|
430536
430536
|
import_debug8 = __toESM(require_src(), 1);
|
|
@@ -430593,7 +430593,7 @@ async function installWithProviders(options2) {
|
|
|
430593
430593
|
}
|
|
430594
430594
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url3}`);
|
|
430595
430595
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
430596
|
-
await (0,
|
|
430596
|
+
await (0, import_promises119.mkdir)(browserRoot, { recursive: true });
|
|
430597
430597
|
}
|
|
430598
430598
|
return await installUrl(url3, options2, provider);
|
|
430599
430599
|
} catch (err) {
|
|
@@ -430666,7 +430666,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
430666
430666
|
const browserRoot = cache3.browserRoot(options2.browser);
|
|
430667
430667
|
const archivePath = import_node_path33.default.join(browserRoot, `${options2.buildId}-${fileName}`);
|
|
430668
430668
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
430669
|
-
await (0,
|
|
430669
|
+
await (0, import_promises119.mkdir)(browserRoot, { recursive: true });
|
|
430670
430670
|
}
|
|
430671
430671
|
if (!options2.unpack) {
|
|
430672
430672
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
@@ -430730,7 +430730,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
430730
430730
|
return installedBrowser;
|
|
430731
430731
|
} finally {
|
|
430732
430732
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
430733
|
-
await (0,
|
|
430733
|
+
await (0, import_promises119.unlink)(archivePath);
|
|
430734
430734
|
}
|
|
430735
430735
|
}
|
|
430736
430736
|
}
|
|
@@ -430810,14 +430810,14 @@ function toMegabytes(bytes) {
|
|
|
430810
430810
|
const mb2 = bytes / 1e3 / 1e3;
|
|
430811
430811
|
return `${Math.round(mb2 * 10) / 10} MB`;
|
|
430812
430812
|
}
|
|
430813
|
-
var import_node_assert3, import_node_child_process5, import_node_fs25,
|
|
430813
|
+
var import_node_assert3, import_node_child_process5, import_node_fs25, import_promises119, import_node_os9, import_node_path33, import_progress, debugInstall, times;
|
|
430814
430814
|
var init_install = __esm({
|
|
430815
430815
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/install.js"() {
|
|
430816
430816
|
"use strict";
|
|
430817
430817
|
import_node_assert3 = __toESM(require("assert"), 1);
|
|
430818
430818
|
import_node_child_process5 = require("child_process");
|
|
430819
430819
|
import_node_fs25 = require("fs");
|
|
430820
|
-
|
|
430820
|
+
import_promises119 = require("fs/promises");
|
|
430821
430821
|
import_node_os9 = __toESM(require("os"), 1);
|
|
430822
430822
|
import_node_path33 = __toESM(require("path"), 1);
|
|
430823
430823
|
import_progress = __toESM(require_progress(), 1);
|
|
@@ -580500,7 +580500,7 @@ async function applyOverlays({ absoluteFilePathToOverlay, absoluteFilePathToOpen
|
|
|
580500
580500
|
const outputFileName = `${import_path31.default.parse(originalFileName).name}.overlaid.json`;
|
|
580501
580501
|
const outputPath = import_path31.default.join(dir, outputFileName);
|
|
580502
580502
|
await (0, import_promises26.writeFile)(outputPath, JSON.stringify(result, null, 2), "utf8");
|
|
580503
|
-
context3.logger.
|
|
580503
|
+
context3.logger.debug(`Wrote overlaid OpenAPI spec to: ${outputPath}`);
|
|
580504
580504
|
return result;
|
|
580505
580505
|
}
|
|
580506
580506
|
async function parseOverlayFile(absoluteFilePathToOverlay, context3) {
|
|
@@ -593565,12 +593565,14 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
593565
593565
|
}
|
|
593566
593566
|
};
|
|
593567
593567
|
|
|
593568
|
+
// ../workspace/oss-validator/lib/validateOSSWorkspace.js
|
|
593569
|
+
var import_promises38 = require("fs/promises");
|
|
593570
|
+
|
|
593568
593571
|
// ../workspace/oss-validator/lib/rules/no-component-schema-collisions/no-component-schema-collisions.js
|
|
593569
593572
|
init_lib6();
|
|
593570
|
-
var import_promises38 = require("fs/promises");
|
|
593571
593573
|
var NoComponentSchemaCollisionsRule = {
|
|
593572
593574
|
name: "no-component-schema-collisions",
|
|
593573
|
-
run: async ({ workspace, specs,
|
|
593575
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593574
593576
|
const violations = [];
|
|
593575
593577
|
const openapiSpecs = specs.filter((spec) => spec.type === "openapi");
|
|
593576
593578
|
if (openapiSpecs.length < 2) {
|
|
@@ -593582,19 +593584,11 @@ var NoComponentSchemaCollisionsRule = {
|
|
|
593582
593584
|
}
|
|
593583
593585
|
const schemaIdRegistry = /* @__PURE__ */ new Map();
|
|
593584
593586
|
for (const spec of openapiSpecs) {
|
|
593585
|
-
const
|
|
593586
|
-
|
|
593587
|
-
const isOpenAPI = contents.includes("openapi") || contents.includes("swagger");
|
|
593588
|
-
if (!isOpenAPI && !isAsyncAPI) {
|
|
593587
|
+
const document4 = loadedDocuments.get(spec.absoluteFilepath);
|
|
593588
|
+
if (document4 == null) {
|
|
593589
593589
|
continue;
|
|
593590
593590
|
}
|
|
593591
593591
|
const relativeFilepath = relative3(workspace.absoluteFilePath, spec.source.file);
|
|
593592
|
-
const document4 = await loadOpenAPI({
|
|
593593
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593594
|
-
context: context3,
|
|
593595
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593596
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593597
|
-
});
|
|
593598
593592
|
const apiToValidate = isOpenAPIV2(document4) ? await convertOpenAPIV2ToV3(document4) : document4;
|
|
593599
593593
|
const schemas = apiToValidate.components?.schemas ?? {};
|
|
593600
593594
|
for (const schemaId of Object.keys(schemas)) {
|
|
@@ -593618,25 +593612,18 @@ var NoComponentSchemaCollisionsRule = {
|
|
|
593618
593612
|
|
|
593619
593613
|
// ../workspace/oss-validator/lib/rules/no-duplicate-auth-header-parameters/no-duplicate-auth-header-parameters.js
|
|
593620
593614
|
init_lib6();
|
|
593621
|
-
var import_promises39 = require("fs/promises");
|
|
593622
593615
|
var NoDuplicateAuthHeaderParametersRule = {
|
|
593623
593616
|
name: "no-duplicate-auth-header-parameters",
|
|
593624
|
-
run: async ({ workspace, specs,
|
|
593617
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593625
593618
|
const violations = [];
|
|
593626
593619
|
for (const spec of specs) {
|
|
593627
593620
|
if (spec.type !== "openapi") {
|
|
593628
593621
|
continue;
|
|
593629
593622
|
}
|
|
593630
|
-
const
|
|
593631
|
-
if (
|
|
593623
|
+
const openAPI = loadedDocuments.get(spec.absoluteFilepath);
|
|
593624
|
+
if (openAPI == null) {
|
|
593632
593625
|
continue;
|
|
593633
593626
|
}
|
|
593634
|
-
const openAPI = await loadOpenAPI({
|
|
593635
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593636
|
-
context: context3,
|
|
593637
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593638
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593639
|
-
});
|
|
593640
593627
|
const apiToValidate = isOpenAPIV2(openAPI) ? await convertOpenAPIV2ToV3(openAPI) : openAPI;
|
|
593641
593628
|
const authHeaderNames = getAuthHeaderNames(apiToValidate);
|
|
593642
593629
|
if (authHeaderNames.size === 0) {
|
|
@@ -593745,21 +593732,14 @@ function isDuplicateAuthHeader(param, authHeaderNames) {
|
|
|
593745
593732
|
|
|
593746
593733
|
// ../workspace/oss-validator/lib/rules/no-duplicate-overrides/no-duplicate-overrides.js
|
|
593747
593734
|
init_lib6();
|
|
593748
|
-
var import_promises40 = require("fs/promises");
|
|
593749
593735
|
var NoDuplicateOverridesRule = {
|
|
593750
593736
|
name: "no-duplicate-overrides",
|
|
593751
|
-
run: async ({ workspace, specs,
|
|
593737
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593752
593738
|
const violations = [];
|
|
593753
593739
|
const seenMethodsByAudience = /* @__PURE__ */ new Map();
|
|
593754
593740
|
for (const spec of specs) {
|
|
593755
|
-
const
|
|
593756
|
-
if (
|
|
593757
|
-
const openAPI = await loadOpenAPI({
|
|
593758
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593759
|
-
context: context3,
|
|
593760
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593761
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593762
|
-
});
|
|
593741
|
+
const openAPI = loadedDocuments.get(spec.absoluteFilepath);
|
|
593742
|
+
if (openAPI != null) {
|
|
593763
593743
|
const apiToValidate = isOpenAPIV2(openAPI) ? await convertOpenAPIV2ToV3(openAPI) : openAPI;
|
|
593764
593744
|
for (const [path97, pathItem] of Object.entries(apiToValidate.paths ?? {})) {
|
|
593765
593745
|
for (const [method8, operation] of Object.entries(pathItem ?? {})) {
|
|
@@ -593808,28 +593788,21 @@ function audiencesIntersect(a10, b19) {
|
|
|
593808
593788
|
|
|
593809
593789
|
// ../workspace/oss-validator/lib/rules/no-invalid-tag-names-or-frontmatter/no-invalid-tag-names-or-frontmatter.js
|
|
593810
593790
|
init_lib6();
|
|
593811
|
-
var import_promises41 = require("fs/promises");
|
|
593812
593791
|
var NON_ASCII_REGEX3 = new RegExp("[^\\x00-\\x7F]");
|
|
593813
593792
|
var FRONTMATTER_REGEX = /(?:^|\n)\s*---\s*(?:\n|$)/;
|
|
593814
593793
|
var HTTP_METHODS = ["get", "post", "put", "delete", "patch", "options", "head", "trace"];
|
|
593815
593794
|
var NoInvalidTagNamesOrFrontmatterRule = {
|
|
593816
593795
|
name: "no-invalid-tag-names-or-frontmatter",
|
|
593817
|
-
run: async ({ workspace, specs,
|
|
593796
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593818
593797
|
const violations = [];
|
|
593819
593798
|
for (const spec of specs) {
|
|
593820
593799
|
if (spec.type !== "openapi") {
|
|
593821
593800
|
continue;
|
|
593822
593801
|
}
|
|
593823
|
-
const
|
|
593824
|
-
if (
|
|
593802
|
+
const openAPI = loadedDocuments.get(spec.absoluteFilepath);
|
|
593803
|
+
if (openAPI == null) {
|
|
593825
593804
|
continue;
|
|
593826
593805
|
}
|
|
593827
|
-
const openAPI = await loadOpenAPI({
|
|
593828
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593829
|
-
context: context3,
|
|
593830
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593831
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593832
|
-
});
|
|
593833
593806
|
const apiToValidate = isOpenAPIV2(openAPI) ? await convertOpenAPIV2ToV3(openAPI) : openAPI;
|
|
593834
593807
|
const relativeFilepath = relative3(workspace.absoluteFilePath, spec.source.file);
|
|
593835
593808
|
const apiDoc = apiToValidate;
|
|
@@ -593896,10 +593869,9 @@ var NoInvalidTagNamesOrFrontmatterRule = {
|
|
|
593896
593869
|
|
|
593897
593870
|
// ../workspace/oss-validator/lib/rules/no-schema-title-collisions/no-schema-title-collisions.js
|
|
593898
593871
|
init_lib6();
|
|
593899
|
-
var import_promises42 = require("fs/promises");
|
|
593900
593872
|
var NoSchemaTitleCollisionsRule = {
|
|
593901
593873
|
name: "no-schema-title-collisions",
|
|
593902
|
-
run: async ({ workspace, specs,
|
|
593874
|
+
run: async ({ workspace, specs, loadedDocuments }) => {
|
|
593903
593875
|
const violations = [];
|
|
593904
593876
|
const titleRegistry = /* @__PURE__ */ new Map();
|
|
593905
593877
|
for (const spec of specs) {
|
|
@@ -593910,19 +593882,11 @@ var NoSchemaTitleCollisionsRule = {
|
|
|
593910
593882
|
if (settings?.useTitlesAsName !== true || settings?.resolveSchemaCollisions === true) {
|
|
593911
593883
|
continue;
|
|
593912
593884
|
}
|
|
593913
|
-
const
|
|
593914
|
-
|
|
593915
|
-
const isOpenAPI = contents.includes("openapi") || contents.includes("swagger");
|
|
593916
|
-
if (!isOpenAPI && !isAsyncAPI) {
|
|
593885
|
+
const document4 = loadedDocuments.get(spec.absoluteFilepath);
|
|
593886
|
+
if (document4 == null) {
|
|
593917
593887
|
continue;
|
|
593918
593888
|
}
|
|
593919
593889
|
const relativeFilepath = relative3(workspace.absoluteFilePath, spec.source.file);
|
|
593920
|
-
const document4 = await loadOpenAPI({
|
|
593921
|
-
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593922
|
-
context: context3,
|
|
593923
|
-
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593924
|
-
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593925
|
-
});
|
|
593926
593890
|
const apiToValidate = isOpenAPIV2(document4) ? await convertOpenAPIV2ToV3(document4) : document4;
|
|
593927
593891
|
const schemas = apiToValidate.components?.schemas ?? {};
|
|
593928
593892
|
for (const [schemaId, schema2] of Object.entries(schemas)) {
|
|
@@ -593966,10 +593930,28 @@ function getAllRules2() {
|
|
|
593966
593930
|
async function validateOSSWorkspace(workspace, context3) {
|
|
593967
593931
|
return await runRulesOnOSSWorkspace({ workspace, context: context3, rules: getAllRules2() });
|
|
593968
593932
|
}
|
|
593933
|
+
async function preloadOpenAPIDocuments({ specs, context: context3 }) {
|
|
593934
|
+
const loadedDocuments = /* @__PURE__ */ new Map();
|
|
593935
|
+
for (const spec of specs) {
|
|
593936
|
+
const contents = (await (0, import_promises38.readFile)(spec.absoluteFilepath)).toString();
|
|
593937
|
+
if (!contents.includes("openapi") && !contents.includes("swagger")) {
|
|
593938
|
+
continue;
|
|
593939
|
+
}
|
|
593940
|
+
const document4 = await loadOpenAPI({
|
|
593941
|
+
absolutePathToOpenAPI: spec.absoluteFilepath,
|
|
593942
|
+
context: context3,
|
|
593943
|
+
absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides,
|
|
593944
|
+
absolutePathToOpenAPIOverlays: spec.absoluteFilepathToOverlays
|
|
593945
|
+
});
|
|
593946
|
+
loadedDocuments.set(spec.absoluteFilepath, document4);
|
|
593947
|
+
}
|
|
593948
|
+
return loadedDocuments;
|
|
593949
|
+
}
|
|
593969
593950
|
async function runRulesOnOSSWorkspace({ workspace, context: context3, rules }) {
|
|
593970
593951
|
const openApiSpecs = await workspace.getOpenAPISpecsCached({ context: context3 });
|
|
593952
|
+
const loadedDocuments = await preloadOpenAPIDocuments({ specs: openApiSpecs, context: context3 });
|
|
593971
593953
|
const ruleResults = await Promise.all(rules.map(async (rule) => {
|
|
593972
|
-
const violations = await rule.run({ workspace, specs: openApiSpecs, context: context3 });
|
|
593954
|
+
const violations = await rule.run({ workspace, specs: openApiSpecs, context: context3, loadedDocuments });
|
|
593973
593955
|
return violations.map((violation) => ({ ...violation, name: violation.name ?? rule.name }));
|
|
593974
593956
|
}));
|
|
593975
593957
|
return ruleResults.flat();
|
|
@@ -594959,7 +594941,7 @@ function getPathToTokenFile() {
|
|
|
594959
594941
|
|
|
594960
594942
|
// ../auth/lib/persistence/getToken.js
|
|
594961
594943
|
init_lib6();
|
|
594962
|
-
var
|
|
594944
|
+
var import_promises39 = require("fs/promises");
|
|
594963
594945
|
var FERN_TOKEN_ENV_VAR = "FERN_TOKEN";
|
|
594964
594946
|
async function getToken2() {
|
|
594965
594947
|
return await getAccessToken() ?? await getUserToken();
|
|
@@ -594980,7 +594962,7 @@ async function getUserToken() {
|
|
|
594980
594962
|
if (!doesTokenFileExist) {
|
|
594981
594963
|
return void 0;
|
|
594982
594964
|
}
|
|
594983
|
-
const tokenFileContents = await (0,
|
|
594965
|
+
const tokenFileContents = await (0, import_promises39.readFile)(pathToTokenFile);
|
|
594984
594966
|
const tokenString = tokenFileContents.toString().trim();
|
|
594985
594967
|
if (tokenString.length === 0) {
|
|
594986
594968
|
return void 0;
|
|
@@ -594992,11 +594974,11 @@ async function getUserToken() {
|
|
|
594992
594974
|
}
|
|
594993
594975
|
|
|
594994
594976
|
// ../auth/lib/persistence/removeToken.js
|
|
594995
|
-
var
|
|
594977
|
+
var import_promises40 = require("fs/promises");
|
|
594996
594978
|
async function removeToken() {
|
|
594997
594979
|
const pathToTokenFile = getPathToTokenFile();
|
|
594998
594980
|
try {
|
|
594999
|
-
await (0,
|
|
594981
|
+
await (0, import_promises40.unlink)(pathToTokenFile);
|
|
595000
594982
|
} catch (error50) {
|
|
595001
594983
|
if (error50.code !== "ENOENT") {
|
|
595002
594984
|
throw error50;
|
|
@@ -595005,12 +594987,12 @@ async function removeToken() {
|
|
|
595005
594987
|
}
|
|
595006
594988
|
|
|
595007
594989
|
// ../auth/lib/persistence/storeToken.js
|
|
595008
|
-
var
|
|
594990
|
+
var import_promises41 = require("fs/promises");
|
|
595009
594991
|
var import_path39 = __toESM(require("path"), 1);
|
|
595010
594992
|
async function storeToken(token) {
|
|
595011
594993
|
const pathToTokenFile = getPathToTokenFile();
|
|
595012
|
-
await (0,
|
|
595013
|
-
await (0,
|
|
594994
|
+
await (0, import_promises41.mkdir)(import_path39.default.dirname(pathToTokenFile), { recursive: true });
|
|
594995
|
+
await (0, import_promises41.writeFile)(pathToTokenFile, token);
|
|
595014
594996
|
}
|
|
595015
594997
|
|
|
595016
594998
|
// ../auth/lib/users/getCurrentUser.js
|
|
@@ -602302,7 +602284,7 @@ var AccessTokenPosthogManager = class {
|
|
|
602302
602284
|
properties: {
|
|
602303
602285
|
...event,
|
|
602304
602286
|
...event.properties,
|
|
602305
|
-
version: "4.50.
|
|
602287
|
+
version: "4.50.4",
|
|
602306
602288
|
usingAccessToken: true
|
|
602307
602289
|
}
|
|
602308
602290
|
});
|
|
@@ -602325,7 +602307,7 @@ var NoopPosthogManager = class {
|
|
|
602325
602307
|
|
|
602326
602308
|
// ../posthog-manager/lib/UserPosthogManager.js
|
|
602327
602309
|
init_lib6();
|
|
602328
|
-
var
|
|
602310
|
+
var import_promises42 = require("fs/promises");
|
|
602329
602311
|
var import_os5 = require("os");
|
|
602330
602312
|
var import_path41 = require("path");
|
|
602331
602313
|
var DISTINCT_ID_FILENAME = "id";
|
|
@@ -602353,7 +602335,7 @@ var UserPosthogManager = class {
|
|
|
602353
602335
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
602354
602336
|
event: "CLI",
|
|
602355
602337
|
properties: {
|
|
602356
|
-
version: "4.50.
|
|
602338
|
+
version: "4.50.4",
|
|
602357
602339
|
...event,
|
|
602358
602340
|
...event.properties,
|
|
602359
602341
|
usingAccessToken: false,
|
|
@@ -602392,10 +602374,10 @@ var UserPosthogManager = class {
|
|
|
602392
602374
|
if (this.persistedDistinctId == null) {
|
|
602393
602375
|
const pathToFile = join2(AbsoluteFilePath2.of((0, import_os5.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER3), RelativeFilePath2.of(DISTINCT_ID_FILENAME));
|
|
602394
602376
|
if (!await doesPathExist(pathToFile)) {
|
|
602395
|
-
await (0,
|
|
602396
|
-
await (0,
|
|
602377
|
+
await (0, import_promises42.mkdir)((0, import_path41.dirname)(pathToFile), { recursive: true });
|
|
602378
|
+
await (0, import_promises42.writeFile)(pathToFile, v4_default());
|
|
602397
602379
|
}
|
|
602398
|
-
this.persistedDistinctId = (await (0,
|
|
602380
|
+
this.persistedDistinctId = (await (0, import_promises42.readFile)(pathToFile)).toString();
|
|
602399
602381
|
}
|
|
602400
602382
|
return this.persistedDistinctId;
|
|
602401
602383
|
}
|
|
@@ -603927,7 +603909,7 @@ var FernRcAccountManager = class {
|
|
|
603927
603909
|
// ../cli-v2/lib/config/fern-rc/FernRcSchemaLoader.js
|
|
603928
603910
|
init_lib6();
|
|
603929
603911
|
var import_fs18 = require("fs");
|
|
603930
|
-
var
|
|
603912
|
+
var import_promises43 = require("fs/promises");
|
|
603931
603913
|
var import_os6 = require("os");
|
|
603932
603914
|
var FILENAME = ".fernrc";
|
|
603933
603915
|
var FernRcSchemaLoader = class {
|
|
@@ -603945,7 +603927,7 @@ var FernRcSchemaLoader = class {
|
|
|
603945
603927
|
absoluteFilePath: this.absoluteFilePath
|
|
603946
603928
|
};
|
|
603947
603929
|
}
|
|
603948
|
-
const contents = await (0,
|
|
603930
|
+
const contents = await (0, import_promises43.readFile)(this.absoluteFilePath, "utf-8");
|
|
603949
603931
|
if (contents.trim().length === 0) {
|
|
603950
603932
|
return {
|
|
603951
603933
|
data: createEmptyFernRcSchema(),
|
|
@@ -604037,7 +604019,7 @@ var FernRcSchemaLoader = class {
|
|
|
604037
604019
|
lineWidth: 120,
|
|
604038
604020
|
noRefs: true
|
|
604039
604021
|
});
|
|
604040
|
-
await (0,
|
|
604022
|
+
await (0, import_promises43.writeFile)(this.absoluteFilePath, yamlContent, "utf-8");
|
|
604041
604023
|
}
|
|
604042
604024
|
};
|
|
604043
604025
|
|
|
@@ -604071,7 +604053,7 @@ var FernRcTelemetryManager = class {
|
|
|
604071
604053
|
|
|
604072
604054
|
// ../cli-v2/lib/config/fern-rc/LegacyTokenMigrator.js
|
|
604073
604055
|
init_lib6();
|
|
604074
|
-
var
|
|
604056
|
+
var import_promises44 = require("fs/promises");
|
|
604075
604057
|
var DEFAULT_USER = "default";
|
|
604076
604058
|
var LegacyTokenMigrator = class {
|
|
604077
604059
|
loader;
|
|
@@ -604090,7 +604072,7 @@ var LegacyTokenMigrator = class {
|
|
|
604090
604072
|
if (config5.auth.accounts.length > 0) {
|
|
604091
604073
|
return { migrated: false };
|
|
604092
604074
|
}
|
|
604093
|
-
const tokenContent = (await (0,
|
|
604075
|
+
const tokenContent = (await (0, import_promises44.readFile)(legacyPath, "utf-8")).trim();
|
|
604094
604076
|
if (tokenContent.length === 0) {
|
|
604095
604077
|
return { migrated: false };
|
|
604096
604078
|
}
|
|
@@ -604334,7 +604316,7 @@ var import_os7 = __toESM(require("os"), 1);
|
|
|
604334
604316
|
// ../cli-v2/lib/cache/ir/IrCache.js
|
|
604335
604317
|
init_lib6();
|
|
604336
604318
|
var import_crypto7 = __toESM(require("crypto"), 1);
|
|
604337
|
-
var
|
|
604319
|
+
var import_promises45 = __toESM(require("fs/promises"), 1);
|
|
604338
604320
|
var IrCache = class {
|
|
604339
604321
|
/** Absolute file path to the IR cache directory (e.g. ~/.cache/fern/v1/ir) */
|
|
604340
604322
|
absoluteFilePath;
|
|
@@ -604364,7 +604346,7 @@ var IrCache = class {
|
|
|
604364
604346
|
async lookup({ hash: hash5, irVersion }) {
|
|
604365
604347
|
const entryPath = this.getEntryPath({ irVersion, hash: hash5 });
|
|
604366
604348
|
try {
|
|
604367
|
-
const stats = await
|
|
604349
|
+
const stats = await import_promises45.default.stat(entryPath);
|
|
604368
604350
|
if (!stats.isFile()) {
|
|
604369
604351
|
return void 0;
|
|
604370
604352
|
}
|
|
@@ -604385,7 +604367,7 @@ var IrCache = class {
|
|
|
604385
604367
|
* Read the content of a cached IR entry.
|
|
604386
604368
|
*/
|
|
604387
604369
|
async read(entry) {
|
|
604388
|
-
return await
|
|
604370
|
+
return await import_promises45.default.readFile(entry.absoluteFilePath, "utf-8");
|
|
604389
604371
|
}
|
|
604390
604372
|
/**
|
|
604391
604373
|
* Store IR content in the cache with an atomic write.
|
|
@@ -604397,19 +604379,19 @@ var IrCache = class {
|
|
|
604397
604379
|
const entryPath = this.getEntryPath({ irVersion, hash: hash5 });
|
|
604398
604380
|
const entryDir = dirname4(entryPath);
|
|
604399
604381
|
const tempFile = join2(this.tempPath, RelativeFilePath2.of(`${import_crypto7.default.randomUUID()}.json`));
|
|
604400
|
-
await
|
|
604401
|
-
await
|
|
604382
|
+
await import_promises45.default.mkdir(entryDir, { recursive: true });
|
|
604383
|
+
await import_promises45.default.mkdir(this.tempPath, { recursive: true });
|
|
604402
604384
|
try {
|
|
604403
604385
|
await streamObjectToFile(tempFile, content5, { pretty: true });
|
|
604404
|
-
await
|
|
604386
|
+
await import_promises45.default.rename(tempFile, entryPath);
|
|
604405
604387
|
} catch (error50) {
|
|
604406
604388
|
try {
|
|
604407
|
-
await
|
|
604389
|
+
await import_promises45.default.unlink(tempFile);
|
|
604408
604390
|
} catch {
|
|
604409
604391
|
}
|
|
604410
604392
|
throw error50;
|
|
604411
604393
|
}
|
|
604412
|
-
const stats = await
|
|
604394
|
+
const stats = await import_promises45.default.stat(entryPath);
|
|
604413
604395
|
return {
|
|
604414
604396
|
hash: hash5,
|
|
604415
604397
|
irVersion,
|
|
@@ -604462,7 +604444,7 @@ var IrCache = class {
|
|
|
604462
604444
|
*/
|
|
604463
604445
|
async listVersionDirectories() {
|
|
604464
604446
|
try {
|
|
604465
|
-
const entries21 = await
|
|
604447
|
+
const entries21 = await import_promises45.default.readdir(this.absoluteFilePath, { withFileTypes: true });
|
|
604466
604448
|
return entries21.filter((e6) => e6.isDirectory()).map((e6) => e6.name);
|
|
604467
604449
|
} catch {
|
|
604468
604450
|
return [];
|
|
@@ -604476,7 +604458,7 @@ var IrCache = class {
|
|
|
604476
604458
|
let totalSize = 0;
|
|
604477
604459
|
const walk4 = async (dir) => {
|
|
604478
604460
|
try {
|
|
604479
|
-
const entries21 = await
|
|
604461
|
+
const entries21 = await import_promises45.default.readdir(dir, { withFileTypes: true });
|
|
604480
604462
|
for (const entry of entries21) {
|
|
604481
604463
|
const fullPath = `${dir}/${entry.name}`;
|
|
604482
604464
|
if (entry.isDirectory()) {
|
|
@@ -604486,7 +604468,7 @@ var IrCache = class {
|
|
|
604486
604468
|
if (entry.isFile() && entry.name.endsWith(".json")) {
|
|
604487
604469
|
entryCount++;
|
|
604488
604470
|
try {
|
|
604489
|
-
const stats = await
|
|
604471
|
+
const stats = await import_promises45.default.stat(fullPath);
|
|
604490
604472
|
totalSize += stats.size;
|
|
604491
604473
|
} catch {
|
|
604492
604474
|
}
|
|
@@ -604509,14 +604491,14 @@ var IrCache = class {
|
|
|
604509
604491
|
let freedSize = 0;
|
|
604510
604492
|
const walk4 = async (dir) => {
|
|
604511
604493
|
try {
|
|
604512
|
-
const entries21 = await
|
|
604494
|
+
const entries21 = await import_promises45.default.readdir(dir, { withFileTypes: true });
|
|
604513
604495
|
for (const entry of entries21) {
|
|
604514
604496
|
const fullPath = `${dir}/${entry.name}`;
|
|
604515
604497
|
if (entry.isDirectory()) {
|
|
604516
604498
|
await walk4(fullPath);
|
|
604517
604499
|
if (!dryRun) {
|
|
604518
604500
|
try {
|
|
604519
|
-
await
|
|
604501
|
+
await import_promises45.default.rmdir(fullPath);
|
|
604520
604502
|
} catch {
|
|
604521
604503
|
}
|
|
604522
604504
|
}
|
|
@@ -604524,11 +604506,11 @@ var IrCache = class {
|
|
|
604524
604506
|
}
|
|
604525
604507
|
if (entry.isFile() && entry.name.endsWith(".json")) {
|
|
604526
604508
|
try {
|
|
604527
|
-
const stats = await
|
|
604509
|
+
const stats = await import_promises45.default.stat(fullPath);
|
|
604528
604510
|
deletedCount++;
|
|
604529
604511
|
freedSize += stats.size;
|
|
604530
604512
|
if (!dryRun) {
|
|
604531
|
-
await
|
|
604513
|
+
await import_promises45.default.unlink(fullPath);
|
|
604532
604514
|
}
|
|
604533
604515
|
} catch {
|
|
604534
604516
|
}
|
|
@@ -604540,7 +604522,7 @@ var IrCache = class {
|
|
|
604540
604522
|
await walk4(dirPath);
|
|
604541
604523
|
if (!dryRun) {
|
|
604542
604524
|
try {
|
|
604543
|
-
await
|
|
604525
|
+
await import_promises45.default.rmdir(dirPath);
|
|
604544
604526
|
} catch {
|
|
604545
604527
|
}
|
|
604546
604528
|
}
|
|
@@ -604549,7 +604531,7 @@ var IrCache = class {
|
|
|
604549
604531
|
};
|
|
604550
604532
|
|
|
604551
604533
|
// ../cli-v2/lib/cache/logs/LogsCache.js
|
|
604552
|
-
var
|
|
604534
|
+
var import_promises46 = __toESM(require("fs/promises"), 1);
|
|
604553
604535
|
var LogsCache = class {
|
|
604554
604536
|
/** Absolute file path to the log cache directory (e.g. ~/.cache/fern/v1/logs) */
|
|
604555
604537
|
absoluteFilePath;
|
|
@@ -604563,12 +604545,12 @@ var LogsCache = class {
|
|
|
604563
604545
|
let fileCount = 0;
|
|
604564
604546
|
let totalSize = 0;
|
|
604565
604547
|
try {
|
|
604566
|
-
const entries21 = await
|
|
604548
|
+
const entries21 = await import_promises46.default.readdir(this.absoluteFilePath, { withFileTypes: true });
|
|
604567
604549
|
for (const entry of entries21) {
|
|
604568
604550
|
if (entry.isFile() && entry.name.endsWith(".log")) {
|
|
604569
604551
|
fileCount++;
|
|
604570
604552
|
try {
|
|
604571
|
-
const stats = await
|
|
604553
|
+
const stats = await import_promises46.default.stat(`${this.absoluteFilePath}/${entry.name}`);
|
|
604572
604554
|
totalSize += stats.size;
|
|
604573
604555
|
} catch {
|
|
604574
604556
|
}
|
|
@@ -604585,16 +604567,16 @@ var LogsCache = class {
|
|
|
604585
604567
|
let deletedCount = 0;
|
|
604586
604568
|
let freedSize = 0;
|
|
604587
604569
|
try {
|
|
604588
|
-
const entries21 = await
|
|
604570
|
+
const entries21 = await import_promises46.default.readdir(this.absoluteFilePath, { withFileTypes: true });
|
|
604589
604571
|
for (const entry of entries21) {
|
|
604590
604572
|
if (entry.isFile() && entry.name.endsWith(".log")) {
|
|
604591
604573
|
const fullPath = `${this.absoluteFilePath}/${entry.name}`;
|
|
604592
604574
|
try {
|
|
604593
|
-
const stats = await
|
|
604575
|
+
const stats = await import_promises46.default.stat(fullPath);
|
|
604594
604576
|
deletedCount++;
|
|
604595
604577
|
freedSize += stats.size;
|
|
604596
604578
|
if (!dryRun) {
|
|
604597
|
-
await
|
|
604579
|
+
await import_promises46.default.unlink(fullPath);
|
|
604598
604580
|
}
|
|
604599
604581
|
} catch {
|
|
604600
604582
|
}
|
|
@@ -604938,7 +604920,7 @@ var SourceLocation = class _SourceLocation {
|
|
|
604938
604920
|
};
|
|
604939
604921
|
|
|
604940
604922
|
// ../yaml/loader/lib/ReferenceResolver.js
|
|
604941
|
-
var
|
|
604923
|
+
var import_promises47 = require("fs/promises");
|
|
604942
604924
|
var import_yaml2 = __toESM(require_dist8(), 1);
|
|
604943
604925
|
|
|
604944
604926
|
// ../yaml/loader/lib/ValidationIssue.js
|
|
@@ -605243,7 +605225,7 @@ var ReferenceResolver = class {
|
|
|
605243
605225
|
}));
|
|
605244
605226
|
return void 0;
|
|
605245
605227
|
}
|
|
605246
|
-
const content5 = await (0,
|
|
605228
|
+
const content5 = await (0, import_promises47.readFile)(referencedFilePath, "utf-8");
|
|
605247
605229
|
const parsedDocument = (0, import_yaml2.parseDocument)(content5);
|
|
605248
605230
|
if (parsedDocument.errors.length > 0) {
|
|
605249
605231
|
const errorMessages = parsedDocument.errors.map((e6) => e6.message).join("; ");
|
|
@@ -605394,7 +605376,7 @@ function deepStrictImpl(schema2, cache3) {
|
|
|
605394
605376
|
|
|
605395
605377
|
// ../yaml/loader/lib/YamlParser.js
|
|
605396
605378
|
init_lib5();
|
|
605397
|
-
var
|
|
605379
|
+
var import_promises48 = require("fs/promises");
|
|
605398
605380
|
var import_yaml3 = __toESM(require_dist8(), 1);
|
|
605399
605381
|
var YamlParser = class {
|
|
605400
605382
|
/**
|
|
@@ -605405,7 +605387,7 @@ var YamlParser = class {
|
|
|
605405
605387
|
* @throws Error if the file cannot be read or contains invalid YAML.
|
|
605406
605388
|
*/
|
|
605407
605389
|
async parse(absoluteFilePath) {
|
|
605408
|
-
const source2 = await (0,
|
|
605390
|
+
const source2 = await (0, import_promises48.readFile)(absoluteFilePath, "utf-8");
|
|
605409
605391
|
return (0, import_yaml3.parse)(source2);
|
|
605410
605392
|
}
|
|
605411
605393
|
/**
|
|
@@ -605419,7 +605401,7 @@ var YamlParser = class {
|
|
|
605419
605401
|
* @throws Error if the file cannot be read or contains invalid YAML.
|
|
605420
605402
|
*/
|
|
605421
605403
|
async parseDocument({ absoluteFilePath, cwd: cwd2 }) {
|
|
605422
|
-
const source2 = await (0,
|
|
605404
|
+
const source2 = await (0, import_promises48.readFile)(absoluteFilePath, "utf-8");
|
|
605423
605405
|
const document4 = (0, import_yaml3.parseDocument)(source2);
|
|
605424
605406
|
const relativeFilePath = RelativeFilePath.of(relative2(cwd2, absoluteFilePath));
|
|
605425
605407
|
return new YamlDocument({
|
|
@@ -626266,7 +626248,7 @@ function _init2(options2 = {}, getDefaultIntegrationsImpl) {
|
|
|
626266
626248
|
}
|
|
626267
626249
|
|
|
626268
626250
|
// ../cli-v2/lib/telemetry/TelemetryClient.js
|
|
626269
|
-
var
|
|
626251
|
+
var import_promises49 = require("fs/promises");
|
|
626270
626252
|
var import_is_ci2 = __toESM(require_is_ci(), 1);
|
|
626271
626253
|
var os13 = __toESM(require("os"), 1);
|
|
626272
626254
|
var import_os8 = require("os");
|
|
@@ -626386,14 +626368,14 @@ var TelemetryClient = class {
|
|
|
626386
626368
|
const distinctIdFilepath = this.getDistinctIdFilepath();
|
|
626387
626369
|
try {
|
|
626388
626370
|
if (!await doesPathExist(distinctIdFilepath)) {
|
|
626389
|
-
await (0,
|
|
626390
|
-
await (0,
|
|
626371
|
+
await (0, import_promises49.mkdir)((0, import_path46.dirname)(distinctIdFilepath), { recursive: true });
|
|
626372
|
+
await (0, import_promises49.writeFile)(distinctIdFilepath, v4_default(), { flag: "wx" });
|
|
626391
626373
|
}
|
|
626392
|
-
const content5 = (await (0,
|
|
626374
|
+
const content5 = (await (0, import_promises49.readFile)(distinctIdFilepath)).toString().trim();
|
|
626393
626375
|
this.cachedDistinctId = content5;
|
|
626394
626376
|
if (!validate_default(content5)) {
|
|
626395
626377
|
const newId = v4_default();
|
|
626396
|
-
await (0,
|
|
626378
|
+
await (0, import_promises49.writeFile)(distinctIdFilepath, newId);
|
|
626397
626379
|
this.cachedDistinctId = newId;
|
|
626398
626380
|
}
|
|
626399
626381
|
} catch {
|
|
@@ -741334,7 +741316,7 @@ function addCompileCommand(cli) {
|
|
|
741334
741316
|
|
|
741335
741317
|
// ../cli-v2/lib/commands/api/merge/command.js
|
|
741336
741318
|
init_lib4();
|
|
741337
|
-
var
|
|
741319
|
+
var import_promises52 = require("fs/promises");
|
|
741338
741320
|
var import_path48 = __toESM(require("path"), 1);
|
|
741339
741321
|
|
|
741340
741322
|
// ../cli-v2/lib/config/fern-yml/constants.js
|
|
@@ -741343,7 +741325,7 @@ var REF_KEY2 = "$ref";
|
|
|
741343
741325
|
|
|
741344
741326
|
// ../cli-v2/lib/config/fern-yml/FernYmlEditor.js
|
|
741345
741327
|
init_lib6();
|
|
741346
|
-
var
|
|
741328
|
+
var import_promises50 = require("fs/promises");
|
|
741347
741329
|
var import_path47 = __toESM(require("path"), 1);
|
|
741348
741330
|
var import_yaml4 = __toESM(require_dist8(), 1);
|
|
741349
741331
|
var FernYmlEditor = class _FernYmlEditor {
|
|
@@ -741366,7 +741348,7 @@ var FernYmlEditor = class _FernYmlEditor {
|
|
|
741366
741348
|
* Sections (`sdks`, `api`) are resolved lazily on first method call.
|
|
741367
741349
|
*/
|
|
741368
741350
|
static async load(config5) {
|
|
741369
|
-
const content5 = await (0,
|
|
741351
|
+
const content5 = await (0, import_promises50.readFile)(config5.fernYmlPath, "utf-8");
|
|
741370
741352
|
const document4 = (0, import_yaml4.parseDocument)(content5);
|
|
741371
741353
|
const doc = document4.toJS();
|
|
741372
741354
|
if (doc == null || typeof doc !== "object") {
|
|
@@ -741547,7 +741529,7 @@ var FernYmlEditor = class _FernYmlEditor {
|
|
|
741547
741529
|
for (const section of this.sections.values()) {
|
|
741548
741530
|
if (this.dirtyFiles.has(section.filePath) && !written.has(section.filePath)) {
|
|
741549
741531
|
written.add(section.filePath);
|
|
741550
|
-
writes.push((0,
|
|
741532
|
+
writes.push((0, import_promises50.writeFile)(section.filePath, section.document.toString(), "utf-8"));
|
|
741551
741533
|
}
|
|
741552
741534
|
}
|
|
741553
741535
|
await Promise.all(writes);
|
|
@@ -741576,7 +741558,7 @@ var FernYmlEditor = class _FernYmlEditor {
|
|
|
741576
741558
|
message: `Referenced file '${refPath}' in ${FERN_YML_FILENAME} does not exist.`
|
|
741577
741559
|
});
|
|
741578
741560
|
}
|
|
741579
|
-
const refContent = await (0,
|
|
741561
|
+
const refContent = await (0, import_promises50.readFile)(resolvedPath, "utf-8");
|
|
741580
741562
|
const refDocument = (0, import_yaml4.parseDocument)(refContent);
|
|
741581
741563
|
const section2 = {
|
|
741582
741564
|
document: refDocument,
|
|
@@ -741921,11 +741903,11 @@ function isEnoentError(error50) {
|
|
|
741921
741903
|
}
|
|
741922
741904
|
|
|
741923
741905
|
// ../cli-v2/lib/commands/api/utils/loadSpec.js
|
|
741924
|
-
var
|
|
741906
|
+
var import_promises51 = require("fs/promises");
|
|
741925
741907
|
async function loadSpec(filepath) {
|
|
741926
741908
|
let contents;
|
|
741927
741909
|
try {
|
|
741928
|
-
contents = await (0,
|
|
741910
|
+
contents = await (0, import_promises51.readFile)(filepath, "utf8");
|
|
741929
741911
|
} catch (error50) {
|
|
741930
741912
|
if (isEnoentError(error50)) {
|
|
741931
741913
|
throw new CliError({ message: `File does not exist: ${filepath}` });
|
|
@@ -741999,7 +741981,7 @@ var MergeCommand = class {
|
|
|
741999
741981
|
}
|
|
742000
741982
|
context3.stderr.info(`${Icons.success} Merged ${source_default.bold(String(overridePaths.length))} override(s) ${source_default.dim("\u2192")} ${source_default.cyan(entry.specFilePath)}`);
|
|
742001
741983
|
}
|
|
742002
|
-
await (0,
|
|
741984
|
+
await (0, import_promises52.writeFile)(entry.specFilePath, serializeSpec(merged, entry.specFilePath));
|
|
742003
741985
|
mergedCount++;
|
|
742004
741986
|
if (editor != null) {
|
|
742005
741987
|
if (overridePaths != null) {
|
|
@@ -742039,7 +742021,7 @@ var MergeCommand = class {
|
|
|
742039
742021
|
async cleanupFiles(context3, filePaths) {
|
|
742040
742022
|
await Promise.all(filePaths.map(async (filePath) => {
|
|
742041
742023
|
try {
|
|
742042
|
-
await (0,
|
|
742024
|
+
await (0, import_promises52.unlink)(filePath);
|
|
742043
742025
|
context3.stderr.info(source_default.dim(`Deleted ${filePath}`));
|
|
742044
742026
|
} catch (error50) {
|
|
742045
742027
|
if (!isEnoentError(error50)) {
|
|
@@ -742064,7 +742046,7 @@ function addMergeCommand(cli) {
|
|
|
742064
742046
|
// ../cli-v2/lib/commands/api/split/command.js
|
|
742065
742047
|
init_lib4();
|
|
742066
742048
|
var import_child_process5 = require("child_process");
|
|
742067
|
-
var
|
|
742049
|
+
var import_promises53 = require("fs/promises");
|
|
742068
742050
|
var import_path49 = __toESM(require("path"), 1);
|
|
742069
742051
|
var import_util17 = require("util");
|
|
742070
742052
|
|
|
@@ -742139,7 +742121,7 @@ var SplitCommand = class {
|
|
|
742139
742121
|
} else {
|
|
742140
742122
|
await this.splitAsOverrides(context3, editor, entry, originalContent, currentContent, args.output);
|
|
742141
742123
|
}
|
|
742142
|
-
await (0,
|
|
742124
|
+
await (0, import_promises53.writeFile)(entry.specFilePath, originalRaw);
|
|
742143
742125
|
context3.stderr.debug(source_default.dim(`Restored ${entry.specFilePath} to git HEAD`));
|
|
742144
742126
|
splitCount++;
|
|
742145
742127
|
}
|
|
@@ -742163,7 +742145,7 @@ var SplitCommand = class {
|
|
|
742163
742145
|
if (await this.tryMergeOverlayIntoExistingFile(outputPath, overlay.actions)) {
|
|
742164
742146
|
context3.stderr.info(`${Icons.success} Merged ${source_default.bold(String(overlay.actions.length))} action(s) into existing ${source_default.cyan(outputPath)}`);
|
|
742165
742147
|
} else {
|
|
742166
|
-
await (0,
|
|
742148
|
+
await (0, import_promises53.writeFile)(outputPath, serializeSpec(overlay, outputPath));
|
|
742167
742149
|
context3.stderr.info(`${Icons.success} Overlay written (${source_default.bold(String(overlay.actions.length))} action(s)) ${source_default.dim("\u2192")} ${source_default.cyan(outputPath)}`);
|
|
742168
742150
|
}
|
|
742169
742151
|
const edit = await editor.addOverlay(entry.specFilePath, outputPath);
|
|
@@ -742178,7 +742160,7 @@ var SplitCommand = class {
|
|
|
742178
742160
|
if (await this.tryMergeIntoExistingFile(outputPath, overrides)) {
|
|
742179
742161
|
context3.stderr.info(`${Icons.success} Merged diff into existing ${source_default.cyan(outputPath)}`);
|
|
742180
742162
|
} else {
|
|
742181
|
-
await (0,
|
|
742163
|
+
await (0, import_promises53.writeFile)(outputPath, serializeSpec(overrides, outputPath));
|
|
742182
742164
|
context3.stderr.info(`${Icons.success} Overrides written ${source_default.dim("\u2192")} ${source_default.cyan(outputPath)}`);
|
|
742183
742165
|
}
|
|
742184
742166
|
const edit = await editor.addOverride(entry.specFilePath, outputPath);
|
|
@@ -742194,7 +742176,7 @@ var SplitCommand = class {
|
|
|
742194
742176
|
async tryMergeOverlayIntoExistingFile(outputPath, newActions) {
|
|
742195
742177
|
let raw;
|
|
742196
742178
|
try {
|
|
742197
|
-
raw = await (0,
|
|
742179
|
+
raw = await (0, import_promises53.readFile)(outputPath, "utf8");
|
|
742198
742180
|
} catch (error50) {
|
|
742199
742181
|
if (isEnoentError(error50)) {
|
|
742200
742182
|
return false;
|
|
@@ -742204,7 +742186,7 @@ var SplitCommand = class {
|
|
|
742204
742186
|
const existing = parseSpec(raw, outputPath);
|
|
742205
742187
|
const existingActions = Array.isArray(existing.actions) ? existing.actions : [];
|
|
742206
742188
|
existing.actions = [...existingActions, ...newActions];
|
|
742207
|
-
await (0,
|
|
742189
|
+
await (0, import_promises53.writeFile)(outputPath, serializeSpec(existing, outputPath));
|
|
742208
742190
|
return true;
|
|
742209
742191
|
}
|
|
742210
742192
|
/**
|
|
@@ -742214,7 +742196,7 @@ var SplitCommand = class {
|
|
|
742214
742196
|
async tryMergeIntoExistingFile(outputPath, overrides) {
|
|
742215
742197
|
let raw;
|
|
742216
742198
|
try {
|
|
742217
|
-
raw = await (0,
|
|
742199
|
+
raw = await (0, import_promises53.readFile)(outputPath, "utf8");
|
|
742218
742200
|
} catch (error50) {
|
|
742219
742201
|
if (isEnoentError(error50)) {
|
|
742220
742202
|
return false;
|
|
@@ -742223,7 +742205,7 @@ var SplitCommand = class {
|
|
|
742223
742205
|
}
|
|
742224
742206
|
const existing = parseSpec(raw, outputPath);
|
|
742225
742207
|
const merged = mergeWithOverrides({ data: existing, overrides });
|
|
742226
|
-
await (0,
|
|
742208
|
+
await (0, import_promises53.writeFile)(outputPath, serializeSpec(merged, outputPath));
|
|
742227
742209
|
return true;
|
|
742228
742210
|
}
|
|
742229
742211
|
async getFileFromGitHead(repoRoot, absolutePath) {
|
|
@@ -777585,9 +777567,9 @@ function replaceFrontmatterImagesforLogo(data2, mapImage) {
|
|
|
777585
777567
|
|
|
777586
777568
|
// ../docs-markdown-utils/lib/replaceReferencedCode.js
|
|
777587
777569
|
init_lib6();
|
|
777588
|
-
var
|
|
777570
|
+
var import_promises54 = require("fs/promises");
|
|
777589
777571
|
async function defaultFileLoader(filepath) {
|
|
777590
|
-
const file4 = await (0,
|
|
777572
|
+
const file4 = await (0, import_promises54.readFile)(filepath);
|
|
777591
777573
|
return file4.toString();
|
|
777592
777574
|
}
|
|
777593
777575
|
function isUrl(src) {
|
|
@@ -777755,10 +777737,10 @@ ${replacement}
|
|
|
777755
777737
|
|
|
777756
777738
|
// ../docs-markdown-utils/lib/replaceReferencedMarkdown.js
|
|
777757
777739
|
init_lib6();
|
|
777758
|
-
var
|
|
777740
|
+
var import_promises55 = require("fs/promises");
|
|
777759
777741
|
var import_gray_matter4 = __toESM(require_gray_matter(), 1);
|
|
777760
777742
|
async function defaultMarkdownLoader(filepath) {
|
|
777761
|
-
const { content: content5 } = (0, import_gray_matter4.default)(await (0,
|
|
777743
|
+
const { content: content5 } = (0, import_gray_matter4.default)(await (0, import_promises55.readFile)(filepath));
|
|
777762
777744
|
return content5;
|
|
777763
777745
|
}
|
|
777764
777746
|
function extractAttributes(markdownTag) {
|
|
@@ -777955,7 +777937,7 @@ init_lib10();
|
|
|
777955
777937
|
var import_dayjs3 = __toESM(require_dayjs_min2(), 1);
|
|
777956
777938
|
var import_utc3 = __toESM(require_utc2(), 1);
|
|
777957
777939
|
var import_fs24 = require("fs");
|
|
777958
|
-
var
|
|
777940
|
+
var import_promises59 = require("fs/promises");
|
|
777959
777941
|
var import_gray_matter5 = __toESM(require_gray_matter(), 1);
|
|
777960
777942
|
init_lodash();
|
|
777961
777943
|
|
|
@@ -782414,7 +782396,7 @@ var OpenAPIPruner = class {
|
|
|
782414
782396
|
};
|
|
782415
782397
|
|
|
782416
782398
|
// ../register/lib/ai-example-enhancer/enhanceExamplesWithAI.js
|
|
782417
|
-
var
|
|
782399
|
+
var import_promises58 = require("fs/promises");
|
|
782418
782400
|
|
|
782419
782401
|
// ../register/lib/ai-example-enhancer/filterHelpers.js
|
|
782420
782402
|
function isFdrTypedValueWrapper(value) {
|
|
@@ -782768,12 +782750,12 @@ var SpinnerStatusCoordinator = class _SpinnerStatusCoordinator {
|
|
|
782768
782750
|
|
|
782769
782751
|
// ../register/lib/ai-example-enhancer/validateAiExamples.js
|
|
782770
782752
|
init_lib6();
|
|
782771
|
-
var
|
|
782753
|
+
var import_promises56 = require("fs/promises");
|
|
782772
782754
|
async function parseAiExamplesOverride(sourceFilePath, context3) {
|
|
782773
782755
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
782774
782756
|
const aiExamples = [];
|
|
782775
782757
|
try {
|
|
782776
|
-
const existingContent = await (0,
|
|
782758
|
+
const existingContent = await (0, import_promises56.readFile)(overrideFilePath, "utf-8");
|
|
782777
782759
|
const parsed = jsYaml.load(existingContent);
|
|
782778
782760
|
if (parsed && typeof parsed === "object" && "paths" in parsed) {
|
|
782779
782761
|
const paths = parsed.paths;
|
|
@@ -782822,7 +782804,7 @@ async function validateAiExamplesFromFile({ sourceFilePath, context: context3 })
|
|
|
782822
782804
|
}
|
|
782823
782805
|
let spec;
|
|
782824
782806
|
try {
|
|
782825
|
-
const specContent = await (0,
|
|
782807
|
+
const specContent = await (0, import_promises56.readFile)(sourceFilePath, "utf-8");
|
|
782826
782808
|
try {
|
|
782827
782809
|
spec = JSON.parse(specContent);
|
|
782828
782810
|
} catch {
|
|
@@ -782881,7 +782863,7 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
782881
782863
|
}
|
|
782882
782864
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
782883
782865
|
try {
|
|
782884
|
-
const existingContent = await (0,
|
|
782866
|
+
const existingContent = await (0, import_promises56.readFile)(overrideFilePath, "utf-8");
|
|
782885
782867
|
const parsed = jsYaml.load(existingContent);
|
|
782886
782868
|
if (!parsed || !parsed.paths) {
|
|
782887
782869
|
return {
|
|
@@ -782926,12 +782908,12 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
782926
782908
|
|
|
782927
782909
|
// ../register/lib/ai-example-enhancer/writeAiExamplesOverride.js
|
|
782928
782910
|
init_lib6();
|
|
782929
|
-
var
|
|
782911
|
+
var import_promises57 = require("fs/promises");
|
|
782930
782912
|
async function loadExistingOverrideCoverage(sourceFilePath, context3) {
|
|
782931
782913
|
const overrideFilePath = AbsoluteFilePath2.of(`${dirname4(sourceFilePath)}/ai_examples_override.yml`);
|
|
782932
782914
|
const coveredEndpoints = /* @__PURE__ */ new Set();
|
|
782933
782915
|
try {
|
|
782934
|
-
const existingContent = await (0,
|
|
782916
|
+
const existingContent = await (0, import_promises57.readFile)(overrideFilePath, "utf-8");
|
|
782935
782917
|
const parsed = jsYaml.load(existingContent);
|
|
782936
782918
|
if (parsed && typeof parsed === "object" && "paths" in parsed) {
|
|
782937
782919
|
const paths = parsed.paths;
|
|
@@ -783057,7 +783039,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
|
|
|
783057
783039
|
try {
|
|
783058
783040
|
let existingOverride = {};
|
|
783059
783041
|
try {
|
|
783060
|
-
const existingContent = await (0,
|
|
783042
|
+
const existingContent = await (0, import_promises57.readFile)(overrideFilePath, "utf-8");
|
|
783061
783043
|
const parsed = jsYaml.load(existingContent);
|
|
783062
783044
|
if (parsed && typeof parsed === "object") {
|
|
783063
783045
|
existingOverride = parsed;
|
|
@@ -783100,7 +783082,7 @@ async function writeAiExamplesOverride({ enhancedExamples, sourceFilePath, conte
|
|
|
783100
783082
|
lineWidth: -1,
|
|
783101
783083
|
noRefs: true
|
|
783102
783084
|
});
|
|
783103
|
-
await (0,
|
|
783085
|
+
await (0, import_promises57.writeFile)(overrideFilePath, yamlContent, "utf-8");
|
|
783104
783086
|
context3.logger.debug(`AI enhanced examples written to: ${overrideFilePath}`);
|
|
783105
783087
|
} catch (error50) {
|
|
783106
783088
|
context3.logger.warn(`Failed to write AI examples override file: ${error50}`);
|
|
@@ -783390,7 +783372,7 @@ async function performAIEnhancement(apiDefinition, config5, context3, token, org
|
|
|
783390
783372
|
const parsedSpecs = [];
|
|
783391
783373
|
for (const sourceSpec of sourceSpecs) {
|
|
783392
783374
|
try {
|
|
783393
|
-
let specContent = await (0,
|
|
783375
|
+
let specContent = await (0, import_promises58.readFile)(sourceSpec.absoluteFilePath, "utf-8");
|
|
783394
783376
|
if (sourceSpec.absoluteFilePathToOverrides != null) {
|
|
783395
783377
|
const overridesPaths = Array.isArray(sourceSpec.absoluteFilePathToOverrides) ? sourceSpec.absoluteFilePathToOverrides : [sourceSpec.absoluteFilePathToOverrides];
|
|
783396
783378
|
try {
|
|
@@ -783401,7 +783383,7 @@ async function performAIEnhancement(apiDefinition, config5, context3, token, org
|
|
|
783401
783383
|
parsedSpec = load(specContent, { json: true });
|
|
783402
783384
|
}
|
|
783403
783385
|
for (const overridesPath of overridesPaths) {
|
|
783404
|
-
const overridesContent = await (0,
|
|
783386
|
+
const overridesContent = await (0, import_promises58.readFile)(overridesPath, "utf-8");
|
|
783405
783387
|
let parsedOverrides;
|
|
783406
783388
|
try {
|
|
783407
783389
|
parsedOverrides = JSON.parse(overridesContent);
|
|
@@ -786528,7 +786510,7 @@ var DocsDefinitionResolver = class {
|
|
|
786528
786510
|
const jsFilePaths = /* @__PURE__ */ new Set();
|
|
786529
786511
|
await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async (filepath) => {
|
|
786530
786512
|
const absoluteFilePath = resolve5(this.docsWorkspace.absoluteFilePath, filepath);
|
|
786531
|
-
const stats = await (0,
|
|
786513
|
+
const stats = await (0, import_promises59.stat)(absoluteFilePath);
|
|
786532
786514
|
if (stats.isDirectory()) {
|
|
786533
786515
|
const files = await listFiles(absoluteFilePath, "{js,ts,jsx,tsx,md,mdx}");
|
|
786534
786516
|
files.forEach((file4) => {
|
|
@@ -786540,7 +786522,7 @@ var DocsDefinitionResolver = class {
|
|
|
786540
786522
|
}));
|
|
786541
786523
|
jsFiles = Object.fromEntries(await Promise.all([...jsFilePaths].map(async (filePath) => {
|
|
786542
786524
|
const relativeFilePath = this.toRelativeFilepath(filePath);
|
|
786543
|
-
const contents = (await (0,
|
|
786525
|
+
const contents = (await (0, import_promises59.readFile)(filePath)).toString();
|
|
786544
786526
|
return [relativeFilePath, contents];
|
|
786545
786527
|
})));
|
|
786546
786528
|
const mdxTime = performance.now() - mdxStart;
|
|
@@ -786554,13 +786536,13 @@ var DocsDefinitionResolver = class {
|
|
|
786554
786536
|
}
|
|
786555
786537
|
if (this._parsedDocsConfig.header != null) {
|
|
786556
786538
|
const relativeFilePath = this.toRelativeFilepath(this._parsedDocsConfig.header);
|
|
786557
|
-
const contents = (await (0,
|
|
786539
|
+
const contents = (await (0, import_promises59.readFile)(this._parsedDocsConfig.header)).toString();
|
|
786558
786540
|
jsFiles[relativeFilePath] = contents;
|
|
786559
786541
|
this.taskContext.logger.debug(`Added custom header component: ${relativeFilePath}`);
|
|
786560
786542
|
}
|
|
786561
786543
|
if (this._parsedDocsConfig.footer != null) {
|
|
786562
786544
|
const relativeFilePath = this.toRelativeFilepath(this._parsedDocsConfig.footer);
|
|
786563
|
-
const contents = (await (0,
|
|
786545
|
+
const contents = (await (0, import_promises59.readFile)(this._parsedDocsConfig.footer)).toString();
|
|
786564
786546
|
jsFiles[relativeFilePath] = contents;
|
|
786565
786547
|
this.taskContext.logger.debug(`Added custom footer component: ${relativeFilePath}`);
|
|
786566
786548
|
}
|
|
@@ -787345,7 +787327,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
787345
787327
|
this.taskContext.logger.warn(`No _navigation.yml found for library '${libraryName}' at ${navFilePath}. Run 'fern docs md generate' first.`);
|
|
787346
787328
|
return null;
|
|
787347
787329
|
}
|
|
787348
|
-
const navContent = await (0,
|
|
787330
|
+
const navContent = await (0, import_promises59.readFile)(navFilePath, "utf-8");
|
|
787349
787331
|
const yamlBody = navContent.split("\n").filter((line) => !line.startsWith("#")).join("\n");
|
|
787350
787332
|
try {
|
|
787351
787333
|
return jsYaml.load(yamlBody) ?? [];
|
|
@@ -787365,7 +787347,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
787365
787347
|
return void 0;
|
|
787366
787348
|
}
|
|
787367
787349
|
const relPath = relative3(this.docsWorkspace.absoluteFilePath, absolutePath);
|
|
787368
|
-
const content5 = await (0,
|
|
787350
|
+
const content5 = await (0, import_promises59.readFile)(absolutePath, "utf-8");
|
|
787369
787351
|
this.parsedDocsConfig.pages[relPath] = content5;
|
|
787370
787352
|
return navigation_exports2.PageId(relPath);
|
|
787371
787353
|
}
|
|
@@ -796229,7 +796211,7 @@ async function validateVersionConfigFileSchema({ value }) {
|
|
|
796229
796211
|
// ../yaml/docs-validator/lib/docsAst/visitDocsConfigFileYamlAst.js
|
|
796230
796212
|
init_lib4();
|
|
796231
796213
|
init_lib6();
|
|
796232
|
-
var
|
|
796214
|
+
var import_promises61 = require("fs/promises");
|
|
796233
796215
|
|
|
796234
796216
|
// ../yaml/docs-validator/lib/docsAst/validateProductConfig.js
|
|
796235
796217
|
init_lib4();
|
|
@@ -798307,7 +798289,7 @@ async function visitFilepath({ absoluteFilepathToConfiguration, rawUnresolvedFil
|
|
|
798307
798289
|
// ../yaml/docs-validator/lib/docsAst/visitNavigationAst.js
|
|
798308
798290
|
init_lib4();
|
|
798309
798291
|
init_lib6();
|
|
798310
|
-
var
|
|
798292
|
+
var import_promises60 = require("fs/promises");
|
|
798311
798293
|
|
|
798312
798294
|
// ../yaml/docs-validator/lib/utils/asyncPool.js
|
|
798313
798295
|
async function asyncPool(limit, items, fn5) {
|
|
@@ -798459,13 +798441,13 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
798459
798441
|
if (markdownPath != null) {
|
|
798460
798442
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), markdownPath);
|
|
798461
798443
|
if (await doesPathExist(absoluteFilepath)) {
|
|
798462
|
-
const fileStats = await (0,
|
|
798444
|
+
const fileStats = await (0, import_promises60.stat)(absoluteFilepath);
|
|
798463
798445
|
const fileSizeMB = fileStats.size / (1024 * 1024);
|
|
798464
798446
|
if (fileSizeMB > 1) {
|
|
798465
798447
|
context3.logger.trace(`Processing large markdown file: ${markdownPath} (${fileSizeMB.toFixed(2)} MB)`);
|
|
798466
798448
|
}
|
|
798467
798449
|
const startTime = performance.now();
|
|
798468
|
-
const content5 = (await (0,
|
|
798450
|
+
const content5 = (await (0, import_promises60.readFile)(absoluteFilepath, "utf8")).toString();
|
|
798469
798451
|
const readTime = performance.now() - startTime;
|
|
798470
798452
|
if (readTime > 2e3) {
|
|
798471
798453
|
context3.logger.debug(`Slow file read: ${markdownPath} took ${readTime.toFixed(0)}ms`);
|
|
@@ -798513,12 +798495,12 @@ async function visitNavigationItem2({ absolutePathToFernFolder, navigationItem,
|
|
|
798513
798495
|
context3.logger.trace(`Starting changelog processing for directory: ${changelogDir}`);
|
|
798514
798496
|
if (await doesPathExist(changelogDir)) {
|
|
798515
798497
|
const startTime = performance.now();
|
|
798516
|
-
const files = await (0,
|
|
798498
|
+
const files = await (0, import_promises60.readdir)(changelogDir);
|
|
798517
798499
|
const markdownFiles = files.filter((file4) => file4.endsWith(".md") || file4.endsWith(".mdx"));
|
|
798518
798500
|
context3.logger.debug(`Processing ${markdownFiles.length} changelog files in ${changelogDir}`);
|
|
798519
798501
|
await asyncPool(VALIDATION_CONCURRENCY, markdownFiles, async (file4) => {
|
|
798520
798502
|
const absoluteFilepath = resolve5(changelogDir, file4);
|
|
798521
|
-
const content5 = (await (0,
|
|
798503
|
+
const content5 = (await (0, import_promises60.readFile)(absoluteFilepath, "utf8")).toString();
|
|
798522
798504
|
context3.logger.trace(`Validating changelog file: ${file4}`);
|
|
798523
798505
|
await visitor.markdownPage?.({
|
|
798524
798506
|
title: file4,
|
|
@@ -798753,7 +798735,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
798753
798735
|
willBeUploaded: false
|
|
798754
798736
|
});
|
|
798755
798737
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), product.path);
|
|
798756
|
-
const content5 = jsYaml.load((await (0,
|
|
798738
|
+
const content5 = jsYaml.load((await (0, import_promises61.readFile)(absoluteFilepath)).toString());
|
|
798757
798739
|
if (await doesPathExist(absoluteFilepath)) {
|
|
798758
798740
|
await visitor.productFile?.({
|
|
798759
798741
|
path: product.path,
|
|
@@ -798832,7 +798814,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
798832
798814
|
willBeUploaded: false
|
|
798833
798815
|
});
|
|
798834
798816
|
const absoluteFilepath = resolve5(dirname4(absoluteFilepathToConfiguration), version7.path);
|
|
798835
|
-
const content5 = jsYaml.load((await (0,
|
|
798817
|
+
const content5 = jsYaml.load((await (0, import_promises61.readFile)(absoluteFilepath)).toString());
|
|
798836
798818
|
if (await doesPathExist(absoluteFilepath)) {
|
|
798837
798819
|
await visitor.versionFile?.({
|
|
798838
798820
|
path: version7.path,
|
|
@@ -799268,11 +799250,11 @@ var import_chardet2 = __toESM(require_lib9(), 1);
|
|
|
799268
799250
|
// ../../../node_modules/.pnpm/file-type@21.3.4/node_modules/file-type/index.js
|
|
799269
799251
|
var import_web = require("stream/web");
|
|
799270
799252
|
var import_node_stream5 = require("stream");
|
|
799271
|
-
var
|
|
799253
|
+
var import_promises64 = __toESM(require("fs/promises"), 1);
|
|
799272
799254
|
var import_node_fs13 = require("fs");
|
|
799273
799255
|
|
|
799274
799256
|
// ../../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/index.js
|
|
799275
|
-
var
|
|
799257
|
+
var import_promises63 = require("fs/promises");
|
|
799276
799258
|
|
|
799277
799259
|
// ../../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/stream/Errors.js
|
|
799278
799260
|
var defaultMessages = "End-Of-Stream";
|
|
@@ -799795,14 +799777,14 @@ function fromBlob(blob, options2) {
|
|
|
799795
799777
|
}
|
|
799796
799778
|
|
|
799797
799779
|
// ../../../node_modules/.pnpm/strtok3@10.3.4/node_modules/strtok3/lib/FileTokenizer.js
|
|
799798
|
-
var
|
|
799780
|
+
var import_promises62 = require("fs/promises");
|
|
799799
799781
|
var FileTokenizer = class _FileTokenizer extends AbstractTokenizer {
|
|
799800
799782
|
/**
|
|
799801
799783
|
* Create tokenizer from provided file path
|
|
799802
799784
|
* @param sourceFilePath File path
|
|
799803
799785
|
*/
|
|
799804
799786
|
static async fromFile(sourceFilePath) {
|
|
799805
|
-
const fileHandle = await (0,
|
|
799787
|
+
const fileHandle = await (0, import_promises62.open)(sourceFilePath, "r");
|
|
799806
799788
|
const stat6 = await fileHandle.stat();
|
|
799807
799789
|
return new _FileTokenizer(fileHandle, { fileInfo: { path: sourceFilePath, size: stat6.size } });
|
|
799808
799790
|
}
|
|
@@ -803043,7 +803025,7 @@ var supportedExtensions = new Set(extensions);
|
|
|
803043
803025
|
var supportedMimeTypes = new Set(mimeTypes);
|
|
803044
803026
|
|
|
803045
803027
|
// ../yaml/docs-validator/lib/rules/valid-file-types/valid-file-types.js
|
|
803046
|
-
var
|
|
803028
|
+
var import_promises65 = require("fs/promises");
|
|
803047
803029
|
var import_path52 = __toESM(require("path"), 1);
|
|
803048
803030
|
var ALLOWED_FILE_TYPES = /* @__PURE__ */ new Set([
|
|
803049
803031
|
// image files
|
|
@@ -803172,7 +803154,7 @@ var ValidFileTypes = {
|
|
|
803172
803154
|
}
|
|
803173
803155
|
};
|
|
803174
803156
|
var getViolationsForFile = async (absoluteFilepath) => {
|
|
803175
|
-
const file4 = new Uint8Array(await (0,
|
|
803157
|
+
const file4 = new Uint8Array(await (0, import_promises65.readFile)(absoluteFilepath));
|
|
803176
803158
|
const fileType = await fileTypeFromBuffer(file4);
|
|
803177
803159
|
if (fileType != null) {
|
|
803178
803160
|
if (ALLOWED_FILE_TYPES.has(fileType.mime)) {
|
|
@@ -803211,7 +803193,7 @@ var getViolationsForFile = async (absoluteFilepath) => {
|
|
|
803211
803193
|
};
|
|
803212
803194
|
|
|
803213
803195
|
// ../yaml/docs-validator/lib/rules/valid-frontmatter/valid-frontmatter.js
|
|
803214
|
-
var
|
|
803196
|
+
var import_promises66 = require("fs/promises");
|
|
803215
803197
|
var import_gray_matter6 = __toESM(require_gray_matter(), 1);
|
|
803216
803198
|
var ValidFrontmatter = {
|
|
803217
803199
|
name: "valid-frontmatter",
|
|
@@ -803222,7 +803204,7 @@ var ValidFrontmatter = {
|
|
|
803222
803204
|
return [];
|
|
803223
803205
|
}
|
|
803224
803206
|
try {
|
|
803225
|
-
const fileContents = await (0,
|
|
803207
|
+
const fileContents = await (0, import_promises66.readFile)(absoluteFilepath, "utf-8");
|
|
803226
803208
|
(0, import_gray_matter6.default)(fileContents);
|
|
803227
803209
|
return [];
|
|
803228
803210
|
} catch (error50) {
|
|
@@ -820664,7 +820646,7 @@ async function parseMarkdown({ markdown, absoluteFilepath, absolutePathToFernFol
|
|
|
820664
820646
|
|
|
820665
820647
|
// ../yaml/docs-validator/lib/rules/valid-markdown-file-reference/valid-markdown-file-reference.js
|
|
820666
820648
|
init_lib6();
|
|
820667
|
-
var
|
|
820649
|
+
var import_promises67 = require("fs/promises");
|
|
820668
820650
|
var import_gray_matter7 = __toESM(require_gray_matter(), 1);
|
|
820669
820651
|
var ValidMarkdownFileReferences = {
|
|
820670
820652
|
name: "valid-markdown-file-references",
|
|
@@ -820675,7 +820657,7 @@ var ValidMarkdownFileReferences = {
|
|
|
820675
820657
|
return [];
|
|
820676
820658
|
}
|
|
820677
820659
|
try {
|
|
820678
|
-
const fileContents = await (0,
|
|
820660
|
+
const fileContents = await (0, import_promises67.readFile)(absoluteFilepath, "utf-8");
|
|
820679
820661
|
const { content: content5 } = (0, import_gray_matter7.default)(fileContents, {});
|
|
820680
820662
|
const tree = parseMarkdownToTree(content5);
|
|
820681
820663
|
const errors4 = [];
|
|
@@ -821276,7 +821258,7 @@ var MDX_NODE_TYPES = [
|
|
|
821276
821258
|
"mdxTextExpression",
|
|
821277
821259
|
"mdxjsEsm"
|
|
821278
821260
|
];
|
|
821279
|
-
function collectLinksAndSources({ readFile:
|
|
821261
|
+
function collectLinksAndSources({ readFile: readFile102 = (path97) => (0, import_node_fs14.readFileSync)(path97, "utf-8"), ...opts }) {
|
|
821280
821262
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
821281
821263
|
const contentQueue = [opts];
|
|
821282
821264
|
const links = [];
|
|
@@ -821314,7 +821296,7 @@ function collectLinksAndSources({ readFile: readFile106 = (path97) => (0, import
|
|
|
821314
821296
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), importPath);
|
|
821315
821297
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
821316
821298
|
contentQueue.push({
|
|
821317
|
-
content:
|
|
821299
|
+
content: readFile102(resolvedImportPath),
|
|
821318
821300
|
absoluteFilepath: resolvedImportPath
|
|
821319
821301
|
});
|
|
821320
821302
|
}
|
|
@@ -821357,7 +821339,7 @@ function collectLinksAndSources({ readFile: readFile106 = (path97) => (0, import
|
|
|
821357
821339
|
if (absoluteFilepath && typeof src === "string") {
|
|
821358
821340
|
const resolvedImportPath = resolve5(dirname4(absoluteFilepath), src);
|
|
821359
821341
|
contentQueue.push({
|
|
821360
|
-
content:
|
|
821342
|
+
content: readFile102(resolvedImportPath),
|
|
821361
821343
|
absoluteFilepath: resolvedImportPath
|
|
821362
821344
|
});
|
|
821363
821345
|
}
|
|
@@ -821754,7 +821736,7 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRulesWith
|
|
|
821754
821736
|
|
|
821755
821737
|
// ../yaml/docs-validator/lib/rules/no-non-component-refs/no-non-component-refs.js
|
|
821756
821738
|
init_lib6();
|
|
821757
|
-
var
|
|
821739
|
+
var import_promises68 = require("fs/promises");
|
|
821758
821740
|
var NoNonComponentRefsRule = {
|
|
821759
821741
|
name: "no-non-component-refs",
|
|
821760
821742
|
create: ({ ossWorkspaces, logger: logger4, workspace: docsWorkspace }) => {
|
|
@@ -821768,7 +821750,7 @@ var NoNonComponentRefsRule = {
|
|
|
821768
821750
|
if (!processedFiles.has(spec.absoluteFilepath)) {
|
|
821769
821751
|
processedFiles.add(spec.absoluteFilepath);
|
|
821770
821752
|
try {
|
|
821771
|
-
const contents = (await (0,
|
|
821753
|
+
const contents = (await (0, import_promises68.readFile)(spec.absoluteFilepath)).toString();
|
|
821772
821754
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
821773
821755
|
const isOpenApiV2Yaml = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
821774
821756
|
const isOpenApiV2Json = contents.includes('"swagger":') && (contents.includes('"swagger":"2.0"') || contents.includes('"swagger": "2.0"'));
|
|
@@ -821810,7 +821792,7 @@ var NoNonComponentRefsRule = {
|
|
|
821810
821792
|
|
|
821811
821793
|
// ../yaml/docs-validator/lib/rules/no-openapi-v2-in-docs/no-openapi-v2-in-docs.js
|
|
821812
821794
|
init_lib6();
|
|
821813
|
-
var
|
|
821795
|
+
var import_promises69 = require("fs/promises");
|
|
821814
821796
|
var NoOpenApiV2InDocsRule = {
|
|
821815
821797
|
name: "no-openapi-v2-in-docs",
|
|
821816
821798
|
create: ({ ossWorkspaces, logger: logger4, workspace: docsWorkspace }) => {
|
|
@@ -821823,7 +821805,7 @@ var NoOpenApiV2InDocsRule = {
|
|
|
821823
821805
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
821824
821806
|
processedFiles.add(spec.absoluteFilepath);
|
|
821825
821807
|
try {
|
|
821826
|
-
const contents = (await (0,
|
|
821808
|
+
const contents = (await (0, import_promises69.readFile)(spec.absoluteFilepath)).toString();
|
|
821827
821809
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
821828
821810
|
const isOpenApiV2Yaml = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
821829
821811
|
const isOpenApiV2Json = contents.includes('"swagger":') && (contents.includes('"swagger":"2.0"') || contents.includes('"swagger": "2.0"'));
|
|
@@ -821949,7 +821931,7 @@ var ValidInstanceUrlRule = {
|
|
|
821949
821931
|
|
|
821950
821932
|
// ../yaml/docs-validator/lib/rules/valid-local-references/valid-local-references.js
|
|
821951
821933
|
init_lib6();
|
|
821952
|
-
var
|
|
821934
|
+
var import_promises70 = require("fs/promises");
|
|
821953
821935
|
function validateReference(ref2, spec) {
|
|
821954
821936
|
const pathParts = ref2.replace(/^#\//, "").split("/").map((part) => (
|
|
821955
821937
|
// Decode JSON Pointer escapes: ~1 -> /, ~0 -> ~
|
|
@@ -822016,7 +821998,7 @@ var ValidLocalReferencesRule = {
|
|
|
822016
821998
|
if (spec.type === "openapi" && !processedFiles.has(spec.absoluteFilepath)) {
|
|
822017
821999
|
processedFiles.add(spec.absoluteFilepath);
|
|
822018
822000
|
try {
|
|
822019
|
-
const contents = (await (0,
|
|
822001
|
+
const contents = (await (0, import_promises70.readFile)(spec.absoluteFilepath)).toString();
|
|
822020
822002
|
const relativePath = relative3(docsWorkspace.absoluteFilePath, spec.absoluteFilepath);
|
|
822021
822003
|
const isOpenApiV2Yaml = contents.includes("swagger:") && (contents.includes('swagger: "2.0"') || contents.includes("swagger: '2.0'") || contents.includes("swagger: 2.0"));
|
|
822022
822004
|
const isOpenApiV2Json = contents.includes('"swagger":') && (contents.includes('"swagger":"2.0"') || contents.includes('"swagger": "2.0"'));
|
|
@@ -822071,7 +822053,7 @@ var ValidLocalReferencesRule = {
|
|
|
822071
822053
|
|
|
822072
822054
|
// ../yaml/docs-validator/lib/rules/valid-openapi-examples/valid-openapi-examples.js
|
|
822073
822055
|
init_lib6();
|
|
822074
|
-
var
|
|
822056
|
+
var import_promises71 = require("fs/promises");
|
|
822075
822057
|
var ValidOpenApiExamples = {
|
|
822076
822058
|
name: "valid-openapi-examples",
|
|
822077
822059
|
create: ({ ossWorkspaces, logger: logger4, workspace: docsWorkspace }) => {
|
|
@@ -822169,7 +822151,7 @@ var ValidOpenApiExamples = {
|
|
|
822169
822151
|
};
|
|
822170
822152
|
async function validateOpenApiExamples({ specPath, logger: logger4 }) {
|
|
822171
822153
|
try {
|
|
822172
|
-
const specContent = await (0,
|
|
822154
|
+
const specContent = await (0, import_promises71.readFile)(specPath, "utf-8");
|
|
822173
822155
|
let spec;
|
|
822174
822156
|
try {
|
|
822175
822157
|
spec = JSON.parse(specContent);
|
|
@@ -822899,11 +822881,11 @@ function addCheckCommand2(cli) {
|
|
|
822899
822881
|
|
|
822900
822882
|
// ../cli-v2/lib/migrator/Migrator.js
|
|
822901
822883
|
init_lib6();
|
|
822902
|
-
var
|
|
822884
|
+
var import_promises75 = require("fs/promises");
|
|
822903
822885
|
|
|
822904
822886
|
// ../cli-v2/lib/migrator/converters/convertApiSpecs.js
|
|
822905
822887
|
init_lib6();
|
|
822906
|
-
var
|
|
822888
|
+
var import_promises72 = require("fs/promises");
|
|
822907
822889
|
|
|
822908
822890
|
// ../cli-v2/lib/migrator/converters/convertSettings.js
|
|
822909
822891
|
var SETTINGS_KEY_MAP = {
|
|
@@ -823037,7 +823019,7 @@ async function convertMultiApi(options2) {
|
|
|
823037
823019
|
const { apisDir, generatorsYmlApis } = options2;
|
|
823038
823020
|
const warnings = [];
|
|
823039
823021
|
const apis = {};
|
|
823040
|
-
const apiDirs = await (0,
|
|
823022
|
+
const apiDirs = await (0, import_promises72.readdir)(apisDir, { withFileTypes: true });
|
|
823041
823023
|
const apiNames = apiDirs.filter((d14) => d14.isDirectory()).map((d14) => d14.name);
|
|
823042
823024
|
for (const apiName of apiNames) {
|
|
823043
823025
|
const apiDir = join2(apisDir, RelativeFilePath2.of(apiName));
|
|
@@ -823788,7 +823770,7 @@ function convertRawReadme(readme) {
|
|
|
823788
823770
|
// ../cli-v2/lib/migrator/fern-config-json/FernConfigJsonMigrator.js
|
|
823789
823771
|
init_lib4();
|
|
823790
823772
|
init_lib6();
|
|
823791
|
-
var
|
|
823773
|
+
var import_promises73 = require("fs/promises");
|
|
823792
823774
|
var FernConfigJsonMigrator = class {
|
|
823793
823775
|
cwd;
|
|
823794
823776
|
constructor({ cwd: cwd2 }) {
|
|
@@ -823821,7 +823803,7 @@ var FernConfigJsonMigrator = class {
|
|
|
823821
823803
|
};
|
|
823822
823804
|
}
|
|
823823
823805
|
try {
|
|
823824
|
-
const content5 = await (0,
|
|
823806
|
+
const content5 = await (0, import_promises73.readFile)(absoluteFilePath, "utf-8");
|
|
823825
823807
|
const config5 = JSON.parse(content5);
|
|
823826
823808
|
const org = typeof config5.organization === "string" ? config5.organization : void 0;
|
|
823827
823809
|
const cliVersion = typeof config5.version === "string" ? config5.version : void 0;
|
|
@@ -823860,7 +823842,7 @@ var FernConfigJsonMigrator = class {
|
|
|
823860
823842
|
// ../cli-v2/lib/migrator/generators-yml/GeneratorsYmlMigrator.js
|
|
823861
823843
|
init_lib4();
|
|
823862
823844
|
init_lib6();
|
|
823863
|
-
var
|
|
823845
|
+
var import_promises74 = require("fs/promises");
|
|
823864
823846
|
var GeneratorsYmlMigrator = class {
|
|
823865
823847
|
cwd;
|
|
823866
823848
|
apiName;
|
|
@@ -823894,7 +823876,7 @@ var GeneratorsYmlMigrator = class {
|
|
|
823894
823876
|
}
|
|
823895
823877
|
let content5;
|
|
823896
823878
|
try {
|
|
823897
|
-
content5 = await (0,
|
|
823879
|
+
content5 = await (0, import_promises74.readFile)(absoluteFilePath, "utf-8");
|
|
823898
823880
|
const config5 = jsYaml.load(content5);
|
|
823899
823881
|
if (config5 == null || typeof config5 !== "object") {
|
|
823900
823882
|
return {
|
|
@@ -824121,11 +824103,11 @@ var Migrator = class {
|
|
|
824121
824103
|
}
|
|
824122
824104
|
const fernYmlPath = join2(this.cwd, RelativeFilePath2.of(FERN_YML_FILENAME));
|
|
824123
824105
|
const yamlContent = this.serializeFernYml(fernYml);
|
|
824124
|
-
await (0,
|
|
824106
|
+
await (0, import_promises75.writeFile)(fernYmlPath, yamlContent, "utf-8");
|
|
824125
824107
|
if (this.deleteOriginals) {
|
|
824126
824108
|
for (const absoluteFilePath of migratedFiles) {
|
|
824127
824109
|
try {
|
|
824128
|
-
await (0,
|
|
824110
|
+
await (0, import_promises75.rm)(absoluteFilePath);
|
|
824129
824111
|
this.logger.debug(`Deleted ${absoluteFilePath}`);
|
|
824130
824112
|
} catch {
|
|
824131
824113
|
warnings.push({
|
|
@@ -824169,7 +824151,7 @@ var Migrator = class {
|
|
|
824169
824151
|
}
|
|
824170
824152
|
async migrateMultiApi(options2) {
|
|
824171
824153
|
const { fernDir, apisDir, org, warnings, migratedFiles } = options2;
|
|
824172
|
-
const apiDirs = await (0,
|
|
824154
|
+
const apiDirs = await (0, import_promises75.readdir)(apisDir, { withFileTypes: true });
|
|
824173
824155
|
const apiNames = apiDirs.filter((d14) => d14.isDirectory()).map((d14) => d14.name);
|
|
824174
824156
|
if (apiNames.length === 0) {
|
|
824175
824157
|
warnings.push({
|
|
@@ -824529,7 +824511,7 @@ init_js();
|
|
|
824529
824511
|
init_lib6();
|
|
824530
824512
|
var import_cors = __toESM(require_lib14(), 1);
|
|
824531
824513
|
var import_express2 = __toESM(require_express3(), 1);
|
|
824532
|
-
var
|
|
824514
|
+
var import_promises79 = require("fs/promises");
|
|
824533
824515
|
var import_http9 = __toESM(require("http"), 1);
|
|
824534
824516
|
var import_path55 = __toESM(require("path"), 1);
|
|
824535
824517
|
|
|
@@ -826202,13 +826184,13 @@ init_wrapper();
|
|
|
826202
826184
|
|
|
826203
826185
|
// ../docs-preview/lib/DebugLogger.js
|
|
826204
826186
|
init_lib6();
|
|
826205
|
-
var
|
|
826187
|
+
var import_promises76 = require("fs/promises");
|
|
826206
826188
|
var import_os9 = require("os");
|
|
826207
826189
|
var import_path54 = __toESM(require("path"), 1);
|
|
826208
826190
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
826209
826191
|
var LOGS_FOLDER_NAME = "logs";
|
|
826210
826192
|
function getCliSource() {
|
|
826211
|
-
const version7 = "4.50.
|
|
826193
|
+
const version7 = "4.50.4";
|
|
826212
826194
|
return `cli@${version7}`;
|
|
826213
826195
|
}
|
|
826214
826196
|
var DebugLogger = class {
|
|
@@ -826228,7 +826210,7 @@ var DebugLogger = class {
|
|
|
826228
826210
|
const localStorageFolder = join2(AbsoluteFilePath2.of((0, import_os9.homedir)()), RelativeFilePath2.of(LOCAL_STORAGE_FOLDER4));
|
|
826229
826211
|
const logsDir = join2(localStorageFolder, RelativeFilePath2.of(LOGS_FOLDER_NAME));
|
|
826230
826212
|
if (!await doesPathExist(logsDir)) {
|
|
826231
|
-
await (0,
|
|
826213
|
+
await (0, import_promises76.mkdir)(logsDir, { recursive: true });
|
|
826232
826214
|
}
|
|
826233
826215
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
826234
826216
|
const logFileName = `${timestamp2}.debug.log`;
|
|
@@ -826241,7 +826223,7 @@ var DebugLogger = class {
|
|
|
826241
826223
|
"================================================================================",
|
|
826242
826224
|
""
|
|
826243
826225
|
].join("\n");
|
|
826244
|
-
await (0,
|
|
826226
|
+
await (0, import_promises76.writeFile)(this.logFilePath, header, "utf-8");
|
|
826245
826227
|
this.initialized = true;
|
|
826246
826228
|
}
|
|
826247
826229
|
/**
|
|
@@ -826259,7 +826241,7 @@ var DebugLogger = class {
|
|
|
826259
826241
|
}
|
|
826260
826242
|
const line = JSON.stringify(entry) + "\n";
|
|
826261
826243
|
try {
|
|
826262
|
-
await (0,
|
|
826244
|
+
await (0, import_promises76.appendFile)(this.logFilePath, line, "utf-8");
|
|
826263
826245
|
} catch (error50) {
|
|
826264
826246
|
}
|
|
826265
826247
|
}
|
|
@@ -826494,7 +826476,7 @@ function getBun() {
|
|
|
826494
826476
|
init_lib6();
|
|
826495
826477
|
var import_cli_progress = __toESM(require_cli_progress(), 1);
|
|
826496
826478
|
var import_decompress = __toESM(require_decompress(), 1);
|
|
826497
|
-
var
|
|
826479
|
+
var import_promises77 = require("fs/promises");
|
|
826498
826480
|
var import_os10 = require("os");
|
|
826499
826481
|
var import_tmp_promise8 = __toESM(require_tmp_promise(), 1);
|
|
826500
826482
|
var import_xml2js = __toESM(require_xml2js(), 1);
|
|
@@ -826582,7 +826564,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826582
826564
|
let currentETag = void 0;
|
|
826583
826565
|
if (currentETagExists) {
|
|
826584
826566
|
logger4.debug("Reading existing ETag");
|
|
826585
|
-
currentETag = (await (0,
|
|
826567
|
+
currentETag = (await (0, import_promises77.readFile)(eTagFilepath)).toString();
|
|
826586
826568
|
}
|
|
826587
826569
|
if (currentETag != null && currentETag === eTag) {
|
|
826588
826570
|
logger4.debug("ETag matches. Using already downloaded bundle");
|
|
@@ -826646,16 +826628,16 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826646
826628
|
}
|
|
826647
826629
|
}
|
|
826648
826630
|
const nodeBuffer = Buffer.concat(chunks);
|
|
826649
|
-
await (0,
|
|
826631
|
+
await (0, import_promises77.writeFile)(outputZipPath, new Uint8Array(nodeBuffer));
|
|
826650
826632
|
logger4.debug(`Wrote ${tryTar ? "output.tar.gz" : "output.zip"} to ${outputZipPath}`);
|
|
826651
826633
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
826652
826634
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
826653
826635
|
logger4.debug(`Removing previously cached bundle at: ${absolutePathToPreviewFolder}`);
|
|
826654
|
-
await (0,
|
|
826636
|
+
await (0, import_promises77.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
826655
826637
|
}
|
|
826656
|
-
await (0,
|
|
826638
|
+
await (0, import_promises77.mkdir)(absolutePathToPreviewFolder, { recursive: true });
|
|
826657
826639
|
const absolutePathToBundleFolder = getPathToBundleFolder({ app });
|
|
826658
|
-
await (0,
|
|
826640
|
+
await (0, import_promises77.mkdir)(absolutePathToBundleFolder, { recursive: true });
|
|
826659
826641
|
logger4.debug(`Decompressing bundle from ${outputZipPath} to ${absolutePathToBundleFolder}`);
|
|
826660
826642
|
let unzipProgressBar;
|
|
826661
826643
|
let unzipInterval;
|
|
@@ -826690,7 +826672,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826690
826672
|
unzipProgressBar.stop();
|
|
826691
826673
|
}
|
|
826692
826674
|
}
|
|
826693
|
-
await (0,
|
|
826675
|
+
await (0, import_promises77.writeFile)(eTagFilepath, eTag);
|
|
826694
826676
|
logger4.debug(`Downloaded bundle to ${absolutePathToBundleFolder}`);
|
|
826695
826677
|
if (app) {
|
|
826696
826678
|
logger4.debug("Checking if pnpm is installed");
|
|
@@ -826772,15 +826754,15 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826772
826754
|
}
|
|
826773
826755
|
if (!pnpmfileExists) {
|
|
826774
826756
|
logger4.debug(`Writing pnpmfile.cjs at ${pnpmfilePath}`);
|
|
826775
|
-
await (0,
|
|
826757
|
+
await (0, import_promises77.writeFile)(pnpmfilePath, PNPMFILE_CJS_CONTENTS);
|
|
826776
826758
|
}
|
|
826777
826759
|
if (!npmrcExists) {
|
|
826778
826760
|
logger4.debug(`Writing .npmrc at ${npmrcPath}`);
|
|
826779
|
-
await (0,
|
|
826761
|
+
await (0, import_promises77.writeFile)(npmrcPath, NPMRC_CONTENTS);
|
|
826780
826762
|
}
|
|
826781
826763
|
if (instrumentationJsExists) {
|
|
826782
826764
|
logger4.debug(`Removing instrumentation.js at ${absPathToInstrumentationJs}`);
|
|
826783
|
-
await (0,
|
|
826765
|
+
await (0, import_promises77.rm)(absPathToInstrumentationJs);
|
|
826784
826766
|
}
|
|
826785
826767
|
try {
|
|
826786
826768
|
logger4.debug("Running pnpm install within standalone");
|
|
@@ -826800,7 +826782,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826800
826782
|
logger4.error(`Error: ${error50}`);
|
|
826801
826783
|
const absolutePathToPreviewFolder = getPathToPreviewFolder({ app });
|
|
826802
826784
|
if (await doesPathExist(absolutePathToPreviewFolder)) {
|
|
826803
|
-
await (0,
|
|
826785
|
+
await (0, import_promises77.rm)(absolutePathToPreviewFolder, { recursive: true });
|
|
826804
826786
|
}
|
|
826805
826787
|
logger4.debug(`Removing incomplete bundle: rm -rf ${absolutePathToPreviewFolder}`);
|
|
826806
826788
|
return {
|
|
@@ -826813,7 +826795,7 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
826813
826795
|
init_lib4();
|
|
826814
826796
|
init_js();
|
|
826815
826797
|
init_lib6();
|
|
826816
|
-
var
|
|
826798
|
+
var import_promises78 = require("fs/promises");
|
|
826817
826799
|
var import_gray_matter8 = __toESM(require_gray_matter(), 1);
|
|
826818
826800
|
var frontmatterPositionCache = /* @__PURE__ */ new Map();
|
|
826819
826801
|
var frontmatterSidebarTitleCache = /* @__PURE__ */ new Map();
|
|
@@ -826883,7 +826865,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
826883
826865
|
navAffectingChange = true;
|
|
826884
826866
|
continue;
|
|
826885
826867
|
}
|
|
826886
|
-
const markdown = (await (0,
|
|
826868
|
+
const markdown = (await (0, import_promises78.readFile)(absoluteFilePath)).toString();
|
|
826887
826869
|
const isNewFile = previousValue == null;
|
|
826888
826870
|
if (isNewFile) {
|
|
826889
826871
|
navAffectingChange = true;
|
|
@@ -827287,7 +827269,7 @@ var SnippetDependencyTracker = class {
|
|
|
827287
827269
|
const markdownFiles = await this.findMarkdownFiles(docsWorkspace.absoluteFilePath);
|
|
827288
827270
|
for (const markdownFile of markdownFiles) {
|
|
827289
827271
|
try {
|
|
827290
|
-
const content5 = await (0,
|
|
827272
|
+
const content5 = await (0, import_promises79.readFile)(markdownFile, "utf-8");
|
|
827291
827273
|
const referencedFiles = this.extractReferences(content5, markdownFile, docsWorkspace.absoluteFilePath);
|
|
827292
827274
|
this.pageToSnippets.set(markdownFile, referencedFiles);
|
|
827293
827275
|
for (const referencedFile of referencedFiles) {
|
|
@@ -827369,7 +827351,7 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
827369
827351
|
const appPreviewFolder = getPathToPreviewFolder({ app: true });
|
|
827370
827352
|
if (await doesPathExist(appPreviewFolder)) {
|
|
827371
827353
|
context3.logger.info("Force download requested. Deleting cached bundle...");
|
|
827372
|
-
await (0,
|
|
827354
|
+
await (0, import_promises79.rm)(appPreviewFolder, { recursive: true });
|
|
827373
827355
|
}
|
|
827374
827356
|
}
|
|
827375
827357
|
if (bundlePath != null) {
|
|
@@ -828864,7 +828846,7 @@ init_lib6();
|
|
|
828864
828846
|
|
|
828865
828847
|
// ../workspace/loader/lib/listFernFiles.js
|
|
828866
828848
|
init_lib6();
|
|
828867
|
-
var
|
|
828849
|
+
var import_promises80 = require("fs/promises");
|
|
828868
828850
|
async function listFernFiles2(root6, extensionGlob) {
|
|
828869
828851
|
const files = [];
|
|
828870
828852
|
for (const absoluteFilepath of await listFiles(root6, extensionGlob)) {
|
|
@@ -828879,7 +828861,7 @@ async function createFernFile2({ relativeFilepath, absoluteFilepath }) {
|
|
|
828879
828861
|
return {
|
|
828880
828862
|
relativeFilepath,
|
|
828881
828863
|
absoluteFilepath,
|
|
828882
|
-
fileContents: (await (0,
|
|
828864
|
+
fileContents: (await (0, import_promises80.readFile)(absoluteFilepath)).toString()
|
|
828883
828865
|
};
|
|
828884
828866
|
}
|
|
828885
828867
|
|
|
@@ -829186,7 +829168,7 @@ async function loadAPIWorkspace({ absolutePathToWorkspace, context: context3, cl
|
|
|
829186
829168
|
// ../workspace/loader/lib/loadDocsWorkspace.js
|
|
829187
829169
|
init_lib4();
|
|
829188
829170
|
init_lib6();
|
|
829189
|
-
var
|
|
829171
|
+
var import_promises81 = require("fs/promises");
|
|
829190
829172
|
|
|
829191
829173
|
// ../workspace/loader/lib/docs-yml.schema.json
|
|
829192
829174
|
var docs_yml_schema_exports = {};
|
|
@@ -835056,7 +835038,7 @@ async function loadDocsConfiguration({ absolutePathToDocsDefinition, context: co
|
|
|
835056
835038
|
});
|
|
835057
835039
|
}
|
|
835058
835040
|
async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context: context3 }) {
|
|
835059
|
-
const contentsStr = await (0,
|
|
835041
|
+
const contentsStr = await (0, import_promises81.readFile)(absolutePathOfConfiguration);
|
|
835060
835042
|
const contentsJson = jsYaml.load(contentsStr.toString());
|
|
835061
835043
|
const result = validateAgainstJsonSchema(contentsJson, docs_yml_schema_exports, {
|
|
835062
835044
|
filePath: absolutePathOfConfiguration
|
|
@@ -835090,8 +835072,8 @@ var import_fiddle_sdk5 = __toESM(require_fiddle_sdk(), 1);
|
|
|
835090
835072
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
835091
835073
|
init_lib6();
|
|
835092
835074
|
var import_fs25 = require("fs");
|
|
835093
|
-
var
|
|
835094
|
-
var
|
|
835075
|
+
var import_promises82 = require("fs/promises");
|
|
835076
|
+
var import_promises83 = require("stream/promises");
|
|
835095
835077
|
async function downloadSnippetsForTask({ snippetsS3PreSignedReadUrl, absolutePathToLocalSnippetJSON, context: context3 }) {
|
|
835096
835078
|
try {
|
|
835097
835079
|
await downloadFileForTask({
|
|
@@ -835108,10 +835090,10 @@ async function downloadFileForTask({ s3PreSignedReadUrl, absolutePathToLocalOutp
|
|
|
835108
835090
|
responseType: "stream"
|
|
835109
835091
|
});
|
|
835110
835092
|
if (await doesPathExist(absolutePathToLocalOutput)) {
|
|
835111
|
-
await (0,
|
|
835093
|
+
await (0, import_promises82.rm)(absolutePathToLocalOutput, { recursive: true });
|
|
835112
835094
|
}
|
|
835113
|
-
await (0,
|
|
835114
|
-
await (0,
|
|
835095
|
+
await (0, import_promises82.mkdir)(dirname4(absolutePathToLocalOutput), { recursive: true });
|
|
835096
|
+
await (0, import_promises83.pipeline)(request7.data, (0, import_fs25.createWriteStream)(absolutePathToLocalOutput));
|
|
835115
835097
|
}
|
|
835116
835098
|
|
|
835117
835099
|
// ../generation/remote-generation/remote-workspace-runner/lib/resolveAutoDiscoveredFernignorePath.js
|
|
@@ -835136,7 +835118,7 @@ init_js();
|
|
|
835136
835118
|
init_lib6();
|
|
835137
835119
|
var import_fiddle_sdk4 = __toESM(require_fiddle_sdk(), 1);
|
|
835138
835120
|
var import_form_data4 = __toESM(require_form_data(), 1);
|
|
835139
|
-
var
|
|
835121
|
+
var import_promises84 = require("fs/promises");
|
|
835140
835122
|
var import_url_join23 = __toESM(require_url_join(), 1);
|
|
835141
835123
|
var import_util19 = require("util");
|
|
835142
835124
|
var import_zlib5 = require("zlib");
|
|
@@ -835189,7 +835171,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
835189
835171
|
fernignoreContents = "";
|
|
835190
835172
|
} else if (fernignorePath != null) {
|
|
835191
835173
|
try {
|
|
835192
|
-
fernignoreContents = await (0,
|
|
835174
|
+
fernignoreContents = await (0, import_promises84.readFile)(fernignorePath, "utf-8");
|
|
835193
835175
|
} catch (error50) {
|
|
835194
835176
|
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`);
|
|
835195
835177
|
}
|
|
@@ -835415,9 +835397,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context3 })
|
|
|
835415
835397
|
init_lib4();
|
|
835416
835398
|
init_lib6();
|
|
835417
835399
|
var import_fs26 = require("fs");
|
|
835418
|
-
var
|
|
835400
|
+
var import_promises85 = require("fs/promises");
|
|
835419
835401
|
var import_path57 = __toESM(require("path"), 1);
|
|
835420
|
-
var
|
|
835402
|
+
var import_promises86 = require("stream/promises");
|
|
835421
835403
|
|
|
835422
835404
|
// ../../../node_modules/.pnpm/terminal-link@3.0.0/node_modules/terminal-link/index.js
|
|
835423
835405
|
var import_supports_hyperlinks = __toESM(require_supports_hyperlinks(), 1);
|
|
@@ -835586,9 +835568,9 @@ async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutpu
|
|
|
835586
835568
|
});
|
|
835587
835569
|
const tmpDir = await import_tmp_promise9.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
835588
835570
|
const outputZipPath = import_path57.default.join(tmpDir.path, "output.zip");
|
|
835589
|
-
await (0,
|
|
835571
|
+
await (0, import_promises86.pipeline)(request7.data, (0, import_fs26.createWriteStream)(outputZipPath));
|
|
835590
835572
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
835591
|
-
await (0,
|
|
835573
|
+
await (0, import_promises85.mkdir)(absolutePathToLocalOutput, { recursive: true });
|
|
835592
835574
|
await extractZipToDirectory(outputZipPath, absolutePathToLocalOutput);
|
|
835593
835575
|
}
|
|
835594
835576
|
async function forceRemoveDirectory(dirPath) {
|
|
@@ -835596,22 +835578,22 @@ async function forceRemoveDirectory(dirPath) {
|
|
|
835596
835578
|
return;
|
|
835597
835579
|
}
|
|
835598
835580
|
await makeWritableRecursive(dirPath);
|
|
835599
|
-
await (0,
|
|
835581
|
+
await (0, import_promises85.rm)(dirPath, { recursive: true, force: true });
|
|
835600
835582
|
}
|
|
835601
835583
|
async function makeWritableRecursive(dirPath) {
|
|
835602
835584
|
try {
|
|
835603
|
-
const entries21 = await (0,
|
|
835585
|
+
const entries21 = await (0, import_promises85.readdir)(dirPath, { withFileTypes: true });
|
|
835604
835586
|
for (const entry of entries21) {
|
|
835605
835587
|
const fullPath = AbsoluteFilePath2.of(import_path57.default.join(dirPath, entry.name));
|
|
835606
835588
|
if (entry.isDirectory()) {
|
|
835607
835589
|
await makeWritableRecursive(fullPath);
|
|
835608
835590
|
}
|
|
835609
835591
|
try {
|
|
835610
|
-
await (0,
|
|
835592
|
+
await (0, import_promises85.chmod)(fullPath, 493);
|
|
835611
835593
|
} catch {
|
|
835612
835594
|
}
|
|
835613
835595
|
}
|
|
835614
|
-
await (0,
|
|
835596
|
+
await (0, import_promises85.chmod)(dirPath, 493);
|
|
835615
835597
|
} catch {
|
|
835616
835598
|
}
|
|
835617
835599
|
}
|
|
@@ -835657,7 +835639,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
835657
835639
|
const tmpOutputResolutionDir = AbsoluteFilePath2.of((await import_tmp_promise9.default.dir({})).path);
|
|
835658
835640
|
const absolutePathToFernignore = join2(absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME));
|
|
835659
835641
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
835660
|
-
await (0,
|
|
835642
|
+
await (0, import_promises85.cp)(absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
835661
835643
|
await runGitCommand(["init"], tmpOutputResolutionDir, context3);
|
|
835662
835644
|
await runGitCommand(["add", "."], tmpOutputResolutionDir, context3);
|
|
835663
835645
|
await runGitCommand([
|
|
@@ -835680,7 +835662,7 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
835680
835662
|
await runGitCommand(["restore", "."], tmpOutputResolutionDir, context3);
|
|
835681
835663
|
await forceRemoveDirectory(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")));
|
|
835682
835664
|
await forceRemoveDirectory(absolutePathToLocalOutput);
|
|
835683
|
-
await (0,
|
|
835665
|
+
await (0, import_promises85.cp)(tmpOutputResolutionDir, absolutePathToLocalOutput, { recursive: true });
|
|
835684
835666
|
}
|
|
835685
835667
|
async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
|
|
835686
835668
|
const request7 = await axios_default.get(s3PreSignedReadUrl, {
|
|
@@ -835688,7 +835670,7 @@ async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath
|
|
|
835688
835670
|
});
|
|
835689
835671
|
const tmpDir = await import_tmp_promise9.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
835690
835672
|
const outputZipPath = import_path57.default.join(tmpDir.path, "output.zip");
|
|
835691
|
-
await (0,
|
|
835673
|
+
await (0, import_promises86.pipeline)(request7.data, (0, import_fs26.createWriteStream)(outputZipPath));
|
|
835692
835674
|
await extractZipToDirectory(outputZipPath, outputPath);
|
|
835693
835675
|
}
|
|
835694
835676
|
async function extractZipToDirectory(zipPath, outputDir) {
|
|
@@ -835703,10 +835685,10 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
835703
835685
|
zipFile.on("entry", (entry) => {
|
|
835704
835686
|
const outputPath = import_path57.default.join(outputDir, entry.fileName);
|
|
835705
835687
|
if (entry.fileName.endsWith("/")) {
|
|
835706
|
-
(0,
|
|
835688
|
+
(0, import_promises85.mkdir)(outputPath, { recursive: true }).then(() => zipFile.readEntry()).catch(reject);
|
|
835707
835689
|
return;
|
|
835708
835690
|
}
|
|
835709
|
-
(0,
|
|
835691
|
+
(0, import_promises85.mkdir)(import_path57.default.dirname(outputPath), { recursive: true }).then(() => {
|
|
835710
835692
|
zipFile.openReadStream(entry, (streamErr, readStream2) => {
|
|
835711
835693
|
if (streamErr || !readStream2) {
|
|
835712
835694
|
reject(streamErr ?? new Error("Failed to open read stream"));
|
|
@@ -835723,7 +835705,7 @@ async function extractZipToDirectory(zipPath, outputDir) {
|
|
|
835723
835705
|
|
|
835724
835706
|
// ../generation/remote-generation/remote-workspace-runner/lib/SourceUploader.js
|
|
835725
835707
|
init_lib6();
|
|
835726
|
-
var
|
|
835708
|
+
var import_promises87 = require("fs/promises");
|
|
835727
835709
|
var import_tmp_promise10 = __toESM(require_tmp_promise(), 1);
|
|
835728
835710
|
var PROTOBUF_ZIP_FILENAME = "proto.zip";
|
|
835729
835711
|
var SourceUploader = class {
|
|
@@ -835744,7 +835726,7 @@ var SourceUploader = class {
|
|
|
835744
835726
|
}
|
|
835745
835727
|
async uploadSource(source2, uploadURL) {
|
|
835746
835728
|
const uploadCommand = await this.getUploadCommand(source2);
|
|
835747
|
-
const fileData = await (0,
|
|
835729
|
+
const fileData = await (0, import_promises87.readFile)(uploadCommand.absoluteFilePath);
|
|
835748
835730
|
const response = await fetch(uploadURL, {
|
|
835749
835731
|
method: "PUT",
|
|
835750
835732
|
body: fileData,
|
|
@@ -835764,7 +835746,7 @@ var SourceUploader = class {
|
|
|
835764
835746
|
absoluteFilePath,
|
|
835765
835747
|
cleanup: async () => {
|
|
835766
835748
|
this.context.logger.debug(`Removing ${absoluteFilePath}`);
|
|
835767
|
-
await (0,
|
|
835749
|
+
await (0, import_promises87.unlink)(absoluteFilePath);
|
|
835768
835750
|
}
|
|
835769
835751
|
};
|
|
835770
835752
|
}
|
|
@@ -836206,7 +836188,7 @@ init_lib4();
|
|
|
836206
836188
|
init_js();
|
|
836207
836189
|
init_lib6();
|
|
836208
836190
|
var import_crypto10 = require("crypto");
|
|
836209
|
-
var
|
|
836191
|
+
var import_promises88 = require("fs/promises");
|
|
836210
836192
|
init_lodash();
|
|
836211
836193
|
var mime = __toESM(require_mime_types(), 1);
|
|
836212
836194
|
|
|
@@ -836285,7 +836267,7 @@ async function unlockDeploy({ fdrOrigin, token, domain: domain3, basepath }) {
|
|
|
836285
836267
|
}
|
|
836286
836268
|
}
|
|
836287
836269
|
async function calculateFileHash(absoluteFilePath) {
|
|
836288
|
-
const fileBuffer = await (0,
|
|
836270
|
+
const fileBuffer = await (0, import_promises88.readFile)(absoluteFilePath);
|
|
836289
836271
|
return (0, import_crypto10.createHash)("sha256").update(new Uint8Array(fileBuffer)).digest("hex");
|
|
836290
836272
|
}
|
|
836291
836273
|
function sanitizeRelativePathForS3(relativeFilePath) {
|
|
@@ -836631,7 +836613,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
836631
836613
|
const absoluteFilePath = sanitizedToAbsoluteMap.get(key2) || resolve5(docsWorkspacePath, RelativeFilePath2.of(key2));
|
|
836632
836614
|
try {
|
|
836633
836615
|
const mimeType = mime.lookup(absoluteFilePath);
|
|
836634
|
-
await axios_default.put(uploadUrl, await (0,
|
|
836616
|
+
await axios_default.put(uploadUrl, await (0, import_promises88.readFile)(absoluteFilePath), {
|
|
836635
836617
|
headers: {
|
|
836636
836618
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
836637
836619
|
// Set max cache control for S3 uploads
|
|
@@ -837210,7 +837192,7 @@ var LegacyDocsPublisher = class {
|
|
|
837210
837192
|
previewId: void 0,
|
|
837211
837193
|
disableTemplates: void 0,
|
|
837212
837194
|
skipUpload,
|
|
837213
|
-
cliVersion: "4.50.
|
|
837195
|
+
cliVersion: "4.50.4"
|
|
837214
837196
|
});
|
|
837215
837197
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
837216
837198
|
return { success: false };
|
|
@@ -838086,7 +838068,7 @@ function addDocsCommand(cli) {
|
|
|
838086
838068
|
// ../cli-v2/lib/commands/init/command.js
|
|
838087
838069
|
init_lib4();
|
|
838088
838070
|
init_lib6();
|
|
838089
|
-
var
|
|
838071
|
+
var import_promises89 = require("fs/promises");
|
|
838090
838072
|
var import_path59 = __toESM(require("path"), 1);
|
|
838091
838073
|
|
|
838092
838074
|
// ../cli-v2/lib/config/fern-yml/FernYmlBuilder.js
|
|
@@ -838961,7 +838943,7 @@ var InitCommand = class {
|
|
|
838961
838943
|
apiPath,
|
|
838962
838944
|
defaultGroup: result.defaultGroup
|
|
838963
838945
|
});
|
|
838964
|
-
await (0,
|
|
838946
|
+
await (0, import_promises89.writeFile)(fernYmlPath, fernYmlContent, "utf-8");
|
|
838965
838947
|
context3.stderr.info(`
|
|
838966
838948
|
${Icons.success} Created ${FERN_YML_FILENAME}`);
|
|
838967
838949
|
}
|
|
@@ -838983,9 +838965,9 @@ var InitCommand = class {
|
|
|
838983
838965
|
}
|
|
838984
838966
|
async writeSpecFile(cwd2, filename, content5) {
|
|
838985
838967
|
const specsDir = join2(cwd2, RelativeFilePath2.of(SPECS_DIR));
|
|
838986
|
-
await (0,
|
|
838968
|
+
await (0, import_promises89.mkdir)(specsDir, { recursive: true });
|
|
838987
838969
|
const filePath = join2(specsDir, RelativeFilePath2.of(filename));
|
|
838988
|
-
await (0,
|
|
838970
|
+
await (0, import_promises89.writeFile)(filePath, content5, "utf-8");
|
|
838989
838971
|
}
|
|
838990
838972
|
resolveApiPath(apiSource) {
|
|
838991
838973
|
switch (apiSource.type) {
|
|
@@ -839465,11 +839447,11 @@ function addCheckCommand4(cli) {
|
|
|
839465
839447
|
// ../cli-v2/lib/commands/sdk/generate/command.js
|
|
839466
839448
|
init_lib4();
|
|
839467
839449
|
init_lib6();
|
|
839468
|
-
var
|
|
839450
|
+
var import_promises107 = require("fs/promises");
|
|
839469
839451
|
|
|
839470
839452
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
839471
839453
|
init_lib6();
|
|
839472
|
-
var
|
|
839454
|
+
var import_promises90 = require("fs/promises");
|
|
839473
839455
|
var import_os11 = require("os");
|
|
839474
839456
|
var import_path60 = __toESM(require("path"), 1);
|
|
839475
839457
|
|
|
@@ -839517,9 +839499,9 @@ var ApiSpecResolver = class {
|
|
|
839517
839499
|
async resolveUrl({ reference: reference4 }) {
|
|
839518
839500
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
839519
839501
|
const extension5 = this.inferExtension({ url: reference4, contentType });
|
|
839520
|
-
const tempDir2 = await (0,
|
|
839502
|
+
const tempDir2 = await (0, import_promises90.mkdtemp)(import_path60.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
839521
839503
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path60.default.join(tempDir2, `spec${extension5}`));
|
|
839522
|
-
await (0,
|
|
839504
|
+
await (0, import_promises90.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
839523
839505
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
839524
839506
|
return {
|
|
839525
839507
|
absoluteFilePath,
|
|
@@ -839532,7 +839514,7 @@ var ApiSpecResolver = class {
|
|
|
839532
839514
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
839533
839515
|
throw new Error(`API spec file does not exist: ${reference4}`);
|
|
839534
839516
|
}
|
|
839535
|
-
const content5 = await (0,
|
|
839517
|
+
const content5 = await (0, import_promises90.readFile)(absoluteFilePath, "utf-8");
|
|
839536
839518
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
839537
839519
|
return {
|
|
839538
839520
|
absoluteFilePath,
|
|
@@ -839619,7 +839601,7 @@ var AutoVersioningCache = class {
|
|
|
839619
839601
|
|
|
839620
839602
|
// ../generation/local-generation/local-workspace-runner/lib/AutoVersioningService.js
|
|
839621
839603
|
var import_fs27 = require("fs");
|
|
839622
|
-
var
|
|
839604
|
+
var import_promises91 = require("fs/promises");
|
|
839623
839605
|
var import_path61 = require("path");
|
|
839624
839606
|
var AutoVersioningException = class extends Error {
|
|
839625
839607
|
constructor(message, cause) {
|
|
@@ -840274,7 +840256,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840274
840256
|
* Reads the module path from a go.mod file.
|
|
840275
840257
|
*/
|
|
840276
840258
|
async readGoModulePath(goModPath) {
|
|
840277
|
-
const content5 = await (0,
|
|
840259
|
+
const content5 = await (0, import_promises91.readFile)(goModPath, "utf-8");
|
|
840278
840260
|
for (const line of content5.split("\n")) {
|
|
840279
840261
|
const trimmed2 = line.trim();
|
|
840280
840262
|
if (trimmed2.startsWith("module ")) {
|
|
@@ -840287,7 +840269,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840287
840269
|
* Adds a version suffix to the module line in go.mod.
|
|
840288
840270
|
*/
|
|
840289
840271
|
async addSuffixToGoMod(goModPath, modulePath, suffix) {
|
|
840290
|
-
const content5 = await (0,
|
|
840272
|
+
const content5 = await (0, import_promises91.readFile)(goModPath, "utf-8");
|
|
840291
840273
|
const lines = content5.split("\n");
|
|
840292
840274
|
let changed = false;
|
|
840293
840275
|
for (let i11 = 0; i11 < lines.length; i11++) {
|
|
@@ -840299,7 +840281,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840299
840281
|
}
|
|
840300
840282
|
}
|
|
840301
840283
|
if (changed) {
|
|
840302
|
-
await (0,
|
|
840284
|
+
await (0, import_promises91.writeFile)(goModPath, lines.join("\n"), "utf-8");
|
|
840303
840285
|
this.logger.debug(`Updated go.mod: added ${suffix} to module path`);
|
|
840304
840286
|
}
|
|
840305
840287
|
}
|
|
@@ -840308,10 +840290,10 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840308
840290
|
*/
|
|
840309
840291
|
async walkDirectory(dir, filter8) {
|
|
840310
840292
|
const results = [];
|
|
840311
|
-
const entries21 = await (0,
|
|
840293
|
+
const entries21 = await (0, import_promises91.readdir)(dir);
|
|
840312
840294
|
for (const entry of entries21) {
|
|
840313
840295
|
const fullPath = (0, import_path61.join)(dir, entry);
|
|
840314
|
-
const entryStat = await (0,
|
|
840296
|
+
const entryStat = await (0, import_promises91.stat)(fullPath);
|
|
840315
840297
|
if (entryStat.isDirectory()) {
|
|
840316
840298
|
if (entry === ".git" || entry === "vendor") {
|
|
840317
840299
|
continue;
|
|
@@ -840338,7 +840320,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840338
840320
|
* Replaces occurrences of the module path with modulePath + suffix in import statements.
|
|
840339
840321
|
*/
|
|
840340
840322
|
async addSuffixToGoFile(filePath, modulePath, suffix) {
|
|
840341
|
-
const content5 = await (0,
|
|
840323
|
+
const content5 = await (0, import_promises91.readFile)(filePath, "utf-8");
|
|
840342
840324
|
const lines = content5.split("\n");
|
|
840343
840325
|
let changed = false;
|
|
840344
840326
|
let inImportBlock = false;
|
|
@@ -840367,7 +840349,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840367
840349
|
}
|
|
840368
840350
|
}
|
|
840369
840351
|
if (changed) {
|
|
840370
|
-
await (0,
|
|
840352
|
+
await (0, import_promises91.writeFile)(filePath, lines.join("\n"), "utf-8");
|
|
840371
840353
|
this.logger.debug(`Updated Go imports in ${filePath}`);
|
|
840372
840354
|
}
|
|
840373
840355
|
}
|
|
@@ -840420,7 +840402,7 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
840420
840402
|
};
|
|
840421
840403
|
|
|
840422
840404
|
// ../generation/local-generation/docker-utils/lib/runDocker.js
|
|
840423
|
-
var
|
|
840405
|
+
var import_promises92 = require("fs/promises");
|
|
840424
840406
|
var import_tmp_promise11 = __toESM(require_tmp_promise(), 1);
|
|
840425
840407
|
async function runContainer({ logger: logger4, imageName, args = [], binds = [], envVars = {}, ports = {}, writeLogsToFile = true, removeAfterCompletion = false, runner, signal }) {
|
|
840426
840408
|
const tryRun = () => tryRunContainer({
|
|
@@ -840471,7 +840453,7 @@ async function tryRunContainer({ logger: logger4, imageName, args, binds, envVar
|
|
|
840471
840453
|
const logs4 = stdout + stderr;
|
|
840472
840454
|
if (writeLogsToFile) {
|
|
840473
840455
|
const tmpFile = await import_tmp_promise11.default.file();
|
|
840474
|
-
await (0,
|
|
840456
|
+
await (0, import_promises92.writeFile)(tmpFile.path, logs4);
|
|
840475
840457
|
logger4.info(`Generator logs here: ${tmpFile.path}`);
|
|
840476
840458
|
}
|
|
840477
840459
|
if (exitCode == null) {
|
|
@@ -858696,7 +858678,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
858696
858678
|
|
|
858697
858679
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
858698
858680
|
init_lib6();
|
|
858699
|
-
var
|
|
858681
|
+
var import_promises93 = require("fs/promises");
|
|
858700
858682
|
var import_path63 = __toESM(require("path"), 1);
|
|
858701
858683
|
|
|
858702
858684
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -858830,8 +858812,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
858830
858812
|
endpointId
|
|
858831
858813
|
});
|
|
858832
858814
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
858833
|
-
await (0,
|
|
858834
|
-
await (0,
|
|
858815
|
+
await (0, import_promises93.mkdir)(import_path63.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
858816
|
+
await (0, import_promises93.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
858835
858817
|
} catch (error50) {
|
|
858836
858818
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
858837
858819
|
}
|
|
@@ -858840,8 +858822,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
858840
858822
|
}
|
|
858841
858823
|
async initializeProject(outputDir) {
|
|
858842
858824
|
const absolutePathToOutputDir = join2(outputDir, RelativeFilePath2.of("src/SeedApi.DynamicSnippets"));
|
|
858843
|
-
await (0,
|
|
858844
|
-
await (0,
|
|
858825
|
+
await (0, import_promises93.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
858826
|
+
await (0, import_promises93.writeFile)(join2(absolutePathToOutputDir, RelativeFilePath2.of("SeedApi.DynamicSnippets.csproj")), PROJECT_FILE_CONTENT);
|
|
858845
858827
|
return absolutePathToOutputDir;
|
|
858846
858828
|
}
|
|
858847
858829
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -862237,7 +862219,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
862237
862219
|
};
|
|
862238
862220
|
|
|
862239
862221
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
862240
|
-
var
|
|
862222
|
+
var import_promises94 = require("fs/promises");
|
|
862241
862223
|
var import_path65 = __toESM(require("path"), 1);
|
|
862242
862224
|
var DynamicSnippetsGoTestGenerator = class {
|
|
862243
862225
|
context;
|
|
@@ -862266,8 +862248,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
862266
862248
|
endpointId
|
|
862267
862249
|
});
|
|
862268
862250
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
862269
|
-
await (0,
|
|
862270
|
-
await (0,
|
|
862251
|
+
await (0, import_promises94.mkdir)(import_path65.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
862252
|
+
await (0, import_promises94.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
862271
862253
|
} catch (error50) {
|
|
862272
862254
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
862273
862255
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -865635,7 +865617,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
865635
865617
|
};
|
|
865636
865618
|
|
|
865637
865619
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
865638
|
-
var
|
|
865620
|
+
var import_promises95 = require("fs/promises");
|
|
865639
865621
|
var import_path66 = __toESM(require("path"), 1);
|
|
865640
865622
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
865641
865623
|
context;
|
|
@@ -865670,8 +865652,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
865670
865652
|
endpointId
|
|
865671
865653
|
});
|
|
865672
865654
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
865673
|
-
await (0,
|
|
865674
|
-
await (0,
|
|
865655
|
+
await (0, import_promises95.mkdir)(import_path66.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
865656
|
+
await (0, import_promises95.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
865675
865657
|
} catch (error50) {
|
|
865676
865658
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
865677
865659
|
}
|
|
@@ -865698,7 +865680,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
865698
865680
|
const reportsPath = join2(outputDir, RelativeFilePath2.of("reports"));
|
|
865699
865681
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
865700
865682
|
if (buildReportsExists) {
|
|
865701
|
-
await (0,
|
|
865683
|
+
await (0, import_promises95.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
865702
865684
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
865703
865685
|
} else {
|
|
865704
865686
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -865712,7 +865694,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
865712
865694
|
}
|
|
865713
865695
|
async initializeProject(outputDir) {
|
|
865714
865696
|
const absolutePathToOutputDir = join2(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
865715
|
-
await (0,
|
|
865697
|
+
await (0, import_promises95.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
865716
865698
|
return absolutePathToOutputDir;
|
|
865717
865699
|
}
|
|
865718
865700
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -869091,7 +869073,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
869091
869073
|
};
|
|
869092
869074
|
|
|
869093
869075
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
869094
|
-
var
|
|
869076
|
+
var import_promises96 = require("fs/promises");
|
|
869095
869077
|
var import_path67 = __toESM(require("path"), 1);
|
|
869096
869078
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
869097
869079
|
context;
|
|
@@ -869120,8 +869102,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
869120
869102
|
endpointId
|
|
869121
869103
|
});
|
|
869122
869104
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
869123
|
-
await (0,
|
|
869124
|
-
await (0,
|
|
869105
|
+
await (0, import_promises96.mkdir)(import_path67.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
869106
|
+
await (0, import_promises96.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
869125
869107
|
} catch (error50) {
|
|
869126
869108
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
869127
869109
|
}
|
|
@@ -872289,7 +872271,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
872289
872271
|
};
|
|
872290
872272
|
|
|
872291
872273
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
872292
|
-
var
|
|
872274
|
+
var import_promises97 = require("fs/promises");
|
|
872293
872275
|
var import_path68 = __toESM(require("path"), 1);
|
|
872294
872276
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
872295
872277
|
context;
|
|
@@ -872318,8 +872300,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
872318
872300
|
endpointId
|
|
872319
872301
|
});
|
|
872320
872302
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
872321
|
-
await (0,
|
|
872322
|
-
await (0,
|
|
872303
|
+
await (0, import_promises97.mkdir)(import_path68.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
872304
|
+
await (0, import_promises97.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
872323
872305
|
} catch (error50) {
|
|
872324
872306
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
872325
872307
|
}
|
|
@@ -874916,7 +874898,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
874916
874898
|
};
|
|
874917
874899
|
|
|
874918
874900
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
874919
|
-
var
|
|
874901
|
+
var import_promises98 = require("fs/promises");
|
|
874920
874902
|
var import_path69 = __toESM(require("path"), 1);
|
|
874921
874903
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
874922
874904
|
context;
|
|
@@ -874945,8 +874927,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
874945
874927
|
endpointId
|
|
874946
874928
|
});
|
|
874947
874929
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
874948
|
-
await (0,
|
|
874949
|
-
await (0,
|
|
874930
|
+
await (0, import_promises98.mkdir)(import_path69.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
874931
|
+
await (0, import_promises98.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
874950
874932
|
} catch (error50) {
|
|
874951
874933
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
874952
874934
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -874962,7 +874944,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
874962
874944
|
};
|
|
874963
874945
|
|
|
874964
874946
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
874965
|
-
var
|
|
874947
|
+
var import_promises99 = require("fs/promises");
|
|
874966
874948
|
var import_node_path24 = __toESM(require("path"), 1);
|
|
874967
874949
|
init_lib6();
|
|
874968
874950
|
|
|
@@ -880170,8 +880152,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
880170
880152
|
absolutePathToOutputDir,
|
|
880171
880153
|
idx
|
|
880172
880154
|
});
|
|
880173
|
-
await (0,
|
|
880174
|
-
await (0,
|
|
880155
|
+
await (0, import_promises99.mkdir)(import_node_path24.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
880156
|
+
await (0, import_promises99.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
880175
880157
|
} catch (error50) {
|
|
880176
880158
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
880177
880159
|
}
|
|
@@ -880180,7 +880162,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
880180
880162
|
}
|
|
880181
880163
|
async initializeProject(outputDir) {
|
|
880182
880164
|
const absolutePathToOutputDir = join2(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
880183
|
-
await (0,
|
|
880165
|
+
await (0, import_promises99.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
880184
880166
|
return absolutePathToOutputDir;
|
|
880185
880167
|
}
|
|
880186
880168
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -880189,7 +880171,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
880189
880171
|
};
|
|
880190
880172
|
|
|
880191
880173
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
880192
|
-
var
|
|
880174
|
+
var import_promises100 = require("fs/promises");
|
|
880193
880175
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
880194
880176
|
init_lib6();
|
|
880195
880177
|
|
|
@@ -884674,8 +884656,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
884674
884656
|
absolutePathToOutputDir,
|
|
884675
884657
|
idx
|
|
884676
884658
|
});
|
|
884677
|
-
await (0,
|
|
884678
|
-
await (0,
|
|
884659
|
+
await (0, import_promises100.mkdir)(import_node_path25.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
884660
|
+
await (0, import_promises100.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
884679
884661
|
} catch (error50) {
|
|
884680
884662
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
884681
884663
|
}
|
|
@@ -884684,7 +884666,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
884684
884666
|
}
|
|
884685
884667
|
async initializeProject(outputDir) {
|
|
884686
884668
|
const absolutePathToOutputDir = join2(outputDir, RelativeFilePath2.of("Snippets"));
|
|
884687
|
-
await (0,
|
|
884669
|
+
await (0, import_promises100.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
884688
884670
|
return absolutePathToOutputDir;
|
|
884689
884671
|
}
|
|
884690
884672
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -887009,7 +886991,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
887009
886991
|
};
|
|
887010
886992
|
|
|
887011
886993
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
887012
|
-
var
|
|
886994
|
+
var import_promises101 = require("fs/promises");
|
|
887013
886995
|
var import_path70 = __toESM(require("path"), 1);
|
|
887014
886996
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
887015
886997
|
context;
|
|
@@ -887038,8 +887020,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
887038
887020
|
endpointId
|
|
887039
887021
|
});
|
|
887040
887022
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
887041
|
-
await (0,
|
|
887042
|
-
await (0,
|
|
887023
|
+
await (0, import_promises101.mkdir)(import_path70.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
887024
|
+
await (0, import_promises101.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
887043
887025
|
} catch (error50) {
|
|
887044
887026
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
887045
887027
|
}
|
|
@@ -887138,7 +887120,7 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir15, config
|
|
|
887138
887120
|
// ../generation/local-generation/local-workspace-runner/lib/runGenerator.js
|
|
887139
887121
|
init_lib6();
|
|
887140
887122
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
887141
|
-
var
|
|
887123
|
+
var import_promises103 = require("fs/promises");
|
|
887142
887124
|
var path70 = __toESM(require("path"), 1);
|
|
887143
887125
|
var import_path72 = require("path");
|
|
887144
887126
|
var import_tmp_promise13 = __toESM(require_tmp_promise(), 1);
|
|
@@ -887998,7 +887980,7 @@ function configureBamlClient(config5) {
|
|
|
887998
887980
|
init_lib4();
|
|
887999
887981
|
init_lib6();
|
|
888000
887982
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
888001
|
-
var
|
|
887983
|
+
var import_promises102 = require("fs/promises");
|
|
888002
887984
|
var import_os12 = require("os");
|
|
888003
887985
|
var import_path71 = require("path");
|
|
888004
887986
|
var import_semver12 = __toESM(require_semver2(), 1);
|
|
@@ -888175,7 +888157,7 @@ var LocalTaskHandler = class {
|
|
|
888175
888157
|
try {
|
|
888176
888158
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
888177
888159
|
diffFile = await this.generateDiffFile();
|
|
888178
|
-
const diffContent = await (0,
|
|
888160
|
+
const diffContent = await (0, import_promises102.readFile)(diffFile, "utf-8");
|
|
888179
888161
|
if (diffContent.trim().length === 0) {
|
|
888180
888162
|
this.context.logger.info("No changes detected in generated SDK");
|
|
888181
888163
|
return null;
|
|
@@ -888336,7 +888318,7 @@ var LocalTaskHandler = class {
|
|
|
888336
888318
|
} finally {
|
|
888337
888319
|
if (diffFile) {
|
|
888338
888320
|
try {
|
|
888339
|
-
await (0,
|
|
888321
|
+
await (0, import_promises102.rm)(diffFile);
|
|
888340
888322
|
} catch (cleanupError) {
|
|
888341
888323
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
888342
888324
|
}
|
|
@@ -888448,7 +888430,7 @@ var LocalTaskHandler = class {
|
|
|
888448
888430
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
888449
888431
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
888450
888432
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
888451
|
-
await (0,
|
|
888433
|
+
await (0, import_promises102.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
888452
888434
|
await this.runGitCommand(["init"], tmpOutputResolutionDir);
|
|
888453
888435
|
await this.runGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
888454
888436
|
await this.runGitCommand([
|
|
@@ -888470,17 +888452,17 @@ var LocalTaskHandler = class {
|
|
|
888470
888452
|
await this.runGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
888471
888453
|
await this.runGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
888472
888454
|
await this.runGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
888473
|
-
await (0,
|
|
888474
|
-
await (0,
|
|
888475
|
-
await (0,
|
|
888455
|
+
await (0, import_promises102.rm)(join2(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
888456
|
+
await (0, import_promises102.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
888457
|
+
await (0, import_promises102.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
888476
888458
|
}
|
|
888477
888459
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
888478
|
-
const contents = await (0,
|
|
888460
|
+
const contents = await (0, import_promises102.readdir)(this.absolutePathToLocalOutput);
|
|
888479
888461
|
const itemsToPreserve = [".git"];
|
|
888480
888462
|
if (await this.generatedOutputMissingReadme()) {
|
|
888481
888463
|
itemsToPreserve.push("README.md");
|
|
888482
888464
|
}
|
|
888483
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
888465
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises102.rm)(join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
888484
888466
|
force: true,
|
|
888485
888467
|
recursive: true
|
|
888486
888468
|
})));
|
|
@@ -888488,11 +888470,11 @@ var LocalTaskHandler = class {
|
|
|
888488
888470
|
}
|
|
888489
888471
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
888490
888472
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
888491
|
-
await (0,
|
|
888473
|
+
await (0, import_promises102.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
888492
888474
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
888493
888475
|
}
|
|
888494
888476
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
888495
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
888477
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises102.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
888496
888478
|
if (firstLocalOutputItem == null) {
|
|
888497
888479
|
return;
|
|
888498
888480
|
}
|
|
@@ -888500,15 +888482,15 @@ var LocalTaskHandler = class {
|
|
|
888500
888482
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
888501
888483
|
await (0, import_decompress2.default)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
888502
888484
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
888503
|
-
await (0,
|
|
888485
|
+
await (0, import_promises102.cp)(join2(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join2(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
888504
888486
|
}
|
|
888505
888487
|
} else {
|
|
888506
|
-
await (0,
|
|
888488
|
+
await (0, import_promises102.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
888507
888489
|
}
|
|
888508
888490
|
}
|
|
888509
888491
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
888510
888492
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
888511
|
-
await (0,
|
|
888493
|
+
await (0, import_promises102.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
888512
888494
|
}
|
|
888513
888495
|
/**
|
|
888514
888496
|
* Checks whether the generated output is missing README.md.
|
|
@@ -888517,7 +888499,7 @@ var LocalTaskHandler = class {
|
|
|
888517
888499
|
*/
|
|
888518
888500
|
async generatedOutputMissingReadme() {
|
|
888519
888501
|
try {
|
|
888520
|
-
const contents = await (0,
|
|
888502
|
+
const contents = await (0, import_promises102.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
888521
888503
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
888522
888504
|
return false;
|
|
888523
888505
|
}
|
|
@@ -888553,13 +888535,13 @@ var LocalTaskHandler = class {
|
|
|
888553
888535
|
async readPriorChangelog(maxEntries) {
|
|
888554
888536
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
888555
888537
|
try {
|
|
888556
|
-
const files = await (0,
|
|
888538
|
+
const files = await (0, import_promises102.readdir)(this.absolutePathToLocalOutput);
|
|
888557
888539
|
const changelogFile = files.find((f10) => f10.toLowerCase() === "changelog.md");
|
|
888558
888540
|
if (!changelogFile) {
|
|
888559
888541
|
return "";
|
|
888560
888542
|
}
|
|
888561
888543
|
const changelogPath = join2(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
888562
|
-
const content5 = await (0,
|
|
888544
|
+
const content5 = await (0, import_promises102.readFile)(changelogPath, "utf-8");
|
|
888563
888545
|
if (content5.trim().length === 0) {
|
|
888564
888546
|
return "";
|
|
888565
888547
|
}
|
|
@@ -888669,24 +888651,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
888669
888651
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
888670
888652
|
const configJsonFile = (0, import_path72.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
888671
888653
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
888672
|
-
await (0,
|
|
888654
|
+
await (0, import_promises103.writeFile)(configJsonFile, "");
|
|
888673
888655
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
888674
888656
|
const tmpOutputDirectory = (0, import_path72.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
888675
888657
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
888676
|
-
await (0,
|
|
888658
|
+
await (0, import_promises103.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
888677
888659
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
888678
888660
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
888679
888661
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
888680
888662
|
const snippetJsonFile = (0, import_path72.join)(workspaceTempDir.path, "snippet.json");
|
|
888681
888663
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
888682
|
-
await (0,
|
|
888664
|
+
await (0, import_promises103.writeFile)(snippetJsonFile, "");
|
|
888683
888665
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
888684
888666
|
}
|
|
888685
888667
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
888686
888668
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
888687
888669
|
const snippetTemplatesJsonFile = (0, import_path72.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
888688
888670
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
888689
|
-
await (0,
|
|
888671
|
+
await (0, import_promises103.writeFile)(snippetTemplatesJsonFile, "");
|
|
888690
888672
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
888691
888673
|
}
|
|
888692
888674
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -888725,7 +888707,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
888725
888707
|
publishToRegistry,
|
|
888726
888708
|
paths
|
|
888727
888709
|
});
|
|
888728
|
-
await (0,
|
|
888710
|
+
await (0, import_promises103.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
888729
888711
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
888730
888712
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
888731
888713
|
hostPath: source2.absoluteFilePath,
|
|
@@ -889326,14 +889308,14 @@ var GenerationRunner = class {
|
|
|
889326
889308
|
};
|
|
889327
889309
|
|
|
889328
889310
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
889329
|
-
var
|
|
889311
|
+
var import_promises105 = require("fs/promises");
|
|
889330
889312
|
|
|
889331
889313
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
889332
889314
|
init_lib4();
|
|
889333
889315
|
init_lib6();
|
|
889334
889316
|
init_lib7();
|
|
889335
889317
|
var import_fiddle_sdk6 = __toESM(require_fiddle_sdk(), 1);
|
|
889336
|
-
var
|
|
889318
|
+
var import_promises104 = require("fs/promises");
|
|
889337
889319
|
var LegacyGeneratorInvocationAdapter = class {
|
|
889338
889320
|
context;
|
|
889339
889321
|
constructor(config5) {
|
|
@@ -889566,7 +889548,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
889566
889548
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
889567
889549
|
throw new Error(`Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`);
|
|
889568
889550
|
}
|
|
889569
|
-
const contents = await (0,
|
|
889551
|
+
const contents = await (0, import_promises104.readFile)(absolutePath, "utf-8");
|
|
889570
889552
|
return import_fiddle_sdk6.FernFiddle.GithubLicense.custom({ contents });
|
|
889571
889553
|
}
|
|
889572
889554
|
buildReadme(target) {
|
|
@@ -889788,7 +889770,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
889788
889770
|
});
|
|
889789
889771
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
889790
889772
|
const snippetPath = join2(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
889791
|
-
await (0,
|
|
889773
|
+
await (0, import_promises105.rm)(snippetPath, { force: true });
|
|
889792
889774
|
}
|
|
889793
889775
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
889794
889776
|
return {
|
|
@@ -889805,7 +889787,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
889805
889787
|
// ../cli-v2/lib/sdk/generator/LegacyRemoteGenerationRunner.js
|
|
889806
889788
|
init_lib4();
|
|
889807
889789
|
init_lib6();
|
|
889808
|
-
var
|
|
889790
|
+
var import_promises106 = require("fs/promises");
|
|
889809
889791
|
var import_os14 = require("os");
|
|
889810
889792
|
var LegacyRemoteGenerationRunner = class {
|
|
889811
889793
|
context;
|
|
@@ -889860,13 +889842,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
889860
889842
|
const previewOutputDirectory = join2(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
889861
889843
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
889862
889844
|
if (targetOutputDirectory != null) {
|
|
889863
|
-
await (0,
|
|
889864
|
-
await (0,
|
|
889845
|
+
await (0, import_promises106.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
889846
|
+
await (0, import_promises106.rm)(join2(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
889865
889847
|
recursive: true,
|
|
889866
889848
|
force: true
|
|
889867
889849
|
});
|
|
889868
889850
|
}
|
|
889869
|
-
await (0,
|
|
889851
|
+
await (0, import_promises106.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
889870
889852
|
}
|
|
889871
889853
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
889872
889854
|
return {
|
|
@@ -889895,7 +889877,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
889895
889877
|
}
|
|
889896
889878
|
async getAbsolutePathToPreview(args) {
|
|
889897
889879
|
if (this.isLocalGitCombo(args)) {
|
|
889898
|
-
const tmpPreviewDirectory = await (0,
|
|
889880
|
+
const tmpPreviewDirectory = await (0, import_promises106.mkdtemp)(join2(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
889899
889881
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
889900
889882
|
}
|
|
889901
889883
|
if (!args.preview) {
|
|
@@ -890531,7 +890513,7 @@ Example:
|
|
|
890531
890513
|
if (!exists2) {
|
|
890532
890514
|
return { shouldProceed: true };
|
|
890533
890515
|
}
|
|
890534
|
-
const files = await (0,
|
|
890516
|
+
const files = await (0, import_promises107.readdir)(outputPath);
|
|
890535
890517
|
if (files.length === 0) {
|
|
890536
890518
|
return { shouldProceed: true };
|
|
890537
890519
|
}
|
|
@@ -890743,7 +890725,7 @@ init_lib4();
|
|
|
890743
890725
|
// ../cli-v2/lib/sdk/updater/GeneratorMigrator.js
|
|
890744
890726
|
init_lib4();
|
|
890745
890727
|
var import_fs28 = require("fs");
|
|
890746
|
-
var
|
|
890728
|
+
var import_promises108 = require("fs/promises");
|
|
890747
890729
|
var import_path75 = require("path");
|
|
890748
890730
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
890749
890731
|
var import_url8 = require("url");
|
|
@@ -890852,7 +890834,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890852
890834
|
}
|
|
890853
890835
|
this.migrationsInstallPromise = (async () => {
|
|
890854
890836
|
const cacheDir = this.cachePath;
|
|
890855
|
-
await (0,
|
|
890837
|
+
await (0, import_promises108.mkdir)(cacheDir, { recursive: true });
|
|
890856
890838
|
const npmCacheDir = (0, import_path75.join)(cacheDir, ".npm-cache");
|
|
890857
890839
|
const packageDir = (0, import_path75.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
890858
890840
|
const packageJsonPath = (0, import_path75.join)(packageDir, "package.json");
|
|
@@ -890869,7 +890851,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890869
890851
|
"--no-audit",
|
|
890870
890852
|
"--no-fund"
|
|
890871
890853
|
], { doNotPipeOutput: true });
|
|
890872
|
-
const packageJsonContent = await (0,
|
|
890854
|
+
const packageJsonContent = await (0, import_promises108.readFile)(packageJsonPath, "utf-8");
|
|
890873
890855
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
890874
890856
|
if (packageJson2.main == null) {
|
|
890875
890857
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`);
|
|
@@ -890911,7 +890893,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890911
890893
|
const myPid = String(process.pid);
|
|
890912
890894
|
while (true) {
|
|
890913
890895
|
try {
|
|
890914
|
-
const fh = await (0,
|
|
890896
|
+
const fh = await (0, import_promises108.open)(lockPath, "wx");
|
|
890915
890897
|
await fh.writeFile(myPid);
|
|
890916
890898
|
await fh.close();
|
|
890917
890899
|
const exitHandler = () => {
|
|
@@ -890928,9 +890910,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890928
890910
|
return async () => {
|
|
890929
890911
|
process.removeListener("exit", exitHandler);
|
|
890930
890912
|
try {
|
|
890931
|
-
const currentContent = await (0,
|
|
890913
|
+
const currentContent = await (0, import_promises108.readFile)(lockPath, "utf-8");
|
|
890932
890914
|
if (currentContent.trim() === myPid) {
|
|
890933
|
-
await (0,
|
|
890915
|
+
await (0, import_promises108.unlink)(lockPath);
|
|
890934
890916
|
} else {
|
|
890935
890917
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
890936
890918
|
}
|
|
@@ -890944,14 +890926,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
890944
890926
|
throw err;
|
|
890945
890927
|
}
|
|
890946
890928
|
try {
|
|
890947
|
-
const lockContent = await (0,
|
|
890929
|
+
const lockContent = await (0, import_promises108.readFile)(lockPath, "utf-8");
|
|
890948
890930
|
const lockPid = Number(lockContent.trim());
|
|
890949
|
-
const lockStat = await (0,
|
|
890931
|
+
const lockStat = await (0, import_promises108.stat)(lockPath);
|
|
890950
890932
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
890951
890933
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
890952
890934
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
890953
890935
|
try {
|
|
890954
|
-
await (0,
|
|
890936
|
+
await (0, import_promises108.unlink)(lockPath);
|
|
890955
890937
|
} catch (unlinkErr) {
|
|
890956
890938
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
890957
890939
|
}
|
|
@@ -891423,13 +891405,13 @@ var import_generator_cli2 = __toESM(require_api5(), 1);
|
|
|
891423
891405
|
|
|
891424
891406
|
// ../init/lib/initializeAPI.js
|
|
891425
891407
|
init_lib6();
|
|
891426
|
-
var
|
|
891408
|
+
var import_promises112 = require("fs/promises");
|
|
891427
891409
|
var import_fs_extra = __toESM(require_lib19(), 1);
|
|
891428
891410
|
var import_path76 = __toESM(require("path"), 1);
|
|
891429
891411
|
|
|
891430
891412
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
891431
891413
|
init_lib6();
|
|
891432
|
-
var
|
|
891414
|
+
var import_promises109 = require("fs/promises");
|
|
891433
891415
|
init_lodash();
|
|
891434
891416
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
891435
891417
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -891459,7 +891441,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
891459
891441
|
}
|
|
891460
891442
|
}
|
|
891461
891443
|
}
|
|
891462
|
-
await (0,
|
|
891444
|
+
await (0, import_promises109.mkdir)(FERN_DIRECTORY);
|
|
891463
891445
|
await writeProjectConfig({
|
|
891464
891446
|
filepath: join2(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
891465
891447
|
organization,
|
|
@@ -891483,11 +891465,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
891483
891465
|
organization,
|
|
891484
891466
|
version: versionOfCli
|
|
891485
891467
|
};
|
|
891486
|
-
await (0,
|
|
891468
|
+
await (0, import_promises109.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
891487
891469
|
}
|
|
891488
891470
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
891489
891471
|
const gitignorePath = join2(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
891490
|
-
await (0,
|
|
891472
|
+
await (0, import_promises109.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
891491
891473
|
}
|
|
891492
891474
|
|
|
891493
891475
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -891676,7 +891658,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
891676
891658
|
|
|
891677
891659
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
891678
891660
|
init_lib4();
|
|
891679
|
-
var
|
|
891661
|
+
var import_promises110 = require("fs/promises");
|
|
891680
891662
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
891681
891663
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
891682
891664
|
const formatted = await formatDefinitionFile({
|
|
@@ -891684,7 +891666,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
891684
891666
|
});
|
|
891685
891667
|
if (formatted !== file4.rawContents) {
|
|
891686
891668
|
if (shouldFix) {
|
|
891687
|
-
await (0,
|
|
891669
|
+
await (0, import_promises110.writeFile)(file4.absoluteFilePath, formatted);
|
|
891688
891670
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
891689
891671
|
} else {
|
|
891690
891672
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -891696,7 +891678,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
891696
891678
|
|
|
891697
891679
|
// ../init/lib/createWorkspace.js
|
|
891698
891680
|
init_lib6();
|
|
891699
|
-
var
|
|
891681
|
+
var import_promises111 = require("fs/promises");
|
|
891700
891682
|
|
|
891701
891683
|
// ../init/lib/sampleImdbApi.js
|
|
891702
891684
|
var SAMPLE_IMDB_API = `
|
|
@@ -891896,7 +891878,7 @@ components:
|
|
|
891896
891878
|
// ../init/lib/createWorkspace.js
|
|
891897
891879
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
891898
891880
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
891899
|
-
await (0,
|
|
891881
|
+
await (0, import_promises111.mkdir)(directoryOfWorkspace);
|
|
891900
891882
|
}
|
|
891901
891883
|
await writeGeneratorsConfiguration({
|
|
891902
891884
|
filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -891911,7 +891893,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
891911
891893
|
}
|
|
891912
891894
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
891913
891895
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
891914
|
-
await (0,
|
|
891896
|
+
await (0, import_promises111.mkdir)(directoryOfWorkspace);
|
|
891915
891897
|
}
|
|
891916
891898
|
await writeGeneratorsConfiguration({
|
|
891917
891899
|
filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -891924,10 +891906,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
891924
891906
|
}
|
|
891925
891907
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
891926
891908
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
891927
|
-
await (0,
|
|
891909
|
+
await (0, import_promises111.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
891928
891910
|
}
|
|
891929
891911
|
const openApiFilePath = join2(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
891930
|
-
await (0,
|
|
891912
|
+
await (0, import_promises111.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
891931
891913
|
await writeGeneratorsConfiguration({
|
|
891932
891914
|
filepath: join2(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
891933
891915
|
cliVersion,
|
|
@@ -891972,7 +891954,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
891972
891954
|
return config5;
|
|
891973
891955
|
}
|
|
891974
891956
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
891975
|
-
await (0,
|
|
891957
|
+
await (0, import_promises111.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
891976
891958
|
sortKeys: (a10, b19) => {
|
|
891977
891959
|
if (a10 === "api") {
|
|
891978
891960
|
return -1;
|
|
@@ -891991,10 +891973,10 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
891991
891973
|
strategy: "status-code"
|
|
891992
891974
|
}
|
|
891993
891975
|
};
|
|
891994
|
-
await (0,
|
|
891995
|
-
await (0,
|
|
891976
|
+
await (0, import_promises111.mkdir)(directoryOfDefinition);
|
|
891977
|
+
await (0, import_promises111.writeFile)(join2(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
891996
891978
|
const absoluteFilepathToImdbYaml = join2(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
891997
|
-
await (0,
|
|
891979
|
+
await (0, import_promises111.writeFile)(absoluteFilepathToImdbYaml, await formatDefinitionFile({
|
|
891998
891980
|
fileContents: SAMPLE_IMDB_API
|
|
891999
891981
|
}));
|
|
892000
891982
|
}
|
|
@@ -892047,7 +892029,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
892047
892029
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
892048
892030
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
892049
892031
|
const apiWorkspaceDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
892050
|
-
await (0,
|
|
892032
|
+
await (0, import_promises112.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
892051
892033
|
if (inlinedApiDefinition) {
|
|
892052
892034
|
const inlinedDefinitionDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
892053
892035
|
const workspaceDefinitionDirectory = join2(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -892084,7 +892066,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
892084
892066
|
// ../init/lib/initializeDocs.js
|
|
892085
892067
|
init_lib4();
|
|
892086
892068
|
init_lib6();
|
|
892087
|
-
var
|
|
892069
|
+
var import_promises113 = require("fs/promises");
|
|
892088
892070
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
892089
892071
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
892090
892072
|
organization,
|
|
@@ -892099,7 +892081,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
892099
892081
|
} else {
|
|
892100
892082
|
try {
|
|
892101
892083
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
892102
|
-
await (0,
|
|
892084
|
+
await (0, import_promises113.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
892103
892085
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
892104
892086
|
return;
|
|
892105
892087
|
} catch (writeError) {
|
|
@@ -892154,7 +892136,7 @@ var FernDocsBuilder = class {
|
|
|
892154
892136
|
|
|
892155
892137
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
892156
892138
|
init_lib6();
|
|
892157
|
-
var
|
|
892139
|
+
var import_promises114 = require("fs/promises");
|
|
892158
892140
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
892159
892141
|
openApiSpecs = {};
|
|
892160
892142
|
nonTabbedNavigation = new NonTabbedNavigationBuilderImpl();
|
|
@@ -892213,7 +892195,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
892213
892195
|
}
|
|
892214
892196
|
async build({ outputDirectory }) {
|
|
892215
892197
|
const absolutePathToFernDirectory = join2(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
892216
|
-
await (0,
|
|
892198
|
+
await (0, import_promises114.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
892217
892199
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
892218
892200
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value]) => {
|
|
892219
892201
|
return [value.tabId, value.tabConfig];
|
|
@@ -892238,27 +892220,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
892238
892220
|
}))
|
|
892239
892221
|
};
|
|
892240
892222
|
}
|
|
892241
|
-
await (0,
|
|
892223
|
+
await (0, import_promises114.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
892242
892224
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
892243
892225
|
const absolutePathToOpenAPI = join2(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
892244
|
-
await (0,
|
|
892245
|
-
await (0,
|
|
892226
|
+
await (0, import_promises114.mkdir)(dirname4(absolutePathToOpenAPI), { recursive: true });
|
|
892227
|
+
await (0, import_promises114.cp)(absolutePath, absolutePathToOpenAPI);
|
|
892246
892228
|
}));
|
|
892247
892229
|
}
|
|
892248
|
-
await (0,
|
|
892230
|
+
await (0, import_promises114.writeFile)(join2(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
892249
892231
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
892250
892232
|
const absoluteFilepathToMarkdownPage = join2(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
892251
|
-
await (0,
|
|
892233
|
+
await (0, import_promises114.mkdir)(dirname4(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
892252
892234
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
892253
892235
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
892254
892236
|
|
|
892255
892237
|
` : "";
|
|
892256
|
-
await (0,
|
|
892238
|
+
await (0, import_promises114.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
892257
892239
|
}));
|
|
892258
892240
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
892259
892241
|
const absolutePathToAsset = join2(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
892260
|
-
await (0,
|
|
892261
|
-
await (0,
|
|
892242
|
+
await (0, import_promises114.mkdir)(dirname4(absolutePathToAsset), { recursive: true });
|
|
892243
|
+
await (0, import_promises114.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
892262
892244
|
}));
|
|
892263
892245
|
}
|
|
892264
892246
|
setInstance({ companyName }) {
|
|
@@ -892291,7 +892273,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
892291
892273
|
|
|
892292
892274
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
892293
892275
|
init_lib6();
|
|
892294
|
-
var
|
|
892276
|
+
var import_promises116 = require("fs/promises");
|
|
892295
892277
|
|
|
892296
892278
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
892297
892279
|
function convertColors(colors19) {
|
|
@@ -892352,10 +892334,10 @@ init_lib6();
|
|
|
892352
892334
|
|
|
892353
892335
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
892354
892336
|
init_lib6();
|
|
892355
|
-
var
|
|
892337
|
+
var import_promises115 = require("fs/promises");
|
|
892356
892338
|
var import_gray_matter9 = __toESM(require_gray_matter(), 1);
|
|
892357
892339
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
892358
|
-
const text9 = await (0,
|
|
892340
|
+
const text9 = await (0, import_promises115.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
892359
892341
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
892360
892342
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
892361
892343
|
const transformedContent = markReferencedAssets({
|
|
@@ -892518,7 +892500,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
892518
892500
|
documentationTab = void 0;
|
|
892519
892501
|
tabUrlToInfo = {};
|
|
892520
892502
|
async import({ args, builder }) {
|
|
892521
|
-
const mintJsonContent = await (0,
|
|
892503
|
+
const mintJsonContent = await (0, import_promises116.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
892522
892504
|
const mint = JSON.parse(mintJsonContent);
|
|
892523
892505
|
builder.setTitle({ title: mint.name });
|
|
892524
892506
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -892644,7 +892626,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
892644
892626
|
|
|
892645
892627
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
892646
892628
|
init_lib6();
|
|
892647
|
-
var
|
|
892629
|
+
var import_promises117 = require("fs/promises");
|
|
892648
892630
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
892649
892631
|
const mintlifyImporter = new MintlifyImporter({
|
|
892650
892632
|
context: taskContext
|
|
@@ -892655,7 +892637,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
892655
892637
|
builder
|
|
892656
892638
|
});
|
|
892657
892639
|
await builder.build({ outputDirectory: outputPath });
|
|
892658
|
-
await (0,
|
|
892640
|
+
await (0, import_promises117.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
892659
892641
|
version: versionOfCli,
|
|
892660
892642
|
organization
|
|
892661
892643
|
}, void 0, 4));
|
|
@@ -892709,7 +892691,7 @@ function assertIsStringArray(val) {
|
|
|
892709
892691
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
892710
892692
|
init_lib4();
|
|
892711
892693
|
init_lib6();
|
|
892712
|
-
var
|
|
892694
|
+
var import_promises122 = require("fs/promises");
|
|
892713
892695
|
|
|
892714
892696
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
892715
892697
|
async function getFavicon(hast) {
|
|
@@ -904127,7 +904109,7 @@ init_disposable();
|
|
|
904127
904109
|
init_incremental_id_generator();
|
|
904128
904110
|
|
|
904129
904111
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
904130
|
-
var
|
|
904112
|
+
var import_promises120 = require("fs/promises");
|
|
904131
904113
|
var import_node_os11 = __toESM(require("os"), 1);
|
|
904132
904114
|
var import_node_path35 = __toESM(require("path"), 1);
|
|
904133
904115
|
init_main();
|
|
@@ -904571,7 +904553,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
904571
904553
|
});
|
|
904572
904554
|
if (userDataDirIndex < 0) {
|
|
904573
904555
|
isTempUserDataDir = true;
|
|
904574
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
904556
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises120.mkdtemp)(this.getProfilePath())}`);
|
|
904575
904557
|
userDataDirIndex = chromeArguments.length - 1;
|
|
904576
904558
|
}
|
|
904577
904559
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -904728,7 +904710,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
904728
904710
|
|
|
904729
904711
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
904730
904712
|
var import_node_fs28 = __toESM(require("fs"), 1);
|
|
904731
|
-
var
|
|
904713
|
+
var import_promises121 = require("fs/promises");
|
|
904732
904714
|
var import_node_os12 = __toESM(require("os"), 1);
|
|
904733
904715
|
var import_node_path36 = __toESM(require("path"), 1);
|
|
904734
904716
|
init_main();
|
|
@@ -904782,7 +904764,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
904782
904764
|
}
|
|
904783
904765
|
isTempUserDataDir = false;
|
|
904784
904766
|
} else {
|
|
904785
|
-
userDataDir = await (0,
|
|
904767
|
+
userDataDir = await (0, import_promises121.mkdtemp)(this.getProfilePath());
|
|
904786
904768
|
firefoxArguments.push("--profile");
|
|
904787
904769
|
firefoxArguments.push(userDataDir);
|
|
904788
904770
|
}
|
|
@@ -904823,8 +904805,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
904823
904805
|
const prefsBackupPath = import_node_path36.default.join(userDataDir, file4 + backupSuffix);
|
|
904824
904806
|
if (import_node_fs28.default.existsSync(prefsBackupPath)) {
|
|
904825
904807
|
const prefsPath = import_node_path36.default.join(userDataDir, file4);
|
|
904826
|
-
await (0,
|
|
904827
|
-
await (0,
|
|
904808
|
+
await (0, import_promises121.unlink)(prefsPath);
|
|
904809
|
+
await (0, import_promises121.rename)(prefsBackupPath, prefsPath);
|
|
904828
904810
|
}
|
|
904829
904811
|
}));
|
|
904830
904812
|
for (const result of results) {
|
|
@@ -905857,7 +905839,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905857
905839
|
if (response.ok) {
|
|
905858
905840
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
905859
905841
|
const faviconPath = join2(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
905860
|
-
await (0,
|
|
905842
|
+
await (0, import_promises122.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
905861
905843
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
905862
905844
|
}
|
|
905863
905845
|
}
|
|
@@ -905874,7 +905856,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905874
905856
|
*/
|
|
905875
905857
|
async getAndCreateAssetsDirectory() {
|
|
905876
905858
|
const assetsDirectory = join2(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
905877
|
-
await (0,
|
|
905859
|
+
await (0, import_promises122.mkdir)(assetsDirectory, { recursive: true });
|
|
905878
905860
|
return assetsDirectory;
|
|
905879
905861
|
}
|
|
905880
905862
|
/**
|
|
@@ -905924,7 +905906,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905924
905906
|
absolutePathToOutputDirectory,
|
|
905925
905907
|
section
|
|
905926
905908
|
});
|
|
905927
|
-
await (0,
|
|
905909
|
+
await (0, import_promises122.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
905928
905910
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
905929
905911
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
905930
905912
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -905939,7 +905921,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905939
905921
|
absolutePathToOutputDirectoryForSection,
|
|
905940
905922
|
page: page.slug
|
|
905941
905923
|
});
|
|
905942
|
-
await (0,
|
|
905924
|
+
await (0, import_promises122.writeFile)(absolutePathForPage, result.data.mdx);
|
|
905943
905925
|
if (result.data.images.imageURLs.length > 0) {
|
|
905944
905926
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
905945
905927
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -905952,8 +905934,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
905952
905934
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
905953
905935
|
const imagePath = join2(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
905954
905936
|
const imageDir = dirname4(imagePath);
|
|
905955
|
-
await (0,
|
|
905956
|
-
await (0,
|
|
905937
|
+
await (0, import_promises122.mkdir)(imageDir, { recursive: true });
|
|
905938
|
+
await (0, import_promises122.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
905957
905939
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
905958
905940
|
} catch (error50) {
|
|
905959
905941
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -906036,7 +906018,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
906036
906018
|
|
|
906037
906019
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
906038
906020
|
init_lib6();
|
|
906039
|
-
var
|
|
906021
|
+
var import_promises123 = require("fs/promises");
|
|
906040
906022
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
906041
906023
|
const builder = new FernDocsBuilderImpl();
|
|
906042
906024
|
builder.setInstance({ companyName: organization });
|
|
@@ -906051,7 +906033,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
906051
906033
|
builder
|
|
906052
906034
|
});
|
|
906053
906035
|
await builder.build({ outputDirectory: outputPath });
|
|
906054
|
-
await (0,
|
|
906036
|
+
await (0, import_promises123.writeFile)(join2(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
906055
906037
|
version: versionOfCli,
|
|
906056
906038
|
organization
|
|
906057
906039
|
}, void 0, 4));
|
|
@@ -906074,7 +906056,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
906074
906056
|
};
|
|
906075
906057
|
|
|
906076
906058
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
906077
|
-
var
|
|
906059
|
+
var import_promises124 = require("fs/promises");
|
|
906078
906060
|
var import_path77 = require("path");
|
|
906079
906061
|
var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
|
|
906080
906062
|
var LoadOpenAPIStatus;
|
|
@@ -906089,7 +906071,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
906089
906071
|
const filePath = (0, import_path77.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
906090
906072
|
logger4.debug("tmpDir", tmpDir.path);
|
|
906091
906073
|
logger4.debug("filePath", filePath);
|
|
906092
|
-
await (0,
|
|
906074
|
+
await (0, import_promises124.writeFile)(filePath, data2);
|
|
906093
906075
|
return {
|
|
906094
906076
|
status: LoadOpenAPIStatus.Success,
|
|
906095
906077
|
filePath
|
|
@@ -910329,7 +910311,7 @@ var CliContext = class {
|
|
|
910329
910311
|
if (false) {
|
|
910330
910312
|
this.logger.error("CLI_VERSION is not defined");
|
|
910331
910313
|
}
|
|
910332
|
-
return "4.50.
|
|
910314
|
+
return "4.50.4";
|
|
910333
910315
|
}
|
|
910334
910316
|
getCliName() {
|
|
910335
910317
|
if (false) {
|
|
@@ -910615,7 +910597,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
910615
910597
|
|
|
910616
910598
|
// ../project-loader/lib/loadProject.js
|
|
910617
910599
|
init_lib6();
|
|
910618
|
-
var
|
|
910600
|
+
var import_promises125 = require("fs/promises");
|
|
910619
910601
|
async function loadProject({ context: context3, nameOverride, ...args }) {
|
|
910620
910602
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
910621
910603
|
if (fernDirectory == null) {
|
|
@@ -910678,7 +910660,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
910678
910660
|
const apisDirectory = join2(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
910679
910661
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
910680
910662
|
if (apisDirectoryExists) {
|
|
910681
|
-
const apiDirectoryContents = await (0,
|
|
910663
|
+
const apiDirectoryContents = await (0, import_promises125.readdir)(apisDirectory, { withFileTypes: true });
|
|
910682
910664
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
910683
910665
|
if (item.isDirectory()) {
|
|
910684
910666
|
all9.push(item.name);
|
|
@@ -910755,11 +910737,11 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
910755
910737
|
|
|
910756
910738
|
// src/cliV2.ts
|
|
910757
910739
|
var import_generators_sdk5 = __toESM(require_generators_sdk(), 1);
|
|
910758
|
-
var
|
|
910740
|
+
var import_promises130 = require("fs/promises");
|
|
910759
910741
|
|
|
910760
910742
|
// src/commands/generator-list/getGeneratorList.ts
|
|
910761
910743
|
init_lib4();
|
|
910762
|
-
var
|
|
910744
|
+
var import_promises126 = require("fs/promises");
|
|
910763
910745
|
var GenerationModeFilter = {
|
|
910764
910746
|
GitHub: "github",
|
|
910765
910747
|
Local: "local-file-system",
|
|
@@ -910819,7 +910801,7 @@ async function getGeneratorList({
|
|
|
910819
910801
|
return;
|
|
910820
910802
|
}
|
|
910821
910803
|
try {
|
|
910822
|
-
await (0,
|
|
910804
|
+
await (0, import_promises126.writeFile)(outputLocation, generatorsListYaml);
|
|
910823
910805
|
} catch (error50) {
|
|
910824
910806
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50);
|
|
910825
910807
|
}
|
|
@@ -910885,7 +910867,7 @@ async function getGeneratorMetadata({
|
|
|
910885
910867
|
}
|
|
910886
910868
|
|
|
910887
910869
|
// src/commands/organization/getOrganization.ts
|
|
910888
|
-
var
|
|
910870
|
+
var import_promises127 = require("fs/promises");
|
|
910889
910871
|
async function getOrganization({
|
|
910890
910872
|
project,
|
|
910891
910873
|
outputLocation,
|
|
@@ -910897,7 +910879,7 @@ async function getOrganization({
|
|
|
910897
910879
|
return;
|
|
910898
910880
|
}
|
|
910899
910881
|
try {
|
|
910900
|
-
await (0,
|
|
910882
|
+
await (0, import_promises127.writeFile)(outputLocation, org);
|
|
910901
910883
|
} catch (error50) {
|
|
910902
910884
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50);
|
|
910903
910885
|
}
|
|
@@ -910905,7 +910887,7 @@ async function getOrganization({
|
|
|
910905
910887
|
|
|
910906
910888
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
910907
910889
|
init_lib6();
|
|
910908
|
-
var
|
|
910890
|
+
var import_promises129 = require("fs/promises");
|
|
910909
910891
|
var import_path79 = __toESM(require("path"), 1);
|
|
910910
910892
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
910911
910893
|
var import_yaml6 = __toESM(require_dist8(), 1);
|
|
@@ -910913,7 +910895,7 @@ var import_yaml6 = __toESM(require_dist8(), 1);
|
|
|
910913
910895
|
// src/commands/upgrade/migrations/loader.ts
|
|
910914
910896
|
init_lib4();
|
|
910915
910897
|
var import_fs31 = require("fs");
|
|
910916
|
-
var
|
|
910898
|
+
var import_promises128 = require("fs/promises");
|
|
910917
910899
|
var import_os15 = require("os");
|
|
910918
910900
|
var import_path78 = require("path");
|
|
910919
910901
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -910941,7 +910923,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
910941
910923
|
const myPid = String(process.pid);
|
|
910942
910924
|
while (true) {
|
|
910943
910925
|
try {
|
|
910944
|
-
const fh = await (0,
|
|
910926
|
+
const fh = await (0, import_promises128.open)(lockPath, "wx");
|
|
910945
910927
|
await fh.writeFile(myPid);
|
|
910946
910928
|
await fh.close();
|
|
910947
910929
|
const exitHandler = () => {
|
|
@@ -910958,9 +910940,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
910958
910940
|
return async () => {
|
|
910959
910941
|
process.removeListener("exit", exitHandler);
|
|
910960
910942
|
try {
|
|
910961
|
-
const currentContent = await (0,
|
|
910943
|
+
const currentContent = await (0, import_promises128.readFile)(lockPath, "utf-8");
|
|
910962
910944
|
if (currentContent.trim() === myPid) {
|
|
910963
|
-
await (0,
|
|
910945
|
+
await (0, import_promises128.unlink)(lockPath);
|
|
910964
910946
|
} else {
|
|
910965
910947
|
logger4.debug(
|
|
910966
910948
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -910976,14 +910958,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
910976
910958
|
throw err;
|
|
910977
910959
|
}
|
|
910978
910960
|
try {
|
|
910979
|
-
const lockContent = await (0,
|
|
910961
|
+
const lockContent = await (0, import_promises128.readFile)(lockPath, "utf-8");
|
|
910980
910962
|
const lockPid = Number(lockContent.trim());
|
|
910981
|
-
const lockStat = await (0,
|
|
910963
|
+
const lockStat = await (0, import_promises128.stat)(lockPath);
|
|
910982
910964
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
910983
910965
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
910984
910966
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
910985
910967
|
try {
|
|
910986
|
-
await (0,
|
|
910968
|
+
await (0, import_promises128.unlink)(lockPath);
|
|
910987
910969
|
} catch (unlinkErr) {
|
|
910988
910970
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
910989
910971
|
}
|
|
@@ -911007,7 +910989,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
911007
910989
|
}
|
|
911008
910990
|
migrationsInstallPromise = (async () => {
|
|
911009
910991
|
const cacheDir = getMigrationCacheDir();
|
|
911010
|
-
await (0,
|
|
910992
|
+
await (0, import_promises128.mkdir)(cacheDir, { recursive: true });
|
|
911011
910993
|
const npmCacheDir = (0, import_path78.join)(cacheDir, ".npm-cache");
|
|
911012
910994
|
const packageDir = (0, import_path78.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
911013
910995
|
const packageJsonPath = (0, import_path78.join)(packageDir, "package.json");
|
|
@@ -911024,7 +911006,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
911024
911006
|
"--no-audit",
|
|
911025
911007
|
"--no-fund"
|
|
911026
911008
|
]);
|
|
911027
|
-
const packageJsonContent = await (0,
|
|
911009
|
+
const packageJsonContent = await (0, import_promises128.readFile)(packageJsonPath, "utf-8");
|
|
911028
911010
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
911029
911011
|
if (packageJson2.main == null) {
|
|
911030
911012
|
throw new Error(`No main field found in package.json for ${MIGRATION_PACKAGE_NAME2}`);
|
|
@@ -911199,7 +911181,7 @@ async function loadAndUpdateGenerators({
|
|
|
911199
911181
|
skippedAutoreleaseDisabled: []
|
|
911200
911182
|
};
|
|
911201
911183
|
}
|
|
911202
|
-
const contents = await (0,
|
|
911184
|
+
const contents = await (0, import_promises129.readFile)(filepath);
|
|
911203
911185
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
911204
911186
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
911205
911187
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -911420,7 +911402,7 @@ async function upgradeGenerator({
|
|
|
911420
911402
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
911421
911403
|
});
|
|
911422
911404
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
911423
|
-
await (0,
|
|
911405
|
+
await (0, import_promises129.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
911424
911406
|
}
|
|
911425
911407
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
911426
911408
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -911818,7 +911800,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
911818
911800
|
}
|
|
911819
911801
|
if (argv.output) {
|
|
911820
911802
|
try {
|
|
911821
|
-
await (0,
|
|
911803
|
+
await (0, import_promises130.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
911822
911804
|
} catch (error50) {
|
|
911823
911805
|
cliContext.failAndThrow(
|
|
911824
911806
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -911832,7 +911814,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
911832
911814
|
}
|
|
911833
911815
|
|
|
911834
911816
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
911835
|
-
var
|
|
911817
|
+
var import_promises131 = require("fs/promises");
|
|
911836
911818
|
async function addGeneratorToWorkspaces({
|
|
911837
911819
|
project: { apiWorkspaces },
|
|
911838
911820
|
generatorName,
|
|
@@ -911859,7 +911841,7 @@ async function addGeneratorToWorkspaces({
|
|
|
911859
911841
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
911860
911842
|
return;
|
|
911861
911843
|
}
|
|
911862
|
-
await (0,
|
|
911844
|
+
await (0, import_promises131.writeFile)(
|
|
911863
911845
|
absolutePathToGeneratorsConfiguration,
|
|
911864
911846
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
911865
911847
|
);
|
|
@@ -912210,7 +912192,7 @@ async function previewDocsWorkspace({
|
|
|
912210
912192
|
|
|
912211
912193
|
// src/commands/docs-diff/docsDiff.ts
|
|
912212
912194
|
init_lib6();
|
|
912213
|
-
var
|
|
912195
|
+
var import_promises132 = require("fs/promises");
|
|
912214
912196
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
912215
912197
|
async function getSlugForFiles({
|
|
912216
912198
|
previewUrl,
|
|
@@ -912430,8 +912412,8 @@ async function generateComparisons({
|
|
|
912430
912412
|
afterPath,
|
|
912431
912413
|
comparisonBasePath
|
|
912432
912414
|
}) {
|
|
912433
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
912434
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
912415
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises132.readFile)(beforePath));
|
|
912416
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises132.readFile)(afterPath));
|
|
912435
912417
|
const beforeOriginalHeight = beforePng.height;
|
|
912436
912418
|
const afterOriginalHeight = afterPng.height;
|
|
912437
912419
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -912469,7 +912451,7 @@ async function generateComparisons({
|
|
|
912469
912451
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
912470
912452
|
const outPath = `${base4}-region-${i11 + 1}.png`;
|
|
912471
912453
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
912472
|
-
await (0,
|
|
912454
|
+
await (0, import_promises132.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
912473
912455
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
912474
912456
|
}
|
|
912475
912457
|
return results;
|
|
@@ -912544,7 +912526,7 @@ async function docsDiff({
|
|
|
912544
912526
|
outputDir.startsWith("/") ? outputDir : join2(cwd(), RelativeFilePath2.of(outputDir))
|
|
912545
912527
|
);
|
|
912546
912528
|
if (!await doesPathExist(outputPath)) {
|
|
912547
|
-
await (0,
|
|
912529
|
+
await (0, import_promises132.mkdir)(outputPath, { recursive: true });
|
|
912548
912530
|
}
|
|
912549
912531
|
const results = [];
|
|
912550
912532
|
await cliContext.runTask(async (context3) => {
|
|
@@ -916941,7 +916923,7 @@ function renderModuleTree(module4, ctx, writer2, parentPath) {
|
|
|
916941
916923
|
}
|
|
916942
916924
|
|
|
916943
916925
|
// src/commands/docs-md-generate/generateLibraryDocs.ts
|
|
916944
|
-
var
|
|
916926
|
+
var import_promises133 = require("fs/promises");
|
|
916945
916927
|
function createLibraryDocsClient({ token }) {
|
|
916946
916928
|
const defaultOrigin = "https://registry-dev2.buildwithfern.com";
|
|
916947
916929
|
const baseUrl = process.env.FERN_FDR_ORIGIN ?? process.env.OVERRIDE_FDR_ORIGIN ?? defaultOrigin;
|
|
@@ -917055,7 +917037,7 @@ async function generateSingleLibrary({
|
|
|
917055
917037
|
if (config5.lang === "cpp" && config5.config?.doxyfile != null) {
|
|
917056
917038
|
const doxyfilePath = resolve5(docsWorkspace.absoluteFilePath, config5.config.doxyfile);
|
|
917057
917039
|
try {
|
|
917058
|
-
doxyfileContent = await (0,
|
|
917040
|
+
doxyfileContent = await (0, import_promises133.readFile)(doxyfilePath, "utf-8");
|
|
917059
917041
|
} catch {
|
|
917060
917042
|
return interactiveTaskContext.failAndThrow(
|
|
917061
917043
|
`Library '${name2}': Could not read Doxyfile at '${config5.config.doxyfile}' (resolved to ${doxyfilePath})`
|
|
@@ -917316,7 +917298,7 @@ Found ${previewDeployments.length} preview deployment(s):
|
|
|
917316
917298
|
}
|
|
917317
917299
|
|
|
917318
917300
|
// src/commands/downgrade/downgrade.ts
|
|
917319
|
-
var
|
|
917301
|
+
var import_promises134 = require("fs/promises");
|
|
917320
917302
|
|
|
917321
917303
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
917322
917304
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -918063,13 +918045,13 @@ async function downgrade({
|
|
|
918063
918045
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
918064
918046
|
draft.version = targetVersion;
|
|
918065
918047
|
});
|
|
918066
|
-
await (0,
|
|
918048
|
+
await (0, import_promises134.writeFile)(projectConfig._absolutePath, ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
918067
918049
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
918068
918050
|
}
|
|
918069
918051
|
|
|
918070
918052
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
918071
918053
|
init_lib6();
|
|
918072
|
-
var
|
|
918054
|
+
var import_promises135 = require("fs/promises");
|
|
918073
918055
|
|
|
918074
918056
|
// src/commands/export/converters/servicesConverter.ts
|
|
918075
918057
|
init_lib4();
|
|
@@ -919400,8 +919382,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
919400
919382
|
ir: ir15,
|
|
919401
919383
|
mode: "openapi"
|
|
919402
919384
|
});
|
|
919403
|
-
await (0,
|
|
919404
|
-
await (0,
|
|
919385
|
+
await (0, import_promises135.mkdir)(dirname4(outputPath), { recursive: true });
|
|
919386
|
+
await (0, import_promises135.writeFile)(
|
|
919405
919387
|
outputPath,
|
|
919406
919388
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
919407
919389
|
);
|
|
@@ -919444,11 +919426,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
919444
919426
|
|
|
919445
919427
|
// src/commands/generate/checkOutputDirectory.ts
|
|
919446
919428
|
init_lib6();
|
|
919447
|
-
var
|
|
919429
|
+
var import_promises138 = require("fs/promises");
|
|
919448
919430
|
|
|
919449
919431
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
919450
919432
|
init_lib6();
|
|
919451
|
-
var
|
|
919433
|
+
var import_promises136 = require("fs/promises");
|
|
919452
919434
|
|
|
919453
919435
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
919454
919436
|
init_lib6();
|
|
@@ -919468,17 +919450,17 @@ async function getOutputDirectories() {
|
|
|
919468
919450
|
if (!doesOutputDirectoriesFileExist) {
|
|
919469
919451
|
return [];
|
|
919470
919452
|
}
|
|
919471
|
-
const outputDirectoriesFileContents = await (0,
|
|
919453
|
+
const outputDirectoriesFileContents = await (0, import_promises136.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
919472
919454
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
919473
919455
|
return outputDirectories;
|
|
919474
919456
|
}
|
|
919475
919457
|
|
|
919476
919458
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
919477
|
-
var
|
|
919459
|
+
var import_promises137 = require("fs/promises");
|
|
919478
919460
|
var import_path82 = __toESM(require("path"), 1);
|
|
919479
919461
|
async function storeOutputDirectories(outputDirectories) {
|
|
919480
|
-
await (0,
|
|
919481
|
-
await (0,
|
|
919462
|
+
await (0, import_promises137.mkdir)(import_path82.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
919463
|
+
await (0, import_promises137.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
919482
919464
|
}
|
|
919483
919465
|
|
|
919484
919466
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -919500,7 +919482,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
919500
919482
|
shouldProceed: true
|
|
919501
919483
|
};
|
|
919502
919484
|
}
|
|
919503
|
-
const files = await (0,
|
|
919485
|
+
const files = await (0, import_promises138.readdir)(outputPath);
|
|
919504
919486
|
if (files.length === 0) {
|
|
919505
919487
|
return {
|
|
919506
919488
|
shouldProceed: true
|
|
@@ -920349,7 +920331,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
920349
920331
|
|
|
920350
920332
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
920351
920333
|
init_lib6();
|
|
920352
|
-
var
|
|
920334
|
+
var import_promises139 = require("fs/promises");
|
|
920353
920335
|
async function compareOpenAPISpecs({
|
|
920354
920336
|
originalPath,
|
|
920355
920337
|
modifiedPath,
|
|
@@ -920386,12 +920368,12 @@ async function compareOpenAPISpecs({
|
|
|
920386
920368
|
}
|
|
920387
920369
|
outputPath = join2(dirname4(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
920388
920370
|
}
|
|
920389
|
-
await (0,
|
|
920371
|
+
await (0, import_promises139.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
920390
920372
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
920391
920373
|
});
|
|
920392
920374
|
}
|
|
920393
920375
|
async function loadSpec2(filepath, context3) {
|
|
920394
|
-
const contents = await (0,
|
|
920376
|
+
const contents = await (0, import_promises139.readFile)(filepath, "utf8");
|
|
920395
920377
|
try {
|
|
920396
920378
|
return JSON.parse(contents);
|
|
920397
920379
|
} catch {
|
|
@@ -920493,7 +920475,7 @@ function deepEqual(a10, b19) {
|
|
|
920493
920475
|
|
|
920494
920476
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
920495
920477
|
init_lib6();
|
|
920496
|
-
var
|
|
920478
|
+
var import_promises140 = require("fs/promises");
|
|
920497
920479
|
async function writeOverridesForWorkspaces({
|
|
920498
920480
|
project,
|
|
920499
920481
|
includeModels,
|
|
@@ -920518,7 +920500,7 @@ async function writeOverridesForWorkspaces({
|
|
|
920518
920500
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
920519
920501
|
let parsedOverrides = null;
|
|
920520
920502
|
try {
|
|
920521
|
-
const contents = (await (0,
|
|
920503
|
+
const contents = (await (0, import_promises140.readFile)(overridesFilepath, "utf8")).toString();
|
|
920522
920504
|
try {
|
|
920523
920505
|
parsedOverrides = JSON.parse(contents);
|
|
920524
920506
|
} catch (err) {
|
|
@@ -920581,7 +920563,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
920581
920563
|
for (const overridesPath of overridesPaths) {
|
|
920582
920564
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
920583
920565
|
const content5 = generateOverridesContent({ ir: ir15, existingOverrides, includeModels, context: context3 });
|
|
920584
|
-
await (0,
|
|
920566
|
+
await (0, import_promises140.writeFile)(overridesPath, jsYaml.dump(content5));
|
|
920585
920567
|
}
|
|
920586
920568
|
} else {
|
|
920587
920569
|
const content5 = generateOverridesContent({ ir: ir15, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -920595,7 +920577,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
920595
920577
|
overridesFilename = `${nameWithoutExt}-overrides${extension5}`;
|
|
920596
920578
|
}
|
|
920597
920579
|
}
|
|
920598
|
-
await (0,
|
|
920580
|
+
await (0, import_promises140.writeFile)(
|
|
920599
920581
|
join2(dirname4(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
920600
920582
|
jsYaml.dump(content5)
|
|
920601
920583
|
);
|
|
@@ -921009,7 +920991,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
921009
920991
|
}
|
|
921010
920992
|
|
|
921011
920993
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
921012
|
-
var
|
|
920994
|
+
var import_promises141 = require("fs/promises");
|
|
921013
920995
|
async function generateJsonschemaForWorkspaces({
|
|
921014
920996
|
typeLocator,
|
|
921015
920997
|
project,
|
|
@@ -921057,9 +921039,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
921057
921039
|
context: context3
|
|
921058
921040
|
});
|
|
921059
921041
|
if (!await doesPathExist(dirname4(jsonschemaFilepath))) {
|
|
921060
|
-
await (0,
|
|
921042
|
+
await (0, import_promises141.mkdir)(dirname4(jsonschemaFilepath), { recursive: true });
|
|
921061
921043
|
}
|
|
921062
|
-
await (0,
|
|
921044
|
+
await (0, import_promises141.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
921063
921045
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
921064
921046
|
});
|
|
921065
921047
|
})
|
|
@@ -921068,7 +921050,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
921068
921050
|
|
|
921069
921051
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
921070
921052
|
init_lib6();
|
|
921071
|
-
var
|
|
921053
|
+
var import_promises142 = require("fs/promises");
|
|
921072
921054
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
921073
921055
|
async function mergeOpenAPIWithOverrides({
|
|
921074
921056
|
openapiPath,
|
|
@@ -921089,12 +921071,12 @@ async function mergeOpenAPIWithOverrides({
|
|
|
921089
921071
|
const merged = mergeExamplesIntoSpec(openapi, overrides, context3);
|
|
921090
921072
|
const isJson = outputPath.endsWith(".json");
|
|
921091
921073
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : jsYaml.dump(merged, { lineWidth: -1, noRefs: true });
|
|
921092
|
-
await (0,
|
|
921074
|
+
await (0, import_promises142.writeFile)(outputPath, output2);
|
|
921093
921075
|
context3.logger.info(`Merged output written to ${outputPath}`);
|
|
921094
921076
|
});
|
|
921095
921077
|
}
|
|
921096
921078
|
async function loadYamlOrJson(filepath, context3) {
|
|
921097
|
-
const contents = await (0,
|
|
921079
|
+
const contents = await (0, import_promises142.readFile)(filepath, "utf8");
|
|
921098
921080
|
try {
|
|
921099
921081
|
return JSON.parse(contents);
|
|
921100
921082
|
} catch {
|
|
@@ -921722,7 +921704,7 @@ async function mockServer({
|
|
|
921722
921704
|
|
|
921723
921705
|
// src/commands/register/registerWorkspacesV1.ts
|
|
921724
921706
|
var import_fiddle_sdk8 = __toESM(require_fiddle_sdk(), 1);
|
|
921725
|
-
var
|
|
921707
|
+
var import_promises143 = require("fs/promises");
|
|
921726
921708
|
var import_path88 = __toESM(require("path"), 1);
|
|
921727
921709
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
921728
921710
|
async function registerWorkspacesV1({
|
|
@@ -921771,7 +921753,7 @@ async function registerWorkspacesV1({
|
|
|
921771
921753
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
921772
921754
|
await Zn3({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
921773
921755
|
context3.logger.info("Uploading definition...");
|
|
921774
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
921756
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises143.readFile)(tarPath));
|
|
921775
921757
|
context3.logger.info(
|
|
921776
921758
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
921777
921759
|
);
|
|
@@ -922228,7 +922210,7 @@ async function sdkPreview({
|
|
|
922228
922210
|
}
|
|
922229
922211
|
|
|
922230
922212
|
// src/commands/self-update/selfUpdate.ts
|
|
922231
|
-
var
|
|
922213
|
+
var import_promises144 = require("fs/promises");
|
|
922232
922214
|
var import_path89 = require("path");
|
|
922233
922215
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
922234
922216
|
let command3;
|
|
@@ -922274,7 +922256,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
922274
922256
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
922275
922257
|
let resolvedPath;
|
|
922276
922258
|
try {
|
|
922277
|
-
resolvedPath = await (0,
|
|
922259
|
+
resolvedPath = await (0, import_promises144.realpath)(fernPath);
|
|
922278
922260
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
922279
922261
|
} catch (error50) {
|
|
922280
922262
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -922556,21 +922538,21 @@ async function generateToken({
|
|
|
922556
922538
|
// src/commands/upgrade/updateApiSpec.ts
|
|
922557
922539
|
init_lib6();
|
|
922558
922540
|
var fs26 = __toESM(require("fs"), 1);
|
|
922559
|
-
var
|
|
922541
|
+
var import_promises145 = require("fs/promises");
|
|
922560
922542
|
init_graphql();
|
|
922561
922543
|
var import_stream16 = require("stream");
|
|
922562
|
-
var
|
|
922544
|
+
var import_promises146 = require("stream/promises");
|
|
922563
922545
|
async function fetchAndWriteFile(url3, path97, logger4, indent4) {
|
|
922564
922546
|
const resp = await fetch(url3);
|
|
922565
922547
|
if (resp.ok && resp.body) {
|
|
922566
922548
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
922567
922549
|
const fileStream = fs26.createWriteStream(path97);
|
|
922568
|
-
await (0,
|
|
922569
|
-
const fileContents = await (0,
|
|
922550
|
+
await (0, import_promises146.finished)(import_stream16.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
922551
|
+
const fileContents = await (0, import_promises145.readFile)(path97, "utf8");
|
|
922570
922552
|
try {
|
|
922571
|
-
await (0,
|
|
922553
|
+
await (0, import_promises145.writeFile)(path97, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
922572
922554
|
} catch (e6) {
|
|
922573
|
-
await (0,
|
|
922555
|
+
await (0, import_promises145.writeFile)(path97, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
922574
922556
|
}
|
|
922575
922557
|
logger4.debug("File written successfully");
|
|
922576
922558
|
}
|
|
@@ -922720,14 +922702,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
922720
922702
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path97, logger4) {
|
|
922721
922703
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
922722
922704
|
if (postResult.success) {
|
|
922723
|
-
await (0,
|
|
922705
|
+
await (0, import_promises145.writeFile)(path97, postResult.result, "utf8");
|
|
922724
922706
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
922725
922707
|
return;
|
|
922726
922708
|
}
|
|
922727
922709
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
922728
922710
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
922729
922711
|
if (getResult.success) {
|
|
922730
|
-
await (0,
|
|
922712
|
+
await (0, import_promises145.writeFile)(path97, getResult.result, "utf8");
|
|
922731
922713
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
922732
922714
|
return;
|
|
922733
922715
|
}
|
|
@@ -922836,7 +922818,7 @@ async function processDefinitions({
|
|
|
922836
922818
|
init_lib4();
|
|
922837
922819
|
|
|
922838
922820
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
922839
|
-
var
|
|
922821
|
+
var import_promises147 = require("fs/promises");
|
|
922840
922822
|
|
|
922841
922823
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
922842
922824
|
init_lib6();
|
|
@@ -922872,7 +922854,7 @@ var migration = {
|
|
|
922872
922854
|
try {
|
|
922873
922855
|
const fileContents = await getFileContents(yamlFilepath);
|
|
922874
922856
|
const newContents = addDiscriminantToFile(fileContents);
|
|
922875
|
-
await (0,
|
|
922857
|
+
await (0, import_promises147.writeFile)(yamlFilepath, newContents);
|
|
922876
922858
|
} catch (error50) {
|
|
922877
922859
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
922878
922860
|
}
|
|
@@ -922880,7 +922862,7 @@ var migration = {
|
|
|
922880
922862
|
}
|
|
922881
922863
|
};
|
|
922882
922864
|
async function getFileContents(filepath) {
|
|
922883
|
-
const buffer = await (0,
|
|
922865
|
+
const buffer = await (0, import_promises147.readFile)(filepath);
|
|
922884
922866
|
return buffer.toString();
|
|
922885
922867
|
}
|
|
922886
922868
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -922909,7 +922891,7 @@ var versionMigrations = {
|
|
|
922909
922891
|
var __default = versionMigrations;
|
|
922910
922892
|
|
|
922911
922893
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
922912
|
-
var
|
|
922894
|
+
var import_promises148 = require("fs/promises");
|
|
922913
922895
|
var import_yaml7 = __toESM(require_dist8(), 1);
|
|
922914
922896
|
|
|
922915
922897
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -922952,7 +922934,7 @@ var migration2 = {
|
|
|
922952
922934
|
}
|
|
922953
922935
|
};
|
|
922954
922936
|
async function migrateFile(filepath, context3) {
|
|
922955
|
-
const contents = await (0,
|
|
922937
|
+
const contents = await (0, import_promises148.readFile)(filepath);
|
|
922956
922938
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
922957
922939
|
const types4 = parsedDocument.get("types");
|
|
922958
922940
|
if (types4 == null) {
|
|
@@ -922984,7 +922966,7 @@ async function migrateFile(filepath, context3) {
|
|
|
922984
922966
|
}
|
|
922985
922967
|
}
|
|
922986
922968
|
}
|
|
922987
|
-
await (0,
|
|
922969
|
+
await (0, import_promises148.writeFile)(filepath, parsedDocument.toString());
|
|
922988
922970
|
}
|
|
922989
922971
|
|
|
922990
922972
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -922995,7 +922977,7 @@ var versionMigrations2 = {
|
|
|
922995
922977
|
var __default2 = versionMigrations2;
|
|
922996
922978
|
|
|
922997
922979
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
922998
|
-
var
|
|
922980
|
+
var import_promises149 = require("fs/promises");
|
|
922999
922981
|
var import_yaml8 = __toESM(require_dist8(), 1);
|
|
923000
922982
|
|
|
923001
922983
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -923038,7 +923020,7 @@ var migration3 = {
|
|
|
923038
923020
|
}
|
|
923039
923021
|
};
|
|
923040
923022
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
923041
|
-
const contents = await (0,
|
|
923023
|
+
const contents = await (0, import_promises149.readFile)(filepath);
|
|
923042
923024
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
923043
923025
|
const draftGenerators = parsedDocument.get("draft");
|
|
923044
923026
|
if (draftGenerators == null) {
|
|
@@ -923065,7 +923047,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
923065
923047
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
923066
923048
|
}
|
|
923067
923049
|
});
|
|
923068
|
-
await (0,
|
|
923050
|
+
await (0, import_promises149.writeFile)(filepath, parsedDocument.toString());
|
|
923069
923051
|
}
|
|
923070
923052
|
|
|
923071
923053
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -923076,7 +923058,7 @@ var versionMigrations3 = {
|
|
|
923076
923058
|
var __default3 = versionMigrations3;
|
|
923077
923059
|
|
|
923078
923060
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
923079
|
-
var
|
|
923061
|
+
var import_promises150 = require("fs/promises");
|
|
923080
923062
|
var import_yaml9 = __toESM(require_dist8(), 1);
|
|
923081
923063
|
|
|
923082
923064
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -923119,7 +923101,7 @@ var migration4 = {
|
|
|
923119
923101
|
}
|
|
923120
923102
|
};
|
|
923121
923103
|
async function migrateFile2(filepath, context3) {
|
|
923122
|
-
const contents = await (0,
|
|
923104
|
+
const contents = await (0, import_promises150.readFile)(filepath);
|
|
923123
923105
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
923124
923106
|
const addType = (typeName, typeDeclaration2) => {
|
|
923125
923107
|
const types4 = parsedDocument.get("types");
|
|
@@ -923163,7 +923145,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
923163
923145
|
}
|
|
923164
923146
|
}
|
|
923165
923147
|
}
|
|
923166
|
-
await (0,
|
|
923148
|
+
await (0, import_promises150.writeFile)(filepath, parsedDocument.toString());
|
|
923167
923149
|
}
|
|
923168
923150
|
|
|
923169
923151
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -923174,7 +923156,7 @@ var versionMigrations4 = {
|
|
|
923174
923156
|
var __default4 = versionMigrations4;
|
|
923175
923157
|
|
|
923176
923158
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
923177
|
-
var
|
|
923159
|
+
var import_promises151 = require("fs/promises");
|
|
923178
923160
|
var import_yaml10 = __toESM(require_dist8(), 1);
|
|
923179
923161
|
|
|
923180
923162
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -923217,7 +923199,7 @@ var migration5 = {
|
|
|
923217
923199
|
}
|
|
923218
923200
|
};
|
|
923219
923201
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
923220
|
-
const contents = await (0,
|
|
923202
|
+
const contents = await (0, import_promises151.readFile)(filepath);
|
|
923221
923203
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
923222
923204
|
const releaseGenerators = parsedDocument.get("release");
|
|
923223
923205
|
if (releaseGenerators == null) {
|
|
@@ -923255,7 +923237,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
923255
923237
|
}
|
|
923256
923238
|
releaseGenerator.delete("outputs");
|
|
923257
923239
|
});
|
|
923258
|
-
await (0,
|
|
923240
|
+
await (0, import_promises151.writeFile)(filepath, parsedDocument.toString());
|
|
923259
923241
|
}
|
|
923260
923242
|
|
|
923261
923243
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -923266,7 +923248,7 @@ var versionMigrations5 = {
|
|
|
923266
923248
|
var __default5 = versionMigrations5;
|
|
923267
923249
|
|
|
923268
923250
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
923269
|
-
var
|
|
923251
|
+
var import_promises152 = require("fs/promises");
|
|
923270
923252
|
|
|
923271
923253
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
923272
923254
|
init_lib6();
|
|
@@ -923299,9 +923281,9 @@ var migration6 = {
|
|
|
923299
923281
|
run: async ({ context: context3 }) => {
|
|
923300
923282
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
923301
923283
|
for (const filepath of yamlFiles) {
|
|
923302
|
-
const contents = await (0,
|
|
923284
|
+
const contents = await (0, import_promises152.readFile)(filepath);
|
|
923303
923285
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
923304
|
-
await (0,
|
|
923286
|
+
await (0, import_promises152.writeFile)(filepath, newContents);
|
|
923305
923287
|
}
|
|
923306
923288
|
}
|
|
923307
923289
|
};
|
|
@@ -923314,7 +923296,7 @@ var versionMigrations6 = {
|
|
|
923314
923296
|
var __default6 = versionMigrations6;
|
|
923315
923297
|
|
|
923316
923298
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
923317
|
-
var
|
|
923299
|
+
var import_promises153 = require("fs/promises");
|
|
923318
923300
|
|
|
923319
923301
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
923320
923302
|
init_lib6();
|
|
@@ -923347,9 +923329,9 @@ var migration7 = {
|
|
|
923347
923329
|
run: async ({ context: context3 }) => {
|
|
923348
923330
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
923349
923331
|
for (const filepath of yamlFiles) {
|
|
923350
|
-
const contents = await (0,
|
|
923332
|
+
const contents = await (0, import_promises153.readFile)(filepath);
|
|
923351
923333
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
923352
|
-
await (0,
|
|
923334
|
+
await (0, import_promises153.writeFile)(filepath, newContents);
|
|
923353
923335
|
}
|
|
923354
923336
|
}
|
|
923355
923337
|
};
|
|
@@ -923363,7 +923345,7 @@ var __default7 = versionMigrations7;
|
|
|
923363
923345
|
|
|
923364
923346
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
923365
923347
|
init_lib4();
|
|
923366
|
-
var
|
|
923348
|
+
var import_promises154 = require("fs/promises");
|
|
923367
923349
|
|
|
923368
923350
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
923369
923351
|
init_lib6();
|
|
@@ -923472,7 +923454,7 @@ var migration8 = {
|
|
|
923472
923454
|
}
|
|
923473
923455
|
};
|
|
923474
923456
|
async function migrateGeneratorsYml3(filepath) {
|
|
923475
|
-
const contentsStr = await (0,
|
|
923457
|
+
const contentsStr = await (0, import_promises154.readFile)(filepath);
|
|
923476
923458
|
const contents = jsYaml.load(contentsStr.toString());
|
|
923477
923459
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
923478
923460
|
let newGeneratorsConfiguration = {};
|
|
@@ -923490,7 +923472,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
923490
923472
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
923491
923473
|
};
|
|
923492
923474
|
}
|
|
923493
|
-
await (0,
|
|
923475
|
+
await (0, import_promises154.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
923494
923476
|
}
|
|
923495
923477
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
923496
923478
|
const newSchema = {
|
|
@@ -923565,7 +923547,7 @@ var versionMigrations8 = {
|
|
|
923565
923547
|
var __default8 = versionMigrations8;
|
|
923566
923548
|
|
|
923567
923549
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
923568
|
-
var
|
|
923550
|
+
var import_promises155 = require("fs/promises");
|
|
923569
923551
|
var import_yaml11 = __toESM(require_dist8(), 1);
|
|
923570
923552
|
|
|
923571
923553
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -923608,7 +923590,7 @@ var migration9 = {
|
|
|
923608
923590
|
}
|
|
923609
923591
|
};
|
|
923610
923592
|
async function migrateRootApiFile(filepath) {
|
|
923611
|
-
const contents = await (0,
|
|
923593
|
+
const contents = await (0, import_promises155.readFile)(filepath);
|
|
923612
923594
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
923613
923595
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
923614
923596
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -923619,7 +923601,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
923619
923601
|
"property-name": errorDiscriminant.value
|
|
923620
923602
|
});
|
|
923621
923603
|
parsedDocument.delete("error-discriminant");
|
|
923622
|
-
await (0,
|
|
923604
|
+
await (0, import_promises155.writeFile)(filepath, parsedDocument.toString());
|
|
923623
923605
|
}
|
|
923624
923606
|
|
|
923625
923607
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -923630,7 +923612,7 @@ var versionMigrations9 = {
|
|
|
923630
923612
|
var __default9 = versionMigrations9;
|
|
923631
923613
|
|
|
923632
923614
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
923633
|
-
var
|
|
923615
|
+
var import_promises156 = require("fs/promises");
|
|
923634
923616
|
var import_yaml12 = __toESM(require_dist8(), 1);
|
|
923635
923617
|
|
|
923636
923618
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -923673,7 +923655,7 @@ var migration10 = {
|
|
|
923673
923655
|
}
|
|
923674
923656
|
};
|
|
923675
923657
|
async function migrateYamlFile(filepath, context3) {
|
|
923676
|
-
const contents = await (0,
|
|
923658
|
+
const contents = await (0, import_promises156.readFile)(filepath);
|
|
923677
923659
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
923678
923660
|
const services = parsedDocument.get("services");
|
|
923679
923661
|
if (services == null) {
|
|
@@ -923713,7 +923695,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
923713
923695
|
context3.failWithoutThrowing("Failed to convert endpoint", e6);
|
|
923714
923696
|
}
|
|
923715
923697
|
}
|
|
923716
|
-
await (0,
|
|
923698
|
+
await (0, import_promises156.writeFile)(filepath, parsedDocument.toString());
|
|
923717
923699
|
}
|
|
923718
923700
|
}
|
|
923719
923701
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -923792,7 +923774,7 @@ var versionMigrations10 = {
|
|
|
923792
923774
|
var __default10 = versionMigrations10;
|
|
923793
923775
|
|
|
923794
923776
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
923795
|
-
var
|
|
923777
|
+
var import_promises157 = require("fs/promises");
|
|
923796
923778
|
var import_yaml13 = __toESM(require_dist8(), 1);
|
|
923797
923779
|
|
|
923798
923780
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -923835,7 +923817,7 @@ var migration11 = {
|
|
|
923835
923817
|
}
|
|
923836
923818
|
};
|
|
923837
923819
|
async function migrateYamlFile2(filepath, context3) {
|
|
923838
|
-
const contents = await (0,
|
|
923820
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
923839
923821
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
923840
923822
|
const types4 = parsedDocument.get("types");
|
|
923841
923823
|
if (types4 == null) {
|
|
@@ -923861,7 +923843,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
923861
923843
|
examples.set(i11, { value });
|
|
923862
923844
|
}
|
|
923863
923845
|
}
|
|
923864
|
-
await (0,
|
|
923846
|
+
await (0, import_promises157.writeFile)(filepath, parsedDocument.toString());
|
|
923865
923847
|
}
|
|
923866
923848
|
|
|
923867
923849
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -923872,7 +923854,7 @@ var versionMigrations11 = {
|
|
|
923872
923854
|
var __default11 = versionMigrations11;
|
|
923873
923855
|
|
|
923874
923856
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
923875
|
-
var
|
|
923857
|
+
var import_promises158 = require("fs/promises");
|
|
923876
923858
|
var import_yaml14 = __toESM(require_dist8(), 1);
|
|
923877
923859
|
|
|
923878
923860
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -923915,7 +923897,7 @@ var migration12 = {
|
|
|
923915
923897
|
}
|
|
923916
923898
|
};
|
|
923917
923899
|
async function migrateYamlFile3(filepath, context3) {
|
|
923918
|
-
const contents = await (0,
|
|
923900
|
+
const contents = await (0, import_promises158.readFile)(filepath);
|
|
923919
923901
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
923920
923902
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
923921
923903
|
return context3.failAndThrow("File is not a map");
|
|
@@ -923945,7 +923927,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
923945
923927
|
pair.value = firstService.value;
|
|
923946
923928
|
}
|
|
923947
923929
|
}
|
|
923948
|
-
await (0,
|
|
923930
|
+
await (0, import_promises158.writeFile)(filepath, parsedDocument.toString());
|
|
923949
923931
|
}
|
|
923950
923932
|
|
|
923951
923933
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -923956,7 +923938,7 @@ var versionMigrations12 = {
|
|
|
923956
923938
|
var __default12 = versionMigrations12;
|
|
923957
923939
|
|
|
923958
923940
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
923959
|
-
var
|
|
923941
|
+
var import_promises159 = require("fs/promises");
|
|
923960
923942
|
var import_yaml15 = __toESM(require_dist8(), 1);
|
|
923961
923943
|
|
|
923962
923944
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -923999,7 +923981,7 @@ var migration13 = {
|
|
|
923999
923981
|
}
|
|
924000
923982
|
};
|
|
924001
923983
|
async function migrateYamlFile4(filepath, context3) {
|
|
924002
|
-
const contents = await (0,
|
|
923984
|
+
const contents = await (0, import_promises159.readFile)(filepath);
|
|
924003
923985
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
924004
923986
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
924005
923987
|
return context3.failAndThrow("File is not a map");
|
|
@@ -924018,7 +924000,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
924018
924000
|
}
|
|
924019
924001
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
924020
924002
|
parsedDocument.contents.items.unshift(docsPair);
|
|
924021
|
-
await (0,
|
|
924003
|
+
await (0, import_promises159.writeFile)(filepath, parsedDocument.toString());
|
|
924022
924004
|
}
|
|
924023
924005
|
|
|
924024
924006
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -924029,7 +924011,7 @@ var versionMigrations13 = {
|
|
|
924029
924011
|
var __default13 = versionMigrations13;
|
|
924030
924012
|
|
|
924031
924013
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
924032
|
-
var
|
|
924014
|
+
var import_promises160 = require("fs/promises");
|
|
924033
924015
|
|
|
924034
924016
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
924035
924017
|
init_lib6();
|
|
@@ -924071,14 +924053,14 @@ var migration14 = {
|
|
|
924071
924053
|
}
|
|
924072
924054
|
};
|
|
924073
924055
|
async function migrateYamlFile5(filepath) {
|
|
924074
|
-
const contents = await (0,
|
|
924056
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
924075
924057
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
924076
924058
|
const regex6 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
924077
924059
|
const updatedSnapshot = contents.toString().replace(regex6, (_match, _prefix, domain3) => {
|
|
924078
924060
|
return `docs:
|
|
924079
924061
|
domain: "${domain3}.${domainSuffix}"`;
|
|
924080
924062
|
});
|
|
924081
|
-
await (0,
|
|
924063
|
+
await (0, import_promises160.writeFile)(filepath, updatedSnapshot.toString());
|
|
924082
924064
|
}
|
|
924083
924065
|
|
|
924084
924066
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -924098,10 +924080,10 @@ var LegacyDocsSerializers = __toESM(require_serialization5(), 1);
|
|
|
924098
924080
|
|
|
924099
924081
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
924100
924082
|
init_lib6();
|
|
924101
|
-
var
|
|
924083
|
+
var import_promises161 = require("fs/promises");
|
|
924102
924084
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
924103
924085
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
924104
|
-
const contentsStr = await (0,
|
|
924086
|
+
const contentsStr = await (0, import_promises161.readFile)(filepath);
|
|
924105
924087
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
924106
924088
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
924107
924089
|
if (result.ok) {
|
|
@@ -924120,7 +924102,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
924120
924102
|
|
|
924121
924103
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
924122
924104
|
init_lib6();
|
|
924123
|
-
var
|
|
924105
|
+
var import_promises163 = require("fs/promises");
|
|
924124
924106
|
|
|
924125
924107
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
924126
924108
|
function convertLegacyDocsConfig({ docsConfiguration, docsURLs, apiName }) {
|
|
@@ -924303,10 +924285,10 @@ __export(legacy_exports, {
|
|
|
924303
924285
|
|
|
924304
924286
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
924305
924287
|
init_lib6();
|
|
924306
|
-
var
|
|
924288
|
+
var import_promises162 = require("fs/promises");
|
|
924307
924289
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
924308
924290
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
924309
|
-
const contentsStr = await (0,
|
|
924291
|
+
const contentsStr = await (0, import_promises162.readFile)(filepath);
|
|
924310
924292
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
924311
924293
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
924312
924294
|
if (result.success) {
|
|
@@ -924336,7 +924318,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
924336
924318
|
var APIS_DIRECTORY2 = "apis";
|
|
924337
924319
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
924338
924320
|
const absolutePathToApisDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
924339
|
-
await (0,
|
|
924321
|
+
await (0, import_promises163.mkdir)(absolutePathToApisDirectory);
|
|
924340
924322
|
for (const workspace of workspaces) {
|
|
924341
924323
|
const absolutePathToWorkspace = join2(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
924342
924324
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -924344,11 +924326,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
924344
924326
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
924345
924327
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
924346
924328
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
924347
|
-
await (0,
|
|
924329
|
+
await (0, import_promises163.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
924348
924330
|
}
|
|
924349
924331
|
const absolutePathToNestedWorkspace = join2(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
924350
924332
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
924351
|
-
await (0,
|
|
924333
|
+
await (0, import_promises163.rm)(absolutePathToWorkspace, { recursive: true });
|
|
924352
924334
|
}
|
|
924353
924335
|
}
|
|
924354
924336
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -924361,7 +924343,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
924361
924343
|
generatorsConfiguration,
|
|
924362
924344
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
924363
924345
|
});
|
|
924364
|
-
await (0,
|
|
924346
|
+
await (0, import_promises163.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
924365
924347
|
return convertedResponse.docsURLs;
|
|
924366
924348
|
}
|
|
924367
924349
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -924375,20 +924357,20 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
924375
924357
|
apiName
|
|
924376
924358
|
});
|
|
924377
924359
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
924378
|
-
await (0,
|
|
924360
|
+
await (0, import_promises163.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
924379
924361
|
}
|
|
924380
924362
|
|
|
924381
924363
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
924382
924364
|
init_lib6();
|
|
924383
|
-
var
|
|
924365
|
+
var import_promises164 = require("fs/promises");
|
|
924384
924366
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
924385
924367
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
924386
924368
|
await migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs });
|
|
924387
924369
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
924388
924370
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
924389
924371
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
924390
|
-
await (0,
|
|
924391
|
-
await (0,
|
|
924372
|
+
await (0, import_promises164.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
924373
|
+
await (0, import_promises164.rm)(absolutePathToWorkspace, { recursive: true });
|
|
924392
924374
|
}
|
|
924393
924375
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
924394
924376
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -924401,7 +924383,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
924401
924383
|
apiName: void 0
|
|
924402
924384
|
});
|
|
924403
924385
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
924404
|
-
await (0,
|
|
924386
|
+
await (0, import_promises164.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
924405
924387
|
}
|
|
924406
924388
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
924407
924389
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -924413,23 +924395,23 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
924413
924395
|
generatorsConfiguration,
|
|
924414
924396
|
pathModificationStrategy: "MoveUp"
|
|
924415
924397
|
});
|
|
924416
|
-
await (0,
|
|
924398
|
+
await (0, import_promises164.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
924417
924399
|
return convertedResponse.docsURLs;
|
|
924418
924400
|
}
|
|
924419
924401
|
|
|
924420
924402
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
924421
924403
|
init_lib6();
|
|
924422
|
-
var
|
|
924404
|
+
var import_promises165 = require("fs/promises");
|
|
924423
924405
|
var APIS_DIRECTORY3 = "apis";
|
|
924424
924406
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
924425
924407
|
const absolutePathToApisDirectory = join2(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
924426
|
-
await (0,
|
|
924408
|
+
await (0, import_promises165.mkdir)(absolutePathToApisDirectory);
|
|
924427
924409
|
for (const workspace of workspaces) {
|
|
924428
924410
|
const absolutePathToWorkspace = join2(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
924429
924411
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
924430
924412
|
const absolutePathToNestedWorkspace = join2(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
924431
924413
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
924432
|
-
await (0,
|
|
924414
|
+
await (0, import_promises165.rm)(absolutePathToWorkspace, { recursive: true });
|
|
924433
924415
|
}
|
|
924434
924416
|
}
|
|
924435
924417
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -924442,16 +924424,16 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
924442
924424
|
generatorsConfiguration,
|
|
924443
924425
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
924444
924426
|
});
|
|
924445
|
-
await (0,
|
|
924427
|
+
await (0, import_promises165.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
924446
924428
|
}
|
|
924447
924429
|
|
|
924448
924430
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
924449
924431
|
init_lib6();
|
|
924450
|
-
var
|
|
924432
|
+
var import_promises166 = require("fs/promises");
|
|
924451
924433
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
924452
924434
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
924453
924435
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
924454
|
-
await (0,
|
|
924436
|
+
await (0, import_promises166.rm)(absolutePathToWorkspace, { recursive: true });
|
|
924455
924437
|
}
|
|
924456
924438
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
924457
924439
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -924463,7 +924445,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
924463
924445
|
generatorsConfiguration,
|
|
924464
924446
|
pathModificationStrategy: "MoveUp"
|
|
924465
924447
|
});
|
|
924466
|
-
await (0,
|
|
924448
|
+
await (0, import_promises166.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
924467
924449
|
}
|
|
924468
924450
|
|
|
924469
924451
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -924541,7 +924523,7 @@ var __default15 = versionMigrations15;
|
|
|
924541
924523
|
|
|
924542
924524
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
924543
924525
|
init_lib6();
|
|
924544
|
-
var
|
|
924526
|
+
var import_promises167 = require("fs/promises");
|
|
924545
924527
|
var import_yaml16 = __toESM(require_dist8(), 1);
|
|
924546
924528
|
var migration16 = {
|
|
924547
924529
|
name: "require-generators-yml",
|
|
@@ -924584,7 +924566,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
924584
924566
|
if (existingGeneratorsYml == null) {
|
|
924585
924567
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
924586
924568
|
const absolutePathToGeneratorsYml = join2(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
924587
|
-
await (0,
|
|
924569
|
+
await (0, import_promises167.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
924588
924570
|
api: {
|
|
924589
924571
|
path: join2(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
924590
924572
|
}
|
|
@@ -924599,7 +924581,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
924599
924581
|
parsedDocument.set("api", {
|
|
924600
924582
|
path: join2(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
924601
924583
|
});
|
|
924602
|
-
await (0,
|
|
924584
|
+
await (0, import_promises167.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
924603
924585
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
924604
924586
|
}
|
|
924605
924587
|
}
|
|
@@ -924627,7 +924609,7 @@ var __default16 = versionMigrations16;
|
|
|
924627
924609
|
|
|
924628
924610
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
924629
924611
|
init_lib6();
|
|
924630
|
-
var
|
|
924612
|
+
var import_promises168 = require("fs/promises");
|
|
924631
924613
|
var import_yaml17 = __toESM(require_dist8(), 1);
|
|
924632
924614
|
var migration17 = {
|
|
924633
924615
|
name: "generators-yml-use-api-specs",
|
|
@@ -924807,7 +924789,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
924807
924789
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
924808
924790
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
924809
924791
|
}
|
|
924810
|
-
await (0,
|
|
924792
|
+
await (0, import_promises168.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924811
924793
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924812
924794
|
}
|
|
924813
924795
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -924854,7 +924836,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
924854
924836
|
}
|
|
924855
924837
|
let specContent;
|
|
924856
924838
|
try {
|
|
924857
|
-
const fileContents = await (0,
|
|
924839
|
+
const fileContents = await (0, import_promises168.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
924858
924840
|
specContent = jsYaml.load(fileContents);
|
|
924859
924841
|
} catch (e6) {
|
|
924860
924842
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e6}. Skipping...`);
|
|
@@ -924958,7 +924940,7 @@ var __default17 = versionMigrations17;
|
|
|
924958
924940
|
|
|
924959
924941
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
924960
924942
|
init_lib6();
|
|
924961
|
-
var
|
|
924943
|
+
var import_promises169 = require("fs/promises");
|
|
924962
924944
|
var migration18 = {
|
|
924963
924945
|
name: "add-path-parameter-order-setting",
|
|
924964
924946
|
summary: `Adds the 'path-parameter-order' setting to existing API configurations to maintain backwards compatibility.
|
|
@@ -925046,7 +925028,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
925046
925028
|
documentToWrite = `${schemaComment}
|
|
925047
925029
|
${documentToWrite}`;
|
|
925048
925030
|
}
|
|
925049
|
-
await (0,
|
|
925031
|
+
await (0, import_promises169.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925050
925032
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925051
925033
|
}
|
|
925052
925034
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -925083,7 +925065,7 @@ var __default18 = versionMigrations18;
|
|
|
925083
925065
|
|
|
925084
925066
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
925085
925067
|
init_lib6();
|
|
925086
|
-
var
|
|
925068
|
+
var import_promises170 = require("fs/promises");
|
|
925087
925069
|
var migration19 = {
|
|
925088
925070
|
name: "update-1_0_0-defaults",
|
|
925089
925071
|
summary: `The defaults of the API spec settings have changed.
|
|
@@ -925258,7 +925240,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
925258
925240
|
documentToWrite = `${schemaComment}
|
|
925259
925241
|
${documentToWrite}`;
|
|
925260
925242
|
}
|
|
925261
|
-
await (0,
|
|
925243
|
+
await (0, import_promises170.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925262
925244
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925263
925245
|
}
|
|
925264
925246
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -925328,7 +925310,7 @@ var __default19 = versionMigrations19;
|
|
|
925328
925310
|
|
|
925329
925311
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
925330
925312
|
init_lib6();
|
|
925331
|
-
var
|
|
925313
|
+
var import_promises171 = require("fs/promises");
|
|
925332
925314
|
var migration20 = {
|
|
925333
925315
|
name: "update-2_0_0-defaults",
|
|
925334
925316
|
summary: `The default of 'coerce-enums-to-literals' has changed from true to false.
|
|
@@ -925503,7 +925485,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
925503
925485
|
documentToWrite = `${schemaComment}
|
|
925504
925486
|
${documentToWrite}`;
|
|
925505
925487
|
}
|
|
925506
|
-
await (0,
|
|
925488
|
+
await (0, import_promises171.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925507
925489
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925508
925490
|
}
|
|
925509
925491
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -925550,7 +925532,7 @@ var __default20 = versionMigrations20;
|
|
|
925550
925532
|
|
|
925551
925533
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
925552
925534
|
init_lib6();
|
|
925553
|
-
var
|
|
925535
|
+
var import_promises172 = require("fs/promises");
|
|
925554
925536
|
var migration21 = {
|
|
925555
925537
|
name: "migrate-deprecated-generator-api-settings",
|
|
925556
925538
|
summary: `Migrates deprecated generator-level API settings keys to their new equivalents:
|
|
@@ -925641,7 +925623,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
925641
925623
|
documentToWrite = `${schemaComment}
|
|
925642
925624
|
${documentToWrite}`;
|
|
925643
925625
|
}
|
|
925644
|
-
await (0,
|
|
925626
|
+
await (0, import_promises172.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925645
925627
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925646
925628
|
}
|
|
925647
925629
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -925688,7 +925670,7 @@ var __default21 = versionMigrations21;
|
|
|
925688
925670
|
|
|
925689
925671
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
925690
925672
|
init_lib6();
|
|
925691
|
-
var
|
|
925673
|
+
var import_promises173 = require("fs/promises");
|
|
925692
925674
|
var migration22 = {
|
|
925693
925675
|
name: "enable-smart-casing",
|
|
925694
925676
|
summary: `Sets 'smart-casing: false' for existing generators to preserve backwards compatibility.
|
|
@@ -925772,7 +925754,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
925772
925754
|
documentToWrite = `${schemaComment}
|
|
925773
925755
|
${documentToWrite}`;
|
|
925774
925756
|
}
|
|
925775
|
-
await (0,
|
|
925757
|
+
await (0, import_promises173.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
925776
925758
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
925777
925759
|
}
|
|
925778
925760
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -925913,7 +925895,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
925913
925895
|
}
|
|
925914
925896
|
|
|
925915
925897
|
// src/commands/upgrade/upgrade.ts
|
|
925916
|
-
var
|
|
925898
|
+
var import_promises174 = require("fs/promises");
|
|
925917
925899
|
|
|
925918
925900
|
// src/cwd.ts
|
|
925919
925901
|
var FERN_CWD_ENV_VAR = "FERN_CWD";
|
|
@@ -926234,7 +926216,7 @@ async function upgrade({
|
|
|
926234
926216
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
926235
926217
|
draft.version = resolvedTargetVersion;
|
|
926236
926218
|
});
|
|
926237
|
-
await (0,
|
|
926219
|
+
await (0, import_promises174.writeFile)(
|
|
926238
926220
|
projectConfig2._absolutePath,
|
|
926239
926221
|
ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2))
|
|
926240
926222
|
);
|
|
@@ -926850,7 +926832,7 @@ async function validateWorkspaces({
|
|
|
926850
926832
|
|
|
926851
926833
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
926852
926834
|
init_lib6();
|
|
926853
|
-
var
|
|
926835
|
+
var import_promises175 = require("fs/promises");
|
|
926854
926836
|
var import_path91 = __toESM(require("path"), 1);
|
|
926855
926837
|
async function writeDefinitionForWorkspaces({
|
|
926856
926838
|
project,
|
|
@@ -926931,28 +926913,28 @@ async function writeFernDefinition({
|
|
|
926931
926913
|
return a10.localeCompare(b19);
|
|
926932
926914
|
};
|
|
926933
926915
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
926934
|
-
await (0,
|
|
926916
|
+
await (0, import_promises175.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
926935
926917
|
}
|
|
926936
|
-
await (0,
|
|
926937
|
-
await (0,
|
|
926918
|
+
await (0, import_promises175.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
926919
|
+
await (0, import_promises175.writeFile)(
|
|
926938
926920
|
join2(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
926939
926921
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
926940
926922
|
);
|
|
926941
926923
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
926942
926924
|
const absoluteFilepath = join2(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
926943
|
-
await (0,
|
|
926944
|
-
await (0,
|
|
926925
|
+
await (0, import_promises175.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
926926
|
+
await (0, import_promises175.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
926945
926927
|
}
|
|
926946
926928
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
926947
926929
|
const absoluteFilepath = join2(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
926948
|
-
await (0,
|
|
926949
|
-
await (0,
|
|
926930
|
+
await (0, import_promises175.mkdir)(dirname4(absoluteFilepath), { recursive: true });
|
|
926931
|
+
await (0, import_promises175.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
926950
926932
|
}
|
|
926951
926933
|
}
|
|
926952
926934
|
|
|
926953
926935
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
926954
926936
|
init_lib6();
|
|
926955
|
-
var
|
|
926937
|
+
var import_promises176 = require("fs/promises");
|
|
926956
926938
|
async function writeDocsDefinitionForProject({
|
|
926957
926939
|
project,
|
|
926958
926940
|
outputPath,
|
|
@@ -926984,7 +926966,7 @@ async function writeDocsDefinitionForProject({
|
|
|
926984
926966
|
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
|
|
926985
926967
|
});
|
|
926986
926968
|
const docsDefinition = await docsResolver.resolve();
|
|
926987
|
-
await (0,
|
|
926969
|
+
await (0, import_promises176.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
926988
926970
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
926989
926971
|
});
|
|
926990
926972
|
}
|
|
@@ -926993,7 +926975,7 @@ async function writeDocsDefinitionForProject({
|
|
|
926993
926975
|
init_lib6();
|
|
926994
926976
|
var import_cli_progress2 = __toESM(require_cli_progress(), 1);
|
|
926995
926977
|
var import_fs37 = require("fs");
|
|
926996
|
-
var
|
|
926978
|
+
var import_promises180 = require("fs/promises");
|
|
926997
926979
|
var import_is_ci3 = __toESM(require_is_ci(), 1);
|
|
926998
926980
|
var import_path94 = __toESM(require("path"), 1);
|
|
926999
926981
|
|
|
@@ -927483,7 +927465,7 @@ function shouldProcessFile(filePath, stub) {
|
|
|
927483
927465
|
|
|
927484
927466
|
// src/commands/write-translation/docs-config-utils.ts
|
|
927485
927467
|
init_lib6();
|
|
927486
|
-
var
|
|
927468
|
+
var import_promises177 = require("fs/promises");
|
|
927487
927469
|
|
|
927488
927470
|
// src/commands/write-translation/url-utils.ts
|
|
927489
927471
|
function addLanguageSuffixToUrl(url3, language) {
|
|
@@ -927640,7 +927622,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
927640
927622
|
stub = false
|
|
927641
927623
|
}) {
|
|
927642
927624
|
try {
|
|
927643
|
-
const originalConfigContent = await (0,
|
|
927625
|
+
const originalConfigContent = await (0, import_promises177.readFile)(originalDocsConfigPath, "utf-8");
|
|
927644
927626
|
const transformation = {
|
|
927645
927627
|
filePath: DOCS_CONFIGURATION_FILENAME,
|
|
927646
927628
|
language,
|
|
@@ -927654,7 +927636,7 @@ async function createLanguageSpecificDocsConfig({
|
|
|
927654
927636
|
const modifiedConfigContent = jsYaml.dump(modifiedConfig, {
|
|
927655
927637
|
sortKeys: false
|
|
927656
927638
|
});
|
|
927657
|
-
await (0,
|
|
927639
|
+
await (0, import_promises177.writeFile)(modifiedConfigPath, modifiedConfigContent, "utf-8");
|
|
927658
927640
|
context3.logger.debug(`Created language-specific docs config: ${modifiedConfigPath}`);
|
|
927659
927641
|
} catch (error50) {
|
|
927660
927642
|
if (error50 instanceof Error && error50.message.includes("403")) {
|
|
@@ -927667,11 +927649,11 @@ async function createLanguageSpecificDocsConfig({
|
|
|
927667
927649
|
// src/commands/write-translation/file-collection-utils.ts
|
|
927668
927650
|
init_lib6();
|
|
927669
927651
|
var import_fs35 = require("fs");
|
|
927670
|
-
var
|
|
927652
|
+
var import_promises178 = require("fs/promises");
|
|
927671
927653
|
var import_path92 = __toESM(require("path"), 1);
|
|
927672
927654
|
async function collectFiles(baseDirectory, relativeBase) {
|
|
927673
927655
|
const discoveredFiles = {};
|
|
927674
|
-
const entries21 = await (0,
|
|
927656
|
+
const entries21 = await (0, import_promises178.readdir)(baseDirectory);
|
|
927675
927657
|
for (const entry of entries21) {
|
|
927676
927658
|
if (entry === "translations") {
|
|
927677
927659
|
continue;
|
|
@@ -927694,7 +927676,7 @@ async function collectFiles(baseDirectory, relativeBase) {
|
|
|
927694
927676
|
// src/commands/write-translation/hash-utils.ts
|
|
927695
927677
|
var import_crypto13 = require("crypto");
|
|
927696
927678
|
var import_fs36 = require("fs");
|
|
927697
|
-
var
|
|
927679
|
+
var import_promises179 = require("fs/promises");
|
|
927698
927680
|
var import_path93 = __toESM(require("path"), 1);
|
|
927699
927681
|
function calculateContentHash(content5) {
|
|
927700
927682
|
return (0, import_crypto13.createHash)("sha256").update(content5, "utf-8").digest("hex");
|
|
@@ -927705,7 +927687,7 @@ async function loadHashMappings(translationsDirectory) {
|
|
|
927705
927687
|
return {};
|
|
927706
927688
|
}
|
|
927707
927689
|
try {
|
|
927708
|
-
const hashesContent = await (0,
|
|
927690
|
+
const hashesContent = await (0, import_promises179.readFile)(hashesFilePath, "utf-8");
|
|
927709
927691
|
const parsed = JSON.parse(hashesContent);
|
|
927710
927692
|
const { _comment, ...hashMappings } = parsed;
|
|
927711
927693
|
return hashMappings;
|
|
@@ -927726,11 +927708,11 @@ async function saveHashMappings(translationsDirectory, hashMappings) {
|
|
|
927726
927708
|
_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.",
|
|
927727
927709
|
...sortedMappings
|
|
927728
927710
|
};
|
|
927729
|
-
await (0,
|
|
927711
|
+
await (0, import_promises179.writeFile)(hashesFilePath, JSON.stringify(fileContent, null, 2), "utf-8");
|
|
927730
927712
|
}
|
|
927731
927713
|
async function hasFileChanged(filePath, relativePath, previousHashes) {
|
|
927732
927714
|
try {
|
|
927733
|
-
const content5 = await (0,
|
|
927715
|
+
const content5 = await (0, import_promises179.readFile)(filePath, "utf-8");
|
|
927734
927716
|
const currentHash = calculateContentHash(content5);
|
|
927735
927717
|
const previousHash = previousHashes[relativePath];
|
|
927736
927718
|
return currentHash !== previousHash;
|
|
@@ -927783,7 +927765,7 @@ async function writeTranslationForProject({
|
|
|
927783
927765
|
}
|
|
927784
927766
|
if (!(0, import_fs37.existsSync)(translationsDirectory)) {
|
|
927785
927767
|
context3.logger.debug(`Creating translations directory at: ${translationsDirectory}`);
|
|
927786
|
-
await (0,
|
|
927768
|
+
await (0, import_promises180.mkdir)(translationsDirectory, { recursive: true });
|
|
927787
927769
|
}
|
|
927788
927770
|
const languageStats = {};
|
|
927789
927771
|
const targetLanguages = languages.filter((lang) => lang !== sourceLanguage);
|
|
@@ -927796,7 +927778,7 @@ async function writeTranslationForProject({
|
|
|
927796
927778
|
RelativeFilePath2.of("fern")
|
|
927797
927779
|
);
|
|
927798
927780
|
if (!(0, import_fs37.existsSync)(languageDirectory)) {
|
|
927799
|
-
await (0,
|
|
927781
|
+
await (0, import_promises180.mkdir)(languageDirectory, { recursive: true });
|
|
927800
927782
|
}
|
|
927801
927783
|
languageStats[language] = {
|
|
927802
927784
|
filesProcessed: 0,
|
|
@@ -927898,7 +927880,7 @@ async function writeTranslationForProject({
|
|
|
927898
927880
|
`[COMPLETED] ${DOCS_CONFIGURATION_FILENAME} -> ${language}/${DOCS_CONFIGURATION_FILENAME}`
|
|
927899
927881
|
);
|
|
927900
927882
|
}
|
|
927901
|
-
const originalConfigContent = await (0,
|
|
927883
|
+
const originalConfigContent = await (0, import_promises180.readFile)(originalDocsConfigPath, "utf-8");
|
|
927902
927884
|
await updateAndSaveHashForFile(
|
|
927903
927885
|
translationsDirectory,
|
|
927904
927886
|
hashMappings,
|
|
@@ -927943,7 +927925,7 @@ async function writeTranslationForProject({
|
|
|
927943
927925
|
continue;
|
|
927944
927926
|
}
|
|
927945
927927
|
cliContext.logger.debug(`[PROCESSING] ${relativePath} (detected changes)`);
|
|
927946
|
-
const originalContent = await (0,
|
|
927928
|
+
const originalContent = await (0, import_promises180.readFile)(filePath, "utf-8");
|
|
927947
927929
|
await updateAndSaveHashForFile(translationsDirectory, hashMappings, relativePath, originalContent);
|
|
927948
927930
|
const sourceStats = languageStats[sourceLanguage];
|
|
927949
927931
|
if (sourceStats) {
|
|
@@ -927968,7 +927950,7 @@ async function writeTranslationForProject({
|
|
|
927968
927950
|
const destPath = join2(languageDirectory, relativePath);
|
|
927969
927951
|
const destDir = import_path94.default.dirname(destPath);
|
|
927970
927952
|
if (!(0, import_fs37.existsSync)(destDir)) {
|
|
927971
|
-
await (0,
|
|
927953
|
+
await (0, import_promises180.mkdir)(destDir, { recursive: true });
|
|
927972
927954
|
}
|
|
927973
927955
|
const transformation = {
|
|
927974
927956
|
filePath: relativePath,
|
|
@@ -927981,7 +927963,7 @@ async function writeTranslationForProject({
|
|
|
927981
927963
|
cliContext,
|
|
927982
927964
|
stub
|
|
927983
927965
|
});
|
|
927984
|
-
await (0,
|
|
927966
|
+
await (0, import_promises180.writeFile)(destPath, transformedContent, "utf-8");
|
|
927985
927967
|
const languageStatsForLang = languageStats[language];
|
|
927986
927968
|
if (languageStatsForLang) {
|
|
927987
927969
|
languageStatsForLang.filesProcessed++;
|
|
@@ -928012,9 +927994,9 @@ async function writeTranslationForProject({
|
|
|
928012
927994
|
const destPath = join2(languageDirectory, relativePath);
|
|
928013
927995
|
const destDir = import_path94.default.dirname(destPath);
|
|
928014
927996
|
if (!(0, import_fs37.existsSync)(destDir)) {
|
|
928015
|
-
await (0,
|
|
927997
|
+
await (0, import_promises180.mkdir)(destDir, { recursive: true });
|
|
928016
927998
|
}
|
|
928017
|
-
await (0,
|
|
927999
|
+
await (0, import_promises180.copyFile)(filePath, destPath);
|
|
928018
928000
|
assetsCopied++;
|
|
928019
928001
|
cliContext.logger.debug(`[ASSET COPIED] ${relativePath} -> ${language}/${relativePath}`);
|
|
928020
928002
|
}
|