@fern-api/fern-api-dev 4.81.1 → 4.82.0-3-gc1f31446d2e
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 +1288 -460
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -469477,6 +469477,7 @@ var CliError = class _CliError extends Error {
|
|
|
469477
469477
|
NetworkError: "NETWORK_ERROR",
|
|
469478
469478
|
AuthError: "AUTH_ERROR",
|
|
469479
469479
|
ConfigError: "CONFIG_ERROR",
|
|
469480
|
+
UserError: "USER_ERROR",
|
|
469480
469481
|
Unclassified: "UNCLASSIFIED"
|
|
469481
469482
|
};
|
|
469482
469483
|
})(CliError || (CliError = {}));
|
|
@@ -469493,6 +469494,7 @@ var SENTRY_REPORTABLE = {
|
|
|
469493
469494
|
[CliError.Code.NetworkError]: false,
|
|
469494
469495
|
[CliError.Code.AuthError]: false,
|
|
469495
469496
|
[CliError.Code.ConfigError]: false,
|
|
469497
|
+
[CliError.Code.UserError]: false,
|
|
469496
469498
|
[CliError.Code.Unclassified]: false
|
|
469497
469499
|
};
|
|
469498
469500
|
function shouldReportToSentry(code5) {
|
|
@@ -486635,7 +486637,7 @@ async function checkVersionDoesNotAlreadyExist({ version: version7, packageName,
|
|
|
486635
486637
|
}
|
|
486636
486638
|
if (exists2) {
|
|
486637
486639
|
if (isPublishMode) {
|
|
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
|
|
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.`, void 0, { code: CliError.Code.VersionError });
|
|
486639
486641
|
} else {
|
|
486640
486642
|
context3.logger.warn(`Version ${version7} of ${resolvedPackageName} already exists on the ${getRegistryName(language)} registry. If your CI pipeline publishes this version, it may fail.`);
|
|
486641
486643
|
}
|
|
@@ -518573,13 +518575,13 @@ function convertToHttpMethod(httpMethod) {
|
|
|
518573
518575
|
delete: () => schemas_exports2.HttpMethodSchema.Delete,
|
|
518574
518576
|
head: () => schemas_exports2.HttpMethodSchema.Head,
|
|
518575
518577
|
options: () => {
|
|
518576
|
-
throw new
|
|
518578
|
+
throw new CliError({ message: "OPTIONS is unsupported", code: CliError.Code.ConfigError });
|
|
518577
518579
|
},
|
|
518578
518580
|
trace: () => {
|
|
518579
|
-
throw new
|
|
518581
|
+
throw new CliError({ message: "TRACE is unsupported", code: CliError.Code.ConfigError });
|
|
518580
518582
|
},
|
|
518581
518583
|
_other: () => {
|
|
518582
|
-
throw new
|
|
518584
|
+
throw new CliError({ message: "Unknown http method is unsupported", code: CliError.Code.ConfigError });
|
|
518583
518585
|
}
|
|
518584
518586
|
});
|
|
518585
518587
|
}
|
|
@@ -518813,7 +518815,10 @@ function buildEndpoint({ endpoint: endpoint3, declarationFile, context: context3
|
|
|
518813
518815
|
};
|
|
518814
518816
|
},
|
|
518815
518817
|
_other: () => {
|
|
518816
|
-
throw new
|
|
518818
|
+
throw new CliError({
|
|
518819
|
+
message: "Unrecognized Response type: " + endpoint3.response?.type,
|
|
518820
|
+
code: CliError.Code.InternalError
|
|
518821
|
+
});
|
|
518817
518822
|
}
|
|
518818
518823
|
});
|
|
518819
518824
|
}
|
|
@@ -519343,7 +519348,10 @@ function getUnresolvedEndpointLocation(endpoint3) {
|
|
|
519343
519348
|
}
|
|
519344
519349
|
}
|
|
519345
519350
|
if (fileParts.length >= operationIdTokens.length) {
|
|
519346
|
-
throw new
|
|
519351
|
+
throw new CliError({
|
|
519352
|
+
message: `Cannot get file for endpoint ${JSON.stringify(endpoint3)}`,
|
|
519353
|
+
code: CliError.Code.InternalError
|
|
519354
|
+
});
|
|
519347
519355
|
}
|
|
519348
519356
|
return {
|
|
519349
519357
|
file: RelativeFilePath.of(camelCase_default(fileParts.join("_")) + ".yml"),
|
|
@@ -519585,7 +519593,10 @@ function buildWebhooks(context3) {
|
|
|
519585
519593
|
};
|
|
519586
519594
|
},
|
|
519587
519595
|
_other: () => {
|
|
519588
|
-
throw new
|
|
519596
|
+
throw new CliError({
|
|
519597
|
+
message: "Unrecognized Response type: " + webhook.response?.type,
|
|
519598
|
+
code: CliError.Code.InternalError
|
|
519599
|
+
});
|
|
519589
519600
|
}
|
|
519590
519601
|
});
|
|
519591
519602
|
}
|
|
@@ -520177,7 +520188,10 @@ var FernDefinitionDirectory = class _FernDefinitionDirectory {
|
|
|
520177
520188
|
}
|
|
520178
520189
|
const [directory, ...remainingPath] = pathParts;
|
|
520179
520190
|
if (directory == null) {
|
|
520180
|
-
throw new
|
|
520191
|
+
throw new CliError({
|
|
520192
|
+
message: `Internal error; cannot add file with path: ${pathParts}`,
|
|
520193
|
+
code: CliError.Code.InternalError
|
|
520194
|
+
});
|
|
520181
520195
|
}
|
|
520182
520196
|
if (!this.directories[directory]) {
|
|
520183
520197
|
this.directories[directory] = new _FernDefinitionDirectory();
|
|
@@ -524639,7 +524653,10 @@ function getSchemaFromFernType({ fernType, nameOverride, generatedName, title: t
|
|
|
524639
524653
|
string: (value2) => LiteralSchemaValue.string(value2),
|
|
524640
524654
|
boolean: (value2) => LiteralSchemaValue.boolean(value2),
|
|
524641
524655
|
_other: () => {
|
|
524642
|
-
throw new
|
|
524656
|
+
throw new CliError({
|
|
524657
|
+
message: "Unexpected literal type",
|
|
524658
|
+
code: CliError.Code.InternalError
|
|
524659
|
+
});
|
|
524643
524660
|
}
|
|
524644
524661
|
}),
|
|
524645
524662
|
description,
|
|
@@ -527796,7 +527813,10 @@ function convertToReferencedSchema(schema2, breadcrumbs, source2, preserveSchema
|
|
|
527796
527813
|
const availability = convertAvailability2(schema2);
|
|
527797
527814
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
527798
527815
|
if (schemaId == null) {
|
|
527799
|
-
throw new
|
|
527816
|
+
throw new CliError({
|
|
527817
|
+
message: `Invalid schema reference ${JSON.stringify(schema2)}`,
|
|
527818
|
+
code: CliError.Code.ReferenceError
|
|
527819
|
+
});
|
|
527800
527820
|
}
|
|
527801
527821
|
return Schema.reference({
|
|
527802
527822
|
// TODO(dsinghvi): references may contain files
|
|
@@ -528125,21 +528145,33 @@ var AbstractAsyncAPIParserContext = class {
|
|
|
528125
528145
|
*/
|
|
528126
528146
|
resolveSchemaReference(schema2) {
|
|
528127
528147
|
if (!schema2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
528128
|
-
throw new
|
|
528148
|
+
throw new CliError({
|
|
528149
|
+
message: `Failed to resolve schema reference: ${schema2.$ref}`,
|
|
528150
|
+
code: CliError.Code.ReferenceError
|
|
528151
|
+
});
|
|
528129
528152
|
}
|
|
528130
528153
|
const schemaKey = schema2.$ref.substring(SCHEMA_REFERENCE_PREFIX.length);
|
|
528131
528154
|
const splitSchemaKey = schemaKey.split("/");
|
|
528132
528155
|
const components = this.document.components;
|
|
528133
528156
|
if (components == null || components.schemas == null) {
|
|
528134
|
-
throw new
|
|
528157
|
+
throw new CliError({
|
|
528158
|
+
message: "Document does not have components.schemas.",
|
|
528159
|
+
code: CliError.Code.ReferenceError
|
|
528160
|
+
});
|
|
528135
528161
|
}
|
|
528136
528162
|
const [topKey, maybeProps, maybePropKey] = splitSchemaKey;
|
|
528137
528163
|
if (topKey == null || topKey === "") {
|
|
528138
|
-
throw new
|
|
528164
|
+
throw new CliError({
|
|
528165
|
+
message: `${schema2.$ref} cannot be resolved. No schema key provided.`,
|
|
528166
|
+
code: CliError.Code.ReferenceError
|
|
528167
|
+
});
|
|
528139
528168
|
}
|
|
528140
528169
|
let resolvedSchema = components.schemas[topKey];
|
|
528141
528170
|
if (resolvedSchema == null) {
|
|
528142
|
-
throw new
|
|
528171
|
+
throw new CliError({
|
|
528172
|
+
message: `Schema "${topKey}" is undefined in document.components.schemas.`,
|
|
528173
|
+
code: CliError.Code.ReferenceError
|
|
528174
|
+
});
|
|
528143
528175
|
}
|
|
528144
528176
|
if (isReferenceObject(resolvedSchema)) {
|
|
528145
528177
|
resolvedSchema = this.resolveSchemaReference(resolvedSchema);
|
|
@@ -528147,7 +528179,10 @@ var AbstractAsyncAPIParserContext = class {
|
|
|
528147
528179
|
if (maybeProps === "properties" && maybePropKey != null) {
|
|
528148
528180
|
const resolvedProperty = resolvedSchema.properties?.[maybePropKey];
|
|
528149
528181
|
if (resolvedProperty == null) {
|
|
528150
|
-
throw new
|
|
528182
|
+
throw new CliError({
|
|
528183
|
+
message: `Property "${maybePropKey}" not found on "${topKey}". Full ref: ${schema2.$ref}`,
|
|
528184
|
+
code: CliError.Code.ReferenceError
|
|
528185
|
+
});
|
|
528151
528186
|
} else if (isReferenceObject(resolvedProperty)) {
|
|
528152
528187
|
resolvedSchema = this.resolveSchemaReference(resolvedProperty);
|
|
528153
528188
|
} else {
|
|
@@ -528200,12 +528235,15 @@ var AsyncAPIV2ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
528200
528235
|
const MESSAGE_REFERENCE_PREFIX = "#/components/messages/";
|
|
528201
528236
|
const components = this.document.components;
|
|
528202
528237
|
if (components == null || components.messages == null || !message.$ref.startsWith(MESSAGE_REFERENCE_PREFIX)) {
|
|
528203
|
-
throw new
|
|
528238
|
+
throw new CliError({
|
|
528239
|
+
message: `Failed to resolve message reference: ${message.$ref} in v2 components`,
|
|
528240
|
+
code: CliError.Code.ReferenceError
|
|
528241
|
+
});
|
|
528204
528242
|
}
|
|
528205
528243
|
const messageKey = message.$ref.substring(MESSAGE_REFERENCE_PREFIX.length);
|
|
528206
528244
|
const resolvedMessage = components.messages[messageKey];
|
|
528207
528245
|
if (resolvedMessage == null) {
|
|
528208
|
-
throw new
|
|
528246
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
528209
528247
|
}
|
|
528210
528248
|
return resolvedMessage;
|
|
528211
528249
|
}
|
|
@@ -529037,7 +529075,10 @@ var ExampleTypeFactory = class _ExampleTypeFactory {
|
|
|
529037
529075
|
while (schema2.type === "reference") {
|
|
529038
529076
|
const resolvedSchema = this.schemas[schema2.schema];
|
|
529039
529077
|
if (resolvedSchema == null) {
|
|
529040
|
-
throw new
|
|
529078
|
+
throw new CliError({
|
|
529079
|
+
message: `Unexpected error: Failed to resolve schema reference: ${schema2.schema}`,
|
|
529080
|
+
code: CliError.Code.InternalError
|
|
529081
|
+
});
|
|
529041
529082
|
}
|
|
529042
529083
|
schema2 = resolvedSchema;
|
|
529043
529084
|
}
|
|
@@ -530366,7 +530407,10 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
530366
530407
|
while (schema2.type === "reference") {
|
|
530367
530408
|
const resolvedSchema = this.schemas[schema2.schema];
|
|
530368
530409
|
if (resolvedSchema == null) {
|
|
530369
|
-
throw new
|
|
530410
|
+
throw new CliError({
|
|
530411
|
+
message: `Unexpected error: Failed to resolve schema reference: ${schema2.schema}`,
|
|
530412
|
+
code: CliError.Code.InternalError
|
|
530413
|
+
});
|
|
530370
530414
|
}
|
|
530371
530415
|
schema2 = resolvedSchema;
|
|
530372
530416
|
}
|
|
@@ -530876,7 +530920,10 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530876
530920
|
getExampleMessageReference(message) {
|
|
530877
530921
|
const channelId = message.channelId ?? this.getDefaultChannelId();
|
|
530878
530922
|
if (channelId == null) {
|
|
530879
|
-
throw new
|
|
530923
|
+
throw new CliError({
|
|
530924
|
+
message: `Cannot resolve example message reference: no channelId provided and no channels found in document`,
|
|
530925
|
+
code: CliError.Code.InternalError
|
|
530926
|
+
});
|
|
530880
530927
|
}
|
|
530881
530928
|
return `#/channels/${channelId}/messages/${message.messageId}`;
|
|
530882
530929
|
}
|
|
@@ -530891,12 +530938,12 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530891
530938
|
resolveParameterReference(parameter6) {
|
|
530892
530939
|
const PARAMETER_REFERENCE_PREFIX2 = "#/components/parameters/";
|
|
530893
530940
|
if (this.document.components == null || this.document.components.parameters == null || !parameter6.$ref.startsWith(PARAMETER_REFERENCE_PREFIX2)) {
|
|
530894
|
-
throw new
|
|
530941
|
+
throw new CliError({ message: `Failed to resolve ${parameter6.$ref}`, code: CliError.Code.ReferenceError });
|
|
530895
530942
|
}
|
|
530896
530943
|
const parameterKey = parameter6.$ref.substring(PARAMETER_REFERENCE_PREFIX2.length);
|
|
530897
530944
|
const resolvedParameter = this.document.components.parameters[parameterKey];
|
|
530898
530945
|
if (resolvedParameter == null) {
|
|
530899
|
-
throw new
|
|
530946
|
+
throw new CliError({ message: `${parameter6.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530900
530947
|
}
|
|
530901
530948
|
if ("$ref" in resolvedParameter) {
|
|
530902
530949
|
return this.resolveParameterReference(resolvedParameter);
|
|
@@ -530908,10 +530955,16 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530908
530955
|
const CHANNELS_PATH_PART = "#/channels/";
|
|
530909
530956
|
const MESSAGE_REFERENCE_PREFIX = "#/components/messages/";
|
|
530910
530957
|
if (message == null) {
|
|
530911
|
-
throw new
|
|
530958
|
+
throw new CliError({
|
|
530959
|
+
message: "Cannot resolve message reference: message is null or undefined",
|
|
530960
|
+
code: CliError.Code.InternalError
|
|
530961
|
+
});
|
|
530912
530962
|
}
|
|
530913
530963
|
if (!message.$ref) {
|
|
530914
|
-
throw new
|
|
530964
|
+
throw new CliError({
|
|
530965
|
+
message: "Cannot resolve message reference: message.$ref is undefined or empty",
|
|
530966
|
+
code: CliError.Code.ReferenceError
|
|
530967
|
+
});
|
|
530915
530968
|
}
|
|
530916
530969
|
if (message.$ref.startsWith(CHANNELS_PATH_PART)) {
|
|
530917
530970
|
const parts = message.$ref.split("/");
|
|
@@ -530919,12 +530972,15 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530919
530972
|
const messageKey2 = parts[4];
|
|
530920
530973
|
const channelPath = rawChannelPath?.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
530921
530974
|
if (channelPath == null || messageKey2 == null || !this.document.channels?.[channelPath]) {
|
|
530922
|
-
throw new
|
|
530975
|
+
throw new CliError({
|
|
530976
|
+
message: `Failed to resolve message reference ${message.$ref} in channel ${channelPath}`,
|
|
530977
|
+
code: CliError.Code.ReferenceError
|
|
530978
|
+
});
|
|
530923
530979
|
}
|
|
530924
530980
|
const channel3 = this.document.channels[channelPath];
|
|
530925
530981
|
const resolvedInChannel = channel3.messages?.[messageKey2];
|
|
530926
530982
|
if (resolvedInChannel == null) {
|
|
530927
|
-
throw new
|
|
530983
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530928
530984
|
}
|
|
530929
530985
|
if ("$ref" in resolvedInChannel && !shallow) {
|
|
530930
530986
|
return this.resolveMessageReference(resolvedInChannel);
|
|
@@ -530937,12 +530993,15 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530937
530993
|
}
|
|
530938
530994
|
const components = this.document.components;
|
|
530939
530995
|
if (!message.$ref.startsWith(MESSAGE_REFERENCE_PREFIX) || !components?.messages) {
|
|
530940
|
-
throw new
|
|
530996
|
+
throw new CliError({
|
|
530997
|
+
message: `Failed to resolve message reference: ${message.$ref} in v3 components`,
|
|
530998
|
+
code: CliError.Code.ReferenceError
|
|
530999
|
+
});
|
|
530941
531000
|
}
|
|
530942
531001
|
const messageKey = message.$ref.substring(MESSAGE_REFERENCE_PREFIX.length);
|
|
530943
531002
|
const resolvedInComponents = components.messages[messageKey];
|
|
530944
531003
|
if (resolvedInComponents == null) {
|
|
530945
|
-
throw new
|
|
531004
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530946
531005
|
}
|
|
530947
531006
|
return {
|
|
530948
531007
|
...resolvedInComponents,
|
|
@@ -531065,14 +531124,20 @@ function parseAsyncAPIV3({ context: context3, breadcrumbs, source: source2, asyn
|
|
|
531065
531124
|
}));
|
|
531066
531125
|
const channelEvent = channelEvents[channelPath];
|
|
531067
531126
|
if (channelEvent == null) {
|
|
531068
|
-
throw new
|
|
531127
|
+
throw new CliError({
|
|
531128
|
+
message: `Internal error: channelEvents["${channelPath}"] is unexpectedly undefined for operation ${operationId}`,
|
|
531129
|
+
code: CliError.Code.InternalError
|
|
531130
|
+
});
|
|
531069
531131
|
}
|
|
531070
531132
|
if (operation.action === "receive") {
|
|
531071
531133
|
channelEvent.subscribe.push(...messagesWithMethodName);
|
|
531072
531134
|
} else if (operation.action === "send") {
|
|
531073
531135
|
channelEvent.publish.push(...messagesWithMethodName);
|
|
531074
531136
|
} else {
|
|
531075
|
-
throw new
|
|
531137
|
+
throw new CliError({
|
|
531138
|
+
message: `Operation ${operationId} has an invalid action: ${operation.action}`,
|
|
531139
|
+
code: CliError.Code.ValidationError
|
|
531140
|
+
});
|
|
531076
531141
|
}
|
|
531077
531142
|
}
|
|
531078
531143
|
for (const [channelPath, events] of Object.entries(channelEvents)) {
|
|
@@ -531336,42 +531401,63 @@ function decodeJsonPointerSegment(segment) {
|
|
|
531336
531401
|
}
|
|
531337
531402
|
function getChannelPathFromOperation(operation) {
|
|
531338
531403
|
if (!operation.channel) {
|
|
531339
|
-
throw new
|
|
531404
|
+
throw new CliError({
|
|
531405
|
+
message: "Operation is missing required 'channel' field",
|
|
531406
|
+
code: CliError.Code.ValidationError
|
|
531407
|
+
});
|
|
531340
531408
|
}
|
|
531341
531409
|
if (!operation.channel.$ref) {
|
|
531342
|
-
throw new
|
|
531410
|
+
throw new CliError({
|
|
531411
|
+
message: "Operation channel is missing required '$ref' field",
|
|
531412
|
+
code: CliError.Code.ValidationError
|
|
531413
|
+
});
|
|
531343
531414
|
}
|
|
531344
531415
|
if (!operation.channel.$ref.startsWith(CHANNEL_REFERENCE_PREFIX)) {
|
|
531345
|
-
throw new
|
|
531416
|
+
throw new CliError({
|
|
531417
|
+
message: `Failed to resolve channel path from operation ${operation.channel.$ref}`,
|
|
531418
|
+
code: CliError.Code.ReferenceError
|
|
531419
|
+
});
|
|
531346
531420
|
}
|
|
531347
531421
|
return decodeJsonPointerSegment(operation.channel.$ref.substring(CHANNEL_REFERENCE_PREFIX.length));
|
|
531348
531422
|
}
|
|
531349
531423
|
function convertChannelParameterLocation(location2) {
|
|
531350
|
-
|
|
531351
|
-
|
|
531352
|
-
|
|
531353
|
-
|
|
531354
|
-
|
|
531355
|
-
|
|
531356
|
-
|
|
531357
|
-
}
|
|
531358
|
-
const type8 = messageType.substring(LOCATION_PREFIX.length);
|
|
531359
|
-
if (type8 !== "header" && type8 !== "path" && type8 !== "payload") {
|
|
531360
|
-
throw new Error(`Invalid message type: ${type8}. Must be one of: header, path, payload`);
|
|
531361
|
-
}
|
|
531362
|
-
return { type: type8, parameterKey };
|
|
531363
|
-
} catch (error50) {
|
|
531364
|
-
throw new Error(`Invalid location format: ${location2}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`);
|
|
531424
|
+
const ASYNCAPI_RUNTIME_EXPRESSION_DOCS = "https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression";
|
|
531425
|
+
const [messageType, parameterKey] = location2.split("#/");
|
|
531426
|
+
if (messageType == null || parameterKey == null) {
|
|
531427
|
+
throw new CliError({
|
|
531428
|
+
message: `Invalid location format: ${location2}; unable to parse message type and parameter key. See ${ASYNCAPI_RUNTIME_EXPRESSION_DOCS} for the expected format.`,
|
|
531429
|
+
code: CliError.Code.ValidationError
|
|
531430
|
+
});
|
|
531365
531431
|
}
|
|
531432
|
+
if (!messageType.startsWith(LOCATION_PREFIX)) {
|
|
531433
|
+
throw new CliError({
|
|
531434
|
+
message: `Invalid location format: ${location2}; expected ${LOCATION_PREFIX} prefix`,
|
|
531435
|
+
code: CliError.Code.ValidationError
|
|
531436
|
+
});
|
|
531437
|
+
}
|
|
531438
|
+
const type8 = messageType.substring(LOCATION_PREFIX.length);
|
|
531439
|
+
if (type8 !== "header" && type8 !== "path" && type8 !== "payload") {
|
|
531440
|
+
throw new CliError({
|
|
531441
|
+
message: `Invalid message type: ${type8}. Must be one of: header, path, payload`,
|
|
531442
|
+
code: CliError.Code.ValidationError
|
|
531443
|
+
});
|
|
531444
|
+
}
|
|
531445
|
+
return { type: type8, parameterKey };
|
|
531366
531446
|
}
|
|
531367
531447
|
function getServerNameFromServerRef(servers, serverRef) {
|
|
531368
531448
|
if (!serverRef.$ref.startsWith(SERVER_REFERENCE_PREFIX)) {
|
|
531369
|
-
throw new
|
|
531449
|
+
throw new CliError({
|
|
531450
|
+
message: `Failed to resolve server name from server ref ${serverRef.$ref}`,
|
|
531451
|
+
code: CliError.Code.ReferenceError
|
|
531452
|
+
});
|
|
531370
531453
|
}
|
|
531371
531454
|
const serverName = serverRef.$ref.substring(SERVER_REFERENCE_PREFIX.length);
|
|
531372
531455
|
const server = servers[serverName];
|
|
531373
531456
|
if (server == null) {
|
|
531374
|
-
throw new
|
|
531457
|
+
throw new CliError({
|
|
531458
|
+
message: `Failed to find server with name ${serverName}`,
|
|
531459
|
+
code: CliError.Code.ReferenceError
|
|
531460
|
+
});
|
|
531375
531461
|
}
|
|
531376
531462
|
return server;
|
|
531377
531463
|
}
|
|
@@ -531560,7 +531646,7 @@ function convertPaginationExtension(pagination) {
|
|
|
531560
531646
|
results: customPagination.results
|
|
531561
531647
|
});
|
|
531562
531648
|
}
|
|
531563
|
-
throw new
|
|
531649
|
+
throw new CliError({ message: "Invalid pagination extension", code: CliError.Code.ValidationError });
|
|
531564
531650
|
}
|
|
531565
531651
|
function getFernPaginationExtension(document4, operation) {
|
|
531566
531652
|
const pagination = getExtension(operation, FernOpenAPIExtension.PAGINATION);
|
|
@@ -531570,7 +531656,10 @@ function getFernPaginationExtension(document4, operation) {
|
|
|
531570
531656
|
if (typeof pagination === "boolean") {
|
|
531571
531657
|
const topLevelPagination = getExtension(document4, FernOpenAPIExtension.PAGINATION);
|
|
531572
531658
|
if (typeof topLevelPagination === "boolean") {
|
|
531573
|
-
throw new
|
|
531659
|
+
throw new CliError({
|
|
531660
|
+
message: "Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",
|
|
531661
|
+
code: CliError.Code.ValidationError
|
|
531662
|
+
});
|
|
531574
531663
|
}
|
|
531575
531664
|
return topLevelPagination == null ? void 0 : convertPaginationExtension(topLevelPagination);
|
|
531576
531665
|
}
|
|
@@ -531889,12 +531978,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531889
531978
|
}
|
|
531890
531979
|
resolveParameterReference(parameter6) {
|
|
531891
531980
|
if (this.document.components == null || this.document.components.parameters == null || !parameter6.$ref.startsWith(PARAMETER_REFERENCE_PREFIX)) {
|
|
531892
|
-
throw new
|
|
531981
|
+
throw new CliError({ message: `Failed to resolve ${parameter6.$ref}`, code: CliError.Code.ReferenceError });
|
|
531893
531982
|
}
|
|
531894
531983
|
const parameterKey = parameter6.$ref.substring(PARAMETER_REFERENCE_PREFIX.length);
|
|
531895
531984
|
const resolvedParameter = this.document.components.parameters[parameterKey];
|
|
531896
531985
|
if (resolvedParameter == null) {
|
|
531897
|
-
throw new
|
|
531986
|
+
throw new CliError({ message: `${parameter6.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531898
531987
|
}
|
|
531899
531988
|
if (isReferenceObject(resolvedParameter)) {
|
|
531900
531989
|
return this.resolveParameterReference(resolvedParameter);
|
|
@@ -531903,12 +531992,15 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531903
531992
|
}
|
|
531904
531993
|
resolveRequestBodyReference(requestBody) {
|
|
531905
531994
|
if (this.document.components == null || this.document.components.requestBodies == null || !requestBody.$ref.startsWith(REQUEST_BODY_REFERENCE_PREFIX)) {
|
|
531906
|
-
throw new
|
|
531995
|
+
throw new CliError({
|
|
531996
|
+
message: `Failed to resolve ${requestBody.$ref}`,
|
|
531997
|
+
code: CliError.Code.ReferenceError
|
|
531998
|
+
});
|
|
531907
531999
|
}
|
|
531908
532000
|
const requestBodyKey = requestBody.$ref.substring(REQUEST_BODY_REFERENCE_PREFIX.length);
|
|
531909
532001
|
const resolvedRequestBody = this.document.components.requestBodies[requestBodyKey];
|
|
531910
532002
|
if (resolvedRequestBody == null) {
|
|
531911
|
-
throw new
|
|
532003
|
+
throw new CliError({ message: `${requestBody.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531912
532004
|
}
|
|
531913
532005
|
if (isReferenceObject(resolvedRequestBody)) {
|
|
531914
532006
|
return this.resolveRequestBodyReference(resolvedRequestBody);
|
|
@@ -531917,12 +532009,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531917
532009
|
}
|
|
531918
532010
|
resolveResponseReference(response) {
|
|
531919
532011
|
if (this.document.components == null || this.document.components.responses == null || !response.$ref.startsWith(RESPONSE_REFERENCE_PREFIX)) {
|
|
531920
|
-
throw new
|
|
532012
|
+
throw new CliError({ message: `Failed to resolve ${response.$ref}`, code: CliError.Code.ReferenceError });
|
|
531921
532013
|
}
|
|
531922
532014
|
const parameterKey = response.$ref.substring(RESPONSE_REFERENCE_PREFIX.length);
|
|
531923
532015
|
const resolvedResponse = this.document.components.responses[parameterKey];
|
|
531924
532016
|
if (resolvedResponse == null) {
|
|
531925
|
-
throw new
|
|
532017
|
+
throw new CliError({ message: `${response.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531926
532018
|
}
|
|
531927
532019
|
if (isReferenceObject(resolvedResponse)) {
|
|
531928
532020
|
return this.resolveResponseReference(resolvedResponse);
|
|
@@ -531931,12 +532023,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531931
532023
|
}
|
|
531932
532024
|
resolveExampleReference(example) {
|
|
531933
532025
|
if (this.document.components == null || this.document.components.examples == null || !example.$ref.startsWith(EXAMPLES_REFERENCE_PREFIX)) {
|
|
531934
|
-
throw new
|
|
532026
|
+
throw new CliError({ message: `Failed to resolve ${example.$ref}`, code: CliError.Code.ReferenceError });
|
|
531935
532027
|
}
|
|
531936
532028
|
const parameterKey = example.$ref.substring(EXAMPLES_REFERENCE_PREFIX.length);
|
|
531937
532029
|
const resolvedExample = this.document.components.examples[parameterKey];
|
|
531938
532030
|
if (resolvedExample == null) {
|
|
531939
|
-
throw new
|
|
532031
|
+
throw new CliError({ message: `${example.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531940
532032
|
}
|
|
531941
532033
|
if (isReferenceObject(resolvedExample)) {
|
|
531942
532034
|
return this.resolveExampleReference(resolvedExample);
|
|
@@ -531945,12 +532037,15 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531945
532037
|
}
|
|
531946
532038
|
resolveSecuritySchemeReference(securityScheme) {
|
|
531947
532039
|
if (this.document.components == null || this.document.components.securitySchemes == null || !securityScheme.$ref.startsWith(SECURITY_SCHEME_REFERENCE_PREFIX)) {
|
|
531948
|
-
throw new
|
|
532040
|
+
throw new CliError({
|
|
532041
|
+
message: `Failed to resolve ${securityScheme.$ref}`,
|
|
532042
|
+
code: CliError.Code.ReferenceError
|
|
532043
|
+
});
|
|
531949
532044
|
}
|
|
531950
532045
|
const securitySchemeKey = securityScheme.$ref.substring(SECURITY_SCHEME_REFERENCE_PREFIX.length);
|
|
531951
532046
|
const resolvedSecurityScheme = this.document.components.securitySchemes[securitySchemeKey];
|
|
531952
532047
|
if (resolvedSecurityScheme == null) {
|
|
531953
|
-
throw new
|
|
532048
|
+
throw new CliError({ message: `${securityScheme.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531954
532049
|
}
|
|
531955
532050
|
if (isReferenceObject(resolvedSecurityScheme)) {
|
|
531956
532051
|
return this.resolveSecuritySchemeReference(resolvedSecurityScheme);
|
|
@@ -532710,15 +532805,24 @@ function getMultipartPartEncodingFromContentType(contentType) {
|
|
|
532710
532805
|
}
|
|
532711
532806
|
function resolveSchema(schema2, document4) {
|
|
532712
532807
|
if (!schema2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
532713
|
-
throw new
|
|
532808
|
+
throw new CliError({
|
|
532809
|
+
message: `Failed to resolve schema reference because of unsupported prefix: ${schema2.$ref}`,
|
|
532810
|
+
code: CliError.Code.ReferenceError
|
|
532811
|
+
});
|
|
532714
532812
|
}
|
|
532715
532813
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
532716
532814
|
if (schemaId == null) {
|
|
532717
|
-
throw new
|
|
532815
|
+
throw new CliError({
|
|
532816
|
+
message: `Failed to resolve schema reference because missing schema id: ${schema2.$ref}`,
|
|
532817
|
+
code: CliError.Code.ReferenceError
|
|
532818
|
+
});
|
|
532718
532819
|
}
|
|
532719
532820
|
const resolvedSchema = document4.components?.schemas?.[schemaId];
|
|
532720
532821
|
if (resolvedSchema == null) {
|
|
532721
|
-
throw new
|
|
532822
|
+
throw new CliError({
|
|
532823
|
+
message: `Failed to resolve schema reference because missing: ${schema2.$ref}`,
|
|
532824
|
+
code: CliError.Code.ReferenceError
|
|
532825
|
+
});
|
|
532722
532826
|
}
|
|
532723
532827
|
if (isReferenceObject(resolvedSchema)) {
|
|
532724
532828
|
return resolveSchema(resolvedSchema, document4);
|
|
@@ -534215,7 +534319,10 @@ function getBasicSecuritySchemeNameAndEnvvar(securityScheme) {
|
|
|
534215
534319
|
function convertSecurityScheme(securityScheme, source2, taskContext, context3) {
|
|
534216
534320
|
if (isReferenceObject(securityScheme)) {
|
|
534217
534321
|
if (context3 == null) {
|
|
534218
|
-
throw new
|
|
534322
|
+
throw new CliError({
|
|
534323
|
+
message: `Converting referenced security schemes requires context: ${JSON.stringify(securityScheme)}`,
|
|
534324
|
+
code: CliError.Code.InternalError
|
|
534325
|
+
});
|
|
534219
534326
|
}
|
|
534220
534327
|
const resolvedSecurityScheme = context3.resolveSecuritySchemeReference(securityScheme);
|
|
534221
534328
|
return convertSecuritySchemeHelper(resolvedSecurityScheme, source2, taskContext);
|
|
@@ -534396,7 +534503,10 @@ function getVariableDefinitions(document4, preserveSchemaIds) {
|
|
|
534396
534503
|
}
|
|
534397
534504
|
];
|
|
534398
534505
|
} else {
|
|
534399
|
-
throw new
|
|
534506
|
+
throw new CliError({
|
|
534507
|
+
message: `Variable ${variableName} has unsupported schema ${JSON.stringify(schema2)}`,
|
|
534508
|
+
code: CliError.Code.ValidationError
|
|
534509
|
+
});
|
|
534400
534510
|
}
|
|
534401
534511
|
}));
|
|
534402
534512
|
}
|
|
@@ -535712,7 +535822,7 @@ async function validateSchema({ schema: schema2, value: value2, context: context
|
|
|
535712
535822
|
});
|
|
535713
535823
|
});
|
|
535714
535824
|
const errorMessage = [`Failed to parse file: ${import_path20.default.relative(process.cwd(), filepathBeingParsed)}`, ...issues].join("\n");
|
|
535715
|
-
return context3.failAndThrow(errorMessage);
|
|
535825
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
535716
535826
|
}
|
|
535717
535827
|
function joinZodPath(arr) {
|
|
535718
535828
|
return arr.reduce((acc, value2) => {
|
|
@@ -535745,7 +535855,9 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535745
535855
|
path: versionOrPath
|
|
535746
535856
|
};
|
|
535747
535857
|
} else {
|
|
535748
|
-
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}
|
|
535858
|
+
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}`, void 0, {
|
|
535859
|
+
code: CliError.Code.ConfigError
|
|
535860
|
+
});
|
|
535749
535861
|
}
|
|
535750
535862
|
} else {
|
|
535751
535863
|
const unprefixedCoordinate = coordinate.substring(1);
|
|
@@ -535760,12 +535872,14 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535760
535872
|
version: versionOrPath
|
|
535761
535873
|
};
|
|
535762
535874
|
} else {
|
|
535763
|
-
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}
|
|
535875
|
+
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}`, void 0, {
|
|
535876
|
+
code: CliError.Code.ConfigError
|
|
535877
|
+
});
|
|
535764
535878
|
}
|
|
535765
535879
|
}
|
|
535766
535880
|
}
|
|
535767
535881
|
if (context3.getResult() === TaskResult.Failure) {
|
|
535768
|
-
context3.failAndThrow();
|
|
535882
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ConfigError });
|
|
535769
535883
|
}
|
|
535770
535884
|
return {
|
|
535771
535885
|
dependencies
|
|
@@ -535921,7 +536035,7 @@ function getColorInstanceFromRawConfigOrThrow(raw, context3, key2, theme) {
|
|
|
535921
536035
|
}
|
|
535922
536036
|
const instance = tinycolor(color3);
|
|
535923
536037
|
if (!instance.isValid()) {
|
|
535924
|
-
context3.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF
|
|
536038
|
+
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
536039
|
}
|
|
535926
536040
|
return instance;
|
|
535927
536041
|
}
|
|
@@ -536535,7 +536649,7 @@ async function parseContext7File({ rawPath, absoluteFilepathToDocsConfig, contex
|
|
|
536535
536649
|
try {
|
|
536536
536650
|
JSON.parse(contents);
|
|
536537
536651
|
} catch (error50) {
|
|
536538
|
-
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50));
|
|
536652
|
+
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50), { code: CliError.Code.ConfigError });
|
|
536539
536653
|
}
|
|
536540
536654
|
return absolutePath;
|
|
536541
536655
|
}
|
|
@@ -536695,7 +536809,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536695
536809
|
featureFlags: convertFeatureFlag(product.featureFlag)
|
|
536696
536810
|
});
|
|
536697
536811
|
} else {
|
|
536698
|
-
throw new
|
|
536812
|
+
throw new CliError({
|
|
536813
|
+
message: `Invalid product configuration: product must have either 'path' or valid 'href' property`,
|
|
536814
|
+
code: CliError.Code.ConfigError
|
|
536815
|
+
});
|
|
536699
536816
|
}
|
|
536700
536817
|
}
|
|
536701
536818
|
return {
|
|
@@ -536710,7 +536827,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536710
536827
|
folderTitleSource
|
|
536711
536828
|
});
|
|
536712
536829
|
}
|
|
536713
|
-
throw new
|
|
536830
|
+
throw new CliError({
|
|
536831
|
+
message: "Unexpected. Docs have neither navigation or versions defined.",
|
|
536832
|
+
code: CliError.Code.ConfigError
|
|
536833
|
+
});
|
|
536714
536834
|
}
|
|
536715
536835
|
function convertFeatureFlag(flag) {
|
|
536716
536836
|
if (flag == null) {
|
|
@@ -536808,7 +536928,10 @@ function parseWeight(weight) {
|
|
|
536808
536928
|
async function convertNavigationTabConfiguration({ tabs, item, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536809
536929
|
const tab2 = tabs[item.tab];
|
|
536810
536930
|
if (tab2 == null) {
|
|
536811
|
-
throw new
|
|
536931
|
+
throw new CliError({
|
|
536932
|
+
message: `Tab ${item.tab} is not defined in the tabs config.`,
|
|
536933
|
+
code: CliError.Code.ConfigError
|
|
536934
|
+
});
|
|
536812
536935
|
}
|
|
536813
536936
|
if (tabbedNavigationItemHasVariants(item)) {
|
|
536814
536937
|
const variants = await Promise.all(item.variants.map(async (variant) => {
|
|
@@ -536937,7 +537060,9 @@ var DEFAULT_CHANGELOG_TITLE = "Changelog";
|
|
|
536937
537060
|
async function expandFolderConfiguration({ rawConfig, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536938
537061
|
const folderPath = resolveFilepath(rawConfig.folder, absolutePathToConfig);
|
|
536939
537062
|
if (!await doesPathExist(folderPath)) {
|
|
536940
|
-
context3.failAndThrow(`Folder not found: ${rawConfig.folder}
|
|
537063
|
+
context3.failAndThrow(`Folder not found: ${rawConfig.folder}`, void 0, {
|
|
537064
|
+
code: CliError.Code.ConfigError
|
|
537065
|
+
});
|
|
536941
537066
|
}
|
|
536942
537067
|
validateCollapsibleConfig({
|
|
536943
537068
|
context: context3,
|
|
@@ -537260,7 +537385,10 @@ function parseLibrariesConfiguration(libraries) {
|
|
|
537260
537385
|
const result = {};
|
|
537261
537386
|
for (const [name2, config5] of Object.entries(libraries)) {
|
|
537262
537387
|
if (!isGitLibraryInput(config5.input)) {
|
|
537263
|
-
throw new
|
|
537388
|
+
throw new CliError({
|
|
537389
|
+
message: `Library '${name2}' uses 'path' input which is not yet supported. Please use 'git' input.`,
|
|
537390
|
+
code: CliError.Code.ConfigError
|
|
537391
|
+
});
|
|
537264
537392
|
}
|
|
537265
537393
|
result[name2] = {
|
|
537266
537394
|
input: {
|
|
@@ -537449,10 +537577,10 @@ function parseAudiences(raw) {
|
|
|
537449
537577
|
}
|
|
537450
537578
|
function validateCollapsibleConfig({ context: context3, sectionTitle, collapsed, collapsible, collapsedByDefault }) {
|
|
537451
537579
|
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
|
|
537580
|
+
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
537581
|
}
|
|
537454
537582
|
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
|
|
537583
|
+
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
537584
|
}
|
|
537457
537585
|
}
|
|
537458
537586
|
|
|
@@ -537727,7 +537855,9 @@ function removeDefaultDockerOrgIfPresent(generatorName) {
|
|
|
537727
537855
|
function getGeneratorNameOrThrow(generatorName, context3) {
|
|
537728
537856
|
const normalizedGeneratorName = normalizeGeneratorName(generatorName);
|
|
537729
537857
|
if (normalizedGeneratorName == null) {
|
|
537730
|
-
return context3.failAndThrow("Unrecognized generator: " + generatorName
|
|
537858
|
+
return context3.failAndThrow("Unrecognized generator: " + generatorName, void 0, {
|
|
537859
|
+
code: CliError.Code.ConfigError
|
|
537860
|
+
});
|
|
537731
537861
|
}
|
|
537732
537862
|
return normalizedGeneratorName;
|
|
537733
537863
|
}
|
|
@@ -537854,9 +537984,9 @@ async function updateGeneratorGroup({ generatorsConfiguration, groupName = gener
|
|
|
537854
537984
|
const availableGroups = Object.keys(generatorsConfiguration.groups ?? {});
|
|
537855
537985
|
if (availableGroups.length > 0) {
|
|
537856
537986
|
const message = "No group specified. Use the --group option:\n" + availableGroups.map((name2) => ` \u203A ${name2}`).join("\n");
|
|
537857
|
-
return context3.failAndThrow(message);
|
|
537987
|
+
return context3.failAndThrow(message, void 0, { code: CliError.Code.ConfigError });
|
|
537858
537988
|
}
|
|
537859
|
-
return context3.failAndThrow("No group specified.");
|
|
537989
|
+
return context3.failAndThrow("No group specified.", void 0, { code: CliError.Code.ConfigError });
|
|
537860
537990
|
}
|
|
537861
537991
|
const groups2 = generatorsConfiguration.groups ??= {};
|
|
537862
537992
|
const group = groups2[groupName];
|
|
@@ -537880,7 +538010,9 @@ async function addGenerator({ generatorName, generatorsConfiguration, groupName
|
|
|
537880
538010
|
context: context3,
|
|
537881
538011
|
update: async (group) => {
|
|
537882
538012
|
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}
|
|
538013
|
+
context3.failAndThrow(`${generatorName} is already installed in group ${groupName}.`, void 0, {
|
|
538014
|
+
code: CliError.Code.ConfigError
|
|
538015
|
+
});
|
|
537884
538016
|
}
|
|
537885
538017
|
const latestVersion2 = await getLatestGeneratorVersion({
|
|
537886
538018
|
cliVersion,
|
|
@@ -544443,7 +544575,10 @@ function parseRemoveDiscriminantsFromSchemas(option) {
|
|
|
544443
544575
|
} else if (option === "never") {
|
|
544444
544576
|
return generators_yml_exports.RemoveDiscriminantsFromSchemas.Never;
|
|
544445
544577
|
}
|
|
544446
|
-
throw new
|
|
544578
|
+
throw new CliError({
|
|
544579
|
+
message: `Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${option}`,
|
|
544580
|
+
code: CliError.Code.ConfigError
|
|
544581
|
+
});
|
|
544447
544582
|
}
|
|
544448
544583
|
function mergeSettings(base4, override) {
|
|
544449
544584
|
return {
|
|
@@ -545010,7 +545145,10 @@ async function getGithubLicense({ absolutePathToGeneratorsConfiguration, githubL
|
|
|
545010
545145
|
function getGithubPublishInfo(output2, maybeGroupLevelMetadata, maybeTopLevelMetadata) {
|
|
545011
545146
|
switch (output2.location) {
|
|
545012
545147
|
case "local-file-system":
|
|
545013
|
-
throw new
|
|
545148
|
+
throw new CliError({
|
|
545149
|
+
message: "Cannot use local-file-system with github publishing",
|
|
545150
|
+
code: CliError.Code.ConfigError
|
|
545151
|
+
});
|
|
545014
545152
|
case "npm":
|
|
545015
545153
|
return api_exports4.GithubPublishInfo.npm({
|
|
545016
545154
|
registryUrl: output2.url ?? "https://registry.npmjs.org",
|
|
@@ -545203,7 +545341,10 @@ async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context
|
|
|
545203
545341
|
if (parsed.ok) {
|
|
545204
545342
|
return parsed.value;
|
|
545205
545343
|
}
|
|
545206
|
-
throw new
|
|
545344
|
+
throw new CliError({
|
|
545345
|
+
message: parsed.errors.map((e5) => e5.message).join("\n"),
|
|
545346
|
+
code: CliError.Code.ConfigError
|
|
545347
|
+
});
|
|
545207
545348
|
} catch (e5) {
|
|
545208
545349
|
if (e5 instanceof jsYaml.YAMLException) {
|
|
545209
545350
|
const relativePath = import_path24.default.relative(process.cwd(), filepath);
|
|
@@ -545225,7 +545366,7 @@ ${e5.mark.snippet}`;
|
|
|
545225
545366
|
errorMessage += '\n\nHint: Values starting with "@" (such as scoped npm packages) must be wrapped in quotes.\n Example: package-name: "@scope/package"';
|
|
545226
545367
|
}
|
|
545227
545368
|
}
|
|
545228
|
-
context3.failAndThrow(errorMessage);
|
|
545369
|
+
context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
545229
545370
|
} else {
|
|
545230
545371
|
throw e5;
|
|
545231
545372
|
}
|
|
@@ -551709,7 +551850,7 @@ function parseTypeName({ typeName, file: file4 }) {
|
|
|
551709
551850
|
imports: file4.imports
|
|
551710
551851
|
});
|
|
551711
551852
|
if (reference4 == null) {
|
|
551712
|
-
throw new
|
|
551853
|
+
throw new CliError({ message: "Failed to locate type: " + typeName, code: CliError.Code.ResolutionError });
|
|
551713
551854
|
}
|
|
551714
551855
|
const nameWithoutId = {
|
|
551715
551856
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -551919,7 +552060,7 @@ function convertHttpRequestBody({ request: request7, file: file4 }) {
|
|
|
551919
552060
|
}
|
|
551920
552061
|
if (isInlineRequestBody(request7.body)) {
|
|
551921
552062
|
if (request7.name == null) {
|
|
551922
|
-
throw new
|
|
552063
|
+
throw new CliError({ message: "Name is missing for inlined request", code: CliError.Code.InternalError });
|
|
551923
552064
|
}
|
|
551924
552065
|
return HttpRequestBody.inlinedRequestBody({
|
|
551925
552066
|
name: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552009,13 +552150,19 @@ function getObjectPropertyFromResolvedType({ typeResolver, file: file4, resolved
|
|
|
552009
552150
|
default:
|
|
552010
552151
|
assertNever(resolvedType);
|
|
552011
552152
|
}
|
|
552012
|
-
throw new
|
|
552153
|
+
throw new CliError({
|
|
552154
|
+
message: "Internal error; response must be an object in order to return a property as a response",
|
|
552155
|
+
code: CliError.Code.InternalError
|
|
552156
|
+
});
|
|
552013
552157
|
}
|
|
552014
552158
|
function getObjectPropertyFromObjectSchema({ typeResolver, file: file4, objectSchema, property: property24 }) {
|
|
552015
552159
|
const properties7 = getAllPropertiesForRawObjectSchema(objectSchema, file4, typeResolver);
|
|
552016
552160
|
const objectProperty = properties7[property24];
|
|
552017
552161
|
if (objectProperty == null) {
|
|
552018
|
-
throw new
|
|
552162
|
+
throw new CliError({
|
|
552163
|
+
message: `Object does not have a property named ${property24}.`,
|
|
552164
|
+
code: CliError.Code.ReferenceError
|
|
552165
|
+
});
|
|
552019
552166
|
}
|
|
552020
552167
|
return objectProperty;
|
|
552021
552168
|
}
|
|
@@ -552048,7 +552195,10 @@ function getAllPropertiesForExtendedType(extendedType, file4, typeResolver) {
|
|
|
552048
552195
|
if (resolvedType._type === "named" && isRawObjectDefinition(resolvedType.declaration)) {
|
|
552049
552196
|
return getAllPropertiesForRawObjectSchema(resolvedType.declaration, file4, typeResolver);
|
|
552050
552197
|
}
|
|
552051
|
-
throw new
|
|
552198
|
+
throw new CliError({
|
|
552199
|
+
message: `Extended type ${extendedType} must be another named type`,
|
|
552200
|
+
code: CliError.Code.InternalError
|
|
552201
|
+
});
|
|
552052
552202
|
}
|
|
552053
552203
|
|
|
552054
552204
|
// ../generation/ir-generator/lib/converters/services/convertProperty.js
|
|
@@ -552112,7 +552262,10 @@ function getPropertyTypeFromObjectSchema({ typeResolver, file: file4, objectSche
|
|
|
552112
552262
|
});
|
|
552113
552263
|
const propertyType = properties7[property24];
|
|
552114
552264
|
if (propertyType == null) {
|
|
552115
|
-
throw new
|
|
552265
|
+
throw new CliError({
|
|
552266
|
+
message: `Response does not have a property named ${property24}.`,
|
|
552267
|
+
code: CliError.Code.ReferenceError
|
|
552268
|
+
});
|
|
552116
552269
|
}
|
|
552117
552270
|
return propertyType;
|
|
552118
552271
|
}
|
|
@@ -552153,7 +552306,10 @@ function getAllPropertiesForExtendedType2({ typeResolver, file: file4, extendedT
|
|
|
552153
552306
|
objectSchema: resolvedType.declaration
|
|
552154
552307
|
});
|
|
552155
552308
|
}
|
|
552156
|
-
throw new
|
|
552309
|
+
throw new CliError({
|
|
552310
|
+
message: `Extended type ${extendedType} must be another named type.`,
|
|
552311
|
+
code: CliError.Code.InternalError
|
|
552312
|
+
});
|
|
552157
552313
|
}
|
|
552158
552314
|
function maybeFileFromResolvedType(resolvedType) {
|
|
552159
552315
|
if (resolvedType == null) {
|
|
@@ -552209,7 +552365,7 @@ function convertHttpSdkRequest({ request: request7, endpointKey, endpoint: endpo
|
|
|
552209
552365
|
function convertHttpSdkRequestShape({ service, request: request7, file: file4, typeResolver }) {
|
|
552210
552366
|
const constructWrapper = () => {
|
|
552211
552367
|
if (typeof request7 === "string" || request7?.name == null) {
|
|
552212
|
-
throw new
|
|
552368
|
+
throw new CliError({ message: "Name is missing for request wrapper", code: CliError.Code.InternalError });
|
|
552213
552369
|
}
|
|
552214
552370
|
return SdkRequestShape.wrapper({
|
|
552215
552371
|
wrapperName: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552389,7 +552545,7 @@ function parseErrorName({ errorName, file: file4 }) {
|
|
|
552389
552545
|
imports: file4.imports
|
|
552390
552546
|
});
|
|
552391
552547
|
if (reference4 == null) {
|
|
552392
|
-
throw new
|
|
552548
|
+
throw new CliError({ message: "Failed to locate error " + errorName, code: CliError.Code.ResolutionError });
|
|
552393
552549
|
}
|
|
552394
552550
|
const nameWithoutId = {
|
|
552395
552551
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -552859,7 +553015,10 @@ function validateObjectExample({ typeName, typeNameForBreadcrumb, rawObject, fil
|
|
|
552859
553015
|
} else {
|
|
552860
553016
|
const definitionFile = getDefinitionFile(workspace, propertyWithPath.filepathOfDeclaration);
|
|
552861
553017
|
if (definitionFile == null) {
|
|
552862
|
-
throw new
|
|
553018
|
+
throw new CliError({
|
|
553019
|
+
message: "Service file does not exist for property: " + propertyWithPath.wireKey,
|
|
553020
|
+
code: CliError.Code.InternalError
|
|
553021
|
+
});
|
|
552863
553022
|
}
|
|
552864
553023
|
violations.push(...validateTypeReferenceExample({
|
|
552865
553024
|
rawTypeReference: propertyWithPath.propertyType,
|
|
@@ -553334,7 +553493,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553334
553493
|
base64: () => validateString(example),
|
|
553335
553494
|
bigInteger: () => validateString(example),
|
|
553336
553495
|
_other: () => {
|
|
553337
|
-
throw new
|
|
553496
|
+
throw new CliError({
|
|
553497
|
+
message: "Unknown primitive type v2: " + primitiveType2.v2,
|
|
553498
|
+
code: CliError.Code.InternalError
|
|
553499
|
+
});
|
|
553338
553500
|
}
|
|
553339
553501
|
});
|
|
553340
553502
|
}
|
|
@@ -553354,7 +553516,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553354
553516
|
base64: () => validateString(example),
|
|
553355
553517
|
bigInteger: () => validateString(example),
|
|
553356
553518
|
_other: () => {
|
|
553357
|
-
throw new
|
|
553519
|
+
throw new CliError({
|
|
553520
|
+
message: "Unknown primitive type: " + primitiveType2.v1,
|
|
553521
|
+
code: CliError.Code.InternalError
|
|
553522
|
+
});
|
|
553358
553523
|
}
|
|
553359
553524
|
});
|
|
553360
553525
|
}
|
|
@@ -553577,7 +553742,10 @@ function convertEnumTypeDeclaration({ _enum: _enum3, file: file4 }) {
|
|
|
553577
553742
|
if (_enum3.default != null) {
|
|
553578
553743
|
defaultValue = values2.find((enumValue) => getWireValue(enumValue.name) === _enum3.default);
|
|
553579
553744
|
if (defaultValue == null) {
|
|
553580
|
-
throw new
|
|
553745
|
+
throw new CliError({
|
|
553746
|
+
message: `Default value ${_enum3.default} not found in enum values`,
|
|
553747
|
+
code: CliError.Code.ValidationError
|
|
553748
|
+
});
|
|
553581
553749
|
}
|
|
553582
553750
|
}
|
|
553583
553751
|
return {
|
|
@@ -553646,18 +553814,27 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553646
553814
|
discriminatedUnion: (rawUnion) => {
|
|
553647
553815
|
const discriminant21 = getUnionDiscriminant(rawUnion);
|
|
553648
553816
|
if (!isPlainObject4(example)) {
|
|
553649
|
-
throw new
|
|
553817
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553650
553818
|
}
|
|
553651
553819
|
const discriminantValueForExample = example[discriminant21];
|
|
553652
553820
|
if (discriminantValueForExample == null) {
|
|
553653
|
-
throw new
|
|
553821
|
+
throw new CliError({
|
|
553822
|
+
message: "Example is missing discriminant: " + discriminant21,
|
|
553823
|
+
code: CliError.Code.ValidationError
|
|
553824
|
+
});
|
|
553654
553825
|
}
|
|
553655
553826
|
if (typeof discriminantValueForExample !== "string") {
|
|
553656
|
-
throw new
|
|
553827
|
+
throw new CliError({
|
|
553828
|
+
message: "Discriminant value is not a string",
|
|
553829
|
+
code: CliError.Code.ValidationError
|
|
553830
|
+
});
|
|
553657
553831
|
}
|
|
553658
553832
|
const rawSingleUnionType = rawUnion.union[discriminantValueForExample];
|
|
553659
553833
|
if (rawSingleUnionType == null) {
|
|
553660
|
-
throw new
|
|
553834
|
+
throw new CliError({
|
|
553835
|
+
message: `${discriminantValueForExample} is not one of the specified discriminant values.`,
|
|
553836
|
+
code: CliError.Code.ValidationError
|
|
553837
|
+
});
|
|
553661
553838
|
}
|
|
553662
553839
|
const rawValueType = typeof rawSingleUnionType === "string" ? rawSingleUnionType : typeof rawSingleUnionType.type === "string" ? rawSingleUnionType.type : void 0;
|
|
553663
553840
|
const baseProperties = Object.entries(rawUnion["base-properties"] ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553688,7 +553865,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553688
553865
|
referenceToNamedType: extendedTypeName
|
|
553689
553866
|
});
|
|
553690
553867
|
if (resolvedExtendedType._type !== "named" || !isRawObjectDefinition(resolvedExtendedType.declaration)) {
|
|
553691
|
-
throw new
|
|
553868
|
+
throw new CliError({
|
|
553869
|
+
message: "Extended type is not a named object",
|
|
553870
|
+
code: CliError.Code.InternalError
|
|
553871
|
+
});
|
|
553692
553872
|
}
|
|
553693
553873
|
const extendedObject = resolvedExtendedType.declaration;
|
|
553694
553874
|
const propertiesFromExtension = Object.entries(extendedObject.properties ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553741,7 +553921,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553741
553921
|
enum: (rawEnum) => {
|
|
553742
553922
|
if (typeof example !== "string") {
|
|
553743
553923
|
const validValues = rawEnum.enum.map((enumEntry) => typeof enumEntry === "string" ? enumEntry : enumEntry.value).join(", ");
|
|
553744
|
-
throw new
|
|
553924
|
+
throw new CliError({
|
|
553925
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553926
|
+
code: CliError.Code.ValidationError
|
|
553927
|
+
});
|
|
553745
553928
|
}
|
|
553746
553929
|
return ExampleTypeShape.enum({
|
|
553747
553930
|
value: fileContainingExample.casingsGenerator.generateNameAndWireValue({
|
|
@@ -553782,7 +553965,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553782
553965
|
return typeof variant === "string" ? variant : variant.type;
|
|
553783
553966
|
});
|
|
553784
553967
|
const validValues = variantOptions.join(", ");
|
|
553785
|
-
throw new
|
|
553968
|
+
throw new CliError({
|
|
553969
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553970
|
+
code: CliError.Code.ValidationError
|
|
553971
|
+
});
|
|
553786
553972
|
}
|
|
553787
553973
|
});
|
|
553788
553974
|
}
|
|
@@ -553809,7 +553995,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553809
553995
|
},
|
|
553810
553996
|
map: ({ keyType, valueType }) => {
|
|
553811
553997
|
if (!isPlainObject4(resolvedExample)) {
|
|
553812
|
-
throw new
|
|
553998
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553813
553999
|
}
|
|
553814
554000
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553815
554001
|
return ExampleTypeReferenceShape.container(ExampleContainer.map({
|
|
@@ -553841,7 +554027,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553841
554027
|
},
|
|
553842
554028
|
list: (itemType) => {
|
|
553843
554029
|
if (!Array.isArray(resolvedExample)) {
|
|
553844
|
-
throw new
|
|
554030
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553845
554031
|
}
|
|
553846
554032
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553847
554033
|
return ExampleTypeReferenceShape.container(ExampleContainer.list({
|
|
@@ -553860,7 +554046,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553860
554046
|
},
|
|
553861
554047
|
set: (itemType) => {
|
|
553862
554048
|
if (!Array.isArray(resolvedExample)) {
|
|
553863
|
-
throw new
|
|
554049
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553864
554050
|
}
|
|
553865
554051
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553866
554052
|
return ExampleTypeReferenceShape.container(ExampleContainer.set({
|
|
@@ -553930,7 +554116,10 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553930
554116
|
});
|
|
553931
554117
|
const parsedReferenceToNamedType = fileContainingRawTypeReference.parseTypeReference(named);
|
|
553932
554118
|
if (parsedReferenceToNamedType.type !== "named") {
|
|
553933
|
-
throw new
|
|
554119
|
+
throw new CliError({
|
|
554120
|
+
message: "Type reference is not to a named type.",
|
|
554121
|
+
code: CliError.Code.InternalError
|
|
554122
|
+
});
|
|
553934
554123
|
}
|
|
553935
554124
|
const typeName = {
|
|
553936
554125
|
typeId: parsedReferenceToNamedType.typeId,
|
|
@@ -554088,13 +554277,19 @@ function convertPrimitiveExample({ example, typeBeingExemplified }) {
|
|
|
554088
554277
|
}));
|
|
554089
554278
|
},
|
|
554090
554279
|
_other: () => {
|
|
554091
|
-
throw new
|
|
554280
|
+
throw new CliError({
|
|
554281
|
+
message: "Unknown primitive type: " + typeBeingExemplified,
|
|
554282
|
+
code: CliError.Code.InternalError
|
|
554283
|
+
});
|
|
554092
554284
|
}
|
|
554093
554285
|
});
|
|
554094
554286
|
}
|
|
554095
554287
|
function convertObject4({ typeName, rawObject, example, fileContainingType, fileContainingExample, typeResolver, exampleResolver, workspace, recursionContext }) {
|
|
554096
554288
|
if (!isPlainObject4(example)) {
|
|
554097
|
-
throw new
|
|
554289
|
+
throw new CliError({
|
|
554290
|
+
message: `Example is not an object. Got: ${JSON.stringify(example)}`,
|
|
554291
|
+
code: CliError.Code.ValidationError
|
|
554292
|
+
});
|
|
554098
554293
|
}
|
|
554099
554294
|
const properties7 = Object.entries(example).map(([wireKey, propertyExample]) => {
|
|
554100
554295
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
@@ -554169,7 +554364,10 @@ function getOriginalTypeDeclarationForPropertyFromExtensions({ wirePropertyKey,
|
|
|
554169
554364
|
file: file4
|
|
554170
554365
|
});
|
|
554171
554366
|
if (resolvedType._type !== "named" || !isRawObjectDefinition(resolvedType.declaration)) {
|
|
554172
|
-
throw new
|
|
554367
|
+
throw new CliError({
|
|
554368
|
+
message: "Extension is not of a named object",
|
|
554369
|
+
code: CliError.Code.InternalError
|
|
554370
|
+
});
|
|
554173
554371
|
}
|
|
554174
554372
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
554175
554373
|
wirePropertyKey,
|
|
@@ -554206,7 +554404,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554206
554404
|
switch (parsedSingleUnionTypeProperties.propertiesType) {
|
|
554207
554405
|
case "singleProperty": {
|
|
554208
554406
|
if (!isPlainObject4(example)) {
|
|
554209
|
-
throw new
|
|
554407
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554210
554408
|
}
|
|
554211
554409
|
return {
|
|
554212
554410
|
wireDiscriminantValue,
|
|
@@ -554224,7 +554422,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554224
554422
|
}
|
|
554225
554423
|
case "samePropertiesAsObject": {
|
|
554226
554424
|
if (!isPlainObject4(example)) {
|
|
554227
|
-
throw new
|
|
554425
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554228
554426
|
}
|
|
554229
554427
|
let rawDeclaration = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
554230
554428
|
referenceToNamedType: rawValueType,
|
|
@@ -554237,7 +554435,10 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554237
554435
|
});
|
|
554238
554436
|
}
|
|
554239
554437
|
if (!isRawObjectDefinition(rawDeclaration.declaration)) {
|
|
554240
|
-
throw new
|
|
554438
|
+
throw new CliError({
|
|
554439
|
+
message: `${rawValueType} is not an object`,
|
|
554440
|
+
code: CliError.Code.ValidationError
|
|
554441
|
+
});
|
|
554241
554442
|
}
|
|
554242
554443
|
const typeName = {
|
|
554243
554444
|
typeId: parsedSingleUnionTypeProperties.typeId,
|
|
@@ -554320,7 +554521,10 @@ function convertExampleEndpointCall2({ service, endpoint: endpoint3, example, ty
|
|
|
554320
554521
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
554321
554522
|
const queryParameterDeclaration = typeof endpoint3.request !== "string" ? endpoint3.request?.["query-parameters"]?.[wireKey] : void 0;
|
|
554322
554523
|
if (queryParameterDeclaration == null) {
|
|
554323
|
-
throw new
|
|
554524
|
+
throw new CliError({
|
|
554525
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
554526
|
+
code: CliError.Code.ReferenceError
|
|
554527
|
+
});
|
|
554324
554528
|
}
|
|
554325
554529
|
const isAllowMultiple = typeof queryParameterDeclaration !== "string" && queryParameterDeclaration["allow-multiple"] === true;
|
|
554326
554530
|
const rawType = typeof queryParameterDeclaration === "string" ? queryParameterDeclaration : queryParameterDeclaration.type;
|
|
@@ -554429,7 +554633,10 @@ function convertPathParameters({ service, endpoint: endpoint3, example, typeReso
|
|
|
554429
554633
|
examplePathParameter
|
|
554430
554634
|
}));
|
|
554431
554635
|
} else {
|
|
554432
|
-
throw new
|
|
554636
|
+
throw new CliError({
|
|
554637
|
+
message: `Path parameter ${key2} does not exist`,
|
|
554638
|
+
code: CliError.Code.ReferenceError
|
|
554639
|
+
});
|
|
554433
554640
|
}
|
|
554434
554641
|
}
|
|
554435
554642
|
}
|
|
@@ -554509,7 +554716,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554509
554716
|
return void 0;
|
|
554510
554717
|
}
|
|
554511
554718
|
if (!isPlainObject4(example.request)) {
|
|
554512
|
-
throw new
|
|
554719
|
+
throw new CliError({
|
|
554720
|
+
message: `Example is not an object. Got: ${JSON.stringify(example.request)}`,
|
|
554721
|
+
code: CliError.Code.ValidationError
|
|
554722
|
+
});
|
|
554513
554723
|
}
|
|
554514
554724
|
const exampleProperties = [];
|
|
554515
554725
|
const exampleExtraProperties = [];
|
|
@@ -554559,7 +554769,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554559
554769
|
});
|
|
554560
554770
|
continue;
|
|
554561
554771
|
}
|
|
554562
|
-
throw new
|
|
554772
|
+
throw new CliError({
|
|
554773
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
554774
|
+
code: CliError.Code.ResolutionError
|
|
554775
|
+
});
|
|
554563
554776
|
}
|
|
554564
554777
|
exampleProperties.push({
|
|
554565
554778
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -554944,7 +555157,7 @@ function getPaginationPropertyComponents(endpointPagination) {
|
|
|
554944
555157
|
results: getResponsePropertyComponents(endpointPagination.results)
|
|
554945
555158
|
};
|
|
554946
555159
|
}
|
|
554947
|
-
throw new
|
|
555160
|
+
throw new CliError({ message: "Invalid pagination schema", code: CliError.Code.ValidationError });
|
|
554948
555161
|
}
|
|
554949
555162
|
function isRawCursorPaginationSchema(rawPaginationSchema) {
|
|
554950
555163
|
return rawPaginationSchema.cursor != null;
|
|
@@ -555115,7 +555328,10 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555115
555328
|
return void 0;
|
|
555116
555329
|
}
|
|
555117
555330
|
if (isHttpService && isGrpcEndpoint) {
|
|
555118
|
-
throw new
|
|
555331
|
+
throw new CliError({
|
|
555332
|
+
message: "Cannot have a grpc endpoint on an http service",
|
|
555333
|
+
code: CliError.Code.ValidationError
|
|
555334
|
+
});
|
|
555119
555335
|
}
|
|
555120
555336
|
if (isGrpcService && isHttpEndpoint) {
|
|
555121
555337
|
return Transport.http();
|
|
@@ -555129,8 +555345,11 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555129
555345
|
return createProtobufService(file4, protoSource, sourceResolver, serviceNameOverride);
|
|
555130
555346
|
}
|
|
555131
555347
|
}
|
|
555132
|
-
throw new
|
|
555133
|
-
|
|
555348
|
+
throw new CliError({
|
|
555349
|
+
message: `Internal error; failed to determine endpoint transport for
|
|
555350
|
+
${JSON.stringify(endpointDeclaration)}"`,
|
|
555351
|
+
code: CliError.Code.InternalError
|
|
555352
|
+
});
|
|
555134
555353
|
}
|
|
555135
555354
|
function createProtobufService(file4, source2, sourceResolver, serviceNameOverride) {
|
|
555136
555355
|
const resolvedSource = sourceResolver.resolveSourceOrThrow({
|
|
@@ -555138,14 +555357,20 @@ function createProtobufService(file4, source2, sourceResolver, serviceNameOverri
|
|
|
555138
555357
|
relativeFilepath: file4.relativeFilepath
|
|
555139
555358
|
});
|
|
555140
555359
|
if (resolvedSource == null || resolvedSource.type !== "protobuf") {
|
|
555141
|
-
throw new
|
|
555360
|
+
throw new CliError({
|
|
555361
|
+
message: `Expected a protobuf source for ${source2.proto}.`,
|
|
555362
|
+
code: CliError.Code.ResolutionError
|
|
555363
|
+
});
|
|
555142
555364
|
}
|
|
555143
555365
|
const protobufService = convertProtobufService({
|
|
555144
555366
|
source: resolvedSource,
|
|
555145
555367
|
serviceNameOverride
|
|
555146
555368
|
});
|
|
555147
555369
|
if (protobufService == null) {
|
|
555148
|
-
throw new
|
|
555370
|
+
throw new CliError({
|
|
555371
|
+
message: `Failed to resolve service name from ${resolvedSource.relativeFilePath}.`,
|
|
555372
|
+
code: CliError.Code.IrConversionError
|
|
555373
|
+
});
|
|
555149
555374
|
}
|
|
555150
555375
|
return Transport.grpc({
|
|
555151
555376
|
service: protobufService
|
|
@@ -555357,7 +555582,7 @@ function resolvePathParameterOrThrow({ parameter: parameter6, variableResolver,
|
|
|
555357
555582
|
file: file4
|
|
555358
555583
|
});
|
|
555359
555584
|
if (resolved == null) {
|
|
555360
|
-
throw new
|
|
555585
|
+
throw new CliError({ message: "Cannot resolve path parameter", code: CliError.Code.InternalError });
|
|
555361
555586
|
}
|
|
555362
555587
|
return resolved;
|
|
555363
555588
|
}
|
|
@@ -555638,7 +555863,10 @@ var DynamicSnippetsConverter = class {
|
|
|
555638
555863
|
return dynamic_exports.Request.body({ pathParameters, body: void 0 });
|
|
555639
555864
|
}
|
|
555640
555865
|
if (endpoint3.sdkRequest == null) {
|
|
555641
|
-
throw new
|
|
555866
|
+
throw new CliError({
|
|
555867
|
+
message: `Internal error; endpoint "${endpoint3.id}" has a request body but no SDK request`,
|
|
555868
|
+
code: CliError.Code.InternalError
|
|
555869
|
+
});
|
|
555642
555870
|
}
|
|
555643
555871
|
switch (endpoint3.sdkRequest.shape.type) {
|
|
555644
555872
|
case "justRequestBody":
|
|
@@ -556131,7 +556359,7 @@ var DynamicSnippetsConverter = class {
|
|
|
556131
556359
|
}))
|
|
556132
556360
|
}),
|
|
556133
556361
|
_other: () => {
|
|
556134
|
-
throw new
|
|
556362
|
+
throw new CliError({ message: "Unknown environments type", code: CliError.Code.InternalError });
|
|
556135
556363
|
}
|
|
556136
556364
|
})
|
|
556137
556365
|
};
|
|
@@ -556168,10 +556396,16 @@ var DynamicSnippetsConverter = class {
|
|
|
556168
556396
|
resolveObjectTypeOrThrow(typeId) {
|
|
556169
556397
|
const typeDeclaration2 = this.ir.types[typeId];
|
|
556170
556398
|
if (typeDeclaration2 == null) {
|
|
556171
|
-
throw new
|
|
556399
|
+
throw new CliError({
|
|
556400
|
+
message: `Internal error; type "${typeId}" not found`,
|
|
556401
|
+
code: CliError.Code.InternalError
|
|
556402
|
+
});
|
|
556172
556403
|
}
|
|
556173
556404
|
if (typeDeclaration2.shape.type !== "object") {
|
|
556174
|
-
throw new
|
|
556405
|
+
throw new CliError({
|
|
556406
|
+
message: `Internal error; type "${typeId}" is not an object`,
|
|
556407
|
+
code: CliError.Code.InternalError
|
|
556408
|
+
});
|
|
556175
556409
|
}
|
|
556176
556410
|
return typeDeclaration2.shape;
|
|
556177
556411
|
}
|
|
@@ -556456,7 +556690,10 @@ function convertOAuthClientCredentials({ propertyResolver, endpointResolver, typ
|
|
|
556456
556690
|
tokenEndpoint
|
|
556457
556691
|
});
|
|
556458
556692
|
if (oauthTokenEndpoint == null) {
|
|
556459
|
-
throw new
|
|
556693
|
+
throw new CliError({
|
|
556694
|
+
message: "Failed to convert OAuth token endpoint.",
|
|
556695
|
+
code: CliError.Code.IrConversionError
|
|
556696
|
+
});
|
|
556460
556697
|
}
|
|
556461
556698
|
const refreshEndpoint = refreshTokenEndpoint != null ? convertOAuthRefreshEndpoint({
|
|
556462
556699
|
propertyResolver,
|
|
@@ -556634,7 +556871,7 @@ function convertSchemeReference2({ reference: reference4, authSchemeDeclarations
|
|
|
556634
556871
|
const convertNamedAuthSchemeReference = (reference5, docs2) => {
|
|
556635
556872
|
const declaration = authSchemeDeclarations?.[reference5];
|
|
556636
556873
|
if (declaration == null) {
|
|
556637
|
-
throw new
|
|
556874
|
+
throw new CliError({ message: "Unknown auth scheme: " + reference5, code: CliError.Code.ReferenceError });
|
|
556638
556875
|
}
|
|
556639
556876
|
return visitRawAuthSchemeDeclaration(declaration, {
|
|
556640
556877
|
header: (rawHeader) => AuthScheme.header({
|
|
@@ -556746,7 +556983,10 @@ function generateOAuth({ key: key2, file: file4, docs: docs2, rawScheme, propert
|
|
|
556746
556983
|
}))
|
|
556747
556984
|
});
|
|
556748
556985
|
default:
|
|
556749
|
-
throw new
|
|
556986
|
+
throw new CliError({
|
|
556987
|
+
message: `Unknown OAuth type: '${rawScheme?.type}'`,
|
|
556988
|
+
code: CliError.Code.ValidationError
|
|
556989
|
+
});
|
|
556750
556990
|
}
|
|
556751
556991
|
}
|
|
556752
556992
|
function generateInferredAuth({ key: key2, file: file4, docs: docs2, rawScheme, propertyResolver, endpointResolver }) {
|
|
@@ -557010,7 +557250,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557010
557250
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
557011
557251
|
const queryParameterDeclaration = channel3["query-parameters"]?.[wireKey];
|
|
557012
557252
|
if (queryParameterDeclaration == null) {
|
|
557013
|
-
throw new
|
|
557253
|
+
throw new CliError({
|
|
557254
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
557255
|
+
code: CliError.Code.ReferenceError
|
|
557256
|
+
});
|
|
557014
557257
|
}
|
|
557015
557258
|
return {
|
|
557016
557259
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557035,7 +557278,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557035
557278
|
messages: example.messages.map((messageExample) => {
|
|
557036
557279
|
const message = channel3.messages?.[messageExample.type];
|
|
557037
557280
|
if (message == null) {
|
|
557038
|
-
throw new
|
|
557281
|
+
throw new CliError({
|
|
557282
|
+
message: `Message ${messageExample.type} does not exist`,
|
|
557283
|
+
code: CliError.Code.ReferenceError
|
|
557284
|
+
});
|
|
557039
557285
|
}
|
|
557040
557286
|
return {
|
|
557041
557287
|
type: messageExample.type,
|
|
@@ -557074,7 +557320,7 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557074
557320
|
}));
|
|
557075
557321
|
}
|
|
557076
557322
|
if (!isPlainObject4(example)) {
|
|
557077
|
-
throw new
|
|
557323
|
+
throw new CliError({ message: "Example must be an object", code: CliError.Code.ValidationError });
|
|
557078
557324
|
}
|
|
557079
557325
|
const exampleProperties = [];
|
|
557080
557326
|
for (const [wireKey, propertyExample] of Object.entries(example)) {
|
|
@@ -557104,7 +557350,10 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557104
557350
|
file: file4
|
|
557105
557351
|
});
|
|
557106
557352
|
if (originalTypeDeclaration == null) {
|
|
557107
|
-
throw new
|
|
557353
|
+
throw new CliError({
|
|
557354
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
557355
|
+
code: CliError.Code.ResolutionError
|
|
557356
|
+
});
|
|
557108
557357
|
}
|
|
557109
557358
|
exampleProperties.push({
|
|
557110
557359
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557188,7 +557437,10 @@ function convertChannelPathParameters({ channel: channel3, example, typeResolver
|
|
|
557188
557437
|
examplePathParameter
|
|
557189
557438
|
}));
|
|
557190
557439
|
} else {
|
|
557191
|
-
throw new
|
|
557440
|
+
throw new CliError({
|
|
557441
|
+
message: `Path parameter ${key2} does not exist`,
|
|
557442
|
+
code: CliError.Code.ReferenceError
|
|
557443
|
+
});
|
|
557192
557444
|
}
|
|
557193
557445
|
}
|
|
557194
557446
|
}
|
|
@@ -557339,7 +557591,10 @@ var ReadmeEndpointCache = class {
|
|
|
557339
557591
|
getEndpointForReadmeOrThrow(readmeEndpoint) {
|
|
557340
557592
|
const endpoint3 = this.getEndpointForReadme(readmeEndpoint);
|
|
557341
557593
|
if (endpoint3 == null) {
|
|
557342
|
-
throw new
|
|
557594
|
+
throw new CliError({
|
|
557595
|
+
message: `Endpoint not found for ${JSON.stringify(readmeEndpoint)}`,
|
|
557596
|
+
code: CliError.Code.ResolutionError
|
|
557597
|
+
});
|
|
557343
557598
|
}
|
|
557344
557599
|
return endpoint3;
|
|
557345
557600
|
}
|
|
@@ -557387,7 +557642,7 @@ function getReadmeEndpointObject({ endpoint: endpoint3 }) {
|
|
|
557387
557642
|
if (typeof endpoint3 === "string") {
|
|
557388
557643
|
const split2 = endpoint3.split(" ");
|
|
557389
557644
|
if (split2.length !== 2 || split2[0] == null || split2[1] == null) {
|
|
557390
|
-
throw new
|
|
557645
|
+
throw new CliError({ message: `invalid endpoint string: ${endpoint3}`, code: CliError.Code.ParseError });
|
|
557391
557646
|
}
|
|
557392
557647
|
return {
|
|
557393
557648
|
method: split2[0],
|
|
@@ -557484,7 +557739,10 @@ function convertWebhookExamples2({ webhook, examples, file: file4, typeResolver,
|
|
|
557484
557739
|
}));
|
|
557485
557740
|
}
|
|
557486
557741
|
if (!isPlainObject4(webhook.payload)) {
|
|
557487
|
-
throw new
|
|
557742
|
+
throw new CliError({
|
|
557743
|
+
message: `Example webhook payload is not an object. Got: ${JSON.stringify(webhook.payload)}`,
|
|
557744
|
+
code: CliError.Code.ValidationError
|
|
557745
|
+
});
|
|
557488
557746
|
}
|
|
557489
557747
|
return examples.map((example) => ({
|
|
557490
557748
|
docs: webhook.docs,
|
|
@@ -557876,7 +558134,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557876
558134
|
const genericInstantiation = typeof generic === "string" ? generic : generic.type;
|
|
557877
558135
|
const maybeGeneric = parseGeneric(genericInstantiation);
|
|
557878
558136
|
if (maybeGeneric == null) {
|
|
557879
|
-
throw new
|
|
558137
|
+
throw new CliError({
|
|
558138
|
+
message: `Invalid generic type definition: ${genericInstantiation}`,
|
|
558139
|
+
code: CliError.Code.ValidationError
|
|
558140
|
+
});
|
|
557880
558141
|
}
|
|
557881
558142
|
const resolvedBaseGeneric = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
557882
558143
|
referenceToNamedType: genericInstantiation,
|
|
@@ -557907,7 +558168,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557907
558168
|
extendedProperties: void 0
|
|
557908
558169
|
});
|
|
557909
558170
|
}
|
|
557910
|
-
throw new
|
|
558171
|
+
throw new CliError({
|
|
558172
|
+
message: `Generic type definition not supported: ${genericInstantiation}`,
|
|
558173
|
+
code: CliError.Code.ValidationError
|
|
558174
|
+
});
|
|
557911
558175
|
}
|
|
557912
558176
|
|
|
557913
558177
|
// ../generation/ir-generator/lib/converters/type-declarations/convertAliasTypeDeclaration.js
|
|
@@ -558299,7 +558563,10 @@ var PackageTreeGenerator = class {
|
|
|
558299
558563
|
addPackageRedirection({ from: from4, to: to10 }) {
|
|
558300
558564
|
const package_ = this.getPackageForFernFilepath(from4);
|
|
558301
558565
|
if (package_.navigationConfig != null) {
|
|
558302
|
-
throw new
|
|
558566
|
+
throw new CliError({
|
|
558567
|
+
message: "Found duplicate navigationConfig for package",
|
|
558568
|
+
code: CliError.Code.InternalError
|
|
558569
|
+
});
|
|
558303
558570
|
}
|
|
558304
558571
|
package_.navigationConfig = {
|
|
558305
558572
|
pointsTo: IdGenerator.generateSubpackageId(to10)
|
|
@@ -558308,7 +558575,7 @@ var PackageTreeGenerator = class {
|
|
|
558308
558575
|
addDocs(fernFilepath, docs2) {
|
|
558309
558576
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558310
558577
|
if (package_.docs != null) {
|
|
558311
|
-
throw new
|
|
558578
|
+
throw new CliError({ message: "Found duplicate docs for package", code: CliError.Code.InternalError });
|
|
558312
558579
|
}
|
|
558313
558580
|
package_.docs = docs2;
|
|
558314
558581
|
}
|
|
@@ -558324,21 +558591,30 @@ var PackageTreeGenerator = class {
|
|
|
558324
558591
|
addService(serviceId, service) {
|
|
558325
558592
|
const package_ = this.getPackageForFernFilepath(service.name.fernFilepath);
|
|
558326
558593
|
if (package_.service != null) {
|
|
558327
|
-
throw new
|
|
558594
|
+
throw new CliError({
|
|
558595
|
+
message: "Found duplicate service for " + serviceId,
|
|
558596
|
+
code: CliError.Code.InternalError
|
|
558597
|
+
});
|
|
558328
558598
|
}
|
|
558329
558599
|
package_.service = serviceId;
|
|
558330
558600
|
}
|
|
558331
558601
|
addWebhookGroup(webhookGroupId, fernFilepath) {
|
|
558332
558602
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558333
558603
|
if (package_.webhooks != null) {
|
|
558334
|
-
throw new
|
|
558604
|
+
throw new CliError({
|
|
558605
|
+
message: "Found duplicate webhook group for " + webhookGroupId,
|
|
558606
|
+
code: CliError.Code.InternalError
|
|
558607
|
+
});
|
|
558335
558608
|
}
|
|
558336
558609
|
package_.webhooks = webhookGroupId;
|
|
558337
558610
|
}
|
|
558338
558611
|
addWebSocketChannel(websocketChannelId, fernFilepath) {
|
|
558339
558612
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558340
558613
|
if (package_.webhooks != null) {
|
|
558341
|
-
throw new
|
|
558614
|
+
throw new CliError({
|
|
558615
|
+
message: "Found duplicate webhook group for " + websocketChannelId,
|
|
558616
|
+
code: CliError.Code.InternalError
|
|
558617
|
+
});
|
|
558342
558618
|
}
|
|
558343
558619
|
package_.websocket = websocketChannelId;
|
|
558344
558620
|
}
|
|
@@ -558381,24 +558657,33 @@ var PackageTreeGenerator = class {
|
|
|
558381
558657
|
}
|
|
558382
558658
|
sortRootPackage(subpackagesInOrder) {
|
|
558383
558659
|
if (!isEqualIgnoreOrder(this.rootPackage.subpackages, subpackagesInOrder)) {
|
|
558384
|
-
throw new
|
|
558660
|
+
throw new CliError({
|
|
558661
|
+
message: "Sorted subpackages differ from unsorted packages in root",
|
|
558662
|
+
code: CliError.Code.InternalError
|
|
558663
|
+
});
|
|
558385
558664
|
}
|
|
558386
558665
|
this.rootPackage.subpackages = subpackagesInOrder;
|
|
558387
558666
|
}
|
|
558388
558667
|
sortSubpackage(subpackageId, subpackagesInOrder) {
|
|
558389
558668
|
const subpackage = this.subpackages[subpackageId];
|
|
558390
558669
|
if (subpackage == null) {
|
|
558391
|
-
throw new
|
|
558670
|
+
throw new CliError({
|
|
558671
|
+
message: "Subpackage does not exist: " + subpackageId,
|
|
558672
|
+
code: CliError.Code.ResolutionError
|
|
558673
|
+
});
|
|
558392
558674
|
}
|
|
558393
558675
|
if (!isEqualIgnoreOrder(subpackage.subpackages, subpackagesInOrder)) {
|
|
558394
|
-
throw new
|
|
558676
|
+
throw new CliError({
|
|
558677
|
+
message: "Sorted subpackages differ from unsorted packages",
|
|
558678
|
+
code: CliError.Code.InternalError
|
|
558679
|
+
});
|
|
558395
558680
|
}
|
|
558396
558681
|
subpackage.subpackages = subpackagesInOrder;
|
|
558397
558682
|
}
|
|
558398
558683
|
getAllSubpackagesWithEndpoints(root6) {
|
|
558399
558684
|
const subpackage = this.subpackages[root6];
|
|
558400
558685
|
if (subpackage == null) {
|
|
558401
|
-
throw new
|
|
558686
|
+
throw new CliError({ message: "Subpackage does not exist: " + root6, code: CliError.Code.ResolutionError });
|
|
558402
558687
|
}
|
|
558403
558688
|
const subpackagesWithEndpoints = this.getAllChildrenWithEndpoints(subpackage);
|
|
558404
558689
|
if (subpackagesWithEndpoints.length > 0 || subpackage.service != null) {
|
|
@@ -558419,7 +558704,10 @@ var PackageTreeGenerator = class {
|
|
|
558419
558704
|
const subpackagesInParent = parent.subpackages.map((subpackageId) => {
|
|
558420
558705
|
const subpackage = this.subpackages[subpackageId];
|
|
558421
558706
|
if (subpackage == null) {
|
|
558422
|
-
throw new
|
|
558707
|
+
throw new CliError({
|
|
558708
|
+
message: "Subpackage ID is invalid: " + subpackageId,
|
|
558709
|
+
code: CliError.Code.InternalError
|
|
558710
|
+
});
|
|
558423
558711
|
}
|
|
558424
558712
|
return subpackage;
|
|
558425
558713
|
});
|
|
@@ -558498,7 +558786,10 @@ var EndpointResolverImpl = class {
|
|
|
558498
558786
|
resolveEndpointOrThrow({ endpoint: endpoint3, file: file4 }) {
|
|
558499
558787
|
const resolvedEndpoint = this.resolveEndpoint({ endpoint: endpoint3, file: file4 });
|
|
558500
558788
|
if (resolvedEndpoint == null) {
|
|
558501
|
-
throw new
|
|
558789
|
+
throw new CliError({
|
|
558790
|
+
message: "Cannot resolve endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
558791
|
+
code: CliError.Code.ResolutionError
|
|
558792
|
+
});
|
|
558502
558793
|
}
|
|
558503
558794
|
return resolvedEndpoint;
|
|
558504
558795
|
}
|
|
@@ -558626,7 +558917,10 @@ var ErrorResolverImpl = class {
|
|
|
558626
558917
|
getDeclarationOrThrow(referenceToError, file4) {
|
|
558627
558918
|
const declaration = this.getDeclaration(referenceToError, file4);
|
|
558628
558919
|
if (declaration == null) {
|
|
558629
|
-
throw new
|
|
558920
|
+
throw new CliError({
|
|
558921
|
+
message: "Error does not exist: " + referenceToError,
|
|
558922
|
+
code: CliError.Code.ResolutionError
|
|
558923
|
+
});
|
|
558630
558924
|
}
|
|
558631
558925
|
return declaration;
|
|
558632
558926
|
}
|
|
@@ -558712,7 +559006,7 @@ var ExampleResolverImpl = class {
|
|
|
558712
559006
|
resolveAllReferencesInExampleOrThrow({ example, file: file4 }) {
|
|
558713
559007
|
const resolvedExample = this.resolveAllReferencesInExample({ example, file: file4 });
|
|
558714
559008
|
if (resolvedExample == null) {
|
|
558715
|
-
throw new
|
|
559009
|
+
throw new CliError({ message: "Failed to resolve examples", code: CliError.Code.ResolutionError });
|
|
558716
559010
|
}
|
|
558717
559011
|
return resolvedExample;
|
|
558718
559012
|
}
|
|
@@ -558759,7 +559053,7 @@ var ExampleResolverImpl = class {
|
|
|
558759
559053
|
resolveExampleOrThrow({ example, file: file4 }) {
|
|
558760
559054
|
const resolvedExample = this.resolveExample({ example, file: file4 });
|
|
558761
559055
|
if (resolvedExample == null) {
|
|
558762
|
-
throw new
|
|
559056
|
+
throw new CliError({ message: "Cannot resolve example: " + example, code: CliError.Code.ResolutionError });
|
|
558763
559057
|
}
|
|
558764
559058
|
return resolvedExample;
|
|
558765
559059
|
}
|
|
@@ -558810,7 +559104,10 @@ var PropertyResolverImpl = class {
|
|
|
558810
559104
|
resolveRequestPropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558811
559105
|
const resolvedRequestProperty = this.resolveRequestProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558812
559106
|
if (resolvedRequestProperty == null) {
|
|
558813
|
-
throw new
|
|
559107
|
+
throw new CliError({
|
|
559108
|
+
message: "Cannot resolve request property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559109
|
+
code: CliError.Code.ResolutionError
|
|
559110
|
+
});
|
|
558814
559111
|
}
|
|
558815
559112
|
return resolvedRequestProperty;
|
|
558816
559113
|
}
|
|
@@ -558854,7 +559151,10 @@ var PropertyResolverImpl = class {
|
|
|
558854
559151
|
resolveResponsePropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558855
559152
|
const resolvedResponseProperty = this.resolveResponseProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558856
559153
|
if (resolvedResponseProperty == null) {
|
|
558857
|
-
throw new
|
|
559154
|
+
throw new CliError({
|
|
559155
|
+
message: "Cannot resolve response property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559156
|
+
code: CliError.Code.ResolutionError
|
|
559157
|
+
});
|
|
558858
559158
|
}
|
|
558859
559159
|
return resolvedResponseProperty;
|
|
558860
559160
|
}
|
|
@@ -559021,7 +559321,10 @@ var PropertyResolverImpl = class {
|
|
|
559021
559321
|
propertyComponents: breadcrumbs
|
|
559022
559322
|
});
|
|
559023
559323
|
if (!currentType) {
|
|
559024
|
-
throw new
|
|
559324
|
+
throw new CliError({
|
|
559325
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in inline request body in file ${file4.relativeFilepath}`,
|
|
559326
|
+
code: CliError.Code.InternalError
|
|
559327
|
+
});
|
|
559025
559328
|
}
|
|
559026
559329
|
result.push({
|
|
559027
559330
|
name: file4.casingsGenerator.generateName(component),
|
|
@@ -559039,7 +559342,10 @@ function getNestedObjectPropertyTypeOrThrow({ typeResolver, file: file4, resolve
|
|
|
559039
559342
|
propertyName
|
|
559040
559343
|
});
|
|
559041
559344
|
if (!nestedPropertyType) {
|
|
559042
|
-
throw new
|
|
559345
|
+
throw new CliError({
|
|
559346
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in ${rootTypeLabel}`,
|
|
559347
|
+
code: CliError.Code.InternalError
|
|
559348
|
+
});
|
|
559043
559349
|
}
|
|
559044
559350
|
return nestedPropertyType;
|
|
559045
559351
|
}
|
|
@@ -559216,14 +559522,20 @@ var TypeResolverImpl = class {
|
|
|
559216
559522
|
resolveTypeOrThrow({ type: type8, file: file4 }) {
|
|
559217
559523
|
const resolvedType = this.resolveType({ type: type8, file: file4 });
|
|
559218
559524
|
if (resolvedType == null) {
|
|
559219
|
-
throw new
|
|
559525
|
+
throw new CliError({
|
|
559526
|
+
message: "Cannot resolve type: " + type8 + " in file " + file4.relativeFilepath,
|
|
559527
|
+
code: CliError.Code.ResolutionError
|
|
559528
|
+
});
|
|
559220
559529
|
}
|
|
559221
559530
|
return resolvedType;
|
|
559222
559531
|
}
|
|
559223
559532
|
getDeclarationOfNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559224
559533
|
const declaration = this.getDeclarationOfNamedType({ referenceToNamedType, file: file4 });
|
|
559225
559534
|
if (declaration == null) {
|
|
559226
|
-
throw new
|
|
559535
|
+
throw new CliError({
|
|
559536
|
+
message: "Cannot find declaration of type: " + referenceToNamedType + " in file " + file4.relativeFilepath,
|
|
559537
|
+
code: CliError.Code.ResolutionError
|
|
559538
|
+
});
|
|
559227
559539
|
}
|
|
559228
559540
|
return declaration;
|
|
559229
559541
|
}
|
|
@@ -559366,7 +559678,10 @@ var TypeResolverImpl = class {
|
|
|
559366
559678
|
resolveNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559367
559679
|
const resolvedType = this.resolveNamedType({ referenceToNamedType, file: file4 });
|
|
559368
559680
|
if (resolvedType == null) {
|
|
559369
|
-
throw new
|
|
559681
|
+
throw new CliError({
|
|
559682
|
+
message: "Cannot resolve type: " + referenceToNamedType,
|
|
559683
|
+
code: CliError.Code.ResolutionError
|
|
559684
|
+
});
|
|
559370
559685
|
}
|
|
559371
559686
|
return resolvedType;
|
|
559372
559687
|
}
|
|
@@ -559425,7 +559740,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559425
559740
|
getDeclarationOrThrow(referenceToVariable, file4) {
|
|
559426
559741
|
const declaration = this.getDeclaration(referenceToVariable, file4);
|
|
559427
559742
|
if (declaration == null) {
|
|
559428
|
-
throw new
|
|
559743
|
+
throw new CliError({
|
|
559744
|
+
message: "Variable does not exist: " + referenceToVariable,
|
|
559745
|
+
code: CliError.Code.ResolutionError
|
|
559746
|
+
});
|
|
559429
559747
|
}
|
|
559430
559748
|
return declaration;
|
|
559431
559749
|
}
|
|
@@ -559448,7 +559766,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559448
559766
|
getVariableIdOrThrow(referenceToVariable) {
|
|
559449
559767
|
const variableId = this.getVariableId(referenceToVariable);
|
|
559450
559768
|
if (variableId == null) {
|
|
559451
|
-
throw new
|
|
559769
|
+
throw new CliError({
|
|
559770
|
+
message: "Variable reference does not start with " + _VariableResolverImpl.VARIABLE_PREFIX,
|
|
559771
|
+
code: CliError.Code.ResolutionError
|
|
559772
|
+
});
|
|
559452
559773
|
}
|
|
559453
559774
|
return variableId;
|
|
559454
559775
|
}
|
|
@@ -559620,7 +559941,10 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
|
|
|
559620
559941
|
}
|
|
559621
559942
|
const errorDiscriminationSchema = workspace.definition.rootApiFile.contents["error-discrimination"];
|
|
559622
559943
|
if (errorDiscriminationSchema == null) {
|
|
559623
|
-
throw new
|
|
559944
|
+
throw new CliError({
|
|
559945
|
+
message: "error-discrimination is missing in api.yml but there are declared errors.",
|
|
559946
|
+
code: CliError.Code.ConfigError
|
|
559947
|
+
});
|
|
559624
559948
|
}
|
|
559625
559949
|
for (const [errorName, errorDeclaration] of Object.entries(errors4)) {
|
|
559626
559950
|
const convertedErrorDeclaration = convertErrorDeclaration({
|
|
@@ -562560,7 +562884,10 @@ var ValidNavigationRule = {
|
|
|
562560
562884
|
}
|
|
562561
562885
|
const expectedItems = directoryToChildren[dirname6(relativeFilepath)];
|
|
562562
562886
|
if (expectedItems == null) {
|
|
562563
|
-
throw new
|
|
562887
|
+
throw new CliError({
|
|
562888
|
+
message: `Could not find expected contents of ${relativeFilepath}`,
|
|
562889
|
+
code: CliError.Code.InternalError
|
|
562890
|
+
});
|
|
562564
562891
|
}
|
|
562565
562892
|
const violations = [];
|
|
562566
562893
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -563804,7 +564131,10 @@ var ValidPaginationRule = {
|
|
|
563804
564131
|
pathPagination: endpointPagination
|
|
563805
564132
|
});
|
|
563806
564133
|
}
|
|
563807
|
-
throw new
|
|
564134
|
+
throw new CliError({
|
|
564135
|
+
message: "Invalid pagination schema",
|
|
564136
|
+
code: CliError.Code.ValidationError
|
|
564137
|
+
});
|
|
563808
564138
|
}
|
|
563809
564139
|
}
|
|
563810
564140
|
};
|
|
@@ -566237,7 +566567,10 @@ var ConjureImporter = class extends APIDefinitionImporter {
|
|
|
566237
566567
|
if (definition3.services == null || Object.keys(definition3.services ?? {}).length === 0) {
|
|
566238
566568
|
const fernFilePath = this.conjureFilepathToFernFilepath[filepath];
|
|
566239
566569
|
if (fernFilePath == null) {
|
|
566240
|
-
throw new
|
|
566570
|
+
throw new CliError({
|
|
566571
|
+
message: `Failed to find corresponding fern filepath for conjure file ${filepath}`,
|
|
566572
|
+
code: CliError.Code.InternalError
|
|
566573
|
+
});
|
|
566241
566574
|
}
|
|
566242
566575
|
for (const [import_, importedFilepath] of Object.entries(definition3.types?.conjureImports ?? {})) {
|
|
566243
566576
|
const fernFileToImport = this.getFernFileToImport({
|
|
@@ -566299,7 +566632,10 @@ var ConjureImporter = class extends APIDefinitionImporter {
|
|
|
566299
566632
|
for (const pathParameter of endpointLocator.pathParameters) {
|
|
566300
566633
|
const pathParameterType = endpointDeclaration.args[pathParameter];
|
|
566301
566634
|
if (pathParameterType == null) {
|
|
566302
|
-
throw new
|
|
566635
|
+
throw new CliError({
|
|
566636
|
+
message: `Failed to find path parameter ${pathParameter} in ${endpointDeclaration.http}`,
|
|
566637
|
+
code: CliError.Code.InternalError
|
|
566638
|
+
});
|
|
566303
566639
|
}
|
|
566304
566640
|
pathParameters[pathParameter] = typeof pathParameterType === "string" ? pathParameterType : (
|
|
566305
566641
|
// biome-ignore lint/suspicious/noExplicitAny: allow explicit any
|
|
@@ -566435,7 +566771,10 @@ var ConjureImporter = class extends APIDefinitionImporter {
|
|
|
566435
566771
|
const relativeFilePathToImportedFile = relativize(absoluteFilePathToConjureFolder, absoluteFilePathToImportedFile);
|
|
566436
566772
|
const correspondingFernFilePath = this.conjureFilepathToFernFilepath[relativeFilePathToImportedFile];
|
|
566437
566773
|
if (correspondingFernFilePath == null) {
|
|
566438
|
-
throw new
|
|
566774
|
+
throw new CliError({
|
|
566775
|
+
message: `Failed to find corresponding fern filepath for conjure file ${relativeFilePathToImportedFile}`,
|
|
566776
|
+
code: CliError.Code.InternalError
|
|
566777
|
+
});
|
|
566439
566778
|
}
|
|
566440
566779
|
return correspondingFernFilePath;
|
|
566441
566780
|
}
|
|
@@ -581572,7 +581911,9 @@ function getPathToLocalStorageDependency(dependency) {
|
|
|
581572
581911
|
}
|
|
581573
581912
|
async function validateLocalDependencyAndGetDefinition({ dependency, context: context3, cliVersion, settings, loadAPIWorkspace: loadAPIWorkspace2 }) {
|
|
581574
581913
|
if (loadAPIWorkspace2 == null) {
|
|
581575
|
-
context3.failWithoutThrowing("Failed to load api definition"
|
|
581914
|
+
context3.failWithoutThrowing("Failed to load api definition", void 0, {
|
|
581915
|
+
code: CliError.Code.ResolutionError
|
|
581916
|
+
});
|
|
581576
581917
|
return void 0;
|
|
581577
581918
|
}
|
|
581578
581919
|
context3.logger.info("Parsing...");
|
|
@@ -581583,7 +581924,9 @@ async function validateLocalDependencyAndGetDefinition({ dependency, context: co
|
|
|
581583
581924
|
workspaceName: void 0
|
|
581584
581925
|
});
|
|
581585
581926
|
if (!loadDependencyWorkspaceResult.didSucceed) {
|
|
581586
|
-
context3.failWithoutThrowing("Failed to load api definition", loadDependencyWorkspaceResult.failures
|
|
581927
|
+
context3.failWithoutThrowing("Failed to load api definition", loadDependencyWorkspaceResult.failures, {
|
|
581928
|
+
code: CliError.Code.ResolutionError
|
|
581929
|
+
});
|
|
581587
581930
|
return void 0;
|
|
581588
581931
|
}
|
|
581589
581932
|
context3.logger.info("Modifying source filepath ...");
|
|
@@ -581605,16 +581948,24 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581605
581948
|
if (!response.ok) {
|
|
581606
581949
|
response.error._visit({
|
|
581607
581950
|
orgDoesNotExistError: () => {
|
|
581608
|
-
context3.failWithoutThrowing("Organization does not exist"
|
|
581951
|
+
context3.failWithoutThrowing("Organization does not exist", void 0, {
|
|
581952
|
+
code: CliError.Code.ResolutionError
|
|
581953
|
+
});
|
|
581609
581954
|
},
|
|
581610
581955
|
apiDoesNotExistError: () => {
|
|
581611
|
-
context3.failWithoutThrowing("API does not exist"
|
|
581956
|
+
context3.failWithoutThrowing("API does not exist", void 0, {
|
|
581957
|
+
code: CliError.Code.ResolutionError
|
|
581958
|
+
});
|
|
581612
581959
|
},
|
|
581613
581960
|
versionDoesNotExistError: () => {
|
|
581614
|
-
context3.failWithoutThrowing("Version does not exist"
|
|
581961
|
+
context3.failWithoutThrowing("Version does not exist", void 0, {
|
|
581962
|
+
code: CliError.Code.ResolutionError
|
|
581963
|
+
});
|
|
581615
581964
|
},
|
|
581616
581965
|
_other: (error50) => {
|
|
581617
|
-
context3.failWithoutThrowing("Failed to download API manifest", error50
|
|
581966
|
+
context3.failWithoutThrowing("Failed to download API manifest", error50, {
|
|
581967
|
+
code: CliError.Code.NetworkError
|
|
581968
|
+
});
|
|
581618
581969
|
}
|
|
581619
581970
|
});
|
|
581620
581971
|
return void 0;
|
|
@@ -581624,14 +581975,14 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581624
581975
|
const parsedCliVersionOfDependency = parseVersion(response.body.cliVersion);
|
|
581625
581976
|
if (parsedYamlVersionOfDependency != null) {
|
|
581626
581977
|
if (parsedYamlVersionOfDependency > YAML_SCHEMA_VERSION) {
|
|
581627
|
-
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a higher version of fern. Upgrade this workspace to ${response.body.cliVersion}
|
|
581978
|
+
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 });
|
|
581628
581979
|
return void 0;
|
|
581629
581980
|
} else if (parsedYamlVersionOfDependency < YAML_SCHEMA_VERSION) {
|
|
581630
|
-
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a lower version of fern. Upgrade it to ${cliVersion}
|
|
581981
|
+
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a lower version of fern. Upgrade it to ${cliVersion}`, void 0, { code: CliError.Code.VersionError });
|
|
581631
581982
|
return void 0;
|
|
581632
581983
|
}
|
|
581633
581984
|
} else if (parsedCliVersion.major !== parsedCliVersionOfDependency.major || parsedCliVersion.minor !== parsedCliVersionOfDependency.minor) {
|
|
581634
|
-
context3.failWithoutThrowing(`CLI version is ${response.body.cliVersion}. Expected ${parsedCliVersion.major}.${parsedCliVersion.minor}.x (to match current workspace)
|
|
581985
|
+
context3.failWithoutThrowing(`CLI version is ${response.body.cliVersion}. Expected ${parsedCliVersion.major}.${parsedCliVersion.minor}.x (to match current workspace).`, void 0, { code: CliError.Code.VersionError });
|
|
581635
581986
|
return void 0;
|
|
581636
581987
|
}
|
|
581637
581988
|
context3.logger.info("Downloading...");
|
|
@@ -581643,7 +581994,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581643
581994
|
absolutePathToLocalOutput: pathToDefinition
|
|
581644
581995
|
});
|
|
581645
581996
|
} catch (error50) {
|
|
581646
|
-
context3.failWithoutThrowing("Failed to download API", error50
|
|
581997
|
+
context3.failWithoutThrowing("Failed to download API", error50, {
|
|
581998
|
+
code: CliError.Code.NetworkError
|
|
581999
|
+
});
|
|
581647
582000
|
return void 0;
|
|
581648
582001
|
}
|
|
581649
582002
|
metadata = response.body;
|
|
@@ -581653,7 +582006,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581653
582006
|
}
|
|
581654
582007
|
context3.logger.info("Parsing...");
|
|
581655
582008
|
if (loadAPIWorkspace2 == null) {
|
|
581656
|
-
context3.failWithoutThrowing("Failed to load API"
|
|
582009
|
+
context3.failWithoutThrowing("Failed to load API", void 0, {
|
|
582010
|
+
code: CliError.Code.ResolutionError
|
|
582011
|
+
});
|
|
581657
582012
|
return void 0;
|
|
581658
582013
|
}
|
|
581659
582014
|
const loadDependencyWorkspaceResult = await loadAPIWorkspace2({
|
|
@@ -581663,12 +582018,14 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581663
582018
|
workspaceName: void 0
|
|
581664
582019
|
});
|
|
581665
582020
|
if (!loadDependencyWorkspaceResult.didSucceed) {
|
|
581666
|
-
context3.failWithoutThrowing("Failed to parse dependency after downloading", loadDependencyWorkspaceResult.failures);
|
|
582021
|
+
context3.failWithoutThrowing("Failed to parse dependency after downloading", loadDependencyWorkspaceResult.failures, { code: CliError.Code.ParseError });
|
|
581667
582022
|
return void 0;
|
|
581668
582023
|
}
|
|
581669
582024
|
const workspaceOfDependency = loadDependencyWorkspaceResult.workspace;
|
|
581670
582025
|
if (workspaceOfDependency.type === "oss") {
|
|
581671
|
-
context3.failWithoutThrowing("Dependency must be a fern workspace."
|
|
582026
|
+
context3.failWithoutThrowing("Dependency must be a fern workspace.", void 0, {
|
|
582027
|
+
code: CliError.Code.ConfigError
|
|
582028
|
+
});
|
|
581672
582029
|
return void 0;
|
|
581673
582030
|
}
|
|
581674
582031
|
return await loadDependencyWorkspaceResult.workspace.getDefinition({ context: context3 }, settings);
|
|
@@ -592208,7 +592565,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592208
592565
|
const parseResult = await parseYamlFiles(yamlFiles);
|
|
592209
592566
|
if (!parseResult.didSucceed) {
|
|
592210
592567
|
handleFailedWorkspaceParserResultRaw(parseResult.failures, defaultedContext.logger);
|
|
592211
|
-
return defaultedContext.failAndThrow(
|
|
592568
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592569
|
+
code: CliError.Code.ValidationError
|
|
592570
|
+
});
|
|
592212
592571
|
}
|
|
592213
592572
|
const structuralValidationResult = validateStructureOfYamlFiles({
|
|
592214
592573
|
files: parseResult.files,
|
|
@@ -592217,7 +592576,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592217
592576
|
});
|
|
592218
592577
|
if (!structuralValidationResult.didSucceed) {
|
|
592219
592578
|
handleFailedWorkspaceParserResultRaw(structuralValidationResult.failures, defaultedContext.logger);
|
|
592220
|
-
return defaultedContext.failAndThrow(
|
|
592579
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592580
|
+
code: CliError.Code.ValidationError
|
|
592581
|
+
});
|
|
592221
592582
|
}
|
|
592222
592583
|
const processPackageMarkersResult = await processPackageMarkers({
|
|
592223
592584
|
dependenciesConfiguration,
|
|
@@ -592229,7 +592590,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592229
592590
|
});
|
|
592230
592591
|
if (!processPackageMarkersResult.didSucceed) {
|
|
592231
592592
|
handleFailedWorkspaceParserResultRaw(processPackageMarkersResult.failures, defaultedContext.logger);
|
|
592232
|
-
return defaultedContext.failAndThrow(
|
|
592593
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592594
|
+
code: CliError.Code.ValidationError
|
|
592595
|
+
});
|
|
592233
592596
|
}
|
|
592234
592597
|
let definition3 = {
|
|
592235
592598
|
absoluteFilePath: absolutePathToDefinition,
|
|
@@ -592296,7 +592659,9 @@ async function mergeWithOverrides2({ absoluteFilePathToOverrides, data: data2, c
|
|
|
592296
592659
|
parsedOverrides = jsYaml.load(contents, { json: true });
|
|
592297
592660
|
}
|
|
592298
592661
|
} catch (err) {
|
|
592299
|
-
return context3.failAndThrow(`Failed to read overrides from file ${absoluteFilePathToOverrides}
|
|
592662
|
+
return context3.failAndThrow(`Failed to read overrides from file ${absoluteFilePathToOverrides}`, void 0, {
|
|
592663
|
+
code: CliError.Code.ParseError
|
|
592664
|
+
});
|
|
592300
592665
|
}
|
|
592301
592666
|
return mergeWithOverrides({ data: data2, overrides: parsedOverrides, allowNullKeys });
|
|
592302
592667
|
}
|
|
@@ -592456,7 +592821,10 @@ async function resolveExternalRefs(obj, baseDir, mainFileAbsPath, registry2, app
|
|
|
592456
592821
|
}
|
|
592457
592822
|
const cacheKey = `${absoluteRefPath}#${jsonPointer}`;
|
|
592458
592823
|
if (visited.has(cacheKey)) {
|
|
592459
|
-
throw new
|
|
592824
|
+
throw new CliError({
|
|
592825
|
+
message: `Circular $ref detected: "${ref2}" (resolved to "${cacheKey}")`,
|
|
592826
|
+
code: CliError.Code.ReferenceError
|
|
592827
|
+
});
|
|
592460
592828
|
}
|
|
592461
592829
|
const newVisited = new Set(visited);
|
|
592462
592830
|
newVisited.add(cacheKey);
|
|
@@ -592539,7 +592907,9 @@ async function parseOverlayFile(absoluteFilePathToOverlay, context3) {
|
|
|
592539
592907
|
try {
|
|
592540
592908
|
contents = await (0, import_promises26.readFile)(absoluteFilePathToOverlay, "utf8");
|
|
592541
592909
|
} catch (err) {
|
|
592542
|
-
return context3.failAndThrow(`Failed to read overlay file at ${absoluteFilePathToOverlay}: ${err}
|
|
592910
|
+
return context3.failAndThrow(`Failed to read overlay file at ${absoluteFilePathToOverlay}: ${err}`, void 0, {
|
|
592911
|
+
code: CliError.Code.ConfigError
|
|
592912
|
+
});
|
|
592543
592913
|
}
|
|
592544
592914
|
try {
|
|
592545
592915
|
try {
|
|
@@ -592548,7 +592918,9 @@ async function parseOverlayFile(absoluteFilePathToOverlay, context3) {
|
|
|
592548
592918
|
return jsYaml.load(contents, { json: true });
|
|
592549
592919
|
}
|
|
592550
592920
|
} catch (err) {
|
|
592551
|
-
return context3.failAndThrow(`Failed to parse overlay file at ${absoluteFilePathToOverlay}: ${err}
|
|
592921
|
+
return context3.failAndThrow(`Failed to parse overlay file at ${absoluteFilePathToOverlay}: ${err}`, void 0, {
|
|
592922
|
+
code: CliError.Code.ParseError
|
|
592923
|
+
});
|
|
592552
592924
|
}
|
|
592553
592925
|
}
|
|
592554
592926
|
function validateOverlay(overlay, context3) {
|
|
@@ -595871,7 +596243,10 @@ function createTypeReferenceFromFernType(fernType) {
|
|
|
595871
596243
|
string: (value2) => Literal.string(value2),
|
|
595872
596244
|
boolean: (value2) => Literal.boolean(value2),
|
|
595873
596245
|
_other: () => {
|
|
595874
|
-
throw new
|
|
596246
|
+
throw new CliError({
|
|
596247
|
+
message: "Unexpected literal type",
|
|
596248
|
+
code: CliError.Code.InternalError
|
|
596249
|
+
});
|
|
595875
596250
|
}
|
|
595876
596251
|
})));
|
|
595877
596252
|
},
|
|
@@ -599912,7 +600287,10 @@ var ChannelConverter3_0 = class extends AbstractChannelConverter {
|
|
|
599912
600287
|
}
|
|
599913
600288
|
getChannelPathFromOperation(operation) {
|
|
599914
600289
|
if (!operation.channel.$ref.startsWith(CHANNEL_REFERENCE_PREFIX2)) {
|
|
599915
|
-
throw new
|
|
600290
|
+
throw new CliError({
|
|
600291
|
+
message: `Failed to resolve channel path from operation ${operation.channel.$ref}`,
|
|
600292
|
+
code: CliError.Code.ReferenceError
|
|
600293
|
+
});
|
|
599916
600294
|
}
|
|
599917
600295
|
return operation.channel.$ref.substring(CHANNEL_REFERENCE_PREFIX2.length);
|
|
599918
600296
|
}
|
|
@@ -604748,7 +605126,7 @@ function getPlatformInfo() {
|
|
|
604748
605126
|
osName = "Windows";
|
|
604749
605127
|
break;
|
|
604750
605128
|
default:
|
|
604751
|
-
throw new
|
|
605129
|
+
throw new CliError({ message: `Unsupported platform: ${platform3}`, code: CliError.Code.EnvironmentError });
|
|
604752
605130
|
}
|
|
604753
605131
|
let archName;
|
|
604754
605132
|
switch (arch3) {
|
|
@@ -604759,7 +605137,7 @@ function getPlatformInfo() {
|
|
|
604759
605137
|
archName = platform3 === "linux" ? "aarch64" : "arm64";
|
|
604760
605138
|
break;
|
|
604761
605139
|
default:
|
|
604762
|
-
throw new
|
|
605140
|
+
throw new CliError({ message: `Unsupported architecture: ${arch3}`, code: CliError.Code.EnvironmentError });
|
|
604763
605141
|
}
|
|
604764
605142
|
return {
|
|
604765
605143
|
os: osName,
|
|
@@ -604833,7 +605211,10 @@ async function acquireLock(logger4) {
|
|
|
604833
605211
|
await new Promise((resolve14) => setTimeout(resolve14, LOCK_RETRY_INTERVAL_MS));
|
|
604834
605212
|
}
|
|
604835
605213
|
}
|
|
604836
|
-
throw new
|
|
605214
|
+
throw new CliError({
|
|
605215
|
+
message: `Failed to acquire buf lock after timeout and retry`,
|
|
605216
|
+
code: CliError.Code.InternalError
|
|
605217
|
+
});
|
|
604837
605218
|
}
|
|
604838
605219
|
return createLockReleaser(lockPath, logger4);
|
|
604839
605220
|
}
|
|
@@ -605022,7 +605403,10 @@ async function ensureBufCommand(logger4) {
|
|
|
605022
605403
|
logger4.debug(`Using auto-downloaded buf: ${downloadedBufPath}`);
|
|
605023
605404
|
return downloadedBufPath;
|
|
605024
605405
|
}
|
|
605025
|
-
throw new
|
|
605406
|
+
throw new CliError({
|
|
605407
|
+
message: "Missing required dependency; please install 'buf' to continue (e.g. 'brew install buf').",
|
|
605408
|
+
code: CliError.Code.EnvironmentError
|
|
605409
|
+
});
|
|
605026
605410
|
}
|
|
605027
605411
|
}
|
|
605028
605412
|
var PROTOBUF_GENERATOR_CONFIG_FILENAME = "buf.gen.yaml";
|
|
@@ -605239,7 +605623,7 @@ var ProtobufIRGenerator = class {
|
|
|
605239
605623
|
try {
|
|
605240
605624
|
await (0, import_promises34.access)(bufLockPath);
|
|
605241
605625
|
} catch {
|
|
605242
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
605626
|
+
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 });
|
|
605243
605627
|
}
|
|
605244
605628
|
} else {
|
|
605245
605629
|
await buf(["dep", "update"]);
|
|
@@ -605247,7 +605631,9 @@ var ProtobufIRGenerator = class {
|
|
|
605247
605631
|
}
|
|
605248
605632
|
const bufGenerateResult = await buf(["generate"]);
|
|
605249
605633
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605250
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
605634
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
605635
|
+
code: CliError.Code.IrConversionError
|
|
605636
|
+
});
|
|
605251
605637
|
}
|
|
605252
605638
|
await (0, import_promises34.unlink)(bufYamlPath);
|
|
605253
605639
|
} catch (error50) {
|
|
@@ -605263,11 +605649,15 @@ var ProtobufIRGenerator = class {
|
|
|
605263
605649
|
try {
|
|
605264
605650
|
this.resolvedBufCommand = await ensureBufCommand(this.context.logger);
|
|
605265
605651
|
} catch (error50) {
|
|
605266
|
-
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50)
|
|
605652
|
+
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50), void 0, {
|
|
605653
|
+
code: CliError.Code.EnvironmentError
|
|
605654
|
+
});
|
|
605267
605655
|
}
|
|
605268
605656
|
}
|
|
605269
605657
|
async generateRemote() {
|
|
605270
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
605658
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
605659
|
+
code: CliError.Code.InternalError
|
|
605660
|
+
});
|
|
605271
605661
|
}
|
|
605272
605662
|
};
|
|
605273
605663
|
|
|
@@ -605307,7 +605697,7 @@ function getPlatformInfo2() {
|
|
|
605307
605697
|
osName = "windows";
|
|
605308
605698
|
break;
|
|
605309
605699
|
default:
|
|
605310
|
-
throw new
|
|
605700
|
+
throw new CliError({ message: `Unsupported platform: ${platform3}`, code: CliError.Code.EnvironmentError });
|
|
605311
605701
|
}
|
|
605312
605702
|
let archName;
|
|
605313
605703
|
switch (arch3) {
|
|
@@ -605318,7 +605708,7 @@ function getPlatformInfo2() {
|
|
|
605318
605708
|
archName = "arm64";
|
|
605319
605709
|
break;
|
|
605320
605710
|
default:
|
|
605321
|
-
throw new
|
|
605711
|
+
throw new CliError({ message: `Unsupported architecture: ${arch3}`, code: CliError.Code.EnvironmentError });
|
|
605322
605712
|
}
|
|
605323
605713
|
return {
|
|
605324
605714
|
os: osName,
|
|
@@ -605392,7 +605782,10 @@ async function acquireLock2(logger4) {
|
|
|
605392
605782
|
await new Promise((resolve14) => setTimeout(resolve14, LOCK_RETRY_INTERVAL_MS2));
|
|
605393
605783
|
}
|
|
605394
605784
|
}
|
|
605395
|
-
throw new
|
|
605785
|
+
throw new CliError({
|
|
605786
|
+
message: `Failed to acquire lock after timeout and retry`,
|
|
605787
|
+
code: CliError.Code.InternalError
|
|
605788
|
+
});
|
|
605396
605789
|
}
|
|
605397
605790
|
return createLockReleaser2(lockPath, logger4);
|
|
605398
605791
|
}
|
|
@@ -605510,7 +605903,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605510
605903
|
*/
|
|
605511
605904
|
async prepare({ absoluteFilepathToProtobufRoot, relativeFilepathToProtobufRoot, local, deps }) {
|
|
605512
605905
|
if (!local) {
|
|
605513
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
605906
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
605907
|
+
code: CliError.Code.InternalError
|
|
605908
|
+
});
|
|
605514
605909
|
}
|
|
605515
605910
|
await this.ensureBufResolved();
|
|
605516
605911
|
await this.ensureProtocGenOpenAPIResolved();
|
|
@@ -605530,7 +605925,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605530
605925
|
try {
|
|
605531
605926
|
await (0, import_promises36.access)(bufLockPath);
|
|
605532
605927
|
} catch {
|
|
605533
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
605928
|
+
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 });
|
|
605534
605929
|
}
|
|
605535
605930
|
} else {
|
|
605536
605931
|
const bufCommand = this.resolvedBufCommand ?? "buf";
|
|
@@ -605567,7 +605962,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605567
605962
|
});
|
|
605568
605963
|
const bufGenerateResult = await buf(["generate", target.toString()]);
|
|
605569
605964
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605570
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
605965
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
605966
|
+
code: CliError.Code.IrConversionError
|
|
605967
|
+
});
|
|
605571
605968
|
}
|
|
605572
605969
|
const outputPath = join8(preparedDir.cwd, RelativeFilePath2.of(PROTOBUF_GENERATOR_OUTPUT_FILEPATH2));
|
|
605573
605970
|
const uniqueOutput = AbsoluteFilePath2.of((await import_tmp_promise7.default.file({ postfix: ".yaml" })).path);
|
|
@@ -605625,7 +606022,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605625
606022
|
try {
|
|
605626
606023
|
await (0, import_promises36.access)(bufLockPath);
|
|
605627
606024
|
} catch {
|
|
605628
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
606025
|
+
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 });
|
|
605629
606026
|
}
|
|
605630
606027
|
} else {
|
|
605631
606028
|
await buf(["dep", "update"]);
|
|
@@ -605638,7 +606035,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605638
606035
|
}
|
|
605639
606036
|
const bufGenerateResult = await buf(["generate", target.toString()]);
|
|
605640
606037
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605641
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
606038
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
606039
|
+
code: CliError.Code.IrConversionError
|
|
606040
|
+
});
|
|
605642
606041
|
}
|
|
605643
606042
|
if (cleanupBufLock) {
|
|
605644
606043
|
await (0, import_promises36.unlink)(bufLockPath);
|
|
@@ -605676,7 +606075,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605676
606075
|
this.protocGenOpenAPIResolved = true;
|
|
605677
606076
|
return;
|
|
605678
606077
|
} catch {
|
|
605679
|
-
this.context.failAndThrow("FERN_USE_LOCAL_PROTOC_GEN_OPENAPI is set but protoc-gen-openapi was not found on PATH.");
|
|
606078
|
+
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 });
|
|
605680
606079
|
}
|
|
605681
606080
|
}
|
|
605682
606081
|
this.context.logger.debug("Resolving protoc-gen-openapi (preferring auto-downloaded fern fork)");
|
|
@@ -605701,7 +606100,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605701
606100
|
}
|
|
605702
606101
|
this.protocGenOpenAPIResolved = true;
|
|
605703
606102
|
} catch {
|
|
605704
|
-
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').");
|
|
606103
|
+
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 });
|
|
605705
606104
|
}
|
|
605706
606105
|
}
|
|
605707
606106
|
async ensureBufResolved() {
|
|
@@ -605711,11 +606110,15 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605711
606110
|
try {
|
|
605712
606111
|
this.resolvedBufCommand = await ensureBufCommand(this.context.logger);
|
|
605713
606112
|
} catch (error50) {
|
|
605714
|
-
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50)
|
|
606113
|
+
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50), void 0, {
|
|
606114
|
+
code: CliError.Code.EnvironmentError
|
|
606115
|
+
});
|
|
605715
606116
|
}
|
|
605716
606117
|
}
|
|
605717
606118
|
async generateRemote() {
|
|
605718
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
606119
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
606120
|
+
code: CliError.Code.InternalError
|
|
606121
|
+
});
|
|
605719
606122
|
}
|
|
605720
606123
|
};
|
|
605721
606124
|
function getProtobufGeneratorConfig({ relativeFilepathToProtobufRoot }) {
|
|
@@ -606094,7 +606497,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606094
606497
|
}
|
|
606095
606498
|
}
|
|
606096
606499
|
if (mergedIr === void 0) {
|
|
606097
|
-
throw new
|
|
606500
|
+
throw new CliError({
|
|
606501
|
+
message: "Failed to generate intermediate representation",
|
|
606502
|
+
code: CliError.Code.IrConversionError
|
|
606503
|
+
});
|
|
606098
606504
|
}
|
|
606099
606505
|
if (authOverrides != null) {
|
|
606100
606506
|
mergedIr = resolveOAuthEndpointReferences({ ir: mergedIr, authOverrides });
|
|
@@ -606190,7 +606596,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606190
606596
|
}
|
|
606191
606597
|
async convertSpecsOverrideToSpecs(specsOverride) {
|
|
606192
606598
|
if (!Array.isArray(specsOverride)) {
|
|
606193
|
-
throw new
|
|
606599
|
+
throw new CliError({
|
|
606600
|
+
message: "Conjure specs override is not yet supported",
|
|
606601
|
+
code: CliError.Code.InternalError
|
|
606602
|
+
});
|
|
606194
606603
|
}
|
|
606195
606604
|
const specs = [];
|
|
606196
606605
|
for (const spec of specsOverride) {
|
|
@@ -606224,7 +606633,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606224
606633
|
};
|
|
606225
606634
|
specs.push(openApiSpec);
|
|
606226
606635
|
} else {
|
|
606227
|
-
throw new
|
|
606636
|
+
throw new CliError({
|
|
606637
|
+
message: `Spec type override not yet supported. Only OpenAPI specs are currently supported in specs override.`,
|
|
606638
|
+
code: CliError.Code.InternalError
|
|
606639
|
+
});
|
|
606228
606640
|
}
|
|
606229
606641
|
}
|
|
606230
606642
|
return specs;
|
|
@@ -614356,7 +614768,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614356
614768
|
properties: {
|
|
614357
614769
|
...event,
|
|
614358
614770
|
...event.properties,
|
|
614359
|
-
version: "4.
|
|
614771
|
+
version: "4.82.0-3-gc1f31446d2e",
|
|
614360
614772
|
usingAccessToken: true
|
|
614361
614773
|
}
|
|
614362
614774
|
});
|
|
@@ -614410,7 +614822,7 @@ var UserPosthogManager = class {
|
|
|
614410
614822
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614411
614823
|
event: "CLI",
|
|
614412
614824
|
properties: {
|
|
614413
|
-
version: "4.
|
|
614825
|
+
version: "4.82.0-3-gc1f31446d2e",
|
|
614414
614826
|
...event,
|
|
614415
614827
|
...event.properties,
|
|
614416
614828
|
usingAccessToken: false,
|
|
@@ -615290,7 +615702,7 @@ async function doAuth0DeviceAuthorizationFlow({ auth0Domain: auth0Domain2, auth0
|
|
|
615290
615702
|
validateStatus: () => true
|
|
615291
615703
|
});
|
|
615292
615704
|
if (deviceCodeResponse.status !== 200) {
|
|
615293
|
-
context3.failAndThrow("Failed to authenticate", deviceCodeResponse.data);
|
|
615705
|
+
context3.failAndThrow("Failed to authenticate", deviceCodeResponse.data, { code: CliError.Code.AuthError });
|
|
615294
615706
|
}
|
|
615295
615707
|
await (0, import_open.default)(deviceCodeResponse.data.verification_uri_complete);
|
|
615296
615708
|
context3.logger.info([
|
|
@@ -615345,7 +615757,7 @@ async function pollForToken({ auth0Domain: auth0Domain2, auth0ClientId, deviceCo
|
|
|
615345
615757
|
case "access_denied":
|
|
615346
615758
|
case "expired_token":
|
|
615347
615759
|
default:
|
|
615348
|
-
return context3.failAndThrow("Failed to authenticate", data2);
|
|
615760
|
+
return context3.failAndThrow("Failed to authenticate", data2, { code: CliError.Code.AuthError });
|
|
615349
615761
|
}
|
|
615350
615762
|
}
|
|
615351
615763
|
|
|
@@ -615435,10 +615847,10 @@ async function getTokenFromCode({ auth0Domain: auth0Domain2, auth0ClientId, code
|
|
|
615435
615847
|
});
|
|
615436
615848
|
const { access_token: accessToken, id_token: idToken } = response.data;
|
|
615437
615849
|
if (accessToken == null) {
|
|
615438
|
-
throw new
|
|
615850
|
+
throw new CliError({ message: "Access token is not defined", code: CliError.Code.AuthError });
|
|
615439
615851
|
}
|
|
615440
615852
|
if (idToken == null) {
|
|
615441
|
-
throw new
|
|
615853
|
+
throw new CliError({ message: "ID token is not defined", code: CliError.Code.AuthError });
|
|
615442
615854
|
}
|
|
615443
615855
|
return { accessToken, idToken };
|
|
615444
615856
|
}
|
|
@@ -615469,17 +615881,26 @@ async function resolveSsoConnection({ dashboardBaseUrl, email: email3 }) {
|
|
|
615469
615881
|
});
|
|
615470
615882
|
} catch (error50) {
|
|
615471
615883
|
if (axios_default.isAxiosError(error50) && error50.response?.status === 404) {
|
|
615472
|
-
throw new
|
|
615884
|
+
throw new CliError({
|
|
615885
|
+
message: `No SSO connection associated with email: ${email3}`,
|
|
615886
|
+
code: CliError.Code.AuthError
|
|
615887
|
+
});
|
|
615473
615888
|
}
|
|
615474
615889
|
throw error50;
|
|
615475
615890
|
}
|
|
615476
615891
|
const responseData = response.data;
|
|
615477
615892
|
if (typeof responseData !== "object" || responseData == null) {
|
|
615478
|
-
throw new
|
|
615893
|
+
throw new CliError({
|
|
615894
|
+
message: "Invalid response format from SSO resolve endpoint",
|
|
615895
|
+
code: CliError.Code.AuthError
|
|
615896
|
+
});
|
|
615479
615897
|
}
|
|
615480
615898
|
const { connection } = responseData;
|
|
615481
615899
|
if (typeof connection !== "string" || connection.length === 0) {
|
|
615482
|
-
throw new
|
|
615900
|
+
throw new CliError({
|
|
615901
|
+
message: "No SSO connection found for this email",
|
|
615902
|
+
code: CliError.Code.AuthError
|
|
615903
|
+
});
|
|
615483
615904
|
}
|
|
615484
615905
|
return connection;
|
|
615485
615906
|
}
|
|
@@ -615547,14 +615968,14 @@ async function askToLogin(context3) {
|
|
|
615547
615968
|
if (!await isLoggedIn() && process.stdout.isTTY) {
|
|
615548
615969
|
await context3.takeOverTerminal(async () => {
|
|
615549
615970
|
if (!await askForConfirmation("Login required. Continue?")) {
|
|
615550
|
-
context3.failAndThrow();
|
|
615971
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.AuthError });
|
|
615551
615972
|
}
|
|
615552
615973
|
});
|
|
615553
615974
|
await login(context3);
|
|
615554
615975
|
}
|
|
615555
615976
|
const token = await getToken2();
|
|
615556
615977
|
if (token == null) {
|
|
615557
|
-
context3.failAndThrow("Authentication required. Please run 'fern login' or set the FERN_TOKEN environment variable.");
|
|
615978
|
+
context3.failAndThrow("Authentication required. Please run 'fern login' or set the FERN_TOKEN environment variable.", void 0, { code: CliError.Code.AuthError });
|
|
615558
615979
|
}
|
|
615559
615980
|
return token;
|
|
615560
615981
|
}
|
|
@@ -615614,7 +616035,10 @@ var PlatformKeyring = class {
|
|
|
615614
616035
|
await this.setPasswordWindows(service, account, password);
|
|
615615
616036
|
break;
|
|
615616
616037
|
default:
|
|
615617
|
-
throw new
|
|
616038
|
+
throw new CliError({
|
|
616039
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
616040
|
+
code: CliError.Code.EnvironmentError
|
|
616041
|
+
});
|
|
615618
616042
|
}
|
|
615619
616043
|
}
|
|
615620
616044
|
async getPassword(service, account) {
|
|
@@ -615626,7 +616050,10 @@ var PlatformKeyring = class {
|
|
|
615626
616050
|
case "win32":
|
|
615627
616051
|
return this.getPasswordWindows(service, account);
|
|
615628
616052
|
default:
|
|
615629
|
-
throw new
|
|
616053
|
+
throw new CliError({
|
|
616054
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
616055
|
+
code: CliError.Code.EnvironmentError
|
|
616056
|
+
});
|
|
615630
616057
|
}
|
|
615631
616058
|
}
|
|
615632
616059
|
async deletePassword(service, account) {
|
|
@@ -615638,7 +616065,10 @@ var PlatformKeyring = class {
|
|
|
615638
616065
|
case "win32":
|
|
615639
616066
|
return this.deletePasswordWindows(service, account);
|
|
615640
616067
|
default:
|
|
615641
|
-
throw new
|
|
616068
|
+
throw new CliError({
|
|
616069
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
616070
|
+
code: CliError.Code.EnvironmentError
|
|
616071
|
+
});
|
|
615642
616072
|
}
|
|
615643
616073
|
}
|
|
615644
616074
|
async findCredentials(service) {
|
|
@@ -615650,7 +616080,10 @@ var PlatformKeyring = class {
|
|
|
615650
616080
|
case "win32":
|
|
615651
616081
|
return this.findCredentialsWindows(service);
|
|
615652
616082
|
default:
|
|
615653
|
-
throw new
|
|
616083
|
+
throw new CliError({
|
|
616084
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
616085
|
+
code: CliError.Code.EnvironmentError
|
|
616086
|
+
});
|
|
615654
616087
|
}
|
|
615655
616088
|
}
|
|
615656
616089
|
async setPasswordDarwin(service, account, password) {
|
|
@@ -617574,7 +618007,10 @@ var YamlSourceResolver = class {
|
|
|
617574
618007
|
case "boolean":
|
|
617575
618008
|
return new SourcedBoolean(value2, location2);
|
|
617576
618009
|
default:
|
|
617577
|
-
throw new
|
|
618010
|
+
throw new CliError({
|
|
618011
|
+
message: `Unexpected value type: ${typeof value2}`,
|
|
618012
|
+
code: CliError.Code.InternalError
|
|
618013
|
+
});
|
|
617578
618014
|
}
|
|
617579
618015
|
}
|
|
617580
618016
|
};
|
|
@@ -617654,7 +618090,10 @@ var YamlConfigLoader = class {
|
|
|
617654
618090
|
try {
|
|
617655
618091
|
return await this.parser.parseDocument({ absoluteFilePath, cwd: this.cwd });
|
|
617656
618092
|
} catch (err) {
|
|
617657
|
-
throw new
|
|
618093
|
+
throw new CliError({
|
|
618094
|
+
message: `Failed to parse YAML file ${absoluteFilePath}: ${extractErrorMessage(err)}`,
|
|
618095
|
+
code: CliError.Code.ParseError
|
|
618096
|
+
});
|
|
617658
618097
|
}
|
|
617659
618098
|
}
|
|
617660
618099
|
async resolveReferences({ document: document4, resolveReferences }) {
|
|
@@ -617763,7 +618202,10 @@ var FileFinder = class {
|
|
|
617763
618202
|
async findOrThrow({ filename, remediationMessage }) {
|
|
617764
618203
|
const filepath = await this.find({ filename });
|
|
617765
618204
|
if (filepath == null) {
|
|
617766
|
-
throw new
|
|
618205
|
+
throw new CliError({
|
|
618206
|
+
message: `${filename} file not found in any parent directory from ${this.from}`,
|
|
618207
|
+
code: CliError.Code.InternalError
|
|
618208
|
+
});
|
|
617767
618209
|
}
|
|
617768
618210
|
return filepath;
|
|
617769
618211
|
}
|
|
@@ -617805,7 +618247,10 @@ var FernYmlSchemaLoader = class {
|
|
|
617805
618247
|
async loadOrThrow() {
|
|
617806
618248
|
const loadResult = await this.load();
|
|
617807
618249
|
if (loadResult.type === "notFound") {
|
|
617808
|
-
throw new
|
|
618250
|
+
throw new CliError({
|
|
618251
|
+
message: `${FILENAME2} file not found in any parent directory; did you forget to run \`fern init\`?`,
|
|
618252
|
+
code: CliError.Code.InternalError
|
|
618253
|
+
});
|
|
617809
618254
|
}
|
|
617810
618255
|
if (loadResult.type === "failure") {
|
|
617811
618256
|
throw new SourcedValidationError(loadResult.issues);
|
|
@@ -617876,7 +618321,10 @@ var TelemetryClient = class _TelemetryClient {
|
|
|
617876
618321
|
if (sentryDsn != null && sentryDsn.length > 0 && isTelemetryEnabled) {
|
|
617877
618322
|
const sentryEnvironment = "development";
|
|
617878
618323
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
617879
|
-
throw new
|
|
618324
|
+
throw new CliError({
|
|
618325
|
+
message: "SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",
|
|
618326
|
+
code: CliError.Code.ConfigError
|
|
618327
|
+
});
|
|
617880
618328
|
}
|
|
617881
618329
|
this.sentry = init2({
|
|
617882
618330
|
dsn: sentryDsn,
|
|
@@ -617994,7 +618442,7 @@ var TelemetryClient = class _TelemetryClient {
|
|
|
617994
618442
|
return join8(AbsoluteFilePath2.of((0, import_os8.homedir)()), RelativeFilePath2.of(".fern"), RelativeFilePath2.of("id"));
|
|
617995
618443
|
}
|
|
617996
618444
|
/**
|
|
617997
|
-
* Returns true if telemetry
|
|
618445
|
+
* Returns true if telemetry is enabled.
|
|
617998
618446
|
*
|
|
617999
618447
|
* Priority:
|
|
618000
618448
|
* 1. FERN_TELEMETRY_DISABLED env var (any non-empty value)
|
|
@@ -618176,7 +618624,10 @@ var ApiDefinitionConverter = class {
|
|
|
618176
618624
|
sourced
|
|
618177
618625
|
});
|
|
618178
618626
|
}
|
|
618179
|
-
throw new
|
|
618627
|
+
throw new CliError({
|
|
618628
|
+
message: `Unknown spec type: ${JSON.stringify(spec)}`,
|
|
618629
|
+
code: CliError.Code.InternalError
|
|
618630
|
+
});
|
|
618180
618631
|
}
|
|
618181
618632
|
async convertOpenApiSpec({ absoluteFernYmlPath, spec, sourced }) {
|
|
618182
618633
|
const result = {
|
|
@@ -619536,7 +619987,10 @@ var LegacyApiSpecAdapter = class {
|
|
|
619536
619987
|
if (isOpenRpcSpec(spec)) {
|
|
619537
619988
|
return this.adaptOpenRpcSpec(spec);
|
|
619538
619989
|
}
|
|
619539
|
-
throw new
|
|
619990
|
+
throw new CliError({
|
|
619991
|
+
message: `Unsupported spec type: ${JSON.stringify(spec)}`,
|
|
619992
|
+
code: CliError.Code.InternalError
|
|
619993
|
+
});
|
|
619540
619994
|
}
|
|
619541
619995
|
convertAll(specs) {
|
|
619542
619996
|
return specs.map((spec) => this.adapt(spec));
|
|
@@ -742131,7 +742585,7 @@ function convertTypes(types4) {
|
|
|
742131
742585
|
return IrVersions_exports.V54.types.Type.undiscriminatedUnion(convertUndiscriminatedUnion(undiscriminatedUnion21));
|
|
742132
742586
|
},
|
|
742133
742587
|
_other: () => {
|
|
742134
|
-
throw new
|
|
742588
|
+
throw new CliError({ message: "Encountered unknown shape", code: CliError.Code.InternalError });
|
|
742135
742589
|
}
|
|
742136
742590
|
})
|
|
742137
742591
|
};
|
|
@@ -742294,7 +742748,10 @@ function convertTypeReference(typeReference2) {
|
|
|
742294
742748
|
named: IrVersions_exports.V54.types.TypeReference.named,
|
|
742295
742749
|
unknown: IrVersions_exports.V54.types.TypeReference.unknown,
|
|
742296
742750
|
_other: () => {
|
|
742297
|
-
throw new
|
|
742751
|
+
throw new CliError({
|
|
742752
|
+
message: "Unknown type reference: " + typeReference2.type,
|
|
742753
|
+
code: CliError.Code.InternalError
|
|
742754
|
+
});
|
|
742298
742755
|
}
|
|
742299
742756
|
});
|
|
742300
742757
|
}
|
|
@@ -742322,7 +742779,10 @@ function convertContainerType(container) {
|
|
|
742322
742779
|
}),
|
|
742323
742780
|
literal: IrVersions_exports.V54.types.ContainerType.literal,
|
|
742324
742781
|
_other: () => {
|
|
742325
|
-
throw new
|
|
742782
|
+
throw new CliError({
|
|
742783
|
+
message: "Unknown ContainerType: " + container.type,
|
|
742784
|
+
code: CliError.Code.InternalError
|
|
742785
|
+
});
|
|
742326
742786
|
}
|
|
742327
742787
|
});
|
|
742328
742788
|
}
|
|
@@ -742341,7 +742801,10 @@ function convertSingleUnionTypeProperties(properties7) {
|
|
|
742341
742801
|
}),
|
|
742342
742802
|
noProperties: IrVersions_exports.V54.types.SingleUnionTypeProperties.noProperties,
|
|
742343
742803
|
_other: () => {
|
|
742344
|
-
throw new
|
|
742804
|
+
throw new CliError({
|
|
742805
|
+
message: `Unknown SingleUnionTypeProperties: ${JSON.stringify(properties7)}`,
|
|
742806
|
+
code: CliError.Code.InternalError
|
|
742807
|
+
});
|
|
742345
742808
|
}
|
|
742346
742809
|
});
|
|
742347
742810
|
}
|
|
@@ -742352,7 +742815,10 @@ function convertResolvedType(resolvedType) {
|
|
|
742352
742815
|
primitive: (primitiveType2) => IrVersions_exports.V54.types.ResolvedTypeReference.primitive(convertPrimitiveType(primitiveType2)),
|
|
742353
742816
|
unknown: IrVersions_exports.V54.types.ResolvedTypeReference.unknown,
|
|
742354
742817
|
_other: () => {
|
|
742355
|
-
throw new
|
|
742818
|
+
throw new CliError({
|
|
742819
|
+
message: "Unknown ResolvedTypeReference: " + resolvedType.type,
|
|
742820
|
+
code: CliError.Code.InternalError
|
|
742821
|
+
});
|
|
742356
742822
|
}
|
|
742357
742823
|
});
|
|
742358
742824
|
}
|
|
@@ -742551,7 +743017,10 @@ function convertSdkRequestShape(shape) {
|
|
|
742551
743017
|
justRequestBody: (reference4) => IrVersions_exports.V54.http.SdkRequestShape.justRequestBody(convertSdkRequestBodyType(reference4)),
|
|
742552
743018
|
wrapper: IrVersions_exports.V54.http.SdkRequestShape.wrapper,
|
|
742553
743019
|
_other: () => {
|
|
742554
|
-
throw new
|
|
743020
|
+
throw new CliError({
|
|
743021
|
+
message: "Unknown SdkRequestShape: " + shape.type,
|
|
743022
|
+
code: CliError.Code.InternalError
|
|
743023
|
+
});
|
|
742555
743024
|
}
|
|
742556
743025
|
});
|
|
742557
743026
|
}
|
|
@@ -742601,7 +743070,10 @@ function convertRequestBody(requestBody) {
|
|
|
742601
743070
|
return IrVersions_exports.V54.http.HttpRequestBody.bytes(bytes);
|
|
742602
743071
|
},
|
|
742603
743072
|
_other: () => {
|
|
742604
|
-
throw new
|
|
743073
|
+
throw new CliError({
|
|
743074
|
+
message: "Unknown HttpRequestBody: " + requestBody.type,
|
|
743075
|
+
code: CliError.Code.InternalError
|
|
743076
|
+
});
|
|
742605
743077
|
}
|
|
742606
743078
|
});
|
|
742607
743079
|
}
|
|
@@ -744039,7 +744511,7 @@ function convertAuthScheme(scheme) {
|
|
|
744039
744511
|
case "inferred":
|
|
744040
744512
|
return IrVersions_exports.V62.AuthScheme.inferred(scheme);
|
|
744041
744513
|
default:
|
|
744042
|
-
throw new
|
|
744514
|
+
throw new CliError({ message: "Unknown AuthScheme type", code: CliError.Code.InternalError });
|
|
744043
744515
|
}
|
|
744044
744516
|
}
|
|
744045
744517
|
function convertTypeDeclaration2(typeDeclaration2) {
|
|
@@ -746454,10 +746926,16 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
746454
746926
|
if (targetGenerator != null) {
|
|
746455
746927
|
const minVersion = this.getMinimumGeneratorVersion(targetGenerator.name);
|
|
746456
746928
|
if (minVersion != null) {
|
|
746457
|
-
throw new
|
|
746929
|
+
throw new CliError({
|
|
746930
|
+
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'.`,
|
|
746931
|
+
code: CliError.Code.VersionError
|
|
746932
|
+
});
|
|
746458
746933
|
}
|
|
746459
746934
|
}
|
|
746460
|
-
throw new
|
|
746935
|
+
throw new CliError({
|
|
746936
|
+
message: "This generator version is not compatible with CLI v4.x.x+. Please upgrade your generator using 'fern generator upgrade --include-major'.",
|
|
746937
|
+
code: CliError.Code.VersionError
|
|
746938
|
+
});
|
|
746461
746939
|
}
|
|
746462
746940
|
}
|
|
746463
746941
|
migrateThroughVersion({ version: version7, intermediateRepresentation, context: context3, targetGenerator }) {
|
|
@@ -746483,7 +746961,7 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
746483
746961
|
targetGenerator
|
|
746484
746962
|
});
|
|
746485
746963
|
if (!hasEncounteredMigrationYet) {
|
|
746486
|
-
context3.failAndThrow(`IR ${version7} does not exist
|
|
746964
|
+
context3.failAndThrow(`IR ${version7} does not exist`, void 0, { code: CliError.Code.VersionError });
|
|
746487
746965
|
}
|
|
746488
746966
|
return migrated;
|
|
746489
746967
|
}
|
|
@@ -746513,15 +746991,28 @@ var IntermediateRepresentationMigratorImpl = class {
|
|
|
746513
746991
|
shouldRunMigration({ migration: migration23, targetGenerator }) {
|
|
746514
746992
|
const minVersionToExclude = migration23.firstGeneratorVersionToConsumeNewIR[targetGenerator.name];
|
|
746515
746993
|
if (minVersionToExclude == null) {
|
|
746516
|
-
throw new
|
|
746994
|
+
throw new CliError({
|
|
746995
|
+
message: `Cannot migrate intermediate representation. Unrecognized generator: ${targetGenerator.name}. If leveraging a custom generator, ensure you are specifying "ir-version" within the generator configuration.`,
|
|
746996
|
+
code: CliError.Code.ConfigError
|
|
746997
|
+
});
|
|
746517
746998
|
}
|
|
746518
746999
|
switch (minVersionToExclude) {
|
|
746519
747000
|
case GeneratorWasNeverUpdatedToConsumeNewIR:
|
|
746520
747001
|
return true;
|
|
746521
747002
|
case GeneratorWasNotCreatedYet:
|
|
746522
|
-
throw new
|
|
747003
|
+
throw new CliError({
|
|
747004
|
+
message: `Cannot migrate intermediate representation. Generator was created after intermediate representation ${migration23.laterVersion}.`,
|
|
747005
|
+
code: CliError.Code.VersionError
|
|
747006
|
+
});
|
|
747007
|
+
}
|
|
747008
|
+
try {
|
|
747009
|
+
return isVersionAhead(minVersionToExclude, targetGenerator.version);
|
|
747010
|
+
} catch (error50) {
|
|
747011
|
+
throw new CliError({
|
|
747012
|
+
message: `Failed to compare versions: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
747013
|
+
code: CliError.Code.VersionError
|
|
747014
|
+
});
|
|
746523
747015
|
}
|
|
746524
|
-
return isVersionAhead(minVersionToExclude, targetGenerator.version);
|
|
746525
747016
|
}
|
|
746526
747017
|
getIRVersionForGenerator({ targetGenerator }) {
|
|
746527
747018
|
let lastIrVersion = this.migrations[0]?.laterVersion;
|
|
@@ -746685,7 +747176,10 @@ var LegacyFernWorkspaceAdapter = class {
|
|
|
746685
747176
|
generatorsConfiguration: apiConfig != null ? this.buildGeneratorsConfiguration(apiConfig) : void 0
|
|
746686
747177
|
});
|
|
746687
747178
|
if (ossWorkspace == null) {
|
|
746688
|
-
throw new
|
|
747179
|
+
throw new CliError({
|
|
747180
|
+
message: "Internal error; failed to build API definitions",
|
|
747181
|
+
code: CliError.Code.InternalError
|
|
747182
|
+
});
|
|
746689
747183
|
}
|
|
746690
747184
|
return ossWorkspace.toFernWorkspace({ context: this.taskContext });
|
|
746691
747185
|
}
|
|
@@ -747842,7 +748336,10 @@ function addSplitCommand(cli) {
|
|
|
747842
748336
|
description: `Output format: '${OVERLAY_NAME}' (OpenAPI Overlay 1.0.0) or '${OVERRIDES_NAME}' (Fern deep-merge)`
|
|
747843
748337
|
}).coerce("format", (value2) => {
|
|
747844
748338
|
if (!ALL_FORMAT_NAMES.includes(value2)) {
|
|
747845
|
-
throw new
|
|
748339
|
+
throw new CliError({
|
|
748340
|
+
message: `Invalid format '${value2}'. Expected one of: ${OVERLAY_NAME}, ${OVERRIDES_NAME}`,
|
|
748341
|
+
code: CliError.Code.ValidationError
|
|
748342
|
+
});
|
|
747846
748343
|
}
|
|
747847
748344
|
return value2;
|
|
747848
748345
|
}));
|
|
@@ -786403,7 +786900,10 @@ function mergeEndpointPairs({ children: children2, findEndpointById, stringifyEn
|
|
|
786403
786900
|
}
|
|
786404
786901
|
const endpoint3 = findEndpointById(child.endpointId);
|
|
786405
786902
|
if (endpoint3 == null) {
|
|
786406
|
-
throw new
|
|
786903
|
+
throw new CliError({
|
|
786904
|
+
message: `Endpoint ${child.endpointId} not found`,
|
|
786905
|
+
code: CliError.Code.InternalError
|
|
786906
|
+
});
|
|
786407
786907
|
}
|
|
786408
786908
|
const methodAndPath = `${endpoint3.method} ${stringifyEndpointPathParts3(endpoint3)}`;
|
|
786409
786909
|
const existing = methodAndPathToEndpointNode.get(methodAndPath);
|
|
@@ -787407,7 +787907,9 @@ ${tagInfo.description}`;
|
|
|
787407
787907
|
getFileId(filepath) {
|
|
787408
787908
|
const fileId = this.collectedFileIds.get(filepath);
|
|
787409
787909
|
if (fileId == null) {
|
|
787410
|
-
return this.taskContext.failAndThrow("Failed to locate file after uploading: " + filepath
|
|
787910
|
+
return this.taskContext.failAndThrow("Failed to locate file after uploading: " + filepath, void 0, {
|
|
787911
|
+
code: CliError.Code.InternalError
|
|
787912
|
+
});
|
|
787411
787913
|
}
|
|
787412
787914
|
return fileId;
|
|
787413
787915
|
}
|
|
@@ -787449,7 +787951,10 @@ var NodeIdGenerator2 = class _NodeIdGenerator {
|
|
|
787449
787951
|
hashedId = this.#getHashedId(id);
|
|
787450
787952
|
loop++;
|
|
787451
787953
|
if (loop > 100) {
|
|
787452
|
-
throw new
|
|
787954
|
+
throw new CliError({
|
|
787955
|
+
message: `Infinite loop detected for id: ${id}`,
|
|
787956
|
+
code: CliError.Code.ReferenceError
|
|
787957
|
+
});
|
|
787453
787958
|
}
|
|
787454
787959
|
}
|
|
787455
787960
|
return hashedId;
|
|
@@ -788205,7 +788710,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788205
788710
|
this.context = context3;
|
|
788206
788711
|
const lambdaOrigin = "https://ykq45y6fvnszd35iv5yuuatkze0rpwuz.lambda-url.us-east-1.on.aws";
|
|
788207
788712
|
if (!lambdaOrigin) {
|
|
788208
|
-
throw new
|
|
788713
|
+
throw new CliError({
|
|
788714
|
+
message: "DEFAULT_FDR_LAMBDA_DOCS_ORIGIN environment variable is not set. AI example enhancement requires this to be configured.",
|
|
788715
|
+
code: CliError.Code.EnvironmentError
|
|
788716
|
+
});
|
|
788209
788717
|
}
|
|
788210
788718
|
this.lambdaOrigin = lambdaOrigin;
|
|
788211
788719
|
this.venusOrigin = "https://venus-dev2.buildwithfern.com";
|
|
@@ -788274,7 +788782,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788274
788782
|
});
|
|
788275
788783
|
if (!response.ok) {
|
|
788276
788784
|
const errorText = await response.text();
|
|
788277
|
-
throw new
|
|
788785
|
+
throw new CliError({
|
|
788786
|
+
message: `Failed to fetch JWT from Venus: ${response.status} ${errorText || response.statusText}`,
|
|
788787
|
+
code: CliError.Code.NetworkError
|
|
788788
|
+
});
|
|
788278
788789
|
}
|
|
788279
788790
|
const result = await response.json();
|
|
788280
788791
|
this.context.logger.debug(`Successfully obtained JWT from Venus (expires at ${result.expiresAt})`);
|
|
@@ -788336,7 +788847,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788336
788847
|
});
|
|
788337
788848
|
if (!response.ok) {
|
|
788338
788849
|
const errorText = await response.text();
|
|
788339
|
-
throw new
|
|
788850
|
+
throw new CliError({
|
|
788851
|
+
message: `Lambda returned ${response.status}: ${errorText || response.statusText}`,
|
|
788852
|
+
code: CliError.Code.NetworkError
|
|
788853
|
+
});
|
|
788340
788854
|
}
|
|
788341
788855
|
const result = await response.json();
|
|
788342
788856
|
return {
|
|
@@ -789849,7 +790363,10 @@ function convertTypeShape(irType) {
|
|
|
789849
790363
|
extraProperties: void 0
|
|
789850
790364
|
}),
|
|
789851
790365
|
_other: () => {
|
|
789852
|
-
throw new
|
|
790366
|
+
throw new CliError({
|
|
790367
|
+
message: "Unknown SingleUnionTypeProperties: " + variant.shape.propertiesType,
|
|
790368
|
+
code: CliError.Code.InternalError
|
|
790369
|
+
});
|
|
789853
790370
|
}
|
|
789854
790371
|
})
|
|
789855
790372
|
};
|
|
@@ -789874,7 +790391,7 @@ function convertTypeShape(irType) {
|
|
|
789874
790391
|
};
|
|
789875
790392
|
},
|
|
789876
790393
|
_other: () => {
|
|
789877
|
-
throw new
|
|
790394
|
+
throw new CliError({ message: "Unknown Type shape: " + irType.type, code: CliError.Code.InternalError });
|
|
789878
790395
|
}
|
|
789879
790396
|
});
|
|
789880
790397
|
}
|
|
@@ -789941,12 +790458,18 @@ function convertTypeReference3(irTypeReference) {
|
|
|
789941
790458
|
};
|
|
789942
790459
|
},
|
|
789943
790460
|
_other: () => {
|
|
789944
|
-
throw new
|
|
790461
|
+
throw new CliError({
|
|
790462
|
+
message: "Unknown literal type: " + literal3.type,
|
|
790463
|
+
code: CliError.Code.InternalError
|
|
790464
|
+
});
|
|
789945
790465
|
}
|
|
789946
790466
|
});
|
|
789947
790467
|
},
|
|
789948
790468
|
_other: () => {
|
|
789949
|
-
throw new
|
|
790469
|
+
throw new CliError({
|
|
790470
|
+
message: "Unknown container reference: " + container.type,
|
|
790471
|
+
code: CliError.Code.InternalError
|
|
790472
|
+
});
|
|
789950
790473
|
}
|
|
789951
790474
|
});
|
|
789952
790475
|
},
|
|
@@ -790026,7 +790549,10 @@ function convertTypeReference3(irTypeReference) {
|
|
|
790026
790549
|
};
|
|
790027
790550
|
},
|
|
790028
790551
|
_other: () => {
|
|
790029
|
-
throw new
|
|
790552
|
+
throw new CliError({
|
|
790553
|
+
message: "Unknown primitive: " + primitive.v1,
|
|
790554
|
+
code: CliError.Code.InternalError
|
|
790555
|
+
});
|
|
790030
790556
|
}
|
|
790031
790557
|
})
|
|
790032
790558
|
};
|
|
@@ -790037,7 +790563,10 @@ function convertTypeReference3(irTypeReference) {
|
|
|
790037
790563
|
};
|
|
790038
790564
|
},
|
|
790039
790565
|
_other: () => {
|
|
790040
|
-
throw new
|
|
790566
|
+
throw new CliError({
|
|
790567
|
+
message: "Unknown Type reference: " + irTypeReference.type,
|
|
790568
|
+
code: CliError.Code.InternalError
|
|
790569
|
+
});
|
|
790041
790570
|
}
|
|
790042
790571
|
});
|
|
790043
790572
|
}
|
|
@@ -790501,7 +791030,10 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
|
|
|
790501
791030
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790502
791031
|
const endpointBaseUrl = singleBaseUrlEnvironment.urls[baseUrlId];
|
|
790503
791032
|
if (endpointBaseUrl == null) {
|
|
790504
|
-
throw new
|
|
791033
|
+
throw new CliError({
|
|
791034
|
+
message: `Encountered undefined server name "${baseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${baseUrlId}`,
|
|
791035
|
+
code: CliError.Code.IrConversionError
|
|
791036
|
+
});
|
|
790505
791037
|
}
|
|
790506
791038
|
return {
|
|
790507
791039
|
id: FdrAPI_exports.EnvironmentId(baseUrlId),
|
|
@@ -790513,12 +791045,18 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
|
|
|
790513
791045
|
return environments2.filter((environment2, index3, self2) => index3 === self2.findIndex((t3) => t3.id === environment2.id && t3.baseUrl === environment2.baseUrl));
|
|
790514
791046
|
}
|
|
790515
791047
|
if (endpointBaseUrlId == null) {
|
|
790516
|
-
throw new
|
|
791048
|
+
throw new CliError({
|
|
791049
|
+
message: `Expected endpoint ${getOriginalName(endpoint3.name)} to have base url.`,
|
|
791050
|
+
code: CliError.Code.IrConversionError
|
|
791051
|
+
});
|
|
790517
791052
|
}
|
|
790518
791053
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790519
791054
|
const endpointBaseUrl = singleBaseUrlEnvironment.urls[endpointBaseUrlId];
|
|
790520
791055
|
if (endpointBaseUrl == null) {
|
|
790521
|
-
throw new
|
|
791056
|
+
throw new CliError({
|
|
791057
|
+
message: `Encountered undefined server name "${endpointBaseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${endpointBaseUrlId}`,
|
|
791058
|
+
code: CliError.Code.IrConversionError
|
|
791059
|
+
});
|
|
790522
791060
|
}
|
|
790523
791061
|
return {
|
|
790524
791062
|
id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
|
|
@@ -790544,12 +791082,18 @@ function convertIrWebSocketEnvironments({ environmentsConfig, channel: channel3
|
|
|
790544
791082
|
});
|
|
790545
791083
|
case "multipleBaseUrls":
|
|
790546
791084
|
if (channelBaseUrlId == null) {
|
|
790547
|
-
throw new
|
|
791085
|
+
throw new CliError({
|
|
791086
|
+
message: `Expected channel ${getOriginalName(channel3.name)} to have base url.`,
|
|
791087
|
+
code: CliError.Code.IrConversionError
|
|
791088
|
+
});
|
|
790548
791089
|
}
|
|
790549
791090
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790550
791091
|
const channelBaseUrl = singleBaseUrlEnvironment.urls[channelBaseUrlId];
|
|
790551
791092
|
if (channelBaseUrl == null) {
|
|
790552
|
-
throw new
|
|
791093
|
+
throw new CliError({
|
|
791094
|
+
message: `Encountered undefined server name ${channelBaseUrl} at channel ${getOriginalName(channel3.name)} ${channel3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${channelBaseUrlId}`,
|
|
791095
|
+
code: CliError.Code.IrConversionError
|
|
791096
|
+
});
|
|
790553
791097
|
}
|
|
790554
791098
|
return {
|
|
790555
791099
|
id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
|
|
@@ -790573,7 +791117,7 @@ function convertHttpMethod2(method8) {
|
|
|
790573
791117
|
delete: () => FdrAPI_exports.HttpMethod.Delete,
|
|
790574
791118
|
head: () => FdrAPI_exports.HttpMethod.Head,
|
|
790575
791119
|
_other: () => {
|
|
790576
|
-
throw new
|
|
791120
|
+
throw new CliError({ message: "Unknown http method: " + method8, code: CliError.Code.InternalError });
|
|
790577
791121
|
}
|
|
790578
791122
|
});
|
|
790579
791123
|
}
|
|
@@ -790689,7 +791233,10 @@ function convertRequestBody3(irRequest) {
|
|
|
790689
791233
|
contentType: bytes.contentType
|
|
790690
791234
|
}),
|
|
790691
791235
|
_other: () => {
|
|
790692
|
-
throw new
|
|
791236
|
+
throw new CliError({
|
|
791237
|
+
message: "Unknown HttpRequestBody: " + irRequest.type,
|
|
791238
|
+
code: CliError.Code.InternalError
|
|
791239
|
+
});
|
|
790693
791240
|
}
|
|
790694
791241
|
});
|
|
790695
791242
|
return requestBodyShape != null ? { type: requestBodyShape, description: irRequest.docs } : void 0;
|
|
@@ -790743,7 +791290,10 @@ function convertResponse2(irResponse) {
|
|
|
790743
791290
|
return void 0;
|
|
790744
791291
|
},
|
|
790745
791292
|
_other: () => {
|
|
790746
|
-
throw new
|
|
791293
|
+
throw new CliError({
|
|
791294
|
+
message: "Unknown HttpResponse: " + irResponse.body,
|
|
791295
|
+
code: CliError.Code.InternalError
|
|
791296
|
+
});
|
|
790747
791297
|
}
|
|
790748
791298
|
});
|
|
790749
791299
|
}
|
|
@@ -790983,7 +791533,10 @@ function convertV2HttpEndpointExample({ shouldUseExampleName, exampleName, examp
|
|
|
790983
791533
|
return void 0;
|
|
790984
791534
|
},
|
|
790985
791535
|
_other: () => {
|
|
790986
|
-
throw new
|
|
791536
|
+
throw new CliError({
|
|
791537
|
+
message: "Unknown ExampleResponseBody: " + example.response?.body?.type,
|
|
791538
|
+
code: CliError.Code.InternalError
|
|
791539
|
+
});
|
|
790987
791540
|
}
|
|
790988
791541
|
}) : void 0,
|
|
790989
791542
|
codeSamples: example.codeSamples?.map((codeSample) => ({
|
|
@@ -791109,18 +791662,27 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
791109
791662
|
stream: (stream5) => stream5.length > 0 ? 200 : 204,
|
|
791110
791663
|
sse: (stream5) => stream5.length > 0 ? 200 : 204,
|
|
791111
791664
|
_other: () => {
|
|
791112
|
-
throw new
|
|
791665
|
+
throw new CliError({
|
|
791666
|
+
message: "Unknown ExampleResponseBody: " + ok3.type,
|
|
791667
|
+
code: CliError.Code.InternalError
|
|
791668
|
+
});
|
|
791113
791669
|
}
|
|
791114
791670
|
}),
|
|
791115
791671
|
error: ({ error: errorName }) => {
|
|
791116
791672
|
const error50 = ir10.errors[errorName.errorId];
|
|
791117
791673
|
if (error50 == null) {
|
|
791118
|
-
throw new
|
|
791674
|
+
throw new CliError({
|
|
791675
|
+
message: "Cannot find error " + errorName.errorId,
|
|
791676
|
+
code: CliError.Code.ResolutionError
|
|
791677
|
+
});
|
|
791119
791678
|
}
|
|
791120
791679
|
return error50.statusCode;
|
|
791121
791680
|
},
|
|
791122
791681
|
_other: () => {
|
|
791123
|
-
throw new
|
|
791682
|
+
throw new CliError({
|
|
791683
|
+
message: "Unknown ExampleResponse: " + example.response.type,
|
|
791684
|
+
code: CliError.Code.InternalError
|
|
791685
|
+
});
|
|
791124
791686
|
}
|
|
791125
791687
|
}),
|
|
791126
791688
|
responseBody: example.response._visit({
|
|
@@ -791142,12 +791704,18 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
791142
791704
|
value: sse.map(({ event, data: data2 }) => ({ event, data: data2.jsonExample }))
|
|
791143
791705
|
}),
|
|
791144
791706
|
_other: () => {
|
|
791145
|
-
throw new
|
|
791707
|
+
throw new CliError({
|
|
791708
|
+
message: "Unknown ExampleResponseBody: " + ok3.type,
|
|
791709
|
+
code: CliError.Code.InternalError
|
|
791710
|
+
});
|
|
791146
791711
|
}
|
|
791147
791712
|
}),
|
|
791148
791713
|
error: (error50) => error50.body != null ? { type: "json", value: error50.body.jsonExample } : void 0,
|
|
791149
791714
|
_other: () => {
|
|
791150
|
-
throw new
|
|
791715
|
+
throw new CliError({
|
|
791716
|
+
message: "Unknown ExampleResponse: " + example.response.type,
|
|
791717
|
+
code: CliError.Code.InternalError
|
|
791718
|
+
});
|
|
791151
791719
|
}
|
|
791152
791720
|
}),
|
|
791153
791721
|
// irExample.response.body != null ? { type: "json", value: irExample.response.body.jsonExample } : undefined,
|
|
@@ -791440,7 +792008,9 @@ async function registerApi({ organization, workspace, context: context3, token,
|
|
|
791440
792008
|
context3.logger.debug(`Registered API Definition ${response.apiDefinitionId}`);
|
|
791441
792009
|
return { id: response.apiDefinitionId, ir: ir10 };
|
|
791442
792010
|
} catch (error50) {
|
|
791443
|
-
return context3.failAndThrow("Failed to register API", error50
|
|
792011
|
+
return context3.failAndThrow("Failed to register API", error50, {
|
|
792012
|
+
code: CliError.Code.NetworkError
|
|
792013
|
+
});
|
|
791444
792014
|
}
|
|
791445
792015
|
}
|
|
791446
792016
|
|
|
@@ -791994,7 +792564,7 @@ var DocsDefinitionResolver = class {
|
|
|
791994
792564
|
_parsedDocsConfig;
|
|
791995
792565
|
get parsedDocsConfig() {
|
|
791996
792566
|
if (this._parsedDocsConfig == null) {
|
|
791997
|
-
throw new
|
|
792567
|
+
throw new CliError({ message: "parsedDocsConfig is not set", code: CliError.Code.InternalError });
|
|
791998
792568
|
}
|
|
791999
792569
|
return this._parsedDocsConfig;
|
|
792000
792570
|
}
|
|
@@ -792490,7 +793060,7 @@ var DocsDefinitionResolver = class {
|
|
|
792490
793060
|
A valid API configuration was not found at the path: fern/apis/${apiSection.apiName}.
|
|
792491
793061
|
Learn more about project structure:
|
|
792492
793062
|
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";
|
|
792493
|
-
throw new
|
|
793063
|
+
throw new CliError({ message: errorMessage, code: CliError.Code.ConfigError });
|
|
792494
793064
|
}
|
|
792495
793065
|
getOpenApiWorkspaceForApiSection(apiSection) {
|
|
792496
793066
|
if (apiSection.apiName != null) {
|
|
@@ -792505,7 +793075,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
792505
793075
|
A valid API configuration was not found at the path: fern/apis/${apiSection.apiName}.
|
|
792506
793076
|
Learn more about project structure:
|
|
792507
793077
|
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";
|
|
792508
|
-
throw new
|
|
793078
|
+
throw new CliError({ message: errorMessage, code: CliError.Code.ConfigError });
|
|
792509
793079
|
}
|
|
792510
793080
|
async toRootNode() {
|
|
792511
793081
|
const slug = navigation_exports.V1.SlugGenerator.init(navigation_exports.slugjoin(this.getDocsBasePath()));
|
|
@@ -792582,7 +793152,10 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
792582
793152
|
const id = this.#idgen.get("versioned");
|
|
792583
793153
|
const defaultVersion = versioned.versions[0];
|
|
792584
793154
|
if (defaultVersion?.hidden === true) {
|
|
792585
|
-
throw new
|
|
793155
|
+
throw new CliError({
|
|
793156
|
+
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.`,
|
|
793157
|
+
code: CliError.Code.ConfigError
|
|
793158
|
+
});
|
|
792586
793159
|
}
|
|
792587
793160
|
const BATCH_SIZE2 = 5;
|
|
792588
793161
|
const children2 = [];
|
|
@@ -792886,7 +793459,7 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
792886
793459
|
}
|
|
792887
793460
|
if (this.docsWorkspace.config.settings?.substituteEnvVars) {
|
|
792888
793461
|
ir10 = replaceEnvVariables(ir10, {
|
|
792889
|
-
onError: (e5) => this.taskContext.failAndThrow(`Error substituting environment variables in API spec: ${e5}
|
|
793462
|
+
onError: (e5) => this.taskContext.failAndThrow(`Error substituting environment variables in API spec: ${e5}`, void 0, { code: CliError.Code.EnvironmentError })
|
|
792890
793463
|
}, { substituteAsEmpty: false });
|
|
792891
793464
|
}
|
|
792892
793465
|
let graphqlWorkspace = openapiWorkspace;
|
|
@@ -793298,7 +793871,9 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
793298
793871
|
}
|
|
793299
793872
|
const fileId = this.collectedFileIds.get(filepath);
|
|
793300
793873
|
if (fileId == null) {
|
|
793301
|
-
return this.taskContext.failAndThrow("Failed to locate file after uploading: " + filepath
|
|
793874
|
+
return this.taskContext.failAndThrow("Failed to locate file after uploading: " + filepath, void 0, {
|
|
793875
|
+
code: CliError.Code.InternalError
|
|
793876
|
+
});
|
|
793302
793877
|
}
|
|
793303
793878
|
return DocsV1Write_exports.FileId(fileId);
|
|
793304
793879
|
}
|
|
@@ -793455,7 +794030,9 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
|
|
|
793455
794030
|
value: this.getFileId(value2)
|
|
793456
794031
|
}),
|
|
793457
794032
|
url: ({ value: value2 }) => ({ type: "url", value: DocsV1Write_exports.Url(value2) }),
|
|
793458
|
-
_other: () => this.taskContext.failAndThrow("Invalid metadata configuration"
|
|
794033
|
+
_other: () => this.taskContext.failAndThrow("Invalid metadata configuration", void 0, {
|
|
794034
|
+
code: CliError.Code.ConfigError
|
|
794035
|
+
})
|
|
793459
794036
|
});
|
|
793460
794037
|
}
|
|
793461
794038
|
/**
|
|
@@ -826658,7 +827235,10 @@ function collectLinksAndSources({ readFile: readFile104 = (path99) => (0, import
|
|
|
826658
827235
|
do {
|
|
826659
827236
|
loopCount++;
|
|
826660
827237
|
if (loopCount > LOOP_LIMIT) {
|
|
826661
|
-
throw new
|
|
827238
|
+
throw new CliError({
|
|
827239
|
+
message: "Infinite loop detected while collecting links and sources",
|
|
827240
|
+
code: CliError.Code.ReferenceError
|
|
827241
|
+
});
|
|
826662
827242
|
}
|
|
826663
827243
|
const popped = contentQueue.shift();
|
|
826664
827244
|
if (popped == null) {
|
|
@@ -826667,7 +827247,10 @@ function collectLinksAndSources({ readFile: readFile104 = (path99) => (0, import
|
|
|
826667
827247
|
const { content: content5, absoluteFilepath } = popped;
|
|
826668
827248
|
if (absoluteFilepath != null) {
|
|
826669
827249
|
if (visitedAbsoluteFilepaths.has(absoluteFilepath)) {
|
|
826670
|
-
throw new
|
|
827250
|
+
throw new CliError({
|
|
827251
|
+
message: `Circular import detected: ${absoluteFilepath}`,
|
|
827252
|
+
code: CliError.Code.ReferenceError
|
|
827253
|
+
});
|
|
826671
827254
|
}
|
|
826672
827255
|
visitedAbsoluteFilepaths.add(absoluteFilepath);
|
|
826673
827256
|
}
|
|
@@ -826884,7 +827467,7 @@ var ValidMarkdownLinks = {
|
|
|
826884
827467
|
const resolvedDocsDefinition = await docsDefinitionResolver.resolve();
|
|
826885
827468
|
const configRoot = resolvedDocsDefinition.config.root;
|
|
826886
827469
|
if (!configRoot || !isV1RootNode2(configRoot)) {
|
|
826887
|
-
throw new
|
|
827470
|
+
throw new CliError({ message: "Root node not found", code: CliError.Code.InternalError });
|
|
826888
827471
|
}
|
|
826889
827472
|
const root6 = navigation_exports.migrate.FernNavigationV1ToLatest.create().root(configRoot);
|
|
826890
827473
|
const collector = navigation_exports.NodeCollector.collect(root6);
|
|
@@ -827894,7 +828477,7 @@ var DocsWorkspaceValidator = class {
|
|
|
827894
828477
|
const startTime = performance.now();
|
|
827895
828478
|
if (workspace.config.settings?.substituteEnvVars) {
|
|
827896
828479
|
workspace.config = replaceEnvVariables(workspace.config, {
|
|
827897
|
-
onError: (error50) => this.taskContext.failAndThrow(error50)
|
|
828480
|
+
onError: (error50) => this.taskContext.failAndThrow(error50, void 0, { code: CliError.Code.ConfigError })
|
|
827898
828481
|
});
|
|
827899
828482
|
}
|
|
827900
828483
|
const violations = await validateDocsWorkspace(workspace, this.taskContext, apiWorkspaces, ossWorkspaces, false, excludeRules);
|
|
@@ -830034,7 +830617,10 @@ function buildPreviewDomain({ orgId, previewId }) {
|
|
|
830034
830617
|
const availableSpace = SUBDOMAIN_LIMIT - prefix2.length;
|
|
830035
830618
|
const minIdLength = 8;
|
|
830036
830619
|
if (availableSpace < minIdLength) {
|
|
830037
|
-
throw new
|
|
830620
|
+
throw new CliError({
|
|
830621
|
+
message: `Organization name "${orgId}" is too long to generate a valid preview URL`,
|
|
830622
|
+
code: CliError.Code.ValidationError
|
|
830623
|
+
});
|
|
830038
830624
|
}
|
|
830039
830625
|
const truncatedId = sanitizedId.slice(0, availableSpace).replace(/-+$/, "");
|
|
830040
830626
|
return `${prefix2}${truncatedId}.${DOMAIN_SUFFIX}`;
|
|
@@ -831728,7 +832314,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
831728
832314
|
var LOGS_FOLDER_NAME = "logs";
|
|
831729
832315
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
831730
832316
|
function getCliSource() {
|
|
831731
|
-
const version7 = "4.
|
|
832317
|
+
const version7 = "4.82.0-3-gc1f31446d2e";
|
|
831732
832318
|
return `cli@${version7}`;
|
|
831733
832319
|
}
|
|
831734
832320
|
var DebugLogger = class {
|
|
@@ -832236,7 +832822,10 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
832236
832822
|
try {
|
|
832237
832823
|
const docsBundleZipResponse = await fetch(docsBundleUrl);
|
|
832238
832824
|
if (!docsBundleZipResponse.ok) {
|
|
832239
|
-
throw new
|
|
832825
|
+
throw new CliError({
|
|
832826
|
+
message: `Failed to download docs preview bundle. Status code: ${docsBundleZipResponse.status}`,
|
|
832827
|
+
code: CliError.Code.NetworkError
|
|
832828
|
+
});
|
|
832240
832829
|
}
|
|
832241
832830
|
const outputZipPath = join8(absoluteDirectoryToTmpDir, RelativeFilePath2.of(tryTar ? "output.tar.gz" : "output.zip"));
|
|
832242
832831
|
if (docsBundleZipResponse.body == null) {
|
|
@@ -832377,7 +832966,10 @@ async function downloadBundle({ bucketUrl, logger: logger4, preferCached, app =
|
|
|
832377
832966
|
doNotPipeOutput: true
|
|
832378
832967
|
});
|
|
832379
832968
|
} catch (error50) {
|
|
832380
|
-
throw new
|
|
832969
|
+
throw new CliError({
|
|
832970
|
+
message: "Requires [pnpm] to run local development. Please run: npm install -g pnpm, and then: fern docs dev",
|
|
832971
|
+
code: CliError.Code.EnvironmentError
|
|
832972
|
+
});
|
|
832381
832973
|
}
|
|
832382
832974
|
try {
|
|
832383
832975
|
logger4.debug("Installing esbuild");
|
|
@@ -832676,7 +833268,7 @@ async function getPreviewDocsDefinition({ domain: domain3, project, context: con
|
|
|
832676
833268
|
const docsWorkspace = project.docsWorkspaces;
|
|
832677
833269
|
const apiWorkspaces = project.apiWorkspaces;
|
|
832678
833270
|
if (docsWorkspace == null) {
|
|
832679
|
-
throw new
|
|
833271
|
+
throw new CliError({ message: "No docs workspace found in project", code: CliError.Code.ConfigError });
|
|
832680
833272
|
}
|
|
832681
833273
|
if (editedAbsoluteFilepaths != null && previousDocsDefinition != null) {
|
|
832682
833274
|
const allMarkdownFiles = editedAbsoluteFilepaths.every((filepath) => filepath.endsWith(".mdx") || filepath.endsWith(".md"));
|
|
@@ -833247,7 +833839,10 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
833247
833839
|
try {
|
|
833248
833840
|
const url3 = "https://dev2-local-preview-bundle4.s3.amazonaws.com/";
|
|
833249
833841
|
if (url3 == null) {
|
|
833250
|
-
throw new
|
|
833842
|
+
throw new CliError({
|
|
833843
|
+
message: "Failed to connect to the docs preview server. Please contact support@buildwithfern.com",
|
|
833844
|
+
code: CliError.Code.InternalError
|
|
833845
|
+
});
|
|
833251
833846
|
}
|
|
833252
833847
|
await downloadBundle({
|
|
833253
833848
|
bucketUrl: url3,
|
|
@@ -833265,7 +833860,10 @@ async function runAppPreviewServer({ initialProject, reloadProject, validateProj
|
|
|
833265
833860
|
try {
|
|
833266
833861
|
const url3 = "https://dev2-local-preview-bundle3.s3.amazonaws.com/";
|
|
833267
833862
|
if (url3 == null) {
|
|
833268
|
-
throw new
|
|
833863
|
+
throw new CliError({
|
|
833864
|
+
message: "Failed to connect to the docs preview server. Please contact support@buildwithfern.com",
|
|
833865
|
+
code: CliError.Code.InternalError
|
|
833866
|
+
});
|
|
833269
833867
|
}
|
|
833270
833868
|
await downloadBundle({
|
|
833271
833869
|
bucketUrl: url3,
|
|
@@ -833735,7 +834333,10 @@ async function runPreviewServer({ initialProject, reloadProject, validateProject
|
|
|
833735
834333
|
try {
|
|
833736
834334
|
const url3 = "https://dev2-local-preview-bundle2.s3.amazonaws.com/";
|
|
833737
834335
|
if (url3 == null) {
|
|
833738
|
-
throw new
|
|
834336
|
+
throw new CliError({
|
|
834337
|
+
message: "Failed to connect to the docs preview server. Please contact support@buildwithfern.com",
|
|
834338
|
+
code: CliError.Code.InternalError
|
|
834339
|
+
});
|
|
833739
834340
|
}
|
|
833740
834341
|
await downloadBundle({ bucketUrl: url3, logger: context3.logger, preferCached: true, tryTar: false });
|
|
833741
834342
|
} catch (err) {
|
|
@@ -834417,7 +835018,16 @@ function createGeneratorsYmlAstVisitorForRules({ relativeFilepath, contents, all
|
|
|
834417
835018
|
|
|
834418
835019
|
// ../yaml/generators-validator/lib/rules/compatible-ir-versions/compatible-ir-versions.js
|
|
834419
835020
|
function getMaybeBadVersionMessage(generatorName, minCliVersion, cliVersion) {
|
|
834420
|
-
|
|
835021
|
+
let isAhead;
|
|
835022
|
+
try {
|
|
835023
|
+
isAhead = isVersionAhead(cliVersion, minCliVersion);
|
|
835024
|
+
} catch (error50) {
|
|
835025
|
+
throw new CliError({
|
|
835026
|
+
message: `Failed to compare versions: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
835027
|
+
code: CliError.Code.VersionError
|
|
835028
|
+
});
|
|
835029
|
+
}
|
|
835030
|
+
if (!isAhead) {
|
|
834421
835031
|
return [
|
|
834422
835032
|
{
|
|
834423
835033
|
severity: "fatal",
|
|
@@ -834552,7 +835162,7 @@ async function validateGeneratorsYmlFile({ contents, allRuleVisitors, cliVersion
|
|
|
834552
835162
|
var import_validate_npm_package_name = __toESM(require_lib18(), 1);
|
|
834553
835163
|
async function collectAPIWorkspaceViolations({ workspace, context: context3, ossWorkspace }) {
|
|
834554
835164
|
if (!(0, import_validate_npm_package_name.default)(workspace.definition.rootApiFile.contents.name).validForNewPackages) {
|
|
834555
|
-
context3.failAndThrow("API name is not valid.");
|
|
835165
|
+
context3.failAndThrow("API name is not valid.", void 0, { code: CliError.Code.ValidationError });
|
|
834556
835166
|
}
|
|
834557
835167
|
const startTime = performance.now();
|
|
834558
835168
|
const apiViolations = validateFernWorkspace(workspace, context3.logger);
|
|
@@ -834590,7 +835200,7 @@ async function validateAPIWorkspaceWithoutExiting({ workspace, context: context3
|
|
|
834590
835200
|
}
|
|
834591
835201
|
async function validateAPIWorkspaceAndLogIssues({ workspace, context: context3, logWarnings, ossWorkspace }) {
|
|
834592
835202
|
if (!(0, import_validate_npm_package_name.default)(workspace.definition.rootApiFile.contents.name).validForNewPackages) {
|
|
834593
|
-
context3.failAndThrow("API name is not valid.");
|
|
835203
|
+
context3.failAndThrow("API name is not valid.", void 0, { code: CliError.Code.ValidationError });
|
|
834594
835204
|
}
|
|
834595
835205
|
const { hasErrors } = await validateAPIWorkspaceWithoutExiting({
|
|
834596
835206
|
workspace,
|
|
@@ -834599,7 +835209,7 @@ async function validateAPIWorkspaceAndLogIssues({ workspace, context: context3,
|
|
|
834599
835209
|
ossWorkspace
|
|
834600
835210
|
});
|
|
834601
835211
|
if (hasErrors) {
|
|
834602
|
-
context3.failAndThrow();
|
|
835212
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ValidationError });
|
|
834603
835213
|
}
|
|
834604
835214
|
}
|
|
834605
835215
|
|
|
@@ -841028,11 +841638,17 @@ async function loadRawDocsConfiguration({ absolutePathOfConfiguration, context:
|
|
|
841028
841638
|
} catch (err) {
|
|
841029
841639
|
context3.logger.error(`Parsing failed even after sanitization: ${extractErrorMessage(err)}`);
|
|
841030
841640
|
context3.logger.debug(`Sanitized JSON structure: ${JSON.stringify(sanitizedJson, null, 2)}`);
|
|
841031
|
-
throw new
|
|
841641
|
+
throw new CliError({
|
|
841642
|
+
message: `Failed to parse ${absolutePathOfConfiguration}: ${extractErrorMessage(err)}`,
|
|
841643
|
+
code: CliError.Code.ParseError
|
|
841644
|
+
});
|
|
841032
841645
|
}
|
|
841033
841646
|
} else {
|
|
841034
|
-
throw new
|
|
841035
|
-
|
|
841647
|
+
throw new CliError({
|
|
841648
|
+
message: `Failed to parse docs.yml:
|
|
841649
|
+
${result.error?.message ?? "Unknown error"}`,
|
|
841650
|
+
code: CliError.Code.ParseError
|
|
841651
|
+
});
|
|
841036
841652
|
}
|
|
841037
841653
|
}
|
|
841038
841654
|
|
|
@@ -841126,7 +841742,10 @@ async function retryWithRateLimit({ fn: fn10, retryRateLimited, logger: logger4,
|
|
|
841126
841742
|
}
|
|
841127
841743
|
}
|
|
841128
841744
|
}
|
|
841129
|
-
throw new
|
|
841745
|
+
throw new CliError({
|
|
841746
|
+
message: "Exceeded maximum retries for 429 Too Many Requests.",
|
|
841747
|
+
code: CliError.Code.InternalError
|
|
841748
|
+
});
|
|
841130
841749
|
}
|
|
841131
841750
|
|
|
841132
841751
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
@@ -841139,7 +841758,9 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
841139
841758
|
try {
|
|
841140
841759
|
fernignoreContents = await (0, import_promises86.readFile)(fernignorePath, "utf-8");
|
|
841141
841760
|
} catch (error50) {
|
|
841142
|
-
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}
|
|
841761
|
+
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`, void 0, {
|
|
841762
|
+
code: CliError.Code.ConfigError
|
|
841763
|
+
});
|
|
841143
841764
|
}
|
|
841144
841765
|
}
|
|
841145
841766
|
const job = await retryWithRateLimit({
|
|
@@ -841162,7 +841783,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
841162
841783
|
}),
|
|
841163
841784
|
retryRateLimited,
|
|
841164
841785
|
logger: context3.logger,
|
|
841165
|
-
onRateLimitedWithoutRetry: () => context3.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.")
|
|
841786
|
+
onRateLimitedWithoutRetry: () => context3.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.", void 0, { code: CliError.Code.NetworkError })
|
|
841166
841787
|
});
|
|
841167
841788
|
await startJob({ intermediateRepresentation, job, context: context3, generatorInvocation, irVersionOverride });
|
|
841168
841789
|
return job;
|
|
@@ -841212,33 +841833,35 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
841212
841833
|
}
|
|
841213
841834
|
return convertCreateJobError(rawError)._visit({
|
|
841214
841835
|
illegalApiNameError: () => {
|
|
841215
|
-
return context3.failAndThrow("API name is invalid: " + workspace.definition.rootApiFile.contents.name);
|
|
841836
|
+
return context3.failAndThrow("API name is invalid: " + workspace.definition.rootApiFile.contents.name, void 0, { code: CliError.Code.ConfigError });
|
|
841216
841837
|
},
|
|
841217
841838
|
illegalApiVersionError: () => {
|
|
841218
|
-
return context3.failAndThrow("API version is invalid: " + version7
|
|
841839
|
+
return context3.failAndThrow("API version is invalid: " + version7, void 0, {
|
|
841840
|
+
code: CliError.Code.ConfigError
|
|
841841
|
+
});
|
|
841219
841842
|
},
|
|
841220
841843
|
cannotPublishToNpmScope: ({ validScope, invalidScope }) => {
|
|
841221
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidScope} (expected ${validScope})
|
|
841844
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidScope} (expected ${validScope})`, void 0, { code: CliError.Code.AuthError });
|
|
841222
841845
|
},
|
|
841223
841846
|
cannotPublishToMavenGroup: ({ validGroup, invalidGroup }) => {
|
|
841224
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidGroup} (expected ${validGroup})
|
|
841847
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidGroup} (expected ${validGroup})`, void 0, { code: CliError.Code.AuthError });
|
|
841225
841848
|
},
|
|
841226
841849
|
cannotPublishPypiPackage: ({ validPrefix, invalidPackageName }) => {
|
|
841227
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidPackageName} (expected ${validPrefix})
|
|
841850
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidPackageName} (expected ${validPrefix})`, void 0, { code: CliError.Code.AuthError });
|
|
841228
841851
|
},
|
|
841229
841852
|
generatorsDoNotExistError: (value2) => {
|
|
841230
|
-
return context3.failAndThrow("Generators do not exist: " + value2.nonExistentGenerators.map((generator) => `${generator.id}@${generator.version}`).join(", "));
|
|
841853
|
+
return context3.failAndThrow("Generators do not exist: " + value2.nonExistentGenerators.map((generator) => `${generator.id}@${generator.version}`).join(", "), void 0, { code: CliError.Code.ConfigError });
|
|
841231
841854
|
},
|
|
841232
841855
|
insufficientPermissions: () => {
|
|
841233
841856
|
return context3.failAndThrow(`You do not have permission to run this generator for organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
841234
841857
|
|
|
841235
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not
|
|
841858
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`, void 0, { code: CliError.Code.AuthError });
|
|
841236
841859
|
},
|
|
841237
841860
|
orgNotConfiguredForWhitelabel: () => {
|
|
841238
|
-
return context3.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com.");
|
|
841861
|
+
return context3.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com.", void 0, { code: CliError.Code.AuthError });
|
|
841239
841862
|
},
|
|
841240
841863
|
branchDoesNotExist: (value2) => {
|
|
841241
|
-
return context3.failAndThrow(`Branch ${value2.branch} does not exist in repository ${value2.repositoryOwner}/${value2.repositoryName}
|
|
841864
|
+
return context3.failAndThrow(`Branch ${value2.branch} does not exist in repository ${value2.repositoryOwner}/${value2.repositoryName}`, void 0, { code: CliError.Code.ConfigError });
|
|
841242
841865
|
},
|
|
841243
841866
|
rateLimitExceeded: () => {
|
|
841244
841867
|
throw new TooManyRequestsError();
|
|
@@ -841247,9 +841870,9 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
|
|
|
841247
841870
|
context3.logger.debug(`Failed to create job: ${JSON.stringify(content5)}`);
|
|
841248
841871
|
const errorMessage = extractErrorMessage2(content5);
|
|
841249
841872
|
if (errorMessage != null) {
|
|
841250
|
-
return context3.failAndThrow(errorMessage);
|
|
841873
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.NetworkError });
|
|
841251
841874
|
}
|
|
841252
|
-
return context3.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.");
|
|
841875
|
+
return context3.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.", void 0, { code: CliError.Code.NetworkError });
|
|
841253
841876
|
}
|
|
841254
841877
|
});
|
|
841255
841878
|
}
|
|
@@ -841294,7 +841917,7 @@ async function startJob({ intermediateRepresentation, generatorInvocation, job,
|
|
|
841294
841917
|
} catch (error50) {
|
|
841295
841918
|
const errorBody = error50 instanceof AxiosError2 ? error50.response?.data : error50;
|
|
841296
841919
|
context3.logger.debug(`POST ${url3} failed with ${JSON.stringify(error50)}`);
|
|
841297
|
-
context3.failAndThrow("Failed to start job", errorBody);
|
|
841920
|
+
context3.failAndThrow("Failed to start job", errorBody, { code: CliError.Code.NetworkError });
|
|
841298
841921
|
}
|
|
841299
841922
|
}
|
|
841300
841923
|
function extractErrorMessage2(error50) {
|
|
@@ -841361,7 +841984,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context3 })
|
|
|
841361
841984
|
if (taskStatus == null) {
|
|
841362
841985
|
numConsecutiveFailed++;
|
|
841363
841986
|
if (numConsecutiveFailed === MAX_UNSUCCESSFUL_ATTEMPTS) {
|
|
841364
|
-
context3.failAndThrow(`Failed to get job status after ${numConsecutiveFailed} attempts
|
|
841987
|
+
context3.failAndThrow(`Failed to get job status after ${numConsecutiveFailed} attempts.`, void 0, {
|
|
841988
|
+
code: CliError.Code.NetworkError
|
|
841989
|
+
});
|
|
841365
841990
|
}
|
|
841366
841991
|
setTimeout(pollForStatus, 2e3 + 1e3 * numConsecutiveFailed);
|
|
841367
841992
|
} else {
|
|
@@ -841418,7 +842043,9 @@ var RemoteTaskHandler = class {
|
|
|
841418
842043
|
}
|
|
841419
842044
|
async processUpdate(remoteTask2) {
|
|
841420
842045
|
if (remoteTask2 == null) {
|
|
841421
|
-
this.context.failAndThrow("Task is missing on job status"
|
|
842046
|
+
this.context.failAndThrow("Task is missing on job status", void 0, {
|
|
842047
|
+
code: CliError.Code.InternalError
|
|
842048
|
+
});
|
|
841422
842049
|
}
|
|
841423
842050
|
const coordinates = remoteTask2.packages.map((p9) => {
|
|
841424
842051
|
return p9.coordinate._visit({
|
|
@@ -841469,7 +842096,7 @@ var RemoteTaskHandler = class {
|
|
|
841469
842096
|
if (s3PreSignedReadUrl != null) {
|
|
841470
842097
|
logS3Url(s3PreSignedReadUrl);
|
|
841471
842098
|
}
|
|
841472
|
-
this.context.failAndThrow(message);
|
|
842099
|
+
this.context.failAndThrow(message, void 0, { code: CliError.Code.ContainerError });
|
|
841473
842100
|
},
|
|
841474
842101
|
finished: async (finishedStatus) => {
|
|
841475
842102
|
if (finishedStatus.s3PreSignedReadUrlV2 != null) {
|
|
@@ -841546,7 +842173,7 @@ async function downloadFilesForTask({ s3PreSignedReadUrl, absolutePathToLocalOut
|
|
|
841546
842173
|
}
|
|
841547
842174
|
context3.logger.info(source_default.green(`Downloaded to ${absolutePathToLocalOutput}`));
|
|
841548
842175
|
} catch (e5) {
|
|
841549
|
-
context3.failAndThrow("Failed to download files", e5);
|
|
842176
|
+
context3.failAndThrow("Failed to download files", e5, { code: CliError.Code.NetworkError });
|
|
841550
842177
|
}
|
|
841551
842178
|
}
|
|
841552
842179
|
async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutput }) {
|
|
@@ -841723,7 +842350,7 @@ var SourceUploader = class {
|
|
|
841723
842350
|
});
|
|
841724
842351
|
await uploadCommand.cleanup();
|
|
841725
842352
|
if (!response.ok) {
|
|
841726
|
-
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}
|
|
842353
|
+
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}`, void 0, { code: CliError.Code.NetworkError });
|
|
841727
842354
|
}
|
|
841728
842355
|
}
|
|
841729
842356
|
async getUploadCommand(source2) {
|
|
@@ -841778,7 +842405,7 @@ var SourceUploader = class {
|
|
|
841778
842405
|
getSourceOrThrow(id) {
|
|
841779
842406
|
const source2 = this.sources[id];
|
|
841780
842407
|
if (source2 == null) {
|
|
841781
|
-
this.context.failAndThrow(`Internal error; server responded with source id "${id}" which does not exist in the workspace
|
|
842408
|
+
this.context.failAndThrow(`Internal error; server responded with source id "${id}" which does not exist in the workspace.`, void 0, { code: CliError.Code.InternalError });
|
|
841782
842409
|
}
|
|
841783
842410
|
return source2;
|
|
841784
842411
|
}
|
|
@@ -841794,7 +842421,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841794
842421
|
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
|
|
841795
842422
|
onError: (e5) => {
|
|
841796
842423
|
if (!isPreview && requireEnvVars) {
|
|
841797
|
-
interactiveTaskContext.failAndThrow(e5
|
|
842424
|
+
interactiveTaskContext.failAndThrow(void 0, e5, {
|
|
842425
|
+
code: CliError.Code.EnvironmentError
|
|
842426
|
+
});
|
|
841798
842427
|
}
|
|
841799
842428
|
}
|
|
841800
842429
|
}, { substituteAsEmpty: isPreview });
|
|
@@ -841894,7 +842523,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841894
842523
|
}
|
|
841895
842524
|
const sourceUploader = new SourceUploader(interactiveTaskContext, sources);
|
|
841896
842525
|
if (sourceUploads == null && sourceUploader.sourceTypes.has("protobuf")) {
|
|
841897
|
-
interactiveTaskContext.failAndThrow("Did not successfully upload Protobuf source files."
|
|
842526
|
+
interactiveTaskContext.failAndThrow("Did not successfully upload Protobuf source files.", void 0, {
|
|
842527
|
+
code: CliError.Code.NetworkError
|
|
842528
|
+
});
|
|
841898
842529
|
}
|
|
841899
842530
|
if (sourceUploads != null) {
|
|
841900
842531
|
interactiveTaskContext.logger.debug("Uploading source files ...");
|
|
@@ -841905,15 +842536,21 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841905
842536
|
if (dynamicIrOnly) {
|
|
841906
842537
|
interactiveTaskContext.logger.info("Dynamic IR only mode: skipping SDK generation and uploading dynamic IR only");
|
|
841907
842538
|
if (version7 == null) {
|
|
841908
|
-
interactiveTaskContext.failAndThrow("Version is required for dynamic IR only mode"
|
|
842539
|
+
interactiveTaskContext.failAndThrow("Version is required for dynamic IR only mode", void 0, {
|
|
842540
|
+
code: CliError.Code.ConfigError
|
|
842541
|
+
});
|
|
841909
842542
|
return void 0;
|
|
841910
842543
|
}
|
|
841911
842544
|
if (generatorInvocation.language == null) {
|
|
841912
|
-
interactiveTaskContext.failAndThrow("Language is required for dynamic IR only mode"
|
|
842545
|
+
interactiveTaskContext.failAndThrow("Language is required for dynamic IR only mode", void 0, {
|
|
842546
|
+
code: CliError.Code.ConfigError
|
|
842547
|
+
});
|
|
841913
842548
|
return void 0;
|
|
841914
842549
|
}
|
|
841915
842550
|
if (packageName == null) {
|
|
841916
|
-
interactiveTaskContext.failAndThrow("Package name is required for dynamic IR only mode"
|
|
842551
|
+
interactiveTaskContext.failAndThrow("Package name is required for dynamic IR only mode", void 0, {
|
|
842552
|
+
code: CliError.Code.ConfigError
|
|
842553
|
+
});
|
|
841917
842554
|
return void 0;
|
|
841918
842555
|
}
|
|
841919
842556
|
try {
|
|
@@ -841929,7 +842566,7 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841929
842566
|
context: interactiveTaskContext
|
|
841930
842567
|
});
|
|
841931
842568
|
} catch (error50) {
|
|
841932
|
-
interactiveTaskContext.failAndThrow(`Failed to upload dynamic IR: ${extractErrorMessage(error50)}
|
|
842569
|
+
interactiveTaskContext.failAndThrow(`Failed to upload dynamic IR: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
|
|
841933
842570
|
}
|
|
841934
842571
|
return {
|
|
841935
842572
|
createdSnippets: false,
|
|
@@ -841965,7 +842602,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841965
842602
|
interactiveTaskContext.logger.debug(`Job ID: ${job.jobId}`);
|
|
841966
842603
|
const taskId = job.taskIds[0];
|
|
841967
842604
|
if (taskId == null) {
|
|
841968
|
-
interactiveTaskContext.failAndThrow("Did not receive a task ID."
|
|
842605
|
+
interactiveTaskContext.failAndThrow("Did not receive a task ID.", void 0, {
|
|
842606
|
+
code: CliError.Code.NetworkError
|
|
842607
|
+
});
|
|
841969
842608
|
return void 0;
|
|
841970
842609
|
}
|
|
841971
842610
|
interactiveTaskContext.logger.debug(`Task ID: ${taskId}`);
|
|
@@ -842131,7 +842770,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
842131
842770
|
onSnippetsProduced: (invocation) => snippetsProducedBy.push(invocation)
|
|
842132
842771
|
}))));
|
|
842133
842772
|
if (automation == null && results.some((didSucceed) => !didSucceed)) {
|
|
842134
|
-
|
|
842773
|
+
throw new TaskAbortSignal();
|
|
842135
842774
|
}
|
|
842136
842775
|
return {
|
|
842137
842776
|
snippetsProducedBy
|
|
@@ -842570,9 +843209,9 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain3
|
|
|
842570
843209
|
context3.logger.error(`FDR registerApiDefinition failed. Error details:
|
|
842571
843210
|
${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
842572
843211
|
if (apiName != null) {
|
|
842573
|
-
return context3.failAndThrow(`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact support@buildwithfern.com`, errorDetails);
|
|
843212
|
+
return context3.failAndThrow(`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact support@buildwithfern.com`, errorDetails, { code: CliError.Code.NetworkError });
|
|
842574
843213
|
} else {
|
|
842575
|
-
return context3.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com`, errorDetails);
|
|
843214
|
+
return context3.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com`, errorDetails, { code: CliError.Code.NetworkError });
|
|
842576
843215
|
}
|
|
842577
843216
|
}
|
|
842578
843217
|
context3.logger.debug(`Registered API Definition ${apiName}: ${response.apiDefinitionId}`);
|
|
@@ -842599,7 +843238,7 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842599
843238
|
if (docsWorkspace.config.settings?.substituteEnvVars) {
|
|
842600
843239
|
context3.logger.debug("Applying environment variable substitution to docs definition...");
|
|
842601
843240
|
const { jsFiles, ...docsWithoutJsFiles } = docsDefinition;
|
|
842602
|
-
const substitutedDocs = replaceEnvVariables(docsWithoutJsFiles, { onError: (e5) => context3.failAndThrow(e5) }, { substituteAsEmpty: false });
|
|
843241
|
+
const substitutedDocs = replaceEnvVariables(docsWithoutJsFiles, { onError: (e5) => context3.failAndThrow(void 0, e5, { code: CliError.Code.EnvironmentError }) }, { substituteAsEmpty: false });
|
|
842603
843242
|
docsDefinition = { ...substitutedDocs, jsFiles };
|
|
842604
843243
|
}
|
|
842605
843244
|
const pageCount = Object.keys(docsDefinition.pages).length;
|
|
@@ -842609,7 +843248,9 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842609
843248
|
context3.logger.debug(`Memory after resolve: RSS=${(resolveMemory.rss / 1024 / 1024).toFixed(2)}MB, Heap=${(resolveMemory.heapUsed / 1024 / 1024).toFixed(2)}MB`);
|
|
842610
843249
|
if (docsRegistrationId == null) {
|
|
842611
843250
|
doUnlock();
|
|
842612
|
-
return context3.failAndThrow("Failed to publish docs.", "Docs registration ID is missing."
|
|
843251
|
+
return context3.failAndThrow("Failed to publish docs.", "Docs registration ID is missing.", {
|
|
843252
|
+
code: CliError.Code.InternalError
|
|
843253
|
+
});
|
|
842613
843254
|
}
|
|
842614
843255
|
context3.logger.info("Publishing docs to FDR...");
|
|
842615
843256
|
const publishStart = performance.now();
|
|
@@ -842621,7 +843262,9 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842621
843262
|
...isBasepathAware && !preview && { basepathAware: true }
|
|
842622
843263
|
});
|
|
842623
843264
|
} catch (error50) {
|
|
842624
|
-
return context3.failAndThrow("Failed to publish docs to " + domain3, error50
|
|
843265
|
+
return context3.failAndThrow("Failed to publish docs to " + domain3, error50, {
|
|
843266
|
+
code: CliError.Code.NetworkError
|
|
843267
|
+
});
|
|
842625
843268
|
}
|
|
842626
843269
|
const publishTime = performance.now() - publishStart;
|
|
842627
843270
|
context3.logger.debug(`Docs published to FDR in ${publishTime.toFixed(0)}ms`);
|
|
@@ -842681,7 +843324,9 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
842681
843324
|
}
|
|
842682
843325
|
});
|
|
842683
843326
|
} catch (e5) {
|
|
842684
|
-
context3.failAndThrow(`Failed to upload ${absoluteFilePath}`, e5
|
|
843327
|
+
context3.failAndThrow(`Failed to upload ${absoluteFilePath}`, e5, {
|
|
843328
|
+
code: CliError.Code.NetworkError
|
|
843329
|
+
});
|
|
842685
843330
|
}
|
|
842686
843331
|
}));
|
|
842687
843332
|
const endTime2 = Date.now();
|
|
@@ -842721,24 +843366,26 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842721
843366
|
}
|
|
842722
843367
|
const authErrorMessage = getAuthenticationErrorMessage(error50, organization, domain3);
|
|
842723
843368
|
if (authErrorMessage != null) {
|
|
842724
|
-
return context3.failAndThrow(authErrorMessage);
|
|
843369
|
+
return context3.failAndThrow(authErrorMessage, void 0, { code: CliError.Code.AuthError });
|
|
842725
843370
|
}
|
|
842726
843371
|
const errorType = errorObj?.error;
|
|
842727
843372
|
switch (errorType) {
|
|
842728
843373
|
case "InvalidCustomDomainError":
|
|
842729
|
-
return context3.failAndThrow(`Your docs domain should end with ${"docs.dev.buildwithfern.com"}
|
|
843374
|
+
return context3.failAndThrow(`Your docs domain should end with ${"docs.dev.buildwithfern.com"}`, void 0, { code: CliError.Code.ConfigError });
|
|
842730
843375
|
case "InvalidDomainError":
|
|
842731
|
-
return context3.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)");
|
|
843376
|
+
return context3.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)", void 0, { code: CliError.Code.ConfigError });
|
|
842732
843377
|
case "UnauthorizedError":
|
|
842733
|
-
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent)
|
|
843378
|
+
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent), void 0, {
|
|
843379
|
+
code: CliError.Code.AuthError
|
|
843380
|
+
});
|
|
842734
843381
|
case "UserNotInOrgError":
|
|
842735
843382
|
return context3.failAndThrow(`You do not belong to organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
842736
843383
|
|
|
842737
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not
|
|
843384
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`, void 0, { code: CliError.Code.AuthError });
|
|
842738
843385
|
case "UnavailableError":
|
|
842739
|
-
return context3.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.");
|
|
843386
|
+
return context3.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.", void 0, { code: CliError.Code.NetworkError });
|
|
842740
843387
|
default:
|
|
842741
|
-
return context3.failAndThrow("Failed to publish docs.", error50);
|
|
843388
|
+
return context3.failAndThrow("Failed to publish docs.", error50, { code: CliError.Code.NetworkError });
|
|
842742
843389
|
}
|
|
842743
843390
|
}
|
|
842744
843391
|
function getAuthenticationErrorMessage(error50, organization, domain3) {
|
|
@@ -843186,21 +843833,25 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
843186
843833
|
docsWorkspace.config = replaceEnvVariables(
|
|
843187
843834
|
docsWorkspace.config,
|
|
843188
843835
|
// Wrap in a closure for correct binding of `this` downstream
|
|
843189
|
-
{ onError: (e5) => context3.failAndThrow(e5) },
|
|
843836
|
+
{ onError: (e5) => context3.failAndThrow(void 0, e5, { code: CliError.Code.EnvironmentError }) },
|
|
843190
843837
|
{ substituteAsEmpty: shouldSubstituteAsEmpty }
|
|
843191
843838
|
);
|
|
843192
843839
|
const instances2 = docsWorkspace.config.instances;
|
|
843193
843840
|
if (instances2.length === 0) {
|
|
843194
|
-
context3.failAndThrow("No instances specified in docs.yml! Cannot register docs."
|
|
843841
|
+
context3.failAndThrow("No instances specified in docs.yml! Cannot register docs.", void 0, {
|
|
843842
|
+
code: CliError.Code.ConfigError
|
|
843843
|
+
});
|
|
843195
843844
|
return;
|
|
843196
843845
|
}
|
|
843197
843846
|
if (instances2.length > 1 && instanceUrl == null) {
|
|
843198
|
-
context3.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${instances2[0]?.url})
|
|
843847
|
+
context3.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${instances2[0]?.url})`, void 0, { code: CliError.Code.ConfigError });
|
|
843199
843848
|
return;
|
|
843200
843849
|
}
|
|
843201
843850
|
const maybeInstance = instances2.find((instance) => instance.url === instanceUrl) ?? instances2[0];
|
|
843202
843851
|
if (maybeInstance == null) {
|
|
843203
|
-
context3.failAndThrow(`No docs instance with url ${instanceUrl}. Failed to register
|
|
843852
|
+
context3.failAndThrow(`No docs instance with url ${instanceUrl}. Failed to register.`, void 0, {
|
|
843853
|
+
code: CliError.Code.ConfigError
|
|
843854
|
+
});
|
|
843204
843855
|
return;
|
|
843205
843856
|
}
|
|
843206
843857
|
const customDomains = [];
|
|
@@ -843245,7 +843896,7 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
843245
843896
|
} catch (error50) {
|
|
843246
843897
|
if (!(error50 instanceof DocsPublishConflictError) || attempt >= PUBLISH_CONFLICT_RETRY_DELAYS_MS.length) {
|
|
843247
843898
|
if (error50 instanceof DocsPublishConflictError) {
|
|
843248
|
-
return context3.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");
|
|
843899
|
+
return context3.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.", void 0, { code: CliError.Code.NetworkError });
|
|
843249
843900
|
}
|
|
843250
843901
|
throw error50;
|
|
843251
843902
|
}
|
|
@@ -843295,7 +843946,7 @@ var LegacyDocsPublisher = class {
|
|
|
843295
843946
|
previewId,
|
|
843296
843947
|
disableTemplates: void 0,
|
|
843297
843948
|
skipUpload,
|
|
843298
|
-
cliVersion: "4.
|
|
843949
|
+
cliVersion: "4.82.0-3-gc1f31446d2e"
|
|
843299
843950
|
});
|
|
843300
843951
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843301
843952
|
return { success: false };
|
|
@@ -843770,7 +844421,10 @@ var DocsTask = class {
|
|
|
843770
844421
|
getTask() {
|
|
843771
844422
|
const task = this.taskGroup.getTask(this.id);
|
|
843772
844423
|
if (task == null) {
|
|
843773
|
-
throw new
|
|
844424
|
+
throw new CliError({
|
|
844425
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
844426
|
+
code: CliError.Code.InternalError
|
|
844427
|
+
});
|
|
843774
844428
|
}
|
|
843775
844429
|
return task;
|
|
843776
844430
|
}
|
|
@@ -845042,7 +845696,10 @@ var Wizard = class {
|
|
|
845042
845696
|
async fetchApiFromUrl(url3, specFormat) {
|
|
845043
845697
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
845044
845698
|
if (!response.ok) {
|
|
845045
|
-
throw new
|
|
845699
|
+
throw new CliError({
|
|
845700
|
+
message: `HTTP ${response.status} ${response.statusText}`,
|
|
845701
|
+
code: CliError.Code.NetworkError
|
|
845702
|
+
});
|
|
845046
845703
|
}
|
|
845047
845704
|
const content5 = await response.text();
|
|
845048
845705
|
const filename = this.resolveFilenameFromUrl({ url: url3, specFormat });
|
|
@@ -846572,20 +847229,29 @@ var ApiSpecDetector = class {
|
|
|
846572
847229
|
async detect({ absoluteFilePath, reference: reference4, content: content5 }) {
|
|
846573
847230
|
const parsed = this.parseOrThrow({ content: content5, reference: reference4 });
|
|
846574
847231
|
if (typeof parsed !== "object" || parsed == null) {
|
|
846575
|
-
throw new
|
|
847232
|
+
throw new CliError({
|
|
847233
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
847234
|
+
code: CliError.Code.InternalError
|
|
847235
|
+
});
|
|
846576
847236
|
}
|
|
846577
847237
|
for (const specType of DETECTABLE_SPEC_TYPES) {
|
|
846578
847238
|
if (specType in parsed) {
|
|
846579
847239
|
return specType;
|
|
846580
847240
|
}
|
|
846581
847241
|
}
|
|
846582
|
-
throw new
|
|
847242
|
+
throw new CliError({
|
|
847243
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
847244
|
+
code: CliError.Code.InternalError
|
|
847245
|
+
});
|
|
846583
847246
|
}
|
|
846584
847247
|
parseOrThrow({ content: content5, reference: reference4 }) {
|
|
846585
847248
|
try {
|
|
846586
847249
|
return jsYaml.load(content5);
|
|
846587
847250
|
} catch {
|
|
846588
|
-
throw new
|
|
847251
|
+
throw new CliError({
|
|
847252
|
+
message: `Could not parse "${reference4}" as YAML or JSON. Ensure the file is a valid OpenAPI or AsyncAPI specification.`,
|
|
847253
|
+
code: CliError.Code.ParseError
|
|
847254
|
+
});
|
|
846589
847255
|
}
|
|
846590
847256
|
}
|
|
846591
847257
|
};
|
|
@@ -846623,7 +847289,10 @@ var ApiSpecResolver = class {
|
|
|
846623
847289
|
async resolveLocal({ reference: reference4 }) {
|
|
846624
847290
|
const absoluteFilePath = resolve6(this.context.cwd, reference4);
|
|
846625
847291
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
846626
|
-
throw new
|
|
847292
|
+
throw new CliError({
|
|
847293
|
+
message: `API spec file does not exist: ${reference4}`,
|
|
847294
|
+
code: CliError.Code.ConfigError
|
|
847295
|
+
});
|
|
846627
847296
|
}
|
|
846628
847297
|
const content5 = await (0, import_promises92.readFile)(absoluteFilePath, "utf-8");
|
|
846629
847298
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
@@ -846636,11 +847305,17 @@ var ApiSpecResolver = class {
|
|
|
846636
847305
|
async fetchContent({ url: url3 }) {
|
|
846637
847306
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
846638
847307
|
if (!response.ok) {
|
|
846639
|
-
throw new
|
|
847308
|
+
throw new CliError({
|
|
847309
|
+
message: `Failed to fetch "${url3}": HTTP ${response.status} ${response.statusText}`,
|
|
847310
|
+
code: CliError.Code.NetworkError
|
|
847311
|
+
});
|
|
846640
847312
|
}
|
|
846641
847313
|
const contentType = response.headers.get("content-type") ?? "";
|
|
846642
847314
|
if (contentType.includes("text/html")) {
|
|
846643
|
-
throw new
|
|
847315
|
+
throw new CliError({
|
|
847316
|
+
message: `The URL "${url3}" returned HTML content. Ensure you're pointing to a raw spec URL, not a documentation page.`,
|
|
847317
|
+
code: CliError.Code.ConfigError
|
|
847318
|
+
});
|
|
846644
847319
|
}
|
|
846645
847320
|
const content5 = await response.text();
|
|
846646
847321
|
return { content: content5, contentType };
|
|
@@ -846665,7 +847340,10 @@ var ApiSpecResolver = class {
|
|
|
846665
847340
|
case "asyncapi":
|
|
846666
847341
|
return { asyncapi: absoluteFilePath, origin: origin2 };
|
|
846667
847342
|
default:
|
|
846668
|
-
throw new
|
|
847343
|
+
throw new CliError({
|
|
847344
|
+
message: `Unsupported spec type for flags mode: "${specType}". Supported: openapi, asyncapi`,
|
|
847345
|
+
code: CliError.Code.ConfigError
|
|
847346
|
+
});
|
|
846669
847347
|
}
|
|
846670
847348
|
}
|
|
846671
847349
|
isUrl(reference4) {
|
|
@@ -847669,10 +848347,12 @@ var ContainerExecutionEnvironment = class {
|
|
|
847669
848347
|
containerImage;
|
|
847670
848348
|
keepContainer;
|
|
847671
848349
|
runner;
|
|
847672
|
-
|
|
848350
|
+
disableTelemetry;
|
|
848351
|
+
constructor({ containerImage, keepContainer, runner, disableTelemetry, dockerImage, keepDocker }) {
|
|
847673
848352
|
this.containerImage = containerImage ?? dockerImage ?? "";
|
|
847674
848353
|
this.keepContainer = keepContainer ?? keepDocker ?? false;
|
|
847675
848354
|
this.runner = runner;
|
|
848355
|
+
this.disableTelemetry = disableTelemetry ?? false;
|
|
847676
848356
|
}
|
|
847677
848357
|
async execute({ generatorName, irPath, configPath, outputPath, snippetPath, snippetTemplatePath, licenseFilePath, sourceMounts, context: context3, inspect: inspect6, runner }) {
|
|
847678
848358
|
context3.logger.info(`Executing generator ${generatorName} using container image: ${this.containerImage}`);
|
|
@@ -847699,16 +848379,29 @@ var ContainerExecutionEnvironment = class {
|
|
|
847699
848379
|
envVars["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${DEFAULT_NODE_DEBUG_PORT}`;
|
|
847700
848380
|
ports[DEFAULT_NODE_DEBUG_PORT] = DEFAULT_NODE_DEBUG_PORT;
|
|
847701
848381
|
}
|
|
847702
|
-
|
|
847703
|
-
|
|
847704
|
-
|
|
847705
|
-
|
|
847706
|
-
|
|
847707
|
-
|
|
847708
|
-
|
|
847709
|
-
|
|
847710
|
-
|
|
847711
|
-
|
|
848382
|
+
if (this.disableTelemetry) {
|
|
848383
|
+
envVars["FERN_DISABLE_TELEMETRY"] = "true";
|
|
848384
|
+
}
|
|
848385
|
+
try {
|
|
848386
|
+
await runContainer({
|
|
848387
|
+
logger: context3.logger,
|
|
848388
|
+
imageName: this.containerImage,
|
|
848389
|
+
args: [CONTAINER_GENERATOR_CONFIG_PATH],
|
|
848390
|
+
binds,
|
|
848391
|
+
envVars,
|
|
848392
|
+
ports,
|
|
848393
|
+
removeAfterCompletion: !this.keepContainer,
|
|
848394
|
+
runner: this.runner ?? runner
|
|
848395
|
+
});
|
|
848396
|
+
} catch (error50) {
|
|
848397
|
+
if (error50 instanceof CliError) {
|
|
848398
|
+
throw error50;
|
|
848399
|
+
}
|
|
848400
|
+
throw new CliError({
|
|
848401
|
+
message: `Container execution failed: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
848402
|
+
code: CliError.Code.ContainerError
|
|
848403
|
+
});
|
|
848404
|
+
}
|
|
847712
848405
|
}
|
|
847713
848406
|
};
|
|
847714
848407
|
|
|
@@ -873199,7 +873892,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
873199
873892
|
}
|
|
873200
873893
|
}
|
|
873201
873894
|
} catch (e5) {
|
|
873202
|
-
this.context.failAndThrow("Failed to run spotlessApply", e5);
|
|
873895
|
+
this.context.failAndThrow("Failed to run spotlessApply", e5, { code: CliError.Code.InternalError });
|
|
873203
873896
|
}
|
|
873204
873897
|
}
|
|
873205
873898
|
this.context.logger.debug("Done generating dynamic snippet tests");
|
|
@@ -894776,11 +895469,17 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
894776
895469
|
buildGeneratorConfig(config5) {
|
|
894777
895470
|
const outputMode = config5.output.mode;
|
|
894778
895471
|
if (outputMode.type !== "github") {
|
|
894779
|
-
throw new
|
|
895472
|
+
throw new CliError({
|
|
895473
|
+
message: "GitHub output mode is required for TypeScript dynamic snippet tests",
|
|
895474
|
+
code: CliError.Code.ConfigError
|
|
895475
|
+
});
|
|
894780
895476
|
}
|
|
894781
895477
|
const publishInfo = outputMode.publishInfo;
|
|
894782
895478
|
if (!publishInfo || publishInfo.type !== "npm") {
|
|
894783
|
-
throw new
|
|
895479
|
+
throw new CliError({
|
|
895480
|
+
message: "NPM publish info is required for TypeScript dynamic snippet tests",
|
|
895481
|
+
code: CliError.Code.ConfigError
|
|
895482
|
+
});
|
|
894784
895483
|
}
|
|
894785
895484
|
return {
|
|
894786
895485
|
...config5,
|
|
@@ -894834,7 +895533,10 @@ var DynamicSnippetsTestGenerator = class _DynamicSnippetsTestGenerator {
|
|
|
894834
895533
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/generateDynamicSnippetsTestSuite.js
|
|
894835
895534
|
async function generateDynamicSnippetsTestSuite({ ir: ir10, config: config5 }) {
|
|
894836
895535
|
if (ir10.dynamic == null) {
|
|
894837
|
-
throw new
|
|
895536
|
+
throw new CliError({
|
|
895537
|
+
message: "Internal error; dynamic IR is not available",
|
|
895538
|
+
code: CliError.Code.InternalError
|
|
895539
|
+
});
|
|
894838
895540
|
}
|
|
894839
895541
|
return {
|
|
894840
895542
|
ir: ir10.dynamic,
|
|
@@ -895030,7 +895732,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
895030
895732
|
push: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
|
|
895031
895733
|
pullRequest: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
|
|
895032
895734
|
_other: () => {
|
|
895033
|
-
throw new
|
|
895735
|
+
throw new CliError({
|
|
895736
|
+
message: "Encountered unknown github mode",
|
|
895737
|
+
code: CliError.Code.InternalError
|
|
895738
|
+
});
|
|
895034
895739
|
}
|
|
895035
895740
|
});
|
|
895036
895741
|
const outputConfig = {
|
|
@@ -895051,7 +895756,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
895051
895756
|
return outputConfig;
|
|
895052
895757
|
},
|
|
895053
895758
|
_other: () => {
|
|
895054
|
-
throw new
|
|
895759
|
+
throw new CliError({
|
|
895760
|
+
message: "Output type did not match any of the types supported by Fern",
|
|
895761
|
+
code: CliError.Code.InternalError
|
|
895762
|
+
});
|
|
895055
895763
|
}
|
|
895056
895764
|
});
|
|
895057
895765
|
return {
|
|
@@ -895925,7 +896633,10 @@ var LocalTaskHandler = class {
|
|
|
895925
896633
|
return null;
|
|
895926
896634
|
}
|
|
895927
896635
|
if (!this.version) {
|
|
895928
|
-
throw new
|
|
896636
|
+
throw new CliError({
|
|
896637
|
+
message: "Version is required for auto versioning",
|
|
896638
|
+
code: CliError.Code.InternalError
|
|
896639
|
+
});
|
|
895929
896640
|
}
|
|
895930
896641
|
let previousVersion;
|
|
895931
896642
|
try {
|
|
@@ -896113,7 +896824,10 @@ var LocalTaskHandler = class {
|
|
|
896113
896824
|
};
|
|
896114
896825
|
}
|
|
896115
896826
|
this.context.logger.error(`Failed to perform automatic versioning: ${error50}`);
|
|
896116
|
-
throw new
|
|
896827
|
+
throw new CliError({
|
|
896828
|
+
message: `Automatic versioning failed: ${error50}`,
|
|
896829
|
+
code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError
|
|
896830
|
+
});
|
|
896117
896831
|
} finally {
|
|
896118
896832
|
if (diffFile) {
|
|
896119
896833
|
try {
|
|
@@ -896166,7 +896880,7 @@ var LocalTaskHandler = class {
|
|
|
896166
896880
|
incrementVersion(version7, versionBump) {
|
|
896167
896881
|
const cleanVersion = import_semver13.default.clean(version7);
|
|
896168
896882
|
if (!cleanVersion) {
|
|
896169
|
-
throw new
|
|
896883
|
+
throw new CliError({ message: `Invalid version format: ${version7}`, code: CliError.Code.VersionError });
|
|
896170
896884
|
}
|
|
896171
896885
|
let releaseType;
|
|
896172
896886
|
switch (versionBump) {
|
|
@@ -896180,11 +896894,17 @@ var LocalTaskHandler = class {
|
|
|
896180
896894
|
releaseType = "patch";
|
|
896181
896895
|
break;
|
|
896182
896896
|
default:
|
|
896183
|
-
throw new
|
|
896897
|
+
throw new CliError({
|
|
896898
|
+
message: `Unsupported version bump: ${versionBump}`,
|
|
896899
|
+
code: CliError.Code.VersionError
|
|
896900
|
+
});
|
|
896184
896901
|
}
|
|
896185
896902
|
const newVersion = import_semver13.default.inc(cleanVersion, releaseType);
|
|
896186
896903
|
if (!newVersion) {
|
|
896187
|
-
throw new
|
|
896904
|
+
throw new CliError({
|
|
896905
|
+
message: `Failed to increment version: ${version7}`,
|
|
896906
|
+
code: CliError.Code.VersionError
|
|
896907
|
+
});
|
|
896188
896908
|
}
|
|
896189
896909
|
return version7.startsWith("v") ? `v${newVersion}` : newVersion;
|
|
896190
896910
|
}
|
|
@@ -896244,7 +896964,10 @@ var LocalTaskHandler = class {
|
|
|
896244
896964
|
*/
|
|
896245
896965
|
async getClientRegistry() {
|
|
896246
896966
|
if (this.ai == null) {
|
|
896247
|
-
throw new
|
|
896967
|
+
throw new CliError({
|
|
896968
|
+
message: "No AI service configuration found in generators.yml. Please add an 'ai' section with provider and model.",
|
|
896969
|
+
code: CliError.Code.ConfigError
|
|
896970
|
+
});
|
|
896248
896971
|
}
|
|
896249
896972
|
this.context.logger.debug(`Using AI service: ${this.ai.provider} with model ${this.ai.model}`);
|
|
896250
896973
|
return configureBamlClient(this.ai);
|
|
@@ -896482,7 +897205,7 @@ function extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig) {
|
|
|
896482
897205
|
}
|
|
896483
897206
|
return void 0;
|
|
896484
897207
|
}
|
|
896485
|
-
async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFernConfig, workspace, generatorInvocation, absolutePathToLocalOutput, absolutePathToLocalSnippetJSON, absolutePathToLocalSnippetTemplateJSON, audiences, version: version7, workspaceTempDir, keepDocker, context: context3, irVersionOverride, outputVersionOverride, writeUnitTests, generateOauthClients, generatePaginatedClients, includeOptionalRequestPropertyExamples, inspect: inspect6, executionEnvironment, runner, whiteLabel, publishToRegistry, ir: ir10, ai: ai10, autoVersioningCache, absolutePathToSpecRepo, skipFernignore }) {
|
|
897208
|
+
async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFernConfig, workspace, generatorInvocation, absolutePathToLocalOutput, absolutePathToLocalSnippetJSON, absolutePathToLocalSnippetTemplateJSON, audiences, version: version7, workspaceTempDir, keepDocker, context: context3, irVersionOverride, outputVersionOverride, writeUnitTests, generateOauthClients, generatePaginatedClients, includeOptionalRequestPropertyExamples, inspect: inspect6, executionEnvironment, runner, whiteLabel, publishToRegistry, ir: ir10, ai: ai10, autoVersioningCache, absolutePathToSpecRepo, skipFernignore, disableTelemetry }) {
|
|
896486
897209
|
const { latest: latest2, migrated } = await getIntermediateRepresentation({
|
|
896487
897210
|
workspace,
|
|
896488
897211
|
audiences,
|
|
@@ -896527,7 +897250,8 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
896527
897250
|
}
|
|
896528
897251
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
896529
897252
|
containerImage: generatorInvocation.containerImage ? `${generatorInvocation.containerImage}:${generatorInvocation.version}` : `${generatorInvocation.name}:${generatorInvocation.version}`,
|
|
896530
|
-
keepContainer: keepDocker
|
|
897253
|
+
keepContainer: keepDocker,
|
|
897254
|
+
disableTelemetry
|
|
896531
897255
|
});
|
|
896532
897256
|
const paths = environment2.usesContainerPaths ? {
|
|
896533
897257
|
outputDirectory: AbsoluteFilePath2.of(CONTAINER_CODEGEN_OUTPUT_DIRECTORY),
|
|
@@ -896653,7 +897377,7 @@ function getGeneratorOutputSubfolder(generatorName) {
|
|
|
896653
897377
|
}
|
|
896654
897378
|
|
|
896655
897379
|
// ../generation/local-generation/local-workspace-runner/lib/runLocalGenerationForWorkspace.js
|
|
896656
|
-
async function runLocalGenerationForWorkspace({ token, projectConfig, workspace, generatorGroup, version: version7, keepDocker, inspect: inspect6, context: context3, absolutePathToPreview, runner, ai: ai10, replay, noReplay, validateWorkspace, requireEnvVars, skipFernignore, publishToRegistry, isPreview: isPreviewOverride, automationMode, autoMerge }) {
|
|
897380
|
+
async function runLocalGenerationForWorkspace({ token, projectConfig, workspace, generatorGroup, version: version7, keepDocker, inspect: inspect6, context: context3, absolutePathToPreview, runner, ai: ai10, replay, noReplay, validateWorkspace, requireEnvVars, skipFernignore, publishToRegistry, isPreview: isPreviewOverride, automationMode, autoMerge, disableTelemetry }) {
|
|
896657
897381
|
const userProvidedVersion = version7;
|
|
896658
897382
|
if (userProvidedVersion != null) {
|
|
896659
897383
|
if (absolutePathToPreview != null) {
|
|
@@ -896677,7 +897401,9 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
|
|
|
896677
897401
|
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
|
|
896678
897402
|
onError: (e5) => {
|
|
896679
897403
|
if (!isPreview && (requireEnvVars ?? true)) {
|
|
896680
|
-
interactiveTaskContext.failAndThrow(e5
|
|
897404
|
+
interactiveTaskContext.failAndThrow(e5, void 0, {
|
|
897405
|
+
code: CliError.Code.EnvironmentError
|
|
897406
|
+
});
|
|
896681
897407
|
}
|
|
896682
897408
|
}
|
|
896683
897409
|
}, { substituteAsEmpty: isPreview });
|
|
@@ -896730,13 +897456,13 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
|
|
|
896730
897456
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
896731
897457
|
token ??= await getAccessToken();
|
|
896732
897458
|
if (token == null) {
|
|
896733
|
-
interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.");
|
|
897459
|
+
interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.", void 0, { code: CliError.Code.AuthError });
|
|
896734
897460
|
return;
|
|
896735
897461
|
}
|
|
896736
897462
|
}
|
|
896737
897463
|
const organization = await venus.organization.get(projectConfig.organization);
|
|
896738
897464
|
if (generatorInvocation.absolutePathToLocalOutput == null && !organization.ok) {
|
|
896739
|
-
interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}
|
|
897465
|
+
interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}.`, void 0, { code: CliError.Code.NetworkError });
|
|
896740
897466
|
return;
|
|
896741
897467
|
}
|
|
896742
897468
|
if (organization.ok) {
|
|
@@ -896772,7 +897498,7 @@ generators:
|
|
|
896772
897498
|
uri: your-org/your-sdk-repo
|
|
896773
897499
|
token: \${GITHUB_TOKEN}
|
|
896774
897500
|
mode: pull-request
|
|
896775
|
-
|
|
897501
|
+
`, void 0, { code: CliError.Code.ConfigError });
|
|
896776
897502
|
}
|
|
896777
897503
|
}
|
|
896778
897504
|
if (selfhostedGithubConfig != null) {
|
|
@@ -896806,13 +897532,13 @@ generators:
|
|
|
896806
897532
|
const branchExists = await repo.remoteBranchExists(selfhostedGithubConfig.branch);
|
|
896807
897533
|
if (!branchExists) {
|
|
896808
897534
|
const parsedRepo = parseRepository(selfhostedGithubConfig.uri);
|
|
896809
|
-
interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}
|
|
897535
|
+
interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}`, void 0, { code: CliError.Code.ConfigError });
|
|
896810
897536
|
}
|
|
896811
897537
|
}
|
|
896812
897538
|
await repo.checkoutRemoteBranch(selfhostedGithubConfig.branch);
|
|
896813
897539
|
}
|
|
896814
897540
|
} catch (error50) {
|
|
896815
|
-
interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}
|
|
897541
|
+
interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
|
|
896816
897542
|
}
|
|
896817
897543
|
}
|
|
896818
897544
|
let absolutePathToLocalSnippetJSON = void 0;
|
|
@@ -896852,7 +897578,8 @@ generators:
|
|
|
896852
897578
|
ai: ai10,
|
|
896853
897579
|
autoVersioningCache,
|
|
896854
897580
|
absolutePathToSpecRepo: dirname6(workspace.absoluteFilePath),
|
|
896855
|
-
skipFernignore
|
|
897581
|
+
skipFernignore,
|
|
897582
|
+
disableTelemetry
|
|
896856
897583
|
});
|
|
896857
897584
|
interactiveTaskContext.logger.info(source_default.green("Wrote files to " + absolutePathToLocalOutput));
|
|
896858
897585
|
if (selfhostedGithubConfig != null && shouldCommit) {
|
|
@@ -896909,13 +897636,13 @@ generators:
|
|
|
896909
897636
|
interactiveTaskContext.logger.info(source_default.green("Automerge enabled on PR"));
|
|
896910
897637
|
}
|
|
896911
897638
|
if (!pipelineResult.success) {
|
|
896912
|
-
interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}
|
|
897639
|
+
interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}`, void 0, { code: CliError.Code.UserError });
|
|
896913
897640
|
}
|
|
896914
897641
|
}
|
|
896915
897642
|
});
|
|
896916
897643
|
}));
|
|
896917
897644
|
if (results.some((didSucceed) => !didSucceed)) {
|
|
896918
|
-
|
|
897645
|
+
throw new TaskAbortSignal();
|
|
896919
897646
|
}
|
|
896920
897647
|
}
|
|
896921
897648
|
function resolveAbsolutePathToLocalPreview(absolutePathToPreview, generatorInvocation) {
|
|
@@ -897118,7 +897845,7 @@ var GenerationRunner = class {
|
|
|
897118
897845
|
const results = await Promise.all(generatorGroup.generators.map(async (generatorInvocation) => {
|
|
897119
897846
|
return context3.runInteractiveTask({ name: generatorInvocation.name }, async (interactiveTaskContext) => {
|
|
897120
897847
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897121
|
-
interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system");
|
|
897848
|
+
interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system", void 0, { code: CliError.Code.ConfigError });
|
|
897122
897849
|
return;
|
|
897123
897850
|
}
|
|
897124
897851
|
try {
|
|
@@ -897152,7 +897879,7 @@ var GenerationRunner = class {
|
|
|
897152
897879
|
} catch (error50) {
|
|
897153
897880
|
if (error50 instanceof TaskAbortSignal) {
|
|
897154
897881
|
} else {
|
|
897155
|
-
interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50);
|
|
897882
|
+
interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50, { code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError });
|
|
897156
897883
|
}
|
|
897157
897884
|
}
|
|
897158
897885
|
});
|
|
@@ -897161,7 +897888,7 @@ var GenerationRunner = class {
|
|
|
897161
897888
|
async executeGenerator({ generatorGroup, generatorInvocation, context: context3, workspace, organization, irVersionOverride, outputVersionOverride, absolutePathToFernConfig, inspect: inspect6, skipFernignore, skipAutogenerationIfManualExamplesExist }) {
|
|
897162
897889
|
context3.logger.info(`Starting generation for ${generatorInvocation.name}`);
|
|
897163
897890
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897164
|
-
throw new
|
|
897891
|
+
throw new CliError({ message: "Output path is required for generation", code: CliError.Code.ConfigError });
|
|
897165
897892
|
}
|
|
897166
897893
|
const rawIr = generateIntermediateRepresentation({
|
|
897167
897894
|
workspace,
|
|
@@ -897467,7 +898194,10 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
897467
898194
|
}
|
|
897468
898195
|
const absolutePath = join8(this.context.cwd, RelativeFilePath2.of(license));
|
|
897469
898196
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
897470
|
-
throw new
|
|
898197
|
+
throw new CliError({
|
|
898198
|
+
message: `Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`,
|
|
898199
|
+
code: CliError.Code.InternalError
|
|
898200
|
+
});
|
|
897471
898201
|
}
|
|
897472
898202
|
const contents = await (0, import_promises106.readFile)(absolutePath, "utf-8");
|
|
897473
898203
|
return api_exports4.GithubLicense.custom({ contents });
|
|
@@ -897650,7 +898380,8 @@ var LegacyLocalGenerationRunner = class {
|
|
|
897650
898380
|
inspect: false,
|
|
897651
898381
|
ai: void 0,
|
|
897652
898382
|
skipFernignore: args.skipFernignore,
|
|
897653
|
-
requireEnvVars: args.requireEnvVars
|
|
898383
|
+
requireEnvVars: args.requireEnvVars,
|
|
898384
|
+
disableTelemetry: !this.context.telemetry.isTelemetryEnabled()
|
|
897654
898385
|
});
|
|
897655
898386
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
897656
898387
|
return {
|
|
@@ -897674,7 +898405,8 @@ var LegacyLocalGenerationRunner = class {
|
|
|
897674
898405
|
const executionEnvironment = new ContainerExecutionEnvironment({
|
|
897675
898406
|
containerImage,
|
|
897676
898407
|
keepContainer: args.keepContainer ?? false,
|
|
897677
|
-
runner: args.containerEngine
|
|
898408
|
+
runner: args.containerEngine,
|
|
898409
|
+
disableTelemetry: !this.context.telemetry.isTelemetryEnabled()
|
|
897678
898410
|
});
|
|
897679
898411
|
const runner = new GenerationRunner(executionEnvironment);
|
|
897680
898412
|
await runner.run({
|
|
@@ -897975,7 +898707,10 @@ var SdkTask = class {
|
|
|
897975
898707
|
getTask() {
|
|
897976
898708
|
const task = this.taskGroup.getTask(this.id);
|
|
897977
898709
|
if (task == null) {
|
|
897978
|
-
throw new
|
|
898710
|
+
throw new CliError({
|
|
898711
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
898712
|
+
code: CliError.Code.InternalError
|
|
898713
|
+
});
|
|
897979
898714
|
}
|
|
897980
898715
|
return task;
|
|
897981
898716
|
}
|
|
@@ -898207,7 +898942,7 @@ var GenerateCommand = class {
|
|
|
898207
898942
|
}
|
|
898208
898943
|
async runGeneration({ context: context3, workspace, targets: targets2, args, forceLocal }) {
|
|
898209
898944
|
if (workspace.sdks == null) {
|
|
898210
|
-
throw new
|
|
898945
|
+
throw new CliError({ message: "No SDKs configured", code: CliError.Code.InternalError });
|
|
898211
898946
|
}
|
|
898212
898947
|
const apisToCheck = [...new Set(targets2.map((t3) => t3.api))];
|
|
898213
898948
|
const apiChecker = new ApiChecker({
|
|
@@ -898889,7 +899624,10 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
898889
899624
|
const packageJsonContent = await (0, import_promises110.readFile)(packageJsonPath, "utf-8");
|
|
898890
899625
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
898891
899626
|
if (packageJson2.main == null) {
|
|
898892
|
-
throw new
|
|
899627
|
+
throw new CliError({
|
|
899628
|
+
message: `No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`,
|
|
899629
|
+
code: CliError.Code.InternalError
|
|
899630
|
+
});
|
|
898893
899631
|
}
|
|
898894
899632
|
const packageEntryPoint = (0, import_path80.join)(packageDir, packageJson2.main);
|
|
898895
899633
|
const { migrations } = await import((0, import_url8.pathToFileURL)(packageEntryPoint).href);
|
|
@@ -899004,11 +899742,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
899004
899742
|
this.logger.debug(`No migration package found for ${generatorName}.`);
|
|
899005
899743
|
return void 0;
|
|
899006
899744
|
}
|
|
899007
|
-
throw new
|
|
899745
|
+
throw new CliError({
|
|
899746
|
+
message: `Failed to load generator migrations for ${generatorName}.
|
|
899008
899747
|
|
|
899009
899748
|
Reason: ${errorMessage}
|
|
899010
899749
|
|
|
899011
|
-
Please check your internet connection and npm configuration, then try again
|
|
899750
|
+
Please check your internet connection and npm configuration, then try again.`,
|
|
899751
|
+
code: CliError.Code.InternalError
|
|
899752
|
+
});
|
|
899012
899753
|
}
|
|
899013
899754
|
}
|
|
899014
899755
|
/**
|
|
@@ -899037,7 +899778,10 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
899037
899778
|
const aVersion = import_semver14.default.parse(a4.version);
|
|
899038
899779
|
const bVersion = import_semver14.default.parse(b7.version);
|
|
899039
899780
|
if (aVersion == null || bVersion == null) {
|
|
899040
|
-
throw new
|
|
899781
|
+
throw new CliError({
|
|
899782
|
+
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.`,
|
|
899783
|
+
code: CliError.Code.InternalError
|
|
899784
|
+
});
|
|
899041
899785
|
}
|
|
899042
899786
|
return import_semver14.default.compare(aVersion, bVersion);
|
|
899043
899787
|
});
|
|
@@ -899055,11 +899799,14 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
899055
899799
|
appliedVersions.push(migration23.version);
|
|
899056
899800
|
} catch (error50) {
|
|
899057
899801
|
const errorMessage = extractErrorMessage(error50);
|
|
899058
|
-
throw new
|
|
899802
|
+
throw new CliError({
|
|
899803
|
+
message: `Failed to apply migration for version ${migration23.version}.
|
|
899059
899804
|
|
|
899060
899805
|
Reason: ${errorMessage}
|
|
899061
899806
|
|
|
899062
|
-
Please report this issue at: https://github.com/fern-api/fern/issues
|
|
899807
|
+
Please report this issue at: https://github.com/fern-api/fern/issues`,
|
|
899808
|
+
code: CliError.Code.InternalError
|
|
899809
|
+
});
|
|
899063
899810
|
}
|
|
899064
899811
|
}
|
|
899065
899812
|
return {
|
|
@@ -899475,7 +900222,9 @@ async function createFernDirectoryAndWorkspace({ organization, taskContext, vers
|
|
|
899475
900222
|
if (response.ok) {
|
|
899476
900223
|
organization = response.body.organizationId;
|
|
899477
900224
|
} else {
|
|
899478
|
-
taskContext.failAndThrow("Unauthorized. FERN_TOKEN is invalid."
|
|
900225
|
+
taskContext.failAndThrow("Unauthorized. FERN_TOKEN is invalid.", void 0, {
|
|
900226
|
+
code: CliError.Code.AuthError
|
|
900227
|
+
});
|
|
899479
900228
|
return { absolutePathToFernDirectory: AbsoluteFilePath2.of("/dummy"), organization: "dummy" };
|
|
899480
900229
|
}
|
|
899481
900230
|
}
|
|
@@ -899709,7 +900458,7 @@ async function formatFernWorkspace({ workspace, context: context3, shouldFix })
|
|
|
899709
900458
|
context3.logger.info(source_default.green(`Formatted ${source_default.bold(relativeFilepath)}`));
|
|
899710
900459
|
} else {
|
|
899711
900460
|
context3.logger.info(source_default.red(`Invalid formatting: ${source_default.bold(relativeFilepath)}`));
|
|
899712
|
-
context3.failWithoutThrowing();
|
|
900461
|
+
context3.failWithoutThrowing(void 0, void 0, { code: CliError.Code.ValidationError });
|
|
899713
900462
|
}
|
|
899714
900463
|
}
|
|
899715
900464
|
}
|
|
@@ -900015,9 +900764,21 @@ async function writeSampleApiDefinition({ directoryOfDefinition, apiName }) {
|
|
|
900015
900764
|
await (0, import_promises113.mkdir)(directoryOfDefinition);
|
|
900016
900765
|
await (0, import_promises113.writeFile)(join8(directoryOfDefinition, RelativeFilePath2.of(ROOT_API_FILENAME)), jsYaml.dump(rootApi));
|
|
900017
900766
|
const absoluteFilepathToImdbYaml = join8(directoryOfDefinition, RelativeFilePath2.of("imdb.yml"));
|
|
900018
|
-
|
|
900019
|
-
|
|
900020
|
-
|
|
900767
|
+
let formattedContent;
|
|
900768
|
+
try {
|
|
900769
|
+
formattedContent = await formatDefinitionFile({
|
|
900770
|
+
fileContents: SAMPLE_IMDB_API
|
|
900771
|
+
});
|
|
900772
|
+
} catch (error50) {
|
|
900773
|
+
if (error50 instanceof CliError) {
|
|
900774
|
+
throw error50;
|
|
900775
|
+
}
|
|
900776
|
+
throw new CliError({
|
|
900777
|
+
message: `Failed to format definition file: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
900778
|
+
code: CliError.Code.ParseError
|
|
900779
|
+
});
|
|
900780
|
+
}
|
|
900781
|
+
await (0, import_promises113.writeFile)(absoluteFilepathToImdbYaml, formattedContent);
|
|
900021
900782
|
}
|
|
900022
900783
|
|
|
900023
900784
|
// ../init/lib/initializeAPI.js
|
|
@@ -900209,7 +900970,7 @@ var FernDocsBuilderImpl = class extends FernDocsBuilder {
|
|
|
900209
900970
|
return this.nonTabbedNavigation;
|
|
900210
900971
|
}
|
|
900211
900972
|
addVersion({ versionConfig, navigation: navigation2 }) {
|
|
900212
|
-
throw new
|
|
900973
|
+
throw new CliError({ message: "Method not implemented.", code: CliError.Code.InternalError });
|
|
900213
900974
|
}
|
|
900214
900975
|
addNavbarLink({ link: link3 }) {
|
|
900215
900976
|
if (this.docsYml.navbarLinks == null) {
|
|
@@ -900641,7 +901402,7 @@ var MintlifyImporter = class extends DocsImporter {
|
|
|
900641
901402
|
if (Object.keys(this.tabUrlToInfo).length > 0) {
|
|
900642
901403
|
const tabUrl = getTabForMintItem({ mintItem });
|
|
900643
901404
|
if (tabUrl == null) {
|
|
900644
|
-
return this.context.failAndThrow(`Failed to assign navigation item to a tab group: ${mintItem.group}
|
|
901405
|
+
return this.context.failAndThrow(`Failed to assign navigation item to a tab group: ${mintItem.group}`, void 0, { code: CliError.Code.ConfigError });
|
|
900645
901406
|
}
|
|
900646
901407
|
const tab2 = this.tabUrlToInfo[tabUrl] ?? this.getDefaultDocumentationTab(builder);
|
|
900647
901408
|
return tab2.navigationBuilder;
|
|
@@ -900685,19 +901446,23 @@ async function runMintlifyMigration({ absolutePathToMintJson, outputPath, taskCo
|
|
|
900685
901446
|
// ../init/lib/initializeWithMintlify.js
|
|
900686
901447
|
var initializeWithMintlify = async ({ pathToMintJson, taskContext, versionOfCli, organization }) => {
|
|
900687
901448
|
if (!pathToMintJson?.includes("mint.json")) {
|
|
900688
|
-
taskContext.failAndThrow("Provide a path to a mint.json file"
|
|
901449
|
+
taskContext.failAndThrow("Provide a path to a mint.json file", void 0, {
|
|
901450
|
+
code: CliError.Code.ConfigError
|
|
901451
|
+
});
|
|
900689
901452
|
return;
|
|
900690
901453
|
}
|
|
900691
901454
|
let absolutePathToMintJson = void 0;
|
|
900692
901455
|
if (isURL(pathToMintJson)) {
|
|
900693
|
-
taskContext.failAndThrow("Clone the repo locally and run this command again by referencing the path to the local mint.json file");
|
|
901456
|
+
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 });
|
|
900694
901457
|
return;
|
|
900695
901458
|
} else {
|
|
900696
901459
|
absolutePathToMintJson = AbsoluteFilePath2.of(resolve6(cwd(), pathToMintJson));
|
|
900697
901460
|
}
|
|
900698
901461
|
const pathExists2 = await doesPathExist(absolutePathToMintJson);
|
|
900699
901462
|
if (!pathExists2 || !absolutePathToMintJson) {
|
|
900700
|
-
taskContext.failAndThrow(`${absolutePathToMintJson} does not exist
|
|
901463
|
+
taskContext.failAndThrow(`${absolutePathToMintJson} does not exist`, void 0, {
|
|
901464
|
+
code: CliError.Code.ConfigError
|
|
901465
|
+
});
|
|
900701
901466
|
return;
|
|
900702
901467
|
}
|
|
900703
901468
|
const outputPath = AbsoluteFilePath2.of(cwd());
|
|
@@ -900721,7 +901486,7 @@ function assertIsNumber(val) {
|
|
|
900721
901486
|
}
|
|
900722
901487
|
function assertIsDefined(val) {
|
|
900723
901488
|
if (val === void 0 || val == null) {
|
|
900724
|
-
throw new
|
|
901489
|
+
throw new CliError({ message: "Value is nullable.", code: CliError.Code.InternalError });
|
|
900725
901490
|
}
|
|
900726
901491
|
}
|
|
900727
901492
|
function assertIsStringArray(val) {
|
|
@@ -913584,7 +914349,7 @@ async function startPuppeteer() {
|
|
|
913584
914349
|
try {
|
|
913585
914350
|
return await launch3({ headless: true, args: ["--ignore-certificate-errors"] });
|
|
913586
914351
|
} catch (error50) {
|
|
913587
|
-
throw new
|
|
914352
|
+
throw new CliError({ message: "Could not create a Puppeteer instance", code: CliError.Code.EnvironmentError });
|
|
913588
914353
|
}
|
|
913589
914354
|
}
|
|
913590
914355
|
async function getHtmlWithPuppeteer(browser, url3) {
|
|
@@ -913609,18 +914374,18 @@ async function getHtmlWithPuppeteer(browser, url3) {
|
|
|
913609
914374
|
await page.close();
|
|
913610
914375
|
return content5;
|
|
913611
914376
|
} catch (error50) {
|
|
913612
|
-
throw new
|
|
914377
|
+
throw new CliError({ message: "Failed to download page from Puppeteer", code: CliError.Code.NetworkError });
|
|
913613
914378
|
}
|
|
913614
914379
|
}
|
|
913615
914380
|
async function fetchPageResponse(url3) {
|
|
913616
914381
|
try {
|
|
913617
914382
|
const res = await fetch(url3);
|
|
913618
914383
|
if (!res.ok) {
|
|
913619
|
-
throw new
|
|
914384
|
+
throw new CliError({ message: `${res.status} ${res.statusText}`, code: CliError.Code.NetworkError });
|
|
913620
914385
|
}
|
|
913621
914386
|
return await res.text();
|
|
913622
914387
|
} catch (error50) {
|
|
913623
|
-
throw new
|
|
914388
|
+
throw new CliError({ message: "Failed to fetch page from source", code: CliError.Code.NetworkError });
|
|
913624
914389
|
}
|
|
913625
914390
|
}
|
|
913626
914391
|
async function fetchPageHtml({ url: url3, browser }) {
|
|
@@ -913634,22 +914399,28 @@ async function fetchPageHtml({ url: url3, browser }) {
|
|
|
913634
914399
|
if (res) {
|
|
913635
914400
|
return res;
|
|
913636
914401
|
}
|
|
913637
|
-
throw new
|
|
914402
|
+
throw new CliError({ message: "An unknown error occurred.", code: CliError.Code.NetworkError });
|
|
913638
914403
|
} catch (error50) {
|
|
913639
|
-
throw new
|
|
914404
|
+
throw new CliError({
|
|
914405
|
+
message: `Error retrieving HTML for ${url3.toString()}`,
|
|
914406
|
+
code: CliError.Code.NetworkError
|
|
914407
|
+
});
|
|
913640
914408
|
}
|
|
913641
914409
|
}
|
|
913642
914410
|
async function fetchImage(url3) {
|
|
913643
914411
|
try {
|
|
913644
914412
|
const res = await exponentialBackoff(() => fetch(url3));
|
|
913645
914413
|
if (!res.ok) {
|
|
913646
|
-
throw new
|
|
914414
|
+
throw new CliError({ message: `${res.status} ${res.statusText}`, code: CliError.Code.NetworkError });
|
|
913647
914415
|
}
|
|
913648
914416
|
const imageBuffer = await res.arrayBuffer();
|
|
913649
914417
|
const imageData = new Uint8Array(imageBuffer);
|
|
913650
914418
|
return imageData;
|
|
913651
914419
|
} catch (error50) {
|
|
913652
|
-
throw new
|
|
914420
|
+
throw new CliError({
|
|
914421
|
+
message: `Failed to retrieve image from source url ${url3}`,
|
|
914422
|
+
code: CliError.Code.NetworkError
|
|
914423
|
+
});
|
|
913653
914424
|
}
|
|
913654
914425
|
}
|
|
913655
914426
|
|
|
@@ -913688,7 +914459,10 @@ async function writeImageToFile(src, rootPath) {
|
|
|
913688
914459
|
const filename = removeMetadataFromImageSrc(src);
|
|
913689
914460
|
const imagePath = (0, import_node_path40.join)(rootPath, filename);
|
|
913690
914461
|
if (!isValidImageSrc(filename)) {
|
|
913691
|
-
throw new
|
|
914462
|
+
throw new CliError({
|
|
914463
|
+
message: `${filename} - file extension not supported`,
|
|
914464
|
+
code: CliError.Code.InternalError
|
|
914465
|
+
});
|
|
913692
914466
|
}
|
|
913693
914467
|
if ((0, import_node_fs31.existsSync)(imagePath)) {
|
|
913694
914468
|
return imagePath;
|
|
@@ -913696,14 +914470,17 @@ async function writeImageToFile(src, rootPath) {
|
|
|
913696
914470
|
try {
|
|
913697
914471
|
(0, import_node_fs31.mkdirSync)((0, import_node_path40.dirname)(imagePath), { recursive: true });
|
|
913698
914472
|
} catch (error50) {
|
|
913699
|
-
throw new
|
|
914473
|
+
throw new CliError({ message: `${imagePath} - failed to create directory`, code: CliError.Code.InternalError });
|
|
913700
914474
|
}
|
|
913701
914475
|
try {
|
|
913702
914476
|
const imageData = await fetchImage(src);
|
|
913703
914477
|
write2(imagePath, imageData);
|
|
913704
914478
|
return imagePath;
|
|
913705
914479
|
} catch (error50) {
|
|
913706
|
-
throw new
|
|
914480
|
+
throw new CliError({
|
|
914481
|
+
message: `${imagePath}: failed to download file from source`,
|
|
914482
|
+
code: CliError.Code.NetworkError
|
|
914483
|
+
});
|
|
913707
914484
|
}
|
|
913708
914485
|
}
|
|
913709
914486
|
function isValidImageSrc(src) {
|
|
@@ -914082,7 +914859,9 @@ async function runReadmeMigration({ readmeUrl, outputPath, taskContext, versionO
|
|
|
914082
914859
|
// ../init/lib/initializeWithReadme.js
|
|
914083
914860
|
var initializeWithReadme = async ({ readmeUrl, organization, taskContext, versionOfCli }) => {
|
|
914084
914861
|
if (!readmeUrl || !isURL(readmeUrl)) {
|
|
914085
|
-
taskContext.failAndThrow("Provide a URL to a readme-generated site"
|
|
914862
|
+
taskContext.failAndThrow("Provide a URL to a readme-generated site", void 0, {
|
|
914863
|
+
code: CliError.Code.ConfigError
|
|
914864
|
+
});
|
|
914086
914865
|
return;
|
|
914087
914866
|
}
|
|
914088
914867
|
const outputPath = AbsoluteFilePath2.of(cwd());
|
|
@@ -917803,13 +918582,17 @@ function reportError2(reporter, error50, options2) {
|
|
|
917803
918582
|
}
|
|
917804
918583
|
}
|
|
917805
918584
|
|
|
918585
|
+
// src/telemetry/isTelemetryDisabled.ts
|
|
918586
|
+
function isTelemetryDisabled() {
|
|
918587
|
+
return process.env.FERN_DISABLE_TELEMETRY === "true";
|
|
918588
|
+
}
|
|
918589
|
+
|
|
917806
918590
|
// src/telemetry/SentryClient.ts
|
|
917807
918591
|
var SentryClient = class {
|
|
917808
918592
|
sentry;
|
|
917809
918593
|
constructor({ release: release2 }) {
|
|
917810
|
-
const isTelemetryEnabled = process.env.FERN_DISABLE_TELEMETRY !== "true";
|
|
917811
918594
|
const sentryDsn = "https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496";
|
|
917812
|
-
if (
|
|
918595
|
+
if (!isTelemetryDisabled() && sentryDsn != null && sentryDsn.length > 0) {
|
|
917813
918596
|
const sentryEnvironment = "development";
|
|
917814
918597
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
917815
918598
|
throw new CliError({
|
|
@@ -917821,9 +918604,33 @@ var SentryClient = class {
|
|
|
917821
918604
|
dsn: sentryDsn,
|
|
917822
918605
|
release: release2,
|
|
917823
918606
|
environment: sentryEnvironment,
|
|
918607
|
+
// Opt out of every built-in integration (HTTP tracing, local
|
|
918608
|
+
// variables, console breadcrumbs, etc.) — error capture is all
|
|
918609
|
+
// we need.
|
|
917824
918610
|
defaultIntegrations: false,
|
|
917825
|
-
|
|
917826
|
-
|
|
918611
|
+
// Rewrite absolute frame paths to repo-root-relative paths so
|
|
918612
|
+
// they align with the source maps uploaded at publish time.
|
|
918613
|
+
// onUncaughtException / onUnhandledRejection catch errors that
|
|
918614
|
+
// escape the CLI's top-level handler (fire-and-forget callbacks,
|
|
918615
|
+
// unhandled rejections in background work, etc.).
|
|
918616
|
+
// linkedErrors chains .cause so wrapped errors stay traceable.
|
|
918617
|
+
// nodeContext adds Node.js version and OS to every event.
|
|
918618
|
+
integrations: [
|
|
918619
|
+
rewriteFramesIntegration(),
|
|
918620
|
+
onUncaughtExceptionIntegration(),
|
|
918621
|
+
onUnhandledRejectionIntegration(),
|
|
918622
|
+
linkedErrorsIntegration(),
|
|
918623
|
+
nodeContextIntegration()
|
|
918624
|
+
],
|
|
918625
|
+
// The CLI doesn't emit transactions; disable performance
|
|
918626
|
+
// sampling entirely.
|
|
918627
|
+
tracesSampleRate: 0,
|
|
918628
|
+
// Always attach a stack trace, even when the thrown value is
|
|
918629
|
+
// not an Error instance (e.g. a plain string or object).
|
|
918630
|
+
attachStacktrace: true,
|
|
918631
|
+
// Suppress the client-report envelope Sentry sends when events
|
|
918632
|
+
// are dropped (e.g. due to rate limits).
|
|
918633
|
+
sendClientReports: false
|
|
917827
918634
|
});
|
|
917828
918635
|
setSentryRunIdTags();
|
|
917829
918636
|
}
|
|
@@ -918415,7 +919222,7 @@ var CliContext = class _CliContext {
|
|
|
918415
919222
|
if (false) {
|
|
918416
919223
|
this.logger.error("CLI_VERSION is not defined");
|
|
918417
919224
|
}
|
|
918418
|
-
return "4.
|
|
919225
|
+
return "4.82.0-3-gc1f31446d2e";
|
|
918419
919226
|
}
|
|
918420
919227
|
getCliName() {
|
|
918421
919228
|
if (false) {
|
|
@@ -918717,7 +919524,9 @@ var import_promises127 = require("fs/promises");
|
|
|
918717
919524
|
async function loadProject({ context: context3, nameOverride, ...args }) {
|
|
918718
919525
|
const fernDirectory = await getFernDirectory(nameOverride);
|
|
918719
919526
|
if (fernDirectory == null) {
|
|
918720
|
-
return context3.failAndThrow(`Directory "${nameOverride ?? FERN_DIRECTORY}" not found
|
|
919527
|
+
return context3.failAndThrow(`Directory "${nameOverride ?? FERN_DIRECTORY}" not found.`, void 0, {
|
|
919528
|
+
code: CliError.Code.ConfigError
|
|
919529
|
+
});
|
|
918721
919530
|
}
|
|
918722
919531
|
return await loadProjectFromDirectory({
|
|
918723
919532
|
absolutePathToFernDirectory: fernDirectory,
|
|
@@ -918758,7 +919567,7 @@ Or one of the following directories:
|
|
|
918758
919567
|
\u203A ${ASYNCAPI_DIRECTORY}/
|
|
918759
919568
|
For more information:
|
|
918760
919569
|
\u203A SDK project structure: https://buildwithfern.com/learn/api-definitions/overview/project-structure
|
|
918761
|
-
\u203A Docs project structure: https://buildwithfern.com/learn/docs/getting-started/project-structure
|
|
919570
|
+
\u203A Docs project structure: https://buildwithfern.com/learn/docs/getting-started/project-structure`, void 0, { code: CliError.Code.ConfigError });
|
|
918762
919571
|
}
|
|
918763
919572
|
return {
|
|
918764
919573
|
config: await loadProjectConfig({ directory: absolutePathToFernDirectory, context: context3 }),
|
|
@@ -918785,10 +919594,12 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
918785
919594
|
}, []);
|
|
918786
919595
|
if (commandLineApiWorkspace != null) {
|
|
918787
919596
|
if (!apiWorkspaceDirectoryNames.includes(commandLineApiWorkspace)) {
|
|
918788
|
-
return context3.failAndThrow("API does not exist: " + commandLineApiWorkspace
|
|
919597
|
+
return context3.failAndThrow("API does not exist: " + commandLineApiWorkspace, void 0, {
|
|
919598
|
+
code: CliError.Code.ConfigError
|
|
919599
|
+
});
|
|
918789
919600
|
}
|
|
918790
919601
|
} else if (apiWorkspaceDirectoryNames.length === 0) {
|
|
918791
|
-
return context3.failAndThrow("No APIs found.");
|
|
919602
|
+
return context3.failAndThrow("No APIs found.", void 0, { code: CliError.Code.ConfigError });
|
|
918792
919603
|
} else if (apiWorkspaceDirectoryNames.length > 1 && !defaultToAllApiWorkspaces) {
|
|
918793
919604
|
let message = "There are multiple workspaces. You must specify one with --api:\n";
|
|
918794
919605
|
const longestWorkspaceName = Math.max(...apiWorkspaceDirectoryNames.map((workspaceName) => workspaceName.length));
|
|
@@ -918796,7 +919607,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
918796
919607
|
const suggestedCommand = `${cliName} ${process.argv.slice(2).join(" ")} --api ${workspaceName}`;
|
|
918797
919608
|
return ` \u203A ${source_default.bold(workspaceName.padEnd(longestWorkspaceName))} ${source_default.dim(suggestedCommand)}`;
|
|
918798
919609
|
}).join("\n");
|
|
918799
|
-
return context3.failAndThrow(message);
|
|
919610
|
+
return context3.failAndThrow(message, void 0, { code: CliError.Code.ConfigError });
|
|
918800
919611
|
}
|
|
918801
919612
|
const apiWorkspaces = [];
|
|
918802
919613
|
const filteredWorkspaces = commandLineApiWorkspace != null ? apiWorkspaceDirectoryNames.filter((api2) => {
|
|
@@ -918813,7 +919624,7 @@ async function loadApis({ cliName, fernDirectory, context: context3, cliVersion,
|
|
|
918813
919624
|
apiWorkspaces.push(workspace2.workspace);
|
|
918814
919625
|
} else {
|
|
918815
919626
|
handleFailedWorkspaceParserResult(workspace2, context3.logger);
|
|
918816
|
-
context3.failAndThrow();
|
|
919627
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ConfigError });
|
|
918817
919628
|
}
|
|
918818
919629
|
}));
|
|
918819
919630
|
return apiWorkspaces;
|
|
@@ -920342,7 +921153,8 @@ async function generateWorkspace({
|
|
|
920342
921153
|
requireEnvVars,
|
|
920343
921154
|
skipFernignore,
|
|
920344
921155
|
automationMode,
|
|
920345
|
-
autoMerge
|
|
921156
|
+
autoMerge,
|
|
921157
|
+
disableTelemetry: isTelemetryDisabled()
|
|
920346
921158
|
});
|
|
920347
921159
|
} else if (token != null) {
|
|
920348
921160
|
await runRemoteGenerationForAPIWorkspace({
|
|
@@ -925077,7 +925889,10 @@ function renderCompoundPage(compound, meta5) {
|
|
|
925077
925889
|
return renderVariablePage(compound.data, meta5);
|
|
925078
925890
|
default: {
|
|
925079
925891
|
const _exhaustive = compound;
|
|
925080
|
-
throw new
|
|
925892
|
+
throw new CliError({
|
|
925893
|
+
message: `Unknown compound kind: ${JSON.stringify(_exhaustive)}`,
|
|
925894
|
+
code: CliError.Code.InternalError
|
|
925895
|
+
});
|
|
925081
925896
|
}
|
|
925082
925897
|
}
|
|
925083
925898
|
}
|
|
@@ -925371,7 +926186,10 @@ function categoryFolderForCompound(collected) {
|
|
|
925371
926186
|
return "variables";
|
|
925372
926187
|
default: {
|
|
925373
926188
|
const _exhaustive = collected.compound;
|
|
925374
|
-
throw new
|
|
926189
|
+
throw new CliError({
|
|
926190
|
+
message: `Unknown compound kind: ${JSON.stringify(_exhaustive)}`,
|
|
926191
|
+
code: CliError.Code.InternalError
|
|
926192
|
+
});
|
|
925375
926193
|
}
|
|
925376
926194
|
}
|
|
925377
926195
|
}
|
|
@@ -926633,7 +927451,10 @@ function resolveTarget({
|
|
|
926633
927451
|
return { type: "id", value: id };
|
|
926634
927452
|
}
|
|
926635
927453
|
if (target == null) {
|
|
926636
|
-
throw new
|
|
927454
|
+
throw new CliError({
|
|
927455
|
+
message: "Must provide a preview URL or --id.",
|
|
927456
|
+
code: CliError.Code.ConfigError
|
|
927457
|
+
});
|
|
926637
927458
|
}
|
|
926638
927459
|
if (isPreviewUrl(target)) {
|
|
926639
927460
|
return { type: "url", value: target };
|
|
@@ -930076,7 +930897,7 @@ var JsonSchemaConverterContext = class {
|
|
|
930076
930897
|
this.context.logger.error(`Type ${typeName} not found`);
|
|
930077
930898
|
} else {
|
|
930078
930899
|
}
|
|
930079
|
-
return this.context.failAndThrow();
|
|
930900
|
+
return this.context.failAndThrow(void 0, void 0, { code: CliError.Code.ReferenceError });
|
|
930080
930901
|
}
|
|
930081
930902
|
return typeDeclaration2;
|
|
930082
930903
|
}
|
|
@@ -931417,7 +932238,8 @@ async function sdkPreview({
|
|
|
931417
932238
|
noReplay: true,
|
|
931418
932239
|
validateWorkspace: true,
|
|
931419
932240
|
publishToRegistry,
|
|
931420
|
-
isPreview: true
|
|
932241
|
+
isPreview: true,
|
|
932242
|
+
disableTelemetry: isTelemetryDisabled()
|
|
931421
932243
|
});
|
|
931422
932244
|
});
|
|
931423
932245
|
}
|
|
@@ -939050,10 +939872,16 @@ function addDocsPreviewDeleteCommand(cli, cliContext) {
|
|
|
939050
939872
|
}).check((argv) => {
|
|
939051
939873
|
const sources = [argv.target, argv.url, argv.id].filter(Boolean);
|
|
939052
939874
|
if (sources.length === 0) {
|
|
939053
|
-
throw new
|
|
939875
|
+
throw new CliError({
|
|
939876
|
+
message: "Must provide a preview URL or --id.",
|
|
939877
|
+
code: CliError.Code.ConfigError
|
|
939878
|
+
});
|
|
939054
939879
|
}
|
|
939055
939880
|
if (sources.length > 1) {
|
|
939056
|
-
throw new
|
|
939881
|
+
throw new CliError({
|
|
939882
|
+
message: "Provide only one of: [target], --url, or --id.",
|
|
939883
|
+
code: CliError.Code.ConfigError
|
|
939884
|
+
});
|
|
939057
939885
|
}
|
|
939058
939886
|
return true;
|
|
939059
939887
|
}),
|