@fern-api/fern-api-dev 5.33.0 → 5.33.2
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 +439 -400
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -68243,8 +68243,8 @@ var require_graceful_fs = __commonJS({
|
|
|
68243
68243
|
}
|
|
68244
68244
|
}
|
|
68245
68245
|
var fs$writeFile = fs30.writeFile;
|
|
68246
|
-
fs30.writeFile =
|
|
68247
|
-
function
|
|
68246
|
+
fs30.writeFile = writeFile95;
|
|
68247
|
+
function writeFile95(path115, data2, options2, cb) {
|
|
68248
68248
|
if (typeof options2 === "function")
|
|
68249
68249
|
cb = options2, options2 = null;
|
|
68250
68250
|
return go$writeFile(path115, data2, options2, cb);
|
|
@@ -337233,8 +337233,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
337233
337233
|
}
|
|
337234
337234
|
}
|
|
337235
337235
|
var fs$writeFile = fs30.writeFile;
|
|
337236
|
-
fs30.writeFile =
|
|
337237
|
-
function
|
|
337236
|
+
fs30.writeFile = writeFile95;
|
|
337237
|
+
function writeFile95(path115, data2, options2, cb) {
|
|
337238
337238
|
if (typeof options2 === "function")
|
|
337239
337239
|
cb = options2, options2 = null;
|
|
337240
337240
|
return go$writeFile(path115, data2, options2, cb);
|
|
@@ -346143,10 +346143,10 @@ var require_make_dir = __commonJS({
|
|
|
346143
346143
|
module4.exports = (input3, opts) => Promise.resolve().then(() => {
|
|
346144
346144
|
checkPath(input3);
|
|
346145
346145
|
opts = Object.assign({}, defaults3, opts);
|
|
346146
|
-
const
|
|
346146
|
+
const mkdir44 = pify(opts.fs.mkdir);
|
|
346147
346147
|
const stat6 = pify(opts.fs.stat);
|
|
346148
346148
|
const make = (pth) => {
|
|
346149
|
-
return
|
|
346149
|
+
return mkdir44(pth, opts.mode).then(() => pth).catch((err) => {
|
|
346150
346150
|
if (err.code === "ENOENT") {
|
|
346151
346151
|
if (err.message.includes("null bytes") || path115.dirname(pth) === pth) {
|
|
346152
346152
|
throw err;
|
|
@@ -361950,7 +361950,7 @@ var require_dist14 = __commonJS({
|
|
|
361950
361950
|
return copy;
|
|
361951
361951
|
}
|
|
361952
361952
|
};
|
|
361953
|
-
var
|
|
361953
|
+
var import_promises199 = require("fs/promises");
|
|
361954
361954
|
var import_node_path310 = require("path");
|
|
361955
361955
|
async function resolveInputs(args) {
|
|
361956
361956
|
const {
|
|
@@ -362003,7 +362003,7 @@ var require_dist14 = __commonJS({
|
|
|
362003
362003
|
}
|
|
362004
362004
|
}
|
|
362005
362005
|
const oursPath = (0, import_node_path310.join)(outputDir, resolvedPath);
|
|
362006
|
-
const ours = await (0,
|
|
362006
|
+
const ours = await (0, import_promises199.readFile)(oursPath, "utf-8").catch(() => null);
|
|
362007
362007
|
let ghostTheirs = null;
|
|
362008
362008
|
if (!base4 && ours && !renameSourcePath) {
|
|
362009
362009
|
const treeReachable = await isTreeReachable(baseGen.tree_hash);
|
|
@@ -402952,7 +402952,7 @@ async function readFernYmlRaw(start2) {
|
|
|
402952
402952
|
for (let i9 = 0; i9 < 50; i9++) {
|
|
402953
402953
|
const candidate = (0, import_path97.resolve)(dir, "fern.yml");
|
|
402954
402954
|
try {
|
|
402955
|
-
const content5 = await (0,
|
|
402955
|
+
const content5 = await (0, import_promises124.readFile)(candidate, "utf-8");
|
|
402956
402956
|
const parsed = jsYaml.load(content5);
|
|
402957
402957
|
if (isRawFernYml(parsed)) {
|
|
402958
402958
|
return parsed;
|
|
@@ -403000,11 +403000,11 @@ function extractInstances(raw) {
|
|
|
403000
403000
|
}
|
|
403001
403001
|
return raw.docs.instances.flatMap((inst) => typeof inst?.url === "string" ? [inst.url] : []);
|
|
403002
403002
|
}
|
|
403003
|
-
var
|
|
403003
|
+
var import_promises124, import_path97;
|
|
403004
403004
|
var init_completion2 = __esm({
|
|
403005
403005
|
"../cli-v2/lib/completion.js"() {
|
|
403006
403006
|
"use strict";
|
|
403007
|
-
|
|
403007
|
+
import_promises124 = require("fs/promises");
|
|
403008
403008
|
init_js_yaml();
|
|
403009
403009
|
import_path97 = require("path");
|
|
403010
403010
|
}
|
|
@@ -403731,14 +403731,14 @@ var require_empty2 = __commonJS({
|
|
|
403731
403731
|
var u6 = require_universalify().fromPromise;
|
|
403732
403732
|
var fs29 = require_fs();
|
|
403733
403733
|
var path115 = require("path");
|
|
403734
|
-
var
|
|
403734
|
+
var mkdir44 = require_mkdirs();
|
|
403735
403735
|
var remove3 = require_remove3();
|
|
403736
403736
|
var emptyDir = u6(async function emptyDir2(dir) {
|
|
403737
403737
|
let items;
|
|
403738
403738
|
try {
|
|
403739
403739
|
items = await fs29.readdir(dir);
|
|
403740
403740
|
} catch {
|
|
403741
|
-
return
|
|
403741
|
+
return mkdir44.mkdirs(dir);
|
|
403742
403742
|
}
|
|
403743
403743
|
return Promise.all(items.map((item) => remove3.remove(path115.join(dir, item))));
|
|
403744
403744
|
});
|
|
@@ -403747,7 +403747,7 @@ var require_empty2 = __commonJS({
|
|
|
403747
403747
|
try {
|
|
403748
403748
|
items = fs29.readdirSync(dir);
|
|
403749
403749
|
} catch {
|
|
403750
|
-
return
|
|
403750
|
+
return mkdir44.mkdirsSync(dir);
|
|
403751
403751
|
}
|
|
403752
403752
|
items.forEach((item) => {
|
|
403753
403753
|
item = path115.join(dir, item);
|
|
@@ -403770,7 +403770,7 @@ var require_file = __commonJS({
|
|
|
403770
403770
|
var u6 = require_universalify().fromPromise;
|
|
403771
403771
|
var path115 = require("path");
|
|
403772
403772
|
var fs29 = require_fs();
|
|
403773
|
-
var
|
|
403773
|
+
var mkdir44 = require_mkdirs();
|
|
403774
403774
|
async function createFile(file4) {
|
|
403775
403775
|
let stats;
|
|
403776
403776
|
try {
|
|
@@ -403784,7 +403784,7 @@ var require_file = __commonJS({
|
|
|
403784
403784
|
dirStats = await fs29.stat(dir);
|
|
403785
403785
|
} catch (err) {
|
|
403786
403786
|
if (err.code === "ENOENT") {
|
|
403787
|
-
await
|
|
403787
|
+
await mkdir44.mkdirs(dir);
|
|
403788
403788
|
await fs29.writeFile(file4, "");
|
|
403789
403789
|
return;
|
|
403790
403790
|
} else {
|
|
@@ -403810,7 +403810,7 @@ var require_file = __commonJS({
|
|
|
403810
403810
|
fs29.readdirSync(dir);
|
|
403811
403811
|
}
|
|
403812
403812
|
} catch (err) {
|
|
403813
|
-
if (err && err.code === "ENOENT")
|
|
403813
|
+
if (err && err.code === "ENOENT") mkdir44.mkdirsSync(dir);
|
|
403814
403814
|
else throw err;
|
|
403815
403815
|
}
|
|
403816
403816
|
fs29.writeFileSync(file4, "");
|
|
@@ -403829,7 +403829,7 @@ var require_link = __commonJS({
|
|
|
403829
403829
|
var u6 = require_universalify().fromPromise;
|
|
403830
403830
|
var path115 = require("path");
|
|
403831
403831
|
var fs29 = require_fs();
|
|
403832
|
-
var
|
|
403832
|
+
var mkdir44 = require_mkdirs();
|
|
403833
403833
|
var { pathExists: pathExists2 } = require_path_exists();
|
|
403834
403834
|
var { areIdentical } = require_stat();
|
|
403835
403835
|
async function createLink(srcpath, dstpath) {
|
|
@@ -403849,7 +403849,7 @@ var require_link = __commonJS({
|
|
|
403849
403849
|
const dir = path115.dirname(dstpath);
|
|
403850
403850
|
const dirExists = await pathExists2(dir);
|
|
403851
403851
|
if (!dirExists) {
|
|
403852
|
-
await
|
|
403852
|
+
await mkdir44.mkdirs(dir);
|
|
403853
403853
|
}
|
|
403854
403854
|
await fs29.link(srcpath, dstpath);
|
|
403855
403855
|
}
|
|
@@ -403869,7 +403869,7 @@ var require_link = __commonJS({
|
|
|
403869
403869
|
const dir = path115.dirname(dstpath);
|
|
403870
403870
|
const dirExists = fs29.existsSync(dir);
|
|
403871
403871
|
if (dirExists) return fs29.linkSync(srcpath, dstpath);
|
|
403872
|
-
|
|
403872
|
+
mkdir44.mkdirsSync(dir);
|
|
403873
403873
|
return fs29.linkSync(srcpath, dstpath);
|
|
403874
403874
|
}
|
|
403875
403875
|
module4.exports = {
|
|
@@ -404168,7 +404168,7 @@ var require_jsonfile = __commonJS({
|
|
|
404168
404168
|
const str3 = stringify5(obj, options2);
|
|
404169
404169
|
await universalify.fromCallback(fs29.writeFile)(file4, str3, options2);
|
|
404170
404170
|
}
|
|
404171
|
-
var
|
|
404171
|
+
var writeFile95 = universalify.fromPromise(_writeFile);
|
|
404172
404172
|
function writeFileSync9(file4, obj, options2 = {}) {
|
|
404173
404173
|
const fs29 = options2.fs || _fs;
|
|
404174
404174
|
const str3 = stringify5(obj, options2);
|
|
@@ -404177,7 +404177,7 @@ var require_jsonfile = __commonJS({
|
|
|
404177
404177
|
module4.exports = {
|
|
404178
404178
|
readFile: readFile113,
|
|
404179
404179
|
readFileSync: readFileSync19,
|
|
404180
|
-
writeFile:
|
|
404180
|
+
writeFile: writeFile95,
|
|
404181
404181
|
writeFileSync: writeFileSync9
|
|
404182
404182
|
};
|
|
404183
404183
|
}
|
|
@@ -404205,19 +404205,19 @@ var require_output_file = __commonJS({
|
|
|
404205
404205
|
var u6 = require_universalify().fromPromise;
|
|
404206
404206
|
var fs29 = require_fs();
|
|
404207
404207
|
var path115 = require("path");
|
|
404208
|
-
var
|
|
404208
|
+
var mkdir44 = require_mkdirs();
|
|
404209
404209
|
var pathExists2 = require_path_exists().pathExists;
|
|
404210
404210
|
async function outputFile(file4, data2, encoding = "utf-8") {
|
|
404211
404211
|
const dir = path115.dirname(file4);
|
|
404212
404212
|
if (!await pathExists2(dir)) {
|
|
404213
|
-
await
|
|
404213
|
+
await mkdir44.mkdirs(dir);
|
|
404214
404214
|
}
|
|
404215
404215
|
return fs29.writeFile(file4, data2, encoding);
|
|
404216
404216
|
}
|
|
404217
404217
|
function outputFileSync(file4, ...args) {
|
|
404218
404218
|
const dir = path115.dirname(file4);
|
|
404219
404219
|
if (!fs29.existsSync(dir)) {
|
|
404220
|
-
|
|
404220
|
+
mkdir44.mkdirsSync(dir);
|
|
404221
404221
|
}
|
|
404222
404222
|
fs29.writeFileSync(file4, ...args);
|
|
404223
404223
|
}
|
|
@@ -467925,7 +467925,7 @@ async function unpackArchive(archivePath, folderPath) {
|
|
|
467925
467925
|
} else if (archivePath.endsWith(".tar.bz2")) {
|
|
467926
467926
|
await extractTar(archivePath, folderPath, "bzip2");
|
|
467927
467927
|
} else if (archivePath.endsWith(".dmg")) {
|
|
467928
|
-
await (0,
|
|
467928
|
+
await (0, import_promises134.mkdir)(folderPath);
|
|
467929
467929
|
await installDMG(archivePath, folderPath);
|
|
467930
467930
|
} else if (archivePath.endsWith(".exe")) {
|
|
467931
467931
|
const result = (0, import_node_child_process4.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
|
|
@@ -468014,7 +468014,7 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
468014
468014
|
}
|
|
468015
468015
|
const mountPath = volumes[0];
|
|
468016
468016
|
try {
|
|
468017
|
-
const fileNames = await (0,
|
|
468017
|
+
const fileNames = await (0, import_promises134.readdir)(mountPath);
|
|
468018
468018
|
const appName = fileNames.find((item) => {
|
|
468019
468019
|
return typeof item === "string" && item.endsWith(".app");
|
|
468020
468020
|
});
|
|
@@ -468027,13 +468027,13 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
468027
468027
|
(0, import_node_child_process4.spawnSync)("hdiutil", ["detach", mountPath, "-quiet"]);
|
|
468028
468028
|
}
|
|
468029
468029
|
}
|
|
468030
|
-
var import_node_child_process4, import_node_fs24,
|
|
468030
|
+
var import_node_child_process4, import_node_fs24, import_promises134, path96, import_node_stream6, import_debug8, debugFileUtil, internalConstantsForTesting;
|
|
468031
468031
|
var init_fileUtil = __esm({
|
|
468032
468032
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js"() {
|
|
468033
468033
|
"use strict";
|
|
468034
468034
|
import_node_child_process4 = require("child_process");
|
|
468035
468035
|
import_node_fs24 = require("fs");
|
|
468036
|
-
|
|
468036
|
+
import_promises134 = require("fs/promises");
|
|
468037
468037
|
path96 = __toESM(require("path"), 1);
|
|
468038
468038
|
import_node_stream6 = require("stream");
|
|
468039
468039
|
import_debug8 = __toESM(require_src(), 1);
|
|
@@ -468096,7 +468096,7 @@ async function installWithProviders(options2) {
|
|
|
468096
468096
|
}
|
|
468097
468097
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url3}`);
|
|
468098
468098
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
468099
|
-
await (0,
|
|
468099
|
+
await (0, import_promises135.mkdir)(browserRoot, { recursive: true });
|
|
468100
468100
|
}
|
|
468101
468101
|
return await installUrl(url3, options2, provider);
|
|
468102
468102
|
} catch (err) {
|
|
@@ -468169,7 +468169,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
468169
468169
|
const browserRoot = cache2.browserRoot(options2.browser);
|
|
468170
468170
|
const archivePath = import_node_path34.default.join(browserRoot, `${options2.buildId}-${fileName}`);
|
|
468171
468171
|
if (!(0, import_node_fs25.existsSync)(browserRoot)) {
|
|
468172
|
-
await (0,
|
|
468172
|
+
await (0, import_promises135.mkdir)(browserRoot, { recursive: true });
|
|
468173
468173
|
}
|
|
468174
468174
|
if (!options2.unpack) {
|
|
468175
468175
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
@@ -468233,7 +468233,7 @@ async function installUrl(url3, options2, provider) {
|
|
|
468233
468233
|
return installedBrowser;
|
|
468234
468234
|
} finally {
|
|
468235
468235
|
if ((0, import_node_fs25.existsSync)(archivePath)) {
|
|
468236
|
-
await (0,
|
|
468236
|
+
await (0, import_promises135.unlink)(archivePath);
|
|
468237
468237
|
}
|
|
468238
468238
|
}
|
|
468239
468239
|
}
|
|
@@ -468313,14 +468313,14 @@ function toMegabytes(bytes) {
|
|
|
468313
468313
|
const mb = bytes / 1e3 / 1e3;
|
|
468314
468314
|
return `${Math.round(mb * 10) / 10} MB`;
|
|
468315
468315
|
}
|
|
468316
|
-
var import_node_assert3, import_node_child_process5, import_node_fs25,
|
|
468316
|
+
var import_node_assert3, import_node_child_process5, import_node_fs25, import_promises135, import_node_os9, import_node_path34, import_progress, debugInstall, times;
|
|
468317
468317
|
var init_install = __esm({
|
|
468318
468318
|
"../../../node_modules/.pnpm/@puppeteer+browsers@2.13.0/node_modules/@puppeteer/browsers/lib/esm/install.js"() {
|
|
468319
468319
|
"use strict";
|
|
468320
468320
|
import_node_assert3 = __toESM(require("assert"), 1);
|
|
468321
468321
|
import_node_child_process5 = require("child_process");
|
|
468322
468322
|
import_node_fs25 = require("fs");
|
|
468323
|
-
|
|
468323
|
+
import_promises135 = require("fs/promises");
|
|
468324
468324
|
import_node_os9 = __toESM(require("os"), 1);
|
|
468325
468325
|
import_node_path34 = __toESM(require("path"), 1);
|
|
468326
468326
|
import_progress = __toESM(require_progress(), 1);
|
|
@@ -668443,7 +668443,7 @@ var AccessTokenPosthogManager = class {
|
|
|
668443
668443
|
properties: {
|
|
668444
668444
|
...event,
|
|
668445
668445
|
...event.properties,
|
|
668446
|
-
version: "5.33.
|
|
668446
|
+
version: "5.33.2",
|
|
668447
668447
|
usingAccessToken: true,
|
|
668448
668448
|
...getRunIdProperties()
|
|
668449
668449
|
}
|
|
@@ -668507,7 +668507,7 @@ var UserPosthogManager = class {
|
|
|
668507
668507
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
668508
668508
|
event: "CLI",
|
|
668509
668509
|
properties: {
|
|
668510
|
-
version: "5.33.
|
|
668510
|
+
version: "5.33.2",
|
|
668511
668511
|
...event,
|
|
668512
668512
|
...event.properties,
|
|
668513
668513
|
usingAccessToken: false,
|
|
@@ -820534,13 +820534,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
820534
820534
|
}
|
|
820535
820535
|
}
|
|
820536
820536
|
}
|
|
820537
|
-
const { writeFile:
|
|
820537
|
+
const { writeFile: writeFile95 } = await import("fs/promises");
|
|
820538
820538
|
const yamlContent = jsYaml.dump(parsed, {
|
|
820539
820539
|
indent: 2,
|
|
820540
820540
|
lineWidth: -1,
|
|
820541
820541
|
noRefs: true
|
|
820542
820542
|
});
|
|
820543
|
-
await
|
|
820543
|
+
await writeFile95(overrideFilePath, yamlContent, "utf-8");
|
|
820544
820544
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
820545
820545
|
return {
|
|
820546
820546
|
removedCount: validationResult.invalidCount,
|
|
@@ -860283,7 +860283,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
860283
860283
|
var LOGS_FOLDER_NAME = "logs";
|
|
860284
860284
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
860285
860285
|
function getCliSource() {
|
|
860286
|
-
const version7 = "5.33.
|
|
860286
|
+
const version7 = "5.33.2";
|
|
860287
860287
|
return `cli@${version7}`;
|
|
860288
860288
|
}
|
|
860289
860289
|
var DebugLogger = class {
|
|
@@ -877858,6 +877858,43 @@ async function generateOne({ generatorInvocation, interactiveTaskContext, projec
|
|
|
877858
877858
|
init_lib4();
|
|
877859
877859
|
init_lib6();
|
|
877860
877860
|
|
|
877861
|
+
// ../generation/remote-generation/remote-workspace-runner/lib/customDomainValidation.js
|
|
877862
|
+
init_lib6();
|
|
877863
|
+
var HTTPS_PREFIX = "https://";
|
|
877864
|
+
var HTTP_PREFIX = "http://";
|
|
877865
|
+
function stripCustomDomainProtocol(customDomain) {
|
|
877866
|
+
if (customDomain.startsWith(HTTPS_PREFIX)) {
|
|
877867
|
+
return customDomain.slice(HTTPS_PREFIX.length);
|
|
877868
|
+
}
|
|
877869
|
+
if (customDomain.startsWith(HTTP_PREFIX)) {
|
|
877870
|
+
return customDomain.slice(HTTP_PREFIX.length);
|
|
877871
|
+
}
|
|
877872
|
+
return customDomain;
|
|
877873
|
+
}
|
|
877874
|
+
function getBasepath(domain3) {
|
|
877875
|
+
try {
|
|
877876
|
+
const url3 = domain3.startsWith(HTTPS_PREFIX) || domain3.startsWith(HTTP_PREFIX) ? domain3 : `${HTTPS_PREFIX}${domain3}`;
|
|
877877
|
+
return normalizeBasepath(new URL(url3).pathname);
|
|
877878
|
+
} catch {
|
|
877879
|
+
return "/";
|
|
877880
|
+
}
|
|
877881
|
+
}
|
|
877882
|
+
function normalizeBasepath(pathname) {
|
|
877883
|
+
if (pathname === "" || pathname === "/") {
|
|
877884
|
+
return "/";
|
|
877885
|
+
}
|
|
877886
|
+
return pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
|
|
877887
|
+
}
|
|
877888
|
+
function validateBasepathAlignment(instanceUrl, customDomains, context3) {
|
|
877889
|
+
const urlBasepath = getBasepath(instanceUrl);
|
|
877890
|
+
for (const customDomain of customDomains) {
|
|
877891
|
+
const customDomainBasepath = getBasepath(customDomain);
|
|
877892
|
+
if (urlBasepath !== customDomainBasepath) {
|
|
877893
|
+
context3.failAndThrow(`Basepath mismatch between Fern url and custom-domain. When basepath-aware mode is enabled (via 'multi-source: true' or the deprecated 'experimental.basepath-aware: true'), the instance 'url' and 'custom-domain' must share the same basepath, otherwise docs will fail to resolve after DNS cutover. Instance url '${instanceUrl}' has basepath '${urlBasepath}' but custom-domain '${customDomain}' has basepath '${customDomainBasepath}'.`, void 0, { code: CliError.Code.ConfigError });
|
|
877894
|
+
}
|
|
877895
|
+
}
|
|
877896
|
+
}
|
|
877897
|
+
|
|
877861
877898
|
// ../generation/remote-generation/remote-workspace-runner/lib/publishDocs.js
|
|
877862
877899
|
init_lib4();
|
|
877863
877900
|
init_js();
|
|
@@ -879000,16 +879037,10 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
879000
879037
|
});
|
|
879001
879038
|
return;
|
|
879002
879039
|
}
|
|
879003
|
-
const customDomains = [];
|
|
879004
|
-
|
|
879005
|
-
|
|
879006
|
-
|
|
879007
|
-
} else if (Array.isArray(maybeInstance.customDomain)) {
|
|
879008
|
-
customDomains.push(...maybeInstance.customDomain);
|
|
879009
|
-
}
|
|
879010
|
-
}
|
|
879011
|
-
if (maybeInstance.multiSource === true) {
|
|
879012
|
-
validateMultiSourceBasepaths(maybeInstance.url, customDomains, context3);
|
|
879040
|
+
const customDomains = (typeof maybeInstance.customDomain === "string" ? [maybeInstance.customDomain] : maybeInstance.customDomain ?? []).map(stripCustomDomainProtocol);
|
|
879041
|
+
const isBasepathAware = maybeInstance.multiSource === true || docsWorkspace.config.experimental?.basepathAware === true;
|
|
879042
|
+
if (isBasepathAware) {
|
|
879043
|
+
validateBasepathAlignment(maybeInstance.url, customDomains, context3);
|
|
879013
879044
|
}
|
|
879014
879045
|
context3.logger.info(`Starting docs publishing for ${preview ? "preview" : "production"}: ${maybeInstance.url}`);
|
|
879015
879046
|
context3.logger.debug(`Organization: ${organization}, Preview: ${preview}, APIs: ${apiWorkspaces.length}, OSS: ${ossWorkspaces.length}`);
|
|
@@ -879062,23 +879093,6 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
879062
879093
|
});
|
|
879063
879094
|
return publishedUrl;
|
|
879064
879095
|
}
|
|
879065
|
-
function getBasepath(domain3) {
|
|
879066
|
-
try {
|
|
879067
|
-
const url3 = domain3.startsWith("https://") || domain3.startsWith("http://") ? domain3 : `https://${domain3}`;
|
|
879068
|
-
return new URL(url3).pathname;
|
|
879069
|
-
} catch {
|
|
879070
|
-
return "/";
|
|
879071
|
-
}
|
|
879072
|
-
}
|
|
879073
|
-
function validateMultiSourceBasepaths(instanceUrl, customDomains, context3) {
|
|
879074
|
-
const urlBasepath = getBasepath(instanceUrl);
|
|
879075
|
-
for (const customDomain of customDomains) {
|
|
879076
|
-
const customDomainBasepath = getBasepath(customDomain);
|
|
879077
|
-
if (customDomainBasepath !== "/" && urlBasepath !== customDomainBasepath) {
|
|
879078
|
-
context3.failAndThrow(`When multi-source is enabled, the url and custom-domain must share the same basepath. Instance url '${instanceUrl}' has basepath '${urlBasepath}' but custom-domain '${customDomain}' has basepath '${customDomainBasepath}'.`, void 0, { code: CliError.Code.ConfigError });
|
|
879079
|
-
}
|
|
879080
|
-
}
|
|
879081
|
-
}
|
|
879082
879096
|
|
|
879083
879097
|
// ../cli-v2/lib/docs/publisher/LegacyDocsPublisher.js
|
|
879084
879098
|
init_lib6();
|
|
@@ -879115,7 +879129,7 @@ var LegacyDocsPublisher = class {
|
|
|
879115
879129
|
previewId,
|
|
879116
879130
|
disableTemplates: void 0,
|
|
879117
879131
|
skipUpload,
|
|
879118
|
-
cliVersion: "5.33.
|
|
879132
|
+
cliVersion: "5.33.2",
|
|
879119
879133
|
loginCommand: "fern auth login"
|
|
879120
879134
|
});
|
|
879121
879135
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -882156,26 +882170,48 @@ function addReplayCommand(cli) {
|
|
|
882156
882170
|
}
|
|
882157
882171
|
|
|
882158
882172
|
// ../cli-v2/lib/commands/schema/command.js
|
|
882173
|
+
init_lib8();
|
|
882159
882174
|
init_lib6();
|
|
882175
|
+
var import_promises105 = require("fs/promises");
|
|
882160
882176
|
var SchemaCommand = class {
|
|
882161
882177
|
async handle(context3, args) {
|
|
882162
|
-
|
|
882163
|
-
|
|
882178
|
+
const schema2 = this.resolveSchema(args.name);
|
|
882179
|
+
if (args.output != null) {
|
|
882180
|
+
await this.writeToFile(context3, schema2, args.pretty, args.output);
|
|
882164
882181
|
return;
|
|
882165
882182
|
}
|
|
882166
|
-
|
|
882183
|
+
this.writeToStdout(context3, schema2, args.pretty);
|
|
882184
|
+
}
|
|
882185
|
+
resolveSchema(name2) {
|
|
882186
|
+
if (name2 == null) {
|
|
882187
|
+
return getFernYmlJsonSchema();
|
|
882188
|
+
}
|
|
882189
|
+
const schema2 = getJsonSchemaByName(name2);
|
|
882167
882190
|
if (schema2 == null) {
|
|
882168
882191
|
const available = getJsonSchemaNames().join(", ");
|
|
882169
882192
|
throw new CliError({
|
|
882170
|
-
message: `Unknown schema '${
|
|
882193
|
+
message: `Unknown schema '${name2}'. Available subsections: ${available}.`,
|
|
882171
882194
|
code: CliError.Code.ConfigError
|
|
882172
882195
|
});
|
|
882173
882196
|
}
|
|
882174
|
-
|
|
882197
|
+
return schema2;
|
|
882175
882198
|
}
|
|
882176
|
-
|
|
882199
|
+
formatJson(value2, pretty) {
|
|
882177
882200
|
const json3 = pretty ? JSON.stringify(value2, null, 2) : JSON.stringify(value2);
|
|
882178
|
-
|
|
882201
|
+
return `${json3}
|
|
882202
|
+
`;
|
|
882203
|
+
}
|
|
882204
|
+
writeToStdout(context3, value2, pretty) {
|
|
882205
|
+
context3.stdout.info(this.formatJson(value2, pretty).trimEnd());
|
|
882206
|
+
}
|
|
882207
|
+
async writeToFile(context3, value2, pretty, outputPath) {
|
|
882208
|
+
const absoluteOutputPath = resolve6(context3.cwd, outputPath);
|
|
882209
|
+
const outputDir = dirname6(absoluteOutputPath);
|
|
882210
|
+
if (!await doesPathExist(outputDir)) {
|
|
882211
|
+
await (0, import_promises105.mkdir)(outputDir, { recursive: true });
|
|
882212
|
+
}
|
|
882213
|
+
await (0, import_promises105.writeFile)(absoluteOutputPath, this.formatJson(value2, pretty));
|
|
882214
|
+
context3.stderr.info(source_default.green(`Wrote JSON Schema to ${absoluteOutputPath}`));
|
|
882179
882215
|
}
|
|
882180
882216
|
};
|
|
882181
882217
|
function addSchemaCommand(cli) {
|
|
@@ -882183,6 +882219,9 @@ function addSchemaCommand(cli) {
|
|
|
882183
882219
|
command2(cli, "schema [name]", "Print a JSON Schema for fern.yml (or a dot-delimited subsection like `sdks` or `sdks.targets`)", (context3, args) => cmd.handle(context3, args), (yargs) => yargs.positional("name", {
|
|
882184
882220
|
type: "string",
|
|
882185
882221
|
description: `Dot-delimited subsection of fern.yml. Omit to print the full schema. Available subsections: ${getJsonSchemaNames().join(", ")}.`
|
|
882222
|
+
}).option("output", {
|
|
882223
|
+
type: "string",
|
|
882224
|
+
description: "Write JSON Schema to this file instead of stdout"
|
|
882186
882225
|
}).option("pretty", {
|
|
882187
882226
|
type: "boolean",
|
|
882188
882227
|
default: true,
|
|
@@ -882451,13 +882490,13 @@ function addCheckCommand5(cli) {
|
|
|
882451
882490
|
init_lib4();
|
|
882452
882491
|
init_lib8();
|
|
882453
882492
|
init_lib6();
|
|
882454
|
-
var
|
|
882493
|
+
var import_promises122 = require("fs/promises");
|
|
882455
882494
|
init_js_yaml();
|
|
882456
882495
|
|
|
882457
882496
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
882458
882497
|
init_lib8();
|
|
882459
882498
|
init_lib6();
|
|
882460
|
-
var
|
|
882499
|
+
var import_promises106 = require("fs/promises");
|
|
882461
882500
|
var import_os11 = require("os");
|
|
882462
882501
|
var import_path81 = __toESM(require("path"), 1);
|
|
882463
882502
|
|
|
@@ -882534,9 +882573,9 @@ var ApiSpecResolver = class {
|
|
|
882534
882573
|
});
|
|
882535
882574
|
}
|
|
882536
882575
|
const extension4 = this.inferExtensionFromContent(content5);
|
|
882537
|
-
const tempDir2 = await (0,
|
|
882576
|
+
const tempDir2 = await (0, import_promises106.mkdtemp)(import_path81.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
882538
882577
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path81.default.join(tempDir2, `spec${extension4}`));
|
|
882539
|
-
await (0,
|
|
882578
|
+
await (0, import_promises106.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
882540
882579
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: "stdin" });
|
|
882541
882580
|
return {
|
|
882542
882581
|
absoluteFilePath,
|
|
@@ -882552,9 +882591,9 @@ var ApiSpecResolver = class {
|
|
|
882552
882591
|
async resolveUrl({ reference: reference4 }) {
|
|
882553
882592
|
const { content: content5, contentType } = await this.fetchContent({ url: reference4 });
|
|
882554
882593
|
const extension4 = this.inferExtension({ url: reference4, contentType });
|
|
882555
|
-
const tempDir2 = await (0,
|
|
882594
|
+
const tempDir2 = await (0, import_promises106.mkdtemp)(import_path81.default.join((0, import_os11.tmpdir)(), "fern-"));
|
|
882556
882595
|
const absoluteFilePath = AbsoluteFilePath2.of(import_path81.default.join(tempDir2, `spec${extension4}`));
|
|
882557
|
-
await (0,
|
|
882596
|
+
await (0, import_promises106.writeFile)(absoluteFilePath, content5, "utf-8");
|
|
882558
882597
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
882559
882598
|
return {
|
|
882560
882599
|
absoluteFilePath,
|
|
@@ -882570,7 +882609,7 @@ var ApiSpecResolver = class {
|
|
|
882570
882609
|
code: CliError.Code.ConfigError
|
|
882571
882610
|
});
|
|
882572
882611
|
}
|
|
882573
|
-
const content5 = await (0,
|
|
882612
|
+
const content5 = await (0, import_promises106.readFile)(absoluteFilePath, "utf-8");
|
|
882574
882613
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
882575
882614
|
return {
|
|
882576
882615
|
absoluteFilePath,
|
|
@@ -901269,7 +901308,7 @@ var DynamicSnippetsGenerator = class extends AbstractDynamicSnippetsGenerator {
|
|
|
901269
901308
|
|
|
901270
901309
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/csharp/DynamicSnippetsCsharpTestGenerator.js
|
|
901271
901310
|
init_lib8();
|
|
901272
|
-
var
|
|
901311
|
+
var import_promises107 = require("fs/promises");
|
|
901273
901312
|
var import_path83 = __toESM(require("path"), 1);
|
|
901274
901313
|
|
|
901275
901314
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/utils/convertEndpointSnippetRequest.js
|
|
@@ -901401,8 +901440,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
901401
901440
|
endpointId
|
|
901402
901441
|
});
|
|
901403
901442
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
901404
|
-
await (0,
|
|
901405
|
-
await (0,
|
|
901443
|
+
await (0, import_promises107.mkdir)(import_path83.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
901444
|
+
await (0, import_promises107.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
901406
901445
|
} catch (error50) {
|
|
901407
901446
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
901408
901447
|
}
|
|
@@ -901411,8 +901450,8 @@ var DynamicSnippetsCsharpTestGenerator = class {
|
|
|
901411
901450
|
}
|
|
901412
901451
|
async initializeProject(outputDir) {
|
|
901413
901452
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
901414
|
-
await (0,
|
|
901415
|
-
await (0,
|
|
901453
|
+
await (0, import_promises107.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
901454
|
+
await (0, import_promises107.writeFile)(join8(absolutePathToOutputDir, RelativeFilePath2.of("Snippets.csproj")), PROJECT_FILE_CONTENT);
|
|
901416
901455
|
return absolutePathToOutputDir;
|
|
901417
901456
|
}
|
|
901418
901457
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -904864,7 +904903,7 @@ var DynamicSnippetsGenerator2 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
904864
904903
|
};
|
|
904865
904904
|
|
|
904866
904905
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/go/DynamicSnippetsGoTestGenerator.js
|
|
904867
|
-
var
|
|
904906
|
+
var import_promises108 = require("fs/promises");
|
|
904868
904907
|
var import_path85 = __toESM(require("path"), 1);
|
|
904869
904908
|
var DynamicSnippetsGoTestGenerator = class {
|
|
904870
904909
|
context;
|
|
@@ -904893,8 +904932,8 @@ var DynamicSnippetsGoTestGenerator = class {
|
|
|
904893
904932
|
endpointId
|
|
904894
904933
|
});
|
|
904895
904934
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
904896
|
-
await (0,
|
|
904897
|
-
await (0,
|
|
904935
|
+
await (0, import_promises108.mkdir)(import_path85.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
904936
|
+
await (0, import_promises108.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
904898
904937
|
} catch (error50) {
|
|
904899
904938
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
904900
904939
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -908291,7 +908330,7 @@ var DynamicSnippetsGenerator3 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
908291
908330
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/java/DynamicSnippetsJavaTestGenerator.js
|
|
908292
908331
|
init_lib12();
|
|
908293
908332
|
init_lib6();
|
|
908294
|
-
var
|
|
908333
|
+
var import_promises109 = require("fs/promises");
|
|
908295
908334
|
var import_path86 = __toESM(require("path"), 1);
|
|
908296
908335
|
var DynamicSnippetsJavaTestGenerator = class {
|
|
908297
908336
|
context;
|
|
@@ -908326,8 +908365,8 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
908326
908365
|
endpointId
|
|
908327
908366
|
});
|
|
908328
908367
|
const dynamicSnippetFilePath = this.getTestFilePath({ absolutePathToOutputDir, idx });
|
|
908329
|
-
await (0,
|
|
908330
|
-
await (0,
|
|
908368
|
+
await (0, import_promises109.mkdir)(import_path86.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
908369
|
+
await (0, import_promises109.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
908331
908370
|
} catch (error50) {
|
|
908332
908371
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
908333
908372
|
}
|
|
@@ -908354,7 +908393,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
908354
908393
|
const reportsPath = join8(outputDir, RelativeFilePath2.of("reports"));
|
|
908355
908394
|
const buildReportsExists = await doesPathExist(buildReportsPath, "directory");
|
|
908356
908395
|
if (buildReportsExists) {
|
|
908357
|
-
await (0,
|
|
908396
|
+
await (0, import_promises109.cp)(buildReportsPath, reportsPath, { recursive: true });
|
|
908358
908397
|
this.context.logger.info("Gradle profiling report copied to reports/");
|
|
908359
908398
|
} else {
|
|
908360
908399
|
this.context.logger.info("No profiling report found in build/reports/");
|
|
@@ -908368,7 +908407,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
908368
908407
|
}
|
|
908369
908408
|
async initializeProject(outputDir) {
|
|
908370
908409
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("src/main/java/com/snippets"));
|
|
908371
|
-
await (0,
|
|
908410
|
+
await (0, import_promises109.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
908372
908411
|
return absolutePathToOutputDir;
|
|
908373
908412
|
}
|
|
908374
908413
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -911833,7 +911872,7 @@ var DynamicSnippetsGenerator4 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
911833
911872
|
};
|
|
911834
911873
|
|
|
911835
911874
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/php/DynamicSnippetsPhpTestGenerator.js
|
|
911836
|
-
var
|
|
911875
|
+
var import_promises110 = require("fs/promises");
|
|
911837
911876
|
var import_path87 = __toESM(require("path"), 1);
|
|
911838
911877
|
var DynamicSnippetsPhpTestGenerator = class {
|
|
911839
911878
|
context;
|
|
@@ -911862,8 +911901,8 @@ var DynamicSnippetsPhpTestGenerator = class {
|
|
|
911862
911901
|
endpointId
|
|
911863
911902
|
});
|
|
911864
911903
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
911865
|
-
await (0,
|
|
911866
|
-
await (0,
|
|
911904
|
+
await (0, import_promises110.mkdir)(import_path87.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
911905
|
+
await (0, import_promises110.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
911867
911906
|
} catch (error50) {
|
|
911868
911907
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
911869
911908
|
}
|
|
@@ -915120,7 +915159,7 @@ var DynamicSnippetsGenerator5 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
915120
915159
|
};
|
|
915121
915160
|
|
|
915122
915161
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/python/DynamicSnippetsPythonTestGenerator.js
|
|
915123
|
-
var
|
|
915162
|
+
var import_promises111 = require("fs/promises");
|
|
915124
915163
|
var import_path88 = __toESM(require("path"), 1);
|
|
915125
915164
|
var DynamicSnippetsPythonTestGenerator = class {
|
|
915126
915165
|
context;
|
|
@@ -915149,8 +915188,8 @@ var DynamicSnippetsPythonTestGenerator = class {
|
|
|
915149
915188
|
endpointId
|
|
915150
915189
|
});
|
|
915151
915190
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
915152
|
-
await (0,
|
|
915153
|
-
await (0,
|
|
915191
|
+
await (0, import_promises111.mkdir)(import_path88.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
915192
|
+
await (0, import_promises111.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
915154
915193
|
} catch (error50) {
|
|
915155
915194
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
915156
915195
|
}
|
|
@@ -918024,7 +918063,7 @@ var DynamicSnippetsGenerator6 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
918024
918063
|
};
|
|
918025
918064
|
|
|
918026
918065
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/ruby/DynamicSnippetsRubyTestGenerator.js
|
|
918027
|
-
var
|
|
918066
|
+
var import_promises112 = require("fs/promises");
|
|
918028
918067
|
var import_path89 = __toESM(require("path"), 1);
|
|
918029
918068
|
var DynamicSnippetsRubyTestGenerator = class {
|
|
918030
918069
|
context;
|
|
@@ -918053,8 +918092,8 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
918053
918092
|
endpointId
|
|
918054
918093
|
});
|
|
918055
918094
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
918056
|
-
await (0,
|
|
918057
|
-
await (0,
|
|
918095
|
+
await (0, import_promises112.mkdir)(import_path89.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
918096
|
+
await (0, import_promises112.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
918058
918097
|
} catch (error50) {
|
|
918059
918098
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
918060
918099
|
if (error50 instanceof Error && error50.stack) {
|
|
@@ -918070,7 +918109,7 @@ var DynamicSnippetsRubyTestGenerator = class {
|
|
|
918070
918109
|
};
|
|
918071
918110
|
|
|
918072
918111
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/rust/DynamicSnippetsRustTestGenerator.js
|
|
918073
|
-
var
|
|
918112
|
+
var import_promises113 = require("fs/promises");
|
|
918074
918113
|
var import_node_path25 = __toESM(require("path"), 1);
|
|
918075
918114
|
init_lib8();
|
|
918076
918115
|
|
|
@@ -923304,8 +923343,8 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
923304
923343
|
absolutePathToOutputDir,
|
|
923305
923344
|
idx
|
|
923306
923345
|
});
|
|
923307
|
-
await (0,
|
|
923308
|
-
await (0,
|
|
923346
|
+
await (0, import_promises113.mkdir)(import_node_path25.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
923347
|
+
await (0, import_promises113.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
923309
923348
|
} catch (error50) {
|
|
923310
923349
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
923311
923350
|
}
|
|
@@ -923314,7 +923353,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
923314
923353
|
}
|
|
923315
923354
|
async initializeProject(outputDir) {
|
|
923316
923355
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("dynamic-snippets"));
|
|
923317
|
-
await (0,
|
|
923356
|
+
await (0, import_promises113.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
923318
923357
|
return absolutePathToOutputDir;
|
|
923319
923358
|
}
|
|
923320
923359
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -923323,7 +923362,7 @@ var DynamicSnippetsRustTestGenerator = class {
|
|
|
923323
923362
|
};
|
|
923324
923363
|
|
|
923325
923364
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/swift/DynamicSnippetsSwiftTestGenerator.js
|
|
923326
|
-
var
|
|
923365
|
+
var import_promises114 = require("fs/promises");
|
|
923327
923366
|
var import_node_path26 = __toESM(require("path"), 1);
|
|
923328
923367
|
init_lib8();
|
|
923329
923368
|
|
|
@@ -927902,8 +927941,8 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
927902
927941
|
absolutePathToOutputDir,
|
|
927903
927942
|
idx
|
|
927904
927943
|
});
|
|
927905
|
-
await (0,
|
|
927906
|
-
await (0,
|
|
927944
|
+
await (0, import_promises114.mkdir)(import_node_path26.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
927945
|
+
await (0, import_promises114.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
927907
927946
|
} catch (error50) {
|
|
927908
927947
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
927909
927948
|
}
|
|
@@ -927912,7 +927951,7 @@ var DynamicSnippetsSwiftTestGenerator = class {
|
|
|
927912
927951
|
}
|
|
927913
927952
|
async initializeProject(outputDir) {
|
|
927914
927953
|
const absolutePathToOutputDir = join8(outputDir, RelativeFilePath2.of("Snippets"));
|
|
927915
|
-
await (0,
|
|
927954
|
+
await (0, import_promises114.mkdir)(absolutePathToOutputDir, { recursive: true });
|
|
927916
927955
|
return absolutePathToOutputDir;
|
|
927917
927956
|
}
|
|
927918
927957
|
getTestFilePath({ absolutePathToOutputDir, idx }) {
|
|
@@ -930241,7 +930280,7 @@ var DynamicSnippetsGenerator9 = class extends AbstractDynamicSnippetsGenerator {
|
|
|
930241
930280
|
};
|
|
930242
930281
|
|
|
930243
930282
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/typescript/DynamicSnippetsTypeScriptTestGenerator.js
|
|
930244
|
-
var
|
|
930283
|
+
var import_promises115 = require("fs/promises");
|
|
930245
930284
|
var import_path90 = __toESM(require("path"), 1);
|
|
930246
930285
|
var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
930247
930286
|
context;
|
|
@@ -930270,8 +930309,8 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
930270
930309
|
endpointId
|
|
930271
930310
|
});
|
|
930272
930311
|
const dynamicSnippetFilePath = this.getTestFilePath({ outputDir, idx });
|
|
930273
|
-
await (0,
|
|
930274
|
-
await (0,
|
|
930312
|
+
await (0, import_promises115.mkdir)(import_path90.default.dirname(dynamicSnippetFilePath), { recursive: true });
|
|
930313
|
+
await (0, import_promises115.writeFile)(dynamicSnippetFilePath, response.snippet);
|
|
930275
930314
|
} catch (error50) {
|
|
930276
930315
|
this.context.logger.error(`Failed to generate dynamic snippet for endpoint ${JSON.stringify(request7.endpoint)}: ${error50}`);
|
|
930277
930316
|
}
|
|
@@ -930381,7 +930420,7 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir11, config
|
|
|
930381
930420
|
init_lib8();
|
|
930382
930421
|
var import_autoversion3 = __toESM(require_autoversion(), 1);
|
|
930383
930422
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
930384
|
-
var
|
|
930423
|
+
var import_promises118 = require("fs/promises");
|
|
930385
930424
|
var path87 = __toESM(require("path"), 1);
|
|
930386
930425
|
var import_path93 = require("path");
|
|
930387
930426
|
var import_tmp_promise14 = __toESM(require_tmp_promise(), 1);
|
|
@@ -930869,7 +930908,7 @@ var import_autoversion2 = __toESM(require_autoversion(), 1);
|
|
|
930869
930908
|
init_lib12();
|
|
930870
930909
|
init_lib6();
|
|
930871
930910
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
930872
|
-
var
|
|
930911
|
+
var import_promises116 = require("fs/promises");
|
|
930873
930912
|
var import_os12 = require("os");
|
|
930874
930913
|
var import_path91 = require("path");
|
|
930875
930914
|
var import_semver12 = __toESM(require_semver2(), 1);
|
|
@@ -930976,7 +931015,7 @@ var LocalTaskHandler = class {
|
|
|
930976
931015
|
try {
|
|
930977
931016
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
930978
931017
|
diffFile = await this.generateDiffFile();
|
|
930979
|
-
const diffContent = await (0,
|
|
931018
|
+
const diffContent = await (0, import_promises116.readFile)(diffFile, "utf-8");
|
|
930980
931019
|
if (diffContent.trim().length === 0) {
|
|
930981
931020
|
this.context.logger.info("No changes detected in generated SDK");
|
|
930982
931021
|
return null;
|
|
@@ -931181,7 +931220,7 @@ var LocalTaskHandler = class {
|
|
|
931181
931220
|
} finally {
|
|
931182
931221
|
if (diffFile) {
|
|
931183
931222
|
try {
|
|
931184
|
-
await (0,
|
|
931223
|
+
await (0, import_promises116.rm)(diffFile);
|
|
931185
931224
|
} catch (cleanupError) {
|
|
931186
931225
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
931187
931226
|
}
|
|
@@ -931361,7 +931400,7 @@ var LocalTaskHandler = class {
|
|
|
931361
931400
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
931362
931401
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
931363
931402
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
931364
|
-
await (0,
|
|
931403
|
+
await (0, import_promises116.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true });
|
|
931365
931404
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
931366
931405
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
931367
931406
|
await this.runThrowawayGitCommand([
|
|
@@ -931381,17 +931420,17 @@ var LocalTaskHandler = class {
|
|
|
931381
931420
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
931382
931421
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
931383
931422
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
931384
|
-
await (0,
|
|
931385
|
-
await (0,
|
|
931386
|
-
await (0,
|
|
931423
|
+
await (0, import_promises116.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), { recursive: true });
|
|
931424
|
+
await (0, import_promises116.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
931425
|
+
await (0, import_promises116.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true });
|
|
931387
931426
|
}
|
|
931388
931427
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
931389
|
-
const contents = await (0,
|
|
931428
|
+
const contents = await (0, import_promises116.readdir)(this.absolutePathToLocalOutput);
|
|
931390
931429
|
const itemsToPreserve = [".git"];
|
|
931391
931430
|
if (await this.generatedOutputMissingReadme()) {
|
|
931392
931431
|
itemsToPreserve.push("README.md");
|
|
931393
931432
|
}
|
|
931394
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
931433
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises116.rm)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
931395
931434
|
force: true,
|
|
931396
931435
|
recursive: true
|
|
931397
931436
|
})));
|
|
@@ -931399,11 +931438,11 @@ var LocalTaskHandler = class {
|
|
|
931399
931438
|
}
|
|
931400
931439
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
931401
931440
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
931402
|
-
await (0,
|
|
931441
|
+
await (0, import_promises116.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
931403
931442
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
931404
931443
|
}
|
|
931405
931444
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
931406
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
931445
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises116.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
931407
931446
|
if (firstLocalOutputItem == null) {
|
|
931408
931447
|
return;
|
|
931409
931448
|
}
|
|
@@ -931411,15 +931450,15 @@ var LocalTaskHandler = class {
|
|
|
931411
931450
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
931412
931451
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
931413
931452
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
931414
|
-
await (0,
|
|
931453
|
+
await (0, import_promises116.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true });
|
|
931415
931454
|
}
|
|
931416
931455
|
} else {
|
|
931417
|
-
await (0,
|
|
931456
|
+
await (0, import_promises116.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true });
|
|
931418
931457
|
}
|
|
931419
931458
|
}
|
|
931420
931459
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
931421
931460
|
this.context.logger.debug(`Copying generated snippets to ${absolutePathToLocalSnippetJSON}`);
|
|
931422
|
-
await (0,
|
|
931461
|
+
await (0, import_promises116.cp)(absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON);
|
|
931423
931462
|
}
|
|
931424
931463
|
/**
|
|
931425
931464
|
* Checks whether the generated output is missing README.md.
|
|
@@ -931428,7 +931467,7 @@ var LocalTaskHandler = class {
|
|
|
931428
931467
|
*/
|
|
931429
931468
|
async generatedOutputMissingReadme() {
|
|
931430
931469
|
try {
|
|
931431
|
-
const contents = await (0,
|
|
931470
|
+
const contents = await (0, import_promises116.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
931432
931471
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
931433
931472
|
return false;
|
|
931434
931473
|
}
|
|
@@ -931478,13 +931517,13 @@ var LocalTaskHandler = class {
|
|
|
931478
931517
|
async readPriorChangelog(maxEntries) {
|
|
931479
931518
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
931480
931519
|
try {
|
|
931481
|
-
const files = await (0,
|
|
931520
|
+
const files = await (0, import_promises116.readdir)(this.absolutePathToLocalOutput);
|
|
931482
931521
|
const changelogFile = files.find((f4) => f4.toLowerCase() === "changelog.md");
|
|
931483
931522
|
if (!changelogFile) {
|
|
931484
931523
|
return "";
|
|
931485
931524
|
}
|
|
931486
931525
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
931487
|
-
const content5 = await (0,
|
|
931526
|
+
const content5 = await (0, import_promises116.readFile)(changelogPath, "utf-8");
|
|
931488
931527
|
if (content5.trim().length === 0) {
|
|
931489
931528
|
return "";
|
|
931490
931529
|
}
|
|
@@ -931562,7 +931601,7 @@ var LocalTaskHandler = class {
|
|
|
931562
931601
|
|
|
931563
931602
|
// ../generation/local-generation/local-workspace-runner/lib/rawSpecs.js
|
|
931564
931603
|
init_lib4();
|
|
931565
|
-
var
|
|
931604
|
+
var import_promises117 = require("fs/promises");
|
|
931566
931605
|
init_js_yaml();
|
|
931567
931606
|
var import_path92 = __toESM(require("path"), 1);
|
|
931568
931607
|
async function collectRawSpecs({ specs, hostOutputDir, containerBaseDir, context: context3, audiences }) {
|
|
@@ -931617,7 +931656,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
931617
931656
|
});
|
|
931618
931657
|
}
|
|
931619
931658
|
resolved = filterSpec(resolved, audiences);
|
|
931620
|
-
await (0,
|
|
931659
|
+
await (0, import_promises117.writeFile)(import_path92.default.join(hostOutputDir, filename), JSON.stringify(resolved));
|
|
931621
931660
|
context3.logger.debug(`Resolved ${isAsync2 ? "AsyncAPI" : "OpenAPI"} spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
931622
931661
|
return {
|
|
931623
931662
|
type: isAsync2 ? "asyncapi" : "openapi",
|
|
@@ -931626,7 +931665,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
931626
931665
|
}
|
|
931627
931666
|
async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context: context3, index: index3 }) {
|
|
931628
931667
|
const filename = `spec-${index3}.json`;
|
|
931629
|
-
const rawContent = await (0,
|
|
931668
|
+
const rawContent = await (0, import_promises117.readFile)(spec.absoluteFilepath, "utf-8");
|
|
931630
931669
|
let parsed;
|
|
931631
931670
|
try {
|
|
931632
931671
|
parsed = JSON.parse(rawContent);
|
|
@@ -931636,7 +931675,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
931636
931675
|
let result = parsed;
|
|
931637
931676
|
const overrides = normalizeOverrides(spec.absoluteFilepathToOverrides);
|
|
931638
931677
|
for (const overridePath of overrides) {
|
|
931639
|
-
const overrideContent = await (0,
|
|
931678
|
+
const overrideContent = await (0, import_promises117.readFile)(overridePath, "utf-8");
|
|
931640
931679
|
let overrideParsed;
|
|
931641
931680
|
try {
|
|
931642
931681
|
overrideParsed = JSON.parse(overrideContent);
|
|
@@ -931648,7 +931687,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
931648
931687
|
overrides: overrideParsed
|
|
931649
931688
|
});
|
|
931650
931689
|
}
|
|
931651
|
-
await (0,
|
|
931690
|
+
await (0, import_promises117.writeFile)(import_path92.default.join(hostOutputDir, filename), JSON.stringify(result));
|
|
931652
931691
|
context3.logger.debug(`Resolved OpenRPC spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
931653
931692
|
return {
|
|
931654
931693
|
type: "openrpc",
|
|
@@ -931658,7 +931697,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
931658
931697
|
async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
931659
931698
|
const dirName = `proto-${index3}`;
|
|
931660
931699
|
const destDir = import_path92.default.join(hostOutputDir, dirName);
|
|
931661
|
-
await (0,
|
|
931700
|
+
await (0, import_promises117.cp)(spec.absoluteFilepathToProtobufRoot, destDir, { recursive: true });
|
|
931662
931701
|
const entry = {
|
|
931663
931702
|
type: "protobuf",
|
|
931664
931703
|
specPath: toContainerPath(dirName, containerBaseDir)
|
|
@@ -931668,7 +931707,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
931668
931707
|
entry.overridePaths = [];
|
|
931669
931708
|
for (const [i9, override] of overrides.entries()) {
|
|
931670
931709
|
const overrideName = `proto-${index3}-override-${i9}${import_path92.default.extname(override)}`;
|
|
931671
|
-
await (0,
|
|
931710
|
+
await (0, import_promises117.copyFile)(override, import_path92.default.join(hostOutputDir, overrideName));
|
|
931672
931711
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
931673
931712
|
}
|
|
931674
931713
|
}
|
|
@@ -931677,7 +931716,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
931677
931716
|
async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
931678
931717
|
const ext2 = import_path92.default.extname(spec.absoluteFilepath) || ".graphql";
|
|
931679
931718
|
const filename = `spec-${index3}${ext2}`;
|
|
931680
|
-
await (0,
|
|
931719
|
+
await (0, import_promises117.copyFile)(spec.absoluteFilepath, import_path92.default.join(hostOutputDir, filename));
|
|
931681
931720
|
const entry = {
|
|
931682
931721
|
type: "graphql",
|
|
931683
931722
|
specPath: toContainerPath(filename, containerBaseDir)
|
|
@@ -931687,7 +931726,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
931687
931726
|
entry.overridePaths = [];
|
|
931688
931727
|
for (const [i9, override] of overrides.entries()) {
|
|
931689
931728
|
const overrideName = `graphql-${index3}-override-${i9}${import_path92.default.extname(override)}`;
|
|
931690
|
-
await (0,
|
|
931729
|
+
await (0, import_promises117.copyFile)(override, import_path92.default.join(hostOutputDir, overrideName));
|
|
931691
931730
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
931692
931731
|
}
|
|
931693
931732
|
}
|
|
@@ -931695,7 +931734,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
931695
931734
|
}
|
|
931696
931735
|
async function isAsyncAPISpec(filepath) {
|
|
931697
931736
|
try {
|
|
931698
|
-
const content5 = await (0,
|
|
931737
|
+
const content5 = await (0, import_promises117.readFile)(filepath, "utf-8");
|
|
931699
931738
|
return content5.includes("asyncapi");
|
|
931700
931739
|
} catch {
|
|
931701
931740
|
return false;
|
|
@@ -931830,24 +931869,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
931830
931869
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
931831
931870
|
const configJsonFile = (0, import_path93.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
931832
931871
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
931833
|
-
await (0,
|
|
931872
|
+
await (0, import_promises118.writeFile)(configJsonFile, "");
|
|
931834
931873
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
931835
931874
|
const tmpOutputDirectory = (0, import_path93.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
931836
931875
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
931837
|
-
await (0,
|
|
931876
|
+
await (0, import_promises118.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
931838
931877
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
931839
931878
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
931840
931879
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
931841
931880
|
const snippetJsonFile = (0, import_path93.join)(workspaceTempDir.path, "snippet.json");
|
|
931842
931881
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
931843
|
-
await (0,
|
|
931882
|
+
await (0, import_promises118.writeFile)(snippetJsonFile, "");
|
|
931844
931883
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
931845
931884
|
}
|
|
931846
931885
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
931847
931886
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
931848
931887
|
const snippetTemplatesJsonFile = (0, import_path93.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
931849
931888
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
931850
|
-
await (0,
|
|
931889
|
+
await (0, import_promises118.writeFile)(snippetTemplatesJsonFile, "");
|
|
931851
931890
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
931852
931891
|
}
|
|
931853
931892
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -931887,7 +931926,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
931887
931926
|
publishToRegistry,
|
|
931888
931927
|
paths
|
|
931889
931928
|
});
|
|
931890
|
-
await (0,
|
|
931929
|
+
await (0, import_promises118.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
931891
931930
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
931892
931931
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
931893
931932
|
hostPath: source2.absoluteFilePath,
|
|
@@ -931895,7 +931934,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
931895
931934
|
}));
|
|
931896
931935
|
if (rawApiSpecs != null && rawApiSpecs.length > 0) {
|
|
931897
931936
|
const rawSpecsDir = (0, import_path93.join)(workspaceTempDir.path, SPECS_DIRECTORY_NAME);
|
|
931898
|
-
await (0,
|
|
931937
|
+
await (0, import_promises118.mkdir)(rawSpecsDir, { recursive: true });
|
|
931899
931938
|
const containerSpecsDir = CONTAINER_SPECS_DIRECTORY;
|
|
931900
931939
|
const manifest = await collectRawSpecs({
|
|
931901
931940
|
specs: rawApiSpecs,
|
|
@@ -931904,7 +931943,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
931904
931943
|
context: context3,
|
|
931905
931944
|
audiences
|
|
931906
931945
|
});
|
|
931907
|
-
await (0,
|
|
931946
|
+
await (0, import_promises118.writeFile)((0, import_path93.join)(rawSpecsDir, SPECS_MANIFEST_FILENAME), JSON.stringify(manifest, void 0, 4));
|
|
931908
931947
|
context3.logger.debug(`Wrote raw specs manifest with ${manifest.specs.length} spec(s) to ${rawSpecsDir}`);
|
|
931909
931948
|
sourceMounts.push({
|
|
931910
931949
|
hostPath: AbsoluteFilePath2.of(rawSpecsDir),
|
|
@@ -932648,14 +932687,14 @@ async function runVerifyPipeline({ outputDir, generatorName, generatorVersion, c
|
|
|
932648
932687
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
932649
932688
|
init_lib5();
|
|
932650
932689
|
init_lib6();
|
|
932651
|
-
var
|
|
932690
|
+
var import_promises120 = require("fs/promises");
|
|
932652
932691
|
|
|
932653
932692
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
932654
932693
|
init_lib4();
|
|
932655
932694
|
init_lib8();
|
|
932656
932695
|
init_lib9();
|
|
932657
932696
|
init_lib6();
|
|
932658
|
-
var
|
|
932697
|
+
var import_promises119 = require("fs/promises");
|
|
932659
932698
|
var LegacyGeneratorInvocationAdapter = class {
|
|
932660
932699
|
context;
|
|
932661
932700
|
constructor(config5) {
|
|
@@ -932909,7 +932948,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
932909
932948
|
code: CliError.Code.InternalError
|
|
932910
932949
|
});
|
|
932911
932950
|
}
|
|
932912
|
-
const contents = await (0,
|
|
932951
|
+
const contents = await (0, import_promises119.readFile)(absolutePath, "utf-8");
|
|
932913
932952
|
return api_exports4.GithubLicense.custom({ contents });
|
|
932914
932953
|
}
|
|
932915
932954
|
buildReadme(target) {
|
|
@@ -933135,7 +933174,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
933135
933174
|
});
|
|
933136
933175
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
933137
933176
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
933138
|
-
await (0,
|
|
933177
|
+
await (0, import_promises120.rm)(snippetPath, { force: true });
|
|
933139
933178
|
}
|
|
933140
933179
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
933141
933180
|
return {
|
|
@@ -933154,7 +933193,7 @@ init_lib4();
|
|
|
933154
933193
|
init_lib8();
|
|
933155
933194
|
init_lib5();
|
|
933156
933195
|
init_lib6();
|
|
933157
|
-
var
|
|
933196
|
+
var import_promises121 = require("fs/promises");
|
|
933158
933197
|
var import_os14 = require("os");
|
|
933159
933198
|
var LegacyRemoteGenerationRunner = class {
|
|
933160
933199
|
context;
|
|
@@ -933213,13 +933252,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
933213
933252
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
933214
933253
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
933215
933254
|
if (targetOutputDirectory != null) {
|
|
933216
|
-
await (0,
|
|
933217
|
-
await (0,
|
|
933255
|
+
await (0, import_promises121.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
933256
|
+
await (0, import_promises121.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
933218
933257
|
recursive: true,
|
|
933219
933258
|
force: true
|
|
933220
933259
|
});
|
|
933221
933260
|
}
|
|
933222
|
-
await (0,
|
|
933261
|
+
await (0, import_promises121.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
933223
933262
|
}
|
|
933224
933263
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
933225
933264
|
return {
|
|
@@ -933248,7 +933287,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
933248
933287
|
}
|
|
933249
933288
|
async getAbsolutePathToPreview(args) {
|
|
933250
933289
|
if (this.isLocalGitCombo(args)) {
|
|
933251
|
-
const tmpPreviewDirectory = await (0,
|
|
933290
|
+
const tmpPreviewDirectory = await (0, import_promises121.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
933252
933291
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
933253
933292
|
}
|
|
933254
933293
|
if (!args.preview) {
|
|
@@ -933984,7 +934023,7 @@ Example:
|
|
|
933984
934023
|
if (!exists2) {
|
|
933985
934024
|
return { shouldProceed: true };
|
|
933986
934025
|
}
|
|
933987
|
-
const files = await (0,
|
|
934026
|
+
const files = await (0, import_promises122.readdir)(outputPath);
|
|
933988
934027
|
if (files.length === 0) {
|
|
933989
934028
|
return { shouldProceed: true };
|
|
933990
934029
|
}
|
|
@@ -934394,7 +934433,7 @@ init_lib4();
|
|
|
934394
934433
|
init_lib12();
|
|
934395
934434
|
init_lib6();
|
|
934396
934435
|
var import_fs35 = require("fs");
|
|
934397
|
-
var
|
|
934436
|
+
var import_promises123 = require("fs/promises");
|
|
934398
934437
|
var import_path96 = require("path");
|
|
934399
934438
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
934400
934439
|
var import_url8 = require("url");
|
|
@@ -934504,7 +934543,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934504
934543
|
}
|
|
934505
934544
|
this.migrationsInstallPromise = (async () => {
|
|
934506
934545
|
const cacheDir = this.cachePath;
|
|
934507
|
-
await (0,
|
|
934546
|
+
await (0, import_promises123.mkdir)(cacheDir, { recursive: true });
|
|
934508
934547
|
const npmCacheDir = (0, import_path96.join)(cacheDir, ".npm-cache");
|
|
934509
934548
|
const packageDir = (0, import_path96.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
934510
934549
|
const packageJsonPath = (0, import_path96.join)(packageDir, "package.json");
|
|
@@ -934521,7 +934560,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934521
934560
|
"--no-audit",
|
|
934522
934561
|
"--no-fund"
|
|
934523
934562
|
], { doNotPipeOutput: true });
|
|
934524
|
-
const packageJsonContent = await (0,
|
|
934563
|
+
const packageJsonContent = await (0, import_promises123.readFile)(packageJsonPath, "utf-8");
|
|
934525
934564
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
934526
934565
|
if (packageJson2.main == null) {
|
|
934527
934566
|
throw new CliError({
|
|
@@ -934566,7 +934605,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934566
934605
|
const myPid = String(process.pid);
|
|
934567
934606
|
while (true) {
|
|
934568
934607
|
try {
|
|
934569
|
-
const fh = await (0,
|
|
934608
|
+
const fh = await (0, import_promises123.open)(lockPath, "wx");
|
|
934570
934609
|
await fh.writeFile(myPid);
|
|
934571
934610
|
await fh.close();
|
|
934572
934611
|
const exitHandler = () => {
|
|
@@ -934583,9 +934622,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934583
934622
|
return async () => {
|
|
934584
934623
|
process.removeListener("exit", exitHandler);
|
|
934585
934624
|
try {
|
|
934586
|
-
const currentContent = await (0,
|
|
934625
|
+
const currentContent = await (0, import_promises123.readFile)(lockPath, "utf-8");
|
|
934587
934626
|
if (currentContent.trim() === myPid) {
|
|
934588
|
-
await (0,
|
|
934627
|
+
await (0, import_promises123.unlink)(lockPath);
|
|
934589
934628
|
} else {
|
|
934590
934629
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
934591
934630
|
}
|
|
@@ -934599,14 +934638,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
934599
934638
|
throw err;
|
|
934600
934639
|
}
|
|
934601
934640
|
try {
|
|
934602
|
-
const lockContent = await (0,
|
|
934641
|
+
const lockContent = await (0, import_promises123.readFile)(lockPath, "utf-8");
|
|
934603
934642
|
const lockPid = Number(lockContent.trim());
|
|
934604
|
-
const lockStat = await (0,
|
|
934643
|
+
const lockStat = await (0, import_promises123.stat)(lockPath);
|
|
934605
934644
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
934606
934645
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
934607
934646
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
934608
934647
|
try {
|
|
934609
|
-
await (0,
|
|
934648
|
+
await (0, import_promises123.unlink)(lockPath);
|
|
934610
934649
|
} catch (unlinkErr) {
|
|
934611
934650
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
934612
934651
|
}
|
|
@@ -935144,14 +935183,14 @@ var import_generator_cli5 = __toESM(require_api3(), 1);
|
|
|
935144
935183
|
|
|
935145
935184
|
// ../init/lib/initializeAPI.js
|
|
935146
935185
|
init_lib8();
|
|
935147
|
-
var
|
|
935186
|
+
var import_promises128 = require("fs/promises");
|
|
935148
935187
|
var import_fs_extra = __toESM(require_lib19(), 1);
|
|
935149
935188
|
var import_path99 = __toESM(require("path"), 1);
|
|
935150
935189
|
|
|
935151
935190
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
935152
935191
|
init_lib8();
|
|
935153
935192
|
init_lib6();
|
|
935154
|
-
var
|
|
935193
|
+
var import_promises125 = require("fs/promises");
|
|
935155
935194
|
init_lodash();
|
|
935156
935195
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
935157
935196
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -935183,7 +935222,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
935183
935222
|
}
|
|
935184
935223
|
}
|
|
935185
935224
|
}
|
|
935186
|
-
await (0,
|
|
935225
|
+
await (0, import_promises125.mkdir)(FERN_DIRECTORY);
|
|
935187
935226
|
await writeProjectConfig({
|
|
935188
935227
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
935189
935228
|
organization,
|
|
@@ -935207,11 +935246,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
935207
935246
|
organization,
|
|
935208
935247
|
version: versionOfCli
|
|
935209
935248
|
};
|
|
935210
|
-
await (0,
|
|
935249
|
+
await (0, import_promises125.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
935211
935250
|
}
|
|
935212
935251
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
935213
935252
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
935214
|
-
await (0,
|
|
935253
|
+
await (0, import_promises125.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
935215
935254
|
}
|
|
935216
935255
|
|
|
935217
935256
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -935401,7 +935440,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
935401
935440
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
935402
935441
|
init_lib4();
|
|
935403
935442
|
init_lib6();
|
|
935404
|
-
var
|
|
935443
|
+
var import_promises126 = require("fs/promises");
|
|
935405
935444
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
935406
935445
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
935407
935446
|
const formatted = await formatDefinitionFile({
|
|
@@ -935409,7 +935448,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
935409
935448
|
});
|
|
935410
935449
|
if (formatted !== file4.rawContents) {
|
|
935411
935450
|
if (shouldFix) {
|
|
935412
|
-
await (0,
|
|
935451
|
+
await (0, import_promises126.writeFile)(file4.absoluteFilePath, formatted);
|
|
935413
935452
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
935414
935453
|
} else {
|
|
935415
935454
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -935422,7 +935461,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
935422
935461
|
// ../init/lib/createWorkspace.js
|
|
935423
935462
|
init_lib8();
|
|
935424
935463
|
init_lib6();
|
|
935425
|
-
var
|
|
935464
|
+
var import_promises127 = require("fs/promises");
|
|
935426
935465
|
init_js_yaml();
|
|
935427
935466
|
|
|
935428
935467
|
// ../init/lib/sampleImdbApi.js
|
|
@@ -935623,7 +935662,7 @@ components:
|
|
|
935623
935662
|
// ../init/lib/createWorkspace.js
|
|
935624
935663
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
935625
935664
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
935626
|
-
await (0,
|
|
935665
|
+
await (0, import_promises127.mkdir)(directoryOfWorkspace);
|
|
935627
935666
|
}
|
|
935628
935667
|
await writeGeneratorsConfiguration({
|
|
935629
935668
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -935638,7 +935677,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
935638
935677
|
}
|
|
935639
935678
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
935640
935679
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
935641
|
-
await (0,
|
|
935680
|
+
await (0, import_promises127.mkdir)(directoryOfWorkspace);
|
|
935642
935681
|
}
|
|
935643
935682
|
await writeGeneratorsConfiguration({
|
|
935644
935683
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -935651,10 +935690,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
935651
935690
|
}
|
|
935652
935691
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
935653
935692
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
935654
|
-
await (0,
|
|
935693
|
+
await (0, import_promises127.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
935655
935694
|
}
|
|
935656
935695
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
935657
|
-
await (0,
|
|
935696
|
+
await (0, import_promises127.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
935658
935697
|
await writeGeneratorsConfiguration({
|
|
935659
935698
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
935660
935699
|
cliVersion,
|
|
@@ -935699,7 +935738,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
935699
935738
|
return config5;
|
|
935700
935739
|
}
|
|
935701
935740
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
935702
|
-
await (0,
|
|
935741
|
+
await (0, import_promises127.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
935703
935742
|
sortKeys: (a3, b8) => {
|
|
935704
935743
|
if (a3 === "api") {
|
|
935705
935744
|
return -1;
|
|
@@ -935718,8 +935757,8 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
935718
935757
|
strategy: "status-code"
|
|
935719
935758
|
}
|
|
935720
935759
|
};
|
|
935721
|
-
await (0,
|
|
935722
|
-
await (0,
|
|
935760
|
+
await (0, import_promises127.mkdir)(directoryOfDefinition);
|
|
935761
|
+
await (0, import_promises127.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
935723
935762
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
935724
935763
|
let formattedContent;
|
|
935725
935764
|
try {
|
|
@@ -935735,7 +935774,7 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
935735
935774
|
code: CliError.Code.ParseError
|
|
935736
935775
|
});
|
|
935737
935776
|
}
|
|
935738
|
-
await (0,
|
|
935777
|
+
await (0, import_promises127.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
935739
935778
|
}
|
|
935740
935779
|
|
|
935741
935780
|
// ../init/lib/initializeAPI.js
|
|
@@ -935786,7 +935825,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
935786
935825
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
935787
935826
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
935788
935827
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
935789
|
-
await (0,
|
|
935828
|
+
await (0, import_promises128.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
935790
935829
|
if (inlinedApiDefinition) {
|
|
935791
935830
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
935792
935831
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -935823,7 +935862,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
935823
935862
|
// ../init/lib/initializeDocs.js
|
|
935824
935863
|
init_lib4();
|
|
935825
935864
|
init_lib8();
|
|
935826
|
-
var
|
|
935865
|
+
var import_promises129 = require("fs/promises");
|
|
935827
935866
|
init_js_yaml();
|
|
935828
935867
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
935829
935868
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
@@ -935839,7 +935878,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
935839
935878
|
} else {
|
|
935840
935879
|
try {
|
|
935841
935880
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
935842
|
-
await (0,
|
|
935881
|
+
await (0, import_promises129.writeFile)(docsYmlPath, jsYaml.dump(docsConfig));
|
|
935843
935882
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
935844
935883
|
return;
|
|
935845
935884
|
} catch (writeError) {
|
|
@@ -935895,7 +935934,7 @@ var FernDocsBuilder = class {
|
|
|
935895
935934
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
935896
935935
|
init_lib8();
|
|
935897
935936
|
init_lib6();
|
|
935898
|
-
var
|
|
935937
|
+
var import_promises130 = require("fs/promises");
|
|
935899
935938
|
init_js_yaml();
|
|
935900
935939
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
935901
935940
|
openApiSpecs = {};
|
|
@@ -935955,7 +935994,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
935955
935994
|
}
|
|
935956
935995
|
async build({ outputDirectory }) {
|
|
935957
935996
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
935958
|
-
await (0,
|
|
935997
|
+
await (0, import_promises130.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
935959
935998
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
935960
935999
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value2]) => {
|
|
935961
936000
|
return [value2.tabId, value2.tabConfig];
|
|
@@ -935980,27 +936019,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
935980
936019
|
}))
|
|
935981
936020
|
};
|
|
935982
936021
|
}
|
|
935983
|
-
await (0,
|
|
936022
|
+
await (0, import_promises130.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), jsYaml.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
935984
936023
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
935985
936024
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
935986
|
-
await (0,
|
|
935987
|
-
await (0,
|
|
936025
|
+
await (0, import_promises130.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
936026
|
+
await (0, import_promises130.cp)(absolutePath, absolutePathToOpenAPI);
|
|
935988
936027
|
}));
|
|
935989
936028
|
}
|
|
935990
|
-
await (0,
|
|
936029
|
+
await (0, import_promises130.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), jsYaml.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
935991
936030
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
935992
936031
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
935993
|
-
await (0,
|
|
936032
|
+
await (0, import_promises130.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
935994
936033
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
935995
936034
|
${jsYaml.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
935996
936035
|
|
|
935997
936036
|
` : "";
|
|
935998
|
-
await (0,
|
|
936037
|
+
await (0, import_promises130.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
935999
936038
|
}));
|
|
936000
936039
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
936001
936040
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
936002
|
-
await (0,
|
|
936003
|
-
await (0,
|
|
936041
|
+
await (0, import_promises130.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
936042
|
+
await (0, import_promises130.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
936004
936043
|
}));
|
|
936005
936044
|
}
|
|
936006
936045
|
setInstance({ companyName }) {
|
|
@@ -936034,7 +936073,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
936034
936073
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
936035
936074
|
init_lib8();
|
|
936036
936075
|
init_lib6();
|
|
936037
|
-
var
|
|
936076
|
+
var import_promises132 = require("fs/promises");
|
|
936038
936077
|
|
|
936039
936078
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
936040
936079
|
function convertColors(colors19) {
|
|
@@ -936095,10 +936134,10 @@ init_lib8();
|
|
|
936095
936134
|
|
|
936096
936135
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
936097
936136
|
init_lib8();
|
|
936098
|
-
var
|
|
936137
|
+
var import_promises131 = require("fs/promises");
|
|
936099
936138
|
var import_gray_matter10 = __toESM(require_gray_matter(), 1);
|
|
936100
936139
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
936101
|
-
const text9 = await (0,
|
|
936140
|
+
const text9 = await (0, import_promises131.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
936102
936141
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
936103
936142
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
936104
936143
|
const transformedContent = markReferencedAssets({
|
|
@@ -936261,7 +936300,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
936261
936300
|
documentationTab = void 0;
|
|
936262
936301
|
tabUrlToInfo = {};
|
|
936263
936302
|
async import({ args, builder }) {
|
|
936264
|
-
const mintJsonContent = await (0,
|
|
936303
|
+
const mintJsonContent = await (0, import_promises132.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
936265
936304
|
const mint = JSON.parse(mintJsonContent);
|
|
936266
936305
|
builder.setTitle({ title: mint.name });
|
|
936267
936306
|
const relativePathToFavicon = RelativeFilePath2.of(mint.favicon.substring(1));
|
|
@@ -936387,7 +936426,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
936387
936426
|
|
|
936388
936427
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
936389
936428
|
init_lib8();
|
|
936390
|
-
var
|
|
936429
|
+
var import_promises133 = require("fs/promises");
|
|
936391
936430
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
936392
936431
|
const mintlifyImporter = new MintlifyImporter({
|
|
936393
936432
|
context: taskContext
|
|
@@ -936398,7 +936437,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
936398
936437
|
builder
|
|
936399
936438
|
});
|
|
936400
936439
|
await builder.build({ outputDirectory: outputPath });
|
|
936401
|
-
await (0,
|
|
936440
|
+
await (0, import_promises133.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
936402
936441
|
version: versionOfCli,
|
|
936403
936442
|
organization
|
|
936404
936443
|
}, void 0, 4));
|
|
@@ -936459,7 +936498,7 @@ function assertIsStringArray(val) {
|
|
|
936459
936498
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
936460
936499
|
init_lib4();
|
|
936461
936500
|
init_lib8();
|
|
936462
|
-
var
|
|
936501
|
+
var import_promises138 = require("fs/promises");
|
|
936463
936502
|
|
|
936464
936503
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
936465
936504
|
init_unist_util_visit();
|
|
@@ -947934,7 +947973,7 @@ init_disposable();
|
|
|
947934
947973
|
init_incremental_id_generator();
|
|
947935
947974
|
|
|
947936
947975
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js
|
|
947937
|
-
var
|
|
947976
|
+
var import_promises136 = require("fs/promises");
|
|
947938
947977
|
var import_node_os11 = __toESM(require("os"), 1);
|
|
947939
947978
|
var import_node_path36 = __toESM(require("path"), 1);
|
|
947940
947979
|
init_main();
|
|
@@ -948378,7 +948417,7 @@ var ChromeLauncher = class extends BrowserLauncher {
|
|
|
948378
948417
|
});
|
|
948379
948418
|
if (userDataDirIndex < 0) {
|
|
948380
948419
|
isTempUserDataDir = true;
|
|
948381
|
-
chromeArguments.push(`--user-data-dir=${await (0,
|
|
948420
|
+
chromeArguments.push(`--user-data-dir=${await (0, import_promises136.mkdtemp)(this.getProfilePath())}`);
|
|
948382
948421
|
userDataDirIndex = chromeArguments.length - 1;
|
|
948383
948422
|
}
|
|
948384
948423
|
const userDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
@@ -948535,7 +948574,7 @@ function removeMatchingFlags(array3, flag) {
|
|
|
948535
948574
|
|
|
948536
948575
|
// ../../../node_modules/.pnpm/puppeteer-core@24.40.0/node_modules/puppeteer-core/lib/esm/puppeteer/node/FirefoxLauncher.js
|
|
948537
948576
|
var import_node_fs28 = __toESM(require("fs"), 1);
|
|
948538
|
-
var
|
|
948577
|
+
var import_promises137 = require("fs/promises");
|
|
948539
948578
|
var import_node_os12 = __toESM(require("os"), 1);
|
|
948540
948579
|
var import_node_path37 = __toESM(require("path"), 1);
|
|
948541
948580
|
init_main();
|
|
@@ -948589,7 +948628,7 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
948589
948628
|
}
|
|
948590
948629
|
isTempUserDataDir = false;
|
|
948591
948630
|
} else {
|
|
948592
|
-
userDataDir = await (0,
|
|
948631
|
+
userDataDir = await (0, import_promises137.mkdtemp)(this.getProfilePath());
|
|
948593
948632
|
firefoxArguments.push("--profile");
|
|
948594
948633
|
firefoxArguments.push(userDataDir);
|
|
948595
948634
|
}
|
|
@@ -948630,8 +948669,8 @@ var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
|
948630
948669
|
const prefsBackupPath = import_node_path37.default.join(userDataDir, file4 + backupSuffix);
|
|
948631
948670
|
if (import_node_fs28.default.existsSync(prefsBackupPath)) {
|
|
948632
948671
|
const prefsPath = import_node_path37.default.join(userDataDir, file4);
|
|
948633
|
-
await (0,
|
|
948634
|
-
await (0,
|
|
948672
|
+
await (0, import_promises137.unlink)(prefsPath);
|
|
948673
|
+
await (0, import_promises137.rename)(prefsBackupPath, prefsPath);
|
|
948635
948674
|
}
|
|
948636
948675
|
}));
|
|
948637
948676
|
for (const result of results) {
|
|
@@ -949676,7 +949715,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949676
949715
|
if (response.ok) {
|
|
949677
949716
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
949678
949717
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
949679
|
-
await (0,
|
|
949718
|
+
await (0, import_promises138.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
949680
949719
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
949681
949720
|
}
|
|
949682
949721
|
}
|
|
@@ -949693,7 +949732,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949693
949732
|
*/
|
|
949694
949733
|
async getAndCreateAssetsDirectory() {
|
|
949695
949734
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
949696
|
-
await (0,
|
|
949735
|
+
await (0, import_promises138.mkdir)(assetsDirectory, { recursive: true });
|
|
949697
949736
|
return assetsDirectory;
|
|
949698
949737
|
}
|
|
949699
949738
|
/**
|
|
@@ -949743,7 +949782,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949743
949782
|
absolutePathToOutputDirectory,
|
|
949744
949783
|
section
|
|
949745
949784
|
});
|
|
949746
|
-
await (0,
|
|
949785
|
+
await (0, import_promises138.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
949747
949786
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
949748
949787
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
949749
949788
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -949758,7 +949797,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949758
949797
|
absolutePathToOutputDirectoryForSection,
|
|
949759
949798
|
page: page.slug
|
|
949760
949799
|
});
|
|
949761
|
-
await (0,
|
|
949800
|
+
await (0, import_promises138.writeFile)(absolutePathForPage, result.data.mdx);
|
|
949762
949801
|
if (result.data.images.imageURLs.length > 0) {
|
|
949763
949802
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
949764
949803
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -949771,8 +949810,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949771
949810
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
949772
949811
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
949773
949812
|
const imageDir = dirname6(imagePath);
|
|
949774
|
-
await (0,
|
|
949775
|
-
await (0,
|
|
949813
|
+
await (0, import_promises138.mkdir)(imageDir, { recursive: true });
|
|
949814
|
+
await (0, import_promises138.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
949776
949815
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
949777
949816
|
} catch (error50) {
|
|
949778
949817
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -949855,7 +949894,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
949855
949894
|
|
|
949856
949895
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
949857
949896
|
init_lib8();
|
|
949858
|
-
var
|
|
949897
|
+
var import_promises139 = require("fs/promises");
|
|
949859
949898
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
949860
949899
|
const builder = new FernDocsBuilderImpl();
|
|
949861
949900
|
builder.setInstance({ companyName: organization });
|
|
@@ -949870,7 +949909,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
949870
949909
|
builder
|
|
949871
949910
|
});
|
|
949872
949911
|
await builder.build({ outputDirectory: outputPath });
|
|
949873
|
-
await (0,
|
|
949912
|
+
await (0, import_promises139.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
949874
949913
|
version: versionOfCli,
|
|
949875
949914
|
organization
|
|
949876
949915
|
}, void 0, 4));
|
|
@@ -949896,7 +949935,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
949896
949935
|
};
|
|
949897
949936
|
|
|
949898
949937
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
949899
|
-
var
|
|
949938
|
+
var import_promises140 = require("fs/promises");
|
|
949900
949939
|
init_js_yaml();
|
|
949901
949940
|
var import_path100 = require("path");
|
|
949902
949941
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
@@ -949912,7 +949951,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
949912
949951
|
const filePath = (0, import_path100.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
949913
949952
|
logger4.debug("tmpDir", tmpDir.path);
|
|
949914
949953
|
logger4.debug("filePath", filePath);
|
|
949915
|
-
await (0,
|
|
949954
|
+
await (0, import_promises140.writeFile)(filePath, data2);
|
|
949916
949955
|
return {
|
|
949917
949956
|
status: LoadOpenAPIStatus.Success,
|
|
949918
949957
|
filePath
|
|
@@ -953790,7 +953829,7 @@ function getAutomationContextFromEnv() {
|
|
|
953790
953829
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
953791
953830
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
953792
953831
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
953793
|
-
cli_version: "5.33.
|
|
953832
|
+
cli_version: "5.33.2"
|
|
953794
953833
|
};
|
|
953795
953834
|
}
|
|
953796
953835
|
function isAutomationMode() {
|
|
@@ -954616,7 +954655,7 @@ var CliContext = class _CliContext {
|
|
|
954616
954655
|
if (false) {
|
|
954617
954656
|
this.logger.error("CLI_VERSION is not defined");
|
|
954618
954657
|
}
|
|
954619
|
-
return "5.33.
|
|
954658
|
+
return "5.33.2";
|
|
954620
954659
|
}
|
|
954621
954660
|
getCliName() {
|
|
954622
954661
|
if (false) {
|
|
@@ -954924,7 +954963,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
954924
954963
|
// ../project-loader/lib/loadProject.js
|
|
954925
954964
|
init_lib8();
|
|
954926
954965
|
init_lib6();
|
|
954927
|
-
var
|
|
954966
|
+
var import_promises141 = require("fs/promises");
|
|
954928
954967
|
|
|
954929
954968
|
// ../project-loader/lib/normalizeCommandLineApiWorkspace.js
|
|
954930
954969
|
function normalizeCommandLineApiWorkspace(input3) {
|
|
@@ -955006,7 +955045,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
955006
955045
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
955007
955046
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
955008
955047
|
if (apisDirectoryExists) {
|
|
955009
|
-
const apiDirectoryContents = await (0,
|
|
955048
|
+
const apiDirectoryContents = await (0, import_promises141.readdir)(apisDirectory, { withFileTypes: true });
|
|
955010
955049
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
955011
955050
|
if (item.isDirectory()) {
|
|
955012
955051
|
all9.push(item.name);
|
|
@@ -955083,12 +955122,12 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
955083
955122
|
// src/cliV2.ts
|
|
955084
955123
|
init_lib6();
|
|
955085
955124
|
var import_generators_sdk6 = __toESM(require_generators_sdk(), 1);
|
|
955086
|
-
var
|
|
955125
|
+
var import_promises146 = require("fs/promises");
|
|
955087
955126
|
|
|
955088
955127
|
// src/commands/generator-list/getGeneratorList.ts
|
|
955089
955128
|
init_lib4();
|
|
955090
955129
|
init_lib6();
|
|
955091
|
-
var
|
|
955130
|
+
var import_promises142 = require("fs/promises");
|
|
955092
955131
|
init_js_yaml();
|
|
955093
955132
|
var GenerationModeFilter = {
|
|
955094
955133
|
GitHub: "github",
|
|
@@ -955149,7 +955188,7 @@ async function getGeneratorList({
|
|
|
955149
955188
|
return;
|
|
955150
955189
|
}
|
|
955151
955190
|
try {
|
|
955152
|
-
await (0,
|
|
955191
|
+
await (0, import_promises142.writeFile)(outputLocation, generatorsListYaml);
|
|
955153
955192
|
} catch (error50) {
|
|
955154
955193
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
955155
955194
|
code: CliError.Code.ConfigError
|
|
@@ -955218,7 +955257,7 @@ async function getGeneratorMetadata({
|
|
|
955218
955257
|
|
|
955219
955258
|
// src/commands/organization/getOrganization.ts
|
|
955220
955259
|
init_lib6();
|
|
955221
|
-
var
|
|
955260
|
+
var import_promises143 = require("fs/promises");
|
|
955222
955261
|
async function getOrganization({
|
|
955223
955262
|
project,
|
|
955224
955263
|
outputLocation,
|
|
@@ -955230,7 +955269,7 @@ async function getOrganization({
|
|
|
955230
955269
|
return;
|
|
955231
955270
|
}
|
|
955232
955271
|
try {
|
|
955233
|
-
await (0,
|
|
955272
|
+
await (0, import_promises143.writeFile)(outputLocation, org);
|
|
955234
955273
|
} catch (error50) {
|
|
955235
955274
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
955236
955275
|
code: CliError.Code.ConfigError
|
|
@@ -955241,7 +955280,7 @@ async function getOrganization({
|
|
|
955241
955280
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
955242
955281
|
init_lib8();
|
|
955243
955282
|
init_lib6();
|
|
955244
|
-
var
|
|
955283
|
+
var import_promises145 = require("fs/promises");
|
|
955245
955284
|
var import_path102 = __toESM(require("path"), 1);
|
|
955246
955285
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
955247
955286
|
var import_yaml6 = __toESM(require_dist11(), 1);
|
|
@@ -955251,7 +955290,7 @@ init_lib4();
|
|
|
955251
955290
|
init_lib12();
|
|
955252
955291
|
init_lib6();
|
|
955253
955292
|
var import_fs39 = require("fs");
|
|
955254
|
-
var
|
|
955293
|
+
var import_promises144 = require("fs/promises");
|
|
955255
955294
|
var import_os15 = require("os");
|
|
955256
955295
|
var import_path101 = require("path");
|
|
955257
955296
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -955279,7 +955318,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
955279
955318
|
const myPid = String(process.pid);
|
|
955280
955319
|
while (true) {
|
|
955281
955320
|
try {
|
|
955282
|
-
const fh = await (0,
|
|
955321
|
+
const fh = await (0, import_promises144.open)(lockPath, "wx");
|
|
955283
955322
|
await fh.writeFile(myPid);
|
|
955284
955323
|
await fh.close();
|
|
955285
955324
|
const exitHandler = () => {
|
|
@@ -955296,9 +955335,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
955296
955335
|
return async () => {
|
|
955297
955336
|
process.removeListener("exit", exitHandler);
|
|
955298
955337
|
try {
|
|
955299
|
-
const currentContent = await (0,
|
|
955338
|
+
const currentContent = await (0, import_promises144.readFile)(lockPath, "utf-8");
|
|
955300
955339
|
if (currentContent.trim() === myPid) {
|
|
955301
|
-
await (0,
|
|
955340
|
+
await (0, import_promises144.unlink)(lockPath);
|
|
955302
955341
|
} else {
|
|
955303
955342
|
logger4.debug(
|
|
955304
955343
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -955314,14 +955353,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
955314
955353
|
throw err;
|
|
955315
955354
|
}
|
|
955316
955355
|
try {
|
|
955317
|
-
const lockContent = await (0,
|
|
955356
|
+
const lockContent = await (0, import_promises144.readFile)(lockPath, "utf-8");
|
|
955318
955357
|
const lockPid = Number(lockContent.trim());
|
|
955319
|
-
const lockStat = await (0,
|
|
955358
|
+
const lockStat = await (0, import_promises144.stat)(lockPath);
|
|
955320
955359
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
955321
955360
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
955322
955361
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
955323
955362
|
try {
|
|
955324
|
-
await (0,
|
|
955363
|
+
await (0, import_promises144.unlink)(lockPath);
|
|
955325
955364
|
} catch (unlinkErr) {
|
|
955326
955365
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
955327
955366
|
}
|
|
@@ -955345,7 +955384,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
955345
955384
|
}
|
|
955346
955385
|
migrationsInstallPromise = (async () => {
|
|
955347
955386
|
const cacheDir = getMigrationCacheDir();
|
|
955348
|
-
await (0,
|
|
955387
|
+
await (0, import_promises144.mkdir)(cacheDir, { recursive: true });
|
|
955349
955388
|
const npmCacheDir = (0, import_path101.join)(cacheDir, ".npm-cache");
|
|
955350
955389
|
const packageDir = (0, import_path101.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
955351
955390
|
const packageJsonPath = (0, import_path101.join)(packageDir, "package.json");
|
|
@@ -955362,7 +955401,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
955362
955401
|
"--no-audit",
|
|
955363
955402
|
"--no-fund"
|
|
955364
955403
|
]);
|
|
955365
|
-
const packageJsonContent = await (0,
|
|
955404
|
+
const packageJsonContent = await (0, import_promises144.readFile)(packageJsonPath, "utf-8");
|
|
955366
955405
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
955367
955406
|
if (packageJson2.main == null) {
|
|
955368
955407
|
throw new CliError({
|
|
@@ -955546,7 +955585,7 @@ async function loadAndUpdateGenerators({
|
|
|
955546
955585
|
skippedAutoreleaseDisabled: []
|
|
955547
955586
|
};
|
|
955548
955587
|
}
|
|
955549
|
-
const contents = await (0,
|
|
955588
|
+
const contents = await (0, import_promises145.readFile)(filepath);
|
|
955550
955589
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
955551
955590
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
955552
955591
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -955783,7 +955822,7 @@ async function upgradeGenerator({
|
|
|
955783
955822
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
955784
955823
|
});
|
|
955785
955824
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
955786
|
-
await (0,
|
|
955825
|
+
await (0, import_promises145.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
955787
955826
|
}
|
|
955788
955827
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
955789
955828
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -956183,7 +956222,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
956183
956222
|
}
|
|
956184
956223
|
if (argv.output) {
|
|
956185
956224
|
try {
|
|
956186
|
-
await (0,
|
|
956225
|
+
await (0, import_promises146.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
956187
956226
|
} catch (error50) {
|
|
956188
956227
|
cliContext.failAndThrow(
|
|
956189
956228
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -956198,7 +956237,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
956198
956237
|
}
|
|
956199
956238
|
|
|
956200
956239
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
956201
|
-
var
|
|
956240
|
+
var import_promises147 = require("fs/promises");
|
|
956202
956241
|
init_js_yaml();
|
|
956203
956242
|
async function addGeneratorToWorkspaces({
|
|
956204
956243
|
project: { apiWorkspaces },
|
|
@@ -956226,7 +956265,7 @@ async function addGeneratorToWorkspaces({
|
|
|
956226
956265
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
956227
956266
|
return;
|
|
956228
956267
|
}
|
|
956229
|
-
await (0,
|
|
956268
|
+
await (0, import_promises147.writeFile)(
|
|
956230
956269
|
absolutePathToGeneratorsConfiguration,
|
|
956231
956270
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + jsYaml.dump(newConfiguration)
|
|
956232
956271
|
);
|
|
@@ -956293,11 +956332,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
956293
956332
|
|
|
956294
956333
|
// src/commands/generate/checkOutputDirectory.ts
|
|
956295
956334
|
init_lib8();
|
|
956296
|
-
var
|
|
956335
|
+
var import_promises150 = require("fs/promises");
|
|
956297
956336
|
|
|
956298
956337
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
956299
956338
|
init_lib8();
|
|
956300
|
-
var
|
|
956339
|
+
var import_promises148 = require("fs/promises");
|
|
956301
956340
|
|
|
956302
956341
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
956303
956342
|
init_lib8();
|
|
@@ -956317,17 +956356,17 @@ async function getOutputDirectories() {
|
|
|
956317
956356
|
if (!doesOutputDirectoriesFileExist) {
|
|
956318
956357
|
return [];
|
|
956319
956358
|
}
|
|
956320
|
-
const outputDirectoriesFileContents = await (0,
|
|
956359
|
+
const outputDirectoriesFileContents = await (0, import_promises148.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
956321
956360
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
956322
956361
|
return outputDirectories;
|
|
956323
956362
|
}
|
|
956324
956363
|
|
|
956325
956364
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
956326
|
-
var
|
|
956365
|
+
var import_promises149 = require("fs/promises");
|
|
956327
956366
|
var import_path103 = __toESM(require("path"), 1);
|
|
956328
956367
|
async function storeOutputDirectories(outputDirectories) {
|
|
956329
|
-
await (0,
|
|
956330
|
-
await (0,
|
|
956368
|
+
await (0, import_promises149.mkdir)(import_path103.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
956369
|
+
await (0, import_promises149.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
956331
956370
|
}
|
|
956332
956371
|
|
|
956333
956372
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -956349,7 +956388,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
956349
956388
|
shouldProceed: true
|
|
956350
956389
|
};
|
|
956351
956390
|
}
|
|
956352
|
-
const files = await (0,
|
|
956391
|
+
const files = await (0, import_promises150.readdir)(outputPath);
|
|
956353
956392
|
if (files.length === 0) {
|
|
956354
956393
|
return {
|
|
956355
956394
|
shouldProceed: true
|
|
@@ -957315,7 +957354,7 @@ function renderOverflowWarning(failureCount) {
|
|
|
957315
957354
|
// src/commands/automations/generate/reportGenerateResults.ts
|
|
957316
957355
|
init_lib4();
|
|
957317
957356
|
var import_fs40 = require("fs");
|
|
957318
|
-
var
|
|
957357
|
+
var import_promises151 = require("fs/promises");
|
|
957319
957358
|
var JSON_SCHEMA_VERSION = 1;
|
|
957320
957359
|
function renderStdoutSummary(results) {
|
|
957321
957360
|
return formatCounts(countResults(results));
|
|
@@ -957505,12 +957544,12 @@ async function writeResults({
|
|
|
957505
957544
|
const stepSummaryPath = getGithubStepSummaryPath();
|
|
957506
957545
|
if (stepSummaryPath != null) {
|
|
957507
957546
|
try {
|
|
957508
|
-
await (0,
|
|
957547
|
+
await (0, import_promises151.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
957509
957548
|
} catch {
|
|
957510
957549
|
}
|
|
957511
957550
|
}
|
|
957512
957551
|
if (jsonOutputPath != null) {
|
|
957513
|
-
await (0,
|
|
957552
|
+
await (0, import_promises151.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
957514
957553
|
}
|
|
957515
957554
|
}
|
|
957516
957555
|
function writeResultsSync({
|
|
@@ -957834,14 +957873,14 @@ function listPreviewGroups({
|
|
|
957834
957873
|
|
|
957835
957874
|
// src/commands/automations/upgrade/executeAutomationsUpgrade.ts
|
|
957836
957875
|
init_lib6();
|
|
957837
|
-
var
|
|
957876
|
+
var import_promises180 = require("fs/promises");
|
|
957838
957877
|
|
|
957839
957878
|
// ../cli-migrations/lib/runMigrations.js
|
|
957840
957879
|
init_lib4();
|
|
957841
957880
|
init_lib6();
|
|
957842
957881
|
|
|
957843
957882
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
957844
|
-
var
|
|
957883
|
+
var import_promises152 = require("fs/promises");
|
|
957845
957884
|
|
|
957846
957885
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
957847
957886
|
init_lib8();
|
|
@@ -957877,7 +957916,7 @@ var migration = {
|
|
|
957877
957916
|
try {
|
|
957878
957917
|
const fileContents = await getFileContents(yamlFilepath);
|
|
957879
957918
|
const newContents = addDiscriminantToFile(fileContents);
|
|
957880
|
-
await (0,
|
|
957919
|
+
await (0, import_promises152.writeFile)(yamlFilepath, newContents);
|
|
957881
957920
|
} catch (error50) {
|
|
957882
957921
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
957883
957922
|
}
|
|
@@ -957885,7 +957924,7 @@ var migration = {
|
|
|
957885
957924
|
}
|
|
957886
957925
|
};
|
|
957887
957926
|
async function getFileContents(filepath) {
|
|
957888
|
-
const buffer = await (0,
|
|
957927
|
+
const buffer = await (0, import_promises152.readFile)(filepath);
|
|
957889
957928
|
return buffer.toString();
|
|
957890
957929
|
}
|
|
957891
957930
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -957914,7 +957953,7 @@ var versionMigrations = {
|
|
|
957914
957953
|
var __default = versionMigrations;
|
|
957915
957954
|
|
|
957916
957955
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
957917
|
-
var
|
|
957956
|
+
var import_promises153 = require("fs/promises");
|
|
957918
957957
|
var import_yaml7 = __toESM(require_dist11(), 1);
|
|
957919
957958
|
|
|
957920
957959
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -957957,7 +957996,7 @@ var migration2 = {
|
|
|
957957
957996
|
}
|
|
957958
957997
|
};
|
|
957959
957998
|
async function migrateFile(filepath, context3) {
|
|
957960
|
-
const contents = await (0,
|
|
957999
|
+
const contents = await (0, import_promises153.readFile)(filepath);
|
|
957961
958000
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
957962
958001
|
const types4 = parsedDocument.get("types");
|
|
957963
958002
|
if (types4 == null) {
|
|
@@ -957989,7 +958028,7 @@ async function migrateFile(filepath, context3) {
|
|
|
957989
958028
|
}
|
|
957990
958029
|
}
|
|
957991
958030
|
}
|
|
957992
|
-
await (0,
|
|
958031
|
+
await (0, import_promises153.writeFile)(filepath, parsedDocument.toString());
|
|
957993
958032
|
}
|
|
957994
958033
|
|
|
957995
958034
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -958000,7 +958039,7 @@ var versionMigrations2 = {
|
|
|
958000
958039
|
var __default2 = versionMigrations2;
|
|
958001
958040
|
|
|
958002
958041
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
958003
|
-
var
|
|
958042
|
+
var import_promises154 = require("fs/promises");
|
|
958004
958043
|
var import_yaml8 = __toESM(require_dist11(), 1);
|
|
958005
958044
|
|
|
958006
958045
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -958043,7 +958082,7 @@ var migration3 = {
|
|
|
958043
958082
|
}
|
|
958044
958083
|
};
|
|
958045
958084
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
958046
|
-
const contents = await (0,
|
|
958085
|
+
const contents = await (0, import_promises154.readFile)(filepath);
|
|
958047
958086
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
958048
958087
|
const draftGenerators = parsedDocument.get("draft");
|
|
958049
958088
|
if (draftGenerators == null) {
|
|
@@ -958070,7 +958109,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
958070
958109
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
958071
958110
|
}
|
|
958072
958111
|
});
|
|
958073
|
-
await (0,
|
|
958112
|
+
await (0, import_promises154.writeFile)(filepath, parsedDocument.toString());
|
|
958074
958113
|
}
|
|
958075
958114
|
|
|
958076
958115
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -958081,7 +958120,7 @@ var versionMigrations3 = {
|
|
|
958081
958120
|
var __default3 = versionMigrations3;
|
|
958082
958121
|
|
|
958083
958122
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
958084
|
-
var
|
|
958123
|
+
var import_promises155 = require("fs/promises");
|
|
958085
958124
|
var import_yaml9 = __toESM(require_dist11(), 1);
|
|
958086
958125
|
|
|
958087
958126
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -958124,7 +958163,7 @@ var migration4 = {
|
|
|
958124
958163
|
}
|
|
958125
958164
|
};
|
|
958126
958165
|
async function migrateFile2(filepath, context3) {
|
|
958127
|
-
const contents = await (0,
|
|
958166
|
+
const contents = await (0, import_promises155.readFile)(filepath);
|
|
958128
958167
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
958129
958168
|
const addType = (typeName, typeDeclaration2) => {
|
|
958130
958169
|
const types4 = parsedDocument.get("types");
|
|
@@ -958168,7 +958207,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
958168
958207
|
}
|
|
958169
958208
|
}
|
|
958170
958209
|
}
|
|
958171
|
-
await (0,
|
|
958210
|
+
await (0, import_promises155.writeFile)(filepath, parsedDocument.toString());
|
|
958172
958211
|
}
|
|
958173
958212
|
|
|
958174
958213
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -958179,7 +958218,7 @@ var versionMigrations4 = {
|
|
|
958179
958218
|
var __default4 = versionMigrations4;
|
|
958180
958219
|
|
|
958181
958220
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
958182
|
-
var
|
|
958221
|
+
var import_promises156 = require("fs/promises");
|
|
958183
958222
|
var import_yaml10 = __toESM(require_dist11(), 1);
|
|
958184
958223
|
|
|
958185
958224
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -958222,7 +958261,7 @@ var migration5 = {
|
|
|
958222
958261
|
}
|
|
958223
958262
|
};
|
|
958224
958263
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
958225
|
-
const contents = await (0,
|
|
958264
|
+
const contents = await (0, import_promises156.readFile)(filepath);
|
|
958226
958265
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
958227
958266
|
const releaseGenerators = parsedDocument.get("release");
|
|
958228
958267
|
if (releaseGenerators == null) {
|
|
@@ -958260,7 +958299,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
958260
958299
|
}
|
|
958261
958300
|
releaseGenerator.delete("outputs");
|
|
958262
958301
|
});
|
|
958263
|
-
await (0,
|
|
958302
|
+
await (0, import_promises156.writeFile)(filepath, parsedDocument.toString());
|
|
958264
958303
|
}
|
|
958265
958304
|
|
|
958266
958305
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -958271,7 +958310,7 @@ var versionMigrations5 = {
|
|
|
958271
958310
|
var __default5 = versionMigrations5;
|
|
958272
958311
|
|
|
958273
958312
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
958274
|
-
var
|
|
958313
|
+
var import_promises157 = require("fs/promises");
|
|
958275
958314
|
|
|
958276
958315
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
958277
958316
|
init_lib8();
|
|
@@ -958304,9 +958343,9 @@ var migration6 = {
|
|
|
958304
958343
|
run: async ({ context: context3 }) => {
|
|
958305
958344
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
958306
958345
|
for (const filepath of yamlFiles) {
|
|
958307
|
-
const contents = await (0,
|
|
958346
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
958308
958347
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
958309
|
-
await (0,
|
|
958348
|
+
await (0, import_promises157.writeFile)(filepath, newContents);
|
|
958310
958349
|
}
|
|
958311
958350
|
}
|
|
958312
958351
|
};
|
|
@@ -958319,7 +958358,7 @@ var versionMigrations6 = {
|
|
|
958319
958358
|
var __default6 = versionMigrations6;
|
|
958320
958359
|
|
|
958321
958360
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
958322
|
-
var
|
|
958361
|
+
var import_promises158 = require("fs/promises");
|
|
958323
958362
|
|
|
958324
958363
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
958325
958364
|
init_lib8();
|
|
@@ -958352,9 +958391,9 @@ var migration7 = {
|
|
|
958352
958391
|
run: async ({ context: context3 }) => {
|
|
958353
958392
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
958354
958393
|
for (const filepath of yamlFiles) {
|
|
958355
|
-
const contents = await (0,
|
|
958394
|
+
const contents = await (0, import_promises158.readFile)(filepath);
|
|
958356
958395
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
958357
|
-
await (0,
|
|
958396
|
+
await (0, import_promises158.writeFile)(filepath, newContents);
|
|
958358
958397
|
}
|
|
958359
958398
|
}
|
|
958360
958399
|
};
|
|
@@ -958368,7 +958407,7 @@ var __default7 = versionMigrations7;
|
|
|
958368
958407
|
|
|
958369
958408
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
958370
958409
|
init_lib4();
|
|
958371
|
-
var
|
|
958410
|
+
var import_promises159 = require("fs/promises");
|
|
958372
958411
|
init_js_yaml();
|
|
958373
958412
|
|
|
958374
958413
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
@@ -958501,7 +958540,7 @@ var migration8 = {
|
|
|
958501
958540
|
}
|
|
958502
958541
|
};
|
|
958503
958542
|
async function migrateGeneratorsYml3(filepath) {
|
|
958504
|
-
const contentsStr = await (0,
|
|
958543
|
+
const contentsStr = await (0, import_promises159.readFile)(filepath);
|
|
958505
958544
|
const contents = jsYaml.load(contentsStr.toString());
|
|
958506
958545
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
958507
958546
|
let newGeneratorsConfiguration = {};
|
|
@@ -958519,7 +958558,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
958519
958558
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
958520
958559
|
};
|
|
958521
958560
|
}
|
|
958522
|
-
await (0,
|
|
958561
|
+
await (0, import_promises159.writeFile)(filepath, jsYaml.dump(newGeneratorsConfiguration));
|
|
958523
958562
|
}
|
|
958524
958563
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
958525
958564
|
const newSchema = {
|
|
@@ -958594,7 +958633,7 @@ var versionMigrations8 = {
|
|
|
958594
958633
|
var __default8 = versionMigrations8;
|
|
958595
958634
|
|
|
958596
958635
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
958597
|
-
var
|
|
958636
|
+
var import_promises160 = require("fs/promises");
|
|
958598
958637
|
var import_yaml11 = __toESM(require_dist11(), 1);
|
|
958599
958638
|
|
|
958600
958639
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -958637,7 +958676,7 @@ var migration9 = {
|
|
|
958637
958676
|
}
|
|
958638
958677
|
};
|
|
958639
958678
|
async function migrateRootApiFile(filepath) {
|
|
958640
|
-
const contents = await (0,
|
|
958679
|
+
const contents = await (0, import_promises160.readFile)(filepath);
|
|
958641
958680
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
958642
958681
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
958643
958682
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -958648,7 +958687,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
958648
958687
|
"property-name": errorDiscriminant.value
|
|
958649
958688
|
});
|
|
958650
958689
|
parsedDocument.delete("error-discriminant");
|
|
958651
|
-
await (0,
|
|
958690
|
+
await (0, import_promises160.writeFile)(filepath, parsedDocument.toString());
|
|
958652
958691
|
}
|
|
958653
958692
|
|
|
958654
958693
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -958659,7 +958698,7 @@ var versionMigrations9 = {
|
|
|
958659
958698
|
var __default9 = versionMigrations9;
|
|
958660
958699
|
|
|
958661
958700
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
958662
|
-
var
|
|
958701
|
+
var import_promises161 = require("fs/promises");
|
|
958663
958702
|
var import_yaml12 = __toESM(require_dist11(), 1);
|
|
958664
958703
|
|
|
958665
958704
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -958702,7 +958741,7 @@ var migration10 = {
|
|
|
958702
958741
|
}
|
|
958703
958742
|
};
|
|
958704
958743
|
async function migrateYamlFile(filepath, context3) {
|
|
958705
|
-
const contents = await (0,
|
|
958744
|
+
const contents = await (0, import_promises161.readFile)(filepath);
|
|
958706
958745
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
958707
958746
|
const services = parsedDocument.get("services");
|
|
958708
958747
|
if (services == null) {
|
|
@@ -958742,7 +958781,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
958742
958781
|
context3.failWithoutThrowing("Failed to convert endpoint", e8);
|
|
958743
958782
|
}
|
|
958744
958783
|
}
|
|
958745
|
-
await (0,
|
|
958784
|
+
await (0, import_promises161.writeFile)(filepath, parsedDocument.toString());
|
|
958746
958785
|
}
|
|
958747
958786
|
}
|
|
958748
958787
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -958821,7 +958860,7 @@ var versionMigrations10 = {
|
|
|
958821
958860
|
var __default10 = versionMigrations10;
|
|
958822
958861
|
|
|
958823
958862
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
958824
|
-
var
|
|
958863
|
+
var import_promises162 = require("fs/promises");
|
|
958825
958864
|
var import_yaml13 = __toESM(require_dist11(), 1);
|
|
958826
958865
|
|
|
958827
958866
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -958864,7 +958903,7 @@ var migration11 = {
|
|
|
958864
958903
|
}
|
|
958865
958904
|
};
|
|
958866
958905
|
async function migrateYamlFile2(filepath, context3) {
|
|
958867
|
-
const contents = await (0,
|
|
958906
|
+
const contents = await (0, import_promises162.readFile)(filepath);
|
|
958868
958907
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
958869
958908
|
const types4 = parsedDocument.get("types");
|
|
958870
958909
|
if (types4 == null) {
|
|
@@ -958890,7 +958929,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
958890
958929
|
examples.set(i9, { value: value2 });
|
|
958891
958930
|
}
|
|
958892
958931
|
}
|
|
958893
|
-
await (0,
|
|
958932
|
+
await (0, import_promises162.writeFile)(filepath, parsedDocument.toString());
|
|
958894
958933
|
}
|
|
958895
958934
|
|
|
958896
958935
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -958901,7 +958940,7 @@ var versionMigrations11 = {
|
|
|
958901
958940
|
var __default11 = versionMigrations11;
|
|
958902
958941
|
|
|
958903
958942
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
958904
|
-
var
|
|
958943
|
+
var import_promises163 = require("fs/promises");
|
|
958905
958944
|
var import_yaml14 = __toESM(require_dist11(), 1);
|
|
958906
958945
|
|
|
958907
958946
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -958944,7 +958983,7 @@ var migration12 = {
|
|
|
958944
958983
|
}
|
|
958945
958984
|
};
|
|
958946
958985
|
async function migrateYamlFile3(filepath, context3) {
|
|
958947
|
-
const contents = await (0,
|
|
958986
|
+
const contents = await (0, import_promises163.readFile)(filepath);
|
|
958948
958987
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
958949
958988
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
958950
958989
|
return context3.failAndThrow("File is not a map");
|
|
@@ -958974,7 +959013,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
958974
959013
|
pair.value = firstService.value;
|
|
958975
959014
|
}
|
|
958976
959015
|
}
|
|
958977
|
-
await (0,
|
|
959016
|
+
await (0, import_promises163.writeFile)(filepath, parsedDocument.toString());
|
|
958978
959017
|
}
|
|
958979
959018
|
|
|
958980
959019
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -958985,7 +959024,7 @@ var versionMigrations12 = {
|
|
|
958985
959024
|
var __default12 = versionMigrations12;
|
|
958986
959025
|
|
|
958987
959026
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
958988
|
-
var
|
|
959027
|
+
var import_promises164 = require("fs/promises");
|
|
958989
959028
|
var import_yaml15 = __toESM(require_dist11(), 1);
|
|
958990
959029
|
|
|
958991
959030
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -959028,7 +959067,7 @@ var migration13 = {
|
|
|
959028
959067
|
}
|
|
959029
959068
|
};
|
|
959030
959069
|
async function migrateYamlFile4(filepath, context3) {
|
|
959031
|
-
const contents = await (0,
|
|
959070
|
+
const contents = await (0, import_promises164.readFile)(filepath);
|
|
959032
959071
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
959033
959072
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
959034
959073
|
return context3.failAndThrow("File is not a map");
|
|
@@ -959047,7 +959086,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
959047
959086
|
}
|
|
959048
959087
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
959049
959088
|
parsedDocument.contents.items.unshift(docsPair);
|
|
959050
|
-
await (0,
|
|
959089
|
+
await (0, import_promises164.writeFile)(filepath, parsedDocument.toString());
|
|
959051
959090
|
}
|
|
959052
959091
|
|
|
959053
959092
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -959058,7 +959097,7 @@ var versionMigrations13 = {
|
|
|
959058
959097
|
var __default13 = versionMigrations13;
|
|
959059
959098
|
|
|
959060
959099
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
959061
|
-
var
|
|
959100
|
+
var import_promises165 = require("fs/promises");
|
|
959062
959101
|
|
|
959063
959102
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
959064
959103
|
init_lib8();
|
|
@@ -959100,14 +959139,14 @@ var migration14 = {
|
|
|
959100
959139
|
}
|
|
959101
959140
|
};
|
|
959102
959141
|
async function migrateYamlFile5(filepath) {
|
|
959103
|
-
const contents = await (0,
|
|
959142
|
+
const contents = await (0, import_promises165.readFile)(filepath);
|
|
959104
959143
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
959105
959144
|
const regex5 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
959106
959145
|
const updatedSnapshot = contents.toString().replace(regex5, (_match, _prefix, domain3) => {
|
|
959107
959146
|
return `docs:
|
|
959108
959147
|
domain: "${domain3}.${domainSuffix}"`;
|
|
959109
959148
|
});
|
|
959110
|
-
await (0,
|
|
959149
|
+
await (0, import_promises165.writeFile)(filepath, updatedSnapshot.toString());
|
|
959111
959150
|
}
|
|
959112
959151
|
|
|
959113
959152
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -959127,11 +959166,11 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
959127
959166
|
|
|
959128
959167
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
959129
959168
|
init_lib8();
|
|
959130
|
-
var
|
|
959169
|
+
var import_promises166 = require("fs/promises");
|
|
959131
959170
|
init_js_yaml();
|
|
959132
959171
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
959133
959172
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
959134
|
-
const contentsStr = await (0,
|
|
959173
|
+
const contentsStr = await (0, import_promises166.readFile)(filepath);
|
|
959135
959174
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
959136
959175
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
959137
959176
|
if (result.ok) {
|
|
@@ -959150,7 +959189,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
959150
959189
|
|
|
959151
959190
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
959152
959191
|
init_lib8();
|
|
959153
|
-
var
|
|
959192
|
+
var import_promises168 = require("fs/promises");
|
|
959154
959193
|
init_js_yaml();
|
|
959155
959194
|
|
|
959156
959195
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
@@ -959359,11 +959398,11 @@ __export(legacy_exports, {
|
|
|
959359
959398
|
|
|
959360
959399
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
959361
959400
|
init_lib8();
|
|
959362
|
-
var
|
|
959401
|
+
var import_promises167 = require("fs/promises");
|
|
959363
959402
|
init_js_yaml();
|
|
959364
959403
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
959365
959404
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
959366
|
-
const contentsStr = await (0,
|
|
959405
|
+
const contentsStr = await (0, import_promises167.readFile)(filepath);
|
|
959367
959406
|
const contentsParsed = jsYaml.load(contentsStr.toString());
|
|
959368
959407
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
959369
959408
|
if (result.success) {
|
|
@@ -959393,7 +959432,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
959393
959432
|
var APIS_DIRECTORY2 = "apis";
|
|
959394
959433
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
959395
959434
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
959396
|
-
await (0,
|
|
959435
|
+
await (0, import_promises168.mkdir)(absolutePathToApisDirectory);
|
|
959397
959436
|
for (const workspace of workspaces) {
|
|
959398
959437
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
959399
959438
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -959401,11 +959440,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
959401
959440
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
959402
959441
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
959403
959442
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
959404
|
-
await (0,
|
|
959443
|
+
await (0, import_promises168.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
959405
959444
|
}
|
|
959406
959445
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
959407
959446
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
959408
|
-
await (0,
|
|
959447
|
+
await (0, import_promises168.rm)(absolutePathToWorkspace, { recursive: true });
|
|
959409
959448
|
}
|
|
959410
959449
|
}
|
|
959411
959450
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -959418,7 +959457,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
959418
959457
|
generatorsConfiguration,
|
|
959419
959458
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
959420
959459
|
});
|
|
959421
|
-
await (0,
|
|
959460
|
+
await (0, import_promises168.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
959422
959461
|
return convertedResponse.docsURLs;
|
|
959423
959462
|
}
|
|
959424
959463
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -959432,12 +959471,12 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
959432
959471
|
apiName
|
|
959433
959472
|
});
|
|
959434
959473
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
959435
|
-
await (0,
|
|
959474
|
+
await (0, import_promises168.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
959436
959475
|
}
|
|
959437
959476
|
|
|
959438
959477
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
959439
959478
|
init_lib8();
|
|
959440
|
-
var
|
|
959479
|
+
var import_promises169 = require("fs/promises");
|
|
959441
959480
|
init_js_yaml();
|
|
959442
959481
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
959443
959482
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
@@ -959445,8 +959484,8 @@ async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePa
|
|
|
959445
959484
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
959446
959485
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
959447
959486
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
959448
|
-
await (0,
|
|
959449
|
-
await (0,
|
|
959487
|
+
await (0, import_promises169.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
959488
|
+
await (0, import_promises169.rm)(absolutePathToWorkspace, { recursive: true });
|
|
959450
959489
|
}
|
|
959451
959490
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
959452
959491
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -959459,7 +959498,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
959459
959498
|
apiName: void 0
|
|
959460
959499
|
});
|
|
959461
959500
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
959462
|
-
await (0,
|
|
959501
|
+
await (0, import_promises169.writeFile)(absolutePathToDocsConfig, jsYaml.dump(convertedDocsConfig));
|
|
959463
959502
|
}
|
|
959464
959503
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
959465
959504
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -959471,24 +959510,24 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
959471
959510
|
generatorsConfiguration,
|
|
959472
959511
|
pathModificationStrategy: "MoveUp"
|
|
959473
959512
|
});
|
|
959474
|
-
await (0,
|
|
959513
|
+
await (0, import_promises169.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
959475
959514
|
return convertedResponse.docsURLs;
|
|
959476
959515
|
}
|
|
959477
959516
|
|
|
959478
959517
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
959479
959518
|
init_lib8();
|
|
959480
|
-
var
|
|
959519
|
+
var import_promises170 = require("fs/promises");
|
|
959481
959520
|
init_js_yaml();
|
|
959482
959521
|
var APIS_DIRECTORY3 = "apis";
|
|
959483
959522
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
959484
959523
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
959485
|
-
await (0,
|
|
959524
|
+
await (0, import_promises170.mkdir)(absolutePathToApisDirectory);
|
|
959486
959525
|
for (const workspace of workspaces) {
|
|
959487
959526
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
959488
959527
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
959489
959528
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
959490
959529
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
959491
|
-
await (0,
|
|
959530
|
+
await (0, import_promises170.rm)(absolutePathToWorkspace, { recursive: true });
|
|
959492
959531
|
}
|
|
959493
959532
|
}
|
|
959494
959533
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -959501,17 +959540,17 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
959501
959540
|
generatorsConfiguration,
|
|
959502
959541
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
959503
959542
|
});
|
|
959504
|
-
await (0,
|
|
959543
|
+
await (0, import_promises170.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
959505
959544
|
}
|
|
959506
959545
|
|
|
959507
959546
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
959508
959547
|
init_lib8();
|
|
959509
|
-
var
|
|
959548
|
+
var import_promises171 = require("fs/promises");
|
|
959510
959549
|
init_js_yaml();
|
|
959511
959550
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
959512
959551
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
959513
959552
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
959514
|
-
await (0,
|
|
959553
|
+
await (0, import_promises171.rm)(absolutePathToWorkspace, { recursive: true });
|
|
959515
959554
|
}
|
|
959516
959555
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
959517
959556
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -959523,7 +959562,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
959523
959562
|
generatorsConfiguration,
|
|
959524
959563
|
pathModificationStrategy: "MoveUp"
|
|
959525
959564
|
});
|
|
959526
|
-
await (0,
|
|
959565
|
+
await (0, import_promises171.writeFile)(absolutePathToGeneratorsConfiguration, jsYaml.dump(convertedResponse.value));
|
|
959527
959566
|
}
|
|
959528
959567
|
|
|
959529
959568
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -959601,7 +959640,7 @@ var __default15 = versionMigrations15;
|
|
|
959601
959640
|
|
|
959602
959641
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
959603
959642
|
init_lib8();
|
|
959604
|
-
var
|
|
959643
|
+
var import_promises172 = require("fs/promises");
|
|
959605
959644
|
init_js_yaml();
|
|
959606
959645
|
var import_yaml16 = __toESM(require_dist11(), 1);
|
|
959607
959646
|
var migration16 = {
|
|
@@ -959645,7 +959684,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
959645
959684
|
if (existingGeneratorsYml == null) {
|
|
959646
959685
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
959647
959686
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
959648
|
-
await (0,
|
|
959687
|
+
await (0, import_promises172.writeFile)(absolutePathToGeneratorsYml, jsYaml.dump({
|
|
959649
959688
|
api: {
|
|
959650
959689
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
959651
959690
|
}
|
|
@@ -959660,7 +959699,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
959660
959699
|
parsedDocument.set("api", {
|
|
959661
959700
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
959662
959701
|
});
|
|
959663
|
-
await (0,
|
|
959702
|
+
await (0, import_promises172.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
959664
959703
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
959665
959704
|
}
|
|
959666
959705
|
}
|
|
@@ -959688,7 +959727,7 @@ var __default16 = versionMigrations16;
|
|
|
959688
959727
|
|
|
959689
959728
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
959690
959729
|
init_lib8();
|
|
959691
|
-
var
|
|
959730
|
+
var import_promises173 = require("fs/promises");
|
|
959692
959731
|
init_js_yaml();
|
|
959693
959732
|
var import_yaml17 = __toESM(require_dist11(), 1);
|
|
959694
959733
|
var migration17 = {
|
|
@@ -959869,7 +959908,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
959869
959908
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
959870
959909
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
959871
959910
|
}
|
|
959872
|
-
await (0,
|
|
959911
|
+
await (0, import_promises173.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
959873
959912
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
959874
959913
|
}
|
|
959875
959914
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -959916,7 +959955,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
959916
959955
|
}
|
|
959917
959956
|
let specContent;
|
|
959918
959957
|
try {
|
|
959919
|
-
const fileContents = await (0,
|
|
959958
|
+
const fileContents = await (0, import_promises173.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
959920
959959
|
specContent = jsYaml.load(fileContents);
|
|
959921
959960
|
} catch (e8) {
|
|
959922
959961
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e8}. Skipping...`);
|
|
@@ -960020,7 +960059,7 @@ var __default17 = versionMigrations17;
|
|
|
960020
960059
|
|
|
960021
960060
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
960022
960061
|
init_lib8();
|
|
960023
|
-
var
|
|
960062
|
+
var import_promises174 = require("fs/promises");
|
|
960024
960063
|
init_js_yaml();
|
|
960025
960064
|
var migration18 = {
|
|
960026
960065
|
name: "add-path-parameter-order-setting",
|
|
@@ -960109,7 +960148,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
960109
960148
|
documentToWrite = `${schemaComment}
|
|
960110
960149
|
${documentToWrite}`;
|
|
960111
960150
|
}
|
|
960112
|
-
await (0,
|
|
960151
|
+
await (0, import_promises174.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960113
960152
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960114
960153
|
}
|
|
960115
960154
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -960146,7 +960185,7 @@ var __default18 = versionMigrations18;
|
|
|
960146
960185
|
|
|
960147
960186
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
960148
960187
|
init_lib8();
|
|
960149
|
-
var
|
|
960188
|
+
var import_promises175 = require("fs/promises");
|
|
960150
960189
|
init_js_yaml();
|
|
960151
960190
|
var migration19 = {
|
|
960152
960191
|
name: "update-1_0_0-defaults",
|
|
@@ -960322,7 +960361,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
960322
960361
|
documentToWrite = `${schemaComment}
|
|
960323
960362
|
${documentToWrite}`;
|
|
960324
960363
|
}
|
|
960325
|
-
await (0,
|
|
960364
|
+
await (0, import_promises175.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960326
960365
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960327
960366
|
}
|
|
960328
960367
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -960392,7 +960431,7 @@ var __default19 = versionMigrations19;
|
|
|
960392
960431
|
|
|
960393
960432
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
960394
960433
|
init_lib8();
|
|
960395
|
-
var
|
|
960434
|
+
var import_promises176 = require("fs/promises");
|
|
960396
960435
|
init_js_yaml();
|
|
960397
960436
|
var migration20 = {
|
|
960398
960437
|
name: "update-2_0_0-defaults",
|
|
@@ -960568,7 +960607,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
960568
960607
|
documentToWrite = `${schemaComment}
|
|
960569
960608
|
${documentToWrite}`;
|
|
960570
960609
|
}
|
|
960571
|
-
await (0,
|
|
960610
|
+
await (0, import_promises176.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960572
960611
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960573
960612
|
}
|
|
960574
960613
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -960615,7 +960654,7 @@ var __default20 = versionMigrations20;
|
|
|
960615
960654
|
|
|
960616
960655
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
960617
960656
|
init_lib8();
|
|
960618
|
-
var
|
|
960657
|
+
var import_promises177 = require("fs/promises");
|
|
960619
960658
|
init_js_yaml();
|
|
960620
960659
|
var migration21 = {
|
|
960621
960660
|
name: "migrate-deprecated-generator-api-settings",
|
|
@@ -960707,7 +960746,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
960707
960746
|
documentToWrite = `${schemaComment}
|
|
960708
960747
|
${documentToWrite}`;
|
|
960709
960748
|
}
|
|
960710
|
-
await (0,
|
|
960749
|
+
await (0, import_promises177.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960711
960750
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960712
960751
|
}
|
|
960713
960752
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -960754,7 +960793,7 @@ var __default21 = versionMigrations21;
|
|
|
960754
960793
|
|
|
960755
960794
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
960756
960795
|
init_lib8();
|
|
960757
|
-
var
|
|
960796
|
+
var import_promises178 = require("fs/promises");
|
|
960758
960797
|
init_js_yaml();
|
|
960759
960798
|
var migration22 = {
|
|
960760
960799
|
name: "enable-smart-casing",
|
|
@@ -960839,7 +960878,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
960839
960878
|
documentToWrite = `${schemaComment}
|
|
960840
960879
|
${documentToWrite}`;
|
|
960841
960880
|
}
|
|
960842
|
-
await (0,
|
|
960881
|
+
await (0, import_promises178.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
960843
960882
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
960844
960883
|
}
|
|
960845
960884
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -960982,7 +961021,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
960982
961021
|
// src/commands/upgrade/upgrade.ts
|
|
960983
961022
|
init_lib12();
|
|
960984
961023
|
init_lib6();
|
|
960985
|
-
var
|
|
961024
|
+
var import_promises179 = require("fs/promises");
|
|
960986
961025
|
|
|
960987
961026
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
960988
961027
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -962037,7 +962076,7 @@ async function upgrade({
|
|
|
962037
962076
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
962038
962077
|
draft.version = resolvedTargetVersion;
|
|
962039
962078
|
});
|
|
962040
|
-
await (0,
|
|
962079
|
+
await (0, import_promises179.writeFile)(
|
|
962041
962080
|
projectConfig2._absolutePath,
|
|
962042
962081
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
962043
962082
|
);
|
|
@@ -962194,7 +962233,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
962194
962233
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
962195
962234
|
});
|
|
962196
962235
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
962197
|
-
await (0,
|
|
962236
|
+
await (0, import_promises180.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
962198
962237
|
}
|
|
962199
962238
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
962200
962239
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -962669,7 +962708,7 @@ async function previewDocsWorkspace({
|
|
|
962669
962708
|
// src/commands/docs-diff/docsDiff.ts
|
|
962670
962709
|
init_lib8();
|
|
962671
962710
|
init_lib6();
|
|
962672
|
-
var
|
|
962711
|
+
var import_promises181 = require("fs/promises");
|
|
962673
962712
|
var import_pngjs = __toESM(require_png2(), 1);
|
|
962674
962713
|
async function getSlugForFiles({
|
|
962675
962714
|
previewUrl,
|
|
@@ -962892,8 +962931,8 @@ async function generateComparisons({
|
|
|
962892
962931
|
afterPath,
|
|
962893
962932
|
comparisonBasePath
|
|
962894
962933
|
}) {
|
|
962895
|
-
const beforePng = import_pngjs.PNG.sync.read(await (0,
|
|
962896
|
-
const afterPng = import_pngjs.PNG.sync.read(await (0,
|
|
962934
|
+
const beforePng = import_pngjs.PNG.sync.read(await (0, import_promises181.readFile)(beforePath));
|
|
962935
|
+
const afterPng = import_pngjs.PNG.sync.read(await (0, import_promises181.readFile)(afterPath));
|
|
962897
962936
|
const beforeOriginalHeight = beforePng.height;
|
|
962898
962937
|
const afterOriginalHeight = afterPng.height;
|
|
962899
962938
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -962931,7 +962970,7 @@ async function generateComparisons({
|
|
|
962931
962970
|
const sideBySide = createSideBySideComparison(croppedBefore, croppedAfter, 20, true);
|
|
962932
962971
|
const outPath = `${base4}-region-${i9 + 1}.png`;
|
|
962933
962972
|
const pngBuffer = import_pngjs.PNG.sync.write(sideBySide);
|
|
962934
|
-
await (0,
|
|
962973
|
+
await (0, import_promises181.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
962935
962974
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
962936
962975
|
}
|
|
962937
962976
|
return results;
|
|
@@ -963010,7 +963049,7 @@ async function docsDiff({
|
|
|
963010
963049
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
963011
963050
|
);
|
|
963012
963051
|
if (!await doesPathExist(outputPath)) {
|
|
963013
|
-
await (0,
|
|
963052
|
+
await (0, import_promises181.mkdir)(outputPath, { recursive: true });
|
|
963014
963053
|
}
|
|
963015
963054
|
const results = [];
|
|
963016
963055
|
await cliContext.runTask(async (context3) => {
|
|
@@ -963328,7 +963367,7 @@ init_lib6();
|
|
|
963328
963367
|
|
|
963329
963368
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
963330
963369
|
init_lib8();
|
|
963331
|
-
var
|
|
963370
|
+
var import_promises182 = require("fs/promises");
|
|
963332
963371
|
init_js_yaml();
|
|
963333
963372
|
var import_path104 = __toESM(require("path"), 1);
|
|
963334
963373
|
var THEME_ELIGIBLE_KEYS2 = /* @__PURE__ */ new Set([
|
|
@@ -963357,18 +963396,18 @@ var ThemeExporter = class {
|
|
|
963357
963396
|
const docsDir = import_path104.default.dirname(docsYmlPath);
|
|
963358
963397
|
const outDir = output2 != null ? import_path104.default.resolve(process.cwd(), output2) : import_path104.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
963359
963398
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
963360
|
-
const raw = jsYaml.load(await (0,
|
|
963399
|
+
const raw = jsYaml.load(await (0, import_promises182.readFile)(docsYmlPath, "utf-8"));
|
|
963361
963400
|
const themeConfig = {};
|
|
963362
963401
|
for (const [k5, v9] of Object.entries(raw)) {
|
|
963363
963402
|
if (THEME_ELIGIBLE_KEYS2.has(k5)) {
|
|
963364
963403
|
themeConfig[k5] = v9;
|
|
963365
963404
|
}
|
|
963366
963405
|
}
|
|
963367
|
-
await (0,
|
|
963406
|
+
await (0, import_promises182.mkdir)(outDir, { recursive: true });
|
|
963368
963407
|
const assetsDir = import_path104.default.join(outDir, "assets");
|
|
963369
|
-
await (0,
|
|
963408
|
+
await (0, import_promises182.mkdir)(assetsDir, { recursive: true });
|
|
963370
963409
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
963371
|
-
await (0,
|
|
963410
|
+
await (0, import_promises182.writeFile)(import_path104.default.join(outDir, "theme.yml"), jsYaml.dump(exported), "utf-8");
|
|
963372
963411
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
963373
963412
|
}
|
|
963374
963413
|
};
|
|
@@ -963382,8 +963421,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
963382
963421
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path104.default.basename(abs) : relFromProject : relFromSource;
|
|
963383
963422
|
const dest = import_path104.default.join(assetsDir, destRelative);
|
|
963384
963423
|
try {
|
|
963385
|
-
await (0,
|
|
963386
|
-
await (0,
|
|
963424
|
+
await (0, import_promises182.mkdir)(import_path104.default.dirname(dest), { recursive: true });
|
|
963425
|
+
await (0, import_promises182.copyFile)(abs, dest);
|
|
963387
963426
|
return `./assets/${destRelative.split(import_path104.default.sep).join("/")}`;
|
|
963388
963427
|
} catch {
|
|
963389
963428
|
return obj;
|
|
@@ -963501,7 +963540,7 @@ async function listDocsThemes({
|
|
|
963501
963540
|
|
|
963502
963541
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
963503
963542
|
init_lib6();
|
|
963504
|
-
var
|
|
963543
|
+
var import_promises184 = require("fs/promises");
|
|
963505
963544
|
init_js_yaml();
|
|
963506
963545
|
var import_path106 = __toESM(require("path"), 1);
|
|
963507
963546
|
|
|
@@ -963510,7 +963549,7 @@ init_lib8();
|
|
|
963510
963549
|
init_lib6();
|
|
963511
963550
|
var import_child_process12 = require("child_process");
|
|
963512
963551
|
var import_crypto9 = require("crypto");
|
|
963513
|
-
var
|
|
963552
|
+
var import_promises183 = require("fs/promises");
|
|
963514
963553
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
963515
963554
|
var import_path105 = __toESM(require("path"), 1);
|
|
963516
963555
|
function getGitRoot() {
|
|
@@ -963554,7 +963593,7 @@ var ThemeConfigProcessor = class {
|
|
|
963554
963593
|
filePaths.map(async (filePath) => {
|
|
963555
963594
|
const abs = import_path105.default.resolve(this.themeDir, filePath);
|
|
963556
963595
|
try {
|
|
963557
|
-
await (0,
|
|
963596
|
+
await (0, import_promises183.access)(abs);
|
|
963558
963597
|
} catch {
|
|
963559
963598
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
963560
963599
|
}
|
|
@@ -963719,7 +963758,7 @@ ${errors4.map((e8) => ` - ${e8}`).join("\n")}`,
|
|
|
963719
963758
|
return { config: cfg, filesUploaded };
|
|
963720
963759
|
}
|
|
963721
963760
|
async uploadFileToCas(absolutePath) {
|
|
963722
|
-
const content5 = await (0,
|
|
963761
|
+
const content5 = await (0, import_promises183.readFile)(absolutePath);
|
|
963723
963762
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
963724
963763
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
963725
963764
|
return this.uploadToCas(content5, contentType, bindPath, import_path105.default.basename(absolutePath));
|
|
@@ -963834,7 +963873,7 @@ async function uploadDocsTheme({
|
|
|
963834
963873
|
await cliContext.runTask(async (context3) => {
|
|
963835
963874
|
let rawYaml;
|
|
963836
963875
|
try {
|
|
963837
|
-
const content5 = await (0,
|
|
963876
|
+
const content5 = await (0, import_promises184.readFile)(themeYmlPath, "utf-8");
|
|
963838
963877
|
rawYaml = jsYaml.load(content5, { schema: jsYaml.JSON_SCHEMA });
|
|
963839
963878
|
} catch {
|
|
963840
963879
|
context3.failAndThrow(
|
|
@@ -963888,7 +963927,7 @@ async function uploadDocsTheme({
|
|
|
963888
963927
|
|
|
963889
963928
|
// src/commands/downgrade/downgrade.ts
|
|
963890
963929
|
init_lib6();
|
|
963891
|
-
var
|
|
963930
|
+
var import_promises185 = require("fs/promises");
|
|
963892
963931
|
function ensureFinalNewline2(content5) {
|
|
963893
963932
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
963894
963933
|
}
|
|
@@ -963913,13 +963952,13 @@ async function downgrade({
|
|
|
963913
963952
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
963914
963953
|
draft.version = targetVersion;
|
|
963915
963954
|
});
|
|
963916
|
-
await (0,
|
|
963955
|
+
await (0, import_promises185.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
963917
963956
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
963918
963957
|
}
|
|
963919
963958
|
|
|
963920
963959
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
963921
963960
|
init_lib8();
|
|
963922
|
-
var
|
|
963961
|
+
var import_promises186 = require("fs/promises");
|
|
963923
963962
|
init_js_yaml();
|
|
963924
963963
|
|
|
963925
963964
|
// src/commands/export/converters/servicesConverter.ts
|
|
@@ -965306,8 +965345,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
965306
965345
|
ir: ir11,
|
|
965307
965346
|
mode: "openapi"
|
|
965308
965347
|
});
|
|
965309
|
-
await (0,
|
|
965310
|
-
await (0,
|
|
965348
|
+
await (0, import_promises186.mkdir)(dirname6(outputPath), { recursive: true });
|
|
965349
|
+
await (0, import_promises186.writeFile)(
|
|
965311
965350
|
outputPath,
|
|
965312
965351
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : jsYaml.dump(openapi, { indent: indent4 })
|
|
965313
965352
|
);
|
|
@@ -965900,7 +965939,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
965900
965939
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
965901
965940
|
init_lib8();
|
|
965902
965941
|
init_lib6();
|
|
965903
|
-
var
|
|
965942
|
+
var import_promises187 = require("fs/promises");
|
|
965904
965943
|
init_js_yaml();
|
|
965905
965944
|
async function compareOpenAPISpecs({
|
|
965906
965945
|
originalPath,
|
|
@@ -965942,12 +965981,12 @@ async function compareOpenAPISpecs({
|
|
|
965942
965981
|
}
|
|
965943
965982
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
965944
965983
|
}
|
|
965945
|
-
await (0,
|
|
965984
|
+
await (0, import_promises187.writeFile)(outputPath, jsYaml.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
965946
965985
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
965947
965986
|
});
|
|
965948
965987
|
}
|
|
965949
965988
|
async function loadSpec2(filepath, context3) {
|
|
965950
|
-
const contents = await (0,
|
|
965989
|
+
const contents = await (0, import_promises187.readFile)(filepath, "utf8");
|
|
965951
965990
|
try {
|
|
965952
965991
|
return JSON.parse(contents);
|
|
965953
965992
|
} catch {
|
|
@@ -966052,7 +966091,7 @@ function deepEqual(a3, b8) {
|
|
|
966052
966091
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
966053
966092
|
init_lib8();
|
|
966054
966093
|
init_lib6();
|
|
966055
|
-
var
|
|
966094
|
+
var import_promises188 = require("fs/promises");
|
|
966056
966095
|
init_js_yaml();
|
|
966057
966096
|
async function writeOverridesForWorkspaces({
|
|
966058
966097
|
project,
|
|
@@ -966078,7 +966117,7 @@ async function writeOverridesForWorkspaces({
|
|
|
966078
966117
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
966079
966118
|
let parsedOverrides = null;
|
|
966080
966119
|
try {
|
|
966081
|
-
const contents = (await (0,
|
|
966120
|
+
const contents = (await (0, import_promises188.readFile)(overridesFilepath, "utf8")).toString();
|
|
966082
966121
|
try {
|
|
966083
966122
|
parsedOverrides = JSON.parse(contents);
|
|
966084
966123
|
} catch (err) {
|
|
@@ -966143,7 +966182,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
966143
966182
|
for (const overridesPath of overridesPaths) {
|
|
966144
966183
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
966145
966184
|
const content5 = generateOverridesContent({ ir: ir11, existingOverrides, includeModels, context: context3 });
|
|
966146
|
-
await (0,
|
|
966185
|
+
await (0, import_promises188.writeFile)(overridesPath, jsYaml.dump(content5));
|
|
966147
966186
|
}
|
|
966148
966187
|
} else {
|
|
966149
966188
|
const content5 = generateOverridesContent({ ir: ir11, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -966157,7 +966196,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
966157
966196
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
966158
966197
|
}
|
|
966159
966198
|
}
|
|
966160
|
-
await (0,
|
|
966199
|
+
await (0, import_promises188.writeFile)(
|
|
966161
966200
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
966162
966201
|
jsYaml.dump(content5)
|
|
966163
966202
|
);
|
|
@@ -966602,7 +966641,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
966602
966641
|
}
|
|
966603
966642
|
|
|
966604
966643
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
966605
|
-
var
|
|
966644
|
+
var import_promises189 = require("fs/promises");
|
|
966606
966645
|
async function generateJsonschemaForWorkspaces({
|
|
966607
966646
|
typeLocator,
|
|
966608
966647
|
project,
|
|
@@ -966650,9 +966689,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
966650
966689
|
context: context3
|
|
966651
966690
|
});
|
|
966652
966691
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
966653
|
-
await (0,
|
|
966692
|
+
await (0, import_promises189.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
966654
966693
|
}
|
|
966655
|
-
await (0,
|
|
966694
|
+
await (0, import_promises189.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
966656
966695
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
966657
966696
|
});
|
|
966658
966697
|
})
|
|
@@ -966662,7 +966701,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
966662
966701
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
966663
966702
|
init_lib8();
|
|
966664
966703
|
init_lib6();
|
|
966665
|
-
var
|
|
966704
|
+
var import_promises190 = require("fs/promises");
|
|
966666
966705
|
init_js_yaml();
|
|
966667
966706
|
var HTTP_METHODS3 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
966668
966707
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -966688,12 +966727,12 @@ async function mergeOpenAPIWithOverrides({
|
|
|
966688
966727
|
const merged = mergeExamplesIntoSpec(openapi, overrides, context3);
|
|
966689
966728
|
const isJson = outputPath.endsWith(".json");
|
|
966690
966729
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : jsYaml.dump(merged, { lineWidth: -1, noRefs: true });
|
|
966691
|
-
await (0,
|
|
966730
|
+
await (0, import_promises190.writeFile)(outputPath, output2);
|
|
966692
966731
|
context3.logger.info(`Merged output written to ${outputPath}`);
|
|
966693
966732
|
});
|
|
966694
966733
|
}
|
|
966695
966734
|
async function loadYamlOrJson(filepath, context3) {
|
|
966696
|
-
const contents = await (0,
|
|
966735
|
+
const contents = await (0, import_promises190.readFile)(filepath, "utf8");
|
|
966697
966736
|
try {
|
|
966698
966737
|
return JSON.parse(contents);
|
|
966699
966738
|
} catch {
|
|
@@ -967329,7 +967368,7 @@ async function mockServer({
|
|
|
967329
967368
|
|
|
967330
967369
|
// src/commands/register/registerWorkspacesV1.ts
|
|
967331
967370
|
init_lib6();
|
|
967332
|
-
var
|
|
967371
|
+
var import_promises191 = require("fs/promises");
|
|
967333
967372
|
var import_path112 = __toESM(require("path"), 1);
|
|
967334
967373
|
var import_tmp_promise17 = __toESM(require_tmp_promise(), 1);
|
|
967335
967374
|
async function registerWorkspacesV1({
|
|
@@ -967382,7 +967421,7 @@ async function registerWorkspacesV1({
|
|
|
967382
967421
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
967383
967422
|
await Zn8({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
967384
967423
|
context3.logger.info("Uploading definition...");
|
|
967385
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
967424
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises191.readFile)(tarPath));
|
|
967386
967425
|
context3.logger.info(
|
|
967387
967426
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
967388
967427
|
);
|
|
@@ -967435,7 +967474,7 @@ function getAIEnhancerConfig2() {
|
|
|
967435
967474
|
|
|
967436
967475
|
// src/commands/resolve-specs/resolveSpecsForWorkspaces.ts
|
|
967437
967476
|
init_lib8();
|
|
967438
|
-
var
|
|
967477
|
+
var import_promises192 = require("fs/promises");
|
|
967439
967478
|
var import_path113 = __toESM(require("path"), 1);
|
|
967440
967479
|
async function resolveSpecsForWorkspaces({
|
|
967441
967480
|
project,
|
|
@@ -967455,14 +967494,14 @@ async function resolveSpecsForWorkspaces({
|
|
|
967455
967494
|
return;
|
|
967456
967495
|
}
|
|
967457
967496
|
const workspaceOutputDir = project.apiWorkspaces.length > 1 ? AbsoluteFilePath2.of(import_path113.default.join(outputDir, workspace.workspaceName ?? "api")) : outputDir;
|
|
967458
|
-
await (0,
|
|
967497
|
+
await (0, import_promises192.mkdir)(workspaceOutputDir, { recursive: true });
|
|
967459
967498
|
const manifest = await collectRawSpecs({
|
|
967460
967499
|
specs,
|
|
967461
967500
|
hostOutputDir: workspaceOutputDir,
|
|
967462
967501
|
containerBaseDir: ".",
|
|
967463
967502
|
context: context3
|
|
967464
967503
|
});
|
|
967465
|
-
await (0,
|
|
967504
|
+
await (0, import_promises192.writeFile)(
|
|
967466
967505
|
import_path113.default.join(workspaceOutputDir, SPECS_MANIFEST_FILENAME),
|
|
967467
967506
|
JSON.stringify(manifest, void 0, 4)
|
|
967468
967507
|
);
|
|
@@ -967669,7 +967708,7 @@ async function generateDiff({
|
|
|
967669
967708
|
// src/commands/sdk-preview/sdkPreview.ts
|
|
967670
967709
|
init_lib8();
|
|
967671
967710
|
init_lib6();
|
|
967672
|
-
var
|
|
967711
|
+
var import_promises193 = __toESM(require("fs/promises"), 1);
|
|
967673
967712
|
|
|
967674
967713
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
967675
967714
|
var BASE_VERSION = "0.0.1";
|
|
@@ -967789,7 +967828,7 @@ async function sdkPreview({
|
|
|
967789
967828
|
const firstPath = pathOutputs[0];
|
|
967790
967829
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
967791
967830
|
if (absolutePathToOutput != null) {
|
|
967792
|
-
await
|
|
967831
|
+
await import_promises193.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
967793
967832
|
}
|
|
967794
967833
|
for (const workspace of project.apiWorkspaces) {
|
|
967795
967834
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -967978,7 +968017,7 @@ async function sdkPreview({
|
|
|
967978
968017
|
// src/commands/self-update/selfUpdate.ts
|
|
967979
968018
|
init_lib12();
|
|
967980
968019
|
init_lib6();
|
|
967981
|
-
var
|
|
968020
|
+
var import_promises194 = require("fs/promises");
|
|
967982
968021
|
var import_path114 = require("path");
|
|
967983
968022
|
async function getPackageManagerBinDir(logger4, pm2) {
|
|
967984
968023
|
let command3;
|
|
@@ -968024,7 +968063,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
968024
968063
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
968025
968064
|
let resolvedPath;
|
|
968026
968065
|
try {
|
|
968027
|
-
resolvedPath = await (0,
|
|
968066
|
+
resolvedPath = await (0, import_promises194.realpath)(fernPath);
|
|
968028
968067
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
968029
968068
|
} catch (error50) {
|
|
968030
968069
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -968331,22 +968370,22 @@ async function generateToken({
|
|
|
968331
968370
|
init_lib8();
|
|
968332
968371
|
init_lib6();
|
|
968333
968372
|
var fs28 = __toESM(require("fs"), 1);
|
|
968334
|
-
var
|
|
968373
|
+
var import_promises195 = require("fs/promises");
|
|
968335
968374
|
init_graphql();
|
|
968336
968375
|
init_js_yaml();
|
|
968337
968376
|
var import_stream17 = require("stream");
|
|
968338
|
-
var
|
|
968377
|
+
var import_promises196 = require("stream/promises");
|
|
968339
968378
|
async function fetchAndWriteFile(url3, path115, logger4, indent4) {
|
|
968340
968379
|
const resp = await fetch(url3);
|
|
968341
968380
|
if (resp.ok && resp.body) {
|
|
968342
968381
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
968343
968382
|
const fileStream = fs28.createWriteStream(path115);
|
|
968344
|
-
await (0,
|
|
968345
|
-
const fileContents = await (0,
|
|
968383
|
+
await (0, import_promises196.finished)(import_stream17.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
968384
|
+
const fileContents = await (0, import_promises195.readFile)(path115, "utf8");
|
|
968346
968385
|
try {
|
|
968347
|
-
await (0,
|
|
968386
|
+
await (0, import_promises195.writeFile)(path115, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
968348
968387
|
} catch (e8) {
|
|
968349
|
-
await (0,
|
|
968388
|
+
await (0, import_promises195.writeFile)(path115, jsYaml.dump(jsYaml.load(fileContents), { indent: indent4 }), "utf8");
|
|
968350
968389
|
}
|
|
968351
968390
|
logger4.debug("File written successfully");
|
|
968352
968391
|
}
|
|
@@ -968502,14 +968541,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
968502
968541
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path115, logger4) {
|
|
968503
968542
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
968504
968543
|
if (postResult.success) {
|
|
968505
|
-
await (0,
|
|
968544
|
+
await (0, import_promises195.writeFile)(path115, postResult.result, "utf8");
|
|
968506
968545
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
968507
968546
|
return;
|
|
968508
968547
|
}
|
|
968509
968548
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
968510
968549
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
968511
968550
|
if (getResult.success) {
|
|
968512
|
-
await (0,
|
|
968551
|
+
await (0, import_promises195.writeFile)(path115, getResult.result, "utf8");
|
|
968513
968552
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
968514
968553
|
return;
|
|
968515
968554
|
}
|
|
@@ -969179,7 +969218,7 @@ async function validateWorkspaces({
|
|
|
969179
969218
|
|
|
969180
969219
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
969181
969220
|
init_lib8();
|
|
969182
|
-
var
|
|
969221
|
+
var import_promises197 = require("fs/promises");
|
|
969183
969222
|
init_js_yaml();
|
|
969184
969223
|
var import_path116 = __toESM(require("path"), 1);
|
|
969185
969224
|
async function writeDefinitionForWorkspaces({
|
|
@@ -969261,28 +969300,28 @@ async function writeFernDefinition({
|
|
|
969261
969300
|
return a3.localeCompare(b8);
|
|
969262
969301
|
};
|
|
969263
969302
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
969264
|
-
await (0,
|
|
969303
|
+
await (0, import_promises197.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
969265
969304
|
}
|
|
969266
|
-
await (0,
|
|
969267
|
-
await (0,
|
|
969305
|
+
await (0, import_promises197.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
969306
|
+
await (0, import_promises197.writeFile)(
|
|
969268
969307
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
969269
969308
|
jsYaml.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
969270
969309
|
);
|
|
969271
969310
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
969272
969311
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
969273
|
-
await (0,
|
|
969274
|
-
await (0,
|
|
969312
|
+
await (0, import_promises197.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
969313
|
+
await (0, import_promises197.writeFile)(absoluteFilepath, jsYaml.dump(packageMarker.contents, { sortKeys }));
|
|
969275
969314
|
}
|
|
969276
969315
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
969277
969316
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
969278
|
-
await (0,
|
|
969279
|
-
await (0,
|
|
969317
|
+
await (0, import_promises197.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
969318
|
+
await (0, import_promises197.writeFile)(absoluteFilepath, jsYaml.dump(definitionFile.contents, { sortKeys }));
|
|
969280
969319
|
}
|
|
969281
969320
|
}
|
|
969282
969321
|
|
|
969283
969322
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
969284
969323
|
init_lib8();
|
|
969285
|
-
var
|
|
969324
|
+
var import_promises198 = require("fs/promises");
|
|
969286
969325
|
async function writeDocsDefinitionForProject({
|
|
969287
969326
|
project,
|
|
969288
969327
|
outputPath,
|
|
@@ -969314,7 +969353,7 @@ async function writeDocsDefinitionForProject({
|
|
|
969314
969353
|
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
|
|
969315
969354
|
});
|
|
969316
969355
|
const docsDefinition = await docsResolver.resolve();
|
|
969317
|
-
await (0,
|
|
969356
|
+
await (0, import_promises198.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
969318
969357
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
969319
969358
|
});
|
|
969320
969359
|
}
|