@dream_engine/search 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/crawler.d.ts +165 -0
- package/dist/crawler.d.ts.map +1 -0
- package/dist/crawler.js +454 -0
- package/dist/crawler.js.map +1 -0
- package/dist/fetcher.d.ts +45 -0
- package/dist/fetcher.d.ts.map +1 -0
- package/dist/fetcher.js +161 -0
- package/dist/fetcher.js.map +1 -0
- package/dist/index-store.d.ts +162 -0
- package/dist/index-store.d.ts.map +1 -0
- package/dist/index-store.js +350 -0
- package/dist/index-store.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/postgres-index.d.ts +66 -0
- package/dist/postgres-index.d.ts.map +1 -0
- package/dist/postgres-index.js +335 -0
- package/dist/postgres-index.js.map +1 -0
- package/dist/robots.d.ts +46 -0
- package/dist/robots.d.ts.map +1 -0
- package/dist/robots.js +161 -0
- package/dist/robots.js.map +1 -0
- package/dist/service.d.ts +203 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +570 -0
- package/dist/service.js.map +1 -0
- package/dist/sitemap.d.ts +21 -0
- package/dist/sitemap.d.ts.map +1 -0
- package/dist/sitemap.js +75 -0
- package/dist/sitemap.js.map +1 -0
- package/dist/sources.d.ts +78 -0
- package/dist/sources.d.ts.map +1 -0
- package/dist/sources.js +146 -0
- package/dist/sources.js.map +1 -0
- package/package.json +44 -3
- package/README.md +0 -3
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { ConfigurationError, SearchError, fnv1a64, getDomain, hammingDistance, normalizeText, normalizeUrl, simhash } from '@dream_engine/core';
|
|
4
|
+
import { makeSnippet, parseQuery, rerankHits, rowToDoc, urlTerms, } from './index-store.js';
|
|
5
|
+
const IDENT = /^[a-z_][a-z0-9_]{0,62}(\.[a-z_][a-z0-9_]{0,62})?$/;
|
|
6
|
+
const TS_CONFIG = /^[a-z_][a-z0-9_]{0,62}$/;
|
|
7
|
+
/** Postgres target without credentials, for stats and error messages. */
|
|
8
|
+
export function describePostgresTarget(connectionString, table) {
|
|
9
|
+
if (!connectionString)
|
|
10
|
+
return `postgres (custom client)#${table}`;
|
|
11
|
+
try {
|
|
12
|
+
const u = new URL(connectionString);
|
|
13
|
+
return `postgres://${u.hostname}${u.port ? `:${u.port}` : ''}${u.pathname}#${table}`;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return `postgres (unparseable connection string)#${table}`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Loads the optional `pg` driver from this package or the application (cwd). */
|
|
20
|
+
async function loadPg() {
|
|
21
|
+
const specifier = 'pg';
|
|
22
|
+
let mod;
|
|
23
|
+
try {
|
|
24
|
+
mod = await import(specifier);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
try {
|
|
28
|
+
mod = createRequire(join(process.cwd(), 'package.json'))(specifier);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
throw new ConfigurationError('search.indexBackend "postgres" needs the "pg" package. Install it next to bashirweb: npm install pg');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const m = mod;
|
|
35
|
+
const Pool = (m.Pool ?? m.default?.Pool);
|
|
36
|
+
if (!Pool)
|
|
37
|
+
throw new ConfigurationError('The installed "pg" package does not export Pool');
|
|
38
|
+
return { Pool };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Full-text index on PostgreSQL (`tsvector` + GIN, weighted fields, stemming), with the same
|
|
42
|
+
* dedupe (content hash and SimHash), query syntax and ranking pipeline as the SQLite backend.
|
|
43
|
+
*
|
|
44
|
+
* The table and index are created on first use. Only standard PostgreSQL 12+ features are used (no extensions).
|
|
45
|
+
*/
|
|
46
|
+
export class PostgresSearchIndex {
|
|
47
|
+
options;
|
|
48
|
+
kind = 'postgres';
|
|
49
|
+
table;
|
|
50
|
+
tsConfig;
|
|
51
|
+
client;
|
|
52
|
+
closeFn;
|
|
53
|
+
ready = null;
|
|
54
|
+
closed = false;
|
|
55
|
+
target;
|
|
56
|
+
constructor(options) {
|
|
57
|
+
this.options = options;
|
|
58
|
+
if (!options.client && !options.connectionString)
|
|
59
|
+
throw new ConfigurationError('PostgresSearchIndex needs a connectionString (search.postgresUrl) or a client');
|
|
60
|
+
const table = (options.table ?? 'bashirweb_documents').toLowerCase();
|
|
61
|
+
if (!IDENT.test(table))
|
|
62
|
+
throw new ConfigurationError(`Invalid Postgres table name: ${table}`);
|
|
63
|
+
const tsConfig = (options.textSearchConfig ?? 'english').toLowerCase();
|
|
64
|
+
if (!TS_CONFIG.test(tsConfig))
|
|
65
|
+
throw new ConfigurationError(`Invalid text search configuration: ${tsConfig}`);
|
|
66
|
+
this.table = table;
|
|
67
|
+
this.tsConfig = tsConfig;
|
|
68
|
+
this.client = options.client ?? null;
|
|
69
|
+
this.closeFn = options.client ? (options.closeClient ?? null) : null;
|
|
70
|
+
this.target = describePostgresTarget(options.connectionString, table);
|
|
71
|
+
}
|
|
72
|
+
get indexPrefix() {
|
|
73
|
+
return this.table.replace('.', '_');
|
|
74
|
+
}
|
|
75
|
+
async db() {
|
|
76
|
+
if (this.closed)
|
|
77
|
+
throw new SearchError('The Postgres index is closed');
|
|
78
|
+
this.ready ??= this.init().catch((error) => {
|
|
79
|
+
this.ready = null;
|
|
80
|
+
throw error;
|
|
81
|
+
});
|
|
82
|
+
await this.ready;
|
|
83
|
+
return this.client;
|
|
84
|
+
}
|
|
85
|
+
async init() {
|
|
86
|
+
if (!this.client) {
|
|
87
|
+
const { Pool } = await loadPg();
|
|
88
|
+
const pool = new Pool({ connectionString: this.options.connectionString, max: this.options.maxConnections ?? 5 });
|
|
89
|
+
this.client = pool;
|
|
90
|
+
this.closeFn = () => pool.end();
|
|
91
|
+
}
|
|
92
|
+
const cfg = `'${this.tsConfig}'::regconfig`;
|
|
93
|
+
try {
|
|
94
|
+
await this.client.query(`
|
|
95
|
+
CREATE TABLE IF NOT EXISTS ${this.table} (
|
|
96
|
+
id BIGSERIAL PRIMARY KEY,
|
|
97
|
+
url TEXT NOT NULL UNIQUE,
|
|
98
|
+
canonical_url TEXT,
|
|
99
|
+
domain TEXT NOT NULL,
|
|
100
|
+
title TEXT NOT NULL,
|
|
101
|
+
description TEXT,
|
|
102
|
+
content TEXT NOT NULL,
|
|
103
|
+
url_terms TEXT NOT NULL DEFAULT '',
|
|
104
|
+
language TEXT,
|
|
105
|
+
published_at TEXT,
|
|
106
|
+
author TEXT,
|
|
107
|
+
fetched_at TEXT NOT NULL,
|
|
108
|
+
indexed_at TEXT NOT NULL,
|
|
109
|
+
source TEXT NOT NULL,
|
|
110
|
+
word_count INTEGER NOT NULL,
|
|
111
|
+
content_hash TEXT NOT NULL,
|
|
112
|
+
simhash TEXT NOT NULL,
|
|
113
|
+
duplicate_of BIGINT REFERENCES ${this.table}(id) ON DELETE SET NULL,
|
|
114
|
+
metadata TEXT NOT NULL DEFAULT '{}',
|
|
115
|
+
fts tsvector GENERATED ALWAYS AS (
|
|
116
|
+
setweight(to_tsvector(${cfg}, title), 'A') ||
|
|
117
|
+
setweight(to_tsvector(${cfg}, coalesce(description, '')), 'B') ||
|
|
118
|
+
setweight(to_tsvector(${cfg}, url_terms), 'C') ||
|
|
119
|
+
setweight(to_tsvector(${cfg}, content), 'D')
|
|
120
|
+
) STORED
|
|
121
|
+
)`);
|
|
122
|
+
await this.client.query(`CREATE INDEX IF NOT EXISTS ${this.indexPrefix}_fts ON ${this.table} USING GIN (fts)`);
|
|
123
|
+
await this.client.query(`CREATE INDEX IF NOT EXISTS ${this.indexPrefix}_domain ON ${this.table} (domain)`);
|
|
124
|
+
await this.client.query(`CREATE INDEX IF NOT EXISTS ${this.indexPrefix}_hash ON ${this.table} (content_hash)`);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
throw new SearchError(`Could not prepare the Postgres index at ${this.target}: ${error.message}`, { cause: error });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async run(sql, params = []) {
|
|
131
|
+
const db = await this.db();
|
|
132
|
+
try {
|
|
133
|
+
return (await db.query(sql, params)).rows;
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
throw new SearchError(`Postgres index query failed: ${error.message}`, { cause: error, details: { target: this.target } });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async upsert(input) {
|
|
140
|
+
const url = normalizeUrl(input.url);
|
|
141
|
+
const content = input.content.replace(/\s+/g, ' ').trim();
|
|
142
|
+
if (!content && !input.title)
|
|
143
|
+
throw new SearchError('Cannot index an empty document', { details: { url } });
|
|
144
|
+
const hash = fnv1a64(normalizeText(content));
|
|
145
|
+
const sh = simhash(`${input.title} ${content}`);
|
|
146
|
+
const domain = getDomain(url);
|
|
147
|
+
const now = new Date().toISOString();
|
|
148
|
+
const t = this.table;
|
|
149
|
+
const [existing] = await this.run(`SELECT id, content_hash, title, description FROM ${t} WHERE url = $1`, [url]);
|
|
150
|
+
if (existing && existing.content_hash === hash && existing.title === input.title && (existing.description ?? null) === (input.description ?? null)) {
|
|
151
|
+
await this.run(`UPDATE ${t} SET fetched_at = $1 WHERE id = $2`, [input.fetchedAt ?? now, existing.id]);
|
|
152
|
+
return { id: Number(existing.id), status: 'unchanged', duplicateOf: null };
|
|
153
|
+
}
|
|
154
|
+
let duplicateOf = null;
|
|
155
|
+
const [exact] = await this.run(`SELECT id FROM ${t} WHERE content_hash = $1 AND url <> $2 AND duplicate_of IS NULL ORDER BY id LIMIT 1`, [
|
|
156
|
+
hash,
|
|
157
|
+
url,
|
|
158
|
+
]);
|
|
159
|
+
if (exact)
|
|
160
|
+
duplicateOf = Number(exact.id);
|
|
161
|
+
else if (content.length > 200) {
|
|
162
|
+
const sameDomain = await this.run(`SELECT id, simhash FROM ${t} WHERE domain = $1 AND url <> $2 AND duplicate_of IS NULL ORDER BY id LIMIT 2000`, [domain, url]);
|
|
163
|
+
for (const row of sameDomain) {
|
|
164
|
+
if (hammingDistance(BigInt(`0x${row.simhash}`), sh) <= 3) {
|
|
165
|
+
duplicateOf = Number(row.id);
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const values = [
|
|
171
|
+
url,
|
|
172
|
+
input.canonicalUrl ?? null,
|
|
173
|
+
domain,
|
|
174
|
+
input.title,
|
|
175
|
+
input.description ?? null,
|
|
176
|
+
content,
|
|
177
|
+
urlTerms(url),
|
|
178
|
+
input.language ?? null,
|
|
179
|
+
input.publishedAt ?? null,
|
|
180
|
+
input.author ?? null,
|
|
181
|
+
input.fetchedAt ?? now,
|
|
182
|
+
now,
|
|
183
|
+
input.source ?? 'manual',
|
|
184
|
+
content ? content.split(' ').length : 0,
|
|
185
|
+
hash,
|
|
186
|
+
sh.toString(16).padStart(16, '0'),
|
|
187
|
+
duplicateOf,
|
|
188
|
+
JSON.stringify(input.metadata ?? {}),
|
|
189
|
+
];
|
|
190
|
+
const [row] = await this.run(`INSERT INTO ${t} (url, canonical_url, domain, title, description, content, url_terms, language, published_at, author, fetched_at, indexed_at, source, word_count, content_hash, simhash, duplicate_of, metadata)
|
|
191
|
+
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)
|
|
192
|
+
ON CONFLICT (url) DO UPDATE SET canonical_url=EXCLUDED.canonical_url, domain=EXCLUDED.domain, title=EXCLUDED.title, description=EXCLUDED.description,
|
|
193
|
+
content=EXCLUDED.content, url_terms=EXCLUDED.url_terms, language=EXCLUDED.language, published_at=EXCLUDED.published_at, author=EXCLUDED.author,
|
|
194
|
+
fetched_at=EXCLUDED.fetched_at, indexed_at=EXCLUDED.indexed_at, source=EXCLUDED.source, word_count=EXCLUDED.word_count,
|
|
195
|
+
content_hash=EXCLUDED.content_hash, simhash=EXCLUDED.simhash, duplicate_of=EXCLUDED.duplicate_of, metadata=EXCLUDED.metadata
|
|
196
|
+
RETURNING id, (xmax = 0) AS inserted`, values);
|
|
197
|
+
const id = Number(row.id);
|
|
198
|
+
return { id, status: duplicateOf !== null ? 'duplicate' : row.inserted ? 'inserted' : 'updated', duplicateOf };
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Builds a tsquery expression from a parsed query, with bound parameters only. Terms are AND-ed
|
|
202
|
+
* (prefix match on the last term of 3+ characters), phrases use `phraseto_tsquery`, exclusions are negated.
|
|
203
|
+
*/
|
|
204
|
+
tsQuery(parsed, params) {
|
|
205
|
+
const cfg = `'${this.tsConfig}'::regconfig`;
|
|
206
|
+
const bind = (v) => {
|
|
207
|
+
params.push(v);
|
|
208
|
+
return `$${params.length}`;
|
|
209
|
+
};
|
|
210
|
+
const parts = [];
|
|
211
|
+
parsed.terms.forEach((term, i) => {
|
|
212
|
+
// Terms are normalized to letters and digits, so `term:*` is valid tsquery syntax.
|
|
213
|
+
if (i === parsed.terms.length - 1 && term.length >= 3 && /^[\p{L}\p{N}]+$/u.test(term))
|
|
214
|
+
parts.push(`to_tsquery(${cfg}, ${bind(`${term}:*`)})`);
|
|
215
|
+
else
|
|
216
|
+
parts.push(`plainto_tsquery(${cfg}, ${bind(term)})`);
|
|
217
|
+
});
|
|
218
|
+
for (const p of parsed.phrases)
|
|
219
|
+
parts.push(`phraseto_tsquery(${cfg}, ${bind(p)})`);
|
|
220
|
+
if (!parts.length)
|
|
221
|
+
return '';
|
|
222
|
+
let expr = parts.join(' && ');
|
|
223
|
+
if (parsed.excluded.length)
|
|
224
|
+
expr = `(${expr}) && !!(${parsed.excluded.map((e) => `plainto_tsquery(${cfg}, ${bind(e)})`).join(' || ')})`;
|
|
225
|
+
return expr;
|
|
226
|
+
}
|
|
227
|
+
async query(query, options = {}) {
|
|
228
|
+
const parsed = parseQuery(query);
|
|
229
|
+
const params = [];
|
|
230
|
+
const tsq = this.tsQuery(parsed, params);
|
|
231
|
+
if (!tsq)
|
|
232
|
+
return { query, ftsQuery: '', total: 0, hits: [] };
|
|
233
|
+
const limit = Math.min(Math.max(options.limit ?? 10, 1), 100);
|
|
234
|
+
const offset = Math.max(options.offset ?? 0, 0);
|
|
235
|
+
const bind = (v) => {
|
|
236
|
+
params.push(v);
|
|
237
|
+
return `$${params.length}`;
|
|
238
|
+
};
|
|
239
|
+
const where = ['d.fts @@ q.q'];
|
|
240
|
+
if (!options.includeDuplicates)
|
|
241
|
+
where.push('d.duplicate_of IS NULL');
|
|
242
|
+
const domains = [...(options.domains ?? []), ...parsed.sites];
|
|
243
|
+
if (domains.length)
|
|
244
|
+
where.push(`(${domains.map((dm) => `(d.domain = ${bind(dm)} OR d.domain LIKE ${bind(`%.${dm}`)})`).join(' OR ')})`);
|
|
245
|
+
for (const dm of options.excludeDomains ?? [])
|
|
246
|
+
where.push(`NOT (d.domain = ${bind(dm)} OR d.domain LIKE ${bind(`%.${dm}`)})`);
|
|
247
|
+
if (options.language)
|
|
248
|
+
where.push(`(d.language = ${bind(options.language)} OR d.language LIKE ${bind(`${options.language}-%`)})`);
|
|
249
|
+
if (options.publishedAfter)
|
|
250
|
+
where.push(`d.published_at IS NOT NULL AND d.published_at >= ${bind(options.publishedAfter)}`);
|
|
251
|
+
if (options.publishedBefore)
|
|
252
|
+
where.push(`d.published_at IS NOT NULL AND d.published_at <= ${bind(options.publishedBefore)}`);
|
|
253
|
+
const t = this.table;
|
|
254
|
+
// A query made only of stop words has no lexemes; numnode() = 0 then, and nothing can match.
|
|
255
|
+
const base = `FROM ${t} d, (SELECT ${tsq} AS q) q WHERE numnode(q.q) > 0 AND ${where.join(' AND ')}`;
|
|
256
|
+
const window = Math.min(500, offset + limit * 5);
|
|
257
|
+
const [count] = await this.run(`SELECT COUNT(*) AS n ${base}`, params);
|
|
258
|
+
const total = Number(count?.n ?? 0);
|
|
259
|
+
// Field weights {D, C, B, A} = content 0.1, URL words 0.2, description 0.4, title 1.0 (mirrors the SQLite BM25 weights 10/4/2/1).
|
|
260
|
+
const rows = total
|
|
261
|
+
? await this.run(`SELECT d.id, d.url, d.canonical_url, d.domain, d.title, d.description, d.language, d.published_at, d.author, d.fetched_at, d.indexed_at,
|
|
262
|
+
d.source, d.word_count, d.content_hash, d.simhash, d.duplicate_of, d.metadata,
|
|
263
|
+
ts_rank('{0.1, 0.2, 0.4, 1.0}', d.fts, q.q, 1) AS rank
|
|
264
|
+
${base} ORDER BY rank DESC, d.id LIMIT ${bind(window)}`, params)
|
|
265
|
+
: [];
|
|
266
|
+
const ordered = rerankHits(rows, parsed, (r) => Number(r.rank), 0.1, options.perDomainLimit);
|
|
267
|
+
const page = ordered.slice(offset, offset + limit);
|
|
268
|
+
const ids = page.map((p) => p.r.id);
|
|
269
|
+
const contents = ids.length
|
|
270
|
+
? await this.run(`SELECT id, content, description FROM ${t} WHERE id = ANY($1::bigint[])`, [
|
|
271
|
+
ids.map(String),
|
|
272
|
+
])
|
|
273
|
+
: [];
|
|
274
|
+
const byId = new Map(contents.map((c) => [Number(c.id), c]));
|
|
275
|
+
const terms = [...parsed.terms, ...parsed.phrases.flatMap((p) => p.split(' '))];
|
|
276
|
+
const hits = page.map((s) => {
|
|
277
|
+
const c = byId.get(Number(s.r.id));
|
|
278
|
+
return {
|
|
279
|
+
doc: rowToDoc(s.r),
|
|
280
|
+
score: Math.round(s.score * 1000) / 1000,
|
|
281
|
+
bm25: Math.round(s.raw * 10000) / 10000,
|
|
282
|
+
snippet: c ? makeSnippet(c.content, c.description, terms) : '',
|
|
283
|
+
};
|
|
284
|
+
});
|
|
285
|
+
return { query, ftsQuery: `tsquery: ${[...parsed.terms, ...parsed.phrases.map((p) => `"${p}"`)].join(' & ')}`, total, hits };
|
|
286
|
+
}
|
|
287
|
+
async get(url) {
|
|
288
|
+
const [row] = await this.run(`SELECT * FROM ${this.table} WHERE url = $1`, [normalizeUrl(url)]);
|
|
289
|
+
return row ? rowToDoc(row) : null;
|
|
290
|
+
}
|
|
291
|
+
async getContent(url) {
|
|
292
|
+
const [row] = await this.run(`SELECT content FROM ${this.table} WHERE url = $1`, [normalizeUrl(url)]);
|
|
293
|
+
return row?.content ?? null;
|
|
294
|
+
}
|
|
295
|
+
async remove(url) {
|
|
296
|
+
const rows = await this.run(`DELETE FROM ${this.table} WHERE url = $1 RETURNING id`, [normalizeUrl(url)]);
|
|
297
|
+
return rows.length > 0;
|
|
298
|
+
}
|
|
299
|
+
async list(options = {}) {
|
|
300
|
+
const limit = Math.min(options.limit ?? 50, 1000);
|
|
301
|
+
const offset = Math.max(options.offset ?? 0, 0);
|
|
302
|
+
const rows = options.domain
|
|
303
|
+
? await this.run(`SELECT * FROM ${this.table} WHERE domain = $1 ORDER BY indexed_at DESC, id DESC LIMIT $2 OFFSET $3`, [
|
|
304
|
+
options.domain,
|
|
305
|
+
limit,
|
|
306
|
+
offset,
|
|
307
|
+
])
|
|
308
|
+
: await this.run(`SELECT * FROM ${this.table} ORDER BY indexed_at DESC, id DESC LIMIT $1 OFFSET $2`, [limit, offset]);
|
|
309
|
+
return rows.map(rowToDoc);
|
|
310
|
+
}
|
|
311
|
+
async stats() {
|
|
312
|
+
const t = this.table;
|
|
313
|
+
const [counts] = await this.run(`SELECT COUNT(*) AS documents, COUNT(duplicate_of) AS duplicates, COUNT(DISTINCT domain) AS domains, MAX(indexed_at) AS last FROM ${t}`);
|
|
314
|
+
const top = await this.run(`SELECT domain, COUNT(*) AS n FROM ${t} GROUP BY domain ORDER BY n DESC, domain LIMIT 10`);
|
|
315
|
+
return {
|
|
316
|
+
documents: Number(counts?.documents ?? 0),
|
|
317
|
+
duplicates: Number(counts?.duplicates ?? 0),
|
|
318
|
+
domains: Number(counts?.domains ?? 0),
|
|
319
|
+
topDomains: top.map((r) => ({ domain: r.domain, documents: Number(r.n) })),
|
|
320
|
+
lastIndexedAt: counts?.last ?? null,
|
|
321
|
+
backend: 'postgres',
|
|
322
|
+
path: this.target,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
async close() {
|
|
326
|
+
if (this.closed)
|
|
327
|
+
return;
|
|
328
|
+
this.closed = true;
|
|
329
|
+
const fn = this.closeFn;
|
|
330
|
+
this.closeFn = null;
|
|
331
|
+
if (fn)
|
|
332
|
+
await fn();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=postgres-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-index.js","sourceRoot":"","sources":["../src/postgres-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChJ,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,GAWT,MAAM,kBAAkB,CAAC;AAyB1B,MAAM,KAAK,GAAG,mDAAmD,CAAC;AAClE,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAE5C,yEAAyE;AACzE,MAAM,UAAU,sBAAsB,CAAC,gBAAoC,EAAE,KAAa;IACxF,IAAI,CAAC,gBAAgB;QAAE,OAAO,4BAA4B,KAAK,EAAE,CAAC;IAClE,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACpC,OAAO,cAAc,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC;IACvF,CAAC;IAAC,MAAM,CAAC;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AC,MAAM,EAAE,UAAU,IAAI,CAAC,CAAC;YAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,CAAC;YACrC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1E,aAAa,EAAE,MAAM,EAAE,IAAI,IAAI,IAAI;YACnC,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,IAAI,CAAC,MAAM;SAClB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,EAAE;YAAE,MAAM,EAAE,EAAE,CAAC;IACrB,CAAC;CACF"}
|
package/dist/robots.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { SafeFetcher } from './fetcher.js';
|
|
2
|
+
export interface RobotsGroup {
|
|
3
|
+
agents: string[];
|
|
4
|
+
rules: Array<{
|
|
5
|
+
allow: boolean;
|
|
6
|
+
pattern: string;
|
|
7
|
+
}>;
|
|
8
|
+
crawlDelay: number | null;
|
|
9
|
+
}
|
|
10
|
+
export interface RobotsTxt {
|
|
11
|
+
groups: RobotsGroup[];
|
|
12
|
+
sitemaps: string[];
|
|
13
|
+
}
|
|
14
|
+
/** Parses robots.txt according to RFC 9309 (plus the common Crawl-delay and Sitemap extensions). */
|
|
15
|
+
export declare function parseRobotsTxt(text: string): RobotsTxt;
|
|
16
|
+
/** Selects the group for a user agent: the most specific product-token match, else "*". */
|
|
17
|
+
export declare function groupFor(robots: RobotsTxt, userAgent: string): RobotsGroup[];
|
|
18
|
+
/** Evaluates a path: the longest matching rule wins; Allow wins ties. */
|
|
19
|
+
export declare function isPathAllowed(robots: RobotsTxt, userAgent: string, pathWithQuery: string): boolean;
|
|
20
|
+
export declare function crawlDelayFor(robots: RobotsTxt, userAgent: string): number | null;
|
|
21
|
+
export interface RobotsStatus {
|
|
22
|
+
origin: string;
|
|
23
|
+
status: 'ok' | 'missing' | 'unreachable' | 'error';
|
|
24
|
+
fetchedAt: string;
|
|
25
|
+
robots: RobotsTxt;
|
|
26
|
+
/** RFC 9309: unreachable (5xx/network) robots.txt means "disallow everything" for now. */
|
|
27
|
+
disallowAll: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** Fetches and caches robots.txt per origin. */
|
|
30
|
+
export declare class RobotsCache {
|
|
31
|
+
private readonly fetcher;
|
|
32
|
+
private readonly userAgent;
|
|
33
|
+
private readonly ttlMs;
|
|
34
|
+
private readonly cache;
|
|
35
|
+
private readonly inflight;
|
|
36
|
+
constructor(fetcher: SafeFetcher, userAgent: string, ttlMs?: number);
|
|
37
|
+
get(url: string): Promise<RobotsStatus>;
|
|
38
|
+
private load;
|
|
39
|
+
isAllowed(url: string): Promise<{
|
|
40
|
+
allowed: boolean;
|
|
41
|
+
reason: string;
|
|
42
|
+
}>;
|
|
43
|
+
crawlDelayMs(url: string): Promise<number | null>;
|
|
44
|
+
snapshot(): RobotsStatus[];
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=robots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"robots.d.ts","sourceRoot":"","sources":["../src/robots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAA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AM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAQrE,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAMvD,QAAQ,IAAI,YAAY,EAAE;CAG3B"}
|
package/dist/robots.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/** Parses robots.txt according to RFC 9309 (plus the common Crawl-delay and Sitemap extensions). */
|
|
2
|
+
export function parseRobotsTxt(text) {
|
|
3
|
+
const groups = [];
|
|
4
|
+
const sitemaps = [];
|
|
5
|
+
let current = null;
|
|
6
|
+
let lastWasAgent = false;
|
|
7
|
+
for (const rawLine of text.split(/\r?\n/)) {
|
|
8
|
+
const line = rawLine.replace(/#.*$/, '').trim();
|
|
9
|
+
if (!line)
|
|
10
|
+
continue;
|
|
11
|
+
const idx = line.indexOf(':');
|
|
12
|
+
if (idx < 0)
|
|
13
|
+
continue;
|
|
14
|
+
const key = line.slice(0, idx).trim().toLowerCase();
|
|
15
|
+
const value = line.slice(idx + 1).trim();
|
|
16
|
+
if (key === 'user-agent') {
|
|
17
|
+
if (!current || !lastWasAgent) {
|
|
18
|
+
current = { agents: [], rules: [], crawlDelay: null };
|
|
19
|
+
groups.push(current);
|
|
20
|
+
}
|
|
21
|
+
current.agents.push(value.toLowerCase());
|
|
22
|
+
lastWasAgent = true;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
lastWasAgent = false;
|
|
26
|
+
if (key === 'sitemap') {
|
|
27
|
+
if (value)
|
|
28
|
+
sitemaps.push(value);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (!current)
|
|
32
|
+
continue;
|
|
33
|
+
if (key === 'allow' || key === 'disallow') {
|
|
34
|
+
if (key === 'disallow' && value === '')
|
|
35
|
+
continue; // empty disallow = allow all
|
|
36
|
+
current.rules.push({ allow: key === 'allow', pattern: value });
|
|
37
|
+
}
|
|
38
|
+
else if (key === 'crawl-delay') {
|
|
39
|
+
const n = Number(value);
|
|
40
|
+
if (Number.isFinite(n) && n >= 0)
|
|
41
|
+
current.crawlDelay = n;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { groups, sitemaps };
|
|
45
|
+
}
|
|
46
|
+
function patternToRegex(pattern) {
|
|
47
|
+
const anchored = pattern.endsWith('$');
|
|
48
|
+
const body = (anchored ? pattern.slice(0, -1) : pattern)
|
|
49
|
+
.split('*')
|
|
50
|
+
.map((part) => part.replace(/[.+?^${}()|[\]\\]/g, '\\$&'))
|
|
51
|
+
.join('.*');
|
|
52
|
+
return new RegExp(`^${body}${anchored ? '$' : ''}`);
|
|
53
|
+
}
|
|
54
|
+
/** Selects the group for a user agent: the most specific product-token match, else "*". */
|
|
55
|
+
export function groupFor(robots, userAgent) {
|
|
56
|
+
const token = (userAgent.split('/')[0] ?? userAgent).toLowerCase().trim();
|
|
57
|
+
const specific = robots.groups.filter((g) => g.agents.some((a) => a !== '*' && token.startsWith(a)));
|
|
58
|
+
if (specific.length)
|
|
59
|
+
return specific;
|
|
60
|
+
return robots.groups.filter((g) => g.agents.includes('*'));
|
|
61
|
+
}
|
|
62
|
+
/** Evaluates a path: the longest matching rule wins; Allow wins ties. */
|
|
63
|
+
export function isPathAllowed(robots, userAgent, pathWithQuery) {
|
|
64
|
+
const groups = groupFor(robots, userAgent);
|
|
65
|
+
let best = null;
|
|
66
|
+
let decodedPath = pathWithQuery;
|
|
67
|
+
try {
|
|
68
|
+
decodedPath = decodeURI(pathWithQuery);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
/* keep raw */
|
|
72
|
+
}
|
|
73
|
+
for (const g of groups) {
|
|
74
|
+
for (const rule of g.rules) {
|
|
75
|
+
if (!rule.pattern)
|
|
76
|
+
continue;
|
|
77
|
+
const re = patternToRegex(rule.pattern);
|
|
78
|
+
if (re.test(pathWithQuery) || re.test(decodedPath)) {
|
|
79
|
+
const length = rule.pattern.length;
|
|
80
|
+
if (!best || length > best.length || (length === best.length && rule.allow))
|
|
81
|
+
best = { allow: rule.allow, length };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return best ? best.allow : true;
|
|
86
|
+
}
|
|
87
|
+
export function crawlDelayFor(robots, userAgent) {
|
|
88
|
+
const delays = groupFor(robots, userAgent)
|
|
89
|
+
.map((g) => g.crawlDelay)
|
|
90
|
+
.filter((d) => d !== null);
|
|
91
|
+
return delays.length ? Math.max(...delays) : null;
|
|
92
|
+
}
|
|
93
|
+
/** Fetches and caches robots.txt per origin. */
|
|
94
|
+
export class RobotsCache {
|
|
95
|
+
fetcher;
|
|
96
|
+
userAgent;
|
|
97
|
+
ttlMs;
|
|
98
|
+
cache = new Map();
|
|
99
|
+
inflight = new Map();
|
|
100
|
+
constructor(fetcher, userAgent, ttlMs = 3600_000) {
|
|
101
|
+
this.fetcher = fetcher;
|
|
102
|
+
this.userAgent = userAgent;
|
|
103
|
+
this.ttlMs = ttlMs;
|
|
104
|
+
}
|
|
105
|
+
async get(url) {
|
|
106
|
+
const origin = new URL(url).origin;
|
|
107
|
+
const hit = this.cache.get(origin);
|
|
108
|
+
if (hit && hit.expires > Date.now())
|
|
109
|
+
return hit.status;
|
|
110
|
+
const pending = this.inflight.get(origin);
|
|
111
|
+
if (pending)
|
|
112
|
+
return pending;
|
|
113
|
+
const p = this.load(origin).finally(() => this.inflight.delete(origin));
|
|
114
|
+
this.inflight.set(origin, p);
|
|
115
|
+
return p;
|
|
116
|
+
}
|
|
117
|
+
async load(origin) {
|
|
118
|
+
let status;
|
|
119
|
+
try {
|
|
120
|
+
const res = await this.fetcher.fetch(`${origin}/robots.txt`, { accept: 'text/plain,*/*', maxBytes: 512 * 1024, timeout: 10_000 });
|
|
121
|
+
if (res.status >= 200 && res.status < 300)
|
|
122
|
+
status = { origin, status: 'ok', fetchedAt: res.fetchedAt, robots: parseRobotsTxt(res.body), disallowAll: false };
|
|
123
|
+
else if (res.status >= 400 && res.status < 500)
|
|
124
|
+
status = { origin, status: 'missing', fetchedAt: res.fetchedAt, robots: { groups: [], sitemaps: [] }, disallowAll: false };
|
|
125
|
+
else
|
|
126
|
+
status = { origin, status: 'unreachable', fetchedAt: res.fetchedAt, robots: { groups: [], sitemaps: [] }, disallowAll: true };
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
// The network policy forbids this origin: that is about the target, not robots.txt. Surface the
|
|
130
|
+
// SecurityError so callers report "blocked" (403 over HTTP) instead of a robots.txt problem.
|
|
131
|
+
if (error.name === 'SecurityError')
|
|
132
|
+
throw error;
|
|
133
|
+
status = {
|
|
134
|
+
origin,
|
|
135
|
+
status: 'unreachable',
|
|
136
|
+
fetchedAt: new Date().toISOString(),
|
|
137
|
+
robots: { groups: [], sitemaps: [] },
|
|
138
|
+
disallowAll: true,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
this.cache.set(origin, { status, expires: Date.now() + (status.status === 'unreachable' ? 5 * 60_000 : this.ttlMs) });
|
|
142
|
+
return status;
|
|
143
|
+
}
|
|
144
|
+
async isAllowed(url) {
|
|
145
|
+
const status = await this.get(url);
|
|
146
|
+
if (status.disallowAll)
|
|
147
|
+
return { allowed: false, reason: `robots.txt ${status.status}` };
|
|
148
|
+
const u = new URL(url);
|
|
149
|
+
const allowed = isPathAllowed(status.robots, this.userAgent, `${u.pathname}${u.search}`);
|
|
150
|
+
return { allowed, reason: allowed ? 'allowed by robots.txt' : 'disallowed by robots.txt' };
|
|
151
|
+
}
|
|
152
|
+
async crawlDelayMs(url) {
|
|
153
|
+
const status = await this.get(url);
|
|
154
|
+
const d = crawlDelayFor(status.robots, this.userAgent);
|
|
155
|
+
return d === null ? null : Math.min(d, 60) * 1000;
|
|
156
|
+
}
|
|
157
|
+
snapshot() {
|
|
158
|
+
return [...this.cache.values()].map((v) => v.status);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# s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