@fern-api/fern-api-dev 5.23.3-795-gcd72613f3c2 → 5.23.3-798-g4d95187bafb
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 +378 -319
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -68437,8 +68437,8 @@ var require_graceful_fs = __commonJS({
|
|
|
68437
68437
|
fs35.createReadStream = createReadStream5;
|
|
68438
68438
|
fs35.createWriteStream = createWriteStream8;
|
|
68439
68439
|
var fs$readFile = fs35.readFile;
|
|
68440
|
-
fs35.readFile =
|
|
68441
|
-
function
|
|
68440
|
+
fs35.readFile = readFile117;
|
|
68441
|
+
function readFile117(path118, options2, cb) {
|
|
68442
68442
|
if (typeof options2 === "function")
|
|
68443
68443
|
cb = options2, options2 = null;
|
|
68444
68444
|
return go$readFile(path118, options2, cb);
|
|
@@ -296253,8 +296253,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
296253
296253
|
fs35.createReadStream = createReadStream5;
|
|
296254
296254
|
fs35.createWriteStream = createWriteStream8;
|
|
296255
296255
|
var fs$readFile = fs35.readFile;
|
|
296256
|
-
fs35.readFile =
|
|
296257
|
-
function
|
|
296256
|
+
fs35.readFile = readFile117;
|
|
296257
|
+
function readFile117(path118, options2, cb) {
|
|
296258
296258
|
if (typeof options2 === "function")
|
|
296259
296259
|
cb = options2, options2 = null;
|
|
296260
296260
|
return go$readFile(path118, options2, cb);
|
|
@@ -379465,9 +379465,10 @@ ${stderr}`);
|
|
|
379465
379465
|
throw e2;
|
|
379466
379466
|
}
|
|
379467
379467
|
}
|
|
379468
|
-
async function execInContainer({ logger: logger4, containerId, command: command3, runner, writeLogsToFile = true, reject = true }) {
|
|
379468
|
+
async function execInContainer({ logger: logger4, containerId, command: command3, runner, envVars = {}, writeLogsToFile = true, reject = true }) {
|
|
379469
379469
|
const containerRunner = runner ?? "docker";
|
|
379470
|
-
const
|
|
379470
|
+
const envArgs = Object.entries(envVars).flatMap(([key2, value2]) => ["-e", `${key2}=${value2}`]);
|
|
379471
|
+
const { stdout, stderr, exitCode } = await loggingExeca(logger4, containerRunner, ["exec", "--user", "root", ...envArgs, containerId, ...command3], {
|
|
379471
379472
|
reject: false,
|
|
379472
379473
|
all: true,
|
|
379473
379474
|
doNotPipeOutput: true
|
|
@@ -389383,7 +389384,7 @@ var require_dist24 = __commonJS({
|
|
|
389383
389384
|
return copy;
|
|
389384
389385
|
}
|
|
389385
389386
|
};
|
|
389386
|
-
var
|
|
389387
|
+
var import_promises211 = require("fs/promises");
|
|
389387
389388
|
var import_node_path310 = require("path");
|
|
389388
389389
|
async function resolveInputs(args) {
|
|
389389
389390
|
const {
|
|
@@ -389436,7 +389437,7 @@ var require_dist24 = __commonJS({
|
|
|
389436
389437
|
}
|
|
389437
389438
|
}
|
|
389438
389439
|
const oursPath = (0, import_node_path310.join)(outputDir, resolvedPath);
|
|
389439
|
-
const ours = await (0,
|
|
389440
|
+
const ours = await (0, import_promises211.readFile)(oursPath, "utf-8").catch(() => null);
|
|
389440
389441
|
let ghostTheirs = null;
|
|
389441
389442
|
let baseTreeUnreachable = false;
|
|
389442
389443
|
if (!base4 && !renameSourcePath) {
|
|
@@ -389678,7 +389679,7 @@ var require_dist24 = __commonJS({
|
|
|
389678
389679
|
conflictReasonHint
|
|
389679
389680
|
};
|
|
389680
389681
|
}
|
|
389681
|
-
var
|
|
389682
|
+
var import_promises212 = require("fs/promises");
|
|
389682
389683
|
var import_node_path45 = require("path");
|
|
389683
389684
|
async function runMergeAndRecord(args) {
|
|
389684
389685
|
const { plan, inputs, patch: patch5, accumulator } = args;
|
|
@@ -389688,14 +389689,14 @@ var require_dist24 = __commonJS({
|
|
|
389688
389689
|
}
|
|
389689
389690
|
if (plan.kind === "new-file-only-user") {
|
|
389690
389691
|
accumulator.recordMerge(resolvedPath, plan.theirs, patch5.base_generation);
|
|
389691
|
-
await (0,
|
|
389692
|
-
await (0,
|
|
389692
|
+
await (0, import_promises212.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
389693
|
+
await (0, import_promises212.writeFile)(oursPath, plan.theirs);
|
|
389693
389694
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
389694
389695
|
}
|
|
389695
389696
|
if (plan.kind === "new-file-both") {
|
|
389696
389697
|
const merged2 = threeWayMerge("", ours, plan.theirs);
|
|
389697
|
-
await (0,
|
|
389698
|
-
await (0,
|
|
389698
|
+
await (0, import_promises212.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
389699
|
+
await (0, import_promises212.writeFile)(oursPath, merged2.content);
|
|
389699
389700
|
const unreachableFlag = plan.baseTreeUnreachable ? { baseTreeUnreachable: true } : {};
|
|
389700
389701
|
if (merged2.hasConflicts) {
|
|
389701
389702
|
return {
|
|
@@ -389711,8 +389712,8 @@ var require_dist24 = __commonJS({
|
|
|
389711
389712
|
return { file: resolvedPath, status: "merged", ...unreachableFlag };
|
|
389712
389713
|
}
|
|
389713
389714
|
const merged = threeWayMerge(plan.mergeBase, ours, plan.theirs);
|
|
389714
|
-
await (0,
|
|
389715
|
-
await (0,
|
|
389715
|
+
await (0, import_promises212.mkdir)((0, import_node_path45.dirname)(oursPath), { recursive: true });
|
|
389716
|
+
await (0, import_promises212.writeFile)(oursPath, merged.content);
|
|
389716
389717
|
if (merged.hasConflicts) {
|
|
389717
389718
|
accumulator.recordConflict(resolvedPath, plan.theirs, patch5.base_generation);
|
|
389718
389719
|
return {
|
|
@@ -430378,7 +430379,7 @@ async function readFernYmlRaw(start2) {
|
|
|
430378
430379
|
for (let i5 = 0; i5 < 50; i5++) {
|
|
430379
430380
|
const candidate = (0, import_path99.resolve)(dir, "fern.yml");
|
|
430380
430381
|
try {
|
|
430381
|
-
const content5 = await (0,
|
|
430382
|
+
const content5 = await (0, import_promises140.readFile)(candidate, "utf-8");
|
|
430382
430383
|
const parsed = index_vite_proxy_tmp_default.load(content5);
|
|
430383
430384
|
if (isRawFernYml(parsed)) {
|
|
430384
430385
|
return parsed;
|
|
@@ -430426,11 +430427,11 @@ function extractInstances(raw) {
|
|
|
430426
430427
|
}
|
|
430427
430428
|
return raw.docs.instances.flatMap((inst) => typeof inst?.url === "string" ? [inst.url] : []);
|
|
430428
430429
|
}
|
|
430429
|
-
var
|
|
430430
|
+
var import_promises140, import_path99;
|
|
430430
430431
|
var init_completion2 = __esm({
|
|
430431
430432
|
"../cli-v2/lib/completion.js"() {
|
|
430432
430433
|
"use strict";
|
|
430433
|
-
|
|
430434
|
+
import_promises140 = require("fs/promises");
|
|
430434
430435
|
init_js_yaml();
|
|
430435
430436
|
import_path99 = require("path");
|
|
430436
430437
|
}
|
|
@@ -431569,7 +431570,7 @@ var require_jsonfile = __commonJS({
|
|
|
431569
431570
|
}
|
|
431570
431571
|
return obj;
|
|
431571
431572
|
}
|
|
431572
|
-
var
|
|
431573
|
+
var readFile117 = universalify.fromPromise(_readFile);
|
|
431573
431574
|
function readFileSync19(file4, options2 = {}) {
|
|
431574
431575
|
if (typeof options2 === "string") {
|
|
431575
431576
|
options2 = { encoding: options2 };
|
|
@@ -431601,7 +431602,7 @@ var require_jsonfile = __commonJS({
|
|
|
431601
431602
|
return fs34.writeFileSync(file4, str2, options2);
|
|
431602
431603
|
}
|
|
431603
431604
|
module4.exports = {
|
|
431604
|
-
readFile:
|
|
431605
|
+
readFile: readFile117,
|
|
431605
431606
|
readFileSync: readFileSync19,
|
|
431606
431607
|
writeFile: writeFile98,
|
|
431607
431608
|
writeFileSync: writeFileSync9
|
|
@@ -628980,7 +628981,7 @@ var AccessTokenPosthogManager = class {
|
|
|
628980
628981
|
properties: {
|
|
628981
628982
|
...event,
|
|
628982
628983
|
...event.properties,
|
|
628983
|
-
version: "5.23.3-
|
|
628984
|
+
version: "5.23.3-798-g4d95187bafb",
|
|
628984
628985
|
usingAccessToken: true,
|
|
628985
628986
|
...getRunIdProperties()
|
|
628986
628987
|
}
|
|
@@ -629044,7 +629045,7 @@ var UserPosthogManager = class {
|
|
|
629044
629045
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
629045
629046
|
event: "CLI",
|
|
629046
629047
|
properties: {
|
|
629047
|
-
version: "5.23.3-
|
|
629048
|
+
version: "5.23.3-798-g4d95187bafb",
|
|
629048
629049
|
...event,
|
|
629049
629050
|
...event.properties,
|
|
629050
629051
|
usingAccessToken: false,
|
|
@@ -779170,10 +779171,10 @@ var HeapAsync = (
|
|
|
779170
779171
|
};
|
|
779171
779172
|
HeapAsync2.prototype._applyLimit = function() {
|
|
779172
779173
|
if (this._limit && this._limit < this.heapArray.length) {
|
|
779173
|
-
var
|
|
779174
|
-
while (
|
|
779174
|
+
var rm21 = this.heapArray.length - this._limit;
|
|
779175
|
+
while (rm21) {
|
|
779175
779176
|
this.heapArray.pop();
|
|
779176
|
-
--
|
|
779177
|
+
--rm21;
|
|
779177
779178
|
}
|
|
779178
779179
|
}
|
|
779179
779180
|
};
|
|
@@ -780002,10 +780003,10 @@ var Heap = (
|
|
|
780002
780003
|
};
|
|
780003
780004
|
Heap2.prototype._applyLimit = function() {
|
|
780004
780005
|
if (this._limit > 0 && this._limit < this.heapArray.length) {
|
|
780005
|
-
var
|
|
780006
|
-
while (
|
|
780006
|
+
var rm21 = this.heapArray.length - this._limit;
|
|
780007
|
+
while (rm21) {
|
|
780007
780008
|
this.heapArray.pop();
|
|
780008
|
-
--
|
|
780009
|
+
--rm21;
|
|
780009
780010
|
}
|
|
780010
780011
|
}
|
|
780011
780012
|
};
|
|
@@ -815645,7 +815646,7 @@ var MDX_NODE_TYPES = [
|
|
|
815645
815646
|
"mdxTextExpression",
|
|
815646
815647
|
"mdxjsEsm"
|
|
815647
815648
|
];
|
|
815648
|
-
function collectLinksAndSources({ readFile:
|
|
815649
|
+
function collectLinksAndSources({ readFile: readFile117 = (path118) => (0, import_node_fs17.readFileSync)(path118, "utf-8"), ...opts }) {
|
|
815649
815650
|
const visitedAbsoluteFilepaths = /* @__PURE__ */ new Set();
|
|
815650
815651
|
const contentQueue = [opts];
|
|
815651
815652
|
const links = [];
|
|
@@ -815694,7 +815695,7 @@ function collectLinksAndSources({ readFile: readFile116 = (path118) => (0, impor
|
|
|
815694
815695
|
const resolvedImportPath = resolve6(dirname6(absoluteFilepath), importPath);
|
|
815695
815696
|
if (resolvedImportPath.endsWith(".mdx") || resolvedImportPath.endsWith(".md")) {
|
|
815696
815697
|
contentQueue.push({
|
|
815697
|
-
content:
|
|
815698
|
+
content: readFile117(resolvedImportPath),
|
|
815698
815699
|
absoluteFilepath: resolvedImportPath
|
|
815699
815700
|
});
|
|
815700
815701
|
}
|
|
@@ -815737,7 +815738,7 @@ function collectLinksAndSources({ readFile: readFile116 = (path118) => (0, impor
|
|
|
815737
815738
|
if (absoluteFilepath && typeof src === "string") {
|
|
815738
815739
|
const resolvedImportPath = resolve6(dirname6(absoluteFilepath), src);
|
|
815739
815740
|
contentQueue.push({
|
|
815740
|
-
content:
|
|
815741
|
+
content: readFile117(resolvedImportPath),
|
|
815741
815742
|
absoluteFilepath: resolvedImportPath
|
|
815742
815743
|
});
|
|
815743
815744
|
}
|
|
@@ -821059,7 +821060,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
821059
821060
|
var LOGS_FOLDER_NAME = "logs";
|
|
821060
821061
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
821061
821062
|
function getCliSource() {
|
|
821062
|
-
const version7 = "5.23.3-
|
|
821063
|
+
const version7 = "5.23.3-798-g4d95187bafb";
|
|
821063
821064
|
return `cli@${version7}`;
|
|
821064
821065
|
}
|
|
821065
821066
|
var DebugLogger = class {
|
|
@@ -852392,7 +852393,7 @@ var LegacyDocsPublisher = class {
|
|
|
852392
852393
|
previewId,
|
|
852393
852394
|
disableTemplates: void 0,
|
|
852394
852395
|
skipUpload,
|
|
852395
|
-
cliVersion: "5.23.3-
|
|
852396
|
+
cliVersion: "5.23.3-798-g4d95187bafb",
|
|
852396
852397
|
loginCommand: "fern auth login"
|
|
852397
852398
|
});
|
|
852398
852399
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -855740,7 +855741,7 @@ function addCheckCommand5(cli) {
|
|
|
855740
855741
|
init_lib4();
|
|
855741
855742
|
init_lib8();
|
|
855742
855743
|
init_lib6();
|
|
855743
|
-
var
|
|
855744
|
+
var import_promises138 = require("fs/promises");
|
|
855744
855745
|
init_js_yaml();
|
|
855745
855746
|
|
|
855746
855747
|
// ../cli-v2/lib/api/resolver/ApiSpecResolver.js
|
|
@@ -855961,6 +855962,8 @@ var CONTAINER_SOURCES_DIRECTORY = DOCKER_SOURCES_DIRECTORY;
|
|
|
855961
855962
|
var DOCKER_SPECS_DIRECTORY = import_path84.default.join(DOCKER_FERN_DIRECTORY, SPECS_DIRECTORY_NAME);
|
|
855962
855963
|
var CONTAINER_SPECS_DIRECTORY = DOCKER_SPECS_DIRECTORY;
|
|
855963
855964
|
var DEFAULT_NODE_DEBUG_PORT = "9229";
|
|
855965
|
+
var TYPE_RELOCATIONS_FILENAME = ".fern-type-relocations.json";
|
|
855966
|
+
var TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR = "FERN_TYPE_RELOCATIONS_OUTPUT_FILEPATH";
|
|
855964
855967
|
var GENERATORS_WANTING_SPECS = /* @__PURE__ */ new Set(["fernapi/fern-cli-generator"]);
|
|
855965
855968
|
function generatorWantsSpecs(generatorName) {
|
|
855966
855969
|
return GENERATORS_WANTING_SPECS.has(generatorName);
|
|
@@ -855998,7 +856001,13 @@ var ContainerExecutionEnvironment = class {
|
|
|
855998
856001
|
for (const sourceMount of sourceMounts ?? []) {
|
|
855999
856002
|
binds.push(`${sourceMount.hostPath}:${sourceMount.containerPath}:ro`);
|
|
856000
856003
|
}
|
|
856001
|
-
const envVars = {
|
|
856004
|
+
const envVars = {
|
|
856005
|
+
// Generators that relocate types to break import cycles write the
|
|
856006
|
+
// relocations here (inside the bind-mounted output dir, so it is
|
|
856007
|
+
// host-readable). The host applies them to its dynamic snippet IR
|
|
856008
|
+
// and deletes the file before copying generated output.
|
|
856009
|
+
[TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR]: `${CONTAINER_CODEGEN_OUTPUT_DIRECTORY}/${TYPE_RELOCATIONS_FILENAME}`
|
|
856010
|
+
};
|
|
856002
856011
|
const ports = {};
|
|
856003
856012
|
if (inspect6) {
|
|
856004
856013
|
envVars["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${DEFAULT_NODE_DEBUG_PORT}`;
|
|
@@ -904043,11 +904052,56 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir3, config:
|
|
|
904043
904052
|
init_lib8();
|
|
904044
904053
|
var import_autoversion3 = __toESM(require_autoversion(), 1);
|
|
904045
904054
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
904046
|
-
var
|
|
904055
|
+
var import_promises134 = require("fs/promises");
|
|
904047
904056
|
var path101 = __toESM(require("path"), 1);
|
|
904048
904057
|
var import_path95 = require("path");
|
|
904049
904058
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
904050
904059
|
|
|
904060
|
+
// ../generation/local-generation/local-workspace-runner/lib/applyTypeRelocations.js
|
|
904061
|
+
init_lib8();
|
|
904062
|
+
var import_promises131 = require("fs/promises");
|
|
904063
|
+
async function applyTypeRelocations({ ir: ir3, tmpOutputDirectory, context: context3 }) {
|
|
904064
|
+
const relocationsFilepath = join8(tmpOutputDirectory, RelativeFilePath2.of(TYPE_RELOCATIONS_FILENAME));
|
|
904065
|
+
let contents;
|
|
904066
|
+
try {
|
|
904067
|
+
contents = await (0, import_promises131.readFile)(relocationsFilepath, "utf-8");
|
|
904068
|
+
} catch {
|
|
904069
|
+
return;
|
|
904070
|
+
}
|
|
904071
|
+
try {
|
|
904072
|
+
const relocations = JSON.parse(contents);
|
|
904073
|
+
if (typeof relocations !== "object" || relocations == null) {
|
|
904074
|
+
return;
|
|
904075
|
+
}
|
|
904076
|
+
const parseOptions2 = {
|
|
904077
|
+
unrecognizedObjectKeys: "passthrough",
|
|
904078
|
+
allowUnrecognizedEnumValues: true,
|
|
904079
|
+
allowUnrecognizedUnionMembers: true,
|
|
904080
|
+
skipValidation: true
|
|
904081
|
+
};
|
|
904082
|
+
for (const [typeId, rawFernFilepath] of Object.entries(relocations)) {
|
|
904083
|
+
const typeDeclaration2 = ir3.types[typeId];
|
|
904084
|
+
if (typeDeclaration2 != null) {
|
|
904085
|
+
typeDeclaration2.name = {
|
|
904086
|
+
...typeDeclaration2.name,
|
|
904087
|
+
fernFilepath: await serialization_exports2.FernFilepath.parseOrThrow(rawFernFilepath, parseOptions2)
|
|
904088
|
+
};
|
|
904089
|
+
}
|
|
904090
|
+
const dynamicType = ir3.dynamic?.types[typeId];
|
|
904091
|
+
if (dynamicType != null) {
|
|
904092
|
+
dynamicType.declaration = {
|
|
904093
|
+
...dynamicType.declaration,
|
|
904094
|
+
fernFilepath: await serialization_exports2.dynamic.FernFilepath.parseOrThrow(rawFernFilepath, parseOptions2)
|
|
904095
|
+
};
|
|
904096
|
+
}
|
|
904097
|
+
}
|
|
904098
|
+
} catch (error50) {
|
|
904099
|
+
context3.logger.warn(`Failed to apply type relocations from ${relocationsFilepath}: ${error50 instanceof Error ? error50.message : String(error50)}`);
|
|
904100
|
+
} finally {
|
|
904101
|
+
await (0, import_promises131.rm)(relocationsFilepath, { force: true });
|
|
904102
|
+
}
|
|
904103
|
+
}
|
|
904104
|
+
|
|
904051
904105
|
// ../generation/local-generation/local-workspace-runner/lib/getGeneratorConfig.js
|
|
904052
904106
|
init_lib9();
|
|
904053
904107
|
init_lib6();
|
|
@@ -904574,7 +904628,7 @@ var import_autoversion2 = __toESM(require_autoversion(), 1);
|
|
|
904574
904628
|
init_lib12();
|
|
904575
904629
|
init_lib6();
|
|
904576
904630
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
904577
|
-
var
|
|
904631
|
+
var import_promises132 = require("fs/promises");
|
|
904578
904632
|
var import_os12 = require("os");
|
|
904579
904633
|
var import_path93 = require("path");
|
|
904580
904634
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
@@ -904681,7 +904735,7 @@ var LocalTaskHandler = class {
|
|
|
904681
904735
|
try {
|
|
904682
904736
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
904683
904737
|
diffFile = await this.generateDiffFile();
|
|
904684
|
-
const diffContent = await (0,
|
|
904738
|
+
const diffContent = await (0, import_promises132.readFile)(diffFile, "utf-8");
|
|
904685
904739
|
if (diffContent.trim().length === 0) {
|
|
904686
904740
|
this.context.logger.info("No changes detected in generated SDK");
|
|
904687
904741
|
return null;
|
|
@@ -904886,7 +904940,7 @@ var LocalTaskHandler = class {
|
|
|
904886
904940
|
} finally {
|
|
904887
904941
|
if (diffFile) {
|
|
904888
904942
|
try {
|
|
904889
|
-
await (0,
|
|
904943
|
+
await (0, import_promises132.rm)(diffFile);
|
|
904890
904944
|
} catch (cleanupError) {
|
|
904891
904945
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
904892
904946
|
}
|
|
@@ -905066,7 +905120,7 @@ var LocalTaskHandler = class {
|
|
|
905066
905120
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
905067
905121
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
905068
905122
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
905069
|
-
await (0,
|
|
905123
|
+
await (0, import_promises132.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true, verbatimSymlinks: true });
|
|
905070
905124
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
905071
905125
|
await this.runThrowawayGitCommand(["config", "gc.auto", "0"], tmpOutputResolutionDir);
|
|
905072
905126
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
@@ -905087,22 +905141,22 @@ var LocalTaskHandler = class {
|
|
|
905087
905141
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
905088
905142
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
905089
905143
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
905090
|
-
await (0,
|
|
905144
|
+
await (0, import_promises132.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), {
|
|
905091
905145
|
recursive: true,
|
|
905092
905146
|
force: true,
|
|
905093
905147
|
maxRetries: 3,
|
|
905094
905148
|
retryDelay: 100
|
|
905095
905149
|
});
|
|
905096
|
-
await (0,
|
|
905097
|
-
await (0,
|
|
905150
|
+
await (0, import_promises132.rm)(this.absolutePathToLocalOutput, { recursive: true });
|
|
905151
|
+
await (0, import_promises132.cp)(tmpOutputResolutionDir, this.absolutePathToLocalOutput, { recursive: true, verbatimSymlinks: true });
|
|
905098
905152
|
}
|
|
905099
905153
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
905100
|
-
const contents = await (0,
|
|
905154
|
+
const contents = await (0, import_promises132.readdir)(this.absolutePathToLocalOutput);
|
|
905101
905155
|
const itemsToPreserve = [".git"];
|
|
905102
905156
|
if (await this.generatedOutputMissingReadme()) {
|
|
905103
905157
|
itemsToPreserve.push("README.md");
|
|
905104
905158
|
}
|
|
905105
|
-
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0,
|
|
905159
|
+
await Promise.all(contents.filter((item) => !itemsToPreserve.includes(item)).map((item) => (0, import_promises132.rm)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(item)), {
|
|
905106
905160
|
force: true,
|
|
905107
905161
|
recursive: true
|
|
905108
905162
|
})));
|
|
@@ -905110,11 +905164,11 @@ var LocalTaskHandler = class {
|
|
|
905110
905164
|
}
|
|
905111
905165
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
905112
905166
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
905113
|
-
await (0,
|
|
905167
|
+
await (0, import_promises132.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
905114
905168
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
905115
905169
|
}
|
|
905116
905170
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
905117
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
905171
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises132.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
905118
905172
|
if (firstLocalOutputItem == null) {
|
|
905119
905173
|
return;
|
|
905120
905174
|
}
|
|
@@ -905122,10 +905176,10 @@ var LocalTaskHandler = class {
|
|
|
905122
905176
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
905123
905177
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
905124
905178
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
905125
|
-
await (0,
|
|
905179
|
+
await (0, import_promises132.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true, verbatimSymlinks: true });
|
|
905126
905180
|
}
|
|
905127
905181
|
} else {
|
|
905128
|
-
await (0,
|
|
905182
|
+
await (0, import_promises132.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true, verbatimSymlinks: true });
|
|
905129
905183
|
}
|
|
905130
905184
|
}
|
|
905131
905185
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
@@ -905146,7 +905200,7 @@ var LocalTaskHandler = class {
|
|
|
905146
905200
|
*/
|
|
905147
905201
|
async generatedOutputMissingReadme() {
|
|
905148
905202
|
try {
|
|
905149
|
-
const contents = await (0,
|
|
905203
|
+
const contents = await (0, import_promises132.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
905150
905204
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
905151
905205
|
return false;
|
|
905152
905206
|
}
|
|
@@ -905196,13 +905250,13 @@ var LocalTaskHandler = class {
|
|
|
905196
905250
|
async readPriorChangelog(maxEntries) {
|
|
905197
905251
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
905198
905252
|
try {
|
|
905199
|
-
const files = await (0,
|
|
905253
|
+
const files = await (0, import_promises132.readdir)(this.absolutePathToLocalOutput);
|
|
905200
905254
|
const changelogFile = files.find((f3) => f3.toLowerCase() === "changelog.md");
|
|
905201
905255
|
if (!changelogFile) {
|
|
905202
905256
|
return "";
|
|
905203
905257
|
}
|
|
905204
905258
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
905205
|
-
const content5 = await (0,
|
|
905259
|
+
const content5 = await (0, import_promises132.readFile)(changelogPath, "utf-8");
|
|
905206
905260
|
if (content5.trim().length === 0) {
|
|
905207
905261
|
return "";
|
|
905208
905262
|
}
|
|
@@ -905278,18 +905332,18 @@ var LocalTaskHandler = class {
|
|
|
905278
905332
|
}
|
|
905279
905333
|
};
|
|
905280
905334
|
async function copySnippetJsonIfNonEmpty({ src, dest }) {
|
|
905281
|
-
const tmpStat = await (0,
|
|
905335
|
+
const tmpStat = await (0, import_promises132.stat)(src);
|
|
905282
905336
|
if (tmpStat.size === 0) {
|
|
905283
905337
|
return "skipped-empty";
|
|
905284
905338
|
}
|
|
905285
|
-
await (0,
|
|
905339
|
+
await (0, import_promises132.cp)(src, dest);
|
|
905286
905340
|
return "copied";
|
|
905287
905341
|
}
|
|
905288
905342
|
|
|
905289
905343
|
// ../generation/local-generation/local-workspace-runner/lib/rawSpecs.js
|
|
905290
905344
|
init_lib4();
|
|
905291
905345
|
init_lib8();
|
|
905292
|
-
var
|
|
905346
|
+
var import_promises133 = require("fs/promises");
|
|
905293
905347
|
init_js_yaml();
|
|
905294
905348
|
var import_path94 = __toESM(require("path"), 1);
|
|
905295
905349
|
var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
|
|
@@ -905357,7 +905411,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
905357
905411
|
});
|
|
905358
905412
|
}
|
|
905359
905413
|
resolved = filterSpec(resolved, audiences);
|
|
905360
|
-
await (0,
|
|
905414
|
+
await (0, import_promises133.writeFile)(import_path94.default.join(hostOutputDir, filename), JSON.stringify(resolved));
|
|
905361
905415
|
context3.logger.debug(`Resolved ${isAsync2 ? "AsyncAPI" : "OpenAPI"} spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
905362
905416
|
return {
|
|
905363
905417
|
type: isAsync2 ? "asyncapi" : "openapi",
|
|
@@ -905367,7 +905421,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
905367
905421
|
}
|
|
905368
905422
|
async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context: context3, index: index3 }) {
|
|
905369
905423
|
const filename = `openrpc${index3}.json`;
|
|
905370
|
-
const rawContent = await (0,
|
|
905424
|
+
const rawContent = await (0, import_promises133.readFile)(spec.absoluteFilepath, "utf-8");
|
|
905371
905425
|
let parsed;
|
|
905372
905426
|
try {
|
|
905373
905427
|
parsed = JSON.parse(rawContent);
|
|
@@ -905377,7 +905431,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
905377
905431
|
let result = parsed;
|
|
905378
905432
|
const overrides = normalizeOverrides(spec.absoluteFilepathToOverrides);
|
|
905379
905433
|
for (const overridePath of overrides) {
|
|
905380
|
-
const overrideContent = await (0,
|
|
905434
|
+
const overrideContent = await (0, import_promises133.readFile)(overridePath, "utf-8");
|
|
905381
905435
|
let overrideParsed;
|
|
905382
905436
|
try {
|
|
905383
905437
|
overrideParsed = JSON.parse(overrideContent);
|
|
@@ -905389,7 +905443,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
905389
905443
|
overrides: overrideParsed
|
|
905390
905444
|
});
|
|
905391
905445
|
}
|
|
905392
|
-
await (0,
|
|
905446
|
+
await (0, import_promises133.writeFile)(import_path94.default.join(hostOutputDir, filename), JSON.stringify(result));
|
|
905393
905447
|
context3.logger.debug(`Resolved OpenRPC spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
905394
905448
|
return {
|
|
905395
905449
|
type: "openrpc",
|
|
@@ -905400,7 +905454,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
905400
905454
|
async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
905401
905455
|
const dirName = `protobuf${index3}`;
|
|
905402
905456
|
const destDir = import_path94.default.join(hostOutputDir, dirName);
|
|
905403
|
-
await (0,
|
|
905457
|
+
await (0, import_promises133.cp)(spec.absoluteFilepathToProtobufRoot, destDir, { recursive: true });
|
|
905404
905458
|
const entry = {
|
|
905405
905459
|
type: "protobuf",
|
|
905406
905460
|
specPath: toContainerPath(dirName, containerBaseDir)
|
|
@@ -905410,7 +905464,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
905410
905464
|
entry.overridePaths = [];
|
|
905411
905465
|
for (const [i5, override] of overrides.entries()) {
|
|
905412
905466
|
const overrideName = `protobuf${index3}-override-${i5}${import_path94.default.extname(override)}`;
|
|
905413
|
-
await (0,
|
|
905467
|
+
await (0, import_promises133.copyFile)(override, import_path94.default.join(hostOutputDir, overrideName));
|
|
905414
905468
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
905415
905469
|
}
|
|
905416
905470
|
}
|
|
@@ -905419,7 +905473,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
905419
905473
|
async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
905420
905474
|
const ext2 = import_path94.default.extname(spec.absoluteFilepath) || ".graphql";
|
|
905421
905475
|
const filename = `graphql${index3}${ext2}`;
|
|
905422
|
-
await (0,
|
|
905476
|
+
await (0, import_promises133.copyFile)(spec.absoluteFilepath, import_path94.default.join(hostOutputDir, filename));
|
|
905423
905477
|
const entry = {
|
|
905424
905478
|
type: "graphql",
|
|
905425
905479
|
specPath: toContainerPath(filename, containerBaseDir),
|
|
@@ -905430,7 +905484,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
905430
905484
|
entry.overridePaths = [];
|
|
905431
905485
|
for (const [i5, override] of overrides.entries()) {
|
|
905432
905486
|
const overrideName = `graphql${index3}-override-${i5}${import_path94.default.extname(override)}`;
|
|
905433
|
-
await (0,
|
|
905487
|
+
await (0, import_promises133.copyFile)(override, import_path94.default.join(hostOutputDir, overrideName));
|
|
905434
905488
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
905435
905489
|
}
|
|
905436
905490
|
}
|
|
@@ -905438,7 +905492,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
905438
905492
|
}
|
|
905439
905493
|
async function isAsyncAPISpec(filepath) {
|
|
905440
905494
|
try {
|
|
905441
|
-
const content5 = await (0,
|
|
905495
|
+
const content5 = await (0, import_promises133.readFile)(filepath, "utf-8");
|
|
905442
905496
|
return content5.includes("asyncapi");
|
|
905443
905497
|
} catch {
|
|
905444
905498
|
return false;
|
|
@@ -905548,7 +905602,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
905548
905602
|
context: context3,
|
|
905549
905603
|
audiences
|
|
905550
905604
|
});
|
|
905551
|
-
await (0,
|
|
905605
|
+
await (0, import_promises133.writeFile)(join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of(SPECS_MANIFEST_FILENAME)), JSON.stringify(manifest, void 0, 4));
|
|
905552
905606
|
const tarGzPath = join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of("specs.tar.gz"));
|
|
905553
905607
|
await Kn({
|
|
905554
905608
|
gzip: true,
|
|
@@ -905557,7 +905611,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
905557
905611
|
portable: true,
|
|
905558
905612
|
filter: (entryPath) => entryPath !== "./specs.tar.gz"
|
|
905559
905613
|
}, ["."]);
|
|
905560
|
-
return await (0,
|
|
905614
|
+
return await (0, import_promises133.readFile)(tarGzPath);
|
|
905561
905615
|
} finally {
|
|
905562
905616
|
await tmpDir.cleanup();
|
|
905563
905617
|
}
|
|
@@ -905597,24 +905651,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905597
905651
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
905598
905652
|
const configJsonFile = (0, import_path95.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
905599
905653
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
905600
|
-
await (0,
|
|
905654
|
+
await (0, import_promises134.writeFile)(configJsonFile, "");
|
|
905601
905655
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
905602
905656
|
const tmpOutputDirectory = (0, import_path95.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
905603
905657
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
905604
|
-
await (0,
|
|
905658
|
+
await (0, import_promises134.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
905605
905659
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
905606
905660
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
905607
905661
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
905608
905662
|
const snippetJsonFile = (0, import_path95.join)(workspaceTempDir.path, "snippet.json");
|
|
905609
905663
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
905610
|
-
await (0,
|
|
905664
|
+
await (0, import_promises134.writeFile)(snippetJsonFile, "");
|
|
905611
905665
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
905612
905666
|
}
|
|
905613
905667
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
905614
905668
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
905615
905669
|
const snippetTemplatesJsonFile = (0, import_path95.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
905616
905670
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
905617
|
-
await (0,
|
|
905671
|
+
await (0, import_promises134.writeFile)(snippetTemplatesJsonFile, "");
|
|
905618
905672
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
905619
905673
|
}
|
|
905620
905674
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -905654,7 +905708,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905654
905708
|
publishToRegistry,
|
|
905655
905709
|
paths
|
|
905656
905710
|
});
|
|
905657
|
-
await (0,
|
|
905711
|
+
await (0, import_promises134.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
905658
905712
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
905659
905713
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
905660
905714
|
hostPath: source2.absoluteFilePath,
|
|
@@ -905662,7 +905716,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905662
905716
|
}));
|
|
905663
905717
|
if (rawApiSpecs != null && rawApiSpecs.length > 0) {
|
|
905664
905718
|
const rawSpecsDir = (0, import_path95.join)(workspaceTempDir.path, SPECS_DIRECTORY_NAME);
|
|
905665
|
-
await (0,
|
|
905719
|
+
await (0, import_promises134.mkdir)(rawSpecsDir, { recursive: true });
|
|
905666
905720
|
const containerSpecsDir = environment2.usesContainerPaths ? CONTAINER_SPECS_DIRECTORY : rawSpecsDir;
|
|
905667
905721
|
const manifest = await collectRawSpecs({
|
|
905668
905722
|
specs: rawApiSpecs,
|
|
@@ -905671,7 +905725,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905671
905725
|
context: context3,
|
|
905672
905726
|
audiences
|
|
905673
905727
|
});
|
|
905674
|
-
await (0,
|
|
905728
|
+
await (0, import_promises134.writeFile)((0, import_path95.join)(rawSpecsDir, SPECS_MANIFEST_FILENAME), JSON.stringify(manifest, void 0, 4));
|
|
905675
905729
|
context3.logger.debug(`Wrote raw specs manifest with ${manifest.specs.length} spec(s) to ${rawSpecsDir}`);
|
|
905676
905730
|
sourceMounts.push({
|
|
905677
905731
|
hostPath: AbsoluteFilePath2.of(rawSpecsDir),
|
|
@@ -905691,6 +905745,11 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905691
905745
|
inspect: inspect6,
|
|
905692
905746
|
runner
|
|
905693
905747
|
});
|
|
905748
|
+
await applyTypeRelocations({
|
|
905749
|
+
ir: latest2,
|
|
905750
|
+
tmpOutputDirectory: absolutePathToTmpOutputDirectory,
|
|
905751
|
+
context: context3
|
|
905752
|
+
});
|
|
905694
905753
|
const taskHandler = new LocalTaskHandler({
|
|
905695
905754
|
context: context3,
|
|
905696
905755
|
absolutePathToLocalOutput,
|
|
@@ -906423,14 +906482,14 @@ async function runVerifyPipeline({ outputDir, generatorName, generatorVersion, c
|
|
|
906423
906482
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
906424
906483
|
init_lib5();
|
|
906425
906484
|
init_lib6();
|
|
906426
|
-
var
|
|
906485
|
+
var import_promises136 = require("fs/promises");
|
|
906427
906486
|
|
|
906428
906487
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
906429
906488
|
init_lib4();
|
|
906430
906489
|
init_lib8();
|
|
906431
906490
|
init_lib9();
|
|
906432
906491
|
init_lib6();
|
|
906433
|
-
var
|
|
906492
|
+
var import_promises135 = require("fs/promises");
|
|
906434
906493
|
var LegacyGeneratorInvocationAdapter = class {
|
|
906435
906494
|
context;
|
|
906436
906495
|
constructor(config5) {
|
|
@@ -906684,7 +906743,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
906684
906743
|
code: CliError.Code.InternalError
|
|
906685
906744
|
});
|
|
906686
906745
|
}
|
|
906687
|
-
const contents = await (0,
|
|
906746
|
+
const contents = await (0, import_promises135.readFile)(absolutePath, "utf-8");
|
|
906688
906747
|
return api_exports4.GithubLicense.custom({ contents });
|
|
906689
906748
|
}
|
|
906690
906749
|
buildReadme(target) {
|
|
@@ -906910,7 +906969,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
906910
906969
|
});
|
|
906911
906970
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
906912
906971
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
906913
|
-
await (0,
|
|
906972
|
+
await (0, import_promises136.rm)(snippetPath, { force: true });
|
|
906914
906973
|
}
|
|
906915
906974
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
906916
906975
|
return {
|
|
@@ -906929,7 +906988,7 @@ init_lib4();
|
|
|
906929
906988
|
init_lib8();
|
|
906930
906989
|
init_lib5();
|
|
906931
906990
|
init_lib6();
|
|
906932
|
-
var
|
|
906991
|
+
var import_promises137 = require("fs/promises");
|
|
906933
906992
|
var import_os14 = require("os");
|
|
906934
906993
|
var LegacyRemoteGenerationRunner = class {
|
|
906935
906994
|
context;
|
|
@@ -906988,13 +907047,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
906988
907047
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
906989
907048
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
906990
907049
|
if (targetOutputDirectory != null) {
|
|
906991
|
-
await (0,
|
|
906992
|
-
await (0,
|
|
907050
|
+
await (0, import_promises137.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
907051
|
+
await (0, import_promises137.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
906993
907052
|
recursive: true,
|
|
906994
907053
|
force: true
|
|
906995
907054
|
});
|
|
906996
907055
|
}
|
|
906997
|
-
await (0,
|
|
907056
|
+
await (0, import_promises137.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
906998
907057
|
}
|
|
906999
907058
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
907000
907059
|
return {
|
|
@@ -907023,7 +907082,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
907023
907082
|
}
|
|
907024
907083
|
async getAbsolutePathToPreview(args) {
|
|
907025
907084
|
if (this.isLocalGitCombo(args)) {
|
|
907026
|
-
const tmpPreviewDirectory = await (0,
|
|
907085
|
+
const tmpPreviewDirectory = await (0, import_promises137.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
907027
907086
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
907028
907087
|
}
|
|
907029
907088
|
if (!args.preview) {
|
|
@@ -907759,7 +907818,7 @@ Example:
|
|
|
907759
907818
|
if (!exists2) {
|
|
907760
907819
|
return { shouldProceed: true };
|
|
907761
907820
|
}
|
|
907762
|
-
const files = await (0,
|
|
907821
|
+
const files = await (0, import_promises138.readdir)(outputPath);
|
|
907763
907822
|
if (files.length === 0) {
|
|
907764
907823
|
return { shouldProceed: true };
|
|
907765
907824
|
}
|
|
@@ -908169,7 +908228,7 @@ init_lib4();
|
|
|
908169
908228
|
init_lib12();
|
|
908170
908229
|
init_lib6();
|
|
908171
908230
|
var import_fs38 = require("fs");
|
|
908172
|
-
var
|
|
908231
|
+
var import_promises139 = require("fs/promises");
|
|
908173
908232
|
var import_path98 = require("path");
|
|
908174
908233
|
var import_semver14 = __toESM(require_semver2(), 1);
|
|
908175
908234
|
var import_url8 = require("url");
|
|
@@ -908279,7 +908338,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908279
908338
|
}
|
|
908280
908339
|
this.migrationsInstallPromise = (async () => {
|
|
908281
908340
|
const cacheDir = this.cachePath;
|
|
908282
|
-
await (0,
|
|
908341
|
+
await (0, import_promises139.mkdir)(cacheDir, { recursive: true });
|
|
908283
908342
|
const npmCacheDir = (0, import_path98.join)(cacheDir, ".npm-cache");
|
|
908284
908343
|
const packageDir = (0, import_path98.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
908285
908344
|
const packageJsonPath = (0, import_path98.join)(packageDir, "package.json");
|
|
@@ -908296,7 +908355,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908296
908355
|
"--no-audit",
|
|
908297
908356
|
"--no-fund"
|
|
908298
908357
|
], { doNotPipeOutput: true });
|
|
908299
|
-
const packageJsonContent = await (0,
|
|
908358
|
+
const packageJsonContent = await (0, import_promises139.readFile)(packageJsonPath, "utf-8");
|
|
908300
908359
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
908301
908360
|
if (packageJson2.main == null) {
|
|
908302
908361
|
throw new CliError({
|
|
@@ -908341,7 +908400,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908341
908400
|
const myPid = String(process.pid);
|
|
908342
908401
|
while (true) {
|
|
908343
908402
|
try {
|
|
908344
|
-
const fh = await (0,
|
|
908403
|
+
const fh = await (0, import_promises139.open)(lockPath, "wx");
|
|
908345
908404
|
await fh.writeFile(myPid);
|
|
908346
908405
|
await fh.close();
|
|
908347
908406
|
const exitHandler = () => {
|
|
@@ -908358,9 +908417,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908358
908417
|
return async () => {
|
|
908359
908418
|
process.removeListener("exit", exitHandler);
|
|
908360
908419
|
try {
|
|
908361
|
-
const currentContent = await (0,
|
|
908420
|
+
const currentContent = await (0, import_promises139.readFile)(lockPath, "utf-8");
|
|
908362
908421
|
if (currentContent.trim() === myPid) {
|
|
908363
|
-
await (0,
|
|
908422
|
+
await (0, import_promises139.unlink)(lockPath);
|
|
908364
908423
|
} else {
|
|
908365
908424
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
908366
908425
|
}
|
|
@@ -908374,14 +908433,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908374
908433
|
throw err;
|
|
908375
908434
|
}
|
|
908376
908435
|
try {
|
|
908377
|
-
const lockContent = await (0,
|
|
908436
|
+
const lockContent = await (0, import_promises139.readFile)(lockPath, "utf-8");
|
|
908378
908437
|
const lockPid = Number(lockContent.trim());
|
|
908379
|
-
const lockStat = await (0,
|
|
908438
|
+
const lockStat = await (0, import_promises139.stat)(lockPath);
|
|
908380
908439
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
908381
908440
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
908382
908441
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
908383
908442
|
try {
|
|
908384
|
-
await (0,
|
|
908443
|
+
await (0, import_promises139.unlink)(lockPath);
|
|
908385
908444
|
} catch (unlinkErr) {
|
|
908386
908445
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
908387
908446
|
}
|
|
@@ -909057,14 +909116,14 @@ var import_generator_cli5 = __toESM(require_api3(), 1);
|
|
|
909057
909116
|
|
|
909058
909117
|
// ../init/lib/initializeAPI.js
|
|
909059
909118
|
init_lib8();
|
|
909060
|
-
var
|
|
909119
|
+
var import_promises144 = require("fs/promises");
|
|
909061
909120
|
var import_fs_extra = __toESM(require_lib18(), 1);
|
|
909062
909121
|
var import_path101 = __toESM(require("path"), 1);
|
|
909063
909122
|
|
|
909064
909123
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
909065
909124
|
init_lib8();
|
|
909066
909125
|
init_lib6();
|
|
909067
|
-
var
|
|
909126
|
+
var import_promises141 = require("fs/promises");
|
|
909068
909127
|
init_lodash();
|
|
909069
909128
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
909070
909129
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -909096,7 +909155,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
909096
909155
|
}
|
|
909097
909156
|
}
|
|
909098
909157
|
}
|
|
909099
|
-
await (0,
|
|
909158
|
+
await (0, import_promises141.mkdir)(FERN_DIRECTORY);
|
|
909100
909159
|
await writeProjectConfig({
|
|
909101
909160
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
909102
909161
|
organization,
|
|
@@ -909120,11 +909179,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
909120
909179
|
organization,
|
|
909121
909180
|
version: versionOfCli
|
|
909122
909181
|
};
|
|
909123
|
-
await (0,
|
|
909182
|
+
await (0, import_promises141.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
909124
909183
|
}
|
|
909125
909184
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
909126
909185
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
909127
|
-
await (0,
|
|
909186
|
+
await (0, import_promises141.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
909128
909187
|
}
|
|
909129
909188
|
|
|
909130
909189
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -909314,7 +909373,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
909314
909373
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
909315
909374
|
init_lib4();
|
|
909316
909375
|
init_lib6();
|
|
909317
|
-
var
|
|
909376
|
+
var import_promises142 = require("fs/promises");
|
|
909318
909377
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
909319
909378
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
909320
909379
|
const formatted = await formatDefinitionFile({
|
|
@@ -909322,7 +909381,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
909322
909381
|
});
|
|
909323
909382
|
if (formatted !== file4.rawContents) {
|
|
909324
909383
|
if (shouldFix) {
|
|
909325
|
-
await (0,
|
|
909384
|
+
await (0, import_promises142.writeFile)(file4.absoluteFilePath, formatted);
|
|
909326
909385
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
909327
909386
|
} else {
|
|
909328
909387
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -909335,7 +909394,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
909335
909394
|
// ../init/lib/createWorkspace.js
|
|
909336
909395
|
init_lib8();
|
|
909337
909396
|
init_lib6();
|
|
909338
|
-
var
|
|
909397
|
+
var import_promises143 = require("fs/promises");
|
|
909339
909398
|
init_js_yaml();
|
|
909340
909399
|
|
|
909341
909400
|
// ../init/lib/sampleImdbApi.js
|
|
@@ -909536,7 +909595,7 @@ components:
|
|
|
909536
909595
|
// ../init/lib/createWorkspace.js
|
|
909537
909596
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
909538
909597
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
909539
|
-
await (0,
|
|
909598
|
+
await (0, import_promises143.mkdir)(directoryOfWorkspace);
|
|
909540
909599
|
}
|
|
909541
909600
|
await writeGeneratorsConfiguration({
|
|
909542
909601
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -909551,7 +909610,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
909551
909610
|
}
|
|
909552
909611
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
909553
909612
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
909554
|
-
await (0,
|
|
909613
|
+
await (0, import_promises143.mkdir)(directoryOfWorkspace);
|
|
909555
909614
|
}
|
|
909556
909615
|
await writeGeneratorsConfiguration({
|
|
909557
909616
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -909564,10 +909623,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
909564
909623
|
}
|
|
909565
909624
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
909566
909625
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
909567
|
-
await (0,
|
|
909626
|
+
await (0, import_promises143.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
909568
909627
|
}
|
|
909569
909628
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
909570
|
-
await (0,
|
|
909629
|
+
await (0, import_promises143.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
909571
909630
|
await writeGeneratorsConfiguration({
|
|
909572
909631
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
909573
909632
|
cliVersion,
|
|
@@ -909612,7 +909671,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
909612
909671
|
return config5;
|
|
909613
909672
|
}
|
|
909614
909673
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
909615
|
-
await (0,
|
|
909674
|
+
await (0, import_promises143.writeFile)(filepath, "# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + index_vite_proxy_tmp_default.dump(await getDefaultGeneratorsConfiguration({ cliVersion, context: context3, apiConfiguration }), {
|
|
909616
909675
|
sortKeys: (a3, b5) => {
|
|
909617
909676
|
if (a3 === "api") {
|
|
909618
909677
|
return -1;
|
|
@@ -909631,8 +909690,8 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
909631
909690
|
strategy: "status-code"
|
|
909632
909691
|
}
|
|
909633
909692
|
};
|
|
909634
|
-
await (0,
|
|
909635
|
-
await (0,
|
|
909693
|
+
await (0, import_promises143.mkdir)(directoryOfDefinition);
|
|
909694
|
+
await (0, import_promises143.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), index_vite_proxy_tmp_default.dump(rootApi));
|
|
909636
909695
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
909637
909696
|
let formattedContent;
|
|
909638
909697
|
try {
|
|
@@ -909648,7 +909707,7 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
909648
909707
|
code: CliError.Code.ParseError
|
|
909649
909708
|
});
|
|
909650
909709
|
}
|
|
909651
|
-
await (0,
|
|
909710
|
+
await (0, import_promises143.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
909652
909711
|
}
|
|
909653
909712
|
|
|
909654
909713
|
// ../init/lib/initializeAPI.js
|
|
@@ -909699,7 +909758,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
909699
909758
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
909700
909759
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
909701
909760
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
909702
|
-
await (0,
|
|
909761
|
+
await (0, import_promises144.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
909703
909762
|
if (inlinedApiDefinition) {
|
|
909704
909763
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
909705
909764
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -909736,7 +909795,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
909736
909795
|
// ../init/lib/initializeDocs.js
|
|
909737
909796
|
init_lib4();
|
|
909738
909797
|
init_lib8();
|
|
909739
|
-
var
|
|
909798
|
+
var import_promises145 = require("fs/promises");
|
|
909740
909799
|
init_js_yaml();
|
|
909741
909800
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
909742
909801
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
@@ -909752,7 +909811,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
909752
909811
|
} else {
|
|
909753
909812
|
try {
|
|
909754
909813
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
909755
|
-
await (0,
|
|
909814
|
+
await (0, import_promises145.writeFile)(docsYmlPath, index_vite_proxy_tmp_default.dump(docsConfig));
|
|
909756
909815
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
909757
909816
|
return;
|
|
909758
909817
|
} catch (writeError) {
|
|
@@ -909808,7 +909867,7 @@ var FernDocsBuilder = class {
|
|
|
909808
909867
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
909809
909868
|
init_lib8();
|
|
909810
909869
|
init_lib6();
|
|
909811
|
-
var
|
|
909870
|
+
var import_promises146 = require("fs/promises");
|
|
909812
909871
|
init_js_yaml();
|
|
909813
909872
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
909814
909873
|
openApiSpecs = {};
|
|
@@ -909868,7 +909927,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
909868
909927
|
}
|
|
909869
909928
|
async build({ outputDirectory }) {
|
|
909870
909929
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
909871
|
-
await (0,
|
|
909930
|
+
await (0, import_promises146.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
909872
909931
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
909873
909932
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value2]) => {
|
|
909874
909933
|
return [value2.tabId, value2.tabConfig];
|
|
@@ -909893,27 +909952,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
909893
909952
|
}))
|
|
909894
909953
|
};
|
|
909895
909954
|
}
|
|
909896
|
-
await (0,
|
|
909955
|
+
await (0, import_promises146.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)), index_vite_proxy_tmp_default.dump(generators_yml_exports.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml)));
|
|
909897
909956
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
909898
909957
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
909899
|
-
await (0,
|
|
909900
|
-
await (0,
|
|
909958
|
+
await (0, import_promises146.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
909959
|
+
await (0, import_promises146.cp)(absolutePath, absolutePathToOpenAPI);
|
|
909901
909960
|
}));
|
|
909902
909961
|
}
|
|
909903
|
-
await (0,
|
|
909962
|
+
await (0, import_promises146.writeFile)(join8(absolutePathToFernDirectory, RelativeFilePath2.of(DOCS_CONFIGURATION_FILENAME)), index_vite_proxy_tmp_default.dump(docs_yml_exports.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml, { omitUndefined: true })));
|
|
909904
909963
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
909905
909964
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
909906
|
-
await (0,
|
|
909965
|
+
await (0, import_promises146.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
909907
909966
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
909908
909967
|
${index_vite_proxy_tmp_default.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
909909
909968
|
|
|
909910
909969
|
` : "";
|
|
909911
|
-
await (0,
|
|
909970
|
+
await (0, import_promises146.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
909912
909971
|
}));
|
|
909913
909972
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
909914
909973
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
909915
|
-
await (0,
|
|
909916
|
-
await (0,
|
|
909974
|
+
await (0, import_promises146.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
909975
|
+
await (0, import_promises146.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
909917
909976
|
}));
|
|
909918
909977
|
}
|
|
909919
909978
|
setInstance({ companyName }) {
|
|
@@ -909947,7 +910006,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
909947
910006
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
909948
910007
|
init_lib8();
|
|
909949
910008
|
init_lib6();
|
|
909950
|
-
var
|
|
910009
|
+
var import_promises148 = require("fs/promises");
|
|
909951
910010
|
|
|
909952
910011
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
909953
910012
|
function convertColors(colors19) {
|
|
@@ -910008,10 +910067,10 @@ init_lib8();
|
|
|
910008
910067
|
|
|
910009
910068
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
910010
910069
|
init_lib8();
|
|
910011
|
-
var
|
|
910070
|
+
var import_promises147 = require("fs/promises");
|
|
910012
910071
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
910013
910072
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
910014
|
-
const text9 = await (0,
|
|
910073
|
+
const text9 = await (0, import_promises147.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
910015
910074
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
910016
910075
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
910017
910076
|
const transformedContent = markReferencedAssets({
|
|
@@ -910180,7 +910239,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
910180
910239
|
documentationTab = void 0;
|
|
910181
910240
|
tabUrlToInfo = {};
|
|
910182
910241
|
async import({ args, builder }) {
|
|
910183
|
-
const mintJsonContent = await (0,
|
|
910242
|
+
const mintJsonContent = await (0, import_promises148.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
910184
910243
|
const mint = this.parseMintJson({
|
|
910185
910244
|
content: mintJsonContent,
|
|
910186
910245
|
absolutePathToMintJson: args.absolutePathToMintJson
|
|
@@ -910325,7 +910384,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
910325
910384
|
|
|
910326
910385
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
910327
910386
|
init_lib8();
|
|
910328
|
-
var
|
|
910387
|
+
var import_promises149 = require("fs/promises");
|
|
910329
910388
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
910330
910389
|
const mintlifyImporter = new MintlifyImporter({
|
|
910331
910390
|
context: taskContext
|
|
@@ -910336,7 +910395,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
910336
910395
|
builder
|
|
910337
910396
|
});
|
|
910338
910397
|
await builder.build({ outputDirectory: outputPath });
|
|
910339
|
-
await (0,
|
|
910398
|
+
await (0, import_promises149.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
910340
910399
|
version: versionOfCli,
|
|
910341
910400
|
organization
|
|
910342
910401
|
}, void 0, 4));
|
|
@@ -910397,7 +910456,7 @@ function assertIsStringArray(val) {
|
|
|
910397
910456
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
910398
910457
|
init_lib4();
|
|
910399
910458
|
init_lib8();
|
|
910400
|
-
var
|
|
910459
|
+
var import_promises150 = require("fs/promises");
|
|
910401
910460
|
|
|
910402
910461
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
910403
910462
|
init_unist_util_visit();
|
|
@@ -913751,7 +913810,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913751
913810
|
if (response.ok) {
|
|
913752
913811
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
913753
913812
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
913754
|
-
await (0,
|
|
913813
|
+
await (0, import_promises150.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
913755
913814
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
913756
913815
|
}
|
|
913757
913816
|
}
|
|
@@ -913768,7 +913827,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913768
913827
|
*/
|
|
913769
913828
|
async getAndCreateAssetsDirectory() {
|
|
913770
913829
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
913771
|
-
await (0,
|
|
913830
|
+
await (0, import_promises150.mkdir)(assetsDirectory, { recursive: true });
|
|
913772
913831
|
return assetsDirectory;
|
|
913773
913832
|
}
|
|
913774
913833
|
/**
|
|
@@ -913818,7 +913877,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913818
913877
|
absolutePathToOutputDirectory,
|
|
913819
913878
|
section
|
|
913820
913879
|
});
|
|
913821
|
-
await (0,
|
|
913880
|
+
await (0, import_promises150.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
913822
913881
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
913823
913882
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
913824
913883
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -913833,7 +913892,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913833
913892
|
absolutePathToOutputDirectoryForSection,
|
|
913834
913893
|
page: page.slug
|
|
913835
913894
|
});
|
|
913836
|
-
await (0,
|
|
913895
|
+
await (0, import_promises150.writeFile)(absolutePathForPage, result.data.mdx);
|
|
913837
913896
|
if (result.data.images.imageURLs.length > 0) {
|
|
913838
913897
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
913839
913898
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -913846,8 +913905,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913846
913905
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
913847
913906
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
913848
913907
|
const imageDir = dirname6(imagePath);
|
|
913849
|
-
await (0,
|
|
913850
|
-
await (0,
|
|
913908
|
+
await (0, import_promises150.mkdir)(imageDir, { recursive: true });
|
|
913909
|
+
await (0, import_promises150.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
913851
913910
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
913852
913911
|
} catch (error50) {
|
|
913853
913912
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -913930,7 +913989,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913930
913989
|
|
|
913931
913990
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
913932
913991
|
init_lib8();
|
|
913933
|
-
var
|
|
913992
|
+
var import_promises151 = require("fs/promises");
|
|
913934
913993
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
913935
913994
|
const builder = new FernDocsBuilderImpl();
|
|
913936
913995
|
builder.setInstance({ companyName: organization });
|
|
@@ -913945,7 +914004,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
913945
914004
|
builder
|
|
913946
914005
|
});
|
|
913947
914006
|
await builder.build({ outputDirectory: outputPath });
|
|
913948
|
-
await (0,
|
|
914007
|
+
await (0, import_promises151.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
913949
914008
|
version: versionOfCli,
|
|
913950
914009
|
organization
|
|
913951
914010
|
}, void 0, 4));
|
|
@@ -913971,7 +914030,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
913971
914030
|
};
|
|
913972
914031
|
|
|
913973
914032
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
913974
|
-
var
|
|
914033
|
+
var import_promises152 = require("fs/promises");
|
|
913975
914034
|
init_js_yaml();
|
|
913976
914035
|
var import_path102 = require("path");
|
|
913977
914036
|
var import_tmp_promise18 = __toESM(require_tmp_promise(), 1);
|
|
@@ -913987,7 +914046,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
913987
914046
|
const filePath = (0, import_path102.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
913988
914047
|
logger4.debug("tmpDir", tmpDir.path);
|
|
913989
914048
|
logger4.debug("filePath", filePath);
|
|
913990
|
-
await (0,
|
|
914049
|
+
await (0, import_promises152.writeFile)(filePath, data2);
|
|
913991
914050
|
return {
|
|
913992
914051
|
status: LoadOpenAPIStatus.Success,
|
|
913993
914052
|
filePath
|
|
@@ -917866,7 +917925,7 @@ function getAutomationContextFromEnv() {
|
|
|
917866
917925
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
917867
917926
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
917868
917927
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
917869
|
-
cli_version: "5.23.3-
|
|
917928
|
+
cli_version: "5.23.3-798-g4d95187bafb"
|
|
917870
917929
|
};
|
|
917871
917930
|
}
|
|
917872
917931
|
function isAutomationMode() {
|
|
@@ -918692,7 +918751,7 @@ var CliContext = class _CliContext {
|
|
|
918692
918751
|
if (false) {
|
|
918693
918752
|
this.logger.error("CLI_VERSION is not defined");
|
|
918694
918753
|
}
|
|
918695
|
-
return "5.23.3-
|
|
918754
|
+
return "5.23.3-798-g4d95187bafb";
|
|
918696
918755
|
}
|
|
918697
918756
|
getCliName() {
|
|
918698
918757
|
if (false) {
|
|
@@ -919000,7 +919059,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
919000
919059
|
// ../project-loader/lib/loadProject.js
|
|
919001
919060
|
init_lib8();
|
|
919002
919061
|
init_lib6();
|
|
919003
|
-
var
|
|
919062
|
+
var import_promises153 = require("fs/promises");
|
|
919004
919063
|
|
|
919005
919064
|
// ../project-loader/lib/normalizeCommandLineApiWorkspace.js
|
|
919006
919065
|
function normalizeCommandLineApiWorkspace(input3) {
|
|
@@ -919082,7 +919141,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
919082
919141
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
919083
919142
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
919084
919143
|
if (apisDirectoryExists) {
|
|
919085
|
-
const apiDirectoryContents = await (0,
|
|
919144
|
+
const apiDirectoryContents = await (0, import_promises153.readdir)(apisDirectory, { withFileTypes: true });
|
|
919086
919145
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
919087
919146
|
if (item.isDirectory()) {
|
|
919088
919147
|
all9.push(item.name);
|
|
@@ -919159,12 +919218,12 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
919159
919218
|
// src/cliV2.ts
|
|
919160
919219
|
init_lib6();
|
|
919161
919220
|
var import_generators_sdk6 = __toESM(require_generators_sdk(), 1);
|
|
919162
|
-
var
|
|
919221
|
+
var import_promises158 = require("fs/promises");
|
|
919163
919222
|
|
|
919164
919223
|
// src/commands/generator-list/getGeneratorList.ts
|
|
919165
919224
|
init_lib4();
|
|
919166
919225
|
init_lib6();
|
|
919167
|
-
var
|
|
919226
|
+
var import_promises154 = require("fs/promises");
|
|
919168
919227
|
init_js_yaml();
|
|
919169
919228
|
var GenerationModeFilter = {
|
|
919170
919229
|
GitHub: "github",
|
|
@@ -919225,7 +919284,7 @@ async function getGeneratorList({
|
|
|
919225
919284
|
return;
|
|
919226
919285
|
}
|
|
919227
919286
|
try {
|
|
919228
|
-
await (0,
|
|
919287
|
+
await (0, import_promises154.writeFile)(outputLocation, generatorsListYaml);
|
|
919229
919288
|
} catch (error50) {
|
|
919230
919289
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
919231
919290
|
code: CliError.Code.ConfigError
|
|
@@ -919294,7 +919353,7 @@ async function getGeneratorMetadata({
|
|
|
919294
919353
|
|
|
919295
919354
|
// src/commands/organization/getOrganization.ts
|
|
919296
919355
|
init_lib6();
|
|
919297
|
-
var
|
|
919356
|
+
var import_promises155 = require("fs/promises");
|
|
919298
919357
|
async function getOrganization({
|
|
919299
919358
|
project,
|
|
919300
919359
|
outputLocation,
|
|
@@ -919306,7 +919365,7 @@ async function getOrganization({
|
|
|
919306
919365
|
return;
|
|
919307
919366
|
}
|
|
919308
919367
|
try {
|
|
919309
|
-
await (0,
|
|
919368
|
+
await (0, import_promises155.writeFile)(outputLocation, org);
|
|
919310
919369
|
} catch (error50) {
|
|
919311
919370
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
919312
919371
|
code: CliError.Code.ConfigError
|
|
@@ -919317,7 +919376,7 @@ async function getOrganization({
|
|
|
919317
919376
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
919318
919377
|
init_lib8();
|
|
919319
919378
|
init_lib6();
|
|
919320
|
-
var
|
|
919379
|
+
var import_promises157 = require("fs/promises");
|
|
919321
919380
|
var import_path104 = __toESM(require("path"), 1);
|
|
919322
919381
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
919323
919382
|
var import_yaml6 = __toESM(require_dist11(), 1);
|
|
@@ -919327,7 +919386,7 @@ init_lib4();
|
|
|
919327
919386
|
init_lib12();
|
|
919328
919387
|
init_lib6();
|
|
919329
919388
|
var import_fs40 = require("fs");
|
|
919330
|
-
var
|
|
919389
|
+
var import_promises156 = require("fs/promises");
|
|
919331
919390
|
var import_os15 = require("os");
|
|
919332
919391
|
var import_path103 = require("path");
|
|
919333
919392
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -919355,7 +919414,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
919355
919414
|
const myPid = String(process.pid);
|
|
919356
919415
|
while (true) {
|
|
919357
919416
|
try {
|
|
919358
|
-
const fh = await (0,
|
|
919417
|
+
const fh = await (0, import_promises156.open)(lockPath, "wx");
|
|
919359
919418
|
await fh.writeFile(myPid);
|
|
919360
919419
|
await fh.close();
|
|
919361
919420
|
const exitHandler = () => {
|
|
@@ -919372,9 +919431,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
919372
919431
|
return async () => {
|
|
919373
919432
|
process.removeListener("exit", exitHandler);
|
|
919374
919433
|
try {
|
|
919375
|
-
const currentContent = await (0,
|
|
919434
|
+
const currentContent = await (0, import_promises156.readFile)(lockPath, "utf-8");
|
|
919376
919435
|
if (currentContent.trim() === myPid) {
|
|
919377
|
-
await (0,
|
|
919436
|
+
await (0, import_promises156.unlink)(lockPath);
|
|
919378
919437
|
} else {
|
|
919379
919438
|
logger4.debug(
|
|
919380
919439
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -919390,14 +919449,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
919390
919449
|
throw err;
|
|
919391
919450
|
}
|
|
919392
919451
|
try {
|
|
919393
|
-
const lockContent = await (0,
|
|
919452
|
+
const lockContent = await (0, import_promises156.readFile)(lockPath, "utf-8");
|
|
919394
919453
|
const lockPid = Number(lockContent.trim());
|
|
919395
|
-
const lockStat = await (0,
|
|
919454
|
+
const lockStat = await (0, import_promises156.stat)(lockPath);
|
|
919396
919455
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
919397
919456
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
919398
919457
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
919399
919458
|
try {
|
|
919400
|
-
await (0,
|
|
919459
|
+
await (0, import_promises156.unlink)(lockPath);
|
|
919401
919460
|
} catch (unlinkErr) {
|
|
919402
919461
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
919403
919462
|
}
|
|
@@ -919421,7 +919480,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
919421
919480
|
}
|
|
919422
919481
|
migrationsInstallPromise = (async () => {
|
|
919423
919482
|
const cacheDir = getMigrationCacheDir();
|
|
919424
|
-
await (0,
|
|
919483
|
+
await (0, import_promises156.mkdir)(cacheDir, { recursive: true });
|
|
919425
919484
|
const npmCacheDir = (0, import_path103.join)(cacheDir, ".npm-cache");
|
|
919426
919485
|
const packageDir = (0, import_path103.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
919427
919486
|
const packageJsonPath = (0, import_path103.join)(packageDir, "package.json");
|
|
@@ -919438,7 +919497,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
919438
919497
|
"--no-audit",
|
|
919439
919498
|
"--no-fund"
|
|
919440
919499
|
]);
|
|
919441
|
-
const packageJsonContent = await (0,
|
|
919500
|
+
const packageJsonContent = await (0, import_promises156.readFile)(packageJsonPath, "utf-8");
|
|
919442
919501
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
919443
919502
|
if (packageJson2.main == null) {
|
|
919444
919503
|
throw new CliError({
|
|
@@ -919622,7 +919681,7 @@ async function loadAndUpdateGenerators({
|
|
|
919622
919681
|
skippedAutoreleaseDisabled: []
|
|
919623
919682
|
};
|
|
919624
919683
|
}
|
|
919625
|
-
const contents = await (0,
|
|
919684
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
919626
919685
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
919627
919686
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
919628
919687
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -919859,7 +919918,7 @@ async function upgradeGenerator({
|
|
|
919859
919918
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
919860
919919
|
});
|
|
919861
919920
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
919862
|
-
await (0,
|
|
919921
|
+
await (0, import_promises157.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
919863
919922
|
}
|
|
919864
919923
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
919865
919924
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -920259,7 +920318,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
920259
920318
|
}
|
|
920260
920319
|
if (argv.output) {
|
|
920261
920320
|
try {
|
|
920262
|
-
await (0,
|
|
920321
|
+
await (0, import_promises158.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
920263
920322
|
} catch (error50) {
|
|
920264
920323
|
cliContext.failAndThrow(
|
|
920265
920324
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -920274,7 +920333,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
920274
920333
|
}
|
|
920275
920334
|
|
|
920276
920335
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
920277
|
-
var
|
|
920336
|
+
var import_promises159 = require("fs/promises");
|
|
920278
920337
|
init_js_yaml();
|
|
920279
920338
|
async function addGeneratorToWorkspaces({
|
|
920280
920339
|
project: { apiWorkspaces },
|
|
@@ -920302,7 +920361,7 @@ async function addGeneratorToWorkspaces({
|
|
|
920302
920361
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
920303
920362
|
return;
|
|
920304
920363
|
}
|
|
920305
|
-
await (0,
|
|
920364
|
+
await (0, import_promises159.writeFile)(
|
|
920306
920365
|
absolutePathToGeneratorsConfiguration,
|
|
920307
920366
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + index_vite_proxy_tmp_default.dump(newConfiguration)
|
|
920308
920367
|
);
|
|
@@ -920369,11 +920428,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
920369
920428
|
|
|
920370
920429
|
// src/commands/generate/checkOutputDirectory.ts
|
|
920371
920430
|
init_lib8();
|
|
920372
|
-
var
|
|
920431
|
+
var import_promises162 = require("fs/promises");
|
|
920373
920432
|
|
|
920374
920433
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
920375
920434
|
init_lib8();
|
|
920376
|
-
var
|
|
920435
|
+
var import_promises160 = require("fs/promises");
|
|
920377
920436
|
|
|
920378
920437
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
920379
920438
|
init_lib8();
|
|
@@ -920393,17 +920452,17 @@ async function getOutputDirectories() {
|
|
|
920393
920452
|
if (!doesOutputDirectoriesFileExist) {
|
|
920394
920453
|
return [];
|
|
920395
920454
|
}
|
|
920396
|
-
const outputDirectoriesFileContents = await (0,
|
|
920455
|
+
const outputDirectoriesFileContents = await (0, import_promises160.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
920397
920456
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
920398
920457
|
return outputDirectories;
|
|
920399
920458
|
}
|
|
920400
920459
|
|
|
920401
920460
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
920402
|
-
var
|
|
920461
|
+
var import_promises161 = require("fs/promises");
|
|
920403
920462
|
var import_path105 = __toESM(require("path"), 1);
|
|
920404
920463
|
async function storeOutputDirectories(outputDirectories) {
|
|
920405
|
-
await (0,
|
|
920406
|
-
await (0,
|
|
920464
|
+
await (0, import_promises161.mkdir)(import_path105.default.dirname(getPathToOutputDirectoriesFile()), { recursive: true });
|
|
920465
|
+
await (0, import_promises161.writeFile)(getPathToOutputDirectoriesFile(), JSON.stringify(outputDirectories, null, 2));
|
|
920407
920466
|
}
|
|
920408
920467
|
|
|
920409
920468
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -920425,7 +920484,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
920425
920484
|
shouldProceed: true
|
|
920426
920485
|
};
|
|
920427
920486
|
}
|
|
920428
|
-
const files = await (0,
|
|
920487
|
+
const files = await (0, import_promises162.readdir)(outputPath);
|
|
920429
920488
|
if (files.length === 0) {
|
|
920430
920489
|
return {
|
|
920431
920490
|
shouldProceed: true
|
|
@@ -921408,7 +921467,7 @@ function renderOverflowWarning(failureCount) {
|
|
|
921408
921467
|
// src/commands/automations/generate/reportGenerateResults.ts
|
|
921409
921468
|
init_lib4();
|
|
921410
921469
|
var import_fs41 = require("fs");
|
|
921411
|
-
var
|
|
921470
|
+
var import_promises163 = require("fs/promises");
|
|
921412
921471
|
var JSON_SCHEMA_VERSION = 1;
|
|
921413
921472
|
function renderStdoutSummary(results) {
|
|
921414
921473
|
return formatCounts(countResults(results));
|
|
@@ -921598,12 +921657,12 @@ async function writeResults({
|
|
|
921598
921657
|
const stepSummaryPath = getGithubStepSummaryPath();
|
|
921599
921658
|
if (stepSummaryPath != null) {
|
|
921600
921659
|
try {
|
|
921601
|
-
await (0,
|
|
921660
|
+
await (0, import_promises163.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
921602
921661
|
} catch {
|
|
921603
921662
|
}
|
|
921604
921663
|
}
|
|
921605
921664
|
if (jsonOutputPath != null) {
|
|
921606
|
-
await (0,
|
|
921665
|
+
await (0, import_promises163.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
921607
921666
|
}
|
|
921608
921667
|
}
|
|
921609
921668
|
function writeResultsSync({
|
|
@@ -921927,14 +921986,14 @@ function listPreviewGroups({
|
|
|
921927
921986
|
|
|
921928
921987
|
// src/commands/automations/upgrade/executeAutomationsUpgrade.ts
|
|
921929
921988
|
init_lib6();
|
|
921930
|
-
var
|
|
921989
|
+
var import_promises192 = require("fs/promises");
|
|
921931
921990
|
|
|
921932
921991
|
// ../cli-migrations/lib/runMigrations.js
|
|
921933
921992
|
init_lib4();
|
|
921934
921993
|
init_lib6();
|
|
921935
921994
|
|
|
921936
921995
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
921937
|
-
var
|
|
921996
|
+
var import_promises164 = require("fs/promises");
|
|
921938
921997
|
|
|
921939
921998
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
921940
921999
|
init_lib8();
|
|
@@ -921970,7 +922029,7 @@ var migration = {
|
|
|
921970
922029
|
try {
|
|
921971
922030
|
const fileContents = await getFileContents(yamlFilepath);
|
|
921972
922031
|
const newContents = addDiscriminantToFile(fileContents);
|
|
921973
|
-
await (0,
|
|
922032
|
+
await (0, import_promises164.writeFile)(yamlFilepath, newContents);
|
|
921974
922033
|
} catch (error50) {
|
|
921975
922034
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
921976
922035
|
}
|
|
@@ -921978,7 +922037,7 @@ var migration = {
|
|
|
921978
922037
|
}
|
|
921979
922038
|
};
|
|
921980
922039
|
async function getFileContents(filepath) {
|
|
921981
|
-
const buffer = await (0,
|
|
922040
|
+
const buffer = await (0, import_promises164.readFile)(filepath);
|
|
921982
922041
|
return buffer.toString();
|
|
921983
922042
|
}
|
|
921984
922043
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -922007,7 +922066,7 @@ var versionMigrations = {
|
|
|
922007
922066
|
var __default = versionMigrations;
|
|
922008
922067
|
|
|
922009
922068
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
922010
|
-
var
|
|
922069
|
+
var import_promises165 = require("fs/promises");
|
|
922011
922070
|
var import_yaml7 = __toESM(require_dist11(), 1);
|
|
922012
922071
|
|
|
922013
922072
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -922050,7 +922109,7 @@ var migration2 = {
|
|
|
922050
922109
|
}
|
|
922051
922110
|
};
|
|
922052
922111
|
async function migrateFile(filepath, context3) {
|
|
922053
|
-
const contents = await (0,
|
|
922112
|
+
const contents = await (0, import_promises165.readFile)(filepath);
|
|
922054
922113
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
922055
922114
|
const types4 = parsedDocument.get("types");
|
|
922056
922115
|
if (types4 == null) {
|
|
@@ -922082,7 +922141,7 @@ async function migrateFile(filepath, context3) {
|
|
|
922082
922141
|
}
|
|
922083
922142
|
}
|
|
922084
922143
|
}
|
|
922085
|
-
await (0,
|
|
922144
|
+
await (0, import_promises165.writeFile)(filepath, parsedDocument.toString());
|
|
922086
922145
|
}
|
|
922087
922146
|
|
|
922088
922147
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -922093,7 +922152,7 @@ var versionMigrations2 = {
|
|
|
922093
922152
|
var __default2 = versionMigrations2;
|
|
922094
922153
|
|
|
922095
922154
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
922096
|
-
var
|
|
922155
|
+
var import_promises166 = require("fs/promises");
|
|
922097
922156
|
var import_yaml8 = __toESM(require_dist11(), 1);
|
|
922098
922157
|
|
|
922099
922158
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -922136,7 +922195,7 @@ var migration3 = {
|
|
|
922136
922195
|
}
|
|
922137
922196
|
};
|
|
922138
922197
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
922139
|
-
const contents = await (0,
|
|
922198
|
+
const contents = await (0, import_promises166.readFile)(filepath);
|
|
922140
922199
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
922141
922200
|
const draftGenerators = parsedDocument.get("draft");
|
|
922142
922201
|
if (draftGenerators == null) {
|
|
@@ -922163,7 +922222,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
922163
922222
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
922164
922223
|
}
|
|
922165
922224
|
});
|
|
922166
|
-
await (0,
|
|
922225
|
+
await (0, import_promises166.writeFile)(filepath, parsedDocument.toString());
|
|
922167
922226
|
}
|
|
922168
922227
|
|
|
922169
922228
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -922174,7 +922233,7 @@ var versionMigrations3 = {
|
|
|
922174
922233
|
var __default3 = versionMigrations3;
|
|
922175
922234
|
|
|
922176
922235
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
922177
|
-
var
|
|
922236
|
+
var import_promises167 = require("fs/promises");
|
|
922178
922237
|
var import_yaml9 = __toESM(require_dist11(), 1);
|
|
922179
922238
|
|
|
922180
922239
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -922217,7 +922276,7 @@ var migration4 = {
|
|
|
922217
922276
|
}
|
|
922218
922277
|
};
|
|
922219
922278
|
async function migrateFile2(filepath, context3) {
|
|
922220
|
-
const contents = await (0,
|
|
922279
|
+
const contents = await (0, import_promises167.readFile)(filepath);
|
|
922221
922280
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
922222
922281
|
const addType = (typeName, typeDeclaration2) => {
|
|
922223
922282
|
const types4 = parsedDocument.get("types");
|
|
@@ -922261,7 +922320,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
922261
922320
|
}
|
|
922262
922321
|
}
|
|
922263
922322
|
}
|
|
922264
|
-
await (0,
|
|
922323
|
+
await (0, import_promises167.writeFile)(filepath, parsedDocument.toString());
|
|
922265
922324
|
}
|
|
922266
922325
|
|
|
922267
922326
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -922272,7 +922331,7 @@ var versionMigrations4 = {
|
|
|
922272
922331
|
var __default4 = versionMigrations4;
|
|
922273
922332
|
|
|
922274
922333
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
922275
|
-
var
|
|
922334
|
+
var import_promises168 = require("fs/promises");
|
|
922276
922335
|
var import_yaml10 = __toESM(require_dist11(), 1);
|
|
922277
922336
|
|
|
922278
922337
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -922315,7 +922374,7 @@ var migration5 = {
|
|
|
922315
922374
|
}
|
|
922316
922375
|
};
|
|
922317
922376
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
922318
|
-
const contents = await (0,
|
|
922377
|
+
const contents = await (0, import_promises168.readFile)(filepath);
|
|
922319
922378
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
922320
922379
|
const releaseGenerators = parsedDocument.get("release");
|
|
922321
922380
|
if (releaseGenerators == null) {
|
|
@@ -922353,7 +922412,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
922353
922412
|
}
|
|
922354
922413
|
releaseGenerator.delete("outputs");
|
|
922355
922414
|
});
|
|
922356
|
-
await (0,
|
|
922415
|
+
await (0, import_promises168.writeFile)(filepath, parsedDocument.toString());
|
|
922357
922416
|
}
|
|
922358
922417
|
|
|
922359
922418
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -922364,7 +922423,7 @@ var versionMigrations5 = {
|
|
|
922364
922423
|
var __default5 = versionMigrations5;
|
|
922365
922424
|
|
|
922366
922425
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
922367
|
-
var
|
|
922426
|
+
var import_promises169 = require("fs/promises");
|
|
922368
922427
|
|
|
922369
922428
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
922370
922429
|
init_lib8();
|
|
@@ -922397,9 +922456,9 @@ var migration6 = {
|
|
|
922397
922456
|
run: async ({ context: context3 }) => {
|
|
922398
922457
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
922399
922458
|
for (const filepath of yamlFiles) {
|
|
922400
|
-
const contents = await (0,
|
|
922459
|
+
const contents = await (0, import_promises169.readFile)(filepath);
|
|
922401
922460
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
922402
|
-
await (0,
|
|
922461
|
+
await (0, import_promises169.writeFile)(filepath, newContents);
|
|
922403
922462
|
}
|
|
922404
922463
|
}
|
|
922405
922464
|
};
|
|
@@ -922412,7 +922471,7 @@ var versionMigrations6 = {
|
|
|
922412
922471
|
var __default6 = versionMigrations6;
|
|
922413
922472
|
|
|
922414
922473
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
922415
|
-
var
|
|
922474
|
+
var import_promises170 = require("fs/promises");
|
|
922416
922475
|
|
|
922417
922476
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
922418
922477
|
init_lib8();
|
|
@@ -922445,9 +922504,9 @@ var migration7 = {
|
|
|
922445
922504
|
run: async ({ context: context3 }) => {
|
|
922446
922505
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
922447
922506
|
for (const filepath of yamlFiles) {
|
|
922448
|
-
const contents = await (0,
|
|
922507
|
+
const contents = await (0, import_promises170.readFile)(filepath);
|
|
922449
922508
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
922450
|
-
await (0,
|
|
922509
|
+
await (0, import_promises170.writeFile)(filepath, newContents);
|
|
922451
922510
|
}
|
|
922452
922511
|
}
|
|
922453
922512
|
};
|
|
@@ -922461,7 +922520,7 @@ var __default7 = versionMigrations7;
|
|
|
922461
922520
|
|
|
922462
922521
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
922463
922522
|
init_lib4();
|
|
922464
|
-
var
|
|
922523
|
+
var import_promises171 = require("fs/promises");
|
|
922465
922524
|
init_js_yaml();
|
|
922466
922525
|
|
|
922467
922526
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
@@ -922594,7 +922653,7 @@ var migration8 = {
|
|
|
922594
922653
|
}
|
|
922595
922654
|
};
|
|
922596
922655
|
async function migrateGeneratorsYml3(filepath) {
|
|
922597
|
-
const contentsStr = await (0,
|
|
922656
|
+
const contentsStr = await (0, import_promises171.readFile)(filepath);
|
|
922598
922657
|
const contents = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
922599
922658
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
922600
922659
|
let newGeneratorsConfiguration = {};
|
|
@@ -922612,7 +922671,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
922612
922671
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
922613
922672
|
};
|
|
922614
922673
|
}
|
|
922615
|
-
await (0,
|
|
922674
|
+
await (0, import_promises171.writeFile)(filepath, index_vite_proxy_tmp_default.dump(newGeneratorsConfiguration));
|
|
922616
922675
|
}
|
|
922617
922676
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
922618
922677
|
const newSchema = {
|
|
@@ -922687,7 +922746,7 @@ var versionMigrations8 = {
|
|
|
922687
922746
|
var __default8 = versionMigrations8;
|
|
922688
922747
|
|
|
922689
922748
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
922690
|
-
var
|
|
922749
|
+
var import_promises172 = require("fs/promises");
|
|
922691
922750
|
var import_yaml11 = __toESM(require_dist11(), 1);
|
|
922692
922751
|
|
|
922693
922752
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -922730,7 +922789,7 @@ var migration9 = {
|
|
|
922730
922789
|
}
|
|
922731
922790
|
};
|
|
922732
922791
|
async function migrateRootApiFile(filepath) {
|
|
922733
|
-
const contents = await (0,
|
|
922792
|
+
const contents = await (0, import_promises172.readFile)(filepath);
|
|
922734
922793
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
922735
922794
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
922736
922795
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -922741,7 +922800,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
922741
922800
|
"property-name": errorDiscriminant.value
|
|
922742
922801
|
});
|
|
922743
922802
|
parsedDocument.delete("error-discriminant");
|
|
922744
|
-
await (0,
|
|
922803
|
+
await (0, import_promises172.writeFile)(filepath, parsedDocument.toString());
|
|
922745
922804
|
}
|
|
922746
922805
|
|
|
922747
922806
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -922752,7 +922811,7 @@ var versionMigrations9 = {
|
|
|
922752
922811
|
var __default9 = versionMigrations9;
|
|
922753
922812
|
|
|
922754
922813
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
922755
|
-
var
|
|
922814
|
+
var import_promises173 = require("fs/promises");
|
|
922756
922815
|
var import_yaml12 = __toESM(require_dist11(), 1);
|
|
922757
922816
|
|
|
922758
922817
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -922795,7 +922854,7 @@ var migration10 = {
|
|
|
922795
922854
|
}
|
|
922796
922855
|
};
|
|
922797
922856
|
async function migrateYamlFile(filepath, context3) {
|
|
922798
|
-
const contents = await (0,
|
|
922857
|
+
const contents = await (0, import_promises173.readFile)(filepath);
|
|
922799
922858
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
922800
922859
|
const services = parsedDocument.get("services");
|
|
922801
922860
|
if (services == null) {
|
|
@@ -922835,7 +922894,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
922835
922894
|
context3.failWithoutThrowing("Failed to convert endpoint", e2);
|
|
922836
922895
|
}
|
|
922837
922896
|
}
|
|
922838
|
-
await (0,
|
|
922897
|
+
await (0, import_promises173.writeFile)(filepath, parsedDocument.toString());
|
|
922839
922898
|
}
|
|
922840
922899
|
}
|
|
922841
922900
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -922914,7 +922973,7 @@ var versionMigrations10 = {
|
|
|
922914
922973
|
var __default10 = versionMigrations10;
|
|
922915
922974
|
|
|
922916
922975
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
922917
|
-
var
|
|
922976
|
+
var import_promises174 = require("fs/promises");
|
|
922918
922977
|
var import_yaml13 = __toESM(require_dist11(), 1);
|
|
922919
922978
|
|
|
922920
922979
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -922957,7 +923016,7 @@ var migration11 = {
|
|
|
922957
923016
|
}
|
|
922958
923017
|
};
|
|
922959
923018
|
async function migrateYamlFile2(filepath, context3) {
|
|
922960
|
-
const contents = await (0,
|
|
923019
|
+
const contents = await (0, import_promises174.readFile)(filepath);
|
|
922961
923020
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
922962
923021
|
const types4 = parsedDocument.get("types");
|
|
922963
923022
|
if (types4 == null) {
|
|
@@ -922983,7 +923042,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
922983
923042
|
examples.set(i5, { value: value2 });
|
|
922984
923043
|
}
|
|
922985
923044
|
}
|
|
922986
|
-
await (0,
|
|
923045
|
+
await (0, import_promises174.writeFile)(filepath, parsedDocument.toString());
|
|
922987
923046
|
}
|
|
922988
923047
|
|
|
922989
923048
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -922994,7 +923053,7 @@ var versionMigrations11 = {
|
|
|
922994
923053
|
var __default11 = versionMigrations11;
|
|
922995
923054
|
|
|
922996
923055
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
922997
|
-
var
|
|
923056
|
+
var import_promises175 = require("fs/promises");
|
|
922998
923057
|
var import_yaml14 = __toESM(require_dist11(), 1);
|
|
922999
923058
|
|
|
923000
923059
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -923037,7 +923096,7 @@ var migration12 = {
|
|
|
923037
923096
|
}
|
|
923038
923097
|
};
|
|
923039
923098
|
async function migrateYamlFile3(filepath, context3) {
|
|
923040
|
-
const contents = await (0,
|
|
923099
|
+
const contents = await (0, import_promises175.readFile)(filepath);
|
|
923041
923100
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
923042
923101
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
923043
923102
|
return context3.failAndThrow("File is not a map");
|
|
@@ -923067,7 +923126,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
923067
923126
|
pair.value = firstService.value;
|
|
923068
923127
|
}
|
|
923069
923128
|
}
|
|
923070
|
-
await (0,
|
|
923129
|
+
await (0, import_promises175.writeFile)(filepath, parsedDocument.toString());
|
|
923071
923130
|
}
|
|
923072
923131
|
|
|
923073
923132
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -923078,7 +923137,7 @@ var versionMigrations12 = {
|
|
|
923078
923137
|
var __default12 = versionMigrations12;
|
|
923079
923138
|
|
|
923080
923139
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
923081
|
-
var
|
|
923140
|
+
var import_promises176 = require("fs/promises");
|
|
923082
923141
|
var import_yaml15 = __toESM(require_dist11(), 1);
|
|
923083
923142
|
|
|
923084
923143
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -923121,7 +923180,7 @@ var migration13 = {
|
|
|
923121
923180
|
}
|
|
923122
923181
|
};
|
|
923123
923182
|
async function migrateYamlFile4(filepath, context3) {
|
|
923124
|
-
const contents = await (0,
|
|
923183
|
+
const contents = await (0, import_promises176.readFile)(filepath);
|
|
923125
923184
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
923126
923185
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
923127
923186
|
return context3.failAndThrow("File is not a map");
|
|
@@ -923140,7 +923199,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
923140
923199
|
}
|
|
923141
923200
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
923142
923201
|
parsedDocument.contents.items.unshift(docsPair);
|
|
923143
|
-
await (0,
|
|
923202
|
+
await (0, import_promises176.writeFile)(filepath, parsedDocument.toString());
|
|
923144
923203
|
}
|
|
923145
923204
|
|
|
923146
923205
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -923151,7 +923210,7 @@ var versionMigrations13 = {
|
|
|
923151
923210
|
var __default13 = versionMigrations13;
|
|
923152
923211
|
|
|
923153
923212
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
923154
|
-
var
|
|
923213
|
+
var import_promises177 = require("fs/promises");
|
|
923155
923214
|
|
|
923156
923215
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
923157
923216
|
init_lib8();
|
|
@@ -923193,14 +923252,14 @@ var migration14 = {
|
|
|
923193
923252
|
}
|
|
923194
923253
|
};
|
|
923195
923254
|
async function migrateYamlFile5(filepath) {
|
|
923196
|
-
const contents = await (0,
|
|
923255
|
+
const contents = await (0, import_promises177.readFile)(filepath);
|
|
923197
923256
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
923198
923257
|
const regex6 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
923199
923258
|
const updatedSnapshot = contents.toString().replace(regex6, (_match, _prefix, domain3) => {
|
|
923200
923259
|
return `docs:
|
|
923201
923260
|
domain: "${domain3}.${domainSuffix}"`;
|
|
923202
923261
|
});
|
|
923203
|
-
await (0,
|
|
923262
|
+
await (0, import_promises177.writeFile)(filepath, updatedSnapshot.toString());
|
|
923204
923263
|
}
|
|
923205
923264
|
|
|
923206
923265
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -923220,11 +923279,11 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
923220
923279
|
|
|
923221
923280
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
923222
923281
|
init_lib8();
|
|
923223
|
-
var
|
|
923282
|
+
var import_promises178 = require("fs/promises");
|
|
923224
923283
|
init_js_yaml();
|
|
923225
923284
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
923226
923285
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
923227
|
-
const contentsStr = await (0,
|
|
923286
|
+
const contentsStr = await (0, import_promises178.readFile)(filepath);
|
|
923228
923287
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
923229
923288
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
923230
923289
|
if (result.ok) {
|
|
@@ -923243,7 +923302,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
923243
923302
|
|
|
923244
923303
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
923245
923304
|
init_lib8();
|
|
923246
|
-
var
|
|
923305
|
+
var import_promises180 = require("fs/promises");
|
|
923247
923306
|
init_js_yaml();
|
|
923248
923307
|
|
|
923249
923308
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
@@ -923452,11 +923511,11 @@ __export(legacy_exports, {
|
|
|
923452
923511
|
|
|
923453
923512
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
923454
923513
|
init_lib8();
|
|
923455
|
-
var
|
|
923514
|
+
var import_promises179 = require("fs/promises");
|
|
923456
923515
|
init_js_yaml();
|
|
923457
923516
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
923458
923517
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
923459
|
-
const contentsStr = await (0,
|
|
923518
|
+
const contentsStr = await (0, import_promises179.readFile)(filepath);
|
|
923460
923519
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
923461
923520
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
923462
923521
|
if (result.success) {
|
|
@@ -923486,7 +923545,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
923486
923545
|
var APIS_DIRECTORY2 = "apis";
|
|
923487
923546
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
923488
923547
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
923489
|
-
await (0,
|
|
923548
|
+
await (0, import_promises180.mkdir)(absolutePathToApisDirectory);
|
|
923490
923549
|
for (const workspace of workspaces) {
|
|
923491
923550
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
923492
923551
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -923494,11 +923553,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
923494
923553
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
923495
923554
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
923496
923555
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
923497
|
-
await (0,
|
|
923556
|
+
await (0, import_promises180.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
923498
923557
|
}
|
|
923499
923558
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
923500
923559
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
923501
|
-
await (0,
|
|
923560
|
+
await (0, import_promises180.rm)(absolutePathToWorkspace, { recursive: true });
|
|
923502
923561
|
}
|
|
923503
923562
|
}
|
|
923504
923563
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -923511,7 +923570,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
923511
923570
|
generatorsConfiguration,
|
|
923512
923571
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
923513
923572
|
});
|
|
923514
|
-
await (0,
|
|
923573
|
+
await (0, import_promises180.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
923515
923574
|
return convertedResponse.docsURLs;
|
|
923516
923575
|
}
|
|
923517
923576
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -923525,12 +923584,12 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
923525
923584
|
apiName
|
|
923526
923585
|
});
|
|
923527
923586
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
923528
|
-
await (0,
|
|
923587
|
+
await (0, import_promises180.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
923529
923588
|
}
|
|
923530
923589
|
|
|
923531
923590
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
923532
923591
|
init_lib8();
|
|
923533
|
-
var
|
|
923592
|
+
var import_promises181 = require("fs/promises");
|
|
923534
923593
|
init_js_yaml();
|
|
923535
923594
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
923536
923595
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
@@ -923538,8 +923597,8 @@ async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePa
|
|
|
923538
923597
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
923539
923598
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
923540
923599
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
923541
|
-
await (0,
|
|
923542
|
-
await (0,
|
|
923600
|
+
await (0, import_promises181.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
923601
|
+
await (0, import_promises181.rm)(absolutePathToWorkspace, { recursive: true });
|
|
923543
923602
|
}
|
|
923544
923603
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
923545
923604
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -923552,7 +923611,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
923552
923611
|
apiName: void 0
|
|
923553
923612
|
});
|
|
923554
923613
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
923555
|
-
await (0,
|
|
923614
|
+
await (0, import_promises181.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
923556
923615
|
}
|
|
923557
923616
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
923558
923617
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -923564,24 +923623,24 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
923564
923623
|
generatorsConfiguration,
|
|
923565
923624
|
pathModificationStrategy: "MoveUp"
|
|
923566
923625
|
});
|
|
923567
|
-
await (0,
|
|
923626
|
+
await (0, import_promises181.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
923568
923627
|
return convertedResponse.docsURLs;
|
|
923569
923628
|
}
|
|
923570
923629
|
|
|
923571
923630
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
923572
923631
|
init_lib8();
|
|
923573
|
-
var
|
|
923632
|
+
var import_promises182 = require("fs/promises");
|
|
923574
923633
|
init_js_yaml();
|
|
923575
923634
|
var APIS_DIRECTORY3 = "apis";
|
|
923576
923635
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
923577
923636
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
923578
|
-
await (0,
|
|
923637
|
+
await (0, import_promises182.mkdir)(absolutePathToApisDirectory);
|
|
923579
923638
|
for (const workspace of workspaces) {
|
|
923580
923639
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
923581
923640
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
923582
923641
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
923583
923642
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
923584
|
-
await (0,
|
|
923643
|
+
await (0, import_promises182.rm)(absolutePathToWorkspace, { recursive: true });
|
|
923585
923644
|
}
|
|
923586
923645
|
}
|
|
923587
923646
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -923594,17 +923653,17 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
923594
923653
|
generatorsConfiguration,
|
|
923595
923654
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
923596
923655
|
});
|
|
923597
|
-
await (0,
|
|
923656
|
+
await (0, import_promises182.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
923598
923657
|
}
|
|
923599
923658
|
|
|
923600
923659
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
923601
923660
|
init_lib8();
|
|
923602
|
-
var
|
|
923661
|
+
var import_promises183 = require("fs/promises");
|
|
923603
923662
|
init_js_yaml();
|
|
923604
923663
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
923605
923664
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
923606
923665
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
923607
|
-
await (0,
|
|
923666
|
+
await (0, import_promises183.rm)(absolutePathToWorkspace, { recursive: true });
|
|
923608
923667
|
}
|
|
923609
923668
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
923610
923669
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -923616,7 +923675,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
923616
923675
|
generatorsConfiguration,
|
|
923617
923676
|
pathModificationStrategy: "MoveUp"
|
|
923618
923677
|
});
|
|
923619
|
-
await (0,
|
|
923678
|
+
await (0, import_promises183.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
923620
923679
|
}
|
|
923621
923680
|
|
|
923622
923681
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -923694,7 +923753,7 @@ var __default15 = versionMigrations15;
|
|
|
923694
923753
|
|
|
923695
923754
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
923696
923755
|
init_lib8();
|
|
923697
|
-
var
|
|
923756
|
+
var import_promises184 = require("fs/promises");
|
|
923698
923757
|
init_js_yaml();
|
|
923699
923758
|
var import_yaml16 = __toESM(require_dist11(), 1);
|
|
923700
923759
|
var migration16 = {
|
|
@@ -923738,7 +923797,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
923738
923797
|
if (existingGeneratorsYml == null) {
|
|
923739
923798
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
923740
923799
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
923741
|
-
await (0,
|
|
923800
|
+
await (0, import_promises184.writeFile)(absolutePathToGeneratorsYml, index_vite_proxy_tmp_default.dump({
|
|
923742
923801
|
api: {
|
|
923743
923802
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
923744
923803
|
}
|
|
@@ -923753,7 +923812,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
923753
923812
|
parsedDocument.set("api", {
|
|
923754
923813
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
923755
923814
|
});
|
|
923756
|
-
await (0,
|
|
923815
|
+
await (0, import_promises184.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
923757
923816
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
923758
923817
|
}
|
|
923759
923818
|
}
|
|
@@ -923781,7 +923840,7 @@ var __default16 = versionMigrations16;
|
|
|
923781
923840
|
|
|
923782
923841
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
923783
923842
|
init_lib8();
|
|
923784
|
-
var
|
|
923843
|
+
var import_promises185 = require("fs/promises");
|
|
923785
923844
|
init_js_yaml();
|
|
923786
923845
|
var import_yaml17 = __toESM(require_dist11(), 1);
|
|
923787
923846
|
var migration17 = {
|
|
@@ -923962,7 +924021,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
923962
924021
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
923963
924022
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
923964
924023
|
}
|
|
923965
|
-
await (0,
|
|
924024
|
+
await (0, import_promises185.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
923966
924025
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
923967
924026
|
}
|
|
923968
924027
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -924009,7 +924068,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
924009
924068
|
}
|
|
924010
924069
|
let specContent;
|
|
924011
924070
|
try {
|
|
924012
|
-
const fileContents = await (0,
|
|
924071
|
+
const fileContents = await (0, import_promises185.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
924013
924072
|
specContent = index_vite_proxy_tmp_default.load(fileContents);
|
|
924014
924073
|
} catch (e2) {
|
|
924015
924074
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e2}. Skipping...`);
|
|
@@ -924113,7 +924172,7 @@ var __default17 = versionMigrations17;
|
|
|
924113
924172
|
|
|
924114
924173
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
924115
924174
|
init_lib8();
|
|
924116
|
-
var
|
|
924175
|
+
var import_promises186 = require("fs/promises");
|
|
924117
924176
|
init_js_yaml();
|
|
924118
924177
|
var migration18 = {
|
|
924119
924178
|
name: "add-path-parameter-order-setting",
|
|
@@ -924202,7 +924261,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
924202
924261
|
documentToWrite = `${schemaComment}
|
|
924203
924262
|
${documentToWrite}`;
|
|
924204
924263
|
}
|
|
924205
|
-
await (0,
|
|
924264
|
+
await (0, import_promises186.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924206
924265
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924207
924266
|
}
|
|
924208
924267
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -924239,7 +924298,7 @@ var __default18 = versionMigrations18;
|
|
|
924239
924298
|
|
|
924240
924299
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
924241
924300
|
init_lib8();
|
|
924242
|
-
var
|
|
924301
|
+
var import_promises187 = require("fs/promises");
|
|
924243
924302
|
init_js_yaml();
|
|
924244
924303
|
var migration19 = {
|
|
924245
924304
|
name: "update-1_0_0-defaults",
|
|
@@ -924415,7 +924474,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
924415
924474
|
documentToWrite = `${schemaComment}
|
|
924416
924475
|
${documentToWrite}`;
|
|
924417
924476
|
}
|
|
924418
|
-
await (0,
|
|
924477
|
+
await (0, import_promises187.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924419
924478
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924420
924479
|
}
|
|
924421
924480
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -924485,7 +924544,7 @@ var __default19 = versionMigrations19;
|
|
|
924485
924544
|
|
|
924486
924545
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
924487
924546
|
init_lib8();
|
|
924488
|
-
var
|
|
924547
|
+
var import_promises188 = require("fs/promises");
|
|
924489
924548
|
init_js_yaml();
|
|
924490
924549
|
var migration20 = {
|
|
924491
924550
|
name: "update-2_0_0-defaults",
|
|
@@ -924661,7 +924720,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
924661
924720
|
documentToWrite = `${schemaComment}
|
|
924662
924721
|
${documentToWrite}`;
|
|
924663
924722
|
}
|
|
924664
|
-
await (0,
|
|
924723
|
+
await (0, import_promises188.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924665
924724
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924666
924725
|
}
|
|
924667
924726
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -924708,7 +924767,7 @@ var __default20 = versionMigrations20;
|
|
|
924708
924767
|
|
|
924709
924768
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
924710
924769
|
init_lib8();
|
|
924711
|
-
var
|
|
924770
|
+
var import_promises189 = require("fs/promises");
|
|
924712
924771
|
init_js_yaml();
|
|
924713
924772
|
var migration21 = {
|
|
924714
924773
|
name: "migrate-deprecated-generator-api-settings",
|
|
@@ -924800,7 +924859,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
924800
924859
|
documentToWrite = `${schemaComment}
|
|
924801
924860
|
${documentToWrite}`;
|
|
924802
924861
|
}
|
|
924803
|
-
await (0,
|
|
924862
|
+
await (0, import_promises189.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924804
924863
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924805
924864
|
}
|
|
924806
924865
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -924847,7 +924906,7 @@ var __default21 = versionMigrations21;
|
|
|
924847
924906
|
|
|
924848
924907
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
924849
924908
|
init_lib8();
|
|
924850
|
-
var
|
|
924909
|
+
var import_promises190 = require("fs/promises");
|
|
924851
924910
|
init_js_yaml();
|
|
924852
924911
|
var migration22 = {
|
|
924853
924912
|
name: "enable-smart-casing",
|
|
@@ -924932,7 +924991,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
924932
924991
|
documentToWrite = `${schemaComment}
|
|
924933
924992
|
${documentToWrite}`;
|
|
924934
924993
|
}
|
|
924935
|
-
await (0,
|
|
924994
|
+
await (0, import_promises190.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924936
924995
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924937
924996
|
}
|
|
924938
924997
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -925075,7 +925134,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
925075
925134
|
// src/commands/upgrade/upgrade.ts
|
|
925076
925135
|
init_lib12();
|
|
925077
925136
|
init_lib6();
|
|
925078
|
-
var
|
|
925137
|
+
var import_promises191 = require("fs/promises");
|
|
925079
925138
|
|
|
925080
925139
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
925081
925140
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -926130,7 +926189,7 @@ async function upgrade({
|
|
|
926130
926189
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
926131
926190
|
draft.version = resolvedTargetVersion;
|
|
926132
926191
|
});
|
|
926133
|
-
await (0,
|
|
926192
|
+
await (0, import_promises191.writeFile)(
|
|
926134
926193
|
projectConfig2._absolutePath,
|
|
926135
926194
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
926136
926195
|
);
|
|
@@ -926287,7 +926346,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
926287
926346
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
926288
926347
|
});
|
|
926289
926348
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
926290
|
-
await (0,
|
|
926349
|
+
await (0, import_promises192.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
926291
926350
|
}
|
|
926292
926351
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
926293
926352
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -926762,7 +926821,7 @@ async function previewDocsWorkspace({
|
|
|
926762
926821
|
// src/commands/docs-diff/docsDiff.ts
|
|
926763
926822
|
init_lib8();
|
|
926764
926823
|
init_lib6();
|
|
926765
|
-
var
|
|
926824
|
+
var import_promises193 = require("fs/promises");
|
|
926766
926825
|
var import_pngjs2 = __toESM(require_png(), 1);
|
|
926767
926826
|
async function getSlugForFiles2({
|
|
926768
926827
|
previewUrl,
|
|
@@ -926985,8 +927044,8 @@ async function generateComparisons2({
|
|
|
926985
927044
|
afterPath,
|
|
926986
927045
|
comparisonBasePath
|
|
926987
927046
|
}) {
|
|
926988
|
-
const beforePng = import_pngjs2.PNG.sync.read(await (0,
|
|
926989
|
-
const afterPng = import_pngjs2.PNG.sync.read(await (0,
|
|
927047
|
+
const beforePng = import_pngjs2.PNG.sync.read(await (0, import_promises193.readFile)(beforePath));
|
|
927048
|
+
const afterPng = import_pngjs2.PNG.sync.read(await (0, import_promises193.readFile)(afterPath));
|
|
926990
927049
|
const beforeOriginalHeight = beforePng.height;
|
|
926991
927050
|
const afterOriginalHeight = afterPng.height;
|
|
926992
927051
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -927024,7 +927083,7 @@ async function generateComparisons2({
|
|
|
927024
927083
|
const sideBySide = createSideBySideComparison2(croppedBefore, croppedAfter, 20, true);
|
|
927025
927084
|
const outPath = `${base4}-region-${i5 + 1}.png`;
|
|
927026
927085
|
const pngBuffer = import_pngjs2.PNG.sync.write(sideBySide);
|
|
927027
|
-
await (0,
|
|
927086
|
+
await (0, import_promises193.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
927028
927087
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
927029
927088
|
}
|
|
927030
927089
|
return results;
|
|
@@ -927103,7 +927162,7 @@ async function docsDiff({
|
|
|
927103
927162
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
927104
927163
|
);
|
|
927105
927164
|
if (!await doesPathExist(outputPath)) {
|
|
927106
|
-
await (0,
|
|
927165
|
+
await (0, import_promises193.mkdir)(outputPath, { recursive: true });
|
|
927107
927166
|
}
|
|
927108
927167
|
const results = [];
|
|
927109
927168
|
await cliContext.runTask(async (context3) => {
|
|
@@ -927524,7 +927583,7 @@ init_lib6();
|
|
|
927524
927583
|
|
|
927525
927584
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
927526
927585
|
init_lib8();
|
|
927527
|
-
var
|
|
927586
|
+
var import_promises194 = require("fs/promises");
|
|
927528
927587
|
init_js_yaml();
|
|
927529
927588
|
var import_path106 = __toESM(require("path"), 1);
|
|
927530
927589
|
var ThemeExporter = class {
|
|
@@ -927537,18 +927596,18 @@ var ThemeExporter = class {
|
|
|
927537
927596
|
const docsDir = import_path106.default.dirname(docsYmlPath);
|
|
927538
927597
|
const outDir = output2 != null ? import_path106.default.resolve(process.cwd(), output2) : import_path106.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
927539
927598
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
927540
|
-
const raw = index_vite_proxy_tmp_default.load(await (0,
|
|
927599
|
+
const raw = index_vite_proxy_tmp_default.load(await (0, import_promises194.readFile)(docsYmlPath, "utf-8"));
|
|
927541
927600
|
const themeConfig = {};
|
|
927542
927601
|
for (const [k4, v3] of Object.entries(raw)) {
|
|
927543
927602
|
if (docs_yml_exports.THEME_ELIGIBLE_YAML_KEYS.has(k4)) {
|
|
927544
927603
|
themeConfig[k4] = v3;
|
|
927545
927604
|
}
|
|
927546
927605
|
}
|
|
927547
|
-
await (0,
|
|
927606
|
+
await (0, import_promises194.mkdir)(outDir, { recursive: true });
|
|
927548
927607
|
const assetsDir = import_path106.default.join(outDir, "assets");
|
|
927549
|
-
await (0,
|
|
927608
|
+
await (0, import_promises194.mkdir)(assetsDir, { recursive: true });
|
|
927550
927609
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
927551
|
-
await (0,
|
|
927610
|
+
await (0, import_promises194.writeFile)(import_path106.default.join(outDir, "theme.yml"), index_vite_proxy_tmp_default.dump(exported), "utf-8");
|
|
927552
927611
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
927553
927612
|
}
|
|
927554
927613
|
};
|
|
@@ -927562,8 +927621,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
927562
927621
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path106.default.basename(abs) : relFromProject : relFromSource;
|
|
927563
927622
|
const dest = import_path106.default.join(assetsDir, destRelative);
|
|
927564
927623
|
try {
|
|
927565
|
-
await (0,
|
|
927566
|
-
await (0,
|
|
927624
|
+
await (0, import_promises194.mkdir)(import_path106.default.dirname(dest), { recursive: true });
|
|
927625
|
+
await (0, import_promises194.copyFile)(abs, dest);
|
|
927567
927626
|
return `./assets/${destRelative.split(import_path106.default.sep).join("/")}`;
|
|
927568
927627
|
} catch {
|
|
927569
927628
|
return obj;
|
|
@@ -927655,7 +927714,7 @@ async function listDocsThemes({
|
|
|
927655
927714
|
|
|
927656
927715
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
927657
927716
|
init_lib6();
|
|
927658
|
-
var
|
|
927717
|
+
var import_promises196 = require("fs/promises");
|
|
927659
927718
|
init_js_yaml();
|
|
927660
927719
|
var import_path108 = __toESM(require("path"), 1);
|
|
927661
927720
|
|
|
@@ -927664,7 +927723,7 @@ init_lib8();
|
|
|
927664
927723
|
init_lib6();
|
|
927665
927724
|
var import_child_process12 = require("child_process");
|
|
927666
927725
|
var import_crypto9 = require("crypto");
|
|
927667
|
-
var
|
|
927726
|
+
var import_promises195 = require("fs/promises");
|
|
927668
927727
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
927669
927728
|
var import_path107 = __toESM(require("path"), 1);
|
|
927670
927729
|
function getGitRoot() {
|
|
@@ -927708,7 +927767,7 @@ var ThemeConfigProcessor = class {
|
|
|
927708
927767
|
filePaths.map(async (filePath) => {
|
|
927709
927768
|
const abs = import_path107.default.resolve(this.themeDir, filePath);
|
|
927710
927769
|
try {
|
|
927711
|
-
await (0,
|
|
927770
|
+
await (0, import_promises195.access)(abs);
|
|
927712
927771
|
} catch {
|
|
927713
927772
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
927714
927773
|
}
|
|
@@ -927873,7 +927932,7 @@ ${errors4.map((e2) => ` - ${e2}`).join("\n")}`,
|
|
|
927873
927932
|
return { config: cfg, filesUploaded };
|
|
927874
927933
|
}
|
|
927875
927934
|
async uploadFileToCas(absolutePath) {
|
|
927876
|
-
const content5 = await (0,
|
|
927935
|
+
const content5 = await (0, import_promises195.readFile)(absolutePath);
|
|
927877
927936
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
927878
927937
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
927879
927938
|
return this.uploadToCas(content5, contentType, bindPath, import_path107.default.basename(absolutePath));
|
|
@@ -927988,7 +928047,7 @@ async function uploadDocsTheme({
|
|
|
927988
928047
|
await cliContext.runTask(async (context3) => {
|
|
927989
928048
|
let rawYaml;
|
|
927990
928049
|
try {
|
|
927991
|
-
const content5 = await (0,
|
|
928050
|
+
const content5 = await (0, import_promises196.readFile)(themeYmlPath, "utf-8");
|
|
927992
928051
|
rawYaml = index_vite_proxy_tmp_default.load(content5, { schema: index_vite_proxy_tmp_default.JSON_SCHEMA });
|
|
927993
928052
|
} catch {
|
|
927994
928053
|
context3.failAndThrow(
|
|
@@ -928042,7 +928101,7 @@ async function uploadDocsTheme({
|
|
|
928042
928101
|
|
|
928043
928102
|
// src/commands/downgrade/downgrade.ts
|
|
928044
928103
|
init_lib6();
|
|
928045
|
-
var
|
|
928104
|
+
var import_promises197 = require("fs/promises");
|
|
928046
928105
|
function ensureFinalNewline2(content5) {
|
|
928047
928106
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
928048
928107
|
}
|
|
@@ -928067,13 +928126,13 @@ async function downgrade({
|
|
|
928067
928126
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
928068
928127
|
draft.version = targetVersion;
|
|
928069
928128
|
});
|
|
928070
|
-
await (0,
|
|
928129
|
+
await (0, import_promises197.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
928071
928130
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
928072
928131
|
}
|
|
928073
928132
|
|
|
928074
928133
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
928075
928134
|
init_lib8();
|
|
928076
|
-
var
|
|
928135
|
+
var import_promises198 = require("fs/promises");
|
|
928077
928136
|
init_js_yaml();
|
|
928078
928137
|
|
|
928079
928138
|
// src/commands/export/converters/servicesConverter.ts
|
|
@@ -929483,8 +929542,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
929483
929542
|
ir: ir3,
|
|
929484
929543
|
mode: "openapi"
|
|
929485
929544
|
});
|
|
929486
|
-
await (0,
|
|
929487
|
-
await (0,
|
|
929545
|
+
await (0, import_promises198.mkdir)(dirname6(outputPath), { recursive: true });
|
|
929546
|
+
await (0, import_promises198.writeFile)(
|
|
929488
929547
|
outputPath,
|
|
929489
929548
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : index_vite_proxy_tmp_default.dump(openapi, { indent: indent4 })
|
|
929490
929549
|
);
|
|
@@ -930077,7 +930136,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
930077
930136
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
930078
930137
|
init_lib8();
|
|
930079
930138
|
init_lib6();
|
|
930080
|
-
var
|
|
930139
|
+
var import_promises199 = require("fs/promises");
|
|
930081
930140
|
init_js_yaml();
|
|
930082
930141
|
async function compareOpenAPISpecs({
|
|
930083
930142
|
originalPath,
|
|
@@ -930119,12 +930178,12 @@ async function compareOpenAPISpecs({
|
|
|
930119
930178
|
}
|
|
930120
930179
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
930121
930180
|
}
|
|
930122
|
-
await (0,
|
|
930181
|
+
await (0, import_promises199.writeFile)(outputPath, index_vite_proxy_tmp_default.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
930123
930182
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
930124
930183
|
});
|
|
930125
930184
|
}
|
|
930126
930185
|
async function loadSpec2(filepath, context3) {
|
|
930127
|
-
const contents = await (0,
|
|
930186
|
+
const contents = await (0, import_promises199.readFile)(filepath, "utf8");
|
|
930128
930187
|
try {
|
|
930129
930188
|
return JSON.parse(contents);
|
|
930130
930189
|
} catch {
|
|
@@ -930229,7 +930288,7 @@ function deepEqual(a3, b5) {
|
|
|
930229
930288
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
930230
930289
|
init_lib8();
|
|
930231
930290
|
init_lib6();
|
|
930232
|
-
var
|
|
930291
|
+
var import_promises200 = require("fs/promises");
|
|
930233
930292
|
init_js_yaml();
|
|
930234
930293
|
async function writeOverridesForWorkspaces({
|
|
930235
930294
|
project,
|
|
@@ -930255,7 +930314,7 @@ async function writeOverridesForWorkspaces({
|
|
|
930255
930314
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
930256
930315
|
let parsedOverrides = null;
|
|
930257
930316
|
try {
|
|
930258
|
-
const contents = (await (0,
|
|
930317
|
+
const contents = (await (0, import_promises200.readFile)(overridesFilepath, "utf8")).toString();
|
|
930259
930318
|
try {
|
|
930260
930319
|
parsedOverrides = JSON.parse(contents);
|
|
930261
930320
|
} catch (err) {
|
|
@@ -930320,7 +930379,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
930320
930379
|
for (const overridesPath of overridesPaths) {
|
|
930321
930380
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
930322
930381
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides, includeModels, context: context3 });
|
|
930323
|
-
await (0,
|
|
930382
|
+
await (0, import_promises200.writeFile)(overridesPath, index_vite_proxy_tmp_default.dump(content5));
|
|
930324
930383
|
}
|
|
930325
930384
|
} else {
|
|
930326
930385
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -930334,7 +930393,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
930334
930393
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
930335
930394
|
}
|
|
930336
930395
|
}
|
|
930337
|
-
await (0,
|
|
930396
|
+
await (0, import_promises200.writeFile)(
|
|
930338
930397
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
930339
930398
|
index_vite_proxy_tmp_default.dump(content5)
|
|
930340
930399
|
);
|
|
@@ -930779,7 +930838,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
930779
930838
|
}
|
|
930780
930839
|
|
|
930781
930840
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
930782
|
-
var
|
|
930841
|
+
var import_promises201 = require("fs/promises");
|
|
930783
930842
|
async function generateJsonschemaForWorkspaces({
|
|
930784
930843
|
typeLocator,
|
|
930785
930844
|
project,
|
|
@@ -930827,9 +930886,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
930827
930886
|
context: context3
|
|
930828
930887
|
});
|
|
930829
930888
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
930830
|
-
await (0,
|
|
930889
|
+
await (0, import_promises201.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
930831
930890
|
}
|
|
930832
|
-
await (0,
|
|
930891
|
+
await (0, import_promises201.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
930833
930892
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
930834
930893
|
});
|
|
930835
930894
|
})
|
|
@@ -930839,7 +930898,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
930839
930898
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
930840
930899
|
init_lib8();
|
|
930841
930900
|
init_lib6();
|
|
930842
|
-
var
|
|
930901
|
+
var import_promises202 = require("fs/promises");
|
|
930843
930902
|
init_js_yaml();
|
|
930844
930903
|
var HTTP_METHODS4 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
930845
930904
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -930868,11 +930927,11 @@ async function mergeOpenAPIWithOverrides({
|
|
|
930868
930927
|
if (split2) {
|
|
930869
930928
|
const examples = extractEnrichedExamples2(openapi, merged);
|
|
930870
930929
|
const output2 = isJson ? JSON.stringify(examples, null, 2) : index_vite_proxy_tmp_default.dump(examples, { lineWidth: -1, noRefs: true });
|
|
930871
|
-
await (0,
|
|
930930
|
+
await (0, import_promises202.writeFile)(outputPath, output2);
|
|
930872
930931
|
context3.logger.info(`Extracted enriched examples written to ${outputPath}`);
|
|
930873
930932
|
} else {
|
|
930874
930933
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : index_vite_proxy_tmp_default.dump(merged, { lineWidth: -1, noRefs: true });
|
|
930875
|
-
await (0,
|
|
930934
|
+
await (0, import_promises202.writeFile)(outputPath, output2);
|
|
930876
930935
|
if (outputPath === openapiPath) {
|
|
930877
930936
|
context3.logger.info(`Enriched ${openapiPath} in-place`);
|
|
930878
930937
|
} else {
|
|
@@ -930882,7 +930941,7 @@ async function mergeOpenAPIWithOverrides({
|
|
|
930882
930941
|
});
|
|
930883
930942
|
}
|
|
930884
930943
|
async function loadYamlOrJson(filepath, context3) {
|
|
930885
|
-
const contents = await (0,
|
|
930944
|
+
const contents = await (0, import_promises202.readFile)(filepath, "utf8");
|
|
930886
930945
|
try {
|
|
930887
930946
|
return JSON.parse(contents);
|
|
930888
930947
|
} catch {
|
|
@@ -931667,7 +931726,7 @@ async function mockServer({
|
|
|
931667
931726
|
|
|
931668
931727
|
// src/commands/register/registerWorkspacesV1.ts
|
|
931669
931728
|
init_lib6();
|
|
931670
|
-
var
|
|
931729
|
+
var import_promises203 = require("fs/promises");
|
|
931671
931730
|
var import_path114 = __toESM(require("path"), 1);
|
|
931672
931731
|
var import_tmp_promise19 = __toESM(require_tmp_promise(), 1);
|
|
931673
931732
|
async function registerWorkspacesV1({
|
|
@@ -931720,7 +931779,7 @@ async function registerWorkspacesV1({
|
|
|
931720
931779
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
931721
931780
|
await Kn({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
931722
931781
|
context3.logger.info("Uploading definition...");
|
|
931723
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
931782
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises203.readFile)(tarPath));
|
|
931724
931783
|
context3.logger.info(
|
|
931725
931784
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
931726
931785
|
);
|
|
@@ -931773,7 +931832,7 @@ function getAIEnhancerConfig2() {
|
|
|
931773
931832
|
|
|
931774
931833
|
// src/commands/resolve-specs/resolveSpecsForWorkspaces.ts
|
|
931775
931834
|
init_lib8();
|
|
931776
|
-
var
|
|
931835
|
+
var import_promises204 = require("fs/promises");
|
|
931777
931836
|
var import_path115 = __toESM(require("path"), 1);
|
|
931778
931837
|
async function resolveSpecsForWorkspaces({
|
|
931779
931838
|
project,
|
|
@@ -931793,14 +931852,14 @@ async function resolveSpecsForWorkspaces({
|
|
|
931793
931852
|
return;
|
|
931794
931853
|
}
|
|
931795
931854
|
const workspaceOutputDir = project.apiWorkspaces.length > 1 ? AbsoluteFilePath2.of(import_path115.default.join(outputDir, workspace.workspaceName ?? "api")) : outputDir;
|
|
931796
|
-
await (0,
|
|
931855
|
+
await (0, import_promises204.mkdir)(workspaceOutputDir, { recursive: true });
|
|
931797
931856
|
const manifest = await collectRawSpecs({
|
|
931798
931857
|
specs,
|
|
931799
931858
|
hostOutputDir: workspaceOutputDir,
|
|
931800
931859
|
containerBaseDir: ".",
|
|
931801
931860
|
context: context3
|
|
931802
931861
|
});
|
|
931803
|
-
await (0,
|
|
931862
|
+
await (0, import_promises204.writeFile)(
|
|
931804
931863
|
import_path115.default.join(workspaceOutputDir, SPECS_MANIFEST_FILENAME),
|
|
931805
931864
|
JSON.stringify(manifest, void 0, 4)
|
|
931806
931865
|
);
|
|
@@ -932007,7 +932066,7 @@ async function generateDiff({
|
|
|
932007
932066
|
// src/commands/sdk-preview/sdkPreview.ts
|
|
932008
932067
|
init_lib8();
|
|
932009
932068
|
init_lib6();
|
|
932010
|
-
var
|
|
932069
|
+
var import_promises205 = __toESM(require("fs/promises"), 1);
|
|
932011
932070
|
|
|
932012
932071
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
932013
932072
|
var BASE_VERSION = "0.0.1";
|
|
@@ -932127,7 +932186,7 @@ async function sdkPreview({
|
|
|
932127
932186
|
const firstPath = pathOutputs[0];
|
|
932128
932187
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
932129
932188
|
if (absolutePathToOutput != null) {
|
|
932130
|
-
await
|
|
932189
|
+
await import_promises205.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
932131
932190
|
}
|
|
932132
932191
|
for (const workspace of project.apiWorkspaces) {
|
|
932133
932192
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -932316,7 +932375,7 @@ async function sdkPreview({
|
|
|
932316
932375
|
// src/commands/self-update/selfUpdate.ts
|
|
932317
932376
|
init_lib12();
|
|
932318
932377
|
init_lib6();
|
|
932319
|
-
var
|
|
932378
|
+
var import_promises206 = require("fs/promises");
|
|
932320
932379
|
var import_path116 = require("path");
|
|
932321
932380
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
932322
932381
|
let command3;
|
|
@@ -932362,7 +932421,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
932362
932421
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
932363
932422
|
let resolvedPath;
|
|
932364
932423
|
try {
|
|
932365
|
-
resolvedPath = await (0,
|
|
932424
|
+
resolvedPath = await (0, import_promises206.realpath)(fernPath);
|
|
932366
932425
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
932367
932426
|
} catch (error50) {
|
|
932368
932427
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -932671,22 +932730,22 @@ async function generateToken({
|
|
|
932671
932730
|
init_lib8();
|
|
932672
932731
|
init_lib6();
|
|
932673
932732
|
var fs33 = __toESM(require("fs"), 1);
|
|
932674
|
-
var
|
|
932733
|
+
var import_promises207 = require("fs/promises");
|
|
932675
932734
|
init_graphql();
|
|
932676
932735
|
init_js_yaml();
|
|
932677
932736
|
var import_stream18 = require("stream");
|
|
932678
|
-
var
|
|
932737
|
+
var import_promises208 = require("stream/promises");
|
|
932679
932738
|
async function fetchAndWriteFile(url3, path118, logger4, indent4) {
|
|
932680
932739
|
const resp = await fetch(url3);
|
|
932681
932740
|
if (resp.ok && resp.body) {
|
|
932682
932741
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
932683
932742
|
const fileStream = fs33.createWriteStream(path118);
|
|
932684
|
-
await (0,
|
|
932685
|
-
const fileContents = await (0,
|
|
932743
|
+
await (0, import_promises208.finished)(import_stream18.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
932744
|
+
const fileContents = await (0, import_promises207.readFile)(path118, "utf8");
|
|
932686
932745
|
try {
|
|
932687
|
-
await (0,
|
|
932746
|
+
await (0, import_promises207.writeFile)(path118, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
932688
932747
|
} catch (e2) {
|
|
932689
|
-
await (0,
|
|
932748
|
+
await (0, import_promises207.writeFile)(path118, index_vite_proxy_tmp_default.dump(index_vite_proxy_tmp_default.load(fileContents), { indent: indent4 }), "utf8");
|
|
932690
932749
|
}
|
|
932691
932750
|
logger4.debug("File written successfully");
|
|
932692
932751
|
}
|
|
@@ -932842,14 +932901,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
932842
932901
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path118, logger4) {
|
|
932843
932902
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
932844
932903
|
if (postResult.success) {
|
|
932845
|
-
await (0,
|
|
932904
|
+
await (0, import_promises207.writeFile)(path118, postResult.result, "utf8");
|
|
932846
932905
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
932847
932906
|
return;
|
|
932848
932907
|
}
|
|
932849
932908
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
932850
932909
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
932851
932910
|
if (getResult.success) {
|
|
932852
|
-
await (0,
|
|
932911
|
+
await (0, import_promises207.writeFile)(path118, getResult.result, "utf8");
|
|
932853
932912
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
932854
932913
|
return;
|
|
932855
932914
|
}
|
|
@@ -933550,7 +933609,7 @@ async function validateWorkspaces({
|
|
|
933550
933609
|
|
|
933551
933610
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
933552
933611
|
init_lib8();
|
|
933553
|
-
var
|
|
933612
|
+
var import_promises209 = require("fs/promises");
|
|
933554
933613
|
init_js_yaml();
|
|
933555
933614
|
var import_path118 = __toESM(require("path"), 1);
|
|
933556
933615
|
async function writeDefinitionForWorkspaces({
|
|
@@ -933632,28 +933691,28 @@ async function writeFernDefinition({
|
|
|
933632
933691
|
return a3.localeCompare(b5);
|
|
933633
933692
|
};
|
|
933634
933693
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
933635
|
-
await (0,
|
|
933694
|
+
await (0, import_promises209.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
933636
933695
|
}
|
|
933637
|
-
await (0,
|
|
933638
|
-
await (0,
|
|
933696
|
+
await (0, import_promises209.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
933697
|
+
await (0, import_promises209.writeFile)(
|
|
933639
933698
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
933640
933699
|
index_vite_proxy_tmp_default.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
933641
933700
|
);
|
|
933642
933701
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
933643
933702
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
933644
|
-
await (0,
|
|
933645
|
-
await (0,
|
|
933703
|
+
await (0, import_promises209.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
933704
|
+
await (0, import_promises209.writeFile)(absoluteFilepath, index_vite_proxy_tmp_default.dump(packageMarker.contents, { sortKeys }));
|
|
933646
933705
|
}
|
|
933647
933706
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
933648
933707
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
933649
|
-
await (0,
|
|
933650
|
-
await (0,
|
|
933708
|
+
await (0, import_promises209.mkdir)(dirname6(absoluteFilepath), { recursive: true });
|
|
933709
|
+
await (0, import_promises209.writeFile)(absoluteFilepath, index_vite_proxy_tmp_default.dump(definitionFile.contents, { sortKeys }));
|
|
933651
933710
|
}
|
|
933652
933711
|
}
|
|
933653
933712
|
|
|
933654
933713
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
933655
933714
|
init_lib8();
|
|
933656
|
-
var
|
|
933715
|
+
var import_promises210 = require("fs/promises");
|
|
933657
933716
|
async function writeDocsDefinitionForProject({
|
|
933658
933717
|
project,
|
|
933659
933718
|
outputPath,
|
|
@@ -933685,7 +933744,7 @@ async function writeDocsDefinitionForProject({
|
|
|
933685
933744
|
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
|
|
933686
933745
|
});
|
|
933687
933746
|
const docsDefinition = await docsResolver.resolve();
|
|
933688
|
-
await (0,
|
|
933747
|
+
await (0, import_promises210.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
933689
933748
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
933690
933749
|
});
|
|
933691
933750
|
}
|