@fern-api/fern-api-dev 4.82.0 → 4.83.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 +410 -155
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -469477,8 +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"
|
|
469481
|
-
Unclassified: "UNCLASSIFIED"
|
|
469480
|
+
UserError: "USER_ERROR"
|
|
469482
469481
|
};
|
|
469483
469482
|
})(CliError || (CliError = {}));
|
|
469484
469483
|
var SENTRY_REPORTABLE = {
|
|
@@ -469494,8 +469493,7 @@ var SENTRY_REPORTABLE = {
|
|
|
469494
469493
|
[CliError.Code.NetworkError]: false,
|
|
469495
469494
|
[CliError.Code.AuthError]: false,
|
|
469496
469495
|
[CliError.Code.ConfigError]: false,
|
|
469497
|
-
[CliError.Code.UserError]: false
|
|
469498
|
-
[CliError.Code.Unclassified]: false
|
|
469496
|
+
[CliError.Code.UserError]: false
|
|
469499
469497
|
};
|
|
469500
469498
|
function shouldReportToSentry(code5) {
|
|
469501
469499
|
return SENTRY_REPORTABLE[code5];
|
|
@@ -469519,7 +469517,7 @@ function resolveErrorCode(error50, explicitCode) {
|
|
|
469519
469517
|
if (isNodeVersionError(error50)) {
|
|
469520
469518
|
return CliError.Code.EnvironmentError;
|
|
469521
469519
|
}
|
|
469522
|
-
return CliError.Code.
|
|
469520
|
+
return CliError.Code.InternalError;
|
|
469523
469521
|
}
|
|
469524
469522
|
|
|
469525
469523
|
// ../logger/lib/LogLevel.js
|
|
@@ -486637,7 +486635,7 @@ async function checkVersionDoesNotAlreadyExist({ version: version7, packageName,
|
|
|
486637
486635
|
}
|
|
486638
486636
|
if (exists2) {
|
|
486639
486637
|
if (isPublishMode) {
|
|
486640
|
-
context3.failAndThrow(`Version ${version7} of ${resolvedPackageName} already exists on the ${getRegistryName(language)} registry. Please use a different version number. If you want to automatically increment the version, omit the --version flag
|
|
486638
|
+
context3.failAndThrow(`Version ${version7} of ${resolvedPackageName} already exists on the ${getRegistryName(language)} registry. Please use a different version number. If you want to automatically increment the version, omit the --version flag.`, void 0, { code: CliError.Code.VersionError });
|
|
486641
486639
|
} else {
|
|
486642
486640
|
context3.logger.warn(`Version ${version7} of ${resolvedPackageName} already exists on the ${getRegistryName(language)} registry. If your CI pipeline publishes this version, it may fail.`);
|
|
486643
486641
|
}
|
|
@@ -518575,13 +518573,13 @@ function convertToHttpMethod(httpMethod) {
|
|
|
518575
518573
|
delete: () => schemas_exports2.HttpMethodSchema.Delete,
|
|
518576
518574
|
head: () => schemas_exports2.HttpMethodSchema.Head,
|
|
518577
518575
|
options: () => {
|
|
518578
|
-
throw new
|
|
518576
|
+
throw new CliError({ message: "OPTIONS is unsupported", code: CliError.Code.ConfigError });
|
|
518579
518577
|
},
|
|
518580
518578
|
trace: () => {
|
|
518581
|
-
throw new
|
|
518579
|
+
throw new CliError({ message: "TRACE is unsupported", code: CliError.Code.ConfigError });
|
|
518582
518580
|
},
|
|
518583
518581
|
_other: () => {
|
|
518584
|
-
throw new
|
|
518582
|
+
throw new CliError({ message: "Unknown http method is unsupported", code: CliError.Code.ConfigError });
|
|
518585
518583
|
}
|
|
518586
518584
|
});
|
|
518587
518585
|
}
|
|
@@ -518815,7 +518813,10 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
|
|
|
518815
518813
|
};
|
|
518816
518814
|
},
|
|
518817
518815
|
_other: () => {
|
|
518818
|
-
throw new
|
|
518816
|
+
throw new CliError({
|
|
518817
|
+
message: "Unrecognized Response type: " + endpoint3.response?.type,
|
|
518818
|
+
code: CliError.Code.InternalError
|
|
518819
|
+
});
|
|
518819
518820
|
}
|
|
518820
518821
|
});
|
|
518821
518822
|
}
|
|
@@ -519345,7 +519346,10 @@ function getUnresolvedEndpointLocation(endpoint3) {
|
|
|
519345
519346
|
}
|
|
519346
519347
|
}
|
|
519347
519348
|
if (fileParts.length >= operationIdTokens.length) {
|
|
519348
|
-
throw new
|
|
519349
|
+
throw new CliError({
|
|
519350
|
+
message: `Cannot get file for endpoint ${JSON.stringify(endpoint3)}`,
|
|
519351
|
+
code: CliError.Code.InternalError
|
|
519352
|
+
});
|
|
519349
519353
|
}
|
|
519350
519354
|
return {
|
|
519351
519355
|
file: RelativeFilePath.of(camelCase_default(fileParts.join("_")) + ".yml"),
|
|
@@ -519587,7 +519591,10 @@ function buildWebhooks(context3) {
|
|
|
519587
519591
|
};
|
|
519588
519592
|
},
|
|
519589
519593
|
_other: () => {
|
|
519590
|
-
throw new
|
|
519594
|
+
throw new CliError({
|
|
519595
|
+
message: "Unrecognized Response type: " + webhook.response?.type,
|
|
519596
|
+
code: CliError.Code.InternalError
|
|
519597
|
+
});
|
|
519591
519598
|
}
|
|
519592
519599
|
});
|
|
519593
519600
|
}
|
|
@@ -520179,7 +520186,10 @@ var FernDefinitionDirectory = class _FernDefinitionDirectory {
|
|
|
520179
520186
|
}
|
|
520180
520187
|
const [directory, ...remainingPath] = pathParts;
|
|
520181
520188
|
if (directory == null) {
|
|
520182
|
-
throw new
|
|
520189
|
+
throw new CliError({
|
|
520190
|
+
message: `Internal error; cannot add file with path: ${pathParts}`,
|
|
520191
|
+
code: CliError.Code.InternalError
|
|
520192
|
+
});
|
|
520183
520193
|
}
|
|
520184
520194
|
if (!this.directories[directory]) {
|
|
520185
520195
|
this.directories[directory] = new _FernDefinitionDirectory();
|
|
@@ -562872,7 +562882,10 @@ var ValidNavigationRule = {
|
|
|
562872
562882
|
}
|
|
562873
562883
|
const expectedItems = directoryToChildren[dirname6(relativeFilepath)];
|
|
562874
562884
|
if (expectedItems == null) {
|
|
562875
|
-
throw new
|
|
562885
|
+
throw new CliError({
|
|
562886
|
+
message: `Could not find expected contents of ${relativeFilepath}`,
|
|
562887
|
+
code: CliError.Code.InternalError
|
|
562888
|
+
});
|
|
562876
562889
|
}
|
|
562877
562890
|
const violations = [];
|
|
562878
562891
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -564116,7 +564129,10 @@ var ValidPaginationRule = {
|
|
|
564116
564129
|
pathPagination: endpointPagination
|
|
564117
564130
|
});
|
|
564118
564131
|
}
|
|
564119
|
-
throw new
|
|
564132
|
+
throw new CliError({
|
|
564133
|
+
message: "Invalid pagination schema",
|
|
564134
|
+
code: CliError.Code.ValidationError
|
|
564135
|
+
});
|
|
564120
564136
|
}
|
|
564121
564137
|
}
|
|
564122
564138
|
};
|
|
@@ -566549,7 +566565,10 @@ var ConjureImporter = class extends APIDefinitionImporter {
|
|
|
566549
566565
|
if (definition3.services == null || Object.keys(definition3.services ?? {}).length === 0) {
|
|
566550
566566
|
const fernFilePath = this.conjureFilepathToFernFilepath[filepath];
|
|
566551
566567
|
if (fernFilePath == null) {
|
|
566552
|
-
throw new
|
|
566568
|
+
throw new CliError({
|
|
566569
|
+
message: `Failed to find corresponding fern filepath for conjure file ${filepath}`,
|
|
566570
|
+
code: CliError.Code.InternalError
|
|
566571
|
+
});
|
|
566553
566572
|
}
|
|
566554
566573
|
for (const [import_, importedFilepath] of Object.entries(definition3.types?.conjureImports ?? {})) {
|
|
566555
566574
|
const fernFileToImport = this.getFernFileToImport({
|
|
@@ -566611,7 +566630,10 @@ var ConjureImporter = class extends APIDefinitionImporter {
|
|
|
566611
566630
|
for (const pathParameter of endpointLocator.pathParameters) {
|
|
566612
566631
|
const pathParameterType = endpointDeclaration.args[pathParameter];
|
|
566613
566632
|
if (pathParameterType == null) {
|
|
566614
|
-
throw new
|
|
566633
|
+
throw new CliError({
|
|
566634
|
+
message: `Failed to find path parameter ${pathParameter} in ${endpointDeclaration.http}`,
|
|
566635
|
+
code: CliError.Code.InternalError
|
|
566636
|
+
});
|
|
566615
566637
|
}
|
|
566616
566638
|
pathParameters[pathParameter] = typeof pathParameterType === "string" ? pathParameterType : (
|
|
566617
566639
|
// biome-ignore lint/suspicious/noExplicitAny: allow explicit any
|
|
@@ -566747,7 +566769,10 @@ var ConjureImporter = class extends APIDefinitionImporter {
|
|
|
566747
566769
|
const relativeFilePathToImportedFile = relativize(absoluteFilePathToConjureFolder, absoluteFilePathToImportedFile);
|
|
566748
566770
|
const correspondingFernFilePath = this.conjureFilepathToFernFilepath[relativeFilePathToImportedFile];
|
|
566749
566771
|
if (correspondingFernFilePath == null) {
|
|
566750
|
-
throw new
|
|
566772
|
+
throw new CliError({
|
|
566773
|
+
message: `Failed to find corresponding fern filepath for conjure file ${relativeFilePathToImportedFile}`,
|
|
566774
|
+
code: CliError.Code.InternalError
|
|
566775
|
+
});
|
|
566751
566776
|
}
|
|
566752
566777
|
return correspondingFernFilePath;
|
|
566753
566778
|
}
|
|
@@ -581884,7 +581909,9 @@ function getPathToLocalStorageDependency(dependency) {
|
|
|
581884
581909
|
}
|
|
581885
581910
|
async function validateLocalDependencyAndGetDefinition({ dependency, context: context3, cliVersion, settings, loadAPIWorkspace: loadAPIWorkspace2 }) {
|
|
581886
581911
|
if (loadAPIWorkspace2 == null) {
|
|
581887
|
-
context3.failWithoutThrowing("Failed to load api definition"
|
|
581912
|
+
context3.failWithoutThrowing("Failed to load api definition", void 0, {
|
|
581913
|
+
code: CliError.Code.ResolutionError
|
|
581914
|
+
});
|
|
581888
581915
|
return void 0;
|
|
581889
581916
|
}
|
|
581890
581917
|
context3.logger.info("Parsing...");
|
|
@@ -581895,7 +581922,9 @@ async function validateLocalDependencyAndGetDefinition({ dependency, context: co
|
|
|
581895
581922
|
workspaceName: void 0
|
|
581896
581923
|
});
|
|
581897
581924
|
if (!loadDependencyWorkspaceResult.didSucceed) {
|
|
581898
|
-
context3.failWithoutThrowing("Failed to load api definition", loadDependencyWorkspaceResult.failures
|
|
581925
|
+
context3.failWithoutThrowing("Failed to load api definition", loadDependencyWorkspaceResult.failures, {
|
|
581926
|
+
code: CliError.Code.ResolutionError
|
|
581927
|
+
});
|
|
581899
581928
|
return void 0;
|
|
581900
581929
|
}
|
|
581901
581930
|
context3.logger.info("Modifying source filepath ...");
|
|
@@ -581917,16 +581946,24 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581917
581946
|
if (!response.ok) {
|
|
581918
581947
|
response.error._visit({
|
|
581919
581948
|
orgDoesNotExistError: () => {
|
|
581920
|
-
context3.failWithoutThrowing("Organization does not exist"
|
|
581949
|
+
context3.failWithoutThrowing("Organization does not exist", void 0, {
|
|
581950
|
+
code: CliError.Code.ResolutionError
|
|
581951
|
+
});
|
|
581921
581952
|
},
|
|
581922
581953
|
apiDoesNotExistError: () => {
|
|
581923
|
-
context3.failWithoutThrowing("API does not exist"
|
|
581954
|
+
context3.failWithoutThrowing("API does not exist", void 0, {
|
|
581955
|
+
code: CliError.Code.ResolutionError
|
|
581956
|
+
});
|
|
581924
581957
|
},
|
|
581925
581958
|
versionDoesNotExistError: () => {
|
|
581926
|
-
context3.failWithoutThrowing("Version does not exist"
|
|
581959
|
+
context3.failWithoutThrowing("Version does not exist", void 0, {
|
|
581960
|
+
code: CliError.Code.ResolutionError
|
|
581961
|
+
});
|
|
581927
581962
|
},
|
|
581928
581963
|
_other: (error50) => {
|
|
581929
|
-
context3.failWithoutThrowing("Failed to download API manifest", error50
|
|
581964
|
+
context3.failWithoutThrowing("Failed to download API manifest", error50, {
|
|
581965
|
+
code: CliError.Code.NetworkError
|
|
581966
|
+
});
|
|
581930
581967
|
}
|
|
581931
581968
|
});
|
|
581932
581969
|
return void 0;
|
|
@@ -581936,14 +581973,14 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581936
581973
|
const parsedCliVersionOfDependency = parseVersion(response.body.cliVersion);
|
|
581937
581974
|
if (parsedYamlVersionOfDependency != null) {
|
|
581938
581975
|
if (parsedYamlVersionOfDependency > YAML_SCHEMA_VERSION) {
|
|
581939
|
-
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a higher version of fern. Upgrade this workspace to ${response.body.cliVersion}
|
|
581976
|
+
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a higher version of fern. Upgrade this workspace to ${response.body.cliVersion}`, void 0, { code: CliError.Code.VersionError });
|
|
581940
581977
|
return void 0;
|
|
581941
581978
|
} else if (parsedYamlVersionOfDependency < YAML_SCHEMA_VERSION) {
|
|
581942
|
-
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a lower version of fern. Upgrade it to ${cliVersion}
|
|
581979
|
+
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a lower version of fern. Upgrade it to ${cliVersion}`, void 0, { code: CliError.Code.VersionError });
|
|
581943
581980
|
return void 0;
|
|
581944
581981
|
}
|
|
581945
581982
|
} else if (parsedCliVersion.major !== parsedCliVersionOfDependency.major || parsedCliVersion.minor !== parsedCliVersionOfDependency.minor) {
|
|
581946
|
-
context3.failWithoutThrowing(`CLI version is ${response.body.cliVersion}. Expected ${parsedCliVersion.major}.${parsedCliVersion.minor}.x (to match current workspace)
|
|
581983
|
+
context3.failWithoutThrowing(`CLI version is ${response.body.cliVersion}. Expected ${parsedCliVersion.major}.${parsedCliVersion.minor}.x (to match current workspace).`, void 0, { code: CliError.Code.VersionError });
|
|
581947
581984
|
return void 0;
|
|
581948
581985
|
}
|
|
581949
581986
|
context3.logger.info("Downloading...");
|
|
@@ -581955,7 +581992,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581955
581992
|
absolutePathToLocalOutput: pathToDefinition
|
|
581956
581993
|
});
|
|
581957
581994
|
} catch (error50) {
|
|
581958
|
-
context3.failWithoutThrowing("Failed to download API", error50
|
|
581995
|
+
context3.failWithoutThrowing("Failed to download API", error50, {
|
|
581996
|
+
code: CliError.Code.NetworkError
|
|
581997
|
+
});
|
|
581959
581998
|
return void 0;
|
|
581960
581999
|
}
|
|
581961
582000
|
metadata = response.body;
|
|
@@ -581965,7 +582004,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581965
582004
|
}
|
|
581966
582005
|
context3.logger.info("Parsing...");
|
|
581967
582006
|
if (loadAPIWorkspace2 == null) {
|
|
581968
|
-
context3.failWithoutThrowing("Failed to load API"
|
|
582007
|
+
context3.failWithoutThrowing("Failed to load API", void 0, {
|
|
582008
|
+
code: CliError.Code.ResolutionError
|
|
582009
|
+
});
|
|
581969
582010
|
return void 0;
|
|
581970
582011
|
}
|
|
581971
582012
|
const loadDependencyWorkspaceResult = await loadAPIWorkspace2({
|
|
@@ -581975,12 +582016,14 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581975
582016
|
workspaceName: void 0
|
|
581976
582017
|
});
|
|
581977
582018
|
if (!loadDependencyWorkspaceResult.didSucceed) {
|
|
581978
|
-
context3.failWithoutThrowing("Failed to parse dependency after downloading", loadDependencyWorkspaceResult.failures);
|
|
582019
|
+
context3.failWithoutThrowing("Failed to parse dependency after downloading", loadDependencyWorkspaceResult.failures, { code: CliError.Code.ParseError });
|
|
581979
582020
|
return void 0;
|
|
581980
582021
|
}
|
|
581981
582022
|
const workspaceOfDependency = loadDependencyWorkspaceResult.workspace;
|
|
581982
582023
|
if (workspaceOfDependency.type === "oss") {
|
|
581983
|
-
context3.failWithoutThrowing("Dependency must be a fern workspace."
|
|
582024
|
+
context3.failWithoutThrowing("Dependency must be a fern workspace.", void 0, {
|
|
582025
|
+
code: CliError.Code.ConfigError
|
|
582026
|
+
});
|
|
581984
582027
|
return void 0;
|
|
581985
582028
|
}
|
|
581986
582029
|
return await loadDependencyWorkspaceResult.workspace.getDefinition({ context: context3 }, settings);
|
|
@@ -592520,7 +592563,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592520
592563
|
const parseResult = await parseYamlFiles(yamlFiles);
|
|
592521
592564
|
if (!parseResult.didSucceed) {
|
|
592522
592565
|
handleFailedWorkspaceParserResultRaw(parseResult.failures, defaultedContext.logger);
|
|
592523
|
-
return defaultedContext.failAndThrow(
|
|
592566
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592567
|
+
code: CliError.Code.ValidationError
|
|
592568
|
+
});
|
|
592524
592569
|
}
|
|
592525
592570
|
const structuralValidationResult = validateStructureOfYamlFiles({
|
|
592526
592571
|
files: parseResult.files,
|
|
@@ -592529,7 +592574,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592529
592574
|
});
|
|
592530
592575
|
if (!structuralValidationResult.didSucceed) {
|
|
592531
592576
|
handleFailedWorkspaceParserResultRaw(structuralValidationResult.failures, defaultedContext.logger);
|
|
592532
|
-
return defaultedContext.failAndThrow(
|
|
592577
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592578
|
+
code: CliError.Code.ValidationError
|
|
592579
|
+
});
|
|
592533
592580
|
}
|
|
592534
592581
|
const processPackageMarkersResult = await processPackageMarkers({
|
|
592535
592582
|
dependenciesConfiguration,
|
|
@@ -592541,7 +592588,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592541
592588
|
});
|
|
592542
592589
|
if (!processPackageMarkersResult.didSucceed) {
|
|
592543
592590
|
handleFailedWorkspaceParserResultRaw(processPackageMarkersResult.failures, defaultedContext.logger);
|
|
592544
|
-
return defaultedContext.failAndThrow(
|
|
592591
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592592
|
+
code: CliError.Code.ValidationError
|
|
592593
|
+
});
|
|
592545
592594
|
}
|
|
592546
592595
|
let definition3 = {
|
|
592547
592596
|
absoluteFilePath: absolutePathToDefinition,
|
|
@@ -592608,7 +592657,9 @@ async function mergeWithOverrides2({ absoluteFilePathToOverrides, data: data2, c
|
|
|
592608
592657
|
parsedOverrides = jsYaml.load(contents, { json: true });
|
|
592609
592658
|
}
|
|
592610
592659
|
} catch (err) {
|
|
592611
|
-
return context3.failAndThrow(`Failed to read overrides from file ${absoluteFilePathToOverrides}
|
|
592660
|
+
return context3.failAndThrow(`Failed to read overrides from file ${absoluteFilePathToOverrides}`, void 0, {
|
|
592661
|
+
code: CliError.Code.ParseError
|
|
592662
|
+
});
|
|
592612
592663
|
}
|
|
592613
592664
|
return mergeWithOverrides({ data: data2, overrides: parsedOverrides, allowNullKeys });
|
|
592614
592665
|
}
|
|
@@ -592768,7 +592819,10 @@ async function resolveExternalRefs(obj, baseDir, mainFileAbsPath, registry2, app
|
|
|
592768
592819
|
}
|
|
592769
592820
|
const cacheKey = `${absoluteRefPath}#${jsonPointer}`;
|
|
592770
592821
|
if (visited.has(cacheKey)) {
|
|
592771
|
-
throw new
|
|
592822
|
+
throw new CliError({
|
|
592823
|
+
message: `Circular $ref detected: "${ref2}" (resolved to "${cacheKey}")`,
|
|
592824
|
+
code: CliError.Code.ReferenceError
|
|
592825
|
+
});
|
|
592772
592826
|
}
|
|
592773
592827
|
const newVisited = new Set(visited);
|
|
592774
592828
|
newVisited.add(cacheKey);
|
|
@@ -592851,7 +592905,9 @@ async function parseOverlayFile(absoluteFilePathToOverlay, context3) {
|
|
|
592851
592905
|
try {
|
|
592852
592906
|
contents = await (0, import_promises26.readFile)(absoluteFilePathToOverlay, "utf8");
|
|
592853
592907
|
} catch (err) {
|
|
592854
|
-
return context3.failAndThrow(`Failed to read overlay file at ${absoluteFilePathToOverlay}: ${err}
|
|
592908
|
+
return context3.failAndThrow(`Failed to read overlay file at ${absoluteFilePathToOverlay}: ${err}`, void 0, {
|
|
592909
|
+
code: CliError.Code.ConfigError
|
|
592910
|
+
});
|
|
592855
592911
|
}
|
|
592856
592912
|
try {
|
|
592857
592913
|
try {
|
|
@@ -592860,7 +592916,9 @@ async function parseOverlayFile(absoluteFilePathToOverlay, context3) {
|
|
|
592860
592916
|
return jsYaml.load(contents, { json: true });
|
|
592861
592917
|
}
|
|
592862
592918
|
} catch (err) {
|
|
592863
|
-
return context3.failAndThrow(`Failed to parse overlay file at ${absoluteFilePathToOverlay}: ${err}
|
|
592919
|
+
return context3.failAndThrow(`Failed to parse overlay file at ${absoluteFilePathToOverlay}: ${err}`, void 0, {
|
|
592920
|
+
code: CliError.Code.ParseError
|
|
592921
|
+
});
|
|
592864
592922
|
}
|
|
592865
592923
|
}
|
|
592866
592924
|
function validateOverlay(overlay, context3) {
|
|
@@ -596183,7 +596241,10 @@ function createTypeReferenceFromFernType(fernType) {
|
|
|
596183
596241
|
string: (value2) => Literal.string(value2),
|
|
596184
596242
|
boolean: (value2) => Literal.boolean(value2),
|
|
596185
596243
|
_other: () => {
|
|
596186
|
-
throw new
|
|
596244
|
+
throw new CliError({
|
|
596245
|
+
message: "Unexpected literal type",
|
|
596246
|
+
code: CliError.Code.InternalError
|
|
596247
|
+
});
|
|
596187
596248
|
}
|
|
596188
596249
|
})));
|
|
596189
596250
|
},
|
|
@@ -600224,7 +600285,10 @@ var ChannelConverter3_0 = class extends AbstractChannelConverter {
|
|
|
600224
600285
|
}
|
|
600225
600286
|
getChannelPathFromOperation(operation) {
|
|
600226
600287
|
if (!operation.channel.$ref.startsWith(CHANNEL_REFERENCE_PREFIX2)) {
|
|
600227
|
-
throw new
|
|
600288
|
+
throw new CliError({
|
|
600289
|
+
message: `Failed to resolve channel path from operation ${operation.channel.$ref}`,
|
|
600290
|
+
code: CliError.Code.ReferenceError
|
|
600291
|
+
});
|
|
600228
600292
|
}
|
|
600229
600293
|
return operation.channel.$ref.substring(CHANNEL_REFERENCE_PREFIX2.length);
|
|
600230
600294
|
}
|
|
@@ -605060,7 +605124,7 @@ function getPlatformInfo() {
|
|
|
605060
605124
|
osName = "Windows";
|
|
605061
605125
|
break;
|
|
605062
605126
|
default:
|
|
605063
|
-
throw new
|
|
605127
|
+
throw new CliError({ message: `Unsupported platform: ${platform3}`, code: CliError.Code.EnvironmentError });
|
|
605064
605128
|
}
|
|
605065
605129
|
let archName;
|
|
605066
605130
|
switch (arch3) {
|
|
@@ -605071,7 +605135,7 @@ function getPlatformInfo() {
|
|
|
605071
605135
|
archName = platform3 === "linux" ? "aarch64" : "arm64";
|
|
605072
605136
|
break;
|
|
605073
605137
|
default:
|
|
605074
|
-
throw new
|
|
605138
|
+
throw new CliError({ message: `Unsupported architecture: ${arch3}`, code: CliError.Code.EnvironmentError });
|
|
605075
605139
|
}
|
|
605076
605140
|
return {
|
|
605077
605141
|
os: osName,
|
|
@@ -605145,7 +605209,10 @@ async function acquireLock(logger4) {
|
|
|
605145
605209
|
await new Promise((resolve14) => setTimeout(resolve14, LOCK_RETRY_INTERVAL_MS));
|
|
605146
605210
|
}
|
|
605147
605211
|
}
|
|
605148
|
-
throw new
|
|
605212
|
+
throw new CliError({
|
|
605213
|
+
message: `Failed to acquire buf lock after timeout and retry`,
|
|
605214
|
+
code: CliError.Code.InternalError
|
|
605215
|
+
});
|
|
605149
605216
|
}
|
|
605150
605217
|
return createLockReleaser(lockPath, logger4);
|
|
605151
605218
|
}
|
|
@@ -605334,7 +605401,10 @@ async function ensureBufCommand(logger4) {
|
|
|
605334
605401
|
logger4.debug(`Using auto-downloaded buf: ${downloadedBufPath}`);
|
|
605335
605402
|
return downloadedBufPath;
|
|
605336
605403
|
}
|
|
605337
|
-
throw new
|
|
605404
|
+
throw new CliError({
|
|
605405
|
+
message: "Missing required dependency; please install 'buf' to continue (e.g. 'brew install buf').",
|
|
605406
|
+
code: CliError.Code.EnvironmentError
|
|
605407
|
+
});
|
|
605338
605408
|
}
|
|
605339
605409
|
}
|
|
605340
605410
|
var PROTOBUF_GENERATOR_CONFIG_FILENAME = "buf.gen.yaml";
|
|
@@ -605551,7 +605621,7 @@ var ProtobufIRGenerator = class {
|
|
|
605551
605621
|
try {
|
|
605552
605622
|
await (0, import_promises34.access)(bufLockPath);
|
|
605553
605623
|
} catch {
|
|
605554
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
605624
|
+
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.", void 0, { code: CliError.Code.InternalError });
|
|
605555
605625
|
}
|
|
605556
605626
|
} else {
|
|
605557
605627
|
await buf(["dep", "update"]);
|
|
@@ -605559,7 +605629,9 @@ var ProtobufIRGenerator = class {
|
|
|
605559
605629
|
}
|
|
605560
605630
|
const bufGenerateResult = await buf(["generate"]);
|
|
605561
605631
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605562
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
605632
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
605633
|
+
code: CliError.Code.IrConversionError
|
|
605634
|
+
});
|
|
605563
605635
|
}
|
|
605564
605636
|
await (0, import_promises34.unlink)(bufYamlPath);
|
|
605565
605637
|
} catch (error50) {
|
|
@@ -605575,11 +605647,15 @@ var ProtobufIRGenerator = class {
|
|
|
605575
605647
|
try {
|
|
605576
605648
|
this.resolvedBufCommand = await ensureBufCommand(this.context.logger);
|
|
605577
605649
|
} catch (error50) {
|
|
605578
|
-
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50)
|
|
605650
|
+
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50), void 0, {
|
|
605651
|
+
code: CliError.Code.EnvironmentError
|
|
605652
|
+
});
|
|
605579
605653
|
}
|
|
605580
605654
|
}
|
|
605581
605655
|
async generateRemote() {
|
|
605582
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
605656
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
605657
|
+
code: CliError.Code.InternalError
|
|
605658
|
+
});
|
|
605583
605659
|
}
|
|
605584
605660
|
};
|
|
605585
605661
|
|
|
@@ -605619,7 +605695,7 @@ function getPlatformInfo2() {
|
|
|
605619
605695
|
osName = "windows";
|
|
605620
605696
|
break;
|
|
605621
605697
|
default:
|
|
605622
|
-
throw new
|
|
605698
|
+
throw new CliError({ message: `Unsupported platform: ${platform3}`, code: CliError.Code.EnvironmentError });
|
|
605623
605699
|
}
|
|
605624
605700
|
let archName;
|
|
605625
605701
|
switch (arch3) {
|
|
@@ -605630,7 +605706,7 @@ function getPlatformInfo2() {
|
|
|
605630
605706
|
archName = "arm64";
|
|
605631
605707
|
break;
|
|
605632
605708
|
default:
|
|
605633
|
-
throw new
|
|
605709
|
+
throw new CliError({ message: `Unsupported architecture: ${arch3}`, code: CliError.Code.EnvironmentError });
|
|
605634
605710
|
}
|
|
605635
605711
|
return {
|
|
605636
605712
|
os: osName,
|
|
@@ -605704,7 +605780,10 @@ async function acquireLock2(logger4) {
|
|
|
605704
605780
|
await new Promise((resolve14) => setTimeout(resolve14, LOCK_RETRY_INTERVAL_MS2));
|
|
605705
605781
|
}
|
|
605706
605782
|
}
|
|
605707
|
-
throw new
|
|
605783
|
+
throw new CliError({
|
|
605784
|
+
message: `Failed to acquire lock after timeout and retry`,
|
|
605785
|
+
code: CliError.Code.InternalError
|
|
605786
|
+
});
|
|
605708
605787
|
}
|
|
605709
605788
|
return createLockReleaser2(lockPath, logger4);
|
|
605710
605789
|
}
|
|
@@ -605822,7 +605901,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605822
605901
|
*/
|
|
605823
605902
|
async prepare({ absoluteFilepathToProtobufRoot, relativeFilepathToProtobufRoot, local, deps }) {
|
|
605824
605903
|
if (!local) {
|
|
605825
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
605904
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
605905
|
+
code: CliError.Code.InternalError
|
|
605906
|
+
});
|
|
605826
605907
|
}
|
|
605827
605908
|
await this.ensureBufResolved();
|
|
605828
605909
|
await this.ensureProtocGenOpenAPIResolved();
|
|
@@ -605842,7 +605923,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605842
605923
|
try {
|
|
605843
605924
|
await (0, import_promises36.access)(bufLockPath);
|
|
605844
605925
|
} catch {
|
|
605845
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
605926
|
+
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.", void 0, { code: CliError.Code.InternalError });
|
|
605846
605927
|
}
|
|
605847
605928
|
} else {
|
|
605848
605929
|
const bufCommand = this.resolvedBufCommand ?? "buf";
|
|
@@ -605879,7 +605960,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605879
605960
|
});
|
|
605880
605961
|
const bufGenerateResult = await buf(["generate", target.toString()]);
|
|
605881
605962
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605882
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
605963
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
605964
|
+
code: CliError.Code.IrConversionError
|
|
605965
|
+
});
|
|
605883
605966
|
}
|
|
605884
605967
|
const outputPath = join8(preparedDir.cwd, RelativeFilePath2.of(PROTOBUF_GENERATOR_OUTPUT_FILEPATH2));
|
|
605885
605968
|
const uniqueOutput = AbsoluteFilePath2.of((await import_tmp_promise7.default.file({ postfix: ".yaml" })).path);
|
|
@@ -605937,7 +606020,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605937
606020
|
try {
|
|
605938
606021
|
await (0, import_promises36.access)(bufLockPath);
|
|
605939
606022
|
} catch {
|
|
605940
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
606023
|
+
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.", void 0, { code: CliError.Code.InternalError });
|
|
605941
606024
|
}
|
|
605942
606025
|
} else {
|
|
605943
606026
|
await buf(["dep", "update"]);
|
|
@@ -605950,7 +606033,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605950
606033
|
}
|
|
605951
606034
|
const bufGenerateResult = await buf(["generate", target.toString()]);
|
|
605952
606035
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605953
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
606036
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
606037
|
+
code: CliError.Code.IrConversionError
|
|
606038
|
+
});
|
|
605954
606039
|
}
|
|
605955
606040
|
if (cleanupBufLock) {
|
|
605956
606041
|
await (0, import_promises36.unlink)(bufLockPath);
|
|
@@ -605988,7 +606073,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605988
606073
|
this.protocGenOpenAPIResolved = true;
|
|
605989
606074
|
return;
|
|
605990
606075
|
} catch {
|
|
605991
|
-
this.context.failAndThrow("FERN_USE_LOCAL_PROTOC_GEN_OPENAPI is set but protoc-gen-openapi was not found on PATH.");
|
|
606076
|
+
this.context.failAndThrow("FERN_USE_LOCAL_PROTOC_GEN_OPENAPI is set but protoc-gen-openapi was not found on PATH.", void 0, { code: CliError.Code.EnvironmentError });
|
|
605992
606077
|
}
|
|
605993
606078
|
}
|
|
605994
606079
|
this.context.logger.debug("Resolving protoc-gen-openapi (preferring auto-downloaded fern fork)");
|
|
@@ -606013,7 +606098,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
606013
606098
|
}
|
|
606014
606099
|
this.protocGenOpenAPIResolved = true;
|
|
606015
606100
|
} catch {
|
|
606016
|
-
this.context.failAndThrow("Missing required dependency; please install 'protoc-gen-openapi' to continue (e.g. 'brew install go && go install github.com/fern-api/protoc-gen-openapi/cmd/protoc-gen-openapi@latest').");
|
|
606101
|
+
this.context.failAndThrow("Missing required dependency; please install 'protoc-gen-openapi' to continue (e.g. 'brew install go && go install github.com/fern-api/protoc-gen-openapi/cmd/protoc-gen-openapi@latest').", void 0, { code: CliError.Code.EnvironmentError });
|
|
606017
606102
|
}
|
|
606018
606103
|
}
|
|
606019
606104
|
async ensureBufResolved() {
|
|
@@ -606023,11 +606108,15 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
606023
606108
|
try {
|
|
606024
606109
|
this.resolvedBufCommand = await ensureBufCommand(this.context.logger);
|
|
606025
606110
|
} catch (error50) {
|
|
606026
|
-
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50)
|
|
606111
|
+
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50), void 0, {
|
|
606112
|
+
code: CliError.Code.EnvironmentError
|
|
606113
|
+
});
|
|
606027
606114
|
}
|
|
606028
606115
|
}
|
|
606029
606116
|
async generateRemote() {
|
|
606030
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
606117
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
606118
|
+
code: CliError.Code.InternalError
|
|
606119
|
+
});
|
|
606031
606120
|
}
|
|
606032
606121
|
};
|
|
606033
606122
|
function getProtobufGeneratorConfig({ relativeFilepathToProtobufRoot }) {
|
|
@@ -606406,7 +606495,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606406
606495
|
}
|
|
606407
606496
|
}
|
|
606408
606497
|
if (mergedIr === void 0) {
|
|
606409
|
-
throw new
|
|
606498
|
+
throw new CliError({
|
|
606499
|
+
message: "Failed to generate intermediate representation",
|
|
606500
|
+
code: CliError.Code.IrConversionError
|
|
606501
|
+
});
|
|
606410
606502
|
}
|
|
606411
606503
|
if (authOverrides != null) {
|
|
606412
606504
|
mergedIr = resolveOAuthEndpointReferences({ ir: mergedIr, authOverrides });
|
|
@@ -606502,7 +606594,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606502
606594
|
}
|
|
606503
606595
|
async convertSpecsOverrideToSpecs(specsOverride) {
|
|
606504
606596
|
if (!Array.isArray(specsOverride)) {
|
|
606505
|
-
throw new
|
|
606597
|
+
throw new CliError({
|
|
606598
|
+
message: "Conjure specs override is not yet supported",
|
|
606599
|
+
code: CliError.Code.InternalError
|
|
606600
|
+
});
|
|
606506
606601
|
}
|
|
606507
606602
|
const specs = [];
|
|
606508
606603
|
for (const spec of specsOverride) {
|
|
@@ -606536,7 +606631,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606536
606631
|
};
|
|
606537
606632
|
specs.push(openApiSpec);
|
|
606538
606633
|
} else {
|
|
606539
|
-
throw new
|
|
606634
|
+
throw new CliError({
|
|
606635
|
+
message: `Spec type override not yet supported. Only OpenAPI specs are currently supported in specs override.`,
|
|
606636
|
+
code: CliError.Code.InternalError
|
|
606637
|
+
});
|
|
606540
606638
|
}
|
|
606541
606639
|
}
|
|
606542
606640
|
return specs;
|
|
@@ -614668,7 +614766,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614668
614766
|
properties: {
|
|
614669
614767
|
...event,
|
|
614670
614768
|
...event.properties,
|
|
614671
|
-
version: "4.
|
|
614769
|
+
version: "4.83.0",
|
|
614672
614770
|
usingAccessToken: true
|
|
614673
614771
|
}
|
|
614674
614772
|
});
|
|
@@ -614722,7 +614820,7 @@ var UserPosthogManager = class {
|
|
|
614722
614820
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614723
614821
|
event: "CLI",
|
|
614724
614822
|
properties: {
|
|
614725
|
-
version: "4.
|
|
614823
|
+
version: "4.83.0",
|
|
614726
614824
|
...event,
|
|
614727
614825
|
...event.properties,
|
|
614728
614826
|
usingAccessToken: false,
|
|
@@ -615602,7 +615700,7 @@ async function doAuth0DeviceAuthorizationFlow({ auth0Domain: auth0Domain2, auth0
|
|
|
615602
615700
|
validateStatus: () => true
|
|
615603
615701
|
});
|
|
615604
615702
|
if (deviceCodeResponse.status !== 200) {
|
|
615605
|
-
context3.failAndThrow("Failed to authenticate", deviceCodeResponse.data);
|
|
615703
|
+
context3.failAndThrow("Failed to authenticate", deviceCodeResponse.data, { code: CliError.Code.AuthError });
|
|
615606
615704
|
}
|
|
615607
615705
|
await (0, import_open.default)(deviceCodeResponse.data.verification_uri_complete);
|
|
615608
615706
|
context3.logger.info([
|
|
@@ -615657,7 +615755,7 @@ async function pollForToken({ auth0Domain: auth0Domain2, auth0ClientId, deviceCo
|
|
|
615657
615755
|
case "access_denied":
|
|
615658
615756
|
case "expired_token":
|
|
615659
615757
|
default:
|
|
615660
|
-
return context3.failAndThrow("Failed to authenticate", data2);
|
|
615758
|
+
return context3.failAndThrow("Failed to authenticate", data2, { code: CliError.Code.AuthError });
|
|
615661
615759
|
}
|
|
615662
615760
|
}
|
|
615663
615761
|
|
|
@@ -615747,10 +615845,10 @@ async function getTokenFromCode({ auth0Domain: auth0Domain2, auth0ClientId, code
|
|
|
615747
615845
|
});
|
|
615748
615846
|
const { access_token: accessToken, id_token: idToken } = response.data;
|
|
615749
615847
|
if (accessToken == null) {
|
|
615750
|
-
throw new
|
|
615848
|
+
throw new CliError({ message: "Access token is not defined", code: CliError.Code.AuthError });
|
|
615751
615849
|
}
|
|
615752
615850
|
if (idToken == null) {
|
|
615753
|
-
throw new
|
|
615851
|
+
throw new CliError({ message: "ID token is not defined", code: CliError.Code.AuthError });
|
|
615754
615852
|
}
|
|
615755
615853
|
return { accessToken, idToken };
|
|
615756
615854
|
}
|
|
@@ -615781,17 +615879,26 @@ async function resolveSsoConnection({ dashboardBaseUrl, email: email3 }) {
|
|
|
615781
615879
|
});
|
|
615782
615880
|
} catch (error50) {
|
|
615783
615881
|
if (axios_default.isAxiosError(error50) && error50.response?.status === 404) {
|
|
615784
|
-
throw new
|
|
615882
|
+
throw new CliError({
|
|
615883
|
+
message: `No SSO connection associated with email: ${email3}`,
|
|
615884
|
+
code: CliError.Code.AuthError
|
|
615885
|
+
});
|
|
615785
615886
|
}
|
|
615786
615887
|
throw error50;
|
|
615787
615888
|
}
|
|
615788
615889
|
const responseData = response.data;
|
|
615789
615890
|
if (typeof responseData !== "object" || responseData == null) {
|
|
615790
|
-
throw new
|
|
615891
|
+
throw new CliError({
|
|
615892
|
+
message: "Invalid response format from SSO resolve endpoint",
|
|
615893
|
+
code: CliError.Code.AuthError
|
|
615894
|
+
});
|
|
615791
615895
|
}
|
|
615792
615896
|
const { connection } = responseData;
|
|
615793
615897
|
if (typeof connection !== "string" || connection.length === 0) {
|
|
615794
|
-
throw new
|
|
615898
|
+
throw new CliError({
|
|
615899
|
+
message: "No SSO connection found for this email",
|
|
615900
|
+
code: CliError.Code.AuthError
|
|
615901
|
+
});
|
|
615795
615902
|
}
|
|
615796
615903
|
return connection;
|
|
615797
615904
|
}
|
|
@@ -615859,14 +615966,14 @@ async function askToLogin(context3) {
|
|
|
615859
615966
|
if (!await isLoggedIn() && process.stdout.isTTY) {
|
|
615860
615967
|
await context3.takeOverTerminal(async () => {
|
|
615861
615968
|
if (!await askForConfirmation("Login required. Continue?")) {
|
|
615862
|
-
context3.failAndThrow();
|
|
615969
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.AuthError });
|
|
615863
615970
|
}
|
|
615864
615971
|
});
|
|
615865
615972
|
await login(context3);
|
|
615866
615973
|
}
|
|
615867
615974
|
const token = await getToken2();
|
|
615868
615975
|
if (token == null) {
|
|
615869
|
-
context3.failAndThrow("Authentication required. Please run 'fern login' or set the FERN_TOKEN environment variable.");
|
|
615976
|
+
context3.failAndThrow("Authentication required. Please run 'fern login' or set the FERN_TOKEN environment variable.", void 0, { code: CliError.Code.AuthError });
|
|
615870
615977
|
}
|
|
615871
615978
|
return token;
|
|
615872
615979
|
}
|
|
@@ -617898,7 +618005,10 @@ var YamlSourceResolver = class {
|
|
|
617898
618005
|
case "boolean":
|
|
617899
618006
|
return new SourcedBoolean(value2, location2);
|
|
617900
618007
|
default:
|
|
617901
|
-
throw new
|
|
618008
|
+
throw new CliError({
|
|
618009
|
+
message: `Unexpected value type: ${typeof value2}`,
|
|
618010
|
+
code: CliError.Code.InternalError
|
|
618011
|
+
});
|
|
617902
618012
|
}
|
|
617903
618013
|
}
|
|
617904
618014
|
};
|
|
@@ -617978,7 +618088,10 @@ var YamlConfigLoader = class {
|
|
|
617978
618088
|
try {
|
|
617979
618089
|
return await this.parser.parseDocument({ absoluteFilePath, cwd: this.cwd });
|
|
617980
618090
|
} catch (err) {
|
|
617981
|
-
throw new
|
|
618091
|
+
throw new CliError({
|
|
618092
|
+
message: `Failed to parse YAML file ${absoluteFilePath}: ${extractErrorMessage(err)}`,
|
|
618093
|
+
code: CliError.Code.ParseError
|
|
618094
|
+
});
|
|
617982
618095
|
}
|
|
617983
618096
|
}
|
|
617984
618097
|
async resolveReferences({ document: document4, resolveReferences }) {
|
|
@@ -742470,7 +742583,7 @@ function convertTypes(types4) {
|
|
|
742470
742583
|
return IrVersions_exports.V54.types.Type.undiscriminatedUnion(convertUndiscriminatedUnion(undiscriminatedUnion21));
|
|
742471
742584
|
},
|
|
742472
742585
|
_other: () => {
|
|
742473
|
-
throw new
|
|
742586
|
+
throw new CliError({ message: "Encountered unknown shape", code: CliError.Code.InternalError });
|
|
742474
742587
|
}
|
|
742475
742588
|
})
|
|
742476
742589
|
};
|
|
@@ -742633,7 +742746,10 @@ function convertTypeReference(typeReference2) {
|
|
|
742633
742746
|
named: IrVersions_exports.V54.types.TypeReference.named,
|
|
742634
742747
|
unknown: IrVersions_exports.V54.types.TypeReference.unknown,
|
|
742635
742748
|
_other: () => {
|
|
742636
|
-
throw new
|
|
742749
|
+
throw new CliError({
|
|
742750
|
+
message: "Unknown type reference: " + typeReference2.type,
|
|
742751
|
+
code: CliError.Code.InternalError
|
|
742752
|
+
});
|
|
742637
742753
|
}
|
|
742638
742754
|
});
|
|
742639
742755
|
}
|
|
@@ -742661,7 +742777,10 @@ function convertContainerType(container) {
|
|
|
742661
742777
|
}),
|
|
742662
742778
|
literal: IrVersions_exports.V54.types.ContainerType.literal,
|
|
742663
742779
|
_other: () => {
|
|
742664
|
-
throw new
|
|
742780
|
+
throw new CliError({
|
|
742781
|
+
message: "Unknown ContainerType: " + container.type,
|
|
742782
|
+
code: CliError.Code.InternalError
|
|
742783
|
+
});
|
|
742665
742784
|
}
|
|
742666
742785
|
});
|
|
742667
742786
|
}
|
|
@@ -742680,7 +742799,10 @@ function convertSingleUnionTypeProperties(properties7) {
|
|
|
742680
742799
|
}),
|
|
742681
742800
|
noProperties: IrVersions_exports.V54.types.SingleUnionTypeProperties.noProperties,
|
|
742682
742801
|
_other: () => {
|
|
742683
|
-
throw new
|
|
742802
|
+
throw new CliError({
|
|
742803
|
+
message: `Unknown SingleUnionTypeProperties: ${JSON.stringify(properties7)}`,
|
|
742804
|
+
code: CliError.Code.InternalError
|
|
742805
|
+
});
|
|
742684
742806
|
}
|
|
742685
742807
|
});
|
|
742686
742808
|
}
|
|
@@ -742691,7 +742813,10 @@ function convertResolvedType(resolvedType) {
|
|
|
742691
742813
|
primitive: (primitiveType2) => IrVersions_exports.V54.types.ResolvedTypeReference.primitive(convertPrimitiveType(primitiveType2)),
|
|
742692
742814
|
unknown: IrVersions_exports.V54.types.ResolvedTypeReference.unknown,
|
|
742693
742815
|
_other: () => {
|
|
742694
|
-
throw new
|
|
742816
|
+
throw new CliError({
|
|
742817
|
+
message: "Unknown ResolvedTypeReference: " + resolvedType.type,
|
|
742818
|
+
code: CliError.Code.InternalError
|
|
742819
|
+
});
|
|
742695
742820
|
}
|
|
742696
742821
|
});
|
|
742697
742822
|
}
|
|
@@ -742890,7 +743015,10 @@ function convertSdkRequestShape(shape) {
|
|
|
742890
743015
|
justRequestBody: (reference4) => IrVersions_exports.V54.http.SdkRequestShape.justRequestBody(convertSdkRequestBodyType(reference4)),
|
|
742891
743016
|
wrapper: IrVersions_exports.V54.http.SdkRequestShape.wrapper,
|
|
742892
743017
|
_other: () => {
|
|
742893
|
-
throw new
|
|
743018
|
+
throw new CliError({
|
|
743019
|
+
message: "Unknown SdkRequestShape: " + shape.type,
|
|
743020
|
+
code: CliError.Code.InternalError
|
|
743021
|
+
});
|
|
742894
743022
|
}
|
|
742895
743023
|
});
|
|
742896
743024
|
}
|
|
@@ -742940,7 +743068,10 @@ function convertRequestBody(requestBody) {
|
|
|
742940
743068
|
return IrVersions_exports.V54.http.HttpRequestBody.bytes(bytes);
|
|
742941
743069
|
},
|
|
742942
743070
|
_other: () => {
|
|
742943
|
-
throw new
|
|
743071
|
+
throw new CliError({
|
|
743072
|
+
message: "Unknown HttpRequestBody: " + requestBody.type,
|
|
743073
|
+
code: CliError.Code.InternalError
|
|
743074
|
+
});
|
|
742944
743075
|
}
|
|
742945
743076
|
});
|
|
742946
743077
|
}
|
|
@@ -744378,7 +744509,7 @@ function convertAuthScheme(scheme) {
|
|
|
744378
744509
|
case "inferred":
|
|
744379
744510
|
return IrVersions_exports.V62.AuthScheme.inferred(scheme);
|
|
744380
744511
|
default:
|
|
744381
|
-
throw new
|
|
744512
|
+
throw new CliError({ message: "Unknown AuthScheme type", code: CliError.Code.InternalError });
|
|
744382
744513
|
}
|
|
744383
744514
|
}
|
|
744384
744515
|
function convertTypeDeclaration2(typeDeclaration2) {
|
|
@@ -746793,10 +746924,16 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
746793
746924
|
if (targetGenerator != null) {
|
|
746794
746925
|
const minVersion = this.getMinimumGeneratorVersion(targetGenerator.name);
|
|
746795
746926
|
if (minVersion != null) {
|
|
746796
|
-
throw new
|
|
746927
|
+
throw new CliError({
|
|
746928
|
+
message: `${targetGenerator.name}@${targetGenerator.version} is not compatible with CLI v4.x.x+. Please upgrade to ${targetGenerator.name}@${minVersion} or later using 'fern generator upgrade --include-major'.`,
|
|
746929
|
+
code: CliError.Code.VersionError
|
|
746930
|
+
});
|
|
746797
746931
|
}
|
|
746798
746932
|
}
|
|
746799
|
-
throw new
|
|
746933
|
+
throw new CliError({
|
|
746934
|
+
message: "This generator version is not compatible with CLI v4.x.x+. Please upgrade your generator using 'fern generator upgrade --include-major'.",
|
|
746935
|
+
code: CliError.Code.VersionError
|
|
746936
|
+
});
|
|
746800
746937
|
}
|
|
746801
746938
|
}
|
|
746802
746939
|
migrateThroughVersion({ version: version7, intermediateRepresentation, context: context3, targetGenerator }) {
|
|
@@ -746822,7 +746959,7 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
746822
746959
|
targetGenerator
|
|
746823
746960
|
});
|
|
746824
746961
|
if (!hasEncounteredMigrationYet) {
|
|
746825
|
-
context3.failAndThrow(`IR ${version7} does not exist
|
|
746962
|
+
context3.failAndThrow(`IR ${version7} does not exist`, void 0, { code: CliError.Code.VersionError });
|
|
746826
746963
|
}
|
|
746827
746964
|
return migrated;
|
|
746828
746965
|
}
|
|
@@ -746852,15 +746989,28 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
746852
746989
|
shouldRunMigration({ migration: migration23, targetGenerator }) {
|
|
746853
746990
|
const minVersionToExclude = migration23.firstGeneratorVersionToConsumeNewIR[targetGenerator.name];
|
|
746854
746991
|
if (minVersionToExclude == null) {
|
|
746855
|
-
throw new
|
|
746992
|
+
throw new CliError({
|
|
746993
|
+
message: `Cannot migrate intermediate representation. Unrecognized generator: ${targetGenerator.name}. If leveraging a custom generator, ensure you are specifying "ir-version" within the generator configuration.`,
|
|
746994
|
+
code: CliError.Code.ConfigError
|
|
746995
|
+
});
|
|
746856
746996
|
}
|
|
746857
746997
|
switch (minVersionToExclude) {
|
|
746858
746998
|
case GeneratorWasNeverUpdatedToConsumeNewIR:
|
|
746859
746999
|
return true;
|
|
746860
747000
|
case GeneratorWasNotCreatedYet:
|
|
746861
|
-
throw new
|
|
747001
|
+
throw new CliError({
|
|
747002
|
+
message: `Cannot migrate intermediate representation. Generator was created after intermediate representation ${migration23.laterVersion}.`,
|
|
747003
|
+
code: CliError.Code.VersionError
|
|
747004
|
+
});
|
|
747005
|
+
}
|
|
747006
|
+
try {
|
|
747007
|
+
return isVersionAhead(minVersionToExclude, targetGenerator.version);
|
|
747008
|
+
} catch (error50) {
|
|
747009
|
+
throw new CliError({
|
|
747010
|
+
message: `Failed to compare versions: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
747011
|
+
code: CliError.Code.VersionError
|
|
747012
|
+
});
|
|
746862
747013
|
}
|
|
746863
|
-
return isVersionAhead(minVersionToExclude, targetGenerator.version);
|
|
746864
747014
|
}
|
|
746865
747015
|
getIRVersionForGenerator({ targetGenerator }) {
|
|
746866
747016
|
let lastIrVersion = this.migrations[0]?.laterVersion;
|
|
@@ -786748,7 +786898,10 @@ function mergeEndpointPairs({ children: children2, findEndpointById, stringifyEn
|
|
|
786748
786898
|
}
|
|
786749
786899
|
const endpoint3 = findEndpointById(child.endpointId);
|
|
786750
786900
|
if (endpoint3 == null) {
|
|
786751
|
-
throw new
|
|
786901
|
+
throw new CliError({
|
|
786902
|
+
message: `Endpoint ${child.endpointId} not found`,
|
|
786903
|
+
code: CliError.Code.InternalError
|
|
786904
|
+
});
|
|
786752
786905
|
}
|
|
786753
786906
|
const methodAndPath = `${endpoint3.method} ${stringifyEndpointPathParts3(endpoint3)}`;
|
|
786754
786907
|
const existing = methodAndPathToEndpointNode.get(methodAndPath);
|
|
@@ -787752,7 +787905,9 @@ ${tagInfo.description}`;
|
|
|
787752
787905
|
getFileId(filepath) {
|
|
787753
787906
|
const fileId = this.collectedFileIds.get(filepath);
|
|
787754
787907
|
if (fileId == null) {
|
|
787755
|
-
return this.taskContext.failAndThrow("Failed to locate file after uploading: " + filepath
|
|
787908
|
+
return this.taskContext.failAndThrow("Failed to locate file after uploading: " + filepath, void 0, {
|
|
787909
|
+
code: CliError.Code.InternalError
|
|
787910
|
+
});
|
|
787756
787911
|
}
|
|
787757
787912
|
return fileId;
|
|
787758
787913
|
}
|
|
@@ -787794,7 +787949,10 @@ var NodeIdGenerator2 = class _NodeIdGenerator {
|
|
|
787794
787949
|
hashedId = this.#getHashedId(id);
|
|
787795
787950
|
loop++;
|
|
787796
787951
|
if (loop > 100) {
|
|
787797
|
-
throw new
|
|
787952
|
+
throw new CliError({
|
|
787953
|
+
message: `Infinite loop detected for id: ${id}`,
|
|
787954
|
+
code: CliError.Code.ReferenceError
|
|
787955
|
+
});
|
|
787798
787956
|
}
|
|
787799
787957
|
}
|
|
787800
787958
|
return hashedId;
|
|
@@ -792404,7 +792562,7 @@ var DocsDefinitionResolver = class {
|
|
|
792404
792562
|
_parsedDocsConfig;
|
|
792405
792563
|
get parsedDocsConfig() {
|
|
792406
792564
|
if (this._parsedDocsConfig == null) {
|
|
792407
|
-
throw new
|
|
792565
|
+
throw new CliError({ message: "parsedDocsConfig is not set", code: CliError.Code.InternalError });
|
|
792408
792566
|
}
|
|
792409
792567
|
return this._parsedDocsConfig;
|
|
792410
792568
|
}
|
|
@@ -792900,7 +793058,7 @@ var DocsDefinitionResolver = class {
|
|
|
792900
793058
|
A valid API configuration was not found at the path: fern/apis/${apiSection.apiName}.
|
|
792901
793059
|
Learn more about project structure:
|
|
792902
793060
|
https://buildwithfern.com/learn/docs/getting-started/project-structure#api-definitions` : "Failed to load API Definition referenced in docs.\nLearn more about project structure:\nhttps://buildwithfern.com/learn/docs/getting-started/project-structure#api-definitions";
|
|
792903
|
-
throw new
|
|
793061
|
+
throw new CliError({ message: errorMessage, code: CliError.Code.ConfigError });
|
|
792904
793062
|
}
|
|
792905
793063
|
getOpenApiWorkspaceForApiSection(apiSection) {
|
|
792906
793064
|
if (apiSection.apiName != null) {
|
|
@@ -792915,7 +793073,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
792915
793073
|
A valid API configuration was not found at the path: fern/apis/${apiSection.apiName}.
|
|
792916
793074
|
Learn more about project structure:
|
|
792917
793075
|
https://buildwithfern.com/learn/docs/getting-started/project-structure#api-definitions` : "Failed to load API Definition referenced in docs.\nLearn more about project structure:\nhttps://buildwithfern.com/learn/docs/getting-started/project-structure#api-definitions";
|
|
792918
|
-
throw new
|
|
793076
|
+
throw new CliError({ message: errorMessage, code: CliError.Code.ConfigError });
|
|
792919
793077
|
}
|
|
792920
793078
|
async toRootNode() {
|
|
792921
793079
|
const slug = navigation_exports.V1.SlugGenerator.init(navigation_exports.slugjoin(this.getDocsBasePath()));
|
|
@@ -792992,7 +793150,10 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
792992
793150
|
const id = this.#idgen.get("versioned");
|
|
792993
793151
|
const defaultVersion = versioned.versions[0];
|
|
792994
793152
|
if (defaultVersion?.hidden === true) {
|
|
792995
|
-
throw new
|
|
793153
|
+
throw new CliError({
|
|
793154
|
+
message: `The default version "${defaultVersion.version}" cannot be hidden. Please set a non-hidden version as the first version in your versions list, or remove the hidden flag from the default version.`,
|
|
793155
|
+
code: CliError.Code.ConfigError
|
|
793156
|
+
});
|
|
792996
793157
|
}
|
|
792997
793158
|
const BATCH_SIZE2 = 5;
|
|
792998
793159
|
const children2 = [];
|
|
@@ -793296,7 +793457,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
793296
793457
|
}
|
|
793297
793458
|
if (this.docsWorkspace.config.settings?.substituteEnvVars) {
|
|
793298
793459
|
ir10 = replaceEnvVariables(ir10, {
|
|
793299
|
-
onError: (e5) => this.taskContext.failAndThrow(`Error substituting environment variables in API spec: ${e5}
|
|
793460
|
+
onError: (e5) => this.taskContext.failAndThrow(`Error substituting environment variables in API spec: ${e5}`, void 0, { code: CliError.Code.EnvironmentError })
|
|
793300
793461
|
}, { substituteAsEmpty: false });
|
|
793301
793462
|
}
|
|
793302
793463
|
let graphqlWorkspace = openapiWorkspace;
|
|
@@ -793708,7 +793869,9 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
793708
793869
|
}
|
|
793709
793870
|
const fileId = this.collectedFileIds.get(filepath);
|
|
793710
793871
|
if (fileId == null) {
|
|
793711
|
-
return this.taskContext.failAndThrow("Failed to locate file after uploading: " + filepath
|
|
793872
|
+
return this.taskContext.failAndThrow("Failed to locate file after uploading: " + filepath, void 0, {
|
|
793873
|
+
code: CliError.Code.InternalError
|
|
793874
|
+
});
|
|
793712
793875
|
}
|
|
793713
793876
|
return DocsV1Write_exports.FileId(fileId);
|
|
793714
793877
|
}
|
|
@@ -793865,7 +794028,9 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
793865
794028
|
value: this.getFileId(value2)
|
|
793866
794029
|
}),
|
|
793867
794030
|
url: ({ value: value2 }) => ({ type: "url", value: DocsV1Write_exports.Url(value2) }),
|
|
793868
|
-
_other: () => this.taskContext.failAndThrow("Invalid metadata configuration"
|
|
794031
|
+
_other: () => this.taskContext.failAndThrow("Invalid metadata configuration", void 0, {
|
|
794032
|
+
code: CliError.Code.ConfigError
|
|
794033
|
+
})
|
|
793869
794034
|
});
|
|
793870
794035
|
}
|
|
793871
794036
|
/**
|
|
@@ -827068,7 +827233,10 @@ function collectLinksAndSources({ readFile: readFile104 = (path99) => (0, import
|
|
|
827068
827233
|
do {
|
|
827069
827234
|
loopCount++;
|
|
827070
827235
|
if (loopCount > LOOP_LIMIT) {
|
|
827071
|
-
throw new
|
|
827236
|
+
throw new CliError({
|
|
827237
|
+
message: "Infinite loop detected while collecting links and sources",
|
|
827238
|
+
code: CliError.Code.ReferenceError
|
|
827239
|
+
});
|
|
827072
827240
|
}
|
|
827073
827241
|
const popped = contentQueue.shift();
|
|
827074
827242
|
if (popped == null) {
|
|
@@ -827077,7 +827245,10 @@ function collectLinksAndSources({ readFile: readFile104 = (path99) => (0, import
|
|
|
827077
827245
|
const { content: content5, absoluteFilepath } = popped;
|
|
827078
827246
|
if (absoluteFilepath != null) {
|
|
827079
827247
|
if (visitedAbsoluteFilepaths.has(absoluteFilepath)) {
|
|
827080
|
-
throw new
|
|
827248
|
+
throw new CliError({
|
|
827249
|
+
message: `Circular import detected: ${absoluteFilepath}`,
|
|
827250
|
+
code: CliError.Code.ReferenceError
|
|
827251
|
+
});
|
|
827081
827252
|
}
|
|
827082
827253
|
visitedAbsoluteFilepaths.add(absoluteFilepath);
|
|
827083
827254
|
}
|
|
@@ -827294,7 +827465,7 @@ var ValidMarkdownLinks = {
|
|
|
827294
827465
|
const resolvedDocsDefinition = await docsDefinitionResolver.resolve();
|
|
827295
827466
|
const configRoot = resolvedDocsDefinition.config.root;
|
|
827296
827467
|
if (!configRoot || !isV1RootNode2(configRoot)) {
|
|
827297
|
-
throw new
|
|
827468
|
+
throw new CliError({ message: "Root node not found", code: CliError.Code.InternalError });
|
|
827298
827469
|
}
|
|
827299
827470
|
const root6 = navigation_exports.migrate.FernNavigationV1ToLatest.create().root(configRoot);
|
|
827300
827471
|
const collector = navigation_exports.NodeCollector.collect(root6);
|
|
@@ -830444,7 +830615,10 @@ function buildPreviewDomain({ orgId, previewId }) {
|
|
|
830444
830615
|
const availableSpace = SUBDOMAIN_LIMIT - prefix2.length;
|
|
830445
830616
|
const minIdLength = 8;
|
|
830446
830617
|
if (availableSpace < minIdLength) {
|
|
830447
|
-
throw new
|
|
830618
|
+
throw new CliError({
|
|
830619
|
+
message: `Organization name "${orgId}" is too long to generate a valid preview URL`,
|
|
830620
|
+
code: CliError.Code.ValidationError
|
|
830621
|
+
});
|
|
830448
830622
|
}
|
|
830449
830623
|
const truncatedId = sanitizedId.slice(0, availableSpace).replace(/-+$/, "");
|
|
830450
830624
|
return `${prefix2}${truncatedId}.${DOMAIN_SUFFIX}`;
|
|
@@ -832138,7 +832312,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
832138
832312
|
var LOGS_FOLDER_NAME = "logs";
|
|
832139
832313
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
832140
832314
|
function getCliSource() {
|
|
832141
|
-
const version7 = "4.
|
|
832315
|
+
const version7 = "4.83.0";
|
|
832142
832316
|
return `cli@${version7}`;
|
|
832143
832317
|
}
|
|
832144
832318
|
var DebugLogger = class {
|
|
@@ -832646,7 +832820,10 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
832646
832820
|
try {
|
|
832647
832821
|
const docsBundleZipResponse = await fetch(docsBundleUrl);
|
|
832648
832822
|
if (!docsBundleZipResponse.ok) {
|
|
832649
|
-
throw new
|
|
832823
|
+
throw new CliError({
|
|
832824
|
+
message: `Failed to download docs preview bundle. Status code: ${docsBundleZipResponse.status}`,
|
|
832825
|
+
code: CliError.Code.NetworkError
|
|
832826
|
+
});
|
|
832650
832827
|
}
|
|
832651
832828
|
const outputZipPath = join8(absoluteDirectoryToTmpDir, RelativeFilePath2.of(tryTar ? "output.tar.gz" : "output.zip"));
|
|
832652
832829
|
if (docsBundleZipResponse.body == null) {
|
|
@@ -832787,7 +832964,10 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
832787
832964
|
doNotPipeOutput: true
|
|
832788
832965
|
});
|
|
832789
832966
|
} catch (error50) {
|
|
832790
|
-
throw new
|
|
832967
|
+
throw new CliError({
|
|
832968
|
+
message: "Requires [pnpm] to run local development. Please run: npm install -g pnpm, and then: fern docs dev",
|
|
832969
|
+
code: CliError.Code.EnvironmentError
|
|
832970
|
+
});
|
|
832791
832971
|
}
|
|
832792
832972
|
try {
|
|
832793
832973
|
logger4.debug("Installing esbuild");
|
|
@@ -833086,7 +833266,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
833086
833266
|
const docsWorkspace = project.docsWorkspaces;
|
|
833087
833267
|
const apiWorkspaces = project.apiWorkspaces;
|
|
833088
833268
|
if (docsWorkspace == null) {
|
|
833089
|
-
throw new
|
|
833269
|
+
throw new CliError({ message: "No docs workspace found in project", code: CliError.Code.ConfigError });
|
|
833090
833270
|
}
|
|
833091
833271
|
if (editedAbsoluteFilepaths != null && previousDocsDefinition != null) {
|
|
833092
833272
|
const allMarkdownFiles = editedAbsoluteFilepaths.every((filepath) => filepath.endsWith(".mdx") || filepath.endsWith(".md"));
|
|
@@ -833657,7 +833837,10 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
833657
833837
|
try {
|
|
833658
833838
|
const url3 = "https://dev2-local-preview-bundle4.s3.amazonaws.com/";
|
|
833659
833839
|
if (url3 == null) {
|
|
833660
|
-
throw new
|
|
833840
|
+
throw new CliError({
|
|
833841
|
+
message: "Failed to connect to the docs preview server. Please contact support@buildwithfern.com",
|
|
833842
|
+
code: CliError.Code.InternalError
|
|
833843
|
+
});
|
|
833661
833844
|
}
|
|
833662
833845
|
await downloadBundle({
|
|
833663
833846
|
bucketUrl: url3,
|
|
@@ -833675,7 +833858,10 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
833675
833858
|
try {
|
|
833676
833859
|
const url3 = "https://dev2-local-preview-bundle3.s3.amazonaws.com/";
|
|
833677
833860
|
if (url3 == null) {
|
|
833678
|
-
throw new
|
|
833861
|
+
throw new CliError({
|
|
833862
|
+
message: "Failed to connect to the docs preview server. Please contact support@buildwithfern.com",
|
|
833863
|
+
code: CliError.Code.InternalError
|
|
833864
|
+
});
|
|
833679
833865
|
}
|
|
833680
833866
|
await downloadBundle({
|
|
833681
833867
|
bucketUrl: url3,
|
|
@@ -834145,7 +834331,10 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
|
|
|
834145
834331
|
try {
|
|
834146
834332
|
const url3 = "https://dev2-local-preview-bundle2.s3.amazonaws.com/";
|
|
834147
834333
|
if (url3 == null) {
|
|
834148
|
-
throw new
|
|
834334
|
+
throw new CliError({
|
|
834335
|
+
message: "Failed to connect to the docs preview server. Please contact support@buildwithfern.com",
|
|
834336
|
+
code: CliError.Code.InternalError
|
|
834337
|
+
});
|
|
834149
834338
|
}
|
|
834150
834339
|
await downloadBundle({ bucketUrl: url3, logger: context3.logger, preferCached: true, tryTar: false });
|
|
834151
834340
|
} catch (err) {
|
|
@@ -834827,7 +835016,16 @@ function createGeneratorsYmlAstVisitorForRules({ relativeFilepath, contents, all
|
|
|
834827
835016
|
|
|
834828
835017
|
// ../yaml/generators-validator/lib/rules/compatible-ir-versions/compatible-ir-versions.js
|
|
834829
835018
|
function getMaybeBadVersionMessage(generatorName, minCliVersion, cliVersion) {
|
|
834830
|
-
|
|
835019
|
+
let isAhead;
|
|
835020
|
+
try {
|
|
835021
|
+
isAhead = isVersionAhead(cliVersion, minCliVersion);
|
|
835022
|
+
} catch (error50) {
|
|
835023
|
+
throw new CliError({
|
|
835024
|
+
message: `Failed to compare versions: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
835025
|
+
code: CliError.Code.VersionError
|
|
835026
|
+
});
|
|
835027
|
+
}
|
|
835028
|
+
if (!isAhead) {
|
|
834831
835029
|
return [
|
|
834832
835030
|
{
|
|
834833
835031
|
severity: "fatal",
|
|
@@ -834962,7 +835160,7 @@ async function validateGeneratorsYmlFile({ contents, allRuleVisitors, cliVersion
|
|
|
834962
835160
|
var import_validate_npm_package_name = __toESM(require_lib18(), 1);
|
|
834963
835161
|
async function collectAPIWorkspaceViolations({ workspace, context: context3, ossWorkspace }) {
|
|
834964
835162
|
if (!(0, import_validate_npm_package_name.default)(workspace.definition.rootApiFile.contents.name).validForNewPackages) {
|
|
834965
|
-
context3.failAndThrow("API name is not valid.");
|
|
835163
|
+
context3.failAndThrow("API name is not valid.", void 0, { code: CliError.Code.ValidationError });
|
|
834966
835164
|
}
|
|
834967
835165
|
const startTime = performance.now();
|
|
834968
835166
|
const apiViolations = validateFernWorkspace(workspace, context3.logger);
|
|
@@ -835000,7 +835198,7 @@ async function validateAPIWorkspaceWithoutExiting({ workspace, context: context3
|
|
|
835000
835198
|
}
|
|
835001
835199
|
async function validateAPIWorkspaceAndLogIssues({ workspace, context: context3, logWarnings, ossWorkspace }) {
|
|
835002
835200
|
if (!(0, import_validate_npm_package_name.default)(workspace.definition.rootApiFile.contents.name).validForNewPackages) {
|
|
835003
|
-
context3.failAndThrow("API name is not valid.");
|
|
835201
|
+
context3.failAndThrow("API name is not valid.", void 0, { code: CliError.Code.ValidationError });
|
|
835004
835202
|
}
|
|
835005
835203
|
const { hasErrors } = await validateAPIWorkspaceWithoutExiting({
|
|
835006
835204
|
workspace,
|
|
@@ -835009,7 +835207,7 @@ async function validateAPIWorkspaceAndLogIssues({ workspace, context: context3,
|
|
|
835009
835207
|
ossWorkspace
|
|
835010
835208
|
});
|
|
835011
835209
|
if (hasErrors) {
|
|
835012
|
-
context3.failAndThrow();
|
|
835210
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ValidationError });
|
|
835013
835211
|
}
|
|
835014
835212
|
}
|
|
835015
835213
|
|
|
@@ -841438,11 +841636,17 @@ async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context:
|
|
|
841438
841636
|
} catch (err) {
|
|
841439
841637
|
context3.logger.error(`Parsing failed even after sanitization: ${extractErrorMessage(err)}`);
|
|
841440
841638
|
context3.logger.debug(`Sanitized JSON structure: ${JSON.stringify(sanitizedJson, null, 2)}`);
|
|
841441
|
-
throw new
|
|
841639
|
+
throw new CliError({
|
|
841640
|
+
message: `Failed to parse ${absolutePathOfConfiguration}: ${extractErrorMessage(err)}`,
|
|
841641
|
+
code: CliError.Code.ParseError
|
|
841642
|
+
});
|
|
841442
841643
|
}
|
|
841443
841644
|
} else {
|
|
841444
|
-
throw new
|
|
841445
|
-
|
|
841645
|
+
throw new CliError({
|
|
841646
|
+
message: `Failed to parse docs.yml:
|
|
841647
|
+
${result.error?.message ?? "Unknown error"}`,
|
|
841648
|
+
code: CliError.Code.ParseError
|
|
841649
|
+
});
|
|
841446
841650
|
}
|
|
841447
841651
|
}
|
|
841448
841652
|
|
|
@@ -843740,7 +843944,7 @@ var LegacyDocsPublisher = class {
|
|
|
843740
843944
|
previewId,
|
|
843741
843945
|
disableTemplates: void 0,
|
|
843742
843946
|
skipUpload,
|
|
843743
|
-
cliVersion: "4.
|
|
843947
|
+
cliVersion: "4.83.0"
|
|
843744
843948
|
});
|
|
843745
843949
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843746
843950
|
return { success: false };
|
|
@@ -900016,7 +900220,9 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
900016
900220
|
if (response.ok) {
|
|
900017
900221
|
organization = response.body.organizationId;
|
|
900018
900222
|
} else {
|
|
900019
|
-
taskContext.failAndThrow("Unauthorized. FERN_TOKEN is invalid."
|
|
900223
|
+
taskContext.failAndThrow("Unauthorized. FERN_TOKEN is invalid.", void 0, {
|
|
900224
|
+
code: CliError.Code.AuthError
|
|
900225
|
+
});
|
|
900020
900226
|
return { absolutePathToFernDirectory: AbsoluteFilePath2.of("/dummy"), organization: "dummy" };
|
|
900021
900227
|
}
|
|
900022
900228
|
}
|
|
@@ -900250,7 +900456,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
900250
900456
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
900251
900457
|
} else {
|
|
900252
900458
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
900253
|
-
context3.failWithoutThrowing();
|
|
900459
|
+
context3.failWithoutThrowing(void 0, void 0, { code: CliError.Code.ValidationError });
|
|
900254
900460
|
}
|
|
900255
900461
|
}
|
|
900256
900462
|
}
|
|
@@ -900556,9 +900762,21 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
900556
900762
|
await (0, import_promises113.mkdir)(directoryOfDefinition);
|
|
900557
900763
|
await (0, import_promises113.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
900558
900764
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
900559
|
-
|
|
900560
|
-
|
|
900561
|
-
|
|
900765
|
+
let formattedContent;
|
|
900766
|
+
try {
|
|
900767
|
+
formattedContent = await formatDefinitionFile({
|
|
900768
|
+
fileContents: SAMPLE_IMDB_API
|
|
900769
|
+
});
|
|
900770
|
+
} catch (error50) {
|
|
900771
|
+
if (error50 instanceof CliError) {
|
|
900772
|
+
throw error50;
|
|
900773
|
+
}
|
|
900774
|
+
throw new CliError({
|
|
900775
|
+
message: `Failed to format definition file: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
900776
|
+
code: CliError.Code.ParseError
|
|
900777
|
+
});
|
|
900778
|
+
}
|
|
900779
|
+
await (0, import_promises113.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
900562
900780
|
}
|
|
900563
900781
|
|
|
900564
900782
|
// ../init/lib/initializeAPI.js
|
|
@@ -900750,7 +900968,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
900750
900968
|
return this.nonTabbedNavigation;
|
|
900751
900969
|
}
|
|
900752
900970
|
addVersion({ versionConfig, navigation: navigation2 }) {
|
|
900753
|
-
throw new
|
|
900971
|
+
throw new CliError({ message: "Method not implemented.", code: CliError.Code.InternalError });
|
|
900754
900972
|
}
|
|
900755
900973
|
addNavbarLink({ link: link3 }) {
|
|
900756
900974
|
if (this.docsYml.navbarLinks == null) {
|
|
@@ -901182,7 +901400,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
901182
901400
|
if (Object.keys(this.tabUrlToInfo).length > 0) {
|
|
901183
901401
|
const tabUrl = getTabForMintItem({ mintItem });
|
|
901184
901402
|
if (tabUrl == null) {
|
|
901185
|
-
return this.context.failAndThrow(`Failed to assign navigation item to a tab group: ${mintItem.group}
|
|
901403
|
+
return this.context.failAndThrow(`Failed to assign navigation item to a tab group: ${mintItem.group}`, void 0, { code: CliError.Code.ConfigError });
|
|
901186
901404
|
}
|
|
901187
901405
|
const tab2 = this.tabUrlToInfo[tabUrl] ?? this.getDefaultDocumentationTab(builder);
|
|
901188
901406
|
return tab2.navigationBuilder;
|
|
@@ -901226,19 +901444,23 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
901226
901444
|
// ../init/lib/initializeWithMintlify.js
|
|
901227
901445
|
var initializeWithMintlify = async ({ pathToMintJson, taskContext, versionOfCli, organization }) => {
|
|
901228
901446
|
if (!pathToMintJson?.includes("mint.json")) {
|
|
901229
|
-
taskContext.failAndThrow("Provide a path to a mint.json file"
|
|
901447
|
+
taskContext.failAndThrow("Provide a path to a mint.json file", void 0, {
|
|
901448
|
+
code: CliError.Code.ConfigError
|
|
901449
|
+
});
|
|
901230
901450
|
return;
|
|
901231
901451
|
}
|
|
901232
901452
|
let absolutePathToMintJson = void 0;
|
|
901233
901453
|
if (isURL(pathToMintJson)) {
|
|
901234
|
-
taskContext.failAndThrow("Clone the repo locally and run this command again by referencing the path to the local mint.json file");
|
|
901454
|
+
taskContext.failAndThrow("Clone the repo locally and run this command again by referencing the path to the local mint.json file", void 0, { code: CliError.Code.ConfigError });
|
|
901235
901455
|
return;
|
|
901236
901456
|
} else {
|
|
901237
901457
|
absolutePathToMintJson = AbsoluteFilePath2.of(resolve6(cwd(), pathToMintJson));
|
|
901238
901458
|
}
|
|
901239
901459
|
const pathExists2 = await doesPathExist(absolutePathToMintJson);
|
|
901240
901460
|
if (!pathExists2 || !absolutePathToMintJson) {
|
|
901241
|
-
taskContext.failAndThrow(`${absolutePathToMintJson} does not exist
|
|
901461
|
+
taskContext.failAndThrow(`${absolutePathToMintJson} does not exist`, void 0, {
|
|
901462
|
+
code: CliError.Code.ConfigError
|
|
901463
|
+
});
|
|
901242
901464
|
return;
|
|
901243
901465
|
}
|
|
901244
901466
|
const outputPath = AbsoluteFilePath2.of(cwd());
|
|
@@ -901262,7 +901484,7 @@ function assertIsNumber(val) {
|
|
|
901262
901484
|
}
|
|
901263
901485
|
function assertIsDefined(val) {
|
|
901264
901486
|
if (val === void 0 || val == null) {
|
|
901265
|
-
throw new
|
|
901487
|
+
throw new CliError({ message: "Value is nullable.", code: CliError.Code.InternalError });
|
|
901266
901488
|
}
|
|
901267
901489
|
}
|
|
901268
901490
|
function assertIsStringArray(val) {
|
|
@@ -914125,7 +914347,7 @@ async function startPuppeteer() {
|
|
|
914125
914347
|
try {
|
|
914126
914348
|
return await launch3({ headless: true, args: ["--ignore-certificate-errors"] });
|
|
914127
914349
|
} catch (error50) {
|
|
914128
|
-
throw new
|
|
914350
|
+
throw new CliError({ message: "Could not create a Puppeteer instance", code: CliError.Code.EnvironmentError });
|
|
914129
914351
|
}
|
|
914130
914352
|
}
|
|
914131
914353
|
async function getHtmlWithPuppeteer(browser, url3) {
|
|
@@ -914150,18 +914372,18 @@ async function getHtmlWithPuppeteer(browser, url3) {
|
|
|
914150
914372
|
await page.close();
|
|
914151
914373
|
return content5;
|
|
914152
914374
|
} catch (error50) {
|
|
914153
|
-
throw new
|
|
914375
|
+
throw new CliError({ message: "Failed to download page from Puppeteer", code: CliError.Code.NetworkError });
|
|
914154
914376
|
}
|
|
914155
914377
|
}
|
|
914156
914378
|
async function fetchPageResponse(url3) {
|
|
914157
914379
|
try {
|
|
914158
914380
|
const res = await fetch(url3);
|
|
914159
914381
|
if (!res.ok) {
|
|
914160
|
-
throw new
|
|
914382
|
+
throw new CliError({ message: `${res.status} ${res.statusText}`, code: CliError.Code.NetworkError });
|
|
914161
914383
|
}
|
|
914162
914384
|
return await res.text();
|
|
914163
914385
|
} catch (error50) {
|
|
914164
|
-
throw new
|
|
914386
|
+
throw new CliError({ message: "Failed to fetch page from source", code: CliError.Code.NetworkError });
|
|
914165
914387
|
}
|
|
914166
914388
|
}
|
|
914167
914389
|
async function fetchPageHtml({ url: url3, browser }) {
|
|
@@ -914175,22 +914397,28 @@ async function fetchPageHtml({ url: url3, browser }) {
|
|
|
914175
914397
|
if (res) {
|
|
914176
914398
|
return res;
|
|
914177
914399
|
}
|
|
914178
|
-
throw new
|
|
914400
|
+
throw new CliError({ message: "An unknown error occurred.", code: CliError.Code.NetworkError });
|
|
914179
914401
|
} catch (error50) {
|
|
914180
|
-
throw new
|
|
914402
|
+
throw new CliError({
|
|
914403
|
+
message: `Error retrieving HTML for ${url3.toString()}`,
|
|
914404
|
+
code: CliError.Code.NetworkError
|
|
914405
|
+
});
|
|
914181
914406
|
}
|
|
914182
914407
|
}
|
|
914183
914408
|
async function fetchImage(url3) {
|
|
914184
914409
|
try {
|
|
914185
914410
|
const res = await exponentialBackoff(() => fetch(url3));
|
|
914186
914411
|
if (!res.ok) {
|
|
914187
|
-
throw new
|
|
914412
|
+
throw new CliError({ message: `${res.status} ${res.statusText}`, code: CliError.Code.NetworkError });
|
|
914188
914413
|
}
|
|
914189
914414
|
const imageBuffer = await res.arrayBuffer();
|
|
914190
914415
|
const imageData = new Uint8Array(imageBuffer);
|
|
914191
914416
|
return imageData;
|
|
914192
914417
|
} catch (error50) {
|
|
914193
|
-
throw new
|
|
914418
|
+
throw new CliError({
|
|
914419
|
+
message: `Failed to retrieve image from source url ${url3}`,
|
|
914420
|
+
code: CliError.Code.NetworkError
|
|
914421
|
+
});
|
|
914194
914422
|
}
|
|
914195
914423
|
}
|
|
914196
914424
|
|
|
@@ -914229,7 +914457,10 @@ async function writeImageToFile(src, rootPath) {
|
|
|
914229
914457
|
const filename = removeMetadataFromImageSrc(src);
|
|
914230
914458
|
const imagePath = (0, import_node_path40.join)(rootPath, filename);
|
|
914231
914459
|
if (!isValidImageSrc(filename)) {
|
|
914232
|
-
throw new
|
|
914460
|
+
throw new CliError({
|
|
914461
|
+
message: `${filename} - file extension not supported`,
|
|
914462
|
+
code: CliError.Code.InternalError
|
|
914463
|
+
});
|
|
914233
914464
|
}
|
|
914234
914465
|
if ((0, import_node_fs31.existsSync)(imagePath)) {
|
|
914235
914466
|
return imagePath;
|
|
@@ -914237,14 +914468,17 @@ async function writeImageToFile(src, rootPath) {
|
|
|
914237
914468
|
try {
|
|
914238
914469
|
(0, import_node_fs31.mkdirSync)((0, import_node_path40.dirname)(imagePath), { recursive: true });
|
|
914239
914470
|
} catch (error50) {
|
|
914240
|
-
throw new
|
|
914471
|
+
throw new CliError({ message: `${imagePath} - failed to create directory`, code: CliError.Code.InternalError });
|
|
914241
914472
|
}
|
|
914242
914473
|
try {
|
|
914243
914474
|
const imageData = await fetchImage(src);
|
|
914244
914475
|
write2(imagePath, imageData);
|
|
914245
914476
|
return imagePath;
|
|
914246
914477
|
} catch (error50) {
|
|
914247
|
-
throw new
|
|
914478
|
+
throw new CliError({
|
|
914479
|
+
message: `${imagePath}: failed to download file from source`,
|
|
914480
|
+
code: CliError.Code.NetworkError
|
|
914481
|
+
});
|
|
914248
914482
|
}
|
|
914249
914483
|
}
|
|
914250
914484
|
function isValidImageSrc(src) {
|
|
@@ -914623,7 +914857,9 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
914623
914857
|
// ../init/lib/initializeWithReadme.js
|
|
914624
914858
|
var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versionOfCli }) => {
|
|
914625
914859
|
if (!readmeUrl || !isURL(readmeUrl)) {
|
|
914626
|
-
taskContext.failAndThrow("Provide a URL to a readme-generated site"
|
|
914860
|
+
taskContext.failAndThrow("Provide a URL to a readme-generated site", void 0, {
|
|
914861
|
+
code: CliError.Code.ConfigError
|
|
914862
|
+
});
|
|
914627
914863
|
return;
|
|
914628
914864
|
}
|
|
914629
914865
|
const outputPath = AbsoluteFilePath2.of(cwd());
|
|
@@ -918984,7 +919220,7 @@ var CliContext = class _CliContext {
|
|
|
918984
919220
|
if (false) {
|
|
918985
919221
|
this.logger.error("CLI_VERSION is not defined");
|
|
918986
919222
|
}
|
|
918987
|
-
return "4.
|
|
919223
|
+
return "4.83.0";
|
|
918988
919224
|
}
|
|
918989
919225
|
getCliName() {
|
|
918990
919226
|
if (false) {
|
|
@@ -919286,7 +919522,9 @@ var import_promises127 = require("fs/promises");
|
|
|
919286
919522
|
async function loadProject({ context: context3, nameOverride, ...args }) {
|
|
919287
919523
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
919288
919524
|
if (fernDirectory == null) {
|
|
919289
|
-
return context3.failAndThrow(`Directory "${nameOverride ?? FERN_DIRECTORY}" not found
|
|
919525
|
+
return context3.failAndThrow(`Directory "${nameOverride ?? FERN_DIRECTORY}" not found.`, void 0, {
|
|
919526
|
+
code: CliError.Code.ConfigError
|
|
919527
|
+
});
|
|
919290
919528
|
}
|
|
919291
919529
|
return await loadProjectFromDirectory({
|
|
919292
919530
|
absolutePathToFernDirectory: fernDirectory,
|
|
@@ -919327,7 +919565,7 @@ Or one of the following directories:
|
|
|
919327
919565
|
\u203A ${ASYNCAPI_DIRECTORY}/
|
|
919328
919566
|
For more information:
|
|
919329
919567
|
\u203A SDK project structure: https://buildwithfern.com/learn/api-definitions/overview/project-structure
|
|
919330
|
-
\u203A Docs project structure: https://buildwithfern.com/learn/docs/getting-started/project-structure
|
|
919568
|
+
\u203A Docs project structure: https://buildwithfern.com/learn/docs/getting-started/project-structure`, void 0, { code: CliError.Code.ConfigError });
|
|
919331
919569
|
}
|
|
919332
919570
|
return {
|
|
919333
919571
|
config: await loadProjectConfig({ directory: absolutePathToFernDirectory, context: context3 }),
|
|
@@ -919354,10 +919592,12 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
919354
919592
|
}, []);
|
|
919355
919593
|
if (commandLineApiWorkspace != null) {
|
|
919356
919594
|
if (!apiWorkspaceDirectoryNames.includes(commandLineApiWorkspace)) {
|
|
919357
|
-
return context3.failAndThrow("API does not exist: " + commandLineApiWorkspace
|
|
919595
|
+
return context3.failAndThrow("API does not exist: " + commandLineApiWorkspace, void 0, {
|
|
919596
|
+
code: CliError.Code.ConfigError
|
|
919597
|
+
});
|
|
919358
919598
|
}
|
|
919359
919599
|
} else if (apiWorkspaceDirectoryNames.length === 0) {
|
|
919360
|
-
return context3.failAndThrow("No APIs found.");
|
|
919600
|
+
return context3.failAndThrow("No APIs found.", void 0, { code: CliError.Code.ConfigError });
|
|
919361
919601
|
} else if (apiWorkspaceDirectoryNames.length > 1 && !defaultToAllApiWorkspaces) {
|
|
919362
919602
|
let message = "There are multiple workspaces. You must specify one with --api:\n";
|
|
919363
919603
|
const longestWorkspaceName = Math.max(...apiWorkspaceDirectoryNames.map((workspaceName) => workspaceName.length));
|
|
@@ -919365,7 +919605,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
919365
919605
|
const suggestedCommand = `${cliName} ${process.argv.slice(2).join(" ")} --api ${workspaceName}`;
|
|
919366
919606
|
return ` \u203A ${source_default.bold(workspaceName.padEnd(longestWorkspaceName))} ${source_default.dim(suggestedCommand)}`;
|
|
919367
919607
|
}).join("\n");
|
|
919368
|
-
return context3.failAndThrow(message);
|
|
919608
|
+
return context3.failAndThrow(message, void 0, { code: CliError.Code.ConfigError });
|
|
919369
919609
|
}
|
|
919370
919610
|
const apiWorkspaces = [];
|
|
919371
919611
|
const filteredWorkspaces = commandLineApiWorkspace != null ? apiWorkspaceDirectoryNames.filter((api2) => {
|
|
@@ -919382,7 +919622,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
919382
919622
|
apiWorkspaces.push(workspace2.workspace);
|
|
919383
919623
|
} else {
|
|
919384
919624
|
handleFailedWorkspaceParserResult(workspace2, context3.logger);
|
|
919385
|
-
context3.failAndThrow();
|
|
919625
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ConfigError });
|
|
919386
919626
|
}
|
|
919387
919627
|
}));
|
|
919388
919628
|
return apiWorkspaces;
|
|
@@ -925647,7 +925887,10 @@ function renderCompoundPage(compound, meta5) {
|
|
|
925647
925887
|
return renderVariablePage(compound.data, meta5);
|
|
925648
925888
|
default: {
|
|
925649
925889
|
const _exhaustive = compound;
|
|
925650
|
-
throw new
|
|
925890
|
+
throw new CliError({
|
|
925891
|
+
message: `Unknown compound kind: ${JSON.stringify(_exhaustive)}`,
|
|
925892
|
+
code: CliError.Code.InternalError
|
|
925893
|
+
});
|
|
925651
925894
|
}
|
|
925652
925895
|
}
|
|
925653
925896
|
}
|
|
@@ -925941,7 +926184,10 @@ function categoryFolderForCompound(collected) {
|
|
|
925941
926184
|
return "variables";
|
|
925942
926185
|
default: {
|
|
925943
926186
|
const _exhaustive = collected.compound;
|
|
925944
|
-
throw new
|
|
926187
|
+
throw new CliError({
|
|
926188
|
+
message: `Unknown compound kind: ${JSON.stringify(_exhaustive)}`,
|
|
926189
|
+
code: CliError.Code.InternalError
|
|
926190
|
+
});
|
|
925945
926191
|
}
|
|
925946
926192
|
}
|
|
925947
926193
|
}
|
|
@@ -927203,7 +927449,10 @@ function resolveTarget({
|
|
|
927203
927449
|
return { type: "id", value: id };
|
|
927204
927450
|
}
|
|
927205
927451
|
if (target == null) {
|
|
927206
|
-
throw new
|
|
927452
|
+
throw new CliError({
|
|
927453
|
+
message: "Must provide a preview URL or --id.",
|
|
927454
|
+
code: CliError.Code.ConfigError
|
|
927455
|
+
});
|
|
927207
927456
|
}
|
|
927208
927457
|
if (isPreviewUrl(target)) {
|
|
927209
927458
|
return { type: "url", value: target };
|
|
@@ -930646,7 +930895,7 @@ var JsonSchemaConverterContext = class {
|
|
|
930646
930895
|
this.context.logger.error(`Type ${typeName} not found`);
|
|
930647
930896
|
} else {
|
|
930648
930897
|
}
|
|
930649
|
-
return this.context.failAndThrow();
|
|
930898
|
+
return this.context.failAndThrow(void 0, void 0, { code: CliError.Code.ReferenceError });
|
|
930650
930899
|
}
|
|
930651
930900
|
return typeDeclaration2;
|
|
930652
930901
|
}
|
|
@@ -939621,10 +939870,16 @@ function addDocsPreviewDeleteCommand(cli, cliContext) {
|
|
|
939621
939870
|
}).check((argv) => {
|
|
939622
939871
|
const sources = [argv.target, argv.url, argv.id].filter(Boolean);
|
|
939623
939872
|
if (sources.length === 0) {
|
|
939624
|
-
throw new
|
|
939873
|
+
throw new CliError({
|
|
939874
|
+
message: "Must provide a preview URL or --id.",
|
|
939875
|
+
code: CliError.Code.ConfigError
|
|
939876
|
+
});
|
|
939625
939877
|
}
|
|
939626
939878
|
if (sources.length > 1) {
|
|
939627
|
-
throw new
|
|
939879
|
+
throw new CliError({
|
|
939880
|
+
message: "Provide only one of: [target], --url, or --id.",
|
|
939881
|
+
code: CliError.Code.ConfigError
|
|
939882
|
+
});
|
|
939628
939883
|
}
|
|
939629
939884
|
return true;
|
|
939630
939885
|
}),
|