@fern-api/fern-api-dev 5.23.3-647-gfeaa92717c9 → 5.23.3-654-g1acf3dda7ca
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 +209 -113
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -669270,7 +669270,7 @@ var AccessTokenPosthogManager = class {
|
|
|
669270
669270
|
properties: {
|
|
669271
669271
|
...event,
|
|
669272
669272
|
...event.properties,
|
|
669273
|
-
version: "5.23.3-
|
|
669273
|
+
version: "5.23.3-654-g1acf3dda7ca",
|
|
669274
669274
|
usingAccessToken: true,
|
|
669275
669275
|
...getRunIdProperties()
|
|
669276
669276
|
}
|
|
@@ -669334,7 +669334,7 @@ var UserPosthogManager = class {
|
|
|
669334
669334
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
669335
669335
|
event: "CLI",
|
|
669336
669336
|
properties: {
|
|
669337
|
-
version: "5.23.3-
|
|
669337
|
+
version: "5.23.3-654-g1acf3dda7ca",
|
|
669338
669338
|
...event,
|
|
669339
669339
|
...event.properties,
|
|
669340
669340
|
usingAccessToken: false,
|
|
@@ -856705,7 +856705,7 @@ function createDocsConfigFileAstVisitorForRules({ relativeFilepath, allRulesWith
|
|
|
856705
856705
|
const ruleViolations = await visitFromRule(node4);
|
|
856706
856706
|
const severityOverride = severityOverrides?.get(ruleName);
|
|
856707
856707
|
addViolations(ruleViolations.map((violation) => ({
|
|
856708
|
-
name: violation.name,
|
|
856708
|
+
name: violation.name ?? ruleName,
|
|
856709
856709
|
severity: severityOverride ?? violation.severity,
|
|
856710
856710
|
relativeFilepath: violation.relativeFilepath ?? RelativeFilePath2.of(""),
|
|
856711
856711
|
nodePath: violation.nodePath ?? nodePath,
|
|
@@ -861072,7 +861072,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
861072
861072
|
var LOGS_FOLDER_NAME = "logs";
|
|
861073
861073
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
861074
861074
|
function getCliSource() {
|
|
861075
|
-
const version7 = "5.23.3-
|
|
861075
|
+
const version7 = "5.23.3-654-g1acf3dda7ca";
|
|
861076
861076
|
return `cli@${version7}`;
|
|
861077
861077
|
}
|
|
861078
861078
|
var DebugLogger = class {
|
|
@@ -892164,7 +892164,7 @@ var LegacyDocsPublisher = class {
|
|
|
892164
892164
|
previewId,
|
|
892165
892165
|
disableTemplates: void 0,
|
|
892166
892166
|
skipUpload,
|
|
892167
|
-
cliVersion: "5.23.3-
|
|
892167
|
+
cliVersion: "5.23.3-654-g1acf3dda7ca",
|
|
892168
892168
|
loginCommand: "fern auth login"
|
|
892169
892169
|
});
|
|
892170
892170
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -943601,13 +943601,19 @@ function getGithubPublishConfig(githubPublishInfo) {
|
|
|
943601
943601
|
secretKeyEnvironmentVariable: (0, import_api50.EnvironmentVariable)(value2.signature.secretKey ?? "")
|
|
943602
943602
|
} : void 0
|
|
943603
943603
|
}),
|
|
943604
|
-
pypi: (value2) =>
|
|
943605
|
-
|
|
943606
|
-
|
|
943607
|
-
|
|
943608
|
-
|
|
943609
|
-
|
|
943610
|
-
|
|
943604
|
+
pypi: (value2) => {
|
|
943605
|
+
const password = (value2.credentials?.password ?? "").trim();
|
|
943606
|
+
const useOidc = password === "<USE_OIDC>" || password === "OIDC";
|
|
943607
|
+
const hasCredentials = value2.credentials != null;
|
|
943608
|
+
return import_generator_exec_sdk.FernGeneratorExec.GithubPublishInfo.pypi({
|
|
943609
|
+
registryUrl: value2.registryUrl,
|
|
943610
|
+
packageName: value2.packageName,
|
|
943611
|
+
usernameEnvironmentVariable: (0, import_api50.EnvironmentVariable)("PYPI_USERNAME"),
|
|
943612
|
+
passwordEnvironmentVariable: (0, import_api50.EnvironmentVariable)(useOidc ? "OIDC" : "PYPI_PASSWORD"),
|
|
943613
|
+
shouldGeneratePublishWorkflow: useOidc || hasCredentials,
|
|
943614
|
+
pypiMetadata: value2.pypiMetadata
|
|
943615
|
+
});
|
|
943616
|
+
},
|
|
943611
943617
|
rubygems: (value2) => import_generator_exec_sdk.FernGeneratorExec.GithubPublishInfo.rubygems({
|
|
943612
943618
|
registryUrl: value2.registryUrl,
|
|
943613
943619
|
packageName: value2.packageName,
|
|
@@ -943729,10 +943735,11 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
943729
943735
|
});
|
|
943730
943736
|
}
|
|
943731
943737
|
});
|
|
943738
|
+
const publishConfig = getPublishConfigForGithubOidc(generatorInvocation, outputVersion);
|
|
943732
943739
|
return {
|
|
943733
943740
|
irFilepath: irPath,
|
|
943734
943741
|
output: output2,
|
|
943735
|
-
publish:
|
|
943742
|
+
publish: publishConfig,
|
|
943736
943743
|
customConfig,
|
|
943737
943744
|
workspaceName,
|
|
943738
943745
|
organization,
|
|
@@ -943923,6 +943930,42 @@ function getPublishTargetFromPublishModeV2(mode) {
|
|
|
943923
943930
|
_other: () => void 0
|
|
943924
943931
|
});
|
|
943925
943932
|
}
|
|
943933
|
+
function getPublishConfigForGithubOidc(generatorInvocation, version7) {
|
|
943934
|
+
const publishInfo = generatorInvocation.outputMode._visit({
|
|
943935
|
+
publish: () => void 0,
|
|
943936
|
+
publishV2: () => void 0,
|
|
943937
|
+
downloadFiles: () => void 0,
|
|
943938
|
+
github: (value2) => value2.publishInfo,
|
|
943939
|
+
githubV2: (value2) => value2._visit({
|
|
943940
|
+
push: (v9) => v9.publishInfo,
|
|
943941
|
+
commitAndRelease: (v9) => v9.publishInfo,
|
|
943942
|
+
pullRequest: (v9) => v9.publishInfo,
|
|
943943
|
+
_other: () => void 0
|
|
943944
|
+
}),
|
|
943945
|
+
_other: () => void 0
|
|
943946
|
+
});
|
|
943947
|
+
if (publishInfo == null || publishInfo.type !== "pypi") {
|
|
943948
|
+
return void 0;
|
|
943949
|
+
}
|
|
943950
|
+
const password = (publishInfo.credentials?.password ?? "").trim();
|
|
943951
|
+
if (password !== "OIDC" && password !== "<USE_OIDC>") {
|
|
943952
|
+
return void 0;
|
|
943953
|
+
}
|
|
943954
|
+
const registriesV2 = structuredClone(emptyRegistriesConfigV2);
|
|
943955
|
+
registriesV2.pypi = {
|
|
943956
|
+
registryUrl: publishInfo.registryUrl,
|
|
943957
|
+
username: "__token__",
|
|
943958
|
+
password: "OIDC",
|
|
943959
|
+
packageName: publishInfo.packageName,
|
|
943960
|
+
pypiMetadata: publishInfo.pypiMetadata
|
|
943961
|
+
};
|
|
943962
|
+
return {
|
|
943963
|
+
registries: structuredClone(emptyRegistriesConfig),
|
|
943964
|
+
registriesV2,
|
|
943965
|
+
publishTarget: void 0,
|
|
943966
|
+
version: version7
|
|
943967
|
+
};
|
|
943968
|
+
}
|
|
943926
943969
|
var emptyRegistriesConfig = {
|
|
943927
943970
|
maven: { registryUrl: "", username: "", password: "", group: "", signature: void 0 },
|
|
943928
943971
|
npm: { registryUrl: "", token: "", scope: "" }
|
|
@@ -957305,7 +957348,7 @@ function getAutomationContextFromEnv() {
|
|
|
957305
957348
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
957306
957349
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
957307
957350
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
957308
|
-
cli_version: "5.23.3-
|
|
957351
|
+
cli_version: "5.23.3-654-g1acf3dda7ca"
|
|
957309
957352
|
};
|
|
957310
957353
|
}
|
|
957311
957354
|
function isAutomationMode() {
|
|
@@ -958131,7 +958174,7 @@ var CliContext = class _CliContext {
|
|
|
958131
958174
|
if (false) {
|
|
958132
958175
|
this.logger.error("CLI_VERSION is not defined");
|
|
958133
958176
|
}
|
|
958134
|
-
return "5.23.3-
|
|
958177
|
+
return "5.23.3-654-g1acf3dda7ca";
|
|
958135
958178
|
}
|
|
958136
958179
|
getCliName() {
|
|
958137
958180
|
if (false) {
|
|
@@ -972847,101 +972890,132 @@ async function validateWorkspaces({
|
|
|
972847
972890
|
const apiResults = [];
|
|
972848
972891
|
let docsResult;
|
|
972849
972892
|
let hasAnyErrors = false;
|
|
972893
|
+
let abortReason;
|
|
972850
972894
|
const apiWorkspacesToValidate = commandLineApiWorkspace != null ? project.apiWorkspaces.filter((workspace) => workspace.workspaceName === commandLineApiWorkspace) : project.apiWorkspaces;
|
|
972851
|
-
|
|
972852
|
-
|
|
972853
|
-
const
|
|
972854
|
-
|
|
972855
|
-
|
|
972856
|
-
|
|
972857
|
-
collected = await collectDocsWorkspaceViolations({
|
|
972858
|
-
workspace: docsWorkspace,
|
|
972859
|
-
context: context3,
|
|
972860
|
-
apiWorkspaces: project.apiWorkspaces,
|
|
972861
|
-
ossWorkspaces,
|
|
972862
|
-
errorOnBrokenLinks,
|
|
972863
|
-
excludeRules
|
|
972864
|
-
});
|
|
972865
|
-
});
|
|
972866
|
-
if (collected != null) {
|
|
972867
|
-
docsResult = {
|
|
972868
|
-
violations: collected.violations,
|
|
972869
|
-
elapsedMillis: collected.elapsedMillis
|
|
972870
|
-
};
|
|
972871
|
-
if (collected.hasErrors) {
|
|
972872
|
-
hasAnyErrors = true;
|
|
972873
|
-
}
|
|
972874
|
-
}
|
|
972875
|
-
}
|
|
972876
|
-
await Promise.all(
|
|
972877
|
-
apiWorkspacesToValidate.map(async (workspace) => {
|
|
972878
|
-
if (workspace.generatorsConfiguration?.groups.length === 0 && workspace.type !== "fern") {
|
|
972879
|
-
return;
|
|
972880
|
-
}
|
|
972881
|
-
if (workspace instanceof OSSWorkspace && directFromOpenapi) {
|
|
972882
|
-
await cliContext.runTaskForWorkspace(workspace, async (context3) => {
|
|
972883
|
-
await workspace.getIntermediateRepresentation({
|
|
972884
|
-
context: context3,
|
|
972885
|
-
audiences: { type: "all" },
|
|
972886
|
-
enableUniqueErrorsPerEndpoint: false,
|
|
972887
|
-
generateV1Examples: false,
|
|
972888
|
-
logWarnings
|
|
972889
|
-
});
|
|
972890
|
-
});
|
|
972891
|
-
return;
|
|
972892
|
-
}
|
|
972893
|
-
if (workspace instanceof LazyFernWorkspace) {
|
|
972894
|
-
const absolutePathToApiYml = join8(
|
|
972895
|
-
workspace.absoluteFilePath,
|
|
972896
|
-
RelativeFilePath2.of(DEFINITION_DIRECTORY),
|
|
972897
|
-
RelativeFilePath2.of(ROOT_API_FILENAME)
|
|
972898
|
-
);
|
|
972899
|
-
const apiYmlExists = await doesPathExist(absolutePathToApiYml);
|
|
972900
|
-
if (!apiYmlExists) {
|
|
972901
|
-
await cliContext.runTask(async (context3) => {
|
|
972902
|
-
context3.logger.error(`Missing file: ${ROOT_API_FILENAME}`);
|
|
972903
|
-
return context3.failAndThrow(void 0, void 0, { code: CliError.Code.ValidationError });
|
|
972904
|
-
});
|
|
972905
|
-
return;
|
|
972906
|
-
}
|
|
972907
|
-
}
|
|
972895
|
+
let hasErrors = false;
|
|
972896
|
+
try {
|
|
972897
|
+
const docsWorkspace = project.docsWorkspaces;
|
|
972898
|
+
if (docsWorkspace != null) {
|
|
972899
|
+
const excludeRules = brokenLinks || errorOnBrokenLinks ? [] : ["valid-markdown-links"];
|
|
972900
|
+
const ossWorkspaces = await filterOssWorkspaces(project);
|
|
972908
972901
|
let collected;
|
|
972909
|
-
await cliContext.runTaskForWorkspace(
|
|
972910
|
-
|
|
972911
|
-
|
|
972912
|
-
workspace: fernWorkspace,
|
|
972902
|
+
await cliContext.runTaskForWorkspace(docsWorkspace, async (context3) => {
|
|
972903
|
+
collected = await collectDocsWorkspaceViolations({
|
|
972904
|
+
workspace: docsWorkspace,
|
|
972913
972905
|
context: context3,
|
|
972914
|
-
|
|
972906
|
+
apiWorkspaces: project.apiWorkspaces,
|
|
972907
|
+
ossWorkspaces,
|
|
972908
|
+
errorOnBrokenLinks,
|
|
972909
|
+
excludeRules
|
|
972915
972910
|
});
|
|
972916
972911
|
});
|
|
972917
972912
|
if (collected != null) {
|
|
972918
|
-
|
|
972919
|
-
apiName: collected.apiName,
|
|
972913
|
+
docsResult = {
|
|
972920
972914
|
violations: collected.violations,
|
|
972921
972915
|
elapsedMillis: collected.elapsedMillis
|
|
972922
|
-
}
|
|
972916
|
+
};
|
|
972923
972917
|
if (collected.hasErrors) {
|
|
972924
972918
|
hasAnyErrors = true;
|
|
972925
972919
|
}
|
|
972926
972920
|
}
|
|
972927
|
-
}
|
|
972928
|
-
|
|
972929
|
-
|
|
972930
|
-
|
|
972931
|
-
|
|
972932
|
-
|
|
972933
|
-
|
|
972934
|
-
|
|
972935
|
-
|
|
972936
|
-
|
|
972937
|
-
|
|
972938
|
-
|
|
972939
|
-
|
|
972940
|
-
|
|
972921
|
+
}
|
|
972922
|
+
await Promise.all(
|
|
972923
|
+
apiWorkspacesToValidate.map(async (workspace) => {
|
|
972924
|
+
if (workspace.generatorsConfiguration?.groups.length === 0 && workspace.type !== "fern") {
|
|
972925
|
+
return;
|
|
972926
|
+
}
|
|
972927
|
+
if (workspace instanceof OSSWorkspace && directFromOpenapi) {
|
|
972928
|
+
await cliContext.runTaskForWorkspace(workspace, async (context3) => {
|
|
972929
|
+
await workspace.getIntermediateRepresentation({
|
|
972930
|
+
context: context3,
|
|
972931
|
+
audiences: { type: "all" },
|
|
972932
|
+
enableUniqueErrorsPerEndpoint: false,
|
|
972933
|
+
generateV1Examples: false,
|
|
972934
|
+
logWarnings
|
|
972935
|
+
});
|
|
972936
|
+
});
|
|
972937
|
+
return;
|
|
972938
|
+
}
|
|
972939
|
+
if (workspace instanceof LazyFernWorkspace) {
|
|
972940
|
+
const absolutePathToApiYml = join8(
|
|
972941
|
+
workspace.absoluteFilePath,
|
|
972942
|
+
RelativeFilePath2.of(DEFINITION_DIRECTORY),
|
|
972943
|
+
RelativeFilePath2.of(ROOT_API_FILENAME)
|
|
972944
|
+
);
|
|
972945
|
+
const apiYmlExists = await doesPathExist(absolutePathToApiYml);
|
|
972946
|
+
if (!apiYmlExists) {
|
|
972947
|
+
abortReason = "missing api.yml";
|
|
972948
|
+
await cliContext.runTask(async (context3) => {
|
|
972949
|
+
context3.logger.error(`Missing file: ${ROOT_API_FILENAME}`);
|
|
972950
|
+
return context3.failAndThrow(void 0, void 0, {
|
|
972951
|
+
code: CliError.Code.ValidationError
|
|
972952
|
+
});
|
|
972953
|
+
});
|
|
972954
|
+
return;
|
|
972955
|
+
}
|
|
972956
|
+
}
|
|
972957
|
+
let collected;
|
|
972958
|
+
await cliContext.runTaskForWorkspace(workspace, async (context3) => {
|
|
972959
|
+
const fernWorkspace = await workspace.toFernWorkspace({ context: context3 });
|
|
972960
|
+
collected = await collectAPIWorkspaceViolations({
|
|
972961
|
+
workspace: fernWorkspace,
|
|
972962
|
+
context: context3,
|
|
972963
|
+
ossWorkspace: workspace instanceof OSSWorkspace ? workspace : void 0
|
|
972964
|
+
});
|
|
972965
|
+
});
|
|
972966
|
+
if (collected != null) {
|
|
972967
|
+
apiResults.push({
|
|
972968
|
+
apiName: collected.apiName,
|
|
972969
|
+
violations: collected.violations,
|
|
972970
|
+
elapsedMillis: collected.elapsedMillis
|
|
972971
|
+
});
|
|
972972
|
+
if (collected.hasErrors) {
|
|
972973
|
+
hasAnyErrors = true;
|
|
972974
|
+
}
|
|
972975
|
+
}
|
|
972976
|
+
})
|
|
972941
972977
|
);
|
|
972942
|
-
|
|
972943
|
-
|
|
972944
|
-
|
|
972978
|
+
const reportResult = await cliContext.runTask((context3) => {
|
|
972979
|
+
return printCheckReport({
|
|
972980
|
+
apiResults,
|
|
972981
|
+
docsResult,
|
|
972982
|
+
logWarnings,
|
|
972983
|
+
context: context3
|
|
972984
|
+
});
|
|
972985
|
+
});
|
|
972986
|
+
hasErrors = reportResult.hasErrors;
|
|
972987
|
+
if (cliContext.isJsonMode) {
|
|
972988
|
+
const showApiNames = apiResults.length > 1;
|
|
972989
|
+
cliContext.writeJsonToStdout(
|
|
972990
|
+
buildCheckJsonResult({ apiResults, docsResult, hasErrors: hasErrors || hasAnyErrors, showApiNames })
|
|
972991
|
+
);
|
|
972992
|
+
}
|
|
972993
|
+
if (hasErrors || hasAnyErrors) {
|
|
972994
|
+
abortReason = "validation errors";
|
|
972995
|
+
cliContext.failAndThrow(void 0, void 0, { code: CliError.Code.ValidationError });
|
|
972996
|
+
}
|
|
972997
|
+
} catch (error50) {
|
|
972998
|
+
if (abortReason == null) {
|
|
972999
|
+
abortReason = error50 instanceof Error ? error50.message.slice(0, 100) : "unexpected error";
|
|
973000
|
+
}
|
|
973001
|
+
throw error50;
|
|
973002
|
+
} finally {
|
|
973003
|
+
const allViolations = [...apiResults.flatMap((r5) => r5.violations), ...docsResult?.violations ?? []];
|
|
973004
|
+
const firedRules = [
|
|
973005
|
+
...new Set(allViolations.map((v9) => v9.name).filter((name2) => name2 != null))
|
|
973006
|
+
];
|
|
973007
|
+
const numErrors = allViolations.filter((v9) => v9.severity === "fatal" || v9.severity === "error").length;
|
|
973008
|
+
const numWarnings = allViolations.filter((v9) => v9.severity === "warning").length;
|
|
973009
|
+
cliContext.instrumentPostHogEvent({
|
|
973010
|
+
command: "fern check",
|
|
973011
|
+
properties: {
|
|
973012
|
+
validationRules: firedRules,
|
|
973013
|
+
numErrors,
|
|
973014
|
+
numWarnings,
|
|
973015
|
+
passed: !hasErrors && !hasAnyErrors,
|
|
973016
|
+
abortReason
|
|
973017
|
+
}
|
|
973018
|
+
});
|
|
972945
973019
|
}
|
|
972946
973020
|
}
|
|
972947
973021
|
|
|
@@ -974295,24 +974369,46 @@ function addValidateCommand(cli, cliContext) {
|
|
|
974295
974369
|
default: false
|
|
974296
974370
|
}),
|
|
974297
974371
|
async (argv) => {
|
|
974298
|
-
|
|
974299
|
-
|
|
974300
|
-
|
|
974301
|
-
|
|
974302
|
-
|
|
974303
|
-
|
|
974304
|
-
|
|
974372
|
+
let project;
|
|
974373
|
+
try {
|
|
974374
|
+
project = await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
|
|
974375
|
+
commandLineApiWorkspace: void 0,
|
|
974376
|
+
defaultToAllApiWorkspaces: true
|
|
974377
|
+
});
|
|
974378
|
+
if (argv.api != null && !project.apiWorkspaces.some((ws5) => ws5.workspaceName === argv.api)) {
|
|
974379
|
+
cliContext.instrumentPostHogEvent({
|
|
974380
|
+
command: "fern check",
|
|
974381
|
+
properties: {
|
|
974382
|
+
passed: false,
|
|
974383
|
+
abortReason: `API does not exist: ${argv.api}`
|
|
974384
|
+
}
|
|
974385
|
+
});
|
|
974386
|
+
cliContext.failAndThrow(`API does not exist: ${argv.api}`, void 0, {
|
|
974387
|
+
code: CliError.Code.ConfigError
|
|
974388
|
+
});
|
|
974389
|
+
}
|
|
974390
|
+
await validateWorkspaces({
|
|
974391
|
+
project,
|
|
974392
|
+
cliContext,
|
|
974393
|
+
logWarnings: argv.warnings,
|
|
974394
|
+
brokenLinks: argv.brokenLinks,
|
|
974395
|
+
errorOnBrokenLinks: argv.strictBrokenLinks,
|
|
974396
|
+
directFromOpenapi: argv.fromOpenapi,
|
|
974397
|
+
commandLineApiWorkspace: argv.api
|
|
974305
974398
|
});
|
|
974399
|
+
} catch (error50) {
|
|
974400
|
+
if (project == null) {
|
|
974401
|
+
const reason = error50 instanceof Error ? error50.message.slice(0, 100) : "project load failed";
|
|
974402
|
+
cliContext.instrumentPostHogEvent({
|
|
974403
|
+
command: "fern check",
|
|
974404
|
+
properties: {
|
|
974405
|
+
passed: false,
|
|
974406
|
+
abortReason: reason
|
|
974407
|
+
}
|
|
974408
|
+
});
|
|
974409
|
+
}
|
|
974410
|
+
throw error50;
|
|
974306
974411
|
}
|
|
974307
|
-
await validateWorkspaces({
|
|
974308
|
-
project,
|
|
974309
|
-
cliContext,
|
|
974310
|
-
logWarnings: argv.warnings,
|
|
974311
|
-
brokenLinks: argv.brokenLinks,
|
|
974312
|
-
errorOnBrokenLinks: argv.strictBrokenLinks,
|
|
974313
|
-
directFromOpenapi: argv.fromOpenapi,
|
|
974314
|
-
commandLineApiWorkspace: argv.api
|
|
974315
|
-
});
|
|
974316
974412
|
}
|
|
974317
974413
|
);
|
|
974318
974414
|
}
|
package/package.json
CHANGED