@fern-api/fern-api-dev 3.42.4 → 3.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +38 -19
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1415660,7 +1415660,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1415660
1415660
|
properties: {
|
|
1415661
1415661
|
...event,
|
|
1415662
1415662
|
...event.properties,
|
|
1415663
|
-
version: "3.
|
|
1415663
|
+
version: "3.43.0",
|
|
1415664
1415664
|
usingAccessToken: true
|
|
1415665
1415665
|
}
|
|
1415666
1415666
|
});
|
|
@@ -1415759,7 +1415759,7 @@ var UserPosthogManager = class {
|
|
|
1415759
1415759
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1415760
1415760
|
event: "CLI",
|
|
1415761
1415761
|
properties: {
|
|
1415762
|
-
version: "3.
|
|
1415762
|
+
version: "3.43.0",
|
|
1415763
1415763
|
...event,
|
|
1415764
1415764
|
...event.properties,
|
|
1415765
1415765
|
usingAccessToken: false,
|
|
@@ -1495953,7 +1495953,7 @@ var CliContext = class {
|
|
|
1495953
1495953
|
if (false) {
|
|
1495954
1495954
|
this.logger.error("CLI_VERSION is not defined");
|
|
1495955
1495955
|
}
|
|
1495956
|
-
return "3.
|
|
1495956
|
+
return "3.43.0";
|
|
1495957
1495957
|
}
|
|
1495958
1495958
|
getCliName() {
|
|
1495959
1495959
|
if (false) {
|
|
@@ -1591744,7 +1591744,7 @@ var import_path37 = __toESM(require("path"), 1);
|
|
|
1591744
1591744
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
1591745
1591745
|
var LOGS_FOLDER_NAME = "logs";
|
|
1591746
1591746
|
function getCliSource() {
|
|
1591747
|
-
const version6 = "3.
|
|
1591747
|
+
const version6 = "3.43.0";
|
|
1591748
1591748
|
return `cli@${version6}`;
|
|
1591749
1591749
|
}
|
|
1591750
1591750
|
var DebugLogger = class {
|
|
@@ -1610745,7 +1610745,8 @@ function getErrorTypeNameKey(declaredErrorName) {
|
|
|
1610745
1610745
|
async function generateOpenAPIForWorkspaces({
|
|
1610746
1610746
|
project,
|
|
1610747
1610747
|
cliContext,
|
|
1610748
|
-
outputPath
|
|
1610748
|
+
outputPath,
|
|
1610749
|
+
indent: indent3
|
|
1610749
1610750
|
}) {
|
|
1610750
1610751
|
await Promise.all(
|
|
1610751
1610752
|
project.apiWorkspaces.map(async (workspace) => {
|
|
@@ -1610772,7 +1610773,7 @@ async function generateOpenAPIForWorkspaces({
|
|
|
1610772
1610773
|
await (0, import_promises84.mkdir)(dirname2(outputPath), { recursive: true });
|
|
1610773
1610774
|
await (0, import_promises84.writeFile)(
|
|
1610774
1610775
|
outputPath,
|
|
1610775
|
-
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0,
|
|
1610776
|
+
outputPath.endsWith(".json") ? JSON.stringify(openapi, void 0, indent3) : jsYaml.dump(openapi, { indent: indent3 })
|
|
1610776
1610777
|
);
|
|
1610777
1610778
|
});
|
|
1610778
1610779
|
})
|
|
@@ -1639486,7 +1639487,7 @@ var fs22 = __toESM(require("fs"), 1);
|
|
|
1639486
1639487
|
var import_promises104 = require("fs/promises");
|
|
1639487
1639488
|
var import_stream9 = require("stream");
|
|
1639488
1639489
|
var import_promises105 = require("stream/promises");
|
|
1639489
|
-
async function fetchAndWriteFile(url2, path69, logger) {
|
|
1639490
|
+
async function fetchAndWriteFile(url2, path69, logger, indent3) {
|
|
1639490
1639491
|
const resp = await fetch(url2);
|
|
1639491
1639492
|
if (resp.ok && resp.body) {
|
|
1639492
1639493
|
logger.debug("Origin successfully fetched, writing to file");
|
|
@@ -1639494,16 +1639495,17 @@ async function fetchAndWriteFile(url2, path69, logger) {
|
|
|
1639494
1639495
|
await (0, import_promises105.finished)(import_stream9.Readable.fromWeb(resp.body).pipe(fileStream));
|
|
1639495
1639496
|
const fileContents = await (0, import_promises104.readFile)(path69, "utf8");
|
|
1639496
1639497
|
try {
|
|
1639497
|
-
await (0, import_promises104.writeFile)(path69, JSON.stringify(JSON.parse(fileContents), void 0,
|
|
1639498
|
+
await (0, import_promises104.writeFile)(path69, JSON.stringify(JSON.parse(fileContents), void 0, indent3), "utf8");
|
|
1639498
1639499
|
} catch (e6) {
|
|
1639499
|
-
await (0, import_promises104.writeFile)(path69, jsYaml.dump(jsYaml.load(fileContents)), "utf8");
|
|
1639500
|
+
await (0, import_promises104.writeFile)(path69, jsYaml.dump(jsYaml.load(fileContents), { indent: indent3 }), "utf8");
|
|
1639500
1639501
|
}
|
|
1639501
1639502
|
logger.debug("File written successfully");
|
|
1639502
1639503
|
}
|
|
1639503
1639504
|
}
|
|
1639504
1639505
|
async function updateApiSpec({
|
|
1639505
1639506
|
cliContext,
|
|
1639506
|
-
project: { apiWorkspaces }
|
|
1639507
|
+
project: { apiWorkspaces },
|
|
1639508
|
+
indent: indent3
|
|
1639507
1639509
|
}) {
|
|
1639508
1639510
|
for (const workspace of apiWorkspaces) {
|
|
1639509
1639511
|
if (workspace.type === "fern") {
|
|
@@ -1639527,7 +1639529,8 @@ async function updateApiSpec({
|
|
|
1639527
1639529
|
await processDefinitions({
|
|
1639528
1639530
|
cliContext,
|
|
1639529
1639531
|
workspacePath: workspace.absoluteFilePath,
|
|
1639530
|
-
apiLocations: generatorConfig.api.definitions
|
|
1639532
|
+
apiLocations: generatorConfig.api.definitions,
|
|
1639533
|
+
indent: indent3
|
|
1639531
1639534
|
});
|
|
1639532
1639535
|
return;
|
|
1639533
1639536
|
} else if (generatorConfig.api.type === "multiNamespace") {
|
|
@@ -1639535,14 +1639538,16 @@ async function updateApiSpec({
|
|
|
1639535
1639538
|
await processDefinitions({
|
|
1639536
1639539
|
cliContext,
|
|
1639537
1639540
|
workspacePath: workspace.absoluteFilePath,
|
|
1639538
|
-
apiLocations: generatorConfig.api.rootDefinitions
|
|
1639541
|
+
apiLocations: generatorConfig.api.rootDefinitions,
|
|
1639542
|
+
indent: indent3
|
|
1639539
1639543
|
});
|
|
1639540
1639544
|
}
|
|
1639541
1639545
|
for (const [_15, apiLocations] of Object.entries(generatorConfig.api.definitions)) {
|
|
1639542
1639546
|
await processDefinitions({
|
|
1639543
1639547
|
cliContext,
|
|
1639544
1639548
|
workspacePath: workspace.absoluteFilePath,
|
|
1639545
|
-
apiLocations
|
|
1639549
|
+
apiLocations,
|
|
1639550
|
+
indent: indent3
|
|
1639546
1639551
|
});
|
|
1639547
1639552
|
}
|
|
1639548
1639553
|
}
|
|
@@ -1639554,7 +1639559,8 @@ async function updateApiSpec({
|
|
|
1639554
1639559
|
async function getAndFetchFromAPIDefinitionLocation({
|
|
1639555
1639560
|
cliContext,
|
|
1639556
1639561
|
workspacePath,
|
|
1639557
|
-
apiLocation
|
|
1639562
|
+
apiLocation,
|
|
1639563
|
+
indent: indent3
|
|
1639558
1639564
|
}) {
|
|
1639559
1639565
|
if (apiLocation.schema.type === "protobuf") {
|
|
1639560
1639566
|
cliContext.logger.info("Encountered conjure API definition, skipping API update.");
|
|
@@ -1639565,20 +1639571,23 @@ async function getAndFetchFromAPIDefinitionLocation({
|
|
|
1639565
1639571
|
await fetchAndWriteFile(
|
|
1639566
1639572
|
apiLocation.origin,
|
|
1639567
1639573
|
join2(workspacePath, RelativeFilePath2.of(apiLocation.schema.path)),
|
|
1639568
|
-
cliContext.logger
|
|
1639574
|
+
cliContext.logger,
|
|
1639575
|
+
indent3
|
|
1639569
1639576
|
);
|
|
1639570
1639577
|
}
|
|
1639571
1639578
|
}
|
|
1639572
1639579
|
async function processDefinitions({
|
|
1639573
1639580
|
cliContext,
|
|
1639574
1639581
|
workspacePath,
|
|
1639575
|
-
apiLocations
|
|
1639582
|
+
apiLocations,
|
|
1639583
|
+
indent: indent3
|
|
1639576
1639584
|
}) {
|
|
1639577
1639585
|
for (const apiLocation of apiLocations) {
|
|
1639578
1639586
|
await getAndFetchFromAPIDefinitionLocation({
|
|
1639579
1639587
|
cliContext,
|
|
1639580
1639588
|
workspacePath,
|
|
1639581
|
-
apiLocation
|
|
1639589
|
+
apiLocation,
|
|
1639590
|
+
indent: indent3
|
|
1639582
1639591
|
});
|
|
1639583
1639592
|
}
|
|
1639584
1639593
|
}
|
|
@@ -1645579,6 +1645588,10 @@ function addUpdateApiSpecCommand(cli, cliContext) {
|
|
|
1645579
1645588
|
(yargs) => yargs.option("api", {
|
|
1645580
1645589
|
string: true,
|
|
1645581
1645590
|
description: "The API to update the spec for. If not specified, all APIs with a declared origin will be updated."
|
|
1645591
|
+
}).option("indent", {
|
|
1645592
|
+
type: "number",
|
|
1645593
|
+
description: "Indentation width in spaces (default: 2)",
|
|
1645594
|
+
default: 2
|
|
1645582
1645595
|
}),
|
|
1645583
1645596
|
async (argv) => {
|
|
1645584
1645597
|
await cliContext.instrumentPostHogEvent({
|
|
@@ -1645589,7 +1645602,8 @@ function addUpdateApiSpecCommand(cli, cliContext) {
|
|
|
1645589
1645602
|
project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
1645590
1645603
|
commandLineApiWorkspace: argv.api,
|
|
1645591
1645604
|
defaultToAllApiWorkspaces: true
|
|
1645592
|
-
})
|
|
1645605
|
+
}),
|
|
1645606
|
+
indent: argv.indent
|
|
1645593
1645607
|
});
|
|
1645594
1645608
|
}
|
|
1645595
1645609
|
);
|
|
@@ -1646115,6 +1646129,10 @@ function addExportCommand(cli, cliContext) {
|
|
|
1646115
1646129
|
}).option("api", {
|
|
1646116
1646130
|
string: true,
|
|
1646117
1646131
|
description: "Only run the command on the provided API"
|
|
1646132
|
+
}).option("indent", {
|
|
1646133
|
+
type: "number",
|
|
1646134
|
+
description: "Indentation width in spaces (default: 2)",
|
|
1646135
|
+
default: 2
|
|
1646118
1646136
|
}),
|
|
1646119
1646137
|
async (argv) => {
|
|
1646120
1646138
|
await cliContext.instrumentPostHogEvent({
|
|
@@ -1646129,7 +1646147,8 @@ function addExportCommand(cli, cliContext) {
|
|
|
1646129
1646147
|
defaultToAllApiWorkspaces: false
|
|
1646130
1646148
|
}),
|
|
1646131
1646149
|
cliContext,
|
|
1646132
|
-
outputPath: resolve(cwd(), argv.outputPath)
|
|
1646150
|
+
outputPath: resolve(cwd(), argv.outputPath),
|
|
1646151
|
+
indent: argv.indent
|
|
1646133
1646152
|
});
|
|
1646134
1646153
|
}
|
|
1646135
1646154
|
);
|
package/package.json
CHANGED