@fern-api/fern-api-dev 4.81.0 → 4.82.0-1-g000d7384e60
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 +1076 -360
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -469477,6 +469477,7 @@ var CliError = class _CliError extends Error {
|
|
|
469477
469477
|
NetworkError: "NETWORK_ERROR",
|
|
469478
469478
|
AuthError: "AUTH_ERROR",
|
|
469479
469479
|
ConfigError: "CONFIG_ERROR",
|
|
469480
|
+
UserError: "USER_ERROR",
|
|
469480
469481
|
Unclassified: "UNCLASSIFIED"
|
|
469481
469482
|
};
|
|
469482
469483
|
})(CliError || (CliError = {}));
|
|
@@ -469493,6 +469494,7 @@ var SENTRY_REPORTABLE = {
|
|
|
469493
469494
|
[CliError.Code.NetworkError]: false,
|
|
469494
469495
|
[CliError.Code.AuthError]: false,
|
|
469495
469496
|
[CliError.Code.ConfigError]: false,
|
|
469497
|
+
[CliError.Code.UserError]: false,
|
|
469496
469498
|
[CliError.Code.Unclassified]: false
|
|
469497
469499
|
};
|
|
469498
469500
|
function shouldReportToSentry(code5) {
|
|
@@ -476772,6 +476774,15 @@ var PublishTarget = {
|
|
|
476772
476774
|
}
|
|
476773
476775
|
};
|
|
476774
476776
|
},
|
|
476777
|
+
go: (value2) => {
|
|
476778
|
+
return {
|
|
476779
|
+
...value2,
|
|
476780
|
+
type: "go",
|
|
476781
|
+
_visit: function(visitor) {
|
|
476782
|
+
return PublishTarget._visit(this, visitor);
|
|
476783
|
+
}
|
|
476784
|
+
};
|
|
476785
|
+
},
|
|
476775
476786
|
_visit: (value2, visitor) => {
|
|
476776
476787
|
switch (value2.type) {
|
|
476777
476788
|
case "postman":
|
|
@@ -476784,6 +476795,8 @@ var PublishTarget = {
|
|
|
476784
476795
|
return visitor.pypi(value2);
|
|
476785
476796
|
case "crates":
|
|
476786
476797
|
return visitor.crates(value2);
|
|
476798
|
+
case "go":
|
|
476799
|
+
return visitor.go(value2);
|
|
476787
476800
|
default:
|
|
476788
476801
|
return visitor._other(value2);
|
|
476789
476802
|
}
|
|
@@ -478370,6 +478383,7 @@ __export(serialization_exports2, {
|
|
|
478370
478383
|
FloatValidationRules: () => FloatValidationRules,
|
|
478371
478384
|
GenerationMetadata: () => GenerationMetadata,
|
|
478372
478385
|
GithubPublish: () => GithubPublish,
|
|
478386
|
+
GoPublishTarget: () => GoPublishTarget,
|
|
478373
478387
|
GrpcTransport: () => GrpcTransport2,
|
|
478374
478388
|
HeaderApiVersionScheme: () => HeaderApiVersionScheme,
|
|
478375
478389
|
HeaderAuthScheme: () => HeaderAuthScheme,
|
|
@@ -483296,6 +483310,12 @@ var CratesPublishTarget = schemas_exports3.objectWithoutOptionalProperties({
|
|
|
483296
483310
|
packageName: schemas_exports3.string().optional()
|
|
483297
483311
|
});
|
|
483298
483312
|
|
|
483313
|
+
// ../../ir-sdk/lib/sdk/serialization/resources/publish/types/GoPublishTarget.js
|
|
483314
|
+
var GoPublishTarget = schemas_exports3.objectWithoutOptionalProperties({
|
|
483315
|
+
version: schemas_exports3.string().optional(),
|
|
483316
|
+
modulePath: schemas_exports3.string().optional()
|
|
483317
|
+
});
|
|
483318
|
+
|
|
483299
483319
|
// ../../ir-sdk/lib/sdk/serialization/resources/publish/types/MavenPublishTarget.js
|
|
483300
483320
|
var MavenPublishTarget = schemas_exports3.objectWithoutOptionalProperties({
|
|
483301
483321
|
coordinate: schemas_exports3.string().optional(),
|
|
@@ -483331,7 +483351,8 @@ var PublishTarget2 = schemas_exports3.union("type", {
|
|
|
483331
483351
|
npm: NpmPublishTarget,
|
|
483332
483352
|
maven: MavenPublishTarget,
|
|
483333
483353
|
pypi: PypiPublishTarget,
|
|
483334
|
-
crates: CratesPublishTarget
|
|
483354
|
+
crates: CratesPublishTarget,
|
|
483355
|
+
go: GoPublishTarget
|
|
483335
483356
|
}).transform({
|
|
483336
483357
|
transform: (value2) => {
|
|
483337
483358
|
switch (value2.type) {
|
|
@@ -483345,6 +483366,8 @@ var PublishTarget2 = schemas_exports3.union("type", {
|
|
|
483345
483366
|
return PublishTarget.pypi(value2);
|
|
483346
483367
|
case "crates":
|
|
483347
483368
|
return PublishTarget.crates(value2);
|
|
483369
|
+
case "go":
|
|
483370
|
+
return PublishTarget.go(value2);
|
|
483348
483371
|
default:
|
|
483349
483372
|
return value2;
|
|
483350
483373
|
}
|
|
@@ -484319,6 +484342,7 @@ __export(publish_exports2, {
|
|
|
484319
484342
|
DirectPublish: () => DirectPublish,
|
|
484320
484343
|
Filesystem: () => Filesystem,
|
|
484321
484344
|
GithubPublish: () => GithubPublish,
|
|
484345
|
+
GoPublishTarget: () => GoPublishTarget,
|
|
484322
484346
|
MavenPublishTarget: () => MavenPublishTarget,
|
|
484323
484347
|
NpmPublishTarget: () => NpmPublishTarget,
|
|
484324
484348
|
PostmanPublishTarget: () => PostmanPublishTarget,
|
|
@@ -524617,7 +524641,10 @@ function getSchemaFromFernType({ fernType, nameOverride, generatedName, title: t
|
|
|
524617
524641
|
string: (value2) => LiteralSchemaValue.string(value2),
|
|
524618
524642
|
boolean: (value2) => LiteralSchemaValue.boolean(value2),
|
|
524619
524643
|
_other: () => {
|
|
524620
|
-
throw new
|
|
524644
|
+
throw new CliError({
|
|
524645
|
+
message: "Unexpected literal type",
|
|
524646
|
+
code: CliError.Code.InternalError
|
|
524647
|
+
});
|
|
524621
524648
|
}
|
|
524622
524649
|
}),
|
|
524623
524650
|
description,
|
|
@@ -527774,7 +527801,10 @@ function convertToReferencedSchema(schema2, breadcrumbs, source2, preserveSchema
|
|
|
527774
527801
|
const availability = convertAvailability2(schema2);
|
|
527775
527802
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
527776
527803
|
if (schemaId == null) {
|
|
527777
|
-
throw new
|
|
527804
|
+
throw new CliError({
|
|
527805
|
+
message: `Invalid schema reference ${JSON.stringify(schema2)}`,
|
|
527806
|
+
code: CliError.Code.ReferenceError
|
|
527807
|
+
});
|
|
527778
527808
|
}
|
|
527779
527809
|
return Schema.reference({
|
|
527780
527810
|
// TODO(dsinghvi): references may contain files
|
|
@@ -528103,21 +528133,33 @@ var AbstractAsyncAPIParserContext = class {
|
|
|
528103
528133
|
*/
|
|
528104
528134
|
resolveSchemaReference(schema2) {
|
|
528105
528135
|
if (!schema2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
528106
|
-
throw new
|
|
528136
|
+
throw new CliError({
|
|
528137
|
+
message: `Failed to resolve schema reference: ${schema2.$ref}`,
|
|
528138
|
+
code: CliError.Code.ReferenceError
|
|
528139
|
+
});
|
|
528107
528140
|
}
|
|
528108
528141
|
const schemaKey = schema2.$ref.substring(SCHEMA_REFERENCE_PREFIX.length);
|
|
528109
528142
|
const splitSchemaKey = schemaKey.split("/");
|
|
528110
528143
|
const components = this.document.components;
|
|
528111
528144
|
if (components == null || components.schemas == null) {
|
|
528112
|
-
throw new
|
|
528145
|
+
throw new CliError({
|
|
528146
|
+
message: "Document does not have components.schemas.",
|
|
528147
|
+
code: CliError.Code.ReferenceError
|
|
528148
|
+
});
|
|
528113
528149
|
}
|
|
528114
528150
|
const [topKey, maybeProps, maybePropKey] = splitSchemaKey;
|
|
528115
528151
|
if (topKey == null || topKey === "") {
|
|
528116
|
-
throw new
|
|
528152
|
+
throw new CliError({
|
|
528153
|
+
message: `${schema2.$ref} cannot be resolved. No schema key provided.`,
|
|
528154
|
+
code: CliError.Code.ReferenceError
|
|
528155
|
+
});
|
|
528117
528156
|
}
|
|
528118
528157
|
let resolvedSchema = components.schemas[topKey];
|
|
528119
528158
|
if (resolvedSchema == null) {
|
|
528120
|
-
throw new
|
|
528159
|
+
throw new CliError({
|
|
528160
|
+
message: `Schema "${topKey}" is undefined in document.components.schemas.`,
|
|
528161
|
+
code: CliError.Code.ReferenceError
|
|
528162
|
+
});
|
|
528121
528163
|
}
|
|
528122
528164
|
if (isReferenceObject(resolvedSchema)) {
|
|
528123
528165
|
resolvedSchema = this.resolveSchemaReference(resolvedSchema);
|
|
@@ -528125,7 +528167,10 @@ var AbstractAsyncAPIParserContext = class {
|
|
|
528125
528167
|
if (maybeProps === "properties" && maybePropKey != null) {
|
|
528126
528168
|
const resolvedProperty = resolvedSchema.properties?.[maybePropKey];
|
|
528127
528169
|
if (resolvedProperty == null) {
|
|
528128
|
-
throw new
|
|
528170
|
+
throw new CliError({
|
|
528171
|
+
message: `Property "${maybePropKey}" not found on "${topKey}". Full ref: ${schema2.$ref}`,
|
|
528172
|
+
code: CliError.Code.ReferenceError
|
|
528173
|
+
});
|
|
528129
528174
|
} else if (isReferenceObject(resolvedProperty)) {
|
|
528130
528175
|
resolvedSchema = this.resolveSchemaReference(resolvedProperty);
|
|
528131
528176
|
} else {
|
|
@@ -528178,12 +528223,15 @@ var AsyncAPIV2ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
528178
528223
|
const MESSAGE_REFERENCE_PREFIX = "#/components/messages/";
|
|
528179
528224
|
const components = this.document.components;
|
|
528180
528225
|
if (components == null || components.messages == null || !message.$ref.startsWith(MESSAGE_REFERENCE_PREFIX)) {
|
|
528181
|
-
throw new
|
|
528226
|
+
throw new CliError({
|
|
528227
|
+
message: `Failed to resolve message reference: ${message.$ref} in v2 components`,
|
|
528228
|
+
code: CliError.Code.ReferenceError
|
|
528229
|
+
});
|
|
528182
528230
|
}
|
|
528183
528231
|
const messageKey = message.$ref.substring(MESSAGE_REFERENCE_PREFIX.length);
|
|
528184
528232
|
const resolvedMessage = components.messages[messageKey];
|
|
528185
528233
|
if (resolvedMessage == null) {
|
|
528186
|
-
throw new
|
|
528234
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
528187
528235
|
}
|
|
528188
528236
|
return resolvedMessage;
|
|
528189
528237
|
}
|
|
@@ -529015,7 +529063,10 @@ var ExampleTypeFactory = class _ExampleTypeFactory {
|
|
|
529015
529063
|
while (schema2.type === "reference") {
|
|
529016
529064
|
const resolvedSchema = this.schemas[schema2.schema];
|
|
529017
529065
|
if (resolvedSchema == null) {
|
|
529018
|
-
throw new
|
|
529066
|
+
throw new CliError({
|
|
529067
|
+
message: `Unexpected error: Failed to resolve schema reference: ${schema2.schema}`,
|
|
529068
|
+
code: CliError.Code.InternalError
|
|
529069
|
+
});
|
|
529019
529070
|
}
|
|
529020
529071
|
schema2 = resolvedSchema;
|
|
529021
529072
|
}
|
|
@@ -530344,7 +530395,10 @@ var ExampleWebsocketSessionFactory = class {
|
|
|
530344
530395
|
while (schema2.type === "reference") {
|
|
530345
530396
|
const resolvedSchema = this.schemas[schema2.schema];
|
|
530346
530397
|
if (resolvedSchema == null) {
|
|
530347
|
-
throw new
|
|
530398
|
+
throw new CliError({
|
|
530399
|
+
message: `Unexpected error: Failed to resolve schema reference: ${schema2.schema}`,
|
|
530400
|
+
code: CliError.Code.InternalError
|
|
530401
|
+
});
|
|
530348
530402
|
}
|
|
530349
530403
|
schema2 = resolvedSchema;
|
|
530350
530404
|
}
|
|
@@ -530854,7 +530908,10 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530854
530908
|
getExampleMessageReference(message) {
|
|
530855
530909
|
const channelId = message.channelId ?? this.getDefaultChannelId();
|
|
530856
530910
|
if (channelId == null) {
|
|
530857
|
-
throw new
|
|
530911
|
+
throw new CliError({
|
|
530912
|
+
message: `Cannot resolve example message reference: no channelId provided and no channels found in document`,
|
|
530913
|
+
code: CliError.Code.InternalError
|
|
530914
|
+
});
|
|
530858
530915
|
}
|
|
530859
530916
|
return `#/channels/${channelId}/messages/${message.messageId}`;
|
|
530860
530917
|
}
|
|
@@ -530869,12 +530926,12 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530869
530926
|
resolveParameterReference(parameter6) {
|
|
530870
530927
|
const PARAMETER_REFERENCE_PREFIX2 = "#/components/parameters/";
|
|
530871
530928
|
if (this.document.components == null || this.document.components.parameters == null || !parameter6.$ref.startsWith(PARAMETER_REFERENCE_PREFIX2)) {
|
|
530872
|
-
throw new
|
|
530929
|
+
throw new CliError({ message: `Failed to resolve ${parameter6.$ref}`, code: CliError.Code.ReferenceError });
|
|
530873
530930
|
}
|
|
530874
530931
|
const parameterKey = parameter6.$ref.substring(PARAMETER_REFERENCE_PREFIX2.length);
|
|
530875
530932
|
const resolvedParameter = this.document.components.parameters[parameterKey];
|
|
530876
530933
|
if (resolvedParameter == null) {
|
|
530877
|
-
throw new
|
|
530934
|
+
throw new CliError({ message: `${parameter6.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530878
530935
|
}
|
|
530879
530936
|
if ("$ref" in resolvedParameter) {
|
|
530880
530937
|
return this.resolveParameterReference(resolvedParameter);
|
|
@@ -530886,10 +530943,16 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530886
530943
|
const CHANNELS_PATH_PART = "#/channels/";
|
|
530887
530944
|
const MESSAGE_REFERENCE_PREFIX = "#/components/messages/";
|
|
530888
530945
|
if (message == null) {
|
|
530889
|
-
throw new
|
|
530946
|
+
throw new CliError({
|
|
530947
|
+
message: "Cannot resolve message reference: message is null or undefined",
|
|
530948
|
+
code: CliError.Code.InternalError
|
|
530949
|
+
});
|
|
530890
530950
|
}
|
|
530891
530951
|
if (!message.$ref) {
|
|
530892
|
-
throw new
|
|
530952
|
+
throw new CliError({
|
|
530953
|
+
message: "Cannot resolve message reference: message.$ref is undefined or empty",
|
|
530954
|
+
code: CliError.Code.ReferenceError
|
|
530955
|
+
});
|
|
530893
530956
|
}
|
|
530894
530957
|
if (message.$ref.startsWith(CHANNELS_PATH_PART)) {
|
|
530895
530958
|
const parts = message.$ref.split("/");
|
|
@@ -530897,12 +530960,15 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530897
530960
|
const messageKey2 = parts[4];
|
|
530898
530961
|
const channelPath = rawChannelPath?.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
530899
530962
|
if (channelPath == null || messageKey2 == null || !this.document.channels?.[channelPath]) {
|
|
530900
|
-
throw new
|
|
530963
|
+
throw new CliError({
|
|
530964
|
+
message: `Failed to resolve message reference ${message.$ref} in channel ${channelPath}`,
|
|
530965
|
+
code: CliError.Code.ReferenceError
|
|
530966
|
+
});
|
|
530901
530967
|
}
|
|
530902
530968
|
const channel3 = this.document.channels[channelPath];
|
|
530903
530969
|
const resolvedInChannel = channel3.messages?.[messageKey2];
|
|
530904
530970
|
if (resolvedInChannel == null) {
|
|
530905
|
-
throw new
|
|
530971
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530906
530972
|
}
|
|
530907
530973
|
if ("$ref" in resolvedInChannel && !shallow) {
|
|
530908
530974
|
return this.resolveMessageReference(resolvedInChannel);
|
|
@@ -530915,12 +530981,15 @@ var AsyncAPIV3ParserContext = class extends AbstractAsyncAPIParserContext {
|
|
|
530915
530981
|
}
|
|
530916
530982
|
const components = this.document.components;
|
|
530917
530983
|
if (!message.$ref.startsWith(MESSAGE_REFERENCE_PREFIX) || !components?.messages) {
|
|
530918
|
-
throw new
|
|
530984
|
+
throw new CliError({
|
|
530985
|
+
message: `Failed to resolve message reference: ${message.$ref} in v3 components`,
|
|
530986
|
+
code: CliError.Code.ReferenceError
|
|
530987
|
+
});
|
|
530919
530988
|
}
|
|
530920
530989
|
const messageKey = message.$ref.substring(MESSAGE_REFERENCE_PREFIX.length);
|
|
530921
530990
|
const resolvedInComponents = components.messages[messageKey];
|
|
530922
530991
|
if (resolvedInComponents == null) {
|
|
530923
|
-
throw new
|
|
530992
|
+
throw new CliError({ message: `${message.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
530924
530993
|
}
|
|
530925
530994
|
return {
|
|
530926
530995
|
...resolvedInComponents,
|
|
@@ -531043,14 +531112,20 @@ function parseAsyncAPIV3({ context: context3, breadcrumbs, source: source2, asyn
|
|
|
531043
531112
|
}));
|
|
531044
531113
|
const channelEvent = channelEvents[channelPath];
|
|
531045
531114
|
if (channelEvent == null) {
|
|
531046
|
-
throw new
|
|
531115
|
+
throw new CliError({
|
|
531116
|
+
message: `Internal error: channelEvents["${channelPath}"] is unexpectedly undefined for operation ${operationId}`,
|
|
531117
|
+
code: CliError.Code.InternalError
|
|
531118
|
+
});
|
|
531047
531119
|
}
|
|
531048
531120
|
if (operation.action === "receive") {
|
|
531049
531121
|
channelEvent.subscribe.push(...messagesWithMethodName);
|
|
531050
531122
|
} else if (operation.action === "send") {
|
|
531051
531123
|
channelEvent.publish.push(...messagesWithMethodName);
|
|
531052
531124
|
} else {
|
|
531053
|
-
throw new
|
|
531125
|
+
throw new CliError({
|
|
531126
|
+
message: `Operation ${operationId} has an invalid action: ${operation.action}`,
|
|
531127
|
+
code: CliError.Code.ValidationError
|
|
531128
|
+
});
|
|
531054
531129
|
}
|
|
531055
531130
|
}
|
|
531056
531131
|
for (const [channelPath, events] of Object.entries(channelEvents)) {
|
|
@@ -531314,42 +531389,63 @@ function decodeJsonPointerSegment(segment) {
|
|
|
531314
531389
|
}
|
|
531315
531390
|
function getChannelPathFromOperation(operation) {
|
|
531316
531391
|
if (!operation.channel) {
|
|
531317
|
-
throw new
|
|
531392
|
+
throw new CliError({
|
|
531393
|
+
message: "Operation is missing required 'channel' field",
|
|
531394
|
+
code: CliError.Code.ValidationError
|
|
531395
|
+
});
|
|
531318
531396
|
}
|
|
531319
531397
|
if (!operation.channel.$ref) {
|
|
531320
|
-
throw new
|
|
531398
|
+
throw new CliError({
|
|
531399
|
+
message: "Operation channel is missing required '$ref' field",
|
|
531400
|
+
code: CliError.Code.ValidationError
|
|
531401
|
+
});
|
|
531321
531402
|
}
|
|
531322
531403
|
if (!operation.channel.$ref.startsWith(CHANNEL_REFERENCE_PREFIX)) {
|
|
531323
|
-
throw new
|
|
531404
|
+
throw new CliError({
|
|
531405
|
+
message: `Failed to resolve channel path from operation ${operation.channel.$ref}`,
|
|
531406
|
+
code: CliError.Code.ReferenceError
|
|
531407
|
+
});
|
|
531324
531408
|
}
|
|
531325
531409
|
return decodeJsonPointerSegment(operation.channel.$ref.substring(CHANNEL_REFERENCE_PREFIX.length));
|
|
531326
531410
|
}
|
|
531327
531411
|
function convertChannelParameterLocation(location2) {
|
|
531328
|
-
|
|
531329
|
-
|
|
531330
|
-
|
|
531331
|
-
|
|
531332
|
-
|
|
531333
|
-
|
|
531334
|
-
|
|
531335
|
-
|
|
531336
|
-
|
|
531337
|
-
|
|
531338
|
-
|
|
531339
|
-
|
|
531340
|
-
|
|
531341
|
-
}
|
|
531342
|
-
|
|
531412
|
+
const ASYNCAPI_RUNTIME_EXPRESSION_DOCS = "https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression";
|
|
531413
|
+
const [messageType, parameterKey] = location2.split("#/");
|
|
531414
|
+
if (messageType == null || parameterKey == null) {
|
|
531415
|
+
throw new CliError({
|
|
531416
|
+
message: `Invalid location format: ${location2}; unable to parse message type and parameter key. See ${ASYNCAPI_RUNTIME_EXPRESSION_DOCS} for the expected format.`,
|
|
531417
|
+
code: CliError.Code.ValidationError
|
|
531418
|
+
});
|
|
531419
|
+
}
|
|
531420
|
+
if (!messageType.startsWith(LOCATION_PREFIX)) {
|
|
531421
|
+
throw new CliError({
|
|
531422
|
+
message: `Invalid location format: ${location2}; expected ${LOCATION_PREFIX} prefix`,
|
|
531423
|
+
code: CliError.Code.ValidationError
|
|
531424
|
+
});
|
|
531425
|
+
}
|
|
531426
|
+
const type8 = messageType.substring(LOCATION_PREFIX.length);
|
|
531427
|
+
if (type8 !== "header" && type8 !== "path" && type8 !== "payload") {
|
|
531428
|
+
throw new CliError({
|
|
531429
|
+
message: `Invalid message type: ${type8}. Must be one of: header, path, payload`,
|
|
531430
|
+
code: CliError.Code.ValidationError
|
|
531431
|
+
});
|
|
531343
531432
|
}
|
|
531433
|
+
return { type: type8, parameterKey };
|
|
531344
531434
|
}
|
|
531345
531435
|
function getServerNameFromServerRef(servers, serverRef) {
|
|
531346
531436
|
if (!serverRef.$ref.startsWith(SERVER_REFERENCE_PREFIX)) {
|
|
531347
|
-
throw new
|
|
531437
|
+
throw new CliError({
|
|
531438
|
+
message: `Failed to resolve server name from server ref ${serverRef.$ref}`,
|
|
531439
|
+
code: CliError.Code.ReferenceError
|
|
531440
|
+
});
|
|
531348
531441
|
}
|
|
531349
531442
|
const serverName = serverRef.$ref.substring(SERVER_REFERENCE_PREFIX.length);
|
|
531350
531443
|
const server = servers[serverName];
|
|
531351
531444
|
if (server == null) {
|
|
531352
|
-
throw new
|
|
531445
|
+
throw new CliError({
|
|
531446
|
+
message: `Failed to find server with name ${serverName}`,
|
|
531447
|
+
code: CliError.Code.ReferenceError
|
|
531448
|
+
});
|
|
531353
531449
|
}
|
|
531354
531450
|
return server;
|
|
531355
531451
|
}
|
|
@@ -531538,7 +531634,7 @@ function convertPaginationExtension(pagination) {
|
|
|
531538
531634
|
results: customPagination.results
|
|
531539
531635
|
});
|
|
531540
531636
|
}
|
|
531541
|
-
throw new
|
|
531637
|
+
throw new CliError({ message: "Invalid pagination extension", code: CliError.Code.ValidationError });
|
|
531542
531638
|
}
|
|
531543
531639
|
function getFernPaginationExtension(document4, operation) {
|
|
531544
531640
|
const pagination = getExtension(operation, FernOpenAPIExtension.PAGINATION);
|
|
@@ -531548,7 +531644,10 @@ function getFernPaginationExtension(document4, operation) {
|
|
|
531548
531644
|
if (typeof pagination === "boolean") {
|
|
531549
531645
|
const topLevelPagination = getExtension(document4, FernOpenAPIExtension.PAGINATION);
|
|
531550
531646
|
if (typeof topLevelPagination === "boolean") {
|
|
531551
|
-
throw new
|
|
531647
|
+
throw new CliError({
|
|
531648
|
+
message: "Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",
|
|
531649
|
+
code: CliError.Code.ValidationError
|
|
531650
|
+
});
|
|
531552
531651
|
}
|
|
531553
531652
|
return topLevelPagination == null ? void 0 : convertPaginationExtension(topLevelPagination);
|
|
531554
531653
|
}
|
|
@@ -531867,12 +531966,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531867
531966
|
}
|
|
531868
531967
|
resolveParameterReference(parameter6) {
|
|
531869
531968
|
if (this.document.components == null || this.document.components.parameters == null || !parameter6.$ref.startsWith(PARAMETER_REFERENCE_PREFIX)) {
|
|
531870
|
-
throw new
|
|
531969
|
+
throw new CliError({ message: `Failed to resolve ${parameter6.$ref}`, code: CliError.Code.ReferenceError });
|
|
531871
531970
|
}
|
|
531872
531971
|
const parameterKey = parameter6.$ref.substring(PARAMETER_REFERENCE_PREFIX.length);
|
|
531873
531972
|
const resolvedParameter = this.document.components.parameters[parameterKey];
|
|
531874
531973
|
if (resolvedParameter == null) {
|
|
531875
|
-
throw new
|
|
531974
|
+
throw new CliError({ message: `${parameter6.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531876
531975
|
}
|
|
531877
531976
|
if (isReferenceObject(resolvedParameter)) {
|
|
531878
531977
|
return this.resolveParameterReference(resolvedParameter);
|
|
@@ -531881,12 +531980,15 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531881
531980
|
}
|
|
531882
531981
|
resolveRequestBodyReference(requestBody) {
|
|
531883
531982
|
if (this.document.components == null || this.document.components.requestBodies == null || !requestBody.$ref.startsWith(REQUEST_BODY_REFERENCE_PREFIX)) {
|
|
531884
|
-
throw new
|
|
531983
|
+
throw new CliError({
|
|
531984
|
+
message: `Failed to resolve ${requestBody.$ref}`,
|
|
531985
|
+
code: CliError.Code.ReferenceError
|
|
531986
|
+
});
|
|
531885
531987
|
}
|
|
531886
531988
|
const requestBodyKey = requestBody.$ref.substring(REQUEST_BODY_REFERENCE_PREFIX.length);
|
|
531887
531989
|
const resolvedRequestBody = this.document.components.requestBodies[requestBodyKey];
|
|
531888
531990
|
if (resolvedRequestBody == null) {
|
|
531889
|
-
throw new
|
|
531991
|
+
throw new CliError({ message: `${requestBody.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531890
531992
|
}
|
|
531891
531993
|
if (isReferenceObject(resolvedRequestBody)) {
|
|
531892
531994
|
return this.resolveRequestBodyReference(resolvedRequestBody);
|
|
@@ -531895,12 +531997,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531895
531997
|
}
|
|
531896
531998
|
resolveResponseReference(response) {
|
|
531897
531999
|
if (this.document.components == null || this.document.components.responses == null || !response.$ref.startsWith(RESPONSE_REFERENCE_PREFIX)) {
|
|
531898
|
-
throw new
|
|
532000
|
+
throw new CliError({ message: `Failed to resolve ${response.$ref}`, code: CliError.Code.ReferenceError });
|
|
531899
532001
|
}
|
|
531900
532002
|
const parameterKey = response.$ref.substring(RESPONSE_REFERENCE_PREFIX.length);
|
|
531901
532003
|
const resolvedResponse = this.document.components.responses[parameterKey];
|
|
531902
532004
|
if (resolvedResponse == null) {
|
|
531903
|
-
throw new
|
|
532005
|
+
throw new CliError({ message: `${response.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531904
532006
|
}
|
|
531905
532007
|
if (isReferenceObject(resolvedResponse)) {
|
|
531906
532008
|
return this.resolveResponseReference(resolvedResponse);
|
|
@@ -531909,12 +532011,12 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531909
532011
|
}
|
|
531910
532012
|
resolveExampleReference(example) {
|
|
531911
532013
|
if (this.document.components == null || this.document.components.examples == null || !example.$ref.startsWith(EXAMPLES_REFERENCE_PREFIX)) {
|
|
531912
|
-
throw new
|
|
532014
|
+
throw new CliError({ message: `Failed to resolve ${example.$ref}`, code: CliError.Code.ReferenceError });
|
|
531913
532015
|
}
|
|
531914
532016
|
const parameterKey = example.$ref.substring(EXAMPLES_REFERENCE_PREFIX.length);
|
|
531915
532017
|
const resolvedExample = this.document.components.examples[parameterKey];
|
|
531916
532018
|
if (resolvedExample == null) {
|
|
531917
|
-
throw new
|
|
532019
|
+
throw new CliError({ message: `${example.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531918
532020
|
}
|
|
531919
532021
|
if (isReferenceObject(resolvedExample)) {
|
|
531920
532022
|
return this.resolveExampleReference(resolvedExample);
|
|
@@ -531923,12 +532025,15 @@ var AbstractOpenAPIV3ParserContext = class {
|
|
|
531923
532025
|
}
|
|
531924
532026
|
resolveSecuritySchemeReference(securityScheme) {
|
|
531925
532027
|
if (this.document.components == null || this.document.components.securitySchemes == null || !securityScheme.$ref.startsWith(SECURITY_SCHEME_REFERENCE_PREFIX)) {
|
|
531926
|
-
throw new
|
|
532028
|
+
throw new CliError({
|
|
532029
|
+
message: `Failed to resolve ${securityScheme.$ref}`,
|
|
532030
|
+
code: CliError.Code.ReferenceError
|
|
532031
|
+
});
|
|
531927
532032
|
}
|
|
531928
532033
|
const securitySchemeKey = securityScheme.$ref.substring(SECURITY_SCHEME_REFERENCE_PREFIX.length);
|
|
531929
532034
|
const resolvedSecurityScheme = this.document.components.securitySchemes[securitySchemeKey];
|
|
531930
532035
|
if (resolvedSecurityScheme == null) {
|
|
531931
|
-
throw new
|
|
532036
|
+
throw new CliError({ message: `${securityScheme.$ref} is undefined`, code: CliError.Code.ReferenceError });
|
|
531932
532037
|
}
|
|
531933
532038
|
if (isReferenceObject(resolvedSecurityScheme)) {
|
|
531934
532039
|
return this.resolveSecuritySchemeReference(resolvedSecurityScheme);
|
|
@@ -532688,15 +532793,24 @@ function getMultipartPartEncodingFromContentType(contentType) {
|
|
|
532688
532793
|
}
|
|
532689
532794
|
function resolveSchema(schema2, document4) {
|
|
532690
532795
|
if (!schema2.$ref.startsWith(SCHEMA_REFERENCE_PREFIX)) {
|
|
532691
|
-
throw new
|
|
532796
|
+
throw new CliError({
|
|
532797
|
+
message: `Failed to resolve schema reference because of unsupported prefix: ${schema2.$ref}`,
|
|
532798
|
+
code: CliError.Code.ReferenceError
|
|
532799
|
+
});
|
|
532692
532800
|
}
|
|
532693
532801
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
532694
532802
|
if (schemaId == null) {
|
|
532695
|
-
throw new
|
|
532803
|
+
throw new CliError({
|
|
532804
|
+
message: `Failed to resolve schema reference because missing schema id: ${schema2.$ref}`,
|
|
532805
|
+
code: CliError.Code.ReferenceError
|
|
532806
|
+
});
|
|
532696
532807
|
}
|
|
532697
532808
|
const resolvedSchema = document4.components?.schemas?.[schemaId];
|
|
532698
532809
|
if (resolvedSchema == null) {
|
|
532699
|
-
throw new
|
|
532810
|
+
throw new CliError({
|
|
532811
|
+
message: `Failed to resolve schema reference because missing: ${schema2.$ref}`,
|
|
532812
|
+
code: CliError.Code.ReferenceError
|
|
532813
|
+
});
|
|
532700
532814
|
}
|
|
532701
532815
|
if (isReferenceObject(resolvedSchema)) {
|
|
532702
532816
|
return resolveSchema(resolvedSchema, document4);
|
|
@@ -534193,7 +534307,10 @@ function getBasicSecuritySchemeNameAndEnvvar(securityScheme) {
|
|
|
534193
534307
|
function convertSecurityScheme(securityScheme, source2, taskContext, context3) {
|
|
534194
534308
|
if (isReferenceObject(securityScheme)) {
|
|
534195
534309
|
if (context3 == null) {
|
|
534196
|
-
throw new
|
|
534310
|
+
throw new CliError({
|
|
534311
|
+
message: `Converting referenced security schemes requires context: ${JSON.stringify(securityScheme)}`,
|
|
534312
|
+
code: CliError.Code.InternalError
|
|
534313
|
+
});
|
|
534197
534314
|
}
|
|
534198
534315
|
const resolvedSecurityScheme = context3.resolveSecuritySchemeReference(securityScheme);
|
|
534199
534316
|
return convertSecuritySchemeHelper(resolvedSecurityScheme, source2, taskContext);
|
|
@@ -534374,7 +534491,10 @@ function getVariableDefinitions(document4, preserveSchemaIds) {
|
|
|
534374
534491
|
}
|
|
534375
534492
|
];
|
|
534376
534493
|
} else {
|
|
534377
|
-
throw new
|
|
534494
|
+
throw new CliError({
|
|
534495
|
+
message: `Variable ${variableName} has unsupported schema ${JSON.stringify(schema2)}`,
|
|
534496
|
+
code: CliError.Code.ValidationError
|
|
534497
|
+
});
|
|
534378
534498
|
}
|
|
534379
534499
|
}));
|
|
534380
534500
|
}
|
|
@@ -535690,7 +535810,7 @@ async function validateSchema({ schema: schema2, value: value2, context: context
|
|
|
535690
535810
|
});
|
|
535691
535811
|
});
|
|
535692
535812
|
const errorMessage = [`Failed to parse file: ${import_path20.default.relative(process.cwd(), filepathBeingParsed)}`, ...issues].join("\n");
|
|
535693
|
-
return context3.failAndThrow(errorMessage);
|
|
535813
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
535694
535814
|
}
|
|
535695
535815
|
function joinZodPath(arr) {
|
|
535696
535816
|
return arr.reduce((acc, value2) => {
|
|
@@ -535723,7 +535843,9 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535723
535843
|
path: versionOrPath
|
|
535724
535844
|
};
|
|
535725
535845
|
} else {
|
|
535726
|
-
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}
|
|
535846
|
+
context3.failWithoutThrowing(`Path to ${coordinate} dependency does not exist: ${pathToApi}`, void 0, {
|
|
535847
|
+
code: CliError.Code.ConfigError
|
|
535848
|
+
});
|
|
535727
535849
|
}
|
|
535728
535850
|
} else {
|
|
535729
535851
|
const unprefixedCoordinate = coordinate.substring(1);
|
|
@@ -535738,12 +535860,14 @@ async function convertDependenciesConfiguration({ absolutePathToWorkspace, rawDe
|
|
|
535738
535860
|
version: versionOrPath
|
|
535739
535861
|
};
|
|
535740
535862
|
} else {
|
|
535741
|
-
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}
|
|
535863
|
+
context3.failWithoutThrowing(`Failed to parse dependency: ${coordinate}`, void 0, {
|
|
535864
|
+
code: CliError.Code.ConfigError
|
|
535865
|
+
});
|
|
535742
535866
|
}
|
|
535743
535867
|
}
|
|
535744
535868
|
}
|
|
535745
535869
|
if (context3.getResult() === TaskResult.Failure) {
|
|
535746
|
-
context3.failAndThrow();
|
|
535870
|
+
context3.failAndThrow(void 0, void 0, { code: CliError.Code.ConfigError });
|
|
535747
535871
|
}
|
|
535748
535872
|
return {
|
|
535749
535873
|
dependencies
|
|
@@ -535899,7 +536023,7 @@ function getColorInstanceFromRawConfigOrThrow(raw, context3, key2, theme) {
|
|
|
535899
536023
|
}
|
|
535900
536024
|
const instance = tinycolor(color3);
|
|
535901
536025
|
if (!instance.isValid()) {
|
|
535902
|
-
context3.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF
|
|
536026
|
+
context3.failAndThrow(`'${typeof raw === "string" ? key2 : `colors.${key2}.${theme}`}' should be a hex color of the format #FFFFFF`, void 0, { code: CliError.Code.ConfigError });
|
|
535903
536027
|
}
|
|
535904
536028
|
return instance;
|
|
535905
536029
|
}
|
|
@@ -536513,7 +536637,7 @@ async function parseContext7File({ rawPath, absoluteFilepathToDocsConfig, contex
|
|
|
536513
536637
|
try {
|
|
536514
536638
|
JSON.parse(contents);
|
|
536515
536639
|
} catch (error50) {
|
|
536516
|
-
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50));
|
|
536640
|
+
context3.failAndThrow(`Invalid JSON in Context7 config file: ${rawPath}`, error50 instanceof Error ? error50.message : String(error50), { code: CliError.Code.ConfigError });
|
|
536517
536641
|
}
|
|
536518
536642
|
return absolutePath;
|
|
536519
536643
|
}
|
|
@@ -536673,7 +536797,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536673
536797
|
featureFlags: convertFeatureFlag(product.featureFlag)
|
|
536674
536798
|
});
|
|
536675
536799
|
} else {
|
|
536676
|
-
throw new
|
|
536800
|
+
throw new CliError({
|
|
536801
|
+
message: `Invalid product configuration: product must have either 'path' or valid 'href' property`,
|
|
536802
|
+
code: CliError.Code.ConfigError
|
|
536803
|
+
});
|
|
536677
536804
|
}
|
|
536678
536805
|
}
|
|
536679
536806
|
return {
|
|
@@ -536688,7 +536815,10 @@ async function getNavigationConfiguration({ tabs, products, versions, navigation
|
|
|
536688
536815
|
folderTitleSource
|
|
536689
536816
|
});
|
|
536690
536817
|
}
|
|
536691
|
-
throw new
|
|
536818
|
+
throw new CliError({
|
|
536819
|
+
message: "Unexpected. Docs have neither navigation or versions defined.",
|
|
536820
|
+
code: CliError.Code.ConfigError
|
|
536821
|
+
});
|
|
536692
536822
|
}
|
|
536693
536823
|
function convertFeatureFlag(flag) {
|
|
536694
536824
|
if (flag == null) {
|
|
@@ -536786,7 +536916,10 @@ function parseWeight(weight) {
|
|
|
536786
536916
|
async function convertNavigationTabConfiguration({ tabs, item, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536787
536917
|
const tab2 = tabs[item.tab];
|
|
536788
536918
|
if (tab2 == null) {
|
|
536789
|
-
throw new
|
|
536919
|
+
throw new CliError({
|
|
536920
|
+
message: `Tab ${item.tab} is not defined in the tabs config.`,
|
|
536921
|
+
code: CliError.Code.ConfigError
|
|
536922
|
+
});
|
|
536790
536923
|
}
|
|
536791
536924
|
if (tabbedNavigationItemHasVariants(item)) {
|
|
536792
536925
|
const variants = await Promise.all(item.variants.map(async (variant) => {
|
|
@@ -536915,7 +537048,9 @@ var DEFAULT_CHANGELOG_TITLE = "Changelog";
|
|
|
536915
537048
|
async function expandFolderConfiguration({ rawConfig, absolutePathToFernFolder, absolutePathToConfig, context: context3, folderTitleSource }) {
|
|
536916
537049
|
const folderPath = resolveFilepath(rawConfig.folder, absolutePathToConfig);
|
|
536917
537050
|
if (!await doesPathExist(folderPath)) {
|
|
536918
|
-
context3.failAndThrow(`Folder not found: ${rawConfig.folder}
|
|
537051
|
+
context3.failAndThrow(`Folder not found: ${rawConfig.folder}`, void 0, {
|
|
537052
|
+
code: CliError.Code.ConfigError
|
|
537053
|
+
});
|
|
536919
537054
|
}
|
|
536920
537055
|
validateCollapsibleConfig({
|
|
536921
537056
|
context: context3,
|
|
@@ -537238,7 +537373,10 @@ function parseLibrariesConfiguration(libraries) {
|
|
|
537238
537373
|
const result = {};
|
|
537239
537374
|
for (const [name2, config5] of Object.entries(libraries)) {
|
|
537240
537375
|
if (!isGitLibraryInput(config5.input)) {
|
|
537241
|
-
throw new
|
|
537376
|
+
throw new CliError({
|
|
537377
|
+
message: `Library '${name2}' uses 'path' input which is not yet supported. Please use 'git' input.`,
|
|
537378
|
+
code: CliError.Code.ConfigError
|
|
537379
|
+
});
|
|
537242
537380
|
}
|
|
537243
537381
|
result[name2] = {
|
|
537244
537382
|
input: {
|
|
@@ -537427,10 +537565,10 @@ function parseAudiences(raw) {
|
|
|
537427
537565
|
}
|
|
537428
537566
|
function validateCollapsibleConfig({ context: context3, sectionTitle, collapsed, collapsible, collapsedByDefault }) {
|
|
537429
537567
|
if (collapsible != null && collapsed != null) {
|
|
537430
|
-
context3.failAndThrow(`Section "${sectionTitle}": cannot use both "collapsible" and the deprecated "collapsed" property. Please use "collapsible" and "collapsed-by-default" instead
|
|
537568
|
+
context3.failAndThrow(`Section "${sectionTitle}": cannot use both "collapsible" and the deprecated "collapsed" property. Please use "collapsible" and "collapsed-by-default" instead.`, void 0, { code: CliError.Code.ConfigError });
|
|
537431
537569
|
}
|
|
537432
537570
|
if (collapsedByDefault != null && collapsible !== true) {
|
|
537433
|
-
context3.failAndThrow(`Section "${sectionTitle}": "collapsed-by-default" requires "collapsible: true". "collapsed-by-default" has no effect on a non-collapsible section
|
|
537571
|
+
context3.failAndThrow(`Section "${sectionTitle}": "collapsed-by-default" requires "collapsible: true". "collapsed-by-default" has no effect on a non-collapsible section.`, void 0, { code: CliError.Code.ConfigError });
|
|
537434
537572
|
}
|
|
537435
537573
|
}
|
|
537436
537574
|
|
|
@@ -537705,7 +537843,9 @@ function removeDefaultDockerOrgIfPresent(generatorName) {
|
|
|
537705
537843
|
function getGeneratorNameOrThrow(generatorName, context3) {
|
|
537706
537844
|
const normalizedGeneratorName = normalizeGeneratorName(generatorName);
|
|
537707
537845
|
if (normalizedGeneratorName == null) {
|
|
537708
|
-
return context3.failAndThrow("Unrecognized generator: " + generatorName
|
|
537846
|
+
return context3.failAndThrow("Unrecognized generator: " + generatorName, void 0, {
|
|
537847
|
+
code: CliError.Code.ConfigError
|
|
537848
|
+
});
|
|
537709
537849
|
}
|
|
537710
537850
|
return normalizedGeneratorName;
|
|
537711
537851
|
}
|
|
@@ -537832,9 +537972,9 @@ async function updateGeneratorGroup({ generatorsConfiguration, groupName = gener
|
|
|
537832
537972
|
const availableGroups = Object.keys(generatorsConfiguration.groups ?? {});
|
|
537833
537973
|
if (availableGroups.length > 0) {
|
|
537834
537974
|
const message = "No group specified. Use the --group option:\n" + availableGroups.map((name2) => ` \u203A ${name2}`).join("\n");
|
|
537835
|
-
return context3.failAndThrow(message);
|
|
537975
|
+
return context3.failAndThrow(message, void 0, { code: CliError.Code.ConfigError });
|
|
537836
537976
|
}
|
|
537837
|
-
return context3.failAndThrow("No group specified.");
|
|
537977
|
+
return context3.failAndThrow("No group specified.", void 0, { code: CliError.Code.ConfigError });
|
|
537838
537978
|
}
|
|
537839
537979
|
const groups2 = generatorsConfiguration.groups ??= {};
|
|
537840
537980
|
const group = groups2[groupName];
|
|
@@ -537858,7 +537998,9 @@ async function addGenerator({ generatorName, generatorsConfiguration, groupName
|
|
|
537858
537998
|
context: context3,
|
|
537859
537999
|
update: async (group) => {
|
|
537860
538000
|
if (group.generators.some((generator) => addDefaultDockerOrgIfNotPresent("image" in generator ? generator.image.name : generator.name) === normalizedGeneratorName)) {
|
|
537861
|
-
context3.failAndThrow(`${generatorName} is already installed in group ${groupName}
|
|
538001
|
+
context3.failAndThrow(`${generatorName} is already installed in group ${groupName}.`, void 0, {
|
|
538002
|
+
code: CliError.Code.ConfigError
|
|
538003
|
+
});
|
|
537862
538004
|
}
|
|
537863
538005
|
const latestVersion2 = await getLatestGeneratorVersion({
|
|
537864
538006
|
cliVersion,
|
|
@@ -544421,7 +544563,10 @@ function parseRemoveDiscriminantsFromSchemas(option) {
|
|
|
544421
544563
|
} else if (option === "never") {
|
|
544422
544564
|
return generators_yml_exports.RemoveDiscriminantsFromSchemas.Never;
|
|
544423
544565
|
}
|
|
544424
|
-
throw new
|
|
544566
|
+
throw new CliError({
|
|
544567
|
+
message: `Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${option}`,
|
|
544568
|
+
code: CliError.Code.ConfigError
|
|
544569
|
+
});
|
|
544425
544570
|
}
|
|
544426
544571
|
function mergeSettings(base4, override) {
|
|
544427
544572
|
return {
|
|
@@ -544988,7 +545133,10 @@ async function getGithubLicense({ absolutePathToGeneratorsConfiguration, githubL
|
|
|
544988
545133
|
function getGithubPublishInfo(output2, maybeGroupLevelMetadata, maybeTopLevelMetadata) {
|
|
544989
545134
|
switch (output2.location) {
|
|
544990
545135
|
case "local-file-system":
|
|
544991
|
-
throw new
|
|
545136
|
+
throw new CliError({
|
|
545137
|
+
message: "Cannot use local-file-system with github publishing",
|
|
545138
|
+
code: CliError.Code.ConfigError
|
|
545139
|
+
});
|
|
544992
545140
|
case "npm":
|
|
544993
545141
|
return api_exports4.GithubPublishInfo.npm({
|
|
544994
545142
|
registryUrl: output2.url ?? "https://registry.npmjs.org",
|
|
@@ -545181,7 +545329,10 @@ async function loadRawGeneratorsConfiguration({ absolutePathToWorkspace, context
|
|
|
545181
545329
|
if (parsed.ok) {
|
|
545182
545330
|
return parsed.value;
|
|
545183
545331
|
}
|
|
545184
|
-
throw new
|
|
545332
|
+
throw new CliError({
|
|
545333
|
+
message: parsed.errors.map((e5) => e5.message).join("\n"),
|
|
545334
|
+
code: CliError.Code.ConfigError
|
|
545335
|
+
});
|
|
545185
545336
|
} catch (e5) {
|
|
545186
545337
|
if (e5 instanceof jsYaml.YAMLException) {
|
|
545187
545338
|
const relativePath = import_path24.default.relative(process.cwd(), filepath);
|
|
@@ -545203,7 +545354,7 @@ ${e5.mark.snippet}`;
|
|
|
545203
545354
|
errorMessage += '\n\nHint: Values starting with "@" (such as scoped npm packages) must be wrapped in quotes.\n Example: package-name: "@scope/package"';
|
|
545204
545355
|
}
|
|
545205
545356
|
}
|
|
545206
|
-
context3.failAndThrow(errorMessage);
|
|
545357
|
+
context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.ConfigError });
|
|
545207
545358
|
} else {
|
|
545208
545359
|
throw e5;
|
|
545209
545360
|
}
|
|
@@ -551687,7 +551838,7 @@ function parseTypeName({ typeName, file: file4 }) {
|
|
|
551687
551838
|
imports: file4.imports
|
|
551688
551839
|
});
|
|
551689
551840
|
if (reference4 == null) {
|
|
551690
|
-
throw new
|
|
551841
|
+
throw new CliError({ message: "Failed to locate type: " + typeName, code: CliError.Code.ResolutionError });
|
|
551691
551842
|
}
|
|
551692
551843
|
const nameWithoutId = {
|
|
551693
551844
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -551897,7 +552048,7 @@ function convertHttpRequestBody({ request: request7, file: file4 }) {
|
|
|
551897
552048
|
}
|
|
551898
552049
|
if (isInlineRequestBody(request7.body)) {
|
|
551899
552050
|
if (request7.name == null) {
|
|
551900
|
-
throw new
|
|
552051
|
+
throw new CliError({ message: "Name is missing for inlined request", code: CliError.Code.InternalError });
|
|
551901
552052
|
}
|
|
551902
552053
|
return HttpRequestBody.inlinedRequestBody({
|
|
551903
552054
|
name: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -551987,13 +552138,19 @@ function getObjectPropertyFromResolvedType({ typeResolver, file: file4, resolved
|
|
|
551987
552138
|
default:
|
|
551988
552139
|
assertNever(resolvedType);
|
|
551989
552140
|
}
|
|
551990
|
-
throw new
|
|
552141
|
+
throw new CliError({
|
|
552142
|
+
message: "Internal error; response must be an object in order to return a property as a response",
|
|
552143
|
+
code: CliError.Code.InternalError
|
|
552144
|
+
});
|
|
551991
552145
|
}
|
|
551992
552146
|
function getObjectPropertyFromObjectSchema({ typeResolver, file: file4, objectSchema, property: property24 }) {
|
|
551993
552147
|
const properties7 = getAllPropertiesForRawObjectSchema(objectSchema, file4, typeResolver);
|
|
551994
552148
|
const objectProperty = properties7[property24];
|
|
551995
552149
|
if (objectProperty == null) {
|
|
551996
|
-
throw new
|
|
552150
|
+
throw new CliError({
|
|
552151
|
+
message: `Object does not have a property named ${property24}.`,
|
|
552152
|
+
code: CliError.Code.ReferenceError
|
|
552153
|
+
});
|
|
551997
552154
|
}
|
|
551998
552155
|
return objectProperty;
|
|
551999
552156
|
}
|
|
@@ -552026,7 +552183,10 @@ function getAllPropertiesForExtendedType(extendedType, file4, typeResolver) {
|
|
|
552026
552183
|
if (resolvedType._type === "named" && isRawObjectDefinition(resolvedType.declaration)) {
|
|
552027
552184
|
return getAllPropertiesForRawObjectSchema(resolvedType.declaration, file4, typeResolver);
|
|
552028
552185
|
}
|
|
552029
|
-
throw new
|
|
552186
|
+
throw new CliError({
|
|
552187
|
+
message: `Extended type ${extendedType} must be another named type`,
|
|
552188
|
+
code: CliError.Code.InternalError
|
|
552189
|
+
});
|
|
552030
552190
|
}
|
|
552031
552191
|
|
|
552032
552192
|
// ../generation/ir-generator/lib/converters/services/convertProperty.js
|
|
@@ -552090,7 +552250,10 @@ function getPropertyTypeFromObjectSchema({ typeResolver, file: file4, objectSche
|
|
|
552090
552250
|
});
|
|
552091
552251
|
const propertyType = properties7[property24];
|
|
552092
552252
|
if (propertyType == null) {
|
|
552093
|
-
throw new
|
|
552253
|
+
throw new CliError({
|
|
552254
|
+
message: `Response does not have a property named ${property24}.`,
|
|
552255
|
+
code: CliError.Code.ReferenceError
|
|
552256
|
+
});
|
|
552094
552257
|
}
|
|
552095
552258
|
return propertyType;
|
|
552096
552259
|
}
|
|
@@ -552131,7 +552294,10 @@ function getAllPropertiesForExtendedType2({ typeResolver, file: file4, extendedT
|
|
|
552131
552294
|
objectSchema: resolvedType.declaration
|
|
552132
552295
|
});
|
|
552133
552296
|
}
|
|
552134
|
-
throw new
|
|
552297
|
+
throw new CliError({
|
|
552298
|
+
message: `Extended type ${extendedType} must be another named type.`,
|
|
552299
|
+
code: CliError.Code.InternalError
|
|
552300
|
+
});
|
|
552135
552301
|
}
|
|
552136
552302
|
function maybeFileFromResolvedType(resolvedType) {
|
|
552137
552303
|
if (resolvedType == null) {
|
|
@@ -552187,7 +552353,7 @@ function convertHttpSdkRequest({ request: request7, endpointKey, endpoint: endpo
|
|
|
552187
552353
|
function convertHttpSdkRequestShape({ service, request: request7, file: file4, typeResolver }) {
|
|
552188
552354
|
const constructWrapper = () => {
|
|
552189
552355
|
if (typeof request7 === "string" || request7?.name == null) {
|
|
552190
|
-
throw new
|
|
552356
|
+
throw new CliError({ message: "Name is missing for request wrapper", code: CliError.Code.InternalError });
|
|
552191
552357
|
}
|
|
552192
552358
|
return SdkRequestShape.wrapper({
|
|
552193
552359
|
wrapperName: file4.casingsGenerator.generateName(request7.name),
|
|
@@ -552367,7 +552533,7 @@ function parseErrorName({ errorName, file: file4 }) {
|
|
|
552367
552533
|
imports: file4.imports
|
|
552368
552534
|
});
|
|
552369
552535
|
if (reference4 == null) {
|
|
552370
|
-
throw new
|
|
552536
|
+
throw new CliError({ message: "Failed to locate error " + errorName, code: CliError.Code.ResolutionError });
|
|
552371
552537
|
}
|
|
552372
552538
|
const nameWithoutId = {
|
|
552373
552539
|
name: file4.casingsGenerator.generateName(reference4.typeName),
|
|
@@ -552837,7 +553003,10 @@ function validateObjectExample({ typeName, typeNameForBreadcrumb, rawObject, fil
|
|
|
552837
553003
|
} else {
|
|
552838
553004
|
const definitionFile = getDefinitionFile(workspace, propertyWithPath.filepathOfDeclaration);
|
|
552839
553005
|
if (definitionFile == null) {
|
|
552840
|
-
throw new
|
|
553006
|
+
throw new CliError({
|
|
553007
|
+
message: "Service file does not exist for property: " + propertyWithPath.wireKey,
|
|
553008
|
+
code: CliError.Code.InternalError
|
|
553009
|
+
});
|
|
552841
553010
|
}
|
|
552842
553011
|
violations.push(...validateTypeReferenceExample({
|
|
552843
553012
|
rawTypeReference: propertyWithPath.propertyType,
|
|
@@ -553312,7 +553481,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553312
553481
|
base64: () => validateString(example),
|
|
553313
553482
|
bigInteger: () => validateString(example),
|
|
553314
553483
|
_other: () => {
|
|
553315
|
-
throw new
|
|
553484
|
+
throw new CliError({
|
|
553485
|
+
message: "Unknown primitive type v2: " + primitiveType2.v2,
|
|
553486
|
+
code: CliError.Code.InternalError
|
|
553487
|
+
});
|
|
553316
553488
|
}
|
|
553317
553489
|
});
|
|
553318
553490
|
}
|
|
@@ -553332,7 +553504,10 @@ function validatePrimitiveExample({ primitiveType: primitiveType2, example }) {
|
|
|
553332
553504
|
base64: () => validateString(example),
|
|
553333
553505
|
bigInteger: () => validateString(example),
|
|
553334
553506
|
_other: () => {
|
|
553335
|
-
throw new
|
|
553507
|
+
throw new CliError({
|
|
553508
|
+
message: "Unknown primitive type: " + primitiveType2.v1,
|
|
553509
|
+
code: CliError.Code.InternalError
|
|
553510
|
+
});
|
|
553336
553511
|
}
|
|
553337
553512
|
});
|
|
553338
553513
|
}
|
|
@@ -553555,7 +553730,10 @@ function convertEnumTypeDeclaration({ _enum: _enum3, file: file4 }) {
|
|
|
553555
553730
|
if (_enum3.default != null) {
|
|
553556
553731
|
defaultValue = values2.find((enumValue) => getWireValue(enumValue.name) === _enum3.default);
|
|
553557
553732
|
if (defaultValue == null) {
|
|
553558
|
-
throw new
|
|
553733
|
+
throw new CliError({
|
|
553734
|
+
message: `Default value ${_enum3.default} not found in enum values`,
|
|
553735
|
+
code: CliError.Code.ValidationError
|
|
553736
|
+
});
|
|
553559
553737
|
}
|
|
553560
553738
|
}
|
|
553561
553739
|
return {
|
|
@@ -553624,18 +553802,27 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553624
553802
|
discriminatedUnion: (rawUnion) => {
|
|
553625
553803
|
const discriminant21 = getUnionDiscriminant(rawUnion);
|
|
553626
553804
|
if (!isPlainObject4(example)) {
|
|
553627
|
-
throw new
|
|
553805
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553628
553806
|
}
|
|
553629
553807
|
const discriminantValueForExample = example[discriminant21];
|
|
553630
553808
|
if (discriminantValueForExample == null) {
|
|
553631
|
-
throw new
|
|
553809
|
+
throw new CliError({
|
|
553810
|
+
message: "Example is missing discriminant: " + discriminant21,
|
|
553811
|
+
code: CliError.Code.ValidationError
|
|
553812
|
+
});
|
|
553632
553813
|
}
|
|
553633
553814
|
if (typeof discriminantValueForExample !== "string") {
|
|
553634
|
-
throw new
|
|
553815
|
+
throw new CliError({
|
|
553816
|
+
message: "Discriminant value is not a string",
|
|
553817
|
+
code: CliError.Code.ValidationError
|
|
553818
|
+
});
|
|
553635
553819
|
}
|
|
553636
553820
|
const rawSingleUnionType = rawUnion.union[discriminantValueForExample];
|
|
553637
553821
|
if (rawSingleUnionType == null) {
|
|
553638
|
-
throw new
|
|
553822
|
+
throw new CliError({
|
|
553823
|
+
message: `${discriminantValueForExample} is not one of the specified discriminant values.`,
|
|
553824
|
+
code: CliError.Code.ValidationError
|
|
553825
|
+
});
|
|
553639
553826
|
}
|
|
553640
553827
|
const rawValueType = typeof rawSingleUnionType === "string" ? rawSingleUnionType : typeof rawSingleUnionType.type === "string" ? rawSingleUnionType.type : void 0;
|
|
553641
553828
|
const baseProperties = Object.entries(rawUnion["base-properties"] ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553666,7 +553853,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553666
553853
|
referenceToNamedType: extendedTypeName
|
|
553667
553854
|
});
|
|
553668
553855
|
if (resolvedExtendedType._type !== "named" || !isRawObjectDefinition(resolvedExtendedType.declaration)) {
|
|
553669
|
-
throw new
|
|
553856
|
+
throw new CliError({
|
|
553857
|
+
message: "Extended type is not a named object",
|
|
553858
|
+
code: CliError.Code.InternalError
|
|
553859
|
+
});
|
|
553670
553860
|
}
|
|
553671
553861
|
const extendedObject = resolvedExtendedType.declaration;
|
|
553672
553862
|
const propertiesFromExtension = Object.entries(extendedObject.properties ?? {}).map(([propertyName, property24]) => {
|
|
@@ -553719,7 +553909,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553719
553909
|
enum: (rawEnum) => {
|
|
553720
553910
|
if (typeof example !== "string") {
|
|
553721
553911
|
const validValues = rawEnum.enum.map((enumEntry) => typeof enumEntry === "string" ? enumEntry : enumEntry.value).join(", ");
|
|
553722
|
-
throw new
|
|
553912
|
+
throw new CliError({
|
|
553913
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553914
|
+
code: CliError.Code.ValidationError
|
|
553915
|
+
});
|
|
553723
553916
|
}
|
|
553724
553917
|
return ExampleTypeShape.enum({
|
|
553725
553918
|
value: fileContainingExample.casingsGenerator.generateNameAndWireValue({
|
|
@@ -553760,7 +553953,10 @@ function convertTypeExample({ typeName, typeDeclaration: typeDeclaration2, examp
|
|
|
553760
553953
|
return typeof variant === "string" ? variant : variant.type;
|
|
553761
553954
|
});
|
|
553762
553955
|
const validValues = variantOptions.join(", ");
|
|
553763
|
-
throw new
|
|
553956
|
+
throw new CliError({
|
|
553957
|
+
message: `Expected one of ${validValues}. Received ${example}`,
|
|
553958
|
+
code: CliError.Code.ValidationError
|
|
553959
|
+
});
|
|
553764
553960
|
}
|
|
553765
553961
|
});
|
|
553766
553962
|
}
|
|
@@ -553787,7 +553983,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553787
553983
|
},
|
|
553788
553984
|
map: ({ keyType, valueType }) => {
|
|
553789
553985
|
if (!isPlainObject4(resolvedExample)) {
|
|
553790
|
-
throw new
|
|
553986
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
553791
553987
|
}
|
|
553792
553988
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553793
553989
|
return ExampleTypeReferenceShape.container(ExampleContainer.map({
|
|
@@ -553819,7 +554015,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553819
554015
|
},
|
|
553820
554016
|
list: (itemType) => {
|
|
553821
554017
|
if (!Array.isArray(resolvedExample)) {
|
|
553822
|
-
throw new
|
|
554018
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553823
554019
|
}
|
|
553824
554020
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553825
554021
|
return ExampleTypeReferenceShape.container(ExampleContainer.list({
|
|
@@ -553838,7 +554034,7 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553838
554034
|
},
|
|
553839
554035
|
set: (itemType) => {
|
|
553840
554036
|
if (!Array.isArray(resolvedExample)) {
|
|
553841
|
-
throw new
|
|
554037
|
+
throw new CliError({ message: "Example is not a list", code: CliError.Code.ValidationError });
|
|
553842
554038
|
}
|
|
553843
554039
|
const nextContext = { depth: ctx.depth + 1, seenTypeIds: ctx.seenTypeIds };
|
|
553844
554040
|
return ExampleTypeReferenceShape.container(ExampleContainer.set({
|
|
@@ -553908,7 +554104,10 @@ function convertTypeReferenceExample({ example, fileContainingExample, rawTypeBe
|
|
|
553908
554104
|
});
|
|
553909
554105
|
const parsedReferenceToNamedType = fileContainingRawTypeReference.parseTypeReference(named);
|
|
553910
554106
|
if (parsedReferenceToNamedType.type !== "named") {
|
|
553911
|
-
throw new
|
|
554107
|
+
throw new CliError({
|
|
554108
|
+
message: "Type reference is not to a named type.",
|
|
554109
|
+
code: CliError.Code.InternalError
|
|
554110
|
+
});
|
|
553912
554111
|
}
|
|
553913
554112
|
const typeName = {
|
|
553914
554113
|
typeId: parsedReferenceToNamedType.typeId,
|
|
@@ -554066,13 +554265,19 @@ function convertPrimitiveExample({ example, typeBeingExemplified }) {
|
|
|
554066
554265
|
}));
|
|
554067
554266
|
},
|
|
554068
554267
|
_other: () => {
|
|
554069
|
-
throw new
|
|
554268
|
+
throw new CliError({
|
|
554269
|
+
message: "Unknown primitive type: " + typeBeingExemplified,
|
|
554270
|
+
code: CliError.Code.InternalError
|
|
554271
|
+
});
|
|
554070
554272
|
}
|
|
554071
554273
|
});
|
|
554072
554274
|
}
|
|
554073
554275
|
function convertObject4({ typeName, rawObject, example, fileContainingType, fileContainingExample, typeResolver, exampleResolver, workspace, recursionContext }) {
|
|
554074
554276
|
if (!isPlainObject4(example)) {
|
|
554075
|
-
throw new
|
|
554277
|
+
throw new CliError({
|
|
554278
|
+
message: `Example is not an object. Got: ${JSON.stringify(example)}`,
|
|
554279
|
+
code: CliError.Code.ValidationError
|
|
554280
|
+
});
|
|
554076
554281
|
}
|
|
554077
554282
|
const properties7 = Object.entries(example).map(([wireKey, propertyExample]) => {
|
|
554078
554283
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
@@ -554147,7 +554352,10 @@ function getOriginalTypeDeclarationForPropertyFromExtensions({ wirePropertyKey,
|
|
|
554147
554352
|
file: file4
|
|
554148
554353
|
});
|
|
554149
554354
|
if (resolvedType._type !== "named" || !isRawObjectDefinition(resolvedType.declaration)) {
|
|
554150
|
-
throw new
|
|
554355
|
+
throw new CliError({
|
|
554356
|
+
message: "Extension is not of a named object",
|
|
554357
|
+
code: CliError.Code.InternalError
|
|
554358
|
+
});
|
|
554151
554359
|
}
|
|
554152
554360
|
const originalTypeDeclaration = getOriginalTypeDeclarationForProperty({
|
|
554153
554361
|
wirePropertyKey,
|
|
@@ -554184,7 +554392,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554184
554392
|
switch (parsedSingleUnionTypeProperties.propertiesType) {
|
|
554185
554393
|
case "singleProperty": {
|
|
554186
554394
|
if (!isPlainObject4(example)) {
|
|
554187
|
-
throw new
|
|
554395
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554188
554396
|
}
|
|
554189
554397
|
return {
|
|
554190
554398
|
wireDiscriminantValue,
|
|
@@ -554202,7 +554410,7 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554202
554410
|
}
|
|
554203
554411
|
case "samePropertiesAsObject": {
|
|
554204
554412
|
if (!isPlainObject4(example)) {
|
|
554205
|
-
throw new
|
|
554413
|
+
throw new CliError({ message: "Example is not an object", code: CliError.Code.ValidationError });
|
|
554206
554414
|
}
|
|
554207
554415
|
let rawDeclaration = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
554208
554416
|
referenceToNamedType: rawValueType,
|
|
@@ -554215,7 +554423,10 @@ function convertSingleUnionType({ rawValueType, rawSingleUnionType, fileContaini
|
|
|
554215
554423
|
});
|
|
554216
554424
|
}
|
|
554217
554425
|
if (!isRawObjectDefinition(rawDeclaration.declaration)) {
|
|
554218
|
-
throw new
|
|
554426
|
+
throw new CliError({
|
|
554427
|
+
message: `${rawValueType} is not an object`,
|
|
554428
|
+
code: CliError.Code.ValidationError
|
|
554429
|
+
});
|
|
554219
554430
|
}
|
|
554220
554431
|
const typeName = {
|
|
554221
554432
|
typeId: parsedSingleUnionTypeProperties.typeId,
|
|
@@ -554298,7 +554509,10 @@ function convertExampleEndpointCall2({ service, endpoint: endpoint3, example, ty
|
|
|
554298
554509
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
554299
554510
|
const queryParameterDeclaration = typeof endpoint3.request !== "string" ? endpoint3.request?.["query-parameters"]?.[wireKey] : void 0;
|
|
554300
554511
|
if (queryParameterDeclaration == null) {
|
|
554301
|
-
throw new
|
|
554512
|
+
throw new CliError({
|
|
554513
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
554514
|
+
code: CliError.Code.ReferenceError
|
|
554515
|
+
});
|
|
554302
554516
|
}
|
|
554303
554517
|
const isAllowMultiple = typeof queryParameterDeclaration !== "string" && queryParameterDeclaration["allow-multiple"] === true;
|
|
554304
554518
|
const rawType = typeof queryParameterDeclaration === "string" ? queryParameterDeclaration : queryParameterDeclaration.type;
|
|
@@ -554407,7 +554621,10 @@ function convertPathParameters({ service, endpoint: endpoint3, example, typeReso
|
|
|
554407
554621
|
examplePathParameter
|
|
554408
554622
|
}));
|
|
554409
554623
|
} else {
|
|
554410
|
-
throw new
|
|
554624
|
+
throw new CliError({
|
|
554625
|
+
message: `Path parameter ${key2} does not exist`,
|
|
554626
|
+
code: CliError.Code.ReferenceError
|
|
554627
|
+
});
|
|
554411
554628
|
}
|
|
554412
554629
|
}
|
|
554413
554630
|
}
|
|
@@ -554487,7 +554704,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554487
554704
|
return void 0;
|
|
554488
554705
|
}
|
|
554489
554706
|
if (!isPlainObject4(example.request)) {
|
|
554490
|
-
throw new
|
|
554707
|
+
throw new CliError({
|
|
554708
|
+
message: `Example is not an object. Got: ${JSON.stringify(example.request)}`,
|
|
554709
|
+
code: CliError.Code.ValidationError
|
|
554710
|
+
});
|
|
554491
554711
|
}
|
|
554492
554712
|
const exampleProperties = [];
|
|
554493
554713
|
const exampleExtraProperties = [];
|
|
@@ -554537,7 +554757,10 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
554537
554757
|
});
|
|
554538
554758
|
continue;
|
|
554539
554759
|
}
|
|
554540
|
-
throw new
|
|
554760
|
+
throw new CliError({
|
|
554761
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
554762
|
+
code: CliError.Code.ResolutionError
|
|
554763
|
+
});
|
|
554541
554764
|
}
|
|
554542
554765
|
exampleProperties.push({
|
|
554543
554766
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -554922,7 +555145,7 @@ function getPaginationPropertyComponents(endpointPagination) {
|
|
|
554922
555145
|
results: getResponsePropertyComponents(endpointPagination.results)
|
|
554923
555146
|
};
|
|
554924
555147
|
}
|
|
554925
|
-
throw new
|
|
555148
|
+
throw new CliError({ message: "Invalid pagination schema", code: CliError.Code.ValidationError });
|
|
554926
555149
|
}
|
|
554927
555150
|
function isRawCursorPaginationSchema(rawPaginationSchema) {
|
|
554928
555151
|
return rawPaginationSchema.cursor != null;
|
|
@@ -555093,7 +555316,10 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555093
555316
|
return void 0;
|
|
555094
555317
|
}
|
|
555095
555318
|
if (isHttpService && isGrpcEndpoint) {
|
|
555096
|
-
throw new
|
|
555319
|
+
throw new CliError({
|
|
555320
|
+
message: "Cannot have a grpc endpoint on an http service",
|
|
555321
|
+
code: CliError.Code.ValidationError
|
|
555322
|
+
});
|
|
555097
555323
|
}
|
|
555098
555324
|
if (isGrpcService && isHttpEndpoint) {
|
|
555099
555325
|
return Transport.http();
|
|
@@ -555107,8 +555333,11 @@ function getTransportForEndpoint({ file: file4, serviceTransport, endpointDeclar
|
|
|
555107
555333
|
return createProtobufService(file4, protoSource, sourceResolver, serviceNameOverride);
|
|
555108
555334
|
}
|
|
555109
555335
|
}
|
|
555110
|
-
throw new
|
|
555111
|
-
|
|
555336
|
+
throw new CliError({
|
|
555337
|
+
message: `Internal error; failed to determine endpoint transport for
|
|
555338
|
+
${JSON.stringify(endpointDeclaration)}"`,
|
|
555339
|
+
code: CliError.Code.InternalError
|
|
555340
|
+
});
|
|
555112
555341
|
}
|
|
555113
555342
|
function createProtobufService(file4, source2, sourceResolver, serviceNameOverride) {
|
|
555114
555343
|
const resolvedSource = sourceResolver.resolveSourceOrThrow({
|
|
@@ -555116,14 +555345,20 @@ function createProtobufService(file4, source2, sourceResolver, serviceNameOverri
|
|
|
555116
555345
|
relativeFilepath: file4.relativeFilepath
|
|
555117
555346
|
});
|
|
555118
555347
|
if (resolvedSource == null || resolvedSource.type !== "protobuf") {
|
|
555119
|
-
throw new
|
|
555348
|
+
throw new CliError({
|
|
555349
|
+
message: `Expected a protobuf source for ${source2.proto}.`,
|
|
555350
|
+
code: CliError.Code.ResolutionError
|
|
555351
|
+
});
|
|
555120
555352
|
}
|
|
555121
555353
|
const protobufService = convertProtobufService({
|
|
555122
555354
|
source: resolvedSource,
|
|
555123
555355
|
serviceNameOverride
|
|
555124
555356
|
});
|
|
555125
555357
|
if (protobufService == null) {
|
|
555126
|
-
throw new
|
|
555358
|
+
throw new CliError({
|
|
555359
|
+
message: `Failed to resolve service name from ${resolvedSource.relativeFilePath}.`,
|
|
555360
|
+
code: CliError.Code.IrConversionError
|
|
555361
|
+
});
|
|
555127
555362
|
}
|
|
555128
555363
|
return Transport.grpc({
|
|
555129
555364
|
service: protobufService
|
|
@@ -555335,7 +555570,7 @@ function resolvePathParameterOrThrow({ parameter: parameter6, variableResolver,
|
|
|
555335
555570
|
file: file4
|
|
555336
555571
|
});
|
|
555337
555572
|
if (resolved == null) {
|
|
555338
|
-
throw new
|
|
555573
|
+
throw new CliError({ message: "Cannot resolve path parameter", code: CliError.Code.InternalError });
|
|
555339
555574
|
}
|
|
555340
555575
|
return resolved;
|
|
555341
555576
|
}
|
|
@@ -555616,7 +555851,10 @@ var DynamicSnippetsConverter = class {
|
|
|
555616
555851
|
return dynamic_exports.Request.body({ pathParameters, body: void 0 });
|
|
555617
555852
|
}
|
|
555618
555853
|
if (endpoint3.sdkRequest == null) {
|
|
555619
|
-
throw new
|
|
555854
|
+
throw new CliError({
|
|
555855
|
+
message: `Internal error; endpoint "${endpoint3.id}" has a request body but no SDK request`,
|
|
555856
|
+
code: CliError.Code.InternalError
|
|
555857
|
+
});
|
|
555620
555858
|
}
|
|
555621
555859
|
switch (endpoint3.sdkRequest.shape.type) {
|
|
555622
555860
|
case "justRequestBody":
|
|
@@ -556109,7 +556347,7 @@ var DynamicSnippetsConverter = class {
|
|
|
556109
556347
|
}))
|
|
556110
556348
|
}),
|
|
556111
556349
|
_other: () => {
|
|
556112
|
-
throw new
|
|
556350
|
+
throw new CliError({ message: "Unknown environments type", code: CliError.Code.InternalError });
|
|
556113
556351
|
}
|
|
556114
556352
|
})
|
|
556115
556353
|
};
|
|
@@ -556146,10 +556384,16 @@ var DynamicSnippetsConverter = class {
|
|
|
556146
556384
|
resolveObjectTypeOrThrow(typeId) {
|
|
556147
556385
|
const typeDeclaration2 = this.ir.types[typeId];
|
|
556148
556386
|
if (typeDeclaration2 == null) {
|
|
556149
|
-
throw new
|
|
556387
|
+
throw new CliError({
|
|
556388
|
+
message: `Internal error; type "${typeId}" not found`,
|
|
556389
|
+
code: CliError.Code.InternalError
|
|
556390
|
+
});
|
|
556150
556391
|
}
|
|
556151
556392
|
if (typeDeclaration2.shape.type !== "object") {
|
|
556152
|
-
throw new
|
|
556393
|
+
throw new CliError({
|
|
556394
|
+
message: `Internal error; type "${typeId}" is not an object`,
|
|
556395
|
+
code: CliError.Code.InternalError
|
|
556396
|
+
});
|
|
556153
556397
|
}
|
|
556154
556398
|
return typeDeclaration2.shape;
|
|
556155
556399
|
}
|
|
@@ -556434,7 +556678,10 @@ function convertOAuthClientCredentials({ propertyResolver, endpointResolver, typ
|
|
|
556434
556678
|
tokenEndpoint
|
|
556435
556679
|
});
|
|
556436
556680
|
if (oauthTokenEndpoint == null) {
|
|
556437
|
-
throw new
|
|
556681
|
+
throw new CliError({
|
|
556682
|
+
message: "Failed to convert OAuth token endpoint.",
|
|
556683
|
+
code: CliError.Code.IrConversionError
|
|
556684
|
+
});
|
|
556438
556685
|
}
|
|
556439
556686
|
const refreshEndpoint = refreshTokenEndpoint != null ? convertOAuthRefreshEndpoint({
|
|
556440
556687
|
propertyResolver,
|
|
@@ -556612,7 +556859,7 @@ function convertSchemeReference2({ reference: reference4, authSchemeDeclarations
|
|
|
556612
556859
|
const convertNamedAuthSchemeReference = (reference5, docs2) => {
|
|
556613
556860
|
const declaration = authSchemeDeclarations?.[reference5];
|
|
556614
556861
|
if (declaration == null) {
|
|
556615
|
-
throw new
|
|
556862
|
+
throw new CliError({ message: "Unknown auth scheme: " + reference5, code: CliError.Code.ReferenceError });
|
|
556616
556863
|
}
|
|
556617
556864
|
return visitRawAuthSchemeDeclaration(declaration, {
|
|
556618
556865
|
header: (rawHeader) => AuthScheme.header({
|
|
@@ -556724,7 +556971,10 @@ function generateOAuth({ key: key2, file: file4, docs: docs2, rawScheme, propert
|
|
|
556724
556971
|
}))
|
|
556725
556972
|
});
|
|
556726
556973
|
default:
|
|
556727
|
-
throw new
|
|
556974
|
+
throw new CliError({
|
|
556975
|
+
message: `Unknown OAuth type: '${rawScheme?.type}'`,
|
|
556976
|
+
code: CliError.Code.ValidationError
|
|
556977
|
+
});
|
|
556728
556978
|
}
|
|
556729
556979
|
}
|
|
556730
556980
|
function generateInferredAuth({ key: key2, file: file4, docs: docs2, rawScheme, propertyResolver, endpointResolver }) {
|
|
@@ -556988,7 +557238,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
556988
557238
|
queryParameters: example["query-parameters"] != null ? Object.entries(example["query-parameters"]).map(([wireKey, value2]) => {
|
|
556989
557239
|
const queryParameterDeclaration = channel3["query-parameters"]?.[wireKey];
|
|
556990
557240
|
if (queryParameterDeclaration == null) {
|
|
556991
|
-
throw new
|
|
557241
|
+
throw new CliError({
|
|
557242
|
+
message: `Query parameter ${wireKey} does not exist`,
|
|
557243
|
+
code: CliError.Code.ReferenceError
|
|
557244
|
+
});
|
|
556992
557245
|
}
|
|
556993
557246
|
return {
|
|
556994
557247
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557013,7 +557266,10 @@ function convertChannel({ channel: channel3, typeResolver, exampleResolver, vari
|
|
|
557013
557266
|
messages: example.messages.map((messageExample) => {
|
|
557014
557267
|
const message = channel3.messages?.[messageExample.type];
|
|
557015
557268
|
if (message == null) {
|
|
557016
|
-
throw new
|
|
557269
|
+
throw new CliError({
|
|
557270
|
+
message: `Message ${messageExample.type} does not exist`,
|
|
557271
|
+
code: CliError.Code.ReferenceError
|
|
557272
|
+
});
|
|
557017
557273
|
}
|
|
557018
557274
|
return {
|
|
557019
557275
|
type: messageExample.type,
|
|
@@ -557052,7 +557308,7 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557052
557308
|
}));
|
|
557053
557309
|
}
|
|
557054
557310
|
if (!isPlainObject4(example)) {
|
|
557055
|
-
throw new
|
|
557311
|
+
throw new CliError({ message: "Example must be an object", code: CliError.Code.ValidationError });
|
|
557056
557312
|
}
|
|
557057
557313
|
const exampleProperties = [];
|
|
557058
557314
|
for (const [wireKey, propertyExample] of Object.entries(example)) {
|
|
@@ -557082,7 +557338,10 @@ function convertExampleWebSocketMessageBody({ message, example, typeResolver, ex
|
|
|
557082
557338
|
file: file4
|
|
557083
557339
|
});
|
|
557084
557340
|
if (originalTypeDeclaration == null) {
|
|
557085
|
-
throw new
|
|
557341
|
+
throw new CliError({
|
|
557342
|
+
message: "Could not find original type declaration for property: " + wireKey,
|
|
557343
|
+
code: CliError.Code.ResolutionError
|
|
557344
|
+
});
|
|
557086
557345
|
}
|
|
557087
557346
|
exampleProperties.push({
|
|
557088
557347
|
name: file4.casingsGenerator.generateNameAndWireValue({
|
|
@@ -557166,7 +557425,10 @@ function convertChannelPathParameters({ channel: channel3, example, typeResolver
|
|
|
557166
557425
|
examplePathParameter
|
|
557167
557426
|
}));
|
|
557168
557427
|
} else {
|
|
557169
|
-
throw new
|
|
557428
|
+
throw new CliError({
|
|
557429
|
+
message: `Path parameter ${key2} does not exist`,
|
|
557430
|
+
code: CliError.Code.ReferenceError
|
|
557431
|
+
});
|
|
557170
557432
|
}
|
|
557171
557433
|
}
|
|
557172
557434
|
}
|
|
@@ -557317,7 +557579,10 @@ var ReadmeEndpointCache = class {
|
|
|
557317
557579
|
getEndpointForReadmeOrThrow(readmeEndpoint) {
|
|
557318
557580
|
const endpoint3 = this.getEndpointForReadme(readmeEndpoint);
|
|
557319
557581
|
if (endpoint3 == null) {
|
|
557320
|
-
throw new
|
|
557582
|
+
throw new CliError({
|
|
557583
|
+
message: `Endpoint not found for ${JSON.stringify(readmeEndpoint)}`,
|
|
557584
|
+
code: CliError.Code.ResolutionError
|
|
557585
|
+
});
|
|
557321
557586
|
}
|
|
557322
557587
|
return endpoint3;
|
|
557323
557588
|
}
|
|
@@ -557365,7 +557630,7 @@ function getReadmeEndpointObject({ endpoint: endpoint3 }) {
|
|
|
557365
557630
|
if (typeof endpoint3 === "string") {
|
|
557366
557631
|
const split2 = endpoint3.split(" ");
|
|
557367
557632
|
if (split2.length !== 2 || split2[0] == null || split2[1] == null) {
|
|
557368
|
-
throw new
|
|
557633
|
+
throw new CliError({ message: `invalid endpoint string: ${endpoint3}`, code: CliError.Code.ParseError });
|
|
557369
557634
|
}
|
|
557370
557635
|
return {
|
|
557371
557636
|
method: split2[0],
|
|
@@ -557462,7 +557727,10 @@ function convertWebhookExamples2({ webhook, examples, file: file4, typeResolver,
|
|
|
557462
557727
|
}));
|
|
557463
557728
|
}
|
|
557464
557729
|
if (!isPlainObject4(webhook.payload)) {
|
|
557465
|
-
throw new
|
|
557730
|
+
throw new CliError({
|
|
557731
|
+
message: `Example webhook payload is not an object. Got: ${JSON.stringify(webhook.payload)}`,
|
|
557732
|
+
code: CliError.Code.ValidationError
|
|
557733
|
+
});
|
|
557466
557734
|
}
|
|
557467
557735
|
return examples.map((example) => ({
|
|
557468
557736
|
docs: webhook.docs,
|
|
@@ -557854,7 +558122,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557854
558122
|
const genericInstantiation = typeof generic === "string" ? generic : generic.type;
|
|
557855
558123
|
const maybeGeneric = parseGeneric(genericInstantiation);
|
|
557856
558124
|
if (maybeGeneric == null) {
|
|
557857
|
-
throw new
|
|
558125
|
+
throw new CliError({
|
|
558126
|
+
message: `Invalid generic type definition: ${genericInstantiation}`,
|
|
558127
|
+
code: CliError.Code.ValidationError
|
|
558128
|
+
});
|
|
557858
558129
|
}
|
|
557859
558130
|
const resolvedBaseGeneric = typeResolver.getDeclarationOfNamedTypeOrThrow({
|
|
557860
558131
|
referenceToNamedType: genericInstantiation,
|
|
@@ -557885,7 +558156,10 @@ function convertGenericTypeDeclaration({ generic, file: file4, typeResolver }) {
|
|
|
557885
558156
|
extendedProperties: void 0
|
|
557886
558157
|
});
|
|
557887
558158
|
}
|
|
557888
|
-
throw new
|
|
558159
|
+
throw new CliError({
|
|
558160
|
+
message: `Generic type definition not supported: ${genericInstantiation}`,
|
|
558161
|
+
code: CliError.Code.ValidationError
|
|
558162
|
+
});
|
|
557889
558163
|
}
|
|
557890
558164
|
|
|
557891
558165
|
// ../generation/ir-generator/lib/converters/type-declarations/convertAliasTypeDeclaration.js
|
|
@@ -558277,7 +558551,10 @@ var PackageTreeGenerator = class {
|
|
|
558277
558551
|
addPackageRedirection({ from: from4, to: to10 }) {
|
|
558278
558552
|
const package_ = this.getPackageForFernFilepath(from4);
|
|
558279
558553
|
if (package_.navigationConfig != null) {
|
|
558280
|
-
throw new
|
|
558554
|
+
throw new CliError({
|
|
558555
|
+
message: "Found duplicate navigationConfig for package",
|
|
558556
|
+
code: CliError.Code.InternalError
|
|
558557
|
+
});
|
|
558281
558558
|
}
|
|
558282
558559
|
package_.navigationConfig = {
|
|
558283
558560
|
pointsTo: IdGenerator.generateSubpackageId(to10)
|
|
@@ -558286,7 +558563,7 @@ var PackageTreeGenerator = class {
|
|
|
558286
558563
|
addDocs(fernFilepath, docs2) {
|
|
558287
558564
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558288
558565
|
if (package_.docs != null) {
|
|
558289
|
-
throw new
|
|
558566
|
+
throw new CliError({ message: "Found duplicate docs for package", code: CliError.Code.InternalError });
|
|
558290
558567
|
}
|
|
558291
558568
|
package_.docs = docs2;
|
|
558292
558569
|
}
|
|
@@ -558302,21 +558579,30 @@ var PackageTreeGenerator = class {
|
|
|
558302
558579
|
addService(serviceId, service) {
|
|
558303
558580
|
const package_ = this.getPackageForFernFilepath(service.name.fernFilepath);
|
|
558304
558581
|
if (package_.service != null) {
|
|
558305
|
-
throw new
|
|
558582
|
+
throw new CliError({
|
|
558583
|
+
message: "Found duplicate service for " + serviceId,
|
|
558584
|
+
code: CliError.Code.InternalError
|
|
558585
|
+
});
|
|
558306
558586
|
}
|
|
558307
558587
|
package_.service = serviceId;
|
|
558308
558588
|
}
|
|
558309
558589
|
addWebhookGroup(webhookGroupId, fernFilepath) {
|
|
558310
558590
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558311
558591
|
if (package_.webhooks != null) {
|
|
558312
|
-
throw new
|
|
558592
|
+
throw new CliError({
|
|
558593
|
+
message: "Found duplicate webhook group for " + webhookGroupId,
|
|
558594
|
+
code: CliError.Code.InternalError
|
|
558595
|
+
});
|
|
558313
558596
|
}
|
|
558314
558597
|
package_.webhooks = webhookGroupId;
|
|
558315
558598
|
}
|
|
558316
558599
|
addWebSocketChannel(websocketChannelId, fernFilepath) {
|
|
558317
558600
|
const package_ = this.getPackageForFernFilepath(fernFilepath);
|
|
558318
558601
|
if (package_.webhooks != null) {
|
|
558319
|
-
throw new
|
|
558602
|
+
throw new CliError({
|
|
558603
|
+
message: "Found duplicate webhook group for " + websocketChannelId,
|
|
558604
|
+
code: CliError.Code.InternalError
|
|
558605
|
+
});
|
|
558320
558606
|
}
|
|
558321
558607
|
package_.websocket = websocketChannelId;
|
|
558322
558608
|
}
|
|
@@ -558359,24 +558645,33 @@ var PackageTreeGenerator = class {
|
|
|
558359
558645
|
}
|
|
558360
558646
|
sortRootPackage(subpackagesInOrder) {
|
|
558361
558647
|
if (!isEqualIgnoreOrder(this.rootPackage.subpackages, subpackagesInOrder)) {
|
|
558362
|
-
throw new
|
|
558648
|
+
throw new CliError({
|
|
558649
|
+
message: "Sorted subpackages differ from unsorted packages in root",
|
|
558650
|
+
code: CliError.Code.InternalError
|
|
558651
|
+
});
|
|
558363
558652
|
}
|
|
558364
558653
|
this.rootPackage.subpackages = subpackagesInOrder;
|
|
558365
558654
|
}
|
|
558366
558655
|
sortSubpackage(subpackageId, subpackagesInOrder) {
|
|
558367
558656
|
const subpackage = this.subpackages[subpackageId];
|
|
558368
558657
|
if (subpackage == null) {
|
|
558369
|
-
throw new
|
|
558658
|
+
throw new CliError({
|
|
558659
|
+
message: "Subpackage does not exist: " + subpackageId,
|
|
558660
|
+
code: CliError.Code.ResolutionError
|
|
558661
|
+
});
|
|
558370
558662
|
}
|
|
558371
558663
|
if (!isEqualIgnoreOrder(subpackage.subpackages, subpackagesInOrder)) {
|
|
558372
|
-
throw new
|
|
558664
|
+
throw new CliError({
|
|
558665
|
+
message: "Sorted subpackages differ from unsorted packages",
|
|
558666
|
+
code: CliError.Code.InternalError
|
|
558667
|
+
});
|
|
558373
558668
|
}
|
|
558374
558669
|
subpackage.subpackages = subpackagesInOrder;
|
|
558375
558670
|
}
|
|
558376
558671
|
getAllSubpackagesWithEndpoints(root6) {
|
|
558377
558672
|
const subpackage = this.subpackages[root6];
|
|
558378
558673
|
if (subpackage == null) {
|
|
558379
|
-
throw new
|
|
558674
|
+
throw new CliError({ message: "Subpackage does not exist: " + root6, code: CliError.Code.ResolutionError });
|
|
558380
558675
|
}
|
|
558381
558676
|
const subpackagesWithEndpoints = this.getAllChildrenWithEndpoints(subpackage);
|
|
558382
558677
|
if (subpackagesWithEndpoints.length > 0 || subpackage.service != null) {
|
|
@@ -558397,7 +558692,10 @@ var PackageTreeGenerator = class {
|
|
|
558397
558692
|
const subpackagesInParent = parent.subpackages.map((subpackageId) => {
|
|
558398
558693
|
const subpackage = this.subpackages[subpackageId];
|
|
558399
558694
|
if (subpackage == null) {
|
|
558400
|
-
throw new
|
|
558695
|
+
throw new CliError({
|
|
558696
|
+
message: "Subpackage ID is invalid: " + subpackageId,
|
|
558697
|
+
code: CliError.Code.InternalError
|
|
558698
|
+
});
|
|
558401
558699
|
}
|
|
558402
558700
|
return subpackage;
|
|
558403
558701
|
});
|
|
@@ -558476,7 +558774,10 @@ var EndpointResolverImpl = class {
|
|
|
558476
558774
|
resolveEndpointOrThrow({ endpoint: endpoint3, file: file4 }) {
|
|
558477
558775
|
const resolvedEndpoint = this.resolveEndpoint({ endpoint: endpoint3, file: file4 });
|
|
558478
558776
|
if (resolvedEndpoint == null) {
|
|
558479
|
-
throw new
|
|
558777
|
+
throw new CliError({
|
|
558778
|
+
message: "Cannot resolve endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
558779
|
+
code: CliError.Code.ResolutionError
|
|
558780
|
+
});
|
|
558480
558781
|
}
|
|
558481
558782
|
return resolvedEndpoint;
|
|
558482
558783
|
}
|
|
@@ -558604,7 +558905,10 @@ var ErrorResolverImpl = class {
|
|
|
558604
558905
|
getDeclarationOrThrow(referenceToError, file4) {
|
|
558605
558906
|
const declaration = this.getDeclaration(referenceToError, file4);
|
|
558606
558907
|
if (declaration == null) {
|
|
558607
|
-
throw new
|
|
558908
|
+
throw new CliError({
|
|
558909
|
+
message: "Error does not exist: " + referenceToError,
|
|
558910
|
+
code: CliError.Code.ResolutionError
|
|
558911
|
+
});
|
|
558608
558912
|
}
|
|
558609
558913
|
return declaration;
|
|
558610
558914
|
}
|
|
@@ -558690,7 +558994,7 @@ var ExampleResolverImpl = class {
|
|
|
558690
558994
|
resolveAllReferencesInExampleOrThrow({ example, file: file4 }) {
|
|
558691
558995
|
const resolvedExample = this.resolveAllReferencesInExample({ example, file: file4 });
|
|
558692
558996
|
if (resolvedExample == null) {
|
|
558693
|
-
throw new
|
|
558997
|
+
throw new CliError({ message: "Failed to resolve examples", code: CliError.Code.ResolutionError });
|
|
558694
558998
|
}
|
|
558695
558999
|
return resolvedExample;
|
|
558696
559000
|
}
|
|
@@ -558737,7 +559041,7 @@ var ExampleResolverImpl = class {
|
|
|
558737
559041
|
resolveExampleOrThrow({ example, file: file4 }) {
|
|
558738
559042
|
const resolvedExample = this.resolveExample({ example, file: file4 });
|
|
558739
559043
|
if (resolvedExample == null) {
|
|
558740
|
-
throw new
|
|
559044
|
+
throw new CliError({ message: "Cannot resolve example: " + example, code: CliError.Code.ResolutionError });
|
|
558741
559045
|
}
|
|
558742
559046
|
return resolvedExample;
|
|
558743
559047
|
}
|
|
@@ -558788,7 +559092,10 @@ var PropertyResolverImpl = class {
|
|
|
558788
559092
|
resolveRequestPropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558789
559093
|
const resolvedRequestProperty = this.resolveRequestProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558790
559094
|
if (resolvedRequestProperty == null) {
|
|
558791
|
-
throw new
|
|
559095
|
+
throw new CliError({
|
|
559096
|
+
message: "Cannot resolve request property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559097
|
+
code: CliError.Code.ResolutionError
|
|
559098
|
+
});
|
|
558792
559099
|
}
|
|
558793
559100
|
return resolvedRequestProperty;
|
|
558794
559101
|
}
|
|
@@ -558832,7 +559139,10 @@ var PropertyResolverImpl = class {
|
|
|
558832
559139
|
resolveResponsePropertyOrThrow({ file: file4, endpoint: endpoint3, propertyComponents }) {
|
|
558833
559140
|
const resolvedResponseProperty = this.resolveResponseProperty({ file: file4, endpoint: endpoint3, propertyComponents });
|
|
558834
559141
|
if (resolvedResponseProperty == null) {
|
|
558835
|
-
throw new
|
|
559142
|
+
throw new CliError({
|
|
559143
|
+
message: "Cannot resolve response property from endpoint: " + endpoint3 + " in file " + file4.relativeFilepath,
|
|
559144
|
+
code: CliError.Code.ResolutionError
|
|
559145
|
+
});
|
|
558836
559146
|
}
|
|
558837
559147
|
return resolvedResponseProperty;
|
|
558838
559148
|
}
|
|
@@ -558999,7 +559309,10 @@ var PropertyResolverImpl = class {
|
|
|
558999
559309
|
propertyComponents: breadcrumbs
|
|
559000
559310
|
});
|
|
559001
559311
|
if (!currentType) {
|
|
559002
|
-
throw new
|
|
559312
|
+
throw new CliError({
|
|
559313
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in inline request body in file ${file4.relativeFilepath}`,
|
|
559314
|
+
code: CliError.Code.InternalError
|
|
559315
|
+
});
|
|
559003
559316
|
}
|
|
559004
559317
|
result.push({
|
|
559005
559318
|
name: file4.casingsGenerator.generateName(component),
|
|
@@ -559017,7 +559330,10 @@ function getNestedObjectPropertyTypeOrThrow({ typeResolver, file: file4, resolve
|
|
|
559017
559330
|
propertyName
|
|
559018
559331
|
});
|
|
559019
559332
|
if (!nestedPropertyType) {
|
|
559020
|
-
throw new
|
|
559333
|
+
throw new CliError({
|
|
559334
|
+
message: `Cannot find property '${breadcrumbs.join(".")}' in ${rootTypeLabel}`,
|
|
559335
|
+
code: CliError.Code.InternalError
|
|
559336
|
+
});
|
|
559021
559337
|
}
|
|
559022
559338
|
return nestedPropertyType;
|
|
559023
559339
|
}
|
|
@@ -559194,14 +559510,20 @@ var TypeResolverImpl = class {
|
|
|
559194
559510
|
resolveTypeOrThrow({ type: type8, file: file4 }) {
|
|
559195
559511
|
const resolvedType = this.resolveType({ type: type8, file: file4 });
|
|
559196
559512
|
if (resolvedType == null) {
|
|
559197
|
-
throw new
|
|
559513
|
+
throw new CliError({
|
|
559514
|
+
message: "Cannot resolve type: " + type8 + " in file " + file4.relativeFilepath,
|
|
559515
|
+
code: CliError.Code.ResolutionError
|
|
559516
|
+
});
|
|
559198
559517
|
}
|
|
559199
559518
|
return resolvedType;
|
|
559200
559519
|
}
|
|
559201
559520
|
getDeclarationOfNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559202
559521
|
const declaration = this.getDeclarationOfNamedType({ referenceToNamedType, file: file4 });
|
|
559203
559522
|
if (declaration == null) {
|
|
559204
|
-
throw new
|
|
559523
|
+
throw new CliError({
|
|
559524
|
+
message: "Cannot find declaration of type: " + referenceToNamedType + " in file " + file4.relativeFilepath,
|
|
559525
|
+
code: CliError.Code.ResolutionError
|
|
559526
|
+
});
|
|
559205
559527
|
}
|
|
559206
559528
|
return declaration;
|
|
559207
559529
|
}
|
|
@@ -559344,7 +559666,10 @@ var TypeResolverImpl = class {
|
|
|
559344
559666
|
resolveNamedTypeOrThrow({ referenceToNamedType, file: file4 }) {
|
|
559345
559667
|
const resolvedType = this.resolveNamedType({ referenceToNamedType, file: file4 });
|
|
559346
559668
|
if (resolvedType == null) {
|
|
559347
|
-
throw new
|
|
559669
|
+
throw new CliError({
|
|
559670
|
+
message: "Cannot resolve type: " + referenceToNamedType,
|
|
559671
|
+
code: CliError.Code.ResolutionError
|
|
559672
|
+
});
|
|
559348
559673
|
}
|
|
559349
559674
|
return resolvedType;
|
|
559350
559675
|
}
|
|
@@ -559403,7 +559728,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559403
559728
|
getDeclarationOrThrow(referenceToVariable, file4) {
|
|
559404
559729
|
const declaration = this.getDeclaration(referenceToVariable, file4);
|
|
559405
559730
|
if (declaration == null) {
|
|
559406
|
-
throw new
|
|
559731
|
+
throw new CliError({
|
|
559732
|
+
message: "Variable does not exist: " + referenceToVariable,
|
|
559733
|
+
code: CliError.Code.ResolutionError
|
|
559734
|
+
});
|
|
559407
559735
|
}
|
|
559408
559736
|
return declaration;
|
|
559409
559737
|
}
|
|
@@ -559426,7 +559754,10 @@ var VariableResolverImpl = class _VariableResolverImpl {
|
|
|
559426
559754
|
getVariableIdOrThrow(referenceToVariable) {
|
|
559427
559755
|
const variableId = this.getVariableId(referenceToVariable);
|
|
559428
559756
|
if (variableId == null) {
|
|
559429
|
-
throw new
|
|
559757
|
+
throw new CliError({
|
|
559758
|
+
message: "Variable reference does not start with " + _VariableResolverImpl.VARIABLE_PREFIX,
|
|
559759
|
+
code: CliError.Code.ResolutionError
|
|
559760
|
+
});
|
|
559430
559761
|
}
|
|
559431
559762
|
return variableId;
|
|
559432
559763
|
}
|
|
@@ -559598,7 +559929,10 @@ function generateIntermediateRepresentation({ workspace, generationLanguage, key
|
|
|
559598
559929
|
}
|
|
559599
559930
|
const errorDiscriminationSchema = workspace.definition.rootApiFile.contents["error-discrimination"];
|
|
559600
559931
|
if (errorDiscriminationSchema == null) {
|
|
559601
|
-
throw new
|
|
559932
|
+
throw new CliError({
|
|
559933
|
+
message: "error-discrimination is missing in api.yml but there are declared errors.",
|
|
559934
|
+
code: CliError.Code.ConfigError
|
|
559935
|
+
});
|
|
559602
559936
|
}
|
|
559603
559937
|
for (const [errorName, errorDeclaration] of Object.entries(errors4)) {
|
|
559604
559938
|
const convertedErrorDeclaration = convertErrorDeclaration({
|
|
@@ -581550,7 +581884,9 @@ function getPathToLocalStorageDependency(dependency) {
|
|
|
581550
581884
|
}
|
|
581551
581885
|
async function validateLocalDependencyAndGetDefinition({ dependency, context: context3, cliVersion, settings, loadAPIWorkspace: loadAPIWorkspace2 }) {
|
|
581552
581886
|
if (loadAPIWorkspace2 == null) {
|
|
581553
|
-
context3.failWithoutThrowing("Failed to load api definition"
|
|
581887
|
+
context3.failWithoutThrowing("Failed to load api definition", void 0, {
|
|
581888
|
+
code: CliError.Code.ResolutionError
|
|
581889
|
+
});
|
|
581554
581890
|
return void 0;
|
|
581555
581891
|
}
|
|
581556
581892
|
context3.logger.info("Parsing...");
|
|
@@ -581561,7 +581897,9 @@ async function validateLocalDependencyAndGetDefinition({ dependency, context: co
|
|
|
581561
581897
|
workspaceName: void 0
|
|
581562
581898
|
});
|
|
581563
581899
|
if (!loadDependencyWorkspaceResult.didSucceed) {
|
|
581564
|
-
context3.failWithoutThrowing("Failed to load api definition", loadDependencyWorkspaceResult.failures
|
|
581900
|
+
context3.failWithoutThrowing("Failed to load api definition", loadDependencyWorkspaceResult.failures, {
|
|
581901
|
+
code: CliError.Code.ResolutionError
|
|
581902
|
+
});
|
|
581565
581903
|
return void 0;
|
|
581566
581904
|
}
|
|
581567
581905
|
context3.logger.info("Modifying source filepath ...");
|
|
@@ -581583,16 +581921,24 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581583
581921
|
if (!response.ok) {
|
|
581584
581922
|
response.error._visit({
|
|
581585
581923
|
orgDoesNotExistError: () => {
|
|
581586
|
-
context3.failWithoutThrowing("Organization does not exist"
|
|
581924
|
+
context3.failWithoutThrowing("Organization does not exist", void 0, {
|
|
581925
|
+
code: CliError.Code.ResolutionError
|
|
581926
|
+
});
|
|
581587
581927
|
},
|
|
581588
581928
|
apiDoesNotExistError: () => {
|
|
581589
|
-
context3.failWithoutThrowing("API does not exist"
|
|
581929
|
+
context3.failWithoutThrowing("API does not exist", void 0, {
|
|
581930
|
+
code: CliError.Code.ResolutionError
|
|
581931
|
+
});
|
|
581590
581932
|
},
|
|
581591
581933
|
versionDoesNotExistError: () => {
|
|
581592
|
-
context3.failWithoutThrowing("Version does not exist"
|
|
581934
|
+
context3.failWithoutThrowing("Version does not exist", void 0, {
|
|
581935
|
+
code: CliError.Code.ResolutionError
|
|
581936
|
+
});
|
|
581593
581937
|
},
|
|
581594
581938
|
_other: (error50) => {
|
|
581595
|
-
context3.failWithoutThrowing("Failed to download API manifest", error50
|
|
581939
|
+
context3.failWithoutThrowing("Failed to download API manifest", error50, {
|
|
581940
|
+
code: CliError.Code.NetworkError
|
|
581941
|
+
});
|
|
581596
581942
|
}
|
|
581597
581943
|
});
|
|
581598
581944
|
return void 0;
|
|
@@ -581602,14 +581948,14 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581602
581948
|
const parsedCliVersionOfDependency = parseVersion(response.body.cliVersion);
|
|
581603
581949
|
if (parsedYamlVersionOfDependency != null) {
|
|
581604
581950
|
if (parsedYamlVersionOfDependency > YAML_SCHEMA_VERSION) {
|
|
581605
|
-
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a higher version of fern. Upgrade this workspace to ${response.body.cliVersion}
|
|
581951
|
+
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a higher version of fern. Upgrade this workspace to ${response.body.cliVersion}`, void 0, { code: CliError.Code.VersionError });
|
|
581606
581952
|
return void 0;
|
|
581607
581953
|
} else if (parsedYamlVersionOfDependency < YAML_SCHEMA_VERSION) {
|
|
581608
|
-
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a lower version of fern. Upgrade it to ${cliVersion}
|
|
581954
|
+
context3.failWithoutThrowing(`${dependency.organization}/${dependency.apiName}@${dependency.version} on a lower version of fern. Upgrade it to ${cliVersion}`, void 0, { code: CliError.Code.VersionError });
|
|
581609
581955
|
return void 0;
|
|
581610
581956
|
}
|
|
581611
581957
|
} else if (parsedCliVersion.major !== parsedCliVersionOfDependency.major || parsedCliVersion.minor !== parsedCliVersionOfDependency.minor) {
|
|
581612
|
-
context3.failWithoutThrowing(`CLI version is ${response.body.cliVersion}. Expected ${parsedCliVersion.major}.${parsedCliVersion.minor}.x (to match current workspace)
|
|
581958
|
+
context3.failWithoutThrowing(`CLI version is ${response.body.cliVersion}. Expected ${parsedCliVersion.major}.${parsedCliVersion.minor}.x (to match current workspace).`, void 0, { code: CliError.Code.VersionError });
|
|
581613
581959
|
return void 0;
|
|
581614
581960
|
}
|
|
581615
581961
|
context3.logger.info("Downloading...");
|
|
@@ -581621,7 +581967,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581621
581967
|
absolutePathToLocalOutput: pathToDefinition
|
|
581622
581968
|
});
|
|
581623
581969
|
} catch (error50) {
|
|
581624
|
-
context3.failWithoutThrowing("Failed to download API", error50
|
|
581970
|
+
context3.failWithoutThrowing("Failed to download API", error50, {
|
|
581971
|
+
code: CliError.Code.NetworkError
|
|
581972
|
+
});
|
|
581625
581973
|
return void 0;
|
|
581626
581974
|
}
|
|
581627
581975
|
metadata = response.body;
|
|
@@ -581631,7 +581979,9 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581631
581979
|
}
|
|
581632
581980
|
context3.logger.info("Parsing...");
|
|
581633
581981
|
if (loadAPIWorkspace2 == null) {
|
|
581634
|
-
context3.failWithoutThrowing("Failed to load API"
|
|
581982
|
+
context3.failWithoutThrowing("Failed to load API", void 0, {
|
|
581983
|
+
code: CliError.Code.ResolutionError
|
|
581984
|
+
});
|
|
581635
581985
|
return void 0;
|
|
581636
581986
|
}
|
|
581637
581987
|
const loadDependencyWorkspaceResult = await loadAPIWorkspace2({
|
|
@@ -581641,12 +581991,14 @@ async function validateVersionedDependencyAndGetDefinition({ dependency, context
|
|
|
581641
581991
|
workspaceName: void 0
|
|
581642
581992
|
});
|
|
581643
581993
|
if (!loadDependencyWorkspaceResult.didSucceed) {
|
|
581644
|
-
context3.failWithoutThrowing("Failed to parse dependency after downloading", loadDependencyWorkspaceResult.failures);
|
|
581994
|
+
context3.failWithoutThrowing("Failed to parse dependency after downloading", loadDependencyWorkspaceResult.failures, { code: CliError.Code.ParseError });
|
|
581645
581995
|
return void 0;
|
|
581646
581996
|
}
|
|
581647
581997
|
const workspaceOfDependency = loadDependencyWorkspaceResult.workspace;
|
|
581648
581998
|
if (workspaceOfDependency.type === "oss") {
|
|
581649
|
-
context3.failWithoutThrowing("Dependency must be a fern workspace."
|
|
581999
|
+
context3.failWithoutThrowing("Dependency must be a fern workspace.", void 0, {
|
|
582000
|
+
code: CliError.Code.ConfigError
|
|
582001
|
+
});
|
|
581650
582002
|
return void 0;
|
|
581651
582003
|
}
|
|
581652
582004
|
return await loadDependencyWorkspaceResult.workspace.getDefinition({ context: context3 }, settings);
|
|
@@ -592186,7 +592538,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592186
592538
|
const parseResult = await parseYamlFiles(yamlFiles);
|
|
592187
592539
|
if (!parseResult.didSucceed) {
|
|
592188
592540
|
handleFailedWorkspaceParserResultRaw(parseResult.failures, defaultedContext.logger);
|
|
592189
|
-
return defaultedContext.failAndThrow(
|
|
592541
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592542
|
+
code: CliError.Code.ValidationError
|
|
592543
|
+
});
|
|
592190
592544
|
}
|
|
592191
592545
|
const structuralValidationResult = validateStructureOfYamlFiles({
|
|
592192
592546
|
files: parseResult.files,
|
|
@@ -592195,7 +592549,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592195
592549
|
});
|
|
592196
592550
|
if (!structuralValidationResult.didSucceed) {
|
|
592197
592551
|
handleFailedWorkspaceParserResultRaw(structuralValidationResult.failures, defaultedContext.logger);
|
|
592198
|
-
return defaultedContext.failAndThrow(
|
|
592552
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592553
|
+
code: CliError.Code.ValidationError
|
|
592554
|
+
});
|
|
592199
592555
|
}
|
|
592200
592556
|
const processPackageMarkersResult = await processPackageMarkers({
|
|
592201
592557
|
dependenciesConfiguration,
|
|
@@ -592207,7 +592563,9 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
|
|
|
592207
592563
|
});
|
|
592208
592564
|
if (!processPackageMarkersResult.didSucceed) {
|
|
592209
592565
|
handleFailedWorkspaceParserResultRaw(processPackageMarkersResult.failures, defaultedContext.logger);
|
|
592210
|
-
return defaultedContext.failAndThrow(
|
|
592566
|
+
return defaultedContext.failAndThrow(void 0, void 0, {
|
|
592567
|
+
code: CliError.Code.ValidationError
|
|
592568
|
+
});
|
|
592211
592569
|
}
|
|
592212
592570
|
let definition3 = {
|
|
592213
592571
|
absoluteFilePath: absolutePathToDefinition,
|
|
@@ -592274,7 +592632,9 @@ async function mergeWithOverrides2({ absoluteFilePathToOverrides, data: data2, c
|
|
|
592274
592632
|
parsedOverrides = jsYaml.load(contents, { json: true });
|
|
592275
592633
|
}
|
|
592276
592634
|
} catch (err) {
|
|
592277
|
-
return context3.failAndThrow(`Failed to read overrides from file ${absoluteFilePathToOverrides}
|
|
592635
|
+
return context3.failAndThrow(`Failed to read overrides from file ${absoluteFilePathToOverrides}`, void 0, {
|
|
592636
|
+
code: CliError.Code.ParseError
|
|
592637
|
+
});
|
|
592278
592638
|
}
|
|
592279
592639
|
return mergeWithOverrides({ data: data2, overrides: parsedOverrides, allowNullKeys });
|
|
592280
592640
|
}
|
|
@@ -592434,7 +592794,10 @@ async function resolveExternalRefs(obj, baseDir, mainFileAbsPath, registry2, app
|
|
|
592434
592794
|
}
|
|
592435
592795
|
const cacheKey = `${absoluteRefPath}#${jsonPointer}`;
|
|
592436
592796
|
if (visited.has(cacheKey)) {
|
|
592437
|
-
throw new
|
|
592797
|
+
throw new CliError({
|
|
592798
|
+
message: `Circular $ref detected: "${ref2}" (resolved to "${cacheKey}")`,
|
|
592799
|
+
code: CliError.Code.ReferenceError
|
|
592800
|
+
});
|
|
592438
592801
|
}
|
|
592439
592802
|
const newVisited = new Set(visited);
|
|
592440
592803
|
newVisited.add(cacheKey);
|
|
@@ -592517,7 +592880,9 @@ async function parseOverlayFile(absoluteFilePathToOverlay, context3) {
|
|
|
592517
592880
|
try {
|
|
592518
592881
|
contents = await (0, import_promises26.readFile)(absoluteFilePathToOverlay, "utf8");
|
|
592519
592882
|
} catch (err) {
|
|
592520
|
-
return context3.failAndThrow(`Failed to read overlay file at ${absoluteFilePathToOverlay}: ${err}
|
|
592883
|
+
return context3.failAndThrow(`Failed to read overlay file at ${absoluteFilePathToOverlay}: ${err}`, void 0, {
|
|
592884
|
+
code: CliError.Code.ConfigError
|
|
592885
|
+
});
|
|
592521
592886
|
}
|
|
592522
592887
|
try {
|
|
592523
592888
|
try {
|
|
@@ -592526,7 +592891,9 @@ async function parseOverlayFile(absoluteFilePathToOverlay, context3) {
|
|
|
592526
592891
|
return jsYaml.load(contents, { json: true });
|
|
592527
592892
|
}
|
|
592528
592893
|
} catch (err) {
|
|
592529
|
-
return context3.failAndThrow(`Failed to parse overlay file at ${absoluteFilePathToOverlay}: ${err}
|
|
592894
|
+
return context3.failAndThrow(`Failed to parse overlay file at ${absoluteFilePathToOverlay}: ${err}`, void 0, {
|
|
592895
|
+
code: CliError.Code.ParseError
|
|
592896
|
+
});
|
|
592530
592897
|
}
|
|
592531
592898
|
}
|
|
592532
592899
|
function validateOverlay(overlay, context3) {
|
|
@@ -604726,7 +605093,7 @@ function getPlatformInfo() {
|
|
|
604726
605093
|
osName = "Windows";
|
|
604727
605094
|
break;
|
|
604728
605095
|
default:
|
|
604729
|
-
throw new
|
|
605096
|
+
throw new CliError({ message: `Unsupported platform: ${platform3}`, code: CliError.Code.EnvironmentError });
|
|
604730
605097
|
}
|
|
604731
605098
|
let archName;
|
|
604732
605099
|
switch (arch3) {
|
|
@@ -604737,7 +605104,7 @@ function getPlatformInfo() {
|
|
|
604737
605104
|
archName = platform3 === "linux" ? "aarch64" : "arm64";
|
|
604738
605105
|
break;
|
|
604739
605106
|
default:
|
|
604740
|
-
throw new
|
|
605107
|
+
throw new CliError({ message: `Unsupported architecture: ${arch3}`, code: CliError.Code.EnvironmentError });
|
|
604741
605108
|
}
|
|
604742
605109
|
return {
|
|
604743
605110
|
os: osName,
|
|
@@ -604811,7 +605178,10 @@ async function acquireLock(logger4) {
|
|
|
604811
605178
|
await new Promise((resolve14) => setTimeout(resolve14, LOCK_RETRY_INTERVAL_MS));
|
|
604812
605179
|
}
|
|
604813
605180
|
}
|
|
604814
|
-
throw new
|
|
605181
|
+
throw new CliError({
|
|
605182
|
+
message: `Failed to acquire buf lock after timeout and retry`,
|
|
605183
|
+
code: CliError.Code.InternalError
|
|
605184
|
+
});
|
|
604815
605185
|
}
|
|
604816
605186
|
return createLockReleaser(lockPath, logger4);
|
|
604817
605187
|
}
|
|
@@ -605000,7 +605370,10 @@ async function ensureBufCommand(logger4) {
|
|
|
605000
605370
|
logger4.debug(`Using auto-downloaded buf: ${downloadedBufPath}`);
|
|
605001
605371
|
return downloadedBufPath;
|
|
605002
605372
|
}
|
|
605003
|
-
throw new
|
|
605373
|
+
throw new CliError({
|
|
605374
|
+
message: "Missing required dependency; please install 'buf' to continue (e.g. 'brew install buf').",
|
|
605375
|
+
code: CliError.Code.EnvironmentError
|
|
605376
|
+
});
|
|
605004
605377
|
}
|
|
605005
605378
|
}
|
|
605006
605379
|
var PROTOBUF_GENERATOR_CONFIG_FILENAME = "buf.gen.yaml";
|
|
@@ -605217,7 +605590,7 @@ var ProtobufIRGenerator = class {
|
|
|
605217
605590
|
try {
|
|
605218
605591
|
await (0, import_promises34.access)(bufLockPath);
|
|
605219
605592
|
} catch {
|
|
605220
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
605593
|
+
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.", void 0, { code: CliError.Code.InternalError });
|
|
605221
605594
|
}
|
|
605222
605595
|
} else {
|
|
605223
605596
|
await buf(["dep", "update"]);
|
|
@@ -605225,7 +605598,9 @@ var ProtobufIRGenerator = class {
|
|
|
605225
605598
|
}
|
|
605226
605599
|
const bufGenerateResult = await buf(["generate"]);
|
|
605227
605600
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605228
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
605601
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
605602
|
+
code: CliError.Code.IrConversionError
|
|
605603
|
+
});
|
|
605229
605604
|
}
|
|
605230
605605
|
await (0, import_promises34.unlink)(bufYamlPath);
|
|
605231
605606
|
} catch (error50) {
|
|
@@ -605241,11 +605616,15 @@ var ProtobufIRGenerator = class {
|
|
|
605241
605616
|
try {
|
|
605242
605617
|
this.resolvedBufCommand = await ensureBufCommand(this.context.logger);
|
|
605243
605618
|
} catch (error50) {
|
|
605244
|
-
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50)
|
|
605619
|
+
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50), void 0, {
|
|
605620
|
+
code: CliError.Code.EnvironmentError
|
|
605621
|
+
});
|
|
605245
605622
|
}
|
|
605246
605623
|
}
|
|
605247
605624
|
async generateRemote() {
|
|
605248
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
605625
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
605626
|
+
code: CliError.Code.InternalError
|
|
605627
|
+
});
|
|
605249
605628
|
}
|
|
605250
605629
|
};
|
|
605251
605630
|
|
|
@@ -605285,7 +605664,7 @@ function getPlatformInfo2() {
|
|
|
605285
605664
|
osName = "windows";
|
|
605286
605665
|
break;
|
|
605287
605666
|
default:
|
|
605288
|
-
throw new
|
|
605667
|
+
throw new CliError({ message: `Unsupported platform: ${platform3}`, code: CliError.Code.EnvironmentError });
|
|
605289
605668
|
}
|
|
605290
605669
|
let archName;
|
|
605291
605670
|
switch (arch3) {
|
|
@@ -605296,7 +605675,7 @@ function getPlatformInfo2() {
|
|
|
605296
605675
|
archName = "arm64";
|
|
605297
605676
|
break;
|
|
605298
605677
|
default:
|
|
605299
|
-
throw new
|
|
605678
|
+
throw new CliError({ message: `Unsupported architecture: ${arch3}`, code: CliError.Code.EnvironmentError });
|
|
605300
605679
|
}
|
|
605301
605680
|
return {
|
|
605302
605681
|
os: osName,
|
|
@@ -605370,7 +605749,10 @@ async function acquireLock2(logger4) {
|
|
|
605370
605749
|
await new Promise((resolve14) => setTimeout(resolve14, LOCK_RETRY_INTERVAL_MS2));
|
|
605371
605750
|
}
|
|
605372
605751
|
}
|
|
605373
|
-
throw new
|
|
605752
|
+
throw new CliError({
|
|
605753
|
+
message: `Failed to acquire lock after timeout and retry`,
|
|
605754
|
+
code: CliError.Code.InternalError
|
|
605755
|
+
});
|
|
605374
605756
|
}
|
|
605375
605757
|
return createLockReleaser2(lockPath, logger4);
|
|
605376
605758
|
}
|
|
@@ -605488,7 +605870,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605488
605870
|
*/
|
|
605489
605871
|
async prepare({ absoluteFilepathToProtobufRoot, relativeFilepathToProtobufRoot, local, deps }) {
|
|
605490
605872
|
if (!local) {
|
|
605491
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
605873
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
605874
|
+
code: CliError.Code.InternalError
|
|
605875
|
+
});
|
|
605492
605876
|
}
|
|
605493
605877
|
await this.ensureBufResolved();
|
|
605494
605878
|
await this.ensureProtocGenOpenAPIResolved();
|
|
@@ -605508,7 +605892,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605508
605892
|
try {
|
|
605509
605893
|
await (0, import_promises36.access)(bufLockPath);
|
|
605510
605894
|
} catch {
|
|
605511
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
605895
|
+
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.", void 0, { code: CliError.Code.InternalError });
|
|
605512
605896
|
}
|
|
605513
605897
|
} else {
|
|
605514
605898
|
const bufCommand = this.resolvedBufCommand ?? "buf";
|
|
@@ -605545,7 +605929,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605545
605929
|
});
|
|
605546
605930
|
const bufGenerateResult = await buf(["generate", target.toString()]);
|
|
605547
605931
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605548
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
605932
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
605933
|
+
code: CliError.Code.IrConversionError
|
|
605934
|
+
});
|
|
605549
605935
|
}
|
|
605550
605936
|
const outputPath = join8(preparedDir.cwd, RelativeFilePath2.of(PROTOBUF_GENERATOR_OUTPUT_FILEPATH2));
|
|
605551
605937
|
const uniqueOutput = AbsoluteFilePath2.of((await import_tmp_promise7.default.file({ postfix: ".yaml" })).path);
|
|
@@ -605603,7 +605989,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605603
605989
|
try {
|
|
605604
605990
|
await (0, import_promises36.access)(bufLockPath);
|
|
605605
605991
|
} catch {
|
|
605606
|
-
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.");
|
|
605992
|
+
this.context.failAndThrow("Air-gapped mode requires a pre-cached buf.lock file. Please run 'buf dep update' at build time to cache dependencies.", void 0, { code: CliError.Code.InternalError });
|
|
605607
605993
|
}
|
|
605608
605994
|
} else {
|
|
605609
605995
|
await buf(["dep", "update"]);
|
|
@@ -605616,7 +606002,9 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605616
606002
|
}
|
|
605617
606003
|
const bufGenerateResult = await buf(["generate", target.toString()]);
|
|
605618
606004
|
if (bufGenerateResult.exitCode !== 0) {
|
|
605619
|
-
this.context.failAndThrow(bufGenerateResult.stderr
|
|
606005
|
+
this.context.failAndThrow(bufGenerateResult.stderr, void 0, {
|
|
606006
|
+
code: CliError.Code.IrConversionError
|
|
606007
|
+
});
|
|
605620
606008
|
}
|
|
605621
606009
|
if (cleanupBufLock) {
|
|
605622
606010
|
await (0, import_promises36.unlink)(bufLockPath);
|
|
@@ -605654,7 +606042,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605654
606042
|
this.protocGenOpenAPIResolved = true;
|
|
605655
606043
|
return;
|
|
605656
606044
|
} catch {
|
|
605657
|
-
this.context.failAndThrow("FERN_USE_LOCAL_PROTOC_GEN_OPENAPI is set but protoc-gen-openapi was not found on PATH.");
|
|
606045
|
+
this.context.failAndThrow("FERN_USE_LOCAL_PROTOC_GEN_OPENAPI is set but protoc-gen-openapi was not found on PATH.", void 0, { code: CliError.Code.EnvironmentError });
|
|
605658
606046
|
}
|
|
605659
606047
|
}
|
|
605660
606048
|
this.context.logger.debug("Resolving protoc-gen-openapi (preferring auto-downloaded fern fork)");
|
|
@@ -605679,7 +606067,7 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605679
606067
|
}
|
|
605680
606068
|
this.protocGenOpenAPIResolved = true;
|
|
605681
606069
|
} catch {
|
|
605682
|
-
this.context.failAndThrow("Missing required dependency; please install 'protoc-gen-openapi' to continue (e.g. 'brew install go && go install github.com/fern-api/protoc-gen-openapi/cmd/protoc-gen-openapi@latest').");
|
|
606070
|
+
this.context.failAndThrow("Missing required dependency; please install 'protoc-gen-openapi' to continue (e.g. 'brew install go && go install github.com/fern-api/protoc-gen-openapi/cmd/protoc-gen-openapi@latest').", void 0, { code: CliError.Code.EnvironmentError });
|
|
605683
606071
|
}
|
|
605684
606072
|
}
|
|
605685
606073
|
async ensureBufResolved() {
|
|
@@ -605689,11 +606077,15 @@ var ProtobufOpenAPIGenerator = class {
|
|
|
605689
606077
|
try {
|
|
605690
606078
|
this.resolvedBufCommand = await ensureBufCommand(this.context.logger);
|
|
605691
606079
|
} catch (error50) {
|
|
605692
|
-
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50)
|
|
606080
|
+
this.context.failAndThrow(error50 instanceof Error ? error50.message : String(error50), void 0, {
|
|
606081
|
+
code: CliError.Code.EnvironmentError
|
|
606082
|
+
});
|
|
605693
606083
|
}
|
|
605694
606084
|
}
|
|
605695
606085
|
async generateRemote() {
|
|
605696
|
-
this.context.failAndThrow("Remote Protobuf generation is unimplemented."
|
|
606086
|
+
this.context.failAndThrow("Remote Protobuf generation is unimplemented.", void 0, {
|
|
606087
|
+
code: CliError.Code.InternalError
|
|
606088
|
+
});
|
|
605697
606089
|
}
|
|
605698
606090
|
};
|
|
605699
606091
|
function getProtobufGeneratorConfig({ relativeFilepathToProtobufRoot }) {
|
|
@@ -606072,7 +606464,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606072
606464
|
}
|
|
606073
606465
|
}
|
|
606074
606466
|
if (mergedIr === void 0) {
|
|
606075
|
-
throw new
|
|
606467
|
+
throw new CliError({
|
|
606468
|
+
message: "Failed to generate intermediate representation",
|
|
606469
|
+
code: CliError.Code.IrConversionError
|
|
606470
|
+
});
|
|
606076
606471
|
}
|
|
606077
606472
|
if (authOverrides != null) {
|
|
606078
606473
|
mergedIr = resolveOAuthEndpointReferences({ ir: mergedIr, authOverrides });
|
|
@@ -606168,7 +606563,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606168
606563
|
}
|
|
606169
606564
|
async convertSpecsOverrideToSpecs(specsOverride) {
|
|
606170
606565
|
if (!Array.isArray(specsOverride)) {
|
|
606171
|
-
throw new
|
|
606566
|
+
throw new CliError({
|
|
606567
|
+
message: "Conjure specs override is not yet supported",
|
|
606568
|
+
code: CliError.Code.InternalError
|
|
606569
|
+
});
|
|
606172
606570
|
}
|
|
606173
606571
|
const specs = [];
|
|
606174
606572
|
for (const spec of specsOverride) {
|
|
@@ -606202,7 +606600,10 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
|
|
|
606202
606600
|
};
|
|
606203
606601
|
specs.push(openApiSpec);
|
|
606204
606602
|
} else {
|
|
606205
|
-
throw new
|
|
606603
|
+
throw new CliError({
|
|
606604
|
+
message: `Spec type override not yet supported. Only OpenAPI specs are currently supported in specs override.`,
|
|
606605
|
+
code: CliError.Code.InternalError
|
|
606606
|
+
});
|
|
606206
606607
|
}
|
|
606207
606608
|
}
|
|
606208
606609
|
return specs;
|
|
@@ -614334,7 +614735,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614334
614735
|
properties: {
|
|
614335
614736
|
...event,
|
|
614336
614737
|
...event.properties,
|
|
614337
|
-
version: "4.
|
|
614738
|
+
version: "4.82.0-1-g000d7384e60",
|
|
614338
614739
|
usingAccessToken: true
|
|
614339
614740
|
}
|
|
614340
614741
|
});
|
|
@@ -614388,7 +614789,7 @@ var UserPosthogManager = class {
|
|
|
614388
614789
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614389
614790
|
event: "CLI",
|
|
614390
614791
|
properties: {
|
|
614391
|
-
version: "4.
|
|
614792
|
+
version: "4.82.0-1-g000d7384e60",
|
|
614392
614793
|
...event,
|
|
614393
614794
|
...event.properties,
|
|
614394
614795
|
usingAccessToken: false,
|
|
@@ -615592,7 +615993,10 @@ var PlatformKeyring = class {
|
|
|
615592
615993
|
await this.setPasswordWindows(service, account, password);
|
|
615593
615994
|
break;
|
|
615594
615995
|
default:
|
|
615595
|
-
throw new
|
|
615996
|
+
throw new CliError({
|
|
615997
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
615998
|
+
code: CliError.Code.EnvironmentError
|
|
615999
|
+
});
|
|
615596
616000
|
}
|
|
615597
616001
|
}
|
|
615598
616002
|
async getPassword(service, account) {
|
|
@@ -615604,7 +616008,10 @@ var PlatformKeyring = class {
|
|
|
615604
616008
|
case "win32":
|
|
615605
616009
|
return this.getPasswordWindows(service, account);
|
|
615606
616010
|
default:
|
|
615607
|
-
throw new
|
|
616011
|
+
throw new CliError({
|
|
616012
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
616013
|
+
code: CliError.Code.EnvironmentError
|
|
616014
|
+
});
|
|
615608
616015
|
}
|
|
615609
616016
|
}
|
|
615610
616017
|
async deletePassword(service, account) {
|
|
@@ -615616,7 +616023,10 @@ var PlatformKeyring = class {
|
|
|
615616
616023
|
case "win32":
|
|
615617
616024
|
return this.deletePasswordWindows(service, account);
|
|
615618
616025
|
default:
|
|
615619
|
-
throw new
|
|
616026
|
+
throw new CliError({
|
|
616027
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
616028
|
+
code: CliError.Code.EnvironmentError
|
|
616029
|
+
});
|
|
615620
616030
|
}
|
|
615621
616031
|
}
|
|
615622
616032
|
async findCredentials(service) {
|
|
@@ -615628,7 +616038,10 @@ var PlatformKeyring = class {
|
|
|
615628
616038
|
case "win32":
|
|
615629
616039
|
return this.findCredentialsWindows(service);
|
|
615630
616040
|
default:
|
|
615631
|
-
throw new
|
|
616041
|
+
throw new CliError({
|
|
616042
|
+
message: `Unsupported platform: ${process.platform}`,
|
|
616043
|
+
code: CliError.Code.EnvironmentError
|
|
616044
|
+
});
|
|
615632
616045
|
}
|
|
615633
616046
|
}
|
|
615634
616047
|
async setPasswordDarwin(service, account, password) {
|
|
@@ -617741,7 +618154,10 @@ var FileFinder = class {
|
|
|
617741
618154
|
async findOrThrow({ filename, remediationMessage }) {
|
|
617742
618155
|
const filepath = await this.find({ filename });
|
|
617743
618156
|
if (filepath == null) {
|
|
617744
|
-
throw new
|
|
618157
|
+
throw new CliError({
|
|
618158
|
+
message: `${filename} file not found in any parent directory from ${this.from}`,
|
|
618159
|
+
code: CliError.Code.InternalError
|
|
618160
|
+
});
|
|
617745
618161
|
}
|
|
617746
618162
|
return filepath;
|
|
617747
618163
|
}
|
|
@@ -617783,7 +618199,10 @@ var FernYmlSchemaLoader = class {
|
|
|
617783
618199
|
async loadOrThrow() {
|
|
617784
618200
|
const loadResult = await this.load();
|
|
617785
618201
|
if (loadResult.type === "notFound") {
|
|
617786
|
-
throw new
|
|
618202
|
+
throw new CliError({
|
|
618203
|
+
message: `${FILENAME2} file not found in any parent directory; did you forget to run \`fern init\`?`,
|
|
618204
|
+
code: CliError.Code.InternalError
|
|
618205
|
+
});
|
|
617787
618206
|
}
|
|
617788
618207
|
if (loadResult.type === "failure") {
|
|
617789
618208
|
throw new SourcedValidationError(loadResult.issues);
|
|
@@ -617854,7 +618273,10 @@ var TelemetryClient = class _TelemetryClient {
|
|
|
617854
618273
|
if (sentryDsn != null && sentryDsn.length > 0 && isTelemetryEnabled) {
|
|
617855
618274
|
const sentryEnvironment = "development";
|
|
617856
618275
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
617857
|
-
throw new
|
|
618276
|
+
throw new CliError({
|
|
618277
|
+
message: "SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",
|
|
618278
|
+
code: CliError.Code.ConfigError
|
|
618279
|
+
});
|
|
617858
618280
|
}
|
|
617859
618281
|
this.sentry = init2({
|
|
617860
618282
|
dsn: sentryDsn,
|
|
@@ -617972,7 +618394,7 @@ var TelemetryClient = class _TelemetryClient {
|
|
|
617972
618394
|
return join8(AbsoluteFilePath2.of((0, import_os8.homedir)()), RelativeFilePath2.of(".fern"), RelativeFilePath2.of("id"));
|
|
617973
618395
|
}
|
|
617974
618396
|
/**
|
|
617975
|
-
* Returns true if telemetry
|
|
618397
|
+
* Returns true if telemetry is enabled.
|
|
617976
618398
|
*
|
|
617977
618399
|
* Priority:
|
|
617978
618400
|
* 1. FERN_TELEMETRY_DISABLED env var (any non-empty value)
|
|
@@ -618154,7 +618576,10 @@ var ApiDefinitionConverter = class {
|
|
|
618154
618576
|
sourced
|
|
618155
618577
|
});
|
|
618156
618578
|
}
|
|
618157
|
-
throw new
|
|
618579
|
+
throw new CliError({
|
|
618580
|
+
message: `Unknown spec type: ${JSON.stringify(spec)}`,
|
|
618581
|
+
code: CliError.Code.InternalError
|
|
618582
|
+
});
|
|
618158
618583
|
}
|
|
618159
618584
|
async convertOpenApiSpec({ absoluteFernYmlPath, spec, sourced }) {
|
|
618160
618585
|
const result = {
|
|
@@ -619514,7 +619939,10 @@ var LegacyApiSpecAdapter = class {
|
|
|
619514
619939
|
if (isOpenRpcSpec(spec)) {
|
|
619515
619940
|
return this.adaptOpenRpcSpec(spec);
|
|
619516
619941
|
}
|
|
619517
|
-
throw new
|
|
619942
|
+
throw new CliError({
|
|
619943
|
+
message: `Unsupported spec type: ${JSON.stringify(spec)}`,
|
|
619944
|
+
code: CliError.Code.InternalError
|
|
619945
|
+
});
|
|
619518
619946
|
}
|
|
619519
619947
|
convertAll(specs) {
|
|
619520
619948
|
return specs.map((spec) => this.adapt(spec));
|
|
@@ -746323,7 +746751,7 @@ function inflateIr(ir10, casingsGenerator) {
|
|
|
746323
746751
|
serviceTypeReferenceInfo: ir10.serviceTypeReferenceInfo,
|
|
746324
746752
|
readmeConfig: ir10.readmeConfig,
|
|
746325
746753
|
sourceConfig: ir10.sourceConfig,
|
|
746326
|
-
publishConfig: ir10.publishConfig,
|
|
746754
|
+
publishConfig: ir10.publishConfig != null ? convertPublishConfig2(ir10.publishConfig) : void 0,
|
|
746327
746755
|
dynamic: ir10.dynamic != null ? inflateDynamicIr(ir10.dynamic) : void 0,
|
|
746328
746756
|
selfHosted: ir10.selfHosted,
|
|
746329
746757
|
audiences: ir10.audiences,
|
|
@@ -746340,6 +746768,43 @@ function inflateIr(ir10, casingsGenerator) {
|
|
|
746340
746768
|
apiPlayground: ir10.apiPlayground
|
|
746341
746769
|
};
|
|
746342
746770
|
}
|
|
746771
|
+
function convertPublishConfig2(publishConfig) {
|
|
746772
|
+
return IrVersions_exports.V66.PublishingConfig._visit(publishConfig, {
|
|
746773
|
+
github: (github) => {
|
|
746774
|
+
const convertedTarget = convertPublishTarget3(github.target);
|
|
746775
|
+
return convertedTarget != null ? IrVersions_exports.V65.PublishingConfig.github({
|
|
746776
|
+
...github,
|
|
746777
|
+
target: convertedTarget
|
|
746778
|
+
}) : void 0;
|
|
746779
|
+
},
|
|
746780
|
+
direct: (direct) => {
|
|
746781
|
+
const convertedTarget = convertPublishTarget3(direct.target);
|
|
746782
|
+
return convertedTarget != null ? IrVersions_exports.V65.PublishingConfig.direct({
|
|
746783
|
+
target: convertedTarget
|
|
746784
|
+
}) : void 0;
|
|
746785
|
+
},
|
|
746786
|
+
filesystem: (filesystem) => {
|
|
746787
|
+
const convertedTarget = filesystem.publishTarget != null ? convertPublishTarget3(filesystem.publishTarget) : void 0;
|
|
746788
|
+
return IrVersions_exports.V65.PublishingConfig.filesystem({
|
|
746789
|
+
generateFullProject: filesystem.generateFullProject,
|
|
746790
|
+
publishTarget: convertedTarget
|
|
746791
|
+
});
|
|
746792
|
+
},
|
|
746793
|
+
_other: () => void 0
|
|
746794
|
+
});
|
|
746795
|
+
}
|
|
746796
|
+
function convertPublishTarget3(target) {
|
|
746797
|
+
return IrVersions_exports.V66.PublishTarget._visit(target, {
|
|
746798
|
+
postman: IrVersions_exports.V65.PublishTarget.postman,
|
|
746799
|
+
npm: IrVersions_exports.V65.PublishTarget.npm,
|
|
746800
|
+
maven: IrVersions_exports.V65.PublishTarget.maven,
|
|
746801
|
+
pypi: IrVersions_exports.V65.PublishTarget.pypi,
|
|
746802
|
+
crates: IrVersions_exports.V65.PublishTarget.crates,
|
|
746803
|
+
// go publish target is not supported in v65, return undefined
|
|
746804
|
+
go: () => void 0,
|
|
746805
|
+
_other: () => void 0
|
|
746806
|
+
});
|
|
746807
|
+
}
|
|
746343
746808
|
|
|
746344
746809
|
// ../generation/ir-migrations/lib/IntermediateRepresentationMigrator.js
|
|
746345
746810
|
function getIntermediateRepresentationMigrator() {
|
|
@@ -746626,7 +747091,10 @@ var LegacyFernWorkspaceAdapter = class {
|
|
|
746626
747091
|
generatorsConfiguration: apiConfig != null ? this.buildGeneratorsConfiguration(apiConfig) : void 0
|
|
746627
747092
|
});
|
|
746628
747093
|
if (ossWorkspace == null) {
|
|
746629
|
-
throw new
|
|
747094
|
+
throw new CliError({
|
|
747095
|
+
message: "Internal error; failed to build API definitions",
|
|
747096
|
+
code: CliError.Code.InternalError
|
|
747097
|
+
});
|
|
746630
747098
|
}
|
|
746631
747099
|
return ossWorkspace.toFernWorkspace({ context: this.taskContext });
|
|
746632
747100
|
}
|
|
@@ -747783,7 +748251,10 @@ function addSplitCommand(cli) {
|
|
|
747783
748251
|
description: `Output format: '${OVERLAY_NAME}' (OpenAPI Overlay 1.0.0) or '${OVERRIDES_NAME}' (Fern deep-merge)`
|
|
747784
748252
|
}).coerce("format", (value2) => {
|
|
747785
748253
|
if (!ALL_FORMAT_NAMES.includes(value2)) {
|
|
747786
|
-
throw new
|
|
748254
|
+
throw new CliError({
|
|
748255
|
+
message: `Invalid format '${value2}'. Expected one of: ${OVERLAY_NAME}, ${OVERRIDES_NAME}`,
|
|
748256
|
+
code: CliError.Code.ValidationError
|
|
748257
|
+
});
|
|
747787
748258
|
}
|
|
747788
748259
|
return value2;
|
|
747789
748260
|
}));
|
|
@@ -788146,7 +788617,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788146
788617
|
this.context = context3;
|
|
788147
788618
|
const lambdaOrigin = "https://ykq45y6fvnszd35iv5yuuatkze0rpwuz.lambda-url.us-east-1.on.aws";
|
|
788148
788619
|
if (!lambdaOrigin) {
|
|
788149
|
-
throw new
|
|
788620
|
+
throw new CliError({
|
|
788621
|
+
message: "DEFAULT_FDR_LAMBDA_DOCS_ORIGIN environment variable is not set. AI example enhancement requires this to be configured.",
|
|
788622
|
+
code: CliError.Code.EnvironmentError
|
|
788623
|
+
});
|
|
788150
788624
|
}
|
|
788151
788625
|
this.lambdaOrigin = lambdaOrigin;
|
|
788152
788626
|
this.venusOrigin = "https://venus-dev2.buildwithfern.com";
|
|
@@ -788215,7 +788689,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788215
788689
|
});
|
|
788216
788690
|
if (!response.ok) {
|
|
788217
788691
|
const errorText = await response.text();
|
|
788218
|
-
throw new
|
|
788692
|
+
throw new CliError({
|
|
788693
|
+
message: `Failed to fetch JWT from Venus: ${response.status} ${errorText || response.statusText}`,
|
|
788694
|
+
code: CliError.Code.NetworkError
|
|
788695
|
+
});
|
|
788219
788696
|
}
|
|
788220
788697
|
const result = await response.json();
|
|
788221
788698
|
this.context.logger.debug(`Successfully obtained JWT from Venus (expires at ${result.expiresAt})`);
|
|
@@ -788277,7 +788754,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788277
788754
|
});
|
|
788278
788755
|
if (!response.ok) {
|
|
788279
788756
|
const errorText = await response.text();
|
|
788280
|
-
throw new
|
|
788757
|
+
throw new CliError({
|
|
788758
|
+
message: `Lambda returned ${response.status}: ${errorText || response.statusText}`,
|
|
788759
|
+
code: CliError.Code.NetworkError
|
|
788760
|
+
});
|
|
788281
788761
|
}
|
|
788282
788762
|
const result = await response.json();
|
|
788283
788763
|
return {
|
|
@@ -789790,7 +790270,10 @@ function convertTypeShape(irType) {
|
|
|
789790
790270
|
extraProperties: void 0
|
|
789791
790271
|
}),
|
|
789792
790272
|
_other: () => {
|
|
789793
|
-
throw new
|
|
790273
|
+
throw new CliError({
|
|
790274
|
+
message: "Unknown SingleUnionTypeProperties: " + variant.shape.propertiesType,
|
|
790275
|
+
code: CliError.Code.InternalError
|
|
790276
|
+
});
|
|
789794
790277
|
}
|
|
789795
790278
|
})
|
|
789796
790279
|
};
|
|
@@ -789815,7 +790298,7 @@ function convertTypeShape(irType) {
|
|
|
789815
790298
|
};
|
|
789816
790299
|
},
|
|
789817
790300
|
_other: () => {
|
|
789818
|
-
throw new
|
|
790301
|
+
throw new CliError({ message: "Unknown Type shape: " + irType.type, code: CliError.Code.InternalError });
|
|
789819
790302
|
}
|
|
789820
790303
|
});
|
|
789821
790304
|
}
|
|
@@ -789882,12 +790365,18 @@ function convertTypeReference3(irTypeReference) {
|
|
|
789882
790365
|
};
|
|
789883
790366
|
},
|
|
789884
790367
|
_other: () => {
|
|
789885
|
-
throw new
|
|
790368
|
+
throw new CliError({
|
|
790369
|
+
message: "Unknown literal type: " + literal3.type,
|
|
790370
|
+
code: CliError.Code.InternalError
|
|
790371
|
+
});
|
|
789886
790372
|
}
|
|
789887
790373
|
});
|
|
789888
790374
|
},
|
|
789889
790375
|
_other: () => {
|
|
789890
|
-
throw new
|
|
790376
|
+
throw new CliError({
|
|
790377
|
+
message: "Unknown container reference: " + container.type,
|
|
790378
|
+
code: CliError.Code.InternalError
|
|
790379
|
+
});
|
|
789891
790380
|
}
|
|
789892
790381
|
});
|
|
789893
790382
|
},
|
|
@@ -789967,7 +790456,10 @@ function convertTypeReference3(irTypeReference) {
|
|
|
789967
790456
|
};
|
|
789968
790457
|
},
|
|
789969
790458
|
_other: () => {
|
|
789970
|
-
throw new
|
|
790459
|
+
throw new CliError({
|
|
790460
|
+
message: "Unknown primitive: " + primitive.v1,
|
|
790461
|
+
code: CliError.Code.InternalError
|
|
790462
|
+
});
|
|
789971
790463
|
}
|
|
789972
790464
|
})
|
|
789973
790465
|
};
|
|
@@ -789978,7 +790470,10 @@ function convertTypeReference3(irTypeReference) {
|
|
|
789978
790470
|
};
|
|
789979
790471
|
},
|
|
789980
790472
|
_other: () => {
|
|
789981
|
-
throw new
|
|
790473
|
+
throw new CliError({
|
|
790474
|
+
message: "Unknown Type reference: " + irTypeReference.type,
|
|
790475
|
+
code: CliError.Code.InternalError
|
|
790476
|
+
});
|
|
789982
790477
|
}
|
|
789983
790478
|
});
|
|
789984
790479
|
}
|
|
@@ -790442,7 +790937,10 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
|
|
|
790442
790937
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790443
790938
|
const endpointBaseUrl = singleBaseUrlEnvironment.urls[baseUrlId];
|
|
790444
790939
|
if (endpointBaseUrl == null) {
|
|
790445
|
-
throw new
|
|
790940
|
+
throw new CliError({
|
|
790941
|
+
message: `Encountered undefined server name "${baseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${baseUrlId}`,
|
|
790942
|
+
code: CliError.Code.IrConversionError
|
|
790943
|
+
});
|
|
790446
790944
|
}
|
|
790447
790945
|
return {
|
|
790448
790946
|
id: FdrAPI_exports.EnvironmentId(baseUrlId),
|
|
@@ -790454,12 +790952,18 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
|
|
|
790454
790952
|
return environments2.filter((environment2, index3, self2) => index3 === self2.findIndex((t3) => t3.id === environment2.id && t3.baseUrl === environment2.baseUrl));
|
|
790455
790953
|
}
|
|
790456
790954
|
if (endpointBaseUrlId == null) {
|
|
790457
|
-
throw new
|
|
790955
|
+
throw new CliError({
|
|
790956
|
+
message: `Expected endpoint ${getOriginalName(endpoint3.name)} to have base url.`,
|
|
790957
|
+
code: CliError.Code.IrConversionError
|
|
790958
|
+
});
|
|
790458
790959
|
}
|
|
790459
790960
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790460
790961
|
const endpointBaseUrl = singleBaseUrlEnvironment.urls[endpointBaseUrlId];
|
|
790461
790962
|
if (endpointBaseUrl == null) {
|
|
790462
|
-
throw new
|
|
790963
|
+
throw new CliError({
|
|
790964
|
+
message: `Encountered undefined server name "${endpointBaseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${endpointBaseUrlId}`,
|
|
790965
|
+
code: CliError.Code.IrConversionError
|
|
790966
|
+
});
|
|
790463
790967
|
}
|
|
790464
790968
|
return {
|
|
790465
790969
|
id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
|
|
@@ -790485,12 +790989,18 @@ function convertIrWebSocketEnvironments({ environmentsConfig, channel: channel3
|
|
|
790485
790989
|
});
|
|
790486
790990
|
case "multipleBaseUrls":
|
|
790487
790991
|
if (channelBaseUrlId == null) {
|
|
790488
|
-
throw new
|
|
790992
|
+
throw new CliError({
|
|
790993
|
+
message: `Expected channel ${getOriginalName(channel3.name)} to have base url.`,
|
|
790994
|
+
code: CliError.Code.IrConversionError
|
|
790995
|
+
});
|
|
790489
790996
|
}
|
|
790490
790997
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790491
790998
|
const channelBaseUrl = singleBaseUrlEnvironment.urls[channelBaseUrlId];
|
|
790492
790999
|
if (channelBaseUrl == null) {
|
|
790493
|
-
throw new
|
|
791000
|
+
throw new CliError({
|
|
791001
|
+
message: `Encountered undefined server name ${channelBaseUrl} at channel ${getOriginalName(channel3.name)} ${channel3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${channelBaseUrlId}`,
|
|
791002
|
+
code: CliError.Code.IrConversionError
|
|
791003
|
+
});
|
|
790494
791004
|
}
|
|
790495
791005
|
return {
|
|
790496
791006
|
id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
|
|
@@ -790514,7 +791024,7 @@ function convertHttpMethod2(method8) {
|
|
|
790514
791024
|
delete: () => FdrAPI_exports.HttpMethod.Delete,
|
|
790515
791025
|
head: () => FdrAPI_exports.HttpMethod.Head,
|
|
790516
791026
|
_other: () => {
|
|
790517
|
-
throw new
|
|
791027
|
+
throw new CliError({ message: "Unknown http method: " + method8, code: CliError.Code.InternalError });
|
|
790518
791028
|
}
|
|
790519
791029
|
});
|
|
790520
791030
|
}
|
|
@@ -790630,7 +791140,10 @@ function convertRequestBody3(irRequest) {
|
|
|
790630
791140
|
contentType: bytes.contentType
|
|
790631
791141
|
}),
|
|
790632
791142
|
_other: () => {
|
|
790633
|
-
throw new
|
|
791143
|
+
throw new CliError({
|
|
791144
|
+
message: "Unknown HttpRequestBody: " + irRequest.type,
|
|
791145
|
+
code: CliError.Code.InternalError
|
|
791146
|
+
});
|
|
790634
791147
|
}
|
|
790635
791148
|
});
|
|
790636
791149
|
return requestBodyShape != null ? { type: requestBodyShape, description: irRequest.docs } : void 0;
|
|
@@ -790684,7 +791197,10 @@ function convertResponse2(irResponse) {
|
|
|
790684
791197
|
return void 0;
|
|
790685
791198
|
},
|
|
790686
791199
|
_other: () => {
|
|
790687
|
-
throw new
|
|
791200
|
+
throw new CliError({
|
|
791201
|
+
message: "Unknown HttpResponse: " + irResponse.body,
|
|
791202
|
+
code: CliError.Code.InternalError
|
|
791203
|
+
});
|
|
790688
791204
|
}
|
|
790689
791205
|
});
|
|
790690
791206
|
}
|
|
@@ -790924,7 +791440,10 @@ function convertV2HttpEndpointExample({ shouldUseExampleName, exampleName, examp
|
|
|
790924
791440
|
return void 0;
|
|
790925
791441
|
},
|
|
790926
791442
|
_other: () => {
|
|
790927
|
-
throw new
|
|
791443
|
+
throw new CliError({
|
|
791444
|
+
message: "Unknown ExampleResponseBody: " + example.response?.body?.type,
|
|
791445
|
+
code: CliError.Code.InternalError
|
|
791446
|
+
});
|
|
790928
791447
|
}
|
|
790929
791448
|
}) : void 0,
|
|
790930
791449
|
codeSamples: example.codeSamples?.map((codeSample) => ({
|
|
@@ -791050,18 +791569,27 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
791050
791569
|
stream: (stream5) => stream5.length > 0 ? 200 : 204,
|
|
791051
791570
|
sse: (stream5) => stream5.length > 0 ? 200 : 204,
|
|
791052
791571
|
_other: () => {
|
|
791053
|
-
throw new
|
|
791572
|
+
throw new CliError({
|
|
791573
|
+
message: "Unknown ExampleResponseBody: " + ok3.type,
|
|
791574
|
+
code: CliError.Code.InternalError
|
|
791575
|
+
});
|
|
791054
791576
|
}
|
|
791055
791577
|
}),
|
|
791056
791578
|
error: ({ error: errorName }) => {
|
|
791057
791579
|
const error50 = ir10.errors[errorName.errorId];
|
|
791058
791580
|
if (error50 == null) {
|
|
791059
|
-
throw new
|
|
791581
|
+
throw new CliError({
|
|
791582
|
+
message: "Cannot find error " + errorName.errorId,
|
|
791583
|
+
code: CliError.Code.ResolutionError
|
|
791584
|
+
});
|
|
791060
791585
|
}
|
|
791061
791586
|
return error50.statusCode;
|
|
791062
791587
|
},
|
|
791063
791588
|
_other: () => {
|
|
791064
|
-
throw new
|
|
791589
|
+
throw new CliError({
|
|
791590
|
+
message: "Unknown ExampleResponse: " + example.response.type,
|
|
791591
|
+
code: CliError.Code.InternalError
|
|
791592
|
+
});
|
|
791065
791593
|
}
|
|
791066
791594
|
}),
|
|
791067
791595
|
responseBody: example.response._visit({
|
|
@@ -791083,12 +791611,18 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
791083
791611
|
value: sse.map(({ event, data: data2 }) => ({ event, data: data2.jsonExample }))
|
|
791084
791612
|
}),
|
|
791085
791613
|
_other: () => {
|
|
791086
|
-
throw new
|
|
791614
|
+
throw new CliError({
|
|
791615
|
+
message: "Unknown ExampleResponseBody: " + ok3.type,
|
|
791616
|
+
code: CliError.Code.InternalError
|
|
791617
|
+
});
|
|
791087
791618
|
}
|
|
791088
791619
|
}),
|
|
791089
791620
|
error: (error50) => error50.body != null ? { type: "json", value: error50.body.jsonExample } : void 0,
|
|
791090
791621
|
_other: () => {
|
|
791091
|
-
throw new
|
|
791622
|
+
throw new CliError({
|
|
791623
|
+
message: "Unknown ExampleResponse: " + example.response.type,
|
|
791624
|
+
code: CliError.Code.InternalError
|
|
791625
|
+
});
|
|
791092
791626
|
}
|
|
791093
791627
|
}),
|
|
791094
791628
|
// irExample.response.body != null ? { type: "json", value: irExample.response.body.jsonExample } : undefined,
|
|
@@ -791381,7 +791915,9 @@ async function registerApi({ organization, workspace, context: context3, token,
|
|
|
791381
791915
|
context3.logger.debug(`Registered API Definition ${response.apiDefinitionId}`);
|
|
791382
791916
|
return { id: response.apiDefinitionId, ir: ir10 };
|
|
791383
791917
|
} catch (error50) {
|
|
791384
|
-
return context3.failAndThrow("Failed to register API", error50
|
|
791918
|
+
return context3.failAndThrow("Failed to register API", error50, {
|
|
791919
|
+
code: CliError.Code.NetworkError
|
|
791920
|
+
});
|
|
791385
791921
|
}
|
|
791386
791922
|
}
|
|
791387
791923
|
|
|
@@ -827835,7 +828371,7 @@ var DocsWorkspaceValidator = class {
|
|
|
827835
828371
|
const startTime = performance.now();
|
|
827836
828372
|
if (workspace.config.settings?.substituteEnvVars) {
|
|
827837
828373
|
workspace.config = replaceEnvVariables(workspace.config, {
|
|
827838
|
-
onError: (error50) => this.taskContext.failAndThrow(error50)
|
|
828374
|
+
onError: (error50) => this.taskContext.failAndThrow(error50, void 0, { code: CliError.Code.ConfigError })
|
|
827839
828375
|
});
|
|
827840
828376
|
}
|
|
827841
828377
|
const violations = await validateDocsWorkspace(workspace, this.taskContext, apiWorkspaces, ossWorkspaces, false, excludeRules);
|
|
@@ -831669,7 +832205,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
831669
832205
|
var LOGS_FOLDER_NAME = "logs";
|
|
831670
832206
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
831671
832207
|
function getCliSource() {
|
|
831672
|
-
const version7 = "4.
|
|
832208
|
+
const version7 = "4.82.0-1-g000d7384e60";
|
|
831673
832209
|
return `cli@${version7}`;
|
|
831674
832210
|
}
|
|
831675
832211
|
var DebugLogger = class {
|
|
@@ -841067,7 +841603,10 @@ async function retryWithRateLimit({ fn: fn10, retryRateLimited, logger: logger4,
|
|
|
841067
841603
|
}
|
|
841068
841604
|
}
|
|
841069
841605
|
}
|
|
841070
|
-
throw new
|
|
841606
|
+
throw new CliError({
|
|
841607
|
+
message: "Exceeded maximum retries for 429 Too Many Requests.",
|
|
841608
|
+
code: CliError.Code.InternalError
|
|
841609
|
+
});
|
|
841071
841610
|
}
|
|
841072
841611
|
|
|
841073
841612
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
@@ -841080,7 +841619,9 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
841080
841619
|
try {
|
|
841081
841620
|
fernignoreContents = await (0, import_promises86.readFile)(fernignorePath, "utf-8");
|
|
841082
841621
|
} catch (error50) {
|
|
841083
|
-
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}
|
|
841622
|
+
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`, void 0, {
|
|
841623
|
+
code: CliError.Code.ConfigError
|
|
841624
|
+
});
|
|
841084
841625
|
}
|
|
841085
841626
|
}
|
|
841086
841627
|
const job = await retryWithRateLimit({
|
|
@@ -841103,7 +841644,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
841103
841644
|
}),
|
|
841104
841645
|
retryRateLimited,
|
|
841105
841646
|
logger: context3.logger,
|
|
841106
|
-
onRateLimitedWithoutRetry: () => context3.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.")
|
|
841647
|
+
onRateLimitedWithoutRetry: () => context3.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.", void 0, { code: CliError.Code.NetworkError })
|
|
841107
841648
|
});
|
|
841108
841649
|
await startJob({ intermediateRepresentation, job, context: context3, generatorInvocation, irVersionOverride });
|
|
841109
841650
|
return job;
|
|
@@ -841153,33 +841694,35 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
841153
841694
|
}
|
|
841154
841695
|
return convertCreateJobError(rawError)._visit({
|
|
841155
841696
|
illegalApiNameError: () => {
|
|
841156
|
-
return context3.failAndThrow("API name is invalid: " + workspace.definition.rootApiFile.contents.name);
|
|
841697
|
+
return context3.failAndThrow("API name is invalid: " + workspace.definition.rootApiFile.contents.name, void 0, { code: CliError.Code.ConfigError });
|
|
841157
841698
|
},
|
|
841158
841699
|
illegalApiVersionError: () => {
|
|
841159
|
-
return context3.failAndThrow("API version is invalid: " + version7
|
|
841700
|
+
return context3.failAndThrow("API version is invalid: " + version7, void 0, {
|
|
841701
|
+
code: CliError.Code.ConfigError
|
|
841702
|
+
});
|
|
841160
841703
|
},
|
|
841161
841704
|
cannotPublishToNpmScope: ({ validScope, invalidScope }) => {
|
|
841162
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidScope} (expected ${validScope})
|
|
841705
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidScope} (expected ${validScope})`, void 0, { code: CliError.Code.AuthError });
|
|
841163
841706
|
},
|
|
841164
841707
|
cannotPublishToMavenGroup: ({ validGroup, invalidGroup }) => {
|
|
841165
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidGroup} (expected ${validGroup})
|
|
841708
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidGroup} (expected ${validGroup})`, void 0, { code: CliError.Code.AuthError });
|
|
841166
841709
|
},
|
|
841167
841710
|
cannotPublishPypiPackage: ({ validPrefix, invalidPackageName }) => {
|
|
841168
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidPackageName} (expected ${validPrefix})
|
|
841711
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidPackageName} (expected ${validPrefix})`, void 0, { code: CliError.Code.AuthError });
|
|
841169
841712
|
},
|
|
841170
841713
|
generatorsDoNotExistError: (value2) => {
|
|
841171
|
-
return context3.failAndThrow("Generators do not exist: " + value2.nonExistentGenerators.map((generator) => `${generator.id}@${generator.version}`).join(", "));
|
|
841714
|
+
return context3.failAndThrow("Generators do not exist: " + value2.nonExistentGenerators.map((generator) => `${generator.id}@${generator.version}`).join(", "), void 0, { code: CliError.Code.ConfigError });
|
|
841172
841715
|
},
|
|
841173
841716
|
insufficientPermissions: () => {
|
|
841174
841717
|
return context3.failAndThrow(`You do not have permission to run this generator for organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
841175
841718
|
|
|
841176
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not
|
|
841719
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`, void 0, { code: CliError.Code.AuthError });
|
|
841177
841720
|
},
|
|
841178
841721
|
orgNotConfiguredForWhitelabel: () => {
|
|
841179
|
-
return context3.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com.");
|
|
841722
|
+
return context3.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com.", void 0, { code: CliError.Code.AuthError });
|
|
841180
841723
|
},
|
|
841181
841724
|
branchDoesNotExist: (value2) => {
|
|
841182
|
-
return context3.failAndThrow(`Branch ${value2.branch} does not exist in repository ${value2.repositoryOwner}/${value2.repositoryName}
|
|
841725
|
+
return context3.failAndThrow(`Branch ${value2.branch} does not exist in repository ${value2.repositoryOwner}/${value2.repositoryName}`, void 0, { code: CliError.Code.ConfigError });
|
|
841183
841726
|
},
|
|
841184
841727
|
rateLimitExceeded: () => {
|
|
841185
841728
|
throw new TooManyRequestsError();
|
|
@@ -841188,9 +841731,9 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
|
|
|
841188
841731
|
context3.logger.debug(`Failed to create job: ${JSON.stringify(content5)}`);
|
|
841189
841732
|
const errorMessage = extractErrorMessage2(content5);
|
|
841190
841733
|
if (errorMessage != null) {
|
|
841191
|
-
return context3.failAndThrow(errorMessage);
|
|
841734
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.NetworkError });
|
|
841192
841735
|
}
|
|
841193
|
-
return context3.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.");
|
|
841736
|
+
return context3.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.", void 0, { code: CliError.Code.NetworkError });
|
|
841194
841737
|
}
|
|
841195
841738
|
});
|
|
841196
841739
|
}
|
|
@@ -841235,7 +841778,7 @@ async function startJob({ intermediateRepresentation, generatorInvocation, job,
|
|
|
841235
841778
|
} catch (error50) {
|
|
841236
841779
|
const errorBody = error50 instanceof AxiosError2 ? error50.response?.data : error50;
|
|
841237
841780
|
context3.logger.debug(`POST ${url3} failed with ${JSON.stringify(error50)}`);
|
|
841238
|
-
context3.failAndThrow("Failed to start job", errorBody);
|
|
841781
|
+
context3.failAndThrow("Failed to start job", errorBody, { code: CliError.Code.NetworkError });
|
|
841239
841782
|
}
|
|
841240
841783
|
}
|
|
841241
841784
|
function extractErrorMessage2(error50) {
|
|
@@ -841302,7 +841845,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context3 })
|
|
|
841302
841845
|
if (taskStatus == null) {
|
|
841303
841846
|
numConsecutiveFailed++;
|
|
841304
841847
|
if (numConsecutiveFailed === MAX_UNSUCCESSFUL_ATTEMPTS) {
|
|
841305
|
-
context3.failAndThrow(`Failed to get job status after ${numConsecutiveFailed} attempts
|
|
841848
|
+
context3.failAndThrow(`Failed to get job status after ${numConsecutiveFailed} attempts.`, void 0, {
|
|
841849
|
+
code: CliError.Code.NetworkError
|
|
841850
|
+
});
|
|
841306
841851
|
}
|
|
841307
841852
|
setTimeout(pollForStatus, 2e3 + 1e3 * numConsecutiveFailed);
|
|
841308
841853
|
} else {
|
|
@@ -841359,7 +841904,9 @@ var RemoteTaskHandler = class {
|
|
|
841359
841904
|
}
|
|
841360
841905
|
async processUpdate(remoteTask2) {
|
|
841361
841906
|
if (remoteTask2 == null) {
|
|
841362
|
-
this.context.failAndThrow("Task is missing on job status"
|
|
841907
|
+
this.context.failAndThrow("Task is missing on job status", void 0, {
|
|
841908
|
+
code: CliError.Code.InternalError
|
|
841909
|
+
});
|
|
841363
841910
|
}
|
|
841364
841911
|
const coordinates = remoteTask2.packages.map((p9) => {
|
|
841365
841912
|
return p9.coordinate._visit({
|
|
@@ -841410,7 +841957,7 @@ var RemoteTaskHandler = class {
|
|
|
841410
841957
|
if (s3PreSignedReadUrl != null) {
|
|
841411
841958
|
logS3Url(s3PreSignedReadUrl);
|
|
841412
841959
|
}
|
|
841413
|
-
this.context.failAndThrow(message);
|
|
841960
|
+
this.context.failAndThrow(message, void 0, { code: CliError.Code.ContainerError });
|
|
841414
841961
|
},
|
|
841415
841962
|
finished: async (finishedStatus) => {
|
|
841416
841963
|
if (finishedStatus.s3PreSignedReadUrlV2 != null) {
|
|
@@ -841487,7 +842034,7 @@ async function downloadFilesForTask({ s3PreSignedReadUrl, absolutePathToLocalOut
|
|
|
841487
842034
|
}
|
|
841488
842035
|
context3.logger.info(source_default.green(`Downloaded to ${absolutePathToLocalOutput}`));
|
|
841489
842036
|
} catch (e5) {
|
|
841490
|
-
context3.failAndThrow("Failed to download files", e5);
|
|
842037
|
+
context3.failAndThrow("Failed to download files", e5, { code: CliError.Code.NetworkError });
|
|
841491
842038
|
}
|
|
841492
842039
|
}
|
|
841493
842040
|
async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutput }) {
|
|
@@ -841664,7 +842211,7 @@ var SourceUploader = class {
|
|
|
841664
842211
|
});
|
|
841665
842212
|
await uploadCommand.cleanup();
|
|
841666
842213
|
if (!response.ok) {
|
|
841667
|
-
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}
|
|
842214
|
+
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}`, void 0, { code: CliError.Code.NetworkError });
|
|
841668
842215
|
}
|
|
841669
842216
|
}
|
|
841670
842217
|
async getUploadCommand(source2) {
|
|
@@ -841719,7 +842266,7 @@ var SourceUploader = class {
|
|
|
841719
842266
|
getSourceOrThrow(id) {
|
|
841720
842267
|
const source2 = this.sources[id];
|
|
841721
842268
|
if (source2 == null) {
|
|
841722
|
-
this.context.failAndThrow(`Internal error; server responded with source id "${id}" which does not exist in the workspace
|
|
842269
|
+
this.context.failAndThrow(`Internal error; server responded with source id "${id}" which does not exist in the workspace.`, void 0, { code: CliError.Code.InternalError });
|
|
841723
842270
|
}
|
|
841724
842271
|
return source2;
|
|
841725
842272
|
}
|
|
@@ -841735,7 +842282,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841735
842282
|
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
|
|
841736
842283
|
onError: (e5) => {
|
|
841737
842284
|
if (!isPreview && requireEnvVars) {
|
|
841738
|
-
interactiveTaskContext.failAndThrow(e5
|
|
842285
|
+
interactiveTaskContext.failAndThrow(void 0, e5, {
|
|
842286
|
+
code: CliError.Code.EnvironmentError
|
|
842287
|
+
});
|
|
841739
842288
|
}
|
|
841740
842289
|
}
|
|
841741
842290
|
}, { substituteAsEmpty: isPreview });
|
|
@@ -841835,7 +842384,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841835
842384
|
}
|
|
841836
842385
|
const sourceUploader = new SourceUploader(interactiveTaskContext, sources);
|
|
841837
842386
|
if (sourceUploads == null && sourceUploader.sourceTypes.has("protobuf")) {
|
|
841838
|
-
interactiveTaskContext.failAndThrow("Did not successfully upload Protobuf source files."
|
|
842387
|
+
interactiveTaskContext.failAndThrow("Did not successfully upload Protobuf source files.", void 0, {
|
|
842388
|
+
code: CliError.Code.NetworkError
|
|
842389
|
+
});
|
|
841839
842390
|
}
|
|
841840
842391
|
if (sourceUploads != null) {
|
|
841841
842392
|
interactiveTaskContext.logger.debug("Uploading source files ...");
|
|
@@ -841846,15 +842397,21 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841846
842397
|
if (dynamicIrOnly) {
|
|
841847
842398
|
interactiveTaskContext.logger.info("Dynamic IR only mode: skipping SDK generation and uploading dynamic IR only");
|
|
841848
842399
|
if (version7 == null) {
|
|
841849
|
-
interactiveTaskContext.failAndThrow("Version is required for dynamic IR only mode"
|
|
842400
|
+
interactiveTaskContext.failAndThrow("Version is required for dynamic IR only mode", void 0, {
|
|
842401
|
+
code: CliError.Code.ConfigError
|
|
842402
|
+
});
|
|
841850
842403
|
return void 0;
|
|
841851
842404
|
}
|
|
841852
842405
|
if (generatorInvocation.language == null) {
|
|
841853
|
-
interactiveTaskContext.failAndThrow("Language is required for dynamic IR only mode"
|
|
842406
|
+
interactiveTaskContext.failAndThrow("Language is required for dynamic IR only mode", void 0, {
|
|
842407
|
+
code: CliError.Code.ConfigError
|
|
842408
|
+
});
|
|
841854
842409
|
return void 0;
|
|
841855
842410
|
}
|
|
841856
842411
|
if (packageName == null) {
|
|
841857
|
-
interactiveTaskContext.failAndThrow("Package name is required for dynamic IR only mode"
|
|
842412
|
+
interactiveTaskContext.failAndThrow("Package name is required for dynamic IR only mode", void 0, {
|
|
842413
|
+
code: CliError.Code.ConfigError
|
|
842414
|
+
});
|
|
841858
842415
|
return void 0;
|
|
841859
842416
|
}
|
|
841860
842417
|
try {
|
|
@@ -841870,7 +842427,7 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841870
842427
|
context: interactiveTaskContext
|
|
841871
842428
|
});
|
|
841872
842429
|
} catch (error50) {
|
|
841873
|
-
interactiveTaskContext.failAndThrow(`Failed to upload dynamic IR: ${extractErrorMessage(error50)}
|
|
842430
|
+
interactiveTaskContext.failAndThrow(`Failed to upload dynamic IR: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
|
|
841874
842431
|
}
|
|
841875
842432
|
return {
|
|
841876
842433
|
createdSnippets: false,
|
|
@@ -841906,7 +842463,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
841906
842463
|
interactiveTaskContext.logger.debug(`Job ID: ${job.jobId}`);
|
|
841907
842464
|
const taskId = job.taskIds[0];
|
|
841908
842465
|
if (taskId == null) {
|
|
841909
|
-
interactiveTaskContext.failAndThrow("Did not receive a task ID."
|
|
842466
|
+
interactiveTaskContext.failAndThrow("Did not receive a task ID.", void 0, {
|
|
842467
|
+
code: CliError.Code.NetworkError
|
|
842468
|
+
});
|
|
841910
842469
|
return void 0;
|
|
841911
842470
|
}
|
|
841912
842471
|
interactiveTaskContext.logger.debug(`Task ID: ${taskId}`);
|
|
@@ -842072,7 +842631,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
842072
842631
|
onSnippetsProduced: (invocation) => snippetsProducedBy.push(invocation)
|
|
842073
842632
|
}))));
|
|
842074
842633
|
if (automation == null && results.some((didSucceed) => !didSucceed)) {
|
|
842075
|
-
|
|
842634
|
+
throw new TaskAbortSignal();
|
|
842076
842635
|
}
|
|
842077
842636
|
return {
|
|
842078
842637
|
snippetsProducedBy
|
|
@@ -842511,9 +843070,9 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain3
|
|
|
842511
843070
|
context3.logger.error(`FDR registerApiDefinition failed. Error details:
|
|
842512
843071
|
${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
842513
843072
|
if (apiName != null) {
|
|
842514
|
-
return context3.failAndThrow(`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact support@buildwithfern.com`, errorDetails);
|
|
843073
|
+
return context3.failAndThrow(`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact support@buildwithfern.com`, errorDetails, { code: CliError.Code.NetworkError });
|
|
842515
843074
|
} else {
|
|
842516
|
-
return context3.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com`, errorDetails);
|
|
843075
|
+
return context3.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com`, errorDetails, { code: CliError.Code.NetworkError });
|
|
842517
843076
|
}
|
|
842518
843077
|
}
|
|
842519
843078
|
context3.logger.debug(`Registered API Definition ${apiName}: ${response.apiDefinitionId}`);
|
|
@@ -842540,7 +843099,7 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842540
843099
|
if (docsWorkspace.config.settings?.substituteEnvVars) {
|
|
842541
843100
|
context3.logger.debug("Applying environment variable substitution to docs definition...");
|
|
842542
843101
|
const { jsFiles, ...docsWithoutJsFiles } = docsDefinition;
|
|
842543
|
-
const substitutedDocs = replaceEnvVariables(docsWithoutJsFiles, { onError: (e5) => context3.failAndThrow(e5) }, { substituteAsEmpty: false });
|
|
843102
|
+
const substitutedDocs = replaceEnvVariables(docsWithoutJsFiles, { onError: (e5) => context3.failAndThrow(void 0, e5, { code: CliError.Code.EnvironmentError }) }, { substituteAsEmpty: false });
|
|
842544
843103
|
docsDefinition = { ...substitutedDocs, jsFiles };
|
|
842545
843104
|
}
|
|
842546
843105
|
const pageCount = Object.keys(docsDefinition.pages).length;
|
|
@@ -842550,7 +843109,9 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842550
843109
|
context3.logger.debug(`Memory after resolve: RSS=${(resolveMemory.rss / 1024 / 1024).toFixed(2)}MB, Heap=${(resolveMemory.heapUsed / 1024 / 1024).toFixed(2)}MB`);
|
|
842551
843110
|
if (docsRegistrationId == null) {
|
|
842552
843111
|
doUnlock();
|
|
842553
|
-
return context3.failAndThrow("Failed to publish docs.", "Docs registration ID is missing."
|
|
843112
|
+
return context3.failAndThrow("Failed to publish docs.", "Docs registration ID is missing.", {
|
|
843113
|
+
code: CliError.Code.InternalError
|
|
843114
|
+
});
|
|
842554
843115
|
}
|
|
842555
843116
|
context3.logger.info("Publishing docs to FDR...");
|
|
842556
843117
|
const publishStart = performance.now();
|
|
@@ -842562,7 +843123,9 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842562
843123
|
...isBasepathAware && !preview && { basepathAware: true }
|
|
842563
843124
|
});
|
|
842564
843125
|
} catch (error50) {
|
|
842565
|
-
return context3.failAndThrow("Failed to publish docs to " + domain3, error50
|
|
843126
|
+
return context3.failAndThrow("Failed to publish docs to " + domain3, error50, {
|
|
843127
|
+
code: CliError.Code.NetworkError
|
|
843128
|
+
});
|
|
842566
843129
|
}
|
|
842567
843130
|
const publishTime = performance.now() - publishStart;
|
|
842568
843131
|
context3.logger.debug(`Docs published to FDR in ${publishTime.toFixed(0)}ms`);
|
|
@@ -842622,7 +843185,9 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
842622
843185
|
}
|
|
842623
843186
|
});
|
|
842624
843187
|
} catch (e5) {
|
|
842625
|
-
context3.failAndThrow(`Failed to upload ${absoluteFilePath}`, e5
|
|
843188
|
+
context3.failAndThrow(`Failed to upload ${absoluteFilePath}`, e5, {
|
|
843189
|
+
code: CliError.Code.NetworkError
|
|
843190
|
+
});
|
|
842626
843191
|
}
|
|
842627
843192
|
}));
|
|
842628
843193
|
const endTime2 = Date.now();
|
|
@@ -842662,24 +843227,26 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842662
843227
|
}
|
|
842663
843228
|
const authErrorMessage = getAuthenticationErrorMessage(error50, organization, domain3);
|
|
842664
843229
|
if (authErrorMessage != null) {
|
|
842665
|
-
return context3.failAndThrow(authErrorMessage);
|
|
843230
|
+
return context3.failAndThrow(authErrorMessage, void 0, { code: CliError.Code.AuthError });
|
|
842666
843231
|
}
|
|
842667
843232
|
const errorType = errorObj?.error;
|
|
842668
843233
|
switch (errorType) {
|
|
842669
843234
|
case "InvalidCustomDomainError":
|
|
842670
|
-
return context3.failAndThrow(`Your docs domain should end with ${"docs.dev.buildwithfern.com"}
|
|
843235
|
+
return context3.failAndThrow(`Your docs domain should end with ${"docs.dev.buildwithfern.com"}`, void 0, { code: CliError.Code.ConfigError });
|
|
842671
843236
|
case "InvalidDomainError":
|
|
842672
|
-
return context3.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)");
|
|
843237
|
+
return context3.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)", void 0, { code: CliError.Code.ConfigError });
|
|
842673
843238
|
case "UnauthorizedError":
|
|
842674
|
-
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent)
|
|
843239
|
+
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent), void 0, {
|
|
843240
|
+
code: CliError.Code.AuthError
|
|
843241
|
+
});
|
|
842675
843242
|
case "UserNotInOrgError":
|
|
842676
843243
|
return context3.failAndThrow(`You do not belong to organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
842677
843244
|
|
|
842678
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not
|
|
843245
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`, void 0, { code: CliError.Code.AuthError });
|
|
842679
843246
|
case "UnavailableError":
|
|
842680
|
-
return context3.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.");
|
|
843247
|
+
return context3.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.", void 0, { code: CliError.Code.NetworkError });
|
|
842681
843248
|
default:
|
|
842682
|
-
return context3.failAndThrow("Failed to publish docs.", error50);
|
|
843249
|
+
return context3.failAndThrow("Failed to publish docs.", error50, { code: CliError.Code.NetworkError });
|
|
842683
843250
|
}
|
|
842684
843251
|
}
|
|
842685
843252
|
function getAuthenticationErrorMessage(error50, organization, domain3) {
|
|
@@ -843127,21 +843694,25 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
843127
843694
|
docsWorkspace.config = replaceEnvVariables(
|
|
843128
843695
|
docsWorkspace.config,
|
|
843129
843696
|
// Wrap in a closure for correct binding of `this` downstream
|
|
843130
|
-
{ onError: (e5) => context3.failAndThrow(e5) },
|
|
843697
|
+
{ onError: (e5) => context3.failAndThrow(void 0, e5, { code: CliError.Code.EnvironmentError }) },
|
|
843131
843698
|
{ substituteAsEmpty: shouldSubstituteAsEmpty }
|
|
843132
843699
|
);
|
|
843133
843700
|
const instances2 = docsWorkspace.config.instances;
|
|
843134
843701
|
if (instances2.length === 0) {
|
|
843135
|
-
context3.failAndThrow("No instances specified in docs.yml! Cannot register docs."
|
|
843702
|
+
context3.failAndThrow("No instances specified in docs.yml! Cannot register docs.", void 0, {
|
|
843703
|
+
code: CliError.Code.ConfigError
|
|
843704
|
+
});
|
|
843136
843705
|
return;
|
|
843137
843706
|
}
|
|
843138
843707
|
if (instances2.length > 1 && instanceUrl == null) {
|
|
843139
|
-
context3.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${instances2[0]?.url})
|
|
843708
|
+
context3.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${instances2[0]?.url})`, void 0, { code: CliError.Code.ConfigError });
|
|
843140
843709
|
return;
|
|
843141
843710
|
}
|
|
843142
843711
|
const maybeInstance = instances2.find((instance) => instance.url === instanceUrl) ?? instances2[0];
|
|
843143
843712
|
if (maybeInstance == null) {
|
|
843144
|
-
context3.failAndThrow(`No docs instance with url ${instanceUrl}. Failed to register
|
|
843713
|
+
context3.failAndThrow(`No docs instance with url ${instanceUrl}. Failed to register.`, void 0, {
|
|
843714
|
+
code: CliError.Code.ConfigError
|
|
843715
|
+
});
|
|
843145
843716
|
return;
|
|
843146
843717
|
}
|
|
843147
843718
|
const customDomains = [];
|
|
@@ -843186,7 +843757,7 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
843186
843757
|
} catch (error50) {
|
|
843187
843758
|
if (!(error50 instanceof DocsPublishConflictError) || attempt >= PUBLISH_CONFLICT_RETRY_DELAYS_MS.length) {
|
|
843188
843759
|
if (error50 instanceof DocsPublishConflictError) {
|
|
843189
|
-
return context3.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");
|
|
843760
|
+
return context3.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.", void 0, { code: CliError.Code.NetworkError });
|
|
843190
843761
|
}
|
|
843191
843762
|
throw error50;
|
|
843192
843763
|
}
|
|
@@ -843236,7 +843807,7 @@ var LegacyDocsPublisher = class {
|
|
|
843236
843807
|
previewId,
|
|
843237
843808
|
disableTemplates: void 0,
|
|
843238
843809
|
skipUpload,
|
|
843239
|
-
cliVersion: "4.
|
|
843810
|
+
cliVersion: "4.82.0-1-g000d7384e60"
|
|
843240
843811
|
});
|
|
843241
843812
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843242
843813
|
return { success: false };
|
|
@@ -843711,7 +844282,10 @@ var DocsTask = class {
|
|
|
843711
844282
|
getTask() {
|
|
843712
844283
|
const task = this.taskGroup.getTask(this.id);
|
|
843713
844284
|
if (task == null) {
|
|
843714
|
-
throw new
|
|
844285
|
+
throw new CliError({
|
|
844286
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
844287
|
+
code: CliError.Code.InternalError
|
|
844288
|
+
});
|
|
843715
844289
|
}
|
|
843716
844290
|
return task;
|
|
843717
844291
|
}
|
|
@@ -844983,7 +845557,10 @@ var Wizard = class {
|
|
|
844983
845557
|
async fetchApiFromUrl(url3, specFormat) {
|
|
844984
845558
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
844985
845559
|
if (!response.ok) {
|
|
844986
|
-
throw new
|
|
845560
|
+
throw new CliError({
|
|
845561
|
+
message: `HTTP ${response.status} ${response.statusText}`,
|
|
845562
|
+
code: CliError.Code.NetworkError
|
|
845563
|
+
});
|
|
844987
845564
|
}
|
|
844988
845565
|
const content5 = await response.text();
|
|
844989
845566
|
const filename = this.resolveFilenameFromUrl({ url: url3, specFormat });
|
|
@@ -846513,20 +847090,29 @@ var ApiSpecDetector = class {
|
|
|
846513
847090
|
async detect({ absoluteFilePath, reference: reference4, content: content5 }) {
|
|
846514
847091
|
const parsed = this.parseOrThrow({ content: content5, reference: reference4 });
|
|
846515
847092
|
if (typeof parsed !== "object" || parsed == null) {
|
|
846516
|
-
throw new
|
|
847093
|
+
throw new CliError({
|
|
847094
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
847095
|
+
code: CliError.Code.InternalError
|
|
847096
|
+
});
|
|
846517
847097
|
}
|
|
846518
847098
|
for (const specType of DETECTABLE_SPEC_TYPES) {
|
|
846519
847099
|
if (specType in parsed) {
|
|
846520
847100
|
return specType;
|
|
846521
847101
|
}
|
|
846522
847102
|
}
|
|
846523
|
-
throw new
|
|
847103
|
+
throw new CliError({
|
|
847104
|
+
message: `Could not determine API type for "${reference4}". File must contain a top-level "openapi" or "asyncapi" key.`,
|
|
847105
|
+
code: CliError.Code.InternalError
|
|
847106
|
+
});
|
|
846524
847107
|
}
|
|
846525
847108
|
parseOrThrow({ content: content5, reference: reference4 }) {
|
|
846526
847109
|
try {
|
|
846527
847110
|
return jsYaml.load(content5);
|
|
846528
847111
|
} catch {
|
|
846529
|
-
throw new
|
|
847112
|
+
throw new CliError({
|
|
847113
|
+
message: `Could not parse "${reference4}" as YAML or JSON. Ensure the file is a valid OpenAPI or AsyncAPI specification.`,
|
|
847114
|
+
code: CliError.Code.ParseError
|
|
847115
|
+
});
|
|
846530
847116
|
}
|
|
846531
847117
|
}
|
|
846532
847118
|
};
|
|
@@ -846564,7 +847150,10 @@ var ApiSpecResolver = class {
|
|
|
846564
847150
|
async resolveLocal({ reference: reference4 }) {
|
|
846565
847151
|
const absoluteFilePath = resolve6(this.context.cwd, reference4);
|
|
846566
847152
|
if (!await doesPathExist(absoluteFilePath)) {
|
|
846567
|
-
throw new
|
|
847153
|
+
throw new CliError({
|
|
847154
|
+
message: `API spec file does not exist: ${reference4}`,
|
|
847155
|
+
code: CliError.Code.ConfigError
|
|
847156
|
+
});
|
|
846568
847157
|
}
|
|
846569
847158
|
const content5 = await (0, import_promises92.readFile)(absoluteFilePath, "utf-8");
|
|
846570
847159
|
const specType = await this.detector.detect({ absoluteFilePath, content: content5, reference: reference4 });
|
|
@@ -846577,11 +847166,17 @@ var ApiSpecResolver = class {
|
|
|
846577
847166
|
async fetchContent({ url: url3 }) {
|
|
846578
847167
|
const response = await fetch(url3, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
|
|
846579
847168
|
if (!response.ok) {
|
|
846580
|
-
throw new
|
|
847169
|
+
throw new CliError({
|
|
847170
|
+
message: `Failed to fetch "${url3}": HTTP ${response.status} ${response.statusText}`,
|
|
847171
|
+
code: CliError.Code.NetworkError
|
|
847172
|
+
});
|
|
846581
847173
|
}
|
|
846582
847174
|
const contentType = response.headers.get("content-type") ?? "";
|
|
846583
847175
|
if (contentType.includes("text/html")) {
|
|
846584
|
-
throw new
|
|
847176
|
+
throw new CliError({
|
|
847177
|
+
message: `The URL "${url3}" returned HTML content. Ensure you're pointing to a raw spec URL, not a documentation page.`,
|
|
847178
|
+
code: CliError.Code.ConfigError
|
|
847179
|
+
});
|
|
846585
847180
|
}
|
|
846586
847181
|
const content5 = await response.text();
|
|
846587
847182
|
return { content: content5, contentType };
|
|
@@ -846606,7 +847201,10 @@ var ApiSpecResolver = class {
|
|
|
846606
847201
|
case "asyncapi":
|
|
846607
847202
|
return { asyncapi: absoluteFilePath, origin: origin2 };
|
|
846608
847203
|
default:
|
|
846609
|
-
throw new
|
|
847204
|
+
throw new CliError({
|
|
847205
|
+
message: `Unsupported spec type for flags mode: "${specType}". Supported: openapi, asyncapi`,
|
|
847206
|
+
code: CliError.Code.ConfigError
|
|
847207
|
+
});
|
|
846610
847208
|
}
|
|
846611
847209
|
}
|
|
846612
847210
|
isUrl(reference4) {
|
|
@@ -847610,10 +848208,12 @@ var ContainerExecutionEnvironment = class {
|
|
|
847610
848208
|
containerImage;
|
|
847611
848209
|
keepContainer;
|
|
847612
848210
|
runner;
|
|
847613
|
-
|
|
848211
|
+
disableTelemetry;
|
|
848212
|
+
constructor({ containerImage, keepContainer, runner, disableTelemetry, dockerImage, keepDocker }) {
|
|
847614
848213
|
this.containerImage = containerImage ?? dockerImage ?? "";
|
|
847615
848214
|
this.keepContainer = keepContainer ?? keepDocker ?? false;
|
|
847616
848215
|
this.runner = runner;
|
|
848216
|
+
this.disableTelemetry = disableTelemetry ?? false;
|
|
847617
848217
|
}
|
|
847618
848218
|
async execute({ generatorName, irPath, configPath, outputPath, snippetPath, snippetTemplatePath, licenseFilePath, sourceMounts, context: context3, inspect: inspect6, runner }) {
|
|
847619
848219
|
context3.logger.info(`Executing generator ${generatorName} using container image: ${this.containerImage}`);
|
|
@@ -847640,16 +848240,29 @@ var ContainerExecutionEnvironment = class {
|
|
|
847640
848240
|
envVars["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${DEFAULT_NODE_DEBUG_PORT}`;
|
|
847641
848241
|
ports[DEFAULT_NODE_DEBUG_PORT] = DEFAULT_NODE_DEBUG_PORT;
|
|
847642
848242
|
}
|
|
847643
|
-
|
|
847644
|
-
|
|
847645
|
-
|
|
847646
|
-
|
|
847647
|
-
|
|
847648
|
-
|
|
847649
|
-
|
|
847650
|
-
|
|
847651
|
-
|
|
847652
|
-
|
|
848243
|
+
if (this.disableTelemetry) {
|
|
848244
|
+
envVars["FERN_DISABLE_TELEMETRY"] = "true";
|
|
848245
|
+
}
|
|
848246
|
+
try {
|
|
848247
|
+
await runContainer({
|
|
848248
|
+
logger: context3.logger,
|
|
848249
|
+
imageName: this.containerImage,
|
|
848250
|
+
args: [CONTAINER_GENERATOR_CONFIG_PATH],
|
|
848251
|
+
binds,
|
|
848252
|
+
envVars,
|
|
848253
|
+
ports,
|
|
848254
|
+
removeAfterCompletion: !this.keepContainer,
|
|
848255
|
+
runner: this.runner ?? runner
|
|
848256
|
+
});
|
|
848257
|
+
} catch (error50) {
|
|
848258
|
+
if (error50 instanceof CliError) {
|
|
848259
|
+
throw error50;
|
|
848260
|
+
}
|
|
848261
|
+
throw new CliError({
|
|
848262
|
+
message: `Container execution failed: ${error50 instanceof Error ? error50.message : String(error50)}`,
|
|
848263
|
+
code: CliError.Code.ContainerError
|
|
848264
|
+
});
|
|
848265
|
+
}
|
|
847653
848266
|
}
|
|
847654
848267
|
};
|
|
847655
848268
|
|
|
@@ -873140,7 +873753,7 @@ var DynamicSnippetsJavaTestGenerator = class {
|
|
|
873140
873753
|
}
|
|
873141
873754
|
}
|
|
873142
873755
|
} catch (e5) {
|
|
873143
|
-
this.context.failAndThrow("Failed to run spotlessApply", e5);
|
|
873756
|
+
this.context.failAndThrow("Failed to run spotlessApply", e5, { code: CliError.Code.InternalError });
|
|
873144
873757
|
}
|
|
873145
873758
|
}
|
|
873146
873759
|
this.context.logger.debug("Done generating dynamic snippet tests");
|
|
@@ -894717,11 +895330,17 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
|
|
|
894717
895330
|
buildGeneratorConfig(config5) {
|
|
894718
895331
|
const outputMode = config5.output.mode;
|
|
894719
895332
|
if (outputMode.type !== "github") {
|
|
894720
|
-
throw new
|
|
895333
|
+
throw new CliError({
|
|
895334
|
+
message: "GitHub output mode is required for TypeScript dynamic snippet tests",
|
|
895335
|
+
code: CliError.Code.ConfigError
|
|
895336
|
+
});
|
|
894721
895337
|
}
|
|
894722
895338
|
const publishInfo = outputMode.publishInfo;
|
|
894723
895339
|
if (!publishInfo || publishInfo.type !== "npm") {
|
|
894724
|
-
throw new
|
|
895340
|
+
throw new CliError({
|
|
895341
|
+
message: "NPM publish info is required for TypeScript dynamic snippet tests",
|
|
895342
|
+
code: CliError.Code.ConfigError
|
|
895343
|
+
});
|
|
894725
895344
|
}
|
|
894726
895345
|
return {
|
|
894727
895346
|
...config5,
|
|
@@ -894775,7 +895394,10 @@ var DynamicSnippetsTestGenerator = class _DynamicSnippetsTestGenerator {
|
|
|
894775
895394
|
// ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/generateDynamicSnippetsTestSuite.js
|
|
894776
895395
|
async function generateDynamicSnippetsTestSuite({ ir: ir10, config: config5 }) {
|
|
894777
895396
|
if (ir10.dynamic == null) {
|
|
894778
|
-
throw new
|
|
895397
|
+
throw new CliError({
|
|
895398
|
+
message: "Internal error; dynamic IR is not available",
|
|
895399
|
+
code: CliError.Code.InternalError
|
|
895400
|
+
});
|
|
894779
895401
|
}
|
|
894780
895402
|
return {
|
|
894781
895403
|
ir: ir10.dynamic,
|
|
@@ -894971,7 +895593,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
894971
895593
|
push: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
|
|
894972
895594
|
pullRequest: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
|
|
894973
895595
|
_other: () => {
|
|
894974
|
-
throw new
|
|
895596
|
+
throw new CliError({
|
|
895597
|
+
message: "Encountered unknown github mode",
|
|
895598
|
+
code: CliError.Code.InternalError
|
|
895599
|
+
});
|
|
894975
895600
|
}
|
|
894976
895601
|
});
|
|
894977
895602
|
const outputConfig = {
|
|
@@ -894992,7 +895617,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
|
|
|
894992
895617
|
return outputConfig;
|
|
894993
895618
|
},
|
|
894994
895619
|
_other: () => {
|
|
894995
|
-
throw new
|
|
895620
|
+
throw new CliError({
|
|
895621
|
+
message: "Output type did not match any of the types supported by Fern",
|
|
895622
|
+
code: CliError.Code.InternalError
|
|
895623
|
+
});
|
|
894996
895624
|
}
|
|
894997
895625
|
});
|
|
894998
895626
|
return {
|
|
@@ -895866,7 +896494,10 @@ var LocalTaskHandler = class {
|
|
|
895866
896494
|
return null;
|
|
895867
896495
|
}
|
|
895868
896496
|
if (!this.version) {
|
|
895869
|
-
throw new
|
|
896497
|
+
throw new CliError({
|
|
896498
|
+
message: "Version is required for auto versioning",
|
|
896499
|
+
code: CliError.Code.InternalError
|
|
896500
|
+
});
|
|
895870
896501
|
}
|
|
895871
896502
|
let previousVersion;
|
|
895872
896503
|
try {
|
|
@@ -896054,7 +896685,10 @@ var LocalTaskHandler = class {
|
|
|
896054
896685
|
};
|
|
896055
896686
|
}
|
|
896056
896687
|
this.context.logger.error(`Failed to perform automatic versioning: ${error50}`);
|
|
896057
|
-
throw new
|
|
896688
|
+
throw new CliError({
|
|
896689
|
+
message: `Automatic versioning failed: ${error50}`,
|
|
896690
|
+
code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError
|
|
896691
|
+
});
|
|
896058
896692
|
} finally {
|
|
896059
896693
|
if (diffFile) {
|
|
896060
896694
|
try {
|
|
@@ -896107,7 +896741,7 @@ var LocalTaskHandler = class {
|
|
|
896107
896741
|
incrementVersion(version7, versionBump) {
|
|
896108
896742
|
const cleanVersion = import_semver13.default.clean(version7);
|
|
896109
896743
|
if (!cleanVersion) {
|
|
896110
|
-
throw new
|
|
896744
|
+
throw new CliError({ message: `Invalid version format: ${version7}`, code: CliError.Code.VersionError });
|
|
896111
896745
|
}
|
|
896112
896746
|
let releaseType;
|
|
896113
896747
|
switch (versionBump) {
|
|
@@ -896121,11 +896755,17 @@ var LocalTaskHandler = class {
|
|
|
896121
896755
|
releaseType = "patch";
|
|
896122
896756
|
break;
|
|
896123
896757
|
default:
|
|
896124
|
-
throw new
|
|
896758
|
+
throw new CliError({
|
|
896759
|
+
message: `Unsupported version bump: ${versionBump}`,
|
|
896760
|
+
code: CliError.Code.VersionError
|
|
896761
|
+
});
|
|
896125
896762
|
}
|
|
896126
896763
|
const newVersion = import_semver13.default.inc(cleanVersion, releaseType);
|
|
896127
896764
|
if (!newVersion) {
|
|
896128
|
-
throw new
|
|
896765
|
+
throw new CliError({
|
|
896766
|
+
message: `Failed to increment version: ${version7}`,
|
|
896767
|
+
code: CliError.Code.VersionError
|
|
896768
|
+
});
|
|
896129
896769
|
}
|
|
896130
896770
|
return version7.startsWith("v") ? `v${newVersion}` : newVersion;
|
|
896131
896771
|
}
|
|
@@ -896185,7 +896825,10 @@ var LocalTaskHandler = class {
|
|
|
896185
896825
|
*/
|
|
896186
896826
|
async getClientRegistry() {
|
|
896187
896827
|
if (this.ai == null) {
|
|
896188
|
-
throw new
|
|
896828
|
+
throw new CliError({
|
|
896829
|
+
message: "No AI service configuration found in generators.yml. Please add an 'ai' section with provider and model.",
|
|
896830
|
+
code: CliError.Code.ConfigError
|
|
896831
|
+
});
|
|
896189
896832
|
}
|
|
896190
896833
|
this.context.logger.debug(`Using AI service: ${this.ai.provider} with model ${this.ai.model}`);
|
|
896191
896834
|
return configureBamlClient(this.ai);
|
|
@@ -896423,7 +897066,7 @@ function extractLicenseFilePath(generatorInvocation, absolutePathToFernConfig) {
|
|
|
896423
897066
|
}
|
|
896424
897067
|
return void 0;
|
|
896425
897068
|
}
|
|
896426
|
-
async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFernConfig, workspace, generatorInvocation, absolutePathToLocalOutput, absolutePathToLocalSnippetJSON, absolutePathToLocalSnippetTemplateJSON, audiences, version: version7, workspaceTempDir, keepDocker, context: context3, irVersionOverride, outputVersionOverride, writeUnitTests, generateOauthClients, generatePaginatedClients, includeOptionalRequestPropertyExamples, inspect: inspect6, executionEnvironment, runner, whiteLabel, publishToRegistry, ir: ir10, ai: ai10, autoVersioningCache, absolutePathToSpecRepo, skipFernignore }) {
|
|
897069
|
+
async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFernConfig, workspace, generatorInvocation, absolutePathToLocalOutput, absolutePathToLocalSnippetJSON, absolutePathToLocalSnippetTemplateJSON, audiences, version: version7, workspaceTempDir, keepDocker, context: context3, irVersionOverride, outputVersionOverride, writeUnitTests, generateOauthClients, generatePaginatedClients, includeOptionalRequestPropertyExamples, inspect: inspect6, executionEnvironment, runner, whiteLabel, publishToRegistry, ir: ir10, ai: ai10, autoVersioningCache, absolutePathToSpecRepo, skipFernignore, disableTelemetry }) {
|
|
896427
897070
|
const { latest: latest2, migrated } = await getIntermediateRepresentation({
|
|
896428
897071
|
workspace,
|
|
896429
897072
|
audiences,
|
|
@@ -896468,7 +897111,8 @@ async function writeFilesToDiskAndRunGenerator({ organization, absolutePathToFer
|
|
|
896468
897111
|
}
|
|
896469
897112
|
const environment2 = executionEnvironment ?? new ContainerExecutionEnvironment({
|
|
896470
897113
|
containerImage: generatorInvocation.containerImage ? `${generatorInvocation.containerImage}:${generatorInvocation.version}` : `${generatorInvocation.name}:${generatorInvocation.version}`,
|
|
896471
|
-
keepContainer: keepDocker
|
|
897114
|
+
keepContainer: keepDocker,
|
|
897115
|
+
disableTelemetry
|
|
896472
897116
|
});
|
|
896473
897117
|
const paths = environment2.usesContainerPaths ? {
|
|
896474
897118
|
outputDirectory: AbsoluteFilePath2.of(CONTAINER_CODEGEN_OUTPUT_DIRECTORY),
|
|
@@ -896594,7 +897238,7 @@ function getGeneratorOutputSubfolder(generatorName) {
|
|
|
896594
897238
|
}
|
|
896595
897239
|
|
|
896596
897240
|
// ../generation/local-generation/local-workspace-runner/lib/runLocalGenerationForWorkspace.js
|
|
896597
|
-
async function runLocalGenerationForWorkspace({ token, projectConfig, workspace, generatorGroup, version: version7, keepDocker, inspect: inspect6, context: context3, absolutePathToPreview, runner, ai: ai10, replay, noReplay, validateWorkspace, requireEnvVars, skipFernignore, publishToRegistry, isPreview: isPreviewOverride, automationMode, autoMerge }) {
|
|
897241
|
+
async function runLocalGenerationForWorkspace({ token, projectConfig, workspace, generatorGroup, version: version7, keepDocker, inspect: inspect6, context: context3, absolutePathToPreview, runner, ai: ai10, replay, noReplay, validateWorkspace, requireEnvVars, skipFernignore, publishToRegistry, isPreview: isPreviewOverride, automationMode, autoMerge, disableTelemetry }) {
|
|
896598
897242
|
const userProvidedVersion = version7;
|
|
896599
897243
|
if (userProvidedVersion != null) {
|
|
896600
897244
|
if (absolutePathToPreview != null) {
|
|
@@ -896618,7 +897262,9 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
|
|
|
896618
897262
|
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
|
|
896619
897263
|
onError: (e5) => {
|
|
896620
897264
|
if (!isPreview && (requireEnvVars ?? true)) {
|
|
896621
|
-
interactiveTaskContext.failAndThrow(e5
|
|
897265
|
+
interactiveTaskContext.failAndThrow(e5, void 0, {
|
|
897266
|
+
code: CliError.Code.EnvironmentError
|
|
897267
|
+
});
|
|
896622
897268
|
}
|
|
896623
897269
|
}
|
|
896624
897270
|
}, { substituteAsEmpty: isPreview });
|
|
@@ -896671,13 +897317,13 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
|
|
|
896671
897317
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
896672
897318
|
token ??= await getAccessToken();
|
|
896673
897319
|
if (token == null) {
|
|
896674
|
-
interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.");
|
|
897320
|
+
interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.", void 0, { code: CliError.Code.AuthError });
|
|
896675
897321
|
return;
|
|
896676
897322
|
}
|
|
896677
897323
|
}
|
|
896678
897324
|
const organization = await venus.organization.get(projectConfig.organization);
|
|
896679
897325
|
if (generatorInvocation.absolutePathToLocalOutput == null && !organization.ok) {
|
|
896680
|
-
interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}
|
|
897326
|
+
interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}.`, void 0, { code: CliError.Code.NetworkError });
|
|
896681
897327
|
return;
|
|
896682
897328
|
}
|
|
896683
897329
|
if (organization.ok) {
|
|
@@ -896713,7 +897359,7 @@ generators:
|
|
|
896713
897359
|
uri: your-org/your-sdk-repo
|
|
896714
897360
|
token: \${GITHUB_TOKEN}
|
|
896715
897361
|
mode: pull-request
|
|
896716
|
-
|
|
897362
|
+
`, void 0, { code: CliError.Code.ConfigError });
|
|
896717
897363
|
}
|
|
896718
897364
|
}
|
|
896719
897365
|
if (selfhostedGithubConfig != null) {
|
|
@@ -896747,13 +897393,13 @@ generators:
|
|
|
896747
897393
|
const branchExists = await repo.remoteBranchExists(selfhostedGithubConfig.branch);
|
|
896748
897394
|
if (!branchExists) {
|
|
896749
897395
|
const parsedRepo = parseRepository(selfhostedGithubConfig.uri);
|
|
896750
|
-
interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}
|
|
897396
|
+
interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}`, void 0, { code: CliError.Code.ConfigError });
|
|
896751
897397
|
}
|
|
896752
897398
|
}
|
|
896753
897399
|
await repo.checkoutRemoteBranch(selfhostedGithubConfig.branch);
|
|
896754
897400
|
}
|
|
896755
897401
|
} catch (error50) {
|
|
896756
|
-
interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}
|
|
897402
|
+
interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
|
|
896757
897403
|
}
|
|
896758
897404
|
}
|
|
896759
897405
|
let absolutePathToLocalSnippetJSON = void 0;
|
|
@@ -896793,7 +897439,8 @@ generators:
|
|
|
896793
897439
|
ai: ai10,
|
|
896794
897440
|
autoVersioningCache,
|
|
896795
897441
|
absolutePathToSpecRepo: dirname6(workspace.absoluteFilePath),
|
|
896796
|
-
skipFernignore
|
|
897442
|
+
skipFernignore,
|
|
897443
|
+
disableTelemetry
|
|
896797
897444
|
});
|
|
896798
897445
|
interactiveTaskContext.logger.info(source_default.green("Wrote files to " + absolutePathToLocalOutput));
|
|
896799
897446
|
if (selfhostedGithubConfig != null && shouldCommit) {
|
|
@@ -896850,13 +897497,13 @@ generators:
|
|
|
896850
897497
|
interactiveTaskContext.logger.info(source_default.green("Automerge enabled on PR"));
|
|
896851
897498
|
}
|
|
896852
897499
|
if (!pipelineResult.success) {
|
|
896853
|
-
interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}
|
|
897500
|
+
interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}`, void 0, { code: CliError.Code.UserError });
|
|
896854
897501
|
}
|
|
896855
897502
|
}
|
|
896856
897503
|
});
|
|
896857
897504
|
}));
|
|
896858
897505
|
if (results.some((didSucceed) => !didSucceed)) {
|
|
896859
|
-
|
|
897506
|
+
throw new TaskAbortSignal();
|
|
896860
897507
|
}
|
|
896861
897508
|
}
|
|
896862
897509
|
function resolveAbsolutePathToLocalPreview(absolutePathToPreview, generatorInvocation) {
|
|
@@ -896912,6 +897559,25 @@ function getPublishConfig2({ generatorInvocation, org, version: version7, userPr
|
|
|
896912
897559
|
packageName
|
|
896913
897560
|
});
|
|
896914
897561
|
context3.logger.debug(`Created CratesPublishTarget: version ${version7} package name: ${packageName}`);
|
|
897562
|
+
} else if (generatorInvocation.language === "go") {
|
|
897563
|
+
if (userProvidedVersion != null) {
|
|
897564
|
+
const goModulePath = (() => {
|
|
897565
|
+
const config5 = generatorInvocation.raw?.config;
|
|
897566
|
+
if (typeof config5 !== "object" || config5 === null) {
|
|
897567
|
+
return void 0;
|
|
897568
|
+
}
|
|
897569
|
+
const module4 = config5.module;
|
|
897570
|
+
if (module4 == null || typeof module4.path !== "string") {
|
|
897571
|
+
return void 0;
|
|
897572
|
+
}
|
|
897573
|
+
return module4.path;
|
|
897574
|
+
})();
|
|
897575
|
+
publishTarget = PublishTarget.go({
|
|
897576
|
+
version: userProvidedVersion,
|
|
897577
|
+
modulePath: goModulePath
|
|
897578
|
+
});
|
|
897579
|
+
context3.logger.debug(`Created GoPublishTarget: version ${userProvidedVersion} module path: ${goModulePath}`);
|
|
897580
|
+
}
|
|
896915
897581
|
} else if (generatorInvocation.language === "java") {
|
|
896916
897582
|
const config5 = generatorInvocation.raw?.config;
|
|
896917
897583
|
const mavenCoordinate = (() => {
|
|
@@ -897040,7 +897706,7 @@ var GenerationRunner = class {
|
|
|
897040
897706
|
const results = await Promise.all(generatorGroup.generators.map(async (generatorInvocation) => {
|
|
897041
897707
|
return context3.runInteractiveTask({ name: generatorInvocation.name }, async (interactiveTaskContext) => {
|
|
897042
897708
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897043
|
-
interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system");
|
|
897709
|
+
interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system", void 0, { code: CliError.Code.ConfigError });
|
|
897044
897710
|
return;
|
|
897045
897711
|
}
|
|
897046
897712
|
try {
|
|
@@ -897074,7 +897740,7 @@ var GenerationRunner = class {
|
|
|
897074
897740
|
} catch (error50) {
|
|
897075
897741
|
if (error50 instanceof TaskAbortSignal) {
|
|
897076
897742
|
} else {
|
|
897077
|
-
interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50);
|
|
897743
|
+
interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50, { code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError });
|
|
897078
897744
|
}
|
|
897079
897745
|
}
|
|
897080
897746
|
});
|
|
@@ -897083,7 +897749,7 @@ var GenerationRunner = class {
|
|
|
897083
897749
|
async executeGenerator({ generatorGroup, generatorInvocation, context: context3, workspace, organization, irVersionOverride, outputVersionOverride, absolutePathToFernConfig, inspect: inspect6, skipFernignore, skipAutogenerationIfManualExamplesExist }) {
|
|
897084
897750
|
context3.logger.info(`Starting generation for ${generatorInvocation.name}`);
|
|
897085
897751
|
if (generatorInvocation.absolutePathToLocalOutput == null) {
|
|
897086
|
-
throw new
|
|
897752
|
+
throw new CliError({ message: "Output path is required for generation", code: CliError.Code.ConfigError });
|
|
897087
897753
|
}
|
|
897088
897754
|
const rawIr = generateIntermediateRepresentation({
|
|
897089
897755
|
workspace,
|
|
@@ -897389,7 +898055,10 @@ var LegacyGeneratorInvocationAdapter = class {
|
|
|
897389
898055
|
}
|
|
897390
898056
|
const absolutePath = join8(this.context.cwd, RelativeFilePath2.of(license));
|
|
897391
898057
|
if (!await doesPathExist(absolutePath, "file")) {
|
|
897392
|
-
throw new
|
|
898058
|
+
throw new CliError({
|
|
898059
|
+
message: `Custom license file "${absolutePath}" does not exist; did you mean to use either MIT or Apache-2.0?`,
|
|
898060
|
+
code: CliError.Code.InternalError
|
|
898061
|
+
});
|
|
897393
898062
|
}
|
|
897394
898063
|
const contents = await (0, import_promises106.readFile)(absolutePath, "utf-8");
|
|
897395
898064
|
return api_exports4.GithubLicense.custom({ contents });
|
|
@@ -897572,7 +898241,8 @@ var LegacyLocalGenerationRunner = class {
|
|
|
897572
898241
|
inspect: false,
|
|
897573
898242
|
ai: void 0,
|
|
897574
898243
|
skipFernignore: args.skipFernignore,
|
|
897575
|
-
requireEnvVars: args.requireEnvVars
|
|
898244
|
+
requireEnvVars: args.requireEnvVars,
|
|
898245
|
+
disableTelemetry: !this.context.telemetry.isTelemetryEnabled()
|
|
897576
898246
|
});
|
|
897577
898247
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
897578
898248
|
return {
|
|
@@ -897596,7 +898266,8 @@ var LegacyLocalGenerationRunner = class {
|
|
|
897596
898266
|
const executionEnvironment = new ContainerExecutionEnvironment({
|
|
897597
898267
|
containerImage,
|
|
897598
898268
|
keepContainer: args.keepContainer ?? false,
|
|
897599
|
-
runner: args.containerEngine
|
|
898269
|
+
runner: args.containerEngine,
|
|
898270
|
+
disableTelemetry: !this.context.telemetry.isTelemetryEnabled()
|
|
897600
898271
|
});
|
|
897601
898272
|
const runner = new GenerationRunner(executionEnvironment);
|
|
897602
898273
|
await runner.run({
|
|
@@ -897897,7 +898568,10 @@ var SdkTask = class {
|
|
|
897897
898568
|
getTask() {
|
|
897898
898569
|
const task = this.taskGroup.getTask(this.id);
|
|
897899
898570
|
if (task == null) {
|
|
897900
|
-
throw new
|
|
898571
|
+
throw new CliError({
|
|
898572
|
+
message: `Internal error; task '${this.id}' does not exist`,
|
|
898573
|
+
code: CliError.Code.InternalError
|
|
898574
|
+
});
|
|
897901
898575
|
}
|
|
897902
898576
|
return task;
|
|
897903
898577
|
}
|
|
@@ -898129,7 +898803,7 @@ var GenerateCommand = class {
|
|
|
898129
898803
|
}
|
|
898130
898804
|
async runGeneration({ context: context3, workspace, targets: targets2, args, forceLocal }) {
|
|
898131
898805
|
if (workspace.sdks == null) {
|
|
898132
|
-
throw new
|
|
898806
|
+
throw new CliError({ message: "No SDKs configured", code: CliError.Code.InternalError });
|
|
898133
898807
|
}
|
|
898134
898808
|
const apisToCheck = [...new Set(targets2.map((t3) => t3.api))];
|
|
898135
898809
|
const apiChecker = new ApiChecker({
|
|
@@ -898811,7 +899485,10 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
898811
899485
|
const packageJsonContent = await (0, import_promises110.readFile)(packageJsonPath, "utf-8");
|
|
898812
899486
|
const packageJson2 = JSON.parse(packageJsonContent);
|
|
898813
899487
|
if (packageJson2.main == null) {
|
|
898814
|
-
throw new
|
|
899488
|
+
throw new CliError({
|
|
899489
|
+
message: `No main field found in package.json for ${MIGRATION_PACKAGE_NAME}`,
|
|
899490
|
+
code: CliError.Code.InternalError
|
|
899491
|
+
});
|
|
898815
899492
|
}
|
|
898816
899493
|
const packageEntryPoint = (0, import_path80.join)(packageDir, packageJson2.main);
|
|
898817
899494
|
const { migrations } = await import((0, import_url8.pathToFileURL)(packageEntryPoint).href);
|
|
@@ -898926,11 +899603,14 @@ var GeneratorMigrator = class _GeneratorMigrator {
|
|
|
898926
899603
|
this.logger.debug(`No migration package found for ${generatorName}.`);
|
|
898927
899604
|
return void 0;
|
|
898928
899605
|
}
|
|
898929
|
-
throw new
|
|
899606
|
+
throw new CliError({
|
|
899607
|
+
message: `Failed to load generator migrations for ${generatorName}.
|
|
898930
899608
|
|
|
898931
899609
|
Reason: ${errorMessage}
|
|
898932
899610
|
|
|
898933
|
-
Please check your internet connection and npm configuration, then try again
|
|
899611
|
+
Please check your internet connection and npm configuration, then try again.`,
|
|
899612
|
+
code: CliError.Code.InternalError
|
|
899613
|
+
});
|
|
898934
899614
|
}
|
|
898935
899615
|
}
|
|
898936
899616
|
/**
|
|
@@ -898959,7 +899639,10 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
898959
899639
|
const aVersion = import_semver14.default.parse(a4.version);
|
|
898960
899640
|
const bVersion = import_semver14.default.parse(b7.version);
|
|
898961
899641
|
if (aVersion == null || bVersion == null) {
|
|
898962
|
-
throw new
|
|
899642
|
+
throw new CliError({
|
|
899643
|
+
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.`,
|
|
899644
|
+
code: CliError.Code.InternalError
|
|
899645
|
+
});
|
|
898963
899646
|
}
|
|
898964
899647
|
return import_semver14.default.compare(aVersion, bVersion);
|
|
898965
899648
|
});
|
|
@@ -898977,11 +899660,14 @@ Please check your internet connection and npm configuration, then try again.`);
|
|
|
898977
899660
|
appliedVersions.push(migration23.version);
|
|
898978
899661
|
} catch (error50) {
|
|
898979
899662
|
const errorMessage = extractErrorMessage(error50);
|
|
898980
|
-
throw new
|
|
899663
|
+
throw new CliError({
|
|
899664
|
+
message: `Failed to apply migration for version ${migration23.version}.
|
|
898981
899665
|
|
|
898982
899666
|
Reason: ${errorMessage}
|
|
898983
899667
|
|
|
898984
|
-
Please report this issue at: https://github.com/fern-api/fern/issues
|
|
899668
|
+
Please report this issue at: https://github.com/fern-api/fern/issues`,
|
|
899669
|
+
code: CliError.Code.InternalError
|
|
899670
|
+
});
|
|
898985
899671
|
}
|
|
898986
899672
|
}
|
|
898987
899673
|
return {
|
|
@@ -917725,13 +918411,17 @@ function reportError2(reporter, error50, options2) {
|
|
|
917725
918411
|
}
|
|
917726
918412
|
}
|
|
917727
918413
|
|
|
918414
|
+
// src/telemetry/isTelemetryDisabled.ts
|
|
918415
|
+
function isTelemetryDisabled() {
|
|
918416
|
+
return process.env.FERN_DISABLE_TELEMETRY === "true";
|
|
918417
|
+
}
|
|
918418
|
+
|
|
917728
918419
|
// src/telemetry/SentryClient.ts
|
|
917729
918420
|
var SentryClient = class {
|
|
917730
918421
|
sentry;
|
|
917731
918422
|
constructor({ release: release2 }) {
|
|
917732
|
-
const isTelemetryEnabled = process.env.FERN_DISABLE_TELEMETRY !== "true";
|
|
917733
918423
|
const sentryDsn = "https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496";
|
|
917734
|
-
if (
|
|
918424
|
+
if (!isTelemetryDisabled() && sentryDsn != null && sentryDsn.length > 0) {
|
|
917735
918425
|
const sentryEnvironment = "development";
|
|
917736
918426
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
917737
918427
|
throw new CliError({
|
|
@@ -917743,9 +918433,33 @@ var SentryClient = class {
|
|
|
917743
918433
|
dsn: sentryDsn,
|
|
917744
918434
|
release: release2,
|
|
917745
918435
|
environment: sentryEnvironment,
|
|
918436
|
+
// Opt out of every built-in integration (HTTP tracing, local
|
|
918437
|
+
// variables, console breadcrumbs, etc.) — error capture is all
|
|
918438
|
+
// we need.
|
|
917746
918439
|
defaultIntegrations: false,
|
|
917747
|
-
|
|
917748
|
-
|
|
918440
|
+
// Rewrite absolute frame paths to repo-root-relative paths so
|
|
918441
|
+
// they align with the source maps uploaded at publish time.
|
|
918442
|
+
// onUncaughtException / onUnhandledRejection catch errors that
|
|
918443
|
+
// escape the CLI's top-level handler (fire-and-forget callbacks,
|
|
918444
|
+
// unhandled rejections in background work, etc.).
|
|
918445
|
+
// linkedErrors chains .cause so wrapped errors stay traceable.
|
|
918446
|
+
// nodeContext adds Node.js version and OS to every event.
|
|
918447
|
+
integrations: [
|
|
918448
|
+
rewriteFramesIntegration(),
|
|
918449
|
+
onUncaughtExceptionIntegration(),
|
|
918450
|
+
onUnhandledRejectionIntegration(),
|
|
918451
|
+
linkedErrorsIntegration(),
|
|
918452
|
+
nodeContextIntegration()
|
|
918453
|
+
],
|
|
918454
|
+
// The CLI doesn't emit transactions; disable performance
|
|
918455
|
+
// sampling entirely.
|
|
918456
|
+
tracesSampleRate: 0,
|
|
918457
|
+
// Always attach a stack trace, even when the thrown value is
|
|
918458
|
+
// not an Error instance (e.g. a plain string or object).
|
|
918459
|
+
attachStacktrace: true,
|
|
918460
|
+
// Suppress the client-report envelope Sentry sends when events
|
|
918461
|
+
// are dropped (e.g. due to rate limits).
|
|
918462
|
+
sendClientReports: false
|
|
917749
918463
|
});
|
|
917750
918464
|
setSentryRunIdTags();
|
|
917751
918465
|
}
|
|
@@ -918337,7 +919051,7 @@ var CliContext = class _CliContext {
|
|
|
918337
919051
|
if (false) {
|
|
918338
919052
|
this.logger.error("CLI_VERSION is not defined");
|
|
918339
919053
|
}
|
|
918340
|
-
return "4.
|
|
919054
|
+
return "4.82.0-1-g000d7384e60";
|
|
918341
919055
|
}
|
|
918342
919056
|
getCliName() {
|
|
918343
919057
|
if (false) {
|
|
@@ -920264,7 +920978,8 @@ async function generateWorkspace({
|
|
|
920264
920978
|
requireEnvVars,
|
|
920265
920979
|
skipFernignore,
|
|
920266
920980
|
automationMode,
|
|
920267
|
-
autoMerge
|
|
920981
|
+
autoMerge,
|
|
920982
|
+
disableTelemetry: isTelemetryDisabled()
|
|
920268
920983
|
});
|
|
920269
920984
|
} else if (token != null) {
|
|
920270
920985
|
await runRemoteGenerationForAPIWorkspace({
|
|
@@ -931339,7 +932054,8 @@ async function sdkPreview({
|
|
|
931339
932054
|
noReplay: true,
|
|
931340
932055
|
validateWorkspace: true,
|
|
931341
932056
|
publishToRegistry,
|
|
931342
|
-
isPreview: true
|
|
932057
|
+
isPreview: true,
|
|
932058
|
+
disableTelemetry: isTelemetryDisabled()
|
|
931343
932059
|
});
|
|
931344
932060
|
});
|
|
931345
932061
|
}
|