@fern-api/fern-api-dev 4.81.0-1-g51d703eda99 → 4.81.0-11-gc0c2550bc58
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 +605 -207
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -524639,7 +524639,10 @@ function getSchemaFromFernType({ fernType, nameOverride, generatedName, title: t
|
|
|
524639
524639
|
string: (value2) => LiteralSchemaValue.string(value2),
|
|
524640
524640
|
boolean: (value2) => LiteralSchemaValue.boolean(value2),
|
|
524641
524641
|
_other: () => {
|
|
524642
|
-
throw new
|
|
524642
|
+
throw new CliError({
|
|
524643
|
+
message: "Unexpected literal type",
|
|
524644
|
+
code: CliError.Code.InternalError
|
|
524645
|
+
});
|
|
524643
524646
|
}
|
|
524644
524647
|
}),
|
|
524645
524648
|
description,
|
|
@@ -527796,7 +527799,10 @@ function convertToReferencedSchema(schema2, breadcrumbs, source2, preserveSchema
|
|
|
527796
527799
|
const availability = convertAvailability2(schema2);
|
|
527797
527800
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
527798
527801
|
if (schemaId == null) {
|
|
527799
|
-
throw new
|
|
527802
|
+
throw new CliError({
|
|
527803
|
+
message: `Invalid schema reference ${JSON.stringify(schema2)}`,
|
|
527804
|
+
code: CliError.Code.ReferenceError
|
|
527805
|
+
});
|
|
527800
527806
|
}
|
|
527801
527807
|
return Schema.reference({
|
|
527802
527808
|
// TODO(dsinghvi): references may contain files
|
|
@@ -528125,21 +528131,33 @@ var AbstractAsyncAPIParserContext = class {
|
|
|
528125
528131
|
*/
|
|
528126
528132
|
resolveSchemaReference(schema2) {
|
|
528127
528133
|
if (!schema2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
528128
|
-
throw new
|
|
528134
|
+
throw new CliError({
|
|
528135
|
+
message: `Failed to resolve schema reference: ${schema2.$ref}`,
|
|
528136
|
+
code: CliError.Code.ReferenceError
|
|
528137
|
+
});
|
|
528129
528138
|
}
|
|
528130
528139
|
const schemaKey = schema2.$ref.substring(SCHEMA_REFERENCE_PREFIX.length);
|
|
528131
528140
|
const splitSchemaKey = schemaKey.split("/");
|
|
528132
528141
|
const components = this.document.components;
|
|
528133
528142
|
if (components == null || components.schemas == null) {
|
|
528134
|
-
throw new
|
|
528143
|
+
throw new CliError({
|
|
528144
|
+
message: "Document does not have components.schemas.",
|
|
528145
|
+
code: CliError.Code.ReferenceError
|
|
528146
|
+
});
|
|
528135
528147
|
}
|
|
528136
528148
|
const [topKey, maybeProps, maybePropKey] = splitSchemaKey;
|
|
528137
528149
|
if (topKey == null || topKey === "") {
|
|
528138
|
-
throw new
|
|
528150
|
+
throw new CliError({
|
|
528151
|
+
message: `${schema2.$ref} cannot be resolved. No schema key provided.`,
|
|
528152
|
+
code: CliError.Code.ReferenceError
|
|
528153
|
+
});
|
|
528139
528154
|
}
|
|
528140
528155
|
let resolvedSchema = components.schemas[topKey];
|
|
528141
528156
|
if (resolvedSchema == null) {
|
|
528142
|
-
throw new
|
|
528157
|
+
throw new CliError({
|
|
528158
|
+
message: `Schema "${topKey}" is undefined in document.components.schemas.`,
|
|
528159
|
+
code: CliError.Code.ReferenceError
|
|
528160
|
+
});
|
|
528143
528161
|
}
|
|
528144
528162
|
if (isReferenceObject(resolvedSchema)) {
|
|
528145
528163
|
resolvedSchema = this.resolveSchemaReference(resolvedSchema);
|
|
@@ -528147,7 +528165,10 @@ var AbstractAsyncAPIParserContext = class {
|
|
|
528147
528165
|
if (maybeProps === "properties" && maybePropKey != null) {
|
|
528148
528166
|
const resolvedProperty = resolvedSchema.properties?.[maybePropKey];
|
|
528149
528167
|
if (resolvedProperty == null) {
|
|
528150
|
-
throw new
|
|
528168
|
+
throw new CliError({
|
|
528169
|
+
message: `Property "${maybePropKey}" not found on "${topKey}". Full ref: ${schema2.$ref}`,
|
|
528170
|
+
code: CliError.Code.ReferenceError
|
|
528171
|
+
});
|
|
528151
528172
|
} else if (isReferenceObject(resolvedProperty)) {
|
|
528152
528173
|
resolvedSchema = this.resolveSchemaReference(resolvedProperty);
|
|
528153
528174
|
} else {
|
|
@@ -528200,12 +528221,15 @@ var AsyncAPIV2ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
528200
528221
|
const MESSAGE_REFERENCE_PREFIX = "#/components/messages/";
|
|
528201
528222
|
const components = this.document.components;
|
|
528202
528223
|
if (components == null || components.messages == null || !message.$ref.startsWith(MESSAGE_REFERENCE_PREFIX)) {
|
|
528203
|
-
throw new
|
|
528224
|
+
throw new CliError({
|
|
528225
|
+
message: `Failed to resolve message reference: ${message.$ref} in v2 components`,
|
|
528226
|
+
code: CliError.Code.ReferenceError
|
|
528227
|
+
});
|
|
528204
528228
|
}
|
|
528205
528229
|
const messageKey = message.$ref.substring(MESSAGE_REFERENCE_PREFIX.length);
|
|
528206
528230
|
const resolvedMessage = components.messages[messageKey];
|
|
528207
528231
|
if (resolvedMessage == null) {
|
|
528208
|
-
throw new
|
|
528232
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
528209
528233
|
}
|
|
528210
528234
|
return resolvedMessage;
|
|
528211
528235
|
}
|
|
@@ -529037,7 +529061,10 @@ var ExampleTypeFactory = class _ExampleTypeFactory {
|
|
|
529037
529061
|
while (schema2.type === "reference") {
|
|
529038
529062
|
const resolvedSchema = this.schemas[schema2.schema];
|
|
529039
529063
|
if (resolvedSchema == null) {
|
|
529040
|
-
throw new
|
|
529064
|
+
throw new CliError({
|
|
529065
|
+
message: `Unexpected error: Failed to resolve schema reference: ${schema2.schema}`,
|
|
529066
|
+
code: CliError.Code.InternalError
|
|
529067
|
+
});
|
|
529041
529068
|
}
|
|
529042
529069
|
schema2 = resolvedSchema;
|
|
529043
529070
|
}
|
|
@@ -530366,7 +530393,10 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
530366
530393
|
while (schema2.type === "reference") {
|
|
530367
530394
|
const resolvedSchema = this.schemas[schema2.schema];
|
|
530368
530395
|
if (resolvedSchema == null) {
|
|
530369
|
-
throw new
|
|
530396
|
+
throw new CliError({
|
|
530397
|
+
message: `Unexpected error: Failed to resolve schema reference: ${schema2.schema}`,
|
|
530398
|
+
code: CliError.Code.InternalError
|
|
530399
|
+
});
|
|
530370
530400
|
}
|
|
530371
530401
|
schema2 = resolvedSchema;
|
|
530372
530402
|
}
|
|
@@ -530876,7 +530906,10 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530876
530906
|
getExampleMessageReference(message) {
|
|
530877
530907
|
const channelId = message.channelId ?? this.getDefaultChannelId();
|
|
530878
530908
|
if (channelId == null) {
|
|
530879
|
-
throw new
|
|
530909
|
+
throw new CliError({
|
|
530910
|
+
message: `Cannot resolve example message reference: no channelId provided and no channels found in document`,
|
|
530911
|
+
code: CliError.Code.InternalError
|
|
530912
|
+
});
|
|
530880
530913
|
}
|
|
530881
530914
|
return `#/channels/${channelId}/messages/${message.messageId}`;
|
|
530882
530915
|
}
|
|
@@ -530891,12 +530924,12 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530891
530924
|
resolveParameterReference(parameter6) {
|
|
530892
530925
|
const PARAMETER_REFERENCE_PREFIX2 = "#/components/parameters/";
|
|
530893
530926
|
if (this.document.components == null || this.document.components.parameters == null || !parameter6.$ref.startsWith(PARAMETER_REFERENCE_PREFIX2)) {
|
|
530894
|
-
throw new
|
|
530927
|
+
throw new CliError({ message: `Failed to resolve ${parameter6.$ref}`, code: CliError.Code.ReferenceError });
|
|
530895
530928
|
}
|
|
530896
530929
|
const parameterKey = parameter6.$ref.substring(PARAMETER_REFERENCE_PREFIX2.length);
|
|
530897
530930
|
const resolvedParameter = this.document.components.parameters[parameterKey];
|
|
530898
530931
|
if (resolvedParameter == null) {
|
|
530899
|
-
throw new
|
|
530932
|
+
throw new CliError({ message: `${parameter6.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530900
530933
|
}
|
|
530901
530934
|
if ("$ref" in resolvedParameter) {
|
|
530902
530935
|
return this.resolveParameterReference(resolvedParameter);
|
|
@@ -530908,10 +530941,16 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530908
530941
|
const CHANNELS_PATH_PART = "#/channels/";
|
|
530909
530942
|
const MESSAGE_REFERENCE_PREFIX = "#/components/messages/";
|
|
530910
530943
|
if (message == null) {
|
|
530911
|
-
throw new
|
|
530944
|
+
throw new CliError({
|
|
530945
|
+
message: "Cannot resolve message reference: message is null or undefined",
|
|
530946
|
+
code: CliError.Code.InternalError
|
|
530947
|
+
});
|
|
530912
530948
|
}
|
|
530913
530949
|
if (!message.$ref) {
|
|
530914
|
-
throw new
|
|
530950
|
+
throw new CliError({
|
|
530951
|
+
message: "Cannot resolve message reference: message.$ref is undefined or empty",
|
|
530952
|
+
code: CliError.Code.ReferenceError
|
|
530953
|
+
});
|
|
530915
530954
|
}
|
|
530916
530955
|
if (message.$ref.startsWith(CHANNELS_PATH_PART)) {
|
|
530917
530956
|
const parts = message.$ref.split("/");
|
|
@@ -530919,12 +530958,15 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530919
530958
|
const messageKey2 = parts[4];
|
|
530920
530959
|
const channelPath = rawChannelPath?.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
530921
530960
|
if (channelPath == null || messageKey2 == null || !this.document.channels?.[channelPath]) {
|
|
530922
|
-
throw new
|
|
530961
|
+
throw new CliError({
|
|
530962
|
+
message: `Failed to resolve message reference ${message.$ref} in channel ${channelPath}`,
|
|
530963
|
+
code: CliError.Code.ReferenceError
|
|
530964
|
+
});
|
|
530923
530965
|
}
|
|
530924
530966
|
const channel3 = this.document.channels[channelPath];
|
|
530925
530967
|
const resolvedInChannel = channel3.messages?.[messageKey2];
|
|
530926
530968
|
if (resolvedInChannel == null) {
|
|
530927
|
-
throw new
|
|
530969
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530928
530970
|
}
|
|
530929
530971
|
if ("$ref" in resolvedInChannel && !shallow) {
|
|
530930
530972
|
return this.resolveMessageReference(resolvedInChannel);
|
|
@@ -530937,12 +530979,15 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530937
530979
|
}
|
|
530938
530980
|
const components = this.document.components;
|
|
530939
530981
|
if (!message.$ref.startsWith(MESSAGE_REFERENCE_PREFIX) || !components?.messages) {
|
|
530940
|
-
throw new
|
|
530982
|
+
throw new CliError({
|
|
530983
|
+
message: `Failed to resolve message reference: ${message.$ref} in v3 components`,
|
|
530984
|
+
code: CliError.Code.ReferenceError
|
|
530985
|
+
});
|
|
530941
530986
|
}
|
|
530942
530987
|
const messageKey = message.$ref.substring(MESSAGE_REFERENCE_PREFIX.length);
|
|
530943
530988
|
const resolvedInComponents = components.messages[messageKey];
|
|
530944
530989
|
if (resolvedInComponents == null) {
|
|
530945
|
-
throw new
|
|
530990
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530946
530991
|
}
|
|
530947
530992
|
return {
|
|
530948
530993
|
...resolvedInComponents,
|
|
@@ -531065,14 +531110,20 @@ function parseAsyncAPIV3({ context: context3, breadcrumbs, source: source2, asyn
|
|
|
531065
531110
|
}));
|
|
531066
531111
|
const channelEvent = channelEvents[channelPath];
|
|
531067
531112
|
if (channelEvent == null) {
|
|
531068
|
-
throw new
|
|
531113
|
+
throw new CliError({
|
|
531114
|
+
message: `Internal error: channelEvents["${channelPath}"] is unexpectedly undefined for operation ${operationId}`,
|
|
531115
|
+
code: CliError.Code.InternalError
|
|
531116
|
+
});
|
|
531069
531117
|
}
|
|
531070
531118
|
if (operation.action === "receive") {
|
|
531071
531119
|
channelEvent.subscribe.push(...messagesWithMethodName);
|
|
531072
531120
|
} else if (operation.action === "send") {
|
|
531073
531121
|
channelEvent.publish.push(...messagesWithMethodName);
|
|
531074
531122
|
} else {
|
|
531075
|
-
throw new
|
|
531123
|
+
throw new CliError({
|
|
531124
|
+
message: `Operation ${operationId} has an invalid action: ${operation.action}`,
|
|
531125
|
+
code: CliError.Code.ValidationError
|
|
531126
|
+
});
|
|
531076
531127
|
}
|
|
531077
531128
|
}
|
|
531078
531129
|
for (const [channelPath, events] of Object.entries(channelEvents)) {
|
|
@@ -531336,42 +531387,63 @@ function decodeJsonPointerSegment(segment) {
|
|
|
531336
531387
|
}
|
|
531337
531388
|
function getChannelPathFromOperation(operation) {
|
|
531338
531389
|
if (!operation.channel) {
|
|
531339
|
-
throw new
|
|
531390
|
+
throw new CliError({
|
|
531391
|
+
message: "Operation is missing required 'channel' field",
|
|
531392
|
+
code: CliError.Code.ValidationError
|
|
531393
|
+
});
|
|
531340
531394
|
}
|
|
531341
531395
|
if (!operation.channel.$ref) {
|
|
531342
|
-
throw new
|
|
531396
|
+
throw new CliError({
|
|
531397
|
+
message: "Operation channel is missing required '$ref' field",
|
|
531398
|
+
code: CliError.Code.ValidationError
|
|
531399
|
+
});
|
|
531343
531400
|
}
|
|
531344
531401
|
if (!operation.channel.$ref.startsWith(CHANNEL_REFERENCE_PREFIX)) {
|
|
531345
|
-
throw new
|
|
531402
|
+
throw new CliError({
|
|
531403
|
+
message: `Failed to resolve channel path from operation ${operation.channel.$ref}`,
|
|
531404
|
+
code: CliError.Code.ReferenceError
|
|
531405
|
+
});
|
|
531346
531406
|
}
|
|
531347
531407
|
return decodeJsonPointerSegment(operation.channel.$ref.substring(CHANNEL_REFERENCE_PREFIX.length));
|
|
531348
531408
|
}
|
|
531349
531409
|
function convertChannelParameterLocation(location2) {
|
|
531350
|
-
|
|
531351
|
-
|
|
531352
|
-
|
|
531353
|
-
|
|
531354
|
-
|
|
531355
|
-
|
|
531356
|
-
|
|
531357
|
-
|
|
531358
|
-
|
|
531359
|
-
|
|
531360
|
-
|
|
531361
|
-
|
|
531362
|
-
|
|
531363
|
-
} catch (error50) {
|
|
531364
|
-
throw new Error(`Invalid location format: ${location2}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`);
|
|
531410
|
+
const ASYNCAPI_RUNTIME_EXPRESSION_DOCS = "https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression";
|
|
531411
|
+
const [messageType, parameterKey] = location2.split("#/");
|
|
531412
|
+
if (messageType == null || parameterKey == null) {
|
|
531413
|
+
throw new CliError({
|
|
531414
|
+
message: `Invalid location format: ${location2}; unable to parse message type and parameter key. See ${ASYNCAPI_RUNTIME_EXPRESSION_DOCS} for the expected format.`,
|
|
531415
|
+
code: CliError.Code.ValidationError
|
|
531416
|
+
});
|
|
531417
|
+
}
|
|
531418
|
+
if (!messageType.startsWith(LOCATION_PREFIX)) {
|
|
531419
|
+
throw new CliError({
|
|
531420
|
+
message: `Invalid location format: ${location2}; expected ${LOCATION_PREFIX} prefix`,
|
|
531421
|
+
code: CliError.Code.ValidationError
|
|
531422
|
+
});
|
|
531365
531423
|
}
|
|
531424
|
+
const type8 = messageType.substring(LOCATION_PREFIX.length);
|
|
531425
|
+
if (type8 !== "header" && type8 !== "path" && type8 !== "payload") {
|
|
531426
|
+
throw new CliError({
|
|
531427
|
+
message: `Invalid message type: ${type8}. Must be one of: header, path, payload`,
|
|
531428
|
+
code: CliError.Code.ValidationError
|
|
531429
|
+
});
|
|
531430
|
+
}
|
|
531431
|
+
return { type: type8, parameterKey };
|
|
531366
531432
|
}
|
|
531367
531433
|
function getServerNameFromServerRef(servers, serverRef) {
|
|
531368
531434
|
if (!serverRef.$ref.startsWith(SERVER_REFERENCE_PREFIX)) {
|
|
531369
|
-
throw new
|
|
531435
|
+
throw new CliError({
|
|
531436
|
+
message: `Failed to resolve server name from server ref ${serverRef.$ref}`,
|
|
531437
|
+
code: CliError.Code.ReferenceError
|
|
531438
|
+
});
|
|
531370
531439
|
}
|
|
531371
531440
|
const serverName = serverRef.$ref.substring(SERVER_REFERENCE_PREFIX.length);
|
|
531372
531441
|
const server = servers[serverName];
|
|
531373
531442
|
if (server == null) {
|
|
531374
|
-
throw new
|
|
531443
|
+
throw new CliError({
|
|
531444
|
+
message: `Failed to find server with name ${serverName}`,
|
|
531445
|
+
code: CliError.Code.ReferenceError
|
|
531446
|
+
});
|
|
531375
531447
|
}
|
|
531376
531448
|
return server;
|
|
531377
531449
|
}
|
|
@@ -531560,7 +531632,7 @@ function convertPaginationExtension(pagination) {
|
|
|
531560
531632
|
results: customPagination.results
|
|
531561
531633
|
});
|
|
531562
531634
|
}
|
|
531563
|
-
throw new
|
|
531635
|
+
throw new CliError({ message: "Invalid pagination extension", code: CliError.Code.ValidationError });
|
|
531564
531636
|
}
|
|
531565
531637
|
function getFernPaginationExtension(document4, operation) {
|
|
531566
531638
|
const pagination = getExtension(operation, FernOpenAPIExtension.PAGINATION);
|
|
@@ -531570,7 +531642,10 @@ function getFernPaginationExtension(document4, operation) {
|
|
|
531570
531642
|
if (typeof pagination === "boolean") {
|
|
531571
531643
|
const topLevelPagination = getExtension(document4, FernOpenAPIExtension.PAGINATION);
|
|
531572
531644
|
if (typeof topLevelPagination === "boolean") {
|
|
531573
|
-
throw new
|
|
531645
|
+
throw new CliError({
|
|
531646
|
+
message: "Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",
|
|
531647
|
+
code: CliError.Code.ValidationError
|
|
531648
|
+
});
|
|
531574
531649
|
}
|
|
531575
531650
|
return topLevelPagination == null ? void 0 : convertPaginationExtension(topLevelPagination);
|
|
531576
531651
|
}
|
|
@@ -531889,12 +531964,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531889
531964
|
}
|
|
531890
531965
|
resolveParameterReference(parameter6) {
|
|
531891
531966
|
if (this.document.components == null || this.document.components.parameters == null || !parameter6.$ref.startsWith(PARAMETER_REFERENCE_PREFIX)) {
|
|
531892
|
-
throw new
|
|
531967
|
+
throw new CliError({ message: `Failed to resolve ${parameter6.$ref}`, code: CliError.Code.ReferenceError });
|
|
531893
531968
|
}
|
|
531894
531969
|
const parameterKey = parameter6.$ref.substring(PARAMETER_REFERENCE_PREFIX.length);
|
|
531895
531970
|
const resolvedParameter = this.document.components.parameters[parameterKey];
|
|
531896
531971
|
if (resolvedParameter == null) {
|
|
531897
|
-
throw new
|
|
531972
|
+
throw new CliError({ message: `${parameter6.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531898
531973
|
}
|
|
531899
531974
|
if (isReferenceObject(resolvedParameter)) {
|
|
531900
531975
|
return this.resolveParameterReference(resolvedParameter);
|
|
@@ -531903,12 +531978,15 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531903
531978
|
}
|
|
531904
531979
|
resolveRequestBodyReference(requestBody) {
|
|
531905
531980
|
if (this.document.components == null || this.document.components.requestBodies == null || !requestBody.$ref.startsWith(REQUEST_BODY_REFERENCE_PREFIX)) {
|
|
531906
|
-
throw new
|
|
531981
|
+
throw new CliError({
|
|
531982
|
+
message: `Failed to resolve ${requestBody.$ref}`,
|
|
531983
|
+
code: CliError.Code.ReferenceError
|
|
531984
|
+
});
|
|
531907
531985
|
}
|
|
531908
531986
|
const requestBodyKey = requestBody.$ref.substring(REQUEST_BODY_REFERENCE_PREFIX.length);
|
|
531909
531987
|
const resolvedRequestBody = this.document.components.requestBodies[requestBodyKey];
|
|
531910
531988
|
if (resolvedRequestBody == null) {
|
|
531911
|
-
throw new
|
|
531989
|
+
throw new CliError({ message: `${requestBody.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531912
531990
|
}
|
|
531913
531991
|
if (isReferenceObject(resolvedRequestBody)) {
|
|
531914
531992
|
return this.resolveRequestBodyReference(resolvedRequestBody);
|
|
@@ -531917,12 +531995,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531917
531995
|
}
|
|
531918
531996
|
resolveResponseReference(response) {
|
|
531919
531997
|
if (this.document.components == null || this.document.components.responses == null || !response.$ref.startsWith(RESPONSE_REFERENCE_PREFIX)) {
|
|
531920
|
-
throw new
|
|
531998
|
+
throw new CliError({ message: `Failed to resolve ${response.$ref}`, code: CliError.Code.ReferenceError });
|
|
531921
531999
|
}
|
|
531922
532000
|
const parameterKey = response.$ref.substring(RESPONSE_REFERENCE_PREFIX.length);
|
|
531923
532001
|
const resolvedResponse = this.document.components.responses[parameterKey];
|
|
531924
532002
|
if (resolvedResponse == null) {
|
|
531925
|
-
throw new
|
|
532003
|
+
throw new CliError({ message: `${response.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531926
532004
|
}
|
|
531927
532005
|
if (isReferenceObject(resolvedResponse)) {
|
|
531928
532006
|
return this.resolveResponseReference(resolvedResponse);
|
|
@@ -531931,12 +532009,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531931
532009
|
}
|
|
531932
532010
|
resolveExampleReference(example) {
|
|
531933
532011
|
if (this.document.components == null || this.document.components.examples == null || !example.$ref.startsWith(EXAMPLES_REFERENCE_PREFIX)) {
|
|
531934
|
-
throw new
|
|
532012
|
+
throw new CliError({ message: `Failed to resolve ${example.$ref}`, code: CliError.Code.ReferenceError });
|
|
531935
532013
|
}
|
|
531936
532014
|
const parameterKey = example.$ref.substring(EXAMPLES_REFERENCE_PREFIX.length);
|
|
531937
532015
|
const resolvedExample = this.document.components.examples[parameterKey];
|
|
531938
532016
|
if (resolvedExample == null) {
|
|
531939
|
-
throw new
|
|
532017
|
+
throw new CliError({ message: `${example.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531940
532018
|
}
|
|
531941
532019
|
if (isReferenceObject(resolvedExample)) {
|
|
531942
532020
|
return this.resolveExampleReference(resolvedExample);
|
|
@@ -531945,12 +532023,15 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531945
532023
|
}
|
|
531946
532024
|
resolveSecuritySchemeReference(securityScheme) {
|
|
531947
532025
|
if (this.document.components == null || this.document.components.securitySchemes == null || !securityScheme.$ref.startsWith(SECURITY_SCHEME_REFERENCE_PREFIX)) {
|
|
531948
|
-
throw new
|
|
532026
|
+
throw new CliError({
|
|
532027
|
+
message: `Failed to resolve ${securityScheme.$ref}`,
|
|
532028
|
+
code: CliError.Code.ReferenceError
|
|
532029
|
+
});
|
|
531949
532030
|
}
|
|
531950
532031
|
const securitySchemeKey = securityScheme.$ref.substring(SECURITY_SCHEME_REFERENCE_PREFIX.length);
|
|
531951
532032
|
const resolvedSecurityScheme = this.document.components.securitySchemes[securitySchemeKey];
|
|
531952
532033
|
if (resolvedSecurityScheme == null) {
|
|
531953
|
-
throw new
|
|
532034
|
+
throw new CliError({ message: `${securityScheme.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531954
532035
|
}
|
|
531955
532036
|
if (isReferenceObject(resolvedSecurityScheme)) {
|
|
531956
532037
|
return this.resolveSecuritySchemeReference(resolvedSecurityScheme);
|
|
@@ -532710,15 +532791,24 @@ function getMultipartPartEncodingFromContentType(contentType) {
|
|
|
532710
532791
|
}
|
|
532711
532792
|
function resolveSchema(schema2, document4) {
|
|
532712
532793
|
if (!schema2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
532713
|
-
throw new
|
|
532794
|
+
throw new CliError({
|
|
532795
|
+
message: `Failed to resolve schema reference because of unsupported prefix: ${schema2.$ref}`,
|
|
532796
|
+
code: CliError.Code.ReferenceError
|
|
532797
|
+
});
|
|
532714
532798
|
}
|
|
532715
532799
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
532716
532800
|
if (schemaId == null) {
|
|
532717
|
-
throw new
|
|
532801
|
+
throw new CliError({
|
|
532802
|
+
message: `Failed to resolve schema reference because missing schema id: ${schema2.$ref}`,
|
|
532803
|
+
code: CliError.Code.ReferenceError
|
|
532804
|
+
});
|
|
532718
532805
|
}
|
|
532719
532806
|
const resolvedSchema = document4.components?.schemas?.[schemaId];
|
|
532720
532807
|
if (resolvedSchema == null) {
|
|
532721
|
-
throw new
|
|
532808
|
+
throw new CliError({
|
|
532809
|
+
message: `Failed to resolve schema reference because missing: ${schema2.$ref}`,
|
|
532810
|
+
code: CliError.Code.ReferenceError
|
|
532811
|
+
});
|
|
532722
532812
|
}
|
|
532723
532813
|
if (isReferenceObject(resolvedSchema)) {
|
|
532724
532814
|
return resolveSchema(resolvedSchema, document4);
|
|
@@ -534215,7 +534305,10 @@ function getBasicSecuritySchemeNameAndEnvvar(securityScheme) {
|
|
|
534215
534305
|
function convertSecurityScheme(securityScheme, source2, taskContext, context3) {
|
|
534216
534306
|
if (isReferenceObject(securityScheme)) {
|
|
534217
534307
|
if (context3 == null) {
|
|
534218
|
-
throw new
|
|
534308
|
+
throw new CliError({
|
|
534309
|
+
message: `Converting referenced security schemes requires context: ${JSON.stringify(securityScheme)}`,
|
|
534310
|
+
code: CliError.Code.InternalError
|
|
534311
|
+
});
|
|
534219
534312
|
}
|
|
534220
534313
|
const resolvedSecurityScheme = context3.resolveSecuritySchemeReference(securityScheme);
|
|
534221
534314
|
return convertSecuritySchemeHelper(resolvedSecurityScheme, source2, taskContext);
|
|
@@ -534396,7 +534489,10 @@ function getVariableDefinitions(document4, preserveSchemaIds) {
|
|
|
534396
534489
|
}
|
|
534397
534490
|
];
|
|
534398
534491
|
} else {
|
|
534399
|
-
throw new
|
|
534492
|
+
throw new CliError({
|
|
534493
|
+
message: `Variable ${variableName} has unsupported schema ${JSON.stringify(schema2)}`,
|
|
534494
|
+
code: CliError.Code.ValidationError
|
|
534495
|
+
});
|
|
534400
534496
|
}
|
|
534401
534497
|
}));
|
|
534402
534498
|
}
|
|
@@ -535712,7 +535808,7 @@ async function validateSchema({ schema: schema2, value: value2, context: context
|
|
|
535712
535808
|
});
|
|
535713
535809
|
});
|
|
535714
535810
|
const errorMessage = [`Failed to parse file: ${import_path20.default.relative(process.cwd(), filepathBeingParsed)}`, ...issues].join("\n");
|
|
535715
|
-
return context3.failAndThrow(errorMessage);
|
|
535811
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
535716
535812
|
}
|
|
535717
535813
|
function joinZodPath(arr) {
|
|
535718
535814
|
return arr.reduce((acc, value2) => {
|
|
@@ -535745,7 +535841,9 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535745
535841
|
path: versionOrPath
|
|
535746
535842
|
};
|
|
535747
535843
|
} else {
|
|
535748
|
-
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}
|
|
535844
|
+
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}`, void 0, {
|
|
535845
|
+
code: CliError.Code.ConfigError
|
|
535846
|
+
});
|
|
535749
535847
|
}
|
|
535750
535848
|
} else {
|
|
535751
535849
|
const unprefixedCoordinate = coordinate.substring(1);
|
|
@@ -535760,12 +535858,14 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535760
535858
|
version: versionOrPath
|
|
535761
535859
|
};
|
|
535762
535860
|
} else {
|
|
535763
|
-
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}
|
|
535861
|
+
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}`, void 0, {
|
|
535862
|
+
code: CliError.Code.ConfigError
|
|
535863
|
+
});
|
|
535764
535864
|
}
|
|
535765
535865
|
}
|
|
535766
535866
|
}
|
|
535767
535867
|
if (context3.getResult() === TaskResult.Failure) {
|
|
535768
|
-
context3.failAndThrow();
|
|
535868
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ConfigError });
|
|
535769
535869
|
}
|
|
535770
535870
|
return {
|
|
535771
535871
|
dependencies
|
|
@@ -535921,7 +536021,7 @@ function getColorInstanceFromRawConfigOrThrow(raw, context3, key2, theme) {
|
|
|
535921
536021
|
}
|
|
535922
536022
|
const instance = tinycolor(color3);
|
|
535923
536023
|
if (!instance.isValid()) {
|
|
535924
|
-
context3.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF
|
|
536024
|
+
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
536025
|
}
|
|
535926
536026
|
return instance;
|
|
535927
536027
|
}
|
|
@@ -536535,7 +536635,7 @@ async function parseContext7File({ rawPath, absoluteFilepathToDocsConfig, contex
|
|
|
536535
536635
|
try {
|
|
536536
536636
|
JSON.parse(contents);
|
|
536537
536637
|
} catch (error50) {
|
|
536538
|
-
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50));
|
|
536638
|
+
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50), { code: CliError.Code.ConfigError });
|
|
536539
536639
|
}
|
|
536540
536640
|
return absolutePath;
|
|
536541
536641
|
}
|
|
@@ -536695,7 +536795,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536695
536795
|
featureFlags: convertFeatureFlag(product.featureFlag)
|
|
536696
536796
|
});
|
|
536697
536797
|
} else {
|
|
536698
|
-
throw new
|
|
536798
|
+
throw new CliError({
|
|
536799
|
+
message: `Invalid product configuration: product must have either 'path' or valid 'href' property`,
|
|
536800
|
+
code: CliError.Code.ConfigError
|
|
536801
|
+
});
|
|
536699
536802
|
}
|
|
536700
536803
|
}
|
|
536701
536804
|
return {
|
|
@@ -536710,7 +536813,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536710
536813
|
folderTitleSource
|
|
536711
536814
|
});
|
|
536712
536815
|
}
|
|
536713
|
-
throw new
|
|
536816
|
+
throw new CliError({
|
|
536817
|
+
message: "Unexpected. Docs have neither navigation or versions defined.",
|
|
536818
|
+
code: CliError.Code.ConfigError
|
|
536819
|
+
});
|
|
536714
536820
|
}
|
|
536715
536821
|
function convertFeatureFlag(flag) {
|
|
536716
536822
|
if (flag == null) {
|
|
@@ -536808,7 +536914,10 @@ function parseWeight(weight) {
|
|
|
536808
536914
|
async function convertNavigationTabConfiguration({ tabs, item, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536809
536915
|
const tab2 = tabs[item.tab];
|
|
536810
536916
|
if (tab2 == null) {
|
|
536811
|
-
throw new
|
|
536917
|
+
throw new CliError({
|
|
536918
|
+
message: `Tab ${item.tab} is not defined in the tabs config.`,
|
|
536919
|
+
code: CliError.Code.ConfigError
|
|
536920
|
+
});
|
|
536812
536921
|
}
|
|
536813
536922
|
if (tabbedNavigationItemHasVariants(item)) {
|
|
536814
536923
|
const variants = await Promise.all(item.variants.map(async (variant) => {
|
|
@@ -536937,7 +537046,9 @@ var DEFAULT_CHANGELOG_TITLE = "Changelog";
|
|
|
536937
537046
|
async function expandFolderConfiguration({ rawConfig, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536938
537047
|
const folderPath = resolveFilepath(rawConfig.folder, absolutePathToConfig);
|
|
536939
537048
|
if (!await doesPathExist(folderPath)) {
|
|
536940
|
-
context3.failAndThrow(`Folder not found: ${rawConfig.folder}
|
|
537049
|
+
context3.failAndThrow(`Folder not found: ${rawConfig.folder}`, void 0, {
|
|
537050
|
+
code: CliError.Code.ConfigError
|
|
537051
|
+
});
|
|
536941
537052
|
}
|
|
536942
537053
|
validateCollapsibleConfig({
|
|
536943
537054
|
context: context3,
|
|
@@ -537260,7 +537371,10 @@ function parseLibrariesConfiguration(libraries) {
|
|
|
537260
537371
|
const result = {};
|
|
537261
537372
|
for (const [name2, config5] of Object.entries(libraries)) {
|
|
537262
537373
|
if (!isGitLibraryInput(config5.input)) {
|
|
537263
|
-
throw new
|
|
537374
|
+
throw new CliError({
|
|
537375
|
+
message: `Library '${name2}' uses 'path' input which is not yet supported. Please use 'git' input.`,
|
|
537376
|
+
code: CliError.Code.ConfigError
|
|
537377
|
+
});
|
|
537264
537378
|
}
|
|
537265
537379
|
result[name2] = {
|
|
537266
537380
|
input: {
|
|
@@ -537449,10 +537563,10 @@ function parseAudiences(raw) {
|
|
|
537449
537563
|
}
|
|
537450
537564
|
function validateCollapsibleConfig({ context: context3, sectionTitle, collapsed, collapsible, collapsedByDefault }) {
|
|
537451
537565
|
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
|
|
537566
|
+
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
537567
|
}
|
|
537454
537568
|
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
|
|
537569
|
+
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
537570
|
}
|
|
537457
537571
|
}
|
|
537458
537572
|
|
|
@@ -537727,7 +537841,9 @@ function removeDefaultDockerOrgIfPresent(generatorName) {
|
|
|
537727
537841
|
function getGeneratorNameOrThrow(generatorName, context3) {
|
|
537728
537842
|
const normalizedGeneratorName = normalizeGeneratorName(generatorName);
|
|
537729
537843
|
if (normalizedGeneratorName == null) {
|
|
537730
|
-
return context3.failAndThrow("Unrecognized generator: " + generatorName
|
|
537844
|
+
return context3.failAndThrow("Unrecognized generator: " + generatorName, void 0, {
|
|
537845
|
+
code: CliError.Code.ConfigError
|
|
537846
|
+
});
|
|
537731
537847
|
}
|
|
537732
537848
|
return normalizedGeneratorName;
|
|
537733
537849
|
}
|
|
@@ -537854,9 +537970,9 @@ async function updateGeneratorGroup({ generatorsConfiguration, groupName = gener
|
|
|
537854
537970
|
const availableGroups = Object.keys(generatorsConfiguration.groups ?? {});
|
|
537855
537971
|
if (availableGroups.length > 0) {
|
|
537856
537972
|
const message = "No group specified. Use the --group option:\n" + availableGroups.map((name2) => ` \u203A ${name2}`).join("\n");
|
|
537857
|
-
return context3.failAndThrow(message);
|
|
537973
|
+
return context3.failAndThrow(message, void 0, { code: CliError.Code.ConfigError });
|
|
537858
537974
|
}
|
|
537859
|
-
return context3.failAndThrow("No group specified.");
|
|
537975
|
+
return context3.failAndThrow("No group specified.", void 0, { code: CliError.Code.ConfigError });
|
|
537860
537976
|
}
|
|
537861
537977
|
const groups2 = generatorsConfiguration.groups ??= {};
|
|
537862
537978
|
const group = groups2[groupName];
|
|
@@ -537880,7 +537996,9 @@ async function addGenerator({ generatorName, generatorsConfiguration, groupName
|
|
|
537880
537996
|
context: context3,
|
|
537881
537997
|
update: async (group) => {
|
|
537882
537998
|
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}
|
|
537999
|
+
context3.failAndThrow(`${generatorName} is already installed in group ${groupName}.`, void 0, {
|
|
538000
|
+
code: CliError.Code.ConfigError
|
|
538001
|
+
});
|
|
537884
538002
|
}
|
|
537885
538003
|
const latestVersion2 = await getLatestGeneratorVersion({
|
|
537886
538004
|
cliVersion,
|
|
@@ -544443,7 +544561,10 @@ function parseRemoveDiscriminantsFromSchemas(option) {
|
|
|
544443
544561
|
} else if (option === "never") {
|
|
544444
544562
|
return generators_yml_exports.RemoveDiscriminantsFromSchemas.Never;
|
|
544445
544563
|
}
|
|
544446
|
-
throw new
|
|
544564
|
+
throw new CliError({
|
|
544565
|
+
message: `Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${option}`,
|
|
544566
|
+
code: CliError.Code.ConfigError
|
|
544567
|
+
});
|
|
544447
544568
|
}
|
|
544448
544569
|
function mergeSettings(base4, override) {
|
|
544449
544570
|
return {
|
|
@@ -545010,7 +545131,10 @@ async function getGithubLicense({ absolutePathToGeneratorsConfiguration, githubL
|
|
|
545010
545131
|
function getGithubPublishInfo(output2, maybeGroupLevelMetadata, maybeTopLevelMetadata) {
|
|
545011
545132
|
switch (output2.location) {
|
|
545012
545133
|
case "local-file-system":
|
|
545013
|
-
throw new
|
|
545134
|
+
throw new CliError({
|
|
545135
|
+
message: "Cannot use local-file-system with github publishing",
|
|
545136
|
+
code: CliError.Code.ConfigError
|
|
545137
|
+
});
|
|
545014
545138
|
case "npm":
|
|
545015
545139
|
return api_exports4.GithubPublishInfo.npm({
|
|
545016
545140
|
registryUrl: output2.url ?? "https://registry.npmjs.org",
|
|
@@ -545203,7 +545327,10 @@ async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context
|
|
|
545203
545327
|
if (parsed.ok) {
|
|
545204
545328
|
return parsed.value;
|
|
545205
545329
|
}
|
|
545206
|
-
throw new
|
|
545330
|
+
throw new CliError({
|
|
545331
|
+
message: parsed.errors.map((e5) => e5.message).join("\n"),
|
|
545332
|
+
code: CliError.Code.ConfigError
|
|
545333
|
+
});
|
|
545207
545334
|
} catch (e5) {
|
|
545208
545335
|
if (e5 instanceof jsYaml.YAMLException) {
|
|
545209
545336
|
const relativePath = import_path24.default.relative(process.cwd(), filepath);
|
|
@@ -545225,7 +545352,7 @@ ${e5.mark.snippet}`;
|
|
|
545225
545352
|
errorMessage += '\n\nHint: Values starting with "@" (such as scoped npm packages) must be wrapped in quotes.\n Example: package-name: "@scope/package"';
|
|
545226
545353
|
}
|
|
545227
545354
|
}
|
|
545228
|
-
context3.failAndThrow(errorMessage);
|
|
545355
|
+
context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
545229
545356
|
} else {
|
|
545230
545357
|
throw e5;
|
|
545231
545358
|
}
|
|
@@ -551709,7 +551836,7 @@ function parseTypeName({ typeName, file: file4 }) {
|
|
|
551709
551836
|
imports: file4.imports
|
|
551710
551837
|
});
|
|
551711
551838
|
if (reference4 == null) {
|
|
551712
|
-
throw new
|
|
551839
|
+
throw new CliError({ message: "Failed to locate type: " + typeName, code: CliError.Code.ResolutionError });
|
|
551713
551840
|
}
|
|
551714
551841
|
const nameWithoutId = {
|
|
551715
551842
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -551919,7 +552046,7 @@ function convertHttpRequestBody({ request: request7, file: file4 }) {
|
|
|
551919
552046
|
}
|
|
551920
552047
|
if (isInlineRequestBody(request7.body)) {
|
|
551921
552048
|
if (request7.name == null) {
|
|
551922
|
-
throw new
|
|
552049
|
+
throw new CliError({ message: "Name is missing for inlined request", code: CliError.Code.InternalError });
|
|
551923
552050
|
}
|
|
551924
552051
|
return HttpRequestBody.inlinedRequestBody({
|
|
551925
552052
|
name: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552009,13 +552136,19 @@ function getObjectPropertyFromResolvedType({ typeResolver, file: file4, resolved
|
|
|
552009
552136
|
default:
|
|
552010
552137
|
assertNever(resolvedType);
|
|
552011
552138
|
}
|
|
552012
|
-
throw new
|
|
552139
|
+
throw new CliError({
|
|
552140
|
+
message: "Internal error; response must be an object in order to return a property as a response",
|
|
552141
|
+
code: CliError.Code.InternalError
|
|
552142
|
+
});
|
|
552013
552143
|
}
|
|
552014
552144
|
function getObjectPropertyFromObjectSchema({ typeResolver, file: file4, objectSchema, property: property24 }) {
|
|
552015
552145
|
const properties7 = getAllPropertiesForRawObjectSchema(objectSchema, file4, typeResolver);
|
|
552016
552146
|
const objectProperty = properties7[property24];
|
|
552017
552147
|
if (objectProperty == null) {
|
|
552018
|
-
throw new
|
|
552148
|
+
throw new CliError({
|
|
552149
|
+
message: `Object does not have a property named ${property24}.`,
|
|
552150
|
+
code: CliError.Code.ReferenceError
|
|
552151
|
+
});
|
|
552019
552152
|
}
|
|
552020
552153
|
return objectProperty;
|
|
552021
552154
|
}
|
|
@@ -552048,7 +552181,10 @@ function getAllPropertiesForExtendedType(extendedType, file4, typeResolver) {
|
|
|
552048
552181
|
if (resolvedType._type === "named" && isRawObjectDefinition(resolvedType.declaration)) {
|
|
552049
552182
|
return getAllPropertiesForRawObjectSchema(resolvedType.declaration, file4, typeResolver);
|
|
552050
552183
|
}
|
|
552051
|
-
throw new
|
|
552184
|
+
throw new CliError({
|
|
552185
|
+
message: `Extended type ${extendedType} must be another named type`,
|
|
552186
|
+
code: CliError.Code.InternalError
|
|
552187
|
+
});
|
|
552052
552188
|
}
|
|
552053
552189
|
|
|
552054
552190
|
// ../generation/ir-generator/lib/converters/services/convertProperty.js
|
|
@@ -552112,7 +552248,10 @@ function getPropertyTypeFromObjectSchema({ typeResolver, file: file4, objectSche
|
|
|
552112
552248
|
});
|
|
552113
552249
|
const propertyType = properties7[property24];
|
|
552114
552250
|
if (propertyType == null) {
|
|
552115
|
-
throw new
|
|
552251
|
+
throw new CliError({
|
|
552252
|
+
message: `Response does not have a property named ${property24}.`,
|
|
552253
|
+
code: CliError.Code.ReferenceError
|
|
552254
|
+
});
|
|
552116
552255
|
}
|
|
552117
552256
|
return propertyType;
|
|
552118
552257
|
}
|
|
@@ -552153,7 +552292,10 @@ function getAllPropertiesForExtendedType2({ typeResolver, file: file4, extendedT
|
|
|
552153
552292
|
objectSchema: resolvedType.declaration
|
|
552154
552293
|
});
|
|
552155
552294
|
}
|
|
552156
|
-
throw new
|
|
552295
|
+
throw new CliError({
|
|
552296
|
+
message: `Extended type ${extendedType} must be another named type.`,
|
|
552297
|
+
code: CliError.Code.InternalError
|
|
552298
|
+
});
|
|
552157
552299
|
}
|
|
552158
552300
|
function maybeFileFromResolvedType(resolvedType) {
|
|
552159
552301
|
if (resolvedType == null) {
|
|
@@ -552209,7 +552351,7 @@ function convertHttpSdkRequest({ request: request7, endpointKey, endpoint: endpo
|
|
|
552209
552351
|
function convertHttpSdkRequestShape({ service, request: request7, file: file4, typeResolver }) {
|
|
552210
552352
|
const constructWrapper = () => {
|
|
552211
552353
|
if (typeof request7 === "string" || request7?.name == null) {
|
|
552212
|
-
throw new
|
|
552354
|
+
throw new CliError({ message: "Name is missing for request wrapper", code: CliError.Code.InternalError });
|
|
552213
552355
|
}
|
|
552214
552356
|
return SdkRequestShape.wrapper({
|
|
552215
552357
|
wrapperName: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552389,7 +552531,7 @@ function parseErrorName({ errorName, file: file4 }) {
|
|
|
552389
552531
|
imports: file4.imports
|
|
552390
552532
|
});
|
|
552391
552533
|
if (reference4 == null) {
|
|
552392
|
-
throw new
|
|
552534
|
+
throw new CliError({ message: "Failed to locate error " + errorName, code: CliError.Code.ResolutionError });
|
|
552393
552535
|
}
|
|
552394
552536
|
const nameWithoutId = {
|
|
552395
552537
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -552859,7 +553001,10 @@ function validateObjectExample({ typeName, typeNameForBreadcrumb, rawObject, fil
|
|
|
552859
553001
|
} else {
|
|
552860
553002
|
const definitionFile = getDefinitionFile(workspace, propertyWithPath.filepathOfDeclaration);
|
|
552861
553003
|
if (definitionFile == null) {
|
|
552862
|
-
throw new
|
|
553004
|
+
throw new CliError({
|
|
553005
|
+
message: "Service file does not exist for property: " + propertyWithPath.wireKey,
|
|
553006
|
+
code: CliError.Code.InternalError
|
|
553007
|
+
});
|
|
552863
553008
|
}
|
|
552864
553009
|
violations.push(...validateTypeReferenceExample({
|
|
552865
553010
|
rawTypeReference: propertyWithPath.propertyType,
|
|
@@ -553334,7 +553479,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553334
553479
|
base64: () => validateString(example),
|
|
553335
553480
|
bigInteger: () => validateString(example),
|
|
553336
553481
|
_other: () => {
|
|
553337
|
-
throw new
|
|
553482
|
+
throw new CliError({
|
|
553483
|
+
message: "Unknown primitive type v2: " + primitiveType2.v2,
|
|
553484
|
+
code: CliError.Code.InternalError
|
|
553485
|
+
});
|
|
553338
553486
|
}
|
|
553339
553487
|
});
|
|
553340
553488
|
}
|
|
@@ -553354,7 +553502,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553354
553502
|
base64: () => validateString(example),
|
|
553355
553503
|
bigInteger: () => validateString(example),
|
|
553356
553504
|
_other: () => {
|
|
553357
|
-
throw new
|
|
553505
|
+
throw new CliError({
|
|
553506
|
+
message: "Unknown primitive type: " + primitiveType2.v1,
|
|
553507
|
+
code: CliError.Code.InternalError
|
|
553508
|
+
});
|
|
553358
553509
|
}
|
|
553359
553510
|
});
|
|
553360
553511
|
}
|
|
@@ -553577,7 +553728,10 @@ function convertEnumTypeDeclaration({ _enum: _enum3, file: file4 }) {
|
|
|
553577
553728
|
if (_enum3.default != null) {
|
|
553578
553729
|
defaultValue = values2.find((enumValue) => getWireValue(enumValue.name) === _enum3.default);
|
|
553579
553730
|
if (defaultValue == null) {
|
|
553580
|
-
throw new
|
|
553731
|
+
throw new CliError({
|
|
553732
|
+
message: `Default value ${_enum3.default} not found in enum values`,
|
|
553733
|
+
code: CliError.Code.ValidationError
|
|
553734
|
+
});
|
|
553581
553735
|
}
|
|
553582
553736
|
}
|
|
553583
553737
|
return {
|
|
@@ -553646,18 +553800,27 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553646
553800
|
discriminatedUnion: (rawUnion) => {
|
|
553647
553801
|
const discriminant21 = getUnionDiscriminant(rawUnion);
|
|
553648
553802
|
if (!isPlainObject4(example)) {
|
|
553649
|
-
throw new
|
|
553803
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553650
553804
|
}
|
|
553651
553805
|
const discriminantValueForExample = example[discriminant21];
|
|
553652
553806
|
if (discriminantValueForExample == null) {
|
|
553653
|
-
throw new
|
|
553807
|
+
throw new CliError({
|
|
553808
|
+
message: "Example is missing discriminant: " + discriminant21,
|
|
553809
|
+
code: CliError.Code.ValidationError
|
|
553810
|
+
});
|
|
553654
553811
|
}
|
|
553655
553812
|
if (typeof discriminantValueForExample !== "string") {
|
|
553656
|
-
throw new
|
|
553813
|
+
throw new CliError({
|
|
553814
|
+
message: "Discriminant value is not a string",
|
|
553815
|
+
code: CliError.Code.ValidationError
|
|
553816
|
+
});
|
|
553657
553817
|
}
|
|
553658
553818
|
const rawSingleUnionType = rawUnion.union[discriminantValueForExample];
|
|
553659
553819
|
if (rawSingleUnionType == null) {
|
|
553660
|
-
throw new
|
|
553820
|
+
throw new CliError({
|
|
553821
|
+
message: `${discriminantValueForExample} is not one of the specified discriminant values.`,
|
|
553822
|
+
code: CliError.Code.ValidationError
|
|
553823
|
+
});
|
|
553661
553824
|
}
|
|
553662
553825
|
const rawValueType = typeof rawSingleUnionType === "string" ? rawSingleUnionType : typeof rawSingleUnionType.type === "string" ? rawSingleUnionType.type : void 0;
|
|
553663
553826
|
const baseProperties = Object.entries(rawUnion["base-properties"] ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553688,7 +553851,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553688
553851
|
referenceToNamedType: extendedTypeName
|
|
553689
553852
|
});
|
|
553690
553853
|
if (resolvedExtendedType._type !== "named" || !isRawObjectDefinition(resolvedExtendedType.declaration)) {
|
|
553691
|
-
throw new
|
|
553854
|
+
throw new CliError({
|
|
553855
|
+
message: "Extended type is not a named object",
|
|
553856
|
+
code: CliError.Code.InternalError
|
|
553857
|
+
});
|
|
553692
553858
|
}
|
|
553693
553859
|
const extendedObject = resolvedExtendedType.declaration;
|
|
553694
553860
|
const propertiesFromExtension = Object.entries(extendedObject.properties ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553741,7 +553907,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553741
553907
|
enum: (rawEnum) => {
|
|
553742
553908
|
if (typeof example !== "string") {
|
|
553743
553909
|
const validValues = rawEnum.enum.map((enumEntry) => typeof enumEntry === "string" ? enumEntry : enumEntry.value).join(", ");
|
|
553744
|
-
throw new
|
|
553910
|
+
throw new CliError({
|
|
553911
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553912
|
+
code: CliError.Code.ValidationError
|
|
553913
|
+
});
|
|
553745
553914
|
}
|
|
553746
553915
|
return ExampleTypeShape.enum({
|
|
553747
553916
|
value: fileContainingExample.casingsGenerator.generateNameAndWireValue({
|
|
@@ -553782,7 +553951,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553782
553951
|
return typeof variant === "string" ? variant : variant.type;
|
|
553783
553952
|
});
|
|
553784
553953
|
const validValues = variantOptions.join(", ");
|
|
553785
|
-
throw new
|
|
553954
|
+
throw new CliError({
|
|
553955
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553956
|
+
code: CliError.Code.ValidationError
|
|
553957
|
+
});
|
|
553786
553958
|
}
|
|
553787
553959
|
});
|
|
553788
553960
|
}
|
|
@@ -553809,7 +553981,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553809
553981
|
},
|
|
553810
553982
|
map: ({ keyType, valueType }) => {
|
|
553811
553983
|
if (!isPlainObject4(resolvedExample)) {
|
|
553812
|
-
throw new
|
|
553984
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553813
553985
|
}
|
|
553814
553986
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553815
553987
|
return ExampleTypeReferenceShape.container(ExampleContainer.map({
|
|
@@ -553841,7 +554013,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553841
554013
|
},
|
|
553842
554014
|
list: (itemType) => {
|
|
553843
554015
|
if (!Array.isArray(resolvedExample)) {
|
|
553844
|
-
throw new
|
|
554016
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553845
554017
|
}
|
|
553846
554018
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553847
554019
|
return ExampleTypeReferenceShape.container(ExampleContainer.list({
|
|
@@ -553860,7 +554032,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553860
554032
|
},
|
|
553861
554033
|
set: (itemType) => {
|
|
553862
554034
|
if (!Array.isArray(resolvedExample)) {
|
|
553863
|
-
throw new
|
|
554035
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553864
554036
|
}
|
|
553865
554037
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553866
554038
|
return ExampleTypeReferenceShape.container(ExampleContainer.set({
|
|
@@ -553930,7 +554102,10 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553930
554102
|
});
|
|
553931
554103
|
const parsedReferenceToNamedType = fileContainingRawTypeReference.parseTypeReference(named);
|
|
553932
554104
|
if (parsedReferenceToNamedType.type !== "named") {
|
|
553933
|
-
throw new
|
|
554105
|
+
throw new CliError({
|
|
554106
|
+
message: "Type reference is not to a named type.",
|
|
554107
|
+
code: CliError.Code.InternalError
|
|
554108
|
+
});
|
|
553934
554109
|
}
|
|
553935
554110
|
const typeName = {
|
|
553936
554111
|
typeId: parsedReferenceToNamedType.typeId,
|
|
@@ -554088,13 +554263,19 @@ function convertPrimitiveExample({ example, typeBeingExemplified }) {
|
|
|
554088
554263
|
}));
|
|
554089
554264
|
},
|
|
554090
554265
|
_other: () => {
|
|
554091
|
-
throw new
|
|
554266
|
+
throw new CliError({
|
|
554267
|
+
message: "Unknown primitive type: " + typeBeingExemplified,
|
|
554268
|
+
code: CliError.Code.InternalError
|
|
554269
|
+
});
|
|
554092
554270
|
}
|
|
554093
554271
|
});
|
|
554094
554272
|
}
|
|
554095
554273
|
function convertObject4({ typeName, rawObject, example, fileContainingType, fileContainingExample, typeResolver, exampleResolver, workspace, recursionContext }) {
|
|
554096
554274
|
if (!isPlainObject4(example)) {
|
|
554097
|
-
throw new
|
|
554275
|
+
throw new CliError({
|
|
554276
|
+
message: `Example is not an object. Got: ${JSON.stringify(example)}`,
|
|
554277
|
+
code: CliError.Code.ValidationError
|
|
554278
|
+
});
|
|
554098
554279
|
}
|
|
554099
554280
|
const properties7 = Object.entries(example).map(([wireKey, propertyExample]) => {
|
|
554100
554281
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
@@ -554169,7 +554350,10 @@ function getOriginalTypeDeclarationForPropertyFromExtensions({ wirePropertyKey,
|
|
|
554169
554350
|
file: file4
|
|
554170
554351
|
});
|
|
554171
554352
|
if (resolvedType._type !== "named" || !isRawObjectDefinition(resolvedType.declaration)) {
|
|
554172
|
-
throw new
|
|
554353
|
+
throw new CliError({
|
|
554354
|
+
message: "Extension is not of a named object",
|
|
554355
|
+
code: CliError.Code.InternalError
|
|
554356
|
+
});
|
|
554173
554357
|
}
|
|
554174
554358
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
554175
554359
|
wirePropertyKey,
|
|
@@ -554206,7 +554390,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554206
554390
|
switch (parsedSingleUnionTypeProperties.propertiesType) {
|
|
554207
554391
|
case "singleProperty": {
|
|
554208
554392
|
if (!isPlainObject4(example)) {
|
|
554209
|
-
throw new
|
|
554393
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554210
554394
|
}
|
|
554211
554395
|
return {
|
|
554212
554396
|
wireDiscriminantValue,
|
|
@@ -554224,7 +554408,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554224
554408
|
}
|
|
554225
554409
|
case "samePropertiesAsObject": {
|
|
554226
554410
|
if (!isPlainObject4(example)) {
|
|
554227
|
-
throw new
|
|
554411
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554228
554412
|
}
|
|
554229
554413
|
let rawDeclaration = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
554230
554414
|
referenceToNamedType: rawValueType,
|
|
@@ -554237,7 +554421,10 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554237
554421
|
});
|
|
554238
554422
|
}
|
|
554239
554423
|
if (!isRawObjectDefinition(rawDeclaration.declaration)) {
|
|
554240
|
-
throw new
|
|
554424
|
+
throw new CliError({
|
|
554425
|
+
message: `${rawValueType} is not an object`,
|
|
554426
|
+
code: CliError.Code.ValidationError
|
|
554427
|
+
});
|
|
554241
554428
|
}
|
|
554242
554429
|
const typeName = {
|
|
554243
554430
|
typeId: parsedSingleUnionTypeProperties.typeId,
|
|
@@ -554320,7 +554507,10 @@ function convertExampleEndpointCall2({ service, endpoint: endpoint3, example, ty
|
|
|
554320
554507
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
554321
554508
|
const queryParameterDeclaration = typeof endpoint3.request !== "string" ? endpoint3.request?.["query-parameters"]?.[wireKey] : void 0;
|
|
554322
554509
|
if (queryParameterDeclaration == null) {
|
|
554323
|
-
throw new
|
|
554510
|
+
throw new CliError({
|
|
554511
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
554512
|
+
code: CliError.Code.ReferenceError
|
|
554513
|
+
});
|
|
554324
554514
|
}
|
|
554325
554515
|
const isAllowMultiple = typeof queryParameterDeclaration !== "string" && queryParameterDeclaration["allow-multiple"] === true;
|
|
554326
554516
|
const rawType = typeof queryParameterDeclaration === "string" ? queryParameterDeclaration : queryParameterDeclaration.type;
|
|
@@ -554429,7 +554619,10 @@ function convertPathParameters({ service, endpoint: endpoint3, example, typeReso
|
|
|
554429
554619
|
examplePathParameter
|
|
554430
554620
|
}));
|
|
554431
554621
|
} else {
|
|
554432
|
-
throw new
|
|
554622
|
+
throw new CliError({
|
|
554623
|
+
message: `Path parameter ${key2} does not exist`,
|
|
554624
|
+
code: CliError.Code.ReferenceError
|
|
554625
|
+
});
|
|
554433
554626
|
}
|
|
554434
554627
|
}
|
|
554435
554628
|
}
|
|
@@ -554509,7 +554702,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554509
554702
|
return void 0;
|
|
554510
554703
|
}
|
|
554511
554704
|
if (!isPlainObject4(example.request)) {
|
|
554512
|
-
throw new
|
|
554705
|
+
throw new CliError({
|
|
554706
|
+
message: `Example is not an object. Got: ${JSON.stringify(example.request)}`,
|
|
554707
|
+
code: CliError.Code.ValidationError
|
|
554708
|
+
});
|
|
554513
554709
|
}
|
|
554514
554710
|
const exampleProperties = [];
|
|
554515
554711
|
const exampleExtraProperties = [];
|
|
@@ -554559,7 +554755,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554559
554755
|
});
|
|
554560
554756
|
continue;
|
|
554561
554757
|
}
|
|
554562
|
-
throw new
|
|
554758
|
+
throw new CliError({
|
|
554759
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
554760
|
+
code: CliError.Code.ResolutionError
|
|
554761
|
+
});
|
|
554563
554762
|
}
|
|
554564
554763
|
exampleProperties.push({
|
|
554565
554764
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -554944,7 +555143,7 @@ function getPaginationPropertyComponents(endpointPagination) {
|
|
|
554944
555143
|
results: getResponsePropertyComponents(endpointPagination.results)
|
|
554945
555144
|
};
|
|
554946
555145
|
}
|
|
554947
|
-
throw new
|
|
555146
|
+
throw new CliError({ message: "Invalid pagination schema", code: CliError.Code.ValidationError });
|
|
554948
555147
|
}
|
|
554949
555148
|
function isRawCursorPaginationSchema(rawPaginationSchema) {
|
|
554950
555149
|
return rawPaginationSchema.cursor != null;
|
|
@@ -555115,7 +555314,10 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555115
555314
|
return void 0;
|
|
555116
555315
|
}
|
|
555117
555316
|
if (isHttpService && isGrpcEndpoint) {
|
|
555118
|
-
throw new
|
|
555317
|
+
throw new CliError({
|
|
555318
|
+
message: "Cannot have a grpc endpoint on an http service",
|
|
555319
|
+
code: CliError.Code.ValidationError
|
|
555320
|
+
});
|
|
555119
555321
|
}
|
|
555120
555322
|
if (isGrpcService && isHttpEndpoint) {
|
|
555121
555323
|
return Transport.http();
|
|
@@ -555129,8 +555331,11 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555129
555331
|
return createProtobufService(file4, protoSource, sourceResolver, serviceNameOverride);
|
|
555130
555332
|
}
|
|
555131
555333
|
}
|
|
555132
|
-
throw new
|
|
555133
|
-
|
|
555334
|
+
throw new CliError({
|
|
555335
|
+
message: `Internal error; failed to determine endpoint transport for
|
|
555336
|
+
${JSON.stringify(endpointDeclaration)}"`,
|
|
555337
|
+
code: CliError.Code.InternalError
|
|
555338
|
+
});
|
|
555134
555339
|
}
|
|
555135
555340
|
function createProtobufService(file4, source2, sourceResolver, serviceNameOverride) {
|
|
555136
555341
|
const resolvedSource = sourceResolver.resolveSourceOrThrow({
|
|
@@ -555138,14 +555343,20 @@ function createProtobufService(file4, source2, sourceResolver, serviceNameOverri
|
|
|
555138
555343
|
relativeFilepath: file4.relativeFilepath
|
|
555139
555344
|
});
|
|
555140
555345
|
if (resolvedSource == null || resolvedSource.type !== "protobuf") {
|
|
555141
|
-
throw new
|
|
555346
|
+
throw new CliError({
|
|
555347
|
+
message: `Expected a protobuf source for ${source2.proto}.`,
|
|
555348
|
+
code: CliError.Code.ResolutionError
|
|
555349
|
+
});
|
|
555142
555350
|
}
|
|
555143
555351
|
const protobufService = convertProtobufService({
|
|
555144
555352
|
source: resolvedSource,
|
|
555145
555353
|
serviceNameOverride
|
|
555146
555354
|
});
|
|
555147
555355
|
if (protobufService == null) {
|
|
555148
|
-
throw new
|
|
555356
|
+
throw new CliError({
|
|
555357
|
+
message: `Failed to resolve service name from ${resolvedSource.relativeFilePath}.`,
|
|
555358
|
+
code: CliError.Code.IrConversionError
|
|
555359
|
+
});
|
|
555149
555360
|
}
|
|
555150
555361
|
return Transport.grpc({
|
|
555151
555362
|
service: protobufService
|
|
@@ -555357,7 +555568,7 @@ function resolvePathParameterOrThrow({ parameter: parameter6, variableResolver,
|
|
|
555357
555568
|
file: file4
|
|
555358
555569
|
});
|
|
555359
555570
|
if (resolved == null) {
|
|
555360
|
-
throw new
|
|
555571
|
+
throw new CliError({ message: "Cannot resolve path parameter", code: CliError.Code.InternalError });
|
|
555361
555572
|
}
|
|
555362
555573
|
return resolved;
|
|
555363
555574
|
}
|
|
@@ -555638,7 +555849,10 @@ var DynamicSnippetsConverter = class {
|
|
|
555638
555849
|
return dynamic_exports.Request.body({ pathParameters, body: void 0 });
|
|
555639
555850
|
}
|
|
555640
555851
|
if (endpoint3.sdkRequest == null) {
|
|
555641
|
-
throw new
|
|
555852
|
+
throw new CliError({
|
|
555853
|
+
message: `Internal error; endpoint "${endpoint3.id}" has a request body but no SDK request`,
|
|
555854
|
+
code: CliError.Code.InternalError
|
|
555855
|
+
});
|
|
555642
555856
|
}
|
|
555643
555857
|
switch (endpoint3.sdkRequest.shape.type) {
|
|
555644
555858
|
case "justRequestBody":
|
|
@@ -556131,7 +556345,7 @@ var DynamicSnippetsConverter = class {
|
|
|
556131
556345
|
}))
|
|
556132
556346
|
}),
|
|
556133
556347
|
_other: () => {
|
|
556134
|
-
throw new
|
|
556348
|
+
throw new CliError({ message: "Unknown environments type", code: CliError.Code.InternalError });
|
|
556135
556349
|
}
|
|
556136
556350
|
})
|
|
556137
556351
|
};
|
|
@@ -556168,10 +556382,16 @@ var DynamicSnippetsConverter = class {
|
|
|
556168
556382
|
resolveObjectTypeOrThrow(typeId) {
|
|
556169
556383
|
const typeDeclaration2 = this.ir.types[typeId];
|
|
556170
556384
|
if (typeDeclaration2 == null) {
|
|
556171
|
-
throw new
|
|
556385
|
+
throw new CliError({
|
|
556386
|
+
message: `Internal error; type "${typeId}" not found`,
|
|
556387
|
+
code: CliError.Code.InternalError
|
|
556388
|
+
});
|
|
556172
556389
|
}
|
|
556173
556390
|
if (typeDeclaration2.shape.type !== "object") {
|
|
556174
|
-
throw new
|
|
556391
|
+
throw new CliError({
|
|
556392
|
+
message: `Internal error; type "${typeId}" is not an object`,
|
|
556393
|
+
code: CliError.Code.InternalError
|
|
556394
|
+
});
|
|
556175
556395
|
}
|
|
556176
556396
|
return typeDeclaration2.shape;
|
|
556177
556397
|
}
|
|
@@ -556456,7 +556676,10 @@ function convertOAuthClientCredentials({ propertyResolver, endpointResolver, typ
|
|
|
556456
556676
|
tokenEndpoint
|
|
556457
556677
|
});
|
|
556458
556678
|
if (oauthTokenEndpoint == null) {
|
|
556459
|
-
throw new
|
|
556679
|
+
throw new CliError({
|
|
556680
|
+
message: "Failed to convert OAuth token endpoint.",
|
|
556681
|
+
code: CliError.Code.IrConversionError
|
|
556682
|
+
});
|
|
556460
556683
|
}
|
|
556461
556684
|
const refreshEndpoint = refreshTokenEndpoint != null ? convertOAuthRefreshEndpoint({
|
|
556462
556685
|
propertyResolver,
|
|
@@ -556634,7 +556857,7 @@ function convertSchemeReference2({ reference: reference4, authSchemeDeclarations
|
|
|
556634
556857
|
const convertNamedAuthSchemeReference = (reference5, docs2) => {
|
|
556635
556858
|
const declaration = authSchemeDeclarations?.[reference5];
|
|
556636
556859
|
if (declaration == null) {
|
|
556637
|
-
throw new
|
|
556860
|
+
throw new CliError({ message: "Unknown auth scheme: " + reference5, code: CliError.Code.ReferenceError });
|
|
556638
556861
|
}
|
|
556639
556862
|
return visitRawAuthSchemeDeclaration(declaration, {
|
|
556640
556863
|
header: (rawHeader) => AuthScheme.header({
|
|
@@ -556746,7 +556969,10 @@ function generateOAuth({ key: key2, file: file4, docs: docs2, rawScheme, propert
|
|
|
556746
556969
|
}))
|
|
556747
556970
|
});
|
|
556748
556971
|
default:
|
|
556749
|
-
throw new
|
|
556972
|
+
throw new CliError({
|
|
556973
|
+
message: `Unknown OAuth type: '${rawScheme?.type}'`,
|
|
556974
|
+
code: CliError.Code.ValidationError
|
|
556975
|
+
});
|
|
556750
556976
|
}
|
|
556751
556977
|
}
|
|
556752
556978
|
function generateInferredAuth({ key: key2, file: file4, docs: docs2, rawScheme, propertyResolver, endpointResolver }) {
|
|
@@ -557010,7 +557236,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557010
557236
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
557011
557237
|
const queryParameterDeclaration = channel3["query-parameters"]?.[wireKey];
|
|
557012
557238
|
if (queryParameterDeclaration == null) {
|
|
557013
|
-
throw new
|
|
557239
|
+
throw new CliError({
|
|
557240
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
557241
|
+
code: CliError.Code.ReferenceError
|
|
557242
|
+
});
|
|
557014
557243
|
}
|
|
557015
557244
|
return {
|
|
557016
557245
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557035,7 +557264,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557035
557264
|
messages: example.messages.map((messageExample) => {
|
|
557036
557265
|
const message = channel3.messages?.[messageExample.type];
|
|
557037
557266
|
if (message == null) {
|
|
557038
|
-
throw new
|
|
557267
|
+
throw new CliError({
|
|
557268
|
+
message: `Message ${messageExample.type} does not exist`,
|
|
557269
|
+
code: CliError.Code.ReferenceError
|
|
557270
|
+
});
|
|
557039
557271
|
}
|
|
557040
557272
|
return {
|
|
557041
557273
|
type: messageExample.type,
|
|
@@ -557074,7 +557306,7 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557074
557306
|
}));
|
|
557075
557307
|
}
|
|
557076
557308
|
if (!isPlainObject4(example)) {
|
|
557077
|
-
throw new
|
|
557309
|
+
throw new CliError({ message: "Example must be an object", code: CliError.Code.ValidationError });
|
|
557078
557310
|
}
|
|
557079
557311
|
const exampleProperties = [];
|
|
557080
557312
|
for (const [wireKey, propertyExample] of Object.entries(example)) {
|
|
@@ -557104,7 +557336,10 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557104
557336
|
file: file4
|
|
557105
557337
|
});
|
|
557106
557338
|
if (originalTypeDeclaration == null) {
|
|
557107
|
-
throw new
|
|
557339
|
+
throw new CliError({
|
|
557340
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
557341
|
+
code: CliError.Code.ResolutionError
|
|
557342
|
+
});
|
|
557108
557343
|
}
|
|
557109
557344
|
exampleProperties.push({
|
|
557110
557345
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557188,7 +557423,10 @@ function convertChannelPathParameters({ channel: channel3, example, typeResolver
|
|
|
557188
557423
|
examplePathParameter
|
|
557189
557424
|
}));
|
|
557190
557425
|
} else {
|
|
557191
|
-
throw new
|
|
557426
|
+
throw new CliError({
|
|
557427
|
+
message: `Path parameter ${key2} does not exist`,
|
|
557428
|
+
code: CliError.Code.ReferenceError
|
|
557429
|
+
});
|
|
557192
557430
|
}
|
|
557193
557431
|
}
|
|
557194
557432
|
}
|
|
@@ -557339,7 +557577,10 @@ var ReadmeEndpointCache = class {
|
|
|
557339
557577
|
getEndpointForReadmeOrThrow(readmeEndpoint) {
|
|
557340
557578
|
const endpoint3 = this.getEndpointForReadme(readmeEndpoint);
|
|
557341
557579
|
if (endpoint3 == null) {
|
|
557342
|
-
throw new
|
|
557580
|
+
throw new CliError({
|
|
557581
|
+
message: `Endpoint not found for ${JSON.stringify(readmeEndpoint)}`,
|
|
557582
|
+
code: CliError.Code.ResolutionError
|
|
557583
|
+
});
|
|
557343
557584
|
}
|
|
557344
557585
|
return endpoint3;
|
|
557345
557586
|
}
|
|
@@ -557387,7 +557628,7 @@ function getReadmeEndpointObject({ endpoint: endpoint3 }) {
|
|
|
557387
557628
|
if (typeof endpoint3 === "string") {
|
|
557388
557629
|
const split2 = endpoint3.split(" ");
|
|
557389
557630
|
if (split2.length !== 2 || split2[0] == null || split2[1] == null) {
|
|
557390
|
-
throw new
|
|
557631
|
+
throw new CliError({ message: `invalid endpoint string: ${endpoint3}`, code: CliError.Code.ParseError });
|
|
557391
557632
|
}
|
|
557392
557633
|
return {
|
|
557393
557634
|
method: split2[0],
|
|
@@ -557484,7 +557725,10 @@ function convertWebhookExamples2({ webhook, examples, file: file4, typeResolver,
|
|
|
557484
557725
|
}));
|
|
557485
557726
|
}
|
|
557486
557727
|
if (!isPlainObject4(webhook.payload)) {
|
|
557487
|
-
throw new
|
|
557728
|
+
throw new CliError({
|
|
557729
|
+
message: `Example webhook payload is not an object. Got: ${JSON.stringify(webhook.payload)}`,
|
|
557730
|
+
code: CliError.Code.ValidationError
|
|
557731
|
+
});
|
|
557488
557732
|
}
|
|
557489
557733
|
return examples.map((example) => ({
|
|
557490
557734
|
docs: webhook.docs,
|
|
@@ -557876,7 +558120,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557876
558120
|
const genericInstantiation = typeof generic === "string" ? generic : generic.type;
|
|
557877
558121
|
const maybeGeneric = parseGeneric(genericInstantiation);
|
|
557878
558122
|
if (maybeGeneric == null) {
|
|
557879
|
-
throw new
|
|
558123
|
+
throw new CliError({
|
|
558124
|
+
message: `Invalid generic type definition: ${genericInstantiation}`,
|
|
558125
|
+
code: CliError.Code.ValidationError
|
|
558126
|
+
});
|
|
557880
558127
|
}
|
|
557881
558128
|
const resolvedBaseGeneric = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
557882
558129
|
referenceToNamedType: genericInstantiation,
|
|
@@ -557907,7 +558154,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557907
558154
|
extendedProperties: void 0
|
|
557908
558155
|
});
|
|
557909
558156
|
}
|
|
557910
|
-
throw new
|
|
558157
|
+
throw new CliError({
|
|
558158
|
+
message: `Generic type definition not supported: ${genericInstantiation}`,
|
|
558159
|
+
code: CliError.Code.ValidationError
|
|
558160
|
+
});
|
|
557911
558161
|
}
|
|
557912
558162
|
|
|
557913
558163
|
// ../generation/ir-generator/lib/converters/type-declarations/convertAliasTypeDeclaration.js
|
|
@@ -558299,7 +558549,10 @@ var PackageTreeGenerator = class {
|
|
|
558299
558549
|
addPackageRedirection({ from: from4, to: to10 }) {
|
|
558300
558550
|
const package_ = this.getPackageForFernFilepath(from4);
|
|
558301
558551
|
if (package_.navigationConfig != null) {
|
|
558302
|
-
throw new
|
|
558552
|
+
throw new CliError({
|
|
558553
|
+
message: "Found duplicate navigationConfig for package",
|
|
558554
|
+
code: CliError.Code.InternalError
|
|
558555
|
+
});
|
|
558303
558556
|
}
|
|
558304
558557
|
package_.navigationConfig = {
|
|
558305
558558
|
pointsTo: IdGenerator.generateSubpackageId(to10)
|
|
@@ -558308,7 +558561,7 @@ var PackageTreeGenerator = class {
|
|
|
558308
558561
|
addDocs(fernFilepath, docs2) {
|
|
558309
558562
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558310
558563
|
if (package_.docs != null) {
|
|
558311
|
-
throw new
|
|
558564
|
+
throw new CliError({ message: "Found duplicate docs for package", code: CliError.Code.InternalError });
|
|
558312
558565
|
}
|
|
558313
558566
|
package_.docs = docs2;
|
|
558314
558567
|
}
|
|
@@ -558324,21 +558577,30 @@ var PackageTreeGenerator = class {
|
|
|
558324
558577
|
addService(serviceId, service) {
|
|
558325
558578
|
const package_ = this.getPackageForFernFilepath(service.name.fernFilepath);
|
|
558326
558579
|
if (package_.service != null) {
|
|
558327
|
-
throw new
|
|
558580
|
+
throw new CliError({
|
|
558581
|
+
message: "Found duplicate service for " + serviceId,
|
|
558582
|
+
code: CliError.Code.InternalError
|
|
558583
|
+
});
|
|
558328
558584
|
}
|
|
558329
558585
|
package_.service = serviceId;
|
|
558330
558586
|
}
|
|
558331
558587
|
addWebhookGroup(webhookGroupId, fernFilepath) {
|
|
558332
558588
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558333
558589
|
if (package_.webhooks != null) {
|
|
558334
|
-
throw new
|
|
558590
|
+
throw new CliError({
|
|
558591
|
+
message: "Found duplicate webhook group for " + webhookGroupId,
|
|
558592
|
+
code: CliError.Code.InternalError
|
|
558593
|
+
});
|
|
558335
558594
|
}
|
|
558336
558595
|
package_.webhooks = webhookGroupId;
|
|
558337
558596
|
}
|
|
558338
558597
|
addWebSocketChannel(websocketChannelId, fernFilepath) {
|
|
558339
558598
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558340
558599
|
if (package_.webhooks != null) {
|
|
558341
|
-
throw new
|
|
558600
|
+
throw new CliError({
|
|
558601
|
+
message: "Found duplicate webhook group for " + websocketChannelId,
|
|
558602
|
+
code: CliError.Code.InternalError
|
|
558603
|
+
});
|
|
558342
558604
|
}
|
|
558343
558605
|
package_.websocket = websocketChannelId;
|
|
558344
558606
|
}
|
|
@@ -558381,24 +558643,33 @@ var PackageTreeGenerator = class {
|
|
|
558381
558643
|
}
|
|
558382
558644
|
sortRootPackage(subpackagesInOrder) {
|
|
558383
558645
|
if (!isEqualIgnoreOrder(this.rootPackage.subpackages, subpackagesInOrder)) {
|
|
558384
|
-
throw new
|
|
558646
|
+
throw new CliError({
|
|
558647
|
+
message: "Sorted subpackages differ from unsorted packages in root",
|
|
558648
|
+
code: CliError.Code.InternalError
|
|
558649
|
+
});
|
|
558385
558650
|
}
|
|
558386
558651
|
this.rootPackage.subpackages = subpackagesInOrder;
|
|
558387
558652
|
}
|
|
558388
558653
|
sortSubpackage(subpackageId, subpackagesInOrder) {
|
|
558389
558654
|
const subpackage = this.subpackages[subpackageId];
|
|
558390
558655
|
if (subpackage == null) {
|
|
558391
|
-
throw new
|
|
558656
|
+
throw new CliError({
|
|
558657
|
+
message: "Subpackage does not exist: " + subpackageId,
|
|
558658
|
+
code: CliError.Code.ResolutionError
|
|
558659
|
+
});
|
|
558392
558660
|
}
|
|
558393
558661
|
if (!isEqualIgnoreOrder(subpackage.subpackages, subpackagesInOrder)) {
|
|
558394
|
-
throw new
|
|
558662
|
+
throw new CliError({
|
|
558663
|
+
message: "Sorted subpackages differ from unsorted packages",
|
|
558664
|
+
code: CliError.Code.InternalError
|
|
558665
|
+
});
|
|
558395
558666
|
}
|
|
558396
558667
|
subpackage.subpackages = subpackagesInOrder;
|
|
558397
558668
|
}
|
|
558398
558669
|
getAllSubpackagesWithEndpoints(root6) {
|
|
558399
558670
|
const subpackage = this.subpackages[root6];
|
|
558400
558671
|
if (subpackage == null) {
|
|
558401
|
-
throw new
|
|
558672
|
+
throw new CliError({ message: "Subpackage does not exist: " + root6, code: CliError.Code.ResolutionError });
|
|
558402
558673
|
}
|
|
558403
558674
|
const subpackagesWithEndpoints = this.getAllChildrenWithEndpoints(subpackage);
|
|
558404
558675
|
if (subpackagesWithEndpoints.length > 0 || subpackage.service != null) {
|
|
@@ -558419,7 +558690,10 @@ var PackageTreeGenerator = class {
|
|
|
558419
558690
|
const subpackagesInParent = parent.subpackages.map((subpackageId) => {
|
|
558420
558691
|
const subpackage = this.subpackages[subpackageId];
|
|
558421
558692
|
if (subpackage == null) {
|
|
558422
|
-
throw new
|
|
558693
|
+
throw new CliError({
|
|
558694
|
+
message: "Subpackage ID is invalid: " + subpackageId,
|
|
558695
|
+
code: CliError.Code.InternalError
|
|
558696
|
+
});
|
|
558423
558697
|
}
|
|
558424
558698
|
return subpackage;
|
|
558425
558699
|
});
|
|
@@ -558498,7 +558772,10 @@ var EndpointResolverImpl = class {
|
|
|
558498
558772
|
resolveEndpointOrThrow({ endpoint: endpoint3, file: file4 }) {
|
|
558499
558773
|
const resolvedEndpoint = this.resolveEndpoint({ endpoint: endpoint3, file: file4 });
|
|
558500
558774
|
if (resolvedEndpoint == null) {
|
|
558501
|
-
throw new
|
|
558775
|
+
throw new CliError({
|
|
558776
|
+
message: "Cannot resolve endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
558777
|
+
code: CliError.Code.ResolutionError
|
|
558778
|
+
});
|
|
558502
558779
|
}
|
|
558503
558780
|
return resolvedEndpoint;
|
|
558504
558781
|
}
|
|
@@ -558626,7 +558903,10 @@ var ErrorResolverImpl = class {
|
|
|
558626
558903
|
getDeclarationOrThrow(referenceToError, file4) {
|
|
558627
558904
|
const declaration = this.getDeclaration(referenceToError, file4);
|
|
558628
558905
|
if (declaration == null) {
|
|
558629
|
-
throw new
|
|
558906
|
+
throw new CliError({
|
|
558907
|
+
message: "Error does not exist: " + referenceToError,
|
|
558908
|
+
code: CliError.Code.ResolutionError
|
|
558909
|
+
});
|
|
558630
558910
|
}
|
|
558631
558911
|
return declaration;
|
|
558632
558912
|
}
|
|
@@ -558712,7 +558992,7 @@ var ExampleResolverImpl = class {
|
|
|
558712
558992
|
resolveAllReferencesInExampleOrThrow({ example, file: file4 }) {
|
|
558713
558993
|
const resolvedExample = this.resolveAllReferencesInExample({ example, file: file4 });
|
|
558714
558994
|
if (resolvedExample == null) {
|
|
558715
|
-
throw new
|
|
558995
|
+
throw new CliError({ message: "Failed to resolve examples", code: CliError.Code.ResolutionError });
|
|
558716
558996
|
}
|
|
558717
558997
|
return resolvedExample;
|
|
558718
558998
|
}
|
|
@@ -558759,7 +559039,7 @@ var ExampleResolverImpl = class {
|
|
|
558759
559039
|
resolveExampleOrThrow({ example, file: file4 }) {
|
|
558760
559040
|
const resolvedExample = this.resolveExample({ example, file: file4 });
|
|
558761
559041
|
if (resolvedExample == null) {
|
|
558762
|
-
throw new
|
|
559042
|
+
throw new CliError({ message: "Cannot resolve example: " + example, code: CliError.Code.ResolutionError });
|
|
558763
559043
|
}
|
|
558764
559044
|
return resolvedExample;
|
|
558765
559045
|
}
|
|
@@ -558810,7 +559090,10 @@ var PropertyResolverImpl = class {
|
|
|
558810
559090
|
resolveRequestPropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558811
559091
|
const resolvedRequestProperty = this.resolveRequestProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558812
559092
|
if (resolvedRequestProperty == null) {
|
|
558813
|
-
throw new
|
|
559093
|
+
throw new CliError({
|
|
559094
|
+
message: "Cannot resolve request property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559095
|
+
code: CliError.Code.ResolutionError
|
|
559096
|
+
});
|
|
558814
559097
|
}
|
|
558815
559098
|
return resolvedRequestProperty;
|
|
558816
559099
|
}
|
|
@@ -558854,7 +559137,10 @@ var PropertyResolverImpl = class {
|
|
|
558854
559137
|
resolveResponsePropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558855
559138
|
const resolvedResponseProperty = this.resolveResponseProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558856
559139
|
if (resolvedResponseProperty == null) {
|
|
558857
|
-
throw new
|
|
559140
|
+
throw new CliError({
|
|
559141
|
+
message: "Cannot resolve response property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559142
|
+
code: CliError.Code.ResolutionError
|
|
559143
|
+
});
|
|
558858
559144
|
}
|
|
558859
559145
|
return resolvedResponseProperty;
|
|
558860
559146
|
}
|
|
@@ -559021,7 +559307,10 @@ var PropertyResolverImpl = class {
|
|
|
559021
559307
|
propertyComponents: breadcrumbs
|
|
559022
559308
|
});
|
|
559023
559309
|
if (!currentType) {
|
|
559024
|
-
throw new
|
|
559310
|
+
throw new CliError({
|
|
559311
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in inline request body in file ${file4.relativeFilepath}`,
|
|
559312
|
+
code: CliError.Code.InternalError
|
|
559313
|
+
});
|
|
559025
559314
|
}
|
|
559026
559315
|
result.push({
|
|
559027
559316
|
name: file4.casingsGenerator.generateName(component),
|
|
@@ -559039,7 +559328,10 @@ function getNestedObjectPropertyTypeOrThrow({ typeResolver, file: file4, resolve
|
|
|
559039
559328
|
propertyName
|
|
559040
559329
|
});
|
|
559041
559330
|
if (!nestedPropertyType) {
|
|
559042
|
-
throw new
|
|
559331
|
+
throw new CliError({
|
|
559332
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in ${rootTypeLabel}`,
|
|
559333
|
+
code: CliError.Code.InternalError
|
|
559334
|
+
});
|
|
559043
559335
|
}
|
|
559044
559336
|
return nestedPropertyType;
|
|
559045
559337
|
}
|
|
@@ -559216,14 +559508,20 @@ var TypeResolverImpl = class {
|
|
|
559216
559508
|
resolveTypeOrThrow({ type: type8, file: file4 }) {
|
|
559217
559509
|
const resolvedType = this.resolveType({ type: type8, file: file4 });
|
|
559218
559510
|
if (resolvedType == null) {
|
|
559219
|
-
throw new
|
|
559511
|
+
throw new CliError({
|
|
559512
|
+
message: "Cannot resolve type: " + type8 + " in file " + file4.relativeFilepath,
|
|
559513
|
+
code: CliError.Code.ResolutionError
|
|
559514
|
+
});
|
|
559220
559515
|
}
|
|
559221
559516
|
return resolvedType;
|
|
559222
559517
|
}
|
|
559223
559518
|
getDeclarationOfNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559224
559519
|
const declaration = this.getDeclarationOfNamedType({ referenceToNamedType, file: file4 });
|
|
559225
559520
|
if (declaration == null) {
|
|
559226
|
-
throw new
|
|
559521
|
+
throw new CliError({
|
|
559522
|
+
message: "Cannot find declaration of type: " + referenceToNamedType + " in file " + file4.relativeFilepath,
|
|
559523
|
+
code: CliError.Code.ResolutionError
|
|
559524
|
+
});
|
|
559227
559525
|
}
|
|
559228
559526
|
return declaration;
|
|
559229
559527
|
}
|
|
@@ -559366,7 +559664,10 @@ var TypeResolverImpl = class {
|
|
|
559366
559664
|
resolveNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559367
559665
|
const resolvedType = this.resolveNamedType({ referenceToNamedType, file: file4 });
|
|
559368
559666
|
if (resolvedType == null) {
|
|
559369
|
-
throw new
|
|
559667
|
+
throw new CliError({
|
|
559668
|
+
message: "Cannot resolve type: " + referenceToNamedType,
|
|
559669
|
+
code: CliError.Code.ResolutionError
|
|
559670
|
+
});
|
|
559370
559671
|
}
|
|
559371
559672
|
return resolvedType;
|
|
559372
559673
|
}
|
|
@@ -559425,7 +559726,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559425
559726
|
getDeclarationOrThrow(referenceToVariable, file4) {
|
|
559426
559727
|
const declaration = this.getDeclaration(referenceToVariable, file4);
|
|
559427
559728
|
if (declaration == null) {
|
|
559428
|
-
throw new
|
|
559729
|
+
throw new CliError({
|
|
559730
|
+
message: "Variable does not exist: " + referenceToVariable,
|
|
559731
|
+
code: CliError.Code.ResolutionError
|
|
559732
|
+
});
|
|
559429
559733
|
}
|
|
559430
559734
|
return declaration;
|
|
559431
559735
|
}
|
|
@@ -559448,7 +559752,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559448
559752
|
getVariableIdOrThrow(referenceToVariable) {
|
|
559449
559753
|
const variableId = this.getVariableId(referenceToVariable);
|
|
559450
559754
|
if (variableId == null) {
|
|
559451
|
-
throw new
|
|
559755
|
+
throw new CliError({
|
|
559756
|
+
message: "Variable reference does not start with " + _VariableResolverImpl.VARIABLE_PREFIX,
|
|
559757
|
+
code: CliError.Code.ResolutionError
|
|
559758
|
+
});
|
|
559452
559759
|
}
|
|
559453
559760
|
return variableId;
|
|
559454
559761
|
}
|
|
@@ -559620,7 +559927,10 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
|
|
|
559620
559927
|
}
|
|
559621
559928
|
const errorDiscriminationSchema = workspace.definition.rootApiFile.contents["error-discrimination"];
|
|
559622
559929
|
if (errorDiscriminationSchema == null) {
|
|
559623
|
-
throw new
|
|
559930
|
+
throw new CliError({
|
|
559931
|
+
message: "error-discrimination is missing in api.yml but there are declared errors.",
|
|
559932
|
+
code: CliError.Code.ConfigError
|
|
559933
|
+
});
|
|
559624
559934
|
}
|
|
559625
559935
|
for (const [errorName, errorDeclaration] of Object.entries(errors4)) {
|
|
559626
559936
|
const convertedErrorDeclaration = convertErrorDeclaration({
|
|
@@ -614356,7 +614666,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614356
614666
|
properties: {
|
|
614357
614667
|
...event,
|
|
614358
614668
|
...event.properties,
|
|
614359
|
-
version: "4.81.0-
|
|
614669
|
+
version: "4.81.0-11-gc0c2550bc58",
|
|
614360
614670
|
usingAccessToken: true
|
|
614361
614671
|
}
|
|
614362
614672
|
});
|
|
@@ -614410,7 +614720,7 @@ var UserPosthogManager = class {
|
|
|
614410
614720
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614411
614721
|
event: "CLI",
|
|
614412
614722
|
properties: {
|
|
614413
|
-
version: "4.81.0-
|
|
614723
|
+
version: "4.81.0-11-gc0c2550bc58",
|
|
614414
614724
|
...event,
|
|
614415
614725
|
...event.properties,
|
|
614416
614726
|
usingAccessToken: false,
|
|
@@ -615614,7 +615924,10 @@ var PlatformKeyring = class {
|
|
|
615614
615924
|
await this.setPasswordWindows(service, account, password);
|
|
615615
615925
|
break;
|
|
615616
615926
|
default:
|
|
615617
|
-
throw new
|
|
615927
|
+
throw new CliError({
|
|
615928
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615929
|
+
code: CliError.Code.EnvironmentError
|
|
615930
|
+
});
|
|
615618
615931
|
}
|
|
615619
615932
|
}
|
|
615620
615933
|
async getPassword(service, account) {
|
|
@@ -615626,7 +615939,10 @@ var PlatformKeyring = class {
|
|
|
615626
615939
|
case "win32":
|
|
615627
615940
|
return this.getPasswordWindows(service, account);
|
|
615628
615941
|
default:
|
|
615629
|
-
throw new
|
|
615942
|
+
throw new CliError({
|
|
615943
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615944
|
+
code: CliError.Code.EnvironmentError
|
|
615945
|
+
});
|
|
615630
615946
|
}
|
|
615631
615947
|
}
|
|
615632
615948
|
async deletePassword(service, account) {
|
|
@@ -615638,7 +615954,10 @@ var PlatformKeyring = class {
|
|
|
615638
615954
|
case "win32":
|
|
615639
615955
|
return this.deletePasswordWindows(service, account);
|
|
615640
615956
|
default:
|
|
615641
|
-
throw new
|
|
615957
|
+
throw new CliError({
|
|
615958
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615959
|
+
code: CliError.Code.EnvironmentError
|
|
615960
|
+
});
|
|
615642
615961
|
}
|
|
615643
615962
|
}
|
|
615644
615963
|
async findCredentials(service) {
|
|
@@ -615650,7 +615969,10 @@ var PlatformKeyring = class {
|
|
|
615650
615969
|
case "win32":
|
|
615651
615970
|
return this.findCredentialsWindows(service);
|
|
615652
615971
|
default:
|
|
615653
|
-
throw new
|
|
615972
|
+
throw new CliError({
|
|
615973
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615974
|
+
code: CliError.Code.EnvironmentError
|
|
615975
|
+
});
|
|
615654
615976
|
}
|
|
615655
615977
|
}
|
|
615656
615978
|
async setPasswordDarwin(service, account, password) {
|
|
@@ -617763,7 +618085,10 @@ var FileFinder = class {
|
|
|
617763
618085
|
async findOrThrow({ filename, remediationMessage }) {
|
|
617764
618086
|
const filepath = await this.find({ filename });
|
|
617765
618087
|
if (filepath == null) {
|
|
617766
|
-
throw new
|
|
618088
|
+
throw new CliError({
|
|
618089
|
+
message: `${filename} file not found in any parent directory from ${this.from}`,
|
|
618090
|
+
code: CliError.Code.InternalError
|
|
618091
|
+
});
|
|
617767
618092
|
}
|
|
617768
618093
|
return filepath;
|
|
617769
618094
|
}
|
|
@@ -617805,7 +618130,10 @@ var FernYmlSchemaLoader = class {
|
|
|
617805
618130
|
async loadOrThrow() {
|
|
617806
618131
|
const loadResult = await this.load();
|
|
617807
618132
|
if (loadResult.type === "notFound") {
|
|
617808
|
-
throw new
|
|
618133
|
+
throw new CliError({
|
|
618134
|
+
message: `${FILENAME2} file not found in any parent directory; did you forget to run \`fern init\`?`,
|
|
618135
|
+
code: CliError.Code.InternalError
|
|
618136
|
+
});
|
|
617809
618137
|
}
|
|
617810
618138
|
if (loadResult.type === "failure") {
|
|
617811
618139
|
throw new SourcedValidationError(loadResult.issues);
|
|
@@ -617876,7 +618204,10 @@ var TelemetryClient = class _TelemetryClient {
|
|
|
617876
618204
|
if (sentryDsn != null && sentryDsn.length > 0 && isTelemetryEnabled) {
|
|
617877
618205
|
const sentryEnvironment = "development";
|
|
617878
618206
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
617879
|
-
throw new
|
|
618207
|
+
throw new CliError({
|
|
618208
|
+
message: "SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",
|
|
618209
|
+
code: CliError.Code.ConfigError
|
|
618210
|
+
});
|
|
617880
618211
|
}
|
|
617881
618212
|
this.sentry = init2({
|
|
617882
618213
|
dsn: sentryDsn,
|
|
@@ -618176,7 +618507,10 @@ var ApiDefinitionConverter = class {
|
|
|
618176
618507
|
sourced
|
|
618177
618508
|
});
|
|
618178
618509
|
}
|
|
618179
|
-
throw new
|
|
618510
|
+
throw new CliError({
|
|
618511
|
+
message: `Unknown spec type: ${JSON.stringify(spec)}`,
|
|
618512
|
+
code: CliError.Code.InternalError
|
|
618513
|
+
});
|
|
618180
618514
|
}
|
|
618181
618515
|
async convertOpenApiSpec({ absoluteFernYmlPath, spec, sourced }) {
|
|
618182
618516
|
const result = {
|
|
@@ -619536,7 +619870,10 @@ var LegacyApiSpecAdapter = class {
|
|
|
619536
619870
|
if (isOpenRpcSpec(spec)) {
|
|
619537
619871
|
return this.adaptOpenRpcSpec(spec);
|
|
619538
619872
|
}
|
|
619539
|
-
throw new
|
|
619873
|
+
throw new CliError({
|
|
619874
|
+
message: `Unsupported spec type: ${JSON.stringify(spec)}`,
|
|
619875
|
+
code: CliError.Code.InternalError
|
|
619876
|
+
});
|
|
619540
619877
|
}
|
|
619541
619878
|
convertAll(specs) {
|
|
619542
619879
|
return specs.map((spec) => this.adapt(spec));
|
|
@@ -746685,7 +747022,10 @@ var LegacyFernWorkspaceAdapter = class {
|
|
|
746685
747022
|
generatorsConfiguration: apiConfig != null ? this.buildGeneratorsConfiguration(apiConfig) : void 0
|
|
746686
747023
|
});
|
|
746687
747024
|
if (ossWorkspace == null) {
|
|
746688
|
-
throw new
|
|
747025
|
+
throw new CliError({
|
|
747026
|
+
message: "Internal error; failed to build API definitions",
|
|
747027
|
+
code: CliError.Code.InternalError
|
|
747028
|
+
});
|
|
746689
747029
|
}
|
|
746690
747030
|
return ossWorkspace.toFernWorkspace({ context: this.taskContext });
|
|
746691
747031
|
}
|
|
@@ -747842,7 +748182,10 @@ function addSplitCommand(cli) {
|
|
|
747842
748182
|
description: `Output format: '${OVERLAY_NAME}' (OpenAPI Overlay 1.0.0) or '${OVERRIDES_NAME}' (Fern deep-merge)`
|
|
747843
748183
|
}).coerce("format", (value2) => {
|
|
747844
748184
|
if (!ALL_FORMAT_NAMES.includes(value2)) {
|
|
747845
|
-
throw new
|
|
748185
|
+
throw new CliError({
|
|
748186
|
+
message: `Invalid format '${value2}'. Expected one of: ${OVERLAY_NAME}, ${OVERRIDES_NAME}`,
|
|
748187
|
+
code: CliError.Code.ValidationError
|
|
748188
|
+
});
|
|
747846
748189
|
}
|
|
747847
748190
|
return value2;
|
|
747848
748191
|
}));
|
|
@@ -827894,7 +828237,7 @@ var DocsWorkspaceValidator = class {
|
|
|
827894
828237
|
const startTime = performance.now();
|
|
827895
828238
|
if (workspace.config.settings?.substituteEnvVars) {
|
|
827896
828239
|
workspace.config = replaceEnvVariables(workspace.config, {
|
|
827897
|
-
onError: (error50) => this.taskContext.failAndThrow(error50)
|
|
828240
|
+
onError: (error50) => this.taskContext.failAndThrow(error50, void 0, { code: CliError.Code.ConfigError })
|
|
827898
828241
|
});
|
|
827899
828242
|
}
|
|
827900
828243
|
const violations = await validateDocsWorkspace(workspace, this.taskContext, apiWorkspaces, ossWorkspaces, false, excludeRules);
|
|
@@ -831728,7 +832071,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
831728
832071
|
var LOGS_FOLDER_NAME = "logs";
|
|
831729
832072
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
831730
832073
|
function getCliSource() {
|
|
831731
|
-
const version7 = "4.81.0-
|
|
832074
|
+
const version7 = "4.81.0-11-gc0c2550bc58";
|
|
831732
832075
|
return `cli@${version7}`;
|
|
831733
832076
|
}
|
|
831734
832077
|
var DebugLogger = class {
|
|
@@ -843295,7 +843638,7 @@ var LegacyDocsPublisher = class {
|
|
|
843295
843638
|
previewId,
|
|
843296
843639
|
disableTemplates: void 0,
|
|
843297
843640
|
skipUpload,
|
|
843298
|
-
cliVersion: "4.81.0-
|
|
843641
|
+
cliVersion: "4.81.0-11-gc0c2550bc58"
|
|
843299
843642
|
});
|
|
843300
843643
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843301
843644
|
return { success: false };
|
|
@@ -843770,7 +844113,10 @@ var DocsTask = class {
|
|
|
843770
844113
|
getTask() {
|
|
843771
844114
|
const task = this.taskGroup.getTask(this.id);
|
|
843772
844115
|
if (task == null) {
|
|
843773
|
-
throw new
|
|
844116
|
+
throw new CliError({
|
|
844117
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
844118
|
+
code: CliError.Code.InternalError
|
|
844119
|
+
});
|
|
843774
844120
|
}
|
|
843775
844121
|
return task;
|
|
843776
844122
|
}
|
|
@@ -845042,7 +845388,10 @@ var Wizard = class {
|
|
|
845042
845388
|
async fetchApiFromUrl(url3, specFormat) {
|
|
845043
845389
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
845044
845390
|
if (!response.ok) {
|
|
845045
|
-
throw new
|
|
845391
|
+
throw new CliError({
|
|
845392
|
+
message: `HTTP ${response.status} ${response.statusText}`,
|
|
845393
|
+
code: CliError.Code.NetworkError
|
|
845394
|
+
});
|
|
845046
845395
|
}
|
|
845047
845396
|
const content5 = await response.text();
|
|
845048
845397
|
const filename = this.resolveFilenameFromUrl({ url: url3, specFormat });
|
|
@@ -846572,20 +846921,29 @@ var ApiSpecDetector = class {
|
|
|
846572
846921
|
async detect({ absoluteFilePath, reference: reference4, content: content5 }) {
|
|
846573
846922
|
const parsed = this.parseOrThrow({ content: content5, reference: reference4 });
|
|
846574
846923
|
if (typeof parsed !== "object" || parsed == null) {
|
|
846575
|
-
throw new
|
|
846924
|
+
throw new CliError({
|
|
846925
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
846926
|
+
code: CliError.Code.InternalError
|
|
846927
|
+
});
|
|
846576
846928
|
}
|
|
846577
846929
|
for (const specType of DETECTABLE_SPEC_TYPES) {
|
|
846578
846930
|
if (specType in parsed) {
|
|
846579
846931
|
return specType;
|
|
846580
846932
|
}
|
|
846581
846933
|
}
|
|
846582
|
-
throw new
|
|
846934
|
+
throw new CliError({
|
|
846935
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
846936
|
+
code: CliError.Code.InternalError
|
|
846937
|
+
});
|
|
846583
846938
|
}
|
|
846584
846939
|
parseOrThrow({ content: content5, reference: reference4 }) {
|
|
846585
846940
|
try {
|
|
846586
846941
|
return jsYaml.load(content5);
|
|
846587
846942
|
} catch {
|
|
846588
|
-
throw new
|
|
846943
|
+
throw new CliError({
|
|
846944
|
+
message: `Could not parse "${reference4}" as YAML or JSON. Ensure the file is a valid OpenAPI or AsyncAPI specification.`,
|
|
846945
|
+
code: CliError.Code.ParseError
|
|
846946
|
+
});
|
|
846589
846947
|
}
|
|
846590
846948
|
}
|
|
846591
846949
|
};
|
|
@@ -846623,7 +846981,10 @@ var ApiSpecResolver = class {
|
|
|
846623
846981
|
async resolveLocal({ reference: reference4 }) {
|
|
846624
846982
|
const absoluteFilePath = resolve6(this.context.cwd, reference4);
|
|
846625
846983
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
846626
|
-
throw new
|
|
846984
|
+
throw new CliError({
|
|
846985
|
+
message: `API spec file does not exist: ${reference4}`,
|
|
846986
|
+
code: CliError.Code.ConfigError
|
|
846987
|
+
});
|
|
846627
846988
|
}
|
|
846628
846989
|
const content5 = await (0, import_promises92.readFile)(absoluteFilePath, "utf-8");
|
|
846629
846990
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
@@ -846636,11 +846997,17 @@ var ApiSpecResolver = class {
|
|
|
846636
846997
|
async fetchContent({ url: url3 }) {
|
|
846637
846998
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
846638
846999
|
if (!response.ok) {
|
|
846639
|
-
throw new
|
|
847000
|
+
throw new CliError({
|
|
847001
|
+
message: `Failed to fetch "${url3}": HTTP ${response.status} ${response.statusText}`,
|
|
847002
|
+
code: CliError.Code.NetworkError
|
|
847003
|
+
});
|
|
846640
847004
|
}
|
|
846641
847005
|
const contentType = response.headers.get("content-type") ?? "";
|
|
846642
847006
|
if (contentType.includes("text/html")) {
|
|
846643
|
-
throw new
|
|
847007
|
+
throw new CliError({
|
|
847008
|
+
message: `The URL "${url3}" returned HTML content. Ensure you're pointing to a raw spec URL, not a documentation page.`,
|
|
847009
|
+
code: CliError.Code.ConfigError
|
|
847010
|
+
});
|
|
846644
847011
|
}
|
|
846645
847012
|
const content5 = await response.text();
|
|
846646
847013
|
return { content: content5, contentType };
|
|
@@ -846665,7 +847032,10 @@ var ApiSpecResolver = class {
|
|
|
846665
847032
|
case "asyncapi":
|
|
846666
847033
|
return { asyncapi: absoluteFilePath, origin: origin2 };
|
|
846667
847034
|
default:
|
|
846668
|
-
throw new
|
|
847035
|
+
throw new CliError({
|
|
847036
|
+
message: `Unsupported spec type for flags mode: "${specType}". Supported: openapi, asyncapi`,
|
|
847037
|
+
code: CliError.Code.ConfigError
|
|
847038
|
+
});
|
|
846669
847039
|
}
|
|
846670
847040
|
}
|
|
846671
847041
|
isUrl(reference4) {
|
|
@@ -847699,16 +848069,26 @@ var ContainerExecutionEnvironment = class {
|
|
|
847699
848069
|
envVars["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${DEFAULT_NODE_DEBUG_PORT}`;
|
|
847700
848070
|
ports[DEFAULT_NODE_DEBUG_PORT] = DEFAULT_NODE_DEBUG_PORT;
|
|
847701
848071
|
}
|
|
847702
|
-
|
|
847703
|
-
|
|
847704
|
-
|
|
847705
|
-
|
|
847706
|
-
|
|
847707
|
-
|
|
847708
|
-
|
|
847709
|
-
|
|
847710
|
-
|
|
847711
|
-
|
|
848072
|
+
try {
|
|
848073
|
+
await runContainer({
|
|
848074
|
+
logger: context3.logger,
|
|
848075
|
+
imageName: this.containerImage,
|
|
848076
|
+
args: [CONTAINER_GENERATOR_CONFIG_PATH],
|
|
848077
|
+
binds,
|
|
848078
|
+
envVars,
|
|
848079
|
+
ports,
|
|
848080
|
+
removeAfterCompletion: !this.keepContainer,
|
|
848081
|
+
runner: this.runner ?? runner
|
|
848082
|
+
});
|
|
848083
|
+
} catch (error50) {
|
|
848084
|
+
if (error50 instanceof CliError) {
|
|
848085
|
+
throw error50;
|
|
848086
|
+
}
|
|
848087
|
+
throw new CliError({
|
|
848088
|
+
message: `Container execution failed: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
848089
|
+
code: CliError.Code.ContainerError
|
|
848090
|
+
});
|
|
848091
|
+
}
|
|
847712
848092
|
}
|
|
847713
848093
|
};
|
|
847714
848094
|
|
|
@@ -897467,7 +897847,10 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
897467
897847
|
}
|
|
897468
897848
|
const absolutePath = join8(this.context.cwd, RelativeFilePath2.of(license));
|
|
897469
897849
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
897470
|
-
throw new
|
|
897850
|
+
throw new CliError({
|
|
897851
|
+
message: `Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`,
|
|
897852
|
+
code: CliError.Code.InternalError
|
|
897853
|
+
});
|
|
897471
897854
|
}
|
|
897472
897855
|
const contents = await (0, import_promises106.readFile)(absolutePath, "utf-8");
|
|
897473
897856
|
return api_exports4.GithubLicense.custom({ contents });
|
|
@@ -897975,7 +898358,10 @@ var SdkTask = class {
|
|
|
897975
898358
|
getTask() {
|
|
897976
898359
|
const task = this.taskGroup.getTask(this.id);
|
|
897977
898360
|
if (task == null) {
|
|
897978
|
-
throw new
|
|
898361
|
+
throw new CliError({
|
|
898362
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
898363
|
+
code: CliError.Code.InternalError
|
|
898364
|
+
});
|
|
897979
898365
|
}
|
|
897980
898366
|
return task;
|
|
897981
898367
|
}
|
|
@@ -898207,7 +898593,7 @@ var GenerateCommand = class {
|
|
|
898207
898593
|
}
|
|
898208
898594
|
async runGeneration({ context: context3, workspace, targets: targets2, args, forceLocal }) {
|
|
898209
898595
|
if (workspace.sdks == null) {
|
|
898210
|
-
throw new
|
|
898596
|
+
throw new CliError({ message: "No SDKs configured", code: CliError.Code.InternalError });
|
|
898211
898597
|
}
|
|
898212
898598
|
const apisToCheck = [...new Set(targets2.map((t3) => t3.api))];
|
|
898213
898599
|
const apiChecker = new ApiChecker({
|
|
@@ -898889,7 +899275,10 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
898889
899275
|
const packageJsonContent = await (0, import_promises110.readFile)(packageJsonPath, "utf-8");
|
|
898890
899276
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
898891
899277
|
if (packageJson2.main == null) {
|
|
898892
|
-
throw new
|
|
899278
|
+
throw new CliError({
|
|
899279
|
+
message: `No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`,
|
|
899280
|
+
code: CliError.Code.InternalError
|
|
899281
|
+
});
|
|
898893
899282
|
}
|
|
898894
899283
|
const packageEntryPoint = (0, import_path80.join)(packageDir, packageJson2.main);
|
|
898895
899284
|
const { migrations } = await import((0, import_url8.pathToFileURL)(packageEntryPoint).href);
|
|
@@ -899004,11 +899393,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
899004
899393
|
this.logger.debug(`No migration package found for ${generatorName}.`);
|
|
899005
899394
|
return void 0;
|
|
899006
899395
|
}
|
|
899007
|
-
throw new
|
|
899396
|
+
throw new CliError({
|
|
899397
|
+
message: `Failed to load generator migrations for ${generatorName}.
|
|
899008
899398
|
|
|
899009
899399
|
Reason: ${errorMessage}
|
|
899010
899400
|
|
|
899011
|
-
Please check your internet connection and npm configuration, then try again
|
|
899401
|
+
Please check your internet connection and npm configuration, then try again.`,
|
|
899402
|
+
code: CliError.Code.InternalError
|
|
899403
|
+
});
|
|
899012
899404
|
}
|
|
899013
899405
|
}
|
|
899014
899406
|
/**
|
|
@@ -899037,7 +899429,10 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
899037
899429
|
const aVersion = import_semver14.default.parse(a4.version);
|
|
899038
899430
|
const bVersion = import_semver14.default.parse(b7.version);
|
|
899039
899431
|
if (aVersion == null || bVersion == null) {
|
|
899040
|
-
throw new
|
|
899432
|
+
throw new CliError({
|
|
899433
|
+
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.`,
|
|
899434
|
+
code: CliError.Code.InternalError
|
|
899435
|
+
});
|
|
899041
899436
|
}
|
|
899042
899437
|
return import_semver14.default.compare(aVersion, bVersion);
|
|
899043
899438
|
});
|
|
@@ -899055,11 +899450,14 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
899055
899450
|
appliedVersions.push(migration23.version);
|
|
899056
899451
|
} catch (error50) {
|
|
899057
899452
|
const errorMessage = extractErrorMessage(error50);
|
|
899058
|
-
throw new
|
|
899453
|
+
throw new CliError({
|
|
899454
|
+
message: `Failed to apply migration for version ${migration23.version}.
|
|
899059
899455
|
|
|
899060
899456
|
Reason: ${errorMessage}
|
|
899061
899457
|
|
|
899062
|
-
Please report this issue at: https://github.com/fern-api/fern/issues
|
|
899458
|
+
Please report this issue at: https://github.com/fern-api/fern/issues`,
|
|
899459
|
+
code: CliError.Code.InternalError
|
|
899460
|
+
});
|
|
899063
899461
|
}
|
|
899064
899462
|
}
|
|
899065
899463
|
return {
|
|
@@ -918415,7 +918813,7 @@ var CliContext = class _CliContext {
|
|
|
918415
918813
|
if (false) {
|
|
918416
918814
|
this.logger.error("CLI_VERSION is not defined");
|
|
918417
918815
|
}
|
|
918418
|
-
return "4.81.0-
|
|
918816
|
+
return "4.81.0-11-gc0c2550bc58";
|
|
918419
918817
|
}
|
|
918420
918818
|
getCliName() {
|
|
918421
918819
|
if (false) {
|