polite-crawler 0.7.2 → 0.7.4

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.
Files changed (39) hide show
  1. package/README.md +5 -1
  2. package/build/api.d.mts +29 -1
  3. package/build/api.mjs +9 -6
  4. package/build/api.mjs.map +1 -1
  5. package/build/{cli-daemon-KjIlGd_Q.mjs → cli-daemon-DLq2mL2u.mjs} +2 -2
  6. package/build/{cli-daemon-KjIlGd_Q.mjs.map → cli-daemon-DLq2mL2u.mjs.map} +1 -1
  7. package/build/{cli-recipes-BVz-P6q0.mjs → cli-recipes-Bpxtn038.mjs} +2 -2
  8. package/build/{cli-recipes-BVz-P6q0.mjs.map → cli-recipes-Bpxtn038.mjs.map} +1 -1
  9. package/build/cli.mjs +7 -7
  10. package/build/{daemon-CF2st2kh.mjs → daemon-gic2K75W.mjs} +3 -3
  11. package/build/{daemon-CF2st2kh.mjs.map → daemon-gic2K75W.mjs.map} +1 -1
  12. package/build/{diff-BsYl-M4P.mjs → diff-BRqaThsF.mjs} +2 -2
  13. package/build/{diff-BsYl-M4P.mjs.map → diff-BRqaThsF.mjs.map} +1 -1
  14. package/build/{extract-CP3VLyJh.mjs → extract-CI3T_zCs.mjs} +2 -2
  15. package/build/{extract-CP3VLyJh.mjs.map → extract-CI3T_zCs.mjs.map} +1 -1
  16. package/build/index.d.mts +1 -1
  17. package/build/index.mjs +10 -10
  18. package/build/{open-DE3mCat8.mjs → open-BJjZ87iB.mjs} +16 -10
  19. package/build/{open-DE3mCat8.mjs.map → open-BJjZ87iB.mjs.map} +1 -1
  20. package/build/politeness.d.mts +8 -1
  21. package/build/politeness.mjs.map +1 -1
  22. package/build/reaction-Cqeo5kNs.mjs +166 -0
  23. package/build/reaction-Cqeo5kNs.mjs.map +1 -0
  24. package/build/{recipe-D2758Xqp.mjs → recipe-BAUadZKl.mjs} +3 -3
  25. package/build/{recipe-D2758Xqp.mjs.map → recipe-BAUadZKl.mjs.map} +1 -1
  26. package/build/{recipe-product-DZsncwAl.mjs → recipe-product-CSQEzSiR.mjs} +4 -4
  27. package/build/{recipe-product-DZsncwAl.mjs.map → recipe-product-CSQEzSiR.mjs.map} +1 -1
  28. package/build/{runtime-DMem_UuO.mjs → runtime-DgktarsN.mjs} +11 -57
  29. package/build/runtime-DgktarsN.mjs.map +1 -0
  30. package/build/{version-J_JYtS-2.mjs → version-C6Xx2HGj.mjs} +2 -2
  31. package/build/{version-J_JYtS-2.mjs.map → version-C6Xx2HGj.mjs.map} +1 -1
  32. package/build/{wacz-DoeRTqqi.mjs → wacz-BJVmPMY2.mjs} +3 -3
  33. package/build/{wacz-DoeRTqqi.mjs.map → wacz-BJVmPMY2.mjs.map} +1 -1
  34. package/build/{warc-5f582tZO.mjs → warc-DMBvXJA3.mjs} +2 -2
  35. package/build/{warc-5f582tZO.mjs.map → warc-DMBvXJA3.mjs.map} +1 -1
  36. package/package.json +1 -1
  37. package/build/reaction-BWTIe95J.mjs +0 -82
  38. package/build/reaction-BWTIe95J.mjs.map +0 -1
  39. package/build/runtime-DMem_UuO.mjs.map +0 -1
package/build/index.d.mts CHANGED
@@ -3577,7 +3577,7 @@ export declare class WatchStore {
3577
3577
  */
3578
3578
  export declare const runWatch: (runtime: CrawlRuntime, source: WatchStore | (() => Promise<WatchStore>), options?: WatchRunnerOptions) => WatchRun;
3579
3579
  /** This is the version of the package. A test makes sure that it agrees with `package.json`. */
3580
- export declare const VERSION = "0.7.2";
3580
+ export declare const VERSION = "0.7.4";
3581
3581
  /** This is the product token that robots.txt rules match when an application gives no token. */
3582
3582
  export declare const DEFAULT_TOKEN = "PoliteCrawler";
3583
3583
  /** This page tells a site owner what the crawler is and how to control it. */
package/build/index.mjs CHANGED
@@ -1,23 +1,23 @@
1
1
  import { n as FileBlobStore, t as CaptureLog } from "./log-CB5bADmd.mjs";
2
2
  import { t as browserMissing } from "./browser-C_dFMvO3.mjs";
3
- import { c as startDaemon, i as daemonStateFile, n as DAEMON_STATE_SCHEMA, o as readDaemonState, r as changeCommand, s as scheduleWatches, t as DAEMON_DEFAULTS } from "./daemon-CF2st2kh.mjs";
4
- import { C as DocIndex, F as makeRecord, M as Crawler, N as DEADLINE_NOTE, O as locate, P as DEFAULT_SECRET_PARAMS, R as EgressRefused, S as readPdf, T as NO_EMBEDDER, _ as archivedDocId, a as fetchPage, c as isHeldBack, d as recordOverride, f as reindex, h as archiveExtractor, i as fetchAndIndex, j as CAPTURE_SCHEMA, l as isoTime, m as versionAtTime, n as HELD_BACK, o as findDocuments, p as verifyQuote, r as catchUpIndex, s as heldBackMeta, t as Extractors, u as readDocument, w as FAST_RANK_SHARE, x as isPdf, z as egressLookup } from "./runtime-DMem_UuO.mjs";
5
- import { a as formatDiff, n as diffDocument, r as diffTexts, t as DIFF_LIMITS } from "./diff-BsYl-M4P.mjs";
6
- import { C as DISCOVER_LIMITS, D as readSitemap, E as feedDate, S as crawlSite, T as SITEMAP_LIMITS, _ as estimateTokens, b as SqliteHostStateStore, c as WatchStore, d as VectorStore, f as createHybridSearch, g as chunkTokensOf, h as chunkText, i as openCrawler, l as runWatch, m as HYBRID_DEFAULTS, n as defaultUserAgent, o as WATCH_LIMITS, p as CHUNK_LIMITS, r as isMailbox, s as WATCH_SCHEMA, t as createRuntime, u as VECTORS_SCHEMA, v as fuseRanks, w as discoverSite, x as CRAWL_LIMITS, y as unitVector } from "./open-DE3mCat8.mjs";
3
+ import { c as startDaemon, i as daemonStateFile, n as DAEMON_STATE_SCHEMA, o as readDaemonState, r as changeCommand, s as scheduleWatches, t as DAEMON_DEFAULTS } from "./daemon-gic2K75W.mjs";
4
+ import { C as DocIndex, F as makeRecord, M as Crawler, N as DEADLINE_NOTE, O as locate, P as DEFAULT_SECRET_PARAMS, R as EgressRefused, S as readPdf, T as NO_EMBEDDER, _ as archivedDocId, a as fetchPage, c as isHeldBack, d as recordOverride, f as reindex, h as archiveExtractor, i as fetchAndIndex, j as CAPTURE_SCHEMA, l as isoTime, m as versionAtTime, n as HELD_BACK, o as findDocuments, p as verifyQuote, r as catchUpIndex, s as heldBackMeta, t as Extractors, u as readDocument, w as FAST_RANK_SHARE, x as isPdf, z as egressLookup } from "./runtime-DgktarsN.mjs";
5
+ import { a as formatDiff, n as diffDocument, r as diffTexts, t as DIFF_LIMITS } from "./diff-BRqaThsF.mjs";
6
+ import { C as DISCOVER_LIMITS, D as readSitemap, E as feedDate, S as crawlSite, T as SITEMAP_LIMITS, _ as estimateTokens, b as SqliteHostStateStore, c as WatchStore, d as VectorStore, f as createHybridSearch, g as chunkTokensOf, h as chunkText, i as openCrawler, l as runWatch, m as HYBRID_DEFAULTS, n as defaultUserAgent, o as WATCH_LIMITS, p as CHUNK_LIMITS, r as isMailbox, s as WATCH_SCHEMA, t as createRuntime, u as VECTORS_SCHEMA, v as fuseRanks, w as discoverSite, x as CRAWL_LIMITS, y as unitVector } from "./open-BJjZ87iB.mjs";
7
7
  import { i as ollamaEmbedder, n as OLLAMA_MODELS, r as isLoopback, t as NO_OLLAMA } from "./ollama-B7eNmGhl.mjs";
8
8
  import { n as TRANSFORMERS_MODELS, r as transformersEmbedder, t as NO_TRANSFORMERS } from "./transformers-Cb-KaPge.mjs";
9
- import { n as checkFields, r as extractDocument, t as FIELD_KINDS } from "./extract-CP3VLyJh.mjs";
9
+ import { n as checkFields, r as extractDocument, t as FIELD_KINDS } from "./extract-CI3T_zCs.mjs";
10
10
  import { DAYS, compareHours, describeWeek, disagreements, fromCompact, fromSchemaOrg, fromText, toHoursWeek } from "./hours.mjs";
11
11
  import { extractPage, typesOf } from "./html.mjs";
12
12
  import { DEFAULT_POLICY, MemoryHostStateStore, VALIDATOR_MEMO, nextValidatorMemo, realClock } from "./politeness.mjs";
13
- import { a as readJson, i as defineRecipe, n as RESERVED_RECIPES, o as registerRecipe, s as runRecipe, t as RECIPE_LIMITS } from "./recipe-D2758Xqp.mjs";
14
- import { a as readAmount, c as locationMatches, d as readVenue, f as venueReadingsOf, i as productOf, l as namesVenue, n as pickProduct, o as readProduct, r as pickVariant, s as VENUE_LIMITS, t as PRODUCT_LIMITS, u as rankHoursLinks } from "./recipe-product-DZsncwAl.mjs";
13
+ import { a as readJson, i as defineRecipe, n as RESERVED_RECIPES, o as registerRecipe, s as runRecipe, t as RECIPE_LIMITS } from "./recipe-BAUadZKl.mjs";
14
+ import { a as readAmount, c as locationMatches, d as readVenue, f as venueReadingsOf, i as productOf, l as namesVenue, n as pickProduct, o as readProduct, r as pickVariant, s as VENUE_LIMITS, t as PRODUCT_LIMITS, u as rankHoursLinks } from "./recipe-product-CSQEzSiR.mjs";
15
15
  import { n as RenderRefused, r as playwrightRenderer, t as NO_PLAYWRIGHT } from "./render-B0NrFDkJ.mjs";
16
16
  import { ALLOW_ALL, decide, parseRobots } from "./robots.mjs";
17
17
  import { bodyEncoding, decodeBody } from "./text.mjs";
18
18
  import { cacheKeyOf, canonicalUrl, siteOf } from "./urls.mjs";
19
- import { i as durationMs, n as DEFAULT_TOKEN, r as VERSION, t as BOT_PAGE } from "./version-J_JYtS-2.mjs";
19
+ import { i as durationMs, n as DEFAULT_TOKEN, r as VERSION, t as BOT_PAGE } from "./version-C6Xx2HGj.mjs";
20
20
  import { i as keyDirectory, n as KEY_DIRECTORY_TYPE, o as verifySignature, r as createWebBotAuthSigner, t as KEY_DIRECTORY_PATH } from "./webbotauth-DbiWmibz.mjs";
21
- import { t as exportWacz } from "./wacz-DoeRTqqi.mjs";
22
- import { n as exportWarc } from "./warc-5f582tZO.mjs";
21
+ import { t as exportWacz } from "./wacz-BJVmPMY2.mjs";
22
+ import { n as exportWarc } from "./warc-DMBvXJA3.mjs";
23
23
  export { ALLOW_ALL, BOT_PAGE, CAPTURE_SCHEMA, CHUNK_LIMITS, CRAWL_LIMITS, CaptureLog, Crawler, DAEMON_DEFAULTS, DAEMON_STATE_SCHEMA, DAYS, DEADLINE_NOTE, DEFAULT_POLICY, DEFAULT_SECRET_PARAMS, DEFAULT_TOKEN, DIFF_LIMITS, DISCOVER_LIMITS, DocIndex, EgressRefused, Extractors, FAST_RANK_SHARE, FIELD_KINDS, FileBlobStore, HELD_BACK, HYBRID_DEFAULTS, KEY_DIRECTORY_PATH, KEY_DIRECTORY_TYPE, MemoryHostStateStore, NO_EMBEDDER, NO_OLLAMA, NO_PLAYWRIGHT, NO_TRANSFORMERS, OLLAMA_MODELS, PRODUCT_LIMITS, RECIPE_LIMITS, RESERVED_RECIPES, RenderRefused, SITEMAP_LIMITS, SqliteHostStateStore, TRANSFORMERS_MODELS, VALIDATOR_MEMO, VECTORS_SCHEMA, VENUE_LIMITS, VERSION, VectorStore, WATCH_LIMITS, WATCH_SCHEMA, WatchStore, archiveExtractor, archivedDocId, bodyEncoding, browserMissing, cacheKeyOf, canonicalUrl, catchUpIndex, changeCommand, checkFields, chunkText, chunkTokensOf, compareHours, crawlSite, createHybridSearch, createRuntime, createWebBotAuthSigner, daemonStateFile, decide, decodeBody, defaultUserAgent, defineRecipe, describeWeek, diffDocument, diffTexts, disagreements, discoverSite, durationMs, egressLookup, estimateTokens, exportWacz, exportWarc, extractDocument, extractPage, feedDate, fetchAndIndex, fetchPage, findDocuments, formatDiff, fromCompact, fromSchemaOrg, fromText, fuseRanks, heldBackMeta, isHeldBack, isLoopback, isMailbox, isPdf, isoTime, keyDirectory, locate, locationMatches, makeRecord, namesVenue, nextValidatorMemo, ollamaEmbedder, openCrawler, parseRobots, pickProduct, pickVariant, playwrightRenderer, productOf, rankHoursLinks, readAmount, readDaemonState, readDocument, readJson, readPdf, readProduct, readSitemap, readVenue, realClock, recordOverride, registerRecipe, reindex, runRecipe, runWatch, scheduleWatches, siteOf, startDaemon, toHoursWeek, transformersEmbedder, typesOf, unitVector, venueReadingsOf, verifyQuote, verifySignature, versionAtTime };
@@ -1,17 +1,17 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.mjs";
2
2
  import { r as checkedRenderer } from "./browser-C_dFMvO3.mjs";
3
- import { i as durationMs, n as DEFAULT_TOKEN, r as VERSION, t as BOT_PAGE } from "./version-J_JYtS-2.mjs";
3
+ import { i as durationMs, n as DEFAULT_TOKEN, r as VERSION, t as BOT_PAGE } from "./version-C6Xx2HGj.mjs";
4
4
  import { n as FileBlobStore, t as CaptureLog } from "./log-CB5bADmd.mjs";
5
- import { A as snippetOf, C as DocIndex, I as sha256$1, L as stableStringify, M as Crawler, N as DEADLINE_NOTE, T as NO_EMBEDDER, a as fetchPage, c as isHeldBack, f as reindex, i as fetchAndIndex, k as parseQuery, l as isoTime, o as findDocuments, p as verifyQuote, r as catchUpIndex, t as Extractors, u as readDocument, y as archivedOf } from "./runtime-DMem_UuO.mjs";
6
- import { n as diffDocument, r as diffTexts } from "./diff-BsYl-M4P.mjs";
5
+ import { A as snippetOf, C as DocIndex, I as sha256$1, L as stableStringify, M as Crawler, N as DEADLINE_NOTE, T as NO_EMBEDDER, a as fetchPage, c as isHeldBack, f as reindex, i as fetchAndIndex, k as parseQuery, l as isoTime, o as findDocuments, p as verifyQuote, r as catchUpIndex, t as Extractors, u as readDocument, y as archivedOf } from "./runtime-DgktarsN.mjs";
6
+ import { n as diffDocument, r as diffTexts } from "./diff-BRqaThsF.mjs";
7
7
  import { extractPage } from "./html.mjs";
8
8
  import { cacheKeyOf, canonicalUrl, scopeTest } from "./urls.mjs";
9
9
  import { decodeBody } from "./text.mjs";
10
- import { r as extractDocument } from "./extract-CP3VLyJh.mjs";
10
+ import { r as extractDocument } from "./extract-CI3T_zCs.mjs";
11
11
  import { matchesPattern } from "./robots.mjs";
12
12
  import { MemoryHostStateStore, nextValidatorMemo, realClock } from "./politeness.mjs";
13
13
  import { r as playwrightRenderer } from "./render-B0NrFDkJ.mjs";
14
- import { o as registerRecipe } from "./recipe-D2758Xqp.mjs";
14
+ import { o as registerRecipe } from "./recipe-BAUadZKl.mjs";
15
15
  import { createHash, randomUUID } from "node:crypto";
16
16
  import { join } from "node:path";
17
17
  import { existsSync, lstatSync, mkdirSync, realpathSync, statSync } from "node:fs";
@@ -2745,10 +2745,10 @@ const targetOf = (url) => {
2745
2745
  };
2746
2746
  };
2747
2747
  /**
2748
- * These are the steps of the schema of `watch.sqlite`, for `migrate` of `@mark1russell7/sqlite`. The
2749
- * version of a file (`PRAGMA user_version`) is the count of its steps. Do not change a step: add a step.
2748
+ * This SQL makes the table and the index of version 1. Each statement has `IF NOT EXISTS`, so each
2749
+ * open of the store also applies it: a file that lost the table or the index gets it again.
2750
2750
  */
2751
- const MIGRATIONS = [`CREATE TABLE IF NOT EXISTS watches (
2751
+ const TABLES_V1 = `CREATE TABLE IF NOT EXISTS watches (
2752
2752
  url TEXT PRIMARY KEY,
2753
2753
  target TEXT NOT NULL,
2754
2754
  host TEXT NOT NULL,
@@ -2778,7 +2778,12 @@ const MIGRATIONS = [`CREATE TABLE IF NOT EXISTS watches (
2778
2778
  pend_fetched_at TEXT,
2779
2779
  pend_since REAL
2780
2780
  );
2781
- CREATE INDEX IF NOT EXISTS watches_due ON watches (next_at)`];
2781
+ CREATE INDEX IF NOT EXISTS watches_due ON watches (next_at)`;
2782
+ /**
2783
+ * These are the steps of the schema of `watch.sqlite`, for `migrate` of `@mark1russell7/sqlite`. The
2784
+ * version of a file (`PRAGMA user_version`) is the count of its steps. Do not change a step: add a step.
2785
+ */
2786
+ const MIGRATIONS = [TABLES_V1];
2782
2787
  /**
2783
2788
  * This store keeps the watch list in a SQLite file (`watch.sqlite`). Two or more processes on one
2784
2789
  * store share it. Each step is one transaction (`BEGIN IMMEDIATE`), and it waits for the lock of a
@@ -2813,6 +2818,7 @@ var WatchStore = class {
2813
2818
  name: "watch store",
2814
2819
  newer: "keep"
2815
2820
  });
2821
+ this.db.exec(TABLES_V1);
2816
2822
  } catch (error) {
2817
2823
  this.db.close();
2818
2824
  throw error;
@@ -3547,4 +3553,4 @@ const openCrawler = (options) => {
3547
3553
  };
3548
3554
  export { DISCOVER_LIMITS as C, readSitemap as D, feedDate as E, crawlSite as S, SITEMAP_LIMITS as T, estimateTokens as _, open_exports as a, SqliteHostStateStore as b, WatchStore as c, VectorStore as d, createHybridSearch as f, chunkTokensOf as g, chunkText as h, openCrawler as i, runWatch as l, HYBRID_DEFAULTS as m, defaultUserAgent as n, WATCH_LIMITS as o, CHUNK_LIMITS as p, isMailbox as r, WATCH_SCHEMA as s, createRuntime as t, VECTORS_SCHEMA as u, fuseRanks as v, discoverSite as w, CRAWL_LIMITS as x, unitVector as y };
3549
3555
 
3550
- //# sourceMappingURL=open-DE3mCat8.mjs.map
3556
+ //# sourceMappingURL=open-BJjZ87iB.mjs.map