fern-api 0.26.8 → 0.26.9-rc1
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/bundle.cjs +54 -101
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -977842,7 +977842,7 @@ var AccessTokenPosthogManager = class {
|
|
|
977842
977842
|
properties: {
|
|
977843
977843
|
...event,
|
|
977844
977844
|
...event.properties,
|
|
977845
|
-
version: "0.26.
|
|
977845
|
+
version: "0.26.9-rc1",
|
|
977846
977846
|
usingAccessToken: true
|
|
977847
977847
|
}
|
|
977848
977848
|
});
|
|
@@ -977904,7 +977904,7 @@ var UserPosthogManager = class {
|
|
|
977904
977904
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
977905
977905
|
event: "CLI",
|
|
977906
977906
|
properties: {
|
|
977907
|
-
version: "0.26.
|
|
977907
|
+
version: "0.26.9-rc1",
|
|
977908
977908
|
...event,
|
|
977909
977909
|
...event.properties
|
|
977910
977910
|
}
|
|
@@ -1002759,10 +1002759,10 @@ var CliContext = class {
|
|
|
1002759
1002759
|
return "fern-api";
|
|
1002760
1002760
|
}
|
|
1002761
1002761
|
getPackageVersion() {
|
|
1002762
|
-
if ("0.26.
|
|
1002762
|
+
if ("0.26.9-rc1" == null) {
|
|
1002763
1002763
|
this.logger.error("CLI_VERSION is not defined");
|
|
1002764
1002764
|
}
|
|
1002765
|
-
return "0.26.
|
|
1002765
|
+
return "0.26.9-rc1";
|
|
1002766
1002766
|
}
|
|
1002767
1002767
|
getCliName() {
|
|
1002768
1002768
|
if ("fern" == null) {
|
|
@@ -1053278,6 +1053278,18 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain2
|
|
|
1053278
1053278
|
absolutePathToFernFolder: docsWorkspace.absoluteFilepath,
|
|
1053279
1053279
|
absoluteFilepathToDocsConfig: docsWorkspace.absoluteFilepathToDocsConfig
|
|
1053280
1053280
|
});
|
|
1053281
|
+
fernWorkspaces.forEach((workspace) => {
|
|
1053282
|
+
if (workspace.changelog != null) {
|
|
1053283
|
+
workspace.changelog.files.forEach((file) => {
|
|
1053284
|
+
const filename = last_default(file.absoluteFilepath.split("/"));
|
|
1053285
|
+
if (filename == null) {
|
|
1053286
|
+
return;
|
|
1053287
|
+
}
|
|
1053288
|
+
const relativePath = relative(docsWorkspace.absoluteFilepath, file.absoluteFilepath);
|
|
1053289
|
+
parsedDocsConfig.pages[relativePath] = file.contents;
|
|
1053290
|
+
});
|
|
1053291
|
+
}
|
|
1053292
|
+
});
|
|
1053281
1053293
|
const mdxImageReferences = [];
|
|
1053282
1053294
|
for (const [relativePath, markdown] of Object.entries(parsedDocsConfig.pages)) {
|
|
1053283
1053295
|
const { filepaths, markdown: newMarkdown } = parseImagePaths(RelativeFilePath.of(relativePath), markdown);
|
|
@@ -1053334,8 +1053346,13 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain2
|
|
|
1053334
1053346
|
}
|
|
1053335
1053347
|
const { docsRegistrationId, uploadUrls } = startDocsRegisterResponse.body;
|
|
1053336
1053348
|
const collectedFileIds = /* @__PURE__ */ new Map();
|
|
1053337
|
-
|
|
1053338
|
-
...filepathsToUpload
|
|
1053349
|
+
const allFilepathsToUpload = [
|
|
1053350
|
+
...filepathsToUpload,
|
|
1053351
|
+
...imageFilepathsWithSizesToUpload.map((image2) => image2.filePath)
|
|
1053352
|
+
];
|
|
1053353
|
+
const chunkedFilepathsToUpload = chunk_default(allFilepathsToUpload, 50);
|
|
1053354
|
+
for (const chunkedFilepaths of chunkedFilepathsToUpload) {
|
|
1053355
|
+
await Promise.all(chunkedFilepaths.map(async (filepathToUpload) => {
|
|
1053339
1053356
|
const relativePath = convertAbsoluteFilepathToFdrFilepath(filepathToUpload, parsedDocsConfig);
|
|
1053340
1053357
|
const uploadUrl = uploadUrls[relativePath];
|
|
1053341
1053358
|
if (uploadUrl == null) {
|
|
@@ -1053353,27 +1053370,8 @@ async function publishDocs({ token, organization, docsWorkspace, domain: domain2
|
|
|
1053353
1053370
|
context.failAndThrow(`Failed to upload ${filepathToUpload}`, e);
|
|
1053354
1053371
|
}
|
|
1053355
1053372
|
}
|
|
1053356
|
-
})
|
|
1053357
|
-
|
|
1053358
|
-
const relativePath = convertAbsoluteFilepathToFdrFilepath(imageFilepathToUpload, parsedDocsConfig);
|
|
1053359
|
-
const uploadUrl = uploadUrls[relativePath];
|
|
1053360
|
-
if (uploadUrl == null) {
|
|
1053361
|
-
context.failAndThrow(`Failed to upload ${imageFilepathToUpload}`, "Upload URL is missing");
|
|
1053362
|
-
} else {
|
|
1053363
|
-
try {
|
|
1053364
|
-
const mimeType = mime.lookup(imageFilepathToUpload);
|
|
1053365
|
-
await import_axios8.default.put(uploadUrl.uploadUrl, await (0, import_promises43.readFile)(imageFilepathToUpload), {
|
|
1053366
|
-
headers: {
|
|
1053367
|
-
"Content-Type": mimeType === false ? "application/octet-stream" : mimeType
|
|
1053368
|
-
}
|
|
1053369
|
-
});
|
|
1053370
|
-
collectedFileIds.set(relativePath, uploadUrl.fileId);
|
|
1053371
|
-
} catch (e) {
|
|
1053372
|
-
context.failAndThrow(`Failed to upload ${imageFilepathToUpload}`, e);
|
|
1053373
|
-
}
|
|
1053374
|
-
}
|
|
1053375
|
-
})
|
|
1053376
|
-
]);
|
|
1053373
|
+
}));
|
|
1053374
|
+
}
|
|
1053377
1053375
|
for (const [relativePath, markdown] of Object.entries(parsedDocsConfig.pages)) {
|
|
1053378
1053376
|
parsedDocsConfig.pages[RelativeFilePath.of(relativePath)] = replaceImagePaths(markdown, collectedFileIds);
|
|
1053379
1053377
|
}
|
|
@@ -1053433,8 +1053431,7 @@ async function constructRegisterDocsRequest({ parsedDocsConfig, organization, fe
|
|
|
1053433
1053431
|
markdown: pageContents,
|
|
1053434
1053432
|
editThisPageUrl: createEditThisPageUrl(editThisPage, pageFilepath)
|
|
1053435
1053433
|
}
|
|
1053436
|
-
}), {})
|
|
1053437
|
-
...convertedDocsConfiguration.pages
|
|
1053434
|
+
}), {})
|
|
1053438
1053435
|
};
|
|
1053439
1053436
|
pages = Object.fromEntries(Object.entries(pages).map(([pageId, pageContent]) => {
|
|
1053440
1053437
|
var _a5;
|
|
@@ -1053507,14 +1053504,10 @@ async function convertDocsConfiguration({ parsedDocsConfig, organization, fernWo
|
|
|
1053507
1053504
|
css: parsedDocsConfig.css,
|
|
1053508
1053505
|
js: convertJavascriptConfiguration(parsedDocsConfig.js, uploadUrls, parsedDocsConfig)
|
|
1053509
1053506
|
};
|
|
1053510
|
-
return {
|
|
1053511
|
-
config,
|
|
1053512
|
-
pages: convertedNavigation.pages
|
|
1053513
|
-
};
|
|
1053507
|
+
return { config };
|
|
1053514
1053508
|
}
|
|
1053515
1053509
|
async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs, absolutePathToFernFolder }) {
|
|
1053516
1053510
|
let config;
|
|
1053517
|
-
let pages = {};
|
|
1053518
1053511
|
switch (navigationConfig.type) {
|
|
1053519
1053512
|
case "untabbed": {
|
|
1053520
1053513
|
const untabbedItems = await Promise.all(navigationConfig.items.map((item) => convertNavigationItem2({
|
|
@@ -1053528,12 +1053521,6 @@ async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfi
|
|
|
1053528
1053521
|
fullSlugs,
|
|
1053529
1053522
|
absolutePathToFernFolder
|
|
1053530
1053523
|
})));
|
|
1053531
|
-
for (const untabbedItem of untabbedItems) {
|
|
1053532
|
-
pages = {
|
|
1053533
|
-
...pages,
|
|
1053534
|
-
...untabbedItem.pages
|
|
1053535
|
-
};
|
|
1053536
|
-
}
|
|
1053537
1053524
|
config = {
|
|
1053538
1053525
|
items: untabbedItems.map((item) => item.item)
|
|
1053539
1053526
|
};
|
|
@@ -1053553,7 +1053540,6 @@ async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfi
|
|
|
1053553
1053540
|
config = {
|
|
1053554
1053541
|
tabs: tabbedItem.tabs
|
|
1053555
1053542
|
};
|
|
1053556
|
-
pages = { ...pages, ...tabbedItem.pages };
|
|
1053557
1053543
|
break;
|
|
1053558
1053544
|
}
|
|
1053559
1053545
|
case "versioned":
|
|
@@ -1053571,10 +1053557,6 @@ async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfi
|
|
|
1053571
1053557
|
fullSlugs,
|
|
1053572
1053558
|
absolutePathToFernFolder
|
|
1053573
1053559
|
});
|
|
1053574
|
-
pages = {
|
|
1053575
|
-
...pages,
|
|
1053576
|
-
...convertedNavigation.pages
|
|
1053577
|
-
};
|
|
1053578
1053560
|
return {
|
|
1053579
1053561
|
version: version4.version,
|
|
1053580
1053562
|
config: convertedNavigation.config,
|
|
@@ -1053587,10 +1053569,7 @@ async function convertNavigationConfig({ navigationConfig, tabs, parsedDocsConfi
|
|
|
1053587
1053569
|
default:
|
|
1053588
1053570
|
assertNever(navigationConfig);
|
|
1053589
1053571
|
}
|
|
1053590
|
-
return {
|
|
1053591
|
-
config,
|
|
1053592
|
-
pages
|
|
1053593
|
-
};
|
|
1053572
|
+
return { config };
|
|
1053594
1053573
|
}
|
|
1053595
1053574
|
function convertAvailability2(availability) {
|
|
1053596
1053575
|
switch (availability) {
|
|
@@ -1053608,7 +1053587,6 @@ function convertAvailability2(availability) {
|
|
|
1053608
1053587
|
}
|
|
1053609
1053588
|
async function convertUnversionedNavigationConfig({ navigationConfig, tabs, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs, absolutePathToFernFolder }) {
|
|
1053610
1053589
|
let config;
|
|
1053611
|
-
let pages = {};
|
|
1053612
1053590
|
switch (navigationConfig.type) {
|
|
1053613
1053591
|
case "untabbed": {
|
|
1053614
1053592
|
const untabbedItems = await Promise.all(navigationConfig.items.map((item) => convertNavigationItem2({
|
|
@@ -1053625,12 +1053603,6 @@ async function convertUnversionedNavigationConfig({ navigationConfig, tabs, pars
|
|
|
1053625
1053603
|
config = {
|
|
1053626
1053604
|
items: untabbedItems.map((item) => item.item)
|
|
1053627
1053605
|
};
|
|
1053628
|
-
for (const untabbedItem of untabbedItems) {
|
|
1053629
|
-
pages = {
|
|
1053630
|
-
...pages,
|
|
1053631
|
-
...untabbedItem.pages
|
|
1053632
|
-
};
|
|
1053633
|
-
}
|
|
1053634
1053606
|
break;
|
|
1053635
1053607
|
}
|
|
1053636
1053608
|
case "tabbed": {
|
|
@@ -1053647,19 +1053619,14 @@ async function convertUnversionedNavigationConfig({ navigationConfig, tabs, pars
|
|
|
1053647
1053619
|
config = {
|
|
1053648
1053620
|
tabs: tabbedItem.tabs
|
|
1053649
1053621
|
};
|
|
1053650
|
-
pages = { ...pages, ...tabbedItem.pages };
|
|
1053651
1053622
|
break;
|
|
1053652
1053623
|
}
|
|
1053653
1053624
|
default:
|
|
1053654
1053625
|
assertNever(navigationConfig);
|
|
1053655
1053626
|
}
|
|
1053656
|
-
return {
|
|
1053657
|
-
config,
|
|
1053658
|
-
pages
|
|
1053659
|
-
};
|
|
1053627
|
+
return { config };
|
|
1053660
1053628
|
}
|
|
1053661
1053629
|
async function convertTabbedNavigation(items, tabs, { parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs, absolutePathToFernFolder }) {
|
|
1053662
|
-
let pages = {};
|
|
1053663
1053630
|
const convertedTabs = await Promise.all(items.map(async (tabbedItem) => {
|
|
1053664
1053631
|
const tabConfig = tabs == null ? void 0 : tabs[tabbedItem.tab];
|
|
1053665
1053632
|
if (tabConfig == null) {
|
|
@@ -1053689,12 +1053656,6 @@ async function convertTabbedNavigation(items, tabs, { parsedDocsConfig, organiza
|
|
|
1053689
1053656
|
fullSlugs,
|
|
1053690
1053657
|
absolutePathToFernFolder
|
|
1053691
1053658
|
})));
|
|
1053692
|
-
tabbedItems.forEach((tabbedItem2) => {
|
|
1053693
|
-
pages = {
|
|
1053694
|
-
...pages,
|
|
1053695
|
-
...tabbedItem2.pages
|
|
1053696
|
-
};
|
|
1053697
|
-
});
|
|
1053698
1053659
|
return {
|
|
1053699
1053660
|
title: tabConfig.displayName,
|
|
1053700
1053661
|
icon: tabConfig.icon,
|
|
@@ -1053702,10 +1053663,7 @@ async function convertTabbedNavigation(items, tabs, { parsedDocsConfig, organiza
|
|
|
1053702
1053663
|
urlSlugOverride: tabConfig.slug
|
|
1053703
1053664
|
};
|
|
1053704
1053665
|
}));
|
|
1053705
|
-
return {
|
|
1053706
|
-
tabs: convertedTabs,
|
|
1053707
|
-
pages
|
|
1053708
|
-
};
|
|
1053666
|
+
return { tabs: convertedTabs };
|
|
1053709
1053667
|
}
|
|
1053710
1053668
|
function convertDocsTypographyConfiguration({ typographyConfiguration, parsedDocsConfig, uploadUrls, context, fullSlugs }) {
|
|
1053711
1053669
|
if (typographyConfiguration == null) {
|
|
@@ -1053867,7 +1053825,6 @@ function convertImageReference2({ imageReference: imageReference2, parsedDocsCon
|
|
|
1053867
1053825
|
async function convertNavigationItem2({ item, parsedDocsConfig, organization, fernWorkspaces, context, token, version: version3, fullSlugs, absolutePathToFernFolder }) {
|
|
1053868
1053826
|
var _a5, _b4;
|
|
1053869
1053827
|
let convertedItem;
|
|
1053870
|
-
let pages = {};
|
|
1053871
1053828
|
switch (item.type) {
|
|
1053872
1053829
|
case "page": {
|
|
1053873
1053830
|
convertedItem = {
|
|
@@ -1053903,12 +1053860,6 @@ async function convertNavigationItem2({ item, parsedDocsConfig, organization, fe
|
|
|
1053903
1053860
|
hidden: item.hidden,
|
|
1053904
1053861
|
skipUrlSlug: item.skipUrlSlug
|
|
1053905
1053862
|
};
|
|
1053906
|
-
for (const sectionItem of sectionItems) {
|
|
1053907
|
-
pages = {
|
|
1053908
|
-
...pages,
|
|
1053909
|
-
...sectionItem.pages
|
|
1053910
|
-
};
|
|
1053911
|
-
}
|
|
1053912
1053863
|
break;
|
|
1053913
1053864
|
}
|
|
1053914
1053865
|
case "apiSection": {
|
|
@@ -1053928,7 +1053879,7 @@ async function convertNavigationItem2({ item, parsedDocsConfig, organization, fe
|
|
|
1053928
1053879
|
}
|
|
1053929
1053880
|
})
|
|
1053930
1053881
|
});
|
|
1053931
|
-
const
|
|
1053882
|
+
const unsortedChangelogItems = [];
|
|
1053932
1053883
|
if (workspace.changelog != null) {
|
|
1053933
1053884
|
for (const file of workspace.changelog.files) {
|
|
1053934
1053885
|
const filename = last_default(file.absoluteFilepath.split("/"));
|
|
@@ -1053940,15 +1053891,13 @@ async function convertNavigationItem2({ item, parsedDocsConfig, organization, fe
|
|
|
1053940
1053891
|
continue;
|
|
1053941
1053892
|
}
|
|
1053942
1053893
|
const relativePath = relative(absolutePathToFernFolder, file.absoluteFilepath);
|
|
1053943
|
-
|
|
1053944
|
-
markdown: file.contents
|
|
1053945
|
-
};
|
|
1053946
|
-
changelogItems.push({
|
|
1053947
|
-
date: changelogDate.toISOString(),
|
|
1053948
|
-
pageId: relativePath
|
|
1053949
|
-
});
|
|
1053894
|
+
unsortedChangelogItems.push({ date: changelogDate, pageId: relativePath });
|
|
1053950
1053895
|
}
|
|
1053951
1053896
|
}
|
|
1053897
|
+
const changelogItems = orderBy_default(unsortedChangelogItems, (item2) => item2.date, "desc").map((item2) => ({
|
|
1053898
|
+
date: item2.date.toISOString(),
|
|
1053899
|
+
pageId: item2.pageId
|
|
1053900
|
+
}));
|
|
1053952
1053901
|
convertedItem = {
|
|
1053953
1053902
|
type: "api",
|
|
1053954
1053903
|
title: item.title,
|
|
@@ -1053979,8 +1053928,7 @@ async function convertNavigationItem2({ item, parsedDocsConfig, organization, fe
|
|
|
1053979
1053928
|
assertNever(item);
|
|
1053980
1053929
|
}
|
|
1053981
1053930
|
return {
|
|
1053982
|
-
item: convertedItem
|
|
1053983
|
-
pages
|
|
1053931
|
+
item: convertedItem
|
|
1053984
1053932
|
};
|
|
1053985
1053933
|
}
|
|
1053986
1053934
|
function convertDocsSnippetsConfigurationToFdr({ snippetsConfiguration }) {
|
|
@@ -1054044,20 +1053992,25 @@ async function getImageFilepathsToUpload(parsedDocsConfig, parsedImagePaths) {
|
|
|
1054044
1053992
|
for (const parsedImagePath of parsedImagePaths) {
|
|
1054045
1053993
|
filepaths.add(parsedImagePath.filepath);
|
|
1054046
1053994
|
}
|
|
1054047
|
-
const
|
|
1054048
|
-
|
|
1054049
|
-
|
|
1054050
|
-
|
|
1053995
|
+
const filepathChunks = chunk_default([...filepaths], 10);
|
|
1053996
|
+
const imageFilepathsAndSizesToUpload = [];
|
|
1053997
|
+
for (const filepaths2 of filepathChunks) {
|
|
1053998
|
+
const chunk2 = await Promise.all(filepaths2.map(async (filePath) => {
|
|
1053999
|
+
try {
|
|
1054000
|
+
const size2 = await sizeOf(filePath);
|
|
1054001
|
+
if (size2 == null || size2.height == null || size2.width == null) {
|
|
1054002
|
+
return { type: "filepath", value: filePath };
|
|
1054003
|
+
}
|
|
1054004
|
+
return {
|
|
1054005
|
+
type: "image",
|
|
1054006
|
+
value: { filePath, width: size2.width, height: size2.height, blurDataUrl: void 0 }
|
|
1054007
|
+
};
|
|
1054008
|
+
} catch (e) {
|
|
1054051
1054009
|
return { type: "filepath", value: filePath };
|
|
1054052
1054010
|
}
|
|
1054053
|
-
|
|
1054054
|
-
|
|
1054055
|
-
|
|
1054056
|
-
};
|
|
1054057
|
-
} catch (e) {
|
|
1054058
|
-
return { type: "filepath", value: filePath };
|
|
1054059
|
-
}
|
|
1054060
|
-
}));
|
|
1054011
|
+
}));
|
|
1054012
|
+
imageFilepathsAndSizesToUpload.push(...chunk2);
|
|
1054013
|
+
}
|
|
1054061
1054014
|
const imagesWithSize = imageFilepathsAndSizesToUpload.filter(isImage).map((image2) => image2.value);
|
|
1054062
1054015
|
const imagesWithoutSize = imageFilepathsAndSizesToUpload.filter(isFilePath).map((image2) => image2.value);
|
|
1054063
1054016
|
return [imagesWithSize, imagesWithoutSize];
|