@fern-api/fern-api-dev 4.72.0 → 4.73.0-2-g7adbd47c733
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 +206 -61
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -621394,7 +621394,7 @@ var AccessTokenPosthogManager = class {
|
|
|
621394
621394
|
properties: {
|
|
621395
621395
|
...event,
|
|
621396
621396
|
...event.properties,
|
|
621397
|
-
version: "4.
|
|
621397
|
+
version: "4.73.0-2-g7adbd47c733",
|
|
621398
621398
|
usingAccessToken: true
|
|
621399
621399
|
}
|
|
621400
621400
|
});
|
|
@@ -621448,7 +621448,7 @@ var UserPosthogManager = class {
|
|
|
621448
621448
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
621449
621449
|
event: "CLI",
|
|
621450
621450
|
properties: {
|
|
621451
|
-
version: "4.
|
|
621451
|
+
version: "4.73.0-2-g7adbd47c733",
|
|
621452
621452
|
...event,
|
|
621453
621453
|
...event.properties,
|
|
621454
621454
|
usingAccessToken: false,
|
|
@@ -624684,7 +624684,8 @@ var YamlConfigLoader = class {
|
|
|
624684
624684
|
data: parseResult.data,
|
|
624685
624685
|
sourced: sourceResolver.toSourced(parseResult.data),
|
|
624686
624686
|
absoluteFilePath,
|
|
624687
|
-
relativeFilePath: RelativeFilePath2.of(relative4(this.cwd, absoluteFilePath))
|
|
624687
|
+
relativeFilePath: RelativeFilePath2.of(relative4(this.cwd, absoluteFilePath)),
|
|
624688
|
+
pathMappings: resolved.pathMappings
|
|
624688
624689
|
};
|
|
624689
624690
|
}
|
|
624690
624691
|
async parseDocument(absoluteFilePath) {
|
|
@@ -624747,6 +624748,17 @@ var YamlConfigLoader = class {
|
|
|
624747
624748
|
case "unrecognized_keys":
|
|
624748
624749
|
return `unknown key(s): ${issue2.keys.join(", ")}`;
|
|
624749
624750
|
case "invalid_union": {
|
|
624751
|
+
const unknownKeys = [];
|
|
624752
|
+
for (const errorGroup of issue2.errors) {
|
|
624753
|
+
for (const err of errorGroup) {
|
|
624754
|
+
if (err.code === "unrecognized_keys") {
|
|
624755
|
+
unknownKeys.push(...err.keys);
|
|
624756
|
+
}
|
|
624757
|
+
}
|
|
624758
|
+
}
|
|
624759
|
+
if (unknownKeys.length > 0) {
|
|
624760
|
+
return `unknown key(s): ${[...new Set(unknownKeys)].join(", ")}`;
|
|
624761
|
+
}
|
|
624750
624762
|
const expectedTypes = /* @__PURE__ */ new Set();
|
|
624751
624763
|
for (const errorGroup of issue2.errors) {
|
|
624752
624764
|
for (const err of errorGroup) {
|
|
@@ -625075,7 +625087,7 @@ var ApiDefinitionConverter = class {
|
|
|
625075
625087
|
let result = {};
|
|
625076
625088
|
if (api != null && !isNullish2(sourced.api)) {
|
|
625077
625089
|
result = await this.convertApi({
|
|
625078
|
-
absoluteFernYmlPath:
|
|
625090
|
+
absoluteFernYmlPath: this.resolveBasePathForKey("api", fernYml),
|
|
625079
625091
|
api,
|
|
625080
625092
|
sourcedApi: sourced.api
|
|
625081
625093
|
});
|
|
@@ -625083,6 +625095,7 @@ var ApiDefinitionConverter = class {
|
|
|
625083
625095
|
if (apis != null && !isNullish2(sourced.apis)) {
|
|
625084
625096
|
result = await this.convertApis({
|
|
625085
625097
|
absoluteFernYmlPath: fernYml.absoluteFilePath,
|
|
625098
|
+
pathMappings: fernYml.pathMappings,
|
|
625086
625099
|
apis,
|
|
625087
625100
|
sourcedApis: sourced.apis
|
|
625088
625101
|
});
|
|
@@ -625120,14 +625133,15 @@ var ApiDefinitionConverter = class {
|
|
|
625120
625133
|
[DEFAULT_API_NAME]: apiDefinition
|
|
625121
625134
|
};
|
|
625122
625135
|
}
|
|
625123
|
-
async convertApis({ absoluteFernYmlPath, apis, sourcedApis }) {
|
|
625136
|
+
async convertApis({ absoluteFernYmlPath, pathMappings, apis, sourcedApis }) {
|
|
625124
625137
|
if (isNullish2(sourcedApis)) {
|
|
625125
625138
|
return {};
|
|
625126
625139
|
}
|
|
625127
625140
|
const apiEntries = Object.entries(apis).filter(([apiName]) => !isNullish2(sourcedApis[apiName])).map(([apiName, apiDef]) => ({ apiName, apiDef, sourcedApiDef: sourcedApis[apiName] })).filter((entry) => !isNullish2(entry.sourcedApiDef));
|
|
625128
625141
|
const convertedEntries = await Promise.all(apiEntries.map(async ({ apiName, apiDef, sourcedApiDef }) => {
|
|
625142
|
+
const entryBasePath = this.findBasePathInMappings(["apis", apiName], pathMappings) ?? this.findBasePathInMappings(["apis"], pathMappings) ?? absoluteFernYmlPath;
|
|
625129
625143
|
const specs = await this.convertSpecs({
|
|
625130
|
-
absoluteFernYmlPath,
|
|
625144
|
+
absoluteFernYmlPath: entryBasePath,
|
|
625131
625145
|
specs: apiDef.specs,
|
|
625132
625146
|
sourced: sourcedApiDef.specs
|
|
625133
625147
|
});
|
|
@@ -625423,9 +625437,33 @@ var ApiDefinitionConverter = class {
|
|
|
625423
625437
|
}
|
|
625424
625438
|
}
|
|
625425
625439
|
}
|
|
625440
|
+
/**
|
|
625441
|
+
* Returns the file path of the document that provided the content at the
|
|
625442
|
+
* given YAML path prefix (via a `$ref`), or `undefined` if no mapping matches.
|
|
625443
|
+
*
|
|
625444
|
+
* Used to resolve spec paths relative to the correct source file when a
|
|
625445
|
+
* config section (e.g. `api`, `apis`, `apis.my-api`) was loaded via `$ref`.
|
|
625446
|
+
*/
|
|
625447
|
+
findBasePathInMappings(yamlPath, pathMappings) {
|
|
625448
|
+
for (const mapping of pathMappings) {
|
|
625449
|
+
if (mapping.yamlPath.length === yamlPath.length && yamlPath.every((seg, i11) => seg === mapping.yamlPath[i11])) {
|
|
625450
|
+
return mapping.document.absoluteFilePath;
|
|
625451
|
+
}
|
|
625452
|
+
}
|
|
625453
|
+
return void 0;
|
|
625454
|
+
}
|
|
625455
|
+
/**
|
|
625456
|
+
* Returns the base file path to use for resolving paths in the given top-level
|
|
625457
|
+
* key (e.g. "api"). If the key was `$ref`'d, returns the path of the referenced
|
|
625458
|
+
* file; otherwise falls back to the fern.yml path.
|
|
625459
|
+
*/
|
|
625460
|
+
resolveBasePathForKey(key2, fernYml) {
|
|
625461
|
+
return this.findBasePathInMappings([key2], fernYml.pathMappings) ?? fernYml.absoluteFilePath;
|
|
625462
|
+
}
|
|
625426
625463
|
};
|
|
625427
625464
|
|
|
625428
625465
|
// ../cli-v2/lib/docs/config/converter/DocsConfigConverter.js
|
|
625466
|
+
var DOCS_YAML_PATH = "docs";
|
|
625429
625467
|
var DocsConfigConverter = class {
|
|
625430
625468
|
issues = [];
|
|
625431
625469
|
convert({ fernYml }) {
|
|
@@ -625437,10 +625475,13 @@ var DocsConfigConverter = class {
|
|
|
625437
625475
|
if (this.issues.length > 0) {
|
|
625438
625476
|
return { success: false, issues: this.issues };
|
|
625439
625477
|
}
|
|
625478
|
+
const docsPathMapping = fernYml.pathMappings.find((m11) => m11.yamlPath.length === 1 && m11.yamlPath[0] === DOCS_YAML_PATH);
|
|
625479
|
+
const absoluteFilePath = docsPathMapping != null ? docsPathMapping.document.absoluteFilePath : fernYml.absoluteFilePath;
|
|
625440
625480
|
return {
|
|
625441
625481
|
success: true,
|
|
625442
625482
|
config: {
|
|
625443
|
-
raw: docs
|
|
625483
|
+
raw: docs,
|
|
625484
|
+
absoluteFilePath
|
|
625444
625485
|
}
|
|
625445
625486
|
};
|
|
625446
625487
|
}
|
|
@@ -753732,8 +753773,13 @@ var IrCompiler = class {
|
|
|
753732
753773
|
var CompileCommand = class {
|
|
753733
753774
|
async handle(context3, args) {
|
|
753734
753775
|
const workspace = await context3.loadWorkspaceOrThrow();
|
|
753735
|
-
const
|
|
753736
|
-
|
|
753776
|
+
const entries23 = this.resolveApiEntries(args, workspace);
|
|
753777
|
+
if (args.output != null && entries23.length > 1) {
|
|
753778
|
+
throw new CliError({
|
|
753779
|
+
message: `--output requires --api when multiple APIs are configured`,
|
|
753780
|
+
code: CliError.Code.ConfigError
|
|
753781
|
+
});
|
|
753782
|
+
}
|
|
753737
753783
|
const compiler2 = new IrCompiler({
|
|
753738
753784
|
context: context3,
|
|
753739
753785
|
cliVersion: workspace.cliVersion
|
|
@@ -753745,43 +753791,35 @@ var CompileCommand = class {
|
|
|
753745
753791
|
disableExamples: args["disable-examples"],
|
|
753746
753792
|
irVersion: args["ir-version"]
|
|
753747
753793
|
};
|
|
753748
|
-
const
|
|
753749
|
-
|
|
753794
|
+
for (const { apiName, definition: definition3 } of entries23) {
|
|
753795
|
+
await this.checkOrThrow({ context: context3, workspace, apiName });
|
|
753796
|
+
const result = args.dynamic ? await compiler2.compileDynamic({ apiName, definition: definition3, options: options2 }) : await compiler2.compile({ apiName, definition: definition3, options: options2 });
|
|
753797
|
+
await this.writeOutput(context3, args, result.object);
|
|
753798
|
+
}
|
|
753750
753799
|
}
|
|
753751
|
-
|
|
753752
|
-
|
|
753800
|
+
/**
|
|
753801
|
+
* Resolves the set of APIs to compile.
|
|
753802
|
+
*
|
|
753803
|
+
* - If `--api` is provided, returns only that API (throws if not found).
|
|
753804
|
+
* - Otherwise returns all APIs in the workspace, matching the behavior of
|
|
753805
|
+
* `check`, `merge`, and `split` which also run on all APIs by default.
|
|
753806
|
+
*/
|
|
753807
|
+
resolveApiEntries(args, workspace) {
|
|
753808
|
+
const allApiNames = Object.keys(workspace.apis);
|
|
753753
753809
|
if (args.api != null) {
|
|
753754
753810
|
const definition3 = workspace.apis[args.api];
|
|
753755
753811
|
if (definition3 == null) {
|
|
753756
|
-
const
|
|
753812
|
+
const available = allApiNames.join(", ");
|
|
753757
753813
|
throw new CliError({
|
|
753758
|
-
message: `API '${args.api}' not found. Available APIs: ${
|
|
753814
|
+
message: `API '${args.api}' not found. Available APIs: ${available}`,
|
|
753759
753815
|
code: CliError.Code.ConfigError
|
|
753760
753816
|
});
|
|
753761
753817
|
}
|
|
753762
|
-
return { apiName: args.api, definition: definition3 };
|
|
753818
|
+
return [{ apiName: args.api, definition: definition3 }];
|
|
753763
753819
|
}
|
|
753764
|
-
|
|
753765
|
-
const apiName = apiNames[0];
|
|
753766
|
-
if (apiName == null) {
|
|
753767
|
-
throw new CliError({
|
|
753768
|
-
message: "Internal error; no APIs found in workspace",
|
|
753769
|
-
code: CliError.Code.InternalError
|
|
753770
|
-
});
|
|
753771
|
-
}
|
|
753820
|
+
return allApiNames.flatMap((apiName) => {
|
|
753772
753821
|
const definition3 = workspace.apis[apiName];
|
|
753773
|
-
|
|
753774
|
-
throw new CliError({
|
|
753775
|
-
message: `Internal error; API '${apiName}' not found in workspace`,
|
|
753776
|
-
code: CliError.Code.InternalError
|
|
753777
|
-
});
|
|
753778
|
-
}
|
|
753779
|
-
return { apiName, definition: definition3 };
|
|
753780
|
-
}
|
|
753781
|
-
const available = apiNames.join(", ");
|
|
753782
|
-
throw new CliError({
|
|
753783
|
-
message: `Multiple APIs found: ${available}. Use --api to select one.`,
|
|
753784
|
-
code: CliError.Code.ConfigError
|
|
753822
|
+
return definition3 != null ? [{ apiName, definition: definition3 }] : [];
|
|
753785
753823
|
});
|
|
753786
753824
|
}
|
|
753787
753825
|
async checkOrThrow({ context: context3, workspace, apiName }) {
|
|
@@ -834698,13 +834736,15 @@ async function runRulesOnDocsWorkspace({ workspace, rules: selectedRules, contex
|
|
|
834698
834736
|
}
|
|
834699
834737
|
|
|
834700
834738
|
// ../cli-v2/lib/docs/adapter/LegacyDocsWorkspaceAdapter.js
|
|
834739
|
+
init_lib6();
|
|
834701
834740
|
var LegacyDocsWorkspaceAdapter = class {
|
|
834702
834741
|
adapt({ docsConfig, absoluteFilePath }) {
|
|
834742
|
+
const docsFilePath = docsConfig.absoluteFilePath ?? absoluteFilePath;
|
|
834703
834743
|
return {
|
|
834704
834744
|
type: "docs",
|
|
834705
834745
|
workspaceName: void 0,
|
|
834706
|
-
absoluteFilePath,
|
|
834707
|
-
absoluteFilepathToDocsConfig:
|
|
834746
|
+
absoluteFilePath: dirname6(docsFilePath),
|
|
834747
|
+
absoluteFilepathToDocsConfig: docsFilePath,
|
|
834708
834748
|
config: docsConfig.raw
|
|
834709
834749
|
};
|
|
834710
834750
|
}
|
|
@@ -834721,9 +834761,9 @@ var LegacyProjectAdapter = class {
|
|
|
834721
834761
|
}
|
|
834722
834762
|
adapt(workspace) {
|
|
834723
834763
|
const apiWorkspaces = this.buildApiWorkspaces(workspace);
|
|
834724
|
-
const docsWorkspace = workspace.docs != null
|
|
834764
|
+
const docsWorkspace = workspace.docs != null ? this.docsAdapter.adapt({
|
|
834725
834765
|
docsConfig: workspace.docs,
|
|
834726
|
-
absoluteFilePath: workspace.absoluteFilePath
|
|
834766
|
+
absoluteFilePath: workspace.docs.absoluteFilePath ?? workspace.absoluteFilePath ?? this.context.cwd
|
|
834727
834767
|
}) : void 0;
|
|
834728
834768
|
return {
|
|
834729
834769
|
config: {
|
|
@@ -838618,7 +838658,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
838618
838658
|
var LOGS_FOLDER_NAME = "logs";
|
|
838619
838659
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
838620
838660
|
function getCliSource() {
|
|
838621
|
-
const version7 = "4.
|
|
838661
|
+
const version7 = "4.73.0-2-g7adbd47c733";
|
|
838622
838662
|
return `cli@${version7}`;
|
|
838623
838663
|
}
|
|
838624
838664
|
var DebugLogger = class {
|
|
@@ -849865,7 +849905,7 @@ var LegacyDocsPublisher = class {
|
|
|
849865
849905
|
previewId,
|
|
849866
849906
|
disableTemplates: void 0,
|
|
849867
849907
|
skipUpload,
|
|
849868
|
-
cliVersion: "4.
|
|
849908
|
+
cliVersion: "4.73.0-2-g7adbd47c733"
|
|
849869
849909
|
});
|
|
849870
849910
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
849871
849911
|
return { success: false };
|
|
@@ -850434,6 +850474,36 @@ var DocsTaskGroup = class {
|
|
|
850434
850474
|
}
|
|
850435
850475
|
};
|
|
850436
850476
|
|
|
850477
|
+
// ../cli-v2/lib/ui/promptSelect.js
|
|
850478
|
+
async function promptSelect({ isTTY, message, choices, nonInteractiveError, flagHint }) {
|
|
850479
|
+
if (choices.length === 0) {
|
|
850480
|
+
throw new CliError({
|
|
850481
|
+
message: "No options available to select from.",
|
|
850482
|
+
code: CliError.Code.InternalError
|
|
850483
|
+
});
|
|
850484
|
+
}
|
|
850485
|
+
if (!isTTY) {
|
|
850486
|
+
throw new CliError({ message: nonInteractiveError, code: CliError.Code.ConfigError });
|
|
850487
|
+
}
|
|
850488
|
+
const maxNameLen = Math.max(...choices.map((c16) => c16.name.length));
|
|
850489
|
+
const { selected } = await lib_default4.prompt([
|
|
850490
|
+
{
|
|
850491
|
+
type: "list",
|
|
850492
|
+
name: "selected",
|
|
850493
|
+
message,
|
|
850494
|
+
choices: choices.map((c16) => {
|
|
850495
|
+
if (flagHint == null) {
|
|
850496
|
+
return { name: c16.name, value: c16.value };
|
|
850497
|
+
}
|
|
850498
|
+
const hint = flagHint(c16.value);
|
|
850499
|
+
const label = hint != null ? `${c16.name.padEnd(maxNameLen)} ${source_default.dim(hint)}` : c16.name;
|
|
850500
|
+
return { name: label, value: c16.value };
|
|
850501
|
+
})
|
|
850502
|
+
}
|
|
850503
|
+
]);
|
|
850504
|
+
return selected;
|
|
850505
|
+
}
|
|
850506
|
+
|
|
850437
850507
|
// ../cli-v2/lib/commands/docs/publish/command.js
|
|
850438
850508
|
var PublishCommand = class {
|
|
850439
850509
|
async handle(context3, args) {
|
|
@@ -850462,7 +850532,8 @@ var PublishCommand = class {
|
|
|
850462
850532
|
code: CliError.Code.ConfigError
|
|
850463
850533
|
});
|
|
850464
850534
|
}
|
|
850465
|
-
const instanceUrl = this.resolveInstanceUrl({
|
|
850535
|
+
const instanceUrl = await this.resolveInstanceUrl({
|
|
850536
|
+
context: context3,
|
|
850466
850537
|
instances: workspace.docs.raw.instances,
|
|
850467
850538
|
instance: args.instance
|
|
850468
850539
|
});
|
|
@@ -850544,7 +850615,7 @@ var PublishCommand = class {
|
|
|
850544
850615
|
throw new CliError({ code: CliError.Code.ContainerError });
|
|
850545
850616
|
}
|
|
850546
850617
|
}
|
|
850547
|
-
resolveInstanceUrl({ instances: instances2, instance }) {
|
|
850618
|
+
async resolveInstanceUrl({ context: context3, instances: instances2, instance }) {
|
|
850548
850619
|
if (instances2.length === 0) {
|
|
850549
850620
|
throw new CliError({
|
|
850550
850621
|
message: "No docs instances configured.\n\n Add an instance to the 'docs:' section of your fern.yml.",
|
|
@@ -850569,14 +850640,17 @@ ${available}
|
|
|
850569
850640
|
}
|
|
850570
850641
|
if (instances2.length > 1) {
|
|
850571
850642
|
const available = instances2.map((i11) => ` - ${i11.url}`).join("\n");
|
|
850572
|
-
|
|
850573
|
-
|
|
850643
|
+
return await promptSelect({
|
|
850644
|
+
isTTY: context3.isTTY,
|
|
850645
|
+
message: "Multiple docs instances configured. Select one:",
|
|
850646
|
+
choices: instances2.map((i11) => ({ name: i11.url, value: i11.url })),
|
|
850647
|
+
nonInteractiveError: `Multiple docs instances configured. Please specify which instance to publish.
|
|
850574
850648
|
|
|
850575
850649
|
Available instances:
|
|
850576
850650
|
${available}
|
|
850577
850651
|
|
|
850578
850652
|
Use --instance <url> to select one.`,
|
|
850579
|
-
|
|
850653
|
+
flagHint: (value) => `--instance ${value}`
|
|
850580
850654
|
});
|
|
850581
850655
|
}
|
|
850582
850656
|
const first3 = instances2[0];
|
|
@@ -904037,7 +904111,8 @@ var GenerateCommand = class {
|
|
|
904037
904111
|
org: args.org
|
|
904038
904112
|
};
|
|
904039
904113
|
}
|
|
904040
|
-
const targets2 = this.getTargets({
|
|
904114
|
+
const targets2 = await this.getTargets({
|
|
904115
|
+
context: context3,
|
|
904041
904116
|
workspace: workspaceWithOverrides,
|
|
904042
904117
|
args,
|
|
904043
904118
|
groupName: args.target != null ? void 0 : args.group ?? workspaceWithOverrides.sdks?.defaultGroup
|
|
@@ -904070,10 +904145,13 @@ var GenerateCommand = class {
|
|
|
904070
904145
|
code: CliError.Code.ConfigError
|
|
904071
904146
|
});
|
|
904072
904147
|
}
|
|
904073
|
-
|
|
904074
|
-
|
|
904075
|
-
|
|
904076
|
-
|
|
904148
|
+
if (args.api == null || args.target == null || args.org == null || args.output == null) {
|
|
904149
|
+
throw new CliError({
|
|
904150
|
+
message: "Internal error: required flags missing",
|
|
904151
|
+
code: CliError.Code.InternalError
|
|
904152
|
+
});
|
|
904153
|
+
}
|
|
904154
|
+
const { api, target, org, output: output2 } = args;
|
|
904077
904155
|
const resolver2 = new ApiSpecResolver({ context: context3 });
|
|
904078
904156
|
const resolvedSpec = await resolver2.resolve({
|
|
904079
904157
|
reference: api
|
|
@@ -904322,19 +904400,70 @@ Example:
|
|
|
904322
904400
|
}
|
|
904323
904401
|
return { path: args.output };
|
|
904324
904402
|
}
|
|
904325
|
-
getTargets({ workspace, args, groupName }) {
|
|
904403
|
+
async getTargets({ context: context3, workspace, args, groupName }) {
|
|
904326
904404
|
let matched = workspace.sdks != null ? this.filterTargetsByGroup(workspace.sdks.targets, groupName) : [];
|
|
904327
904405
|
if (args.target != null) {
|
|
904328
904406
|
matched = matched.filter((t3) => t3.name === args.target);
|
|
904329
904407
|
if (matched.length === 0) {
|
|
904330
|
-
|
|
904408
|
+
const allTargets = workspace.sdks?.targets ?? [];
|
|
904409
|
+
const available = allTargets.map((t3) => t3.name);
|
|
904410
|
+
if (available.length > 0) {
|
|
904411
|
+
throw new CliError({
|
|
904412
|
+
message: `Target '${args.target}' not found. Available targets: ${available.join(", ")}`,
|
|
904413
|
+
code: CliError.Code.ConfigError
|
|
904414
|
+
});
|
|
904415
|
+
} else {
|
|
904416
|
+
throw new CliError({
|
|
904417
|
+
message: `Target '${args.target}' not found`,
|
|
904418
|
+
code: CliError.Code.ConfigError
|
|
904419
|
+
});
|
|
904420
|
+
}
|
|
904331
904421
|
}
|
|
904332
904422
|
}
|
|
904333
904423
|
if (matched.length === 0) {
|
|
904334
904424
|
if (groupName != null) {
|
|
904335
|
-
throw new
|
|
904425
|
+
throw new CliError({
|
|
904426
|
+
message: `No targets found for group '${groupName}'`,
|
|
904427
|
+
code: CliError.Code.ConfigError
|
|
904428
|
+
});
|
|
904429
|
+
}
|
|
904430
|
+
throw new CliError({
|
|
904431
|
+
message: "No targets configured in fern.yml",
|
|
904432
|
+
code: CliError.Code.ConfigError
|
|
904433
|
+
});
|
|
904434
|
+
}
|
|
904435
|
+
if (groupName == null && args.target == null && matched.length > 1) {
|
|
904436
|
+
const allGroups = this.collectGroups(matched);
|
|
904437
|
+
if (allGroups.length > 1) {
|
|
904438
|
+
const selectedGroup = await promptSelect({
|
|
904439
|
+
isTTY: context3.isTTY,
|
|
904440
|
+
message: "Multiple SDK groups found. Select one:",
|
|
904441
|
+
choices: [
|
|
904442
|
+
{ name: `all (${matched.length} targets)`, value: void 0 },
|
|
904443
|
+
...allGroups.map((g19) => ({ name: g19, value: g19 }))
|
|
904444
|
+
],
|
|
904445
|
+
nonInteractiveError: `Multiple SDK groups found: ${allGroups.join(", ")}. Use --group to select one.`,
|
|
904446
|
+
flagHint: (value) => value != null ? `--group ${value}` : void 0
|
|
904447
|
+
});
|
|
904448
|
+
if (selectedGroup != null) {
|
|
904449
|
+
matched = this.filterTargetsByGroup(matched, selectedGroup);
|
|
904450
|
+
}
|
|
904451
|
+
} else {
|
|
904452
|
+
const targetNames = matched.map((t3) => t3.name);
|
|
904453
|
+
const selectedTarget = await promptSelect({
|
|
904454
|
+
isTTY: context3.isTTY,
|
|
904455
|
+
message: "Multiple SDK targets found. Select one:",
|
|
904456
|
+
choices: [
|
|
904457
|
+
{ name: `all (${matched.length} targets)`, value: void 0 },
|
|
904458
|
+
...targetNames.map((name2) => ({ name: name2, value: name2 }))
|
|
904459
|
+
],
|
|
904460
|
+
nonInteractiveError: `Multiple SDK targets found: ${targetNames.join(", ")}. Use --target to select one.`,
|
|
904461
|
+
flagHint: (value) => value != null ? `--target ${value}` : void 0
|
|
904462
|
+
});
|
|
904463
|
+
if (selectedTarget != null) {
|
|
904464
|
+
matched = matched.filter((t3) => t3.name === selectedTarget);
|
|
904465
|
+
}
|
|
904336
904466
|
}
|
|
904337
|
-
throw new Error("No targets configured in fern.yml");
|
|
904338
904467
|
}
|
|
904339
904468
|
return matched.map((target) => ({
|
|
904340
904469
|
...target,
|
|
@@ -904342,6 +904471,17 @@ Example:
|
|
|
904342
904471
|
output: args.output != null ? this.parseTargetOutput(args) : target.output
|
|
904343
904472
|
}));
|
|
904344
904473
|
}
|
|
904474
|
+
collectGroups(targets2) {
|
|
904475
|
+
const groups2 = /* @__PURE__ */ new Set();
|
|
904476
|
+
for (const target of targets2) {
|
|
904477
|
+
if (target.groups != null) {
|
|
904478
|
+
for (const group of target.groups) {
|
|
904479
|
+
groups2.add(group);
|
|
904480
|
+
}
|
|
904481
|
+
}
|
|
904482
|
+
}
|
|
904483
|
+
return [...groups2].sort();
|
|
904484
|
+
}
|
|
904345
904485
|
async checkOutputDirectory({ context: context3, args, outputPath }) {
|
|
904346
904486
|
if (args.force || !context3.isTTY) {
|
|
904347
904487
|
return { shouldProceed: true };
|
|
@@ -904371,11 +904511,13 @@ Example:
|
|
|
904371
904511
|
return targets2.filter((target) => target.groups?.includes(groupName));
|
|
904372
904512
|
}
|
|
904373
904513
|
resolveLanguage(target) {
|
|
904374
|
-
|
|
904375
|
-
|
|
904376
|
-
return lang;
|
|
904514
|
+
if (isLanguage(target)) {
|
|
904515
|
+
return target;
|
|
904377
904516
|
}
|
|
904378
|
-
throw new
|
|
904517
|
+
throw new CliError({
|
|
904518
|
+
message: `"${target}" is not a supported language. Supported: ${LANGUAGES.join(", ")}`,
|
|
904519
|
+
code: CliError.Code.ConfigError
|
|
904520
|
+
});
|
|
904379
904521
|
}
|
|
904380
904522
|
parseAudiences(audiences) {
|
|
904381
904523
|
if (audiences == null || audiences.length === 0) {
|
|
@@ -904427,6 +904569,9 @@ Example:
|
|
|
904427
904569
|
return text9.trimEnd().split("\n").map((line) => line.length > 0 ? ` ${line}` : line).join("\n");
|
|
904428
904570
|
}
|
|
904429
904571
|
};
|
|
904572
|
+
function isLanguage(target) {
|
|
904573
|
+
return LANGUAGES.includes(target);
|
|
904574
|
+
}
|
|
904430
904575
|
function addGenerateCommand(cli) {
|
|
904431
904576
|
const cmd = new GenerateCommand();
|
|
904432
904577
|
command2(cli, "generate", "Generate SDKs from fern.yml or directly from an API spec", async (context3, args) => {
|
|
@@ -924218,7 +924363,7 @@ var CliContext = class _CliContext {
|
|
|
924218
924363
|
if (false) {
|
|
924219
924364
|
this.logger.error("CLI_VERSION is not defined");
|
|
924220
924365
|
}
|
|
924221
|
-
return "4.
|
|
924366
|
+
return "4.73.0-2-g7adbd47c733";
|
|
924222
924367
|
}
|
|
924223
924368
|
getCliName() {
|
|
924224
924369
|
if (false) {
|
package/package.json
CHANGED