@fern-api/fern-api-dev 4.81.0-3-gaa0d9a2b5d2 → 4.81.0-9-ge0476cd3e22
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 +430 -138
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -535712,7 +535712,7 @@ async function validateSchema({ schema: schema2, value: value2, context: context
|
|
|
535712
535712
|
});
|
|
535713
535713
|
});
|
|
535714
535714
|
const errorMessage = [`Failed to parse file: ${import_path20.default.relative(process.cwd(), filepathBeingParsed)}`, ...issues].join("\n");
|
|
535715
|
-
return context3.failAndThrow(errorMessage);
|
|
535715
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
535716
535716
|
}
|
|
535717
535717
|
function joinZodPath(arr) {
|
|
535718
535718
|
return arr.reduce((acc, value2) => {
|
|
@@ -535745,7 +535745,9 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535745
535745
|
path: versionOrPath
|
|
535746
535746
|
};
|
|
535747
535747
|
} else {
|
|
535748
|
-
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}
|
|
535748
|
+
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}`, void 0, {
|
|
535749
|
+
code: CliError.Code.ConfigError
|
|
535750
|
+
});
|
|
535749
535751
|
}
|
|
535750
535752
|
} else {
|
|
535751
535753
|
const unprefixedCoordinate = coordinate.substring(1);
|
|
@@ -535760,12 +535762,14 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535760
535762
|
version: versionOrPath
|
|
535761
535763
|
};
|
|
535762
535764
|
} else {
|
|
535763
|
-
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}
|
|
535765
|
+
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}`, void 0, {
|
|
535766
|
+
code: CliError.Code.ConfigError
|
|
535767
|
+
});
|
|
535764
535768
|
}
|
|
535765
535769
|
}
|
|
535766
535770
|
}
|
|
535767
535771
|
if (context3.getResult() === TaskResult.Failure) {
|
|
535768
|
-
context3.failAndThrow();
|
|
535772
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ConfigError });
|
|
535769
535773
|
}
|
|
535770
535774
|
return {
|
|
535771
535775
|
dependencies
|
|
@@ -535921,7 +535925,7 @@ function getColorInstanceFromRawConfigOrThrow(raw, context3, key2, theme) {
|
|
|
535921
535925
|
}
|
|
535922
535926
|
const instance = tinycolor(color3);
|
|
535923
535927
|
if (!instance.isValid()) {
|
|
535924
|
-
context3.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF
|
|
535928
|
+
context3.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF`, void 0, { code: CliError.Code.ConfigError });
|
|
535925
535929
|
}
|
|
535926
535930
|
return instance;
|
|
535927
535931
|
}
|
|
@@ -536535,7 +536539,7 @@ async function parseContext7File({ rawPath, absoluteFilepathToDocsConfig, contex
|
|
|
536535
536539
|
try {
|
|
536536
536540
|
JSON.parse(contents);
|
|
536537
536541
|
} catch (error50) {
|
|
536538
|
-
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50));
|
|
536542
|
+
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50), { code: CliError.Code.ConfigError });
|
|
536539
536543
|
}
|
|
536540
536544
|
return absolutePath;
|
|
536541
536545
|
}
|
|
@@ -536695,7 +536699,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536695
536699
|
featureFlags: convertFeatureFlag(product.featureFlag)
|
|
536696
536700
|
});
|
|
536697
536701
|
} else {
|
|
536698
|
-
throw new
|
|
536702
|
+
throw new CliError({
|
|
536703
|
+
message: `Invalid product configuration: product must have either 'path' or valid 'href' property`,
|
|
536704
|
+
code: CliError.Code.ConfigError
|
|
536705
|
+
});
|
|
536699
536706
|
}
|
|
536700
536707
|
}
|
|
536701
536708
|
return {
|
|
@@ -536710,7 +536717,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536710
536717
|
folderTitleSource
|
|
536711
536718
|
});
|
|
536712
536719
|
}
|
|
536713
|
-
throw new
|
|
536720
|
+
throw new CliError({
|
|
536721
|
+
message: "Unexpected. Docs have neither navigation or versions defined.",
|
|
536722
|
+
code: CliError.Code.ConfigError
|
|
536723
|
+
});
|
|
536714
536724
|
}
|
|
536715
536725
|
function convertFeatureFlag(flag) {
|
|
536716
536726
|
if (flag == null) {
|
|
@@ -536808,7 +536818,10 @@ function parseWeight(weight) {
|
|
|
536808
536818
|
async function convertNavigationTabConfiguration({ tabs, item, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536809
536819
|
const tab2 = tabs[item.tab];
|
|
536810
536820
|
if (tab2 == null) {
|
|
536811
|
-
throw new
|
|
536821
|
+
throw new CliError({
|
|
536822
|
+
message: `Tab ${item.tab} is not defined in the tabs config.`,
|
|
536823
|
+
code: CliError.Code.ConfigError
|
|
536824
|
+
});
|
|
536812
536825
|
}
|
|
536813
536826
|
if (tabbedNavigationItemHasVariants(item)) {
|
|
536814
536827
|
const variants = await Promise.all(item.variants.map(async (variant) => {
|
|
@@ -536937,7 +536950,9 @@ var DEFAULT_CHANGELOG_TITLE = "Changelog";
|
|
|
536937
536950
|
async function expandFolderConfiguration({ rawConfig, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536938
536951
|
const folderPath = resolveFilepath(rawConfig.folder, absolutePathToConfig);
|
|
536939
536952
|
if (!await doesPathExist(folderPath)) {
|
|
536940
|
-
context3.failAndThrow(`Folder not found: ${rawConfig.folder}
|
|
536953
|
+
context3.failAndThrow(`Folder not found: ${rawConfig.folder}`, void 0, {
|
|
536954
|
+
code: CliError.Code.ConfigError
|
|
536955
|
+
});
|
|
536941
536956
|
}
|
|
536942
536957
|
validateCollapsibleConfig({
|
|
536943
536958
|
context: context3,
|
|
@@ -537260,7 +537275,10 @@ function parseLibrariesConfiguration(libraries) {
|
|
|
537260
537275
|
const result = {};
|
|
537261
537276
|
for (const [name2, config5] of Object.entries(libraries)) {
|
|
537262
537277
|
if (!isGitLibraryInput(config5.input)) {
|
|
537263
|
-
throw new
|
|
537278
|
+
throw new CliError({
|
|
537279
|
+
message: `Library '${name2}' uses 'path' input which is not yet supported. Please use 'git' input.`,
|
|
537280
|
+
code: CliError.Code.ConfigError
|
|
537281
|
+
});
|
|
537264
537282
|
}
|
|
537265
537283
|
result[name2] = {
|
|
537266
537284
|
input: {
|
|
@@ -537449,10 +537467,10 @@ function parseAudiences(raw) {
|
|
|
537449
537467
|
}
|
|
537450
537468
|
function validateCollapsibleConfig({ context: context3, sectionTitle, collapsed, collapsible, collapsedByDefault }) {
|
|
537451
537469
|
if (collapsible != null && collapsed != null) {
|
|
537452
|
-
context3.failAndThrow(`Section "${sectionTitle}": cannot use both "collapsible" and the deprecated "collapsed" property. Please use "collapsible" and "collapsed-by-default" instead
|
|
537470
|
+
context3.failAndThrow(`Section "${sectionTitle}": cannot use both "collapsible" and the deprecated "collapsed" property. Please use "collapsible" and "collapsed-by-default" instead.`, void 0, { code: CliError.Code.ConfigError });
|
|
537453
537471
|
}
|
|
537454
537472
|
if (collapsedByDefault != null && collapsible !== true) {
|
|
537455
|
-
context3.failAndThrow(`Section "${sectionTitle}": "collapsed-by-default" requires "collapsible: true". "collapsed-by-default" has no effect on a non-collapsible section
|
|
537473
|
+
context3.failAndThrow(`Section "${sectionTitle}": "collapsed-by-default" requires "collapsible: true". "collapsed-by-default" has no effect on a non-collapsible section.`, void 0, { code: CliError.Code.ConfigError });
|
|
537456
537474
|
}
|
|
537457
537475
|
}
|
|
537458
537476
|
|
|
@@ -537727,7 +537745,9 @@ function removeDefaultDockerOrgIfPresent(generatorName) {
|
|
|
537727
537745
|
function getGeneratorNameOrThrow(generatorName, context3) {
|
|
537728
537746
|
const normalizedGeneratorName = normalizeGeneratorName(generatorName);
|
|
537729
537747
|
if (normalizedGeneratorName == null) {
|
|
537730
|
-
return context3.failAndThrow("Unrecognized generator: " + generatorName
|
|
537748
|
+
return context3.failAndThrow("Unrecognized generator: " + generatorName, void 0, {
|
|
537749
|
+
code: CliError.Code.ConfigError
|
|
537750
|
+
});
|
|
537731
537751
|
}
|
|
537732
537752
|
return normalizedGeneratorName;
|
|
537733
537753
|
}
|
|
@@ -537854,9 +537874,9 @@ async function updateGeneratorGroup({ generatorsConfiguration, groupName = gener
|
|
|
537854
537874
|
const availableGroups = Object.keys(generatorsConfiguration.groups ?? {});
|
|
537855
537875
|
if (availableGroups.length > 0) {
|
|
537856
537876
|
const message = "No group specified. Use the --group option:\n" + availableGroups.map((name2) => ` \u203A ${name2}`).join("\n");
|
|
537857
|
-
return context3.failAndThrow(message);
|
|
537877
|
+
return context3.failAndThrow(message, void 0, { code: CliError.Code.ConfigError });
|
|
537858
537878
|
}
|
|
537859
|
-
return context3.failAndThrow("No group specified.");
|
|
537879
|
+
return context3.failAndThrow("No group specified.", void 0, { code: CliError.Code.ConfigError });
|
|
537860
537880
|
}
|
|
537861
537881
|
const groups2 = generatorsConfiguration.groups ??= {};
|
|
537862
537882
|
const group = groups2[groupName];
|
|
@@ -537880,7 +537900,9 @@ async function addGenerator({ generatorName, generatorsConfiguration, groupName
|
|
|
537880
537900
|
context: context3,
|
|
537881
537901
|
update: async (group) => {
|
|
537882
537902
|
if (group.generators.some((generator) => addDefaultDockerOrgIfNotPresent("image" in generator ? generator.image.name : generator.name) === normalizedGeneratorName)) {
|
|
537883
|
-
context3.failAndThrow(`${generatorName} is already installed in group ${groupName}
|
|
537903
|
+
context3.failAndThrow(`${generatorName} is already installed in group ${groupName}.`, void 0, {
|
|
537904
|
+
code: CliError.Code.ConfigError
|
|
537905
|
+
});
|
|
537884
537906
|
}
|
|
537885
537907
|
const latestVersion2 = await getLatestGeneratorVersion({
|
|
537886
537908
|
cliVersion,
|
|
@@ -544443,7 +544465,10 @@ function parseRemoveDiscriminantsFromSchemas(option) {
|
|
|
544443
544465
|
} else if (option === "never") {
|
|
544444
544466
|
return generators_yml_exports.RemoveDiscriminantsFromSchemas.Never;
|
|
544445
544467
|
}
|
|
544446
|
-
throw new
|
|
544468
|
+
throw new CliError({
|
|
544469
|
+
message: `Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${option}`,
|
|
544470
|
+
code: CliError.Code.ConfigError
|
|
544471
|
+
});
|
|
544447
544472
|
}
|
|
544448
544473
|
function mergeSettings(base4, override) {
|
|
544449
544474
|
return {
|
|
@@ -545010,7 +545035,10 @@ async function getGithubLicense({ absolutePathToGeneratorsConfiguration, githubL
|
|
|
545010
545035
|
function getGithubPublishInfo(output2, maybeGroupLevelMetadata, maybeTopLevelMetadata) {
|
|
545011
545036
|
switch (output2.location) {
|
|
545012
545037
|
case "local-file-system":
|
|
545013
|
-
throw new
|
|
545038
|
+
throw new CliError({
|
|
545039
|
+
message: "Cannot use local-file-system with github publishing",
|
|
545040
|
+
code: CliError.Code.ConfigError
|
|
545041
|
+
});
|
|
545014
545042
|
case "npm":
|
|
545015
545043
|
return api_exports4.GithubPublishInfo.npm({
|
|
545016
545044
|
registryUrl: output2.url ?? "https://registry.npmjs.org",
|
|
@@ -545203,7 +545231,10 @@ async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context
|
|
|
545203
545231
|
if (parsed.ok) {
|
|
545204
545232
|
return parsed.value;
|
|
545205
545233
|
}
|
|
545206
|
-
throw new
|
|
545234
|
+
throw new CliError({
|
|
545235
|
+
message: parsed.errors.map((e5) => e5.message).join("\n"),
|
|
545236
|
+
code: CliError.Code.ConfigError
|
|
545237
|
+
});
|
|
545207
545238
|
} catch (e5) {
|
|
545208
545239
|
if (e5 instanceof jsYaml.YAMLException) {
|
|
545209
545240
|
const relativePath = import_path24.default.relative(process.cwd(), filepath);
|
|
@@ -545225,7 +545256,7 @@ ${e5.mark.snippet}`;
|
|
|
545225
545256
|
errorMessage += '\n\nHint: Values starting with "@" (such as scoped npm packages) must be wrapped in quotes.\n Example: package-name: "@scope/package"';
|
|
545226
545257
|
}
|
|
545227
545258
|
}
|
|
545228
|
-
context3.failAndThrow(errorMessage);
|
|
545259
|
+
context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
545229
545260
|
} else {
|
|
545230
545261
|
throw e5;
|
|
545231
545262
|
}
|
|
@@ -551709,7 +551740,7 @@ function parseTypeName({ typeName, file: file4 }) {
|
|
|
551709
551740
|
imports: file4.imports
|
|
551710
551741
|
});
|
|
551711
551742
|
if (reference4 == null) {
|
|
551712
|
-
throw new
|
|
551743
|
+
throw new CliError({ message: "Failed to locate type: " + typeName, code: CliError.Code.ResolutionError });
|
|
551713
551744
|
}
|
|
551714
551745
|
const nameWithoutId = {
|
|
551715
551746
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -551919,7 +551950,7 @@ function convertHttpRequestBody({ request: request7, file: file4 }) {
|
|
|
551919
551950
|
}
|
|
551920
551951
|
if (isInlineRequestBody(request7.body)) {
|
|
551921
551952
|
if (request7.name == null) {
|
|
551922
|
-
throw new
|
|
551953
|
+
throw new CliError({ message: "Name is missing for inlined request", code: CliError.Code.InternalError });
|
|
551923
551954
|
}
|
|
551924
551955
|
return HttpRequestBody.inlinedRequestBody({
|
|
551925
551956
|
name: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552009,13 +552040,19 @@ function getObjectPropertyFromResolvedType({ typeResolver, file: file4, resolved
|
|
|
552009
552040
|
default:
|
|
552010
552041
|
assertNever(resolvedType);
|
|
552011
552042
|
}
|
|
552012
|
-
throw new
|
|
552043
|
+
throw new CliError({
|
|
552044
|
+
message: "Internal error; response must be an object in order to return a property as a response",
|
|
552045
|
+
code: CliError.Code.InternalError
|
|
552046
|
+
});
|
|
552013
552047
|
}
|
|
552014
552048
|
function getObjectPropertyFromObjectSchema({ typeResolver, file: file4, objectSchema, property: property24 }) {
|
|
552015
552049
|
const properties7 = getAllPropertiesForRawObjectSchema(objectSchema, file4, typeResolver);
|
|
552016
552050
|
const objectProperty = properties7[property24];
|
|
552017
552051
|
if (objectProperty == null) {
|
|
552018
|
-
throw new
|
|
552052
|
+
throw new CliError({
|
|
552053
|
+
message: `Object does not have a property named ${property24}.`,
|
|
552054
|
+
code: CliError.Code.ReferenceError
|
|
552055
|
+
});
|
|
552019
552056
|
}
|
|
552020
552057
|
return objectProperty;
|
|
552021
552058
|
}
|
|
@@ -552048,7 +552085,10 @@ function getAllPropertiesForExtendedType(extendedType, file4, typeResolver) {
|
|
|
552048
552085
|
if (resolvedType._type === "named" && isRawObjectDefinition(resolvedType.declaration)) {
|
|
552049
552086
|
return getAllPropertiesForRawObjectSchema(resolvedType.declaration, file4, typeResolver);
|
|
552050
552087
|
}
|
|
552051
|
-
throw new
|
|
552088
|
+
throw new CliError({
|
|
552089
|
+
message: `Extended type ${extendedType} must be another named type`,
|
|
552090
|
+
code: CliError.Code.InternalError
|
|
552091
|
+
});
|
|
552052
552092
|
}
|
|
552053
552093
|
|
|
552054
552094
|
// ../generation/ir-generator/lib/converters/services/convertProperty.js
|
|
@@ -552112,7 +552152,10 @@ function getPropertyTypeFromObjectSchema({ typeResolver, file: file4, objectSche
|
|
|
552112
552152
|
});
|
|
552113
552153
|
const propertyType = properties7[property24];
|
|
552114
552154
|
if (propertyType == null) {
|
|
552115
|
-
throw new
|
|
552155
|
+
throw new CliError({
|
|
552156
|
+
message: `Response does not have a property named ${property24}.`,
|
|
552157
|
+
code: CliError.Code.ReferenceError
|
|
552158
|
+
});
|
|
552116
552159
|
}
|
|
552117
552160
|
return propertyType;
|
|
552118
552161
|
}
|
|
@@ -552153,7 +552196,10 @@ function getAllPropertiesForExtendedType2({ typeResolver, file: file4, extendedT
|
|
|
552153
552196
|
objectSchema: resolvedType.declaration
|
|
552154
552197
|
});
|
|
552155
552198
|
}
|
|
552156
|
-
throw new
|
|
552199
|
+
throw new CliError({
|
|
552200
|
+
message: `Extended type ${extendedType} must be another named type.`,
|
|
552201
|
+
code: CliError.Code.InternalError
|
|
552202
|
+
});
|
|
552157
552203
|
}
|
|
552158
552204
|
function maybeFileFromResolvedType(resolvedType) {
|
|
552159
552205
|
if (resolvedType == null) {
|
|
@@ -552209,7 +552255,7 @@ function convertHttpSdkRequest({ request: request7, endpointKey, endpoint: endpo
|
|
|
552209
552255
|
function convertHttpSdkRequestShape({ service, request: request7, file: file4, typeResolver }) {
|
|
552210
552256
|
const constructWrapper = () => {
|
|
552211
552257
|
if (typeof request7 === "string" || request7?.name == null) {
|
|
552212
|
-
throw new
|
|
552258
|
+
throw new CliError({ message: "Name is missing for request wrapper", code: CliError.Code.InternalError });
|
|
552213
552259
|
}
|
|
552214
552260
|
return SdkRequestShape.wrapper({
|
|
552215
552261
|
wrapperName: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552389,7 +552435,7 @@ function parseErrorName({ errorName, file: file4 }) {
|
|
|
552389
552435
|
imports: file4.imports
|
|
552390
552436
|
});
|
|
552391
552437
|
if (reference4 == null) {
|
|
552392
|
-
throw new
|
|
552438
|
+
throw new CliError({ message: "Failed to locate error " + errorName, code: CliError.Code.ResolutionError });
|
|
552393
552439
|
}
|
|
552394
552440
|
const nameWithoutId = {
|
|
552395
552441
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -552859,7 +552905,10 @@ function validateObjectExample({ typeName, typeNameForBreadcrumb, rawObject, fil
|
|
|
552859
552905
|
} else {
|
|
552860
552906
|
const definitionFile = getDefinitionFile(workspace, propertyWithPath.filepathOfDeclaration);
|
|
552861
552907
|
if (definitionFile == null) {
|
|
552862
|
-
throw new
|
|
552908
|
+
throw new CliError({
|
|
552909
|
+
message: "Service file does not exist for property: " + propertyWithPath.wireKey,
|
|
552910
|
+
code: CliError.Code.InternalError
|
|
552911
|
+
});
|
|
552863
552912
|
}
|
|
552864
552913
|
violations.push(...validateTypeReferenceExample({
|
|
552865
552914
|
rawTypeReference: propertyWithPath.propertyType,
|
|
@@ -553334,7 +553383,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553334
553383
|
base64: () => validateString(example),
|
|
553335
553384
|
bigInteger: () => validateString(example),
|
|
553336
553385
|
_other: () => {
|
|
553337
|
-
throw new
|
|
553386
|
+
throw new CliError({
|
|
553387
|
+
message: "Unknown primitive type v2: " + primitiveType2.v2,
|
|
553388
|
+
code: CliError.Code.InternalError
|
|
553389
|
+
});
|
|
553338
553390
|
}
|
|
553339
553391
|
});
|
|
553340
553392
|
}
|
|
@@ -553354,7 +553406,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553354
553406
|
base64: () => validateString(example),
|
|
553355
553407
|
bigInteger: () => validateString(example),
|
|
553356
553408
|
_other: () => {
|
|
553357
|
-
throw new
|
|
553409
|
+
throw new CliError({
|
|
553410
|
+
message: "Unknown primitive type: " + primitiveType2.v1,
|
|
553411
|
+
code: CliError.Code.InternalError
|
|
553412
|
+
});
|
|
553358
553413
|
}
|
|
553359
553414
|
});
|
|
553360
553415
|
}
|
|
@@ -553577,7 +553632,10 @@ function convertEnumTypeDeclaration({ _enum: _enum3, file: file4 }) {
|
|
|
553577
553632
|
if (_enum3.default != null) {
|
|
553578
553633
|
defaultValue = values2.find((enumValue) => getWireValue(enumValue.name) === _enum3.default);
|
|
553579
553634
|
if (defaultValue == null) {
|
|
553580
|
-
throw new
|
|
553635
|
+
throw new CliError({
|
|
553636
|
+
message: `Default value ${_enum3.default} not found in enum values`,
|
|
553637
|
+
code: CliError.Code.ValidationError
|
|
553638
|
+
});
|
|
553581
553639
|
}
|
|
553582
553640
|
}
|
|
553583
553641
|
return {
|
|
@@ -553646,18 +553704,27 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553646
553704
|
discriminatedUnion: (rawUnion) => {
|
|
553647
553705
|
const discriminant21 = getUnionDiscriminant(rawUnion);
|
|
553648
553706
|
if (!isPlainObject4(example)) {
|
|
553649
|
-
throw new
|
|
553707
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553650
553708
|
}
|
|
553651
553709
|
const discriminantValueForExample = example[discriminant21];
|
|
553652
553710
|
if (discriminantValueForExample == null) {
|
|
553653
|
-
throw new
|
|
553711
|
+
throw new CliError({
|
|
553712
|
+
message: "Example is missing discriminant: " + discriminant21,
|
|
553713
|
+
code: CliError.Code.ValidationError
|
|
553714
|
+
});
|
|
553654
553715
|
}
|
|
553655
553716
|
if (typeof discriminantValueForExample !== "string") {
|
|
553656
|
-
throw new
|
|
553717
|
+
throw new CliError({
|
|
553718
|
+
message: "Discriminant value is not a string",
|
|
553719
|
+
code: CliError.Code.ValidationError
|
|
553720
|
+
});
|
|
553657
553721
|
}
|
|
553658
553722
|
const rawSingleUnionType = rawUnion.union[discriminantValueForExample];
|
|
553659
553723
|
if (rawSingleUnionType == null) {
|
|
553660
|
-
throw new
|
|
553724
|
+
throw new CliError({
|
|
553725
|
+
message: `${discriminantValueForExample} is not one of the specified discriminant values.`,
|
|
553726
|
+
code: CliError.Code.ValidationError
|
|
553727
|
+
});
|
|
553661
553728
|
}
|
|
553662
553729
|
const rawValueType = typeof rawSingleUnionType === "string" ? rawSingleUnionType : typeof rawSingleUnionType.type === "string" ? rawSingleUnionType.type : void 0;
|
|
553663
553730
|
const baseProperties = Object.entries(rawUnion["base-properties"] ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553688,7 +553755,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553688
553755
|
referenceToNamedType: extendedTypeName
|
|
553689
553756
|
});
|
|
553690
553757
|
if (resolvedExtendedType._type !== "named" || !isRawObjectDefinition(resolvedExtendedType.declaration)) {
|
|
553691
|
-
throw new
|
|
553758
|
+
throw new CliError({
|
|
553759
|
+
message: "Extended type is not a named object",
|
|
553760
|
+
code: CliError.Code.InternalError
|
|
553761
|
+
});
|
|
553692
553762
|
}
|
|
553693
553763
|
const extendedObject = resolvedExtendedType.declaration;
|
|
553694
553764
|
const propertiesFromExtension = Object.entries(extendedObject.properties ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553741,7 +553811,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553741
553811
|
enum: (rawEnum) => {
|
|
553742
553812
|
if (typeof example !== "string") {
|
|
553743
553813
|
const validValues = rawEnum.enum.map((enumEntry) => typeof enumEntry === "string" ? enumEntry : enumEntry.value).join(", ");
|
|
553744
|
-
throw new
|
|
553814
|
+
throw new CliError({
|
|
553815
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553816
|
+
code: CliError.Code.ValidationError
|
|
553817
|
+
});
|
|
553745
553818
|
}
|
|
553746
553819
|
return ExampleTypeShape.enum({
|
|
553747
553820
|
value: fileContainingExample.casingsGenerator.generateNameAndWireValue({
|
|
@@ -553782,7 +553855,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553782
553855
|
return typeof variant === "string" ? variant : variant.type;
|
|
553783
553856
|
});
|
|
553784
553857
|
const validValues = variantOptions.join(", ");
|
|
553785
|
-
throw new
|
|
553858
|
+
throw new CliError({
|
|
553859
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553860
|
+
code: CliError.Code.ValidationError
|
|
553861
|
+
});
|
|
553786
553862
|
}
|
|
553787
553863
|
});
|
|
553788
553864
|
}
|
|
@@ -553809,7 +553885,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553809
553885
|
},
|
|
553810
553886
|
map: ({ keyType, valueType }) => {
|
|
553811
553887
|
if (!isPlainObject4(resolvedExample)) {
|
|
553812
|
-
throw new
|
|
553888
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553813
553889
|
}
|
|
553814
553890
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553815
553891
|
return ExampleTypeReferenceShape.container(ExampleContainer.map({
|
|
@@ -553841,7 +553917,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553841
553917
|
},
|
|
553842
553918
|
list: (itemType) => {
|
|
553843
553919
|
if (!Array.isArray(resolvedExample)) {
|
|
553844
|
-
throw new
|
|
553920
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553845
553921
|
}
|
|
553846
553922
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553847
553923
|
return ExampleTypeReferenceShape.container(ExampleContainer.list({
|
|
@@ -553860,7 +553936,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553860
553936
|
},
|
|
553861
553937
|
set: (itemType) => {
|
|
553862
553938
|
if (!Array.isArray(resolvedExample)) {
|
|
553863
|
-
throw new
|
|
553939
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553864
553940
|
}
|
|
553865
553941
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553866
553942
|
return ExampleTypeReferenceShape.container(ExampleContainer.set({
|
|
@@ -553930,7 +554006,10 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553930
554006
|
});
|
|
553931
554007
|
const parsedReferenceToNamedType = fileContainingRawTypeReference.parseTypeReference(named);
|
|
553932
554008
|
if (parsedReferenceToNamedType.type !== "named") {
|
|
553933
|
-
throw new
|
|
554009
|
+
throw new CliError({
|
|
554010
|
+
message: "Type reference is not to a named type.",
|
|
554011
|
+
code: CliError.Code.InternalError
|
|
554012
|
+
});
|
|
553934
554013
|
}
|
|
553935
554014
|
const typeName = {
|
|
553936
554015
|
typeId: parsedReferenceToNamedType.typeId,
|
|
@@ -554088,13 +554167,19 @@ function convertPrimitiveExample({ example, typeBeingExemplified }) {
|
|
|
554088
554167
|
}));
|
|
554089
554168
|
},
|
|
554090
554169
|
_other: () => {
|
|
554091
|
-
throw new
|
|
554170
|
+
throw new CliError({
|
|
554171
|
+
message: "Unknown primitive type: " + typeBeingExemplified,
|
|
554172
|
+
code: CliError.Code.InternalError
|
|
554173
|
+
});
|
|
554092
554174
|
}
|
|
554093
554175
|
});
|
|
554094
554176
|
}
|
|
554095
554177
|
function convertObject4({ typeName, rawObject, example, fileContainingType, fileContainingExample, typeResolver, exampleResolver, workspace, recursionContext }) {
|
|
554096
554178
|
if (!isPlainObject4(example)) {
|
|
554097
|
-
throw new
|
|
554179
|
+
throw new CliError({
|
|
554180
|
+
message: `Example is not an object. Got: ${JSON.stringify(example)}`,
|
|
554181
|
+
code: CliError.Code.ValidationError
|
|
554182
|
+
});
|
|
554098
554183
|
}
|
|
554099
554184
|
const properties7 = Object.entries(example).map(([wireKey, propertyExample]) => {
|
|
554100
554185
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
@@ -554169,7 +554254,10 @@ function getOriginalTypeDeclarationForPropertyFromExtensions({ wirePropertyKey,
|
|
|
554169
554254
|
file: file4
|
|
554170
554255
|
});
|
|
554171
554256
|
if (resolvedType._type !== "named" || !isRawObjectDefinition(resolvedType.declaration)) {
|
|
554172
|
-
throw new
|
|
554257
|
+
throw new CliError({
|
|
554258
|
+
message: "Extension is not of a named object",
|
|
554259
|
+
code: CliError.Code.InternalError
|
|
554260
|
+
});
|
|
554173
554261
|
}
|
|
554174
554262
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
554175
554263
|
wirePropertyKey,
|
|
@@ -554206,7 +554294,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554206
554294
|
switch (parsedSingleUnionTypeProperties.propertiesType) {
|
|
554207
554295
|
case "singleProperty": {
|
|
554208
554296
|
if (!isPlainObject4(example)) {
|
|
554209
|
-
throw new
|
|
554297
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554210
554298
|
}
|
|
554211
554299
|
return {
|
|
554212
554300
|
wireDiscriminantValue,
|
|
@@ -554224,7 +554312,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554224
554312
|
}
|
|
554225
554313
|
case "samePropertiesAsObject": {
|
|
554226
554314
|
if (!isPlainObject4(example)) {
|
|
554227
|
-
throw new
|
|
554315
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554228
554316
|
}
|
|
554229
554317
|
let rawDeclaration = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
554230
554318
|
referenceToNamedType: rawValueType,
|
|
@@ -554237,7 +554325,10 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554237
554325
|
});
|
|
554238
554326
|
}
|
|
554239
554327
|
if (!isRawObjectDefinition(rawDeclaration.declaration)) {
|
|
554240
|
-
throw new
|
|
554328
|
+
throw new CliError({
|
|
554329
|
+
message: `${rawValueType} is not an object`,
|
|
554330
|
+
code: CliError.Code.ValidationError
|
|
554331
|
+
});
|
|
554241
554332
|
}
|
|
554242
554333
|
const typeName = {
|
|
554243
554334
|
typeId: parsedSingleUnionTypeProperties.typeId,
|
|
@@ -554320,7 +554411,10 @@ function convertExampleEndpointCall2({ service, endpoint: endpoint3, example, ty
|
|
|
554320
554411
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
554321
554412
|
const queryParameterDeclaration = typeof endpoint3.request !== "string" ? endpoint3.request?.["query-parameters"]?.[wireKey] : void 0;
|
|
554322
554413
|
if (queryParameterDeclaration == null) {
|
|
554323
|
-
throw new
|
|
554414
|
+
throw new CliError({
|
|
554415
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
554416
|
+
code: CliError.Code.ReferenceError
|
|
554417
|
+
});
|
|
554324
554418
|
}
|
|
554325
554419
|
const isAllowMultiple = typeof queryParameterDeclaration !== "string" && queryParameterDeclaration["allow-multiple"] === true;
|
|
554326
554420
|
const rawType = typeof queryParameterDeclaration === "string" ? queryParameterDeclaration : queryParameterDeclaration.type;
|
|
@@ -554429,7 +554523,10 @@ function convertPathParameters({ service, endpoint: endpoint3, example, typeReso
|
|
|
554429
554523
|
examplePathParameter
|
|
554430
554524
|
}));
|
|
554431
554525
|
} else {
|
|
554432
|
-
throw new
|
|
554526
|
+
throw new CliError({
|
|
554527
|
+
message: `Path parameter ${key2} does not exist`,
|
|
554528
|
+
code: CliError.Code.ReferenceError
|
|
554529
|
+
});
|
|
554433
554530
|
}
|
|
554434
554531
|
}
|
|
554435
554532
|
}
|
|
@@ -554509,7 +554606,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554509
554606
|
return void 0;
|
|
554510
554607
|
}
|
|
554511
554608
|
if (!isPlainObject4(example.request)) {
|
|
554512
|
-
throw new
|
|
554609
|
+
throw new CliError({
|
|
554610
|
+
message: `Example is not an object. Got: ${JSON.stringify(example.request)}`,
|
|
554611
|
+
code: CliError.Code.ValidationError
|
|
554612
|
+
});
|
|
554513
554613
|
}
|
|
554514
554614
|
const exampleProperties = [];
|
|
554515
554615
|
const exampleExtraProperties = [];
|
|
@@ -554559,7 +554659,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554559
554659
|
});
|
|
554560
554660
|
continue;
|
|
554561
554661
|
}
|
|
554562
|
-
throw new
|
|
554662
|
+
throw new CliError({
|
|
554663
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
554664
|
+
code: CliError.Code.ResolutionError
|
|
554665
|
+
});
|
|
554563
554666
|
}
|
|
554564
554667
|
exampleProperties.push({
|
|
554565
554668
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -554944,7 +555047,7 @@ function getPaginationPropertyComponents(endpointPagination) {
|
|
|
554944
555047
|
results: getResponsePropertyComponents(endpointPagination.results)
|
|
554945
555048
|
};
|
|
554946
555049
|
}
|
|
554947
|
-
throw new
|
|
555050
|
+
throw new CliError({ message: "Invalid pagination schema", code: CliError.Code.ValidationError });
|
|
554948
555051
|
}
|
|
554949
555052
|
function isRawCursorPaginationSchema(rawPaginationSchema) {
|
|
554950
555053
|
return rawPaginationSchema.cursor != null;
|
|
@@ -555115,7 +555218,10 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555115
555218
|
return void 0;
|
|
555116
555219
|
}
|
|
555117
555220
|
if (isHttpService && isGrpcEndpoint) {
|
|
555118
|
-
throw new
|
|
555221
|
+
throw new CliError({
|
|
555222
|
+
message: "Cannot have a grpc endpoint on an http service",
|
|
555223
|
+
code: CliError.Code.ValidationError
|
|
555224
|
+
});
|
|
555119
555225
|
}
|
|
555120
555226
|
if (isGrpcService && isHttpEndpoint) {
|
|
555121
555227
|
return Transport.http();
|
|
@@ -555129,8 +555235,11 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555129
555235
|
return createProtobufService(file4, protoSource, sourceResolver, serviceNameOverride);
|
|
555130
555236
|
}
|
|
555131
555237
|
}
|
|
555132
|
-
throw new
|
|
555133
|
-
|
|
555238
|
+
throw new CliError({
|
|
555239
|
+
message: `Internal error; failed to determine endpoint transport for
|
|
555240
|
+
${JSON.stringify(endpointDeclaration)}"`,
|
|
555241
|
+
code: CliError.Code.InternalError
|
|
555242
|
+
});
|
|
555134
555243
|
}
|
|
555135
555244
|
function createProtobufService(file4, source2, sourceResolver, serviceNameOverride) {
|
|
555136
555245
|
const resolvedSource = sourceResolver.resolveSourceOrThrow({
|
|
@@ -555138,14 +555247,20 @@ function createProtobufService(file4, source2, sourceResolver, serviceNameOverri
|
|
|
555138
555247
|
relativeFilepath: file4.relativeFilepath
|
|
555139
555248
|
});
|
|
555140
555249
|
if (resolvedSource == null || resolvedSource.type !== "protobuf") {
|
|
555141
|
-
throw new
|
|
555250
|
+
throw new CliError({
|
|
555251
|
+
message: `Expected a protobuf source for ${source2.proto}.`,
|
|
555252
|
+
code: CliError.Code.ResolutionError
|
|
555253
|
+
});
|
|
555142
555254
|
}
|
|
555143
555255
|
const protobufService = convertProtobufService({
|
|
555144
555256
|
source: resolvedSource,
|
|
555145
555257
|
serviceNameOverride
|
|
555146
555258
|
});
|
|
555147
555259
|
if (protobufService == null) {
|
|
555148
|
-
throw new
|
|
555260
|
+
throw new CliError({
|
|
555261
|
+
message: `Failed to resolve service name from ${resolvedSource.relativeFilePath}.`,
|
|
555262
|
+
code: CliError.Code.IrConversionError
|
|
555263
|
+
});
|
|
555149
555264
|
}
|
|
555150
555265
|
return Transport.grpc({
|
|
555151
555266
|
service: protobufService
|
|
@@ -555357,7 +555472,7 @@ function resolvePathParameterOrThrow({ parameter: parameter6, variableResolver,
|
|
|
555357
555472
|
file: file4
|
|
555358
555473
|
});
|
|
555359
555474
|
if (resolved == null) {
|
|
555360
|
-
throw new
|
|
555475
|
+
throw new CliError({ message: "Cannot resolve path parameter", code: CliError.Code.InternalError });
|
|
555361
555476
|
}
|
|
555362
555477
|
return resolved;
|
|
555363
555478
|
}
|
|
@@ -555638,7 +555753,10 @@ var DynamicSnippetsConverter = class {
|
|
|
555638
555753
|
return dynamic_exports.Request.body({ pathParameters, body: void 0 });
|
|
555639
555754
|
}
|
|
555640
555755
|
if (endpoint3.sdkRequest == null) {
|
|
555641
|
-
throw new
|
|
555756
|
+
throw new CliError({
|
|
555757
|
+
message: `Internal error; endpoint "${endpoint3.id}" has a request body but no SDK request`,
|
|
555758
|
+
code: CliError.Code.InternalError
|
|
555759
|
+
});
|
|
555642
555760
|
}
|
|
555643
555761
|
switch (endpoint3.sdkRequest.shape.type) {
|
|
555644
555762
|
case "justRequestBody":
|
|
@@ -556131,7 +556249,7 @@ var DynamicSnippetsConverter = class {
|
|
|
556131
556249
|
}))
|
|
556132
556250
|
}),
|
|
556133
556251
|
_other: () => {
|
|
556134
|
-
throw new
|
|
556252
|
+
throw new CliError({ message: "Unknown environments type", code: CliError.Code.InternalError });
|
|
556135
556253
|
}
|
|
556136
556254
|
})
|
|
556137
556255
|
};
|
|
@@ -556168,10 +556286,16 @@ var DynamicSnippetsConverter = class {
|
|
|
556168
556286
|
resolveObjectTypeOrThrow(typeId) {
|
|
556169
556287
|
const typeDeclaration2 = this.ir.types[typeId];
|
|
556170
556288
|
if (typeDeclaration2 == null) {
|
|
556171
|
-
throw new
|
|
556289
|
+
throw new CliError({
|
|
556290
|
+
message: `Internal error; type "${typeId}" not found`,
|
|
556291
|
+
code: CliError.Code.InternalError
|
|
556292
|
+
});
|
|
556172
556293
|
}
|
|
556173
556294
|
if (typeDeclaration2.shape.type !== "object") {
|
|
556174
|
-
throw new
|
|
556295
|
+
throw new CliError({
|
|
556296
|
+
message: `Internal error; type "${typeId}" is not an object`,
|
|
556297
|
+
code: CliError.Code.InternalError
|
|
556298
|
+
});
|
|
556175
556299
|
}
|
|
556176
556300
|
return typeDeclaration2.shape;
|
|
556177
556301
|
}
|
|
@@ -556456,7 +556580,10 @@ function convertOAuthClientCredentials({ propertyResolver, endpointResolver, typ
|
|
|
556456
556580
|
tokenEndpoint
|
|
556457
556581
|
});
|
|
556458
556582
|
if (oauthTokenEndpoint == null) {
|
|
556459
|
-
throw new
|
|
556583
|
+
throw new CliError({
|
|
556584
|
+
message: "Failed to convert OAuth token endpoint.",
|
|
556585
|
+
code: CliError.Code.IrConversionError
|
|
556586
|
+
});
|
|
556460
556587
|
}
|
|
556461
556588
|
const refreshEndpoint = refreshTokenEndpoint != null ? convertOAuthRefreshEndpoint({
|
|
556462
556589
|
propertyResolver,
|
|
@@ -556634,7 +556761,7 @@ function convertSchemeReference2({ reference: reference4, authSchemeDeclarations
|
|
|
556634
556761
|
const convertNamedAuthSchemeReference = (reference5, docs2) => {
|
|
556635
556762
|
const declaration = authSchemeDeclarations?.[reference5];
|
|
556636
556763
|
if (declaration == null) {
|
|
556637
|
-
throw new
|
|
556764
|
+
throw new CliError({ message: "Unknown auth scheme: " + reference5, code: CliError.Code.ReferenceError });
|
|
556638
556765
|
}
|
|
556639
556766
|
return visitRawAuthSchemeDeclaration(declaration, {
|
|
556640
556767
|
header: (rawHeader) => AuthScheme.header({
|
|
@@ -556746,7 +556873,10 @@ function generateOAuth({ key: key2, file: file4, docs: docs2, rawScheme, propert
|
|
|
556746
556873
|
}))
|
|
556747
556874
|
});
|
|
556748
556875
|
default:
|
|
556749
|
-
throw new
|
|
556876
|
+
throw new CliError({
|
|
556877
|
+
message: `Unknown OAuth type: '${rawScheme?.type}'`,
|
|
556878
|
+
code: CliError.Code.ValidationError
|
|
556879
|
+
});
|
|
556750
556880
|
}
|
|
556751
556881
|
}
|
|
556752
556882
|
function generateInferredAuth({ key: key2, file: file4, docs: docs2, rawScheme, propertyResolver, endpointResolver }) {
|
|
@@ -557010,7 +557140,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557010
557140
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
557011
557141
|
const queryParameterDeclaration = channel3["query-parameters"]?.[wireKey];
|
|
557012
557142
|
if (queryParameterDeclaration == null) {
|
|
557013
|
-
throw new
|
|
557143
|
+
throw new CliError({
|
|
557144
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
557145
|
+
code: CliError.Code.ReferenceError
|
|
557146
|
+
});
|
|
557014
557147
|
}
|
|
557015
557148
|
return {
|
|
557016
557149
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557035,7 +557168,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557035
557168
|
messages: example.messages.map((messageExample) => {
|
|
557036
557169
|
const message = channel3.messages?.[messageExample.type];
|
|
557037
557170
|
if (message == null) {
|
|
557038
|
-
throw new
|
|
557171
|
+
throw new CliError({
|
|
557172
|
+
message: `Message ${messageExample.type} does not exist`,
|
|
557173
|
+
code: CliError.Code.ReferenceError
|
|
557174
|
+
});
|
|
557039
557175
|
}
|
|
557040
557176
|
return {
|
|
557041
557177
|
type: messageExample.type,
|
|
@@ -557074,7 +557210,7 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557074
557210
|
}));
|
|
557075
557211
|
}
|
|
557076
557212
|
if (!isPlainObject4(example)) {
|
|
557077
|
-
throw new
|
|
557213
|
+
throw new CliError({ message: "Example must be an object", code: CliError.Code.ValidationError });
|
|
557078
557214
|
}
|
|
557079
557215
|
const exampleProperties = [];
|
|
557080
557216
|
for (const [wireKey, propertyExample] of Object.entries(example)) {
|
|
@@ -557104,7 +557240,10 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557104
557240
|
file: file4
|
|
557105
557241
|
});
|
|
557106
557242
|
if (originalTypeDeclaration == null) {
|
|
557107
|
-
throw new
|
|
557243
|
+
throw new CliError({
|
|
557244
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
557245
|
+
code: CliError.Code.ResolutionError
|
|
557246
|
+
});
|
|
557108
557247
|
}
|
|
557109
557248
|
exampleProperties.push({
|
|
557110
557249
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557188,7 +557327,10 @@ function convertChannelPathParameters({ channel: channel3, example, typeResolver
|
|
|
557188
557327
|
examplePathParameter
|
|
557189
557328
|
}));
|
|
557190
557329
|
} else {
|
|
557191
|
-
throw new
|
|
557330
|
+
throw new CliError({
|
|
557331
|
+
message: `Path parameter ${key2} does not exist`,
|
|
557332
|
+
code: CliError.Code.ReferenceError
|
|
557333
|
+
});
|
|
557192
557334
|
}
|
|
557193
557335
|
}
|
|
557194
557336
|
}
|
|
@@ -557339,7 +557481,10 @@ var ReadmeEndpointCache = class {
|
|
|
557339
557481
|
getEndpointForReadmeOrThrow(readmeEndpoint) {
|
|
557340
557482
|
const endpoint3 = this.getEndpointForReadme(readmeEndpoint);
|
|
557341
557483
|
if (endpoint3 == null) {
|
|
557342
|
-
throw new
|
|
557484
|
+
throw new CliError({
|
|
557485
|
+
message: `Endpoint not found for ${JSON.stringify(readmeEndpoint)}`,
|
|
557486
|
+
code: CliError.Code.ResolutionError
|
|
557487
|
+
});
|
|
557343
557488
|
}
|
|
557344
557489
|
return endpoint3;
|
|
557345
557490
|
}
|
|
@@ -557387,7 +557532,7 @@ function getReadmeEndpointObject({ endpoint: endpoint3 }) {
|
|
|
557387
557532
|
if (typeof endpoint3 === "string") {
|
|
557388
557533
|
const split2 = endpoint3.split(" ");
|
|
557389
557534
|
if (split2.length !== 2 || split2[0] == null || split2[1] == null) {
|
|
557390
|
-
throw new
|
|
557535
|
+
throw new CliError({ message: `invalid endpoint string: ${endpoint3}`, code: CliError.Code.ParseError });
|
|
557391
557536
|
}
|
|
557392
557537
|
return {
|
|
557393
557538
|
method: split2[0],
|
|
@@ -557484,7 +557629,10 @@ function convertWebhookExamples2({ webhook, examples, file: file4, typeResolver,
|
|
|
557484
557629
|
}));
|
|
557485
557630
|
}
|
|
557486
557631
|
if (!isPlainObject4(webhook.payload)) {
|
|
557487
|
-
throw new
|
|
557632
|
+
throw new CliError({
|
|
557633
|
+
message: `Example webhook payload is not an object. Got: ${JSON.stringify(webhook.payload)}`,
|
|
557634
|
+
code: CliError.Code.ValidationError
|
|
557635
|
+
});
|
|
557488
557636
|
}
|
|
557489
557637
|
return examples.map((example) => ({
|
|
557490
557638
|
docs: webhook.docs,
|
|
@@ -557876,7 +558024,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557876
558024
|
const genericInstantiation = typeof generic === "string" ? generic : generic.type;
|
|
557877
558025
|
const maybeGeneric = parseGeneric(genericInstantiation);
|
|
557878
558026
|
if (maybeGeneric == null) {
|
|
557879
|
-
throw new
|
|
558027
|
+
throw new CliError({
|
|
558028
|
+
message: `Invalid generic type definition: ${genericInstantiation}`,
|
|
558029
|
+
code: CliError.Code.ValidationError
|
|
558030
|
+
});
|
|
557880
558031
|
}
|
|
557881
558032
|
const resolvedBaseGeneric = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
557882
558033
|
referenceToNamedType: genericInstantiation,
|
|
@@ -557907,7 +558058,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557907
558058
|
extendedProperties: void 0
|
|
557908
558059
|
});
|
|
557909
558060
|
}
|
|
557910
|
-
throw new
|
|
558061
|
+
throw new CliError({
|
|
558062
|
+
message: `Generic type definition not supported: ${genericInstantiation}`,
|
|
558063
|
+
code: CliError.Code.ValidationError
|
|
558064
|
+
});
|
|
557911
558065
|
}
|
|
557912
558066
|
|
|
557913
558067
|
// ../generation/ir-generator/lib/converters/type-declarations/convertAliasTypeDeclaration.js
|
|
@@ -558299,7 +558453,10 @@ var PackageTreeGenerator = class {
|
|
|
558299
558453
|
addPackageRedirection({ from: from4, to: to10 }) {
|
|
558300
558454
|
const package_ = this.getPackageForFernFilepath(from4);
|
|
558301
558455
|
if (package_.navigationConfig != null) {
|
|
558302
|
-
throw new
|
|
558456
|
+
throw new CliError({
|
|
558457
|
+
message: "Found duplicate navigationConfig for package",
|
|
558458
|
+
code: CliError.Code.InternalError
|
|
558459
|
+
});
|
|
558303
558460
|
}
|
|
558304
558461
|
package_.navigationConfig = {
|
|
558305
558462
|
pointsTo: IdGenerator.generateSubpackageId(to10)
|
|
@@ -558308,7 +558465,7 @@ var PackageTreeGenerator = class {
|
|
|
558308
558465
|
addDocs(fernFilepath, docs2) {
|
|
558309
558466
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558310
558467
|
if (package_.docs != null) {
|
|
558311
|
-
throw new
|
|
558468
|
+
throw new CliError({ message: "Found duplicate docs for package", code: CliError.Code.InternalError });
|
|
558312
558469
|
}
|
|
558313
558470
|
package_.docs = docs2;
|
|
558314
558471
|
}
|
|
@@ -558324,21 +558481,30 @@ var PackageTreeGenerator = class {
|
|
|
558324
558481
|
addService(serviceId, service) {
|
|
558325
558482
|
const package_ = this.getPackageForFernFilepath(service.name.fernFilepath);
|
|
558326
558483
|
if (package_.service != null) {
|
|
558327
|
-
throw new
|
|
558484
|
+
throw new CliError({
|
|
558485
|
+
message: "Found duplicate service for " + serviceId,
|
|
558486
|
+
code: CliError.Code.InternalError
|
|
558487
|
+
});
|
|
558328
558488
|
}
|
|
558329
558489
|
package_.service = serviceId;
|
|
558330
558490
|
}
|
|
558331
558491
|
addWebhookGroup(webhookGroupId, fernFilepath) {
|
|
558332
558492
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558333
558493
|
if (package_.webhooks != null) {
|
|
558334
|
-
throw new
|
|
558494
|
+
throw new CliError({
|
|
558495
|
+
message: "Found duplicate webhook group for " + webhookGroupId,
|
|
558496
|
+
code: CliError.Code.InternalError
|
|
558497
|
+
});
|
|
558335
558498
|
}
|
|
558336
558499
|
package_.webhooks = webhookGroupId;
|
|
558337
558500
|
}
|
|
558338
558501
|
addWebSocketChannel(websocketChannelId, fernFilepath) {
|
|
558339
558502
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558340
558503
|
if (package_.webhooks != null) {
|
|
558341
|
-
throw new
|
|
558504
|
+
throw new CliError({
|
|
558505
|
+
message: "Found duplicate webhook group for " + websocketChannelId,
|
|
558506
|
+
code: CliError.Code.InternalError
|
|
558507
|
+
});
|
|
558342
558508
|
}
|
|
558343
558509
|
package_.websocket = websocketChannelId;
|
|
558344
558510
|
}
|
|
@@ -558381,24 +558547,33 @@ var PackageTreeGenerator = class {
|
|
|
558381
558547
|
}
|
|
558382
558548
|
sortRootPackage(subpackagesInOrder) {
|
|
558383
558549
|
if (!isEqualIgnoreOrder(this.rootPackage.subpackages, subpackagesInOrder)) {
|
|
558384
|
-
throw new
|
|
558550
|
+
throw new CliError({
|
|
558551
|
+
message: "Sorted subpackages differ from unsorted packages in root",
|
|
558552
|
+
code: CliError.Code.InternalError
|
|
558553
|
+
});
|
|
558385
558554
|
}
|
|
558386
558555
|
this.rootPackage.subpackages = subpackagesInOrder;
|
|
558387
558556
|
}
|
|
558388
558557
|
sortSubpackage(subpackageId, subpackagesInOrder) {
|
|
558389
558558
|
const subpackage = this.subpackages[subpackageId];
|
|
558390
558559
|
if (subpackage == null) {
|
|
558391
|
-
throw new
|
|
558560
|
+
throw new CliError({
|
|
558561
|
+
message: "Subpackage does not exist: " + subpackageId,
|
|
558562
|
+
code: CliError.Code.ResolutionError
|
|
558563
|
+
});
|
|
558392
558564
|
}
|
|
558393
558565
|
if (!isEqualIgnoreOrder(subpackage.subpackages, subpackagesInOrder)) {
|
|
558394
|
-
throw new
|
|
558566
|
+
throw new CliError({
|
|
558567
|
+
message: "Sorted subpackages differ from unsorted packages",
|
|
558568
|
+
code: CliError.Code.InternalError
|
|
558569
|
+
});
|
|
558395
558570
|
}
|
|
558396
558571
|
subpackage.subpackages = subpackagesInOrder;
|
|
558397
558572
|
}
|
|
558398
558573
|
getAllSubpackagesWithEndpoints(root6) {
|
|
558399
558574
|
const subpackage = this.subpackages[root6];
|
|
558400
558575
|
if (subpackage == null) {
|
|
558401
|
-
throw new
|
|
558576
|
+
throw new CliError({ message: "Subpackage does not exist: " + root6, code: CliError.Code.ResolutionError });
|
|
558402
558577
|
}
|
|
558403
558578
|
const subpackagesWithEndpoints = this.getAllChildrenWithEndpoints(subpackage);
|
|
558404
558579
|
if (subpackagesWithEndpoints.length > 0 || subpackage.service != null) {
|
|
@@ -558419,7 +558594,10 @@ var PackageTreeGenerator = class {
|
|
|
558419
558594
|
const subpackagesInParent = parent.subpackages.map((subpackageId) => {
|
|
558420
558595
|
const subpackage = this.subpackages[subpackageId];
|
|
558421
558596
|
if (subpackage == null) {
|
|
558422
|
-
throw new
|
|
558597
|
+
throw new CliError({
|
|
558598
|
+
message: "Subpackage ID is invalid: " + subpackageId,
|
|
558599
|
+
code: CliError.Code.InternalError
|
|
558600
|
+
});
|
|
558423
558601
|
}
|
|
558424
558602
|
return subpackage;
|
|
558425
558603
|
});
|
|
@@ -558498,7 +558676,10 @@ var EndpointResolverImpl = class {
|
|
|
558498
558676
|
resolveEndpointOrThrow({ endpoint: endpoint3, file: file4 }) {
|
|
558499
558677
|
const resolvedEndpoint = this.resolveEndpoint({ endpoint: endpoint3, file: file4 });
|
|
558500
558678
|
if (resolvedEndpoint == null) {
|
|
558501
|
-
throw new
|
|
558679
|
+
throw new CliError({
|
|
558680
|
+
message: "Cannot resolve endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
558681
|
+
code: CliError.Code.ResolutionError
|
|
558682
|
+
});
|
|
558502
558683
|
}
|
|
558503
558684
|
return resolvedEndpoint;
|
|
558504
558685
|
}
|
|
@@ -558626,7 +558807,10 @@ var ErrorResolverImpl = class {
|
|
|
558626
558807
|
getDeclarationOrThrow(referenceToError, file4) {
|
|
558627
558808
|
const declaration = this.getDeclaration(referenceToError, file4);
|
|
558628
558809
|
if (declaration == null) {
|
|
558629
|
-
throw new
|
|
558810
|
+
throw new CliError({
|
|
558811
|
+
message: "Error does not exist: " + referenceToError,
|
|
558812
|
+
code: CliError.Code.ResolutionError
|
|
558813
|
+
});
|
|
558630
558814
|
}
|
|
558631
558815
|
return declaration;
|
|
558632
558816
|
}
|
|
@@ -558712,7 +558896,7 @@ var ExampleResolverImpl = class {
|
|
|
558712
558896
|
resolveAllReferencesInExampleOrThrow({ example, file: file4 }) {
|
|
558713
558897
|
const resolvedExample = this.resolveAllReferencesInExample({ example, file: file4 });
|
|
558714
558898
|
if (resolvedExample == null) {
|
|
558715
|
-
throw new
|
|
558899
|
+
throw new CliError({ message: "Failed to resolve examples", code: CliError.Code.ResolutionError });
|
|
558716
558900
|
}
|
|
558717
558901
|
return resolvedExample;
|
|
558718
558902
|
}
|
|
@@ -558759,7 +558943,7 @@ var ExampleResolverImpl = class {
|
|
|
558759
558943
|
resolveExampleOrThrow({ example, file: file4 }) {
|
|
558760
558944
|
const resolvedExample = this.resolveExample({ example, file: file4 });
|
|
558761
558945
|
if (resolvedExample == null) {
|
|
558762
|
-
throw new
|
|
558946
|
+
throw new CliError({ message: "Cannot resolve example: " + example, code: CliError.Code.ResolutionError });
|
|
558763
558947
|
}
|
|
558764
558948
|
return resolvedExample;
|
|
558765
558949
|
}
|
|
@@ -558810,7 +558994,10 @@ var PropertyResolverImpl = class {
|
|
|
558810
558994
|
resolveRequestPropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558811
558995
|
const resolvedRequestProperty = this.resolveRequestProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558812
558996
|
if (resolvedRequestProperty == null) {
|
|
558813
|
-
throw new
|
|
558997
|
+
throw new CliError({
|
|
558998
|
+
message: "Cannot resolve request property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
558999
|
+
code: CliError.Code.ResolutionError
|
|
559000
|
+
});
|
|
558814
559001
|
}
|
|
558815
559002
|
return resolvedRequestProperty;
|
|
558816
559003
|
}
|
|
@@ -558854,7 +559041,10 @@ var PropertyResolverImpl = class {
|
|
|
558854
559041
|
resolveResponsePropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558855
559042
|
const resolvedResponseProperty = this.resolveResponseProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558856
559043
|
if (resolvedResponseProperty == null) {
|
|
558857
|
-
throw new
|
|
559044
|
+
throw new CliError({
|
|
559045
|
+
message: "Cannot resolve response property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559046
|
+
code: CliError.Code.ResolutionError
|
|
559047
|
+
});
|
|
558858
559048
|
}
|
|
558859
559049
|
return resolvedResponseProperty;
|
|
558860
559050
|
}
|
|
@@ -559021,7 +559211,10 @@ var PropertyResolverImpl = class {
|
|
|
559021
559211
|
propertyComponents: breadcrumbs
|
|
559022
559212
|
});
|
|
559023
559213
|
if (!currentType) {
|
|
559024
|
-
throw new
|
|
559214
|
+
throw new CliError({
|
|
559215
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in inline request body in file ${file4.relativeFilepath}`,
|
|
559216
|
+
code: CliError.Code.InternalError
|
|
559217
|
+
});
|
|
559025
559218
|
}
|
|
559026
559219
|
result.push({
|
|
559027
559220
|
name: file4.casingsGenerator.generateName(component),
|
|
@@ -559039,7 +559232,10 @@ function getNestedObjectPropertyTypeOrThrow({ typeResolver, file: file4, resolve
|
|
|
559039
559232
|
propertyName
|
|
559040
559233
|
});
|
|
559041
559234
|
if (!nestedPropertyType) {
|
|
559042
|
-
throw new
|
|
559235
|
+
throw new CliError({
|
|
559236
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in ${rootTypeLabel}`,
|
|
559237
|
+
code: CliError.Code.InternalError
|
|
559238
|
+
});
|
|
559043
559239
|
}
|
|
559044
559240
|
return nestedPropertyType;
|
|
559045
559241
|
}
|
|
@@ -559216,14 +559412,20 @@ var TypeResolverImpl = class {
|
|
|
559216
559412
|
resolveTypeOrThrow({ type: type8, file: file4 }) {
|
|
559217
559413
|
const resolvedType = this.resolveType({ type: type8, file: file4 });
|
|
559218
559414
|
if (resolvedType == null) {
|
|
559219
|
-
throw new
|
|
559415
|
+
throw new CliError({
|
|
559416
|
+
message: "Cannot resolve type: " + type8 + " in file " + file4.relativeFilepath,
|
|
559417
|
+
code: CliError.Code.ResolutionError
|
|
559418
|
+
});
|
|
559220
559419
|
}
|
|
559221
559420
|
return resolvedType;
|
|
559222
559421
|
}
|
|
559223
559422
|
getDeclarationOfNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559224
559423
|
const declaration = this.getDeclarationOfNamedType({ referenceToNamedType, file: file4 });
|
|
559225
559424
|
if (declaration == null) {
|
|
559226
|
-
throw new
|
|
559425
|
+
throw new CliError({
|
|
559426
|
+
message: "Cannot find declaration of type: " + referenceToNamedType + " in file " + file4.relativeFilepath,
|
|
559427
|
+
code: CliError.Code.ResolutionError
|
|
559428
|
+
});
|
|
559227
559429
|
}
|
|
559228
559430
|
return declaration;
|
|
559229
559431
|
}
|
|
@@ -559366,7 +559568,10 @@ var TypeResolverImpl = class {
|
|
|
559366
559568
|
resolveNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559367
559569
|
const resolvedType = this.resolveNamedType({ referenceToNamedType, file: file4 });
|
|
559368
559570
|
if (resolvedType == null) {
|
|
559369
|
-
throw new
|
|
559571
|
+
throw new CliError({
|
|
559572
|
+
message: "Cannot resolve type: " + referenceToNamedType,
|
|
559573
|
+
code: CliError.Code.ResolutionError
|
|
559574
|
+
});
|
|
559370
559575
|
}
|
|
559371
559576
|
return resolvedType;
|
|
559372
559577
|
}
|
|
@@ -559425,7 +559630,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559425
559630
|
getDeclarationOrThrow(referenceToVariable, file4) {
|
|
559426
559631
|
const declaration = this.getDeclaration(referenceToVariable, file4);
|
|
559427
559632
|
if (declaration == null) {
|
|
559428
|
-
throw new
|
|
559633
|
+
throw new CliError({
|
|
559634
|
+
message: "Variable does not exist: " + referenceToVariable,
|
|
559635
|
+
code: CliError.Code.ResolutionError
|
|
559636
|
+
});
|
|
559429
559637
|
}
|
|
559430
559638
|
return declaration;
|
|
559431
559639
|
}
|
|
@@ -559448,7 +559656,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559448
559656
|
getVariableIdOrThrow(referenceToVariable) {
|
|
559449
559657
|
const variableId = this.getVariableId(referenceToVariable);
|
|
559450
559658
|
if (variableId == null) {
|
|
559451
|
-
throw new
|
|
559659
|
+
throw new CliError({
|
|
559660
|
+
message: "Variable reference does not start with " + _VariableResolverImpl.VARIABLE_PREFIX,
|
|
559661
|
+
code: CliError.Code.ResolutionError
|
|
559662
|
+
});
|
|
559452
559663
|
}
|
|
559453
559664
|
return variableId;
|
|
559454
559665
|
}
|
|
@@ -559620,7 +559831,10 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
|
|
|
559620
559831
|
}
|
|
559621
559832
|
const errorDiscriminationSchema = workspace.definition.rootApiFile.contents["error-discrimination"];
|
|
559622
559833
|
if (errorDiscriminationSchema == null) {
|
|
559623
|
-
throw new
|
|
559834
|
+
throw new CliError({
|
|
559835
|
+
message: "error-discrimination is missing in api.yml but there are declared errors.",
|
|
559836
|
+
code: CliError.Code.ConfigError
|
|
559837
|
+
});
|
|
559624
559838
|
}
|
|
559625
559839
|
for (const [errorName, errorDeclaration] of Object.entries(errors4)) {
|
|
559626
559840
|
const convertedErrorDeclaration = convertErrorDeclaration({
|
|
@@ -614356,7 +614570,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614356
614570
|
properties: {
|
|
614357
614571
|
...event,
|
|
614358
614572
|
...event.properties,
|
|
614359
|
-
version: "4.81.0-
|
|
614573
|
+
version: "4.81.0-9-ge0476cd3e22",
|
|
614360
614574
|
usingAccessToken: true
|
|
614361
614575
|
}
|
|
614362
614576
|
});
|
|
@@ -614410,7 +614624,7 @@ var UserPosthogManager = class {
|
|
|
614410
614624
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614411
614625
|
event: "CLI",
|
|
614412
614626
|
properties: {
|
|
614413
|
-
version: "4.81.0-
|
|
614627
|
+
version: "4.81.0-9-ge0476cd3e22",
|
|
614414
614628
|
...event,
|
|
614415
614629
|
...event.properties,
|
|
614416
614630
|
usingAccessToken: false,
|
|
@@ -615614,7 +615828,10 @@ var PlatformKeyring = class {
|
|
|
615614
615828
|
await this.setPasswordWindows(service, account, password);
|
|
615615
615829
|
break;
|
|
615616
615830
|
default:
|
|
615617
|
-
throw new
|
|
615831
|
+
throw new CliError({
|
|
615832
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615833
|
+
code: CliError.Code.EnvironmentError
|
|
615834
|
+
});
|
|
615618
615835
|
}
|
|
615619
615836
|
}
|
|
615620
615837
|
async getPassword(service, account) {
|
|
@@ -615626,7 +615843,10 @@ var PlatformKeyring = class {
|
|
|
615626
615843
|
case "win32":
|
|
615627
615844
|
return this.getPasswordWindows(service, account);
|
|
615628
615845
|
default:
|
|
615629
|
-
throw new
|
|
615846
|
+
throw new CliError({
|
|
615847
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615848
|
+
code: CliError.Code.EnvironmentError
|
|
615849
|
+
});
|
|
615630
615850
|
}
|
|
615631
615851
|
}
|
|
615632
615852
|
async deletePassword(service, account) {
|
|
@@ -615638,7 +615858,10 @@ var PlatformKeyring = class {
|
|
|
615638
615858
|
case "win32":
|
|
615639
615859
|
return this.deletePasswordWindows(service, account);
|
|
615640
615860
|
default:
|
|
615641
|
-
throw new
|
|
615861
|
+
throw new CliError({
|
|
615862
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615863
|
+
code: CliError.Code.EnvironmentError
|
|
615864
|
+
});
|
|
615642
615865
|
}
|
|
615643
615866
|
}
|
|
615644
615867
|
async findCredentials(service) {
|
|
@@ -615650,7 +615873,10 @@ var PlatformKeyring = class {
|
|
|
615650
615873
|
case "win32":
|
|
615651
615874
|
return this.findCredentialsWindows(service);
|
|
615652
615875
|
default:
|
|
615653
|
-
throw new
|
|
615876
|
+
throw new CliError({
|
|
615877
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615878
|
+
code: CliError.Code.EnvironmentError
|
|
615879
|
+
});
|
|
615654
615880
|
}
|
|
615655
615881
|
}
|
|
615656
615882
|
async setPasswordDarwin(service, account, password) {
|
|
@@ -617763,7 +617989,10 @@ var FileFinder = class {
|
|
|
617763
617989
|
async findOrThrow({ filename, remediationMessage }) {
|
|
617764
617990
|
const filepath = await this.find({ filename });
|
|
617765
617991
|
if (filepath == null) {
|
|
617766
|
-
throw new
|
|
617992
|
+
throw new CliError({
|
|
617993
|
+
message: `${filename} file not found in any parent directory from ${this.from}`,
|
|
617994
|
+
code: CliError.Code.InternalError
|
|
617995
|
+
});
|
|
617767
617996
|
}
|
|
617768
617997
|
return filepath;
|
|
617769
617998
|
}
|
|
@@ -617805,7 +618034,10 @@ var FernYmlSchemaLoader = class {
|
|
|
617805
618034
|
async loadOrThrow() {
|
|
617806
618035
|
const loadResult = await this.load();
|
|
617807
618036
|
if (loadResult.type === "notFound") {
|
|
617808
|
-
throw new
|
|
618037
|
+
throw new CliError({
|
|
618038
|
+
message: `${FILENAME2} file not found in any parent directory; did you forget to run \`fern init\`?`,
|
|
618039
|
+
code: CliError.Code.InternalError
|
|
618040
|
+
});
|
|
617809
618041
|
}
|
|
617810
618042
|
if (loadResult.type === "failure") {
|
|
617811
618043
|
throw new SourcedValidationError(loadResult.issues);
|
|
@@ -617876,7 +618108,10 @@ var TelemetryClient = class _TelemetryClient {
|
|
|
617876
618108
|
if (sentryDsn != null && sentryDsn.length > 0 && isTelemetryEnabled) {
|
|
617877
618109
|
const sentryEnvironment = "development";
|
|
617878
618110
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
617879
|
-
throw new
|
|
618111
|
+
throw new CliError({
|
|
618112
|
+
message: "SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",
|
|
618113
|
+
code: CliError.Code.ConfigError
|
|
618114
|
+
});
|
|
617880
618115
|
}
|
|
617881
618116
|
this.sentry = init2({
|
|
617882
618117
|
dsn: sentryDsn,
|
|
@@ -618176,7 +618411,10 @@ var ApiDefinitionConverter = class {
|
|
|
618176
618411
|
sourced
|
|
618177
618412
|
});
|
|
618178
618413
|
}
|
|
618179
|
-
throw new
|
|
618414
|
+
throw new CliError({
|
|
618415
|
+
message: `Unknown spec type: ${JSON.stringify(spec)}`,
|
|
618416
|
+
code: CliError.Code.InternalError
|
|
618417
|
+
});
|
|
618180
618418
|
}
|
|
618181
618419
|
async convertOpenApiSpec({ absoluteFernYmlPath, spec, sourced }) {
|
|
618182
618420
|
const result = {
|
|
@@ -619536,7 +619774,10 @@ var LegacyApiSpecAdapter = class {
|
|
|
619536
619774
|
if (isOpenRpcSpec(spec)) {
|
|
619537
619775
|
return this.adaptOpenRpcSpec(spec);
|
|
619538
619776
|
}
|
|
619539
|
-
throw new
|
|
619777
|
+
throw new CliError({
|
|
619778
|
+
message: `Unsupported spec type: ${JSON.stringify(spec)}`,
|
|
619779
|
+
code: CliError.Code.InternalError
|
|
619780
|
+
});
|
|
619540
619781
|
}
|
|
619541
619782
|
convertAll(specs) {
|
|
619542
619783
|
return specs.map((spec) => this.adapt(spec));
|
|
@@ -746685,7 +746926,10 @@ var LegacyFernWorkspaceAdapter = class {
|
|
|
746685
746926
|
generatorsConfiguration: apiConfig != null ? this.buildGeneratorsConfiguration(apiConfig) : void 0
|
|
746686
746927
|
});
|
|
746687
746928
|
if (ossWorkspace == null) {
|
|
746688
|
-
throw new
|
|
746929
|
+
throw new CliError({
|
|
746930
|
+
message: "Internal error; failed to build API definitions",
|
|
746931
|
+
code: CliError.Code.InternalError
|
|
746932
|
+
});
|
|
746689
746933
|
}
|
|
746690
746934
|
return ossWorkspace.toFernWorkspace({ context: this.taskContext });
|
|
746691
746935
|
}
|
|
@@ -747842,7 +748086,10 @@ function addSplitCommand(cli) {
|
|
|
747842
748086
|
description: `Output format: '${OVERLAY_NAME}' (OpenAPI Overlay 1.0.0) or '${OVERRIDES_NAME}' (Fern deep-merge)`
|
|
747843
748087
|
}).coerce("format", (value2) => {
|
|
747844
748088
|
if (!ALL_FORMAT_NAMES.includes(value2)) {
|
|
747845
|
-
throw new
|
|
748089
|
+
throw new CliError({
|
|
748090
|
+
message: `Invalid format '${value2}'. Expected one of: ${OVERLAY_NAME}, ${OVERRIDES_NAME}`,
|
|
748091
|
+
code: CliError.Code.ValidationError
|
|
748092
|
+
});
|
|
747846
748093
|
}
|
|
747847
748094
|
return value2;
|
|
747848
748095
|
}));
|
|
@@ -827894,7 +828141,7 @@ var DocsWorkspaceValidator = class {
|
|
|
827894
828141
|
const startTime = performance.now();
|
|
827895
828142
|
if (workspace.config.settings?.substituteEnvVars) {
|
|
827896
828143
|
workspace.config = replaceEnvVariables(workspace.config, {
|
|
827897
|
-
onError: (error50) => this.taskContext.failAndThrow(error50)
|
|
828144
|
+
onError: (error50) => this.taskContext.failAndThrow(error50, void 0, { code: CliError.Code.ConfigError })
|
|
827898
828145
|
});
|
|
827899
828146
|
}
|
|
827900
828147
|
const violations = await validateDocsWorkspace(workspace, this.taskContext, apiWorkspaces, ossWorkspaces, false, excludeRules);
|
|
@@ -831728,7 +831975,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
831728
831975
|
var LOGS_FOLDER_NAME = "logs";
|
|
831729
831976
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
831730
831977
|
function getCliSource() {
|
|
831731
|
-
const version7 = "4.81.0-
|
|
831978
|
+
const version7 = "4.81.0-9-ge0476cd3e22";
|
|
831732
831979
|
return `cli@${version7}`;
|
|
831733
831980
|
}
|
|
831734
831981
|
var DebugLogger = class {
|
|
@@ -843295,7 +843542,7 @@ var LegacyDocsPublisher = class {
|
|
|
843295
843542
|
previewId,
|
|
843296
843543
|
disableTemplates: void 0,
|
|
843297
843544
|
skipUpload,
|
|
843298
|
-
cliVersion: "4.81.0-
|
|
843545
|
+
cliVersion: "4.81.0-9-ge0476cd3e22"
|
|
843299
843546
|
});
|
|
843300
843547
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843301
843548
|
return { success: false };
|
|
@@ -843770,7 +844017,10 @@ var DocsTask = class {
|
|
|
843770
844017
|
getTask() {
|
|
843771
844018
|
const task = this.taskGroup.getTask(this.id);
|
|
843772
844019
|
if (task == null) {
|
|
843773
|
-
throw new
|
|
844020
|
+
throw new CliError({
|
|
844021
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
844022
|
+
code: CliError.Code.InternalError
|
|
844023
|
+
});
|
|
843774
844024
|
}
|
|
843775
844025
|
return task;
|
|
843776
844026
|
}
|
|
@@ -845042,7 +845292,10 @@ var Wizard = class {
|
|
|
845042
845292
|
async fetchApiFromUrl(url3, specFormat) {
|
|
845043
845293
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
845044
845294
|
if (!response.ok) {
|
|
845045
|
-
throw new
|
|
845295
|
+
throw new CliError({
|
|
845296
|
+
message: `HTTP ${response.status} ${response.statusText}`,
|
|
845297
|
+
code: CliError.Code.NetworkError
|
|
845298
|
+
});
|
|
845046
845299
|
}
|
|
845047
845300
|
const content5 = await response.text();
|
|
845048
845301
|
const filename = this.resolveFilenameFromUrl({ url: url3, specFormat });
|
|
@@ -846572,20 +846825,29 @@ var ApiSpecDetector = class {
|
|
|
846572
846825
|
async detect({ absoluteFilePath, reference: reference4, content: content5 }) {
|
|
846573
846826
|
const parsed = this.parseOrThrow({ content: content5, reference: reference4 });
|
|
846574
846827
|
if (typeof parsed !== "object" || parsed == null) {
|
|
846575
|
-
throw new
|
|
846828
|
+
throw new CliError({
|
|
846829
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
846830
|
+
code: CliError.Code.InternalError
|
|
846831
|
+
});
|
|
846576
846832
|
}
|
|
846577
846833
|
for (const specType of DETECTABLE_SPEC_TYPES) {
|
|
846578
846834
|
if (specType in parsed) {
|
|
846579
846835
|
return specType;
|
|
846580
846836
|
}
|
|
846581
846837
|
}
|
|
846582
|
-
throw new
|
|
846838
|
+
throw new CliError({
|
|
846839
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
846840
|
+
code: CliError.Code.InternalError
|
|
846841
|
+
});
|
|
846583
846842
|
}
|
|
846584
846843
|
parseOrThrow({ content: content5, reference: reference4 }) {
|
|
846585
846844
|
try {
|
|
846586
846845
|
return jsYaml.load(content5);
|
|
846587
846846
|
} catch {
|
|
846588
|
-
throw new
|
|
846847
|
+
throw new CliError({
|
|
846848
|
+
message: `Could not parse "${reference4}" as YAML or JSON. Ensure the file is a valid OpenAPI or AsyncAPI specification.`,
|
|
846849
|
+
code: CliError.Code.ParseError
|
|
846850
|
+
});
|
|
846589
846851
|
}
|
|
846590
846852
|
}
|
|
846591
846853
|
};
|
|
@@ -846623,7 +846885,10 @@ var ApiSpecResolver = class {
|
|
|
846623
846885
|
async resolveLocal({ reference: reference4 }) {
|
|
846624
846886
|
const absoluteFilePath = resolve6(this.context.cwd, reference4);
|
|
846625
846887
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
846626
|
-
throw new
|
|
846888
|
+
throw new CliError({
|
|
846889
|
+
message: `API spec file does not exist: ${reference4}`,
|
|
846890
|
+
code: CliError.Code.ConfigError
|
|
846891
|
+
});
|
|
846627
846892
|
}
|
|
846628
846893
|
const content5 = await (0, import_promises92.readFile)(absoluteFilePath, "utf-8");
|
|
846629
846894
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
@@ -846636,11 +846901,17 @@ var ApiSpecResolver = class {
|
|
|
846636
846901
|
async fetchContent({ url: url3 }) {
|
|
846637
846902
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
846638
846903
|
if (!response.ok) {
|
|
846639
|
-
throw new
|
|
846904
|
+
throw new CliError({
|
|
846905
|
+
message: `Failed to fetch "${url3}": HTTP ${response.status} ${response.statusText}`,
|
|
846906
|
+
code: CliError.Code.NetworkError
|
|
846907
|
+
});
|
|
846640
846908
|
}
|
|
846641
846909
|
const contentType = response.headers.get("content-type") ?? "";
|
|
846642
846910
|
if (contentType.includes("text/html")) {
|
|
846643
|
-
throw new
|
|
846911
|
+
throw new CliError({
|
|
846912
|
+
message: `The URL "${url3}" returned HTML content. Ensure you're pointing to a raw spec URL, not a documentation page.`,
|
|
846913
|
+
code: CliError.Code.ConfigError
|
|
846914
|
+
});
|
|
846644
846915
|
}
|
|
846645
846916
|
const content5 = await response.text();
|
|
846646
846917
|
return { content: content5, contentType };
|
|
@@ -846665,7 +846936,10 @@ var ApiSpecResolver = class {
|
|
|
846665
846936
|
case "asyncapi":
|
|
846666
846937
|
return { asyncapi: absoluteFilePath, origin: origin2 };
|
|
846667
846938
|
default:
|
|
846668
|
-
throw new
|
|
846939
|
+
throw new CliError({
|
|
846940
|
+
message: `Unsupported spec type for flags mode: "${specType}". Supported: openapi, asyncapi`,
|
|
846941
|
+
code: CliError.Code.ConfigError
|
|
846942
|
+
});
|
|
846669
846943
|
}
|
|
846670
846944
|
}
|
|
846671
846945
|
isUrl(reference4) {
|
|
@@ -897467,7 +897741,10 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
897467
897741
|
}
|
|
897468
897742
|
const absolutePath = join8(this.context.cwd, RelativeFilePath2.of(license));
|
|
897469
897743
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
897470
|
-
throw new
|
|
897744
|
+
throw new CliError({
|
|
897745
|
+
message: `Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`,
|
|
897746
|
+
code: CliError.Code.InternalError
|
|
897747
|
+
});
|
|
897471
897748
|
}
|
|
897472
897749
|
const contents = await (0, import_promises106.readFile)(absolutePath, "utf-8");
|
|
897473
897750
|
return api_exports4.GithubLicense.custom({ contents });
|
|
@@ -897975,7 +898252,10 @@ var SdkTask = class {
|
|
|
897975
898252
|
getTask() {
|
|
897976
898253
|
const task = this.taskGroup.getTask(this.id);
|
|
897977
898254
|
if (task == null) {
|
|
897978
|
-
throw new
|
|
898255
|
+
throw new CliError({
|
|
898256
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
898257
|
+
code: CliError.Code.InternalError
|
|
898258
|
+
});
|
|
897979
898259
|
}
|
|
897980
898260
|
return task;
|
|
897981
898261
|
}
|
|
@@ -898207,7 +898487,7 @@ var GenerateCommand = class {
|
|
|
898207
898487
|
}
|
|
898208
898488
|
async runGeneration({ context: context3, workspace, targets: targets2, args, forceLocal }) {
|
|
898209
898489
|
if (workspace.sdks == null) {
|
|
898210
|
-
throw new
|
|
898490
|
+
throw new CliError({ message: "No SDKs configured", code: CliError.Code.InternalError });
|
|
898211
898491
|
}
|
|
898212
898492
|
const apisToCheck = [...new Set(targets2.map((t3) => t3.api))];
|
|
898213
898493
|
const apiChecker = new ApiChecker({
|
|
@@ -898889,7 +899169,10 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
898889
899169
|
const packageJsonContent = await (0, import_promises110.readFile)(packageJsonPath, "utf-8");
|
|
898890
899170
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
898891
899171
|
if (packageJson2.main == null) {
|
|
898892
|
-
throw new
|
|
899172
|
+
throw new CliError({
|
|
899173
|
+
message: `No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`,
|
|
899174
|
+
code: CliError.Code.InternalError
|
|
899175
|
+
});
|
|
898893
899176
|
}
|
|
898894
899177
|
const packageEntryPoint = (0, import_path80.join)(packageDir, packageJson2.main);
|
|
898895
899178
|
const { migrations } = await import((0, import_url8.pathToFileURL)(packageEntryPoint).href);
|
|
@@ -899004,11 +899287,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
899004
899287
|
this.logger.debug(`No migration package found for ${generatorName}.`);
|
|
899005
899288
|
return void 0;
|
|
899006
899289
|
}
|
|
899007
|
-
throw new
|
|
899290
|
+
throw new CliError({
|
|
899291
|
+
message: `Failed to load generator migrations for ${generatorName}.
|
|
899008
899292
|
|
|
899009
899293
|
Reason: ${errorMessage}
|
|
899010
899294
|
|
|
899011
|
-
Please check your internet connection and npm configuration, then try again
|
|
899295
|
+
Please check your internet connection and npm configuration, then try again.`,
|
|
899296
|
+
code: CliError.Code.InternalError
|
|
899297
|
+
});
|
|
899012
899298
|
}
|
|
899013
899299
|
}
|
|
899014
899300
|
/**
|
|
@@ -899037,7 +899323,10 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
899037
899323
|
const aVersion = import_semver14.default.parse(a4.version);
|
|
899038
899324
|
const bVersion = import_semver14.default.parse(b7.version);
|
|
899039
899325
|
if (aVersion == null || bVersion == null) {
|
|
899040
|
-
throw new
|
|
899326
|
+
throw new CliError({
|
|
899327
|
+
message: `Internal error: Invalid migration version found during sort. Version A: ${a4.version}, Version B: ${b7.version}. This should not happen as invalid versions are filtered out.`,
|
|
899328
|
+
code: CliError.Code.InternalError
|
|
899329
|
+
});
|
|
899041
899330
|
}
|
|
899042
899331
|
return import_semver14.default.compare(aVersion, bVersion);
|
|
899043
899332
|
});
|
|
@@ -899055,11 +899344,14 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
899055
899344
|
appliedVersions.push(migration23.version);
|
|
899056
899345
|
} catch (error50) {
|
|
899057
899346
|
const errorMessage = extractErrorMessage(error50);
|
|
899058
|
-
throw new
|
|
899347
|
+
throw new CliError({
|
|
899348
|
+
message: `Failed to apply migration for version ${migration23.version}.
|
|
899059
899349
|
|
|
899060
899350
|
Reason: ${errorMessage}
|
|
899061
899351
|
|
|
899062
|
-
Please report this issue at: https://github.com/fern-api/fern/issues
|
|
899352
|
+
Please report this issue at: https://github.com/fern-api/fern/issues`,
|
|
899353
|
+
code: CliError.Code.InternalError
|
|
899354
|
+
});
|
|
899063
899355
|
}
|
|
899064
899356
|
}
|
|
899065
899357
|
return {
|
|
@@ -918415,7 +918707,7 @@ var CliContext = class _CliContext {
|
|
|
918415
918707
|
if (false) {
|
|
918416
918708
|
this.logger.error("CLI_VERSION is not defined");
|
|
918417
918709
|
}
|
|
918418
|
-
return "4.81.0-
|
|
918710
|
+
return "4.81.0-9-ge0476cd3e22";
|
|
918419
918711
|
}
|
|
918420
918712
|
getCliName() {
|
|
918421
918713
|
if (false) {
|