@claritylabs/cl-sdk 3.1.24 → 3.1.25
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/dist/index.js +0 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10556,63 +10556,6 @@ ${JSON.stringify(nodes, null, 2)}
|
|
|
10556
10556
|
|
|
10557
10557
|
Return JSON for the operational profile.`;
|
|
10558
10558
|
}
|
|
10559
|
-
function tableCellValueText(cell) {
|
|
10560
|
-
return cleanText(cell.textExcerpt ?? cell.description ?? "", "");
|
|
10561
|
-
}
|
|
10562
|
-
function tableRowTextFromCells(cells) {
|
|
10563
|
-
const text = cells.map((cell) => {
|
|
10564
|
-
const label = cleanText(cell.title, "");
|
|
10565
|
-
const value = tableCellValueText(cell);
|
|
10566
|
-
if (!value) return label;
|
|
10567
|
-
if (!label || value.toLowerCase() === label.toLowerCase()) return value;
|
|
10568
|
-
return `${label}: ${value}`;
|
|
10569
|
-
}).filter(Boolean).join(" | ");
|
|
10570
|
-
return text ? cleanText(text, text) : void 0;
|
|
10571
|
-
}
|
|
10572
|
-
function normalizeTableBoundaryDelimiters(value) {
|
|
10573
|
-
const text = cleanText(value, "");
|
|
10574
|
-
if (!text) return void 0;
|
|
10575
|
-
const normalized = text.replace(/\s+\|\s+\|/g, " | ").replace(/\s+\/\s+\|/g, " |").replace(/\s+[|/]\s*$/g, "").replace(/\s{2,}/g, " ").trim();
|
|
10576
|
-
return normalized || void 0;
|
|
10577
|
-
}
|
|
10578
|
-
function normalizeSourceTreeTableDisplayText(sourceTree) {
|
|
10579
|
-
const byParent = nodesByParent(sourceTree);
|
|
10580
|
-
const updates = /* @__PURE__ */ new Map();
|
|
10581
|
-
const currentNode = (node) => updates.get(node.id) ?? node;
|
|
10582
|
-
for (const node of sourceTree) {
|
|
10583
|
-
if (node.kind !== "table_cell") continue;
|
|
10584
|
-
const textExcerpt = normalizeTableBoundaryDelimiters(node.textExcerpt);
|
|
10585
|
-
const textChanged = textExcerpt !== void 0 && textExcerpt !== node.textExcerpt;
|
|
10586
|
-
const description = textChanged && textExcerpt ? normalizeTableBoundaryDelimiters([node.title, textExcerpt].filter(Boolean).join(" | ")) : normalizeTableBoundaryDelimiters(node.description);
|
|
10587
|
-
if (textExcerpt === node.textExcerpt && description === node.description) continue;
|
|
10588
|
-
updates.set(node.id, {
|
|
10589
|
-
...node,
|
|
10590
|
-
...textExcerpt !== void 0 ? { textExcerpt } : {},
|
|
10591
|
-
...description !== void 0 ? { description } : {}
|
|
10592
|
-
});
|
|
10593
|
-
}
|
|
10594
|
-
for (const node of sourceTree) {
|
|
10595
|
-
if (node.kind !== "table_row") continue;
|
|
10596
|
-
const cells = (byParent.get(node.id) ?? []).filter((child) => child.kind === "table_cell").map(currentNode).sort(
|
|
10597
|
-
(left, right) => tableCellColumnIndex(left, 0) - tableCellColumnIndex(right, 0) || left.order - right.order || left.id.localeCompare(right.id)
|
|
10598
|
-
);
|
|
10599
|
-
const textExcerpt = cells.length ? tableRowTextFromCells(cells) : normalizeTableBoundaryDelimiters(node.textExcerpt);
|
|
10600
|
-
const textChanged = textExcerpt !== void 0 && textExcerpt !== node.textExcerpt;
|
|
10601
|
-
const description = textChanged && textExcerpt ? normalizeTableBoundaryDelimiters([node.title, textExcerpt].filter(Boolean).join(" | ")) : normalizeTableBoundaryDelimiters(node.description);
|
|
10602
|
-
if (textExcerpt === node.textExcerpt && description === node.description) continue;
|
|
10603
|
-
updates.set(node.id, {
|
|
10604
|
-
...node,
|
|
10605
|
-
...textExcerpt !== void 0 ? { textExcerpt } : {},
|
|
10606
|
-
...description !== void 0 ? { description } : {}
|
|
10607
|
-
});
|
|
10608
|
-
}
|
|
10609
|
-
if (updates.size === 0) return sourceTree;
|
|
10610
|
-
return sourceTree.map((node) => updates.get(node.id) ?? node);
|
|
10611
|
-
}
|
|
10612
|
-
function tableCellColumnIndex(cell, fallbackIndex) {
|
|
10613
|
-
const metadataIndex = cell.metadata?.columnIndex;
|
|
10614
|
-
return typeof metadataIndex === "number" && Number.isInteger(metadataIndex) ? metadataIndex : fallbackIndex;
|
|
10615
|
-
}
|
|
10616
10559
|
function sourceTreeToOutline(sourceTree) {
|
|
10617
10560
|
const byParent = /* @__PURE__ */ new Map();
|
|
10618
10561
|
for (const node of sourceTree.filter((item) => item.kind !== "document")) {
|
|
@@ -10859,7 +10802,6 @@ async function runSourceTreeExtraction(params) {
|
|
|
10859
10802
|
}
|
|
10860
10803
|
params.trackUsage(usage, report);
|
|
10861
10804
|
};
|
|
10862
|
-
sourceTree = normalizeSourceTreeTableDisplayText(sourceTree);
|
|
10863
10805
|
const emptyProfile = emptyOperationalProfile();
|
|
10864
10806
|
let operationalProfile = emptyProfile;
|
|
10865
10807
|
try {
|