@fern-api/fern-api-dev 5.56.3 → 5.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +448 -369
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -99837,8 +99837,8 @@ var require_graceful_fs = __commonJS({
|
|
|
99837
99837
|
}
|
|
99838
99838
|
var fs$appendFile = fs35.appendFile;
|
|
99839
99839
|
if (fs$appendFile)
|
|
99840
|
-
fs35.appendFile =
|
|
99841
|
-
function
|
|
99840
|
+
fs35.appendFile = appendFile4;
|
|
99841
|
+
function appendFile4(path119, data2, options2, cb) {
|
|
99842
99842
|
if (typeof options2 === "function")
|
|
99843
99843
|
cb = options2, options2 = null;
|
|
99844
99844
|
return go$appendFile(path119, data2, options2, cb);
|
|
@@ -478581,8 +478581,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
478581
478581
|
}
|
|
478582
478582
|
var fs$appendFile = fs35.appendFile;
|
|
478583
478583
|
if (fs$appendFile)
|
|
478584
|
-
fs35.appendFile =
|
|
478585
|
-
function
|
|
478584
|
+
fs35.appendFile = appendFile4;
|
|
478585
|
+
function appendFile4(path119, data2, options2, cb) {
|
|
478586
478586
|
if (typeof options2 === "function")
|
|
478587
478587
|
cb = options2, options2 = null;
|
|
478588
478588
|
return go$appendFile(path119, data2, options2, cb);
|
|
@@ -571792,7 +571792,7 @@ var require_dist24 = __commonJS({
|
|
|
571792
571792
|
return copy;
|
|
571793
571793
|
}
|
|
571794
571794
|
};
|
|
571795
|
-
var
|
|
571795
|
+
var import_promises215 = require("fs/promises");
|
|
571796
571796
|
var import_node_path310 = require("path");
|
|
571797
571797
|
async function resolveInputs(args) {
|
|
571798
571798
|
const {
|
|
@@ -571845,7 +571845,7 @@ var require_dist24 = __commonJS({
|
|
|
571845
571845
|
}
|
|
571846
571846
|
}
|
|
571847
571847
|
const oursPath = (0, import_node_path310.join)(outputDir, resolvedPath);
|
|
571848
|
-
const ours = await (0,
|
|
571848
|
+
const ours = await (0, import_promises215.readFile)(oursPath, "utf-8").catch(() => null);
|
|
571849
571849
|
let ghostTheirs = null;
|
|
571850
571850
|
let baseTreeUnreachable = false;
|
|
571851
571851
|
if (!base4 && !renameSourcePath) {
|
|
@@ -572087,7 +572087,7 @@ var require_dist24 = __commonJS({
|
|
|
572087
572087
|
conflictReasonHint
|
|
572088
572088
|
};
|
|
572089
572089
|
}
|
|
572090
|
-
var
|
|
572090
|
+
var import_promises216 = require("fs/promises");
|
|
572091
572091
|
var import_node_path45 = require("path");
|
|
572092
572092
|
async function runMergeAndRecord(args) {
|
|
572093
572093
|
const { plan, inputs, patch: patch5, accumulator } = args;
|
|
@@ -572097,14 +572097,14 @@ var require_dist24 = __commonJS({
|
|
|
572097
572097
|
}
|
|
572098
572098
|
if (plan.kind === "new-file-only-user") {
|
|
572099
572099
|
accumulator.recordMerge(resolvedPath, plan.theirs, patch5.base_generation);
|
|
572100
|
-
await (0,
|
|
572101
|
-
await (0,
|
|
572100
|
+
await (0, import_promises216.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572101
|
+
await (0, import_promises216.writeFile)(oursPath, plan.theirs);
|
|
572102
572102
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
572103
572103
|
}
|
|
572104
572104
|
if (plan.kind === "new-file-both") {
|
|
572105
572105
|
const merged2 = threeWayMerge("", ours, plan.theirs);
|
|
572106
|
-
await (0,
|
|
572107
|
-
await (0,
|
|
572106
|
+
await (0, import_promises216.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572107
|
+
await (0, import_promises216.writeFile)(oursPath, merged2.content);
|
|
572108
572108
|
const unreachableFlag = plan.baseTreeUnreachable ? { baseTreeUnreachable: true } : {};
|
|
572109
572109
|
if (merged2.hasConflicts) {
|
|
572110
572110
|
return {
|
|
@@ -572120,8 +572120,8 @@ var require_dist24 = __commonJS({
|
|
|
572120
572120
|
return { file: resolvedPath, status: "merged", ...unreachableFlag };
|
|
572121
572121
|
}
|
|
572122
572122
|
const merged = threeWayMerge(plan.mergeBase, ours, plan.theirs);
|
|
572123
|
-
await (0,
|
|
572124
|
-
await (0,
|
|
572123
|
+
await (0, import_promises216.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
572124
|
+
await (0, import_promises216.writeFile)(oursPath, merged.content);
|
|
572125
572125
|
if (merged.hasConflicts) {
|
|
572126
572126
|
accumulator.recordConflict(resolvedPath, plan.theirs, patch5.base_generation);
|
|
572127
572127
|
return {
|
|
@@ -588891,13 +588891,13 @@ async function buildTranslatedDocsDefinition({ docsDefinition, locale, localePag
|
|
|
588891
588891
|
};
|
|
588892
588892
|
const localeAwareMarkdownLoader = async (filepath) => {
|
|
588893
588893
|
const pathToRead = await resolveLocalePath(filepath);
|
|
588894
|
-
const raw = await (0,
|
|
588894
|
+
const raw = await (0, import_promises119.readFile)(pathToRead, "utf-8");
|
|
588895
588895
|
const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
588896
588896
|
return fmMatch != null ? raw.slice(fmMatch[0].length) : raw;
|
|
588897
588897
|
};
|
|
588898
588898
|
const localeAwareFileLoader = async (filepath) => {
|
|
588899
588899
|
const pathToRead = await resolveLocalePath(filepath);
|
|
588900
|
-
return (0,
|
|
588900
|
+
return (0, import_promises119.readFile)(pathToRead, "utf-8");
|
|
588901
588901
|
};
|
|
588902
588902
|
const translatedPageEntries = await Promise.all(Object.entries(localePages).map(async ([path119, rawMarkdown]) => {
|
|
588903
588903
|
try {
|
|
@@ -588973,13 +588973,13 @@ async function buildTranslatedDocsDefinition({ docsDefinition, locale, localePag
|
|
|
588973
588973
|
}
|
|
588974
588974
|
};
|
|
588975
588975
|
}
|
|
588976
|
-
var
|
|
588976
|
+
var import_promises119;
|
|
588977
588977
|
var init_buildTranslatedDocsDefinition = __esm({
|
|
588978
588978
|
"../generation/remote-generation/remote-workspace-runner/lib/buildTranslatedDocsDefinition.js"() {
|
|
588979
588979
|
"use strict";
|
|
588980
588980
|
init_lib67();
|
|
588981
588981
|
init_lib8();
|
|
588982
|
-
|
|
588982
|
+
import_promises119 = require("fs/promises");
|
|
588983
588983
|
}
|
|
588984
588984
|
});
|
|
588985
588985
|
|
|
@@ -619428,7 +619428,7 @@ async function readFernYmlRaw(start2) {
|
|
|
619428
619428
|
for (let i5 = 0; i5 < 50; i5++) {
|
|
619429
619429
|
const candidate = (0, import_path102.resolve)(dir, "fern.yml");
|
|
619430
619430
|
try {
|
|
619431
|
-
const content5 = await (0,
|
|
619431
|
+
const content5 = await (0, import_promises143.readFile)(candidate, "utf-8");
|
|
619432
619432
|
const parsed = index_vite_proxy_tmp_default.load(content5);
|
|
619433
619433
|
if (isRawFernYml(parsed)) {
|
|
619434
619434
|
return parsed;
|
|
@@ -619476,11 +619476,11 @@ function extractInstances(raw) {
|
|
|
619476
619476
|
}
|
|
619477
619477
|
return raw.docs.instances.flatMap((inst) => typeof inst?.url === "string" ? [inst.url] : []);
|
|
619478
619478
|
}
|
|
619479
|
-
var
|
|
619479
|
+
var import_promises143, import_path102;
|
|
619480
619480
|
var init_completion2 = __esm({
|
|
619481
619481
|
"../cli-v2/lib/completion.js"() {
|
|
619482
619482
|
"use strict";
|
|
619483
|
-
|
|
619483
|
+
import_promises143 = require("fs/promises");
|
|
619484
619484
|
init_js_yaml();
|
|
619485
619485
|
import_path102 = require("path");
|
|
619486
619486
|
}
|
|
@@ -686971,7 +686971,7 @@ var AccessTokenPosthogManager = class {
|
|
|
686971
686971
|
properties: {
|
|
686972
686972
|
...event,
|
|
686973
686973
|
...event.properties,
|
|
686974
|
-
version: "5.
|
|
686974
|
+
version: "5.57.0",
|
|
686975
686975
|
usingAccessToken: true,
|
|
686976
686976
|
...getRunIdProperties()
|
|
686977
686977
|
}
|
|
@@ -687037,7 +687037,7 @@ var UserPosthogManager = class {
|
|
|
687037
687037
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
687038
687038
|
event: "CLI",
|
|
687039
687039
|
properties: {
|
|
687040
|
-
version: "5.
|
|
687040
|
+
version: "5.57.0",
|
|
687041
687041
|
...event,
|
|
687042
687042
|
...event.properties,
|
|
687043
687043
|
usingAccessToken: false,
|
|
@@ -868132,7 +868132,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
868132
868132
|
var LOGS_FOLDER_NAME = "logs";
|
|
868133
868133
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
868134
868134
|
function getCliSource() {
|
|
868135
|
-
const version7 = "5.
|
|
868135
|
+
const version7 = "5.57.0";
|
|
868136
868136
|
return `cli@${version7}`;
|
|
868137
868137
|
}
|
|
868138
868138
|
var DebugLogger = class {
|
|
@@ -889510,6 +889510,7 @@ async function validateAPIWorkspaceAndLogIssues({ workspace, context: context3,
|
|
|
889510
889510
|
}
|
|
889511
889511
|
|
|
889512
889512
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForAPIWorkspace.js
|
|
889513
|
+
init_lib25();
|
|
889513
889514
|
init_lib4();
|
|
889514
889515
|
init_lib35();
|
|
889515
889516
|
init_lib6();
|
|
@@ -896827,6 +896828,7 @@ ${result.error?.message ?? "Unknown error"}`,
|
|
|
896827
896828
|
|
|
896828
896829
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForAPIWorkspace.js
|
|
896829
896830
|
init_esm19();
|
|
896831
|
+
var import_promises118 = require("fs/promises");
|
|
896830
896832
|
|
|
896831
896833
|
// ../generation/remote-generation/remote-workspace-runner/lib/downloadSnippetsForTask.js
|
|
896832
896834
|
init_lib8();
|
|
@@ -897581,9 +897583,12 @@ async function downloadFilesForTask({ s3PreSignedReadUrl, absolutePathToLocalOut
|
|
|
897581
897583
|
context3.failAndThrow("Failed to download files", e2, { code: CliError.Code.NetworkError });
|
|
897582
897584
|
}
|
|
897583
897585
|
}
|
|
897586
|
+
var S3_DOWNLOAD_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
897584
897587
|
async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutput }) {
|
|
897585
897588
|
const request7 = await axios_default.get(s3PreSignedReadUrl, {
|
|
897586
|
-
responseType: "stream"
|
|
897589
|
+
responseType: "stream",
|
|
897590
|
+
timeout: 6e4,
|
|
897591
|
+
signal: AbortSignal.timeout(S3_DOWNLOAD_TIMEOUT_MS)
|
|
897587
897592
|
});
|
|
897588
897593
|
const tmpDir = await import_tmp_promise13.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
897589
897594
|
const outputZipPath = import_path79.default.join(tmpDir.path, "output.zip");
|
|
@@ -897685,7 +897690,9 @@ async function downloadFilesWithFernIgnoreInTempRepo({ s3PreSignedReadUrl, absol
|
|
|
897685
897690
|
}
|
|
897686
897691
|
async function downloadAndExtractZipToDirectory({ s3PreSignedReadUrl, outputPath }) {
|
|
897687
897692
|
const request7 = await axios_default.get(s3PreSignedReadUrl, {
|
|
897688
|
-
responseType: "stream"
|
|
897693
|
+
responseType: "stream",
|
|
897694
|
+
timeout: 6e4,
|
|
897695
|
+
signal: AbortSignal.timeout(S3_DOWNLOAD_TIMEOUT_MS)
|
|
897689
897696
|
});
|
|
897690
897697
|
const tmpDir = await import_tmp_promise13.default.dir({ prefix: "fern", unsafeCleanup: true });
|
|
897691
897698
|
const outputZipPath = import_path79.default.join(tmpDir.path, "output.zip");
|
|
@@ -898341,6 +898348,16 @@ async function generateOne({ generatorInvocation, interactiveTaskContext, projec
|
|
|
898341
898348
|
generatorsYmlLineNumber: lineNumber
|
|
898342
898349
|
});
|
|
898343
898350
|
}
|
|
898351
|
+
await emitGenerationAnnotations({
|
|
898352
|
+
pullRequestUrl: remoteTaskHandlerResponse?.pullRequestUrl,
|
|
898353
|
+
publishTarget: remoteTaskHandlerResponse?.publishTarget,
|
|
898354
|
+
noChangesDetected: remoteTaskHandlerResponse?.noChangesDetected,
|
|
898355
|
+
version: remoteTaskHandlerResponse?.actualVersion,
|
|
898356
|
+
generatorName: generatorInvocation.name,
|
|
898357
|
+
groupName: generatorGroup.groupName,
|
|
898358
|
+
apiName: workspace.workspaceName,
|
|
898359
|
+
isAutomation: automation != null
|
|
898360
|
+
});
|
|
898344
898361
|
} catch (error50) {
|
|
898345
898362
|
if (automation == null) {
|
|
898346
898363
|
throw error50;
|
|
@@ -898376,6 +898393,68 @@ async function generateOne({ generatorInvocation, interactiveTaskContext, projec
|
|
|
898376
898393
|
});
|
|
898377
898394
|
}
|
|
898378
898395
|
}
|
|
898396
|
+
async function emitGenerationAnnotations(ctx) {
|
|
898397
|
+
if (!shouldEmitGithubAnnotations()) {
|
|
898398
|
+
return;
|
|
898399
|
+
}
|
|
898400
|
+
const notices = [];
|
|
898401
|
+
if (ctx.pullRequestUrl != null) {
|
|
898402
|
+
notices.push({
|
|
898403
|
+
event: "PR created",
|
|
898404
|
+
body: ctx.pullRequestUrl,
|
|
898405
|
+
summaryLine: `\u{1F500} **${ctx.generatorName}** \u2192 [PR](${ctx.pullRequestUrl})`
|
|
898406
|
+
});
|
|
898407
|
+
}
|
|
898408
|
+
if (ctx.publishTarget != null) {
|
|
898409
|
+
notices.push({
|
|
898410
|
+
event: `Published to ${ctx.publishTarget.label}`,
|
|
898411
|
+
body: `${ctx.publishTarget.version} \u2192 ${ctx.publishTarget.url}`,
|
|
898412
|
+
summaryLine: `\u{1F4E6} **${ctx.generatorName}** \u2192 [${ctx.publishTarget.label} ${ctx.publishTarget.version}](${ctx.publishTarget.url})`
|
|
898413
|
+
});
|
|
898414
|
+
}
|
|
898415
|
+
if (ctx.noChangesDetected) {
|
|
898416
|
+
notices.push({
|
|
898417
|
+
event: "No changes detected",
|
|
898418
|
+
body: "SDK repo is already up to date",
|
|
898419
|
+
summaryLine: `\u2705 **${ctx.generatorName}** \u2192 No changes detected`
|
|
898420
|
+
});
|
|
898421
|
+
}
|
|
898422
|
+
if (ctx.version != null && ctx.publishTarget == null && ctx.pullRequestUrl == null) {
|
|
898423
|
+
notices.push({
|
|
898424
|
+
event: `Version ${ctx.version}`,
|
|
898425
|
+
body: `Generated version ${ctx.version}`,
|
|
898426
|
+
summaryLine: `\u{1F3F7}\uFE0F **${ctx.generatorName}** \u2192 Version ${ctx.version}`
|
|
898427
|
+
});
|
|
898428
|
+
}
|
|
898429
|
+
if (notices.length === 0) {
|
|
898430
|
+
return;
|
|
898431
|
+
}
|
|
898432
|
+
const qualifiers = [`group=${ctx.groupName}`];
|
|
898433
|
+
if (ctx.apiName != null && ctx.apiName.length > 0) {
|
|
898434
|
+
qualifiers.push(`api=${ctx.apiName}`);
|
|
898435
|
+
}
|
|
898436
|
+
const prefix2 = `${ctx.generatorName} (${qualifiers.join(", ")})`;
|
|
898437
|
+
for (const notice of notices) {
|
|
898438
|
+
const title2 = `${prefix2} \u2192 ${notice.event}`;
|
|
898439
|
+
const annotation = renderGithubAnnotation("notice", notice.body, { title: title2 });
|
|
898440
|
+
if (annotation != null) {
|
|
898441
|
+
process.stdout.write(annotation);
|
|
898442
|
+
}
|
|
898443
|
+
}
|
|
898444
|
+
if (!ctx.isAutomation) {
|
|
898445
|
+
const stepSummaryPath = process.env.GITHUB_STEP_SUMMARY;
|
|
898446
|
+
if (stepSummaryPath != null && stepSummaryPath.length > 0) {
|
|
898447
|
+
const lines = notices.map((n2) => `${n2.summaryLine}
|
|
898448
|
+
`).join("");
|
|
898449
|
+
try {
|
|
898450
|
+
await (0, import_promises118.appendFile)(stepSummaryPath, lines, "utf8");
|
|
898451
|
+
} catch (error50) {
|
|
898452
|
+
process.stderr.write(`[warn] Failed to append to GITHUB_STEP_SUMMARY: ${error50}
|
|
898453
|
+
`);
|
|
898454
|
+
}
|
|
898455
|
+
}
|
|
898456
|
+
}
|
|
898457
|
+
}
|
|
898379
898458
|
|
|
898380
898459
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForDocsWorkspace.js
|
|
898381
898460
|
init_lib4();
|
|
@@ -898435,7 +898514,7 @@ init_lib6();
|
|
|
898435
898514
|
init_axios2();
|
|
898436
898515
|
init_source();
|
|
898437
898516
|
var import_crypto9 = require("crypto");
|
|
898438
|
-
var
|
|
898517
|
+
var import_promises121 = require("fs/promises");
|
|
898439
898518
|
init_lodash();
|
|
898440
898519
|
var mime3 = __toESM(require_mime_types(), 1);
|
|
898441
898520
|
var import_path80 = require("path");
|
|
@@ -898510,7 +898589,7 @@ init_lib67();
|
|
|
898510
898589
|
init_js();
|
|
898511
898590
|
init_lib66();
|
|
898512
898591
|
var import_crypto8 = require("crypto");
|
|
898513
|
-
var
|
|
898592
|
+
var import_promises120 = require("fs/promises");
|
|
898514
898593
|
var mime2 = __toESM(require_mime_types(), 1);
|
|
898515
898594
|
|
|
898516
898595
|
// ../generation/remote-generation/remote-workspace-runner/lib/mapDocsConfigToLedgerConfig.js
|
|
@@ -898882,7 +898961,7 @@ async function uploadMissingBlobs(missingContent, blobs, context3, filePaths) {
|
|
|
898882
898961
|
if (blob == null && filePaths != null) {
|
|
898883
898962
|
const filePath = filePaths.get(hash5);
|
|
898884
898963
|
if (filePath != null) {
|
|
898885
|
-
blob = await (0,
|
|
898964
|
+
blob = await (0, import_promises120.readFile)(filePath);
|
|
898886
898965
|
const inferred = mime2.lookup(filePath);
|
|
898887
898966
|
if (inferred !== false) {
|
|
898888
898967
|
contentType = inferred;
|
|
@@ -899182,7 +899261,7 @@ function sanitizeRelativePathForS3(relativeFilePath) {
|
|
|
899182
899261
|
return relativeFilePath.replace(/\.\.\//g, "_dot_dot_/");
|
|
899183
899262
|
}
|
|
899184
899263
|
async function readAndHashFile(absoluteFilePath) {
|
|
899185
|
-
const buffer = await (0,
|
|
899264
|
+
const buffer = await (0, import_promises121.readFile)(absoluteFilePath);
|
|
899186
899265
|
const hash5 = (0, import_crypto9.createHash)("sha256").update(new Uint8Array(buffer)).digest("hex");
|
|
899187
899266
|
return { buffer, hash: hash5 };
|
|
899188
899267
|
}
|
|
@@ -899683,13 +899762,13 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
899683
899762
|
};
|
|
899684
899763
|
const localeAwareMarkdownLoader = async (filepath) => {
|
|
899685
899764
|
const pathToRead = await resolveLocalePath(filepath);
|
|
899686
|
-
const raw = await (0,
|
|
899765
|
+
const raw = await (0, import_promises121.readFile)(pathToRead, "utf-8");
|
|
899687
899766
|
const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
899688
899767
|
return fmMatch != null ? raw.slice(fmMatch[0].length) : raw;
|
|
899689
899768
|
};
|
|
899690
899769
|
const localeAwareFileLoader = async (filepath) => {
|
|
899691
899770
|
const pathToRead = await resolveLocalePath(filepath);
|
|
899692
|
-
return (0,
|
|
899771
|
+
return (0, import_promises121.readFile)(pathToRead, "utf-8");
|
|
899693
899772
|
};
|
|
899694
899773
|
const translatedPageEntries = await Promise.all(Object.entries(localePages).map(async ([path119, rawMarkdown]) => {
|
|
899695
899774
|
try {
|
|
@@ -899883,7 +899962,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
899883
899962
|
try {
|
|
899884
899963
|
const uploadUrl = extractUploadUrl(urlValue);
|
|
899885
899964
|
const mimeType = mime3.lookup(absoluteFilePath);
|
|
899886
|
-
await axios_default.put(uploadUrl, await (0,
|
|
899965
|
+
await axios_default.put(uploadUrl, await (0, import_promises121.readFile)(absoluteFilePath), {
|
|
899887
899966
|
headers: {
|
|
899888
899967
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
899889
899968
|
// Set max cache control for S3 uploads
|
|
@@ -900534,7 +900613,7 @@ var LegacyDocsPublisher = class {
|
|
|
900534
900613
|
previewId,
|
|
900535
900614
|
disableTemplates: void 0,
|
|
900536
900615
|
skipUpload,
|
|
900537
|
-
cliVersion: "5.
|
|
900616
|
+
cliVersion: "5.57.0",
|
|
900538
900617
|
loginCommand: "fern auth login"
|
|
900539
900618
|
});
|
|
900540
900619
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -901524,7 +901603,7 @@ init_lib4();
|
|
|
901524
901603
|
init_lib8();
|
|
901525
901604
|
init_lib6();
|
|
901526
901605
|
init_source();
|
|
901527
|
-
var
|
|
901606
|
+
var import_promises122 = require("fs/promises");
|
|
901528
901607
|
var import_path82 = __toESM(require("path"), 1);
|
|
901529
901608
|
|
|
901530
901609
|
// ../cli-v2/lib/config/fern-yml/FernYmlBuilder.js
|
|
@@ -902395,7 +902474,7 @@ var InitCommand = class {
|
|
|
902395
902474
|
apiPath,
|
|
902396
902475
|
defaultGroup: result.defaultGroup
|
|
902397
902476
|
});
|
|
902398
|
-
await (0,
|
|
902477
|
+
await (0, import_promises122.writeFile)(fernYmlPath, fernYmlContent, "utf-8");
|
|
902399
902478
|
context3.stderr.info(`
|
|
902400
902479
|
${Icons.success} Created ${FERN_YML_FILENAME}`);
|
|
902401
902480
|
}
|
|
@@ -902417,9 +902496,9 @@ var InitCommand = class {
|
|
|
902417
902496
|
}
|
|
902418
902497
|
async writeSpecFile(cwd2, filename, content5) {
|
|
902419
902498
|
const specsDir = join8(cwd2, RelativeFilePath2.of(SPECS_DIR));
|
|
902420
|
-
await (0,
|
|
902499
|
+
await (0, import_promises122.mkdir)(specsDir, { recursive: true });
|
|
902421
902500
|
const filePath = join8(specsDir, RelativeFilePath2.of(filename));
|
|
902422
|
-
await (0,
|
|
902501
|
+
await (0, import_promises122.writeFile)(filePath, content5, "utf-8");
|
|
902423
902502
|
}
|
|
902424
902503
|
resolveApiPath(apiSource) {
|
|
902425
902504
|
switch (apiSource.type) {
|
|
@@ -903581,7 +903660,7 @@ function addReplayCommand(cli) {
|
|
|
903581
903660
|
init_lib8();
|
|
903582
903661
|
init_lib6();
|
|
903583
903662
|
init_source();
|
|
903584
|
-
var
|
|
903663
|
+
var import_promises123 = require("fs/promises");
|
|
903585
903664
|
var SchemaCommand = class {
|
|
903586
903665
|
async handle(context3, args) {
|
|
903587
903666
|
const schema = this.resolveSchema(args.name);
|
|
@@ -903617,9 +903696,9 @@ var SchemaCommand = class {
|
|
|
903617
903696
|
const absoluteOutputPath = resolve6(context3.cwd, outputPath);
|
|
903618
903697
|
const outputDir = dirname6(absoluteOutputPath);
|
|
903619
903698
|
if (!await doesPathExist(outputDir)) {
|
|
903620
|
-
await (0,
|
|
903699
|
+
await (0, import_promises123.mkdir)(outputDir, { recursive: true });
|
|
903621
903700
|
}
|
|
903622
|
-
await (0,
|
|
903701
|
+
await (0, import_promises123.writeFile)(absoluteOutputPath, this.formatJson(value2, pretty));
|
|
903623
903702
|
context3.stderr.info(source_default.green(`Wrote JSON Schema to ${absoluteOutputPath}`));
|
|
903624
903703
|
}
|
|
903625
903704
|
};
|
|
@@ -903903,13 +903982,13 @@ init_lib4();
|
|
|
903903
903982
|
init_lib8();
|
|
903904
903983
|
init_lib6();
|
|
903905
903984
|
init_source();
|
|
903906
|
-
var
|
|
903985
|
+
var import_promises141 = require("fs/promises");
|
|
903907
903986
|
init_js_yaml();
|
|
903908
903987
|
|
|
903909
903988
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
903910
903989
|
init_lib8();
|
|
903911
903990
|
init_lib6();
|
|
903912
|
-
var
|
|
903991
|
+
var import_promises124 = require("fs/promises");
|
|
903913
903992
|
var import_os11 = require("os");
|
|
903914
903993
|
var import_path86 = __toESM(require("path"), 1);
|
|
903915
903994
|
|
|
@@ -903986,9 +904065,9 @@ var ApiSpecResolver = class {
|
|
|
903986
904065
|
});
|
|
903987
904066
|
}
|
|
903988
904067
|
const extension4 = this.inferExtensionFromContent(content5);
|
|
903989
|
-
const tempDir2 = await (0,
|
|
904068
|
+
const tempDir2 = await (0, import_promises124.mkdtemp)(import_path86.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
903990
904069
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path86.default.join(tempDir2, `spec${extension4}`));
|
|
903991
|
-
await (0,
|
|
904070
|
+
await (0, import_promises124.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
903992
904071
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: "stdin" });
|
|
903993
904072
|
return {
|
|
903994
904073
|
absoluteFilePath,
|
|
@@ -904004,9 +904083,9 @@ var ApiSpecResolver = class {
|
|
|
904004
904083
|
async resolveUrl({ reference: reference4 }) {
|
|
904005
904084
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
904006
904085
|
const extension4 = this.inferExtension({ url: reference4, contentType });
|
|
904007
|
-
const tempDir2 = await (0,
|
|
904086
|
+
const tempDir2 = await (0, import_promises124.mkdtemp)(import_path86.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
904008
904087
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path86.default.join(tempDir2, `spec${extension4}`));
|
|
904009
|
-
await (0,
|
|
904088
|
+
await (0, import_promises124.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
904010
904089
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
904011
904090
|
return {
|
|
904012
904091
|
absoluteFilePath,
|
|
@@ -904022,7 +904101,7 @@ var ApiSpecResolver = class {
|
|
|
904022
904101
|
code: CliError.Code.ConfigError
|
|
904023
904102
|
});
|
|
904024
904103
|
}
|
|
904025
|
-
const content5 = await (0,
|
|
904104
|
+
const content5 = await (0, import_promises124.readFile)(absoluteFilePath, "utf-8");
|
|
904026
904105
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
904027
904106
|
return {
|
|
904028
904107
|
absoluteFilePath,
|
|
@@ -922803,7 +922882,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
922803
922882
|
|
|
922804
922883
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
922805
922884
|
init_lib8();
|
|
922806
|
-
var
|
|
922885
|
+
var import_promises125 = require("fs/promises");
|
|
922807
922886
|
var import_path88 = __toESM(require("path"), 1);
|
|
922808
922887
|
|
|
922809
922888
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -922937,8 +923016,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
922937
923016
|
endpointId
|
|
922938
923017
|
});
|
|
922939
923018
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
922940
|
-
await (0,
|
|
922941
|
-
await (0,
|
|
923019
|
+
await (0, import_promises125.mkdir)(import_path88.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
923020
|
+
await (0, import_promises125.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
922942
923021
|
} catch (error50) {
|
|
922943
923022
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
922944
923023
|
}
|
|
@@ -922947,8 +923026,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
922947
923026
|
}
|
|
922948
923027
|
async initializeProject(outputDir) {
|
|
922949
923028
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
922950
|
-
await (0,
|
|
922951
|
-
await (0,
|
|
923029
|
+
await (0, import_promises125.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
923030
|
+
await (0, import_promises125.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
|
|
922952
923031
|
return absolutePathToOutputDir;
|
|
922953
923032
|
}
|
|
922954
923033
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -926461,7 +926540,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
926461
926540
|
};
|
|
926462
926541
|
|
|
926463
926542
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
926464
|
-
var
|
|
926543
|
+
var import_promises126 = require("fs/promises");
|
|
926465
926544
|
var import_path90 = __toESM(require("path"), 1);
|
|
926466
926545
|
var DynamicSnippetsGoTestGenerator = class {
|
|
926467
926546
|
context;
|
|
@@ -926490,8 +926569,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
926490
926569
|
endpointId
|
|
926491
926570
|
});
|
|
926492
926571
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
926493
|
-
await (0,
|
|
926494
|
-
await (0,
|
|
926572
|
+
await (0, import_promises126.mkdir)(import_path90.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
926573
|
+
await (0, import_promises126.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
926495
926574
|
} catch (error50) {
|
|
926496
926575
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
926497
926576
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -930378,7 +930457,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
930378
930457
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
930379
930458
|
init_lib33();
|
|
930380
930459
|
init_lib6();
|
|
930381
|
-
var
|
|
930460
|
+
var import_promises127 = require("fs/promises");
|
|
930382
930461
|
var import_path91 = __toESM(require("path"), 1);
|
|
930383
930462
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
930384
930463
|
context;
|
|
@@ -930416,8 +930495,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930416
930495
|
endpointId
|
|
930417
930496
|
});
|
|
930418
930497
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
930419
|
-
await (0,
|
|
930420
|
-
await (0,
|
|
930498
|
+
await (0, import_promises127.mkdir)(import_path91.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
930499
|
+
await (0, import_promises127.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
930421
930500
|
} catch (error50) {
|
|
930422
930501
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
930423
930502
|
}
|
|
@@ -930444,7 +930523,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930444
930523
|
const reportsPath = join8(outputDir, RelativeFilePath2.of("reports"));
|
|
930445
930524
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
930446
930525
|
if (buildReportsExists) {
|
|
930447
|
-
await (0,
|
|
930526
|
+
await (0, import_promises127.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
930448
930527
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
930449
930528
|
} else {
|
|
930450
930529
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -930458,7 +930537,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930458
930537
|
}
|
|
930459
930538
|
async initializeProject(outputDir) {
|
|
930460
930539
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
930461
|
-
await (0,
|
|
930540
|
+
await (0, import_promises127.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
930462
930541
|
return absolutePathToOutputDir;
|
|
930463
930542
|
}
|
|
930464
930543
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -933961,7 +934040,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
933961
934040
|
};
|
|
933962
934041
|
|
|
933963
934042
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
933964
|
-
var
|
|
934043
|
+
var import_promises128 = require("fs/promises");
|
|
933965
934044
|
var import_path92 = __toESM(require("path"), 1);
|
|
933966
934045
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
933967
934046
|
context;
|
|
@@ -933990,8 +934069,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
933990
934069
|
endpointId
|
|
933991
934070
|
});
|
|
933992
934071
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
933993
|
-
await (0,
|
|
933994
|
-
await (0,
|
|
934072
|
+
await (0, import_promises128.mkdir)(import_path92.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
934073
|
+
await (0, import_promises128.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
933995
934074
|
} catch (error50) {
|
|
933996
934075
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
933997
934076
|
}
|
|
@@ -937248,7 +937327,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
937248
937327
|
};
|
|
937249
937328
|
|
|
937250
937329
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
937251
|
-
var
|
|
937330
|
+
var import_promises129 = require("fs/promises");
|
|
937252
937331
|
var import_path93 = __toESM(require("path"), 1);
|
|
937253
937332
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
937254
937333
|
context;
|
|
@@ -937277,8 +937356,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
937277
937356
|
endpointId
|
|
937278
937357
|
});
|
|
937279
937358
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
937280
|
-
await (0,
|
|
937281
|
-
await (0,
|
|
937359
|
+
await (0, import_promises129.mkdir)(import_path93.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
937360
|
+
await (0, import_promises129.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
937282
937361
|
} catch (error50) {
|
|
937283
937362
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
937284
937363
|
}
|
|
@@ -940225,7 +940304,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
940225
940304
|
};
|
|
940226
940305
|
|
|
940227
940306
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
940228
|
-
var
|
|
940307
|
+
var import_promises130 = require("fs/promises");
|
|
940229
940308
|
var import_path94 = __toESM(require("path"), 1);
|
|
940230
940309
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
940231
940310
|
context;
|
|
@@ -940254,8 +940333,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
940254
940333
|
endpointId
|
|
940255
940334
|
});
|
|
940256
940335
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
940257
|
-
await (0,
|
|
940258
|
-
await (0,
|
|
940336
|
+
await (0, import_promises130.mkdir)(import_path94.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
940337
|
+
await (0, import_promises130.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
940259
940338
|
} catch (error50) {
|
|
940260
940339
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
940261
940340
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -940271,7 +940350,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
940271
940350
|
};
|
|
940272
940351
|
|
|
940273
940352
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
940274
|
-
var
|
|
940353
|
+
var import_promises131 = require("fs/promises");
|
|
940275
940354
|
var import_node_path40 = __toESM(require("path"), 1);
|
|
940276
940355
|
init_lib8();
|
|
940277
940356
|
|
|
@@ -945505,8 +945584,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945505
945584
|
absolutePathToOutputDir,
|
|
945506
945585
|
idx
|
|
945507
945586
|
});
|
|
945508
|
-
await (0,
|
|
945509
|
-
await (0,
|
|
945587
|
+
await (0, import_promises131.mkdir)(import_node_path40.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
945588
|
+
await (0, import_promises131.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
945510
945589
|
} catch (error50) {
|
|
945511
945590
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
945512
945591
|
}
|
|
@@ -945515,7 +945594,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945515
945594
|
}
|
|
945516
945595
|
async initializeProject(outputDir) {
|
|
945517
945596
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
945518
|
-
await (0,
|
|
945597
|
+
await (0, import_promises131.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
945519
945598
|
return absolutePathToOutputDir;
|
|
945520
945599
|
}
|
|
945521
945600
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -945524,7 +945603,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945524
945603
|
};
|
|
945525
945604
|
|
|
945526
945605
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
945527
|
-
var
|
|
945606
|
+
var import_promises132 = require("fs/promises");
|
|
945528
945607
|
var import_node_path41 = __toESM(require("path"), 1);
|
|
945529
945608
|
init_lib8();
|
|
945530
945609
|
|
|
@@ -950188,8 +950267,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
950188
950267
|
absolutePathToOutputDir,
|
|
950189
950268
|
idx
|
|
950190
950269
|
});
|
|
950191
|
-
await (0,
|
|
950192
|
-
await (0,
|
|
950270
|
+
await (0, import_promises132.mkdir)(import_node_path41.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
950271
|
+
await (0, import_promises132.writeFile)(dynamicSnippetFilePath, this.wrapSnippetAsLibrary(response.snippet, `Example${idx}`));
|
|
950193
950272
|
} catch (error50) {
|
|
950194
950273
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
950195
950274
|
}
|
|
@@ -950198,7 +950277,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
950198
950277
|
}
|
|
950199
950278
|
async initializeProject(outputDir) {
|
|
950200
950279
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Tests/Snippets"));
|
|
950201
|
-
await (0,
|
|
950280
|
+
await (0, import_promises132.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
950202
950281
|
return absolutePathToOutputDir;
|
|
950203
950282
|
}
|
|
950204
950283
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -952682,7 +952761,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
952682
952761
|
};
|
|
952683
952762
|
|
|
952684
952763
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
952685
|
-
var
|
|
952764
|
+
var import_promises133 = require("fs/promises");
|
|
952686
952765
|
var import_path95 = __toESM(require("path"), 1);
|
|
952687
952766
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
952688
952767
|
context;
|
|
@@ -952711,8 +952790,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
952711
952790
|
endpointId
|
|
952712
952791
|
});
|
|
952713
952792
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
952714
|
-
await (0,
|
|
952715
|
-
await (0,
|
|
952793
|
+
await (0, import_promises133.mkdir)(import_path95.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
952794
|
+
await (0, import_promises133.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
952716
952795
|
} catch (error50) {
|
|
952717
952796
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
952718
952797
|
}
|
|
@@ -952826,7 +952905,7 @@ init_lib8();
|
|
|
952826
952905
|
var import_autoversion3 = __toESM(require_autoversion(), 1);
|
|
952827
952906
|
init_lib9();
|
|
952828
952907
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
952829
|
-
var
|
|
952908
|
+
var import_promises137 = require("fs/promises");
|
|
952830
952909
|
var path102 = __toESM(require("path"), 1);
|
|
952831
952910
|
var import_path98 = require("path");
|
|
952832
952911
|
var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
@@ -952834,12 +952913,12 @@ var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
|
952834
952913
|
// ../generation/local-generation/local-workspace-runner/lib/applyTypeRelocations.js
|
|
952835
952914
|
init_lib8();
|
|
952836
952915
|
init_lib9();
|
|
952837
|
-
var
|
|
952916
|
+
var import_promises134 = require("fs/promises");
|
|
952838
952917
|
async function applyTypeRelocations({ ir: ir3, tmpOutputDirectory, context: context3 }) {
|
|
952839
952918
|
const relocationsFilepath = join8(tmpOutputDirectory, RelativeFilePath2.of(TYPE_RELOCATIONS_FILENAME));
|
|
952840
952919
|
let contents;
|
|
952841
952920
|
try {
|
|
952842
|
-
contents = await (0,
|
|
952921
|
+
contents = await (0, import_promises134.readFile)(relocationsFilepath, "utf-8");
|
|
952843
952922
|
} catch {
|
|
952844
952923
|
return;
|
|
952845
952924
|
}
|
|
@@ -952873,7 +952952,7 @@ async function applyTypeRelocations({ ir: ir3, tmpOutputDirectory, context: cont
|
|
|
952873
952952
|
} catch (error50) {
|
|
952874
952953
|
context3.logger.warn(`Failed to apply type relocations from ${relocationsFilepath}: ${error50 instanceof Error ? error50.message : String(error50)}`);
|
|
952875
952954
|
} finally {
|
|
952876
|
-
await (0,
|
|
952955
|
+
await (0, import_promises134.rm)(relocationsFilepath, { force: true });
|
|
952877
952956
|
}
|
|
952878
952957
|
}
|
|
952879
952958
|
|
|
@@ -953415,7 +953494,7 @@ var import_autoversion2 = __toESM(require_autoversion(), 1);
|
|
|
953415
953494
|
init_lib33();
|
|
953416
953495
|
init_lib6();
|
|
953417
953496
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
953418
|
-
var
|
|
953497
|
+
var import_promises135 = require("fs/promises");
|
|
953419
953498
|
var import_os12 = require("os");
|
|
953420
953499
|
var import_path96 = require("path");
|
|
953421
953500
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
@@ -953524,7 +953603,7 @@ var LocalTaskHandler = class {
|
|
|
953524
953603
|
try {
|
|
953525
953604
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
953526
953605
|
diffFile = await this.generateDiffFile();
|
|
953527
|
-
const diffContent = await (0,
|
|
953606
|
+
const diffContent = await (0, import_promises135.readFile)(diffFile, "utf-8");
|
|
953528
953607
|
if (diffContent.trim().length === 0) {
|
|
953529
953608
|
this.context.logger.info("No changes detected in generated SDK");
|
|
953530
953609
|
return null;
|
|
@@ -953729,7 +953808,7 @@ var LocalTaskHandler = class {
|
|
|
953729
953808
|
} finally {
|
|
953730
953809
|
if (diffFile) {
|
|
953731
953810
|
try {
|
|
953732
|
-
await (0,
|
|
953811
|
+
await (0, import_promises135.rm)(diffFile);
|
|
953733
953812
|
} catch (cleanupError) {
|
|
953734
953813
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
953735
953814
|
}
|
|
@@ -953910,7 +953989,7 @@ var LocalTaskHandler = class {
|
|
|
953910
953989
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
953911
953990
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
953912
953991
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
953913
|
-
await (0,
|
|
953992
|
+
await (0, import_promises135.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true, verbatimSymlinks: true });
|
|
953914
953993
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
953915
953994
|
await this.runThrowawayGitCommand(["config", "gc.auto", "0"], tmpOutputResolutionDir);
|
|
953916
953995
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
@@ -953931,22 +954010,22 @@ var LocalTaskHandler = class {
|
|
|
953931
954010
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
953932
954011
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
953933
954012
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
953934
|
-
await (0,
|
|
954013
|
+
await (0, import_promises135.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), {
|
|
953935
954014
|
recursive: true,
|
|
953936
954015
|
force: true,
|
|
953937
954016
|
maxRetries: 3,
|
|
953938
954017
|
retryDelay: 100
|
|
953939
954018
|
});
|
|
953940
|
-
await (0,
|
|
953941
|
-
await (0,
|
|
954019
|
+
await (0, import_promises135.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
954020
|
+
await (0, import_promises135.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true, verbatimSymlinks: true });
|
|
953942
954021
|
}
|
|
953943
954022
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
953944
|
-
const contents = await (0,
|
|
954023
|
+
const contents = await (0, import_promises135.readdir)(this.absolutePathToLocalOutput);
|
|
953945
954024
|
const itemsToPreserve = [".git"];
|
|
953946
954025
|
if (await this.generatedOutputMissingReadme()) {
|
|
953947
954026
|
itemsToPreserve.push("README.md");
|
|
953948
954027
|
}
|
|
953949
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
954028
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises135.rm)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
953950
954029
|
force: true,
|
|
953951
954030
|
recursive: true
|
|
953952
954031
|
})));
|
|
@@ -953954,11 +954033,11 @@ var LocalTaskHandler = class {
|
|
|
953954
954033
|
}
|
|
953955
954034
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
953956
954035
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
953957
|
-
await (0,
|
|
954036
|
+
await (0, import_promises135.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
953958
954037
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
953959
954038
|
}
|
|
953960
954039
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
953961
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
954040
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises135.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
953962
954041
|
if (firstLocalOutputItem == null) {
|
|
953963
954042
|
return;
|
|
953964
954043
|
}
|
|
@@ -953966,10 +954045,10 @@ var LocalTaskHandler = class {
|
|
|
953966
954045
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
953967
954046
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
953968
954047
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
953969
|
-
await (0,
|
|
954048
|
+
await (0, import_promises135.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true, verbatimSymlinks: true });
|
|
953970
954049
|
}
|
|
953971
954050
|
} else {
|
|
953972
|
-
await (0,
|
|
954051
|
+
await (0, import_promises135.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true, verbatimSymlinks: true });
|
|
953973
954052
|
}
|
|
953974
954053
|
}
|
|
953975
954054
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
@@ -953990,7 +954069,7 @@ var LocalTaskHandler = class {
|
|
|
953990
954069
|
*/
|
|
953991
954070
|
async generatedOutputMissingReadme() {
|
|
953992
954071
|
try {
|
|
953993
|
-
const contents = await (0,
|
|
954072
|
+
const contents = await (0, import_promises135.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
953994
954073
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
953995
954074
|
return false;
|
|
953996
954075
|
}
|
|
@@ -954040,13 +954119,13 @@ var LocalTaskHandler = class {
|
|
|
954040
954119
|
async readPriorChangelog(maxEntries) {
|
|
954041
954120
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
954042
954121
|
try {
|
|
954043
|
-
const files = await (0,
|
|
954122
|
+
const files = await (0, import_promises135.readdir)(this.absolutePathToLocalOutput);
|
|
954044
954123
|
const changelogFile = files.find((f3) => f3.toLowerCase() === "changelog.md");
|
|
954045
954124
|
if (!changelogFile) {
|
|
954046
954125
|
return "";
|
|
954047
954126
|
}
|
|
954048
954127
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
954049
|
-
const content5 = await (0,
|
|
954128
|
+
const content5 = await (0, import_promises135.readFile)(changelogPath, "utf-8");
|
|
954050
954129
|
if (content5.trim().length === 0) {
|
|
954051
954130
|
return "";
|
|
954052
954131
|
}
|
|
@@ -954122,11 +954201,11 @@ var LocalTaskHandler = class {
|
|
|
954122
954201
|
}
|
|
954123
954202
|
};
|
|
954124
954203
|
async function copySnippetJsonIfNonEmpty({ src, dest }) {
|
|
954125
|
-
const tmpStat = await (0,
|
|
954204
|
+
const tmpStat = await (0, import_promises135.stat)(src);
|
|
954126
954205
|
if (tmpStat.size === 0) {
|
|
954127
954206
|
return "skipped-empty";
|
|
954128
954207
|
}
|
|
954129
|
-
await (0,
|
|
954208
|
+
await (0, import_promises135.cp)(src, dest);
|
|
954130
954209
|
return "copied";
|
|
954131
954210
|
}
|
|
954132
954211
|
|
|
@@ -954134,7 +954213,7 @@ async function copySnippetJsonIfNonEmpty({ src, dest }) {
|
|
|
954134
954213
|
init_lib4();
|
|
954135
954214
|
init_lib8();
|
|
954136
954215
|
init_lib35();
|
|
954137
|
-
var
|
|
954216
|
+
var import_promises136 = require("fs/promises");
|
|
954138
954217
|
init_js_yaml();
|
|
954139
954218
|
var import_path97 = __toESM(require("path"), 1);
|
|
954140
954219
|
init_index_min2();
|
|
@@ -954203,7 +954282,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
954203
954282
|
});
|
|
954204
954283
|
}
|
|
954205
954284
|
resolved = filterSpec(resolved, audiences);
|
|
954206
|
-
await (0,
|
|
954285
|
+
await (0, import_promises136.writeFile)(import_path97.default.join(hostOutputDir, filename), JSON.stringify(resolved));
|
|
954207
954286
|
context3.logger.debug(`Resolved ${isAsync2 ? "AsyncAPI" : "OpenAPI"} spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
954208
954287
|
return {
|
|
954209
954288
|
type: isAsync2 ? "asyncapi" : "openapi",
|
|
@@ -954213,7 +954292,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
954213
954292
|
}
|
|
954214
954293
|
async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context: context3, index: index3 }) {
|
|
954215
954294
|
const filename = `openrpc${index3}.json`;
|
|
954216
|
-
const rawContent = await (0,
|
|
954295
|
+
const rawContent = await (0, import_promises136.readFile)(spec.absoluteFilepath, "utf-8");
|
|
954217
954296
|
let parsed;
|
|
954218
954297
|
try {
|
|
954219
954298
|
parsed = JSON.parse(rawContent);
|
|
@@ -954223,7 +954302,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954223
954302
|
let result = parsed;
|
|
954224
954303
|
const overrides = normalizeOverrides(spec.absoluteFilepathToOverrides);
|
|
954225
954304
|
for (const overridePath of overrides) {
|
|
954226
|
-
const overrideContent = await (0,
|
|
954305
|
+
const overrideContent = await (0, import_promises136.readFile)(overridePath, "utf-8");
|
|
954227
954306
|
let overrideParsed;
|
|
954228
954307
|
try {
|
|
954229
954308
|
overrideParsed = JSON.parse(overrideContent);
|
|
@@ -954235,7 +954314,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954235
954314
|
overrides: overrideParsed
|
|
954236
954315
|
});
|
|
954237
954316
|
}
|
|
954238
|
-
await (0,
|
|
954317
|
+
await (0, import_promises136.writeFile)(import_path97.default.join(hostOutputDir, filename), JSON.stringify(result));
|
|
954239
954318
|
context3.logger.debug(`Resolved OpenRPC spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
954240
954319
|
return {
|
|
954241
954320
|
type: "openrpc",
|
|
@@ -954246,7 +954325,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954246
954325
|
async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
954247
954326
|
const dirName = `protobuf${index3}`;
|
|
954248
954327
|
const destDir = import_path97.default.join(hostOutputDir, dirName);
|
|
954249
|
-
await (0,
|
|
954328
|
+
await (0, import_promises136.cp)(spec.absoluteFilepathToProtobufRoot, destDir, { recursive: true });
|
|
954250
954329
|
const entry = {
|
|
954251
954330
|
type: "protobuf",
|
|
954252
954331
|
specPath: toContainerPath(dirName, containerBaseDir)
|
|
@@ -954256,7 +954335,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
954256
954335
|
entry.overridePaths = [];
|
|
954257
954336
|
for (const [i5, override] of overrides.entries()) {
|
|
954258
954337
|
const overrideName = `protobuf${index3}-override-${i5}${import_path97.default.extname(override)}`;
|
|
954259
|
-
await (0,
|
|
954338
|
+
await (0, import_promises136.copyFile)(override, import_path97.default.join(hostOutputDir, overrideName));
|
|
954260
954339
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
954261
954340
|
}
|
|
954262
954341
|
}
|
|
@@ -954265,7 +954344,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
954265
954344
|
async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
954266
954345
|
const ext2 = import_path97.default.extname(spec.absoluteFilepath) || ".graphql";
|
|
954267
954346
|
const filename = `graphql${index3}${ext2}`;
|
|
954268
|
-
await (0,
|
|
954347
|
+
await (0, import_promises136.copyFile)(spec.absoluteFilepath, import_path97.default.join(hostOutputDir, filename));
|
|
954269
954348
|
const entry = {
|
|
954270
954349
|
type: "graphql",
|
|
954271
954350
|
specPath: toContainerPath(filename, containerBaseDir),
|
|
@@ -954276,7 +954355,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
954276
954355
|
entry.overridePaths = [];
|
|
954277
954356
|
for (const [i5, override] of overrides.entries()) {
|
|
954278
954357
|
const overrideName = `graphql${index3}-override-${i5}${import_path97.default.extname(override)}`;
|
|
954279
|
-
await (0,
|
|
954358
|
+
await (0, import_promises136.copyFile)(override, import_path97.default.join(hostOutputDir, overrideName));
|
|
954280
954359
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
954281
954360
|
}
|
|
954282
954361
|
}
|
|
@@ -954284,7 +954363,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
954284
954363
|
}
|
|
954285
954364
|
async function isAsyncAPISpec(filepath) {
|
|
954286
954365
|
try {
|
|
954287
|
-
const content5 = await (0,
|
|
954366
|
+
const content5 = await (0, import_promises136.readFile)(filepath, "utf-8");
|
|
954288
954367
|
return content5.includes("asyncapi");
|
|
954289
954368
|
} catch {
|
|
954290
954369
|
return false;
|
|
@@ -954394,7 +954473,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
954394
954473
|
context: context3,
|
|
954395
954474
|
audiences
|
|
954396
954475
|
});
|
|
954397
|
-
await (0,
|
|
954476
|
+
await (0, import_promises136.writeFile)(join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of(SPECS_MANIFEST_FILENAME)), JSON.stringify(manifest, void 0, 4));
|
|
954398
954477
|
const tarGzPath = join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of("specs.tar.gz"));
|
|
954399
954478
|
await Kn({
|
|
954400
954479
|
gzip: true,
|
|
@@ -954403,7 +954482,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
954403
954482
|
portable: true,
|
|
954404
954483
|
filter: (entryPath) => entryPath !== "./specs.tar.gz"
|
|
954405
954484
|
}, ["."]);
|
|
954406
|
-
return await (0,
|
|
954485
|
+
return await (0, import_promises136.readFile)(tarGzPath);
|
|
954407
954486
|
} finally {
|
|
954408
954487
|
await tmpDir.cleanup();
|
|
954409
954488
|
}
|
|
@@ -954445,24 +954524,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954445
954524
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
954446
954525
|
const configJsonFile = (0, import_path98.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
954447
954526
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
954448
|
-
await (0,
|
|
954527
|
+
await (0, import_promises137.writeFile)(configJsonFile, "");
|
|
954449
954528
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
954450
954529
|
const tmpOutputDirectory = (0, import_path98.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
954451
954530
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
954452
|
-
await (0,
|
|
954531
|
+
await (0, import_promises137.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
954453
954532
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
954454
954533
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
954455
954534
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
954456
954535
|
const snippetJsonFile = (0, import_path98.join)(workspaceTempDir.path, "snippet.json");
|
|
954457
954536
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
954458
|
-
await (0,
|
|
954537
|
+
await (0, import_promises137.writeFile)(snippetJsonFile, "");
|
|
954459
954538
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
954460
954539
|
}
|
|
954461
954540
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
954462
954541
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
954463
954542
|
const snippetTemplatesJsonFile = (0, import_path98.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
954464
954543
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
954465
|
-
await (0,
|
|
954544
|
+
await (0, import_promises137.writeFile)(snippetTemplatesJsonFile, "");
|
|
954466
954545
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
954467
954546
|
}
|
|
954468
954547
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -954503,7 +954582,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954503
954582
|
publishToRegistry,
|
|
954504
954583
|
paths
|
|
954505
954584
|
});
|
|
954506
|
-
await (0,
|
|
954585
|
+
await (0, import_promises137.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
954507
954586
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
954508
954587
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
954509
954588
|
hostPath: source2.absoluteFilePath,
|
|
@@ -954511,7 +954590,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954511
954590
|
}));
|
|
954512
954591
|
if (rawApiSpecs != null && rawApiSpecs.length > 0) {
|
|
954513
954592
|
const rawSpecsDir = (0, import_path98.join)(workspaceTempDir.path, SPECS_DIRECTORY_NAME);
|
|
954514
|
-
await (0,
|
|
954593
|
+
await (0, import_promises137.mkdir)(rawSpecsDir, { recursive: true });
|
|
954515
954594
|
const containerSpecsDir = environment2.usesContainerPaths ? CONTAINER_SPECS_DIRECTORY : rawSpecsDir;
|
|
954516
954595
|
const manifest = await collectRawSpecs({
|
|
954517
954596
|
specs: rawApiSpecs,
|
|
@@ -954520,7 +954599,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954520
954599
|
context: context3,
|
|
954521
954600
|
audiences
|
|
954522
954601
|
});
|
|
954523
|
-
await (0,
|
|
954602
|
+
await (0, import_promises137.writeFile)((0, import_path98.join)(rawSpecsDir, SPECS_MANIFEST_FILENAME), JSON.stringify(manifest, void 0, 4));
|
|
954524
954603
|
context3.logger.debug(`Wrote raw specs manifest with ${manifest.specs.length} spec(s) to ${rawSpecsDir}`);
|
|
954525
954604
|
sourceMounts.push({
|
|
954526
954605
|
hostPath: AbsoluteFilePath2.of(rawSpecsDir),
|
|
@@ -955284,7 +955363,7 @@ async function runVerifyPipeline({ outputDir, generatorName, generatorVersion, c
|
|
|
955284
955363
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
955285
955364
|
init_lib5();
|
|
955286
955365
|
init_lib6();
|
|
955287
|
-
var
|
|
955366
|
+
var import_promises139 = require("fs/promises");
|
|
955288
955367
|
|
|
955289
955368
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
955290
955369
|
init_lib12();
|
|
@@ -955294,7 +955373,7 @@ init_lib8();
|
|
|
955294
955373
|
init_lib11();
|
|
955295
955374
|
init_lib6();
|
|
955296
955375
|
init_esm19();
|
|
955297
|
-
var
|
|
955376
|
+
var import_promises138 = require("fs/promises");
|
|
955298
955377
|
var LegacyGeneratorInvocationAdapter = class {
|
|
955299
955378
|
context;
|
|
955300
955379
|
constructor(config5) {
|
|
@@ -955548,7 +955627,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
955548
955627
|
code: CliError.Code.InternalError
|
|
955549
955628
|
});
|
|
955550
955629
|
}
|
|
955551
|
-
const contents = await (0,
|
|
955630
|
+
const contents = await (0, import_promises138.readFile)(absolutePath, "utf-8");
|
|
955552
955631
|
return api_exports4.GithubLicense.custom({ contents });
|
|
955553
955632
|
}
|
|
955554
955633
|
buildReadme(target) {
|
|
@@ -955774,7 +955853,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
955774
955853
|
});
|
|
955775
955854
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
955776
955855
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
955777
|
-
await (0,
|
|
955856
|
+
await (0, import_promises139.rm)(snippetPath, { force: true });
|
|
955778
955857
|
}
|
|
955779
955858
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
955780
955859
|
return {
|
|
@@ -955793,7 +955872,7 @@ init_lib4();
|
|
|
955793
955872
|
init_lib8();
|
|
955794
955873
|
init_lib5();
|
|
955795
955874
|
init_lib6();
|
|
955796
|
-
var
|
|
955875
|
+
var import_promises140 = require("fs/promises");
|
|
955797
955876
|
var import_os14 = require("os");
|
|
955798
955877
|
var LegacyRemoteGenerationRunner = class {
|
|
955799
955878
|
context;
|
|
@@ -955852,13 +955931,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
955852
955931
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
955853
955932
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
955854
955933
|
if (targetOutputDirectory != null) {
|
|
955855
|
-
await (0,
|
|
955856
|
-
await (0,
|
|
955934
|
+
await (0, import_promises140.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
955935
|
+
await (0, import_promises140.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
955857
955936
|
recursive: true,
|
|
955858
955937
|
force: true
|
|
955859
955938
|
});
|
|
955860
955939
|
}
|
|
955861
|
-
await (0,
|
|
955940
|
+
await (0, import_promises140.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
955862
955941
|
}
|
|
955863
955942
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
955864
955943
|
return {
|
|
@@ -955887,7 +955966,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
955887
955966
|
}
|
|
955888
955967
|
async getAbsolutePathToPreview(args) {
|
|
955889
955968
|
if (this.isLocalGitCombo(args)) {
|
|
955890
|
-
const tmpPreviewDirectory = await (0,
|
|
955969
|
+
const tmpPreviewDirectory = await (0, import_promises140.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
955891
955970
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
955892
955971
|
}
|
|
955893
955972
|
if (!args.preview) {
|
|
@@ -956623,7 +956702,7 @@ Example:
|
|
|
956623
956702
|
if (!exists2) {
|
|
956624
956703
|
return { shouldProceed: true };
|
|
956625
956704
|
}
|
|
956626
|
-
const files = await (0,
|
|
956705
|
+
const files = await (0, import_promises141.readdir)(outputPath);
|
|
956627
956706
|
if (files.length === 0) {
|
|
956628
956707
|
return { shouldProceed: true };
|
|
956629
956708
|
}
|
|
@@ -957035,7 +957114,7 @@ init_lib4();
|
|
|
957035
957114
|
init_lib33();
|
|
957036
957115
|
init_lib6();
|
|
957037
957116
|
var import_fs38 = require("fs");
|
|
957038
|
-
var
|
|
957117
|
+
var import_promises142 = require("fs/promises");
|
|
957039
957118
|
var import_path101 = require("path");
|
|
957040
957119
|
var import_semver14 = __toESM(require_semver2(), 1);
|
|
957041
957120
|
var import_url8 = require("url");
|
|
@@ -957145,7 +957224,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957145
957224
|
}
|
|
957146
957225
|
this.migrationsInstallPromise = (async () => {
|
|
957147
957226
|
const cacheDir = this.cachePath;
|
|
957148
|
-
await (0,
|
|
957227
|
+
await (0, import_promises142.mkdir)(cacheDir, { recursive: true });
|
|
957149
957228
|
const npmCacheDir = (0, import_path101.join)(cacheDir, ".npm-cache");
|
|
957150
957229
|
const packageDir = (0, import_path101.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
957151
957230
|
const packageJsonPath = (0, import_path101.join)(packageDir, "package.json");
|
|
@@ -957162,7 +957241,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957162
957241
|
"--no-audit",
|
|
957163
957242
|
"--no-fund"
|
|
957164
957243
|
], { doNotPipeOutput: true });
|
|
957165
|
-
const packageJsonContent = await (0,
|
|
957244
|
+
const packageJsonContent = await (0, import_promises142.readFile)(packageJsonPath, "utf-8");
|
|
957166
957245
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
957167
957246
|
if (packageJson2.main == null) {
|
|
957168
957247
|
throw new CliError({
|
|
@@ -957207,7 +957286,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957207
957286
|
const myPid = String(process.pid);
|
|
957208
957287
|
while (true) {
|
|
957209
957288
|
try {
|
|
957210
|
-
const fh = await (0,
|
|
957289
|
+
const fh = await (0, import_promises142.open)(lockPath, "wx");
|
|
957211
957290
|
await fh.writeFile(myPid);
|
|
957212
957291
|
await fh.close();
|
|
957213
957292
|
const exitHandler = () => {
|
|
@@ -957224,9 +957303,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957224
957303
|
return async () => {
|
|
957225
957304
|
process.removeListener("exit", exitHandler);
|
|
957226
957305
|
try {
|
|
957227
|
-
const currentContent = await (0,
|
|
957306
|
+
const currentContent = await (0, import_promises142.readFile)(lockPath, "utf-8");
|
|
957228
957307
|
if (currentContent.trim() === myPid) {
|
|
957229
|
-
await (0,
|
|
957308
|
+
await (0, import_promises142.unlink)(lockPath);
|
|
957230
957309
|
} else {
|
|
957231
957310
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
957232
957311
|
}
|
|
@@ -957240,14 +957319,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957240
957319
|
throw err;
|
|
957241
957320
|
}
|
|
957242
957321
|
try {
|
|
957243
|
-
const lockContent = await (0,
|
|
957322
|
+
const lockContent = await (0, import_promises142.readFile)(lockPath, "utf-8");
|
|
957244
957323
|
const lockPid = Number(lockContent.trim());
|
|
957245
|
-
const lockStat = await (0,
|
|
957324
|
+
const lockStat = await (0, import_promises142.stat)(lockPath);
|
|
957246
957325
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
957247
957326
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
957248
957327
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
957249
957328
|
try {
|
|
957250
|
-
await (0,
|
|
957329
|
+
await (0, import_promises142.unlink)(lockPath);
|
|
957251
957330
|
} catch (unlinkErr) {
|
|
957252
957331
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
957253
957332
|
}
|
|
@@ -957936,7 +958015,7 @@ var import_generator_cli5 = __toESM(require_api3(), 1);
|
|
|
957936
958015
|
init_lib19();
|
|
957937
958016
|
init_lib8();
|
|
957938
958017
|
init_source();
|
|
957939
|
-
var
|
|
958018
|
+
var import_promises147 = require("fs/promises");
|
|
957940
958019
|
var import_fs_extra = __toESM(require_lib18(), 1);
|
|
957941
958020
|
var import_path104 = __toESM(require("path"), 1);
|
|
957942
958021
|
|
|
@@ -957946,7 +958025,7 @@ init_lib26();
|
|
|
957946
958025
|
init_lib8();
|
|
957947
958026
|
init_lib6();
|
|
957948
958027
|
init_source();
|
|
957949
|
-
var
|
|
958028
|
+
var import_promises144 = require("fs/promises");
|
|
957950
958029
|
init_lodash();
|
|
957951
958030
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
957952
958031
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -957978,7 +958057,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
957978
958057
|
}
|
|
957979
958058
|
}
|
|
957980
958059
|
}
|
|
957981
|
-
await (0,
|
|
958060
|
+
await (0, import_promises144.mkdir)(FERN_DIRECTORY);
|
|
957982
958061
|
await writeProjectConfig({
|
|
957983
958062
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
957984
958063
|
organization,
|
|
@@ -958002,11 +958081,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
958002
958081
|
organization,
|
|
958003
958082
|
version: versionOfCli
|
|
958004
958083
|
};
|
|
958005
|
-
await (0,
|
|
958084
|
+
await (0, import_promises144.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
958006
958085
|
}
|
|
958007
958086
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
958008
958087
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
958009
|
-
await (0,
|
|
958088
|
+
await (0, import_promises144.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
958010
958089
|
}
|
|
958011
958090
|
|
|
958012
958091
|
// ../init/lib/createWorkspace.js
|
|
@@ -958200,7 +958279,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
958200
958279
|
init_lib4();
|
|
958201
958280
|
init_lib6();
|
|
958202
958281
|
init_source();
|
|
958203
|
-
var
|
|
958282
|
+
var import_promises145 = require("fs/promises");
|
|
958204
958283
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
958205
958284
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
958206
958285
|
const formatted = await formatDefinitionFile({
|
|
@@ -958208,7 +958287,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
958208
958287
|
});
|
|
958209
958288
|
if (formatted !== file4.rawContents) {
|
|
958210
958289
|
if (shouldFix) {
|
|
958211
|
-
await (0,
|
|
958290
|
+
await (0, import_promises145.writeFile)(file4.absoluteFilePath, formatted);
|
|
958212
958291
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
958213
958292
|
} else {
|
|
958214
958293
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -958221,7 +958300,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
958221
958300
|
// ../init/lib/createWorkspace.js
|
|
958222
958301
|
init_lib8();
|
|
958223
958302
|
init_lib6();
|
|
958224
|
-
var
|
|
958303
|
+
var import_promises146 = require("fs/promises");
|
|
958225
958304
|
init_js_yaml();
|
|
958226
958305
|
|
|
958227
958306
|
// ../init/lib/sampleImdbApi.js
|
|
@@ -958422,7 +958501,7 @@ components:
|
|
|
958422
958501
|
// ../init/lib/createWorkspace.js
|
|
958423
958502
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
958424
958503
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958425
|
-
await (0,
|
|
958504
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace);
|
|
958426
958505
|
}
|
|
958427
958506
|
await writeGeneratorsConfiguration({
|
|
958428
958507
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -958437,7 +958516,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
958437
958516
|
}
|
|
958438
958517
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
958439
958518
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958440
|
-
await (0,
|
|
958519
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace);
|
|
958441
958520
|
}
|
|
958442
958521
|
await writeGeneratorsConfiguration({
|
|
958443
958522
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -958450,10 +958529,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
958450
958529
|
}
|
|
958451
958530
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
958452
958531
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958453
|
-
await (0,
|
|
958532
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
958454
958533
|
}
|
|
958455
958534
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
958456
|
-
await (0,
|
|
958535
|
+
await (0, import_promises146.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
958457
958536
|
await writeGeneratorsConfiguration({
|
|
958458
958537
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
958459
958538
|
cliVersion,
|
|
@@ -958498,7 +958577,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
958498
958577
|
return config5;
|
|
958499
958578
|
}
|
|
958500
958579
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
958501
|
-
await (0,
|
|
958580
|
+
await (0, import_promises146.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + index_vite_proxy_tmp_default.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
958502
958581
|
sortKeys: (a3, b5) => {
|
|
958503
958582
|
if (a3 === "api") {
|
|
958504
958583
|
return -1;
|
|
@@ -958517,8 +958596,8 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
958517
958596
|
strategy: "status-code"
|
|
958518
958597
|
}
|
|
958519
958598
|
};
|
|
958520
|
-
await (0,
|
|
958521
|
-
await (0,
|
|
958599
|
+
await (0, import_promises146.mkdir)(directoryOfDefinition);
|
|
958600
|
+
await (0, import_promises146.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), index_vite_proxy_tmp_default.dump(rootApi));
|
|
958522
958601
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
958523
958602
|
let formattedContent;
|
|
958524
958603
|
try {
|
|
@@ -958534,7 +958613,7 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
958534
958613
|
code: CliError.Code.ParseError
|
|
958535
958614
|
});
|
|
958536
958615
|
}
|
|
958537
|
-
await (0,
|
|
958616
|
+
await (0, import_promises146.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
958538
958617
|
}
|
|
958539
958618
|
|
|
958540
958619
|
// ../init/lib/initializeAPI.js
|
|
@@ -958585,7 +958664,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
958585
958664
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
958586
958665
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
958587
958666
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
958588
|
-
await (0,
|
|
958667
|
+
await (0, import_promises147.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
958589
958668
|
if (inlinedApiDefinition) {
|
|
958590
958669
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
958591
958670
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -958624,7 +958703,7 @@ init_lib19();
|
|
|
958624
958703
|
init_lib4();
|
|
958625
958704
|
init_lib8();
|
|
958626
958705
|
init_source();
|
|
958627
|
-
var
|
|
958706
|
+
var import_promises148 = require("fs/promises");
|
|
958628
958707
|
init_js_yaml();
|
|
958629
958708
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
958630
958709
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
@@ -958640,7 +958719,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
958640
958719
|
} else {
|
|
958641
958720
|
try {
|
|
958642
958721
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
958643
|
-
await (0,
|
|
958722
|
+
await (0, import_promises148.writeFile)(docsYmlPath, index_vite_proxy_tmp_default.dump(docsConfig));
|
|
958644
958723
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
958645
958724
|
return;
|
|
958646
958725
|
} catch (writeError) {
|
|
@@ -958697,7 +958776,7 @@ var FernDocsBuilder = class {
|
|
|
958697
958776
|
init_lib12();
|
|
958698
958777
|
init_lib8();
|
|
958699
958778
|
init_lib6();
|
|
958700
|
-
var
|
|
958779
|
+
var import_promises149 = require("fs/promises");
|
|
958701
958780
|
init_js_yaml();
|
|
958702
958781
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
958703
958782
|
openApiSpecs = {};
|
|
@@ -958757,7 +958836,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
958757
958836
|
}
|
|
958758
958837
|
async build({ outputDirectory }) {
|
|
958759
958838
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
958760
|
-
await (0,
|
|
958839
|
+
await (0, import_promises149.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
958761
958840
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
958762
958841
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value2]) => {
|
|
958763
958842
|
return [value2.tabId, value2.tabConfig];
|
|
@@ -958782,27 +958861,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
958782
958861
|
}))
|
|
958783
958862
|
};
|
|
958784
958863
|
}
|
|
958785
|
-
await (0,
|
|
958864
|
+
await (0, import_promises149.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), index_vite_proxy_tmp_default.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
958786
958865
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
958787
958866
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
958788
|
-
await (0,
|
|
958789
|
-
await (0,
|
|
958867
|
+
await (0, import_promises149.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
958868
|
+
await (0, import_promises149.cp)(absolutePath, absolutePathToOpenAPI);
|
|
958790
958869
|
}));
|
|
958791
958870
|
}
|
|
958792
|
-
await (0,
|
|
958871
|
+
await (0, import_promises149.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), index_vite_proxy_tmp_default.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
958793
958872
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
958794
958873
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
958795
|
-
await (0,
|
|
958874
|
+
await (0, import_promises149.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
958796
958875
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
958797
958876
|
${index_vite_proxy_tmp_default.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
958798
958877
|
|
|
958799
958878
|
` : "";
|
|
958800
|
-
await (0,
|
|
958879
|
+
await (0, import_promises149.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
958801
958880
|
}));
|
|
958802
958881
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
958803
958882
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
958804
|
-
await (0,
|
|
958805
|
-
await (0,
|
|
958883
|
+
await (0, import_promises149.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
958884
|
+
await (0, import_promises149.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
958806
958885
|
}));
|
|
958807
958886
|
}
|
|
958808
958887
|
setInstance({ companyName }) {
|
|
@@ -958836,7 +958915,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
958836
958915
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
958837
958916
|
init_lib8();
|
|
958838
958917
|
init_lib6();
|
|
958839
|
-
var
|
|
958918
|
+
var import_promises151 = require("fs/promises");
|
|
958840
958919
|
|
|
958841
958920
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
958842
958921
|
function convertColors(colors19) {
|
|
@@ -958897,10 +958976,10 @@ init_lib8();
|
|
|
958897
958976
|
|
|
958898
958977
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
958899
958978
|
init_lib8();
|
|
958900
|
-
var
|
|
958979
|
+
var import_promises150 = require("fs/promises");
|
|
958901
958980
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
958902
958981
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
958903
|
-
const text9 = await (0,
|
|
958982
|
+
const text9 = await (0, import_promises150.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
958904
958983
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
958905
958984
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
958906
958985
|
const transformedContent = markReferencedAssets({
|
|
@@ -959069,7 +959148,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
959069
959148
|
documentationTab = void 0;
|
|
959070
959149
|
tabUrlToInfo = {};
|
|
959071
959150
|
async import({ args, builder }) {
|
|
959072
|
-
const mintJsonContent = await (0,
|
|
959151
|
+
const mintJsonContent = await (0, import_promises151.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
959073
959152
|
const mint = this.parseMintJson({
|
|
959074
959153
|
content: mintJsonContent,
|
|
959075
959154
|
absolutePathToMintJson: args.absolutePathToMintJson
|
|
@@ -959215,7 +959294,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
959215
959294
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
959216
959295
|
init_lib12();
|
|
959217
959296
|
init_lib8();
|
|
959218
|
-
var
|
|
959297
|
+
var import_promises152 = require("fs/promises");
|
|
959219
959298
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
959220
959299
|
const mintlifyImporter = new MintlifyImporter({
|
|
959221
959300
|
context: taskContext
|
|
@@ -959226,7 +959305,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
959226
959305
|
builder
|
|
959227
959306
|
});
|
|
959228
959307
|
await builder.build({ outputDirectory: outputPath });
|
|
959229
|
-
await (0,
|
|
959308
|
+
await (0, import_promises152.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
959230
959309
|
version: versionOfCli,
|
|
959231
959310
|
organization
|
|
959232
959311
|
}, void 0, 4));
|
|
@@ -959287,7 +959366,7 @@ function assertIsStringArray(val) {
|
|
|
959287
959366
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
959288
959367
|
init_lib4();
|
|
959289
959368
|
init_lib8();
|
|
959290
|
-
var
|
|
959369
|
+
var import_promises153 = require("fs/promises");
|
|
959291
959370
|
|
|
959292
959371
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
959293
959372
|
init_unist_util_visit();
|
|
@@ -962641,7 +962720,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962641
962720
|
if (response.ok) {
|
|
962642
962721
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
962643
962722
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
962644
|
-
await (0,
|
|
962723
|
+
await (0, import_promises153.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
962645
962724
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
962646
962725
|
}
|
|
962647
962726
|
}
|
|
@@ -962658,7 +962737,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962658
962737
|
*/
|
|
962659
962738
|
async getAndCreateAssetsDirectory() {
|
|
962660
962739
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
962661
|
-
await (0,
|
|
962740
|
+
await (0, import_promises153.mkdir)(assetsDirectory, { recursive: true });
|
|
962662
962741
|
return assetsDirectory;
|
|
962663
962742
|
}
|
|
962664
962743
|
/**
|
|
@@ -962708,7 +962787,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962708
962787
|
absolutePathToOutputDirectory,
|
|
962709
962788
|
section
|
|
962710
962789
|
});
|
|
962711
|
-
await (0,
|
|
962790
|
+
await (0, import_promises153.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
962712
962791
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
962713
962792
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
962714
962793
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -962723,7 +962802,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962723
962802
|
absolutePathToOutputDirectoryForSection,
|
|
962724
962803
|
page: page.slug
|
|
962725
962804
|
});
|
|
962726
|
-
await (0,
|
|
962805
|
+
await (0, import_promises153.writeFile)(absolutePathForPage, result.data.mdx);
|
|
962727
962806
|
if (result.data.images.imageURLs.length > 0) {
|
|
962728
962807
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
962729
962808
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -962736,8 +962815,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962736
962815
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
962737
962816
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
962738
962817
|
const imageDir = dirname6(imagePath);
|
|
962739
|
-
await (0,
|
|
962740
|
-
await (0,
|
|
962818
|
+
await (0, import_promises153.mkdir)(imageDir, { recursive: true });
|
|
962819
|
+
await (0, import_promises153.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
962741
962820
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
962742
962821
|
} catch (error50) {
|
|
962743
962822
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -962821,7 +962900,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962821
962900
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
962822
962901
|
init_lib12();
|
|
962823
962902
|
init_lib8();
|
|
962824
|
-
var
|
|
962903
|
+
var import_promises154 = require("fs/promises");
|
|
962825
962904
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
962826
962905
|
const builder = new FernDocsBuilderImpl();
|
|
962827
962906
|
builder.setInstance({ companyName: organization });
|
|
@@ -962836,7 +962915,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
962836
962915
|
builder
|
|
962837
962916
|
});
|
|
962838
962917
|
await builder.build({ outputDirectory: outputPath });
|
|
962839
|
-
await (0,
|
|
962918
|
+
await (0, import_promises154.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
962840
962919
|
version: versionOfCli,
|
|
962841
962920
|
organization
|
|
962842
962921
|
}, void 0, 4));
|
|
@@ -962863,7 +962942,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
962863
962942
|
|
|
962864
962943
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
962865
962944
|
init_axios2();
|
|
962866
|
-
var
|
|
962945
|
+
var import_promises155 = require("fs/promises");
|
|
962867
962946
|
init_js_yaml();
|
|
962868
962947
|
var import_path105 = require("path");
|
|
962869
962948
|
var import_tmp_promise19 = __toESM(require_tmp_promise(), 1);
|
|
@@ -962879,7 +962958,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
962879
962958
|
const filePath = (0, import_path105.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
962880
962959
|
logger4.debug("tmpDir", tmpDir.path);
|
|
962881
962960
|
logger4.debug("filePath", filePath);
|
|
962882
|
-
await (0,
|
|
962961
|
+
await (0, import_promises155.writeFile)(filePath, data2);
|
|
962883
962962
|
return {
|
|
962884
962963
|
status: LoadOpenAPIStatus.Success,
|
|
962885
962964
|
filePath
|
|
@@ -966803,7 +966882,7 @@ function getAutomationContextFromEnv() {
|
|
|
966803
966882
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
966804
966883
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
966805
966884
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
966806
|
-
cli_version: "5.
|
|
966885
|
+
cli_version: "5.57.0"
|
|
966807
966886
|
};
|
|
966808
966887
|
}
|
|
966809
966888
|
function isAutomationMode() {
|
|
@@ -967635,7 +967714,7 @@ var CliContext = class _CliContext {
|
|
|
967635
967714
|
if (false) {
|
|
967636
967715
|
this.logger.error("CLI_VERSION is not defined");
|
|
967637
967716
|
}
|
|
967638
|
-
return "5.
|
|
967717
|
+
return "5.57.0";
|
|
967639
967718
|
}
|
|
967640
967719
|
getCliName() {
|
|
967641
967720
|
if (false) {
|
|
@@ -967945,7 +968024,7 @@ init_lib19();
|
|
|
967945
968024
|
init_lib8();
|
|
967946
968025
|
init_lib6();
|
|
967947
968026
|
init_source();
|
|
967948
|
-
var
|
|
968027
|
+
var import_promises156 = require("fs/promises");
|
|
967949
968028
|
|
|
967950
968029
|
// ../project-loader/lib/normalizeCommandLineApiWorkspace.js
|
|
967951
968030
|
function normalizeCommandLineApiWorkspace(input3) {
|
|
@@ -968027,7 +968106,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
968027
968106
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
968028
968107
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
968029
968108
|
if (apisDirectoryExists) {
|
|
968030
|
-
const apiDirectoryContents = await (0,
|
|
968109
|
+
const apiDirectoryContents = await (0, import_promises156.readdir)(apisDirectory, { withFileTypes: true });
|
|
968031
968110
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
968032
968111
|
if (item.isDirectory()) {
|
|
968033
968112
|
all9.push(item.name);
|
|
@@ -968105,13 +968184,13 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
968105
968184
|
init_lib19();
|
|
968106
968185
|
init_lib6();
|
|
968107
968186
|
var import_generators_sdk6 = __toESM(require_generators_sdk(), 1);
|
|
968108
|
-
var
|
|
968187
|
+
var import_promises161 = require("fs/promises");
|
|
968109
968188
|
|
|
968110
968189
|
// src/commands/generator-list/getGeneratorList.ts
|
|
968111
968190
|
init_lib19();
|
|
968112
968191
|
init_lib4();
|
|
968113
968192
|
init_lib6();
|
|
968114
|
-
var
|
|
968193
|
+
var import_promises157 = require("fs/promises");
|
|
968115
968194
|
init_js_yaml();
|
|
968116
968195
|
var GenerationModeFilter = {
|
|
968117
968196
|
GitHub: "github",
|
|
@@ -968172,7 +968251,7 @@ async function getGeneratorList({
|
|
|
968172
968251
|
return;
|
|
968173
968252
|
}
|
|
968174
968253
|
try {
|
|
968175
|
-
await (0,
|
|
968254
|
+
await (0, import_promises157.writeFile)(outputLocation, generatorsListYaml);
|
|
968176
968255
|
} catch (error50) {
|
|
968177
968256
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
968178
968257
|
code: CliError.Code.ConfigError
|
|
@@ -968242,7 +968321,7 @@ async function getGeneratorMetadata({
|
|
|
968242
968321
|
|
|
968243
968322
|
// src/commands/organization/getOrganization.ts
|
|
968244
968323
|
init_lib6();
|
|
968245
|
-
var
|
|
968324
|
+
var import_promises158 = require("fs/promises");
|
|
968246
968325
|
async function getOrganization({
|
|
968247
968326
|
project,
|
|
968248
968327
|
outputLocation,
|
|
@@ -968254,7 +968333,7 @@ async function getOrganization({
|
|
|
968254
968333
|
return;
|
|
968255
968334
|
}
|
|
968256
968335
|
try {
|
|
968257
|
-
await (0,
|
|
968336
|
+
await (0, import_promises158.writeFile)(outputLocation, org);
|
|
968258
968337
|
} catch (error50) {
|
|
968259
968338
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
968260
968339
|
code: CliError.Code.ConfigError
|
|
@@ -968267,7 +968346,7 @@ init_lib19();
|
|
|
968267
968346
|
init_lib8();
|
|
968268
968347
|
init_lib6();
|
|
968269
968348
|
init_source();
|
|
968270
|
-
var
|
|
968349
|
+
var import_promises160 = require("fs/promises");
|
|
968271
968350
|
var import_path107 = __toESM(require("path"), 1);
|
|
968272
968351
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
968273
968352
|
var import_yaml6 = __toESM(require_dist11(), 1);
|
|
@@ -968277,7 +968356,7 @@ init_lib4();
|
|
|
968277
968356
|
init_lib33();
|
|
968278
968357
|
init_lib6();
|
|
968279
968358
|
var import_fs40 = require("fs");
|
|
968280
|
-
var
|
|
968359
|
+
var import_promises159 = require("fs/promises");
|
|
968281
968360
|
var import_os15 = require("os");
|
|
968282
968361
|
var import_path106 = require("path");
|
|
968283
968362
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -968305,7 +968384,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968305
968384
|
const myPid = String(process.pid);
|
|
968306
968385
|
while (true) {
|
|
968307
968386
|
try {
|
|
968308
|
-
const fh = await (0,
|
|
968387
|
+
const fh = await (0, import_promises159.open)(lockPath, "wx");
|
|
968309
968388
|
await fh.writeFile(myPid);
|
|
968310
968389
|
await fh.close();
|
|
968311
968390
|
const exitHandler = () => {
|
|
@@ -968322,9 +968401,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968322
968401
|
return async () => {
|
|
968323
968402
|
process.removeListener("exit", exitHandler);
|
|
968324
968403
|
try {
|
|
968325
|
-
const currentContent = await (0,
|
|
968404
|
+
const currentContent = await (0, import_promises159.readFile)(lockPath, "utf-8");
|
|
968326
968405
|
if (currentContent.trim() === myPid) {
|
|
968327
|
-
await (0,
|
|
968406
|
+
await (0, import_promises159.unlink)(lockPath);
|
|
968328
968407
|
} else {
|
|
968329
968408
|
logger4.debug(
|
|
968330
968409
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -968340,14 +968419,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968340
968419
|
throw err;
|
|
968341
968420
|
}
|
|
968342
968421
|
try {
|
|
968343
|
-
const lockContent = await (0,
|
|
968422
|
+
const lockContent = await (0, import_promises159.readFile)(lockPath, "utf-8");
|
|
968344
968423
|
const lockPid = Number(lockContent.trim());
|
|
968345
|
-
const lockStat = await (0,
|
|
968424
|
+
const lockStat = await (0, import_promises159.stat)(lockPath);
|
|
968346
968425
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
968347
968426
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
968348
968427
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
968349
968428
|
try {
|
|
968350
|
-
await (0,
|
|
968429
|
+
await (0, import_promises159.unlink)(lockPath);
|
|
968351
968430
|
} catch (unlinkErr) {
|
|
968352
968431
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
968353
968432
|
}
|
|
@@ -968371,7 +968450,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
968371
968450
|
}
|
|
968372
968451
|
migrationsInstallPromise = (async () => {
|
|
968373
968452
|
const cacheDir = getMigrationCacheDir();
|
|
968374
|
-
await (0,
|
|
968453
|
+
await (0, import_promises159.mkdir)(cacheDir, { recursive: true });
|
|
968375
968454
|
const npmCacheDir = (0, import_path106.join)(cacheDir, ".npm-cache");
|
|
968376
968455
|
const packageDir = (0, import_path106.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
968377
968456
|
const packageJsonPath = (0, import_path106.join)(packageDir, "package.json");
|
|
@@ -968388,7 +968467,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
968388
968467
|
"--no-audit",
|
|
968389
968468
|
"--no-fund"
|
|
968390
968469
|
]);
|
|
968391
|
-
const packageJsonContent = await (0,
|
|
968470
|
+
const packageJsonContent = await (0, import_promises159.readFile)(packageJsonPath, "utf-8");
|
|
968392
968471
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
968393
968472
|
if (packageJson2.main == null) {
|
|
968394
968473
|
throw new CliError({
|
|
@@ -968572,7 +968651,7 @@ async function loadAndUpdateGenerators({
|
|
|
968572
968651
|
skippedAutoreleaseDisabled: []
|
|
968573
968652
|
};
|
|
968574
968653
|
}
|
|
968575
|
-
const contents = await (0,
|
|
968654
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
968576
968655
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
968577
968656
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
968578
968657
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -968809,7 +968888,7 @@ async function upgradeGenerator({
|
|
|
968809
968888
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
968810
968889
|
});
|
|
968811
968890
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
968812
|
-
await (0,
|
|
968891
|
+
await (0, import_promises160.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
968813
968892
|
}
|
|
968814
968893
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
968815
968894
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -969209,7 +969288,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
969209
969288
|
}
|
|
969210
969289
|
if (argv.output) {
|
|
969211
969290
|
try {
|
|
969212
|
-
await (0,
|
|
969291
|
+
await (0, import_promises161.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
969213
969292
|
} catch (error50) {
|
|
969214
969293
|
cliContext.failAndThrow(
|
|
969215
969294
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -969226,7 +969305,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
969226
969305
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
969227
969306
|
init_lib19();
|
|
969228
969307
|
init_source();
|
|
969229
|
-
var
|
|
969308
|
+
var import_promises162 = require("fs/promises");
|
|
969230
969309
|
init_js_yaml();
|
|
969231
969310
|
async function addGeneratorToWorkspaces({
|
|
969232
969311
|
project: { apiWorkspaces },
|
|
@@ -969254,7 +969333,7 @@ async function addGeneratorToWorkspaces({
|
|
|
969254
969333
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
969255
969334
|
return;
|
|
969256
969335
|
}
|
|
969257
|
-
await (0,
|
|
969336
|
+
await (0, import_promises162.writeFile)(
|
|
969258
969337
|
absolutePathToGeneratorsConfiguration,
|
|
969259
969338
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + index_vite_proxy_tmp_default.dump(newConfiguration)
|
|
969260
969339
|
);
|
|
@@ -969322,11 +969401,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
969322
969401
|
|
|
969323
969402
|
// src/commands/generate/checkOutputDirectory.ts
|
|
969324
969403
|
init_lib8();
|
|
969325
|
-
var
|
|
969404
|
+
var import_promises165 = require("fs/promises");
|
|
969326
969405
|
|
|
969327
969406
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
969328
969407
|
init_lib8();
|
|
969329
|
-
var
|
|
969408
|
+
var import_promises163 = require("fs/promises");
|
|
969330
969409
|
|
|
969331
969410
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
969332
969411
|
init_lib8();
|
|
@@ -969346,17 +969425,17 @@ async function getOutputDirectories() {
|
|
|
969346
969425
|
if (!doesOutputDirectoriesFileExist) {
|
|
969347
969426
|
return [];
|
|
969348
969427
|
}
|
|
969349
|
-
const outputDirectoriesFileContents = await (0,
|
|
969428
|
+
const outputDirectoriesFileContents = await (0, import_promises163.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
969350
969429
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
969351
969430
|
return outputDirectories;
|
|
969352
969431
|
}
|
|
969353
969432
|
|
|
969354
969433
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
969355
|
-
var
|
|
969434
|
+
var import_promises164 = require("fs/promises");
|
|
969356
969435
|
var import_path108 = __toESM(require("path"), 1);
|
|
969357
969436
|
async function storeOutputDirectories(outputDirectories) {
|
|
969358
|
-
await (0,
|
|
969359
|
-
await (0,
|
|
969437
|
+
await (0, import_promises164.mkdir)(import_path108.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
969438
|
+
await (0, import_promises164.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
969360
969439
|
}
|
|
969361
969440
|
|
|
969362
969441
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -969378,7 +969457,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
969378
969457
|
shouldProceed: true
|
|
969379
969458
|
};
|
|
969380
969459
|
}
|
|
969381
|
-
const files = await (0,
|
|
969460
|
+
const files = await (0, import_promises165.readdir)(outputPath);
|
|
969382
969461
|
if (files.length === 0) {
|
|
969383
969462
|
return {
|
|
969384
969463
|
shouldProceed: true
|
|
@@ -970367,7 +970446,7 @@ function renderOverflowWarning(failureCount) {
|
|
|
970367
970446
|
// src/commands/automations/generate/reportGenerateResults.ts
|
|
970368
970447
|
init_lib4();
|
|
970369
970448
|
var import_fs41 = require("fs");
|
|
970370
|
-
var
|
|
970449
|
+
var import_promises166 = require("fs/promises");
|
|
970371
970450
|
var JSON_SCHEMA_VERSION = 1;
|
|
970372
970451
|
function renderStdoutSummary(results) {
|
|
970373
970452
|
return formatCounts(countResults(results));
|
|
@@ -970557,12 +970636,12 @@ async function writeResults({
|
|
|
970557
970636
|
const stepSummaryPath = getGithubStepSummaryPath();
|
|
970558
970637
|
if (stepSummaryPath != null) {
|
|
970559
970638
|
try {
|
|
970560
|
-
await (0,
|
|
970639
|
+
await (0, import_promises166.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
970561
970640
|
} catch {
|
|
970562
970641
|
}
|
|
970563
970642
|
}
|
|
970564
970643
|
if (jsonOutputPath != null) {
|
|
970565
|
-
await (0,
|
|
970644
|
+
await (0, import_promises166.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
970566
970645
|
}
|
|
970567
970646
|
}
|
|
970568
970647
|
function writeResultsSync({
|
|
@@ -970889,7 +970968,7 @@ function listPreviewGroups({
|
|
|
970889
970968
|
init_lib19();
|
|
970890
970969
|
init_lib6();
|
|
970891
970970
|
init_source();
|
|
970892
|
-
var
|
|
970971
|
+
var import_promises196 = require("fs/promises");
|
|
970893
970972
|
|
|
970894
970973
|
// ../cli-migrations/lib/runMigrations.js
|
|
970895
970974
|
init_lib4();
|
|
@@ -970900,7 +970979,7 @@ init_source();
|
|
|
970900
970979
|
init_lib27();
|
|
970901
970980
|
|
|
970902
970981
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
970903
|
-
var
|
|
970982
|
+
var import_promises167 = require("fs/promises");
|
|
970904
970983
|
|
|
970905
970984
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
970906
970985
|
init_lib8();
|
|
@@ -970937,7 +971016,7 @@ var migration = {
|
|
|
970937
971016
|
try {
|
|
970938
971017
|
const fileContents = await getFileContents(yamlFilepath);
|
|
970939
971018
|
const newContents = addDiscriminantToFile(fileContents);
|
|
970940
|
-
await (0,
|
|
971019
|
+
await (0, import_promises167.writeFile)(yamlFilepath, newContents);
|
|
970941
971020
|
} catch (error50) {
|
|
970942
971021
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
970943
971022
|
}
|
|
@@ -970945,7 +971024,7 @@ var migration = {
|
|
|
970945
971024
|
}
|
|
970946
971025
|
};
|
|
970947
971026
|
async function getFileContents(filepath) {
|
|
970948
|
-
const buffer = await (0,
|
|
971027
|
+
const buffer = await (0, import_promises167.readFile)(filepath);
|
|
970949
971028
|
return buffer.toString();
|
|
970950
971029
|
}
|
|
970951
971030
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -970974,7 +971053,7 @@ var versionMigrations = {
|
|
|
970974
971053
|
var __default = versionMigrations;
|
|
970975
971054
|
|
|
970976
971055
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
970977
|
-
var
|
|
971056
|
+
var import_promises168 = require("fs/promises");
|
|
970978
971057
|
var import_yaml7 = __toESM(require_dist11(), 1);
|
|
970979
971058
|
|
|
970980
971059
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -971018,7 +971097,7 @@ var migration2 = {
|
|
|
971018
971097
|
}
|
|
971019
971098
|
};
|
|
971020
971099
|
async function migrateFile(filepath, context3) {
|
|
971021
|
-
const contents = await (0,
|
|
971100
|
+
const contents = await (0, import_promises168.readFile)(filepath);
|
|
971022
971101
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
971023
971102
|
const types4 = parsedDocument.get("types");
|
|
971024
971103
|
if (types4 == null) {
|
|
@@ -971050,7 +971129,7 @@ async function migrateFile(filepath, context3) {
|
|
|
971050
971129
|
}
|
|
971051
971130
|
}
|
|
971052
971131
|
}
|
|
971053
|
-
await (0,
|
|
971132
|
+
await (0, import_promises168.writeFile)(filepath, parsedDocument.toString());
|
|
971054
971133
|
}
|
|
971055
971134
|
|
|
971056
971135
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -971061,7 +971140,7 @@ var versionMigrations2 = {
|
|
|
971061
971140
|
var __default2 = versionMigrations2;
|
|
971062
971141
|
|
|
971063
971142
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
971064
|
-
var
|
|
971143
|
+
var import_promises169 = require("fs/promises");
|
|
971065
971144
|
var import_yaml8 = __toESM(require_dist11(), 1);
|
|
971066
971145
|
|
|
971067
971146
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -971105,7 +971184,7 @@ var migration3 = {
|
|
|
971105
971184
|
}
|
|
971106
971185
|
};
|
|
971107
971186
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
971108
|
-
const contents = await (0,
|
|
971187
|
+
const contents = await (0, import_promises169.readFile)(filepath);
|
|
971109
971188
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
971110
971189
|
const draftGenerators = parsedDocument.get("draft");
|
|
971111
971190
|
if (draftGenerators == null) {
|
|
@@ -971132,7 +971211,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
971132
971211
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
971133
971212
|
}
|
|
971134
971213
|
});
|
|
971135
|
-
await (0,
|
|
971214
|
+
await (0, import_promises169.writeFile)(filepath, parsedDocument.toString());
|
|
971136
971215
|
}
|
|
971137
971216
|
|
|
971138
971217
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -971143,7 +971222,7 @@ var versionMigrations3 = {
|
|
|
971143
971222
|
var __default3 = versionMigrations3;
|
|
971144
971223
|
|
|
971145
971224
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
971146
|
-
var
|
|
971225
|
+
var import_promises170 = require("fs/promises");
|
|
971147
971226
|
var import_yaml9 = __toESM(require_dist11(), 1);
|
|
971148
971227
|
|
|
971149
971228
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -971187,7 +971266,7 @@ var migration4 = {
|
|
|
971187
971266
|
}
|
|
971188
971267
|
};
|
|
971189
971268
|
async function migrateFile2(filepath, context3) {
|
|
971190
|
-
const contents = await (0,
|
|
971269
|
+
const contents = await (0, import_promises170.readFile)(filepath);
|
|
971191
971270
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
971192
971271
|
const addType = (typeName, typeDeclaration2) => {
|
|
971193
971272
|
const types4 = parsedDocument.get("types");
|
|
@@ -971231,7 +971310,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
971231
971310
|
}
|
|
971232
971311
|
}
|
|
971233
971312
|
}
|
|
971234
|
-
await (0,
|
|
971313
|
+
await (0, import_promises170.writeFile)(filepath, parsedDocument.toString());
|
|
971235
971314
|
}
|
|
971236
971315
|
|
|
971237
971316
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -971242,7 +971321,7 @@ var versionMigrations4 = {
|
|
|
971242
971321
|
var __default4 = versionMigrations4;
|
|
971243
971322
|
|
|
971244
971323
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
971245
|
-
var
|
|
971324
|
+
var import_promises171 = require("fs/promises");
|
|
971246
971325
|
var import_yaml10 = __toESM(require_dist11(), 1);
|
|
971247
971326
|
|
|
971248
971327
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -971286,7 +971365,7 @@ var migration5 = {
|
|
|
971286
971365
|
}
|
|
971287
971366
|
};
|
|
971288
971367
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
971289
|
-
const contents = await (0,
|
|
971368
|
+
const contents = await (0, import_promises171.readFile)(filepath);
|
|
971290
971369
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
971291
971370
|
const releaseGenerators = parsedDocument.get("release");
|
|
971292
971371
|
if (releaseGenerators == null) {
|
|
@@ -971324,7 +971403,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
971324
971403
|
}
|
|
971325
971404
|
releaseGenerator.delete("outputs");
|
|
971326
971405
|
});
|
|
971327
|
-
await (0,
|
|
971406
|
+
await (0, import_promises171.writeFile)(filepath, parsedDocument.toString());
|
|
971328
971407
|
}
|
|
971329
971408
|
|
|
971330
971409
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -971335,7 +971414,7 @@ var versionMigrations5 = {
|
|
|
971335
971414
|
var __default5 = versionMigrations5;
|
|
971336
971415
|
|
|
971337
971416
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
971338
|
-
var
|
|
971417
|
+
var import_promises172 = require("fs/promises");
|
|
971339
971418
|
|
|
971340
971419
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
971341
971420
|
init_lib8();
|
|
@@ -971369,9 +971448,9 @@ var migration6 = {
|
|
|
971369
971448
|
run: async ({ context: context3 }) => {
|
|
971370
971449
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
971371
971450
|
for (const filepath of yamlFiles) {
|
|
971372
|
-
const contents = await (0,
|
|
971451
|
+
const contents = await (0, import_promises172.readFile)(filepath);
|
|
971373
971452
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
971374
|
-
await (0,
|
|
971453
|
+
await (0, import_promises172.writeFile)(filepath, newContents);
|
|
971375
971454
|
}
|
|
971376
971455
|
}
|
|
971377
971456
|
};
|
|
@@ -971384,7 +971463,7 @@ var versionMigrations6 = {
|
|
|
971384
971463
|
var __default6 = versionMigrations6;
|
|
971385
971464
|
|
|
971386
971465
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
971387
|
-
var
|
|
971466
|
+
var import_promises173 = require("fs/promises");
|
|
971388
971467
|
|
|
971389
971468
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
971390
971469
|
init_lib8();
|
|
@@ -971418,9 +971497,9 @@ var migration7 = {
|
|
|
971418
971497
|
run: async ({ context: context3 }) => {
|
|
971419
971498
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
971420
971499
|
for (const filepath of yamlFiles) {
|
|
971421
|
-
const contents = await (0,
|
|
971500
|
+
const contents = await (0, import_promises173.readFile)(filepath);
|
|
971422
971501
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
971423
|
-
await (0,
|
|
971502
|
+
await (0, import_promises173.writeFile)(filepath, newContents);
|
|
971424
971503
|
}
|
|
971425
971504
|
}
|
|
971426
971505
|
};
|
|
@@ -971434,7 +971513,7 @@ var __default7 = versionMigrations7;
|
|
|
971434
971513
|
|
|
971435
971514
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
971436
971515
|
init_lib4();
|
|
971437
|
-
var
|
|
971516
|
+
var import_promises174 = require("fs/promises");
|
|
971438
971517
|
init_js_yaml();
|
|
971439
971518
|
|
|
971440
971519
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
@@ -971568,7 +971647,7 @@ var migration8 = {
|
|
|
971568
971647
|
}
|
|
971569
971648
|
};
|
|
971570
971649
|
async function migrateGeneratorsYml3(filepath) {
|
|
971571
|
-
const contentsStr = await (0,
|
|
971650
|
+
const contentsStr = await (0, import_promises174.readFile)(filepath);
|
|
971572
971651
|
const contents = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
971573
971652
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
971574
971653
|
let newGeneratorsConfiguration = {};
|
|
@@ -971586,7 +971665,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
971586
971665
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
971587
971666
|
};
|
|
971588
971667
|
}
|
|
971589
|
-
await (0,
|
|
971668
|
+
await (0, import_promises174.writeFile)(filepath, index_vite_proxy_tmp_default.dump(newGeneratorsConfiguration));
|
|
971590
971669
|
}
|
|
971591
971670
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
971592
971671
|
const newSchema = {
|
|
@@ -971661,7 +971740,7 @@ var versionMigrations8 = {
|
|
|
971661
971740
|
var __default8 = versionMigrations8;
|
|
971662
971741
|
|
|
971663
971742
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
971664
|
-
var
|
|
971743
|
+
var import_promises175 = require("fs/promises");
|
|
971665
971744
|
var import_yaml11 = __toESM(require_dist11(), 1);
|
|
971666
971745
|
|
|
971667
971746
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -971705,7 +971784,7 @@ var migration9 = {
|
|
|
971705
971784
|
}
|
|
971706
971785
|
};
|
|
971707
971786
|
async function migrateRootApiFile(filepath) {
|
|
971708
|
-
const contents = await (0,
|
|
971787
|
+
const contents = await (0, import_promises175.readFile)(filepath);
|
|
971709
971788
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
971710
971789
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
971711
971790
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -971716,7 +971795,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
971716
971795
|
"property-name": errorDiscriminant.value
|
|
971717
971796
|
});
|
|
971718
971797
|
parsedDocument.delete("error-discriminant");
|
|
971719
|
-
await (0,
|
|
971798
|
+
await (0, import_promises175.writeFile)(filepath, parsedDocument.toString());
|
|
971720
971799
|
}
|
|
971721
971800
|
|
|
971722
971801
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -971727,7 +971806,7 @@ var versionMigrations9 = {
|
|
|
971727
971806
|
var __default9 = versionMigrations9;
|
|
971728
971807
|
|
|
971729
971808
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
971730
|
-
var
|
|
971809
|
+
var import_promises176 = require("fs/promises");
|
|
971731
971810
|
var import_yaml12 = __toESM(require_dist11(), 1);
|
|
971732
971811
|
|
|
971733
971812
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -971771,7 +971850,7 @@ var migration10 = {
|
|
|
971771
971850
|
}
|
|
971772
971851
|
};
|
|
971773
971852
|
async function migrateYamlFile(filepath, context3) {
|
|
971774
|
-
const contents = await (0,
|
|
971853
|
+
const contents = await (0, import_promises176.readFile)(filepath);
|
|
971775
971854
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
971776
971855
|
const services = parsedDocument.get("services");
|
|
971777
971856
|
if (services == null) {
|
|
@@ -971811,7 +971890,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
971811
971890
|
context3.failWithoutThrowing("Failed to convert endpoint", e2);
|
|
971812
971891
|
}
|
|
971813
971892
|
}
|
|
971814
|
-
await (0,
|
|
971893
|
+
await (0, import_promises176.writeFile)(filepath, parsedDocument.toString());
|
|
971815
971894
|
}
|
|
971816
971895
|
}
|
|
971817
971896
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -971890,7 +971969,7 @@ var versionMigrations10 = {
|
|
|
971890
971969
|
var __default10 = versionMigrations10;
|
|
971891
971970
|
|
|
971892
971971
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
971893
|
-
var
|
|
971972
|
+
var import_promises177 = require("fs/promises");
|
|
971894
971973
|
var import_yaml13 = __toESM(require_dist11(), 1);
|
|
971895
971974
|
|
|
971896
971975
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -971934,7 +972013,7 @@ var migration11 = {
|
|
|
971934
972013
|
}
|
|
971935
972014
|
};
|
|
971936
972015
|
async function migrateYamlFile2(filepath, context3) {
|
|
971937
|
-
const contents = await (0,
|
|
972016
|
+
const contents = await (0, import_promises177.readFile)(filepath);
|
|
971938
972017
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
971939
972018
|
const types4 = parsedDocument.get("types");
|
|
971940
972019
|
if (types4 == null) {
|
|
@@ -971960,7 +972039,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
971960
972039
|
examples.set(i5, { value: value2 });
|
|
971961
972040
|
}
|
|
971962
972041
|
}
|
|
971963
|
-
await (0,
|
|
972042
|
+
await (0, import_promises177.writeFile)(filepath, parsedDocument.toString());
|
|
971964
972043
|
}
|
|
971965
972044
|
|
|
971966
972045
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -971971,7 +972050,7 @@ var versionMigrations11 = {
|
|
|
971971
972050
|
var __default11 = versionMigrations11;
|
|
971972
972051
|
|
|
971973
972052
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
971974
|
-
var
|
|
972053
|
+
var import_promises178 = require("fs/promises");
|
|
971975
972054
|
var import_yaml14 = __toESM(require_dist11(), 1);
|
|
971976
972055
|
|
|
971977
972056
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -972015,7 +972094,7 @@ var migration12 = {
|
|
|
972015
972094
|
}
|
|
972016
972095
|
};
|
|
972017
972096
|
async function migrateYamlFile3(filepath, context3) {
|
|
972018
|
-
const contents = await (0,
|
|
972097
|
+
const contents = await (0, import_promises178.readFile)(filepath);
|
|
972019
972098
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
972020
972099
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
972021
972100
|
return context3.failAndThrow("File is not a map");
|
|
@@ -972045,7 +972124,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
972045
972124
|
pair.value = firstService.value;
|
|
972046
972125
|
}
|
|
972047
972126
|
}
|
|
972048
|
-
await (0,
|
|
972127
|
+
await (0, import_promises178.writeFile)(filepath, parsedDocument.toString());
|
|
972049
972128
|
}
|
|
972050
972129
|
|
|
972051
972130
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -972056,7 +972135,7 @@ var versionMigrations12 = {
|
|
|
972056
972135
|
var __default12 = versionMigrations12;
|
|
972057
972136
|
|
|
972058
972137
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
972059
|
-
var
|
|
972138
|
+
var import_promises179 = require("fs/promises");
|
|
972060
972139
|
var import_yaml15 = __toESM(require_dist11(), 1);
|
|
972061
972140
|
|
|
972062
972141
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -972100,7 +972179,7 @@ var migration13 = {
|
|
|
972100
972179
|
}
|
|
972101
972180
|
};
|
|
972102
972181
|
async function migrateYamlFile4(filepath, context3) {
|
|
972103
|
-
const contents = await (0,
|
|
972182
|
+
const contents = await (0, import_promises179.readFile)(filepath);
|
|
972104
972183
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
972105
972184
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
972106
972185
|
return context3.failAndThrow("File is not a map");
|
|
@@ -972119,7 +972198,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
972119
972198
|
}
|
|
972120
972199
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
972121
972200
|
parsedDocument.contents.items.unshift(docsPair);
|
|
972122
|
-
await (0,
|
|
972201
|
+
await (0, import_promises179.writeFile)(filepath, parsedDocument.toString());
|
|
972123
972202
|
}
|
|
972124
972203
|
|
|
972125
972204
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -972130,7 +972209,7 @@ var versionMigrations13 = {
|
|
|
972130
972209
|
var __default13 = versionMigrations13;
|
|
972131
972210
|
|
|
972132
972211
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
972133
|
-
var
|
|
972212
|
+
var import_promises180 = require("fs/promises");
|
|
972134
972213
|
|
|
972135
972214
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
972136
972215
|
init_lib8();
|
|
@@ -972173,14 +972252,14 @@ var migration14 = {
|
|
|
972173
972252
|
}
|
|
972174
972253
|
};
|
|
972175
972254
|
async function migrateYamlFile5(filepath) {
|
|
972176
|
-
const contents = await (0,
|
|
972255
|
+
const contents = await (0, import_promises180.readFile)(filepath);
|
|
972177
972256
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
972178
972257
|
const regex6 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
972179
972258
|
const updatedSnapshot = contents.toString().replace(regex6, (_match, _prefix, domain3) => {
|
|
972180
972259
|
return `docs:
|
|
972181
972260
|
domain: "${domain3}.${domainSuffix}"`;
|
|
972182
972261
|
});
|
|
972183
|
-
await (0,
|
|
972262
|
+
await (0, import_promises180.writeFile)(filepath, updatedSnapshot.toString());
|
|
972184
972263
|
}
|
|
972185
972264
|
|
|
972186
972265
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -972201,11 +972280,11 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
972201
972280
|
|
|
972202
972281
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
972203
972282
|
init_lib8();
|
|
972204
|
-
var
|
|
972283
|
+
var import_promises181 = require("fs/promises");
|
|
972205
972284
|
init_js_yaml();
|
|
972206
972285
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
972207
972286
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972208
|
-
const contentsStr = await (0,
|
|
972287
|
+
const contentsStr = await (0, import_promises181.readFile)(filepath);
|
|
972209
972288
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
972210
972289
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
972211
972290
|
if (result.ok) {
|
|
@@ -972224,7 +972303,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
972224
972303
|
|
|
972225
972304
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
972226
972305
|
init_lib8();
|
|
972227
|
-
var
|
|
972306
|
+
var import_promises183 = require("fs/promises");
|
|
972228
972307
|
init_js_yaml();
|
|
972229
972308
|
|
|
972230
972309
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
@@ -972433,11 +972512,11 @@ __export(legacy_exports, {
|
|
|
972433
972512
|
|
|
972434
972513
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
972435
972514
|
init_lib8();
|
|
972436
|
-
var
|
|
972515
|
+
var import_promises182 = require("fs/promises");
|
|
972437
972516
|
init_js_yaml();
|
|
972438
972517
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
972439
972518
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
972440
|
-
const contentsStr = await (0,
|
|
972519
|
+
const contentsStr = await (0, import_promises182.readFile)(filepath);
|
|
972441
972520
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
972442
972521
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
972443
972522
|
if (result.success) {
|
|
@@ -972467,7 +972546,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
972467
972546
|
var APIS_DIRECTORY2 = "apis";
|
|
972468
972547
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
972469
972548
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
972470
|
-
await (0,
|
|
972549
|
+
await (0, import_promises183.mkdir)(absolutePathToApisDirectory);
|
|
972471
972550
|
for (const workspace of workspaces) {
|
|
972472
972551
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
972473
972552
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -972475,11 +972554,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
972475
972554
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
972476
972555
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
972477
972556
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
972478
|
-
await (0,
|
|
972557
|
+
await (0, import_promises183.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
972479
972558
|
}
|
|
972480
972559
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
972481
972560
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
972482
|
-
await (0,
|
|
972561
|
+
await (0, import_promises183.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972483
972562
|
}
|
|
972484
972563
|
}
|
|
972485
972564
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -972492,7 +972571,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
972492
972571
|
generatorsConfiguration,
|
|
972493
972572
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
972494
972573
|
});
|
|
972495
|
-
await (0,
|
|
972574
|
+
await (0, import_promises183.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972496
972575
|
return convertedResponse.docsURLs;
|
|
972497
972576
|
}
|
|
972498
972577
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -972506,12 +972585,12 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
972506
972585
|
apiName
|
|
972507
972586
|
});
|
|
972508
972587
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972509
|
-
await (0,
|
|
972588
|
+
await (0, import_promises183.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
972510
972589
|
}
|
|
972511
972590
|
|
|
972512
972591
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
972513
972592
|
init_lib8();
|
|
972514
|
-
var
|
|
972593
|
+
var import_promises184 = require("fs/promises");
|
|
972515
972594
|
init_js_yaml();
|
|
972516
972595
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
972517
972596
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
@@ -972519,8 +972598,8 @@ async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePa
|
|
|
972519
972598
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
972520
972599
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
972521
972600
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
972522
|
-
await (0,
|
|
972523
|
-
await (0,
|
|
972601
|
+
await (0, import_promises184.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
972602
|
+
await (0, import_promises184.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972524
972603
|
}
|
|
972525
972604
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
972526
972605
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972533,7 +972612,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
972533
972612
|
apiName: void 0
|
|
972534
972613
|
});
|
|
972535
972614
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972536
|
-
await (0,
|
|
972615
|
+
await (0, import_promises184.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
972537
972616
|
}
|
|
972538
972617
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
972539
972618
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972545,24 +972624,24 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
972545
972624
|
generatorsConfiguration,
|
|
972546
972625
|
pathModificationStrategy: "MoveUp"
|
|
972547
972626
|
});
|
|
972548
|
-
await (0,
|
|
972627
|
+
await (0, import_promises184.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972549
972628
|
return convertedResponse.docsURLs;
|
|
972550
972629
|
}
|
|
972551
972630
|
|
|
972552
972631
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
972553
972632
|
init_lib8();
|
|
972554
|
-
var
|
|
972633
|
+
var import_promises185 = require("fs/promises");
|
|
972555
972634
|
init_js_yaml();
|
|
972556
972635
|
var APIS_DIRECTORY3 = "apis";
|
|
972557
972636
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
972558
972637
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
972559
|
-
await (0,
|
|
972638
|
+
await (0, import_promises185.mkdir)(absolutePathToApisDirectory);
|
|
972560
972639
|
for (const workspace of workspaces) {
|
|
972561
972640
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
972562
972641
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
972563
972642
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
972564
972643
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
972565
|
-
await (0,
|
|
972644
|
+
await (0, import_promises185.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972566
972645
|
}
|
|
972567
972646
|
}
|
|
972568
972647
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -972575,17 +972654,17 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
972575
972654
|
generatorsConfiguration,
|
|
972576
972655
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
972577
972656
|
});
|
|
972578
|
-
await (0,
|
|
972657
|
+
await (0, import_promises185.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972579
972658
|
}
|
|
972580
972659
|
|
|
972581
972660
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
972582
972661
|
init_lib8();
|
|
972583
|
-
var
|
|
972662
|
+
var import_promises186 = require("fs/promises");
|
|
972584
972663
|
init_js_yaml();
|
|
972585
972664
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
972586
972665
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
972587
972666
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
972588
|
-
await (0,
|
|
972667
|
+
await (0, import_promises186.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972589
972668
|
}
|
|
972590
972669
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
972591
972670
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972597,7 +972676,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
972597
972676
|
generatorsConfiguration,
|
|
972598
972677
|
pathModificationStrategy: "MoveUp"
|
|
972599
972678
|
});
|
|
972600
|
-
await (0,
|
|
972679
|
+
await (0, import_promises186.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972601
972680
|
}
|
|
972602
972681
|
|
|
972603
972682
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -972677,7 +972756,7 @@ var __default15 = versionMigrations15;
|
|
|
972677
972756
|
init_lib19();
|
|
972678
972757
|
init_lib8();
|
|
972679
972758
|
init_source();
|
|
972680
|
-
var
|
|
972759
|
+
var import_promises187 = require("fs/promises");
|
|
972681
972760
|
init_js_yaml();
|
|
972682
972761
|
var import_yaml16 = __toESM(require_dist11(), 1);
|
|
972683
972762
|
var migration16 = {
|
|
@@ -972721,7 +972800,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
972721
972800
|
if (existingGeneratorsYml == null) {
|
|
972722
972801
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
972723
972802
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
972724
|
-
await (0,
|
|
972803
|
+
await (0, import_promises187.writeFile)(absolutePathToGeneratorsYml, index_vite_proxy_tmp_default.dump({
|
|
972725
972804
|
api: {
|
|
972726
972805
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
972727
972806
|
}
|
|
@@ -972736,7 +972815,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
972736
972815
|
parsedDocument.set("api", {
|
|
972737
972816
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
972738
972817
|
});
|
|
972739
|
-
await (0,
|
|
972818
|
+
await (0, import_promises187.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
972740
972819
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
972741
972820
|
}
|
|
972742
972821
|
}
|
|
@@ -972766,7 +972845,7 @@ var __default16 = versionMigrations16;
|
|
|
972766
972845
|
init_lib19();
|
|
972767
972846
|
init_lib8();
|
|
972768
972847
|
init_source();
|
|
972769
|
-
var
|
|
972848
|
+
var import_promises188 = require("fs/promises");
|
|
972770
972849
|
init_js_yaml();
|
|
972771
972850
|
var import_yaml17 = __toESM(require_dist11(), 1);
|
|
972772
972851
|
var migration17 = {
|
|
@@ -972947,7 +973026,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
972947
973026
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
972948
973027
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
972949
973028
|
}
|
|
972950
|
-
await (0,
|
|
973029
|
+
await (0, import_promises188.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
972951
973030
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
972952
973031
|
}
|
|
972953
973032
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -972994,7 +973073,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
972994
973073
|
}
|
|
972995
973074
|
let specContent;
|
|
972996
973075
|
try {
|
|
972997
|
-
const fileContents = await (0,
|
|
973076
|
+
const fileContents = await (0, import_promises188.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
972998
973077
|
specContent = index_vite_proxy_tmp_default.load(fileContents);
|
|
972999
973078
|
} catch (e2) {
|
|
973000
973079
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e2}. Skipping...`);
|
|
@@ -973100,7 +973179,7 @@ var __default17 = versionMigrations17;
|
|
|
973100
973179
|
init_lib19();
|
|
973101
973180
|
init_lib8();
|
|
973102
973181
|
init_source();
|
|
973103
|
-
var
|
|
973182
|
+
var import_promises189 = require("fs/promises");
|
|
973104
973183
|
init_js_yaml();
|
|
973105
973184
|
var migration18 = {
|
|
973106
973185
|
name: "add-path-parameter-order-setting",
|
|
@@ -973189,7 +973268,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
973189
973268
|
documentToWrite = `${schemaComment}
|
|
973190
973269
|
${documentToWrite}`;
|
|
973191
973270
|
}
|
|
973192
|
-
await (0,
|
|
973271
|
+
await (0, import_promises189.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973193
973272
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973194
973273
|
}
|
|
973195
973274
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -973228,7 +973307,7 @@ var __default18 = versionMigrations18;
|
|
|
973228
973307
|
init_lib19();
|
|
973229
973308
|
init_lib8();
|
|
973230
973309
|
init_source();
|
|
973231
|
-
var
|
|
973310
|
+
var import_promises190 = require("fs/promises");
|
|
973232
973311
|
init_js_yaml();
|
|
973233
973312
|
var migration19 = {
|
|
973234
973313
|
name: "update-1_0_0-defaults",
|
|
@@ -973404,7 +973483,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
973404
973483
|
documentToWrite = `${schemaComment}
|
|
973405
973484
|
${documentToWrite}`;
|
|
973406
973485
|
}
|
|
973407
|
-
await (0,
|
|
973486
|
+
await (0, import_promises190.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973408
973487
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973409
973488
|
}
|
|
973410
973489
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -973476,7 +973555,7 @@ var __default19 = versionMigrations19;
|
|
|
973476
973555
|
init_lib19();
|
|
973477
973556
|
init_lib8();
|
|
973478
973557
|
init_source();
|
|
973479
|
-
var
|
|
973558
|
+
var import_promises191 = require("fs/promises");
|
|
973480
973559
|
init_js_yaml();
|
|
973481
973560
|
var migration20 = {
|
|
973482
973561
|
name: "update-2_0_0-defaults",
|
|
@@ -973652,7 +973731,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
973652
973731
|
documentToWrite = `${schemaComment}
|
|
973653
973732
|
${documentToWrite}`;
|
|
973654
973733
|
}
|
|
973655
|
-
await (0,
|
|
973734
|
+
await (0, import_promises191.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973656
973735
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973657
973736
|
}
|
|
973658
973737
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -973701,7 +973780,7 @@ var __default20 = versionMigrations20;
|
|
|
973701
973780
|
init_lib19();
|
|
973702
973781
|
init_lib8();
|
|
973703
973782
|
init_source();
|
|
973704
|
-
var
|
|
973783
|
+
var import_promises192 = require("fs/promises");
|
|
973705
973784
|
init_js_yaml();
|
|
973706
973785
|
var migration21 = {
|
|
973707
973786
|
name: "migrate-deprecated-generator-api-settings",
|
|
@@ -973793,7 +973872,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
973793
973872
|
documentToWrite = `${schemaComment}
|
|
973794
973873
|
${documentToWrite}`;
|
|
973795
973874
|
}
|
|
973796
|
-
await (0,
|
|
973875
|
+
await (0, import_promises192.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973797
973876
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973798
973877
|
}
|
|
973799
973878
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -973842,7 +973921,7 @@ var __default21 = versionMigrations21;
|
|
|
973842
973921
|
init_lib19();
|
|
973843
973922
|
init_lib8();
|
|
973844
973923
|
init_source();
|
|
973845
|
-
var
|
|
973924
|
+
var import_promises193 = require("fs/promises");
|
|
973846
973925
|
init_js_yaml();
|
|
973847
973926
|
var migration22 = {
|
|
973848
973927
|
name: "enable-smart-casing",
|
|
@@ -973927,7 +974006,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
973927
974006
|
documentToWrite = `${schemaComment}
|
|
973928
974007
|
${documentToWrite}`;
|
|
973929
974008
|
}
|
|
973930
|
-
await (0,
|
|
974009
|
+
await (0, import_promises193.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973931
974010
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973932
974011
|
}
|
|
973933
974012
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -973967,7 +974046,7 @@ var __default22 = versionMigrations22;
|
|
|
973967
974046
|
init_lib19();
|
|
973968
974047
|
init_lib8();
|
|
973969
974048
|
init_source();
|
|
973970
|
-
var
|
|
974049
|
+
var import_promises194 = require("fs/promises");
|
|
973971
974050
|
init_js_yaml();
|
|
973972
974051
|
var migration23 = {
|
|
973973
974052
|
name: "disable-disambiguate-request-names",
|
|
@@ -974092,7 +974171,7 @@ async function updateGeneratorsYml6({ context: context3, files }) {
|
|
|
974092
974171
|
documentToWrite = `${schemaComment}
|
|
974093
974172
|
${documentToWrite}`;
|
|
974094
974173
|
}
|
|
974095
|
-
await (0,
|
|
974174
|
+
await (0, import_promises194.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
974096
974175
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
974097
974176
|
}
|
|
974098
974177
|
async function getFilesAndDirectories8(absoluteFilepath) {
|
|
@@ -974227,7 +974306,7 @@ init_lib33();
|
|
|
974227
974306
|
init_lib27();
|
|
974228
974307
|
init_lib6();
|
|
974229
974308
|
init_source();
|
|
974230
|
-
var
|
|
974309
|
+
var import_promises195 = require("fs/promises");
|
|
974231
974310
|
|
|
974232
974311
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
974233
974312
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -975283,7 +975362,7 @@ async function upgrade({
|
|
|
975283
975362
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
975284
975363
|
draft.version = resolvedTargetVersion;
|
|
975285
975364
|
});
|
|
975286
|
-
await (0,
|
|
975365
|
+
await (0, import_promises195.writeFile)(
|
|
975287
975366
|
projectConfig2._absolutePath,
|
|
975288
975367
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
975289
975368
|
);
|
|
@@ -975440,7 +975519,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
975440
975519
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
975441
975520
|
});
|
|
975442
975521
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
975443
|
-
await (0,
|
|
975522
|
+
await (0, import_promises196.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
975444
975523
|
}
|
|
975445
975524
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
975446
975525
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -975918,7 +975997,7 @@ async function previewDocsWorkspace({
|
|
|
975918
975997
|
// src/commands/docs-diff/docsDiff.ts
|
|
975919
975998
|
init_lib8();
|
|
975920
975999
|
init_lib6();
|
|
975921
|
-
var
|
|
976000
|
+
var import_promises197 = require("fs/promises");
|
|
975922
976001
|
var import_pngjs2 = __toESM(require_png(), 1);
|
|
975923
976002
|
async function getSlugForFiles2({
|
|
975924
976003
|
previewUrl,
|
|
@@ -976141,8 +976220,8 @@ async function generateComparisons2({
|
|
|
976141
976220
|
afterPath,
|
|
976142
976221
|
comparisonBasePath
|
|
976143
976222
|
}) {
|
|
976144
|
-
const beforePng = import_pngjs2.PNG.sync.read(await (0,
|
|
976145
|
-
const afterPng = import_pngjs2.PNG.sync.read(await (0,
|
|
976223
|
+
const beforePng = import_pngjs2.PNG.sync.read(await (0, import_promises197.readFile)(beforePath));
|
|
976224
|
+
const afterPng = import_pngjs2.PNG.sync.read(await (0, import_promises197.readFile)(afterPath));
|
|
976146
976225
|
const beforeOriginalHeight = beforePng.height;
|
|
976147
976226
|
const afterOriginalHeight = afterPng.height;
|
|
976148
976227
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -976180,7 +976259,7 @@ async function generateComparisons2({
|
|
|
976180
976259
|
const sideBySide = createSideBySideComparison2(croppedBefore, croppedAfter, 20, true);
|
|
976181
976260
|
const outPath = `${base4}-region-${i5 + 1}.png`;
|
|
976182
976261
|
const pngBuffer = import_pngjs2.PNG.sync.write(sideBySide);
|
|
976183
|
-
await (0,
|
|
976262
|
+
await (0, import_promises197.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
976184
976263
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
976185
976264
|
}
|
|
976186
976265
|
return results;
|
|
@@ -976259,7 +976338,7 @@ async function docsDiff({
|
|
|
976259
976338
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
976260
976339
|
);
|
|
976261
976340
|
if (!await doesPathExist(outputPath)) {
|
|
976262
|
-
await (0,
|
|
976341
|
+
await (0, import_promises197.mkdir)(outputPath, { recursive: true });
|
|
976263
976342
|
}
|
|
976264
976343
|
const results = [];
|
|
976265
976344
|
await cliContext.runTask(async (context3) => {
|
|
@@ -976687,7 +976766,7 @@ init_lib6();
|
|
|
976687
976766
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
976688
976767
|
init_lib12();
|
|
976689
976768
|
init_lib8();
|
|
976690
|
-
var
|
|
976769
|
+
var import_promises198 = require("fs/promises");
|
|
976691
976770
|
init_js_yaml();
|
|
976692
976771
|
var import_path109 = __toESM(require("path"), 1);
|
|
976693
976772
|
var ThemeExporter = class {
|
|
@@ -976700,18 +976779,18 @@ var ThemeExporter = class {
|
|
|
976700
976779
|
const docsDir = import_path109.default.dirname(docsYmlPath);
|
|
976701
976780
|
const outDir = output2 != null ? import_path109.default.resolve(process.cwd(), output2) : import_path109.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
976702
976781
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
976703
|
-
const raw = index_vite_proxy_tmp_default.load(await (0,
|
|
976782
|
+
const raw = index_vite_proxy_tmp_default.load(await (0, import_promises198.readFile)(docsYmlPath, "utf-8"));
|
|
976704
976783
|
const themeConfig = {};
|
|
976705
976784
|
for (const [k4, v3] of Object.entries(raw)) {
|
|
976706
976785
|
if (docs_yml_exports.THEME_ELIGIBLE_YAML_KEYS.has(k4)) {
|
|
976707
976786
|
themeConfig[k4] = v3;
|
|
976708
976787
|
}
|
|
976709
976788
|
}
|
|
976710
|
-
await (0,
|
|
976789
|
+
await (0, import_promises198.mkdir)(outDir, { recursive: true });
|
|
976711
976790
|
const assetsDir = import_path109.default.join(outDir, "assets");
|
|
976712
|
-
await (0,
|
|
976791
|
+
await (0, import_promises198.mkdir)(assetsDir, { recursive: true });
|
|
976713
976792
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
976714
|
-
await (0,
|
|
976793
|
+
await (0, import_promises198.writeFile)(import_path109.default.join(outDir, "theme.yml"), index_vite_proxy_tmp_default.dump(exported), "utf-8");
|
|
976715
976794
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
976716
976795
|
}
|
|
976717
976796
|
};
|
|
@@ -976725,8 +976804,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
976725
976804
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path109.default.basename(abs) : relFromProject : relFromSource;
|
|
976726
976805
|
const dest = import_path109.default.join(assetsDir, destRelative);
|
|
976727
976806
|
try {
|
|
976728
|
-
await (0,
|
|
976729
|
-
await (0,
|
|
976807
|
+
await (0, import_promises198.mkdir)(import_path109.default.dirname(dest), { recursive: true });
|
|
976808
|
+
await (0, import_promises198.copyFile)(abs, dest);
|
|
976730
976809
|
return `./assets/${destRelative.split(import_path109.default.sep).join("/")}`;
|
|
976731
976810
|
} catch {
|
|
976732
976811
|
return obj;
|
|
@@ -976818,7 +976897,7 @@ async function listDocsThemes({
|
|
|
976818
976897
|
|
|
976819
976898
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
976820
976899
|
init_lib6();
|
|
976821
|
-
var
|
|
976900
|
+
var import_promises200 = require("fs/promises");
|
|
976822
976901
|
init_js_yaml();
|
|
976823
976902
|
var import_path111 = __toESM(require("path"), 1);
|
|
976824
976903
|
|
|
@@ -976827,7 +976906,7 @@ init_lib8();
|
|
|
976827
976906
|
init_lib6();
|
|
976828
976907
|
var import_child_process13 = require("child_process");
|
|
976829
976908
|
var import_crypto10 = require("crypto");
|
|
976830
|
-
var
|
|
976909
|
+
var import_promises199 = require("fs/promises");
|
|
976831
976910
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
976832
976911
|
var import_path110 = __toESM(require("path"), 1);
|
|
976833
976912
|
function getGitRoot() {
|
|
@@ -976871,7 +976950,7 @@ var ThemeConfigProcessor = class {
|
|
|
976871
976950
|
filePaths.map(async (filePath) => {
|
|
976872
976951
|
const abs = import_path110.default.resolve(this.themeDir, filePath);
|
|
976873
976952
|
try {
|
|
976874
|
-
await (0,
|
|
976953
|
+
await (0, import_promises199.access)(abs);
|
|
976875
976954
|
} catch {
|
|
976876
976955
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
976877
976956
|
}
|
|
@@ -977036,7 +977115,7 @@ ${errors4.map((e2) => ` - ${e2}`).join("\n")}`,
|
|
|
977036
977115
|
return { config: cfg, filesUploaded };
|
|
977037
977116
|
}
|
|
977038
977117
|
async uploadFileToCas(absolutePath) {
|
|
977039
|
-
const content5 = await (0,
|
|
977118
|
+
const content5 = await (0, import_promises199.readFile)(absolutePath);
|
|
977040
977119
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
977041
977120
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
977042
977121
|
return this.uploadToCas(content5, contentType, bindPath, import_path110.default.basename(absolutePath));
|
|
@@ -977151,7 +977230,7 @@ async function uploadDocsTheme({
|
|
|
977151
977230
|
await cliContext.runTask(async (context3) => {
|
|
977152
977231
|
let rawYaml;
|
|
977153
977232
|
try {
|
|
977154
|
-
const content5 = await (0,
|
|
977233
|
+
const content5 = await (0, import_promises200.readFile)(themeYmlPath, "utf-8");
|
|
977155
977234
|
rawYaml = index_vite_proxy_tmp_default.load(content5, { schema: index_vite_proxy_tmp_default.JSON_SCHEMA });
|
|
977156
977235
|
} catch {
|
|
977157
977236
|
context3.failAndThrow(
|
|
@@ -977206,7 +977285,7 @@ async function uploadDocsTheme({
|
|
|
977206
977285
|
// src/commands/downgrade/downgrade.ts
|
|
977207
977286
|
init_lib19();
|
|
977208
977287
|
init_lib6();
|
|
977209
|
-
var
|
|
977288
|
+
var import_promises201 = require("fs/promises");
|
|
977210
977289
|
function ensureFinalNewline2(content5) {
|
|
977211
977290
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
977212
977291
|
}
|
|
@@ -977231,7 +977310,7 @@ async function downgrade({
|
|
|
977231
977310
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
977232
977311
|
draft.version = targetVersion;
|
|
977233
977312
|
});
|
|
977234
|
-
await (0,
|
|
977313
|
+
await (0, import_promises201.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
977235
977314
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
977236
977315
|
}
|
|
977237
977316
|
|
|
@@ -977239,7 +977318,7 @@ async function downgrade({
|
|
|
977239
977318
|
init_lib36();
|
|
977240
977319
|
init_lib8();
|
|
977241
977320
|
init_lib22();
|
|
977242
|
-
var
|
|
977321
|
+
var import_promises202 = require("fs/promises");
|
|
977243
977322
|
init_js_yaml();
|
|
977244
977323
|
|
|
977245
977324
|
// src/commands/export/convertIrToOpenApi.ts
|
|
@@ -978661,8 +978740,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
978661
978740
|
ir: ir3,
|
|
978662
978741
|
mode: "openapi"
|
|
978663
978742
|
});
|
|
978664
|
-
await (0,
|
|
978665
|
-
await (0,
|
|
978743
|
+
await (0, import_promises202.mkdir)(dirname6(outputPath), { recursive: true });
|
|
978744
|
+
await (0, import_promises202.writeFile)(
|
|
978666
978745
|
outputPath,
|
|
978667
978746
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : index_vite_proxy_tmp_default.dump(openapi, { indent: indent4 })
|
|
978668
978747
|
);
|
|
@@ -979268,7 +979347,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
979268
979347
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
979269
979348
|
init_lib8();
|
|
979270
979349
|
init_lib6();
|
|
979271
|
-
var
|
|
979350
|
+
var import_promises203 = require("fs/promises");
|
|
979272
979351
|
init_js_yaml();
|
|
979273
979352
|
async function compareOpenAPISpecs({
|
|
979274
979353
|
originalPath,
|
|
@@ -979310,12 +979389,12 @@ async function compareOpenAPISpecs({
|
|
|
979310
979389
|
}
|
|
979311
979390
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
979312
979391
|
}
|
|
979313
|
-
await (0,
|
|
979392
|
+
await (0, import_promises203.writeFile)(outputPath, index_vite_proxy_tmp_default.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
979314
979393
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
979315
979394
|
});
|
|
979316
979395
|
}
|
|
979317
979396
|
async function loadSpec2(filepath, context3) {
|
|
979318
|
-
const contents = await (0,
|
|
979397
|
+
const contents = await (0, import_promises203.readFile)(filepath, "utf8");
|
|
979319
979398
|
try {
|
|
979320
979399
|
return JSON.parse(contents);
|
|
979321
979400
|
} catch {
|
|
@@ -979423,7 +979502,7 @@ init_lib35();
|
|
|
979423
979502
|
init_lib16();
|
|
979424
979503
|
init_lib15();
|
|
979425
979504
|
init_lib6();
|
|
979426
|
-
var
|
|
979505
|
+
var import_promises204 = require("fs/promises");
|
|
979427
979506
|
init_js_yaml();
|
|
979428
979507
|
async function writeOverridesForWorkspaces({
|
|
979429
979508
|
project,
|
|
@@ -979449,7 +979528,7 @@ async function writeOverridesForWorkspaces({
|
|
|
979449
979528
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
979450
979529
|
let parsedOverrides = null;
|
|
979451
979530
|
try {
|
|
979452
|
-
const contents = (await (0,
|
|
979531
|
+
const contents = (await (0, import_promises204.readFile)(overridesFilepath, "utf8")).toString();
|
|
979453
979532
|
try {
|
|
979454
979533
|
parsedOverrides = JSON.parse(contents);
|
|
979455
979534
|
} catch (err) {
|
|
@@ -979514,7 +979593,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
979514
979593
|
for (const overridesPath of overridesPaths) {
|
|
979515
979594
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
979516
979595
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides, includeModels, context: context3 });
|
|
979517
|
-
await (0,
|
|
979596
|
+
await (0, import_promises204.writeFile)(overridesPath, index_vite_proxy_tmp_default.dump(content5));
|
|
979518
979597
|
}
|
|
979519
979598
|
} else {
|
|
979520
979599
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -979528,7 +979607,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
979528
979607
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
979529
979608
|
}
|
|
979530
979609
|
}
|
|
979531
|
-
await (0,
|
|
979610
|
+
await (0, import_promises204.writeFile)(
|
|
979532
979611
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
979533
979612
|
index_vite_proxy_tmp_default.dump(content5)
|
|
979534
979613
|
);
|
|
@@ -979987,7 +980066,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
979987
980066
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
979988
980067
|
init_lib21();
|
|
979989
980068
|
init_source();
|
|
979990
|
-
var
|
|
980069
|
+
var import_promises205 = require("fs/promises");
|
|
979991
980070
|
async function generateJsonschemaForWorkspaces({
|
|
979992
980071
|
typeLocator,
|
|
979993
980072
|
project,
|
|
@@ -980035,9 +980114,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
980035
980114
|
context: context3
|
|
980036
980115
|
});
|
|
980037
980116
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
980038
|
-
await (0,
|
|
980117
|
+
await (0, import_promises205.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
980039
980118
|
}
|
|
980040
|
-
await (0,
|
|
980119
|
+
await (0, import_promises205.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
980041
980120
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
980042
980121
|
});
|
|
980043
980122
|
})
|
|
@@ -980047,7 +980126,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
980047
980126
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
980048
980127
|
init_lib8();
|
|
980049
980128
|
init_lib6();
|
|
980050
|
-
var
|
|
980129
|
+
var import_promises206 = require("fs/promises");
|
|
980051
980130
|
init_js_yaml();
|
|
980052
980131
|
var HTTP_METHODS4 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
980053
980132
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -980076,11 +980155,11 @@ async function mergeOpenAPIWithOverrides({
|
|
|
980076
980155
|
if (split2) {
|
|
980077
980156
|
const examples = extractEnrichedExamples2(openapi, merged);
|
|
980078
980157
|
const output2 = isJson ? JSON.stringify(examples, null, 2) : index_vite_proxy_tmp_default.dump(examples, { lineWidth: -1, noRefs: true });
|
|
980079
|
-
await (0,
|
|
980158
|
+
await (0, import_promises206.writeFile)(outputPath, output2);
|
|
980080
980159
|
context3.logger.info(`Extracted enriched examples written to ${outputPath}`);
|
|
980081
980160
|
} else {
|
|
980082
980161
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : index_vite_proxy_tmp_default.dump(merged, { lineWidth: -1, noRefs: true });
|
|
980083
|
-
await (0,
|
|
980162
|
+
await (0, import_promises206.writeFile)(outputPath, output2);
|
|
980084
980163
|
if (outputPath === openapiPath) {
|
|
980085
980164
|
context3.logger.info(`Enriched ${openapiPath} in-place`);
|
|
980086
980165
|
} else {
|
|
@@ -980090,7 +980169,7 @@ async function mergeOpenAPIWithOverrides({
|
|
|
980090
980169
|
});
|
|
980091
980170
|
}
|
|
980092
980171
|
async function loadYamlOrJson(filepath, context3) {
|
|
980093
|
-
const contents = await (0,
|
|
980172
|
+
const contents = await (0, import_promises206.readFile)(filepath, "utf8");
|
|
980094
980173
|
try {
|
|
980095
980174
|
return JSON.parse(contents);
|
|
980096
980175
|
} catch {
|
|
@@ -980885,7 +980964,7 @@ init_lib35();
|
|
|
980885
980964
|
init_lib6();
|
|
980886
980965
|
init_esm19();
|
|
980887
980966
|
init_axios2();
|
|
980888
|
-
var
|
|
980967
|
+
var import_promises207 = require("fs/promises");
|
|
980889
980968
|
var import_path117 = __toESM(require("path"), 1);
|
|
980890
980969
|
init_index_min2();
|
|
980891
980970
|
var import_tmp_promise20 = __toESM(require_tmp_promise(), 1);
|
|
@@ -980939,7 +981018,7 @@ async function registerWorkspacesV1({
|
|
|
980939
981018
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
980940
981019
|
await Kn({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
980941
981020
|
context3.logger.info("Uploading definition...");
|
|
980942
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
981021
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises207.readFile)(tarPath));
|
|
980943
981022
|
context3.logger.info(
|
|
980944
981023
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
980945
981024
|
);
|
|
@@ -980996,7 +981075,7 @@ function getAIEnhancerConfig2() {
|
|
|
980996
981075
|
// src/commands/resolve-specs/resolveSpecsForWorkspaces.ts
|
|
980997
981076
|
init_lib8();
|
|
980998
981077
|
init_lib35();
|
|
980999
|
-
var
|
|
981078
|
+
var import_promises208 = require("fs/promises");
|
|
981000
981079
|
var import_path118 = __toESM(require("path"), 1);
|
|
981001
981080
|
async function resolveSpecsForWorkspaces({
|
|
981002
981081
|
project,
|
|
@@ -981016,14 +981095,14 @@ async function resolveSpecsForWorkspaces({
|
|
|
981016
981095
|
return;
|
|
981017
981096
|
}
|
|
981018
981097
|
const workspaceOutputDir = project.apiWorkspaces.length > 1 ? AbsoluteFilePath2.of(import_path118.default.join(outputDir, workspace.workspaceName ?? "api")) : outputDir;
|
|
981019
|
-
await (0,
|
|
981098
|
+
await (0, import_promises208.mkdir)(workspaceOutputDir, { recursive: true });
|
|
981020
981099
|
const manifest = await collectRawSpecs({
|
|
981021
981100
|
specs,
|
|
981022
981101
|
hostOutputDir: workspaceOutputDir,
|
|
981023
981102
|
containerBaseDir: ".",
|
|
981024
981103
|
context: context3
|
|
981025
981104
|
});
|
|
981026
|
-
await (0,
|
|
981105
|
+
await (0, import_promises208.writeFile)(
|
|
981027
981106
|
import_path118.default.join(workspaceOutputDir, SPECS_MANIFEST_FILENAME),
|
|
981028
981107
|
JSON.stringify(manifest, void 0, 4)
|
|
981029
981108
|
);
|
|
@@ -981233,7 +981312,7 @@ init_lib17();
|
|
|
981233
981312
|
init_lib19();
|
|
981234
981313
|
init_lib8();
|
|
981235
981314
|
init_lib6();
|
|
981236
|
-
var
|
|
981315
|
+
var import_promises209 = __toESM(require("fs/promises"), 1);
|
|
981237
981316
|
|
|
981238
981317
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
981239
981318
|
var BASE_VERSION = "0.0.1";
|
|
@@ -981353,7 +981432,7 @@ async function sdkPreview({
|
|
|
981353
981432
|
const firstPath = pathOutputs[0];
|
|
981354
981433
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
981355
981434
|
if (absolutePathToOutput != null) {
|
|
981356
|
-
await
|
|
981435
|
+
await import_promises209.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
981357
981436
|
}
|
|
981358
981437
|
for (const workspace of project.apiWorkspaces) {
|
|
981359
981438
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -981543,7 +981622,7 @@ async function sdkPreview({
|
|
|
981543
981622
|
init_lib33();
|
|
981544
981623
|
init_lib6();
|
|
981545
981624
|
init_source();
|
|
981546
|
-
var
|
|
981625
|
+
var import_promises210 = require("fs/promises");
|
|
981547
981626
|
var import_path119 = require("path");
|
|
981548
981627
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
981549
981628
|
let command3;
|
|
@@ -981589,7 +981668,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
981589
981668
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
981590
981669
|
let resolvedPath;
|
|
981591
981670
|
try {
|
|
981592
|
-
resolvedPath = await (0,
|
|
981671
|
+
resolvedPath = await (0, import_promises210.realpath)(fernPath);
|
|
981593
981672
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
981594
981673
|
} catch (error50) {
|
|
981595
981674
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -981903,22 +981982,22 @@ init_lib19();
|
|
|
981903
981982
|
init_lib8();
|
|
981904
981983
|
init_lib6();
|
|
981905
981984
|
var fs33 = __toESM(require("fs"), 1);
|
|
981906
|
-
var
|
|
981985
|
+
var import_promises211 = require("fs/promises");
|
|
981907
981986
|
init_graphql();
|
|
981908
981987
|
init_js_yaml();
|
|
981909
981988
|
var import_stream18 = require("stream");
|
|
981910
|
-
var
|
|
981989
|
+
var import_promises212 = require("stream/promises");
|
|
981911
981990
|
async function fetchAndWriteFile(url3, path119, logger4, indent4) {
|
|
981912
981991
|
const resp = await fetch(url3);
|
|
981913
981992
|
if (resp.ok && resp.body) {
|
|
981914
981993
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
981915
981994
|
const fileStream = fs33.createWriteStream(path119);
|
|
981916
|
-
await (0,
|
|
981917
|
-
const fileContents = await (0,
|
|
981995
|
+
await (0, import_promises212.finished)(import_stream18.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
981996
|
+
const fileContents = await (0, import_promises211.readFile)(path119, "utf8");
|
|
981918
981997
|
try {
|
|
981919
|
-
await (0,
|
|
981998
|
+
await (0, import_promises211.writeFile)(path119, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
981920
981999
|
} catch (e2) {
|
|
981921
|
-
await (0,
|
|
982000
|
+
await (0, import_promises211.writeFile)(path119, index_vite_proxy_tmp_default.dump(index_vite_proxy_tmp_default.load(fileContents), { indent: indent4 }), "utf8");
|
|
981922
982001
|
}
|
|
981923
982002
|
logger4.debug("File written successfully");
|
|
981924
982003
|
}
|
|
@@ -982074,14 +982153,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
982074
982153
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path119, logger4) {
|
|
982075
982154
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
982076
982155
|
if (postResult.success) {
|
|
982077
|
-
await (0,
|
|
982156
|
+
await (0, import_promises211.writeFile)(path119, postResult.result, "utf8");
|
|
982078
982157
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
982079
982158
|
return;
|
|
982080
982159
|
}
|
|
982081
982160
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
982082
982161
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
982083
982162
|
if (getResult.success) {
|
|
982084
|
-
await (0,
|
|
982163
|
+
await (0, import_promises211.writeFile)(path119, getResult.result, "utf8");
|
|
982085
982164
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
982086
982165
|
return;
|
|
982087
982166
|
}
|
|
@@ -982791,7 +982870,7 @@ async function validateWorkspaces({
|
|
|
982791
982870
|
init_lib19();
|
|
982792
982871
|
init_lib8();
|
|
982793
982872
|
init_source();
|
|
982794
|
-
var
|
|
982873
|
+
var import_promises213 = require("fs/promises");
|
|
982795
982874
|
init_js_yaml();
|
|
982796
982875
|
var import_path121 = __toESM(require("path"), 1);
|
|
982797
982876
|
async function writeDefinitionForWorkspaces({
|
|
@@ -982873,22 +982952,22 @@ async function writeFernDefinition({
|
|
|
982873
982952
|
return a3.localeCompare(b5);
|
|
982874
982953
|
};
|
|
982875
982954
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
982876
|
-
await (0,
|
|
982955
|
+
await (0, import_promises213.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
982877
982956
|
}
|
|
982878
|
-
await (0,
|
|
982879
|
-
await (0,
|
|
982957
|
+
await (0, import_promises213.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
982958
|
+
await (0, import_promises213.writeFile)(
|
|
982880
982959
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
982881
982960
|
index_vite_proxy_tmp_default.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
982882
982961
|
);
|
|
982883
982962
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
982884
982963
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
982885
|
-
await (0,
|
|
982886
|
-
await (0,
|
|
982964
|
+
await (0, import_promises213.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
982965
|
+
await (0, import_promises213.writeFile)(absoluteFilepath, index_vite_proxy_tmp_default.dump(packageMarker.contents, { sortKeys }));
|
|
982887
982966
|
}
|
|
982888
982967
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
982889
982968
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
982890
|
-
await (0,
|
|
982891
|
-
await (0,
|
|
982969
|
+
await (0, import_promises213.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
982970
|
+
await (0, import_promises213.writeFile)(absoluteFilepath, index_vite_proxy_tmp_default.dump(definitionFile.contents, { sortKeys }));
|
|
982892
982971
|
}
|
|
982893
982972
|
}
|
|
982894
982973
|
|
|
@@ -982896,7 +982975,7 @@ async function writeFernDefinition({
|
|
|
982896
982975
|
init_lib67();
|
|
982897
982976
|
init_lib8();
|
|
982898
982977
|
init_source();
|
|
982899
|
-
var
|
|
982978
|
+
var import_promises214 = require("fs/promises");
|
|
982900
982979
|
async function writeDocsDefinitionForProject({
|
|
982901
982980
|
project,
|
|
982902
982981
|
outputPath,
|
|
@@ -982928,7 +983007,7 @@ async function writeDocsDefinitionForProject({
|
|
|
982928
983007
|
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
|
|
982929
983008
|
});
|
|
982930
983009
|
const docsDefinition = await docsResolver.resolve();
|
|
982931
|
-
await (0,
|
|
983010
|
+
await (0, import_promises214.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
982932
983011
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
982933
983012
|
});
|
|
982934
983013
|
}
|