@fern-api/fern-api-dev 4.53.1-21-gc889c7f1eeb → 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 +64 -18
- 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 };
|
|
@@ -910458,7 +910504,7 @@ var CliContext = class {
|
|
|
910458
910504
|
if (false) {
|
|
910459
910505
|
this.logger.error("CLI_VERSION is not defined");
|
|
910460
910506
|
}
|
|
910461
|
-
return "4.53.
|
|
910507
|
+
return "4.53.2";
|
|
910462
910508
|
}
|
|
910463
910509
|
getCliName() {
|
|
910464
910510
|
if (false) {
|
package/package.json
CHANGED