@swarmvaultai/viewer 0.1.25 → 0.1.26
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/assets/index-4JhL4iIB.js +330 -0
- package/dist/index.html +1 -1
- package/dist/lib.d.ts +17 -0
- package/dist/lib.js +8 -4
- package/package.json +1 -1
- package/dist/assets/index-CmEm2Pd_.js +0 -330
package/dist/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>SwarmVault Graph</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-4JhL4iIB.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-mRA-6D-Z.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/dist/lib.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ type ViewerGraphNode = {
|
|
|
14
14
|
label: string;
|
|
15
15
|
sourceIds: string[];
|
|
16
16
|
projectIds: string[];
|
|
17
|
+
sourceClass?: string;
|
|
17
18
|
pageId?: string;
|
|
18
19
|
language?: string;
|
|
19
20
|
moduleId?: string;
|
|
@@ -50,6 +51,7 @@ type ViewerGraphPage = {
|
|
|
50
51
|
kind: string;
|
|
51
52
|
status: string;
|
|
52
53
|
sourceType?: string;
|
|
54
|
+
sourceClass?: string;
|
|
53
55
|
projectIds: string[];
|
|
54
56
|
content: string;
|
|
55
57
|
assets: ViewerOutputAsset[];
|
|
@@ -71,6 +73,7 @@ type ViewerGraphArtifact = {
|
|
|
71
73
|
kind: string;
|
|
72
74
|
status: string;
|
|
73
75
|
sourceType?: string;
|
|
76
|
+
sourceClass?: string;
|
|
74
77
|
projectIds: string[];
|
|
75
78
|
nodeIds: string[];
|
|
76
79
|
backlinks: string[];
|
|
@@ -87,6 +90,7 @@ type ViewerSearchResult = {
|
|
|
87
90
|
status?: string;
|
|
88
91
|
projectIds: string[];
|
|
89
92
|
sourceType?: string;
|
|
93
|
+
sourceClass?: string;
|
|
90
94
|
};
|
|
91
95
|
type ViewerPagePayload = {
|
|
92
96
|
path: string;
|
|
@@ -227,6 +231,18 @@ type ViewerGraphReport = {
|
|
|
227
231
|
pages: number;
|
|
228
232
|
communities: number;
|
|
229
233
|
};
|
|
234
|
+
firstPartyOverview: {
|
|
235
|
+
nodes: number;
|
|
236
|
+
edges: number;
|
|
237
|
+
pages: number;
|
|
238
|
+
communities: number;
|
|
239
|
+
};
|
|
240
|
+
sourceClassBreakdown: Record<string, {
|
|
241
|
+
sources: number;
|
|
242
|
+
pages: number;
|
|
243
|
+
nodes: number;
|
|
244
|
+
}>;
|
|
245
|
+
warnings: string[];
|
|
230
246
|
benchmark?: {
|
|
231
247
|
generatedAt: string;
|
|
232
248
|
stale: boolean;
|
|
@@ -282,6 +298,7 @@ type ViewerSearchOptions = {
|
|
|
282
298
|
status?: string;
|
|
283
299
|
project?: string;
|
|
284
300
|
sourceType?: string;
|
|
301
|
+
sourceClass?: string;
|
|
285
302
|
};
|
|
286
303
|
declare function fetchGraphArtifact(input?: string, init?: RequestInit): Promise<ViewerGraphArtifact>;
|
|
287
304
|
declare function searchViewerPages(query: string, options?: ViewerSearchOptions): Promise<ViewerSearchResult[]>;
|
package/dist/lib.js
CHANGED
|
@@ -33,6 +33,7 @@ async function searchViewerPages(query, options = {}) {
|
|
|
33
33
|
const status = options.status ?? "all";
|
|
34
34
|
const project = options.project ?? "all";
|
|
35
35
|
const sourceType = options.sourceType ?? "all";
|
|
36
|
+
const sourceClass = options.sourceClass ?? "all";
|
|
36
37
|
if (embedded) {
|
|
37
38
|
const normalizedQuery = query.trim().toLowerCase();
|
|
38
39
|
if (!normalizedQuery) {
|
|
@@ -40,7 +41,7 @@ async function searchViewerPages(query, options = {}) {
|
|
|
40
41
|
}
|
|
41
42
|
return embedded.pages.filter((page) => kind === "all" ? true : page.kind === kind).filter((page) => status === "all" ? true : page.status === status).filter(
|
|
42
43
|
(page) => project === "all" ? true : project === "unassigned" ? page.projectIds.length === 0 : page.projectIds.includes(project)
|
|
43
|
-
).filter((page) => sourceType === "all" ? true : (page.sourceType ?? "") === sourceType).map((page) => {
|
|
44
|
+
).filter((page) => sourceType === "all" ? true : (page.sourceType ?? "") === sourceType).filter((page) => sourceClass === "all" ? true : (page.sourceClass ?? "") === sourceClass).map((page) => {
|
|
44
45
|
const haystack = `${page.title}
|
|
45
46
|
${page.content}`.toLowerCase();
|
|
46
47
|
const score = haystack.includes(normalizedQuery) ? haystack.indexOf(normalizedQuery) : Number.POSITIVE_INFINITY;
|
|
@@ -53,7 +54,8 @@ ${page.content}`.toLowerCase();
|
|
|
53
54
|
kind: page.kind,
|
|
54
55
|
status: page.status,
|
|
55
56
|
projectIds: page.projectIds,
|
|
56
|
-
sourceType: page.sourceType
|
|
57
|
+
sourceType: page.sourceType,
|
|
58
|
+
sourceClass: page.sourceClass
|
|
57
59
|
};
|
|
58
60
|
}).filter((page) => Number.isFinite(page.rank)).sort((left, right) => left.rank - right.rank || left.title.localeCompare(right.title)).slice(0, limit);
|
|
59
61
|
}
|
|
@@ -63,7 +65,8 @@ ${page.content}`.toLowerCase();
|
|
|
63
65
|
kind,
|
|
64
66
|
status,
|
|
65
67
|
project,
|
|
66
|
-
sourceType
|
|
68
|
+
sourceType,
|
|
69
|
+
sourceClass
|
|
67
70
|
});
|
|
68
71
|
const response = await fetch(`/api/search?${params.toString()}`);
|
|
69
72
|
if (!response.ok) {
|
|
@@ -86,7 +89,8 @@ async function fetchViewerPage(path) {
|
|
|
86
89
|
kind: page.kind,
|
|
87
90
|
status: page.status,
|
|
88
91
|
project_ids: page.projectIds,
|
|
89
|
-
source_type: page.sourceType
|
|
92
|
+
source_type: page.sourceType,
|
|
93
|
+
source_class: page.sourceClass
|
|
90
94
|
},
|
|
91
95
|
content: page.content,
|
|
92
96
|
assets: page.assets ?? []
|