@fern-api/fern-api-dev 5.56.4 → 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 +441 -367
- 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();
|
|
@@ -898346,6 +898348,16 @@ async function generateOne({ generatorInvocation, interactiveTaskContext, projec
|
|
|
898346
898348
|
generatorsYmlLineNumber: lineNumber
|
|
898347
898349
|
});
|
|
898348
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
|
+
});
|
|
898349
898361
|
} catch (error50) {
|
|
898350
898362
|
if (automation == null) {
|
|
898351
898363
|
throw error50;
|
|
@@ -898381,6 +898393,68 @@ async function generateOne({ generatorInvocation, interactiveTaskContext, projec
|
|
|
898381
898393
|
});
|
|
898382
898394
|
}
|
|
898383
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
|
+
}
|
|
898384
898458
|
|
|
898385
898459
|
// ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForDocsWorkspace.js
|
|
898386
898460
|
init_lib4();
|
|
@@ -898440,7 +898514,7 @@ init_lib6();
|
|
|
898440
898514
|
init_axios2();
|
|
898441
898515
|
init_source();
|
|
898442
898516
|
var import_crypto9 = require("crypto");
|
|
898443
|
-
var
|
|
898517
|
+
var import_promises121 = require("fs/promises");
|
|
898444
898518
|
init_lodash();
|
|
898445
898519
|
var mime3 = __toESM(require_mime_types(), 1);
|
|
898446
898520
|
var import_path80 = require("path");
|
|
@@ -898515,7 +898589,7 @@ init_lib67();
|
|
|
898515
898589
|
init_js();
|
|
898516
898590
|
init_lib66();
|
|
898517
898591
|
var import_crypto8 = require("crypto");
|
|
898518
|
-
var
|
|
898592
|
+
var import_promises120 = require("fs/promises");
|
|
898519
898593
|
var mime2 = __toESM(require_mime_types(), 1);
|
|
898520
898594
|
|
|
898521
898595
|
// ../generation/remote-generation/remote-workspace-runner/lib/mapDocsConfigToLedgerConfig.js
|
|
@@ -898887,7 +898961,7 @@ async function uploadMissingBlobs(missingContent, blobs, context3, filePaths) {
|
|
|
898887
898961
|
if (blob == null && filePaths != null) {
|
|
898888
898962
|
const filePath = filePaths.get(hash5);
|
|
898889
898963
|
if (filePath != null) {
|
|
898890
|
-
blob = await (0,
|
|
898964
|
+
blob = await (0, import_promises120.readFile)(filePath);
|
|
898891
898965
|
const inferred = mime2.lookup(filePath);
|
|
898892
898966
|
if (inferred !== false) {
|
|
898893
898967
|
contentType = inferred;
|
|
@@ -899187,7 +899261,7 @@ function sanitizeRelativePathForS3(relativeFilePath) {
|
|
|
899187
899261
|
return relativeFilePath.replace(/\.\.\//g, "_dot_dot_/");
|
|
899188
899262
|
}
|
|
899189
899263
|
async function readAndHashFile(absoluteFilePath) {
|
|
899190
|
-
const buffer = await (0,
|
|
899264
|
+
const buffer = await (0, import_promises121.readFile)(absoluteFilePath);
|
|
899191
899265
|
const hash5 = (0, import_crypto9.createHash)("sha256").update(new Uint8Array(buffer)).digest("hex");
|
|
899192
899266
|
return { buffer, hash: hash5 };
|
|
899193
899267
|
}
|
|
@@ -899688,13 +899762,13 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
899688
899762
|
};
|
|
899689
899763
|
const localeAwareMarkdownLoader = async (filepath) => {
|
|
899690
899764
|
const pathToRead = await resolveLocalePath(filepath);
|
|
899691
|
-
const raw = await (0,
|
|
899765
|
+
const raw = await (0, import_promises121.readFile)(pathToRead, "utf-8");
|
|
899692
899766
|
const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
|
|
899693
899767
|
return fmMatch != null ? raw.slice(fmMatch[0].length) : raw;
|
|
899694
899768
|
};
|
|
899695
899769
|
const localeAwareFileLoader = async (filepath) => {
|
|
899696
899770
|
const pathToRead = await resolveLocalePath(filepath);
|
|
899697
|
-
return (0,
|
|
899771
|
+
return (0, import_promises121.readFile)(pathToRead, "utf-8");
|
|
899698
899772
|
};
|
|
899699
899773
|
const translatedPageEntries = await Promise.all(Object.entries(localePages).map(async ([path119, rawMarkdown]) => {
|
|
899700
899774
|
try {
|
|
@@ -899888,7 +899962,7 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
899888
899962
|
try {
|
|
899889
899963
|
const uploadUrl = extractUploadUrl(urlValue);
|
|
899890
899964
|
const mimeType = mime3.lookup(absoluteFilePath);
|
|
899891
|
-
await axios_default.put(uploadUrl, await (0,
|
|
899965
|
+
await axios_default.put(uploadUrl, await (0, import_promises121.readFile)(absoluteFilePath), {
|
|
899892
899966
|
headers: {
|
|
899893
899967
|
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType,
|
|
899894
899968
|
// Set max cache control for S3 uploads
|
|
@@ -900539,7 +900613,7 @@ var LegacyDocsPublisher = class {
|
|
|
900539
900613
|
previewId,
|
|
900540
900614
|
disableTemplates: void 0,
|
|
900541
900615
|
skipUpload,
|
|
900542
|
-
cliVersion: "5.
|
|
900616
|
+
cliVersion: "5.57.0",
|
|
900543
900617
|
loginCommand: "fern auth login"
|
|
900544
900618
|
});
|
|
900545
900619
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -901529,7 +901603,7 @@ init_lib4();
|
|
|
901529
901603
|
init_lib8();
|
|
901530
901604
|
init_lib6();
|
|
901531
901605
|
init_source();
|
|
901532
|
-
var
|
|
901606
|
+
var import_promises122 = require("fs/promises");
|
|
901533
901607
|
var import_path82 = __toESM(require("path"), 1);
|
|
901534
901608
|
|
|
901535
901609
|
// ../cli-v2/lib/config/fern-yml/FernYmlBuilder.js
|
|
@@ -902400,7 +902474,7 @@ var InitCommand = class {
|
|
|
902400
902474
|
apiPath,
|
|
902401
902475
|
defaultGroup: result.defaultGroup
|
|
902402
902476
|
});
|
|
902403
|
-
await (0,
|
|
902477
|
+
await (0, import_promises122.writeFile)(fernYmlPath, fernYmlContent, "utf-8");
|
|
902404
902478
|
context3.stderr.info(`
|
|
902405
902479
|
${Icons.success} Created ${FERN_YML_FILENAME}`);
|
|
902406
902480
|
}
|
|
@@ -902422,9 +902496,9 @@ var InitCommand = class {
|
|
|
902422
902496
|
}
|
|
902423
902497
|
async writeSpecFile(cwd2, filename, content5) {
|
|
902424
902498
|
const specsDir = join8(cwd2, RelativeFilePath2.of(SPECS_DIR));
|
|
902425
|
-
await (0,
|
|
902499
|
+
await (0, import_promises122.mkdir)(specsDir, { recursive: true });
|
|
902426
902500
|
const filePath = join8(specsDir, RelativeFilePath2.of(filename));
|
|
902427
|
-
await (0,
|
|
902501
|
+
await (0, import_promises122.writeFile)(filePath, content5, "utf-8");
|
|
902428
902502
|
}
|
|
902429
902503
|
resolveApiPath(apiSource) {
|
|
902430
902504
|
switch (apiSource.type) {
|
|
@@ -903586,7 +903660,7 @@ function addReplayCommand(cli) {
|
|
|
903586
903660
|
init_lib8();
|
|
903587
903661
|
init_lib6();
|
|
903588
903662
|
init_source();
|
|
903589
|
-
var
|
|
903663
|
+
var import_promises123 = require("fs/promises");
|
|
903590
903664
|
var SchemaCommand = class {
|
|
903591
903665
|
async handle(context3, args) {
|
|
903592
903666
|
const schema = this.resolveSchema(args.name);
|
|
@@ -903622,9 +903696,9 @@ var SchemaCommand = class {
|
|
|
903622
903696
|
const absoluteOutputPath = resolve6(context3.cwd, outputPath);
|
|
903623
903697
|
const outputDir = dirname6(absoluteOutputPath);
|
|
903624
903698
|
if (!await doesPathExist(outputDir)) {
|
|
903625
|
-
await (0,
|
|
903699
|
+
await (0, import_promises123.mkdir)(outputDir, { recursive: true });
|
|
903626
903700
|
}
|
|
903627
|
-
await (0,
|
|
903701
|
+
await (0, import_promises123.writeFile)(absoluteOutputPath, this.formatJson(value2, pretty));
|
|
903628
903702
|
context3.stderr.info(source_default.green(`Wrote JSON Schema to ${absoluteOutputPath}`));
|
|
903629
903703
|
}
|
|
903630
903704
|
};
|
|
@@ -903908,13 +903982,13 @@ init_lib4();
|
|
|
903908
903982
|
init_lib8();
|
|
903909
903983
|
init_lib6();
|
|
903910
903984
|
init_source();
|
|
903911
|
-
var
|
|
903985
|
+
var import_promises141 = require("fs/promises");
|
|
903912
903986
|
init_js_yaml();
|
|
903913
903987
|
|
|
903914
903988
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
903915
903989
|
init_lib8();
|
|
903916
903990
|
init_lib6();
|
|
903917
|
-
var
|
|
903991
|
+
var import_promises124 = require("fs/promises");
|
|
903918
903992
|
var import_os11 = require("os");
|
|
903919
903993
|
var import_path86 = __toESM(require("path"), 1);
|
|
903920
903994
|
|
|
@@ -903991,9 +904065,9 @@ var ApiSpecResolver = class {
|
|
|
903991
904065
|
});
|
|
903992
904066
|
}
|
|
903993
904067
|
const extension4 = this.inferExtensionFromContent(content5);
|
|
903994
|
-
const tempDir2 = await (0,
|
|
904068
|
+
const tempDir2 = await (0, import_promises124.mkdtemp)(import_path86.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
903995
904069
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path86.default.join(tempDir2, `spec${extension4}`));
|
|
903996
|
-
await (0,
|
|
904070
|
+
await (0, import_promises124.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
903997
904071
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: "stdin" });
|
|
903998
904072
|
return {
|
|
903999
904073
|
absoluteFilePath,
|
|
@@ -904009,9 +904083,9 @@ var ApiSpecResolver = class {
|
|
|
904009
904083
|
async resolveUrl({ reference: reference4 }) {
|
|
904010
904084
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
904011
904085
|
const extension4 = this.inferExtension({ url: reference4, contentType });
|
|
904012
|
-
const tempDir2 = await (0,
|
|
904086
|
+
const tempDir2 = await (0, import_promises124.mkdtemp)(import_path86.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
904013
904087
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path86.default.join(tempDir2, `spec${extension4}`));
|
|
904014
|
-
await (0,
|
|
904088
|
+
await (0, import_promises124.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
904015
904089
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
904016
904090
|
return {
|
|
904017
904091
|
absoluteFilePath,
|
|
@@ -904027,7 +904101,7 @@ var ApiSpecResolver = class {
|
|
|
904027
904101
|
code: CliError.Code.ConfigError
|
|
904028
904102
|
});
|
|
904029
904103
|
}
|
|
904030
|
-
const content5 = await (0,
|
|
904104
|
+
const content5 = await (0, import_promises124.readFile)(absoluteFilePath, "utf-8");
|
|
904031
904105
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
904032
904106
|
return {
|
|
904033
904107
|
absoluteFilePath,
|
|
@@ -922808,7 +922882,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
922808
922882
|
|
|
922809
922883
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
922810
922884
|
init_lib8();
|
|
922811
|
-
var
|
|
922885
|
+
var import_promises125 = require("fs/promises");
|
|
922812
922886
|
var import_path88 = __toESM(require("path"), 1);
|
|
922813
922887
|
|
|
922814
922888
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -922942,8 +923016,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
922942
923016
|
endpointId
|
|
922943
923017
|
});
|
|
922944
923018
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
922945
|
-
await (0,
|
|
922946
|
-
await (0,
|
|
923019
|
+
await (0, import_promises125.mkdir)(import_path88.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
923020
|
+
await (0, import_promises125.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
922947
923021
|
} catch (error50) {
|
|
922948
923022
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
922949
923023
|
}
|
|
@@ -922952,8 +923026,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
922952
923026
|
}
|
|
922953
923027
|
async initializeProject(outputDir) {
|
|
922954
923028
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
922955
|
-
await (0,
|
|
922956
|
-
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);
|
|
922957
923031
|
return absolutePathToOutputDir;
|
|
922958
923032
|
}
|
|
922959
923033
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -926466,7 +926540,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
926466
926540
|
};
|
|
926467
926541
|
|
|
926468
926542
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
926469
|
-
var
|
|
926543
|
+
var import_promises126 = require("fs/promises");
|
|
926470
926544
|
var import_path90 = __toESM(require("path"), 1);
|
|
926471
926545
|
var DynamicSnippetsGoTestGenerator = class {
|
|
926472
926546
|
context;
|
|
@@ -926495,8 +926569,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
926495
926569
|
endpointId
|
|
926496
926570
|
});
|
|
926497
926571
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
926498
|
-
await (0,
|
|
926499
|
-
await (0,
|
|
926572
|
+
await (0, import_promises126.mkdir)(import_path90.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
926573
|
+
await (0, import_promises126.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
926500
926574
|
} catch (error50) {
|
|
926501
926575
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
926502
926576
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -930383,7 +930457,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
930383
930457
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
930384
930458
|
init_lib33();
|
|
930385
930459
|
init_lib6();
|
|
930386
|
-
var
|
|
930460
|
+
var import_promises127 = require("fs/promises");
|
|
930387
930461
|
var import_path91 = __toESM(require("path"), 1);
|
|
930388
930462
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
930389
930463
|
context;
|
|
@@ -930421,8 +930495,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930421
930495
|
endpointId
|
|
930422
930496
|
});
|
|
930423
930497
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
930424
|
-
await (0,
|
|
930425
|
-
await (0,
|
|
930498
|
+
await (0, import_promises127.mkdir)(import_path91.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
930499
|
+
await (0, import_promises127.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
930426
930500
|
} catch (error50) {
|
|
930427
930501
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
930428
930502
|
}
|
|
@@ -930449,7 +930523,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930449
930523
|
const reportsPath = join8(outputDir, RelativeFilePath2.of("reports"));
|
|
930450
930524
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
930451
930525
|
if (buildReportsExists) {
|
|
930452
|
-
await (0,
|
|
930526
|
+
await (0, import_promises127.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
930453
930527
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
930454
930528
|
} else {
|
|
930455
930529
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -930463,7 +930537,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
930463
930537
|
}
|
|
930464
930538
|
async initializeProject(outputDir) {
|
|
930465
930539
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
930466
|
-
await (0,
|
|
930540
|
+
await (0, import_promises127.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
930467
930541
|
return absolutePathToOutputDir;
|
|
930468
930542
|
}
|
|
930469
930543
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -933966,7 +934040,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
933966
934040
|
};
|
|
933967
934041
|
|
|
933968
934042
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
933969
|
-
var
|
|
934043
|
+
var import_promises128 = require("fs/promises");
|
|
933970
934044
|
var import_path92 = __toESM(require("path"), 1);
|
|
933971
934045
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
933972
934046
|
context;
|
|
@@ -933995,8 +934069,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
933995
934069
|
endpointId
|
|
933996
934070
|
});
|
|
933997
934071
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
933998
|
-
await (0,
|
|
933999
|
-
await (0,
|
|
934072
|
+
await (0, import_promises128.mkdir)(import_path92.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
934073
|
+
await (0, import_promises128.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
934000
934074
|
} catch (error50) {
|
|
934001
934075
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
934002
934076
|
}
|
|
@@ -937253,7 +937327,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
937253
937327
|
};
|
|
937254
937328
|
|
|
937255
937329
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
937256
|
-
var
|
|
937330
|
+
var import_promises129 = require("fs/promises");
|
|
937257
937331
|
var import_path93 = __toESM(require("path"), 1);
|
|
937258
937332
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
937259
937333
|
context;
|
|
@@ -937282,8 +937356,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
937282
937356
|
endpointId
|
|
937283
937357
|
});
|
|
937284
937358
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
937285
|
-
await (0,
|
|
937286
|
-
await (0,
|
|
937359
|
+
await (0, import_promises129.mkdir)(import_path93.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
937360
|
+
await (0, import_promises129.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
937287
937361
|
} catch (error50) {
|
|
937288
937362
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
937289
937363
|
}
|
|
@@ -940230,7 +940304,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
940230
940304
|
};
|
|
940231
940305
|
|
|
940232
940306
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
940233
|
-
var
|
|
940307
|
+
var import_promises130 = require("fs/promises");
|
|
940234
940308
|
var import_path94 = __toESM(require("path"), 1);
|
|
940235
940309
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
940236
940310
|
context;
|
|
@@ -940259,8 +940333,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
940259
940333
|
endpointId
|
|
940260
940334
|
});
|
|
940261
940335
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
940262
|
-
await (0,
|
|
940263
|
-
await (0,
|
|
940336
|
+
await (0, import_promises130.mkdir)(import_path94.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
940337
|
+
await (0, import_promises130.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
940264
940338
|
} catch (error50) {
|
|
940265
940339
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
940266
940340
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -940276,7 +940350,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
940276
940350
|
};
|
|
940277
940351
|
|
|
940278
940352
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
940279
|
-
var
|
|
940353
|
+
var import_promises131 = require("fs/promises");
|
|
940280
940354
|
var import_node_path40 = __toESM(require("path"), 1);
|
|
940281
940355
|
init_lib8();
|
|
940282
940356
|
|
|
@@ -945510,8 +945584,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945510
945584
|
absolutePathToOutputDir,
|
|
945511
945585
|
idx
|
|
945512
945586
|
});
|
|
945513
|
-
await (0,
|
|
945514
|
-
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);
|
|
945515
945589
|
} catch (error50) {
|
|
945516
945590
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
945517
945591
|
}
|
|
@@ -945520,7 +945594,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945520
945594
|
}
|
|
945521
945595
|
async initializeProject(outputDir) {
|
|
945522
945596
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
945523
|
-
await (0,
|
|
945597
|
+
await (0, import_promises131.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
945524
945598
|
return absolutePathToOutputDir;
|
|
945525
945599
|
}
|
|
945526
945600
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -945529,7 +945603,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
945529
945603
|
};
|
|
945530
945604
|
|
|
945531
945605
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
945532
|
-
var
|
|
945606
|
+
var import_promises132 = require("fs/promises");
|
|
945533
945607
|
var import_node_path41 = __toESM(require("path"), 1);
|
|
945534
945608
|
init_lib8();
|
|
945535
945609
|
|
|
@@ -950193,8 +950267,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
950193
950267
|
absolutePathToOutputDir,
|
|
950194
950268
|
idx
|
|
950195
950269
|
});
|
|
950196
|
-
await (0,
|
|
950197
|
-
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}`));
|
|
950198
950272
|
} catch (error50) {
|
|
950199
950273
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
950200
950274
|
}
|
|
@@ -950203,7 +950277,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
950203
950277
|
}
|
|
950204
950278
|
async initializeProject(outputDir) {
|
|
950205
950279
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Tests/Snippets"));
|
|
950206
|
-
await (0,
|
|
950280
|
+
await (0, import_promises132.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
950207
950281
|
return absolutePathToOutputDir;
|
|
950208
950282
|
}
|
|
950209
950283
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -952687,7 +952761,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
952687
952761
|
};
|
|
952688
952762
|
|
|
952689
952763
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
952690
|
-
var
|
|
952764
|
+
var import_promises133 = require("fs/promises");
|
|
952691
952765
|
var import_path95 = __toESM(require("path"), 1);
|
|
952692
952766
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
952693
952767
|
context;
|
|
@@ -952716,8 +952790,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
952716
952790
|
endpointId
|
|
952717
952791
|
});
|
|
952718
952792
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
952719
|
-
await (0,
|
|
952720
|
-
await (0,
|
|
952793
|
+
await (0, import_promises133.mkdir)(import_path95.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
952794
|
+
await (0, import_promises133.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
952721
952795
|
} catch (error50) {
|
|
952722
952796
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
952723
952797
|
}
|
|
@@ -952831,7 +952905,7 @@ init_lib8();
|
|
|
952831
952905
|
var import_autoversion3 = __toESM(require_autoversion(), 1);
|
|
952832
952906
|
init_lib9();
|
|
952833
952907
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
952834
|
-
var
|
|
952908
|
+
var import_promises137 = require("fs/promises");
|
|
952835
952909
|
var path102 = __toESM(require("path"), 1);
|
|
952836
952910
|
var import_path98 = require("path");
|
|
952837
952911
|
var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
@@ -952839,12 +952913,12 @@ var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
|
952839
952913
|
// ../generation/local-generation/local-workspace-runner/lib/applyTypeRelocations.js
|
|
952840
952914
|
init_lib8();
|
|
952841
952915
|
init_lib9();
|
|
952842
|
-
var
|
|
952916
|
+
var import_promises134 = require("fs/promises");
|
|
952843
952917
|
async function applyTypeRelocations({ ir: ir3, tmpOutputDirectory, context: context3 }) {
|
|
952844
952918
|
const relocationsFilepath = join8(tmpOutputDirectory, RelativeFilePath2.of(TYPE_RELOCATIONS_FILENAME));
|
|
952845
952919
|
let contents;
|
|
952846
952920
|
try {
|
|
952847
|
-
contents = await (0,
|
|
952921
|
+
contents = await (0, import_promises134.readFile)(relocationsFilepath, "utf-8");
|
|
952848
952922
|
} catch {
|
|
952849
952923
|
return;
|
|
952850
952924
|
}
|
|
@@ -952878,7 +952952,7 @@ async function applyTypeRelocations({ ir: ir3, tmpOutputDirectory, context: cont
|
|
|
952878
952952
|
} catch (error50) {
|
|
952879
952953
|
context3.logger.warn(`Failed to apply type relocations from ${relocationsFilepath}: ${error50 instanceof Error ? error50.message : String(error50)}`);
|
|
952880
952954
|
} finally {
|
|
952881
|
-
await (0,
|
|
952955
|
+
await (0, import_promises134.rm)(relocationsFilepath, { force: true });
|
|
952882
952956
|
}
|
|
952883
952957
|
}
|
|
952884
952958
|
|
|
@@ -953420,7 +953494,7 @@ var import_autoversion2 = __toESM(require_autoversion(), 1);
|
|
|
953420
953494
|
init_lib33();
|
|
953421
953495
|
init_lib6();
|
|
953422
953496
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
953423
|
-
var
|
|
953497
|
+
var import_promises135 = require("fs/promises");
|
|
953424
953498
|
var import_os12 = require("os");
|
|
953425
953499
|
var import_path96 = require("path");
|
|
953426
953500
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
@@ -953529,7 +953603,7 @@ var LocalTaskHandler = class {
|
|
|
953529
953603
|
try {
|
|
953530
953604
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
953531
953605
|
diffFile = await this.generateDiffFile();
|
|
953532
|
-
const diffContent = await (0,
|
|
953606
|
+
const diffContent = await (0, import_promises135.readFile)(diffFile, "utf-8");
|
|
953533
953607
|
if (diffContent.trim().length === 0) {
|
|
953534
953608
|
this.context.logger.info("No changes detected in generated SDK");
|
|
953535
953609
|
return null;
|
|
@@ -953734,7 +953808,7 @@ var LocalTaskHandler = class {
|
|
|
953734
953808
|
} finally {
|
|
953735
953809
|
if (diffFile) {
|
|
953736
953810
|
try {
|
|
953737
|
-
await (0,
|
|
953811
|
+
await (0, import_promises135.rm)(diffFile);
|
|
953738
953812
|
} catch (cleanupError) {
|
|
953739
953813
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
953740
953814
|
}
|
|
@@ -953915,7 +953989,7 @@ var LocalTaskHandler = class {
|
|
|
953915
953989
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
953916
953990
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
953917
953991
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
953918
|
-
await (0,
|
|
953992
|
+
await (0, import_promises135.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true, verbatimSymlinks: true });
|
|
953919
953993
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
953920
953994
|
await this.runThrowawayGitCommand(["config", "gc.auto", "0"], tmpOutputResolutionDir);
|
|
953921
953995
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
@@ -953936,22 +954010,22 @@ var LocalTaskHandler = class {
|
|
|
953936
954010
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
953937
954011
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
953938
954012
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
953939
|
-
await (0,
|
|
954013
|
+
await (0, import_promises135.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), {
|
|
953940
954014
|
recursive: true,
|
|
953941
954015
|
force: true,
|
|
953942
954016
|
maxRetries: 3,
|
|
953943
954017
|
retryDelay: 100
|
|
953944
954018
|
});
|
|
953945
|
-
await (0,
|
|
953946
|
-
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 });
|
|
953947
954021
|
}
|
|
953948
954022
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
953949
|
-
const contents = await (0,
|
|
954023
|
+
const contents = await (0, import_promises135.readdir)(this.absolutePathToLocalOutput);
|
|
953950
954024
|
const itemsToPreserve = [".git"];
|
|
953951
954025
|
if (await this.generatedOutputMissingReadme()) {
|
|
953952
954026
|
itemsToPreserve.push("README.md");
|
|
953953
954027
|
}
|
|
953954
|
-
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)), {
|
|
953955
954029
|
force: true,
|
|
953956
954030
|
recursive: true
|
|
953957
954031
|
})));
|
|
@@ -953959,11 +954033,11 @@ var LocalTaskHandler = class {
|
|
|
953959
954033
|
}
|
|
953960
954034
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
953961
954035
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
953962
|
-
await (0,
|
|
954036
|
+
await (0, import_promises135.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
953963
954037
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
953964
954038
|
}
|
|
953965
954039
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
953966
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
954040
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises135.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
953967
954041
|
if (firstLocalOutputItem == null) {
|
|
953968
954042
|
return;
|
|
953969
954043
|
}
|
|
@@ -953971,10 +954045,10 @@ var LocalTaskHandler = class {
|
|
|
953971
954045
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
953972
954046
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
953973
954047
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
953974
|
-
await (0,
|
|
954048
|
+
await (0, import_promises135.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true, verbatimSymlinks: true });
|
|
953975
954049
|
}
|
|
953976
954050
|
} else {
|
|
953977
|
-
await (0,
|
|
954051
|
+
await (0, import_promises135.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true, verbatimSymlinks: true });
|
|
953978
954052
|
}
|
|
953979
954053
|
}
|
|
953980
954054
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
@@ -953995,7 +954069,7 @@ var LocalTaskHandler = class {
|
|
|
953995
954069
|
*/
|
|
953996
954070
|
async generatedOutputMissingReadme() {
|
|
953997
954071
|
try {
|
|
953998
|
-
const contents = await (0,
|
|
954072
|
+
const contents = await (0, import_promises135.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
953999
954073
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
954000
954074
|
return false;
|
|
954001
954075
|
}
|
|
@@ -954045,13 +954119,13 @@ var LocalTaskHandler = class {
|
|
|
954045
954119
|
async readPriorChangelog(maxEntries) {
|
|
954046
954120
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
954047
954121
|
try {
|
|
954048
|
-
const files = await (0,
|
|
954122
|
+
const files = await (0, import_promises135.readdir)(this.absolutePathToLocalOutput);
|
|
954049
954123
|
const changelogFile = files.find((f3) => f3.toLowerCase() === "changelog.md");
|
|
954050
954124
|
if (!changelogFile) {
|
|
954051
954125
|
return "";
|
|
954052
954126
|
}
|
|
954053
954127
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
954054
|
-
const content5 = await (0,
|
|
954128
|
+
const content5 = await (0, import_promises135.readFile)(changelogPath, "utf-8");
|
|
954055
954129
|
if (content5.trim().length === 0) {
|
|
954056
954130
|
return "";
|
|
954057
954131
|
}
|
|
@@ -954127,11 +954201,11 @@ var LocalTaskHandler = class {
|
|
|
954127
954201
|
}
|
|
954128
954202
|
};
|
|
954129
954203
|
async function copySnippetJsonIfNonEmpty({ src, dest }) {
|
|
954130
|
-
const tmpStat = await (0,
|
|
954204
|
+
const tmpStat = await (0, import_promises135.stat)(src);
|
|
954131
954205
|
if (tmpStat.size === 0) {
|
|
954132
954206
|
return "skipped-empty";
|
|
954133
954207
|
}
|
|
954134
|
-
await (0,
|
|
954208
|
+
await (0, import_promises135.cp)(src, dest);
|
|
954135
954209
|
return "copied";
|
|
954136
954210
|
}
|
|
954137
954211
|
|
|
@@ -954139,7 +954213,7 @@ async function copySnippetJsonIfNonEmpty({ src, dest }) {
|
|
|
954139
954213
|
init_lib4();
|
|
954140
954214
|
init_lib8();
|
|
954141
954215
|
init_lib35();
|
|
954142
|
-
var
|
|
954216
|
+
var import_promises136 = require("fs/promises");
|
|
954143
954217
|
init_js_yaml();
|
|
954144
954218
|
var import_path97 = __toESM(require("path"), 1);
|
|
954145
954219
|
init_index_min2();
|
|
@@ -954208,7 +954282,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
954208
954282
|
});
|
|
954209
954283
|
}
|
|
954210
954284
|
resolved = filterSpec(resolved, audiences);
|
|
954211
|
-
await (0,
|
|
954285
|
+
await (0, import_promises136.writeFile)(import_path97.default.join(hostOutputDir, filename), JSON.stringify(resolved));
|
|
954212
954286
|
context3.logger.debug(`Resolved ${isAsync2 ? "AsyncAPI" : "OpenAPI"} spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
954213
954287
|
return {
|
|
954214
954288
|
type: isAsync2 ? "asyncapi" : "openapi",
|
|
@@ -954218,7 +954292,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
954218
954292
|
}
|
|
954219
954293
|
async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context: context3, index: index3 }) {
|
|
954220
954294
|
const filename = `openrpc${index3}.json`;
|
|
954221
|
-
const rawContent = await (0,
|
|
954295
|
+
const rawContent = await (0, import_promises136.readFile)(spec.absoluteFilepath, "utf-8");
|
|
954222
954296
|
let parsed;
|
|
954223
954297
|
try {
|
|
954224
954298
|
parsed = JSON.parse(rawContent);
|
|
@@ -954228,7 +954302,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954228
954302
|
let result = parsed;
|
|
954229
954303
|
const overrides = normalizeOverrides(spec.absoluteFilepathToOverrides);
|
|
954230
954304
|
for (const overridePath of overrides) {
|
|
954231
|
-
const overrideContent = await (0,
|
|
954305
|
+
const overrideContent = await (0, import_promises136.readFile)(overridePath, "utf-8");
|
|
954232
954306
|
let overrideParsed;
|
|
954233
954307
|
try {
|
|
954234
954308
|
overrideParsed = JSON.parse(overrideContent);
|
|
@@ -954240,7 +954314,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954240
954314
|
overrides: overrideParsed
|
|
954241
954315
|
});
|
|
954242
954316
|
}
|
|
954243
|
-
await (0,
|
|
954317
|
+
await (0, import_promises136.writeFile)(import_path97.default.join(hostOutputDir, filename), JSON.stringify(result));
|
|
954244
954318
|
context3.logger.debug(`Resolved OpenRPC spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
954245
954319
|
return {
|
|
954246
954320
|
type: "openrpc",
|
|
@@ -954251,7 +954325,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
954251
954325
|
async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
954252
954326
|
const dirName = `protobuf${index3}`;
|
|
954253
954327
|
const destDir = import_path97.default.join(hostOutputDir, dirName);
|
|
954254
|
-
await (0,
|
|
954328
|
+
await (0, import_promises136.cp)(spec.absoluteFilepathToProtobufRoot, destDir, { recursive: true });
|
|
954255
954329
|
const entry = {
|
|
954256
954330
|
type: "protobuf",
|
|
954257
954331
|
specPath: toContainerPath(dirName, containerBaseDir)
|
|
@@ -954261,7 +954335,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
954261
954335
|
entry.overridePaths = [];
|
|
954262
954336
|
for (const [i5, override] of overrides.entries()) {
|
|
954263
954337
|
const overrideName = `protobuf${index3}-override-${i5}${import_path97.default.extname(override)}`;
|
|
954264
|
-
await (0,
|
|
954338
|
+
await (0, import_promises136.copyFile)(override, import_path97.default.join(hostOutputDir, overrideName));
|
|
954265
954339
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
954266
954340
|
}
|
|
954267
954341
|
}
|
|
@@ -954270,7 +954344,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
954270
954344
|
async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
954271
954345
|
const ext2 = import_path97.default.extname(spec.absoluteFilepath) || ".graphql";
|
|
954272
954346
|
const filename = `graphql${index3}${ext2}`;
|
|
954273
|
-
await (0,
|
|
954347
|
+
await (0, import_promises136.copyFile)(spec.absoluteFilepath, import_path97.default.join(hostOutputDir, filename));
|
|
954274
954348
|
const entry = {
|
|
954275
954349
|
type: "graphql",
|
|
954276
954350
|
specPath: toContainerPath(filename, containerBaseDir),
|
|
@@ -954281,7 +954355,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
954281
954355
|
entry.overridePaths = [];
|
|
954282
954356
|
for (const [i5, override] of overrides.entries()) {
|
|
954283
954357
|
const overrideName = `graphql${index3}-override-${i5}${import_path97.default.extname(override)}`;
|
|
954284
|
-
await (0,
|
|
954358
|
+
await (0, import_promises136.copyFile)(override, import_path97.default.join(hostOutputDir, overrideName));
|
|
954285
954359
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
954286
954360
|
}
|
|
954287
954361
|
}
|
|
@@ -954289,7 +954363,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
954289
954363
|
}
|
|
954290
954364
|
async function isAsyncAPISpec(filepath) {
|
|
954291
954365
|
try {
|
|
954292
|
-
const content5 = await (0,
|
|
954366
|
+
const content5 = await (0, import_promises136.readFile)(filepath, "utf-8");
|
|
954293
954367
|
return content5.includes("asyncapi");
|
|
954294
954368
|
} catch {
|
|
954295
954369
|
return false;
|
|
@@ -954399,7 +954473,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
954399
954473
|
context: context3,
|
|
954400
954474
|
audiences
|
|
954401
954475
|
});
|
|
954402
|
-
await (0,
|
|
954476
|
+
await (0, import_promises136.writeFile)(join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of(SPECS_MANIFEST_FILENAME)), JSON.stringify(manifest, void 0, 4));
|
|
954403
954477
|
const tarGzPath = join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of("specs.tar.gz"));
|
|
954404
954478
|
await Kn({
|
|
954405
954479
|
gzip: true,
|
|
@@ -954408,7 +954482,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
954408
954482
|
portable: true,
|
|
954409
954483
|
filter: (entryPath) => entryPath !== "./specs.tar.gz"
|
|
954410
954484
|
}, ["."]);
|
|
954411
|
-
return await (0,
|
|
954485
|
+
return await (0, import_promises136.readFile)(tarGzPath);
|
|
954412
954486
|
} finally {
|
|
954413
954487
|
await tmpDir.cleanup();
|
|
954414
954488
|
}
|
|
@@ -954450,24 +954524,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954450
954524
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
954451
954525
|
const configJsonFile = (0, import_path98.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
954452
954526
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
954453
|
-
await (0,
|
|
954527
|
+
await (0, import_promises137.writeFile)(configJsonFile, "");
|
|
954454
954528
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
954455
954529
|
const tmpOutputDirectory = (0, import_path98.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
954456
954530
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
954457
|
-
await (0,
|
|
954531
|
+
await (0, import_promises137.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
954458
954532
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
954459
954533
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
954460
954534
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
954461
954535
|
const snippetJsonFile = (0, import_path98.join)(workspaceTempDir.path, "snippet.json");
|
|
954462
954536
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
954463
|
-
await (0,
|
|
954537
|
+
await (0, import_promises137.writeFile)(snippetJsonFile, "");
|
|
954464
954538
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
954465
954539
|
}
|
|
954466
954540
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
954467
954541
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
954468
954542
|
const snippetTemplatesJsonFile = (0, import_path98.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
954469
954543
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
954470
|
-
await (0,
|
|
954544
|
+
await (0, import_promises137.writeFile)(snippetTemplatesJsonFile, "");
|
|
954471
954545
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
954472
954546
|
}
|
|
954473
954547
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -954508,7 +954582,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954508
954582
|
publishToRegistry,
|
|
954509
954583
|
paths
|
|
954510
954584
|
});
|
|
954511
|
-
await (0,
|
|
954585
|
+
await (0, import_promises137.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
954512
954586
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
954513
954587
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
954514
954588
|
hostPath: source2.absoluteFilePath,
|
|
@@ -954516,7 +954590,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954516
954590
|
}));
|
|
954517
954591
|
if (rawApiSpecs != null && rawApiSpecs.length > 0) {
|
|
954518
954592
|
const rawSpecsDir = (0, import_path98.join)(workspaceTempDir.path, SPECS_DIRECTORY_NAME);
|
|
954519
|
-
await (0,
|
|
954593
|
+
await (0, import_promises137.mkdir)(rawSpecsDir, { recursive: true });
|
|
954520
954594
|
const containerSpecsDir = environment2.usesContainerPaths ? CONTAINER_SPECS_DIRECTORY : rawSpecsDir;
|
|
954521
954595
|
const manifest = await collectRawSpecs({
|
|
954522
954596
|
specs: rawApiSpecs,
|
|
@@ -954525,7 +954599,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
954525
954599
|
context: context3,
|
|
954526
954600
|
audiences
|
|
954527
954601
|
});
|
|
954528
|
-
await (0,
|
|
954602
|
+
await (0, import_promises137.writeFile)((0, import_path98.join)(rawSpecsDir, SPECS_MANIFEST_FILENAME), JSON.stringify(manifest, void 0, 4));
|
|
954529
954603
|
context3.logger.debug(`Wrote raw specs manifest with ${manifest.specs.length} spec(s) to ${rawSpecsDir}`);
|
|
954530
954604
|
sourceMounts.push({
|
|
954531
954605
|
hostPath: AbsoluteFilePath2.of(rawSpecsDir),
|
|
@@ -955289,7 +955363,7 @@ async function runVerifyPipeline({ outputDir, generatorName, generatorVersion, c
|
|
|
955289
955363
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
955290
955364
|
init_lib5();
|
|
955291
955365
|
init_lib6();
|
|
955292
|
-
var
|
|
955366
|
+
var import_promises139 = require("fs/promises");
|
|
955293
955367
|
|
|
955294
955368
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
955295
955369
|
init_lib12();
|
|
@@ -955299,7 +955373,7 @@ init_lib8();
|
|
|
955299
955373
|
init_lib11();
|
|
955300
955374
|
init_lib6();
|
|
955301
955375
|
init_esm19();
|
|
955302
|
-
var
|
|
955376
|
+
var import_promises138 = require("fs/promises");
|
|
955303
955377
|
var LegacyGeneratorInvocationAdapter = class {
|
|
955304
955378
|
context;
|
|
955305
955379
|
constructor(config5) {
|
|
@@ -955553,7 +955627,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
955553
955627
|
code: CliError.Code.InternalError
|
|
955554
955628
|
});
|
|
955555
955629
|
}
|
|
955556
|
-
const contents = await (0,
|
|
955630
|
+
const contents = await (0, import_promises138.readFile)(absolutePath, "utf-8");
|
|
955557
955631
|
return api_exports4.GithubLicense.custom({ contents });
|
|
955558
955632
|
}
|
|
955559
955633
|
buildReadme(target) {
|
|
@@ -955779,7 +955853,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
955779
955853
|
});
|
|
955780
955854
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
955781
955855
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
955782
|
-
await (0,
|
|
955856
|
+
await (0, import_promises139.rm)(snippetPath, { force: true });
|
|
955783
955857
|
}
|
|
955784
955858
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
955785
955859
|
return {
|
|
@@ -955798,7 +955872,7 @@ init_lib4();
|
|
|
955798
955872
|
init_lib8();
|
|
955799
955873
|
init_lib5();
|
|
955800
955874
|
init_lib6();
|
|
955801
|
-
var
|
|
955875
|
+
var import_promises140 = require("fs/promises");
|
|
955802
955876
|
var import_os14 = require("os");
|
|
955803
955877
|
var LegacyRemoteGenerationRunner = class {
|
|
955804
955878
|
context;
|
|
@@ -955857,13 +955931,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
955857
955931
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
955858
955932
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
955859
955933
|
if (targetOutputDirectory != null) {
|
|
955860
|
-
await (0,
|
|
955861
|
-
await (0,
|
|
955934
|
+
await (0, import_promises140.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
955935
|
+
await (0, import_promises140.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
955862
955936
|
recursive: true,
|
|
955863
955937
|
force: true
|
|
955864
955938
|
});
|
|
955865
955939
|
}
|
|
955866
|
-
await (0,
|
|
955940
|
+
await (0, import_promises140.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
955867
955941
|
}
|
|
955868
955942
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
955869
955943
|
return {
|
|
@@ -955892,7 +955966,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
955892
955966
|
}
|
|
955893
955967
|
async getAbsolutePathToPreview(args) {
|
|
955894
955968
|
if (this.isLocalGitCombo(args)) {
|
|
955895
|
-
const tmpPreviewDirectory = await (0,
|
|
955969
|
+
const tmpPreviewDirectory = await (0, import_promises140.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
955896
955970
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
955897
955971
|
}
|
|
955898
955972
|
if (!args.preview) {
|
|
@@ -956628,7 +956702,7 @@ Example:
|
|
|
956628
956702
|
if (!exists2) {
|
|
956629
956703
|
return { shouldProceed: true };
|
|
956630
956704
|
}
|
|
956631
|
-
const files = await (0,
|
|
956705
|
+
const files = await (0, import_promises141.readdir)(outputPath);
|
|
956632
956706
|
if (files.length === 0) {
|
|
956633
956707
|
return { shouldProceed: true };
|
|
956634
956708
|
}
|
|
@@ -957040,7 +957114,7 @@ init_lib4();
|
|
|
957040
957114
|
init_lib33();
|
|
957041
957115
|
init_lib6();
|
|
957042
957116
|
var import_fs38 = require("fs");
|
|
957043
|
-
var
|
|
957117
|
+
var import_promises142 = require("fs/promises");
|
|
957044
957118
|
var import_path101 = require("path");
|
|
957045
957119
|
var import_semver14 = __toESM(require_semver2(), 1);
|
|
957046
957120
|
var import_url8 = require("url");
|
|
@@ -957150,7 +957224,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957150
957224
|
}
|
|
957151
957225
|
this.migrationsInstallPromise = (async () => {
|
|
957152
957226
|
const cacheDir = this.cachePath;
|
|
957153
|
-
await (0,
|
|
957227
|
+
await (0, import_promises142.mkdir)(cacheDir, { recursive: true });
|
|
957154
957228
|
const npmCacheDir = (0, import_path101.join)(cacheDir, ".npm-cache");
|
|
957155
957229
|
const packageDir = (0, import_path101.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
957156
957230
|
const packageJsonPath = (0, import_path101.join)(packageDir, "package.json");
|
|
@@ -957167,7 +957241,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957167
957241
|
"--no-audit",
|
|
957168
957242
|
"--no-fund"
|
|
957169
957243
|
], { doNotPipeOutput: true });
|
|
957170
|
-
const packageJsonContent = await (0,
|
|
957244
|
+
const packageJsonContent = await (0, import_promises142.readFile)(packageJsonPath, "utf-8");
|
|
957171
957245
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
957172
957246
|
if (packageJson2.main == null) {
|
|
957173
957247
|
throw new CliError({
|
|
@@ -957212,7 +957286,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957212
957286
|
const myPid = String(process.pid);
|
|
957213
957287
|
while (true) {
|
|
957214
957288
|
try {
|
|
957215
|
-
const fh = await (0,
|
|
957289
|
+
const fh = await (0, import_promises142.open)(lockPath, "wx");
|
|
957216
957290
|
await fh.writeFile(myPid);
|
|
957217
957291
|
await fh.close();
|
|
957218
957292
|
const exitHandler = () => {
|
|
@@ -957229,9 +957303,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957229
957303
|
return async () => {
|
|
957230
957304
|
process.removeListener("exit", exitHandler);
|
|
957231
957305
|
try {
|
|
957232
|
-
const currentContent = await (0,
|
|
957306
|
+
const currentContent = await (0, import_promises142.readFile)(lockPath, "utf-8");
|
|
957233
957307
|
if (currentContent.trim() === myPid) {
|
|
957234
|
-
await (0,
|
|
957308
|
+
await (0, import_promises142.unlink)(lockPath);
|
|
957235
957309
|
} else {
|
|
957236
957310
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
957237
957311
|
}
|
|
@@ -957245,14 +957319,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
957245
957319
|
throw err;
|
|
957246
957320
|
}
|
|
957247
957321
|
try {
|
|
957248
|
-
const lockContent = await (0,
|
|
957322
|
+
const lockContent = await (0, import_promises142.readFile)(lockPath, "utf-8");
|
|
957249
957323
|
const lockPid = Number(lockContent.trim());
|
|
957250
|
-
const lockStat = await (0,
|
|
957324
|
+
const lockStat = await (0, import_promises142.stat)(lockPath);
|
|
957251
957325
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
957252
957326
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
957253
957327
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
957254
957328
|
try {
|
|
957255
|
-
await (0,
|
|
957329
|
+
await (0, import_promises142.unlink)(lockPath);
|
|
957256
957330
|
} catch (unlinkErr) {
|
|
957257
957331
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
957258
957332
|
}
|
|
@@ -957941,7 +958015,7 @@ var import_generator_cli5 = __toESM(require_api3(), 1);
|
|
|
957941
958015
|
init_lib19();
|
|
957942
958016
|
init_lib8();
|
|
957943
958017
|
init_source();
|
|
957944
|
-
var
|
|
958018
|
+
var import_promises147 = require("fs/promises");
|
|
957945
958019
|
var import_fs_extra = __toESM(require_lib18(), 1);
|
|
957946
958020
|
var import_path104 = __toESM(require("path"), 1);
|
|
957947
958021
|
|
|
@@ -957951,7 +958025,7 @@ init_lib26();
|
|
|
957951
958025
|
init_lib8();
|
|
957952
958026
|
init_lib6();
|
|
957953
958027
|
init_source();
|
|
957954
|
-
var
|
|
958028
|
+
var import_promises144 = require("fs/promises");
|
|
957955
958029
|
init_lodash();
|
|
957956
958030
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
957957
958031
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -957983,7 +958057,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
957983
958057
|
}
|
|
957984
958058
|
}
|
|
957985
958059
|
}
|
|
957986
|
-
await (0,
|
|
958060
|
+
await (0, import_promises144.mkdir)(FERN_DIRECTORY);
|
|
957987
958061
|
await writeProjectConfig({
|
|
957988
958062
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
957989
958063
|
organization,
|
|
@@ -958007,11 +958081,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
958007
958081
|
organization,
|
|
958008
958082
|
version: versionOfCli
|
|
958009
958083
|
};
|
|
958010
|
-
await (0,
|
|
958084
|
+
await (0, import_promises144.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
958011
958085
|
}
|
|
958012
958086
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
958013
958087
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
958014
|
-
await (0,
|
|
958088
|
+
await (0, import_promises144.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
958015
958089
|
}
|
|
958016
958090
|
|
|
958017
958091
|
// ../init/lib/createWorkspace.js
|
|
@@ -958205,7 +958279,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
958205
958279
|
init_lib4();
|
|
958206
958280
|
init_lib6();
|
|
958207
958281
|
init_source();
|
|
958208
|
-
var
|
|
958282
|
+
var import_promises145 = require("fs/promises");
|
|
958209
958283
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
958210
958284
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
958211
958285
|
const formatted = await formatDefinitionFile({
|
|
@@ -958213,7 +958287,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
958213
958287
|
});
|
|
958214
958288
|
if (formatted !== file4.rawContents) {
|
|
958215
958289
|
if (shouldFix) {
|
|
958216
|
-
await (0,
|
|
958290
|
+
await (0, import_promises145.writeFile)(file4.absoluteFilePath, formatted);
|
|
958217
958291
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
958218
958292
|
} else {
|
|
958219
958293
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -958226,7 +958300,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
958226
958300
|
// ../init/lib/createWorkspace.js
|
|
958227
958301
|
init_lib8();
|
|
958228
958302
|
init_lib6();
|
|
958229
|
-
var
|
|
958303
|
+
var import_promises146 = require("fs/promises");
|
|
958230
958304
|
init_js_yaml();
|
|
958231
958305
|
|
|
958232
958306
|
// ../init/lib/sampleImdbApi.js
|
|
@@ -958427,7 +958501,7 @@ components:
|
|
|
958427
958501
|
// ../init/lib/createWorkspace.js
|
|
958428
958502
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
958429
958503
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958430
|
-
await (0,
|
|
958504
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace);
|
|
958431
958505
|
}
|
|
958432
958506
|
await writeGeneratorsConfiguration({
|
|
958433
958507
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -958442,7 +958516,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
958442
958516
|
}
|
|
958443
958517
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
958444
958518
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958445
|
-
await (0,
|
|
958519
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace);
|
|
958446
958520
|
}
|
|
958447
958521
|
await writeGeneratorsConfiguration({
|
|
958448
958522
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -958455,10 +958529,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
958455
958529
|
}
|
|
958456
958530
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
958457
958531
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
958458
|
-
await (0,
|
|
958532
|
+
await (0, import_promises146.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
958459
958533
|
}
|
|
958460
958534
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
958461
|
-
await (0,
|
|
958535
|
+
await (0, import_promises146.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
958462
958536
|
await writeGeneratorsConfiguration({
|
|
958463
958537
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
958464
958538
|
cliVersion,
|
|
@@ -958503,7 +958577,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
958503
958577
|
return config5;
|
|
958504
958578
|
}
|
|
958505
958579
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
958506
|
-
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 }), {
|
|
958507
958581
|
sortKeys: (a3, b5) => {
|
|
958508
958582
|
if (a3 === "api") {
|
|
958509
958583
|
return -1;
|
|
@@ -958522,8 +958596,8 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
958522
958596
|
strategy: "status-code"
|
|
958523
958597
|
}
|
|
958524
958598
|
};
|
|
958525
|
-
await (0,
|
|
958526
|
-
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));
|
|
958527
958601
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
958528
958602
|
let formattedContent;
|
|
958529
958603
|
try {
|
|
@@ -958539,7 +958613,7 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
958539
958613
|
code: CliError.Code.ParseError
|
|
958540
958614
|
});
|
|
958541
958615
|
}
|
|
958542
|
-
await (0,
|
|
958616
|
+
await (0, import_promises146.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
958543
958617
|
}
|
|
958544
958618
|
|
|
958545
958619
|
// ../init/lib/initializeAPI.js
|
|
@@ -958590,7 +958664,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
958590
958664
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
958591
958665
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
958592
958666
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
958593
|
-
await (0,
|
|
958667
|
+
await (0, import_promises147.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
958594
958668
|
if (inlinedApiDefinition) {
|
|
958595
958669
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
958596
958670
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -958629,7 +958703,7 @@ init_lib19();
|
|
|
958629
958703
|
init_lib4();
|
|
958630
958704
|
init_lib8();
|
|
958631
958705
|
init_source();
|
|
958632
|
-
var
|
|
958706
|
+
var import_promises148 = require("fs/promises");
|
|
958633
958707
|
init_js_yaml();
|
|
958634
958708
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
958635
958709
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
@@ -958645,7 +958719,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
958645
958719
|
} else {
|
|
958646
958720
|
try {
|
|
958647
958721
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
958648
|
-
await (0,
|
|
958722
|
+
await (0, import_promises148.writeFile)(docsYmlPath, index_vite_proxy_tmp_default.dump(docsConfig));
|
|
958649
958723
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
958650
958724
|
return;
|
|
958651
958725
|
} catch (writeError) {
|
|
@@ -958702,7 +958776,7 @@ var FernDocsBuilder = class {
|
|
|
958702
958776
|
init_lib12();
|
|
958703
958777
|
init_lib8();
|
|
958704
958778
|
init_lib6();
|
|
958705
|
-
var
|
|
958779
|
+
var import_promises149 = require("fs/promises");
|
|
958706
958780
|
init_js_yaml();
|
|
958707
958781
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
958708
958782
|
openApiSpecs = {};
|
|
@@ -958762,7 +958836,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
958762
958836
|
}
|
|
958763
958837
|
async build({ outputDirectory }) {
|
|
958764
958838
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
958765
|
-
await (0,
|
|
958839
|
+
await (0, import_promises149.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
958766
958840
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
958767
958841
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value2]) => {
|
|
958768
958842
|
return [value2.tabId, value2.tabConfig];
|
|
@@ -958787,27 +958861,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
958787
958861
|
}))
|
|
958788
958862
|
};
|
|
958789
958863
|
}
|
|
958790
|
-
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)));
|
|
958791
958865
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
958792
958866
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
958793
|
-
await (0,
|
|
958794
|
-
await (0,
|
|
958867
|
+
await (0, import_promises149.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
958868
|
+
await (0, import_promises149.cp)(absolutePath, absolutePathToOpenAPI);
|
|
958795
958869
|
}));
|
|
958796
958870
|
}
|
|
958797
|
-
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 })));
|
|
958798
958872
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
958799
958873
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
958800
|
-
await (0,
|
|
958874
|
+
await (0, import_promises149.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
958801
958875
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
958802
958876
|
${index_vite_proxy_tmp_default.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
958803
958877
|
|
|
958804
958878
|
` : "";
|
|
958805
|
-
await (0,
|
|
958879
|
+
await (0, import_promises149.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
958806
958880
|
}));
|
|
958807
958881
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
958808
958882
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
958809
|
-
await (0,
|
|
958810
|
-
await (0,
|
|
958883
|
+
await (0, import_promises149.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
958884
|
+
await (0, import_promises149.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
958811
958885
|
}));
|
|
958812
958886
|
}
|
|
958813
958887
|
setInstance({ companyName }) {
|
|
@@ -958841,7 +958915,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
958841
958915
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
958842
958916
|
init_lib8();
|
|
958843
958917
|
init_lib6();
|
|
958844
|
-
var
|
|
958918
|
+
var import_promises151 = require("fs/promises");
|
|
958845
958919
|
|
|
958846
958920
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
958847
958921
|
function convertColors(colors19) {
|
|
@@ -958902,10 +958976,10 @@ init_lib8();
|
|
|
958902
958976
|
|
|
958903
958977
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
958904
958978
|
init_lib8();
|
|
958905
|
-
var
|
|
958979
|
+
var import_promises150 = require("fs/promises");
|
|
958906
958980
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
958907
958981
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
958908
|
-
const text9 = await (0,
|
|
958982
|
+
const text9 = await (0, import_promises150.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
958909
958983
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
958910
958984
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
958911
958985
|
const transformedContent = markReferencedAssets({
|
|
@@ -959074,7 +959148,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
959074
959148
|
documentationTab = void 0;
|
|
959075
959149
|
tabUrlToInfo = {};
|
|
959076
959150
|
async import({ args, builder }) {
|
|
959077
|
-
const mintJsonContent = await (0,
|
|
959151
|
+
const mintJsonContent = await (0, import_promises151.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
959078
959152
|
const mint = this.parseMintJson({
|
|
959079
959153
|
content: mintJsonContent,
|
|
959080
959154
|
absolutePathToMintJson: args.absolutePathToMintJson
|
|
@@ -959220,7 +959294,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
959220
959294
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
959221
959295
|
init_lib12();
|
|
959222
959296
|
init_lib8();
|
|
959223
|
-
var
|
|
959297
|
+
var import_promises152 = require("fs/promises");
|
|
959224
959298
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
959225
959299
|
const mintlifyImporter = new MintlifyImporter({
|
|
959226
959300
|
context: taskContext
|
|
@@ -959231,7 +959305,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
959231
959305
|
builder
|
|
959232
959306
|
});
|
|
959233
959307
|
await builder.build({ outputDirectory: outputPath });
|
|
959234
|
-
await (0,
|
|
959308
|
+
await (0, import_promises152.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
959235
959309
|
version: versionOfCli,
|
|
959236
959310
|
organization
|
|
959237
959311
|
}, void 0, 4));
|
|
@@ -959292,7 +959366,7 @@ function assertIsStringArray(val) {
|
|
|
959292
959366
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
959293
959367
|
init_lib4();
|
|
959294
959368
|
init_lib8();
|
|
959295
|
-
var
|
|
959369
|
+
var import_promises153 = require("fs/promises");
|
|
959296
959370
|
|
|
959297
959371
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
959298
959372
|
init_unist_util_visit();
|
|
@@ -962646,7 +962720,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962646
962720
|
if (response.ok) {
|
|
962647
962721
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
962648
962722
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
962649
|
-
await (0,
|
|
962723
|
+
await (0, import_promises153.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
962650
962724
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
962651
962725
|
}
|
|
962652
962726
|
}
|
|
@@ -962663,7 +962737,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962663
962737
|
*/
|
|
962664
962738
|
async getAndCreateAssetsDirectory() {
|
|
962665
962739
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
962666
|
-
await (0,
|
|
962740
|
+
await (0, import_promises153.mkdir)(assetsDirectory, { recursive: true });
|
|
962667
962741
|
return assetsDirectory;
|
|
962668
962742
|
}
|
|
962669
962743
|
/**
|
|
@@ -962713,7 +962787,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962713
962787
|
absolutePathToOutputDirectory,
|
|
962714
962788
|
section
|
|
962715
962789
|
});
|
|
962716
|
-
await (0,
|
|
962790
|
+
await (0, import_promises153.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
962717
962791
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
962718
962792
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
962719
962793
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -962728,7 +962802,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962728
962802
|
absolutePathToOutputDirectoryForSection,
|
|
962729
962803
|
page: page.slug
|
|
962730
962804
|
});
|
|
962731
|
-
await (0,
|
|
962805
|
+
await (0, import_promises153.writeFile)(absolutePathForPage, result.data.mdx);
|
|
962732
962806
|
if (result.data.images.imageURLs.length > 0) {
|
|
962733
962807
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
962734
962808
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -962741,8 +962815,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962741
962815
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
962742
962816
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
962743
962817
|
const imageDir = dirname6(imagePath);
|
|
962744
|
-
await (0,
|
|
962745
|
-
await (0,
|
|
962818
|
+
await (0, import_promises153.mkdir)(imageDir, { recursive: true });
|
|
962819
|
+
await (0, import_promises153.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
962746
962820
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
962747
962821
|
} catch (error50) {
|
|
962748
962822
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -962826,7 +962900,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
962826
962900
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
962827
962901
|
init_lib12();
|
|
962828
962902
|
init_lib8();
|
|
962829
|
-
var
|
|
962903
|
+
var import_promises154 = require("fs/promises");
|
|
962830
962904
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
962831
962905
|
const builder = new FernDocsBuilderImpl();
|
|
962832
962906
|
builder.setInstance({ companyName: organization });
|
|
@@ -962841,7 +962915,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
962841
962915
|
builder
|
|
962842
962916
|
});
|
|
962843
962917
|
await builder.build({ outputDirectory: outputPath });
|
|
962844
|
-
await (0,
|
|
962918
|
+
await (0, import_promises154.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
962845
962919
|
version: versionOfCli,
|
|
962846
962920
|
organization
|
|
962847
962921
|
}, void 0, 4));
|
|
@@ -962868,7 +962942,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
962868
962942
|
|
|
962869
962943
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
962870
962944
|
init_axios2();
|
|
962871
|
-
var
|
|
962945
|
+
var import_promises155 = require("fs/promises");
|
|
962872
962946
|
init_js_yaml();
|
|
962873
962947
|
var import_path105 = require("path");
|
|
962874
962948
|
var import_tmp_promise19 = __toESM(require_tmp_promise(), 1);
|
|
@@ -962884,7 +962958,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
962884
962958
|
const filePath = (0, import_path105.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
962885
962959
|
logger4.debug("tmpDir", tmpDir.path);
|
|
962886
962960
|
logger4.debug("filePath", filePath);
|
|
962887
|
-
await (0,
|
|
962961
|
+
await (0, import_promises155.writeFile)(filePath, data2);
|
|
962888
962962
|
return {
|
|
962889
962963
|
status: LoadOpenAPIStatus.Success,
|
|
962890
962964
|
filePath
|
|
@@ -966808,7 +966882,7 @@ function getAutomationContextFromEnv() {
|
|
|
966808
966882
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
966809
966883
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
966810
966884
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
966811
|
-
cli_version: "5.
|
|
966885
|
+
cli_version: "5.57.0"
|
|
966812
966886
|
};
|
|
966813
966887
|
}
|
|
966814
966888
|
function isAutomationMode() {
|
|
@@ -967640,7 +967714,7 @@ var CliContext = class _CliContext {
|
|
|
967640
967714
|
if (false) {
|
|
967641
967715
|
this.logger.error("CLI_VERSION is not defined");
|
|
967642
967716
|
}
|
|
967643
|
-
return "5.
|
|
967717
|
+
return "5.57.0";
|
|
967644
967718
|
}
|
|
967645
967719
|
getCliName() {
|
|
967646
967720
|
if (false) {
|
|
@@ -967950,7 +968024,7 @@ init_lib19();
|
|
|
967950
968024
|
init_lib8();
|
|
967951
968025
|
init_lib6();
|
|
967952
968026
|
init_source();
|
|
967953
|
-
var
|
|
968027
|
+
var import_promises156 = require("fs/promises");
|
|
967954
968028
|
|
|
967955
968029
|
// ../project-loader/lib/normalizeCommandLineApiWorkspace.js
|
|
967956
968030
|
function normalizeCommandLineApiWorkspace(input3) {
|
|
@@ -968032,7 +968106,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
968032
968106
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
968033
968107
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
968034
968108
|
if (apisDirectoryExists) {
|
|
968035
|
-
const apiDirectoryContents = await (0,
|
|
968109
|
+
const apiDirectoryContents = await (0, import_promises156.readdir)(apisDirectory, { withFileTypes: true });
|
|
968036
968110
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
968037
968111
|
if (item.isDirectory()) {
|
|
968038
968112
|
all9.push(item.name);
|
|
@@ -968110,13 +968184,13 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
968110
968184
|
init_lib19();
|
|
968111
968185
|
init_lib6();
|
|
968112
968186
|
var import_generators_sdk6 = __toESM(require_generators_sdk(), 1);
|
|
968113
|
-
var
|
|
968187
|
+
var import_promises161 = require("fs/promises");
|
|
968114
968188
|
|
|
968115
968189
|
// src/commands/generator-list/getGeneratorList.ts
|
|
968116
968190
|
init_lib19();
|
|
968117
968191
|
init_lib4();
|
|
968118
968192
|
init_lib6();
|
|
968119
|
-
var
|
|
968193
|
+
var import_promises157 = require("fs/promises");
|
|
968120
968194
|
init_js_yaml();
|
|
968121
968195
|
var GenerationModeFilter = {
|
|
968122
968196
|
GitHub: "github",
|
|
@@ -968177,7 +968251,7 @@ async function getGeneratorList({
|
|
|
968177
968251
|
return;
|
|
968178
968252
|
}
|
|
968179
968253
|
try {
|
|
968180
|
-
await (0,
|
|
968254
|
+
await (0, import_promises157.writeFile)(outputLocation, generatorsListYaml);
|
|
968181
968255
|
} catch (error50) {
|
|
968182
968256
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
968183
968257
|
code: CliError.Code.ConfigError
|
|
@@ -968247,7 +968321,7 @@ async function getGeneratorMetadata({
|
|
|
968247
968321
|
|
|
968248
968322
|
// src/commands/organization/getOrganization.ts
|
|
968249
968323
|
init_lib6();
|
|
968250
|
-
var
|
|
968324
|
+
var import_promises158 = require("fs/promises");
|
|
968251
968325
|
async function getOrganization({
|
|
968252
968326
|
project,
|
|
968253
968327
|
outputLocation,
|
|
@@ -968259,7 +968333,7 @@ async function getOrganization({
|
|
|
968259
968333
|
return;
|
|
968260
968334
|
}
|
|
968261
968335
|
try {
|
|
968262
|
-
await (0,
|
|
968336
|
+
await (0, import_promises158.writeFile)(outputLocation, org);
|
|
968263
968337
|
} catch (error50) {
|
|
968264
968338
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
968265
968339
|
code: CliError.Code.ConfigError
|
|
@@ -968272,7 +968346,7 @@ init_lib19();
|
|
|
968272
968346
|
init_lib8();
|
|
968273
968347
|
init_lib6();
|
|
968274
968348
|
init_source();
|
|
968275
|
-
var
|
|
968349
|
+
var import_promises160 = require("fs/promises");
|
|
968276
968350
|
var import_path107 = __toESM(require("path"), 1);
|
|
968277
968351
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
968278
968352
|
var import_yaml6 = __toESM(require_dist11(), 1);
|
|
@@ -968282,7 +968356,7 @@ init_lib4();
|
|
|
968282
968356
|
init_lib33();
|
|
968283
968357
|
init_lib6();
|
|
968284
968358
|
var import_fs40 = require("fs");
|
|
968285
|
-
var
|
|
968359
|
+
var import_promises159 = require("fs/promises");
|
|
968286
968360
|
var import_os15 = require("os");
|
|
968287
968361
|
var import_path106 = require("path");
|
|
968288
968362
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -968310,7 +968384,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968310
968384
|
const myPid = String(process.pid);
|
|
968311
968385
|
while (true) {
|
|
968312
968386
|
try {
|
|
968313
|
-
const fh = await (0,
|
|
968387
|
+
const fh = await (0, import_promises159.open)(lockPath, "wx");
|
|
968314
968388
|
await fh.writeFile(myPid);
|
|
968315
968389
|
await fh.close();
|
|
968316
968390
|
const exitHandler = () => {
|
|
@@ -968327,9 +968401,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968327
968401
|
return async () => {
|
|
968328
968402
|
process.removeListener("exit", exitHandler);
|
|
968329
968403
|
try {
|
|
968330
|
-
const currentContent = await (0,
|
|
968404
|
+
const currentContent = await (0, import_promises159.readFile)(lockPath, "utf-8");
|
|
968331
968405
|
if (currentContent.trim() === myPid) {
|
|
968332
|
-
await (0,
|
|
968406
|
+
await (0, import_promises159.unlink)(lockPath);
|
|
968333
968407
|
} else {
|
|
968334
968408
|
logger4.debug(
|
|
968335
968409
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -968345,14 +968419,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
968345
968419
|
throw err;
|
|
968346
968420
|
}
|
|
968347
968421
|
try {
|
|
968348
|
-
const lockContent = await (0,
|
|
968422
|
+
const lockContent = await (0, import_promises159.readFile)(lockPath, "utf-8");
|
|
968349
968423
|
const lockPid = Number(lockContent.trim());
|
|
968350
|
-
const lockStat = await (0,
|
|
968424
|
+
const lockStat = await (0, import_promises159.stat)(lockPath);
|
|
968351
968425
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
968352
968426
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
968353
968427
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
968354
968428
|
try {
|
|
968355
|
-
await (0,
|
|
968429
|
+
await (0, import_promises159.unlink)(lockPath);
|
|
968356
968430
|
} catch (unlinkErr) {
|
|
968357
968431
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
968358
968432
|
}
|
|
@@ -968376,7 +968450,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
968376
968450
|
}
|
|
968377
968451
|
migrationsInstallPromise = (async () => {
|
|
968378
968452
|
const cacheDir = getMigrationCacheDir();
|
|
968379
|
-
await (0,
|
|
968453
|
+
await (0, import_promises159.mkdir)(cacheDir, { recursive: true });
|
|
968380
968454
|
const npmCacheDir = (0, import_path106.join)(cacheDir, ".npm-cache");
|
|
968381
968455
|
const packageDir = (0, import_path106.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
968382
968456
|
const packageJsonPath = (0, import_path106.join)(packageDir, "package.json");
|
|
@@ -968393,7 +968467,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
968393
968467
|
"--no-audit",
|
|
968394
968468
|
"--no-fund"
|
|
968395
968469
|
]);
|
|
968396
|
-
const packageJsonContent = await (0,
|
|
968470
|
+
const packageJsonContent = await (0, import_promises159.readFile)(packageJsonPath, "utf-8");
|
|
968397
968471
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
968398
968472
|
if (packageJson2.main == null) {
|
|
968399
968473
|
throw new CliError({
|
|
@@ -968577,7 +968651,7 @@ async function loadAndUpdateGenerators({
|
|
|
968577
968651
|
skippedAutoreleaseDisabled: []
|
|
968578
968652
|
};
|
|
968579
968653
|
}
|
|
968580
|
-
const contents = await (0,
|
|
968654
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
968581
968655
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
968582
968656
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
968583
968657
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -968814,7 +968888,7 @@ async function upgradeGenerator({
|
|
|
968814
968888
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
968815
968889
|
});
|
|
968816
968890
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
968817
|
-
await (0,
|
|
968891
|
+
await (0, import_promises160.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
968818
968892
|
}
|
|
968819
968893
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
968820
968894
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -969214,7 +969288,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
969214
969288
|
}
|
|
969215
969289
|
if (argv.output) {
|
|
969216
969290
|
try {
|
|
969217
|
-
await (0,
|
|
969291
|
+
await (0, import_promises161.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
969218
969292
|
} catch (error50) {
|
|
969219
969293
|
cliContext.failAndThrow(
|
|
969220
969294
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -969231,7 +969305,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
969231
969305
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
969232
969306
|
init_lib19();
|
|
969233
969307
|
init_source();
|
|
969234
|
-
var
|
|
969308
|
+
var import_promises162 = require("fs/promises");
|
|
969235
969309
|
init_js_yaml();
|
|
969236
969310
|
async function addGeneratorToWorkspaces({
|
|
969237
969311
|
project: { apiWorkspaces },
|
|
@@ -969259,7 +969333,7 @@ async function addGeneratorToWorkspaces({
|
|
|
969259
969333
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
969260
969334
|
return;
|
|
969261
969335
|
}
|
|
969262
|
-
await (0,
|
|
969336
|
+
await (0, import_promises162.writeFile)(
|
|
969263
969337
|
absolutePathToGeneratorsConfiguration,
|
|
969264
969338
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + index_vite_proxy_tmp_default.dump(newConfiguration)
|
|
969265
969339
|
);
|
|
@@ -969327,11 +969401,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
969327
969401
|
|
|
969328
969402
|
// src/commands/generate/checkOutputDirectory.ts
|
|
969329
969403
|
init_lib8();
|
|
969330
|
-
var
|
|
969404
|
+
var import_promises165 = require("fs/promises");
|
|
969331
969405
|
|
|
969332
969406
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
969333
969407
|
init_lib8();
|
|
969334
|
-
var
|
|
969408
|
+
var import_promises163 = require("fs/promises");
|
|
969335
969409
|
|
|
969336
969410
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
969337
969411
|
init_lib8();
|
|
@@ -969351,17 +969425,17 @@ async function getOutputDirectories() {
|
|
|
969351
969425
|
if (!doesOutputDirectoriesFileExist) {
|
|
969352
969426
|
return [];
|
|
969353
969427
|
}
|
|
969354
|
-
const outputDirectoriesFileContents = await (0,
|
|
969428
|
+
const outputDirectoriesFileContents = await (0, import_promises163.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
969355
969429
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
969356
969430
|
return outputDirectories;
|
|
969357
969431
|
}
|
|
969358
969432
|
|
|
969359
969433
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
969360
|
-
var
|
|
969434
|
+
var import_promises164 = require("fs/promises");
|
|
969361
969435
|
var import_path108 = __toESM(require("path"), 1);
|
|
969362
969436
|
async function storeOutputDirectories(outputDirectories) {
|
|
969363
|
-
await (0,
|
|
969364
|
-
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));
|
|
969365
969439
|
}
|
|
969366
969440
|
|
|
969367
969441
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -969383,7 +969457,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
969383
969457
|
shouldProceed: true
|
|
969384
969458
|
};
|
|
969385
969459
|
}
|
|
969386
|
-
const files = await (0,
|
|
969460
|
+
const files = await (0, import_promises165.readdir)(outputPath);
|
|
969387
969461
|
if (files.length === 0) {
|
|
969388
969462
|
return {
|
|
969389
969463
|
shouldProceed: true
|
|
@@ -970372,7 +970446,7 @@ function renderOverflowWarning(failureCount) {
|
|
|
970372
970446
|
// src/commands/automations/generate/reportGenerateResults.ts
|
|
970373
970447
|
init_lib4();
|
|
970374
970448
|
var import_fs41 = require("fs");
|
|
970375
|
-
var
|
|
970449
|
+
var import_promises166 = require("fs/promises");
|
|
970376
970450
|
var JSON_SCHEMA_VERSION = 1;
|
|
970377
970451
|
function renderStdoutSummary(results) {
|
|
970378
970452
|
return formatCounts(countResults(results));
|
|
@@ -970562,12 +970636,12 @@ async function writeResults({
|
|
|
970562
970636
|
const stepSummaryPath = getGithubStepSummaryPath();
|
|
970563
970637
|
if (stepSummaryPath != null) {
|
|
970564
970638
|
try {
|
|
970565
|
-
await (0,
|
|
970639
|
+
await (0, import_promises166.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
970566
970640
|
} catch {
|
|
970567
970641
|
}
|
|
970568
970642
|
}
|
|
970569
970643
|
if (jsonOutputPath != null) {
|
|
970570
|
-
await (0,
|
|
970644
|
+
await (0, import_promises166.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
970571
970645
|
}
|
|
970572
970646
|
}
|
|
970573
970647
|
function writeResultsSync({
|
|
@@ -970894,7 +970968,7 @@ function listPreviewGroups({
|
|
|
970894
970968
|
init_lib19();
|
|
970895
970969
|
init_lib6();
|
|
970896
970970
|
init_source();
|
|
970897
|
-
var
|
|
970971
|
+
var import_promises196 = require("fs/promises");
|
|
970898
970972
|
|
|
970899
970973
|
// ../cli-migrations/lib/runMigrations.js
|
|
970900
970974
|
init_lib4();
|
|
@@ -970905,7 +970979,7 @@ init_source();
|
|
|
970905
970979
|
init_lib27();
|
|
970906
970980
|
|
|
970907
970981
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
970908
|
-
var
|
|
970982
|
+
var import_promises167 = require("fs/promises");
|
|
970909
970983
|
|
|
970910
970984
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
970911
970985
|
init_lib8();
|
|
@@ -970942,7 +971016,7 @@ var migration = {
|
|
|
970942
971016
|
try {
|
|
970943
971017
|
const fileContents = await getFileContents(yamlFilepath);
|
|
970944
971018
|
const newContents = addDiscriminantToFile(fileContents);
|
|
970945
|
-
await (0,
|
|
971019
|
+
await (0, import_promises167.writeFile)(yamlFilepath, newContents);
|
|
970946
971020
|
} catch (error50) {
|
|
970947
971021
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
970948
971022
|
}
|
|
@@ -970950,7 +971024,7 @@ var migration = {
|
|
|
970950
971024
|
}
|
|
970951
971025
|
};
|
|
970952
971026
|
async function getFileContents(filepath) {
|
|
970953
|
-
const buffer = await (0,
|
|
971027
|
+
const buffer = await (0, import_promises167.readFile)(filepath);
|
|
970954
971028
|
return buffer.toString();
|
|
970955
971029
|
}
|
|
970956
971030
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -970979,7 +971053,7 @@ var versionMigrations = {
|
|
|
970979
971053
|
var __default = versionMigrations;
|
|
970980
971054
|
|
|
970981
971055
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
970982
|
-
var
|
|
971056
|
+
var import_promises168 = require("fs/promises");
|
|
970983
971057
|
var import_yaml7 = __toESM(require_dist11(), 1);
|
|
970984
971058
|
|
|
970985
971059
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -971023,7 +971097,7 @@ var migration2 = {
|
|
|
971023
971097
|
}
|
|
971024
971098
|
};
|
|
971025
971099
|
async function migrateFile(filepath, context3) {
|
|
971026
|
-
const contents = await (0,
|
|
971100
|
+
const contents = await (0, import_promises168.readFile)(filepath);
|
|
971027
971101
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
971028
971102
|
const types4 = parsedDocument.get("types");
|
|
971029
971103
|
if (types4 == null) {
|
|
@@ -971055,7 +971129,7 @@ async function migrateFile(filepath, context3) {
|
|
|
971055
971129
|
}
|
|
971056
971130
|
}
|
|
971057
971131
|
}
|
|
971058
|
-
await (0,
|
|
971132
|
+
await (0, import_promises168.writeFile)(filepath, parsedDocument.toString());
|
|
971059
971133
|
}
|
|
971060
971134
|
|
|
971061
971135
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -971066,7 +971140,7 @@ var versionMigrations2 = {
|
|
|
971066
971140
|
var __default2 = versionMigrations2;
|
|
971067
971141
|
|
|
971068
971142
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
971069
|
-
var
|
|
971143
|
+
var import_promises169 = require("fs/promises");
|
|
971070
971144
|
var import_yaml8 = __toESM(require_dist11(), 1);
|
|
971071
971145
|
|
|
971072
971146
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -971110,7 +971184,7 @@ var migration3 = {
|
|
|
971110
971184
|
}
|
|
971111
971185
|
};
|
|
971112
971186
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
971113
|
-
const contents = await (0,
|
|
971187
|
+
const contents = await (0, import_promises169.readFile)(filepath);
|
|
971114
971188
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
971115
971189
|
const draftGenerators = parsedDocument.get("draft");
|
|
971116
971190
|
if (draftGenerators == null) {
|
|
@@ -971137,7 +971211,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
971137
971211
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
971138
971212
|
}
|
|
971139
971213
|
});
|
|
971140
|
-
await (0,
|
|
971214
|
+
await (0, import_promises169.writeFile)(filepath, parsedDocument.toString());
|
|
971141
971215
|
}
|
|
971142
971216
|
|
|
971143
971217
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -971148,7 +971222,7 @@ var versionMigrations3 = {
|
|
|
971148
971222
|
var __default3 = versionMigrations3;
|
|
971149
971223
|
|
|
971150
971224
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
971151
|
-
var
|
|
971225
|
+
var import_promises170 = require("fs/promises");
|
|
971152
971226
|
var import_yaml9 = __toESM(require_dist11(), 1);
|
|
971153
971227
|
|
|
971154
971228
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -971192,7 +971266,7 @@ var migration4 = {
|
|
|
971192
971266
|
}
|
|
971193
971267
|
};
|
|
971194
971268
|
async function migrateFile2(filepath, context3) {
|
|
971195
|
-
const contents = await (0,
|
|
971269
|
+
const contents = await (0, import_promises170.readFile)(filepath);
|
|
971196
971270
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
971197
971271
|
const addType = (typeName, typeDeclaration2) => {
|
|
971198
971272
|
const types4 = parsedDocument.get("types");
|
|
@@ -971236,7 +971310,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
971236
971310
|
}
|
|
971237
971311
|
}
|
|
971238
971312
|
}
|
|
971239
|
-
await (0,
|
|
971313
|
+
await (0, import_promises170.writeFile)(filepath, parsedDocument.toString());
|
|
971240
971314
|
}
|
|
971241
971315
|
|
|
971242
971316
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -971247,7 +971321,7 @@ var versionMigrations4 = {
|
|
|
971247
971321
|
var __default4 = versionMigrations4;
|
|
971248
971322
|
|
|
971249
971323
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
971250
|
-
var
|
|
971324
|
+
var import_promises171 = require("fs/promises");
|
|
971251
971325
|
var import_yaml10 = __toESM(require_dist11(), 1);
|
|
971252
971326
|
|
|
971253
971327
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -971291,7 +971365,7 @@ var migration5 = {
|
|
|
971291
971365
|
}
|
|
971292
971366
|
};
|
|
971293
971367
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
971294
|
-
const contents = await (0,
|
|
971368
|
+
const contents = await (0, import_promises171.readFile)(filepath);
|
|
971295
971369
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
971296
971370
|
const releaseGenerators = parsedDocument.get("release");
|
|
971297
971371
|
if (releaseGenerators == null) {
|
|
@@ -971329,7 +971403,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
971329
971403
|
}
|
|
971330
971404
|
releaseGenerator.delete("outputs");
|
|
971331
971405
|
});
|
|
971332
|
-
await (0,
|
|
971406
|
+
await (0, import_promises171.writeFile)(filepath, parsedDocument.toString());
|
|
971333
971407
|
}
|
|
971334
971408
|
|
|
971335
971409
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -971340,7 +971414,7 @@ var versionMigrations5 = {
|
|
|
971340
971414
|
var __default5 = versionMigrations5;
|
|
971341
971415
|
|
|
971342
971416
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
971343
|
-
var
|
|
971417
|
+
var import_promises172 = require("fs/promises");
|
|
971344
971418
|
|
|
971345
971419
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
971346
971420
|
init_lib8();
|
|
@@ -971374,9 +971448,9 @@ var migration6 = {
|
|
|
971374
971448
|
run: async ({ context: context3 }) => {
|
|
971375
971449
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
971376
971450
|
for (const filepath of yamlFiles) {
|
|
971377
|
-
const contents = await (0,
|
|
971451
|
+
const contents = await (0, import_promises172.readFile)(filepath);
|
|
971378
971452
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
971379
|
-
await (0,
|
|
971453
|
+
await (0, import_promises172.writeFile)(filepath, newContents);
|
|
971380
971454
|
}
|
|
971381
971455
|
}
|
|
971382
971456
|
};
|
|
@@ -971389,7 +971463,7 @@ var versionMigrations6 = {
|
|
|
971389
971463
|
var __default6 = versionMigrations6;
|
|
971390
971464
|
|
|
971391
971465
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
971392
|
-
var
|
|
971466
|
+
var import_promises173 = require("fs/promises");
|
|
971393
971467
|
|
|
971394
971468
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
971395
971469
|
init_lib8();
|
|
@@ -971423,9 +971497,9 @@ var migration7 = {
|
|
|
971423
971497
|
run: async ({ context: context3 }) => {
|
|
971424
971498
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
971425
971499
|
for (const filepath of yamlFiles) {
|
|
971426
|
-
const contents = await (0,
|
|
971500
|
+
const contents = await (0, import_promises173.readFile)(filepath);
|
|
971427
971501
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
971428
|
-
await (0,
|
|
971502
|
+
await (0, import_promises173.writeFile)(filepath, newContents);
|
|
971429
971503
|
}
|
|
971430
971504
|
}
|
|
971431
971505
|
};
|
|
@@ -971439,7 +971513,7 @@ var __default7 = versionMigrations7;
|
|
|
971439
971513
|
|
|
971440
971514
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
971441
971515
|
init_lib4();
|
|
971442
|
-
var
|
|
971516
|
+
var import_promises174 = require("fs/promises");
|
|
971443
971517
|
init_js_yaml();
|
|
971444
971518
|
|
|
971445
971519
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
@@ -971573,7 +971647,7 @@ var migration8 = {
|
|
|
971573
971647
|
}
|
|
971574
971648
|
};
|
|
971575
971649
|
async function migrateGeneratorsYml3(filepath) {
|
|
971576
|
-
const contentsStr = await (0,
|
|
971650
|
+
const contentsStr = await (0, import_promises174.readFile)(filepath);
|
|
971577
971651
|
const contents = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
971578
971652
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
971579
971653
|
let newGeneratorsConfiguration = {};
|
|
@@ -971591,7 +971665,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
971591
971665
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
971592
971666
|
};
|
|
971593
971667
|
}
|
|
971594
|
-
await (0,
|
|
971668
|
+
await (0, import_promises174.writeFile)(filepath, index_vite_proxy_tmp_default.dump(newGeneratorsConfiguration));
|
|
971595
971669
|
}
|
|
971596
971670
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
971597
971671
|
const newSchema = {
|
|
@@ -971666,7 +971740,7 @@ var versionMigrations8 = {
|
|
|
971666
971740
|
var __default8 = versionMigrations8;
|
|
971667
971741
|
|
|
971668
971742
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
971669
|
-
var
|
|
971743
|
+
var import_promises175 = require("fs/promises");
|
|
971670
971744
|
var import_yaml11 = __toESM(require_dist11(), 1);
|
|
971671
971745
|
|
|
971672
971746
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -971710,7 +971784,7 @@ var migration9 = {
|
|
|
971710
971784
|
}
|
|
971711
971785
|
};
|
|
971712
971786
|
async function migrateRootApiFile(filepath) {
|
|
971713
|
-
const contents = await (0,
|
|
971787
|
+
const contents = await (0, import_promises175.readFile)(filepath);
|
|
971714
971788
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
971715
971789
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
971716
971790
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -971721,7 +971795,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
971721
971795
|
"property-name": errorDiscriminant.value
|
|
971722
971796
|
});
|
|
971723
971797
|
parsedDocument.delete("error-discriminant");
|
|
971724
|
-
await (0,
|
|
971798
|
+
await (0, import_promises175.writeFile)(filepath, parsedDocument.toString());
|
|
971725
971799
|
}
|
|
971726
971800
|
|
|
971727
971801
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -971732,7 +971806,7 @@ var versionMigrations9 = {
|
|
|
971732
971806
|
var __default9 = versionMigrations9;
|
|
971733
971807
|
|
|
971734
971808
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
971735
|
-
var
|
|
971809
|
+
var import_promises176 = require("fs/promises");
|
|
971736
971810
|
var import_yaml12 = __toESM(require_dist11(), 1);
|
|
971737
971811
|
|
|
971738
971812
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -971776,7 +971850,7 @@ var migration10 = {
|
|
|
971776
971850
|
}
|
|
971777
971851
|
};
|
|
971778
971852
|
async function migrateYamlFile(filepath, context3) {
|
|
971779
|
-
const contents = await (0,
|
|
971853
|
+
const contents = await (0, import_promises176.readFile)(filepath);
|
|
971780
971854
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
971781
971855
|
const services = parsedDocument.get("services");
|
|
971782
971856
|
if (services == null) {
|
|
@@ -971816,7 +971890,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
971816
971890
|
context3.failWithoutThrowing("Failed to convert endpoint", e2);
|
|
971817
971891
|
}
|
|
971818
971892
|
}
|
|
971819
|
-
await (0,
|
|
971893
|
+
await (0, import_promises176.writeFile)(filepath, parsedDocument.toString());
|
|
971820
971894
|
}
|
|
971821
971895
|
}
|
|
971822
971896
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -971895,7 +971969,7 @@ var versionMigrations10 = {
|
|
|
971895
971969
|
var __default10 = versionMigrations10;
|
|
971896
971970
|
|
|
971897
971971
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
971898
|
-
var
|
|
971972
|
+
var import_promises177 = require("fs/promises");
|
|
971899
971973
|
var import_yaml13 = __toESM(require_dist11(), 1);
|
|
971900
971974
|
|
|
971901
971975
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -971939,7 +972013,7 @@ var migration11 = {
|
|
|
971939
972013
|
}
|
|
971940
972014
|
};
|
|
971941
972015
|
async function migrateYamlFile2(filepath, context3) {
|
|
971942
|
-
const contents = await (0,
|
|
972016
|
+
const contents = await (0, import_promises177.readFile)(filepath);
|
|
971943
972017
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
971944
972018
|
const types4 = parsedDocument.get("types");
|
|
971945
972019
|
if (types4 == null) {
|
|
@@ -971965,7 +972039,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
971965
972039
|
examples.set(i5, { value: value2 });
|
|
971966
972040
|
}
|
|
971967
972041
|
}
|
|
971968
|
-
await (0,
|
|
972042
|
+
await (0, import_promises177.writeFile)(filepath, parsedDocument.toString());
|
|
971969
972043
|
}
|
|
971970
972044
|
|
|
971971
972045
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -971976,7 +972050,7 @@ var versionMigrations11 = {
|
|
|
971976
972050
|
var __default11 = versionMigrations11;
|
|
971977
972051
|
|
|
971978
972052
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
971979
|
-
var
|
|
972053
|
+
var import_promises178 = require("fs/promises");
|
|
971980
972054
|
var import_yaml14 = __toESM(require_dist11(), 1);
|
|
971981
972055
|
|
|
971982
972056
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -972020,7 +972094,7 @@ var migration12 = {
|
|
|
972020
972094
|
}
|
|
972021
972095
|
};
|
|
972022
972096
|
async function migrateYamlFile3(filepath, context3) {
|
|
972023
|
-
const contents = await (0,
|
|
972097
|
+
const contents = await (0, import_promises178.readFile)(filepath);
|
|
972024
972098
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
972025
972099
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
972026
972100
|
return context3.failAndThrow("File is not a map");
|
|
@@ -972050,7 +972124,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
972050
972124
|
pair.value = firstService.value;
|
|
972051
972125
|
}
|
|
972052
972126
|
}
|
|
972053
|
-
await (0,
|
|
972127
|
+
await (0, import_promises178.writeFile)(filepath, parsedDocument.toString());
|
|
972054
972128
|
}
|
|
972055
972129
|
|
|
972056
972130
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -972061,7 +972135,7 @@ var versionMigrations12 = {
|
|
|
972061
972135
|
var __default12 = versionMigrations12;
|
|
972062
972136
|
|
|
972063
972137
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
972064
|
-
var
|
|
972138
|
+
var import_promises179 = require("fs/promises");
|
|
972065
972139
|
var import_yaml15 = __toESM(require_dist11(), 1);
|
|
972066
972140
|
|
|
972067
972141
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -972105,7 +972179,7 @@ var migration13 = {
|
|
|
972105
972179
|
}
|
|
972106
972180
|
};
|
|
972107
972181
|
async function migrateYamlFile4(filepath, context3) {
|
|
972108
|
-
const contents = await (0,
|
|
972182
|
+
const contents = await (0, import_promises179.readFile)(filepath);
|
|
972109
972183
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
972110
972184
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
972111
972185
|
return context3.failAndThrow("File is not a map");
|
|
@@ -972124,7 +972198,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
972124
972198
|
}
|
|
972125
972199
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
972126
972200
|
parsedDocument.contents.items.unshift(docsPair);
|
|
972127
|
-
await (0,
|
|
972201
|
+
await (0, import_promises179.writeFile)(filepath, parsedDocument.toString());
|
|
972128
972202
|
}
|
|
972129
972203
|
|
|
972130
972204
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -972135,7 +972209,7 @@ var versionMigrations13 = {
|
|
|
972135
972209
|
var __default13 = versionMigrations13;
|
|
972136
972210
|
|
|
972137
972211
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
972138
|
-
var
|
|
972212
|
+
var import_promises180 = require("fs/promises");
|
|
972139
972213
|
|
|
972140
972214
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
972141
972215
|
init_lib8();
|
|
@@ -972178,14 +972252,14 @@ var migration14 = {
|
|
|
972178
972252
|
}
|
|
972179
972253
|
};
|
|
972180
972254
|
async function migrateYamlFile5(filepath) {
|
|
972181
|
-
const contents = await (0,
|
|
972255
|
+
const contents = await (0, import_promises180.readFile)(filepath);
|
|
972182
972256
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
972183
972257
|
const regex6 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
972184
972258
|
const updatedSnapshot = contents.toString().replace(regex6, (_match, _prefix, domain3) => {
|
|
972185
972259
|
return `docs:
|
|
972186
972260
|
domain: "${domain3}.${domainSuffix}"`;
|
|
972187
972261
|
});
|
|
972188
|
-
await (0,
|
|
972262
|
+
await (0, import_promises180.writeFile)(filepath, updatedSnapshot.toString());
|
|
972189
972263
|
}
|
|
972190
972264
|
|
|
972191
972265
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -972206,11 +972280,11 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
972206
972280
|
|
|
972207
972281
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
972208
972282
|
init_lib8();
|
|
972209
|
-
var
|
|
972283
|
+
var import_promises181 = require("fs/promises");
|
|
972210
972284
|
init_js_yaml();
|
|
972211
972285
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
972212
972286
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972213
|
-
const contentsStr = await (0,
|
|
972287
|
+
const contentsStr = await (0, import_promises181.readFile)(filepath);
|
|
972214
972288
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
972215
972289
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
972216
972290
|
if (result.ok) {
|
|
@@ -972229,7 +972303,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
972229
972303
|
|
|
972230
972304
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
972231
972305
|
init_lib8();
|
|
972232
|
-
var
|
|
972306
|
+
var import_promises183 = require("fs/promises");
|
|
972233
972307
|
init_js_yaml();
|
|
972234
972308
|
|
|
972235
972309
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
@@ -972438,11 +972512,11 @@ __export(legacy_exports, {
|
|
|
972438
972512
|
|
|
972439
972513
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
972440
972514
|
init_lib8();
|
|
972441
|
-
var
|
|
972515
|
+
var import_promises182 = require("fs/promises");
|
|
972442
972516
|
init_js_yaml();
|
|
972443
972517
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
972444
972518
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
972445
|
-
const contentsStr = await (0,
|
|
972519
|
+
const contentsStr = await (0, import_promises182.readFile)(filepath);
|
|
972446
972520
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
972447
972521
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
972448
972522
|
if (result.success) {
|
|
@@ -972472,7 +972546,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
972472
972546
|
var APIS_DIRECTORY2 = "apis";
|
|
972473
972547
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
972474
972548
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
972475
|
-
await (0,
|
|
972549
|
+
await (0, import_promises183.mkdir)(absolutePathToApisDirectory);
|
|
972476
972550
|
for (const workspace of workspaces) {
|
|
972477
972551
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
972478
972552
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -972480,11 +972554,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
972480
972554
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
972481
972555
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
972482
972556
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
972483
|
-
await (0,
|
|
972557
|
+
await (0, import_promises183.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
972484
972558
|
}
|
|
972485
972559
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
972486
972560
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
972487
|
-
await (0,
|
|
972561
|
+
await (0, import_promises183.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972488
972562
|
}
|
|
972489
972563
|
}
|
|
972490
972564
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -972497,7 +972571,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
972497
972571
|
generatorsConfiguration,
|
|
972498
972572
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
972499
972573
|
});
|
|
972500
|
-
await (0,
|
|
972574
|
+
await (0, import_promises183.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972501
972575
|
return convertedResponse.docsURLs;
|
|
972502
972576
|
}
|
|
972503
972577
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -972511,12 +972585,12 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
972511
972585
|
apiName
|
|
972512
972586
|
});
|
|
972513
972587
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972514
|
-
await (0,
|
|
972588
|
+
await (0, import_promises183.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
972515
972589
|
}
|
|
972516
972590
|
|
|
972517
972591
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
972518
972592
|
init_lib8();
|
|
972519
|
-
var
|
|
972593
|
+
var import_promises184 = require("fs/promises");
|
|
972520
972594
|
init_js_yaml();
|
|
972521
972595
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
972522
972596
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
@@ -972524,8 +972598,8 @@ async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePa
|
|
|
972524
972598
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
972525
972599
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
972526
972600
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
972527
|
-
await (0,
|
|
972528
|
-
await (0,
|
|
972601
|
+
await (0, import_promises184.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
972602
|
+
await (0, import_promises184.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972529
972603
|
}
|
|
972530
972604
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
972531
972605
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972538,7 +972612,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
972538
972612
|
apiName: void 0
|
|
972539
972613
|
});
|
|
972540
972614
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
972541
|
-
await (0,
|
|
972615
|
+
await (0, import_promises184.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
972542
972616
|
}
|
|
972543
972617
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
972544
972618
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972550,24 +972624,24 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
972550
972624
|
generatorsConfiguration,
|
|
972551
972625
|
pathModificationStrategy: "MoveUp"
|
|
972552
972626
|
});
|
|
972553
|
-
await (0,
|
|
972627
|
+
await (0, import_promises184.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972554
972628
|
return convertedResponse.docsURLs;
|
|
972555
972629
|
}
|
|
972556
972630
|
|
|
972557
972631
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
972558
972632
|
init_lib8();
|
|
972559
|
-
var
|
|
972633
|
+
var import_promises185 = require("fs/promises");
|
|
972560
972634
|
init_js_yaml();
|
|
972561
972635
|
var APIS_DIRECTORY3 = "apis";
|
|
972562
972636
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
972563
972637
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
972564
|
-
await (0,
|
|
972638
|
+
await (0, import_promises185.mkdir)(absolutePathToApisDirectory);
|
|
972565
972639
|
for (const workspace of workspaces) {
|
|
972566
972640
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
972567
972641
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
972568
972642
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
972569
972643
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
972570
|
-
await (0,
|
|
972644
|
+
await (0, import_promises185.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972571
972645
|
}
|
|
972572
972646
|
}
|
|
972573
972647
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -972580,17 +972654,17 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
972580
972654
|
generatorsConfiguration,
|
|
972581
972655
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
972582
972656
|
});
|
|
972583
|
-
await (0,
|
|
972657
|
+
await (0, import_promises185.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972584
972658
|
}
|
|
972585
972659
|
|
|
972586
972660
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
972587
972661
|
init_lib8();
|
|
972588
|
-
var
|
|
972662
|
+
var import_promises186 = require("fs/promises");
|
|
972589
972663
|
init_js_yaml();
|
|
972590
972664
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
972591
972665
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
972592
972666
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
972593
|
-
await (0,
|
|
972667
|
+
await (0, import_promises186.rm)(absolutePathToWorkspace, { recursive: true });
|
|
972594
972668
|
}
|
|
972595
972669
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
972596
972670
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -972602,7 +972676,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
972602
972676
|
generatorsConfiguration,
|
|
972603
972677
|
pathModificationStrategy: "MoveUp"
|
|
972604
972678
|
});
|
|
972605
|
-
await (0,
|
|
972679
|
+
await (0, import_promises186.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
972606
972680
|
}
|
|
972607
972681
|
|
|
972608
972682
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -972682,7 +972756,7 @@ var __default15 = versionMigrations15;
|
|
|
972682
972756
|
init_lib19();
|
|
972683
972757
|
init_lib8();
|
|
972684
972758
|
init_source();
|
|
972685
|
-
var
|
|
972759
|
+
var import_promises187 = require("fs/promises");
|
|
972686
972760
|
init_js_yaml();
|
|
972687
972761
|
var import_yaml16 = __toESM(require_dist11(), 1);
|
|
972688
972762
|
var migration16 = {
|
|
@@ -972726,7 +972800,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
972726
972800
|
if (existingGeneratorsYml == null) {
|
|
972727
972801
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
972728
972802
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
972729
|
-
await (0,
|
|
972803
|
+
await (0, import_promises187.writeFile)(absolutePathToGeneratorsYml, index_vite_proxy_tmp_default.dump({
|
|
972730
972804
|
api: {
|
|
972731
972805
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
972732
972806
|
}
|
|
@@ -972741,7 +972815,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
972741
972815
|
parsedDocument.set("api", {
|
|
972742
972816
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
972743
972817
|
});
|
|
972744
|
-
await (0,
|
|
972818
|
+
await (0, import_promises187.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
972745
972819
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
972746
972820
|
}
|
|
972747
972821
|
}
|
|
@@ -972771,7 +972845,7 @@ var __default16 = versionMigrations16;
|
|
|
972771
972845
|
init_lib19();
|
|
972772
972846
|
init_lib8();
|
|
972773
972847
|
init_source();
|
|
972774
|
-
var
|
|
972848
|
+
var import_promises188 = require("fs/promises");
|
|
972775
972849
|
init_js_yaml();
|
|
972776
972850
|
var import_yaml17 = __toESM(require_dist11(), 1);
|
|
972777
972851
|
var migration17 = {
|
|
@@ -972952,7 +973026,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
972952
973026
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
972953
973027
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
972954
973028
|
}
|
|
972955
|
-
await (0,
|
|
973029
|
+
await (0, import_promises188.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
972956
973030
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
972957
973031
|
}
|
|
972958
973032
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -972999,7 +973073,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
972999
973073
|
}
|
|
973000
973074
|
let specContent;
|
|
973001
973075
|
try {
|
|
973002
|
-
const fileContents = await (0,
|
|
973076
|
+
const fileContents = await (0, import_promises188.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
973003
973077
|
specContent = index_vite_proxy_tmp_default.load(fileContents);
|
|
973004
973078
|
} catch (e2) {
|
|
973005
973079
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e2}. Skipping...`);
|
|
@@ -973105,7 +973179,7 @@ var __default17 = versionMigrations17;
|
|
|
973105
973179
|
init_lib19();
|
|
973106
973180
|
init_lib8();
|
|
973107
973181
|
init_source();
|
|
973108
|
-
var
|
|
973182
|
+
var import_promises189 = require("fs/promises");
|
|
973109
973183
|
init_js_yaml();
|
|
973110
973184
|
var migration18 = {
|
|
973111
973185
|
name: "add-path-parameter-order-setting",
|
|
@@ -973194,7 +973268,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
973194
973268
|
documentToWrite = `${schemaComment}
|
|
973195
973269
|
${documentToWrite}`;
|
|
973196
973270
|
}
|
|
973197
|
-
await (0,
|
|
973271
|
+
await (0, import_promises189.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973198
973272
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973199
973273
|
}
|
|
973200
973274
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -973233,7 +973307,7 @@ var __default18 = versionMigrations18;
|
|
|
973233
973307
|
init_lib19();
|
|
973234
973308
|
init_lib8();
|
|
973235
973309
|
init_source();
|
|
973236
|
-
var
|
|
973310
|
+
var import_promises190 = require("fs/promises");
|
|
973237
973311
|
init_js_yaml();
|
|
973238
973312
|
var migration19 = {
|
|
973239
973313
|
name: "update-1_0_0-defaults",
|
|
@@ -973409,7 +973483,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
973409
973483
|
documentToWrite = `${schemaComment}
|
|
973410
973484
|
${documentToWrite}`;
|
|
973411
973485
|
}
|
|
973412
|
-
await (0,
|
|
973486
|
+
await (0, import_promises190.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973413
973487
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973414
973488
|
}
|
|
973415
973489
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -973481,7 +973555,7 @@ var __default19 = versionMigrations19;
|
|
|
973481
973555
|
init_lib19();
|
|
973482
973556
|
init_lib8();
|
|
973483
973557
|
init_source();
|
|
973484
|
-
var
|
|
973558
|
+
var import_promises191 = require("fs/promises");
|
|
973485
973559
|
init_js_yaml();
|
|
973486
973560
|
var migration20 = {
|
|
973487
973561
|
name: "update-2_0_0-defaults",
|
|
@@ -973657,7 +973731,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
973657
973731
|
documentToWrite = `${schemaComment}
|
|
973658
973732
|
${documentToWrite}`;
|
|
973659
973733
|
}
|
|
973660
|
-
await (0,
|
|
973734
|
+
await (0, import_promises191.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973661
973735
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973662
973736
|
}
|
|
973663
973737
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -973706,7 +973780,7 @@ var __default20 = versionMigrations20;
|
|
|
973706
973780
|
init_lib19();
|
|
973707
973781
|
init_lib8();
|
|
973708
973782
|
init_source();
|
|
973709
|
-
var
|
|
973783
|
+
var import_promises192 = require("fs/promises");
|
|
973710
973784
|
init_js_yaml();
|
|
973711
973785
|
var migration21 = {
|
|
973712
973786
|
name: "migrate-deprecated-generator-api-settings",
|
|
@@ -973798,7 +973872,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
973798
973872
|
documentToWrite = `${schemaComment}
|
|
973799
973873
|
${documentToWrite}`;
|
|
973800
973874
|
}
|
|
973801
|
-
await (0,
|
|
973875
|
+
await (0, import_promises192.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973802
973876
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973803
973877
|
}
|
|
973804
973878
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -973847,7 +973921,7 @@ var __default21 = versionMigrations21;
|
|
|
973847
973921
|
init_lib19();
|
|
973848
973922
|
init_lib8();
|
|
973849
973923
|
init_source();
|
|
973850
|
-
var
|
|
973924
|
+
var import_promises193 = require("fs/promises");
|
|
973851
973925
|
init_js_yaml();
|
|
973852
973926
|
var migration22 = {
|
|
973853
973927
|
name: "enable-smart-casing",
|
|
@@ -973932,7 +974006,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
973932
974006
|
documentToWrite = `${schemaComment}
|
|
973933
974007
|
${documentToWrite}`;
|
|
973934
974008
|
}
|
|
973935
|
-
await (0,
|
|
974009
|
+
await (0, import_promises193.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
973936
974010
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
973937
974011
|
}
|
|
973938
974012
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -973972,7 +974046,7 @@ var __default22 = versionMigrations22;
|
|
|
973972
974046
|
init_lib19();
|
|
973973
974047
|
init_lib8();
|
|
973974
974048
|
init_source();
|
|
973975
|
-
var
|
|
974049
|
+
var import_promises194 = require("fs/promises");
|
|
973976
974050
|
init_js_yaml();
|
|
973977
974051
|
var migration23 = {
|
|
973978
974052
|
name: "disable-disambiguate-request-names",
|
|
@@ -974097,7 +974171,7 @@ async function updateGeneratorsYml6({ context: context3, files }) {
|
|
|
974097
974171
|
documentToWrite = `${schemaComment}
|
|
974098
974172
|
${documentToWrite}`;
|
|
974099
974173
|
}
|
|
974100
|
-
await (0,
|
|
974174
|
+
await (0, import_promises194.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
974101
974175
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
974102
974176
|
}
|
|
974103
974177
|
async function getFilesAndDirectories8(absoluteFilepath) {
|
|
@@ -974232,7 +974306,7 @@ init_lib33();
|
|
|
974232
974306
|
init_lib27();
|
|
974233
974307
|
init_lib6();
|
|
974234
974308
|
init_source();
|
|
974235
|
-
var
|
|
974309
|
+
var import_promises195 = require("fs/promises");
|
|
974236
974310
|
|
|
974237
974311
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
974238
974312
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -975288,7 +975362,7 @@ async function upgrade({
|
|
|
975288
975362
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
975289
975363
|
draft.version = resolvedTargetVersion;
|
|
975290
975364
|
});
|
|
975291
|
-
await (0,
|
|
975365
|
+
await (0, import_promises195.writeFile)(
|
|
975292
975366
|
projectConfig2._absolutePath,
|
|
975293
975367
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
975294
975368
|
);
|
|
@@ -975445,7 +975519,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
975445
975519
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
975446
975520
|
});
|
|
975447
975521
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
975448
|
-
await (0,
|
|
975522
|
+
await (0, import_promises196.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
975449
975523
|
}
|
|
975450
975524
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
975451
975525
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -975923,7 +975997,7 @@ async function previewDocsWorkspace({
|
|
|
975923
975997
|
// src/commands/docs-diff/docsDiff.ts
|
|
975924
975998
|
init_lib8();
|
|
975925
975999
|
init_lib6();
|
|
975926
|
-
var
|
|
976000
|
+
var import_promises197 = require("fs/promises");
|
|
975927
976001
|
var import_pngjs2 = __toESM(require_png(), 1);
|
|
975928
976002
|
async function getSlugForFiles2({
|
|
975929
976003
|
previewUrl,
|
|
@@ -976146,8 +976220,8 @@ async function generateComparisons2({
|
|
|
976146
976220
|
afterPath,
|
|
976147
976221
|
comparisonBasePath
|
|
976148
976222
|
}) {
|
|
976149
|
-
const beforePng = import_pngjs2.PNG.sync.read(await (0,
|
|
976150
|
-
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));
|
|
976151
976225
|
const beforeOriginalHeight = beforePng.height;
|
|
976152
976226
|
const afterOriginalHeight = afterPng.height;
|
|
976153
976227
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -976185,7 +976259,7 @@ async function generateComparisons2({
|
|
|
976185
976259
|
const sideBySide = createSideBySideComparison2(croppedBefore, croppedAfter, 20, true);
|
|
976186
976260
|
const outPath = `${base4}-region-${i5 + 1}.png`;
|
|
976187
976261
|
const pngBuffer = import_pngjs2.PNG.sync.write(sideBySide);
|
|
976188
|
-
await (0,
|
|
976262
|
+
await (0, import_promises197.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
976189
976263
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
976190
976264
|
}
|
|
976191
976265
|
return results;
|
|
@@ -976264,7 +976338,7 @@ async function docsDiff({
|
|
|
976264
976338
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
976265
976339
|
);
|
|
976266
976340
|
if (!await doesPathExist(outputPath)) {
|
|
976267
|
-
await (0,
|
|
976341
|
+
await (0, import_promises197.mkdir)(outputPath, { recursive: true });
|
|
976268
976342
|
}
|
|
976269
976343
|
const results = [];
|
|
976270
976344
|
await cliContext.runTask(async (context3) => {
|
|
@@ -976692,7 +976766,7 @@ init_lib6();
|
|
|
976692
976766
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
976693
976767
|
init_lib12();
|
|
976694
976768
|
init_lib8();
|
|
976695
|
-
var
|
|
976769
|
+
var import_promises198 = require("fs/promises");
|
|
976696
976770
|
init_js_yaml();
|
|
976697
976771
|
var import_path109 = __toESM(require("path"), 1);
|
|
976698
976772
|
var ThemeExporter = class {
|
|
@@ -976705,18 +976779,18 @@ var ThemeExporter = class {
|
|
|
976705
976779
|
const docsDir = import_path109.default.dirname(docsYmlPath);
|
|
976706
976780
|
const outDir = output2 != null ? import_path109.default.resolve(process.cwd(), output2) : import_path109.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
976707
976781
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
976708
|
-
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"));
|
|
976709
976783
|
const themeConfig = {};
|
|
976710
976784
|
for (const [k4, v3] of Object.entries(raw)) {
|
|
976711
976785
|
if (docs_yml_exports.THEME_ELIGIBLE_YAML_KEYS.has(k4)) {
|
|
976712
976786
|
themeConfig[k4] = v3;
|
|
976713
976787
|
}
|
|
976714
976788
|
}
|
|
976715
|
-
await (0,
|
|
976789
|
+
await (0, import_promises198.mkdir)(outDir, { recursive: true });
|
|
976716
976790
|
const assetsDir = import_path109.default.join(outDir, "assets");
|
|
976717
|
-
await (0,
|
|
976791
|
+
await (0, import_promises198.mkdir)(assetsDir, { recursive: true });
|
|
976718
976792
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
976719
|
-
await (0,
|
|
976793
|
+
await (0, import_promises198.writeFile)(import_path109.default.join(outDir, "theme.yml"), index_vite_proxy_tmp_default.dump(exported), "utf-8");
|
|
976720
976794
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
976721
976795
|
}
|
|
976722
976796
|
};
|
|
@@ -976730,8 +976804,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
976730
976804
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path109.default.basename(abs) : relFromProject : relFromSource;
|
|
976731
976805
|
const dest = import_path109.default.join(assetsDir, destRelative);
|
|
976732
976806
|
try {
|
|
976733
|
-
await (0,
|
|
976734
|
-
await (0,
|
|
976807
|
+
await (0, import_promises198.mkdir)(import_path109.default.dirname(dest), { recursive: true });
|
|
976808
|
+
await (0, import_promises198.copyFile)(abs, dest);
|
|
976735
976809
|
return `./assets/${destRelative.split(import_path109.default.sep).join("/")}`;
|
|
976736
976810
|
} catch {
|
|
976737
976811
|
return obj;
|
|
@@ -976823,7 +976897,7 @@ async function listDocsThemes({
|
|
|
976823
976897
|
|
|
976824
976898
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
976825
976899
|
init_lib6();
|
|
976826
|
-
var
|
|
976900
|
+
var import_promises200 = require("fs/promises");
|
|
976827
976901
|
init_js_yaml();
|
|
976828
976902
|
var import_path111 = __toESM(require("path"), 1);
|
|
976829
976903
|
|
|
@@ -976832,7 +976906,7 @@ init_lib8();
|
|
|
976832
976906
|
init_lib6();
|
|
976833
976907
|
var import_child_process13 = require("child_process");
|
|
976834
976908
|
var import_crypto10 = require("crypto");
|
|
976835
|
-
var
|
|
976909
|
+
var import_promises199 = require("fs/promises");
|
|
976836
976910
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
976837
976911
|
var import_path110 = __toESM(require("path"), 1);
|
|
976838
976912
|
function getGitRoot() {
|
|
@@ -976876,7 +976950,7 @@ var ThemeConfigProcessor = class {
|
|
|
976876
976950
|
filePaths.map(async (filePath) => {
|
|
976877
976951
|
const abs = import_path110.default.resolve(this.themeDir, filePath);
|
|
976878
976952
|
try {
|
|
976879
|
-
await (0,
|
|
976953
|
+
await (0, import_promises199.access)(abs);
|
|
976880
976954
|
} catch {
|
|
976881
976955
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
976882
976956
|
}
|
|
@@ -977041,7 +977115,7 @@ ${errors4.map((e2) => ` - ${e2}`).join("\n")}`,
|
|
|
977041
977115
|
return { config: cfg, filesUploaded };
|
|
977042
977116
|
}
|
|
977043
977117
|
async uploadFileToCas(absolutePath) {
|
|
977044
|
-
const content5 = await (0,
|
|
977118
|
+
const content5 = await (0, import_promises199.readFile)(absolutePath);
|
|
977045
977119
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
977046
977120
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
977047
977121
|
return this.uploadToCas(content5, contentType, bindPath, import_path110.default.basename(absolutePath));
|
|
@@ -977156,7 +977230,7 @@ async function uploadDocsTheme({
|
|
|
977156
977230
|
await cliContext.runTask(async (context3) => {
|
|
977157
977231
|
let rawYaml;
|
|
977158
977232
|
try {
|
|
977159
|
-
const content5 = await (0,
|
|
977233
|
+
const content5 = await (0, import_promises200.readFile)(themeYmlPath, "utf-8");
|
|
977160
977234
|
rawYaml = index_vite_proxy_tmp_default.load(content5, { schema: index_vite_proxy_tmp_default.JSON_SCHEMA });
|
|
977161
977235
|
} catch {
|
|
977162
977236
|
context3.failAndThrow(
|
|
@@ -977211,7 +977285,7 @@ async function uploadDocsTheme({
|
|
|
977211
977285
|
// src/commands/downgrade/downgrade.ts
|
|
977212
977286
|
init_lib19();
|
|
977213
977287
|
init_lib6();
|
|
977214
|
-
var
|
|
977288
|
+
var import_promises201 = require("fs/promises");
|
|
977215
977289
|
function ensureFinalNewline2(content5) {
|
|
977216
977290
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
977217
977291
|
}
|
|
@@ -977236,7 +977310,7 @@ async function downgrade({
|
|
|
977236
977310
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
977237
977311
|
draft.version = targetVersion;
|
|
977238
977312
|
});
|
|
977239
|
-
await (0,
|
|
977313
|
+
await (0, import_promises201.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
977240
977314
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
977241
977315
|
}
|
|
977242
977316
|
|
|
@@ -977244,7 +977318,7 @@ async function downgrade({
|
|
|
977244
977318
|
init_lib36();
|
|
977245
977319
|
init_lib8();
|
|
977246
977320
|
init_lib22();
|
|
977247
|
-
var
|
|
977321
|
+
var import_promises202 = require("fs/promises");
|
|
977248
977322
|
init_js_yaml();
|
|
977249
977323
|
|
|
977250
977324
|
// src/commands/export/convertIrToOpenApi.ts
|
|
@@ -978666,8 +978740,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
978666
978740
|
ir: ir3,
|
|
978667
978741
|
mode: "openapi"
|
|
978668
978742
|
});
|
|
978669
|
-
await (0,
|
|
978670
|
-
await (0,
|
|
978743
|
+
await (0, import_promises202.mkdir)(dirname6(outputPath), { recursive: true });
|
|
978744
|
+
await (0, import_promises202.writeFile)(
|
|
978671
978745
|
outputPath,
|
|
978672
978746
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : index_vite_proxy_tmp_default.dump(openapi, { indent: indent4 })
|
|
978673
978747
|
);
|
|
@@ -979273,7 +979347,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
979273
979347
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
979274
979348
|
init_lib8();
|
|
979275
979349
|
init_lib6();
|
|
979276
|
-
var
|
|
979350
|
+
var import_promises203 = require("fs/promises");
|
|
979277
979351
|
init_js_yaml();
|
|
979278
979352
|
async function compareOpenAPISpecs({
|
|
979279
979353
|
originalPath,
|
|
@@ -979315,12 +979389,12 @@ async function compareOpenAPISpecs({
|
|
|
979315
979389
|
}
|
|
979316
979390
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
979317
979391
|
}
|
|
979318
|
-
await (0,
|
|
979392
|
+
await (0, import_promises203.writeFile)(outputPath, index_vite_proxy_tmp_default.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
979319
979393
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
979320
979394
|
});
|
|
979321
979395
|
}
|
|
979322
979396
|
async function loadSpec2(filepath, context3) {
|
|
979323
|
-
const contents = await (0,
|
|
979397
|
+
const contents = await (0, import_promises203.readFile)(filepath, "utf8");
|
|
979324
979398
|
try {
|
|
979325
979399
|
return JSON.parse(contents);
|
|
979326
979400
|
} catch {
|
|
@@ -979428,7 +979502,7 @@ init_lib35();
|
|
|
979428
979502
|
init_lib16();
|
|
979429
979503
|
init_lib15();
|
|
979430
979504
|
init_lib6();
|
|
979431
|
-
var
|
|
979505
|
+
var import_promises204 = require("fs/promises");
|
|
979432
979506
|
init_js_yaml();
|
|
979433
979507
|
async function writeOverridesForWorkspaces({
|
|
979434
979508
|
project,
|
|
@@ -979454,7 +979528,7 @@ async function writeOverridesForWorkspaces({
|
|
|
979454
979528
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
979455
979529
|
let parsedOverrides = null;
|
|
979456
979530
|
try {
|
|
979457
|
-
const contents = (await (0,
|
|
979531
|
+
const contents = (await (0, import_promises204.readFile)(overridesFilepath, "utf8")).toString();
|
|
979458
979532
|
try {
|
|
979459
979533
|
parsedOverrides = JSON.parse(contents);
|
|
979460
979534
|
} catch (err) {
|
|
@@ -979519,7 +979593,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
979519
979593
|
for (const overridesPath of overridesPaths) {
|
|
979520
979594
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
979521
979595
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides, includeModels, context: context3 });
|
|
979522
|
-
await (0,
|
|
979596
|
+
await (0, import_promises204.writeFile)(overridesPath, index_vite_proxy_tmp_default.dump(content5));
|
|
979523
979597
|
}
|
|
979524
979598
|
} else {
|
|
979525
979599
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -979533,7 +979607,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
979533
979607
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
979534
979608
|
}
|
|
979535
979609
|
}
|
|
979536
|
-
await (0,
|
|
979610
|
+
await (0, import_promises204.writeFile)(
|
|
979537
979611
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
979538
979612
|
index_vite_proxy_tmp_default.dump(content5)
|
|
979539
979613
|
);
|
|
@@ -979992,7 +980066,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
979992
980066
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
979993
980067
|
init_lib21();
|
|
979994
980068
|
init_source();
|
|
979995
|
-
var
|
|
980069
|
+
var import_promises205 = require("fs/promises");
|
|
979996
980070
|
async function generateJsonschemaForWorkspaces({
|
|
979997
980071
|
typeLocator,
|
|
979998
980072
|
project,
|
|
@@ -980040,9 +980114,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
980040
980114
|
context: context3
|
|
980041
980115
|
});
|
|
980042
980116
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
980043
|
-
await (0,
|
|
980117
|
+
await (0, import_promises205.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
980044
980118
|
}
|
|
980045
|
-
await (0,
|
|
980119
|
+
await (0, import_promises205.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
980046
980120
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
980047
980121
|
});
|
|
980048
980122
|
})
|
|
@@ -980052,7 +980126,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
980052
980126
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
980053
980127
|
init_lib8();
|
|
980054
980128
|
init_lib6();
|
|
980055
|
-
var
|
|
980129
|
+
var import_promises206 = require("fs/promises");
|
|
980056
980130
|
init_js_yaml();
|
|
980057
980131
|
var HTTP_METHODS4 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
980058
980132
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -980081,11 +980155,11 @@ async function mergeOpenAPIWithOverrides({
|
|
|
980081
980155
|
if (split2) {
|
|
980082
980156
|
const examples = extractEnrichedExamples2(openapi, merged);
|
|
980083
980157
|
const output2 = isJson ? JSON.stringify(examples, null, 2) : index_vite_proxy_tmp_default.dump(examples, { lineWidth: -1, noRefs: true });
|
|
980084
|
-
await (0,
|
|
980158
|
+
await (0, import_promises206.writeFile)(outputPath, output2);
|
|
980085
980159
|
context3.logger.info(`Extracted enriched examples written to ${outputPath}`);
|
|
980086
980160
|
} else {
|
|
980087
980161
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : index_vite_proxy_tmp_default.dump(merged, { lineWidth: -1, noRefs: true });
|
|
980088
|
-
await (0,
|
|
980162
|
+
await (0, import_promises206.writeFile)(outputPath, output2);
|
|
980089
980163
|
if (outputPath === openapiPath) {
|
|
980090
980164
|
context3.logger.info(`Enriched ${openapiPath} in-place`);
|
|
980091
980165
|
} else {
|
|
@@ -980095,7 +980169,7 @@ async function mergeOpenAPIWithOverrides({
|
|
|
980095
980169
|
});
|
|
980096
980170
|
}
|
|
980097
980171
|
async function loadYamlOrJson(filepath, context3) {
|
|
980098
|
-
const contents = await (0,
|
|
980172
|
+
const contents = await (0, import_promises206.readFile)(filepath, "utf8");
|
|
980099
980173
|
try {
|
|
980100
980174
|
return JSON.parse(contents);
|
|
980101
980175
|
} catch {
|
|
@@ -980890,7 +980964,7 @@ init_lib35();
|
|
|
980890
980964
|
init_lib6();
|
|
980891
980965
|
init_esm19();
|
|
980892
980966
|
init_axios2();
|
|
980893
|
-
var
|
|
980967
|
+
var import_promises207 = require("fs/promises");
|
|
980894
980968
|
var import_path117 = __toESM(require("path"), 1);
|
|
980895
980969
|
init_index_min2();
|
|
980896
980970
|
var import_tmp_promise20 = __toESM(require_tmp_promise(), 1);
|
|
@@ -980944,7 +981018,7 @@ async function registerWorkspacesV1({
|
|
|
980944
981018
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
980945
981019
|
await Kn({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
980946
981020
|
context3.logger.info("Uploading definition...");
|
|
980947
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
981021
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises207.readFile)(tarPath));
|
|
980948
981022
|
context3.logger.info(
|
|
980949
981023
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
980950
981024
|
);
|
|
@@ -981001,7 +981075,7 @@ function getAIEnhancerConfig2() {
|
|
|
981001
981075
|
// src/commands/resolve-specs/resolveSpecsForWorkspaces.ts
|
|
981002
981076
|
init_lib8();
|
|
981003
981077
|
init_lib35();
|
|
981004
|
-
var
|
|
981078
|
+
var import_promises208 = require("fs/promises");
|
|
981005
981079
|
var import_path118 = __toESM(require("path"), 1);
|
|
981006
981080
|
async function resolveSpecsForWorkspaces({
|
|
981007
981081
|
project,
|
|
@@ -981021,14 +981095,14 @@ async function resolveSpecsForWorkspaces({
|
|
|
981021
981095
|
return;
|
|
981022
981096
|
}
|
|
981023
981097
|
const workspaceOutputDir = project.apiWorkspaces.length > 1 ? AbsoluteFilePath2.of(import_path118.default.join(outputDir, workspace.workspaceName ?? "api")) : outputDir;
|
|
981024
|
-
await (0,
|
|
981098
|
+
await (0, import_promises208.mkdir)(workspaceOutputDir, { recursive: true });
|
|
981025
981099
|
const manifest = await collectRawSpecs({
|
|
981026
981100
|
specs,
|
|
981027
981101
|
hostOutputDir: workspaceOutputDir,
|
|
981028
981102
|
containerBaseDir: ".",
|
|
981029
981103
|
context: context3
|
|
981030
981104
|
});
|
|
981031
|
-
await (0,
|
|
981105
|
+
await (0, import_promises208.writeFile)(
|
|
981032
981106
|
import_path118.default.join(workspaceOutputDir, SPECS_MANIFEST_FILENAME),
|
|
981033
981107
|
JSON.stringify(manifest, void 0, 4)
|
|
981034
981108
|
);
|
|
@@ -981238,7 +981312,7 @@ init_lib17();
|
|
|
981238
981312
|
init_lib19();
|
|
981239
981313
|
init_lib8();
|
|
981240
981314
|
init_lib6();
|
|
981241
|
-
var
|
|
981315
|
+
var import_promises209 = __toESM(require("fs/promises"), 1);
|
|
981242
981316
|
|
|
981243
981317
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
981244
981318
|
var BASE_VERSION = "0.0.1";
|
|
@@ -981358,7 +981432,7 @@ async function sdkPreview({
|
|
|
981358
981432
|
const firstPath = pathOutputs[0];
|
|
981359
981433
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
981360
981434
|
if (absolutePathToOutput != null) {
|
|
981361
|
-
await
|
|
981435
|
+
await import_promises209.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
981362
981436
|
}
|
|
981363
981437
|
for (const workspace of project.apiWorkspaces) {
|
|
981364
981438
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -981548,7 +981622,7 @@ async function sdkPreview({
|
|
|
981548
981622
|
init_lib33();
|
|
981549
981623
|
init_lib6();
|
|
981550
981624
|
init_source();
|
|
981551
|
-
var
|
|
981625
|
+
var import_promises210 = require("fs/promises");
|
|
981552
981626
|
var import_path119 = require("path");
|
|
981553
981627
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
981554
981628
|
let command3;
|
|
@@ -981594,7 +981668,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
981594
981668
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
981595
981669
|
let resolvedPath;
|
|
981596
981670
|
try {
|
|
981597
|
-
resolvedPath = await (0,
|
|
981671
|
+
resolvedPath = await (0, import_promises210.realpath)(fernPath);
|
|
981598
981672
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
981599
981673
|
} catch (error50) {
|
|
981600
981674
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -981908,22 +981982,22 @@ init_lib19();
|
|
|
981908
981982
|
init_lib8();
|
|
981909
981983
|
init_lib6();
|
|
981910
981984
|
var fs33 = __toESM(require("fs"), 1);
|
|
981911
|
-
var
|
|
981985
|
+
var import_promises211 = require("fs/promises");
|
|
981912
981986
|
init_graphql();
|
|
981913
981987
|
init_js_yaml();
|
|
981914
981988
|
var import_stream18 = require("stream");
|
|
981915
|
-
var
|
|
981989
|
+
var import_promises212 = require("stream/promises");
|
|
981916
981990
|
async function fetchAndWriteFile(url3, path119, logger4, indent4) {
|
|
981917
981991
|
const resp = await fetch(url3);
|
|
981918
981992
|
if (resp.ok && resp.body) {
|
|
981919
981993
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
981920
981994
|
const fileStream = fs33.createWriteStream(path119);
|
|
981921
|
-
await (0,
|
|
981922
|
-
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");
|
|
981923
981997
|
try {
|
|
981924
|
-
await (0,
|
|
981998
|
+
await (0, import_promises211.writeFile)(path119, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
981925
981999
|
} catch (e2) {
|
|
981926
|
-
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");
|
|
981927
982001
|
}
|
|
981928
982002
|
logger4.debug("File written successfully");
|
|
981929
982003
|
}
|
|
@@ -982079,14 +982153,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
982079
982153
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path119, logger4) {
|
|
982080
982154
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
982081
982155
|
if (postResult.success) {
|
|
982082
|
-
await (0,
|
|
982156
|
+
await (0, import_promises211.writeFile)(path119, postResult.result, "utf8");
|
|
982083
982157
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
982084
982158
|
return;
|
|
982085
982159
|
}
|
|
982086
982160
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
982087
982161
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
982088
982162
|
if (getResult.success) {
|
|
982089
|
-
await (0,
|
|
982163
|
+
await (0, import_promises211.writeFile)(path119, getResult.result, "utf8");
|
|
982090
982164
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
982091
982165
|
return;
|
|
982092
982166
|
}
|
|
@@ -982796,7 +982870,7 @@ async function validateWorkspaces({
|
|
|
982796
982870
|
init_lib19();
|
|
982797
982871
|
init_lib8();
|
|
982798
982872
|
init_source();
|
|
982799
|
-
var
|
|
982873
|
+
var import_promises213 = require("fs/promises");
|
|
982800
982874
|
init_js_yaml();
|
|
982801
982875
|
var import_path121 = __toESM(require("path"), 1);
|
|
982802
982876
|
async function writeDefinitionForWorkspaces({
|
|
@@ -982878,22 +982952,22 @@ async function writeFernDefinition({
|
|
|
982878
982952
|
return a3.localeCompare(b5);
|
|
982879
982953
|
};
|
|
982880
982954
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
982881
|
-
await (0,
|
|
982955
|
+
await (0, import_promises213.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
982882
982956
|
}
|
|
982883
|
-
await (0,
|
|
982884
|
-
await (0,
|
|
982957
|
+
await (0, import_promises213.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
982958
|
+
await (0, import_promises213.writeFile)(
|
|
982885
982959
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
982886
982960
|
index_vite_proxy_tmp_default.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
982887
982961
|
);
|
|
982888
982962
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
982889
982963
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
982890
|
-
await (0,
|
|
982891
|
-
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 }));
|
|
982892
982966
|
}
|
|
982893
982967
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
982894
982968
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
982895
|
-
await (0,
|
|
982896
|
-
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 }));
|
|
982897
982971
|
}
|
|
982898
982972
|
}
|
|
982899
982973
|
|
|
@@ -982901,7 +982975,7 @@ async function writeFernDefinition({
|
|
|
982901
982975
|
init_lib67();
|
|
982902
982976
|
init_lib8();
|
|
982903
982977
|
init_source();
|
|
982904
|
-
var
|
|
982978
|
+
var import_promises214 = require("fs/promises");
|
|
982905
982979
|
async function writeDocsDefinitionForProject({
|
|
982906
982980
|
project,
|
|
982907
982981
|
outputPath,
|
|
@@ -982933,7 +983007,7 @@ async function writeDocsDefinitionForProject({
|
|
|
982933
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
|
|
982934
983008
|
});
|
|
982935
983009
|
const docsDefinition = await docsResolver.resolve();
|
|
982936
|
-
await (0,
|
|
983010
|
+
await (0, import_promises214.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
982937
983011
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
982938
983012
|
});
|
|
982939
983013
|
}
|