@fern-api/fern-api-dev 5.23.3-793-g9dc86a08808 → 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 +385 -320
- 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}`;
|
|
@@ -901322,7 +901331,10 @@ var EndpointSnippetGenerator8 = class {
|
|
|
901322
901331
|
this.context.errors.unscope();
|
|
901323
901332
|
this.context.errors.scope(Scope4.RequestBody);
|
|
901324
901333
|
if (request7.body != null) {
|
|
901325
|
-
|
|
901334
|
+
const bodyArg = this.getEndpointMethodBodyRequestArg({ body: request7.body, value: snippet.requestBody });
|
|
901335
|
+
if (!bodyArg.value.isNop()) {
|
|
901336
|
+
args.push(bodyArg);
|
|
901337
|
+
}
|
|
901326
901338
|
}
|
|
901327
901339
|
this.context.errors.unscope();
|
|
901328
901340
|
return args;
|
|
@@ -901336,6 +901348,9 @@ var EndpointSnippetGenerator8 = class {
|
|
|
901336
901348
|
value: this.getBytesBodyRequestArg({ value: value2 })
|
|
901337
901349
|
});
|
|
901338
901350
|
case "typeReference":
|
|
901351
|
+
if (body.value.type === "optional" && value2 == null) {
|
|
901352
|
+
return swift_exports.functionArgument({ label: "request", value: swift_exports.Expression.nop() });
|
|
901353
|
+
}
|
|
901339
901354
|
return swift_exports.functionArgument({
|
|
901340
901355
|
label: "request",
|
|
901341
901356
|
value: this.context.dynamicTypeLiteralMapper.convert({
|
|
@@ -904037,11 +904052,56 @@ async function generateDynamicSnippetTests({ context: context3, ir: ir3, config:
|
|
|
904037
904052
|
init_lib8();
|
|
904038
904053
|
var import_autoversion3 = __toESM(require_autoversion(), 1);
|
|
904039
904054
|
var import_serialization = __toESM(require_serialization3(), 1);
|
|
904040
|
-
var
|
|
904055
|
+
var import_promises134 = require("fs/promises");
|
|
904041
904056
|
var path101 = __toESM(require("path"), 1);
|
|
904042
904057
|
var import_path95 = require("path");
|
|
904043
904058
|
var import_tmp_promise16 = __toESM(require_tmp_promise(), 1);
|
|
904044
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
|
+
|
|
904045
904105
|
// ../generation/local-generation/local-workspace-runner/lib/getGeneratorConfig.js
|
|
904046
904106
|
init_lib9();
|
|
904047
904107
|
init_lib6();
|
|
@@ -904568,7 +904628,7 @@ var import_autoversion2 = __toESM(require_autoversion(), 1);
|
|
|
904568
904628
|
init_lib12();
|
|
904569
904629
|
init_lib6();
|
|
904570
904630
|
var import_decompress2 = __toESM(require_decompress(), 1);
|
|
904571
|
-
var
|
|
904631
|
+
var import_promises132 = require("fs/promises");
|
|
904572
904632
|
var import_os12 = require("os");
|
|
904573
904633
|
var import_path93 = require("path");
|
|
904574
904634
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
@@ -904675,7 +904735,7 @@ var LocalTaskHandler = class {
|
|
|
904675
904735
|
try {
|
|
904676
904736
|
this.context.logger.info("Analyzing SDK changes for automatic semantic versioning");
|
|
904677
904737
|
diffFile = await this.generateDiffFile();
|
|
904678
|
-
const diffContent = await (0,
|
|
904738
|
+
const diffContent = await (0, import_promises132.readFile)(diffFile, "utf-8");
|
|
904679
904739
|
if (diffContent.trim().length === 0) {
|
|
904680
904740
|
this.context.logger.info("No changes detected in generated SDK");
|
|
904681
904741
|
return null;
|
|
@@ -904880,7 +904940,7 @@ var LocalTaskHandler = class {
|
|
|
904880
904940
|
} finally {
|
|
904881
904941
|
if (diffFile) {
|
|
904882
904942
|
try {
|
|
904883
|
-
await (0,
|
|
904943
|
+
await (0, import_promises132.rm)(diffFile);
|
|
904884
904944
|
} catch (cleanupError) {
|
|
904885
904945
|
this.context.logger.warn(`Failed to delete temp diff file: ${diffFile}`, String(cleanupError));
|
|
904886
904946
|
}
|
|
@@ -905060,7 +905120,7 @@ var LocalTaskHandler = class {
|
|
|
905060
905120
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
905061
905121
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
905062
905122
|
const pathsToPreserve = await this.getPathsToPreserve(fernIgnorePaths);
|
|
905063
|
-
await (0,
|
|
905123
|
+
await (0, import_promises132.cp)(this.absolutePathToLocalOutput, tmpOutputResolutionDir, { recursive: true, verbatimSymlinks: true });
|
|
905064
905124
|
await this.runThrowawayGitCommand(["init"], tmpOutputResolutionDir);
|
|
905065
905125
|
await this.runThrowawayGitCommand(["config", "gc.auto", "0"], tmpOutputResolutionDir);
|
|
905066
905126
|
await this.runThrowawayGitCommand(["add", "."], tmpOutputResolutionDir);
|
|
@@ -905081,22 +905141,22 @@ var LocalTaskHandler = class {
|
|
|
905081
905141
|
await this.runThrowawayGitCommand(["reset", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
905082
905142
|
await this.runThrowawayGitCommand(["clean", "-fd", "--", ...pathsToPreserve], tmpOutputResolutionDir);
|
|
905083
905143
|
await this.runThrowawayGitCommand(["restore", "."], tmpOutputResolutionDir);
|
|
905084
|
-
await (0,
|
|
905144
|
+
await (0, import_promises132.rm)(join8(tmpOutputResolutionDir, RelativeFilePath2.of(".git")), {
|
|
905085
905145
|
recursive: true,
|
|
905086
905146
|
force: true,
|
|
905087
905147
|
maxRetries: 3,
|
|
905088
905148
|
retryDelay: 100
|
|
905089
905149
|
});
|
|
905090
|
-
await (0,
|
|
905091
|
-
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 });
|
|
905092
905152
|
}
|
|
905093
905153
|
async copyGeneratedFilesNoFernIgnorePreservingGit() {
|
|
905094
|
-
const contents = await (0,
|
|
905154
|
+
const contents = await (0, import_promises132.readdir)(this.absolutePathToLocalOutput);
|
|
905095
905155
|
const itemsToPreserve = [".git"];
|
|
905096
905156
|
if (await this.generatedOutputMissingReadme()) {
|
|
905097
905157
|
itemsToPreserve.push("README.md");
|
|
905098
905158
|
}
|
|
905099
|
-
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)), {
|
|
905100
905160
|
force: true,
|
|
905101
905161
|
recursive: true
|
|
905102
905162
|
})));
|
|
@@ -905104,11 +905164,11 @@ var LocalTaskHandler = class {
|
|
|
905104
905164
|
}
|
|
905105
905165
|
async copyGeneratedFilesNoFernIgnoreDeleteAll() {
|
|
905106
905166
|
this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`);
|
|
905107
|
-
await (0,
|
|
905167
|
+
await (0, import_promises132.rm)(this.absolutePathToLocalOutput, { force: true, recursive: true });
|
|
905108
905168
|
await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput);
|
|
905109
905169
|
}
|
|
905110
905170
|
async copyGeneratedFilesToDirectory(outputPath) {
|
|
905111
|
-
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0,
|
|
905171
|
+
const [firstLocalOutputItem, ...remaininglocalOutputItems] = await (0, import_promises132.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
905112
905172
|
if (firstLocalOutputItem == null) {
|
|
905113
905173
|
return;
|
|
905114
905174
|
}
|
|
@@ -905116,10 +905176,10 @@ var LocalTaskHandler = class {
|
|
|
905116
905176
|
if (firstLocalOutputItem.endsWith(".zip")) {
|
|
905117
905177
|
await (0, import_decompress2.default)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(firstLocalOutputItem)), outputPath);
|
|
905118
905178
|
for (const localOutputItem of remaininglocalOutputItems) {
|
|
905119
|
-
await (0,
|
|
905179
|
+
await (0, import_promises132.cp)(join8(this.absolutePathToTmpOutputDirectory, RelativeFilePath2.of(localOutputItem)), join8(outputPath, RelativeFilePath2.of(localOutputItem)), { recursive: true, verbatimSymlinks: true });
|
|
905120
905180
|
}
|
|
905121
905181
|
} else {
|
|
905122
|
-
await (0,
|
|
905182
|
+
await (0, import_promises132.cp)(this.absolutePathToTmpOutputDirectory, outputPath, { recursive: true, verbatimSymlinks: true });
|
|
905123
905183
|
}
|
|
905124
905184
|
}
|
|
905125
905185
|
async copySnippetJSON({ absolutePathToTmpSnippetJSON, absolutePathToLocalSnippetJSON }) {
|
|
@@ -905140,7 +905200,7 @@ var LocalTaskHandler = class {
|
|
|
905140
905200
|
*/
|
|
905141
905201
|
async generatedOutputMissingReadme() {
|
|
905142
905202
|
try {
|
|
905143
|
-
const contents = await (0,
|
|
905203
|
+
const contents = await (0, import_promises132.readdir)(this.absolutePathToTmpOutputDirectory);
|
|
905144
905204
|
if (contents.length === 1 && contents[0] != null && contents[0].endsWith(".zip")) {
|
|
905145
905205
|
return false;
|
|
905146
905206
|
}
|
|
@@ -905190,13 +905250,13 @@ var LocalTaskHandler = class {
|
|
|
905190
905250
|
async readPriorChangelog(maxEntries) {
|
|
905191
905251
|
const MAX_CHANGELOG_SIZE = 2048;
|
|
905192
905252
|
try {
|
|
905193
|
-
const files = await (0,
|
|
905253
|
+
const files = await (0, import_promises132.readdir)(this.absolutePathToLocalOutput);
|
|
905194
905254
|
const changelogFile = files.find((f3) => f3.toLowerCase() === "changelog.md");
|
|
905195
905255
|
if (!changelogFile) {
|
|
905196
905256
|
return "";
|
|
905197
905257
|
}
|
|
905198
905258
|
const changelogPath = join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(changelogFile));
|
|
905199
|
-
const content5 = await (0,
|
|
905259
|
+
const content5 = await (0, import_promises132.readFile)(changelogPath, "utf-8");
|
|
905200
905260
|
if (content5.trim().length === 0) {
|
|
905201
905261
|
return "";
|
|
905202
905262
|
}
|
|
@@ -905272,18 +905332,18 @@ var LocalTaskHandler = class {
|
|
|
905272
905332
|
}
|
|
905273
905333
|
};
|
|
905274
905334
|
async function copySnippetJsonIfNonEmpty({ src, dest }) {
|
|
905275
|
-
const tmpStat = await (0,
|
|
905335
|
+
const tmpStat = await (0, import_promises132.stat)(src);
|
|
905276
905336
|
if (tmpStat.size === 0) {
|
|
905277
905337
|
return "skipped-empty";
|
|
905278
905338
|
}
|
|
905279
|
-
await (0,
|
|
905339
|
+
await (0, import_promises132.cp)(src, dest);
|
|
905280
905340
|
return "copied";
|
|
905281
905341
|
}
|
|
905282
905342
|
|
|
905283
905343
|
// ../generation/local-generation/local-workspace-runner/lib/rawSpecs.js
|
|
905284
905344
|
init_lib4();
|
|
905285
905345
|
init_lib8();
|
|
905286
|
-
var
|
|
905346
|
+
var import_promises133 = require("fs/promises");
|
|
905287
905347
|
init_js_yaml();
|
|
905288
905348
|
var import_path94 = __toESM(require("path"), 1);
|
|
905289
905349
|
var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
|
|
@@ -905351,7 +905411,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
905351
905411
|
});
|
|
905352
905412
|
}
|
|
905353
905413
|
resolved = filterSpec(resolved, audiences);
|
|
905354
|
-
await (0,
|
|
905414
|
+
await (0, import_promises133.writeFile)(import_path94.default.join(hostOutputDir, filename), JSON.stringify(resolved));
|
|
905355
905415
|
context3.logger.debug(`Resolved ${isAsync2 ? "AsyncAPI" : "OpenAPI"} spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
905356
905416
|
return {
|
|
905357
905417
|
type: isAsync2 ? "asyncapi" : "openapi",
|
|
@@ -905361,7 +905421,7 @@ async function resolveOpenAPIOrAsyncAPI({ spec, hostOutputDir, containerBaseDir,
|
|
|
905361
905421
|
}
|
|
905362
905422
|
async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context: context3, index: index3 }) {
|
|
905363
905423
|
const filename = `openrpc${index3}.json`;
|
|
905364
|
-
const rawContent = await (0,
|
|
905424
|
+
const rawContent = await (0, import_promises133.readFile)(spec.absoluteFilepath, "utf-8");
|
|
905365
905425
|
let parsed;
|
|
905366
905426
|
try {
|
|
905367
905427
|
parsed = JSON.parse(rawContent);
|
|
@@ -905371,7 +905431,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
905371
905431
|
let result = parsed;
|
|
905372
905432
|
const overrides = normalizeOverrides(spec.absoluteFilepathToOverrides);
|
|
905373
905433
|
for (const overridePath of overrides) {
|
|
905374
|
-
const overrideContent = await (0,
|
|
905434
|
+
const overrideContent = await (0, import_promises133.readFile)(overridePath, "utf-8");
|
|
905375
905435
|
let overrideParsed;
|
|
905376
905436
|
try {
|
|
905377
905437
|
overrideParsed = JSON.parse(overrideContent);
|
|
@@ -905383,7 +905443,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
905383
905443
|
overrides: overrideParsed
|
|
905384
905444
|
});
|
|
905385
905445
|
}
|
|
905386
|
-
await (0,
|
|
905446
|
+
await (0, import_promises133.writeFile)(import_path94.default.join(hostOutputDir, filename), JSON.stringify(result));
|
|
905387
905447
|
context3.logger.debug(`Resolved OpenRPC spec ${spec.absoluteFilepath} -> ${filename}`);
|
|
905388
905448
|
return {
|
|
905389
905449
|
type: "openrpc",
|
|
@@ -905394,7 +905454,7 @@ async function resolveOpenRPC({ spec, hostOutputDir, containerBaseDir, context:
|
|
|
905394
905454
|
async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
905395
905455
|
const dirName = `protobuf${index3}`;
|
|
905396
905456
|
const destDir = import_path94.default.join(hostOutputDir, dirName);
|
|
905397
|
-
await (0,
|
|
905457
|
+
await (0, import_promises133.cp)(spec.absoluteFilepathToProtobufRoot, destDir, { recursive: true });
|
|
905398
905458
|
const entry = {
|
|
905399
905459
|
type: "protobuf",
|
|
905400
905460
|
specPath: toContainerPath(dirName, containerBaseDir)
|
|
@@ -905404,7 +905464,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
905404
905464
|
entry.overridePaths = [];
|
|
905405
905465
|
for (const [i5, override] of overrides.entries()) {
|
|
905406
905466
|
const overrideName = `protobuf${index3}-override-${i5}${import_path94.default.extname(override)}`;
|
|
905407
|
-
await (0,
|
|
905467
|
+
await (0, import_promises133.copyFile)(override, import_path94.default.join(hostOutputDir, overrideName));
|
|
905408
905468
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
905409
905469
|
}
|
|
905410
905470
|
}
|
|
@@ -905413,7 +905473,7 @@ async function copyProtobuf({ spec, hostOutputDir, containerBaseDir, index: inde
|
|
|
905413
905473
|
async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index3 }) {
|
|
905414
905474
|
const ext2 = import_path94.default.extname(spec.absoluteFilepath) || ".graphql";
|
|
905415
905475
|
const filename = `graphql${index3}${ext2}`;
|
|
905416
|
-
await (0,
|
|
905476
|
+
await (0, import_promises133.copyFile)(spec.absoluteFilepath, import_path94.default.join(hostOutputDir, filename));
|
|
905417
905477
|
const entry = {
|
|
905418
905478
|
type: "graphql",
|
|
905419
905479
|
specPath: toContainerPath(filename, containerBaseDir),
|
|
@@ -905424,7 +905484,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
905424
905484
|
entry.overridePaths = [];
|
|
905425
905485
|
for (const [i5, override] of overrides.entries()) {
|
|
905426
905486
|
const overrideName = `graphql${index3}-override-${i5}${import_path94.default.extname(override)}`;
|
|
905427
|
-
await (0,
|
|
905487
|
+
await (0, import_promises133.copyFile)(override, import_path94.default.join(hostOutputDir, overrideName));
|
|
905428
905488
|
entry.overridePaths.push(toContainerPath(overrideName, containerBaseDir));
|
|
905429
905489
|
}
|
|
905430
905490
|
}
|
|
@@ -905432,7 +905492,7 @@ async function copyGraphQL({ spec, hostOutputDir, containerBaseDir, index: index
|
|
|
905432
905492
|
}
|
|
905433
905493
|
async function isAsyncAPISpec(filepath) {
|
|
905434
905494
|
try {
|
|
905435
|
-
const content5 = await (0,
|
|
905495
|
+
const content5 = await (0, import_promises133.readFile)(filepath, "utf-8");
|
|
905436
905496
|
return content5.includes("asyncapi");
|
|
905437
905497
|
} catch {
|
|
905438
905498
|
return false;
|
|
@@ -905542,7 +905602,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
905542
905602
|
context: context3,
|
|
905543
905603
|
audiences
|
|
905544
905604
|
});
|
|
905545
|
-
await (0,
|
|
905605
|
+
await (0, import_promises133.writeFile)(join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of(SPECS_MANIFEST_FILENAME)), JSON.stringify(manifest, void 0, 4));
|
|
905546
905606
|
const tarGzPath = join8(AbsoluteFilePath2.of(tmpDir.path), RelativeFilePath2.of("specs.tar.gz"));
|
|
905547
905607
|
await Kn({
|
|
905548
905608
|
gzip: true,
|
|
@@ -905551,7 +905611,7 @@ async function createSpecsTarGzBuffer({ specs, context: context3, audiences }) {
|
|
|
905551
905611
|
portable: true,
|
|
905552
905612
|
filter: (entryPath) => entryPath !== "./specs.tar.gz"
|
|
905553
905613
|
}, ["."]);
|
|
905554
|
-
return await (0,
|
|
905614
|
+
return await (0, import_promises133.readFile)(tarGzPath);
|
|
905555
905615
|
} finally {
|
|
905556
905616
|
await tmpDir.cleanup();
|
|
905557
905617
|
}
|
|
@@ -905591,24 +905651,24 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905591
905651
|
context3.logger.debug("Wrote IR to: " + absolutePathToIr);
|
|
905592
905652
|
const configJsonFile = (0, import_path95.join)(workspaceTempDir.path, GENERATOR_CONFIG_FILENAME);
|
|
905593
905653
|
const absolutePathToWriteConfigJson = AbsoluteFilePath2.of(configJsonFile);
|
|
905594
|
-
await (0,
|
|
905654
|
+
await (0, import_promises134.writeFile)(configJsonFile, "");
|
|
905595
905655
|
context3.logger.debug("Will write config.json to: " + absolutePathToWriteConfigJson);
|
|
905596
905656
|
const tmpOutputDirectory = (0, import_path95.join)(workspaceTempDir.path, CODEGEN_OUTPUT_DIRECTORY_NAME);
|
|
905597
905657
|
const absolutePathToTmpOutputDirectory = AbsoluteFilePath2.of(tmpOutputDirectory);
|
|
905598
|
-
await (0,
|
|
905658
|
+
await (0, import_promises134.mkdir)(tmpOutputDirectory, { recursive: true });
|
|
905599
905659
|
context3.logger.debug("Will write output to: " + absolutePathToTmpOutputDirectory);
|
|
905600
905660
|
let absolutePathToTmpSnippetJSON = void 0;
|
|
905601
905661
|
if (absolutePathToLocalSnippetJSON != null) {
|
|
905602
905662
|
const snippetJsonFile = (0, import_path95.join)(workspaceTempDir.path, "snippet.json");
|
|
905603
905663
|
absolutePathToTmpSnippetJSON = AbsoluteFilePath2.of(snippetJsonFile);
|
|
905604
|
-
await (0,
|
|
905664
|
+
await (0, import_promises134.writeFile)(snippetJsonFile, "");
|
|
905605
905665
|
context3.logger.debug("Will write snippet.json to: " + absolutePathToTmpSnippetJSON);
|
|
905606
905666
|
}
|
|
905607
905667
|
let absolutePathToTmpSnippetTemplatesJSON = void 0;
|
|
905608
905668
|
if (absolutePathToLocalSnippetTemplateJSON != null) {
|
|
905609
905669
|
const snippetTemplatesJsonFile = (0, import_path95.join)(workspaceTempDir.path, SNIPPET_TEMPLATES_JSON_FILENAME);
|
|
905610
905670
|
absolutePathToTmpSnippetTemplatesJSON = AbsoluteFilePath2.of(snippetTemplatesJsonFile);
|
|
905611
|
-
await (0,
|
|
905671
|
+
await (0, import_promises134.writeFile)(snippetTemplatesJsonFile, "");
|
|
905612
905672
|
context3.logger.debug("Will write snippet-templates.json to: " + absolutePathToTmpSnippetTemplatesJSON);
|
|
905613
905673
|
}
|
|
905614
905674
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
@@ -905648,7 +905708,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905648
905708
|
publishToRegistry,
|
|
905649
905709
|
paths
|
|
905650
905710
|
});
|
|
905651
|
-
await (0,
|
|
905711
|
+
await (0, import_promises134.writeFile)(absolutePathToWriteConfigJson, JSON.stringify(await import_serialization.GeneratorConfig.jsonOrThrow(config5), void 0, 4));
|
|
905652
905712
|
const absolutePathToLicenseFile = extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig);
|
|
905653
905713
|
const sourceMounts = workspace.getSources().filter((source2) => source2.type === "protobuf").map((source2) => ({
|
|
905654
905714
|
hostPath: source2.absoluteFilePath,
|
|
@@ -905656,7 +905716,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905656
905716
|
}));
|
|
905657
905717
|
if (rawApiSpecs != null && rawApiSpecs.length > 0) {
|
|
905658
905718
|
const rawSpecsDir = (0, import_path95.join)(workspaceTempDir.path, SPECS_DIRECTORY_NAME);
|
|
905659
|
-
await (0,
|
|
905719
|
+
await (0, import_promises134.mkdir)(rawSpecsDir, { recursive: true });
|
|
905660
905720
|
const containerSpecsDir = environment2.usesContainerPaths ? CONTAINER_SPECS_DIRECTORY : rawSpecsDir;
|
|
905661
905721
|
const manifest = await collectRawSpecs({
|
|
905662
905722
|
specs: rawApiSpecs,
|
|
@@ -905665,7 +905725,7 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905665
905725
|
context: context3,
|
|
905666
905726
|
audiences
|
|
905667
905727
|
});
|
|
905668
|
-
await (0,
|
|
905728
|
+
await (0, import_promises134.writeFile)((0, import_path95.join)(rawSpecsDir, SPECS_MANIFEST_FILENAME), JSON.stringify(manifest, void 0, 4));
|
|
905669
905729
|
context3.logger.debug(`Wrote raw specs manifest with ${manifest.specs.length} spec(s) to ${rawSpecsDir}`);
|
|
905670
905730
|
sourceMounts.push({
|
|
905671
905731
|
hostPath: AbsoluteFilePath2.of(rawSpecsDir),
|
|
@@ -905685,6 +905745,11 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
905685
905745
|
inspect: inspect6,
|
|
905686
905746
|
runner
|
|
905687
905747
|
});
|
|
905748
|
+
await applyTypeRelocations({
|
|
905749
|
+
ir: latest2,
|
|
905750
|
+
tmpOutputDirectory: absolutePathToTmpOutputDirectory,
|
|
905751
|
+
context: context3
|
|
905752
|
+
});
|
|
905688
905753
|
const taskHandler = new LocalTaskHandler({
|
|
905689
905754
|
context: context3,
|
|
905690
905755
|
absolutePathToLocalOutput,
|
|
@@ -906417,14 +906482,14 @@ async function runVerifyPipeline({ outputDir, generatorName, generatorVersion, c
|
|
|
906417
906482
|
// ../cli-v2/lib/sdk/generator/LegacyLocalGenerationRunner.js
|
|
906418
906483
|
init_lib5();
|
|
906419
906484
|
init_lib6();
|
|
906420
|
-
var
|
|
906485
|
+
var import_promises136 = require("fs/promises");
|
|
906421
906486
|
|
|
906422
906487
|
// ../cli-v2/lib/sdk/adapter/LegacyGeneratorInvocationAdapter.js
|
|
906423
906488
|
init_lib4();
|
|
906424
906489
|
init_lib8();
|
|
906425
906490
|
init_lib9();
|
|
906426
906491
|
init_lib6();
|
|
906427
|
-
var
|
|
906492
|
+
var import_promises135 = require("fs/promises");
|
|
906428
906493
|
var LegacyGeneratorInvocationAdapter = class {
|
|
906429
906494
|
context;
|
|
906430
906495
|
constructor(config5) {
|
|
@@ -906678,7 +906743,7 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
906678
906743
|
code: CliError.Code.InternalError
|
|
906679
906744
|
});
|
|
906680
906745
|
}
|
|
906681
|
-
const contents = await (0,
|
|
906746
|
+
const contents = await (0, import_promises135.readFile)(absolutePath, "utf-8");
|
|
906682
906747
|
return api_exports4.GithubLicense.custom({ contents });
|
|
906683
906748
|
}
|
|
906684
906749
|
buildReadme(target) {
|
|
@@ -906904,7 +906969,7 @@ var LegacyLocalGenerationRunner = class {
|
|
|
906904
906969
|
});
|
|
906905
906970
|
if (args.target.output.path != null && generatorInvocation.absolutePathToLocalOutput != null) {
|
|
906906
906971
|
const snippetPath = join8(generatorInvocation.absolutePathToLocalOutput, RelativeFilePath2.of(SNIPPET_JSON_FILENAME));
|
|
906907
|
-
await (0,
|
|
906972
|
+
await (0, import_promises136.rm)(snippetPath, { force: true });
|
|
906908
906973
|
}
|
|
906909
906974
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
906910
906975
|
return {
|
|
@@ -906923,7 +906988,7 @@ init_lib4();
|
|
|
906923
906988
|
init_lib8();
|
|
906924
906989
|
init_lib5();
|
|
906925
906990
|
init_lib6();
|
|
906926
|
-
var
|
|
906991
|
+
var import_promises137 = require("fs/promises");
|
|
906927
906992
|
var import_os14 = require("os");
|
|
906928
906993
|
var LegacyRemoteGenerationRunner = class {
|
|
906929
906994
|
context;
|
|
@@ -906982,13 +907047,13 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
906982
907047
|
const previewOutputDirectory = join8(absolutePathToPreview, RelativeFilePath2.of(generatorName));
|
|
906983
907048
|
const targetOutputDirectory = generatorInvocation.absolutePathToLocalOutput;
|
|
906984
907049
|
if (targetOutputDirectory != null) {
|
|
906985
|
-
await (0,
|
|
906986
|
-
await (0,
|
|
907050
|
+
await (0, import_promises137.cp)(previewOutputDirectory, targetOutputDirectory, { recursive: true });
|
|
907051
|
+
await (0, import_promises137.rm)(join8(targetOutputDirectory, RelativeFilePath2.of(".git")), {
|
|
906987
907052
|
recursive: true,
|
|
906988
907053
|
force: true
|
|
906989
907054
|
});
|
|
906990
907055
|
}
|
|
906991
|
-
await (0,
|
|
907056
|
+
await (0, import_promises137.rm)(absolutePathToPreview, { recursive: true, force: true });
|
|
906992
907057
|
}
|
|
906993
907058
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
906994
907059
|
return {
|
|
@@ -907017,7 +907082,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
907017
907082
|
}
|
|
907018
907083
|
async getAbsolutePathToPreview(args) {
|
|
907019
907084
|
if (this.isLocalGitCombo(args)) {
|
|
907020
|
-
const tmpPreviewDirectory = await (0,
|
|
907085
|
+
const tmpPreviewDirectory = await (0, import_promises137.mkdtemp)(join8(AbsoluteFilePath2.of((0, import_os14.tmpdir)()), RelativeFilePath2.of("fern-preview-")));
|
|
907021
907086
|
return AbsoluteFilePath2.of(tmpPreviewDirectory);
|
|
907022
907087
|
}
|
|
907023
907088
|
if (!args.preview) {
|
|
@@ -907753,7 +907818,7 @@ Example:
|
|
|
907753
907818
|
if (!exists2) {
|
|
907754
907819
|
return { shouldProceed: true };
|
|
907755
907820
|
}
|
|
907756
|
-
const files = await (0,
|
|
907821
|
+
const files = await (0, import_promises138.readdir)(outputPath);
|
|
907757
907822
|
if (files.length === 0) {
|
|
907758
907823
|
return { shouldProceed: true };
|
|
907759
907824
|
}
|
|
@@ -908163,7 +908228,7 @@ init_lib4();
|
|
|
908163
908228
|
init_lib12();
|
|
908164
908229
|
init_lib6();
|
|
908165
908230
|
var import_fs38 = require("fs");
|
|
908166
|
-
var
|
|
908231
|
+
var import_promises139 = require("fs/promises");
|
|
908167
908232
|
var import_path98 = require("path");
|
|
908168
908233
|
var import_semver14 = __toESM(require_semver2(), 1);
|
|
908169
908234
|
var import_url8 = require("url");
|
|
@@ -908273,7 +908338,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908273
908338
|
}
|
|
908274
908339
|
this.migrationsInstallPromise = (async () => {
|
|
908275
908340
|
const cacheDir = this.cachePath;
|
|
908276
|
-
await (0,
|
|
908341
|
+
await (0, import_promises139.mkdir)(cacheDir, { recursive: true });
|
|
908277
908342
|
const npmCacheDir = (0, import_path98.join)(cacheDir, ".npm-cache");
|
|
908278
908343
|
const packageDir = (0, import_path98.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME);
|
|
908279
908344
|
const packageJsonPath = (0, import_path98.join)(packageDir, "package.json");
|
|
@@ -908290,7 +908355,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908290
908355
|
"--no-audit",
|
|
908291
908356
|
"--no-fund"
|
|
908292
908357
|
], { doNotPipeOutput: true });
|
|
908293
|
-
const packageJsonContent = await (0,
|
|
908358
|
+
const packageJsonContent = await (0, import_promises139.readFile)(packageJsonPath, "utf-8");
|
|
908294
908359
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
908295
908360
|
if (packageJson2.main == null) {
|
|
908296
908361
|
throw new CliError({
|
|
@@ -908335,7 +908400,7 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908335
908400
|
const myPid = String(process.pid);
|
|
908336
908401
|
while (true) {
|
|
908337
908402
|
try {
|
|
908338
|
-
const fh = await (0,
|
|
908403
|
+
const fh = await (0, import_promises139.open)(lockPath, "wx");
|
|
908339
908404
|
await fh.writeFile(myPid);
|
|
908340
908405
|
await fh.close();
|
|
908341
908406
|
const exitHandler = () => {
|
|
@@ -908352,9 +908417,9 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908352
908417
|
return async () => {
|
|
908353
908418
|
process.removeListener("exit", exitHandler);
|
|
908354
908419
|
try {
|
|
908355
|
-
const currentContent = await (0,
|
|
908420
|
+
const currentContent = await (0, import_promises139.readFile)(lockPath, "utf-8");
|
|
908356
908421
|
if (currentContent.trim() === myPid) {
|
|
908357
|
-
await (0,
|
|
908422
|
+
await (0, import_promises139.unlink)(lockPath);
|
|
908358
908423
|
} else {
|
|
908359
908424
|
logger4.debug(`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`);
|
|
908360
908425
|
}
|
|
@@ -908368,14 +908433,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
908368
908433
|
throw err;
|
|
908369
908434
|
}
|
|
908370
908435
|
try {
|
|
908371
|
-
const lockContent = await (0,
|
|
908436
|
+
const lockContent = await (0, import_promises139.readFile)(lockPath, "utf-8");
|
|
908372
908437
|
const lockPid = Number(lockContent.trim());
|
|
908373
|
-
const lockStat = await (0,
|
|
908438
|
+
const lockStat = await (0, import_promises139.stat)(lockPath);
|
|
908374
908439
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
908375
908440
|
if (lockAge > _GeneratorMigrator.LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !_GeneratorMigrator.isProcessAlive(lockPid)) {
|
|
908376
908441
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
908377
908442
|
try {
|
|
908378
|
-
await (0,
|
|
908443
|
+
await (0, import_promises139.unlink)(lockPath);
|
|
908379
908444
|
} catch (unlinkErr) {
|
|
908380
908445
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
908381
908446
|
}
|
|
@@ -909051,14 +909116,14 @@ var import_generator_cli5 = __toESM(require_api3(), 1);
|
|
|
909051
909116
|
|
|
909052
909117
|
// ../init/lib/initializeAPI.js
|
|
909053
909118
|
init_lib8();
|
|
909054
|
-
var
|
|
909119
|
+
var import_promises144 = require("fs/promises");
|
|
909055
909120
|
var import_fs_extra = __toESM(require_lib18(), 1);
|
|
909056
909121
|
var import_path101 = __toESM(require("path"), 1);
|
|
909057
909122
|
|
|
909058
909123
|
// ../init/lib/createFernDirectoryAndOrganization.js
|
|
909059
909124
|
init_lib8();
|
|
909060
909125
|
init_lib6();
|
|
909061
|
-
var
|
|
909126
|
+
var import_promises141 = require("fs/promises");
|
|
909062
909127
|
init_lodash();
|
|
909063
909128
|
var GITIGNORE_CONTENT = "**/.preview\n**/.definition\n";
|
|
909064
909129
|
async function createFernDirectoryAndWorkspace({ organization, taskContext, versionOfCli }) {
|
|
@@ -909090,7 +909155,7 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
909090
909155
|
}
|
|
909091
909156
|
}
|
|
909092
909157
|
}
|
|
909093
|
-
await (0,
|
|
909158
|
+
await (0, import_promises141.mkdir)(FERN_DIRECTORY);
|
|
909094
909159
|
await writeProjectConfig({
|
|
909095
909160
|
filepath: join8(pathToFernDirectory, RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)),
|
|
909096
909161
|
organization,
|
|
@@ -909114,11 +909179,11 @@ async function writeProjectConfig({ organization, filepath, versionOfCli }) {
|
|
|
909114
909179
|
organization,
|
|
909115
909180
|
version: versionOfCli
|
|
909116
909181
|
};
|
|
909117
|
-
await (0,
|
|
909182
|
+
await (0, import_promises141.writeFile)(filepath, JSON.stringify(projectConfig, void 0, 4));
|
|
909118
909183
|
}
|
|
909119
909184
|
async function writeGitignore({ absolutePathToFernDirectory }) {
|
|
909120
909185
|
const gitignorePath = join8(absolutePathToFernDirectory, RelativeFilePath2.of(".gitignore"));
|
|
909121
|
-
await (0,
|
|
909186
|
+
await (0, import_promises141.writeFile)(gitignorePath, GITIGNORE_CONTENT);
|
|
909122
909187
|
}
|
|
909123
909188
|
|
|
909124
909189
|
// ../fern-definition/formatter/lib/FernDefinitionFileFormatter.js
|
|
@@ -909308,7 +909373,7 @@ async function formatDefinitionFile({ fileContents }) {
|
|
|
909308
909373
|
// ../fern-definition/formatter/lib/formatWorkspace.js
|
|
909309
909374
|
init_lib4();
|
|
909310
909375
|
init_lib6();
|
|
909311
|
-
var
|
|
909376
|
+
var import_promises142 = require("fs/promises");
|
|
909312
909377
|
async function formatFernWorkspace({ workspace, context: context3, shouldFix }) {
|
|
909313
909378
|
for (const [relativeFilepath, file4] of entries(workspace.definition.namedDefinitionFiles)) {
|
|
909314
909379
|
const formatted = await formatDefinitionFile({
|
|
@@ -909316,7 +909381,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
909316
909381
|
});
|
|
909317
909382
|
if (formatted !== file4.rawContents) {
|
|
909318
909383
|
if (shouldFix) {
|
|
909319
|
-
await (0,
|
|
909384
|
+
await (0, import_promises142.writeFile)(file4.absoluteFilePath, formatted);
|
|
909320
909385
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
909321
909386
|
} else {
|
|
909322
909387
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
@@ -909329,7 +909394,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
909329
909394
|
// ../init/lib/createWorkspace.js
|
|
909330
909395
|
init_lib8();
|
|
909331
909396
|
init_lib6();
|
|
909332
|
-
var
|
|
909397
|
+
var import_promises143 = require("fs/promises");
|
|
909333
909398
|
init_js_yaml();
|
|
909334
909399
|
|
|
909335
909400
|
// ../init/lib/sampleImdbApi.js
|
|
@@ -909530,7 +909595,7 @@ components:
|
|
|
909530
909595
|
// ../init/lib/createWorkspace.js
|
|
909531
909596
|
async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context: context3, apiName = "api" }) {
|
|
909532
909597
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
909533
|
-
await (0,
|
|
909598
|
+
await (0, import_promises143.mkdir)(directoryOfWorkspace);
|
|
909534
909599
|
}
|
|
909535
909600
|
await writeGeneratorsConfiguration({
|
|
909536
909601
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -909545,7 +909610,7 @@ async function createFernWorkspace({ directoryOfWorkspace, cliVersion, context:
|
|
|
909545
909610
|
}
|
|
909546
909611
|
async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, cliVersion, context: context3 }) {
|
|
909547
909612
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
909548
|
-
await (0,
|
|
909613
|
+
await (0, import_promises143.mkdir)(directoryOfWorkspace);
|
|
909549
909614
|
}
|
|
909550
909615
|
await writeGeneratorsConfiguration({
|
|
909551
909616
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
@@ -909558,10 +909623,10 @@ async function createOpenAPIWorkspace({ directoryOfWorkspace, openAPIFilePath, c
|
|
|
909558
909623
|
}
|
|
909559
909624
|
async function createDefaultOpenAPIWorkspace({ directoryOfWorkspace, cliVersion, context: context3 }) {
|
|
909560
909625
|
if (!await doesPathExist(directoryOfWorkspace)) {
|
|
909561
|
-
await (0,
|
|
909626
|
+
await (0, import_promises143.mkdir)(directoryOfWorkspace, { recursive: true });
|
|
909562
909627
|
}
|
|
909563
909628
|
const openApiFilePath = join8(directoryOfWorkspace, RelativeFilePath2.of("openapi.yml"));
|
|
909564
|
-
await (0,
|
|
909629
|
+
await (0, import_promises143.writeFile)(openApiFilePath, SAMPLE_OPENAPI);
|
|
909565
909630
|
await writeGeneratorsConfiguration({
|
|
909566
909631
|
filepath: join8(directoryOfWorkspace, RelativeFilePath2.of(GENERATORS_CONFIGURATION_FILENAME)),
|
|
909567
909632
|
cliVersion,
|
|
@@ -909606,7 +909671,7 @@ async function getDefaultGeneratorsConfiguration({ cliVersion, context: context3
|
|
|
909606
909671
|
return config5;
|
|
909607
909672
|
}
|
|
909608
909673
|
async function writeGeneratorsConfiguration({ filepath, cliVersion, context: context3, apiConfiguration }) {
|
|
909609
|
-
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 }), {
|
|
909610
909675
|
sortKeys: (a3, b5) => {
|
|
909611
909676
|
if (a3 === "api") {
|
|
909612
909677
|
return -1;
|
|
@@ -909625,8 +909690,8 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
909625
909690
|
strategy: "status-code"
|
|
909626
909691
|
}
|
|
909627
909692
|
};
|
|
909628
|
-
await (0,
|
|
909629
|
-
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));
|
|
909630
909695
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
909631
909696
|
let formattedContent;
|
|
909632
909697
|
try {
|
|
@@ -909642,7 +909707,7 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
909642
909707
|
code: CliError.Code.ParseError
|
|
909643
909708
|
});
|
|
909644
909709
|
}
|
|
909645
|
-
await (0,
|
|
909710
|
+
await (0, import_promises143.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
909646
909711
|
}
|
|
909647
909712
|
|
|
909648
909713
|
// ../init/lib/initializeAPI.js
|
|
@@ -909693,7 +909758,7 @@ async function getDirectoryOfNewAPIWorkspace({ absolutePathToFernDirectory, task
|
|
|
909693
909758
|
if (inlinedApiDefinition || inlinedOpenApiWorkspace) {
|
|
909694
909759
|
taskContext.logger.info("Creating workspaces to support multiple API Definitions.");
|
|
909695
909760
|
const apiWorkspaceDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY), RelativeFilePath2.of("api"));
|
|
909696
|
-
await (0,
|
|
909761
|
+
await (0, import_promises144.mkdir)(apiWorkspaceDirectory, { recursive: true });
|
|
909697
909762
|
if (inlinedApiDefinition) {
|
|
909698
909763
|
const inlinedDefinitionDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
909699
909764
|
const workspaceDefinitionDirectory = join8(apiWorkspaceDirectory, RelativeFilePath2.of(DEFINITION_DIRECTORY));
|
|
@@ -909730,7 +909795,7 @@ async function hasInlinedOpenAPIWorkspace({ absolutePathToFernDirectory }) {
|
|
|
909730
909795
|
// ../init/lib/initializeDocs.js
|
|
909731
909796
|
init_lib4();
|
|
909732
909797
|
init_lib8();
|
|
909733
|
-
var
|
|
909798
|
+
var import_promises145 = require("fs/promises");
|
|
909734
909799
|
init_js_yaml();
|
|
909735
909800
|
async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
909736
909801
|
const createDirectoryResponse = await createFernDirectoryAndWorkspace({
|
|
@@ -909746,7 +909811,7 @@ async function initializeDocs({ organization, taskContext, versionOfCli }) {
|
|
|
909746
909811
|
} else {
|
|
909747
909812
|
try {
|
|
909748
909813
|
const docsConfig = getDocsConfig(createDirectoryResponse.organization);
|
|
909749
|
-
await (0,
|
|
909814
|
+
await (0, import_promises145.writeFile)(docsYmlPath, index_vite_proxy_tmp_default.dump(docsConfig));
|
|
909750
909815
|
taskContext.logger.info(source_default.green("Created docs configuration"));
|
|
909751
909816
|
return;
|
|
909752
909817
|
} catch (writeError) {
|
|
@@ -909802,7 +909867,7 @@ var FernDocsBuilder = class {
|
|
|
909802
909867
|
// ../docs-importers/commons/lib/FernDocsBuilderImpl.js
|
|
909803
909868
|
init_lib8();
|
|
909804
909869
|
init_lib6();
|
|
909805
|
-
var
|
|
909870
|
+
var import_promises146 = require("fs/promises");
|
|
909806
909871
|
init_js_yaml();
|
|
909807
909872
|
var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
909808
909873
|
openApiSpecs = {};
|
|
@@ -909862,7 +909927,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
909862
909927
|
}
|
|
909863
909928
|
async build({ outputDirectory }) {
|
|
909864
909929
|
const absolutePathToFernDirectory = join8(outputDirectory, RelativeFilePath2.of(FERN_DIRECTORY));
|
|
909865
|
-
await (0,
|
|
909930
|
+
await (0, import_promises146.mkdir)(absolutePathToFernDirectory, { recursive: true });
|
|
909866
909931
|
if (Object.keys(this.tabbedNavigation).length > 0) {
|
|
909867
909932
|
this.docsYml.tabs = Object.fromEntries(Object.entries(this.tabbedNavigation).map(([key2, value2]) => {
|
|
909868
909933
|
return [value2.tabId, value2.tabConfig];
|
|
@@ -909887,27 +909952,27 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
909887
909952
|
}))
|
|
909888
909953
|
};
|
|
909889
909954
|
}
|
|
909890
|
-
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)));
|
|
909891
909956
|
await Promise.all(Object.entries(this.openApiSpecs).map(async ([relativePath, absolutePath]) => {
|
|
909892
909957
|
const absolutePathToOpenAPI = join8(absolutePathToFernDirectory, RelativeFilePath2.of(relativePath));
|
|
909893
|
-
await (0,
|
|
909894
|
-
await (0,
|
|
909958
|
+
await (0, import_promises146.mkdir)(dirname6(absolutePathToOpenAPI), { recursive: true });
|
|
909959
|
+
await (0, import_promises146.cp)(absolutePath, absolutePathToOpenAPI);
|
|
909895
909960
|
}));
|
|
909896
909961
|
}
|
|
909897
|
-
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 })));
|
|
909898
909963
|
await Promise.all(Object.entries(this.markdownPages).map(async ([filepath, page]) => {
|
|
909899
909964
|
const absoluteFilepathToMarkdownPage = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
909900
|
-
await (0,
|
|
909965
|
+
await (0, import_promises146.mkdir)(dirname6(absoluteFilepathToMarkdownPage), { recursive: true });
|
|
909901
909966
|
const frontmatter = Object.keys(page.frontmatter).length > 0 ? `---
|
|
909902
909967
|
${index_vite_proxy_tmp_default.dump(JSON.parse(JSON.stringify(page.frontmatter)))}---
|
|
909903
909968
|
|
|
909904
909969
|
` : "";
|
|
909905
|
-
await (0,
|
|
909970
|
+
await (0, import_promises146.writeFile)(absoluteFilepathToMarkdownPage, `${frontmatter}${page.markdown}`);
|
|
909906
909971
|
}));
|
|
909907
909972
|
await Promise.all(Object.entries(this.assets).map(async ([filepath, asset]) => {
|
|
909908
909973
|
const absolutePathToAsset = join8(absolutePathToFernDirectory, RelativeFilePath2.of(filepath));
|
|
909909
|
-
await (0,
|
|
909910
|
-
await (0,
|
|
909974
|
+
await (0, import_promises146.mkdir)(dirname6(absolutePathToAsset), { recursive: true });
|
|
909975
|
+
await (0, import_promises146.cp)(asset.absoluteFilePathToAsset, absolutePathToAsset);
|
|
909911
909976
|
}));
|
|
909912
909977
|
}
|
|
909913
909978
|
setInstance({ companyName }) {
|
|
@@ -909941,7 +910006,7 @@ var NonTabbedNavigationBuilderImpl = class {
|
|
|
909941
910006
|
// ../docs-importers/mintlify/lib/MintlifyImporter.js
|
|
909942
910007
|
init_lib8();
|
|
909943
910008
|
init_lib6();
|
|
909944
|
-
var
|
|
910009
|
+
var import_promises148 = require("fs/promises");
|
|
909945
910010
|
|
|
909946
910011
|
// ../docs-importers/mintlify/lib/convertColors.js
|
|
909947
910012
|
function convertColors(colors19) {
|
|
@@ -910002,10 +910067,10 @@ init_lib8();
|
|
|
910002
910067
|
|
|
910003
910068
|
// ../docs-importers/mintlify/lib/convertMarkdown.js
|
|
910004
910069
|
init_lib8();
|
|
910005
|
-
var
|
|
910070
|
+
var import_promises147 = require("fs/promises");
|
|
910006
910071
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
910007
910072
|
async function convertMarkdown({ absolutePathToMintJson, absoluteFilepathToMarkdown, relativeFilepathFromRoot, builder }) {
|
|
910008
|
-
const text9 = await (0,
|
|
910073
|
+
const text9 = await (0, import_promises147.readFile)(absoluteFilepathToMarkdown, "utf-8");
|
|
910009
910074
|
const { data: data2, content: content5 } = parseMintlifyFrontmatter(text9);
|
|
910010
910075
|
const slug = relativeFilepathFromRoot.replace(/\.(md|mdx)$/, "");
|
|
910011
910076
|
const transformedContent = markReferencedAssets({
|
|
@@ -910174,7 +910239,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
910174
910239
|
documentationTab = void 0;
|
|
910175
910240
|
tabUrlToInfo = {};
|
|
910176
910241
|
async import({ args, builder }) {
|
|
910177
|
-
const mintJsonContent = await (0,
|
|
910242
|
+
const mintJsonContent = await (0, import_promises148.readFile)(args.absolutePathToMintJson, "utf-8");
|
|
910178
910243
|
const mint = this.parseMintJson({
|
|
910179
910244
|
content: mintJsonContent,
|
|
910180
910245
|
absolutePathToMintJson: args.absolutePathToMintJson
|
|
@@ -910319,7 +910384,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
910319
910384
|
|
|
910320
910385
|
// ../docs-importers/mintlify/lib/runMintlifyMigration.js
|
|
910321
910386
|
init_lib8();
|
|
910322
|
-
var
|
|
910387
|
+
var import_promises149 = require("fs/promises");
|
|
910323
910388
|
async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskContext, versionOfCli, organization }) {
|
|
910324
910389
|
const mintlifyImporter = new MintlifyImporter({
|
|
910325
910390
|
context: taskContext
|
|
@@ -910330,7 +910395,7 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
910330
910395
|
builder
|
|
910331
910396
|
});
|
|
910332
910397
|
await builder.build({ outputDirectory: outputPath });
|
|
910333
|
-
await (0,
|
|
910398
|
+
await (0, import_promises149.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
910334
910399
|
version: versionOfCli,
|
|
910335
910400
|
organization
|
|
910336
910401
|
}, void 0, 4));
|
|
@@ -910391,7 +910456,7 @@ function assertIsStringArray(val) {
|
|
|
910391
910456
|
// ../docs-importers/readme/lib/ReadmeImporter.js
|
|
910392
910457
|
init_lib4();
|
|
910393
910458
|
init_lib8();
|
|
910394
|
-
var
|
|
910459
|
+
var import_promises150 = require("fs/promises");
|
|
910395
910460
|
|
|
910396
910461
|
// ../docs-importers/readme/lib/extract/favicon.js
|
|
910397
910462
|
init_unist_util_visit();
|
|
@@ -913745,7 +913810,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913745
913810
|
if (response.ok) {
|
|
913746
913811
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
913747
913812
|
const faviconPath = join8(assetsDirectory, RelativeFilePath2.of("favicon"));
|
|
913748
|
-
await (0,
|
|
913813
|
+
await (0, import_promises150.writeFile)(faviconPath, new Uint8Array(imageBuffer));
|
|
913749
913814
|
builder.setFavicon({ favicon: relativize(this.absolutePathToFernDirectory, faviconPath) });
|
|
913750
913815
|
}
|
|
913751
913816
|
}
|
|
@@ -913762,7 +913827,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913762
913827
|
*/
|
|
913763
913828
|
async getAndCreateAssetsDirectory() {
|
|
913764
913829
|
const assetsDirectory = join8(this.absolutePathToFernDirectory, RelativeFilePath2.of("assets"));
|
|
913765
|
-
await (0,
|
|
913830
|
+
await (0, import_promises150.mkdir)(assetsDirectory, { recursive: true });
|
|
913766
913831
|
return assetsDirectory;
|
|
913767
913832
|
}
|
|
913768
913833
|
/**
|
|
@@ -913812,7 +913877,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913812
913877
|
absolutePathToOutputDirectory,
|
|
913813
913878
|
section
|
|
913814
913879
|
});
|
|
913815
|
-
await (0,
|
|
913880
|
+
await (0, import_promises150.mkdir)(absolutePathToOutputDirectoryForSection, { recursive: true });
|
|
913816
913881
|
await Promise.all(section.pages.filter((page) => page.type === "page").map(async (page) => {
|
|
913817
913882
|
const url3 = new URL(page.slug.toString(), this.url);
|
|
913818
913883
|
this.logger.debug(`Fetching page: ${url3.toString()}`);
|
|
@@ -913827,7 +913892,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913827
913892
|
absolutePathToOutputDirectoryForSection,
|
|
913828
913893
|
page: page.slug
|
|
913829
913894
|
});
|
|
913830
|
-
await (0,
|
|
913895
|
+
await (0, import_promises150.writeFile)(absolutePathForPage, result.data.mdx);
|
|
913831
913896
|
if (result.data.images.imageURLs.length > 0) {
|
|
913832
913897
|
this.logger.debug(`Found ${result.data.images.imageURLs.length} images to download for ${url3.toString()}`);
|
|
913833
913898
|
await Promise.all(Object.entries(result.data.images.imageURLToFilename).map(async ([imageUrl, filename]) => {
|
|
@@ -913840,8 +913905,8 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913840
913905
|
const imageBuffer = Buffer.from(await response.arrayBuffer());
|
|
913841
913906
|
const imagePath = join8(absolutePathToOutputDirectoryForSection, RelativeFilePath2.of(filename));
|
|
913842
913907
|
const imageDir = dirname6(imagePath);
|
|
913843
|
-
await (0,
|
|
913844
|
-
await (0,
|
|
913908
|
+
await (0, import_promises150.mkdir)(imageDir, { recursive: true });
|
|
913909
|
+
await (0, import_promises150.writeFile)(imagePath, new Uint8Array(imageBuffer));
|
|
913845
913910
|
this.logger.debug(`Saved image to ${imagePath}`);
|
|
913846
913911
|
} catch (error50) {
|
|
913847
913912
|
this.logger.warn(`Error downloading image ${imageUrl}: ${error50}`);
|
|
@@ -913924,7 +913989,7 @@ var ReadmeImporter = class extends DocsImporter {
|
|
|
913924
913989
|
|
|
913925
913990
|
// ../docs-importers/readme/lib/runReadmeMigration.js
|
|
913926
913991
|
init_lib8();
|
|
913927
|
-
var
|
|
913992
|
+
var import_promises151 = require("fs/promises");
|
|
913928
913993
|
async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionOfCli, organization }) {
|
|
913929
913994
|
const builder = new FernDocsBuilderImpl();
|
|
913930
913995
|
builder.setInstance({ companyName: organization });
|
|
@@ -913939,7 +914004,7 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
913939
914004
|
builder
|
|
913940
914005
|
});
|
|
913941
914006
|
await builder.build({ outputDirectory: outputPath });
|
|
913942
|
-
await (0,
|
|
914007
|
+
await (0, import_promises151.writeFile)(join8(AbsoluteFilePath2.of(outputPath), RelativeFilePath2.of(FERN_DIRECTORY), RelativeFilePath2.of(PROJECT_CONFIG_FILENAME)), JSON.stringify({
|
|
913943
914008
|
version: versionOfCli,
|
|
913944
914009
|
organization
|
|
913945
914010
|
}, void 0, 4));
|
|
@@ -913965,7 +914030,7 @@ var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versio
|
|
|
913965
914030
|
};
|
|
913966
914031
|
|
|
913967
914032
|
// ../init/lib/utils/loadOpenApiFromUrl.js
|
|
913968
|
-
var
|
|
914033
|
+
var import_promises152 = require("fs/promises");
|
|
913969
914034
|
init_js_yaml();
|
|
913970
914035
|
var import_path102 = require("path");
|
|
913971
914036
|
var import_tmp_promise18 = __toESM(require_tmp_promise(), 1);
|
|
@@ -913981,7 +914046,7 @@ async function loadOpenAPIFromUrl({ url: url3, logger: logger4 }) {
|
|
|
913981
914046
|
const filePath = (0, import_path102.join)(tmpDir.path, url3.endsWith(".json") ? "openapi.json" : "openapi.yaml");
|
|
913982
914047
|
logger4.debug("tmpDir", tmpDir.path);
|
|
913983
914048
|
logger4.debug("filePath", filePath);
|
|
913984
|
-
await (0,
|
|
914049
|
+
await (0, import_promises152.writeFile)(filePath, data2);
|
|
913985
914050
|
return {
|
|
913986
914051
|
status: LoadOpenAPIStatus.Success,
|
|
913987
914052
|
filePath
|
|
@@ -917860,7 +917925,7 @@ function getAutomationContextFromEnv() {
|
|
|
917860
917925
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
917861
917926
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
917862
917927
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
917863
|
-
cli_version: "5.23.3-
|
|
917928
|
+
cli_version: "5.23.3-798-g4d95187bafb"
|
|
917864
917929
|
};
|
|
917865
917930
|
}
|
|
917866
917931
|
function isAutomationMode() {
|
|
@@ -918686,7 +918751,7 @@ var CliContext = class _CliContext {
|
|
|
918686
918751
|
if (false) {
|
|
918687
918752
|
this.logger.error("CLI_VERSION is not defined");
|
|
918688
918753
|
}
|
|
918689
|
-
return "5.23.3-
|
|
918754
|
+
return "5.23.3-798-g4d95187bafb";
|
|
918690
918755
|
}
|
|
918691
918756
|
getCliName() {
|
|
918692
918757
|
if (false) {
|
|
@@ -918994,7 +919059,7 @@ function wrapWorkspaceNameForPrefix(workspaceName) {
|
|
|
918994
919059
|
// ../project-loader/lib/loadProject.js
|
|
918995
919060
|
init_lib8();
|
|
918996
919061
|
init_lib6();
|
|
918997
|
-
var
|
|
919062
|
+
var import_promises153 = require("fs/promises");
|
|
918998
919063
|
|
|
918999
919064
|
// ../project-loader/lib/normalizeCommandLineApiWorkspace.js
|
|
919000
919065
|
function normalizeCommandLineApiWorkspace(input3) {
|
|
@@ -919076,7 +919141,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
919076
919141
|
const apisDirectory = join8(fernDirectory, RelativeFilePath2.of(APIS_DIRECTORY));
|
|
919077
919142
|
const apisDirectoryExists = await doesPathExist(apisDirectory);
|
|
919078
919143
|
if (apisDirectoryExists) {
|
|
919079
|
-
const apiDirectoryContents = await (0,
|
|
919144
|
+
const apiDirectoryContents = await (0, import_promises153.readdir)(apisDirectory, { withFileTypes: true });
|
|
919080
919145
|
const apiWorkspaceDirectoryNames = apiDirectoryContents.reduce((all9, item) => {
|
|
919081
919146
|
if (item.isDirectory()) {
|
|
919082
919147
|
all9.push(item.name);
|
|
@@ -919153,12 +919218,12 @@ async function loadProjectAndRegisterWorkspacesWithContext(cliContext, args, reg
|
|
|
919153
919218
|
// src/cliV2.ts
|
|
919154
919219
|
init_lib6();
|
|
919155
919220
|
var import_generators_sdk6 = __toESM(require_generators_sdk(), 1);
|
|
919156
|
-
var
|
|
919221
|
+
var import_promises158 = require("fs/promises");
|
|
919157
919222
|
|
|
919158
919223
|
// src/commands/generator-list/getGeneratorList.ts
|
|
919159
919224
|
init_lib4();
|
|
919160
919225
|
init_lib6();
|
|
919161
|
-
var
|
|
919226
|
+
var import_promises154 = require("fs/promises");
|
|
919162
919227
|
init_js_yaml();
|
|
919163
919228
|
var GenerationModeFilter = {
|
|
919164
919229
|
GitHub: "github",
|
|
@@ -919219,7 +919284,7 @@ async function getGeneratorList({
|
|
|
919219
919284
|
return;
|
|
919220
919285
|
}
|
|
919221
919286
|
try {
|
|
919222
|
-
await (0,
|
|
919287
|
+
await (0, import_promises154.writeFile)(outputLocation, generatorsListYaml);
|
|
919223
919288
|
} catch (error50) {
|
|
919224
919289
|
cliContext.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
919225
919290
|
code: CliError.Code.ConfigError
|
|
@@ -919288,7 +919353,7 @@ async function getGeneratorMetadata({
|
|
|
919288
919353
|
|
|
919289
919354
|
// src/commands/organization/getOrganization.ts
|
|
919290
919355
|
init_lib6();
|
|
919291
|
-
var
|
|
919356
|
+
var import_promises155 = require("fs/promises");
|
|
919292
919357
|
async function getOrganization({
|
|
919293
919358
|
project,
|
|
919294
919359
|
outputLocation,
|
|
@@ -919300,7 +919365,7 @@ async function getOrganization({
|
|
|
919300
919365
|
return;
|
|
919301
919366
|
}
|
|
919302
919367
|
try {
|
|
919303
|
-
await (0,
|
|
919368
|
+
await (0, import_promises155.writeFile)(outputLocation, org);
|
|
919304
919369
|
} catch (error50) {
|
|
919305
919370
|
context3.failAndThrow(`Could not write file to the specified location: ${outputLocation}`, error50, {
|
|
919306
919371
|
code: CliError.Code.ConfigError
|
|
@@ -919311,7 +919376,7 @@ async function getOrganization({
|
|
|
919311
919376
|
// src/commands/upgrade/upgradeGenerator.ts
|
|
919312
919377
|
init_lib8();
|
|
919313
919378
|
init_lib6();
|
|
919314
|
-
var
|
|
919379
|
+
var import_promises157 = require("fs/promises");
|
|
919315
919380
|
var import_path104 = __toESM(require("path"), 1);
|
|
919316
919381
|
var import_semver16 = __toESM(require_semver2(), 1);
|
|
919317
919382
|
var import_yaml6 = __toESM(require_dist11(), 1);
|
|
@@ -919321,7 +919386,7 @@ init_lib4();
|
|
|
919321
919386
|
init_lib12();
|
|
919322
919387
|
init_lib6();
|
|
919323
919388
|
var import_fs40 = require("fs");
|
|
919324
|
-
var
|
|
919389
|
+
var import_promises156 = require("fs/promises");
|
|
919325
919390
|
var import_os15 = require("os");
|
|
919326
919391
|
var import_path103 = require("path");
|
|
919327
919392
|
var import_semver15 = __toESM(require_semver2(), 1);
|
|
@@ -919349,7 +919414,7 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
919349
919414
|
const myPid = String(process.pid);
|
|
919350
919415
|
while (true) {
|
|
919351
919416
|
try {
|
|
919352
|
-
const fh = await (0,
|
|
919417
|
+
const fh = await (0, import_promises156.open)(lockPath, "wx");
|
|
919353
919418
|
await fh.writeFile(myPid);
|
|
919354
919419
|
await fh.close();
|
|
919355
919420
|
const exitHandler = () => {
|
|
@@ -919366,9 +919431,9 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
919366
919431
|
return async () => {
|
|
919367
919432
|
process.removeListener("exit", exitHandler);
|
|
919368
919433
|
try {
|
|
919369
|
-
const currentContent = await (0,
|
|
919434
|
+
const currentContent = await (0, import_promises156.readFile)(lockPath, "utf-8");
|
|
919370
919435
|
if (currentContent.trim() === myPid) {
|
|
919371
|
-
await (0,
|
|
919436
|
+
await (0, import_promises156.unlink)(lockPath);
|
|
919372
919437
|
} else {
|
|
919373
919438
|
logger4.debug(
|
|
919374
919439
|
`Lock file owned by another process (expected pid=${myPid}, found=${currentContent.trim()}); skipping release`
|
|
@@ -919384,14 +919449,14 @@ async function acquireLock3(logger4, cacheDir) {
|
|
|
919384
919449
|
throw err;
|
|
919385
919450
|
}
|
|
919386
919451
|
try {
|
|
919387
|
-
const lockContent = await (0,
|
|
919452
|
+
const lockContent = await (0, import_promises156.readFile)(lockPath, "utf-8");
|
|
919388
919453
|
const lockPid = Number(lockContent.trim());
|
|
919389
|
-
const lockStat = await (0,
|
|
919454
|
+
const lockStat = await (0, import_promises156.stat)(lockPath);
|
|
919390
919455
|
const lockAge = Date.now() - lockStat.mtimeMs;
|
|
919391
919456
|
if (lockAge > LOCK_STALE_MS || Number.isFinite(lockPid) && lockPid > 0 && !isProcessAlive(lockPid)) {
|
|
919392
919457
|
logger4.debug(`Removing stale migration lock (pid=${lockContent.trim()}, age=${lockAge}ms)`);
|
|
919393
919458
|
try {
|
|
919394
|
-
await (0,
|
|
919459
|
+
await (0, import_promises156.unlink)(lockPath);
|
|
919395
919460
|
} catch (unlinkErr) {
|
|
919396
919461
|
logger4.debug(`Failed to remove stale lock: ${unlinkErr}`);
|
|
919397
919462
|
}
|
|
@@ -919415,7 +919480,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
919415
919480
|
}
|
|
919416
919481
|
migrationsInstallPromise = (async () => {
|
|
919417
919482
|
const cacheDir = getMigrationCacheDir();
|
|
919418
|
-
await (0,
|
|
919483
|
+
await (0, import_promises156.mkdir)(cacheDir, { recursive: true });
|
|
919419
919484
|
const npmCacheDir = (0, import_path103.join)(cacheDir, ".npm-cache");
|
|
919420
919485
|
const packageDir = (0, import_path103.join)(cacheDir, "node_modules", MIGRATION_PACKAGE_NAME2);
|
|
919421
919486
|
const packageJsonPath = (0, import_path103.join)(packageDir, "package.json");
|
|
@@ -919432,7 +919497,7 @@ async function ensureMigrationsInstalled(logger4) {
|
|
|
919432
919497
|
"--no-audit",
|
|
919433
919498
|
"--no-fund"
|
|
919434
919499
|
]);
|
|
919435
|
-
const packageJsonContent = await (0,
|
|
919500
|
+
const packageJsonContent = await (0, import_promises156.readFile)(packageJsonPath, "utf-8");
|
|
919436
919501
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
919437
919502
|
if (packageJson2.main == null) {
|
|
919438
919503
|
throw new CliError({
|
|
@@ -919616,7 +919681,7 @@ async function loadAndUpdateGenerators({
|
|
|
919616
919681
|
skippedAutoreleaseDisabled: []
|
|
919617
919682
|
};
|
|
919618
919683
|
}
|
|
919619
|
-
const contents = await (0,
|
|
919684
|
+
const contents = await (0, import_promises157.readFile)(filepath);
|
|
919620
919685
|
context3.logger.debug(`Found generators: ${contents.toString()}`);
|
|
919621
919686
|
const parsedDocument = import_yaml6.default.parseDocument(contents.toString());
|
|
919622
919687
|
const generatorGroups = parsedDocument.get("groups");
|
|
@@ -919853,7 +919918,7 @@ async function upgradeGenerator({
|
|
|
919853
919918
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
919854
919919
|
});
|
|
919855
919920
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
919856
|
-
await (0,
|
|
919921
|
+
await (0, import_promises157.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
919857
919922
|
}
|
|
919858
919923
|
allSkippedMajorUpgrades.push(...result.skippedMajorUpgrades);
|
|
919859
919924
|
if (result.appliedUpgrades.length > 0) {
|
|
@@ -920253,7 +920318,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
920253
920318
|
}
|
|
920254
920319
|
if (argv.output) {
|
|
920255
920320
|
try {
|
|
920256
|
-
await (0,
|
|
920321
|
+
await (0, import_promises158.writeFile)(argv.output, JSON.stringify(generatorMetadata, null, 2));
|
|
920257
920322
|
} catch (error50) {
|
|
920258
920323
|
cliContext.failAndThrow(
|
|
920259
920324
|
`Could not write file to the specified location: ${argv.output}`,
|
|
@@ -920268,7 +920333,7 @@ function addGeneratorCommands(cli, cliContext) {
|
|
|
920268
920333
|
}
|
|
920269
920334
|
|
|
920270
920335
|
// src/commands/add-generator/addGeneratorToWorkspaces.ts
|
|
920271
|
-
var
|
|
920336
|
+
var import_promises159 = require("fs/promises");
|
|
920272
920337
|
init_js_yaml();
|
|
920273
920338
|
async function addGeneratorToWorkspaces({
|
|
920274
920339
|
project: { apiWorkspaces },
|
|
@@ -920296,7 +920361,7 @@ async function addGeneratorToWorkspaces({
|
|
|
920296
920361
|
if (absolutePathToGeneratorsConfiguration == null) {
|
|
920297
920362
|
return;
|
|
920298
920363
|
}
|
|
920299
|
-
await (0,
|
|
920364
|
+
await (0, import_promises159.writeFile)(
|
|
920300
920365
|
absolutePathToGeneratorsConfiguration,
|
|
920301
920366
|
"# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json\n" + index_vite_proxy_tmp_default.dump(newConfiguration)
|
|
920302
920367
|
);
|
|
@@ -920363,11 +920428,11 @@ var LOCAL_STORAGE_FOLDER6 = ".fern-dev";
|
|
|
920363
920428
|
|
|
920364
920429
|
// src/commands/generate/checkOutputDirectory.ts
|
|
920365
920430
|
init_lib8();
|
|
920366
|
-
var
|
|
920431
|
+
var import_promises162 = require("fs/promises");
|
|
920367
920432
|
|
|
920368
920433
|
// src/persistence/output-directories/getOutputDirectories.ts
|
|
920369
920434
|
init_lib8();
|
|
920370
|
-
var
|
|
920435
|
+
var import_promises160 = require("fs/promises");
|
|
920371
920436
|
|
|
920372
920437
|
// src/persistence/output-directories/getPathToOutputDirectoriesFile.ts
|
|
920373
920438
|
init_lib8();
|
|
@@ -920387,17 +920452,17 @@ async function getOutputDirectories() {
|
|
|
920387
920452
|
if (!doesOutputDirectoriesFileExist) {
|
|
920388
920453
|
return [];
|
|
920389
920454
|
}
|
|
920390
|
-
const outputDirectoriesFileContents = await (0,
|
|
920455
|
+
const outputDirectoriesFileContents = await (0, import_promises160.readFile)(pathToOutputDirectoriesFile, { encoding: "utf-8" });
|
|
920391
920456
|
const outputDirectories = JSON.parse(outputDirectoriesFileContents);
|
|
920392
920457
|
return outputDirectories;
|
|
920393
920458
|
}
|
|
920394
920459
|
|
|
920395
920460
|
// src/persistence/output-directories/storeOutputDirectories.ts
|
|
920396
|
-
var
|
|
920461
|
+
var import_promises161 = require("fs/promises");
|
|
920397
920462
|
var import_path105 = __toESM(require("path"), 1);
|
|
920398
920463
|
async function storeOutputDirectories(outputDirectories) {
|
|
920399
|
-
await (0,
|
|
920400
|
-
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));
|
|
920401
920466
|
}
|
|
920402
920467
|
|
|
920403
920468
|
// src/commands/generate/checkOutputDirectory.ts
|
|
@@ -920419,7 +920484,7 @@ async function checkOutputDirectory(outputPath, cliContext, force) {
|
|
|
920419
920484
|
shouldProceed: true
|
|
920420
920485
|
};
|
|
920421
920486
|
}
|
|
920422
|
-
const files = await (0,
|
|
920487
|
+
const files = await (0, import_promises162.readdir)(outputPath);
|
|
920423
920488
|
if (files.length === 0) {
|
|
920424
920489
|
return {
|
|
920425
920490
|
shouldProceed: true
|
|
@@ -921402,7 +921467,7 @@ function renderOverflowWarning(failureCount) {
|
|
|
921402
921467
|
// src/commands/automations/generate/reportGenerateResults.ts
|
|
921403
921468
|
init_lib4();
|
|
921404
921469
|
var import_fs41 = require("fs");
|
|
921405
|
-
var
|
|
921470
|
+
var import_promises163 = require("fs/promises");
|
|
921406
921471
|
var JSON_SCHEMA_VERSION = 1;
|
|
921407
921472
|
function renderStdoutSummary(results) {
|
|
921408
921473
|
return formatCounts(countResults(results));
|
|
@@ -921592,12 +921657,12 @@ async function writeResults({
|
|
|
921592
921657
|
const stepSummaryPath = getGithubStepSummaryPath();
|
|
921593
921658
|
if (stepSummaryPath != null) {
|
|
921594
921659
|
try {
|
|
921595
|
-
await (0,
|
|
921660
|
+
await (0, import_promises163.appendFile)(stepSummaryPath, renderMarkdownSummary(results), "utf8");
|
|
921596
921661
|
} catch {
|
|
921597
921662
|
}
|
|
921598
921663
|
}
|
|
921599
921664
|
if (jsonOutputPath != null) {
|
|
921600
|
-
await (0,
|
|
921665
|
+
await (0, import_promises163.writeFile)(jsonOutputPath, JSON.stringify(renderJsonSummary(results), null, 2), "utf8");
|
|
921601
921666
|
}
|
|
921602
921667
|
}
|
|
921603
921668
|
function writeResultsSync({
|
|
@@ -921921,14 +921986,14 @@ function listPreviewGroups({
|
|
|
921921
921986
|
|
|
921922
921987
|
// src/commands/automations/upgrade/executeAutomationsUpgrade.ts
|
|
921923
921988
|
init_lib6();
|
|
921924
|
-
var
|
|
921989
|
+
var import_promises192 = require("fs/promises");
|
|
921925
921990
|
|
|
921926
921991
|
// ../cli-migrations/lib/runMigrations.js
|
|
921927
921992
|
init_lib4();
|
|
921928
921993
|
init_lib6();
|
|
921929
921994
|
|
|
921930
921995
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/migration.js
|
|
921931
|
-
var
|
|
921996
|
+
var import_promises164 = require("fs/promises");
|
|
921932
921997
|
|
|
921933
921998
|
// ../cli-migrations/lib/migrations/0.0.191/discriminant/getAllYamlFiles.js
|
|
921934
921999
|
init_lib8();
|
|
@@ -921964,7 +922029,7 @@ var migration = {
|
|
|
921964
922029
|
try {
|
|
921965
922030
|
const fileContents = await getFileContents(yamlFilepath);
|
|
921966
922031
|
const newContents = addDiscriminantToFile(fileContents);
|
|
921967
|
-
await (0,
|
|
922032
|
+
await (0, import_promises164.writeFile)(yamlFilepath, newContents);
|
|
921968
922033
|
} catch (error50) {
|
|
921969
922034
|
context3.failAndThrow("Failed to migrate " + yamlFilepath, error50);
|
|
921970
922035
|
}
|
|
@@ -921972,7 +922037,7 @@ var migration = {
|
|
|
921972
922037
|
}
|
|
921973
922038
|
};
|
|
921974
922039
|
async function getFileContents(filepath) {
|
|
921975
|
-
const buffer = await (0,
|
|
922040
|
+
const buffer = await (0, import_promises164.readFile)(filepath);
|
|
921976
922041
|
return buffer.toString();
|
|
921977
922042
|
}
|
|
921978
922043
|
var UNION_REGEX = /^(\s{2,})union:\s*$/gm;
|
|
@@ -922001,7 +922066,7 @@ var versionMigrations = {
|
|
|
922001
922066
|
var __default = versionMigrations;
|
|
922002
922067
|
|
|
922003
922068
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/migration.js
|
|
922004
|
-
var
|
|
922069
|
+
var import_promises165 = require("fs/promises");
|
|
922005
922070
|
var import_yaml7 = __toESM(require_dist11(), 1);
|
|
922006
922071
|
|
|
922007
922072
|
// ../cli-migrations/lib/migrations/0.0.203/union-single-property-key/getAllYamlFiles.js
|
|
@@ -922044,7 +922109,7 @@ var migration2 = {
|
|
|
922044
922109
|
}
|
|
922045
922110
|
};
|
|
922046
922111
|
async function migrateFile(filepath, context3) {
|
|
922047
|
-
const contents = await (0,
|
|
922112
|
+
const contents = await (0, import_promises165.readFile)(filepath);
|
|
922048
922113
|
const parsedDocument = import_yaml7.default.parseDocument(contents.toString());
|
|
922049
922114
|
const types4 = parsedDocument.get("types");
|
|
922050
922115
|
if (types4 == null) {
|
|
@@ -922076,7 +922141,7 @@ async function migrateFile(filepath, context3) {
|
|
|
922076
922141
|
}
|
|
922077
922142
|
}
|
|
922078
922143
|
}
|
|
922079
|
-
await (0,
|
|
922144
|
+
await (0, import_promises165.writeFile)(filepath, parsedDocument.toString());
|
|
922080
922145
|
}
|
|
922081
922146
|
|
|
922082
922147
|
// ../cli-migrations/lib/migrations/0.0.203/index.js
|
|
@@ -922087,7 +922152,7 @@ var versionMigrations2 = {
|
|
|
922087
922152
|
var __default2 = versionMigrations2;
|
|
922088
922153
|
|
|
922089
922154
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/migration.js
|
|
922090
|
-
var
|
|
922155
|
+
var import_promises166 = require("fs/promises");
|
|
922091
922156
|
var import_yaml8 = __toESM(require_dist11(), 1);
|
|
922092
922157
|
|
|
922093
922158
|
// ../cli-migrations/lib/migrations/0.0.207/add-mode-to-draft-generators/getAllGeneratorYamlFiles.js
|
|
@@ -922130,7 +922195,7 @@ var migration3 = {
|
|
|
922130
922195
|
}
|
|
922131
922196
|
};
|
|
922132
922197
|
async function migrateGeneratorsYml(filepath, context3) {
|
|
922133
|
-
const contents = await (0,
|
|
922198
|
+
const contents = await (0, import_promises166.readFile)(filepath);
|
|
922134
922199
|
const parsedDocument = import_yaml8.default.parseDocument(contents.toString());
|
|
922135
922200
|
const draftGenerators = parsedDocument.get("draft");
|
|
922136
922201
|
if (draftGenerators == null) {
|
|
@@ -922157,7 +922222,7 @@ async function migrateGeneratorsYml(filepath, context3) {
|
|
|
922157
922222
|
draftGenerator.set("output-path", name2.value.includes("openapi") ? "./generated-openapi" : name2.value.includes("postman") ? "./generated-postman" : localOutput);
|
|
922158
922223
|
}
|
|
922159
922224
|
});
|
|
922160
|
-
await (0,
|
|
922225
|
+
await (0, import_promises166.writeFile)(filepath, parsedDocument.toString());
|
|
922161
922226
|
}
|
|
922162
922227
|
|
|
922163
922228
|
// ../cli-migrations/lib/migrations/0.0.207/index.js
|
|
@@ -922168,7 +922233,7 @@ var versionMigrations3 = {
|
|
|
922168
922233
|
var __default3 = versionMigrations3;
|
|
922169
922234
|
|
|
922170
922235
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/migration.js
|
|
922171
|
-
var
|
|
922236
|
+
var import_promises167 = require("fs/promises");
|
|
922172
922237
|
var import_yaml9 = __toESM(require_dist11(), 1);
|
|
922173
922238
|
|
|
922174
922239
|
// ../cli-migrations/lib/migrations/0.0.210/remove-inline-error-declarations/getAllYamlFiles.js
|
|
@@ -922211,7 +922276,7 @@ var migration4 = {
|
|
|
922211
922276
|
}
|
|
922212
922277
|
};
|
|
922213
922278
|
async function migrateFile2(filepath, context3) {
|
|
922214
|
-
const contents = await (0,
|
|
922279
|
+
const contents = await (0, import_promises167.readFile)(filepath);
|
|
922215
922280
|
const parsedDocument = import_yaml9.default.parseDocument(contents.toString());
|
|
922216
922281
|
const addType = (typeName, typeDeclaration2) => {
|
|
922217
922282
|
const types4 = parsedDocument.get("types");
|
|
@@ -922255,7 +922320,7 @@ async function migrateFile2(filepath, context3) {
|
|
|
922255
922320
|
}
|
|
922256
922321
|
}
|
|
922257
922322
|
}
|
|
922258
|
-
await (0,
|
|
922323
|
+
await (0, import_promises167.writeFile)(filepath, parsedDocument.toString());
|
|
922259
922324
|
}
|
|
922260
922325
|
|
|
922261
922326
|
// ../cli-migrations/lib/migrations/0.0.210/index.js
|
|
@@ -922266,7 +922331,7 @@ var versionMigrations4 = {
|
|
|
922266
922331
|
var __default4 = versionMigrations4;
|
|
922267
922332
|
|
|
922268
922333
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/migration.js
|
|
922269
|
-
var
|
|
922334
|
+
var import_promises168 = require("fs/promises");
|
|
922270
922335
|
var import_yaml10 = __toESM(require_dist11(), 1);
|
|
922271
922336
|
|
|
922272
922337
|
// ../cli-migrations/lib/migrations/0.0.212/add-publishing-to-release-generators/getAllGeneratorYamlFiles.js
|
|
@@ -922309,7 +922374,7 @@ var migration5 = {
|
|
|
922309
922374
|
}
|
|
922310
922375
|
};
|
|
922311
922376
|
async function migrateGeneratorsYml2(filepath, context3) {
|
|
922312
|
-
const contents = await (0,
|
|
922377
|
+
const contents = await (0, import_promises168.readFile)(filepath);
|
|
922313
922378
|
const parsedDocument = import_yaml10.default.parseDocument(contents.toString());
|
|
922314
922379
|
const releaseGenerators = parsedDocument.get("release");
|
|
922315
922380
|
if (releaseGenerators == null) {
|
|
@@ -922347,7 +922412,7 @@ async function migrateGeneratorsYml2(filepath, context3) {
|
|
|
922347
922412
|
}
|
|
922348
922413
|
releaseGenerator.delete("outputs");
|
|
922349
922414
|
});
|
|
922350
|
-
await (0,
|
|
922415
|
+
await (0, import_promises168.writeFile)(filepath, parsedDocument.toString());
|
|
922351
922416
|
}
|
|
922352
922417
|
|
|
922353
922418
|
// ../cli-migrations/lib/migrations/0.0.212/index.js
|
|
@@ -922358,7 +922423,7 @@ var versionMigrations5 = {
|
|
|
922358
922423
|
var __default5 = versionMigrations5;
|
|
922359
922424
|
|
|
922360
922425
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/migration.js
|
|
922361
|
-
var
|
|
922426
|
+
var import_promises169 = require("fs/promises");
|
|
922362
922427
|
|
|
922363
922428
|
// ../cli-migrations/lib/migrations/0.0.220/rename-alias-key-to-type/getAllYamlFiles.js
|
|
922364
922429
|
init_lib8();
|
|
@@ -922391,9 +922456,9 @@ var migration6 = {
|
|
|
922391
922456
|
run: async ({ context: context3 }) => {
|
|
922392
922457
|
const yamlFiles = await getAllYamlFiles4(context3);
|
|
922393
922458
|
for (const filepath of yamlFiles) {
|
|
922394
|
-
const contents = await (0,
|
|
922459
|
+
const contents = await (0, import_promises169.readFile)(filepath);
|
|
922395
922460
|
const newContents = contents.toString().replaceAll(" alias:", " type:");
|
|
922396
|
-
await (0,
|
|
922461
|
+
await (0, import_promises169.writeFile)(filepath, newContents);
|
|
922397
922462
|
}
|
|
922398
922463
|
}
|
|
922399
922464
|
};
|
|
@@ -922406,7 +922471,7 @@ var versionMigrations6 = {
|
|
|
922406
922471
|
var __default6 = versionMigrations6;
|
|
922407
922472
|
|
|
922408
922473
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/migration.js
|
|
922409
|
-
var
|
|
922474
|
+
var import_promises170 = require("fs/promises");
|
|
922410
922475
|
|
|
922411
922476
|
// ../cli-migrations/lib/migrations/0.0.221/add-error-discriminant/getAllRootApiYamlFiles.js
|
|
922412
922477
|
init_lib8();
|
|
@@ -922439,9 +922504,9 @@ var migration7 = {
|
|
|
922439
922504
|
run: async ({ context: context3 }) => {
|
|
922440
922505
|
const yamlFiles = await getAllRootApiYamlFiles(context3);
|
|
922441
922506
|
for (const filepath of yamlFiles) {
|
|
922442
|
-
const contents = await (0,
|
|
922507
|
+
const contents = await (0, import_promises170.readFile)(filepath);
|
|
922443
922508
|
const newContents = contents.toString() + "\nerror-discriminant: error";
|
|
922444
|
-
await (0,
|
|
922509
|
+
await (0, import_promises170.writeFile)(filepath, newContents);
|
|
922445
922510
|
}
|
|
922446
922511
|
}
|
|
922447
922512
|
};
|
|
@@ -922455,7 +922520,7 @@ var __default7 = versionMigrations7;
|
|
|
922455
922520
|
|
|
922456
922521
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/migration.js
|
|
922457
922522
|
init_lib4();
|
|
922458
|
-
var
|
|
922523
|
+
var import_promises171 = require("fs/promises");
|
|
922459
922524
|
init_js_yaml();
|
|
922460
922525
|
|
|
922461
922526
|
// ../cli-migrations/lib/migrations/0.0.241/add-generator-groups/getAllGeneratorYamlFiles.js
|
|
@@ -922588,7 +922653,7 @@ var migration8 = {
|
|
|
922588
922653
|
}
|
|
922589
922654
|
};
|
|
922590
922655
|
async function migrateGeneratorsYml3(filepath) {
|
|
922591
|
-
const contentsStr = await (0,
|
|
922656
|
+
const contentsStr = await (0, import_promises171.readFile)(filepath);
|
|
922592
922657
|
const contents = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
922593
922658
|
const oldGeneratorsConfiguration = GeneratorsConfigurationSchema2.parse(contents);
|
|
922594
922659
|
let newGeneratorsConfiguration = {};
|
|
@@ -922606,7 +922671,7 @@ async function migrateGeneratorsYml3(filepath) {
|
|
|
922606
922671
|
generators: oldGeneratorsConfiguration.release.map((releaseGeneratorInvocation) => convertReleaseGeneratorInvocation(releaseGeneratorInvocation))
|
|
922607
922672
|
};
|
|
922608
922673
|
}
|
|
922609
|
-
await (0,
|
|
922674
|
+
await (0, import_promises171.writeFile)(filepath, index_vite_proxy_tmp_default.dump(newGeneratorsConfiguration));
|
|
922610
922675
|
}
|
|
922611
922676
|
function convertDraftGeneratorInvocation(draftGeneratorInvocation) {
|
|
922612
922677
|
const newSchema = {
|
|
@@ -922681,7 +922746,7 @@ var versionMigrations8 = {
|
|
|
922681
922746
|
var __default8 = versionMigrations8;
|
|
922682
922747
|
|
|
922683
922748
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/migration.js
|
|
922684
|
-
var
|
|
922749
|
+
var import_promises172 = require("fs/promises");
|
|
922685
922750
|
var import_yaml11 = __toESM(require_dist11(), 1);
|
|
922686
922751
|
|
|
922687
922752
|
// ../cli-migrations/lib/migrations/0.0.248/add-error-discrimination-config/getAllRootApiYamlFiles.js
|
|
@@ -922724,7 +922789,7 @@ var migration9 = {
|
|
|
922724
922789
|
}
|
|
922725
922790
|
};
|
|
922726
922791
|
async function migrateRootApiFile(filepath) {
|
|
922727
|
-
const contents = await (0,
|
|
922792
|
+
const contents = await (0, import_promises172.readFile)(filepath);
|
|
922728
922793
|
const parsedDocument = import_yaml11.default.parseDocument(contents.toString());
|
|
922729
922794
|
const errorDiscriminant = parsedDocument.get("error-discriminant", true);
|
|
922730
922795
|
if (errorDiscriminant == null || !import_yaml11.default.isScalar(errorDiscriminant) || typeof errorDiscriminant.value !== "string") {
|
|
@@ -922735,7 +922800,7 @@ async function migrateRootApiFile(filepath) {
|
|
|
922735
922800
|
"property-name": errorDiscriminant.value
|
|
922736
922801
|
});
|
|
922737
922802
|
parsedDocument.delete("error-discriminant");
|
|
922738
|
-
await (0,
|
|
922803
|
+
await (0, import_promises172.writeFile)(filepath, parsedDocument.toString());
|
|
922739
922804
|
}
|
|
922740
922805
|
|
|
922741
922806
|
// ../cli-migrations/lib/migrations/0.0.248/index.js
|
|
@@ -922746,7 +922811,7 @@ var versionMigrations9 = {
|
|
|
922746
922811
|
var __default9 = versionMigrations9;
|
|
922747
922812
|
|
|
922748
922813
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/migration.js
|
|
922749
|
-
var
|
|
922814
|
+
var import_promises173 = require("fs/promises");
|
|
922750
922815
|
var import_yaml12 = __toESM(require_dist11(), 1);
|
|
922751
922816
|
|
|
922752
922817
|
// ../cli-migrations/lib/migrations/0.1.3-rc3/add-inline-requests/getAllYamlFiles.js
|
|
@@ -922789,7 +922854,7 @@ var migration10 = {
|
|
|
922789
922854
|
}
|
|
922790
922855
|
};
|
|
922791
922856
|
async function migrateYamlFile(filepath, context3) {
|
|
922792
|
-
const contents = await (0,
|
|
922857
|
+
const contents = await (0, import_promises173.readFile)(filepath);
|
|
922793
922858
|
const parsedDocument = import_yaml12.default.parseDocument(contents.toString());
|
|
922794
922859
|
const services = parsedDocument.get("services");
|
|
922795
922860
|
if (services == null) {
|
|
@@ -922829,7 +922894,7 @@ async function migrateYamlFile(filepath, context3) {
|
|
|
922829
922894
|
context3.failWithoutThrowing("Failed to convert endpoint", e2);
|
|
922830
922895
|
}
|
|
922831
922896
|
}
|
|
922832
|
-
await (0,
|
|
922897
|
+
await (0, import_promises173.writeFile)(filepath, parsedDocument.toString());
|
|
922833
922898
|
}
|
|
922834
922899
|
}
|
|
922835
922900
|
function convertEndpoint4({ document: document4, endpoint: endpoint3 }) {
|
|
@@ -922908,7 +922973,7 @@ var versionMigrations10 = {
|
|
|
922908
922973
|
var __default10 = versionMigrations10;
|
|
922909
922974
|
|
|
922910
922975
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/migration.js
|
|
922911
|
-
var
|
|
922976
|
+
var import_promises174 = require("fs/promises");
|
|
922912
922977
|
var import_yaml13 = __toESM(require_dist11(), 1);
|
|
922913
922978
|
|
|
922914
922979
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/add-value-key-to-type-examples/getAllYamlFiles.js
|
|
@@ -922951,7 +923016,7 @@ var migration11 = {
|
|
|
922951
923016
|
}
|
|
922952
923017
|
};
|
|
922953
923018
|
async function migrateYamlFile2(filepath, context3) {
|
|
922954
|
-
const contents = await (0,
|
|
923019
|
+
const contents = await (0, import_promises174.readFile)(filepath);
|
|
922955
923020
|
const parsedDocument = import_yaml13.default.parseDocument(contents.toString());
|
|
922956
923021
|
const types4 = parsedDocument.get("types");
|
|
922957
923022
|
if (types4 == null) {
|
|
@@ -922977,7 +923042,7 @@ async function migrateYamlFile2(filepath, context3) {
|
|
|
922977
923042
|
examples.set(i5, { value: value2 });
|
|
922978
923043
|
}
|
|
922979
923044
|
}
|
|
922980
|
-
await (0,
|
|
923045
|
+
await (0, import_promises174.writeFile)(filepath, parsedDocument.toString());
|
|
922981
923046
|
}
|
|
922982
923047
|
|
|
922983
923048
|
// ../cli-migrations/lib/migrations/0.3.0-rc12/index.js
|
|
@@ -922988,7 +923053,7 @@ var versionMigrations11 = {
|
|
|
922988
923053
|
var __default11 = versionMigrations11;
|
|
922989
923054
|
|
|
922990
923055
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/migration.js
|
|
922991
|
-
var
|
|
923056
|
+
var import_promises175 = require("fs/promises");
|
|
922992
923057
|
var import_yaml14 = __toESM(require_dist11(), 1);
|
|
922993
923058
|
|
|
922994
923059
|
// ../cli-migrations/lib/migrations/0.3.23/change-services-key-to-service/getAllYamlFiles.js
|
|
@@ -923031,7 +923096,7 @@ var migration12 = {
|
|
|
923031
923096
|
}
|
|
923032
923097
|
};
|
|
923033
923098
|
async function migrateYamlFile3(filepath, context3) {
|
|
923034
|
-
const contents = await (0,
|
|
923099
|
+
const contents = await (0, import_promises175.readFile)(filepath);
|
|
923035
923100
|
const parsedDocument = import_yaml14.default.parseDocument(contents.toString());
|
|
923036
923101
|
if (!import_yaml14.default.isMap(parsedDocument.contents)) {
|
|
923037
923102
|
return context3.failAndThrow("File is not a map");
|
|
@@ -923061,7 +923126,7 @@ async function migrateYamlFile3(filepath, context3) {
|
|
|
923061
923126
|
pair.value = firstService.value;
|
|
923062
923127
|
}
|
|
923063
923128
|
}
|
|
923064
|
-
await (0,
|
|
923129
|
+
await (0, import_promises175.writeFile)(filepath, parsedDocument.toString());
|
|
923065
923130
|
}
|
|
923066
923131
|
|
|
923067
923132
|
// ../cli-migrations/lib/migrations/0.3.23/index.js
|
|
@@ -923072,7 +923137,7 @@ var versionMigrations12 = {
|
|
|
923072
923137
|
var __default12 = versionMigrations12;
|
|
923073
923138
|
|
|
923074
923139
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/migration.js
|
|
923075
|
-
var
|
|
923140
|
+
var import_promises176 = require("fs/promises");
|
|
923076
923141
|
var import_yaml15 = __toESM(require_dist11(), 1);
|
|
923077
923142
|
|
|
923078
923143
|
// ../cli-migrations/lib/migrations/0.5.4/move-service-docs-to-top-level/getAllYamlFiles.js
|
|
@@ -923115,7 +923180,7 @@ var migration13 = {
|
|
|
923115
923180
|
}
|
|
923116
923181
|
};
|
|
923117
923182
|
async function migrateYamlFile4(filepath, context3) {
|
|
923118
|
-
const contents = await (0,
|
|
923183
|
+
const contents = await (0, import_promises176.readFile)(filepath);
|
|
923119
923184
|
const parsedDocument = import_yaml15.default.parseDocument(contents.toString());
|
|
923120
923185
|
if (!import_yaml15.default.isMap(parsedDocument.contents)) {
|
|
923121
923186
|
return context3.failAndThrow("File is not a map");
|
|
@@ -923134,7 +923199,7 @@ async function migrateYamlFile4(filepath, context3) {
|
|
|
923134
923199
|
}
|
|
923135
923200
|
service.items.splice(indexOfServiceDocsPair, 1);
|
|
923136
923201
|
parsedDocument.contents.items.unshift(docsPair);
|
|
923137
|
-
await (0,
|
|
923202
|
+
await (0, import_promises176.writeFile)(filepath, parsedDocument.toString());
|
|
923138
923203
|
}
|
|
923139
923204
|
|
|
923140
923205
|
// ../cli-migrations/lib/migrations/0.5.4/index.js
|
|
@@ -923145,7 +923210,7 @@ var versionMigrations13 = {
|
|
|
923145
923210
|
var __default13 = versionMigrations13;
|
|
923146
923211
|
|
|
923147
923212
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/migration.js
|
|
923148
|
-
var
|
|
923213
|
+
var import_promises177 = require("fs/promises");
|
|
923149
923214
|
|
|
923150
923215
|
// ../cli-migrations/lib/migrations/0.9.10/add-suffix-to-docs-domain/getAllGeneratorYamlFiles.js
|
|
923151
923216
|
init_lib8();
|
|
@@ -923187,14 +923252,14 @@ var migration14 = {
|
|
|
923187
923252
|
}
|
|
923188
923253
|
};
|
|
923189
923254
|
async function migrateYamlFile5(filepath) {
|
|
923190
|
-
const contents = await (0,
|
|
923255
|
+
const contents = await (0, import_promises177.readFile)(filepath);
|
|
923191
923256
|
const domainSuffix = process.env.DOMAIN_SUFFIX ?? "docs.buildwithfern.com";
|
|
923192
923257
|
const regex6 = /(docs:\s*domain:\s*)"([^"]*)"/g;
|
|
923193
923258
|
const updatedSnapshot = contents.toString().replace(regex6, (_match, _prefix, domain3) => {
|
|
923194
923259
|
return `docs:
|
|
923195
923260
|
domain: "${domain3}.${domainSuffix}"`;
|
|
923196
923261
|
});
|
|
923197
|
-
await (0,
|
|
923262
|
+
await (0, import_promises177.writeFile)(filepath, updatedSnapshot.toString());
|
|
923198
923263
|
}
|
|
923199
923264
|
|
|
923200
923265
|
// ../cli-migrations/lib/migrations/0.9.10/index.js
|
|
@@ -923214,11 +923279,11 @@ var LegacyDocsSerializers = __toESM(require_serialization4(), 1);
|
|
|
923214
923279
|
|
|
923215
923280
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/loadRawDocsConfiguration.js
|
|
923216
923281
|
init_lib8();
|
|
923217
|
-
var
|
|
923282
|
+
var import_promises178 = require("fs/promises");
|
|
923218
923283
|
init_js_yaml();
|
|
923219
923284
|
async function loadRawDocsConfiguration2({ absolutePathToWorkspace }) {
|
|
923220
923285
|
const filepath = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
923221
|
-
const contentsStr = await (0,
|
|
923286
|
+
const contentsStr = await (0, import_promises178.readFile)(filepath);
|
|
923222
923287
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
923223
923288
|
const result = await LegacyDocsSerializers.DocsConfiguration.parse(contentsParsed);
|
|
923224
923289
|
if (result.ok) {
|
|
@@ -923237,7 +923302,7 @@ function getAbsolutePathToDocsFolder({ absolutePathToWorkspace }) {
|
|
|
923237
923302
|
|
|
923238
923303
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndMultipleAPIs.js
|
|
923239
923304
|
init_lib8();
|
|
923240
|
-
var
|
|
923305
|
+
var import_promises180 = require("fs/promises");
|
|
923241
923306
|
init_js_yaml();
|
|
923242
923307
|
|
|
923243
923308
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/docs-config/convertLegacyDocsConfig.js
|
|
@@ -923446,11 +923511,11 @@ __export(legacy_exports, {
|
|
|
923446
923511
|
|
|
923447
923512
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/generators-configuration/loadRawGeneratorsConfiguration.js
|
|
923448
923513
|
init_lib8();
|
|
923449
|
-
var
|
|
923514
|
+
var import_promises179 = require("fs/promises");
|
|
923450
923515
|
init_js_yaml();
|
|
923451
923516
|
async function loadRawGeneratorsConfiguration2({ absolutePathToWorkspace }) {
|
|
923452
923517
|
const filepath = getAbsolutePathToGeneratorsConfiguration({ absolutePathToWorkspace });
|
|
923453
|
-
const contentsStr = await (0,
|
|
923518
|
+
const contentsStr = await (0, import_promises179.readFile)(filepath);
|
|
923454
923519
|
const contentsParsed = index_vite_proxy_tmp_default.load(contentsStr.toString());
|
|
923455
923520
|
const result = await legacy_exports.GeneratorsConfigurationSchema.safeParseAsync(contentsParsed);
|
|
923456
923521
|
if (result.success) {
|
|
@@ -923480,7 +923545,7 @@ function migrateDocsInstances(docsURLs) {
|
|
|
923480
923545
|
var APIS_DIRECTORY2 = "apis";
|
|
923481
923546
|
async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspaces, workspaceContainingDocs }) {
|
|
923482
923547
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY2));
|
|
923483
|
-
await (0,
|
|
923548
|
+
await (0, import_promises180.mkdir)(absolutePathToApisDirectory);
|
|
923484
923549
|
for (const workspace of workspaces) {
|
|
923485
923550
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
923486
923551
|
const docsURLs = await migrateAndWriteGeneratorsYml({ absolutePathToWorkspace });
|
|
@@ -923488,11 +923553,11 @@ async function migrateDocsAndMultipleAPIs({ absolutePathToFernDirectory, workspa
|
|
|
923488
923553
|
await migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName: workspaceContainingDocs });
|
|
923489
923554
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
923490
923555
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
923491
|
-
await (0,
|
|
923556
|
+
await (0, import_promises180.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
923492
923557
|
}
|
|
923493
923558
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
923494
923559
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
923495
|
-
await (0,
|
|
923560
|
+
await (0, import_promises180.rm)(absolutePathToWorkspace, { recursive: true });
|
|
923496
923561
|
}
|
|
923497
923562
|
}
|
|
923498
923563
|
async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
@@ -923505,7 +923570,7 @@ async function migrateAndWriteGeneratorsYml({ absolutePathToWorkspace }) {
|
|
|
923505
923570
|
generatorsConfiguration,
|
|
923506
923571
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
923507
923572
|
});
|
|
923508
|
-
await (0,
|
|
923573
|
+
await (0, import_promises180.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
923509
923574
|
return convertedResponse.docsURLs;
|
|
923510
923575
|
}
|
|
923511
923576
|
async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiName }) {
|
|
@@ -923519,12 +923584,12 @@ async function migrateAndWriteDocsYml({ absolutePathToWorkspace, docsURLs, apiNa
|
|
|
923519
923584
|
apiName
|
|
923520
923585
|
});
|
|
923521
923586
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
923522
|
-
await (0,
|
|
923587
|
+
await (0, import_promises180.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
923523
923588
|
}
|
|
923524
923589
|
|
|
923525
923590
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateDocsAndSingleAPI.js
|
|
923526
923591
|
init_lib8();
|
|
923527
|
-
var
|
|
923592
|
+
var import_promises181 = require("fs/promises");
|
|
923528
923593
|
init_js_yaml();
|
|
923529
923594
|
async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
923530
923595
|
const docsURLs = await migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace });
|
|
@@ -923532,8 +923597,8 @@ async function migrateDocsAndSingleAPI({ absolutePathToFernDirectory, absolutePa
|
|
|
923532
923597
|
const absolutePathToDocsFolder = getAbsolutePathToDocsFolder({ absolutePathToWorkspace });
|
|
923533
923598
|
await moveFolder({ src: absolutePathToDocsFolder, dest: absolutePathToFernDirectory });
|
|
923534
923599
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
923535
|
-
await (0,
|
|
923536
|
-
await (0,
|
|
923600
|
+
await (0, import_promises181.rm)(absolutePathToDocsFolder, { recursive: true });
|
|
923601
|
+
await (0, import_promises181.rm)(absolutePathToWorkspace, { recursive: true });
|
|
923537
923602
|
}
|
|
923538
923603
|
async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
923539
923604
|
const docsConfiguration = await loadRawDocsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -923546,7 +923611,7 @@ async function migrateAndWriteDocsYml2({ absolutePathToWorkspace, docsURLs }) {
|
|
|
923546
923611
|
apiName: void 0
|
|
923547
923612
|
});
|
|
923548
923613
|
const absolutePathToDocsConfig = getAbsolutePathToDocsYaml({ absolutePathToWorkspace });
|
|
923549
|
-
await (0,
|
|
923614
|
+
await (0, import_promises181.writeFile)(absolutePathToDocsConfig, index_vite_proxy_tmp_default.dump(convertedDocsConfig));
|
|
923550
923615
|
}
|
|
923551
923616
|
async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
923552
923617
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -923558,24 +923623,24 @@ async function migrateAndWriteGeneratorsYml2({ absolutePathToWorkspace }) {
|
|
|
923558
923623
|
generatorsConfiguration,
|
|
923559
923624
|
pathModificationStrategy: "MoveUp"
|
|
923560
923625
|
});
|
|
923561
|
-
await (0,
|
|
923626
|
+
await (0, import_promises181.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
923562
923627
|
return convertedResponse.docsURLs;
|
|
923563
923628
|
}
|
|
923564
923629
|
|
|
923565
923630
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlyMultipleAPIs.js
|
|
923566
923631
|
init_lib8();
|
|
923567
|
-
var
|
|
923632
|
+
var import_promises182 = require("fs/promises");
|
|
923568
923633
|
init_js_yaml();
|
|
923569
923634
|
var APIS_DIRECTORY3 = "apis";
|
|
923570
923635
|
async function migrateOnlyMultipleAPIs({ absolutePathToFernDirectory, workspaces }) {
|
|
923571
923636
|
const absolutePathToApisDirectory = join8(absolutePathToFernDirectory, RelativeFilePath2.of(APIS_DIRECTORY3));
|
|
923572
|
-
await (0,
|
|
923637
|
+
await (0, import_promises182.mkdir)(absolutePathToApisDirectory);
|
|
923573
923638
|
for (const workspace of workspaces) {
|
|
923574
923639
|
const absolutePathToWorkspace = join8(absolutePathToFernDirectory, RelativeFilePath2.of(workspace));
|
|
923575
923640
|
await migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace });
|
|
923576
923641
|
const absolutePathToNestedWorkspace = join8(absolutePathToApisDirectory, RelativeFilePath2.of(workspace));
|
|
923577
923642
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToNestedWorkspace });
|
|
923578
|
-
await (0,
|
|
923643
|
+
await (0, import_promises182.rm)(absolutePathToWorkspace, { recursive: true });
|
|
923579
923644
|
}
|
|
923580
923645
|
}
|
|
923581
923646
|
async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
@@ -923588,17 +923653,17 @@ async function migrateAndWriteGeneratorsYml3({ absolutePathToWorkspace }) {
|
|
|
923588
923653
|
generatorsConfiguration,
|
|
923589
923654
|
pathModificationStrategy: PathModificationStrategy.Nest
|
|
923590
923655
|
});
|
|
923591
|
-
await (0,
|
|
923656
|
+
await (0, import_promises182.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
923592
923657
|
}
|
|
923593
923658
|
|
|
923594
923659
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migrateOnlySingleAPI.js
|
|
923595
923660
|
init_lib8();
|
|
923596
|
-
var
|
|
923661
|
+
var import_promises183 = require("fs/promises");
|
|
923597
923662
|
init_js_yaml();
|
|
923598
923663
|
async function migrateOnlySingleAPI({ absolutePathToFernDirectory, absolutePathToWorkspace }) {
|
|
923599
923664
|
await migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace });
|
|
923600
923665
|
await moveFolder({ src: absolutePathToWorkspace, dest: absolutePathToFernDirectory });
|
|
923601
|
-
await (0,
|
|
923666
|
+
await (0, import_promises183.rm)(absolutePathToWorkspace, { recursive: true });
|
|
923602
923667
|
}
|
|
923603
923668
|
async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
923604
923669
|
const generatorsConfiguration = await loadRawGeneratorsConfiguration2({ absolutePathToWorkspace });
|
|
@@ -923610,7 +923675,7 @@ async function migrateAndWriteGeneratorsYml4({ absolutePathToWorkspace }) {
|
|
|
923610
923675
|
generatorsConfiguration,
|
|
923611
923676
|
pathModificationStrategy: "MoveUp"
|
|
923612
923677
|
});
|
|
923613
|
-
await (0,
|
|
923678
|
+
await (0, import_promises183.writeFile)(absolutePathToGeneratorsConfiguration, index_vite_proxy_tmp_default.dump(convertedResponse.value));
|
|
923614
923679
|
}
|
|
923615
923680
|
|
|
923616
923681
|
// ../cli-migrations/lib/migrations/0.15.0-rc0/update-directory-structure/migration.js
|
|
@@ -923688,7 +923753,7 @@ var __default15 = versionMigrations15;
|
|
|
923688
923753
|
|
|
923689
923754
|
// ../cli-migrations/lib/migrations/0.41.0-rc0/require-generators-yml/migration.js
|
|
923690
923755
|
init_lib8();
|
|
923691
|
-
var
|
|
923756
|
+
var import_promises184 = require("fs/promises");
|
|
923692
923757
|
init_js_yaml();
|
|
923693
923758
|
var import_yaml16 = __toESM(require_dist11(), 1);
|
|
923694
923759
|
var migration16 = {
|
|
@@ -923732,7 +923797,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
923732
923797
|
if (existingGeneratorsYml == null) {
|
|
923733
923798
|
if (openapiDirectory != null && openapiDirectory.contents[0] != null) {
|
|
923734
923799
|
const absolutePathToGeneratorsYml = join8(absoluteFilepathToWorkspace, RelativeFilePath2.of("generators.yml"));
|
|
923735
|
-
await (0,
|
|
923800
|
+
await (0, import_promises184.writeFile)(absolutePathToGeneratorsYml, index_vite_proxy_tmp_default.dump({
|
|
923736
923801
|
api: {
|
|
923737
923802
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
923738
923803
|
}
|
|
@@ -923747,7 +923812,7 @@ async function addApiConfigurationToSingleWorkspace({ absolutePathToFernDirector
|
|
|
923747
923812
|
parsedDocument.set("api", {
|
|
923748
923813
|
path: join8(relativize(absolutePathToFernDirectory, absoluteFilepathToWorkspace), RelativeFilePath2.of(openapiDirectory.name), RelativeFilePath2.of(openapiDirectory.contents[0]?.name))
|
|
923749
923814
|
});
|
|
923750
|
-
await (0,
|
|
923815
|
+
await (0, import_promises184.writeFile)(existingGeneratorsYml.absolutePath, parsedDocument.toString());
|
|
923751
923816
|
context3.logger.info(source_default.green(`Updated ${existingGeneratorsYml.absolutePath}`));
|
|
923752
923817
|
}
|
|
923753
923818
|
}
|
|
@@ -923775,7 +923840,7 @@ var __default16 = versionMigrations16;
|
|
|
923775
923840
|
|
|
923776
923841
|
// ../cli-migrations/lib/migrations/0.54.0-rc0/use-generators-yml-specs/migration.js
|
|
923777
923842
|
init_lib8();
|
|
923778
|
-
var
|
|
923843
|
+
var import_promises185 = require("fs/promises");
|
|
923779
923844
|
init_js_yaml();
|
|
923780
923845
|
var import_yaml17 = __toESM(require_dist11(), 1);
|
|
923781
923846
|
var migration17 = {
|
|
@@ -923956,7 +924021,7 @@ async function addApiConfigurationToSingleWorkspace2({ absoluteFilepathToWorkspa
|
|
|
923956
924021
|
if (schemaComment && documentToWrite.indexOf(schemaComment) === -1) {
|
|
923957
924022
|
documentToWrite = `${schemaComment}${documentToWrite}`;
|
|
923958
924023
|
}
|
|
923959
|
-
await (0,
|
|
924024
|
+
await (0, import_promises185.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
923960
924025
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
923961
924026
|
}
|
|
923962
924027
|
async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, directories, context: context3, namespace }) {
|
|
@@ -924003,7 +924068,7 @@ async function parseApiSpec({ oldSpec, absoluteFilepathToWorkspace, files, direc
|
|
|
924003
924068
|
}
|
|
924004
924069
|
let specContent;
|
|
924005
924070
|
try {
|
|
924006
|
-
const fileContents = await (0,
|
|
924071
|
+
const fileContents = await (0, import_promises185.readFile)(absoluteSpecPath, { encoding: "utf-8" });
|
|
924007
924072
|
specContent = index_vite_proxy_tmp_default.load(fileContents);
|
|
924008
924073
|
} catch (e2) {
|
|
924009
924074
|
context3.logger.warn(`Failed to read API spec file ${spec.path}. Error: ${e2}. Skipping...`);
|
|
@@ -924107,7 +924172,7 @@ var __default17 = versionMigrations17;
|
|
|
924107
924172
|
|
|
924108
924173
|
// ../cli-migrations/lib/migrations/0.82.1/add-path-parameter-order-setting/migration.js
|
|
924109
924174
|
init_lib8();
|
|
924110
|
-
var
|
|
924175
|
+
var import_promises186 = require("fs/promises");
|
|
924111
924176
|
init_js_yaml();
|
|
924112
924177
|
var migration18 = {
|
|
924113
924178
|
name: "add-path-parameter-order-setting",
|
|
@@ -924196,7 +924261,7 @@ async function updateGeneratorsYml({ context: context3, files }) {
|
|
|
924196
924261
|
documentToWrite = `${schemaComment}
|
|
924197
924262
|
${documentToWrite}`;
|
|
924198
924263
|
}
|
|
924199
|
-
await (0,
|
|
924264
|
+
await (0, import_promises186.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924200
924265
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924201
924266
|
}
|
|
924202
924267
|
async function getFilesAndDirectories3(absoluteFilepath) {
|
|
@@ -924233,7 +924298,7 @@ var __default18 = versionMigrations18;
|
|
|
924233
924298
|
|
|
924234
924299
|
// ../cli-migrations/lib/migrations/1.0.0/update-settings-defaults/migration.js
|
|
924235
924300
|
init_lib8();
|
|
924236
|
-
var
|
|
924301
|
+
var import_promises187 = require("fs/promises");
|
|
924237
924302
|
init_js_yaml();
|
|
924238
924303
|
var migration19 = {
|
|
924239
924304
|
name: "update-1_0_0-defaults",
|
|
@@ -924409,7 +924474,7 @@ async function updateGeneratorsYml2({ context: context3, files }) {
|
|
|
924409
924474
|
documentToWrite = `${schemaComment}
|
|
924410
924475
|
${documentToWrite}`;
|
|
924411
924476
|
}
|
|
924412
|
-
await (0,
|
|
924477
|
+
await (0, import_promises187.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924413
924478
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924414
924479
|
}
|
|
924415
924480
|
async function getFilesAndDirectories4(absoluteFilepath) {
|
|
@@ -924479,7 +924544,7 @@ var __default19 = versionMigrations19;
|
|
|
924479
924544
|
|
|
924480
924545
|
// ../cli-migrations/lib/migrations/2.0.0-rc0/update-settings-defaults/migration.js
|
|
924481
924546
|
init_lib8();
|
|
924482
|
-
var
|
|
924547
|
+
var import_promises188 = require("fs/promises");
|
|
924483
924548
|
init_js_yaml();
|
|
924484
924549
|
var migration20 = {
|
|
924485
924550
|
name: "update-2_0_0-defaults",
|
|
@@ -924655,7 +924720,7 @@ async function updateGeneratorsYml3({ context: context3, files }) {
|
|
|
924655
924720
|
documentToWrite = `${schemaComment}
|
|
924656
924721
|
${documentToWrite}`;
|
|
924657
924722
|
}
|
|
924658
|
-
await (0,
|
|
924723
|
+
await (0, import_promises188.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924659
924724
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924660
924725
|
}
|
|
924661
924726
|
async function getFilesAndDirectories5(absoluteFilepath) {
|
|
@@ -924702,7 +924767,7 @@ var __default20 = versionMigrations20;
|
|
|
924702
924767
|
|
|
924703
924768
|
// ../cli-migrations/lib/migrations/2.13.0/migrate-deprecated-generator-api-settings/migration.js
|
|
924704
924769
|
init_lib8();
|
|
924705
|
-
var
|
|
924770
|
+
var import_promises189 = require("fs/promises");
|
|
924706
924771
|
init_js_yaml();
|
|
924707
924772
|
var migration21 = {
|
|
924708
924773
|
name: "migrate-deprecated-generator-api-settings",
|
|
@@ -924794,7 +924859,7 @@ async function updateGeneratorsYml4({ context: context3, files }) {
|
|
|
924794
924859
|
documentToWrite = `${schemaComment}
|
|
924795
924860
|
${documentToWrite}`;
|
|
924796
924861
|
}
|
|
924797
|
-
await (0,
|
|
924862
|
+
await (0, import_promises189.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924798
924863
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924799
924864
|
}
|
|
924800
924865
|
function migrateDeprecatedSettings(settings, context3) {
|
|
@@ -924841,7 +924906,7 @@ var __default21 = versionMigrations21;
|
|
|
924841
924906
|
|
|
924842
924907
|
// ../cli-migrations/lib/migrations/3.0.0/enable-smart-casing/migration.js
|
|
924843
924908
|
init_lib8();
|
|
924844
|
-
var
|
|
924909
|
+
var import_promises190 = require("fs/promises");
|
|
924845
924910
|
init_js_yaml();
|
|
924846
924911
|
var migration22 = {
|
|
924847
924912
|
name: "enable-smart-casing",
|
|
@@ -924926,7 +924991,7 @@ async function updateGeneratorsYml5({ context: context3, files }) {
|
|
|
924926
924991
|
documentToWrite = `${schemaComment}
|
|
924927
924992
|
${documentToWrite}`;
|
|
924928
924993
|
}
|
|
924929
|
-
await (0,
|
|
924994
|
+
await (0, import_promises190.writeFile)(generatorsYmlFile.absolutePath, documentToWrite);
|
|
924930
924995
|
context3.logger.info(source_default.green(`Updated ${generatorsYmlFile.absolutePath}`));
|
|
924931
924996
|
}
|
|
924932
924997
|
function setSmartCasingFalseIfNotConfigured(generator, context3) {
|
|
@@ -925069,7 +925134,7 @@ ${source_default.dim(migration23.summary)}`
|
|
|
925069
925134
|
// src/commands/upgrade/upgrade.ts
|
|
925070
925135
|
init_lib12();
|
|
925071
925136
|
init_lib6();
|
|
925072
|
-
var
|
|
925137
|
+
var import_promises191 = require("fs/promises");
|
|
925073
925138
|
|
|
925074
925139
|
// ../../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
|
|
925075
925140
|
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
@@ -926124,7 +926189,7 @@ async function upgrade({
|
|
|
926124
926189
|
const newProjectConfig = produce(projectConfig2.rawConfig, (draft) => {
|
|
926125
926190
|
draft.version = resolvedTargetVersion;
|
|
926126
926191
|
});
|
|
926127
|
-
await (0,
|
|
926192
|
+
await (0, import_promises191.writeFile)(
|
|
926128
926193
|
projectConfig2._absolutePath,
|
|
926129
926194
|
ensureFinalNewline(JSON.stringify(newProjectConfig, void 0, 2))
|
|
926130
926195
|
);
|
|
@@ -926281,7 +926346,7 @@ async function upgradeGeneratorsForAllWorkspaces({
|
|
|
926281
926346
|
absolutePathToWorkspace: workspace.absoluteFilePath
|
|
926282
926347
|
});
|
|
926283
926348
|
if (absolutePathToGeneratorsConfiguration != null && result.updatedConfiguration != null) {
|
|
926284
|
-
await (0,
|
|
926349
|
+
await (0, import_promises192.writeFile)(absolutePathToGeneratorsConfiguration, result.updatedConfiguration);
|
|
926285
926350
|
}
|
|
926286
926351
|
for (const upgrade2 of result.appliedUpgrades) {
|
|
926287
926352
|
const normalizedName = addDefaultDockerOrgIfNotPresent(upgrade2.generatorName);
|
|
@@ -926756,7 +926821,7 @@ async function previewDocsWorkspace({
|
|
|
926756
926821
|
// src/commands/docs-diff/docsDiff.ts
|
|
926757
926822
|
init_lib8();
|
|
926758
926823
|
init_lib6();
|
|
926759
|
-
var
|
|
926824
|
+
var import_promises193 = require("fs/promises");
|
|
926760
926825
|
var import_pngjs2 = __toESM(require_png(), 1);
|
|
926761
926826
|
async function getSlugForFiles2({
|
|
926762
926827
|
previewUrl,
|
|
@@ -926979,8 +927044,8 @@ async function generateComparisons2({
|
|
|
926979
927044
|
afterPath,
|
|
926980
927045
|
comparisonBasePath
|
|
926981
927046
|
}) {
|
|
926982
|
-
const beforePng = import_pngjs2.PNG.sync.read(await (0,
|
|
926983
|
-
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));
|
|
926984
927049
|
const beforeOriginalHeight = beforePng.height;
|
|
926985
927050
|
const afterOriginalHeight = afterPng.height;
|
|
926986
927051
|
const width = Math.max(beforePng.width, afterPng.width);
|
|
@@ -927018,7 +927083,7 @@ async function generateComparisons2({
|
|
|
927018
927083
|
const sideBySide = createSideBySideComparison2(croppedBefore, croppedAfter, 20, true);
|
|
927019
927084
|
const outPath = `${base4}-region-${i5 + 1}.png`;
|
|
927020
927085
|
const pngBuffer = import_pngjs2.PNG.sync.write(sideBySide);
|
|
927021
|
-
await (0,
|
|
927086
|
+
await (0, import_promises193.writeFile)(outPath, new Uint8Array(pngBuffer));
|
|
927022
927087
|
results.push({ changePercent, boundingBox, comparisonPath: outPath });
|
|
927023
927088
|
}
|
|
927024
927089
|
return results;
|
|
@@ -927097,7 +927162,7 @@ async function docsDiff({
|
|
|
927097
927162
|
outputDir.startsWith("/") ? outputDir : join8(cwd(), RelativeFilePath2.of(outputDir))
|
|
927098
927163
|
);
|
|
927099
927164
|
if (!await doesPathExist(outputPath)) {
|
|
927100
|
-
await (0,
|
|
927165
|
+
await (0, import_promises193.mkdir)(outputPath, { recursive: true });
|
|
927101
927166
|
}
|
|
927102
927167
|
const results = [];
|
|
927103
927168
|
await cliContext.runTask(async (context3) => {
|
|
@@ -927518,7 +927583,7 @@ init_lib6();
|
|
|
927518
927583
|
|
|
927519
927584
|
// src/commands/docs-theme/ThemeExporter.ts
|
|
927520
927585
|
init_lib8();
|
|
927521
|
-
var
|
|
927586
|
+
var import_promises194 = require("fs/promises");
|
|
927522
927587
|
init_js_yaml();
|
|
927523
927588
|
var import_path106 = __toESM(require("path"), 1);
|
|
927524
927589
|
var ThemeExporter = class {
|
|
@@ -927531,18 +927596,18 @@ var ThemeExporter = class {
|
|
|
927531
927596
|
const docsDir = import_path106.default.dirname(docsYmlPath);
|
|
927532
927597
|
const outDir = output2 != null ? import_path106.default.resolve(process.cwd(), output2) : import_path106.default.join(this.docsWorkspace.absoluteFilePath, "theme");
|
|
927533
927598
|
context3.logger.info(`Exporting theme-eligible fields from docs.yml \u2192 ${outDir}`);
|
|
927534
|
-
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"));
|
|
927535
927600
|
const themeConfig = {};
|
|
927536
927601
|
for (const [k4, v3] of Object.entries(raw)) {
|
|
927537
927602
|
if (docs_yml_exports.THEME_ELIGIBLE_YAML_KEYS.has(k4)) {
|
|
927538
927603
|
themeConfig[k4] = v3;
|
|
927539
927604
|
}
|
|
927540
927605
|
}
|
|
927541
|
-
await (0,
|
|
927606
|
+
await (0, import_promises194.mkdir)(outDir, { recursive: true });
|
|
927542
927607
|
const assetsDir = import_path106.default.join(outDir, "assets");
|
|
927543
|
-
await (0,
|
|
927608
|
+
await (0, import_promises194.mkdir)(assetsDir, { recursive: true });
|
|
927544
927609
|
const exported = await copyLocalFiles(themeConfig, docsDir, assetsDir);
|
|
927545
|
-
await (0,
|
|
927610
|
+
await (0, import_promises194.writeFile)(import_path106.default.join(outDir, "theme.yml"), index_vite_proxy_tmp_default.dump(exported), "utf-8");
|
|
927546
927611
|
context3.logger.info(`Theme exported to ${outDir}/theme.yml`);
|
|
927547
927612
|
}
|
|
927548
927613
|
};
|
|
@@ -927556,8 +927621,8 @@ async function copyLocalFiles(obj, sourceDir, assetsDir) {
|
|
|
927556
927621
|
const destRelative = relFromSource.startsWith("..") ? relFromProject.startsWith("..") ? import_path106.default.basename(abs) : relFromProject : relFromSource;
|
|
927557
927622
|
const dest = import_path106.default.join(assetsDir, destRelative);
|
|
927558
927623
|
try {
|
|
927559
|
-
await (0,
|
|
927560
|
-
await (0,
|
|
927624
|
+
await (0, import_promises194.mkdir)(import_path106.default.dirname(dest), { recursive: true });
|
|
927625
|
+
await (0, import_promises194.copyFile)(abs, dest);
|
|
927561
927626
|
return `./assets/${destRelative.split(import_path106.default.sep).join("/")}`;
|
|
927562
927627
|
} catch {
|
|
927563
927628
|
return obj;
|
|
@@ -927649,7 +927714,7 @@ async function listDocsThemes({
|
|
|
927649
927714
|
|
|
927650
927715
|
// src/commands/docs-theme/uploadDocsTheme.ts
|
|
927651
927716
|
init_lib6();
|
|
927652
|
-
var
|
|
927717
|
+
var import_promises196 = require("fs/promises");
|
|
927653
927718
|
init_js_yaml();
|
|
927654
927719
|
var import_path108 = __toESM(require("path"), 1);
|
|
927655
927720
|
|
|
@@ -927658,7 +927723,7 @@ init_lib8();
|
|
|
927658
927723
|
init_lib6();
|
|
927659
927724
|
var import_child_process12 = require("child_process");
|
|
927660
927725
|
var import_crypto9 = require("crypto");
|
|
927661
|
-
var
|
|
927726
|
+
var import_promises195 = require("fs/promises");
|
|
927662
927727
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
|
927663
927728
|
var import_path107 = __toESM(require("path"), 1);
|
|
927664
927729
|
function getGitRoot() {
|
|
@@ -927702,7 +927767,7 @@ var ThemeConfigProcessor = class {
|
|
|
927702
927767
|
filePaths.map(async (filePath) => {
|
|
927703
927768
|
const abs = import_path107.default.resolve(this.themeDir, filePath);
|
|
927704
927769
|
try {
|
|
927705
|
-
await (0,
|
|
927770
|
+
await (0, import_promises195.access)(abs);
|
|
927706
927771
|
} catch {
|
|
927707
927772
|
errors4.push(`Referenced file not found: ${abs}`);
|
|
927708
927773
|
}
|
|
@@ -927867,7 +927932,7 @@ ${errors4.map((e2) => ` - ${e2}`).join("\n")}`,
|
|
|
927867
927932
|
return { config: cfg, filesUploaded };
|
|
927868
927933
|
}
|
|
927869
927934
|
async uploadFileToCas(absolutePath) {
|
|
927870
|
-
const content5 = await (0,
|
|
927935
|
+
const content5 = await (0, import_promises195.readFile)(absolutePath);
|
|
927871
927936
|
const contentType = import_mime_types2.default.lookup(absolutePath) || "application/octet-stream";
|
|
927872
927937
|
const bindPath = posixBindPath(this.gitRoot, absolutePath);
|
|
927873
927938
|
return this.uploadToCas(content5, contentType, bindPath, import_path107.default.basename(absolutePath));
|
|
@@ -927982,7 +928047,7 @@ async function uploadDocsTheme({
|
|
|
927982
928047
|
await cliContext.runTask(async (context3) => {
|
|
927983
928048
|
let rawYaml;
|
|
927984
928049
|
try {
|
|
927985
|
-
const content5 = await (0,
|
|
928050
|
+
const content5 = await (0, import_promises196.readFile)(themeYmlPath, "utf-8");
|
|
927986
928051
|
rawYaml = index_vite_proxy_tmp_default.load(content5, { schema: index_vite_proxy_tmp_default.JSON_SCHEMA });
|
|
927987
928052
|
} catch {
|
|
927988
928053
|
context3.failAndThrow(
|
|
@@ -928036,7 +928101,7 @@ async function uploadDocsTheme({
|
|
|
928036
928101
|
|
|
928037
928102
|
// src/commands/downgrade/downgrade.ts
|
|
928038
928103
|
init_lib6();
|
|
928039
|
-
var
|
|
928104
|
+
var import_promises197 = require("fs/promises");
|
|
928040
928105
|
function ensureFinalNewline2(content5) {
|
|
928041
928106
|
return content5.endsWith("\n") ? content5 : content5 + "\n";
|
|
928042
928107
|
}
|
|
@@ -928061,13 +928126,13 @@ async function downgrade({
|
|
|
928061
928126
|
const newProjectConfig = produce(projectConfig.rawConfig, (draft) => {
|
|
928062
928127
|
draft.version = targetVersion;
|
|
928063
928128
|
});
|
|
928064
|
-
await (0,
|
|
928129
|
+
await (0, import_promises197.writeFile)(projectConfig._absolutePath, ensureFinalNewline2(JSON.stringify(newProjectConfig, void 0, 2)));
|
|
928065
928130
|
cliContext.logger.info(`Updated ${PROJECT_CONFIG_FILENAME} to version ${targetVersion}`);
|
|
928066
928131
|
}
|
|
928067
928132
|
|
|
928068
928133
|
// src/commands/export/generateOpenAPIForWorkspaces.ts
|
|
928069
928134
|
init_lib8();
|
|
928070
|
-
var
|
|
928135
|
+
var import_promises198 = require("fs/promises");
|
|
928071
928136
|
init_js_yaml();
|
|
928072
928137
|
|
|
928073
928138
|
// src/commands/export/converters/servicesConverter.ts
|
|
@@ -929477,8 +929542,8 @@ async function generateOpenAPIForWorkspaces({
|
|
|
929477
929542
|
ir: ir3,
|
|
929478
929543
|
mode: "openapi"
|
|
929479
929544
|
});
|
|
929480
|
-
await (0,
|
|
929481
|
-
await (0,
|
|
929545
|
+
await (0, import_promises198.mkdir)(dirname6(outputPath), { recursive: true });
|
|
929546
|
+
await (0, import_promises198.writeFile)(
|
|
929482
929547
|
outputPath,
|
|
929483
929548
|
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent4) : index_vite_proxy_tmp_default.dump(openapi, { indent: indent4 })
|
|
929484
929549
|
);
|
|
@@ -930071,7 +930136,7 @@ async function generateOpenAPIIrForWorkspaces({
|
|
|
930071
930136
|
// src/commands/generate-overrides/compareOpenAPISpecs.ts
|
|
930072
930137
|
init_lib8();
|
|
930073
930138
|
init_lib6();
|
|
930074
|
-
var
|
|
930139
|
+
var import_promises199 = require("fs/promises");
|
|
930075
930140
|
init_js_yaml();
|
|
930076
930141
|
async function compareOpenAPISpecs({
|
|
930077
930142
|
originalPath,
|
|
@@ -930113,12 +930178,12 @@ async function compareOpenAPISpecs({
|
|
|
930113
930178
|
}
|
|
930114
930179
|
outputPath = join8(dirname6(originalPath), RelativeFilePath2.of(overridesFilename));
|
|
930115
930180
|
}
|
|
930116
|
-
await (0,
|
|
930181
|
+
await (0, import_promises199.writeFile)(outputPath, index_vite_proxy_tmp_default.dump(overrides, { lineWidth: -1, noRefs: true }));
|
|
930117
930182
|
context3.logger.info(`Overrides written to ${outputPath}`);
|
|
930118
930183
|
});
|
|
930119
930184
|
}
|
|
930120
930185
|
async function loadSpec2(filepath, context3) {
|
|
930121
|
-
const contents = await (0,
|
|
930186
|
+
const contents = await (0, import_promises199.readFile)(filepath, "utf8");
|
|
930122
930187
|
try {
|
|
930123
930188
|
return JSON.parse(contents);
|
|
930124
930189
|
} catch {
|
|
@@ -930223,7 +930288,7 @@ function deepEqual(a3, b5) {
|
|
|
930223
930288
|
// src/commands/generate-overrides/writeOverridesForWorkspaces.ts
|
|
930224
930289
|
init_lib8();
|
|
930225
930290
|
init_lib6();
|
|
930226
|
-
var
|
|
930291
|
+
var import_promises200 = require("fs/promises");
|
|
930227
930292
|
init_js_yaml();
|
|
930228
930293
|
async function writeOverridesForWorkspaces({
|
|
930229
930294
|
project,
|
|
@@ -930249,7 +930314,7 @@ async function writeOverridesForWorkspaces({
|
|
|
930249
930314
|
async function readExistingOverrides(overridesFilepath, context3) {
|
|
930250
930315
|
let parsedOverrides = null;
|
|
930251
930316
|
try {
|
|
930252
|
-
const contents = (await (0,
|
|
930317
|
+
const contents = (await (0, import_promises200.readFile)(overridesFilepath, "utf8")).toString();
|
|
930253
930318
|
try {
|
|
930254
930319
|
parsedOverrides = JSON.parse(contents);
|
|
930255
930320
|
} catch (err) {
|
|
@@ -930314,7 +930379,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
930314
930379
|
for (const overridesPath of overridesPaths) {
|
|
930315
930380
|
const existingOverrides = await readExistingOverrides(overridesPath, context3);
|
|
930316
930381
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides, includeModels, context: context3 });
|
|
930317
|
-
await (0,
|
|
930382
|
+
await (0, import_promises200.writeFile)(overridesPath, index_vite_proxy_tmp_default.dump(content5));
|
|
930318
930383
|
}
|
|
930319
930384
|
} else {
|
|
930320
930385
|
const content5 = generateOverridesContent({ ir: ir3, existingOverrides: {}, includeModels, context: context3 });
|
|
@@ -930328,7 +930393,7 @@ async function writeDefinitionForOpenAPIWorkspace({
|
|
|
930328
930393
|
overridesFilename = `${nameWithoutExt}-overrides${extension4}`;
|
|
930329
930394
|
}
|
|
930330
930395
|
}
|
|
930331
|
-
await (0,
|
|
930396
|
+
await (0, import_promises200.writeFile)(
|
|
930332
930397
|
join8(dirname6(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
|
|
930333
930398
|
index_vite_proxy_tmp_default.dump(content5)
|
|
930334
930399
|
);
|
|
@@ -930773,7 +930838,7 @@ function convertIRtoJsonSchema(args) {
|
|
|
930773
930838
|
}
|
|
930774
930839
|
|
|
930775
930840
|
// src/commands/jsonschema/generateJsonschemaForWorkspace.ts
|
|
930776
|
-
var
|
|
930841
|
+
var import_promises201 = require("fs/promises");
|
|
930777
930842
|
async function generateJsonschemaForWorkspaces({
|
|
930778
930843
|
typeLocator,
|
|
930779
930844
|
project,
|
|
@@ -930821,9 +930886,9 @@ async function generateJsonschemaForWorkspaces({
|
|
|
930821
930886
|
context: context3
|
|
930822
930887
|
});
|
|
930823
930888
|
if (!await doesPathExist(dirname6(jsonschemaFilepath))) {
|
|
930824
|
-
await (0,
|
|
930889
|
+
await (0, import_promises201.mkdir)(dirname6(jsonschemaFilepath), { recursive: true });
|
|
930825
930890
|
}
|
|
930826
|
-
await (0,
|
|
930891
|
+
await (0, import_promises201.writeFile)(jsonschemaFilepath, JSON.stringify(jsonSchema, null, 2));
|
|
930827
930892
|
context3.logger.info(source_default.green(`Wrote JSON Schema to ${jsonschemaFilepath}`));
|
|
930828
930893
|
});
|
|
930829
930894
|
})
|
|
@@ -930833,7 +930898,7 @@ async function generateJsonschemaForWorkspaces({
|
|
|
930833
930898
|
// src/commands/merge/mergeOpenAPIWithOverrides.ts
|
|
930834
930899
|
init_lib8();
|
|
930835
930900
|
init_lib6();
|
|
930836
|
-
var
|
|
930901
|
+
var import_promises202 = require("fs/promises");
|
|
930837
930902
|
init_js_yaml();
|
|
930838
930903
|
var HTTP_METHODS4 = /* @__PURE__ */ new Set(["get", "put", "post", "delete", "options", "head", "patch", "trace"]);
|
|
930839
930904
|
async function mergeOpenAPIWithOverrides({
|
|
@@ -930862,11 +930927,11 @@ async function mergeOpenAPIWithOverrides({
|
|
|
930862
930927
|
if (split2) {
|
|
930863
930928
|
const examples = extractEnrichedExamples2(openapi, merged);
|
|
930864
930929
|
const output2 = isJson ? JSON.stringify(examples, null, 2) : index_vite_proxy_tmp_default.dump(examples, { lineWidth: -1, noRefs: true });
|
|
930865
|
-
await (0,
|
|
930930
|
+
await (0, import_promises202.writeFile)(outputPath, output2);
|
|
930866
930931
|
context3.logger.info(`Extracted enriched examples written to ${outputPath}`);
|
|
930867
930932
|
} else {
|
|
930868
930933
|
const output2 = isJson ? JSON.stringify(merged, null, 2) : index_vite_proxy_tmp_default.dump(merged, { lineWidth: -1, noRefs: true });
|
|
930869
|
-
await (0,
|
|
930934
|
+
await (0, import_promises202.writeFile)(outputPath, output2);
|
|
930870
930935
|
if (outputPath === openapiPath) {
|
|
930871
930936
|
context3.logger.info(`Enriched ${openapiPath} in-place`);
|
|
930872
930937
|
} else {
|
|
@@ -930876,7 +930941,7 @@ async function mergeOpenAPIWithOverrides({
|
|
|
930876
930941
|
});
|
|
930877
930942
|
}
|
|
930878
930943
|
async function loadYamlOrJson(filepath, context3) {
|
|
930879
|
-
const contents = await (0,
|
|
930944
|
+
const contents = await (0, import_promises202.readFile)(filepath, "utf8");
|
|
930880
930945
|
try {
|
|
930881
930946
|
return JSON.parse(contents);
|
|
930882
930947
|
} catch {
|
|
@@ -931661,7 +931726,7 @@ async function mockServer({
|
|
|
931661
931726
|
|
|
931662
931727
|
// src/commands/register/registerWorkspacesV1.ts
|
|
931663
931728
|
init_lib6();
|
|
931664
|
-
var
|
|
931729
|
+
var import_promises203 = require("fs/promises");
|
|
931665
931730
|
var import_path114 = __toESM(require("path"), 1);
|
|
931666
931731
|
var import_tmp_promise19 = __toESM(require_tmp_promise(), 1);
|
|
931667
931732
|
async function registerWorkspacesV1({
|
|
@@ -931714,7 +931779,7 @@ async function registerWorkspacesV1({
|
|
|
931714
931779
|
context3.logger.debug(`Compressing definition at ${tmpDir.path}`);
|
|
931715
931780
|
await Kn({ file: tarPath, cwd: resolvedWorkspace.absoluteFilePath }, ["."]);
|
|
931716
931781
|
context3.logger.info("Uploading definition...");
|
|
931717
|
-
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0,
|
|
931782
|
+
await axios_default.put(registerApiResponse.body.definitionS3UploadUrl, await (0, import_promises203.readFile)(tarPath));
|
|
931718
931783
|
context3.logger.info(
|
|
931719
931784
|
`Registered @${project.config.organization}/${resolvedWorkspace.definition.rootApiFile.contents.name}:${registerApiResponse.body.version}`
|
|
931720
931785
|
);
|
|
@@ -931767,7 +931832,7 @@ function getAIEnhancerConfig2() {
|
|
|
931767
931832
|
|
|
931768
931833
|
// src/commands/resolve-specs/resolveSpecsForWorkspaces.ts
|
|
931769
931834
|
init_lib8();
|
|
931770
|
-
var
|
|
931835
|
+
var import_promises204 = require("fs/promises");
|
|
931771
931836
|
var import_path115 = __toESM(require("path"), 1);
|
|
931772
931837
|
async function resolveSpecsForWorkspaces({
|
|
931773
931838
|
project,
|
|
@@ -931787,14 +931852,14 @@ async function resolveSpecsForWorkspaces({
|
|
|
931787
931852
|
return;
|
|
931788
931853
|
}
|
|
931789
931854
|
const workspaceOutputDir = project.apiWorkspaces.length > 1 ? AbsoluteFilePath2.of(import_path115.default.join(outputDir, workspace.workspaceName ?? "api")) : outputDir;
|
|
931790
|
-
await (0,
|
|
931855
|
+
await (0, import_promises204.mkdir)(workspaceOutputDir, { recursive: true });
|
|
931791
931856
|
const manifest = await collectRawSpecs({
|
|
931792
931857
|
specs,
|
|
931793
931858
|
hostOutputDir: workspaceOutputDir,
|
|
931794
931859
|
containerBaseDir: ".",
|
|
931795
931860
|
context: context3
|
|
931796
931861
|
});
|
|
931797
|
-
await (0,
|
|
931862
|
+
await (0, import_promises204.writeFile)(
|
|
931798
931863
|
import_path115.default.join(workspaceOutputDir, SPECS_MANIFEST_FILENAME),
|
|
931799
931864
|
JSON.stringify(manifest, void 0, 4)
|
|
931800
931865
|
);
|
|
@@ -932001,7 +932066,7 @@ async function generateDiff({
|
|
|
932001
932066
|
// src/commands/sdk-preview/sdkPreview.ts
|
|
932002
932067
|
init_lib8();
|
|
932003
932068
|
init_lib6();
|
|
932004
|
-
var
|
|
932069
|
+
var import_promises205 = __toESM(require("fs/promises"), 1);
|
|
932005
932070
|
|
|
932006
932071
|
// src/commands/sdk-preview/computePreviewVersion.ts
|
|
932007
932072
|
var BASE_VERSION = "0.0.1";
|
|
@@ -932121,7 +932186,7 @@ async function sdkPreview({
|
|
|
932121
932186
|
const firstPath = pathOutputs[0];
|
|
932122
932187
|
const absolutePathToOutput = firstPath != null ? AbsoluteFilePath2.of(resolve6(cwd(), firstPath)) : void 0;
|
|
932123
932188
|
if (absolutePathToOutput != null) {
|
|
932124
|
-
await
|
|
932189
|
+
await import_promises205.default.mkdir(absolutePathToOutput, { recursive: true });
|
|
932125
932190
|
}
|
|
932126
932191
|
for (const workspace of project.apiWorkspaces) {
|
|
932127
932192
|
if (workspace.generatorsConfiguration == null) {
|
|
@@ -932310,7 +932375,7 @@ async function sdkPreview({
|
|
|
932310
932375
|
// src/commands/self-update/selfUpdate.ts
|
|
932311
932376
|
init_lib12();
|
|
932312
932377
|
init_lib6();
|
|
932313
|
-
var
|
|
932378
|
+
var import_promises206 = require("fs/promises");
|
|
932314
932379
|
var import_path116 = require("path");
|
|
932315
932380
|
async function getPackageManagerBinDir(logger4, pm) {
|
|
932316
932381
|
let command3;
|
|
@@ -932356,7 +932421,7 @@ async function detectInstallationMethod(logger4) {
|
|
|
932356
932421
|
logger4.debug(`Found fern at: ${fernPath}`);
|
|
932357
932422
|
let resolvedPath;
|
|
932358
932423
|
try {
|
|
932359
|
-
resolvedPath = await (0,
|
|
932424
|
+
resolvedPath = await (0, import_promises206.realpath)(fernPath);
|
|
932360
932425
|
logger4.debug(`Resolved to: ${resolvedPath}`);
|
|
932361
932426
|
} catch (error50) {
|
|
932362
932427
|
logger4.debug(`Failed to resolve symlink: ${error50}`);
|
|
@@ -932665,22 +932730,22 @@ async function generateToken({
|
|
|
932665
932730
|
init_lib8();
|
|
932666
932731
|
init_lib6();
|
|
932667
932732
|
var fs33 = __toESM(require("fs"), 1);
|
|
932668
|
-
var
|
|
932733
|
+
var import_promises207 = require("fs/promises");
|
|
932669
932734
|
init_graphql();
|
|
932670
932735
|
init_js_yaml();
|
|
932671
932736
|
var import_stream18 = require("stream");
|
|
932672
|
-
var
|
|
932737
|
+
var import_promises208 = require("stream/promises");
|
|
932673
932738
|
async function fetchAndWriteFile(url3, path118, logger4, indent4) {
|
|
932674
932739
|
const resp = await fetch(url3);
|
|
932675
932740
|
if (resp.ok && resp.body) {
|
|
932676
932741
|
logger4.debug("Origin successfully fetched, writing to file");
|
|
932677
932742
|
const fileStream = fs33.createWriteStream(path118);
|
|
932678
|
-
await (0,
|
|
932679
|
-
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");
|
|
932680
932745
|
try {
|
|
932681
|
-
await (0,
|
|
932746
|
+
await (0, import_promises207.writeFile)(path118, JSON.stringify(JSON.parse(fileContents), void 0, indent4), "utf8");
|
|
932682
932747
|
} catch (e2) {
|
|
932683
|
-
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");
|
|
932684
932749
|
}
|
|
932685
932750
|
logger4.debug("File written successfully");
|
|
932686
932751
|
}
|
|
@@ -932836,14 +932901,14 @@ async function tryDirectJSONFetch(url3, logger4) {
|
|
|
932836
932901
|
async function fetchGraphQLSchemaWithAutoDetection(url3, path118, logger4) {
|
|
932837
932902
|
const postResult = await tryGraphQLIntrospection(url3, logger4);
|
|
932838
932903
|
if (postResult.success) {
|
|
932839
|
-
await (0,
|
|
932904
|
+
await (0, import_promises207.writeFile)(path118, postResult.result, "utf8");
|
|
932840
932905
|
logger4.info("Successfully fetched GraphQL schema using POST introspection");
|
|
932841
932906
|
return;
|
|
932842
932907
|
}
|
|
932843
932908
|
logger4.debug(`POST introspection failed: ${postResult.error}`);
|
|
932844
932909
|
const getResult = await tryDirectJSONFetch(url3, logger4);
|
|
932845
932910
|
if (getResult.success) {
|
|
932846
|
-
await (0,
|
|
932911
|
+
await (0, import_promises207.writeFile)(path118, getResult.result, "utf8");
|
|
932847
932912
|
logger4.info("Successfully fetched GraphQL schema using direct JSON fetch");
|
|
932848
932913
|
return;
|
|
932849
932914
|
}
|
|
@@ -933544,7 +933609,7 @@ async function validateWorkspaces({
|
|
|
933544
933609
|
|
|
933545
933610
|
// src/commands/write-definition/writeDefinitionForWorkspaces.ts
|
|
933546
933611
|
init_lib8();
|
|
933547
|
-
var
|
|
933612
|
+
var import_promises209 = require("fs/promises");
|
|
933548
933613
|
init_js_yaml();
|
|
933549
933614
|
var import_path118 = __toESM(require("path"), 1);
|
|
933550
933615
|
async function writeDefinitionForWorkspaces({
|
|
@@ -933626,28 +933691,28 @@ async function writeFernDefinition({
|
|
|
933626
933691
|
return a3.localeCompare(b5);
|
|
933627
933692
|
};
|
|
933628
933693
|
if (await doesPathExist(absolutePathToOutputDirectory)) {
|
|
933629
|
-
await (0,
|
|
933694
|
+
await (0, import_promises209.rm)(absolutePathToOutputDirectory, { recursive: true });
|
|
933630
933695
|
}
|
|
933631
|
-
await (0,
|
|
933632
|
-
await (0,
|
|
933696
|
+
await (0, import_promises209.mkdir)(absolutePathToOutputDirectory, { recursive: true });
|
|
933697
|
+
await (0, import_promises209.writeFile)(
|
|
933633
933698
|
join8(absolutePathToOutputDirectory, RelativeFilePath2.of(ROOT_API_FILENAME)),
|
|
933634
933699
|
index_vite_proxy_tmp_default.dump(definition3.rootApiFile.contents, { sortKeys })
|
|
933635
933700
|
);
|
|
933636
933701
|
for (const [relativePath, packageMarker] of Object.entries(definition3.packageMarkers)) {
|
|
933637
933702
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
933638
|
-
await (0,
|
|
933639
|
-
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 }));
|
|
933640
933705
|
}
|
|
933641
933706
|
for (const [relativePath, definitionFile] of Object.entries(definition3.namedDefinitionFiles)) {
|
|
933642
933707
|
const absoluteFilepath = join8(absolutePathToOutputDirectory, RelativeFilePath2.of(relativePath));
|
|
933643
|
-
await (0,
|
|
933644
|
-
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 }));
|
|
933645
933710
|
}
|
|
933646
933711
|
}
|
|
933647
933712
|
|
|
933648
933713
|
// src/commands/write-docs-definition/writeDocsDefinitionForProject.ts
|
|
933649
933714
|
init_lib8();
|
|
933650
|
-
var
|
|
933715
|
+
var import_promises210 = require("fs/promises");
|
|
933651
933716
|
async function writeDocsDefinitionForProject({
|
|
933652
933717
|
project,
|
|
933653
933718
|
outputPath,
|
|
@@ -933679,7 +933744,7 @@ async function writeDocsDefinitionForProject({
|
|
|
933679
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
|
|
933680
933745
|
});
|
|
933681
933746
|
const docsDefinition = await docsResolver.resolve();
|
|
933682
|
-
await (0,
|
|
933747
|
+
await (0, import_promises210.writeFile)(AbsoluteFilePath2.of(outputPath), JSON.stringify(docsDefinition, null, 2));
|
|
933683
933748
|
context3.logger.info(source_default.green(`Docs definition written to ${outputPath}`));
|
|
933684
933749
|
});
|
|
933685
933750
|
}
|