@fern-api/fern-api-dev 4.53.1 → 4.53.2
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 +118 -50
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -602380,7 +602380,7 @@ var AccessTokenPosthogManager = class {
|
|
|
602380
602380
|
properties: {
|
|
602381
602381
|
...event,
|
|
602382
602382
|
...event.properties,
|
|
602383
|
-
version: "4.53.
|
|
602383
|
+
version: "4.53.2",
|
|
602384
602384
|
usingAccessToken: true
|
|
602385
602385
|
}
|
|
602386
602386
|
});
|
|
@@ -602431,7 +602431,7 @@ var UserPosthogManager = class {
|
|
|
602431
602431
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
602432
602432
|
event: "CLI",
|
|
602433
602433
|
properties: {
|
|
602434
|
-
version: "4.53.
|
|
602434
|
+
version: "4.53.2",
|
|
602435
602435
|
...event,
|
|
602436
602436
|
...event.properties,
|
|
602437
602437
|
usingAccessToken: false,
|
|
@@ -826304,7 +826304,7 @@ var import_path54 = __toESM(require("path"), 1);
|
|
|
826304
826304
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
826305
826305
|
var LOGS_FOLDER_NAME = "logs";
|
|
826306
826306
|
function getCliSource() {
|
|
826307
|
-
const version7 = "4.53.
|
|
826307
|
+
const version7 = "4.53.2";
|
|
826308
826308
|
return `cli@${version7}`;
|
|
826309
826309
|
}
|
|
826310
826310
|
var DebugLogger = class {
|
|
@@ -836528,7 +836528,7 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain3
|
|
|
836528
836528
|
}
|
|
836529
836529
|
return convertToFilePathPairs(startDocsRegisterResponse.body.uploadUrls, docsWorkspace.absoluteFilePath, sanitizedToAbsoluteMap);
|
|
836530
836530
|
} else {
|
|
836531
|
-
return await startDocsRegisterFailed(startDocsRegisterResponse.error, context3, organization);
|
|
836531
|
+
return await startDocsRegisterFailed(startDocsRegisterResponse.error, context3, organization, domain3);
|
|
836532
836532
|
}
|
|
836533
836533
|
} else {
|
|
836534
836534
|
const startDocsRegisterResponse = await fdr.docs.v2.write.startDocsRegister({
|
|
@@ -836564,7 +836564,7 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain3
|
|
|
836564
836564
|
}
|
|
836565
836565
|
return convertToFilePathPairs(startDocsRegisterResponse.body.uploadUrls, docsWorkspace.absoluteFilePath, sanitizedToAbsoluteMap);
|
|
836566
836566
|
} else {
|
|
836567
|
-
return startDocsRegisterFailed(startDocsRegisterResponse.error, context3, organization);
|
|
836567
|
+
return startDocsRegisterFailed(startDocsRegisterResponse.error, context3, organization, domain3);
|
|
836568
836568
|
}
|
|
836569
836569
|
}
|
|
836570
836570
|
},
|
|
@@ -836768,19 +836768,22 @@ function convertToFilePathPairs(uploadUrls, docsWorkspacePath, sanitizedToAbsolu
|
|
|
836768
836768
|
}
|
|
836769
836769
|
return toRet;
|
|
836770
836770
|
}
|
|
836771
|
-
async function startDocsRegisterFailed(error50, context3, organization) {
|
|
836771
|
+
async function startDocsRegisterFailed(error50, context3, organization, domain3) {
|
|
836772
836772
|
await context3.instrumentPostHogEvent({
|
|
836773
836773
|
command: "docs-generation",
|
|
836774
836774
|
properties: {
|
|
836775
836775
|
error: JSON.stringify(error50)
|
|
836776
836776
|
}
|
|
836777
836777
|
});
|
|
836778
|
+
const errorDetails = extractErrorDetails(error50);
|
|
836779
|
+
context3.logger.debug(`startDocsRegister failed for domain '${domain3}', org '${organization}'. Error details:
|
|
836780
|
+
${JSON.stringify(errorDetails, void 0, 2)}`);
|
|
836778
836781
|
const errorObj = error50;
|
|
836779
836782
|
const errorContent = errorObj?.content;
|
|
836780
836783
|
if (errorContent?.reason === "status-code" && errorContent?.statusCode === 409) {
|
|
836781
836784
|
throw new DocsPublishConflictError();
|
|
836782
836785
|
}
|
|
836783
|
-
const authErrorMessage = getAuthenticationErrorMessage(error50, organization);
|
|
836786
|
+
const authErrorMessage = getAuthenticationErrorMessage(error50, organization, domain3);
|
|
836784
836787
|
if (authErrorMessage != null) {
|
|
836785
836788
|
return context3.failAndThrow(authErrorMessage);
|
|
836786
836789
|
}
|
|
@@ -836790,9 +836793,7 @@ async function startDocsRegisterFailed(error50, context3, organization) {
|
|
|
836790
836793
|
case "InvalidDomainError":
|
|
836791
836794
|
return context3.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)");
|
|
836792
836795
|
case "UnauthorizedError":
|
|
836793
|
-
return context3.failAndThrow(
|
|
836794
|
-
|
|
836795
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`);
|
|
836796
|
+
return context3.failAndThrow(buildAuthFailureMessage(domain3, organization, errorContent));
|
|
836796
836797
|
case "UserNotInOrgError":
|
|
836797
836798
|
return context3.failAndThrow(`You do not belong to organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
836798
836799
|
|
|
@@ -836803,21 +836804,66 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
|
|
|
836803
836804
|
return context3.failAndThrow("Failed to publish docs.", error50);
|
|
836804
836805
|
}
|
|
836805
836806
|
}
|
|
836806
|
-
function getAuthenticationErrorMessage(error50, organization) {
|
|
836807
|
+
function getAuthenticationErrorMessage(error50, organization, domain3) {
|
|
836807
836808
|
const errorObj = error50;
|
|
836808
836809
|
const content5 = errorObj?.content;
|
|
836809
836810
|
if (content5?.reason === "status-code") {
|
|
836810
836811
|
const statusCode = content5.statusCode;
|
|
836811
836812
|
if (statusCode === 401 || statusCode === 403) {
|
|
836812
|
-
|
|
836813
|
-
const contactMessage = "Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.";
|
|
836814
|
-
return `${baseMessage}
|
|
836815
|
-
|
|
836816
|
-
${contactMessage}`;
|
|
836813
|
+
return buildAuthFailureMessage(domain3, organization, content5);
|
|
836817
836814
|
}
|
|
836818
836815
|
}
|
|
836819
836816
|
return void 0;
|
|
836820
836817
|
}
|
|
836818
|
+
function buildAuthFailureMessage(domain3, organization, errorContent) {
|
|
836819
|
+
const { code: code5, message } = extractServerError(errorContent);
|
|
836820
|
+
switch (code5) {
|
|
836821
|
+
case "FORBIDDEN":
|
|
836822
|
+
return buildForbiddenMessage(domain3, organization, message);
|
|
836823
|
+
case "UNAUTHORIZED":
|
|
836824
|
+
return buildUnauthorizedMessage(organization, message);
|
|
836825
|
+
case "INTERNAL_SERVER_ERROR":
|
|
836826
|
+
return `An internal server error occurred while publishing docs to '${domain3}'. Please try again or reach out to support@buildwithfern.com for assistance.`;
|
|
836827
|
+
default:
|
|
836828
|
+
if (message != null) {
|
|
836829
|
+
return message;
|
|
836830
|
+
}
|
|
836831
|
+
return `Failed to publish docs to '${domain3}'. Please reach out to support@buildwithfern.com for assistance.`;
|
|
836832
|
+
}
|
|
836833
|
+
}
|
|
836834
|
+
var FORBIDDEN_ORG_MEMBERSHIP_PATTERNS = ["does not belong to organization", "User does not belong"];
|
|
836835
|
+
function buildForbiddenMessage(domain3, organization, message) {
|
|
836836
|
+
if (message == null) {
|
|
836837
|
+
return `You do not have permission to publish docs to '${domain3}' under organization '${organization}'.`;
|
|
836838
|
+
}
|
|
836839
|
+
if (FORBIDDEN_ORG_MEMBERSHIP_PATTERNS.some((pattern) => message.includes(pattern))) {
|
|
836840
|
+
return `You are not a member of organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
836841
|
+
|
|
836842
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`;
|
|
836843
|
+
}
|
|
836844
|
+
return message;
|
|
836845
|
+
}
|
|
836846
|
+
function buildUnauthorizedMessage(organization, message) {
|
|
836847
|
+
if (message != null && message.includes("Invalid authorization token")) {
|
|
836848
|
+
return "Your authentication token is invalid or expired. Please run 'fern login' to re-authenticate.";
|
|
836849
|
+
}
|
|
836850
|
+
return `You are not authorized to publish docs under organization '${organization}'. Please run 'fern login' to ensure you are logged in with the correct account.
|
|
836851
|
+
|
|
836852
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`;
|
|
836853
|
+
}
|
|
836854
|
+
function extractServerError(content5) {
|
|
836855
|
+
if (content5 == null) {
|
|
836856
|
+
return { code: void 0, message: void 0 };
|
|
836857
|
+
}
|
|
836858
|
+
const body = content5.body;
|
|
836859
|
+
if (body != null && typeof body === "object") {
|
|
836860
|
+
const code5 = typeof body.code === "string" ? body.code : void 0;
|
|
836861
|
+
const message2 = typeof body.message === "string" ? body.message : void 0;
|
|
836862
|
+
return { code: code5, message: message2 };
|
|
836863
|
+
}
|
|
836864
|
+
const message = typeof body === "string" && body.length > 0 ? body : typeof content5.errorMessage === "string" ? content5.errorMessage : typeof content5.message === "string" ? content5.message : void 0;
|
|
836865
|
+
return { code: void 0, message };
|
|
836866
|
+
}
|
|
836821
836867
|
function parseBasePath(domain3) {
|
|
836822
836868
|
try {
|
|
836823
836869
|
return new URL(wrapWithHttps(domain3)).pathname;
|
|
@@ -837316,7 +837362,7 @@ var LegacyDocsPublisher = class {
|
|
|
837316
837362
|
previewId: void 0,
|
|
837317
837363
|
disableTemplates: void 0,
|
|
837318
837364
|
skipUpload,
|
|
837319
|
-
cliVersion: "4.53.
|
|
837365
|
+
cliVersion: "4.53.2"
|
|
837320
837366
|
});
|
|
837321
837367
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
837322
837368
|
return { success: false };
|
|
@@ -875310,6 +875356,28 @@ var RustFilenameRegistry = class _RustFilenameRegistry {
|
|
|
875310
875356
|
baseTypeName
|
|
875311
875357
|
]);
|
|
875312
875358
|
}
|
|
875359
|
+
/**
|
|
875360
|
+
* Register filename for bytes request body types
|
|
875361
|
+
* @param endpointId - Unique endpoint ID from IR
|
|
875362
|
+
* @param baseFilename - Base filename in snake_case (without .rs extension)
|
|
875363
|
+
* @returns The registered unique filename (without .rs extension)
|
|
875364
|
+
*/
|
|
875365
|
+
registerBytesRequestFilename(endpointId, baseFilename) {
|
|
875366
|
+
return this.filenameRegistry.registerSymbol(this.getBytesRequestFilenameId(endpointId), [
|
|
875367
|
+
baseFilename,
|
|
875368
|
+
`${baseFilename}_request`,
|
|
875369
|
+
`${baseFilename}_bytes`
|
|
875370
|
+
]);
|
|
875371
|
+
}
|
|
875372
|
+
/**
|
|
875373
|
+
* Register type name for bytes request body
|
|
875374
|
+
* @param endpointId - Unique endpoint ID from IR
|
|
875375
|
+
* @param baseTypeName - Base type name in PascalCase
|
|
875376
|
+
* @returns The registered unique type name
|
|
875377
|
+
*/
|
|
875378
|
+
registerBytesRequestTypeName(endpointId, baseTypeName) {
|
|
875379
|
+
return this.typenameRegistry.registerSymbol(this.getBytesRequestTypeNameId(endpointId), [baseTypeName]);
|
|
875380
|
+
}
|
|
875313
875381
|
/**
|
|
875314
875382
|
* Register client name for a subpackage or root client
|
|
875315
875383
|
* @param clientId - Unique identifier for the client (subpackage ID or "root")
|
|
@@ -875451,6 +875519,28 @@ var RustFilenameRegistry = class _RustFilenameRegistry {
|
|
|
875451
875519
|
assertDefined(typename, `Type name not found for referenced request with query ${endpointId}`);
|
|
875452
875520
|
return typename;
|
|
875453
875521
|
}
|
|
875522
|
+
/**
|
|
875523
|
+
* Get registered filename for bytes request body
|
|
875524
|
+
* @param endpointId - Unique endpoint ID from IR
|
|
875525
|
+
* @returns Filename with .rs extension
|
|
875526
|
+
* @throws Error if filename not registered
|
|
875527
|
+
*/
|
|
875528
|
+
getBytesRequestFilenameOrThrow(endpointId) {
|
|
875529
|
+
const filename = this.filenameRegistry.getSymbolNameById(this.getBytesRequestFilenameId(endpointId));
|
|
875530
|
+
assertDefined(filename, `Filename not found for bytes request ${endpointId}`);
|
|
875531
|
+
return `${filename}.rs`;
|
|
875532
|
+
}
|
|
875533
|
+
/**
|
|
875534
|
+
* Get registered type name for bytes request body
|
|
875535
|
+
* @param endpointId - Unique endpoint ID from IR
|
|
875536
|
+
* @returns The unique type name
|
|
875537
|
+
* @throws Error if type name not registered
|
|
875538
|
+
*/
|
|
875539
|
+
getBytesRequestTypeNameOrThrow(endpointId) {
|
|
875540
|
+
const typename = this.typenameRegistry.getSymbolNameById(this.getBytesRequestTypeNameId(endpointId));
|
|
875541
|
+
assertDefined(typename, `Type name not found for bytes request ${endpointId}`);
|
|
875542
|
+
return typename;
|
|
875543
|
+
}
|
|
875454
875544
|
// =====================================
|
|
875455
875545
|
// Private Helper Methods
|
|
875456
875546
|
// =====================================
|
|
@@ -875487,6 +875577,12 @@ var RustFilenameRegistry = class _RustFilenameRegistry {
|
|
|
875487
875577
|
getReferencedRequestWithQueryTypeNameId(endpointId) {
|
|
875488
875578
|
return `${TYPENAME_ID_PREFIX}referenced_request_with_query_${endpointId}`;
|
|
875489
875579
|
}
|
|
875580
|
+
getBytesRequestFilenameId(endpointId) {
|
|
875581
|
+
return `${FILENAME_ID_PREFIX}bytes_request_${endpointId}`;
|
|
875582
|
+
}
|
|
875583
|
+
getBytesRequestTypeNameId(endpointId) {
|
|
875584
|
+
return `${TYPENAME_ID_PREFIX}bytes_request_${endpointId}`;
|
|
875585
|
+
}
|
|
875490
875586
|
};
|
|
875491
875587
|
|
|
875492
875588
|
// ../../../generators/rust/base/lib/utils/index.js
|
|
@@ -879814,10 +879910,7 @@ var EndpointSnippetGenerator8 = class {
|
|
|
879814
879910
|
const hasBody = request7.body != null;
|
|
879815
879911
|
const body = request7.body;
|
|
879816
879912
|
const isReferencedBodyOnly = body != null && !hasQueryParams && body.type === "referenced";
|
|
879817
|
-
|
|
879818
|
-
if (isBytesWithQueryParams) {
|
|
879819
|
-
args.push(...this.getBytesEndpointArgs({ request: request7, snippet: snippet2 }));
|
|
879820
|
-
} else if (isReferencedBodyOnly && body.type === "referenced") {
|
|
879913
|
+
if (isReferencedBodyOnly && body.type === "referenced") {
|
|
879821
879914
|
const bodyExpr = this.getReferencedRequestBodyPropertyExpression({
|
|
879822
879915
|
body: body.bodyType,
|
|
879823
879916
|
value: snippet2.requestBody
|
|
@@ -879834,34 +879927,6 @@ var EndpointSnippetGenerator8 = class {
|
|
|
879834
879927
|
}
|
|
879835
879928
|
return args;
|
|
879836
879929
|
}
|
|
879837
|
-
getBytesEndpointArgs({ request: request7, snippet: snippet2 }) {
|
|
879838
|
-
const args = [];
|
|
879839
|
-
const queryParameters = this.context.associateQueryParametersByWireValue({
|
|
879840
|
-
parameters: request7.queryParameters ?? [],
|
|
879841
|
-
values: snippet2.queryParameters ?? {}
|
|
879842
|
-
});
|
|
879843
|
-
const providedValues = /* @__PURE__ */ new Map();
|
|
879844
|
-
for (const qp4 of queryParameters) {
|
|
879845
|
-
const fieldName = this.context.getPropertyName(qp4.name.name);
|
|
879846
|
-
providedValues.set(fieldName, this.context.dynamicTypeLiteralMapper.convert(qp4));
|
|
879847
|
-
}
|
|
879848
|
-
const allQueryParams = request7.queryParameters ?? [];
|
|
879849
|
-
for (const param of allQueryParams) {
|
|
879850
|
-
const fieldName = this.context.getPropertyName(param.name.name);
|
|
879851
|
-
const value = providedValues.get(fieldName);
|
|
879852
|
-
if (value != null) {
|
|
879853
|
-
args.push(rust_exports.Expression.referenceOf(value));
|
|
879854
|
-
} else {
|
|
879855
|
-
args.push(rust_exports.Expression.referenceOf(rust_exports.Expression.raw("None")));
|
|
879856
|
-
}
|
|
879857
|
-
}
|
|
879858
|
-
if (snippet2.requestBody != null && typeof snippet2.requestBody === "string" && snippet2.requestBody !== "") {
|
|
879859
|
-
args.push(rust_exports.Expression.referenceOf(rust_exports.Expression.raw(`"${snippet2.requestBody}".as_bytes().to_vec()`)));
|
|
879860
|
-
} else {
|
|
879861
|
-
args.push(rust_exports.Expression.referenceOf(rust_exports.Expression.raw("vec![]")));
|
|
879862
|
-
}
|
|
879863
|
-
return args;
|
|
879864
|
-
}
|
|
879865
879930
|
getBodyRequestArg({ body, value }) {
|
|
879866
879931
|
switch (body.type) {
|
|
879867
879932
|
case "bytes":
|
|
@@ -879873,6 +879938,9 @@ var EndpointSnippetGenerator8 = class {
|
|
|
879873
879938
|
}
|
|
879874
879939
|
}
|
|
879875
879940
|
getBytesBodyRequestArg({ value }) {
|
|
879941
|
+
if (value == null) {
|
|
879942
|
+
return rust_exports.Expression.raw("vec![]");
|
|
879943
|
+
}
|
|
879876
879944
|
if (typeof value !== "string") {
|
|
879877
879945
|
this.context.errors.add({
|
|
879878
879946
|
severity: Severity.Critical,
|
|
@@ -910436,7 +910504,7 @@ var CliContext = class {
|
|
|
910436
910504
|
if (false) {
|
|
910437
910505
|
this.logger.error("CLI_VERSION is not defined");
|
|
910438
910506
|
}
|
|
910439
|
-
return "4.53.
|
|
910507
|
+
return "4.53.2";
|
|
910440
910508
|
}
|
|
910441
910509
|
getCliName() {
|
|
910442
910510
|
if (false) {
|
package/package.json
CHANGED