@fern-api/fern-api-dev 4.81.0-13-g1d7c3cd6458 → 4.81.0-15-gf31c7899b46
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 +176 -76
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -614668,7 +614668,7 @@ var AccessTokenPosthogManager = class {
|
|
|
614668
614668
|
properties: {
|
|
614669
614669
|
...event,
|
|
614670
614670
|
...event.properties,
|
|
614671
|
-
version: "4.81.0-
|
|
614671
|
+
version: "4.81.0-15-gf31c7899b46",
|
|
614672
614672
|
usingAccessToken: true
|
|
614673
614673
|
}
|
|
614674
614674
|
});
|
|
@@ -614722,7 +614722,7 @@ var UserPosthogManager = class {
|
|
|
614722
614722
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
614723
614723
|
event: "CLI",
|
|
614724
614724
|
properties: {
|
|
614725
|
-
version: "4.81.0-
|
|
614725
|
+
version: "4.81.0-15-gf31c7899b46",
|
|
614726
614726
|
...event,
|
|
614727
614727
|
...event.properties,
|
|
614728
614728
|
usingAccessToken: false,
|
|
@@ -788550,7 +788550,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788550
788550
|
this.context = context3;
|
|
788551
788551
|
const lambdaOrigin = "https://ykq45y6fvnszd35iv5yuuatkze0rpwuz.lambda-url.us-east-1.on.aws";
|
|
788552
788552
|
if (!lambdaOrigin) {
|
|
788553
|
-
throw new
|
|
788553
|
+
throw new CliError({
|
|
788554
|
+
message: "DEFAULT_FDR_LAMBDA_DOCS_ORIGIN environment variable is not set. AI example enhancement requires this to be configured.",
|
|
788555
|
+
code: CliError.Code.EnvironmentError
|
|
788556
|
+
});
|
|
788554
788557
|
}
|
|
788555
788558
|
this.lambdaOrigin = lambdaOrigin;
|
|
788556
788559
|
this.venusOrigin = "https://venus-dev2.buildwithfern.com";
|
|
@@ -788619,7 +788622,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788619
788622
|
});
|
|
788620
788623
|
if (!response.ok) {
|
|
788621
788624
|
const errorText = await response.text();
|
|
788622
|
-
throw new
|
|
788625
|
+
throw new CliError({
|
|
788626
|
+
message: `Failed to fetch JWT from Venus: ${response.status} ${errorText || response.statusText}`,
|
|
788627
|
+
code: CliError.Code.NetworkError
|
|
788628
|
+
});
|
|
788623
788629
|
}
|
|
788624
788630
|
const result = await response.json();
|
|
788625
788631
|
this.context.logger.debug(`Successfully obtained JWT from Venus (expires at ${result.expiresAt})`);
|
|
@@ -788681,7 +788687,10 @@ var LambdaExampleEnhancer = class {
|
|
|
788681
788687
|
});
|
|
788682
788688
|
if (!response.ok) {
|
|
788683
788689
|
const errorText = await response.text();
|
|
788684
|
-
throw new
|
|
788690
|
+
throw new CliError({
|
|
788691
|
+
message: `Lambda returned ${response.status}: ${errorText || response.statusText}`,
|
|
788692
|
+
code: CliError.Code.NetworkError
|
|
788693
|
+
});
|
|
788685
788694
|
}
|
|
788686
788695
|
const result = await response.json();
|
|
788687
788696
|
return {
|
|
@@ -790194,7 +790203,10 @@ function convertTypeShape(irType) {
|
|
|
790194
790203
|
extraProperties: void 0
|
|
790195
790204
|
}),
|
|
790196
790205
|
_other: () => {
|
|
790197
|
-
throw new
|
|
790206
|
+
throw new CliError({
|
|
790207
|
+
message: "Unknown SingleUnionTypeProperties: " + variant.shape.propertiesType,
|
|
790208
|
+
code: CliError.Code.InternalError
|
|
790209
|
+
});
|
|
790198
790210
|
}
|
|
790199
790211
|
})
|
|
790200
790212
|
};
|
|
@@ -790219,7 +790231,7 @@ function convertTypeShape(irType) {
|
|
|
790219
790231
|
};
|
|
790220
790232
|
},
|
|
790221
790233
|
_other: () => {
|
|
790222
|
-
throw new
|
|
790234
|
+
throw new CliError({ message: "Unknown Type shape: " + irType.type, code: CliError.Code.InternalError });
|
|
790223
790235
|
}
|
|
790224
790236
|
});
|
|
790225
790237
|
}
|
|
@@ -790286,12 +790298,18 @@ function convertTypeReference3(irTypeReference) {
|
|
|
790286
790298
|
};
|
|
790287
790299
|
},
|
|
790288
790300
|
_other: () => {
|
|
790289
|
-
throw new
|
|
790301
|
+
throw new CliError({
|
|
790302
|
+
message: "Unknown literal type: " + literal3.type,
|
|
790303
|
+
code: CliError.Code.InternalError
|
|
790304
|
+
});
|
|
790290
790305
|
}
|
|
790291
790306
|
});
|
|
790292
790307
|
},
|
|
790293
790308
|
_other: () => {
|
|
790294
|
-
throw new
|
|
790309
|
+
throw new CliError({
|
|
790310
|
+
message: "Unknown container reference: " + container.type,
|
|
790311
|
+
code: CliError.Code.InternalError
|
|
790312
|
+
});
|
|
790295
790313
|
}
|
|
790296
790314
|
});
|
|
790297
790315
|
},
|
|
@@ -790371,7 +790389,10 @@ function convertTypeReference3(irTypeReference) {
|
|
|
790371
790389
|
};
|
|
790372
790390
|
},
|
|
790373
790391
|
_other: () => {
|
|
790374
|
-
throw new
|
|
790392
|
+
throw new CliError({
|
|
790393
|
+
message: "Unknown primitive: " + primitive.v1,
|
|
790394
|
+
code: CliError.Code.InternalError
|
|
790395
|
+
});
|
|
790375
790396
|
}
|
|
790376
790397
|
})
|
|
790377
790398
|
};
|
|
@@ -790382,7 +790403,10 @@ function convertTypeReference3(irTypeReference) {
|
|
|
790382
790403
|
};
|
|
790383
790404
|
},
|
|
790384
790405
|
_other: () => {
|
|
790385
|
-
throw new
|
|
790406
|
+
throw new CliError({
|
|
790407
|
+
message: "Unknown Type reference: " + irTypeReference.type,
|
|
790408
|
+
code: CliError.Code.InternalError
|
|
790409
|
+
});
|
|
790386
790410
|
}
|
|
790387
790411
|
});
|
|
790388
790412
|
}
|
|
@@ -790846,7 +790870,10 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
|
|
|
790846
790870
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790847
790871
|
const endpointBaseUrl = singleBaseUrlEnvironment.urls[baseUrlId];
|
|
790848
790872
|
if (endpointBaseUrl == null) {
|
|
790849
|
-
throw new
|
|
790873
|
+
throw new CliError({
|
|
790874
|
+
message: `Encountered undefined server name "${baseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${baseUrlId}`,
|
|
790875
|
+
code: CliError.Code.IrConversionError
|
|
790876
|
+
});
|
|
790850
790877
|
}
|
|
790851
790878
|
return {
|
|
790852
790879
|
id: FdrAPI_exports.EnvironmentId(baseUrlId),
|
|
@@ -790858,12 +790885,18 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
|
|
|
790858
790885
|
return environments2.filter((environment2, index3, self2) => index3 === self2.findIndex((t3) => t3.id === environment2.id && t3.baseUrl === environment2.baseUrl));
|
|
790859
790886
|
}
|
|
790860
790887
|
if (endpointBaseUrlId == null) {
|
|
790861
|
-
throw new
|
|
790888
|
+
throw new CliError({
|
|
790889
|
+
message: `Expected endpoint ${getOriginalName(endpoint3.name)} to have base url.`,
|
|
790890
|
+
code: CliError.Code.IrConversionError
|
|
790891
|
+
});
|
|
790862
790892
|
}
|
|
790863
790893
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790864
790894
|
const endpointBaseUrl = singleBaseUrlEnvironment.urls[endpointBaseUrlId];
|
|
790865
790895
|
if (endpointBaseUrl == null) {
|
|
790866
|
-
throw new
|
|
790896
|
+
throw new CliError({
|
|
790897
|
+
message: `Encountered undefined server name "${endpointBaseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${endpointBaseUrlId}`,
|
|
790898
|
+
code: CliError.Code.IrConversionError
|
|
790899
|
+
});
|
|
790867
790900
|
}
|
|
790868
790901
|
return {
|
|
790869
790902
|
id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
|
|
@@ -790889,12 +790922,18 @@ function convertIrWebSocketEnvironments({ environmentsConfig, channel: channel3
|
|
|
790889
790922
|
});
|
|
790890
790923
|
case "multipleBaseUrls":
|
|
790891
790924
|
if (channelBaseUrlId == null) {
|
|
790892
|
-
throw new
|
|
790925
|
+
throw new CliError({
|
|
790926
|
+
message: `Expected channel ${getOriginalName(channel3.name)} to have base url.`,
|
|
790927
|
+
code: CliError.Code.IrConversionError
|
|
790928
|
+
});
|
|
790893
790929
|
}
|
|
790894
790930
|
return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
|
|
790895
790931
|
const channelBaseUrl = singleBaseUrlEnvironment.urls[channelBaseUrlId];
|
|
790896
790932
|
if (channelBaseUrl == null) {
|
|
790897
|
-
throw new
|
|
790933
|
+
throw new CliError({
|
|
790934
|
+
message: `Encountered undefined server name ${channelBaseUrl} at channel ${getOriginalName(channel3.name)} ${channel3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${channelBaseUrlId}`,
|
|
790935
|
+
code: CliError.Code.IrConversionError
|
|
790936
|
+
});
|
|
790898
790937
|
}
|
|
790899
790938
|
return {
|
|
790900
790939
|
id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
|
|
@@ -790918,7 +790957,7 @@ function convertHttpMethod2(method8) {
|
|
|
790918
790957
|
delete: () => FdrAPI_exports.HttpMethod.Delete,
|
|
790919
790958
|
head: () => FdrAPI_exports.HttpMethod.Head,
|
|
790920
790959
|
_other: () => {
|
|
790921
|
-
throw new
|
|
790960
|
+
throw new CliError({ message: "Unknown http method: " + method8, code: CliError.Code.InternalError });
|
|
790922
790961
|
}
|
|
790923
790962
|
});
|
|
790924
790963
|
}
|
|
@@ -791034,7 +791073,10 @@ function convertRequestBody3(irRequest) {
|
|
|
791034
791073
|
contentType: bytes.contentType
|
|
791035
791074
|
}),
|
|
791036
791075
|
_other: () => {
|
|
791037
|
-
throw new
|
|
791076
|
+
throw new CliError({
|
|
791077
|
+
message: "Unknown HttpRequestBody: " + irRequest.type,
|
|
791078
|
+
code: CliError.Code.InternalError
|
|
791079
|
+
});
|
|
791038
791080
|
}
|
|
791039
791081
|
});
|
|
791040
791082
|
return requestBodyShape != null ? { type: requestBodyShape, description: irRequest.docs } : void 0;
|
|
@@ -791088,7 +791130,10 @@ function convertResponse2(irResponse) {
|
|
|
791088
791130
|
return void 0;
|
|
791089
791131
|
},
|
|
791090
791132
|
_other: () => {
|
|
791091
|
-
throw new
|
|
791133
|
+
throw new CliError({
|
|
791134
|
+
message: "Unknown HttpResponse: " + irResponse.body,
|
|
791135
|
+
code: CliError.Code.InternalError
|
|
791136
|
+
});
|
|
791092
791137
|
}
|
|
791093
791138
|
});
|
|
791094
791139
|
}
|
|
@@ -791328,7 +791373,10 @@ function convertV2HttpEndpointExample({ shouldUseExampleName, exampleName, examp
|
|
|
791328
791373
|
return void 0;
|
|
791329
791374
|
},
|
|
791330
791375
|
_other: () => {
|
|
791331
|
-
throw new
|
|
791376
|
+
throw new CliError({
|
|
791377
|
+
message: "Unknown ExampleResponseBody: " + example.response?.body?.type,
|
|
791378
|
+
code: CliError.Code.InternalError
|
|
791379
|
+
});
|
|
791332
791380
|
}
|
|
791333
791381
|
}) : void 0,
|
|
791334
791382
|
codeSamples: example.codeSamples?.map((codeSample) => ({
|
|
@@ -791454,18 +791502,27 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
791454
791502
|
stream: (stream5) => stream5.length > 0 ? 200 : 204,
|
|
791455
791503
|
sse: (stream5) => stream5.length > 0 ? 200 : 204,
|
|
791456
791504
|
_other: () => {
|
|
791457
|
-
throw new
|
|
791505
|
+
throw new CliError({
|
|
791506
|
+
message: "Unknown ExampleResponseBody: " + ok3.type,
|
|
791507
|
+
code: CliError.Code.InternalError
|
|
791508
|
+
});
|
|
791458
791509
|
}
|
|
791459
791510
|
}),
|
|
791460
791511
|
error: ({ error: errorName }) => {
|
|
791461
791512
|
const error50 = ir10.errors[errorName.errorId];
|
|
791462
791513
|
if (error50 == null) {
|
|
791463
|
-
throw new
|
|
791514
|
+
throw new CliError({
|
|
791515
|
+
message: "Cannot find error " + errorName.errorId,
|
|
791516
|
+
code: CliError.Code.ResolutionError
|
|
791517
|
+
});
|
|
791464
791518
|
}
|
|
791465
791519
|
return error50.statusCode;
|
|
791466
791520
|
},
|
|
791467
791521
|
_other: () => {
|
|
791468
|
-
throw new
|
|
791522
|
+
throw new CliError({
|
|
791523
|
+
message: "Unknown ExampleResponse: " + example.response.type,
|
|
791524
|
+
code: CliError.Code.InternalError
|
|
791525
|
+
});
|
|
791469
791526
|
}
|
|
791470
791527
|
}),
|
|
791471
791528
|
responseBody: example.response._visit({
|
|
@@ -791487,12 +791544,18 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
|
|
|
791487
791544
|
value: sse.map(({ event, data: data2 }) => ({ event, data: data2.jsonExample }))
|
|
791488
791545
|
}),
|
|
791489
791546
|
_other: () => {
|
|
791490
|
-
throw new
|
|
791547
|
+
throw new CliError({
|
|
791548
|
+
message: "Unknown ExampleResponseBody: " + ok3.type,
|
|
791549
|
+
code: CliError.Code.InternalError
|
|
791550
|
+
});
|
|
791491
791551
|
}
|
|
791492
791552
|
}),
|
|
791493
791553
|
error: (error50) => error50.body != null ? { type: "json", value: error50.body.jsonExample } : void 0,
|
|
791494
791554
|
_other: () => {
|
|
791495
|
-
throw new
|
|
791555
|
+
throw new CliError({
|
|
791556
|
+
message: "Unknown ExampleResponse: " + example.response.type,
|
|
791557
|
+
code: CliError.Code.InternalError
|
|
791558
|
+
});
|
|
791496
791559
|
}
|
|
791497
791560
|
}),
|
|
791498
791561
|
// irExample.response.body != null ? { type: "json", value: irExample.response.body.jsonExample } : undefined,
|
|
@@ -791785,7 +791848,9 @@ async function registerApi({ organization, workspace, context: context3, token,
|
|
|
791785
791848
|
context3.logger.debug(`Registered API Definition ${response.apiDefinitionId}`);
|
|
791786
791849
|
return { id: response.apiDefinitionId, ir: ir10 };
|
|
791787
791850
|
} catch (error50) {
|
|
791788
|
-
return context3.failAndThrow("Failed to register API", error50
|
|
791851
|
+
return context3.failAndThrow("Failed to register API", error50, {
|
|
791852
|
+
code: CliError.Code.NetworkError
|
|
791853
|
+
});
|
|
791789
791854
|
}
|
|
791790
791855
|
}
|
|
791791
791856
|
|
|
@@ -832073,7 +832138,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
832073
832138
|
var LOGS_FOLDER_NAME = "logs";
|
|
832074
832139
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
832075
832140
|
function getCliSource() {
|
|
832076
|
-
const version7 = "4.81.0-
|
|
832141
|
+
const version7 = "4.81.0-15-gf31c7899b46";
|
|
832077
832142
|
return `cli@${version7}`;
|
|
832078
832143
|
}
|
|
832079
832144
|
var DebugLogger = class {
|
|
@@ -841471,7 +841536,10 @@ async function retryWithRateLimit({ fn: fn10, retryRateLimited, logger: logger4,
|
|
|
841471
841536
|
}
|
|
841472
841537
|
}
|
|
841473
841538
|
}
|
|
841474
|
-
throw new
|
|
841539
|
+
throw new CliError({
|
|
841540
|
+
message: "Exceeded maximum retries for 429 Too Many Requests.",
|
|
841541
|
+
code: CliError.Code.InternalError
|
|
841542
|
+
});
|
|
841475
841543
|
}
|
|
841476
841544
|
|
|
841477
841545
|
// ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
|
|
@@ -841484,7 +841552,9 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
841484
841552
|
try {
|
|
841485
841553
|
fernignoreContents = await (0, import_promises86.readFile)(fernignorePath, "utf-8");
|
|
841486
841554
|
} catch (error50) {
|
|
841487
|
-
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}
|
|
841555
|
+
context3.failAndThrow(`Failed to read fernignore file at ${fernignorePath}: ${error50}`, void 0, {
|
|
841556
|
+
code: CliError.Code.ConfigError
|
|
841557
|
+
});
|
|
841488
841558
|
}
|
|
841489
841559
|
}
|
|
841490
841560
|
const job = await retryWithRateLimit({
|
|
@@ -841507,7 +841577,7 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
|
|
|
841507
841577
|
}),
|
|
841508
841578
|
retryRateLimited,
|
|
841509
841579
|
logger: context3.logger,
|
|
841510
|
-
onRateLimitedWithoutRetry: () => context3.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.")
|
|
841580
|
+
onRateLimitedWithoutRetry: () => context3.failAndThrow("Received 429 Too Many Requests. Re-run with --retry-rate-limited to automatically retry.", void 0, { code: CliError.Code.NetworkError })
|
|
841511
841581
|
});
|
|
841512
841582
|
await startJob({ intermediateRepresentation, job, context: context3, generatorInvocation, irVersionOverride });
|
|
841513
841583
|
return job;
|
|
@@ -841557,33 +841627,35 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
|
|
|
841557
841627
|
}
|
|
841558
841628
|
return convertCreateJobError(rawError)._visit({
|
|
841559
841629
|
illegalApiNameError: () => {
|
|
841560
|
-
return context3.failAndThrow("API name is invalid: " + workspace.definition.rootApiFile.contents.name);
|
|
841630
|
+
return context3.failAndThrow("API name is invalid: " + workspace.definition.rootApiFile.contents.name, void 0, { code: CliError.Code.ConfigError });
|
|
841561
841631
|
},
|
|
841562
841632
|
illegalApiVersionError: () => {
|
|
841563
|
-
return context3.failAndThrow("API version is invalid: " + version7
|
|
841633
|
+
return context3.failAndThrow("API version is invalid: " + version7, void 0, {
|
|
841634
|
+
code: CliError.Code.ConfigError
|
|
841635
|
+
});
|
|
841564
841636
|
},
|
|
841565
841637
|
cannotPublishToNpmScope: ({ validScope, invalidScope }) => {
|
|
841566
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidScope} (expected ${validScope})
|
|
841638
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidScope} (expected ${validScope})`, void 0, { code: CliError.Code.AuthError });
|
|
841567
841639
|
},
|
|
841568
841640
|
cannotPublishToMavenGroup: ({ validGroup, invalidGroup }) => {
|
|
841569
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidGroup} (expected ${validGroup})
|
|
841641
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidGroup} (expected ${validGroup})`, void 0, { code: CliError.Code.AuthError });
|
|
841570
841642
|
},
|
|
841571
841643
|
cannotPublishPypiPackage: ({ validPrefix, invalidPackageName }) => {
|
|
841572
|
-
return context3.failAndThrow(`You do not have permission to publish to ${invalidPackageName} (expected ${validPrefix})
|
|
841644
|
+
return context3.failAndThrow(`You do not have permission to publish to ${invalidPackageName} (expected ${validPrefix})`, void 0, { code: CliError.Code.AuthError });
|
|
841573
841645
|
},
|
|
841574
841646
|
generatorsDoNotExistError: (value2) => {
|
|
841575
|
-
return context3.failAndThrow("Generators do not exist: " + value2.nonExistentGenerators.map((generator) => `${generator.id}@${generator.version}`).join(", "));
|
|
841647
|
+
return context3.failAndThrow("Generators do not exist: " + value2.nonExistentGenerators.map((generator) => `${generator.id}@${generator.version}`).join(", "), void 0, { code: CliError.Code.ConfigError });
|
|
841576
841648
|
},
|
|
841577
841649
|
insufficientPermissions: () => {
|
|
841578
841650
|
return context3.failAndThrow(`You do not have permission to run this generator for organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
841579
841651
|
|
|
841580
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not
|
|
841652
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`, void 0, { code: CliError.Code.AuthError });
|
|
841581
841653
|
},
|
|
841582
841654
|
orgNotConfiguredForWhitelabel: () => {
|
|
841583
|
-
return context3.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com.");
|
|
841655
|
+
return context3.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com.", void 0, { code: CliError.Code.AuthError });
|
|
841584
841656
|
},
|
|
841585
841657
|
branchDoesNotExist: (value2) => {
|
|
841586
|
-
return context3.failAndThrow(`Branch ${value2.branch} does not exist in repository ${value2.repositoryOwner}/${value2.repositoryName}
|
|
841658
|
+
return context3.failAndThrow(`Branch ${value2.branch} does not exist in repository ${value2.repositoryOwner}/${value2.repositoryName}`, void 0, { code: CliError.Code.ConfigError });
|
|
841587
841659
|
},
|
|
841588
841660
|
rateLimitExceeded: () => {
|
|
841589
841661
|
throw new TooManyRequestsError();
|
|
@@ -841592,9 +841664,9 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
|
|
|
841592
841664
|
context3.logger.debug(`Failed to create job: ${JSON.stringify(content5)}`);
|
|
841593
841665
|
const errorMessage = extractErrorMessage2(content5);
|
|
841594
841666
|
if (errorMessage != null) {
|
|
841595
|
-
return context3.failAndThrow(errorMessage);
|
|
841667
|
+
return context3.failAndThrow(errorMessage, void 0, { code: CliError.Code.NetworkError });
|
|
841596
841668
|
}
|
|
841597
|
-
return context3.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.");
|
|
841669
|
+
return context3.failAndThrow("Failed to create job. Please try again or contact support@buildwithfern.com for assistance.", void 0, { code: CliError.Code.NetworkError });
|
|
841598
841670
|
}
|
|
841599
841671
|
});
|
|
841600
841672
|
}
|
|
@@ -841639,7 +841711,7 @@ async function startJob({ intermediateRepresentation, generatorInvocation, job,
|
|
|
841639
841711
|
} catch (error50) {
|
|
841640
841712
|
const errorBody = error50 instanceof AxiosError2 ? error50.response?.data : error50;
|
|
841641
841713
|
context3.logger.debug(`POST ${url3} failed with ${JSON.stringify(error50)}`);
|
|
841642
|
-
context3.failAndThrow("Failed to start job", errorBody);
|
|
841714
|
+
context3.failAndThrow("Failed to start job", errorBody, { code: CliError.Code.NetworkError });
|
|
841643
841715
|
}
|
|
841644
841716
|
}
|
|
841645
841717
|
function extractErrorMessage2(error50) {
|
|
@@ -841706,7 +841778,9 @@ function pollJobAndReportStatus({ job, taskId, taskHandler, context: context3 })
|
|
|
841706
841778
|
if (taskStatus == null) {
|
|
841707
841779
|
numConsecutiveFailed++;
|
|
841708
841780
|
if (numConsecutiveFailed === MAX_UNSUCCESSFUL_ATTEMPTS) {
|
|
841709
|
-
context3.failAndThrow(`Failed to get job status after ${numConsecutiveFailed} attempts
|
|
841781
|
+
context3.failAndThrow(`Failed to get job status after ${numConsecutiveFailed} attempts.`, void 0, {
|
|
841782
|
+
code: CliError.Code.NetworkError
|
|
841783
|
+
});
|
|
841710
841784
|
}
|
|
841711
841785
|
setTimeout(pollForStatus, 2e3 + 1e3 * numConsecutiveFailed);
|
|
841712
841786
|
} else {
|
|
@@ -841763,7 +841837,9 @@ var RemoteTaskHandler = class {
|
|
|
841763
841837
|
}
|
|
841764
841838
|
async processUpdate(remoteTask2) {
|
|
841765
841839
|
if (remoteTask2 == null) {
|
|
841766
|
-
this.context.failAndThrow("Task is missing on job status"
|
|
841840
|
+
this.context.failAndThrow("Task is missing on job status", void 0, {
|
|
841841
|
+
code: CliError.Code.InternalError
|
|
841842
|
+
});
|
|
841767
841843
|
}
|
|
841768
841844
|
const coordinates = remoteTask2.packages.map((p9) => {
|
|
841769
841845
|
return p9.coordinate._visit({
|
|
@@ -841814,7 +841890,7 @@ var RemoteTaskHandler = class {
|
|
|
841814
841890
|
if (s3PreSignedReadUrl != null) {
|
|
841815
841891
|
logS3Url(s3PreSignedReadUrl);
|
|
841816
841892
|
}
|
|
841817
|
-
this.context.failAndThrow(message);
|
|
841893
|
+
this.context.failAndThrow(message, void 0, { code: CliError.Code.ContainerError });
|
|
841818
841894
|
},
|
|
841819
841895
|
finished: async (finishedStatus) => {
|
|
841820
841896
|
if (finishedStatus.s3PreSignedReadUrlV2 != null) {
|
|
@@ -841891,7 +841967,7 @@ async function downloadFilesForTask({ s3PreSignedReadUrl, absolutePathToLocalOut
|
|
|
841891
841967
|
}
|
|
841892
841968
|
context3.logger.info(source_default.green(`Downloaded to ${absolutePathToLocalOutput}`));
|
|
841893
841969
|
} catch (e5) {
|
|
841894
|
-
context3.failAndThrow("Failed to download files", e5);
|
|
841970
|
+
context3.failAndThrow("Failed to download files", e5, { code: CliError.Code.NetworkError });
|
|
841895
841971
|
}
|
|
841896
841972
|
}
|
|
841897
841973
|
async function downloadZipForTask({ s3PreSignedReadUrl, absolutePathToLocalOutput }) {
|
|
@@ -842068,7 +842144,7 @@ var SourceUploader = class {
|
|
|
842068
842144
|
});
|
|
842069
842145
|
await uploadCommand.cleanup();
|
|
842070
842146
|
if (!response.ok) {
|
|
842071
|
-
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}
|
|
842147
|
+
this.context.failAndThrow(`Failed to upload source file: ${source2.absoluteFilePath}. Status: ${response.status}, ${response.statusText}`, void 0, { code: CliError.Code.NetworkError });
|
|
842072
842148
|
}
|
|
842073
842149
|
}
|
|
842074
842150
|
async getUploadCommand(source2) {
|
|
@@ -842123,7 +842199,7 @@ var SourceUploader = class {
|
|
|
842123
842199
|
getSourceOrThrow(id) {
|
|
842124
842200
|
const source2 = this.sources[id];
|
|
842125
842201
|
if (source2 == null) {
|
|
842126
|
-
this.context.failAndThrow(`Internal error; server responded with source id "${id}" which does not exist in the workspace
|
|
842202
|
+
this.context.failAndThrow(`Internal error; server responded with source id "${id}" which does not exist in the workspace.`, void 0, { code: CliError.Code.InternalError });
|
|
842127
842203
|
}
|
|
842128
842204
|
return source2;
|
|
842129
842205
|
}
|
|
@@ -842139,7 +842215,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
842139
842215
|
const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
|
|
842140
842216
|
onError: (e5) => {
|
|
842141
842217
|
if (!isPreview && requireEnvVars) {
|
|
842142
|
-
interactiveTaskContext.failAndThrow(e5
|
|
842218
|
+
interactiveTaskContext.failAndThrow(void 0, e5, {
|
|
842219
|
+
code: CliError.Code.EnvironmentError
|
|
842220
|
+
});
|
|
842143
842221
|
}
|
|
842144
842222
|
}
|
|
842145
842223
|
}, { substituteAsEmpty: isPreview });
|
|
@@ -842239,7 +842317,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
842239
842317
|
}
|
|
842240
842318
|
const sourceUploader = new SourceUploader(interactiveTaskContext, sources);
|
|
842241
842319
|
if (sourceUploads == null && sourceUploader.sourceTypes.has("protobuf")) {
|
|
842242
|
-
interactiveTaskContext.failAndThrow("Did not successfully upload Protobuf source files."
|
|
842320
|
+
interactiveTaskContext.failAndThrow("Did not successfully upload Protobuf source files.", void 0, {
|
|
842321
|
+
code: CliError.Code.NetworkError
|
|
842322
|
+
});
|
|
842243
842323
|
}
|
|
842244
842324
|
if (sourceUploads != null) {
|
|
842245
842325
|
interactiveTaskContext.logger.debug("Uploading source files ...");
|
|
@@ -842250,15 +842330,21 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
842250
842330
|
if (dynamicIrOnly) {
|
|
842251
842331
|
interactiveTaskContext.logger.info("Dynamic IR only mode: skipping SDK generation and uploading dynamic IR only");
|
|
842252
842332
|
if (version7 == null) {
|
|
842253
|
-
interactiveTaskContext.failAndThrow("Version is required for dynamic IR only mode"
|
|
842333
|
+
interactiveTaskContext.failAndThrow("Version is required for dynamic IR only mode", void 0, {
|
|
842334
|
+
code: CliError.Code.ConfigError
|
|
842335
|
+
});
|
|
842254
842336
|
return void 0;
|
|
842255
842337
|
}
|
|
842256
842338
|
if (generatorInvocation.language == null) {
|
|
842257
|
-
interactiveTaskContext.failAndThrow("Language is required for dynamic IR only mode"
|
|
842339
|
+
interactiveTaskContext.failAndThrow("Language is required for dynamic IR only mode", void 0, {
|
|
842340
|
+
code: CliError.Code.ConfigError
|
|
842341
|
+
});
|
|
842258
842342
|
return void 0;
|
|
842259
842343
|
}
|
|
842260
842344
|
if (packageName == null) {
|
|
842261
|
-
interactiveTaskContext.failAndThrow("Package name is required for dynamic IR only mode"
|
|
842345
|
+
interactiveTaskContext.failAndThrow("Package name is required for dynamic IR only mode", void 0, {
|
|
842346
|
+
code: CliError.Code.ConfigError
|
|
842347
|
+
});
|
|
842262
842348
|
return void 0;
|
|
842263
842349
|
}
|
|
842264
842350
|
try {
|
|
@@ -842274,7 +842360,7 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
842274
842360
|
context: interactiveTaskContext
|
|
842275
842361
|
});
|
|
842276
842362
|
} catch (error50) {
|
|
842277
|
-
interactiveTaskContext.failAndThrow(`Failed to upload dynamic IR: ${extractErrorMessage(error50)}
|
|
842363
|
+
interactiveTaskContext.failAndThrow(`Failed to upload dynamic IR: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
|
|
842278
842364
|
}
|
|
842279
842365
|
return {
|
|
842280
842366
|
createdSnippets: false,
|
|
@@ -842310,7 +842396,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
842310
842396
|
interactiveTaskContext.logger.debug(`Job ID: ${job.jobId}`);
|
|
842311
842397
|
const taskId = job.taskIds[0];
|
|
842312
842398
|
if (taskId == null) {
|
|
842313
|
-
interactiveTaskContext.failAndThrow("Did not receive a task ID."
|
|
842399
|
+
interactiveTaskContext.failAndThrow("Did not receive a task ID.", void 0, {
|
|
842400
|
+
code: CliError.Code.NetworkError
|
|
842401
|
+
});
|
|
842314
842402
|
return void 0;
|
|
842315
842403
|
}
|
|
842316
842404
|
interactiveTaskContext.logger.debug(`Task ID: ${taskId}`);
|
|
@@ -842476,7 +842564,7 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
|
|
|
842476
842564
|
onSnippetsProduced: (invocation) => snippetsProducedBy.push(invocation)
|
|
842477
842565
|
}))));
|
|
842478
842566
|
if (automation == null && results.some((didSucceed) => !didSucceed)) {
|
|
842479
|
-
|
|
842567
|
+
throw new TaskAbortSignal();
|
|
842480
842568
|
}
|
|
842481
842569
|
return {
|
|
842482
842570
|
snippetsProducedBy
|
|
@@ -842915,9 +843003,9 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain3
|
|
|
842915
843003
|
context3.logger.error(`FDR registerApiDefinition failed. Error details:
|
|
842916
843004
|
${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
842917
843005
|
if (apiName != null) {
|
|
842918
|
-
return context3.failAndThrow(`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact support@buildwithfern.com`, errorDetails);
|
|
843006
|
+
return context3.failAndThrow(`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact support@buildwithfern.com`, errorDetails, { code: CliError.Code.NetworkError });
|
|
842919
843007
|
} else {
|
|
842920
|
-
return context3.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com`, errorDetails);
|
|
843008
|
+
return context3.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com`, errorDetails, { code: CliError.Code.NetworkError });
|
|
842921
843009
|
}
|
|
842922
843010
|
}
|
|
842923
843011
|
context3.logger.debug(`Registered API Definition ${apiName}: ${response.apiDefinitionId}`);
|
|
@@ -842944,7 +843032,7 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842944
843032
|
if (docsWorkspace.config.settings?.substituteEnvVars) {
|
|
842945
843033
|
context3.logger.debug("Applying environment variable substitution to docs definition...");
|
|
842946
843034
|
const { jsFiles, ...docsWithoutJsFiles } = docsDefinition;
|
|
842947
|
-
const substitutedDocs = replaceEnvVariables(docsWithoutJsFiles, { onError: (e5) => context3.failAndThrow(e5) }, { substituteAsEmpty: false });
|
|
843035
|
+
const substitutedDocs = replaceEnvVariables(docsWithoutJsFiles, { onError: (e5) => context3.failAndThrow(void 0, e5, { code: CliError.Code.EnvironmentError }) }, { substituteAsEmpty: false });
|
|
842948
843036
|
docsDefinition = { ...substitutedDocs, jsFiles };
|
|
842949
843037
|
}
|
|
842950
843038
|
const pageCount = Object.keys(docsDefinition.pages).length;
|
|
@@ -842954,7 +843042,9 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842954
843042
|
context3.logger.debug(`Memory after resolve: RSS=${(resolveMemory.rss / 1024 / 1024).toFixed(2)}MB, Heap=${(resolveMemory.heapUsed / 1024 / 1024).toFixed(2)}MB`);
|
|
842955
843043
|
if (docsRegistrationId == null) {
|
|
842956
843044
|
doUnlock();
|
|
842957
|
-
return context3.failAndThrow("Failed to publish docs.", "Docs registration ID is missing."
|
|
843045
|
+
return context3.failAndThrow("Failed to publish docs.", "Docs registration ID is missing.", {
|
|
843046
|
+
code: CliError.Code.InternalError
|
|
843047
|
+
});
|
|
842958
843048
|
}
|
|
842959
843049
|
context3.logger.info("Publishing docs to FDR...");
|
|
842960
843050
|
const publishStart = performance.now();
|
|
@@ -842966,7 +843056,9 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
842966
843056
|
...isBasepathAware && !preview && { basepathAware: true }
|
|
842967
843057
|
});
|
|
842968
843058
|
} catch (error50) {
|
|
842969
|
-
return context3.failAndThrow("Failed to publish docs to " + domain3, error50
|
|
843059
|
+
return context3.failAndThrow("Failed to publish docs to " + domain3, error50, {
|
|
843060
|
+
code: CliError.Code.NetworkError
|
|
843061
|
+
});
|
|
842970
843062
|
}
|
|
842971
843063
|
const publishTime = performance.now() - publishStart;
|
|
842972
843064
|
context3.logger.debug(`Docs published to FDR in ${publishTime.toFixed(0)}ms`);
|
|
@@ -843026,7 +843118,9 @@ async function uploadFiles(filesToUpload, docsWorkspacePath, context3, batchSize
|
|
|
843026
843118
|
}
|
|
843027
843119
|
});
|
|
843028
843120
|
} catch (e5) {
|
|
843029
|
-
context3.failAndThrow(`Failed to upload ${absoluteFilePath}`, e5
|
|
843121
|
+
context3.failAndThrow(`Failed to upload ${absoluteFilePath}`, e5, {
|
|
843122
|
+
code: CliError.Code.NetworkError
|
|
843123
|
+
});
|
|
843030
843124
|
}
|
|
843031
843125
|
}));
|
|
843032
843126
|
const endTime2 = Date.now();
|
|
@@ -843066,24 +843160,26 @@ ${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
|
843066
843160
|
}
|
|
843067
843161
|
const authErrorMessage = getAuthenticationErrorMessage(error50, organization, domain3);
|
|
843068
843162
|
if (authErrorMessage != null) {
|
|
843069
|
-
return context3.failAndThrow(authErrorMessage);
|
|
843163
|
+
return context3.failAndThrow(authErrorMessage, void 0, { code: CliError.Code.AuthError });
|
|
843070
843164
|
}
|
|
843071
843165
|
const errorType = errorObj?.error;
|
|
843072
843166
|
switch (errorType) {
|
|
843073
843167
|
case "InvalidCustomDomainError":
|
|
843074
|
-
return context3.failAndThrow(`Your docs domain should end with ${"docs.dev.buildwithfern.com"}
|
|
843168
|
+
return context3.failAndThrow(`Your docs domain should end with ${"docs.dev.buildwithfern.com"}`, void 0, { code: CliError.Code.ConfigError });
|
|
843075
843169
|
case "InvalidDomainError":
|
|
843076
|
-
return context3.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)");
|
|
843170
|
+
return context3.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)", void 0, { code: CliError.Code.ConfigError });
|
|
843077
843171
|
case "UnauthorizedError":
|
|
843078
|
-
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent)
|
|
843172
|
+
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent), void 0, {
|
|
843173
|
+
code: CliError.Code.AuthError
|
|
843174
|
+
});
|
|
843079
843175
|
case "UserNotInOrgError":
|
|
843080
843176
|
return context3.failAndThrow(`You do not belong to organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
843081
843177
|
|
|
843082
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not
|
|
843178
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`, void 0, { code: CliError.Code.AuthError });
|
|
843083
843179
|
case "UnavailableError":
|
|
843084
|
-
return context3.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.");
|
|
843180
|
+
return context3.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.", void 0, { code: CliError.Code.NetworkError });
|
|
843085
843181
|
default:
|
|
843086
|
-
return context3.failAndThrow("Failed to publish docs.", error50);
|
|
843182
|
+
return context3.failAndThrow("Failed to publish docs.", error50, { code: CliError.Code.NetworkError });
|
|
843087
843183
|
}
|
|
843088
843184
|
}
|
|
843089
843185
|
function getAuthenticationErrorMessage(error50, organization, domain3) {
|
|
@@ -843531,21 +843627,25 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
843531
843627
|
docsWorkspace.config = replaceEnvVariables(
|
|
843532
843628
|
docsWorkspace.config,
|
|
843533
843629
|
// Wrap in a closure for correct binding of `this` downstream
|
|
843534
|
-
{ onError: (e5) => context3.failAndThrow(e5) },
|
|
843630
|
+
{ onError: (e5) => context3.failAndThrow(void 0, e5, { code: CliError.Code.EnvironmentError }) },
|
|
843535
843631
|
{ substituteAsEmpty: shouldSubstituteAsEmpty }
|
|
843536
843632
|
);
|
|
843537
843633
|
const instances2 = docsWorkspace.config.instances;
|
|
843538
843634
|
if (instances2.length === 0) {
|
|
843539
|
-
context3.failAndThrow("No instances specified in docs.yml! Cannot register docs."
|
|
843635
|
+
context3.failAndThrow("No instances specified in docs.yml! Cannot register docs.", void 0, {
|
|
843636
|
+
code: CliError.Code.ConfigError
|
|
843637
|
+
});
|
|
843540
843638
|
return;
|
|
843541
843639
|
}
|
|
843542
843640
|
if (instances2.length > 1 && instanceUrl == null) {
|
|
843543
|
-
context3.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${instances2[0]?.url})
|
|
843641
|
+
context3.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${instances2[0]?.url})`, void 0, { code: CliError.Code.ConfigError });
|
|
843544
843642
|
return;
|
|
843545
843643
|
}
|
|
843546
843644
|
const maybeInstance = instances2.find((instance) => instance.url === instanceUrl) ?? instances2[0];
|
|
843547
843645
|
if (maybeInstance == null) {
|
|
843548
|
-
context3.failAndThrow(`No docs instance with url ${instanceUrl}. Failed to register
|
|
843646
|
+
context3.failAndThrow(`No docs instance with url ${instanceUrl}. Failed to register.`, void 0, {
|
|
843647
|
+
code: CliError.Code.ConfigError
|
|
843648
|
+
});
|
|
843549
843649
|
return;
|
|
843550
843650
|
}
|
|
843551
843651
|
const customDomains = [];
|
|
@@ -843590,7 +843690,7 @@ async function runRemoteGenerationForDocsWorkspace({ organization, apiWorkspaces
|
|
|
843590
843690
|
} catch (error50) {
|
|
843591
843691
|
if (!(error50 instanceof DocsPublishConflictError) || attempt >= PUBLISH_CONFLICT_RETRY_DELAYS_MS.length) {
|
|
843592
843692
|
if (error50 instanceof DocsPublishConflictError) {
|
|
843593
|
-
return context3.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");
|
|
843693
|
+
return context3.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.", void 0, { code: CliError.Code.NetworkError });
|
|
843594
843694
|
}
|
|
843595
843695
|
throw error50;
|
|
843596
843696
|
}
|
|
@@ -843640,7 +843740,7 @@ var LegacyDocsPublisher = class {
|
|
|
843640
843740
|
previewId,
|
|
843641
843741
|
disableTemplates: void 0,
|
|
843642
843742
|
skipUpload,
|
|
843643
|
-
cliVersion: "4.81.0-
|
|
843743
|
+
cliVersion: "4.81.0-15-gf31c7899b46"
|
|
843644
843744
|
});
|
|
843645
843745
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
843646
843746
|
return { success: false };
|
|
@@ -918871,7 +918971,7 @@ var CliContext = class _CliContext {
|
|
|
918871
918971
|
if (false) {
|
|
918872
918972
|
this.logger.error("CLI_VERSION is not defined");
|
|
918873
918973
|
}
|
|
918874
|
-
return "4.81.0-
|
|
918974
|
+
return "4.81.0-15-gf31c7899b46";
|
|
918875
918975
|
}
|
|
918876
918976
|
getCliName() {
|
|
918877
918977
|
if (false) {
|
package/package.json
CHANGED