@detiq/crawler 1.1.9 → 1.1.10
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/accessibility-auditor.js +54 -74
- package/dist/ai-login.js +227 -249
- package/dist/auth-token-rotator.js +57 -67
- package/dist/auth.js +299 -336
- package/dist/browser-extension.js +104 -142
- package/dist/captcha-solver.js +98 -125
- package/dist/color-contrast.js +77 -89
- package/dist/content-chunker.js +126 -126
- package/dist/content-dedup.js +54 -71
- package/dist/cookie-consent.js +68 -83
- package/dist/cookie-jar.js +53 -60
- package/dist/crawler.js +4494 -5353
- package/dist/custom-js-injector.js +45 -61
- package/dist/dark-mode-capture.js +67 -81
- package/dist/dead-link-detector.js +47 -55
- package/dist/element-hash.js +8 -12
- package/dist/email-otp.js +154 -195
- package/dist/engine-router.js +87 -98
- package/dist/export/bulk-export.js +70 -55
- package/dist/export/vector-export.js +77 -105
- package/dist/extractors/advanced.js +249 -266
- package/dist/extractors/artifact-envelope.js +59 -58
- package/dist/failure-analysis-agent.js +37 -33
- package/dist/feature-flag-detector.js +51 -66
- package/dist/form-detector.js +55 -75
- package/dist/frontier.js +76 -101
- package/dist/gap-pass.js +68 -89
- package/dist/graphql-detector.js +62 -72
- package/dist/http-engine.js +282 -330
- package/dist/incremental-diff.js +54 -87
- package/dist/index.js +67 -28
- package/dist/input-fuzzer.js +93 -97
- package/dist/interactive-probe.js +715 -827
- package/dist/job-queue.js +2151 -2169
- package/dist/js-coverage.js +52 -56
- package/dist/js-router-detector.js +86 -117
- package/dist/language-detector.js +51 -63
- package/dist/link-classifier.js +32 -50
- package/dist/live-view.js +91 -108
- package/dist/locator-extractor.js +151 -187
- package/dist/logger.js +9 -7
- package/dist/markdown-extract.js +48 -61
- package/dist/native-crawler.js +780 -946
- package/dist/network-observer.js +135 -156
- package/dist/network-throttle.js +29 -40
- package/dist/openapi-generator.js +77 -92
- package/dist/pdf-extractor.js +72 -90
- package/dist/performance-metrics.js +80 -102
- package/dist/phash.js +125 -144
- package/dist/pii-scrubber.js +65 -68
- package/dist/playwright-recorder.js +70 -58
- package/dist/policies/crawl-safety.js +31 -34
- package/dist/profiles/domain-profile.js +130 -125
- package/dist/proxy.js +146 -172
- package/dist/rate-limiter.js +58 -65
- package/dist/redirect-tracker.js +60 -64
- package/dist/redis-frontier.js +116 -136
- package/dist/redis-queue.js +157 -144
- package/dist/response-cache.js +127 -140
- package/dist/responsive-detector.js +42 -46
- package/dist/retry-policy.js +46 -50
- package/dist/robots-txt.js +69 -83
- package/dist/screen-reader.js +45 -70
- package/dist/screenshot-masker.js +59 -77
- package/dist/seo-checker.js +88 -107
- package/dist/session-capture.js +192 -212
- package/dist/session-export.js +107 -133
- package/dist/sitemap-writer.js +38 -41
- package/dist/sitemap.js +141 -202
- package/dist/skyvern.js +123 -148
- package/dist/sqs-queue.js +42 -42
- package/dist/sso-token.js +74 -90
- package/dist/stealth/human-behavior.js +156 -173
- package/dist/telemetry.js +68 -82
- package/dist/test-executor.js +309 -335
- package/dist/tls-fingerprint.js +77 -88
- package/dist/url-pattern-completer.js +71 -90
- package/dist/visual-diff-verdict.js +23 -38
- package/dist/webhook-notifier.js +71 -69
- package/dist/websocket-detector.js +56 -68
- package/dist/worker.js +29 -38
- package/package.json +1 -1
|
@@ -1,61 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Outputs:
|
|
5
|
-
* - CSV: url, name, wordCount, screenshotPath, markdownPath, createdAt — for spreadsheet analysis
|
|
6
|
-
* - JSON: full screen records array — for API integration
|
|
7
|
-
* - Markdown digest: concatenated markdown of all screens — for LLM context windows
|
|
8
|
-
*/
|
|
9
|
-
import * as fs from 'fs/promises';
|
|
10
|
-
import * as path from 'path';
|
|
1
|
+
import * as fs from "fs/promises";
|
|
2
|
+
import * as path from "path";
|
|
11
3
|
function escapeCsv(val) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
if (val.includes(",") || val.includes('"') || val.includes("\n")) {
|
|
5
|
+
return `"${val.replace(/"/g, '""')}"`;
|
|
6
|
+
}
|
|
7
|
+
return val;
|
|
16
8
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
async function exportToCsv(screens, outputPath) {
|
|
10
|
+
const headers = ["id", "name", "url", "projectId", "wordCount", "screenshotPath", "markdownPath", "createdAt"];
|
|
11
|
+
const rows = screens.map((s) => [
|
|
12
|
+
s.id,
|
|
13
|
+
s.name,
|
|
14
|
+
s.url,
|
|
15
|
+
s.projectId,
|
|
16
|
+
String(s.wordCount ?? 0),
|
|
17
|
+
s.screenshotPath ?? "",
|
|
18
|
+
s.markdownPath ?? "",
|
|
19
|
+
s.createdAt?.toISOString() ?? ""
|
|
20
|
+
].map(escapeCsv).join(","));
|
|
21
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
22
|
+
await fs.writeFile(outputPath, [headers.join(","), ...rows].join("\n"), "utf8");
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
async function exportToJson(screens, outputPath) {
|
|
25
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
26
|
+
const data = screens.map((s) => ({
|
|
27
|
+
id: s.id,
|
|
28
|
+
name: s.name,
|
|
29
|
+
url: s.url,
|
|
30
|
+
projectId: s.projectId,
|
|
31
|
+
wordCount: s.wordCount,
|
|
32
|
+
screenshotPath: s.screenshotPath,
|
|
33
|
+
markdownPath: s.markdownPath,
|
|
34
|
+
createdAt: s.createdAt?.toISOString(),
|
|
35
|
+
updatedAt: s.updatedAt?.toISOString()
|
|
36
|
+
}));
|
|
37
|
+
await fs.writeFile(outputPath, JSON.stringify(data, null, 2), "utf8");
|
|
43
38
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
async function exportToMarkdownDigest(screens, outputPath, opts = {}) {
|
|
40
|
+
const { readMarkdownFromPath = true, maxScreens = 200 } = opts;
|
|
41
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
42
|
+
const handle = await fs.open(outputPath, "w");
|
|
43
|
+
try {
|
|
44
|
+
await handle.write(`# ZeTa Crawl Digest
|
|
45
|
+
|
|
46
|
+
Exported: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
47
|
+
Screens: ${Math.min(screens.length, maxScreens)}
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
`);
|
|
52
|
+
for (const screen of screens.slice(0, maxScreens)) {
|
|
53
|
+
let md = screen.markdown ?? "";
|
|
54
|
+
if (!md && readMarkdownFromPath && screen.markdownPath) {
|
|
55
|
+
md = await fs.readFile(screen.markdownPath, "utf8").catch(() => "");
|
|
56
|
+
}
|
|
57
|
+
await handle.write(`## ${screen.name}
|
|
58
|
+
|
|
59
|
+
**URL:** ${screen.url}
|
|
60
|
+
|
|
61
|
+
${md.trim()}
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
`);
|
|
60
66
|
}
|
|
67
|
+
} finally {
|
|
68
|
+
await handle.close();
|
|
69
|
+
}
|
|
61
70
|
}
|
|
71
|
+
export {
|
|
72
|
+
exportToCsv,
|
|
73
|
+
exportToJson,
|
|
74
|
+
exportToMarkdownDigest
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=bulk-export.js.map
|
|
@@ -1,113 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Produces a JSONL file where each line is one chunk ready for upsert into
|
|
5
|
-
* Pinecone, Qdrant, Weaviate, or any vector store. The embedding itself is
|
|
6
|
-
* NOT generated here (requires an embedding model at the user's end) — we
|
|
7
|
-
* produce the text chunks + metadata, and the caller embeds them.
|
|
8
|
-
*
|
|
9
|
-
* Format per line (JSONL):
|
|
10
|
-
* {
|
|
11
|
-
* "id": "<screenId>-<chunkIndex>",
|
|
12
|
-
* "text": "<chunk text>",
|
|
13
|
-
* "metadata": {
|
|
14
|
-
* "screenId": "...",
|
|
15
|
-
* "projectId": "...",
|
|
16
|
-
* "tenantId": "...",
|
|
17
|
-
* "url": "...",
|
|
18
|
-
* "screenName": "...",
|
|
19
|
-
* "chunkIndex": 0,
|
|
20
|
-
* "totalChunks": 3,
|
|
21
|
-
* "crawledAt": "2026-...",
|
|
22
|
-
* "wordCount": 142
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
*/
|
|
26
|
-
import * as fs from 'fs/promises';
|
|
27
|
-
import * as path from 'path';
|
|
1
|
+
import * as fs from "fs/promises";
|
|
2
|
+
import * as path from "path";
|
|
28
3
|
function splitIntoChunks(text, maxChunkWords = 300) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
current += (current ? '\n\n' : '') + para;
|
|
41
|
-
wordCount += words;
|
|
4
|
+
const paragraphs = text.split(/\n{2,}/).filter((p) => p.trim().length > 0);
|
|
5
|
+
const chunks = [];
|
|
6
|
+
let current = "";
|
|
7
|
+
let wordCount = 0;
|
|
8
|
+
for (const para of paragraphs) {
|
|
9
|
+
const words = para.split(/\s+/).length;
|
|
10
|
+
if (wordCount + words > maxChunkWords && current.length > 0) {
|
|
11
|
+
chunks.push(current.trim());
|
|
12
|
+
current = "";
|
|
13
|
+
wordCount = 0;
|
|
42
14
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
current += (current ? "\n\n" : "") + para;
|
|
16
|
+
wordCount += words;
|
|
17
|
+
}
|
|
18
|
+
if (current.trim()) chunks.push(current.trim());
|
|
19
|
+
return chunks.length > 0 ? chunks : [text.slice(0, 2e3)];
|
|
46
20
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
catch { /* file missing — skip */ }
|
|
61
|
-
}
|
|
62
|
-
if (!markdown || markdown.trim().length < 20) {
|
|
63
|
-
skipped++;
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
const textChunks = splitIntoChunks(markdown, maxChunkWords);
|
|
67
|
-
for (let i = 0; i < textChunks.length; i++) {
|
|
68
|
-
const chunk = {
|
|
69
|
-
id: `${screen.id}-${i}`,
|
|
70
|
-
text: textChunks[i],
|
|
71
|
-
metadata: {
|
|
72
|
-
screenId: screen.id,
|
|
73
|
-
projectId: screen.projectId,
|
|
74
|
-
tenantId: screen.tenantId,
|
|
75
|
-
url: screen.url,
|
|
76
|
-
screenName: screen.name,
|
|
77
|
-
chunkIndex: i,
|
|
78
|
-
totalChunks: textChunks.length,
|
|
79
|
-
crawledAt: screen.updatedAt?.toISOString() ?? new Date().toISOString(),
|
|
80
|
-
wordCount: textChunks[i].split(/\s+/).length,
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
await handle.write(JSON.stringify(chunk) + '\n');
|
|
84
|
-
totalChunks++;
|
|
85
|
-
}
|
|
21
|
+
async function exportScreensToVectorJsonl(screens, outputPath, opts = {}) {
|
|
22
|
+
const { maxChunkWords = 300, readMarkdownFromPath = true } = opts;
|
|
23
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
24
|
+
const handle = await fs.open(outputPath, "w");
|
|
25
|
+
let totalChunks = 0;
|
|
26
|
+
let skipped = 0;
|
|
27
|
+
try {
|
|
28
|
+
for (const screen of screens) {
|
|
29
|
+
let markdown = screen.markdown ?? "";
|
|
30
|
+
if (!markdown && readMarkdownFromPath && screen.markdownPath) {
|
|
31
|
+
try {
|
|
32
|
+
markdown = await fs.readFile(screen.markdownPath, "utf8");
|
|
33
|
+
} catch {
|
|
86
34
|
}
|
|
35
|
+
}
|
|
36
|
+
if (!markdown || markdown.trim().length < 20) {
|
|
37
|
+
skipped++;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const textChunks = splitIntoChunks(markdown, maxChunkWords);
|
|
41
|
+
for (let i = 0; i < textChunks.length; i++) {
|
|
42
|
+
const chunk = {
|
|
43
|
+
id: `${screen.id}-${i}`,
|
|
44
|
+
text: textChunks[i],
|
|
45
|
+
metadata: {
|
|
46
|
+
screenId: screen.id,
|
|
47
|
+
projectId: screen.projectId,
|
|
48
|
+
tenantId: screen.tenantId,
|
|
49
|
+
url: screen.url,
|
|
50
|
+
screenName: screen.name,
|
|
51
|
+
chunkIndex: i,
|
|
52
|
+
totalChunks: textChunks.length,
|
|
53
|
+
crawledAt: screen.updatedAt?.toISOString() ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
54
|
+
wordCount: textChunks[i].split(/\s+/).length
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
await handle.write(JSON.stringify(chunk) + "\n");
|
|
58
|
+
totalChunks++;
|
|
59
|
+
}
|
|
87
60
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
61
|
+
} finally {
|
|
62
|
+
await handle.close();
|
|
63
|
+
}
|
|
64
|
+
return { totalChunks, skipped };
|
|
92
65
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
id: chunk.id,
|
|
100
|
-
values: embeddings[i],
|
|
101
|
-
metadata: chunk.metadata,
|
|
102
|
-
}));
|
|
66
|
+
function toPineconeUpsert(chunks, embeddings, namespace = "zeta-crawl") {
|
|
67
|
+
return chunks.map((chunk, i) => ({
|
|
68
|
+
id: chunk.id,
|
|
69
|
+
values: embeddings[i],
|
|
70
|
+
metadata: chunk.metadata
|
|
71
|
+
}));
|
|
103
72
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
vector: embeddings[i],
|
|
111
|
-
payload: { ...chunk.metadata, text: chunk.text },
|
|
112
|
-
}));
|
|
73
|
+
function toQdrantPoints(chunks, embeddings) {
|
|
74
|
+
return chunks.map((chunk, i) => ({
|
|
75
|
+
id: chunk.id,
|
|
76
|
+
vector: embeddings[i],
|
|
77
|
+
payload: { ...chunk.metadata, text: chunk.text }
|
|
78
|
+
}));
|
|
113
79
|
}
|
|
80
|
+
export {
|
|
81
|
+
exportScreensToVectorJsonl,
|
|
82
|
+
toPineconeUpsert,
|
|
83
|
+
toQdrantPoints
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=vector-export.js.map
|