@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.js
CHANGED
|
@@ -10924,63 +10924,6 @@ ${JSON.stringify(nodes, null, 2)}
|
|
|
10924
10924
|
|
|
10925
10925
|
Return JSON for the operational profile.`;
|
|
10926
10926
|
}
|
|
10927
|
-
function tableCellValueText(cell) {
|
|
10928
|
-
return cleanText(cell.textExcerpt ?? cell.description ?? "", "");
|
|
10929
|
-
}
|
|
10930
|
-
function tableRowTextFromCells(cells) {
|
|
10931
|
-
const text = cells.map((cell) => {
|
|
10932
|
-
const label = cleanText(cell.title, "");
|
|
10933
|
-
const value = tableCellValueText(cell);
|
|
10934
|
-
if (!value) return label;
|
|
10935
|
-
if (!label || value.toLowerCase() === label.toLowerCase()) return value;
|
|
10936
|
-
return `${label}: ${value}`;
|
|
10937
|
-
}).filter(Boolean).join(" | ");
|
|
10938
|
-
return text ? cleanText(text, text) : void 0;
|
|
10939
|
-
}
|
|
10940
|
-
function normalizeTableBoundaryDelimiters(value) {
|
|
10941
|
-
const text = cleanText(value, "");
|
|
10942
|
-
if (!text) return void 0;
|
|
10943
|
-
const normalized = text.replace(/\s+\|\s+\|/g, " | ").replace(/\s+\/\s+\|/g, " |").replace(/\s+[|/]\s*$/g, "").replace(/\s{2,}/g, " ").trim();
|
|
10944
|
-
return normalized || void 0;
|
|
10945
|
-
}
|
|
10946
|
-
function normalizeSourceTreeTableDisplayText(sourceTree) {
|
|
10947
|
-
const byParent = nodesByParent(sourceTree);
|
|
10948
|
-
const updates = /* @__PURE__ */ new Map();
|
|
10949
|
-
const currentNode = (node) => updates.get(node.id) ?? node;
|
|
10950
|
-
for (const node of sourceTree) {
|
|
10951
|
-
if (node.kind !== "table_cell") continue;
|
|
10952
|
-
const textExcerpt = normalizeTableBoundaryDelimiters(node.textExcerpt);
|
|
10953
|
-
const textChanged = textExcerpt !== void 0 && textExcerpt !== node.textExcerpt;
|
|
10954
|
-
const description = textChanged && textExcerpt ? normalizeTableBoundaryDelimiters([node.title, textExcerpt].filter(Boolean).join(" | ")) : normalizeTableBoundaryDelimiters(node.description);
|
|
10955
|
-
if (textExcerpt === node.textExcerpt && description === node.description) continue;
|
|
10956
|
-
updates.set(node.id, {
|
|
10957
|
-
...node,
|
|
10958
|
-
...textExcerpt !== void 0 ? { textExcerpt } : {},
|
|
10959
|
-
...description !== void 0 ? { description } : {}
|
|
10960
|
-
});
|
|
10961
|
-
}
|
|
10962
|
-
for (const node of sourceTree) {
|
|
10963
|
-
if (node.kind !== "table_row") continue;
|
|
10964
|
-
const cells = (byParent.get(node.id) ?? []).filter((child) => child.kind === "table_cell").map(currentNode).sort(
|
|
10965
|
-
(left, right) => tableCellColumnIndex(left, 0) - tableCellColumnIndex(right, 0) || left.order - right.order || left.id.localeCompare(right.id)
|
|
10966
|
-
);
|
|
10967
|
-
const textExcerpt = cells.length ? tableRowTextFromCells(cells) : normalizeTableBoundaryDelimiters(node.textExcerpt);
|
|
10968
|
-
const textChanged = textExcerpt !== void 0 && textExcerpt !== node.textExcerpt;
|
|
10969
|
-
const description = textChanged && textExcerpt ? normalizeTableBoundaryDelimiters([node.title, textExcerpt].filter(Boolean).join(" | ")) : normalizeTableBoundaryDelimiters(node.description);
|
|
10970
|
-
if (textExcerpt === node.textExcerpt && description === node.description) continue;
|
|
10971
|
-
updates.set(node.id, {
|
|
10972
|
-
...node,
|
|
10973
|
-
...textExcerpt !== void 0 ? { textExcerpt } : {},
|
|
10974
|
-
...description !== void 0 ? { description } : {}
|
|
10975
|
-
});
|
|
10976
|
-
}
|
|
10977
|
-
if (updates.size === 0) return sourceTree;
|
|
10978
|
-
return sourceTree.map((node) => updates.get(node.id) ?? node);
|
|
10979
|
-
}
|
|
10980
|
-
function tableCellColumnIndex(cell, fallbackIndex) {
|
|
10981
|
-
const metadataIndex = cell.metadata?.columnIndex;
|
|
10982
|
-
return typeof metadataIndex === "number" && Number.isInteger(metadataIndex) ? metadataIndex : fallbackIndex;
|
|
10983
|
-
}
|
|
10984
10927
|
function sourceTreeToOutline(sourceTree) {
|
|
10985
10928
|
const byParent = /* @__PURE__ */ new Map();
|
|
10986
10929
|
for (const node of sourceTree.filter((item) => item.kind !== "document")) {
|
|
@@ -11227,7 +11170,6 @@ async function runSourceTreeExtraction(params) {
|
|
|
11227
11170
|
}
|
|
11228
11171
|
params.trackUsage(usage, report);
|
|
11229
11172
|
};
|
|
11230
|
-
sourceTree = normalizeSourceTreeTableDisplayText(sourceTree);
|
|
11231
11173
|
const emptyProfile = emptyOperationalProfile();
|
|
11232
11174
|
let operationalProfile = emptyProfile;
|
|
11233
11175
|
try {
|