@getguru/import-engine 0.1.4 → 0.1.5
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/docx-import-cli.js +17 -9
- package/package.json +1 -1
package/docx-import-cli.js
CHANGED
|
@@ -101996,8 +101996,8 @@ function capFolderDepth(path3) {
|
|
|
101996
101996
|
function buildFolderTree(docs2) {
|
|
101997
101997
|
let nextFolderId = 0;
|
|
101998
101998
|
const makeFolderId = () => `folder${nextFolderId++}`;
|
|
101999
|
-
function getOrCreateChild(childrenMap, segment, parentPathSegments) {
|
|
102000
|
-
let child = childrenMap.get(
|
|
101999
|
+
function getOrCreateChild(childrenMap, segment, parentPathSegments, lookupKey = segment) {
|
|
102000
|
+
let child = childrenMap.get(lookupKey);
|
|
102001
102001
|
if (!child) {
|
|
102002
102002
|
child = {
|
|
102003
102003
|
id: makeFolderId(),
|
|
@@ -102006,19 +102006,20 @@ function buildFolderTree(docs2) {
|
|
|
102006
102006
|
cardIds: [],
|
|
102007
102007
|
pathSegments: [...parentPathSegments, segment]
|
|
102008
102008
|
};
|
|
102009
|
-
childrenMap.set(
|
|
102009
|
+
childrenMap.set(lookupKey, child);
|
|
102010
102010
|
}
|
|
102011
102011
|
return child;
|
|
102012
102012
|
}
|
|
102013
102013
|
const roots = /* @__PURE__ */ new Map();
|
|
102014
102014
|
const collectionLevelCardIds = [];
|
|
102015
|
-
function attachCardToPath(docId, rawPath) {
|
|
102015
|
+
function attachCardToPath(docId, rawPath, scope) {
|
|
102016
102016
|
const path3 = capFolderDepth(rawPath);
|
|
102017
102017
|
let childrenMap = roots;
|
|
102018
102018
|
let node;
|
|
102019
102019
|
let pathSegments = [];
|
|
102020
102020
|
for (const segment of path3) {
|
|
102021
|
-
|
|
102021
|
+
const lookupKey = childrenMap === roots && scope != null ? `${scope}\0${segment}` : segment;
|
|
102022
|
+
node = getOrCreateChild(childrenMap, segment, pathSegments, lookupKey);
|
|
102022
102023
|
childrenMap = node.children;
|
|
102023
102024
|
pathSegments = node.pathSegments;
|
|
102024
102025
|
}
|
|
@@ -102051,7 +102052,11 @@ function buildFolderTree(docs2) {
|
|
|
102051
102052
|
collectionLevelCardIds.push(doc.id);
|
|
102052
102053
|
continue;
|
|
102053
102054
|
}
|
|
102054
|
-
attachCardToPath(
|
|
102055
|
+
attachCardToPath(
|
|
102056
|
+
doc.id,
|
|
102057
|
+
path3,
|
|
102058
|
+
Array.isArray(doc.guruFolder) ? doc.guruFolderScope : void 0
|
|
102059
|
+
);
|
|
102055
102060
|
}
|
|
102056
102061
|
return { roots: Array.from(roots.values()), collectionLevelCardIds };
|
|
102057
102062
|
}
|
|
@@ -110996,6 +111001,9 @@ function processConfluenceDoc(div, doc) {
|
|
|
110996
111001
|
tryStep(doc, "resolving the page's folder", div, () => {
|
|
110997
111002
|
const breadcrumbs = Array.from(div.querySelectorAll("#breadcrumbs a"));
|
|
110998
111003
|
doc.guruFolder = breadcrumbs.slice(2).map((breadcrumb) => breadcrumb.textContent.trim());
|
|
111004
|
+
if (doc.folder) {
|
|
111005
|
+
doc.guruFolderScope = doc.folder;
|
|
111006
|
+
}
|
|
110999
111007
|
});
|
|
111000
111008
|
removeAll(div, "#main-header, #content > .page-metadata, #footer, input");
|
|
111001
111009
|
tryStep(doc, "converting panels to guru callouts", div, () => {
|
|
@@ -111214,7 +111222,7 @@ function buildConfluencePageIndex(allDocs, zip) {
|
|
|
111214
111222
|
if (pageId && !byId.has(pageId)) {
|
|
111215
111223
|
byId.set(pageId, doc);
|
|
111216
111224
|
}
|
|
111217
|
-
const space = normalizeConfluenceKey((doc.folder || "").split("/")
|
|
111225
|
+
const space = normalizeConfluenceKey((doc.folder || "").split("/").pop());
|
|
111218
111226
|
const title = normalizeConfluenceKey(doc.title);
|
|
111219
111227
|
if (space && title) {
|
|
111220
111228
|
if (!byTitle.has(space)) {
|
|
@@ -114433,7 +114441,7 @@ var import_jszip5 = __toESM(require_lib3());
|
|
|
114433
114441
|
var import_url_join6 = __toESM(require_url_join());
|
|
114434
114442
|
|
|
114435
114443
|
// packages/import-engine/package.json
|
|
114436
|
-
var version = "0.1.
|
|
114444
|
+
var version = "0.1.5";
|
|
114437
114445
|
|
|
114438
114446
|
// src/docx-import/detectors.js
|
|
114439
114447
|
function isGoogleSitesDoc(div) {
|
|
@@ -114457,7 +114465,7 @@ var showError;
|
|
|
114457
114465
|
var updateLoader;
|
|
114458
114466
|
var showReport;
|
|
114459
114467
|
var docLinkIndex = /* @__PURE__ */ new Map();
|
|
114460
|
-
var toolVersion = true ? `${version}+${"
|
|
114468
|
+
var toolVersion = true ? `${version}+${"8c32bd5"}` : version;
|
|
114461
114469
|
var pendingUpload = null;
|
|
114462
114470
|
function confirmPendingUpload() {
|
|
114463
114471
|
const upload = pendingUpload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getguru/import-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Command-line engine that turns Notion, Confluence, Google, Word, PDF, Markdown and spreadsheet exports into Guru import zips.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"guru-import-engine": "docx-import-cli.js"
|