@fern-api/fern-api-dev 4.81.0-12-gda1eb9c3fad → 4.81.0-13-g1d7c3cd6458
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 +62 -28
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -469477,6 +469477,7 @@ var CliError = class _CliError extends Error {
|
|
|
469477
469477
|
NetworkError: "NETWORK_ERROR",
|
|
469478
469478
|
AuthError: "AUTH_ERROR",
|
|
469479
469479
|
ConfigError: "CONFIG_ERROR",
|
|
469480
|
+
UserError: "USER_ERROR",
|
|
469480
469481
|
Unclassified: "UNCLASSIFIED"
|
|
469481
469482
|
};
|
|
469482
469483
|
})(CliError || (CliError = {}));
|
|
@@ -469493,6 +469494,7 @@ var SENTRY_REPORTABLE = {
|
|
|
469493
469494
|
[CliError.Code.NetworkError]: false,
|
|
469494
469495
|
[CliError.Code.AuthError]: false,
|
|
469495
469496
|
[CliError.Code.ConfigError]: false,
|
|
469497
|
+
[CliError.Code.UserError]: false,
|
|
469496
469498
|
[CliError.Code.Unclassified]: false
|
|
469497
469499
|
};
|
|
469498
469500
|
function shouldReportToSentry(code5) {
|
|
@@ -614666,7 +614668,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614666
614668
|
properties: {
|
|
614667
614669
|
...event,
|
|
614668
614670
|
...event.properties,
|
|
614669
|
-
version: "4.81.0-
|
|
614671
|
+
version: "4.81.0-13-g1d7c3cd6458",
|
|
614670
614672
|
usingAccessToken: true
|
|
614671
614673
|
}
|
|
614672
614674
|
});
|
|
@@ -614720,7 +614722,7 @@ var UserPosthogManager = class {
|
|
|
614720
614722
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614721
614723
|
event: "CLI",
|
|
614722
614724
|
properties: {
|
|
614723
|
-
version: "4.81.0-
|
|
614725
|
+
version: "4.81.0-13-g1d7c3cd6458",
|
|
614724
614726
|
...event,
|
|
614725
614727
|
...event.properties,
|
|
614726
614728
|
usingAccessToken: false,
|
|
@@ -832071,7 +832073,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
832071
832073
|
var LOGS_FOLDER_NAME = "logs";
|
|
832072
832074
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
832073
832075
|
function getCliSource() {
|
|
832074
|
-
const version7 = "4.81.0-
|
|
832076
|
+
const version7 = "4.81.0-13-g1d7c3cd6458";
|
|
832075
832077
|
return `cli@${version7}`;
|
|
832076
832078
|
}
|
|
832077
832079
|
var DebugLogger = class {
|
|
@@ -843638,7 +843640,7 @@ var LegacyDocsPublisher = class {
|
|
|
843638
843640
|
previewId,
|
|
843639
843641
|
disableTemplates: void 0,
|
|
843640
843642
|
skipUpload,
|
|
843641
|
-
cliVersion: "4.81.0-
|
|
843643
|
+
cliVersion: "4.81.0-13-g1d7c3cd6458"
|
|
843642
843644
|
});
|
|
843643
843645
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843644
843646
|
return { success: false };
|
|
@@ -873579,7 +873581,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
873579
873581
|
}
|
|
873580
873582
|
}
|
|
873581
873583
|
} catch (e5) {
|
|
873582
|
-
this.context.failAndThrow("Failed to run spotlessApply", e5);
|
|
873584
|
+
this.context.failAndThrow("Failed to run spotlessApply", e5, { code: CliError.Code.InternalError });
|
|
873583
873585
|
}
|
|
873584
873586
|
}
|
|
873585
873587
|
this.context.logger.debug("Done generating dynamic snippet tests");
|
|
@@ -895156,11 +895158,17 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
895156
895158
|
buildGeneratorConfig(config5) {
|
|
895157
895159
|
const outputMode = config5.output.mode;
|
|
895158
895160
|
if (outputMode.type !== "github") {
|
|
895159
|
-
throw new
|
|
895161
|
+
throw new CliError({
|
|
895162
|
+
message: "GitHub output mode is required for TypeScript dynamic snippet tests",
|
|
895163
|
+
code: CliError.Code.ConfigError
|
|
895164
|
+
});
|
|
895160
895165
|
}
|
|
895161
895166
|
const publishInfo = outputMode.publishInfo;
|
|
895162
895167
|
if (!publishInfo || publishInfo.type !== "npm") {
|
|
895163
|
-
throw new
|
|
895168
|
+
throw new CliError({
|
|
895169
|
+
message: "NPM publish info is required for TypeScript dynamic snippet tests",
|
|
895170
|
+
code: CliError.Code.ConfigError
|
|
895171
|
+
});
|
|
895164
895172
|
}
|
|
895165
895173
|
return {
|
|
895166
895174
|
...config5,
|
|
@@ -895214,7 +895222,10 @@ var DynamicSnippetsTestGenerator = class _DynamicSnippetsTestGenerator {
|
|
|
895214
895222
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/generateDynamicSnippetsTestSuite.js
|
|
895215
895223
|
async function generateDynamicSnippetsTestSuite({ ir: ir10, config: config5 }) {
|
|
895216
895224
|
if (ir10.dynamic == null) {
|
|
895217
|
-
throw new
|
|
895225
|
+
throw new CliError({
|
|
895226
|
+
message: "Internal error; dynamic IR is not available",
|
|
895227
|
+
code: CliError.Code.InternalError
|
|
895228
|
+
});
|
|
895218
895229
|
}
|
|
895219
895230
|
return {
|
|
895220
895231
|
ir: ir10.dynamic,
|
|
@@ -895410,7 +895421,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
895410
895421
|
push: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
|
|
895411
895422
|
pullRequest: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
|
|
895412
895423
|
_other: () => {
|
|
895413
|
-
throw new
|
|
895424
|
+
throw new CliError({
|
|
895425
|
+
message: "Encountered unknown github mode",
|
|
895426
|
+
code: CliError.Code.InternalError
|
|
895427
|
+
});
|
|
895414
895428
|
}
|
|
895415
895429
|
});
|
|
895416
895430
|
const outputConfig = {
|
|
@@ -895431,7 +895445,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
895431
895445
|
return outputConfig;
|
|
895432
895446
|
},
|
|
895433
895447
|
_other: () => {
|
|
895434
|
-
throw new
|
|
895448
|
+
throw new CliError({
|
|
895449
|
+
message: "Output type did not match any of the types supported by Fern",
|
|
895450
|
+
code: CliError.Code.InternalError
|
|
895451
|
+
});
|
|
895435
895452
|
}
|
|
895436
895453
|
});
|
|
895437
895454
|
return {
|
|
@@ -896305,7 +896322,10 @@ var LocalTaskHandler = class {
|
|
|
896305
896322
|
return null;
|
|
896306
896323
|
}
|
|
896307
896324
|
if (!this.version) {
|
|
896308
|
-
throw new
|
|
896325
|
+
throw new CliError({
|
|
896326
|
+
message: "Version is required for auto versioning",
|
|
896327
|
+
code: CliError.Code.InternalError
|
|
896328
|
+
});
|
|
896309
896329
|
}
|
|
896310
896330
|
let previousVersion;
|
|
896311
896331
|
try {
|
|
@@ -896493,7 +896513,10 @@ var LocalTaskHandler = class {
|
|
|
896493
896513
|
};
|
|
896494
896514
|
}
|
|
896495
896515
|
this.context.logger.error(`Failed to perform automatic versioning: ${error50}`);
|
|
896496
|
-
throw new
|
|
896516
|
+
throw new CliError({
|
|
896517
|
+
message: `Automatic versioning failed: ${error50}`,
|
|
896518
|
+
code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError
|
|
896519
|
+
});
|
|
896497
896520
|
} finally {
|
|
896498
896521
|
if (diffFile) {
|
|
896499
896522
|
try {
|
|
@@ -896546,7 +896569,7 @@ var LocalTaskHandler = class {
|
|
|
896546
896569
|
incrementVersion(version7, versionBump) {
|
|
896547
896570
|
const cleanVersion = import_semver13.default.clean(version7);
|
|
896548
896571
|
if (!cleanVersion) {
|
|
896549
|
-
throw new
|
|
896572
|
+
throw new CliError({ message: `Invalid version format: ${version7}`, code: CliError.Code.VersionError });
|
|
896550
896573
|
}
|
|
896551
896574
|
let releaseType;
|
|
896552
896575
|
switch (versionBump) {
|
|
@@ -896560,11 +896583,17 @@ var LocalTaskHandler = class {
|
|
|
896560
896583
|
releaseType = "patch";
|
|
896561
896584
|
break;
|
|
896562
896585
|
default:
|
|
896563
|
-
throw new
|
|
896586
|
+
throw new CliError({
|
|
896587
|
+
message: `Unsupported version bump: ${versionBump}`,
|
|
896588
|
+
code: CliError.Code.VersionError
|
|
896589
|
+
});
|
|
896564
896590
|
}
|
|
896565
896591
|
const newVersion = import_semver13.default.inc(cleanVersion, releaseType);
|
|
896566
896592
|
if (!newVersion) {
|
|
896567
|
-
throw new
|
|
896593
|
+
throw new CliError({
|
|
896594
|
+
message: `Failed to increment version: ${version7}`,
|
|
896595
|
+
code: CliError.Code.VersionError
|
|
896596
|
+
});
|
|
896568
896597
|
}
|
|
896569
896598
|
return version7.startsWith("v") ? `v${newVersion}` : newVersion;
|
|
896570
896599
|
}
|
|
@@ -896624,7 +896653,10 @@ var LocalTaskHandler = class {
|
|
|
896624
896653
|
*/
|
|
896625
896654
|
async getClientRegistry() {
|
|
896626
896655
|
if (this.ai == null) {
|
|
896627
|
-
throw new
|
|
896656
|
+
throw new CliError({
|
|
896657
|
+
message: "No AI service configuration found in generators.yml. Please add an 'ai' section with provider and model.",
|
|
896658
|
+
code: CliError.Code.ConfigError
|
|
896659
|
+
});
|
|
896628
896660
|
}
|
|
896629
896661
|
this.context.logger.debug(`Using AI service: ${this.ai.provider} with model ${this.ai.model}`);
|
|
896630
896662
|
return configureBamlClient(this.ai);
|
|
@@ -897057,7 +897089,9 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
|
|
|
897057
897089
|
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
|
|
897058
897090
|
onError: (e5) => {
|
|
897059
897091
|
if (!isPreview && (requireEnvVars ?? true)) {
|
|
897060
|
-
interactiveTaskContext.failAndThrow(e5
|
|
897092
|
+
interactiveTaskContext.failAndThrow(e5, void 0, {
|
|
897093
|
+
code: CliError.Code.EnvironmentError
|
|
897094
|
+
});
|
|
897061
897095
|
}
|
|
897062
897096
|
}
|
|
897063
897097
|
}, { substituteAsEmpty: isPreview });
|
|
@@ -897110,13 +897144,13 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
|
|
|
897110
897144
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897111
897145
|
token ??= await getAccessToken();
|
|
897112
897146
|
if (token == null) {
|
|
897113
|
-
interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.");
|
|
897147
|
+
interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.", void 0, { code: CliError.Code.AuthError });
|
|
897114
897148
|
return;
|
|
897115
897149
|
}
|
|
897116
897150
|
}
|
|
897117
897151
|
const organization = await venus.organization.get(projectConfig.organization);
|
|
897118
897152
|
if (generatorInvocation.absolutePathToLocalOutput == null && !organization.ok) {
|
|
897119
|
-
interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}
|
|
897153
|
+
interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}.`, void 0, { code: CliError.Code.NetworkError });
|
|
897120
897154
|
return;
|
|
897121
897155
|
}
|
|
897122
897156
|
if (organization.ok) {
|
|
@@ -897152,7 +897186,7 @@ generators:
|
|
|
897152
897186
|
uri: your-org/your-sdk-repo
|
|
897153
897187
|
token: \${GITHUB_TOKEN}
|
|
897154
897188
|
mode: pull-request
|
|
897155
|
-
|
|
897189
|
+
`, void 0, { code: CliError.Code.ConfigError });
|
|
897156
897190
|
}
|
|
897157
897191
|
}
|
|
897158
897192
|
if (selfhostedGithubConfig != null) {
|
|
@@ -897186,13 +897220,13 @@ generators:
|
|
|
897186
897220
|
const branchExists = await repo.remoteBranchExists(selfhostedGithubConfig.branch);
|
|
897187
897221
|
if (!branchExists) {
|
|
897188
897222
|
const parsedRepo = parseRepository(selfhostedGithubConfig.uri);
|
|
897189
|
-
interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}
|
|
897223
|
+
interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}`, void 0, { code: CliError.Code.ConfigError });
|
|
897190
897224
|
}
|
|
897191
897225
|
}
|
|
897192
897226
|
await repo.checkoutRemoteBranch(selfhostedGithubConfig.branch);
|
|
897193
897227
|
}
|
|
897194
897228
|
} catch (error50) {
|
|
897195
|
-
interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}
|
|
897229
|
+
interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
|
|
897196
897230
|
}
|
|
897197
897231
|
}
|
|
897198
897232
|
let absolutePathToLocalSnippetJSON = void 0;
|
|
@@ -897289,13 +897323,13 @@ generators:
|
|
|
897289
897323
|
interactiveTaskContext.logger.info(source_default.green("Automerge enabled on PR"));
|
|
897290
897324
|
}
|
|
897291
897325
|
if (!pipelineResult.success) {
|
|
897292
|
-
interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}
|
|
897326
|
+
interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}`, void 0, { code: CliError.Code.UserError });
|
|
897293
897327
|
}
|
|
897294
897328
|
}
|
|
897295
897329
|
});
|
|
897296
897330
|
}));
|
|
897297
897331
|
if (results.some((didSucceed) => !didSucceed)) {
|
|
897298
|
-
|
|
897332
|
+
throw new TaskAbortSignal();
|
|
897299
897333
|
}
|
|
897300
897334
|
}
|
|
897301
897335
|
function resolveAbsolutePathToLocalPreview(absolutePathToPreview, generatorInvocation) {
|
|
@@ -897498,7 +897532,7 @@ var GenerationRunner = class {
|
|
|
897498
897532
|
const results = await Promise.all(generatorGroup.generators.map(async (generatorInvocation) => {
|
|
897499
897533
|
return context3.runInteractiveTask({ name: generatorInvocation.name }, async (interactiveTaskContext) => {
|
|
897500
897534
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897501
|
-
interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system");
|
|
897535
|
+
interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system", void 0, { code: CliError.Code.ConfigError });
|
|
897502
897536
|
return;
|
|
897503
897537
|
}
|
|
897504
897538
|
try {
|
|
@@ -897532,7 +897566,7 @@ var GenerationRunner = class {
|
|
|
897532
897566
|
} catch (error50) {
|
|
897533
897567
|
if (error50 instanceof TaskAbortSignal) {
|
|
897534
897568
|
} else {
|
|
897535
|
-
interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50);
|
|
897569
|
+
interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50, { code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError });
|
|
897536
897570
|
}
|
|
897537
897571
|
}
|
|
897538
897572
|
});
|
|
@@ -897541,7 +897575,7 @@ var GenerationRunner = class {
|
|
|
897541
897575
|
async executeGenerator({ generatorGroup, generatorInvocation, context: context3, workspace, organization, irVersionOverride, outputVersionOverride, absolutePathToFernConfig, inspect: inspect6, skipFernignore, skipAutogenerationIfManualExamplesExist }) {
|
|
897542
897576
|
context3.logger.info(`Starting generation for ${generatorInvocation.name}`);
|
|
897543
897577
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897544
|
-
throw new
|
|
897578
|
+
throw new CliError({ message: "Output path is required for generation", code: CliError.Code.ConfigError });
|
|
897545
897579
|
}
|
|
897546
897580
|
const rawIr = generateIntermediateRepresentation({
|
|
897547
897581
|
workspace,
|
|
@@ -918837,7 +918871,7 @@ var CliContext = class _CliContext {
|
|
|
918837
918871
|
if (false) {
|
|
918838
918872
|
this.logger.error("CLI_VERSION is not defined");
|
|
918839
918873
|
}
|
|
918840
|
-
return "4.81.0-
|
|
918874
|
+
return "4.81.0-13-g1d7c3cd6458";
|
|
918841
918875
|
}
|
|
918842
918876
|
getCliName() {
|
|
918843
918877
|
if (false) {
|
package/package.json
CHANGED