@fern-api/fern-api-dev 4.81.1 → 4.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +886 -315
- 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) {
|
|
@@ -524639,7 +524641,10 @@ function getSchemaFromFernType({ fernType, nameOverride, generatedName, title: t
|
|
|
524639
524641
|
string: (value2) => LiteralSchemaValue.string(value2),
|
|
524640
524642
|
boolean: (value2) => LiteralSchemaValue.boolean(value2),
|
|
524641
524643
|
_other: () => {
|
|
524642
|
-
throw new
|
|
524644
|
+
throw new CliError({
|
|
524645
|
+
message: "Unexpected literal type",
|
|
524646
|
+
code: CliError.Code.InternalError
|
|
524647
|
+
});
|
|
524643
524648
|
}
|
|
524644
524649
|
}),
|
|
524645
524650
|
description,
|
|
@@ -527796,7 +527801,10 @@ function convertToReferencedSchema(schema2, breadcrumbs, source2, preserveSchema
|
|
|
527796
527801
|
const availability = convertAvailability2(schema2);
|
|
527797
527802
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
527798
527803
|
if (schemaId == null) {
|
|
527799
|
-
throw new
|
|
527804
|
+
throw new CliError({
|
|
527805
|
+
message: `Invalid schema reference ${JSON.stringify(schema2)}`,
|
|
527806
|
+
code: CliError.Code.ReferenceError
|
|
527807
|
+
});
|
|
527800
527808
|
}
|
|
527801
527809
|
return Schema.reference({
|
|
527802
527810
|
// TODO(dsinghvi): references may contain files
|
|
@@ -528125,21 +528133,33 @@ var AbstractAsyncAPIParserContext = class {
|
|
|
528125
528133
|
*/
|
|
528126
528134
|
resolveSchemaReference(schema2) {
|
|
528127
528135
|
if (!schema2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
528128
|
-
throw new
|
|
528136
|
+
throw new CliError({
|
|
528137
|
+
message: `Failed to resolve schema reference: ${schema2.$ref}`,
|
|
528138
|
+
code: CliError.Code.ReferenceError
|
|
528139
|
+
});
|
|
528129
528140
|
}
|
|
528130
528141
|
const schemaKey = schema2.$ref.substring(SCHEMA_REFERENCE_PREFIX.length);
|
|
528131
528142
|
const splitSchemaKey = schemaKey.split("/");
|
|
528132
528143
|
const components = this.document.components;
|
|
528133
528144
|
if (components == null || components.schemas == null) {
|
|
528134
|
-
throw new
|
|
528145
|
+
throw new CliError({
|
|
528146
|
+
message: "Document does not have components.schemas.",
|
|
528147
|
+
code: CliError.Code.ReferenceError
|
|
528148
|
+
});
|
|
528135
528149
|
}
|
|
528136
528150
|
const [topKey, maybeProps, maybePropKey] = splitSchemaKey;
|
|
528137
528151
|
if (topKey == null || topKey === "") {
|
|
528138
|
-
throw new
|
|
528152
|
+
throw new CliError({
|
|
528153
|
+
message: `${schema2.$ref} cannot be resolved. No schema key provided.`,
|
|
528154
|
+
code: CliError.Code.ReferenceError
|
|
528155
|
+
});
|
|
528139
528156
|
}
|
|
528140
528157
|
let resolvedSchema = components.schemas[topKey];
|
|
528141
528158
|
if (resolvedSchema == null) {
|
|
528142
|
-
throw new
|
|
528159
|
+
throw new CliError({
|
|
528160
|
+
message: `Schema "${topKey}" is undefined in document.components.schemas.`,
|
|
528161
|
+
code: CliError.Code.ReferenceError
|
|
528162
|
+
});
|
|
528143
528163
|
}
|
|
528144
528164
|
if (isReferenceObject(resolvedSchema)) {
|
|
528145
528165
|
resolvedSchema = this.resolveSchemaReference(resolvedSchema);
|
|
@@ -528147,7 +528167,10 @@ var AbstractAsyncAPIParserContext = class {
|
|
|
528147
528167
|
if (maybeProps === "properties" && maybePropKey != null) {
|
|
528148
528168
|
const resolvedProperty = resolvedSchema.properties?.[maybePropKey];
|
|
528149
528169
|
if (resolvedProperty == null) {
|
|
528150
|
-
throw new
|
|
528170
|
+
throw new CliError({
|
|
528171
|
+
message: `Property "${maybePropKey}" not found on "${topKey}". Full ref: ${schema2.$ref}`,
|
|
528172
|
+
code: CliError.Code.ReferenceError
|
|
528173
|
+
});
|
|
528151
528174
|
} else if (isReferenceObject(resolvedProperty)) {
|
|
528152
528175
|
resolvedSchema = this.resolveSchemaReference(resolvedProperty);
|
|
528153
528176
|
} else {
|
|
@@ -528200,12 +528223,15 @@ var AsyncAPIV2ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
528200
528223
|
const MESSAGE_REFERENCE_PREFIX = "#/components/messages/";
|
|
528201
528224
|
const components = this.document.components;
|
|
528202
528225
|
if (components == null || components.messages == null || !message.$ref.startsWith(MESSAGE_REFERENCE_PREFIX)) {
|
|
528203
|
-
throw new
|
|
528226
|
+
throw new CliError({
|
|
528227
|
+
message: `Failed to resolve message reference: ${message.$ref} in v2 components`,
|
|
528228
|
+
code: CliError.Code.ReferenceError
|
|
528229
|
+
});
|
|
528204
528230
|
}
|
|
528205
528231
|
const messageKey = message.$ref.substring(MESSAGE_REFERENCE_PREFIX.length);
|
|
528206
528232
|
const resolvedMessage = components.messages[messageKey];
|
|
528207
528233
|
if (resolvedMessage == null) {
|
|
528208
|
-
throw new
|
|
528234
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
528209
528235
|
}
|
|
528210
528236
|
return resolvedMessage;
|
|
528211
528237
|
}
|
|
@@ -529037,7 +529063,10 @@ var ExampleTypeFactory = class _ExampleTypeFactory {
|
|
|
529037
529063
|
while (schema2.type === "reference") {
|
|
529038
529064
|
const resolvedSchema = this.schemas[schema2.schema];
|
|
529039
529065
|
if (resolvedSchema == null) {
|
|
529040
|
-
throw new
|
|
529066
|
+
throw new CliError({
|
|
529067
|
+
message: `Unexpected error: Failed to resolve schema reference: ${schema2.schema}`,
|
|
529068
|
+
code: CliError.Code.InternalError
|
|
529069
|
+
});
|
|
529041
529070
|
}
|
|
529042
529071
|
schema2 = resolvedSchema;
|
|
529043
529072
|
}
|
|
@@ -530366,7 +530395,10 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
530366
530395
|
while (schema2.type === "reference") {
|
|
530367
530396
|
const resolvedSchema = this.schemas[schema2.schema];
|
|
530368
530397
|
if (resolvedSchema == null) {
|
|
530369
|
-
throw new
|
|
530398
|
+
throw new CliError({
|
|
530399
|
+
message: `Unexpected error: Failed to resolve schema reference: ${schema2.schema}`,
|
|
530400
|
+
code: CliError.Code.InternalError
|
|
530401
|
+
});
|
|
530370
530402
|
}
|
|
530371
530403
|
schema2 = resolvedSchema;
|
|
530372
530404
|
}
|
|
@@ -530876,7 +530908,10 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530876
530908
|
getExampleMessageReference(message) {
|
|
530877
530909
|
const channelId = message.channelId ?? this.getDefaultChannelId();
|
|
530878
530910
|
if (channelId == null) {
|
|
530879
|
-
throw new
|
|
530911
|
+
throw new CliError({
|
|
530912
|
+
message: `Cannot resolve example message reference: no channelId provided and no channels found in document`,
|
|
530913
|
+
code: CliError.Code.InternalError
|
|
530914
|
+
});
|
|
530880
530915
|
}
|
|
530881
530916
|
return `#/channels/${channelId}/messages/${message.messageId}`;
|
|
530882
530917
|
}
|
|
@@ -530891,12 +530926,12 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530891
530926
|
resolveParameterReference(parameter6) {
|
|
530892
530927
|
const PARAMETER_REFERENCE_PREFIX2 = "#/components/parameters/";
|
|
530893
530928
|
if (this.document.components == null || this.document.components.parameters == null || !parameter6.$ref.startsWith(PARAMETER_REFERENCE_PREFIX2)) {
|
|
530894
|
-
throw new
|
|
530929
|
+
throw new CliError({ message: `Failed to resolve ${parameter6.$ref}`, code: CliError.Code.ReferenceError });
|
|
530895
530930
|
}
|
|
530896
530931
|
const parameterKey = parameter6.$ref.substring(PARAMETER_REFERENCE_PREFIX2.length);
|
|
530897
530932
|
const resolvedParameter = this.document.components.parameters[parameterKey];
|
|
530898
530933
|
if (resolvedParameter == null) {
|
|
530899
|
-
throw new
|
|
530934
|
+
throw new CliError({ message: `${parameter6.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530900
530935
|
}
|
|
530901
530936
|
if ("$ref" in resolvedParameter) {
|
|
530902
530937
|
return this.resolveParameterReference(resolvedParameter);
|
|
@@ -530908,10 +530943,16 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530908
530943
|
const CHANNELS_PATH_PART = "#/channels/";
|
|
530909
530944
|
const MESSAGE_REFERENCE_PREFIX = "#/components/messages/";
|
|
530910
530945
|
if (message == null) {
|
|
530911
|
-
throw new
|
|
530946
|
+
throw new CliError({
|
|
530947
|
+
message: "Cannot resolve message reference: message is null or undefined",
|
|
530948
|
+
code: CliError.Code.InternalError
|
|
530949
|
+
});
|
|
530912
530950
|
}
|
|
530913
530951
|
if (!message.$ref) {
|
|
530914
|
-
throw new
|
|
530952
|
+
throw new CliError({
|
|
530953
|
+
message: "Cannot resolve message reference: message.$ref is undefined or empty",
|
|
530954
|
+
code: CliError.Code.ReferenceError
|
|
530955
|
+
});
|
|
530915
530956
|
}
|
|
530916
530957
|
if (message.$ref.startsWith(CHANNELS_PATH_PART)) {
|
|
530917
530958
|
const parts = message.$ref.split("/");
|
|
@@ -530919,12 +530960,15 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530919
530960
|
const messageKey2 = parts[4];
|
|
530920
530961
|
const channelPath = rawChannelPath?.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
530921
530962
|
if (channelPath == null || messageKey2 == null || !this.document.channels?.[channelPath]) {
|
|
530922
|
-
throw new
|
|
530963
|
+
throw new CliError({
|
|
530964
|
+
message: `Failed to resolve message reference ${message.$ref} in channel ${channelPath}`,
|
|
530965
|
+
code: CliError.Code.ReferenceError
|
|
530966
|
+
});
|
|
530923
530967
|
}
|
|
530924
530968
|
const channel3 = this.document.channels[channelPath];
|
|
530925
530969
|
const resolvedInChannel = channel3.messages?.[messageKey2];
|
|
530926
530970
|
if (resolvedInChannel == null) {
|
|
530927
|
-
throw new
|
|
530971
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530928
530972
|
}
|
|
530929
530973
|
if ("$ref" in resolvedInChannel && !shallow) {
|
|
530930
530974
|
return this.resolveMessageReference(resolvedInChannel);
|
|
@@ -530937,12 +530981,15 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530937
530981
|
}
|
|
530938
530982
|
const components = this.document.components;
|
|
530939
530983
|
if (!message.$ref.startsWith(MESSAGE_REFERENCE_PREFIX) || !components?.messages) {
|
|
530940
|
-
throw new
|
|
530984
|
+
throw new CliError({
|
|
530985
|
+
message: `Failed to resolve message reference: ${message.$ref} in v3 components`,
|
|
530986
|
+
code: CliError.Code.ReferenceError
|
|
530987
|
+
});
|
|
530941
530988
|
}
|
|
530942
530989
|
const messageKey = message.$ref.substring(MESSAGE_REFERENCE_PREFIX.length);
|
|
530943
530990
|
const resolvedInComponents = components.messages[messageKey];
|
|
530944
530991
|
if (resolvedInComponents == null) {
|
|
530945
|
-
throw new
|
|
530992
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530946
530993
|
}
|
|
530947
530994
|
return {
|
|
530948
530995
|
...resolvedInComponents,
|
|
@@ -531065,14 +531112,20 @@ function parseAsyncAPIV3({ context: context3, breadcrumbs, source: source2, asyn
|
|
|
531065
531112
|
}));
|
|
531066
531113
|
const channelEvent = channelEvents[channelPath];
|
|
531067
531114
|
if (channelEvent == null) {
|
|
531068
|
-
throw new
|
|
531115
|
+
throw new CliError({
|
|
531116
|
+
message: `Internal error: channelEvents["${channelPath}"] is unexpectedly undefined for operation ${operationId}`,
|
|
531117
|
+
code: CliError.Code.InternalError
|
|
531118
|
+
});
|
|
531069
531119
|
}
|
|
531070
531120
|
if (operation.action === "receive") {
|
|
531071
531121
|
channelEvent.subscribe.push(...messagesWithMethodName);
|
|
531072
531122
|
} else if (operation.action === "send") {
|
|
531073
531123
|
channelEvent.publish.push(...messagesWithMethodName);
|
|
531074
531124
|
} else {
|
|
531075
|
-
throw new
|
|
531125
|
+
throw new CliError({
|
|
531126
|
+
message: `Operation ${operationId} has an invalid action: ${operation.action}`,
|
|
531127
|
+
code: CliError.Code.ValidationError
|
|
531128
|
+
});
|
|
531076
531129
|
}
|
|
531077
531130
|
}
|
|
531078
531131
|
for (const [channelPath, events] of Object.entries(channelEvents)) {
|
|
@@ -531336,42 +531389,63 @@ function decodeJsonPointerSegment(segment) {
|
|
|
531336
531389
|
}
|
|
531337
531390
|
function getChannelPathFromOperation(operation) {
|
|
531338
531391
|
if (!operation.channel) {
|
|
531339
|
-
throw new
|
|
531392
|
+
throw new CliError({
|
|
531393
|
+
message: "Operation is missing required 'channel' field",
|
|
531394
|
+
code: CliError.Code.ValidationError
|
|
531395
|
+
});
|
|
531340
531396
|
}
|
|
531341
531397
|
if (!operation.channel.$ref) {
|
|
531342
|
-
throw new
|
|
531398
|
+
throw new CliError({
|
|
531399
|
+
message: "Operation channel is missing required '$ref' field",
|
|
531400
|
+
code: CliError.Code.ValidationError
|
|
531401
|
+
});
|
|
531343
531402
|
}
|
|
531344
531403
|
if (!operation.channel.$ref.startsWith(CHANNEL_REFERENCE_PREFIX)) {
|
|
531345
|
-
throw new
|
|
531404
|
+
throw new CliError({
|
|
531405
|
+
message: `Failed to resolve channel path from operation ${operation.channel.$ref}`,
|
|
531406
|
+
code: CliError.Code.ReferenceError
|
|
531407
|
+
});
|
|
531346
531408
|
}
|
|
531347
531409
|
return decodeJsonPointerSegment(operation.channel.$ref.substring(CHANNEL_REFERENCE_PREFIX.length));
|
|
531348
531410
|
}
|
|
531349
531411
|
function convertChannelParameterLocation(location2) {
|
|
531350
|
-
|
|
531351
|
-
|
|
531352
|
-
|
|
531353
|
-
|
|
531354
|
-
|
|
531355
|
-
|
|
531356
|
-
|
|
531357
|
-
|
|
531358
|
-
|
|
531359
|
-
|
|
531360
|
-
|
|
531361
|
-
|
|
531362
|
-
|
|
531363
|
-
}
|
|
531364
|
-
|
|
531412
|
+
const ASYNCAPI_RUNTIME_EXPRESSION_DOCS = "https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression";
|
|
531413
|
+
const [messageType, parameterKey] = location2.split("#/");
|
|
531414
|
+
if (messageType == null || parameterKey == null) {
|
|
531415
|
+
throw new CliError({
|
|
531416
|
+
message: `Invalid location format: ${location2}; unable to parse message type and parameter key. See ${ASYNCAPI_RUNTIME_EXPRESSION_DOCS} for the expected format.`,
|
|
531417
|
+
code: CliError.Code.ValidationError
|
|
531418
|
+
});
|
|
531419
|
+
}
|
|
531420
|
+
if (!messageType.startsWith(LOCATION_PREFIX)) {
|
|
531421
|
+
throw new CliError({
|
|
531422
|
+
message: `Invalid location format: ${location2}; expected ${LOCATION_PREFIX} prefix`,
|
|
531423
|
+
code: CliError.Code.ValidationError
|
|
531424
|
+
});
|
|
531425
|
+
}
|
|
531426
|
+
const type8 = messageType.substring(LOCATION_PREFIX.length);
|
|
531427
|
+
if (type8 !== "header" && type8 !== "path" && type8 !== "payload") {
|
|
531428
|
+
throw new CliError({
|
|
531429
|
+
message: `Invalid message type: ${type8}. Must be one of: header, path, payload`,
|
|
531430
|
+
code: CliError.Code.ValidationError
|
|
531431
|
+
});
|
|
531365
531432
|
}
|
|
531433
|
+
return { type: type8, parameterKey };
|
|
531366
531434
|
}
|
|
531367
531435
|
function getServerNameFromServerRef(servers, serverRef) {
|
|
531368
531436
|
if (!serverRef.$ref.startsWith(SERVER_REFERENCE_PREFIX)) {
|
|
531369
|
-
throw new
|
|
531437
|
+
throw new CliError({
|
|
531438
|
+
message: `Failed to resolve server name from server ref ${serverRef.$ref}`,
|
|
531439
|
+
code: CliError.Code.ReferenceError
|
|
531440
|
+
});
|
|
531370
531441
|
}
|
|
531371
531442
|
const serverName = serverRef.$ref.substring(SERVER_REFERENCE_PREFIX.length);
|
|
531372
531443
|
const server = servers[serverName];
|
|
531373
531444
|
if (server == null) {
|
|
531374
|
-
throw new
|
|
531445
|
+
throw new CliError({
|
|
531446
|
+
message: `Failed to find server with name ${serverName}`,
|
|
531447
|
+
code: CliError.Code.ReferenceError
|
|
531448
|
+
});
|
|
531375
531449
|
}
|
|
531376
531450
|
return server;
|
|
531377
531451
|
}
|
|
@@ -531560,7 +531634,7 @@ function convertPaginationExtension(pagination) {
|
|
|
531560
531634
|
results: customPagination.results
|
|
531561
531635
|
});
|
|
531562
531636
|
}
|
|
531563
|
-
throw new
|
|
531637
|
+
throw new CliError({ message: "Invalid pagination extension", code: CliError.Code.ValidationError });
|
|
531564
531638
|
}
|
|
531565
531639
|
function getFernPaginationExtension(document4, operation) {
|
|
531566
531640
|
const pagination = getExtension(operation, FernOpenAPIExtension.PAGINATION);
|
|
@@ -531570,7 +531644,10 @@ function getFernPaginationExtension(document4, operation) {
|
|
|
531570
531644
|
if (typeof pagination === "boolean") {
|
|
531571
531645
|
const topLevelPagination = getExtension(document4, FernOpenAPIExtension.PAGINATION);
|
|
531572
531646
|
if (typeof topLevelPagination === "boolean") {
|
|
531573
|
-
throw new
|
|
531647
|
+
throw new CliError({
|
|
531648
|
+
message: "Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",
|
|
531649
|
+
code: CliError.Code.ValidationError
|
|
531650
|
+
});
|
|
531574
531651
|
}
|
|
531575
531652
|
return topLevelPagination == null ? void 0 : convertPaginationExtension(topLevelPagination);
|
|
531576
531653
|
}
|
|
@@ -531889,12 +531966,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531889
531966
|
}
|
|
531890
531967
|
resolveParameterReference(parameter6) {
|
|
531891
531968
|
if (this.document.components == null || this.document.components.parameters == null || !parameter6.$ref.startsWith(PARAMETER_REFERENCE_PREFIX)) {
|
|
531892
|
-
throw new
|
|
531969
|
+
throw new CliError({ message: `Failed to resolve ${parameter6.$ref}`, code: CliError.Code.ReferenceError });
|
|
531893
531970
|
}
|
|
531894
531971
|
const parameterKey = parameter6.$ref.substring(PARAMETER_REFERENCE_PREFIX.length);
|
|
531895
531972
|
const resolvedParameter = this.document.components.parameters[parameterKey];
|
|
531896
531973
|
if (resolvedParameter == null) {
|
|
531897
|
-
throw new
|
|
531974
|
+
throw new CliError({ message: `${parameter6.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531898
531975
|
}
|
|
531899
531976
|
if (isReferenceObject(resolvedParameter)) {
|
|
531900
531977
|
return this.resolveParameterReference(resolvedParameter);
|
|
@@ -531903,12 +531980,15 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531903
531980
|
}
|
|
531904
531981
|
resolveRequestBodyReference(requestBody) {
|
|
531905
531982
|
if (this.document.components == null || this.document.components.requestBodies == null || !requestBody.$ref.startsWith(REQUEST_BODY_REFERENCE_PREFIX)) {
|
|
531906
|
-
throw new
|
|
531983
|
+
throw new CliError({
|
|
531984
|
+
message: `Failed to resolve ${requestBody.$ref}`,
|
|
531985
|
+
code: CliError.Code.ReferenceError
|
|
531986
|
+
});
|
|
531907
531987
|
}
|
|
531908
531988
|
const requestBodyKey = requestBody.$ref.substring(REQUEST_BODY_REFERENCE_PREFIX.length);
|
|
531909
531989
|
const resolvedRequestBody = this.document.components.requestBodies[requestBodyKey];
|
|
531910
531990
|
if (resolvedRequestBody == null) {
|
|
531911
|
-
throw new
|
|
531991
|
+
throw new CliError({ message: `${requestBody.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531912
531992
|
}
|
|
531913
531993
|
if (isReferenceObject(resolvedRequestBody)) {
|
|
531914
531994
|
return this.resolveRequestBodyReference(resolvedRequestBody);
|
|
@@ -531917,12 +531997,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531917
531997
|
}
|
|
531918
531998
|
resolveResponseReference(response) {
|
|
531919
531999
|
if (this.document.components == null || this.document.components.responses == null || !response.$ref.startsWith(RESPONSE_REFERENCE_PREFIX)) {
|
|
531920
|
-
throw new
|
|
532000
|
+
throw new CliError({ message: `Failed to resolve ${response.$ref}`, code: CliError.Code.ReferenceError });
|
|
531921
532001
|
}
|
|
531922
532002
|
const parameterKey = response.$ref.substring(RESPONSE_REFERENCE_PREFIX.length);
|
|
531923
532003
|
const resolvedResponse = this.document.components.responses[parameterKey];
|
|
531924
532004
|
if (resolvedResponse == null) {
|
|
531925
|
-
throw new
|
|
532005
|
+
throw new CliError({ message: `${response.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531926
532006
|
}
|
|
531927
532007
|
if (isReferenceObject(resolvedResponse)) {
|
|
531928
532008
|
return this.resolveResponseReference(resolvedResponse);
|
|
@@ -531931,12 +532011,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531931
532011
|
}
|
|
531932
532012
|
resolveExampleReference(example) {
|
|
531933
532013
|
if (this.document.components == null || this.document.components.examples == null || !example.$ref.startsWith(EXAMPLES_REFERENCE_PREFIX)) {
|
|
531934
|
-
throw new
|
|
532014
|
+
throw new CliError({ message: `Failed to resolve ${example.$ref}`, code: CliError.Code.ReferenceError });
|
|
531935
532015
|
}
|
|
531936
532016
|
const parameterKey = example.$ref.substring(EXAMPLES_REFERENCE_PREFIX.length);
|
|
531937
532017
|
const resolvedExample = this.document.components.examples[parameterKey];
|
|
531938
532018
|
if (resolvedExample == null) {
|
|
531939
|
-
throw new
|
|
532019
|
+
throw new CliError({ message: `${example.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531940
532020
|
}
|
|
531941
532021
|
if (isReferenceObject(resolvedExample)) {
|
|
531942
532022
|
return this.resolveExampleReference(resolvedExample);
|
|
@@ -531945,12 +532025,15 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531945
532025
|
}
|
|
531946
532026
|
resolveSecuritySchemeReference(securityScheme) {
|
|
531947
532027
|
if (this.document.components == null || this.document.components.securitySchemes == null || !securityScheme.$ref.startsWith(SECURITY_SCHEME_REFERENCE_PREFIX)) {
|
|
531948
|
-
throw new
|
|
532028
|
+
throw new CliError({
|
|
532029
|
+
message: `Failed to resolve ${securityScheme.$ref}`,
|
|
532030
|
+
code: CliError.Code.ReferenceError
|
|
532031
|
+
});
|
|
531949
532032
|
}
|
|
531950
532033
|
const securitySchemeKey = securityScheme.$ref.substring(SECURITY_SCHEME_REFERENCE_PREFIX.length);
|
|
531951
532034
|
const resolvedSecurityScheme = this.document.components.securitySchemes[securitySchemeKey];
|
|
531952
532035
|
if (resolvedSecurityScheme == null) {
|
|
531953
|
-
throw new
|
|
532036
|
+
throw new CliError({ message: `${securityScheme.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531954
532037
|
}
|
|
531955
532038
|
if (isReferenceObject(resolvedSecurityScheme)) {
|
|
531956
532039
|
return this.resolveSecuritySchemeReference(resolvedSecurityScheme);
|
|
@@ -532710,15 +532793,24 @@ function getMultipartPartEncodingFromContentType(contentType) {
|
|
|
532710
532793
|
}
|
|
532711
532794
|
function resolveSchema(schema2, document4) {
|
|
532712
532795
|
if (!schema2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
532713
|
-
throw new
|
|
532796
|
+
throw new CliError({
|
|
532797
|
+
message: `Failed to resolve schema reference because of unsupported prefix: ${schema2.$ref}`,
|
|
532798
|
+
code: CliError.Code.ReferenceError
|
|
532799
|
+
});
|
|
532714
532800
|
}
|
|
532715
532801
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
532716
532802
|
if (schemaId == null) {
|
|
532717
|
-
throw new
|
|
532803
|
+
throw new CliError({
|
|
532804
|
+
message: `Failed to resolve schema reference because missing schema id: ${schema2.$ref}`,
|
|
532805
|
+
code: CliError.Code.ReferenceError
|
|
532806
|
+
});
|
|
532718
532807
|
}
|
|
532719
532808
|
const resolvedSchema = document4.components?.schemas?.[schemaId];
|
|
532720
532809
|
if (resolvedSchema == null) {
|
|
532721
|
-
throw new
|
|
532810
|
+
throw new CliError({
|
|
532811
|
+
message: `Failed to resolve schema reference because missing: ${schema2.$ref}`,
|
|
532812
|
+
code: CliError.Code.ReferenceError
|
|
532813
|
+
});
|
|
532722
532814
|
}
|
|
532723
532815
|
if (isReferenceObject(resolvedSchema)) {
|
|
532724
532816
|
return resolveSchema(resolvedSchema, document4);
|
|
@@ -534215,7 +534307,10 @@ function getBasicSecuritySchemeNameAndEnvvar(securityScheme) {
|
|
|
534215
534307
|
function convertSecurityScheme(securityScheme, source2, taskContext, context3) {
|
|
534216
534308
|
if (isReferenceObject(securityScheme)) {
|
|
534217
534309
|
if (context3 == null) {
|
|
534218
|
-
throw new
|
|
534310
|
+
throw new CliError({
|
|
534311
|
+
message: `Converting referenced security schemes requires context: ${JSON.stringify(securityScheme)}`,
|
|
534312
|
+
code: CliError.Code.InternalError
|
|
534313
|
+
});
|
|
534219
534314
|
}
|
|
534220
534315
|
const resolvedSecurityScheme = context3.resolveSecuritySchemeReference(securityScheme);
|
|
534221
534316
|
return convertSecuritySchemeHelper(resolvedSecurityScheme, source2, taskContext);
|
|
@@ -534396,7 +534491,10 @@ function getVariableDefinitions(document4, preserveSchemaIds) {
|
|
|
534396
534491
|
}
|
|
534397
534492
|
];
|
|
534398
534493
|
} else {
|
|
534399
|
-
throw new
|
|
534494
|
+
throw new CliError({
|
|
534495
|
+
message: `Variable ${variableName} has unsupported schema ${JSON.stringify(schema2)}`,
|
|
534496
|
+
code: CliError.Code.ValidationError
|
|
534497
|
+
});
|
|
534400
534498
|
}
|
|
534401
534499
|
}));
|
|
534402
534500
|
}
|
|
@@ -535712,7 +535810,7 @@ async function validateSchema({ schema: schema2, value: value2, context: context
|
|
|
535712
535810
|
});
|
|
535713
535811
|
});
|
|
535714
535812
|
const errorMessage = [`Failed to parse file: ${import_path20.default.relative(process.cwd(), filepathBeingParsed)}`, ...issues].join("\n");
|
|
535715
|
-
return context3.failAndThrow(errorMessage);
|
|
535813
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
535716
535814
|
}
|
|
535717
535815
|
function joinZodPath(arr) {
|
|
535718
535816
|
return arr.reduce((acc, value2) => {
|
|
@@ -535745,7 +535843,9 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535745
535843
|
path: versionOrPath
|
|
535746
535844
|
};
|
|
535747
535845
|
} else {
|
|
535748
|
-
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}
|
|
535846
|
+
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}`, void 0, {
|
|
535847
|
+
code: CliError.Code.ConfigError
|
|
535848
|
+
});
|
|
535749
535849
|
}
|
|
535750
535850
|
} else {
|
|
535751
535851
|
const unprefixedCoordinate = coordinate.substring(1);
|
|
@@ -535760,12 +535860,14 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535760
535860
|
version: versionOrPath
|
|
535761
535861
|
};
|
|
535762
535862
|
} else {
|
|
535763
|
-
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}
|
|
535863
|
+
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}`, void 0, {
|
|
535864
|
+
code: CliError.Code.ConfigError
|
|
535865
|
+
});
|
|
535764
535866
|
}
|
|
535765
535867
|
}
|
|
535766
535868
|
}
|
|
535767
535869
|
if (context3.getResult() === TaskResult.Failure) {
|
|
535768
|
-
context3.failAndThrow();
|
|
535870
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ConfigError });
|
|
535769
535871
|
}
|
|
535770
535872
|
return {
|
|
535771
535873
|
dependencies
|
|
@@ -535921,7 +536023,7 @@ function getColorInstanceFromRawConfigOrThrow(raw, context3, key2, theme) {
|
|
|
535921
536023
|
}
|
|
535922
536024
|
const instance = tinycolor(color3);
|
|
535923
536025
|
if (!instance.isValid()) {
|
|
535924
|
-
context3.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF
|
|
536026
|
+
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
536027
|
}
|
|
535926
536028
|
return instance;
|
|
535927
536029
|
}
|
|
@@ -536535,7 +536637,7 @@ async function parseContext7File({ rawPath, absoluteFilepathToDocsConfig, contex
|
|
|
536535
536637
|
try {
|
|
536536
536638
|
JSON.parse(contents);
|
|
536537
536639
|
} catch (error50) {
|
|
536538
|
-
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50));
|
|
536640
|
+
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50), { code: CliError.Code.ConfigError });
|
|
536539
536641
|
}
|
|
536540
536642
|
return absolutePath;
|
|
536541
536643
|
}
|
|
@@ -536695,7 +536797,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536695
536797
|
featureFlags: convertFeatureFlag(product.featureFlag)
|
|
536696
536798
|
});
|
|
536697
536799
|
} else {
|
|
536698
|
-
throw new
|
|
536800
|
+
throw new CliError({
|
|
536801
|
+
message: `Invalid product configuration: product must have either 'path' or valid 'href' property`,
|
|
536802
|
+
code: CliError.Code.ConfigError
|
|
536803
|
+
});
|
|
536699
536804
|
}
|
|
536700
536805
|
}
|
|
536701
536806
|
return {
|
|
@@ -536710,7 +536815,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536710
536815
|
folderTitleSource
|
|
536711
536816
|
});
|
|
536712
536817
|
}
|
|
536713
|
-
throw new
|
|
536818
|
+
throw new CliError({
|
|
536819
|
+
message: "Unexpected. Docs have neither navigation or versions defined.",
|
|
536820
|
+
code: CliError.Code.ConfigError
|
|
536821
|
+
});
|
|
536714
536822
|
}
|
|
536715
536823
|
function convertFeatureFlag(flag) {
|
|
536716
536824
|
if (flag == null) {
|
|
@@ -536808,7 +536916,10 @@ function parseWeight(weight) {
|
|
|
536808
536916
|
async function convertNavigationTabConfiguration({ tabs, item, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536809
536917
|
const tab2 = tabs[item.tab];
|
|
536810
536918
|
if (tab2 == null) {
|
|
536811
|
-
throw new
|
|
536919
|
+
throw new CliError({
|
|
536920
|
+
message: `Tab ${item.tab} is not defined in the tabs config.`,
|
|
536921
|
+
code: CliError.Code.ConfigError
|
|
536922
|
+
});
|
|
536812
536923
|
}
|
|
536813
536924
|
if (tabbedNavigationItemHasVariants(item)) {
|
|
536814
536925
|
const variants = await Promise.all(item.variants.map(async (variant) => {
|
|
@@ -536937,7 +537048,9 @@ var DEFAULT_CHANGELOG_TITLE = "Changelog";
|
|
|
536937
537048
|
async function expandFolderConfiguration({ rawConfig, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536938
537049
|
const folderPath = resolveFilepath(rawConfig.folder, absolutePathToConfig);
|
|
536939
537050
|
if (!await doesPathExist(folderPath)) {
|
|
536940
|
-
context3.failAndThrow(`Folder not found: ${rawConfig.folder}
|
|
537051
|
+
context3.failAndThrow(`Folder not found: ${rawConfig.folder}`, void 0, {
|
|
537052
|
+
code: CliError.Code.ConfigError
|
|
537053
|
+
});
|
|
536941
537054
|
}
|
|
536942
537055
|
validateCollapsibleConfig({
|
|
536943
537056
|
context: context3,
|
|
@@ -537260,7 +537373,10 @@ function parseLibrariesConfiguration(libraries) {
|
|
|
537260
537373
|
const result = {};
|
|
537261
537374
|
for (const [name2, config5] of Object.entries(libraries)) {
|
|
537262
537375
|
if (!isGitLibraryInput(config5.input)) {
|
|
537263
|
-
throw new
|
|
537376
|
+
throw new CliError({
|
|
537377
|
+
message: `Library '${name2}' uses 'path' input which is not yet supported. Please use 'git' input.`,
|
|
537378
|
+
code: CliError.Code.ConfigError
|
|
537379
|
+
});
|
|
537264
537380
|
}
|
|
537265
537381
|
result[name2] = {
|
|
537266
537382
|
input: {
|
|
@@ -537449,10 +537565,10 @@ function parseAudiences(raw) {
|
|
|
537449
537565
|
}
|
|
537450
537566
|
function validateCollapsibleConfig({ context: context3, sectionTitle, collapsed, collapsible, collapsedByDefault }) {
|
|
537451
537567
|
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
|
|
537568
|
+
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
537569
|
}
|
|
537454
537570
|
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
|
|
537571
|
+
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
537572
|
}
|
|
537457
537573
|
}
|
|
537458
537574
|
|
|
@@ -537727,7 +537843,9 @@ function removeDefaultDockerOrgIfPresent(generatorName) {
|
|
|
537727
537843
|
function getGeneratorNameOrThrow(generatorName, context3) {
|
|
537728
537844
|
const normalizedGeneratorName = normalizeGeneratorName(generatorName);
|
|
537729
537845
|
if (normalizedGeneratorName == null) {
|
|
537730
|
-
return context3.failAndThrow("Unrecognized generator: " + generatorName
|
|
537846
|
+
return context3.failAndThrow("Unrecognized generator: " + generatorName, void 0, {
|
|
537847
|
+
code: CliError.Code.ConfigError
|
|
537848
|
+
});
|
|
537731
537849
|
}
|
|
537732
537850
|
return normalizedGeneratorName;
|
|
537733
537851
|
}
|
|
@@ -537854,9 +537972,9 @@ async function updateGeneratorGroup({ generatorsConfiguration, groupName = gener
|
|
|
537854
537972
|
const availableGroups = Object.keys(generatorsConfiguration.groups ?? {});
|
|
537855
537973
|
if (availableGroups.length > 0) {
|
|
537856
537974
|
const message = "No group specified. Use the --group option:\n" + availableGroups.map((name2) => ` \u203A ${name2}`).join("\n");
|
|
537857
|
-
return context3.failAndThrow(message);
|
|
537975
|
+
return context3.failAndThrow(message, void 0, { code: CliError.Code.ConfigError });
|
|
537858
537976
|
}
|
|
537859
|
-
return context3.failAndThrow("No group specified.");
|
|
537977
|
+
return context3.failAndThrow("No group specified.", void 0, { code: CliError.Code.ConfigError });
|
|
537860
537978
|
}
|
|
537861
537979
|
const groups2 = generatorsConfiguration.groups ??= {};
|
|
537862
537980
|
const group = groups2[groupName];
|
|
@@ -537880,7 +537998,9 @@ async function addGenerator({ generatorName, generatorsConfiguration, groupName
|
|
|
537880
537998
|
context: context3,
|
|
537881
537999
|
update: async (group) => {
|
|
537882
538000
|
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}
|
|
538001
|
+
context3.failAndThrow(`${generatorName} is already installed in group ${groupName}.`, void 0, {
|
|
538002
|
+
code: CliError.Code.ConfigError
|
|
538003
|
+
});
|
|
537884
538004
|
}
|
|
537885
538005
|
const latestVersion2 = await getLatestGeneratorVersion({
|
|
537886
538006
|
cliVersion,
|
|
@@ -544443,7 +544563,10 @@ function parseRemoveDiscriminantsFromSchemas(option) {
|
|
|
544443
544563
|
} else if (option === "never") {
|
|
544444
544564
|
return generators_yml_exports.RemoveDiscriminantsFromSchemas.Never;
|
|
544445
544565
|
}
|
|
544446
|
-
throw new
|
|
544566
|
+
throw new CliError({
|
|
544567
|
+
message: `Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${option}`,
|
|
544568
|
+
code: CliError.Code.ConfigError
|
|
544569
|
+
});
|
|
544447
544570
|
}
|
|
544448
544571
|
function mergeSettings(base4, override) {
|
|
544449
544572
|
return {
|
|
@@ -545010,7 +545133,10 @@ async function getGithubLicense({ absolutePathToGeneratorsConfiguration, githubL
|
|
|
545010
545133
|
function getGithubPublishInfo(output2, maybeGroupLevelMetadata, maybeTopLevelMetadata) {
|
|
545011
545134
|
switch (output2.location) {
|
|
545012
545135
|
case "local-file-system":
|
|
545013
|
-
throw new
|
|
545136
|
+
throw new CliError({
|
|
545137
|
+
message: "Cannot use local-file-system with github publishing",
|
|
545138
|
+
code: CliError.Code.ConfigError
|
|
545139
|
+
});
|
|
545014
545140
|
case "npm":
|
|
545015
545141
|
return api_exports4.GithubPublishInfo.npm({
|
|
545016
545142
|
registryUrl: output2.url ?? "https://registry.npmjs.org",
|
|
@@ -545203,7 +545329,10 @@ async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context
|
|
|
545203
545329
|
if (parsed.ok) {
|
|
545204
545330
|
return parsed.value;
|
|
545205
545331
|
}
|
|
545206
|
-
throw new
|
|
545332
|
+
throw new CliError({
|
|
545333
|
+
message: parsed.errors.map((e5) => e5.message).join("\n"),
|
|
545334
|
+
code: CliError.Code.ConfigError
|
|
545335
|
+
});
|
|
545207
545336
|
} catch (e5) {
|
|
545208
545337
|
if (e5 instanceof jsYaml.YAMLException) {
|
|
545209
545338
|
const relativePath = import_path24.default.relative(process.cwd(), filepath);
|
|
@@ -545225,7 +545354,7 @@ ${e5.mark.snippet}`;
|
|
|
545225
545354
|
errorMessage += '\n\nHint: Values starting with "@" (such as scoped npm packages) must be wrapped in quotes.\n Example: package-name: "@scope/package"';
|
|
545226
545355
|
}
|
|
545227
545356
|
}
|
|
545228
|
-
context3.failAndThrow(errorMessage);
|
|
545357
|
+
context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
545229
545358
|
} else {
|
|
545230
545359
|
throw e5;
|
|
545231
545360
|
}
|
|
@@ -551709,7 +551838,7 @@ function parseTypeName({ typeName, file: file4 }) {
|
|
|
551709
551838
|
imports: file4.imports
|
|
551710
551839
|
});
|
|
551711
551840
|
if (reference4 == null) {
|
|
551712
|
-
throw new
|
|
551841
|
+
throw new CliError({ message: "Failed to locate type: " + typeName, code: CliError.Code.ResolutionError });
|
|
551713
551842
|
}
|
|
551714
551843
|
const nameWithoutId = {
|
|
551715
551844
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -551919,7 +552048,7 @@ function convertHttpRequestBody({ request: request7, file: file4 }) {
|
|
|
551919
552048
|
}
|
|
551920
552049
|
if (isInlineRequestBody(request7.body)) {
|
|
551921
552050
|
if (request7.name == null) {
|
|
551922
|
-
throw new
|
|
552051
|
+
throw new CliError({ message: "Name is missing for inlined request", code: CliError.Code.InternalError });
|
|
551923
552052
|
}
|
|
551924
552053
|
return HttpRequestBody.inlinedRequestBody({
|
|
551925
552054
|
name: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552009,13 +552138,19 @@ function getObjectPropertyFromResolvedType({ typeResolver, file: file4, resolved
|
|
|
552009
552138
|
default:
|
|
552010
552139
|
assertNever(resolvedType);
|
|
552011
552140
|
}
|
|
552012
|
-
throw new
|
|
552141
|
+
throw new CliError({
|
|
552142
|
+
message: "Internal error; response must be an object in order to return a property as a response",
|
|
552143
|
+
code: CliError.Code.InternalError
|
|
552144
|
+
});
|
|
552013
552145
|
}
|
|
552014
552146
|
function getObjectPropertyFromObjectSchema({ typeResolver, file: file4, objectSchema, property: property24 }) {
|
|
552015
552147
|
const properties7 = getAllPropertiesForRawObjectSchema(objectSchema, file4, typeResolver);
|
|
552016
552148
|
const objectProperty = properties7[property24];
|
|
552017
552149
|
if (objectProperty == null) {
|
|
552018
|
-
throw new
|
|
552150
|
+
throw new CliError({
|
|
552151
|
+
message: `Object does not have a property named ${property24}.`,
|
|
552152
|
+
code: CliError.Code.ReferenceError
|
|
552153
|
+
});
|
|
552019
552154
|
}
|
|
552020
552155
|
return objectProperty;
|
|
552021
552156
|
}
|
|
@@ -552048,7 +552183,10 @@ function getAllPropertiesForExtendedType(extendedType, file4, typeResolver) {
|
|
|
552048
552183
|
if (resolvedType._type === "named" && isRawObjectDefinition(resolvedType.declaration)) {
|
|
552049
552184
|
return getAllPropertiesForRawObjectSchema(resolvedType.declaration, file4, typeResolver);
|
|
552050
552185
|
}
|
|
552051
|
-
throw new
|
|
552186
|
+
throw new CliError({
|
|
552187
|
+
message: `Extended type ${extendedType} must be another named type`,
|
|
552188
|
+
code: CliError.Code.InternalError
|
|
552189
|
+
});
|
|
552052
552190
|
}
|
|
552053
552191
|
|
|
552054
552192
|
// ../generation/ir-generator/lib/converters/services/convertProperty.js
|
|
@@ -552112,7 +552250,10 @@ function getPropertyTypeFromObjectSchema({ typeResolver, file: file4, objectSche
|
|
|
552112
552250
|
});
|
|
552113
552251
|
const propertyType = properties7[property24];
|
|
552114
552252
|
if (propertyType == null) {
|
|
552115
|
-
throw new
|
|
552253
|
+
throw new CliError({
|
|
552254
|
+
message: `Response does not have a property named ${property24}.`,
|
|
552255
|
+
code: CliError.Code.ReferenceError
|
|
552256
|
+
});
|
|
552116
552257
|
}
|
|
552117
552258
|
return propertyType;
|
|
552118
552259
|
}
|
|
@@ -552153,7 +552294,10 @@ function getAllPropertiesForExtendedType2({ typeResolver, file: file4, extendedT
|
|
|
552153
552294
|
objectSchema: resolvedType.declaration
|
|
552154
552295
|
});
|
|
552155
552296
|
}
|
|
552156
|
-
throw new
|
|
552297
|
+
throw new CliError({
|
|
552298
|
+
message: `Extended type ${extendedType} must be another named type.`,
|
|
552299
|
+
code: CliError.Code.InternalError
|
|
552300
|
+
});
|
|
552157
552301
|
}
|
|
552158
552302
|
function maybeFileFromResolvedType(resolvedType) {
|
|
552159
552303
|
if (resolvedType == null) {
|
|
@@ -552209,7 +552353,7 @@ function convertHttpSdkRequest({ request: request7, endpointKey, endpoint: endpo
|
|
|
552209
552353
|
function convertHttpSdkRequestShape({ service, request: request7, file: file4, typeResolver }) {
|
|
552210
552354
|
const constructWrapper = () => {
|
|
552211
552355
|
if (typeof request7 === "string" || request7?.name == null) {
|
|
552212
|
-
throw new
|
|
552356
|
+
throw new CliError({ message: "Name is missing for request wrapper", code: CliError.Code.InternalError });
|
|
552213
552357
|
}
|
|
552214
552358
|
return SdkRequestShape.wrapper({
|
|
552215
552359
|
wrapperName: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552389,7 +552533,7 @@ function parseErrorName({ errorName, file: file4 }) {
|
|
|
552389
552533
|
imports: file4.imports
|
|
552390
552534
|
});
|
|
552391
552535
|
if (reference4 == null) {
|
|
552392
|
-
throw new
|
|
552536
|
+
throw new CliError({ message: "Failed to locate error " + errorName, code: CliError.Code.ResolutionError });
|
|
552393
552537
|
}
|
|
552394
552538
|
const nameWithoutId = {
|
|
552395
552539
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -552859,7 +553003,10 @@ function validateObjectExample({ typeName, typeNameForBreadcrumb, rawObject, fil
|
|
|
552859
553003
|
} else {
|
|
552860
553004
|
const definitionFile = getDefinitionFile(workspace, propertyWithPath.filepathOfDeclaration);
|
|
552861
553005
|
if (definitionFile == null) {
|
|
552862
|
-
throw new
|
|
553006
|
+
throw new CliError({
|
|
553007
|
+
message: "Service file does not exist for property: " + propertyWithPath.wireKey,
|
|
553008
|
+
code: CliError.Code.InternalError
|
|
553009
|
+
});
|
|
552863
553010
|
}
|
|
552864
553011
|
violations.push(...validateTypeReferenceExample({
|
|
552865
553012
|
rawTypeReference: propertyWithPath.propertyType,
|
|
@@ -553334,7 +553481,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553334
553481
|
base64: () => validateString(example),
|
|
553335
553482
|
bigInteger: () => validateString(example),
|
|
553336
553483
|
_other: () => {
|
|
553337
|
-
throw new
|
|
553484
|
+
throw new CliError({
|
|
553485
|
+
message: "Unknown primitive type v2: " + primitiveType2.v2,
|
|
553486
|
+
code: CliError.Code.InternalError
|
|
553487
|
+
});
|
|
553338
553488
|
}
|
|
553339
553489
|
});
|
|
553340
553490
|
}
|
|
@@ -553354,7 +553504,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553354
553504
|
base64: () => validateString(example),
|
|
553355
553505
|
bigInteger: () => validateString(example),
|
|
553356
553506
|
_other: () => {
|
|
553357
|
-
throw new
|
|
553507
|
+
throw new CliError({
|
|
553508
|
+
message: "Unknown primitive type: " + primitiveType2.v1,
|
|
553509
|
+
code: CliError.Code.InternalError
|
|
553510
|
+
});
|
|
553358
553511
|
}
|
|
553359
553512
|
});
|
|
553360
553513
|
}
|
|
@@ -553577,7 +553730,10 @@ function convertEnumTypeDeclaration({ _enum: _enum3, file: file4 }) {
|
|
|
553577
553730
|
if (_enum3.default != null) {
|
|
553578
553731
|
defaultValue = values2.find((enumValue) => getWireValue(enumValue.name) === _enum3.default);
|
|
553579
553732
|
if (defaultValue == null) {
|
|
553580
|
-
throw new
|
|
553733
|
+
throw new CliError({
|
|
553734
|
+
message: `Default value ${_enum3.default} not found in enum values`,
|
|
553735
|
+
code: CliError.Code.ValidationError
|
|
553736
|
+
});
|
|
553581
553737
|
}
|
|
553582
553738
|
}
|
|
553583
553739
|
return {
|
|
@@ -553646,18 +553802,27 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553646
553802
|
discriminatedUnion: (rawUnion) => {
|
|
553647
553803
|
const discriminant21 = getUnionDiscriminant(rawUnion);
|
|
553648
553804
|
if (!isPlainObject4(example)) {
|
|
553649
|
-
throw new
|
|
553805
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553650
553806
|
}
|
|
553651
553807
|
const discriminantValueForExample = example[discriminant21];
|
|
553652
553808
|
if (discriminantValueForExample == null) {
|
|
553653
|
-
throw new
|
|
553809
|
+
throw new CliError({
|
|
553810
|
+
message: "Example is missing discriminant: " + discriminant21,
|
|
553811
|
+
code: CliError.Code.ValidationError
|
|
553812
|
+
});
|
|
553654
553813
|
}
|
|
553655
553814
|
if (typeof discriminantValueForExample !== "string") {
|
|
553656
|
-
throw new
|
|
553815
|
+
throw new CliError({
|
|
553816
|
+
message: "Discriminant value is not a string",
|
|
553817
|
+
code: CliError.Code.ValidationError
|
|
553818
|
+
});
|
|
553657
553819
|
}
|
|
553658
553820
|
const rawSingleUnionType = rawUnion.union[discriminantValueForExample];
|
|
553659
553821
|
if (rawSingleUnionType == null) {
|
|
553660
|
-
throw new
|
|
553822
|
+
throw new CliError({
|
|
553823
|
+
message: `${discriminantValueForExample} is not one of the specified discriminant values.`,
|
|
553824
|
+
code: CliError.Code.ValidationError
|
|
553825
|
+
});
|
|
553661
553826
|
}
|
|
553662
553827
|
const rawValueType = typeof rawSingleUnionType === "string" ? rawSingleUnionType : typeof rawSingleUnionType.type === "string" ? rawSingleUnionType.type : void 0;
|
|
553663
553828
|
const baseProperties = Object.entries(rawUnion["base-properties"] ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553688,7 +553853,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553688
553853
|
referenceToNamedType: extendedTypeName
|
|
553689
553854
|
});
|
|
553690
553855
|
if (resolvedExtendedType._type !== "named" || !isRawObjectDefinition(resolvedExtendedType.declaration)) {
|
|
553691
|
-
throw new
|
|
553856
|
+
throw new CliError({
|
|
553857
|
+
message: "Extended type is not a named object",
|
|
553858
|
+
code: CliError.Code.InternalError
|
|
553859
|
+
});
|
|
553692
553860
|
}
|
|
553693
553861
|
const extendedObject = resolvedExtendedType.declaration;
|
|
553694
553862
|
const propertiesFromExtension = Object.entries(extendedObject.properties ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553741,7 +553909,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553741
553909
|
enum: (rawEnum) => {
|
|
553742
553910
|
if (typeof example !== "string") {
|
|
553743
553911
|
const validValues = rawEnum.enum.map((enumEntry) => typeof enumEntry === "string" ? enumEntry : enumEntry.value).join(", ");
|
|
553744
|
-
throw new
|
|
553912
|
+
throw new CliError({
|
|
553913
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553914
|
+
code: CliError.Code.ValidationError
|
|
553915
|
+
});
|
|
553745
553916
|
}
|
|
553746
553917
|
return ExampleTypeShape.enum({
|
|
553747
553918
|
value: fileContainingExample.casingsGenerator.generateNameAndWireValue({
|
|
@@ -553782,7 +553953,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553782
553953
|
return typeof variant === "string" ? variant : variant.type;
|
|
553783
553954
|
});
|
|
553784
553955
|
const validValues = variantOptions.join(", ");
|
|
553785
|
-
throw new
|
|
553956
|
+
throw new CliError({
|
|
553957
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553958
|
+
code: CliError.Code.ValidationError
|
|
553959
|
+
});
|
|
553786
553960
|
}
|
|
553787
553961
|
});
|
|
553788
553962
|
}
|
|
@@ -553809,7 +553983,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553809
553983
|
},
|
|
553810
553984
|
map: ({ keyType, valueType }) => {
|
|
553811
553985
|
if (!isPlainObject4(resolvedExample)) {
|
|
553812
|
-
throw new
|
|
553986
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553813
553987
|
}
|
|
553814
553988
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553815
553989
|
return ExampleTypeReferenceShape.container(ExampleContainer.map({
|
|
@@ -553841,7 +554015,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553841
554015
|
},
|
|
553842
554016
|
list: (itemType) => {
|
|
553843
554017
|
if (!Array.isArray(resolvedExample)) {
|
|
553844
|
-
throw new
|
|
554018
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553845
554019
|
}
|
|
553846
554020
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553847
554021
|
return ExampleTypeReferenceShape.container(ExampleContainer.list({
|
|
@@ -553860,7 +554034,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553860
554034
|
},
|
|
553861
554035
|
set: (itemType) => {
|
|
553862
554036
|
if (!Array.isArray(resolvedExample)) {
|
|
553863
|
-
throw new
|
|
554037
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553864
554038
|
}
|
|
553865
554039
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553866
554040
|
return ExampleTypeReferenceShape.container(ExampleContainer.set({
|
|
@@ -553930,7 +554104,10 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553930
554104
|
});
|
|
553931
554105
|
const parsedReferenceToNamedType = fileContainingRawTypeReference.parseTypeReference(named);
|
|
553932
554106
|
if (parsedReferenceToNamedType.type !== "named") {
|
|
553933
|
-
throw new
|
|
554107
|
+
throw new CliError({
|
|
554108
|
+
message: "Type reference is not to a named type.",
|
|
554109
|
+
code: CliError.Code.InternalError
|
|
554110
|
+
});
|
|
553934
554111
|
}
|
|
553935
554112
|
const typeName = {
|
|
553936
554113
|
typeId: parsedReferenceToNamedType.typeId,
|
|
@@ -554088,13 +554265,19 @@ function convertPrimitiveExample({ example, typeBeingExemplified }) {
|
|
|
554088
554265
|
}));
|
|
554089
554266
|
},
|
|
554090
554267
|
_other: () => {
|
|
554091
|
-
throw new
|
|
554268
|
+
throw new CliError({
|
|
554269
|
+
message: "Unknown primitive type: " + typeBeingExemplified,
|
|
554270
|
+
code: CliError.Code.InternalError
|
|
554271
|
+
});
|
|
554092
554272
|
}
|
|
554093
554273
|
});
|
|
554094
554274
|
}
|
|
554095
554275
|
function convertObject4({ typeName, rawObject, example, fileContainingType, fileContainingExample, typeResolver, exampleResolver, workspace, recursionContext }) {
|
|
554096
554276
|
if (!isPlainObject4(example)) {
|
|
554097
|
-
throw new
|
|
554277
|
+
throw new CliError({
|
|
554278
|
+
message: `Example is not an object. Got: ${JSON.stringify(example)}`,
|
|
554279
|
+
code: CliError.Code.ValidationError
|
|
554280
|
+
});
|
|
554098
554281
|
}
|
|
554099
554282
|
const properties7 = Object.entries(example).map(([wireKey, propertyExample]) => {
|
|
554100
554283
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
@@ -554169,7 +554352,10 @@ function getOriginalTypeDeclarationForPropertyFromExtensions({ wirePropertyKey,
|
|
|
554169
554352
|
file: file4
|
|
554170
554353
|
});
|
|
554171
554354
|
if (resolvedType._type !== "named" || !isRawObjectDefinition(resolvedType.declaration)) {
|
|
554172
|
-
throw new
|
|
554355
|
+
throw new CliError({
|
|
554356
|
+
message: "Extension is not of a named object",
|
|
554357
|
+
code: CliError.Code.InternalError
|
|
554358
|
+
});
|
|
554173
554359
|
}
|
|
554174
554360
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
554175
554361
|
wirePropertyKey,
|
|
@@ -554206,7 +554392,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554206
554392
|
switch (parsedSingleUnionTypeProperties.propertiesType) {
|
|
554207
554393
|
case "singleProperty": {
|
|
554208
554394
|
if (!isPlainObject4(example)) {
|
|
554209
|
-
throw new
|
|
554395
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554210
554396
|
}
|
|
554211
554397
|
return {
|
|
554212
554398
|
wireDiscriminantValue,
|
|
@@ -554224,7 +554410,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554224
554410
|
}
|
|
554225
554411
|
case "samePropertiesAsObject": {
|
|
554226
554412
|
if (!isPlainObject4(example)) {
|
|
554227
|
-
throw new
|
|
554413
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554228
554414
|
}
|
|
554229
554415
|
let rawDeclaration = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
554230
554416
|
referenceToNamedType: rawValueType,
|
|
@@ -554237,7 +554423,10 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554237
554423
|
});
|
|
554238
554424
|
}
|
|
554239
554425
|
if (!isRawObjectDefinition(rawDeclaration.declaration)) {
|
|
554240
|
-
throw new
|
|
554426
|
+
throw new CliError({
|
|
554427
|
+
message: `${rawValueType} is not an object`,
|
|
554428
|
+
code: CliError.Code.ValidationError
|
|
554429
|
+
});
|
|
554241
554430
|
}
|
|
554242
554431
|
const typeName = {
|
|
554243
554432
|
typeId: parsedSingleUnionTypeProperties.typeId,
|
|
@@ -554320,7 +554509,10 @@ function convertExampleEndpointCall2({ service, endpoint: endpoint3, example, ty
|
|
|
554320
554509
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
554321
554510
|
const queryParameterDeclaration = typeof endpoint3.request !== "string" ? endpoint3.request?.["query-parameters"]?.[wireKey] : void 0;
|
|
554322
554511
|
if (queryParameterDeclaration == null) {
|
|
554323
|
-
throw new
|
|
554512
|
+
throw new CliError({
|
|
554513
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
554514
|
+
code: CliError.Code.ReferenceError
|
|
554515
|
+
});
|
|
554324
554516
|
}
|
|
554325
554517
|
const isAllowMultiple = typeof queryParameterDeclaration !== "string" && queryParameterDeclaration["allow-multiple"] === true;
|
|
554326
554518
|
const rawType = typeof queryParameterDeclaration === "string" ? queryParameterDeclaration : queryParameterDeclaration.type;
|
|
@@ -554429,7 +554621,10 @@ function convertPathParameters({ service, endpoint: endpoint3, example, typeReso
|
|
|
554429
554621
|
examplePathParameter
|
|
554430
554622
|
}));
|
|
554431
554623
|
} else {
|
|
554432
|
-
throw new
|
|
554624
|
+
throw new CliError({
|
|
554625
|
+
message: `Path parameter ${key2} does not exist`,
|
|
554626
|
+
code: CliError.Code.ReferenceError
|
|
554627
|
+
});
|
|
554433
554628
|
}
|
|
554434
554629
|
}
|
|
554435
554630
|
}
|
|
@@ -554509,7 +554704,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554509
554704
|
return void 0;
|
|
554510
554705
|
}
|
|
554511
554706
|
if (!isPlainObject4(example.request)) {
|
|
554512
|
-
throw new
|
|
554707
|
+
throw new CliError({
|
|
554708
|
+
message: `Example is not an object. Got: ${JSON.stringify(example.request)}`,
|
|
554709
|
+
code: CliError.Code.ValidationError
|
|
554710
|
+
});
|
|
554513
554711
|
}
|
|
554514
554712
|
const exampleProperties = [];
|
|
554515
554713
|
const exampleExtraProperties = [];
|
|
@@ -554559,7 +554757,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554559
554757
|
});
|
|
554560
554758
|
continue;
|
|
554561
554759
|
}
|
|
554562
|
-
throw new
|
|
554760
|
+
throw new CliError({
|
|
554761
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
554762
|
+
code: CliError.Code.ResolutionError
|
|
554763
|
+
});
|
|
554563
554764
|
}
|
|
554564
554765
|
exampleProperties.push({
|
|
554565
554766
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -554944,7 +555145,7 @@ function getPaginationPropertyComponents(endpointPagination) {
|
|
|
554944
555145
|
results: getResponsePropertyComponents(endpointPagination.results)
|
|
554945
555146
|
};
|
|
554946
555147
|
}
|
|
554947
|
-
throw new
|
|
555148
|
+
throw new CliError({ message: "Invalid pagination schema", code: CliError.Code.ValidationError });
|
|
554948
555149
|
}
|
|
554949
555150
|
function isRawCursorPaginationSchema(rawPaginationSchema) {
|
|
554950
555151
|
return rawPaginationSchema.cursor != null;
|
|
@@ -555115,7 +555316,10 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555115
555316
|
return void 0;
|
|
555116
555317
|
}
|
|
555117
555318
|
if (isHttpService && isGrpcEndpoint) {
|
|
555118
|
-
throw new
|
|
555319
|
+
throw new CliError({
|
|
555320
|
+
message: "Cannot have a grpc endpoint on an http service",
|
|
555321
|
+
code: CliError.Code.ValidationError
|
|
555322
|
+
});
|
|
555119
555323
|
}
|
|
555120
555324
|
if (isGrpcService && isHttpEndpoint) {
|
|
555121
555325
|
return Transport.http();
|
|
@@ -555129,8 +555333,11 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555129
555333
|
return createProtobufService(file4, protoSource, sourceResolver, serviceNameOverride);
|
|
555130
555334
|
}
|
|
555131
555335
|
}
|
|
555132
|
-
throw new
|
|
555133
|
-
|
|
555336
|
+
throw new CliError({
|
|
555337
|
+
message: `Internal error; failed to determine endpoint transport for
|
|
555338
|
+
${JSON.stringify(endpointDeclaration)}"`,
|
|
555339
|
+
code: CliError.Code.InternalError
|
|
555340
|
+
});
|
|
555134
555341
|
}
|
|
555135
555342
|
function createProtobufService(file4, source2, sourceResolver, serviceNameOverride) {
|
|
555136
555343
|
const resolvedSource = sourceResolver.resolveSourceOrThrow({
|
|
@@ -555138,14 +555345,20 @@ function createProtobufService(file4, source2, sourceResolver, serviceNameOverri
|
|
|
555138
555345
|
relativeFilepath: file4.relativeFilepath
|
|
555139
555346
|
});
|
|
555140
555347
|
if (resolvedSource == null || resolvedSource.type !== "protobuf") {
|
|
555141
|
-
throw new
|
|
555348
|
+
throw new CliError({
|
|
555349
|
+
message: `Expected a protobuf source for ${source2.proto}.`,
|
|
555350
|
+
code: CliError.Code.ResolutionError
|
|
555351
|
+
});
|
|
555142
555352
|
}
|
|
555143
555353
|
const protobufService = convertProtobufService({
|
|
555144
555354
|
source: resolvedSource,
|
|
555145
555355
|
serviceNameOverride
|
|
555146
555356
|
});
|
|
555147
555357
|
if (protobufService == null) {
|
|
555148
|
-
throw new
|
|
555358
|
+
throw new CliError({
|
|
555359
|
+
message: `Failed to resolve service name from ${resolvedSource.relativeFilePath}.`,
|
|
555360
|
+
code: CliError.Code.IrConversionError
|
|
555361
|
+
});
|
|
555149
555362
|
}
|
|
555150
555363
|
return Transport.grpc({
|
|
555151
555364
|
service: protobufService
|
|
@@ -555357,7 +555570,7 @@ function resolvePathParameterOrThrow({ parameter: parameter6, variableResolver,
|
|
|
555357
555570
|
file: file4
|
|
555358
555571
|
});
|
|
555359
555572
|
if (resolved == null) {
|
|
555360
|
-
throw new
|
|
555573
|
+
throw new CliError({ message: "Cannot resolve path parameter", code: CliError.Code.InternalError });
|
|
555361
555574
|
}
|
|
555362
555575
|
return resolved;
|
|
555363
555576
|
}
|
|
@@ -555638,7 +555851,10 @@ var DynamicSnippetsConverter = class {
|
|
|
555638
555851
|
return dynamic_exports.Request.body({ pathParameters, body: void 0 });
|
|
555639
555852
|
}
|
|
555640
555853
|
if (endpoint3.sdkRequest == null) {
|
|
555641
|
-
throw new
|
|
555854
|
+
throw new CliError({
|
|
555855
|
+
message: `Internal error; endpoint "${endpoint3.id}" has a request body but no SDK request`,
|
|
555856
|
+
code: CliError.Code.InternalError
|
|
555857
|
+
});
|
|
555642
555858
|
}
|
|
555643
555859
|
switch (endpoint3.sdkRequest.shape.type) {
|
|
555644
555860
|
case "justRequestBody":
|
|
@@ -556131,7 +556347,7 @@ var DynamicSnippetsConverter = class {
|
|
|
556131
556347
|
}))
|
|
556132
556348
|
}),
|
|
556133
556349
|
_other: () => {
|
|
556134
|
-
throw new
|
|
556350
|
+
throw new CliError({ message: "Unknown environments type", code: CliError.Code.InternalError });
|
|
556135
556351
|
}
|
|
556136
556352
|
})
|
|
556137
556353
|
};
|
|
@@ -556168,10 +556384,16 @@ var DynamicSnippetsConverter = class {
|
|
|
556168
556384
|
resolveObjectTypeOrThrow(typeId) {
|
|
556169
556385
|
const typeDeclaration2 = this.ir.types[typeId];
|
|
556170
556386
|
if (typeDeclaration2 == null) {
|
|
556171
|
-
throw new
|
|
556387
|
+
throw new CliError({
|
|
556388
|
+
message: `Internal error; type "${typeId}" not found`,
|
|
556389
|
+
code: CliError.Code.InternalError
|
|
556390
|
+
});
|
|
556172
556391
|
}
|
|
556173
556392
|
if (typeDeclaration2.shape.type !== "object") {
|
|
556174
|
-
throw new
|
|
556393
|
+
throw new CliError({
|
|
556394
|
+
message: `Internal error; type "${typeId}" is not an object`,
|
|
556395
|
+
code: CliError.Code.InternalError
|
|
556396
|
+
});
|
|
556175
556397
|
}
|
|
556176
556398
|
return typeDeclaration2.shape;
|
|
556177
556399
|
}
|
|
@@ -556456,7 +556678,10 @@ function convertOAuthClientCredentials({ propertyResolver, endpointResolver, typ
|
|
|
556456
556678
|
tokenEndpoint
|
|
556457
556679
|
});
|
|
556458
556680
|
if (oauthTokenEndpoint == null) {
|
|
556459
|
-
throw new
|
|
556681
|
+
throw new CliError({
|
|
556682
|
+
message: "Failed to convert OAuth token endpoint.",
|
|
556683
|
+
code: CliError.Code.IrConversionError
|
|
556684
|
+
});
|
|
556460
556685
|
}
|
|
556461
556686
|
const refreshEndpoint = refreshTokenEndpoint != null ? convertOAuthRefreshEndpoint({
|
|
556462
556687
|
propertyResolver,
|
|
@@ -556634,7 +556859,7 @@ function convertSchemeReference2({ reference: reference4, authSchemeDeclarations
|
|
|
556634
556859
|
const convertNamedAuthSchemeReference = (reference5, docs2) => {
|
|
556635
556860
|
const declaration = authSchemeDeclarations?.[reference5];
|
|
556636
556861
|
if (declaration == null) {
|
|
556637
|
-
throw new
|
|
556862
|
+
throw new CliError({ message: "Unknown auth scheme: " + reference5, code: CliError.Code.ReferenceError });
|
|
556638
556863
|
}
|
|
556639
556864
|
return visitRawAuthSchemeDeclaration(declaration, {
|
|
556640
556865
|
header: (rawHeader) => AuthScheme.header({
|
|
@@ -556746,7 +556971,10 @@ function generateOAuth({ key: key2, file: file4, docs: docs2, rawScheme, propert
|
|
|
556746
556971
|
}))
|
|
556747
556972
|
});
|
|
556748
556973
|
default:
|
|
556749
|
-
throw new
|
|
556974
|
+
throw new CliError({
|
|
556975
|
+
message: `Unknown OAuth type: '${rawScheme?.type}'`,
|
|
556976
|
+
code: CliError.Code.ValidationError
|
|
556977
|
+
});
|
|
556750
556978
|
}
|
|
556751
556979
|
}
|
|
556752
556980
|
function generateInferredAuth({ key: key2, file: file4, docs: docs2, rawScheme, propertyResolver, endpointResolver }) {
|
|
@@ -557010,7 +557238,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557010
557238
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
557011
557239
|
const queryParameterDeclaration = channel3["query-parameters"]?.[wireKey];
|
|
557012
557240
|
if (queryParameterDeclaration == null) {
|
|
557013
|
-
throw new
|
|
557241
|
+
throw new CliError({
|
|
557242
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
557243
|
+
code: CliError.Code.ReferenceError
|
|
557244
|
+
});
|
|
557014
557245
|
}
|
|
557015
557246
|
return {
|
|
557016
557247
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557035,7 +557266,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557035
557266
|
messages: example.messages.map((messageExample) => {
|
|
557036
557267
|
const message = channel3.messages?.[messageExample.type];
|
|
557037
557268
|
if (message == null) {
|
|
557038
|
-
throw new
|
|
557269
|
+
throw new CliError({
|
|
557270
|
+
message: `Message ${messageExample.type} does not exist`,
|
|
557271
|
+
code: CliError.Code.ReferenceError
|
|
557272
|
+
});
|
|
557039
557273
|
}
|
|
557040
557274
|
return {
|
|
557041
557275
|
type: messageExample.type,
|
|
@@ -557074,7 +557308,7 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557074
557308
|
}));
|
|
557075
557309
|
}
|
|
557076
557310
|
if (!isPlainObject4(example)) {
|
|
557077
|
-
throw new
|
|
557311
|
+
throw new CliError({ message: "Example must be an object", code: CliError.Code.ValidationError });
|
|
557078
557312
|
}
|
|
557079
557313
|
const exampleProperties = [];
|
|
557080
557314
|
for (const [wireKey, propertyExample] of Object.entries(example)) {
|
|
@@ -557104,7 +557338,10 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557104
557338
|
file: file4
|
|
557105
557339
|
});
|
|
557106
557340
|
if (originalTypeDeclaration == null) {
|
|
557107
|
-
throw new
|
|
557341
|
+
throw new CliError({
|
|
557342
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
557343
|
+
code: CliError.Code.ResolutionError
|
|
557344
|
+
});
|
|
557108
557345
|
}
|
|
557109
557346
|
exampleProperties.push({
|
|
557110
557347
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557188,7 +557425,10 @@ function convertChannelPathParameters({ channel: channel3, example, typeResolver
|
|
|
557188
557425
|
examplePathParameter
|
|
557189
557426
|
}));
|
|
557190
557427
|
} else {
|
|
557191
|
-
throw new
|
|
557428
|
+
throw new CliError({
|
|
557429
|
+
message: `Path parameter ${key2} does not exist`,
|
|
557430
|
+
code: CliError.Code.ReferenceError
|
|
557431
|
+
});
|
|
557192
557432
|
}
|
|
557193
557433
|
}
|
|
557194
557434
|
}
|
|
@@ -557339,7 +557579,10 @@ var ReadmeEndpointCache = class {
|
|
|
557339
557579
|
getEndpointForReadmeOrThrow(readmeEndpoint) {
|
|
557340
557580
|
const endpoint3 = this.getEndpointForReadme(readmeEndpoint);
|
|
557341
557581
|
if (endpoint3 == null) {
|
|
557342
|
-
throw new
|
|
557582
|
+
throw new CliError({
|
|
557583
|
+
message: `Endpoint not found for ${JSON.stringify(readmeEndpoint)}`,
|
|
557584
|
+
code: CliError.Code.ResolutionError
|
|
557585
|
+
});
|
|
557343
557586
|
}
|
|
557344
557587
|
return endpoint3;
|
|
557345
557588
|
}
|
|
@@ -557387,7 +557630,7 @@ function getReadmeEndpointObject({ endpoint: endpoint3 }) {
|
|
|
557387
557630
|
if (typeof endpoint3 === "string") {
|
|
557388
557631
|
const split2 = endpoint3.split(" ");
|
|
557389
557632
|
if (split2.length !== 2 || split2[0] == null || split2[1] == null) {
|
|
557390
|
-
throw new
|
|
557633
|
+
throw new CliError({ message: `invalid endpoint string: ${endpoint3}`, code: CliError.Code.ParseError });
|
|
557391
557634
|
}
|
|
557392
557635
|
return {
|
|
557393
557636
|
method: split2[0],
|
|
@@ -557484,7 +557727,10 @@ function convertWebhookExamples2({ webhook, examples, file: file4, typeResolver,
|
|
|
557484
557727
|
}));
|
|
557485
557728
|
}
|
|
557486
557729
|
if (!isPlainObject4(webhook.payload)) {
|
|
557487
|
-
throw new
|
|
557730
|
+
throw new CliError({
|
|
557731
|
+
message: `Example webhook payload is not an object. Got: ${JSON.stringify(webhook.payload)}`,
|
|
557732
|
+
code: CliError.Code.ValidationError
|
|
557733
|
+
});
|
|
557488
557734
|
}
|
|
557489
557735
|
return examples.map((example) => ({
|
|
557490
557736
|
docs: webhook.docs,
|
|
@@ -557876,7 +558122,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557876
558122
|
const genericInstantiation = typeof generic === "string" ? generic : generic.type;
|
|
557877
558123
|
const maybeGeneric = parseGeneric(genericInstantiation);
|
|
557878
558124
|
if (maybeGeneric == null) {
|
|
557879
|
-
throw new
|
|
558125
|
+
throw new CliError({
|
|
558126
|
+
message: `Invalid generic type definition: ${genericInstantiation}`,
|
|
558127
|
+
code: CliError.Code.ValidationError
|
|
558128
|
+
});
|
|
557880
558129
|
}
|
|
557881
558130
|
const resolvedBaseGeneric = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
557882
558131
|
referenceToNamedType: genericInstantiation,
|
|
@@ -557907,7 +558156,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557907
558156
|
extendedProperties: void 0
|
|
557908
558157
|
});
|
|
557909
558158
|
}
|
|
557910
|
-
throw new
|
|
558159
|
+
throw new CliError({
|
|
558160
|
+
message: `Generic type definition not supported: ${genericInstantiation}`,
|
|
558161
|
+
code: CliError.Code.ValidationError
|
|
558162
|
+
});
|
|
557911
558163
|
}
|
|
557912
558164
|
|
|
557913
558165
|
// ../generation/ir-generator/lib/converters/type-declarations/convertAliasTypeDeclaration.js
|
|
@@ -558299,7 +558551,10 @@ var PackageTreeGenerator = class {
|
|
|
558299
558551
|
addPackageRedirection({ from: from4, to: to10 }) {
|
|
558300
558552
|
const package_ = this.getPackageForFernFilepath(from4);
|
|
558301
558553
|
if (package_.navigationConfig != null) {
|
|
558302
|
-
throw new
|
|
558554
|
+
throw new CliError({
|
|
558555
|
+
message: "Found duplicate navigationConfig for package",
|
|
558556
|
+
code: CliError.Code.InternalError
|
|
558557
|
+
});
|
|
558303
558558
|
}
|
|
558304
558559
|
package_.navigationConfig = {
|
|
558305
558560
|
pointsTo: IdGenerator.generateSubpackageId(to10)
|
|
@@ -558308,7 +558563,7 @@ var PackageTreeGenerator = class {
|
|
|
558308
558563
|
addDocs(fernFilepath, docs2) {
|
|
558309
558564
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558310
558565
|
if (package_.docs != null) {
|
|
558311
|
-
throw new
|
|
558566
|
+
throw new CliError({ message: "Found duplicate docs for package", code: CliError.Code.InternalError });
|
|
558312
558567
|
}
|
|
558313
558568
|
package_.docs = docs2;
|
|
558314
558569
|
}
|
|
@@ -558324,21 +558579,30 @@ var PackageTreeGenerator = class {
|
|
|
558324
558579
|
addService(serviceId, service) {
|
|
558325
558580
|
const package_ = this.getPackageForFernFilepath(service.name.fernFilepath);
|
|
558326
558581
|
if (package_.service != null) {
|
|
558327
|
-
throw new
|
|
558582
|
+
throw new CliError({
|
|
558583
|
+
message: "Found duplicate service for " + serviceId,
|
|
558584
|
+
code: CliError.Code.InternalError
|
|
558585
|
+
});
|
|
558328
558586
|
}
|
|
558329
558587
|
package_.service = serviceId;
|
|
558330
558588
|
}
|
|
558331
558589
|
addWebhookGroup(webhookGroupId, fernFilepath) {
|
|
558332
558590
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558333
558591
|
if (package_.webhooks != null) {
|
|
558334
|
-
throw new
|
|
558592
|
+
throw new CliError({
|
|
558593
|
+
message: "Found duplicate webhook group for " + webhookGroupId,
|
|
558594
|
+
code: CliError.Code.InternalError
|
|
558595
|
+
});
|
|
558335
558596
|
}
|
|
558336
558597
|
package_.webhooks = webhookGroupId;
|
|
558337
558598
|
}
|
|
558338
558599
|
addWebSocketChannel(websocketChannelId, fernFilepath) {
|
|
558339
558600
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558340
558601
|
if (package_.webhooks != null) {
|
|
558341
|
-
throw new
|
|
558602
|
+
throw new CliError({
|
|
558603
|
+
message: "Found duplicate webhook group for " + websocketChannelId,
|
|
558604
|
+
code: CliError.Code.InternalError
|
|
558605
|
+
});
|
|
558342
558606
|
}
|
|
558343
558607
|
package_.websocket = websocketChannelId;
|
|
558344
558608
|
}
|
|
@@ -558381,24 +558645,33 @@ var PackageTreeGenerator = class {
|
|
|
558381
558645
|
}
|
|
558382
558646
|
sortRootPackage(subpackagesInOrder) {
|
|
558383
558647
|
if (!isEqualIgnoreOrder(this.rootPackage.subpackages, subpackagesInOrder)) {
|
|
558384
|
-
throw new
|
|
558648
|
+
throw new CliError({
|
|
558649
|
+
message: "Sorted subpackages differ from unsorted packages in root",
|
|
558650
|
+
code: CliError.Code.InternalError
|
|
558651
|
+
});
|
|
558385
558652
|
}
|
|
558386
558653
|
this.rootPackage.subpackages = subpackagesInOrder;
|
|
558387
558654
|
}
|
|
558388
558655
|
sortSubpackage(subpackageId, subpackagesInOrder) {
|
|
558389
558656
|
const subpackage = this.subpackages[subpackageId];
|
|
558390
558657
|
if (subpackage == null) {
|
|
558391
|
-
throw new
|
|
558658
|
+
throw new CliError({
|
|
558659
|
+
message: "Subpackage does not exist: " + subpackageId,
|
|
558660
|
+
code: CliError.Code.ResolutionError
|
|
558661
|
+
});
|
|
558392
558662
|
}
|
|
558393
558663
|
if (!isEqualIgnoreOrder(subpackage.subpackages, subpackagesInOrder)) {
|
|
558394
|
-
throw new
|
|
558664
|
+
throw new CliError({
|
|
558665
|
+
message: "Sorted subpackages differ from unsorted packages",
|
|
558666
|
+
code: CliError.Code.InternalError
|
|
558667
|
+
});
|
|
558395
558668
|
}
|
|
558396
558669
|
subpackage.subpackages = subpackagesInOrder;
|
|
558397
558670
|
}
|
|
558398
558671
|
getAllSubpackagesWithEndpoints(root6) {
|
|
558399
558672
|
const subpackage = this.subpackages[root6];
|
|
558400
558673
|
if (subpackage == null) {
|
|
558401
|
-
throw new
|
|
558674
|
+
throw new CliError({ message: "Subpackage does not exist: " + root6, code: CliError.Code.ResolutionError });
|
|
558402
558675
|
}
|
|
558403
558676
|
const subpackagesWithEndpoints = this.getAllChildrenWithEndpoints(subpackage);
|
|
558404
558677
|
if (subpackagesWithEndpoints.length > 0 || subpackage.service != null) {
|
|
@@ -558419,7 +558692,10 @@ var PackageTreeGenerator = class {
|
|
|
558419
558692
|
const subpackagesInParent = parent.subpackages.map((subpackageId) => {
|
|
558420
558693
|
const subpackage = this.subpackages[subpackageId];
|
|
558421
558694
|
if (subpackage == null) {
|
|
558422
|
-
throw new
|
|
558695
|
+
throw new CliError({
|
|
558696
|
+
message: "Subpackage ID is invalid: " + subpackageId,
|
|
558697
|
+
code: CliError.Code.InternalError
|
|
558698
|
+
});
|
|
558423
558699
|
}
|
|
558424
558700
|
return subpackage;
|
|
558425
558701
|
});
|
|
@@ -558498,7 +558774,10 @@ var EndpointResolverImpl = class {
|
|
|
558498
558774
|
resolveEndpointOrThrow({ endpoint: endpoint3, file: file4 }) {
|
|
558499
558775
|
const resolvedEndpoint = this.resolveEndpoint({ endpoint: endpoint3, file: file4 });
|
|
558500
558776
|
if (resolvedEndpoint == null) {
|
|
558501
|
-
throw new
|
|
558777
|
+
throw new CliError({
|
|
558778
|
+
message: "Cannot resolve endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
558779
|
+
code: CliError.Code.ResolutionError
|
|
558780
|
+
});
|
|
558502
558781
|
}
|
|
558503
558782
|
return resolvedEndpoint;
|
|
558504
558783
|
}
|
|
@@ -558626,7 +558905,10 @@ var ErrorResolverImpl = class {
|
|
|
558626
558905
|
getDeclarationOrThrow(referenceToError, file4) {
|
|
558627
558906
|
const declaration = this.getDeclaration(referenceToError, file4);
|
|
558628
558907
|
if (declaration == null) {
|
|
558629
|
-
throw new
|
|
558908
|
+
throw new CliError({
|
|
558909
|
+
message: "Error does not exist: " + referenceToError,
|
|
558910
|
+
code: CliError.Code.ResolutionError
|
|
558911
|
+
});
|
|
558630
558912
|
}
|
|
558631
558913
|
return declaration;
|
|
558632
558914
|
}
|
|
@@ -558712,7 +558994,7 @@ var ExampleResolverImpl = class {
|
|
|
558712
558994
|
resolveAllReferencesInExampleOrThrow({ example, file: file4 }) {
|
|
558713
558995
|
const resolvedExample = this.resolveAllReferencesInExample({ example, file: file4 });
|
|
558714
558996
|
if (resolvedExample == null) {
|
|
558715
|
-
throw new
|
|
558997
|
+
throw new CliError({ message: "Failed to resolve examples", code: CliError.Code.ResolutionError });
|
|
558716
558998
|
}
|
|
558717
558999
|
return resolvedExample;
|
|
558718
559000
|
}
|
|
@@ -558759,7 +559041,7 @@ var ExampleResolverImpl = class {
|
|
|
558759
559041
|
resolveExampleOrThrow({ example, file: file4 }) {
|
|
558760
559042
|
const resolvedExample = this.resolveExample({ example, file: file4 });
|
|
558761
559043
|
if (resolvedExample == null) {
|
|
558762
|
-
throw new
|
|
559044
|
+
throw new CliError({ message: "Cannot resolve example: " + example, code: CliError.Code.ResolutionError });
|
|
558763
559045
|
}
|
|
558764
559046
|
return resolvedExample;
|
|
558765
559047
|
}
|
|
@@ -558810,7 +559092,10 @@ var PropertyResolverImpl = class {
|
|
|
558810
559092
|
resolveRequestPropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558811
559093
|
const resolvedRequestProperty = this.resolveRequestProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558812
559094
|
if (resolvedRequestProperty == null) {
|
|
558813
|
-
throw new
|
|
559095
|
+
throw new CliError({
|
|
559096
|
+
message: "Cannot resolve request property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559097
|
+
code: CliError.Code.ResolutionError
|
|
559098
|
+
});
|
|
558814
559099
|
}
|
|
558815
559100
|
return resolvedRequestProperty;
|
|
558816
559101
|
}
|
|
@@ -558854,7 +559139,10 @@ var PropertyResolverImpl = class {
|
|
|
558854
559139
|
resolveResponsePropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558855
559140
|
const resolvedResponseProperty = this.resolveResponseProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558856
559141
|
if (resolvedResponseProperty == null) {
|
|
558857
|
-
throw new
|
|
559142
|
+
throw new CliError({
|
|
559143
|
+
message: "Cannot resolve response property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559144
|
+
code: CliError.Code.ResolutionError
|
|
559145
|
+
});
|
|
558858
559146
|
}
|
|
558859
559147
|
return resolvedResponseProperty;
|
|
558860
559148
|
}
|
|
@@ -559021,7 +559309,10 @@ var PropertyResolverImpl = class {
|
|
|
559021
559309
|
propertyComponents: breadcrumbs
|
|
559022
559310
|
});
|
|
559023
559311
|
if (!currentType) {
|
|
559024
|
-
throw new
|
|
559312
|
+
throw new CliError({
|
|
559313
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in inline request body in file ${file4.relativeFilepath}`,
|
|
559314
|
+
code: CliError.Code.InternalError
|
|
559315
|
+
});
|
|
559025
559316
|
}
|
|
559026
559317
|
result.push({
|
|
559027
559318
|
name: file4.casingsGenerator.generateName(component),
|
|
@@ -559039,7 +559330,10 @@ function getNestedObjectPropertyTypeOrThrow({ typeResolver, file: file4, resolve
|
|
|
559039
559330
|
propertyName
|
|
559040
559331
|
});
|
|
559041
559332
|
if (!nestedPropertyType) {
|
|
559042
|
-
throw new
|
|
559333
|
+
throw new CliError({
|
|
559334
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in ${rootTypeLabel}`,
|
|
559335
|
+
code: CliError.Code.InternalError
|
|
559336
|
+
});
|
|
559043
559337
|
}
|
|
559044
559338
|
return nestedPropertyType;
|
|
559045
559339
|
}
|
|
@@ -559216,14 +559510,20 @@ var TypeResolverImpl = class {
|
|
|
559216
559510
|
resolveTypeOrThrow({ type: type8, file: file4 }) {
|
|
559217
559511
|
const resolvedType = this.resolveType({ type: type8, file: file4 });
|
|
559218
559512
|
if (resolvedType == null) {
|
|
559219
|
-
throw new
|
|
559513
|
+
throw new CliError({
|
|
559514
|
+
message: "Cannot resolve type: " + type8 + " in file " + file4.relativeFilepath,
|
|
559515
|
+
code: CliError.Code.ResolutionError
|
|
559516
|
+
});
|
|
559220
559517
|
}
|
|
559221
559518
|
return resolvedType;
|
|
559222
559519
|
}
|
|
559223
559520
|
getDeclarationOfNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559224
559521
|
const declaration = this.getDeclarationOfNamedType({ referenceToNamedType, file: file4 });
|
|
559225
559522
|
if (declaration == null) {
|
|
559226
|
-
throw new
|
|
559523
|
+
throw new CliError({
|
|
559524
|
+
message: "Cannot find declaration of type: " + referenceToNamedType + " in file " + file4.relativeFilepath,
|
|
559525
|
+
code: CliError.Code.ResolutionError
|
|
559526
|
+
});
|
|
559227
559527
|
}
|
|
559228
559528
|
return declaration;
|
|
559229
559529
|
}
|
|
@@ -559366,7 +559666,10 @@ var TypeResolverImpl = class {
|
|
|
559366
559666
|
resolveNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559367
559667
|
const resolvedType = this.resolveNamedType({ referenceToNamedType, file: file4 });
|
|
559368
559668
|
if (resolvedType == null) {
|
|
559369
|
-
throw new
|
|
559669
|
+
throw new CliError({
|
|
559670
|
+
message: "Cannot resolve type: " + referenceToNamedType,
|
|
559671
|
+
code: CliError.Code.ResolutionError
|
|
559672
|
+
});
|
|
559370
559673
|
}
|
|
559371
559674
|
return resolvedType;
|
|
559372
559675
|
}
|
|
@@ -559425,7 +559728,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559425
559728
|
getDeclarationOrThrow(referenceToVariable, file4) {
|
|
559426
559729
|
const declaration = this.getDeclaration(referenceToVariable, file4);
|
|
559427
559730
|
if (declaration == null) {
|
|
559428
|
-
throw new
|
|
559731
|
+
throw new CliError({
|
|
559732
|
+
message: "Variable does not exist: " + referenceToVariable,
|
|
559733
|
+
code: CliError.Code.ResolutionError
|
|
559734
|
+
});
|
|
559429
559735
|
}
|
|
559430
559736
|
return declaration;
|
|
559431
559737
|
}
|
|
@@ -559448,7 +559754,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559448
559754
|
getVariableIdOrThrow(referenceToVariable) {
|
|
559449
559755
|
const variableId = this.getVariableId(referenceToVariable);
|
|
559450
559756
|
if (variableId == null) {
|
|
559451
|
-
throw new
|
|
559757
|
+
throw new CliError({
|
|
559758
|
+
message: "Variable reference does not start with " + _VariableResolverImpl.VARIABLE_PREFIX,
|
|
559759
|
+
code: CliError.Code.ResolutionError
|
|
559760
|
+
});
|
|
559452
559761
|
}
|
|
559453
559762
|
return variableId;
|
|
559454
559763
|
}
|
|
@@ -559620,7 +559929,10 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
|
|
|
559620
559929
|
}
|
|
559621
559930
|
const errorDiscriminationSchema = workspace.definition.rootApiFile.contents["error-discrimination"];
|
|
559622
559931
|
if (errorDiscriminationSchema == null) {
|
|
559623
|
-
throw new
|
|
559932
|
+
throw new CliError({
|
|
559933
|
+
message: "error-discrimination is missing in api.yml but there are declared errors.",
|
|
559934
|
+
code: CliError.Code.ConfigError
|
|
559935
|
+
});
|
|
559624
559936
|
}
|
|
559625
559937
|
for (const [errorName, errorDeclaration] of Object.entries(errors4)) {
|
|
559626
559938
|
const convertedErrorDeclaration = convertErrorDeclaration({
|
|
@@ -614356,7 +614668,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614356
614668
|
properties: {
|
|
614357
614669
|
...event,
|
|
614358
614670
|
...event.properties,
|
|
614359
|
-
version: "4.
|
|
614671
|
+
version: "4.82.0",
|
|
614360
614672
|
usingAccessToken: true
|
|
614361
614673
|
}
|
|
614362
614674
|
});
|
|
@@ -614410,7 +614722,7 @@ var UserPosthogManager = class {
|
|
|
614410
614722
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614411
614723
|
event: "CLI",
|
|
614412
614724
|
properties: {
|
|
614413
|
-
version: "4.
|
|
614725
|
+
version: "4.82.0",
|
|
614414
614726
|
...event,
|
|
614415
614727
|
...event.properties,
|
|
614416
614728
|
usingAccessToken: false,
|
|
@@ -615614,7 +615926,10 @@ var PlatformKeyring = class {
|
|
|
615614
615926
|
await this.setPasswordWindows(service, account, password);
|
|
615615
615927
|
break;
|
|
615616
615928
|
default:
|
|
615617
|
-
throw new
|
|
615929
|
+
throw new CliError({
|
|
615930
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615931
|
+
code: CliError.Code.EnvironmentError
|
|
615932
|
+
});
|
|
615618
615933
|
}
|
|
615619
615934
|
}
|
|
615620
615935
|
async getPassword(service, account) {
|
|
@@ -615626,7 +615941,10 @@ var PlatformKeyring = class {
|
|
|
615626
615941
|
case "win32":
|
|
615627
615942
|
return this.getPasswordWindows(service, account);
|
|
615628
615943
|
default:
|
|
615629
|
-
throw new
|
|
615944
|
+
throw new CliError({
|
|
615945
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615946
|
+
code: CliError.Code.EnvironmentError
|
|
615947
|
+
});
|
|
615630
615948
|
}
|
|
615631
615949
|
}
|
|
615632
615950
|
async deletePassword(service, account) {
|
|
@@ -615638,7 +615956,10 @@ var PlatformKeyring = class {
|
|
|
615638
615956
|
case "win32":
|
|
615639
615957
|
return this.deletePasswordWindows(service, account);
|
|
615640
615958
|
default:
|
|
615641
|
-
throw new
|
|
615959
|
+
throw new CliError({
|
|
615960
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615961
|
+
code: CliError.Code.EnvironmentError
|
|
615962
|
+
});
|
|
615642
615963
|
}
|
|
615643
615964
|
}
|
|
615644
615965
|
async findCredentials(service) {
|
|
@@ -615650,7 +615971,10 @@ var PlatformKeyring = class {
|
|
|
615650
615971
|
case "win32":
|
|
615651
615972
|
return this.findCredentialsWindows(service);
|
|
615652
615973
|
default:
|
|
615653
|
-
throw new
|
|
615974
|
+
throw new CliError({
|
|
615975
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615976
|
+
code: CliError.Code.EnvironmentError
|
|
615977
|
+
});
|
|
615654
615978
|
}
|
|
615655
615979
|
}
|
|
615656
615980
|
async setPasswordDarwin(service, account, password) {
|
|
@@ -617763,7 +618087,10 @@ var FileFinder = class {
|
|
|
617763
618087
|
async findOrThrow({ filename, remediationMessage }) {
|
|
617764
618088
|
const filepath = await this.find({ filename });
|
|
617765
618089
|
if (filepath == null) {
|
|
617766
|
-
throw new
|
|
618090
|
+
throw new CliError({
|
|
618091
|
+
message: `${filename} file not found in any parent directory from ${this.from}`,
|
|
618092
|
+
code: CliError.Code.InternalError
|
|
618093
|
+
});
|
|
617767
618094
|
}
|
|
617768
618095
|
return filepath;
|
|
617769
618096
|
}
|
|
@@ -617805,7 +618132,10 @@ var FernYmlSchemaLoader = class {
|
|
|
617805
618132
|
async loadOrThrow() {
|
|
617806
618133
|
const loadResult = await this.load();
|
|
617807
618134
|
if (loadResult.type === "notFound") {
|
|
617808
|
-
throw new
|
|
618135
|
+
throw new CliError({
|
|
618136
|
+
message: `${FILENAME2} file not found in any parent directory; did you forget to run \`fern init\`?`,
|
|
618137
|
+
code: CliError.Code.InternalError
|
|
618138
|
+
});
|
|
617809
618139
|
}
|
|
617810
618140
|
if (loadResult.type === "failure") {
|
|
617811
618141
|
throw new SourcedValidationError(loadResult.issues);
|
|
@@ -617876,7 +618206,10 @@ var TelemetryClient = class _TelemetryClient {
|
|
|
617876
618206
|
if (sentryDsn != null && sentryDsn.length > 0 && isTelemetryEnabled) {
|
|
617877
618207
|
const sentryEnvironment = "development";
|
|
617878
618208
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
617879
|
-
throw new
|
|
618209
|
+
throw new CliError({
|
|
618210
|
+
message: "SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",
|
|
618211
|
+
code: CliError.Code.ConfigError
|
|
618212
|
+
});
|
|
617880
618213
|
}
|
|
617881
618214
|
this.sentry = init2({
|
|
617882
618215
|
dsn: sentryDsn,
|
|
@@ -617994,7 +618327,7 @@ var TelemetryClient = class _TelemetryClient {
|
|
|
617994
618327
|
return join8(AbsoluteFilePath2.of((0, import_os8.homedir)()), RelativeFilePath2.of(".fern"), RelativeFilePath2.of("id"));
|
|
617995
618328
|
}
|
|
617996
618329
|
/**
|
|
617997
|
-
* Returns true if telemetry
|
|
618330
|
+
* Returns true if telemetry is enabled.
|
|
617998
618331
|
*
|
|
617999
618332
|
* Priority:
|
|
618000
618333
|
* 1. FERN_TELEMETRY_DISABLED env var (any non-empty value)
|
|
@@ -618176,7 +618509,10 @@ var ApiDefinitionConverter = class {
|
|
|
618176
618509
|
sourced
|
|
618177
618510
|
});
|
|
618178
618511
|
}
|
|
618179
|
-
throw new
|
|
618512
|
+
throw new CliError({
|
|
618513
|
+
message: `Unknown spec type: ${JSON.stringify(spec)}`,
|
|
618514
|
+
code: CliError.Code.InternalError
|
|
618515
|
+
});
|
|
618180
618516
|
}
|
|
618181
618517
|
async convertOpenApiSpec({ absoluteFernYmlPath, spec, sourced }) {
|
|
618182
618518
|
const result = {
|
|
@@ -619536,7 +619872,10 @@ var LegacyApiSpecAdapter = class {
|
|
|
619536
619872
|
if (isOpenRpcSpec(spec)) {
|
|
619537
619873
|
return this.adaptOpenRpcSpec(spec);
|
|
619538
619874
|
}
|
|
619539
|
-
throw new
|
|
619875
|
+
throw new CliError({
|
|
619876
|
+
message: `Unsupported spec type: ${JSON.stringify(spec)}`,
|
|
619877
|
+
code: CliError.Code.InternalError
|
|
619878
|
+
});
|
|
619540
619879
|
}
|
|
619541
619880
|
convertAll(specs) {
|
|
619542
619881
|
return specs.map((spec) => this.adapt(spec));
|
|
@@ -746685,7 +747024,10 @@ var LegacyFernWorkspaceAdapter = class {
|
|
|
746685
747024
|
generatorsConfiguration: apiConfig != null ? this.buildGeneratorsConfiguration(apiConfig) : void 0
|
|
746686
747025
|
});
|
|
746687
747026
|
if (ossWorkspace == null) {
|
|
746688
|
-
throw new
|
|
747027
|
+
throw new CliError({
|
|
747028
|
+
message: "Internal error; failed to build API definitions",
|
|
747029
|
+
code: CliError.Code.InternalError
|
|
747030
|
+
});
|
|
746689
747031
|
}
|
|
746690
747032
|
return ossWorkspace.toFernWorkspace({ context: this.taskContext });
|
|
746691
747033
|
}
|
|
@@ -747842,7 +748184,10 @@ function addSplitCommand(cli) {
|
|
|
747842
748184
|
description: `Output format: '${OVERLAY_NAME}' (OpenAPI Overlay 1.0.0) or '${OVERRIDES_NAME}' (Fern deep-merge)`
|
|
747843
748185
|
}).coerce("format", (value2) => {
|
|
747844
748186
|
if (!ALL_FORMAT_NAMES.includes(value2)) {
|
|
747845
|
-
throw new
|
|
748187
|
+
throw new CliError({
|
|
748188
|
+
message: `Invalid format '${value2}'. Expected one of: ${OVERLAY_NAME}, ${OVERRIDES_NAME}`,
|
|
748189
|
+
code: CliError.Code.ValidationError
|
|
748190
|
+
});
|
|
747846
748191
|
}
|
|
747847
748192
|
return value2;
|
|
747848
748193
|
}));
|
|
@@ -788205,7 +788550,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788205
788550
|
this.context = context3;
|
|
788206
788551
|
const lambdaOrigin = "https://ykq45y6fvnszd35iv5yuuatkze0rpwuz.lambda-url.us-east-1.on.aws";
|
|
788207
788552
|
if (!lambdaOrigin) {
|
|
788208
|
-
throw new
|
|
788553
|
+
throw new CliError({
|
|
788554
|
+
message: "DEFAULT_FDR_LAMBDA_DOCS_ORIGIN environment variable is not set. AI example enhancement requires this to be configured.",
|
|
788555
|
+
code: CliError.Code.EnvironmentError
|
|
788556
|
+
});
|
|
788209
788557
|
}
|
|
788210
788558
|
this.lambdaOrigin = lambdaOrigin;
|
|
788211
788559
|
this.venusOrigin = "https://venus-dev2.buildwithfern.com";
|
|
@@ -788274,7 +788622,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788274
788622
|
});
|
|
788275
788623
|
if (!response.ok) {
|
|
788276
788624
|
const errorText = await response.text();
|
|
788277
|
-
throw new
|
|
788625
|
+
throw new CliError({
|
|
788626
|
+
message: `Failed to fetch JWT from Venus: ${response.status} ${errorText || response.statusText}`,
|
|
788627
|
+
code: CliError.Code.NetworkError
|
|
788628
|
+
});
|
|
788278
788629
|
}
|
|
788279
788630
|
const result = await response.json();
|
|
788280
788631
|
this.context.logger.debug(`Successfully obtained JWT from Venus (expires at ${result.expiresAt})`);
|
|
@@ -788336,7 +788687,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788336
788687
|
});
|
|
788337
788688
|
if (!response.ok) {
|
|
788338
788689
|
const errorText = await response.text();
|
|
788339
|
-
throw new
|
|
788690
|
+
throw new CliError({
|
|
788691
|
+
message: `Lambda returned ${response.status}: ${errorText || response.statusText}`,
|
|
788692
|
+
code: CliError.Code.NetworkError
|
|
788693
|
+
});
|
|
788340
788694
|
}
|
|
788341
788695
|
const result = await response.json();
|
|
788342
788696
|
return {
|
|
@@ -789849,7 +790203,10 @@ function convertTypeShape(irType) {
|
|
|
789849
790203
|
extraProperties: void 0
|
|
789850
790204
|
}),
|
|
789851
790205
|
_other: () => {
|
|
789852
|
-
throw new
|
|
790206
|
+
throw new CliError({
|
|
790207
|
+
message: "Unknown SingleUnionTypeProperties: " + variant.shape.propertiesType,
|
|
790208
|
+
code: CliError.Code.InternalError
|
|
790209
|
+
});
|
|
789853
790210
|
}
|
|
789854
790211
|
})
|
|
789855
790212
|
};
|
|
@@ -789874,7 +790231,7 @@ function convertTypeShape(irType) {
|
|
|
789874
790231
|
};
|
|
789875
790232
|
},
|
|
789876
790233
|
_other: () => {
|
|
789877
|
-
throw new
|
|
790234
|
+
throw new CliError({ message: "Unknown Type shape: " + irType.type, code: CliError.Code.InternalError });
|
|
789878
790235
|
}
|
|
789879
790236
|
});
|
|
789880
790237
|
}
|
|
@@ -789941,12 +790298,18 @@ function convertTypeReference3(irTypeReference) {
|
|
|
789941
790298
|
};
|
|
789942
790299
|
},
|
|
789943
790300
|
_other: () => {
|
|
789944
|
-
throw new
|
|
790301
|
+
throw new CliError({
|
|
790302
|
+
message: "Unknown literal type: " + literal3.type,
|
|
790303
|
+
code: CliError.Code.InternalError
|
|
790304
|
+
});
|
|
789945
790305
|
}
|
|
789946
790306
|
});
|
|
789947
790307
|
},
|
|
789948
790308
|
_other: () => {
|
|
789949
|
-
throw new
|
|
790309
|
+
throw new CliError({
|
|
790310
|
+
message: "Unknown container reference: " + container.type,
|
|
790311
|
+
code: CliError.Code.InternalError
|
|
790312
|
+
});
|
|
789950
790313
|
}
|
|
789951
790314
|
});
|
|
789952
790315
|
},
|
|
@@ -790026,7 +790389,10 @@ function convertTypeReference3(irTypeReference) {
|
|
|
790026
790389
|
};
|
|
790027
790390
|
},
|
|
790028
790391
|
_other: () => {
|
|
790029
|
-
throw new
|
|
790392
|
+
throw new CliError({
|
|
790393
|
+
message: "Unknown primitive: " + primitive.v1,
|
|
790394
|
+
code: CliError.Code.InternalError
|
|
790395
|
+
});
|
|
790030
790396
|
}
|
|
790031
790397
|
})
|
|
790032
790398
|
};
|
|
@@ -790037,7 +790403,10 @@ function convertTypeReference3(irTypeReference) {
|
|
|
790037
790403
|
};
|
|
790038
790404
|
},
|
|
790039
790405
|
_other: () => {
|
|
790040
|
-
throw new
|
|
790406
|
+
throw new CliError({
|
|
790407
|
+
message: "Unknown Type reference: " + irTypeReference.type,
|
|
790408
|
+
code: CliError.Code.InternalError
|
|
790409
|
+
});
|
|
790041
790410
|
}
|
|
790042
790411
|
});
|
|
790043
790412
|
}
|
|
@@ -790501,7 +790870,10 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
|
|
|
790501
790870
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790502
790871
|
const endpointBaseUrl = singleBaseUrlEnvironment.urls[baseUrlId];
|
|
790503
790872
|
if (endpointBaseUrl == null) {
|
|
790504
|
-
throw new
|
|
790873
|
+
throw new CliError({
|
|
790874
|
+
message: `Encountered undefined server name "${baseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${baseUrlId}`,
|
|
790875
|
+
code: CliError.Code.IrConversionError
|
|
790876
|
+
});
|
|
790505
790877
|
}
|
|
790506
790878
|
return {
|
|
790507
790879
|
id: FdrAPI_exports.EnvironmentId(baseUrlId),
|
|
@@ -790513,12 +790885,18 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
|
|
|
790513
790885
|
return environments2.filter((environment2, index3, self2) => index3 === self2.findIndex((t3) => t3.id === environment2.id && t3.baseUrl === environment2.baseUrl));
|
|
790514
790886
|
}
|
|
790515
790887
|
if (endpointBaseUrlId == null) {
|
|
790516
|
-
throw new
|
|
790888
|
+
throw new CliError({
|
|
790889
|
+
message: `Expected endpoint ${getOriginalName(endpoint3.name)} to have base url.`,
|
|
790890
|
+
code: CliError.Code.IrConversionError
|
|
790891
|
+
});
|
|
790517
790892
|
}
|
|
790518
790893
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790519
790894
|
const endpointBaseUrl = singleBaseUrlEnvironment.urls[endpointBaseUrlId];
|
|
790520
790895
|
if (endpointBaseUrl == null) {
|
|
790521
|
-
throw new
|
|
790896
|
+
throw new CliError({
|
|
790897
|
+
message: `Encountered undefined server name "${endpointBaseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${endpointBaseUrlId}`,
|
|
790898
|
+
code: CliError.Code.IrConversionError
|
|
790899
|
+
});
|
|
790522
790900
|
}
|
|
790523
790901
|
return {
|
|
790524
790902
|
id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
|
|
@@ -790544,12 +790922,18 @@ function convertIrWebSocketEnvironments({ environmentsConfig, channel: channel3
|
|
|
790544
790922
|
});
|
|
790545
790923
|
case "multipleBaseUrls":
|
|
790546
790924
|
if (channelBaseUrlId == null) {
|
|
790547
|
-
throw new
|
|
790925
|
+
throw new CliError({
|
|
790926
|
+
message: `Expected channel ${getOriginalName(channel3.name)} to have base url.`,
|
|
790927
|
+
code: CliError.Code.IrConversionError
|
|
790928
|
+
});
|
|
790548
790929
|
}
|
|
790549
790930
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790550
790931
|
const channelBaseUrl = singleBaseUrlEnvironment.urls[channelBaseUrlId];
|
|
790551
790932
|
if (channelBaseUrl == null) {
|
|
790552
|
-
throw new
|
|
790933
|
+
throw new CliError({
|
|
790934
|
+
message: `Encountered undefined server name ${channelBaseUrl} at channel ${getOriginalName(channel3.name)} ${channel3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${channelBaseUrlId}`,
|
|
790935
|
+
code: CliError.Code.IrConversionError
|
|
790936
|
+
});
|
|
790553
790937
|
}
|
|
790554
790938
|
return {
|
|
790555
790939
|
id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
|
|
@@ -790573,7 +790957,7 @@ function convertHttpMethod2(method8) {
|
|
|
790573
790957
|
delete: () => FdrAPI_exports.HttpMethod.Delete,
|
|
790574
790958
|
head: () => FdrAPI_exports.HttpMethod.Head,
|
|
790575
790959
|
_other: () => {
|
|
790576
|
-
throw new
|
|
790960
|
+
throw new CliError({ message: "Unknown http method: " + method8, code: CliError.Code.InternalError });
|
|
790577
790961
|
}
|
|
790578
790962
|
});
|
|
790579
790963
|
}
|
|
@@ -790689,7 +791073,10 @@ function convertRequestBody3(irRequest) {
|
|
|
790689
791073
|
contentType: bytes.contentType
|
|
790690
791074
|
}),
|
|
790691
791075
|
_other: () => {
|
|
790692
|
-
throw new
|
|
791076
|
+
throw new CliError({
|
|
791077
|
+
message: "Unknown HttpRequestBody: " + irRequest.type,
|
|
791078
|
+
code: CliError.Code.InternalError
|
|
791079
|
+
});
|
|
790693
791080
|
}
|
|
790694
791081
|
});
|
|
790695
791082
|
return requestBodyShape != null ? { type: requestBodyShape, description: irRequest.docs } : void 0;
|
|
@@ -790743,7 +791130,10 @@ function convertResponse2(irResponse) {
|
|
|
790743
791130
|
return void 0;
|
|
790744
791131
|
},
|
|
790745
791132
|
_other: () => {
|
|
790746
|
-
throw new
|
|
791133
|
+
throw new CliError({
|
|
791134
|
+
message: "Unknown HttpResponse: " + irResponse.body,
|
|
791135
|
+
code: CliError.Code.InternalError
|
|
791136
|
+
});
|
|
790747
791137
|
}
|
|
790748
791138
|
});
|
|
790749
791139
|
}
|
|
@@ -790983,7 +791373,10 @@ function convertV2HttpEndpointExample({ shouldUseExampleName, exampleName, examp
|
|
|
790983
791373
|
return void 0;
|
|
790984
791374
|
},
|
|
790985
791375
|
_other: () => {
|
|
790986
|
-
throw new
|
|
791376
|
+
throw new CliError({
|
|
791377
|
+
message: "Unknown ExampleResponseBody: " + example.response?.body?.type,
|
|
791378
|
+
code: CliError.Code.InternalError
|
|
791379
|
+
});
|
|
790987
791380
|
}
|
|
790988
791381
|
}) : void 0,
|
|
790989
791382
|
codeSamples: example.codeSamples?.map((codeSample) => ({
|
|
@@ -791109,18 +791502,27 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
791109
791502
|
stream: (stream5) => stream5.length > 0 ? 200 : 204,
|
|
791110
791503
|
sse: (stream5) => stream5.length > 0 ? 200 : 204,
|
|
791111
791504
|
_other: () => {
|
|
791112
|
-
throw new
|
|
791505
|
+
throw new CliError({
|
|
791506
|
+
message: "Unknown ExampleResponseBody: " + ok3.type,
|
|
791507
|
+
code: CliError.Code.InternalError
|
|
791508
|
+
});
|
|
791113
791509
|
}
|
|
791114
791510
|
}),
|
|
791115
791511
|
error: ({ error: errorName }) => {
|
|
791116
791512
|
const error50 = ir10.errors[errorName.errorId];
|
|
791117
791513
|
if (error50 == null) {
|
|
791118
|
-
throw new
|
|
791514
|
+
throw new CliError({
|
|
791515
|
+
message: "Cannot find error " + errorName.errorId,
|
|
791516
|
+
code: CliError.Code.ResolutionError
|
|
791517
|
+
});
|
|
791119
791518
|
}
|
|
791120
791519
|
return error50.statusCode;
|
|
791121
791520
|
},
|
|
791122
791521
|
_other: () => {
|
|
791123
|
-
throw new
|
|
791522
|
+
throw new CliError({
|
|
791523
|
+
message: "Unknown ExampleResponse: " + example.response.type,
|
|
791524
|
+
code: CliError.Code.InternalError
|
|
791525
|
+
});
|
|
791124
791526
|
}
|
|
791125
791527
|
}),
|
|
791126
791528
|
responseBody: example.response._visit({
|
|
@@ -791142,12 +791544,18 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
791142
791544
|
value: sse.map(({ event, data: data2 }) => ({ event, data: data2.jsonExample }))
|
|
791143
791545
|
}),
|
|
791144
791546
|
_other: () => {
|
|
791145
|
-
throw new
|
|
791547
|
+
throw new CliError({
|
|
791548
|
+
message: "Unknown ExampleResponseBody: " + ok3.type,
|
|
791549
|
+
code: CliError.Code.InternalError
|
|
791550
|
+
});
|
|
791146
791551
|
}
|
|
791147
791552
|
}),
|
|
791148
791553
|
error: (error50) => error50.body != null ? { type: "json", value: error50.body.jsonExample } : void 0,
|
|
791149
791554
|
_other: () => {
|
|
791150
|
-
throw new
|
|
791555
|
+
throw new CliError({
|
|
791556
|
+
message: "Unknown ExampleResponse: " + example.response.type,
|
|
791557
|
+
code: CliError.Code.InternalError
|
|
791558
|
+
});
|
|
791151
791559
|
}
|
|
791152
791560
|
}),
|
|
791153
791561
|
// irExample.response.body != null ? { type: "json", value: irExample.response.body.jsonExample } : undefined,
|
|
@@ -791440,7 +791848,9 @@ async function registerApi({ organization, workspace, context: context3, token,
|
|
|
791440
791848
|
context3.logger.debug(`Registered API Definition ${response.apiDefinitionId}`);
|
|
791441
791849
|
return { id: response.apiDefinitionId, ir: ir10 };
|
|
791442
791850
|
} catch (error50) {
|
|
791443
|
-
return context3.failAndThrow("Failed to register API", error50
|
|
791851
|
+
return context3.failAndThrow("Failed to register API", error50, {
|
|
791852
|
+
code: CliError.Code.NetworkError
|
|
791853
|
+
});
|
|
791444
791854
|
}
|
|
791445
791855
|
}
|
|
791446
791856
|
|
|
@@ -827894,7 +828304,7 @@ var DocsWorkspaceValidator = class {
|
|
|
827894
828304
|
const startTime = performance.now();
|
|
827895
828305
|
if (workspace.config.settings?.substituteEnvVars) {
|
|
827896
828306
|
workspace.config = replaceEnvVariables(workspace.config, {
|
|
827897
|
-
onError: (error50) => this.taskContext.failAndThrow(error50)
|
|
828307
|
+
onError: (error50) => this.taskContext.failAndThrow(error50, void 0, { code: CliError.Code.ConfigError })
|
|
827898
828308
|
});
|
|
827899
828309
|
}
|
|
827900
828310
|
const violations = await validateDocsWorkspace(workspace, this.taskContext, apiWorkspaces, ossWorkspaces, false, excludeRules);
|
|
@@ -831728,7 +832138,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
831728
832138
|
var LOGS_FOLDER_NAME = "logs";
|
|
831729
832139
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
831730
832140
|
function getCliSource() {
|
|
831731
|
-
const version7 = "4.
|
|
832141
|
+
const version7 = "4.82.0";
|
|
831732
832142
|
return `cli@${version7}`;
|
|
831733
832143
|
}
|
|
831734
832144
|
var DebugLogger = class {
|
|
@@ -841126,7 +841536,10 @@ async function retryWithRateLimit({ fn: fn10, retryRateLimited, logger: logger4,
|
|
|
841126
841536
|
}
|
|
841127
841537
|
}
|
|
841128
841538
|
}
|
|
841129
|
-
throw new
|
|
841539
|
+
throw new CliError({
|
|
841540
|
+
message: "Exceeded maximum retries for 429 Too Many Requests.",
|
|
841541
|
+
code: CliError.Code.InternalError
|
|
841542
|
+
});
|
|
841130
841543
|
}
|
|
841131
841544
|
|
|
841132
841545
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
@@ -841139,7 +841552,9 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
841139
841552
|
try {
|
|
841140
841553
|
fernignoreContents = await (0, import_promises86.readFile)(fernignorePath, "utf-8");
|
|
841141
841554
|
} catch (error50) {
|
|
841142
|
-
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}
|
|
841555
|
+
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`, void 0, {
|
|
841556
|
+
code: CliError.Code.ConfigError
|
|
841557
|
+
});
|
|
841143
841558
|
}
|
|
841144
841559
|
}
|
|
841145
841560
|
const job = await retryWithRateLimit({
|
|
@@ -841162,7 +841577,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
841162
841577
|
}),
|
|
841163
841578
|
retryRateLimited,
|
|
841164
841579
|
logger: context3.logger,
|
|
841165
|
-
onRateLimitedWithoutRetry: () => context3.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.")
|
|
841580
|
+
onRateLimitedWithoutRetry: () => context3.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.", void 0, { code: CliError.Code.NetworkError })
|
|
841166
841581
|
});
|
|
841167
841582
|
await startJob({ intermediateRepresentation, job, context: context3, generatorInvocation, irVersionOverride });
|
|
841168
841583
|
return job;
|
|
@@ -841212,33 +841627,35 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
841212
841627
|
}
|
|
841213
841628
|
return convertCreateJobError(rawError)._visit({
|
|
841214
841629
|
illegalApiNameError: () => {
|
|
841215
|
-
return context3.failAndThrow("API name is invalid: " + workspace.definition.rootApiFile.contents.name);
|
|
841630
|
+
return context3.failAndThrow("API name is invalid: " + workspace.definition.rootApiFile.contents.name, void 0, { code: CliError.Code.ConfigError });
|
|
841216
841631
|
},
|
|
841217
841632
|
illegalApiVersionError: () => {
|
|
841218
|
-
return context3.failAndThrow("API version is invalid: " + version7
|
|
841633
|
+
return context3.failAndThrow("API version is invalid: " + version7, void 0, {
|
|
841634
|
+
code: CliError.Code.ConfigError
|
|
841635
|
+
});
|
|
841219
841636
|
},
|
|
841220
841637
|
cannotPublishToNpmScope: ({ validScope, invalidScope }) => {
|
|
841221
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidScope} (expected ${validScope})
|
|
841638
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidScope} (expected ${validScope})`, void 0, { code: CliError.Code.AuthError });
|
|
841222
841639
|
},
|
|
841223
841640
|
cannotPublishToMavenGroup: ({ validGroup, invalidGroup }) => {
|
|
841224
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidGroup} (expected ${validGroup})
|
|
841641
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidGroup} (expected ${validGroup})`, void 0, { code: CliError.Code.AuthError });
|
|
841225
841642
|
},
|
|
841226
841643
|
cannotPublishPypiPackage: ({ validPrefix, invalidPackageName }) => {
|
|
841227
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidPackageName} (expected ${validPrefix})
|
|
841644
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidPackageName} (expected ${validPrefix})`, void 0, { code: CliError.Code.AuthError });
|
|
841228
841645
|
},
|
|
841229
841646
|
generatorsDoNotExistError: (value2) => {
|
|
841230
|
-
return context3.failAndThrow("Generators do not exist: " + value2.nonExistentGenerators.map((generator) => `${generator.id}@${generator.version}`).join(", "));
|
|
841647
|
+
return context3.failAndThrow("Generators do not exist: " + value2.nonExistentGenerators.map((generator) => `${generator.id}@${generator.version}`).join(", "), void 0, { code: CliError.Code.ConfigError });
|
|
841231
841648
|
},
|
|
841232
841649
|
insufficientPermissions: () => {
|
|
841233
841650
|
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
841651
|
|
|
841235
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not
|
|
841652
|
+
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
841653
|
},
|
|
841237
841654
|
orgNotConfiguredForWhitelabel: () => {
|
|
841238
|
-
return context3.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com.");
|
|
841655
|
+
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
841656
|
},
|
|
841240
841657
|
branchDoesNotExist: (value2) => {
|
|
841241
|
-
return context3.failAndThrow(`Branch ${value2.branch} does not exist in repository ${value2.repositoryOwner}/${value2.repositoryName}
|
|
841658
|
+
return context3.failAndThrow(`Branch ${value2.branch} does not exist in repository ${value2.repositoryOwner}/${value2.repositoryName}`, void 0, { code: CliError.Code.ConfigError });
|
|
841242
841659
|
},
|
|
841243
841660
|
rateLimitExceeded: () => {
|
|
841244
841661
|
throw new TooManyRequestsError();
|
|
@@ -841247,9 +841664,9 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
|
|
|
841247
841664
|
context3.logger.debug(`Failed to create job: ${JSON.stringify(content5)}`);
|
|
841248
841665
|
const errorMessage = extractErrorMessage2(content5);
|
|
841249
841666
|
if (errorMessage != null) {
|
|
841250
|
-
return context3.failAndThrow(errorMessage);
|
|
841667
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.NetworkError });
|
|
841251
841668
|
}
|
|
841252
|
-
return context3.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.");
|
|
841669
|
+
return context3.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.", void 0, { code: CliError.Code.NetworkError });
|
|
841253
841670
|
}
|
|
841254
841671
|
});
|
|
841255
841672
|
}
|
|
@@ -841294,7 +841711,7 @@ async function startJob({ intermediateRepresentation, generatorInvocation, job,
|
|
|
841294
841711
|
} catch (error50) {
|
|
841295
841712
|
const errorBody = error50 instanceof AxiosError2 ? error50.response?.data : error50;
|
|
841296
841713
|
context3.logger.debug(`POST ${url3} failed with ${JSON.stringify(error50)}`);
|
|
841297
|
-
context3.failAndThrow("Failed to start job", errorBody);
|
|
841714
|
+
context3.failAndThrow("Failed to start job", errorBody, { code: CliError.Code.NetworkError });
|
|
841298
841715
|
}
|
|
841299
841716
|
}
|
|
841300
841717
|
function extractErrorMessage2(error50) {
|
|
@@ -841361,7 +841778,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context3 })
|
|
|
841361
841778
|
if (taskStatus == null) {
|
|
841362
841779
|
numConsecutiveFailed++;
|
|
841363
841780
|
if (numConsecutiveFailed === MAX_UNSUCCESSFUL_ATTEMPTS) {
|
|
841364
|
-
context3.failAndThrow(`Failed to get job status after ${numConsecutiveFailed} attempts
|
|
841781
|
+
context3.failAndThrow(`Failed to get job status after ${numConsecutiveFailed} attempts.`, void 0, {
|
|
841782
|
+
code: CliError.Code.NetworkError
|
|
841783
|
+
});
|
|
841365
841784
|
}
|
|
841366
841785
|
setTimeout(pollForStatus, 2e3 + 1e3 * numConsecutiveFailed);
|
|
841367
841786
|
} else {
|
|
@@ -841418,7 +841837,9 @@ var RemoteTaskHandler = class {
|
|
|
841418
841837
|
}
|
|
841419
841838
|
async processUpdate(remoteTask2) {
|
|
841420
841839
|
if (remoteTask2 == null) {
|
|
841421
|
-
this.context.failAndThrow("Task is missing on job status"
|
|
841840
|
+
this.context.failAndThrow("Task is missing on job status", void 0, {
|
|
841841
|
+
code: CliError.Code.InternalError
|
|
841842
|
+
});
|
|
841422
841843
|
}
|
|
841423
841844
|
const coordinates = remoteTask2.packages.map((p9) => {
|
|
841424
841845
|
return p9.coordinate._visit({
|
|
@@ -841469,7 +841890,7 @@ var RemoteTaskHandler = class {
|
|
|
841469
841890
|
if (s3PreSignedReadUrl != null) {
|
|
841470
841891
|
logS3Url(s3PreSignedReadUrl);
|
|
841471
841892
|
}
|
|
841472
|
-
this.context.failAndThrow(message);
|
|
841893
|
+
this.context.failAndThrow(message, void 0, { code: CliError.Code.ContainerError });
|
|
841473
841894
|
},
|
|
841474
841895
|
finished: async (finishedStatus) => {
|
|
841475
841896
|
if (finishedStatus.s3PreSignedReadUrlV2 != null) {
|
|
@@ -841546,7 +841967,7 @@ async function downloadFilesForTask({ s3PreSignedReadUrl, absolutePathToLocalOut
|
|
|
841546
841967
|
}
|
|
841547
841968
|
context3.logger.info(source_default.green(`Downloaded to ${absolutePathToLocalOutput}`));
|
|
841548
841969
|
} catch (e5) {
|
|
841549
|
-
context3.failAndThrow("Failed to download files", e5);
|
|
841970
|
+
context3.failAndThrow("Failed to download files", e5, { code: CliError.Code.NetworkError });
|
|
841550
841971
|
}
|
|
841551
841972
|
}
|
|
841552
841973
|
async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutput }) {
|
|
@@ -841723,7 +842144,7 @@ var SourceUploader = class {
|
|
|
841723
842144
|
});
|
|
841724
842145
|
await uploadCommand.cleanup();
|
|
841725
842146
|
if (!response.ok) {
|
|
841726
|
-
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}
|
|
842147
|
+
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}`, void 0, { code: CliError.Code.NetworkError });
|
|
841727
842148
|
}
|
|
841728
842149
|
}
|
|
841729
842150
|
async getUploadCommand(source2) {
|
|
@@ -841778,7 +842199,7 @@ var SourceUploader = class {
|
|
|
841778
842199
|
getSourceOrThrow(id) {
|
|
841779
842200
|
const source2 = this.sources[id];
|
|
841780
842201
|
if (source2 == null) {
|
|
841781
|
-
this.context.failAndThrow(`Internal error; server responded with source id "${id}" which does not exist in the workspace
|
|
842202
|
+
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
842203
|
}
|
|
841783
842204
|
return source2;
|
|
841784
842205
|
}
|
|
@@ -841794,7 +842215,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841794
842215
|
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
|
|
841795
842216
|
onError: (e5) => {
|
|
841796
842217
|
if (!isPreview && requireEnvVars) {
|
|
841797
|
-
interactiveTaskContext.failAndThrow(e5
|
|
842218
|
+
interactiveTaskContext.failAndThrow(void 0, e5, {
|
|
842219
|
+
code: CliError.Code.EnvironmentError
|
|
842220
|
+
});
|
|
841798
842221
|
}
|
|
841799
842222
|
}
|
|
841800
842223
|
}, { substituteAsEmpty: isPreview });
|
|
@@ -841894,7 +842317,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841894
842317
|
}
|
|
841895
842318
|
const sourceUploader = new SourceUploader(interactiveTaskContext, sources);
|
|
841896
842319
|
if (sourceUploads == null && sourceUploader.sourceTypes.has("protobuf")) {
|
|
841897
|
-
interactiveTaskContext.failAndThrow("Did not successfully upload Protobuf source files."
|
|
842320
|
+
interactiveTaskContext.failAndThrow("Did not successfully upload Protobuf source files.", void 0, {
|
|
842321
|
+
code: CliError.Code.NetworkError
|
|
842322
|
+
});
|
|
841898
842323
|
}
|
|
841899
842324
|
if (sourceUploads != null) {
|
|
841900
842325
|
interactiveTaskContext.logger.debug("Uploading source files ...");
|
|
@@ -841905,15 +842330,21 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841905
842330
|
if (dynamicIrOnly) {
|
|
841906
842331
|
interactiveTaskContext.logger.info("Dynamic IR only mode: skipping SDK generation and uploading dynamic IR only");
|
|
841907
842332
|
if (version7 == null) {
|
|
841908
|
-
interactiveTaskContext.failAndThrow("Version is required for dynamic IR only mode"
|
|
842333
|
+
interactiveTaskContext.failAndThrow("Version is required for dynamic IR only mode", void 0, {
|
|
842334
|
+
code: CliError.Code.ConfigError
|
|
842335
|
+
});
|
|
841909
842336
|
return void 0;
|
|
841910
842337
|
}
|
|
841911
842338
|
if (generatorInvocation.language == null) {
|
|
841912
|
-
interactiveTaskContext.failAndThrow("Language is required for dynamic IR only mode"
|
|
842339
|
+
interactiveTaskContext.failAndThrow("Language is required for dynamic IR only mode", void 0, {
|
|
842340
|
+
code: CliError.Code.ConfigError
|
|
842341
|
+
});
|
|
841913
842342
|
return void 0;
|
|
841914
842343
|
}
|
|
841915
842344
|
if (packageName == null) {
|
|
841916
|
-
interactiveTaskContext.failAndThrow("Package name is required for dynamic IR only mode"
|
|
842345
|
+
interactiveTaskContext.failAndThrow("Package name is required for dynamic IR only mode", void 0, {
|
|
842346
|
+
code: CliError.Code.ConfigError
|
|
842347
|
+
});
|
|
841917
842348
|
return void 0;
|
|
841918
842349
|
}
|
|
841919
842350
|
try {
|
|
@@ -841929,7 +842360,7 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841929
842360
|
context: interactiveTaskContext
|
|
841930
842361
|
});
|
|
841931
842362
|
} catch (error50) {
|
|
841932
|
-
interactiveTaskContext.failAndThrow(`Failed to upload dynamic IR: ${extractErrorMessage(error50)}
|
|
842363
|
+
interactiveTaskContext.failAndThrow(`Failed to upload dynamic IR: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
|
|
841933
842364
|
}
|
|
841934
842365
|
return {
|
|
841935
842366
|
createdSnippets: false,
|
|
@@ -841965,7 +842396,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841965
842396
|
interactiveTaskContext.logger.debug(`Job ID: ${job.jobId}`);
|
|
841966
842397
|
const taskId = job.taskIds[0];
|
|
841967
842398
|
if (taskId == null) {
|
|
841968
|
-
interactiveTaskContext.failAndThrow("Did not receive a task ID."
|
|
842399
|
+
interactiveTaskContext.failAndThrow("Did not receive a task ID.", void 0, {
|
|
842400
|
+
code: CliError.Code.NetworkError
|
|
842401
|
+
});
|
|
841969
842402
|
return void 0;
|
|
841970
842403
|
}
|
|
841971
842404
|
interactiveTaskContext.logger.debug(`Task ID: ${taskId}`);
|
|
@@ -842131,7 +842564,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
842131
842564
|
onSnippetsProduced: (invocation) => snippetsProducedBy.push(invocation)
|
|
842132
842565
|
}))));
|
|
842133
842566
|
if (automation == null && results.some((didSucceed) => !didSucceed)) {
|
|
842134
|
-
|
|
842567
|
+
throw new TaskAbortSignal();
|
|
842135
842568
|
}
|
|
842136
842569
|
return {
|
|
842137
842570
|
snippetsProducedBy
|
|
@@ -842570,9 +843003,9 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain3
|
|
|
842570
843003
|
context3.logger.error(`FDR registerApiDefinition failed. Error details:
|
|
842571
843004
|
${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
842572
843005
|
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);
|
|
843006
|
+
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
843007
|
} else {
|
|
842575
|
-
return context3.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com`, errorDetails);
|
|
843008
|
+
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
843009
|
}
|
|
842577
843010
|
}
|
|
842578
843011
|
context3.logger.debug(`Registered API Definition ${apiName}: ${response.apiDefinitionId}`);
|
|
@@ -842599,7 +843032,7 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842599
843032
|
if (docsWorkspace.config.settings?.substituteEnvVars) {
|
|
842600
843033
|
context3.logger.debug("Applying environment variable substitution to docs definition...");
|
|
842601
843034
|
const { jsFiles, ...docsWithoutJsFiles } = docsDefinition;
|
|
842602
|
-
const substitutedDocs = replaceEnvVariables(docsWithoutJsFiles, { onError: (e5) => context3.failAndThrow(e5) }, { substituteAsEmpty: false });
|
|
843035
|
+
const substitutedDocs = replaceEnvVariables(docsWithoutJsFiles, { onError: (e5) => context3.failAndThrow(void 0, e5, { code: CliError.Code.EnvironmentError }) }, { substituteAsEmpty: false });
|
|
842603
843036
|
docsDefinition = { ...substitutedDocs, jsFiles };
|
|
842604
843037
|
}
|
|
842605
843038
|
const pageCount = Object.keys(docsDefinition.pages).length;
|
|
@@ -842609,7 +843042,9 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842609
843042
|
context3.logger.debug(`Memory after resolve: RSS=${(resolveMemory.rss / 1024 / 1024).toFixed(2)}MB, Heap=${(resolveMemory.heapUsed / 1024 / 1024).toFixed(2)}MB`);
|
|
842610
843043
|
if (docsRegistrationId == null) {
|
|
842611
843044
|
doUnlock();
|
|
842612
|
-
return context3.failAndThrow("Failed to publish docs.", "Docs registration ID is missing."
|
|
843045
|
+
return context3.failAndThrow("Failed to publish docs.", "Docs registration ID is missing.", {
|
|
843046
|
+
code: CliError.Code.InternalError
|
|
843047
|
+
});
|
|
842613
843048
|
}
|
|
842614
843049
|
context3.logger.info("Publishing docs to FDR...");
|
|
842615
843050
|
const publishStart = performance.now();
|
|
@@ -842621,7 +843056,9 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842621
843056
|
...isBasepathAware && !preview && { basepathAware: true }
|
|
842622
843057
|
});
|
|
842623
843058
|
} catch (error50) {
|
|
842624
|
-
return context3.failAndThrow("Failed to publish docs to " + domain3, error50
|
|
843059
|
+
return context3.failAndThrow("Failed to publish docs to " + domain3, error50, {
|
|
843060
|
+
code: CliError.Code.NetworkError
|
|
843061
|
+
});
|
|
842625
843062
|
}
|
|
842626
843063
|
const publishTime = performance.now() - publishStart;
|
|
842627
843064
|
context3.logger.debug(`Docs published to FDR in ${publishTime.toFixed(0)}ms`);
|
|
@@ -842681,7 +843118,9 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
842681
843118
|
}
|
|
842682
843119
|
});
|
|
842683
843120
|
} catch (e5) {
|
|
842684
|
-
context3.failAndThrow(`Failed to upload ${absoluteFilePath}`, e5
|
|
843121
|
+
context3.failAndThrow(`Failed to upload ${absoluteFilePath}`, e5, {
|
|
843122
|
+
code: CliError.Code.NetworkError
|
|
843123
|
+
});
|
|
842685
843124
|
}
|
|
842686
843125
|
}));
|
|
842687
843126
|
const endTime2 = Date.now();
|
|
@@ -842721,24 +843160,26 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842721
843160
|
}
|
|
842722
843161
|
const authErrorMessage = getAuthenticationErrorMessage(error50, organization, domain3);
|
|
842723
843162
|
if (authErrorMessage != null) {
|
|
842724
|
-
return context3.failAndThrow(authErrorMessage);
|
|
843163
|
+
return context3.failAndThrow(authErrorMessage, void 0, { code: CliError.Code.AuthError });
|
|
842725
843164
|
}
|
|
842726
843165
|
const errorType = errorObj?.error;
|
|
842727
843166
|
switch (errorType) {
|
|
842728
843167
|
case "InvalidCustomDomainError":
|
|
842729
|
-
return context3.failAndThrow(`Your docs domain should end with ${"docs.dev.buildwithfern.com"}
|
|
843168
|
+
return context3.failAndThrow(`Your docs domain should end with ${"docs.dev.buildwithfern.com"}`, void 0, { code: CliError.Code.ConfigError });
|
|
842730
843169
|
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)");
|
|
843170
|
+
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
843171
|
case "UnauthorizedError":
|
|
842733
|
-
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent)
|
|
843172
|
+
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent), void 0, {
|
|
843173
|
+
code: CliError.Code.AuthError
|
|
843174
|
+
});
|
|
842734
843175
|
case "UserNotInOrgError":
|
|
842735
843176
|
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
843177
|
|
|
842737
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not
|
|
843178
|
+
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
843179
|
case "UnavailableError":
|
|
842739
|
-
return context3.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.");
|
|
843180
|
+
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
843181
|
default:
|
|
842741
|
-
return context3.failAndThrow("Failed to publish docs.", error50);
|
|
843182
|
+
return context3.failAndThrow("Failed to publish docs.", error50, { code: CliError.Code.NetworkError });
|
|
842742
843183
|
}
|
|
842743
843184
|
}
|
|
842744
843185
|
function getAuthenticationErrorMessage(error50, organization, domain3) {
|
|
@@ -843186,21 +843627,25 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
843186
843627
|
docsWorkspace.config = replaceEnvVariables(
|
|
843187
843628
|
docsWorkspace.config,
|
|
843188
843629
|
// Wrap in a closure for correct binding of `this` downstream
|
|
843189
|
-
{ onError: (e5) => context3.failAndThrow(e5) },
|
|
843630
|
+
{ onError: (e5) => context3.failAndThrow(void 0, e5, { code: CliError.Code.EnvironmentError }) },
|
|
843190
843631
|
{ substituteAsEmpty: shouldSubstituteAsEmpty }
|
|
843191
843632
|
);
|
|
843192
843633
|
const instances2 = docsWorkspace.config.instances;
|
|
843193
843634
|
if (instances2.length === 0) {
|
|
843194
|
-
context3.failAndThrow("No instances specified in docs.yml! Cannot register docs."
|
|
843635
|
+
context3.failAndThrow("No instances specified in docs.yml! Cannot register docs.", void 0, {
|
|
843636
|
+
code: CliError.Code.ConfigError
|
|
843637
|
+
});
|
|
843195
843638
|
return;
|
|
843196
843639
|
}
|
|
843197
843640
|
if (instances2.length > 1 && instanceUrl == null) {
|
|
843198
|
-
context3.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${instances2[0]?.url})
|
|
843641
|
+
context3.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${instances2[0]?.url})`, void 0, { code: CliError.Code.ConfigError });
|
|
843199
843642
|
return;
|
|
843200
843643
|
}
|
|
843201
843644
|
const maybeInstance = instances2.find((instance) => instance.url === instanceUrl) ?? instances2[0];
|
|
843202
843645
|
if (maybeInstance == null) {
|
|
843203
|
-
context3.failAndThrow(`No docs instance with url ${instanceUrl}. Failed to register
|
|
843646
|
+
context3.failAndThrow(`No docs instance with url ${instanceUrl}. Failed to register.`, void 0, {
|
|
843647
|
+
code: CliError.Code.ConfigError
|
|
843648
|
+
});
|
|
843204
843649
|
return;
|
|
843205
843650
|
}
|
|
843206
843651
|
const customDomains = [];
|
|
@@ -843245,7 +843690,7 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
843245
843690
|
} catch (error50) {
|
|
843246
843691
|
if (!(error50 instanceof DocsPublishConflictError) || attempt >= PUBLISH_CONFLICT_RETRY_DELAYS_MS.length) {
|
|
843247
843692
|
if (error50 instanceof DocsPublishConflictError) {
|
|
843248
|
-
return context3.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");
|
|
843693
|
+
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
843694
|
}
|
|
843250
843695
|
throw error50;
|
|
843251
843696
|
}
|
|
@@ -843295,7 +843740,7 @@ var LegacyDocsPublisher = class {
|
|
|
843295
843740
|
previewId,
|
|
843296
843741
|
disableTemplates: void 0,
|
|
843297
843742
|
skipUpload,
|
|
843298
|
-
cliVersion: "4.
|
|
843743
|
+
cliVersion: "4.82.0"
|
|
843299
843744
|
});
|
|
843300
843745
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843301
843746
|
return { success: false };
|
|
@@ -843770,7 +844215,10 @@ var DocsTask = class {
|
|
|
843770
844215
|
getTask() {
|
|
843771
844216
|
const task = this.taskGroup.getTask(this.id);
|
|
843772
844217
|
if (task == null) {
|
|
843773
|
-
throw new
|
|
844218
|
+
throw new CliError({
|
|
844219
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
844220
|
+
code: CliError.Code.InternalError
|
|
844221
|
+
});
|
|
843774
844222
|
}
|
|
843775
844223
|
return task;
|
|
843776
844224
|
}
|
|
@@ -845042,7 +845490,10 @@ var Wizard = class {
|
|
|
845042
845490
|
async fetchApiFromUrl(url3, specFormat) {
|
|
845043
845491
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
845044
845492
|
if (!response.ok) {
|
|
845045
|
-
throw new
|
|
845493
|
+
throw new CliError({
|
|
845494
|
+
message: `HTTP ${response.status} ${response.statusText}`,
|
|
845495
|
+
code: CliError.Code.NetworkError
|
|
845496
|
+
});
|
|
845046
845497
|
}
|
|
845047
845498
|
const content5 = await response.text();
|
|
845048
845499
|
const filename = this.resolveFilenameFromUrl({ url: url3, specFormat });
|
|
@@ -846572,20 +847023,29 @@ var ApiSpecDetector = class {
|
|
|
846572
847023
|
async detect({ absoluteFilePath, reference: reference4, content: content5 }) {
|
|
846573
847024
|
const parsed = this.parseOrThrow({ content: content5, reference: reference4 });
|
|
846574
847025
|
if (typeof parsed !== "object" || parsed == null) {
|
|
846575
|
-
throw new
|
|
847026
|
+
throw new CliError({
|
|
847027
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
847028
|
+
code: CliError.Code.InternalError
|
|
847029
|
+
});
|
|
846576
847030
|
}
|
|
846577
847031
|
for (const specType of DETECTABLE_SPEC_TYPES) {
|
|
846578
847032
|
if (specType in parsed) {
|
|
846579
847033
|
return specType;
|
|
846580
847034
|
}
|
|
846581
847035
|
}
|
|
846582
|
-
throw new
|
|
847036
|
+
throw new CliError({
|
|
847037
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
847038
|
+
code: CliError.Code.InternalError
|
|
847039
|
+
});
|
|
846583
847040
|
}
|
|
846584
847041
|
parseOrThrow({ content: content5, reference: reference4 }) {
|
|
846585
847042
|
try {
|
|
846586
847043
|
return jsYaml.load(content5);
|
|
846587
847044
|
} catch {
|
|
846588
|
-
throw new
|
|
847045
|
+
throw new CliError({
|
|
847046
|
+
message: `Could not parse "${reference4}" as YAML or JSON. Ensure the file is a valid OpenAPI or AsyncAPI specification.`,
|
|
847047
|
+
code: CliError.Code.ParseError
|
|
847048
|
+
});
|
|
846589
847049
|
}
|
|
846590
847050
|
}
|
|
846591
847051
|
};
|
|
@@ -846623,7 +847083,10 @@ var ApiSpecResolver = class {
|
|
|
846623
847083
|
async resolveLocal({ reference: reference4 }) {
|
|
846624
847084
|
const absoluteFilePath = resolve6(this.context.cwd, reference4);
|
|
846625
847085
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
846626
|
-
throw new
|
|
847086
|
+
throw new CliError({
|
|
847087
|
+
message: `API spec file does not exist: ${reference4}`,
|
|
847088
|
+
code: CliError.Code.ConfigError
|
|
847089
|
+
});
|
|
846627
847090
|
}
|
|
846628
847091
|
const content5 = await (0, import_promises92.readFile)(absoluteFilePath, "utf-8");
|
|
846629
847092
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
@@ -846636,11 +847099,17 @@ var ApiSpecResolver = class {
|
|
|
846636
847099
|
async fetchContent({ url: url3 }) {
|
|
846637
847100
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
846638
847101
|
if (!response.ok) {
|
|
846639
|
-
throw new
|
|
847102
|
+
throw new CliError({
|
|
847103
|
+
message: `Failed to fetch "${url3}": HTTP ${response.status} ${response.statusText}`,
|
|
847104
|
+
code: CliError.Code.NetworkError
|
|
847105
|
+
});
|
|
846640
847106
|
}
|
|
846641
847107
|
const contentType = response.headers.get("content-type") ?? "";
|
|
846642
847108
|
if (contentType.includes("text/html")) {
|
|
846643
|
-
throw new
|
|
847109
|
+
throw new CliError({
|
|
847110
|
+
message: `The URL "${url3}" returned HTML content. Ensure you're pointing to a raw spec URL, not a documentation page.`,
|
|
847111
|
+
code: CliError.Code.ConfigError
|
|
847112
|
+
});
|
|
846644
847113
|
}
|
|
846645
847114
|
const content5 = await response.text();
|
|
846646
847115
|
return { content: content5, contentType };
|
|
@@ -846665,7 +847134,10 @@ var ApiSpecResolver = class {
|
|
|
846665
847134
|
case "asyncapi":
|
|
846666
847135
|
return { asyncapi: absoluteFilePath, origin: origin2 };
|
|
846667
847136
|
default:
|
|
846668
|
-
throw new
|
|
847137
|
+
throw new CliError({
|
|
847138
|
+
message: `Unsupported spec type for flags mode: "${specType}". Supported: openapi, asyncapi`,
|
|
847139
|
+
code: CliError.Code.ConfigError
|
|
847140
|
+
});
|
|
846669
847141
|
}
|
|
846670
847142
|
}
|
|
846671
847143
|
isUrl(reference4) {
|
|
@@ -847669,10 +848141,12 @@ var ContainerExecutionEnvironment = class {
|
|
|
847669
848141
|
containerImage;
|
|
847670
848142
|
keepContainer;
|
|
847671
848143
|
runner;
|
|
847672
|
-
|
|
848144
|
+
disableTelemetry;
|
|
848145
|
+
constructor({ containerImage, keepContainer, runner, disableTelemetry, dockerImage, keepDocker }) {
|
|
847673
848146
|
this.containerImage = containerImage ?? dockerImage ?? "";
|
|
847674
848147
|
this.keepContainer = keepContainer ?? keepDocker ?? false;
|
|
847675
848148
|
this.runner = runner;
|
|
848149
|
+
this.disableTelemetry = disableTelemetry ?? false;
|
|
847676
848150
|
}
|
|
847677
848151
|
async execute({ generatorName, irPath, configPath, outputPath, snippetPath, snippetTemplatePath, licenseFilePath, sourceMounts, context: context3, inspect: inspect6, runner }) {
|
|
847678
848152
|
context3.logger.info(`Executing generator ${generatorName} using container image: ${this.containerImage}`);
|
|
@@ -847699,16 +848173,29 @@ var ContainerExecutionEnvironment = class {
|
|
|
847699
848173
|
envVars["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${DEFAULT_NODE_DEBUG_PORT}`;
|
|
847700
848174
|
ports[DEFAULT_NODE_DEBUG_PORT] = DEFAULT_NODE_DEBUG_PORT;
|
|
847701
848175
|
}
|
|
847702
|
-
|
|
847703
|
-
|
|
847704
|
-
|
|
847705
|
-
|
|
847706
|
-
|
|
847707
|
-
|
|
847708
|
-
|
|
847709
|
-
|
|
847710
|
-
|
|
847711
|
-
|
|
848176
|
+
if (this.disableTelemetry) {
|
|
848177
|
+
envVars["FERN_DISABLE_TELEMETRY"] = "true";
|
|
848178
|
+
}
|
|
848179
|
+
try {
|
|
848180
|
+
await runContainer({
|
|
848181
|
+
logger: context3.logger,
|
|
848182
|
+
imageName: this.containerImage,
|
|
848183
|
+
args: [CONTAINER_GENERATOR_CONFIG_PATH],
|
|
848184
|
+
binds,
|
|
848185
|
+
envVars,
|
|
848186
|
+
ports,
|
|
848187
|
+
removeAfterCompletion: !this.keepContainer,
|
|
848188
|
+
runner: this.runner ?? runner
|
|
848189
|
+
});
|
|
848190
|
+
} catch (error50) {
|
|
848191
|
+
if (error50 instanceof CliError) {
|
|
848192
|
+
throw error50;
|
|
848193
|
+
}
|
|
848194
|
+
throw new CliError({
|
|
848195
|
+
message: `Container execution failed: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
848196
|
+
code: CliError.Code.ContainerError
|
|
848197
|
+
});
|
|
848198
|
+
}
|
|
847712
848199
|
}
|
|
847713
848200
|
};
|
|
847714
848201
|
|
|
@@ -873199,7 +873686,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
873199
873686
|
}
|
|
873200
873687
|
}
|
|
873201
873688
|
} catch (e5) {
|
|
873202
|
-
this.context.failAndThrow("Failed to run spotlessApply", e5);
|
|
873689
|
+
this.context.failAndThrow("Failed to run spotlessApply", e5, { code: CliError.Code.InternalError });
|
|
873203
873690
|
}
|
|
873204
873691
|
}
|
|
873205
873692
|
this.context.logger.debug("Done generating dynamic snippet tests");
|
|
@@ -894776,11 +895263,17 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
894776
895263
|
buildGeneratorConfig(config5) {
|
|
894777
895264
|
const outputMode = config5.output.mode;
|
|
894778
895265
|
if (outputMode.type !== "github") {
|
|
894779
|
-
throw new
|
|
895266
|
+
throw new CliError({
|
|
895267
|
+
message: "GitHub output mode is required for TypeScript dynamic snippet tests",
|
|
895268
|
+
code: CliError.Code.ConfigError
|
|
895269
|
+
});
|
|
894780
895270
|
}
|
|
894781
895271
|
const publishInfo = outputMode.publishInfo;
|
|
894782
895272
|
if (!publishInfo || publishInfo.type !== "npm") {
|
|
894783
|
-
throw new
|
|
895273
|
+
throw new CliError({
|
|
895274
|
+
message: "NPM publish info is required for TypeScript dynamic snippet tests",
|
|
895275
|
+
code: CliError.Code.ConfigError
|
|
895276
|
+
});
|
|
894784
895277
|
}
|
|
894785
895278
|
return {
|
|
894786
895279
|
...config5,
|
|
@@ -894834,7 +895327,10 @@ var DynamicSnippetsTestGenerator = class _DynamicSnippetsTestGenerator {
|
|
|
894834
895327
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/generateDynamicSnippetsTestSuite.js
|
|
894835
895328
|
async function generateDynamicSnippetsTestSuite({ ir: ir10, config: config5 }) {
|
|
894836
895329
|
if (ir10.dynamic == null) {
|
|
894837
|
-
throw new
|
|
895330
|
+
throw new CliError({
|
|
895331
|
+
message: "Internal error; dynamic IR is not available",
|
|
895332
|
+
code: CliError.Code.InternalError
|
|
895333
|
+
});
|
|
894838
895334
|
}
|
|
894839
895335
|
return {
|
|
894840
895336
|
ir: ir10.dynamic,
|
|
@@ -895030,7 +895526,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
895030
895526
|
push: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
|
|
895031
895527
|
pullRequest: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
|
|
895032
895528
|
_other: () => {
|
|
895033
|
-
throw new
|
|
895529
|
+
throw new CliError({
|
|
895530
|
+
message: "Encountered unknown github mode",
|
|
895531
|
+
code: CliError.Code.InternalError
|
|
895532
|
+
});
|
|
895034
895533
|
}
|
|
895035
895534
|
});
|
|
895036
895535
|
const outputConfig = {
|
|
@@ -895051,7 +895550,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
895051
895550
|
return outputConfig;
|
|
895052
895551
|
},
|
|
895053
895552
|
_other: () => {
|
|
895054
|
-
throw new
|
|
895553
|
+
throw new CliError({
|
|
895554
|
+
message: "Output type did not match any of the types supported by Fern",
|
|
895555
|
+
code: CliError.Code.InternalError
|
|
895556
|
+
});
|
|
895055
895557
|
}
|
|
895056
895558
|
});
|
|
895057
895559
|
return {
|
|
@@ -895925,7 +896427,10 @@ var LocalTaskHandler = class {
|
|
|
895925
896427
|
return null;
|
|
895926
896428
|
}
|
|
895927
896429
|
if (!this.version) {
|
|
895928
|
-
throw new
|
|
896430
|
+
throw new CliError({
|
|
896431
|
+
message: "Version is required for auto versioning",
|
|
896432
|
+
code: CliError.Code.InternalError
|
|
896433
|
+
});
|
|
895929
896434
|
}
|
|
895930
896435
|
let previousVersion;
|
|
895931
896436
|
try {
|
|
@@ -896113,7 +896618,10 @@ var LocalTaskHandler = class {
|
|
|
896113
896618
|
};
|
|
896114
896619
|
}
|
|
896115
896620
|
this.context.logger.error(`Failed to perform automatic versioning: ${error50}`);
|
|
896116
|
-
throw new
|
|
896621
|
+
throw new CliError({
|
|
896622
|
+
message: `Automatic versioning failed: ${error50}`,
|
|
896623
|
+
code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError
|
|
896624
|
+
});
|
|
896117
896625
|
} finally {
|
|
896118
896626
|
if (diffFile) {
|
|
896119
896627
|
try {
|
|
@@ -896166,7 +896674,7 @@ var LocalTaskHandler = class {
|
|
|
896166
896674
|
incrementVersion(version7, versionBump) {
|
|
896167
896675
|
const cleanVersion = import_semver13.default.clean(version7);
|
|
896168
896676
|
if (!cleanVersion) {
|
|
896169
|
-
throw new
|
|
896677
|
+
throw new CliError({ message: `Invalid version format: ${version7}`, code: CliError.Code.VersionError });
|
|
896170
896678
|
}
|
|
896171
896679
|
let releaseType;
|
|
896172
896680
|
switch (versionBump) {
|
|
@@ -896180,11 +896688,17 @@ var LocalTaskHandler = class {
|
|
|
896180
896688
|
releaseType = "patch";
|
|
896181
896689
|
break;
|
|
896182
896690
|
default:
|
|
896183
|
-
throw new
|
|
896691
|
+
throw new CliError({
|
|
896692
|
+
message: `Unsupported version bump: ${versionBump}`,
|
|
896693
|
+
code: CliError.Code.VersionError
|
|
896694
|
+
});
|
|
896184
896695
|
}
|
|
896185
896696
|
const newVersion = import_semver13.default.inc(cleanVersion, releaseType);
|
|
896186
896697
|
if (!newVersion) {
|
|
896187
|
-
throw new
|
|
896698
|
+
throw new CliError({
|
|
896699
|
+
message: `Failed to increment version: ${version7}`,
|
|
896700
|
+
code: CliError.Code.VersionError
|
|
896701
|
+
});
|
|
896188
896702
|
}
|
|
896189
896703
|
return version7.startsWith("v") ? `v${newVersion}` : newVersion;
|
|
896190
896704
|
}
|
|
@@ -896244,7 +896758,10 @@ var LocalTaskHandler = class {
|
|
|
896244
896758
|
*/
|
|
896245
896759
|
async getClientRegistry() {
|
|
896246
896760
|
if (this.ai == null) {
|
|
896247
|
-
throw new
|
|
896761
|
+
throw new CliError({
|
|
896762
|
+
message: "No AI service configuration found in generators.yml. Please add an 'ai' section with provider and model.",
|
|
896763
|
+
code: CliError.Code.ConfigError
|
|
896764
|
+
});
|
|
896248
896765
|
}
|
|
896249
896766
|
this.context.logger.debug(`Using AI service: ${this.ai.provider} with model ${this.ai.model}`);
|
|
896250
896767
|
return configureBamlClient(this.ai);
|
|
@@ -896482,7 +896999,7 @@ function extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig) {
|
|
|
896482
896999
|
}
|
|
896483
897000
|
return void 0;
|
|
896484
897001
|
}
|
|
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 }) {
|
|
897002
|
+
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
897003
|
const { latest: latest2, migrated } = await getIntermediateRepresentation({
|
|
896487
897004
|
workspace,
|
|
896488
897005
|
audiences,
|
|
@@ -896527,7 +897044,8 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
896527
897044
|
}
|
|
896528
897045
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
896529
897046
|
containerImage: generatorInvocation.containerImage ? `${generatorInvocation.containerImage}:${generatorInvocation.version}` : `${generatorInvocation.name}:${generatorInvocation.version}`,
|
|
896530
|
-
keepContainer: keepDocker
|
|
897047
|
+
keepContainer: keepDocker,
|
|
897048
|
+
disableTelemetry
|
|
896531
897049
|
});
|
|
896532
897050
|
const paths = environment2.usesContainerPaths ? {
|
|
896533
897051
|
outputDirectory: AbsoluteFilePath2.of(CONTAINER_CODEGEN_OUTPUT_DIRECTORY),
|
|
@@ -896653,7 +897171,7 @@ function getGeneratorOutputSubfolder(generatorName) {
|
|
|
896653
897171
|
}
|
|
896654
897172
|
|
|
896655
897173
|
// ../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 }) {
|
|
897174
|
+
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
897175
|
const userProvidedVersion = version7;
|
|
896658
897176
|
if (userProvidedVersion != null) {
|
|
896659
897177
|
if (absolutePathToPreview != null) {
|
|
@@ -896677,7 +897195,9 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
|
|
|
896677
897195
|
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
|
|
896678
897196
|
onError: (e5) => {
|
|
896679
897197
|
if (!isPreview && (requireEnvVars ?? true)) {
|
|
896680
|
-
interactiveTaskContext.failAndThrow(e5
|
|
897198
|
+
interactiveTaskContext.failAndThrow(e5, void 0, {
|
|
897199
|
+
code: CliError.Code.EnvironmentError
|
|
897200
|
+
});
|
|
896681
897201
|
}
|
|
896682
897202
|
}
|
|
896683
897203
|
}, { substituteAsEmpty: isPreview });
|
|
@@ -896730,13 +897250,13 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
|
|
|
896730
897250
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
896731
897251
|
token ??= await getAccessToken();
|
|
896732
897252
|
if (token == null) {
|
|
896733
|
-
interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.");
|
|
897253
|
+
interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.", void 0, { code: CliError.Code.AuthError });
|
|
896734
897254
|
return;
|
|
896735
897255
|
}
|
|
896736
897256
|
}
|
|
896737
897257
|
const organization = await venus.organization.get(projectConfig.organization);
|
|
896738
897258
|
if (generatorInvocation.absolutePathToLocalOutput == null && !organization.ok) {
|
|
896739
|
-
interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}
|
|
897259
|
+
interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}.`, void 0, { code: CliError.Code.NetworkError });
|
|
896740
897260
|
return;
|
|
896741
897261
|
}
|
|
896742
897262
|
if (organization.ok) {
|
|
@@ -896772,7 +897292,7 @@ generators:
|
|
|
896772
897292
|
uri: your-org/your-sdk-repo
|
|
896773
897293
|
token: \${GITHUB_TOKEN}
|
|
896774
897294
|
mode: pull-request
|
|
896775
|
-
|
|
897295
|
+
`, void 0, { code: CliError.Code.ConfigError });
|
|
896776
897296
|
}
|
|
896777
897297
|
}
|
|
896778
897298
|
if (selfhostedGithubConfig != null) {
|
|
@@ -896806,13 +897326,13 @@ generators:
|
|
|
896806
897326
|
const branchExists = await repo.remoteBranchExists(selfhostedGithubConfig.branch);
|
|
896807
897327
|
if (!branchExists) {
|
|
896808
897328
|
const parsedRepo = parseRepository(selfhostedGithubConfig.uri);
|
|
896809
|
-
interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}
|
|
897329
|
+
interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}`, void 0, { code: CliError.Code.ConfigError });
|
|
896810
897330
|
}
|
|
896811
897331
|
}
|
|
896812
897332
|
await repo.checkoutRemoteBranch(selfhostedGithubConfig.branch);
|
|
896813
897333
|
}
|
|
896814
897334
|
} catch (error50) {
|
|
896815
|
-
interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}
|
|
897335
|
+
interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
|
|
896816
897336
|
}
|
|
896817
897337
|
}
|
|
896818
897338
|
let absolutePathToLocalSnippetJSON = void 0;
|
|
@@ -896852,7 +897372,8 @@ generators:
|
|
|
896852
897372
|
ai: ai10,
|
|
896853
897373
|
autoVersioningCache,
|
|
896854
897374
|
absolutePathToSpecRepo: dirname6(workspace.absoluteFilePath),
|
|
896855
|
-
skipFernignore
|
|
897375
|
+
skipFernignore,
|
|
897376
|
+
disableTelemetry
|
|
896856
897377
|
});
|
|
896857
897378
|
interactiveTaskContext.logger.info(source_default.green("Wrote files to " + absolutePathToLocalOutput));
|
|
896858
897379
|
if (selfhostedGithubConfig != null && shouldCommit) {
|
|
@@ -896909,13 +897430,13 @@ generators:
|
|
|
896909
897430
|
interactiveTaskContext.logger.info(source_default.green("Automerge enabled on PR"));
|
|
896910
897431
|
}
|
|
896911
897432
|
if (!pipelineResult.success) {
|
|
896912
|
-
interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}
|
|
897433
|
+
interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}`, void 0, { code: CliError.Code.UserError });
|
|
896913
897434
|
}
|
|
896914
897435
|
}
|
|
896915
897436
|
});
|
|
896916
897437
|
}));
|
|
896917
897438
|
if (results.some((didSucceed) => !didSucceed)) {
|
|
896918
|
-
|
|
897439
|
+
throw new TaskAbortSignal();
|
|
896919
897440
|
}
|
|
896920
897441
|
}
|
|
896921
897442
|
function resolveAbsolutePathToLocalPreview(absolutePathToPreview, generatorInvocation) {
|
|
@@ -897118,7 +897639,7 @@ var GenerationRunner = class {
|
|
|
897118
897639
|
const results = await Promise.all(generatorGroup.generators.map(async (generatorInvocation) => {
|
|
897119
897640
|
return context3.runInteractiveTask({ name: generatorInvocation.name }, async (interactiveTaskContext) => {
|
|
897120
897641
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897121
|
-
interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system");
|
|
897642
|
+
interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system", void 0, { code: CliError.Code.ConfigError });
|
|
897122
897643
|
return;
|
|
897123
897644
|
}
|
|
897124
897645
|
try {
|
|
@@ -897152,7 +897673,7 @@ var GenerationRunner = class {
|
|
|
897152
897673
|
} catch (error50) {
|
|
897153
897674
|
if (error50 instanceof TaskAbortSignal) {
|
|
897154
897675
|
} else {
|
|
897155
|
-
interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50);
|
|
897676
|
+
interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50, { code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError });
|
|
897156
897677
|
}
|
|
897157
897678
|
}
|
|
897158
897679
|
});
|
|
@@ -897161,7 +897682,7 @@ var GenerationRunner = class {
|
|
|
897161
897682
|
async executeGenerator({ generatorGroup, generatorInvocation, context: context3, workspace, organization, irVersionOverride, outputVersionOverride, absolutePathToFernConfig, inspect: inspect6, skipFernignore, skipAutogenerationIfManualExamplesExist }) {
|
|
897162
897683
|
context3.logger.info(`Starting generation for ${generatorInvocation.name}`);
|
|
897163
897684
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897164
|
-
throw new
|
|
897685
|
+
throw new CliError({ message: "Output path is required for generation", code: CliError.Code.ConfigError });
|
|
897165
897686
|
}
|
|
897166
897687
|
const rawIr = generateIntermediateRepresentation({
|
|
897167
897688
|
workspace,
|
|
@@ -897467,7 +897988,10 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
897467
897988
|
}
|
|
897468
897989
|
const absolutePath = join8(this.context.cwd, RelativeFilePath2.of(license));
|
|
897469
897990
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
897470
|
-
throw new
|
|
897991
|
+
throw new CliError({
|
|
897992
|
+
message: `Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`,
|
|
897993
|
+
code: CliError.Code.InternalError
|
|
897994
|
+
});
|
|
897471
897995
|
}
|
|
897472
897996
|
const contents = await (0, import_promises106.readFile)(absolutePath, "utf-8");
|
|
897473
897997
|
return api_exports4.GithubLicense.custom({ contents });
|
|
@@ -897650,7 +898174,8 @@ var LegacyLocalGenerationRunner = class {
|
|
|
897650
898174
|
inspect: false,
|
|
897651
898175
|
ai: void 0,
|
|
897652
898176
|
skipFernignore: args.skipFernignore,
|
|
897653
|
-
requireEnvVars: args.requireEnvVars
|
|
898177
|
+
requireEnvVars: args.requireEnvVars,
|
|
898178
|
+
disableTelemetry: !this.context.telemetry.isTelemetryEnabled()
|
|
897654
898179
|
});
|
|
897655
898180
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
897656
898181
|
return {
|
|
@@ -897674,7 +898199,8 @@ var LegacyLocalGenerationRunner = class {
|
|
|
897674
898199
|
const executionEnvironment = new ContainerExecutionEnvironment({
|
|
897675
898200
|
containerImage,
|
|
897676
898201
|
keepContainer: args.keepContainer ?? false,
|
|
897677
|
-
runner: args.containerEngine
|
|
898202
|
+
runner: args.containerEngine,
|
|
898203
|
+
disableTelemetry: !this.context.telemetry.isTelemetryEnabled()
|
|
897678
898204
|
});
|
|
897679
898205
|
const runner = new GenerationRunner(executionEnvironment);
|
|
897680
898206
|
await runner.run({
|
|
@@ -897975,7 +898501,10 @@ var SdkTask = class {
|
|
|
897975
898501
|
getTask() {
|
|
897976
898502
|
const task = this.taskGroup.getTask(this.id);
|
|
897977
898503
|
if (task == null) {
|
|
897978
|
-
throw new
|
|
898504
|
+
throw new CliError({
|
|
898505
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
898506
|
+
code: CliError.Code.InternalError
|
|
898507
|
+
});
|
|
897979
898508
|
}
|
|
897980
898509
|
return task;
|
|
897981
898510
|
}
|
|
@@ -898207,7 +898736,7 @@ var GenerateCommand = class {
|
|
|
898207
898736
|
}
|
|
898208
898737
|
async runGeneration({ context: context3, workspace, targets: targets2, args, forceLocal }) {
|
|
898209
898738
|
if (workspace.sdks == null) {
|
|
898210
|
-
throw new
|
|
898739
|
+
throw new CliError({ message: "No SDKs configured", code: CliError.Code.InternalError });
|
|
898211
898740
|
}
|
|
898212
898741
|
const apisToCheck = [...new Set(targets2.map((t3) => t3.api))];
|
|
898213
898742
|
const apiChecker = new ApiChecker({
|
|
@@ -898889,7 +899418,10 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
898889
899418
|
const packageJsonContent = await (0, import_promises110.readFile)(packageJsonPath, "utf-8");
|
|
898890
899419
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
898891
899420
|
if (packageJson2.main == null) {
|
|
898892
|
-
throw new
|
|
899421
|
+
throw new CliError({
|
|
899422
|
+
message: `No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`,
|
|
899423
|
+
code: CliError.Code.InternalError
|
|
899424
|
+
});
|
|
898893
899425
|
}
|
|
898894
899426
|
const packageEntryPoint = (0, import_path80.join)(packageDir, packageJson2.main);
|
|
898895
899427
|
const { migrations } = await import((0, import_url8.pathToFileURL)(packageEntryPoint).href);
|
|
@@ -899004,11 +899536,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
899004
899536
|
this.logger.debug(`No migration package found for ${generatorName}.`);
|
|
899005
899537
|
return void 0;
|
|
899006
899538
|
}
|
|
899007
|
-
throw new
|
|
899539
|
+
throw new CliError({
|
|
899540
|
+
message: `Failed to load generator migrations for ${generatorName}.
|
|
899008
899541
|
|
|
899009
899542
|
Reason: ${errorMessage}
|
|
899010
899543
|
|
|
899011
|
-
Please check your internet connection and npm configuration, then try again
|
|
899544
|
+
Please check your internet connection and npm configuration, then try again.`,
|
|
899545
|
+
code: CliError.Code.InternalError
|
|
899546
|
+
});
|
|
899012
899547
|
}
|
|
899013
899548
|
}
|
|
899014
899549
|
/**
|
|
@@ -899037,7 +899572,10 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
899037
899572
|
const aVersion = import_semver14.default.parse(a4.version);
|
|
899038
899573
|
const bVersion = import_semver14.default.parse(b7.version);
|
|
899039
899574
|
if (aVersion == null || bVersion == null) {
|
|
899040
|
-
throw new
|
|
899575
|
+
throw new CliError({
|
|
899576
|
+
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.`,
|
|
899577
|
+
code: CliError.Code.InternalError
|
|
899578
|
+
});
|
|
899041
899579
|
}
|
|
899042
899580
|
return import_semver14.default.compare(aVersion, bVersion);
|
|
899043
899581
|
});
|
|
@@ -899055,11 +899593,14 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
899055
899593
|
appliedVersions.push(migration23.version);
|
|
899056
899594
|
} catch (error50) {
|
|
899057
899595
|
const errorMessage = extractErrorMessage(error50);
|
|
899058
|
-
throw new
|
|
899596
|
+
throw new CliError({
|
|
899597
|
+
message: `Failed to apply migration for version ${migration23.version}.
|
|
899059
899598
|
|
|
899060
899599
|
Reason: ${errorMessage}
|
|
899061
899600
|
|
|
899062
|
-
Please report this issue at: https://github.com/fern-api/fern/issues
|
|
899601
|
+
Please report this issue at: https://github.com/fern-api/fern/issues`,
|
|
899602
|
+
code: CliError.Code.InternalError
|
|
899603
|
+
});
|
|
899063
899604
|
}
|
|
899064
899605
|
}
|
|
899065
899606
|
return {
|
|
@@ -917803,13 +918344,17 @@ function reportError2(reporter, error50, options2) {
|
|
|
917803
918344
|
}
|
|
917804
918345
|
}
|
|
917805
918346
|
|
|
918347
|
+
// src/telemetry/isTelemetryDisabled.ts
|
|
918348
|
+
function isTelemetryDisabled() {
|
|
918349
|
+
return process.env.FERN_DISABLE_TELEMETRY === "true";
|
|
918350
|
+
}
|
|
918351
|
+
|
|
917806
918352
|
// src/telemetry/SentryClient.ts
|
|
917807
918353
|
var SentryClient = class {
|
|
917808
918354
|
sentry;
|
|
917809
918355
|
constructor({ release: release2 }) {
|
|
917810
|
-
const isTelemetryEnabled = process.env.FERN_DISABLE_TELEMETRY !== "true";
|
|
917811
918356
|
const sentryDsn = "https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496";
|
|
917812
|
-
if (
|
|
918357
|
+
if (!isTelemetryDisabled() && sentryDsn != null && sentryDsn.length > 0) {
|
|
917813
918358
|
const sentryEnvironment = "development";
|
|
917814
918359
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
917815
918360
|
throw new CliError({
|
|
@@ -917821,9 +918366,33 @@ var SentryClient = class {
|
|
|
917821
918366
|
dsn: sentryDsn,
|
|
917822
918367
|
release: release2,
|
|
917823
918368
|
environment: sentryEnvironment,
|
|
918369
|
+
// Opt out of every built-in integration (HTTP tracing, local
|
|
918370
|
+
// variables, console breadcrumbs, etc.) — error capture is all
|
|
918371
|
+
// we need.
|
|
917824
918372
|
defaultIntegrations: false,
|
|
917825
|
-
|
|
917826
|
-
|
|
918373
|
+
// Rewrite absolute frame paths to repo-root-relative paths so
|
|
918374
|
+
// they align with the source maps uploaded at publish time.
|
|
918375
|
+
// onUncaughtException / onUnhandledRejection catch errors that
|
|
918376
|
+
// escape the CLI's top-level handler (fire-and-forget callbacks,
|
|
918377
|
+
// unhandled rejections in background work, etc.).
|
|
918378
|
+
// linkedErrors chains .cause so wrapped errors stay traceable.
|
|
918379
|
+
// nodeContext adds Node.js version and OS to every event.
|
|
918380
|
+
integrations: [
|
|
918381
|
+
rewriteFramesIntegration(),
|
|
918382
|
+
onUncaughtExceptionIntegration(),
|
|
918383
|
+
onUnhandledRejectionIntegration(),
|
|
918384
|
+
linkedErrorsIntegration(),
|
|
918385
|
+
nodeContextIntegration()
|
|
918386
|
+
],
|
|
918387
|
+
// The CLI doesn't emit transactions; disable performance
|
|
918388
|
+
// sampling entirely.
|
|
918389
|
+
tracesSampleRate: 0,
|
|
918390
|
+
// Always attach a stack trace, even when the thrown value is
|
|
918391
|
+
// not an Error instance (e.g. a plain string or object).
|
|
918392
|
+
attachStacktrace: true,
|
|
918393
|
+
// Suppress the client-report envelope Sentry sends when events
|
|
918394
|
+
// are dropped (e.g. due to rate limits).
|
|
918395
|
+
sendClientReports: false
|
|
917827
918396
|
});
|
|
917828
918397
|
setSentryRunIdTags();
|
|
917829
918398
|
}
|
|
@@ -918415,7 +918984,7 @@ var CliContext = class _CliContext {
|
|
|
918415
918984
|
if (false) {
|
|
918416
918985
|
this.logger.error("CLI_VERSION is not defined");
|
|
918417
918986
|
}
|
|
918418
|
-
return "4.
|
|
918987
|
+
return "4.82.0";
|
|
918419
918988
|
}
|
|
918420
918989
|
getCliName() {
|
|
918421
918990
|
if (false) {
|
|
@@ -920342,7 +920911,8 @@ async function generateWorkspace({
|
|
|
920342
920911
|
requireEnvVars,
|
|
920343
920912
|
skipFernignore,
|
|
920344
920913
|
automationMode,
|
|
920345
|
-
autoMerge
|
|
920914
|
+
autoMerge,
|
|
920915
|
+
disableTelemetry: isTelemetryDisabled()
|
|
920346
920916
|
});
|
|
920347
920917
|
} else if (token != null) {
|
|
920348
920918
|
await runRemoteGenerationForAPIWorkspace({
|
|
@@ -931417,7 +931987,8 @@ async function sdkPreview({
|
|
|
931417
931987
|
noReplay: true,
|
|
931418
931988
|
validateWorkspace: true,
|
|
931419
931989
|
publishToRegistry,
|
|
931420
|
-
isPreview: true
|
|
931990
|
+
isPreview: true,
|
|
931991
|
+
disableTelemetry: isTelemetryDisabled()
|
|
931421
931992
|
});
|
|
931422
931993
|
});
|
|
931423
931994
|
}
|