@nitpicker/crawler 0.11.0 → 0.13.0
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/README.md +6 -4
- package/lib/archive/archive-accessor.d.ts +2 -2
- package/lib/archive/archive-accessor.js +2 -2
- package/lib/archive/archive-lock.d.ts +7 -0
- package/lib/archive/archive-lock.js +7 -0
- package/lib/archive/archive.d.ts +175 -13
- package/lib/archive/archive.js +198 -14
- package/lib/archive/cache/compute-archive-cache-key.d.ts +39 -0
- package/lib/archive/cache/compute-archive-cache-key.js +95 -0
- package/lib/archive/cache/extract-archive-to-cache.d.ts +43 -0
- package/lib/archive/cache/extract-archive-to-cache.js +309 -0
- package/lib/archive/cache/get-archive-cache-root.d.ts +20 -0
- package/lib/archive/cache/get-archive-cache-root.js +53 -0
- package/lib/archive/cache/is-archive-cache-disabled.d.ts +24 -0
- package/lib/archive/cache/is-archive-cache-disabled.js +34 -0
- package/lib/archive/cache/resolve-archive-cache-dir.d.ts +26 -0
- package/lib/archive/cache/resolve-archive-cache-dir.js +32 -0
- package/lib/archive/create-adjunct-tables.d.ts +43 -0
- package/lib/archive/create-adjunct-tables.js +213 -0
- package/lib/archive/create-entity-tables.d.ts +173 -0
- package/lib/archive/create-entity-tables.js +318 -0
- package/lib/archive/create-progress-reporter.d.ts +30 -0
- package/lib/archive/create-progress-reporter.js +38 -0
- package/lib/archive/create-ref-tables.d.ts +35 -0
- package/lib/archive/create-ref-tables.js +188 -0
- package/lib/archive/database.d.ts +130 -182
- package/lib/archive/database.js +524 -1777
- package/lib/archive/db-ops/_shared/clear-write-ref-caches.d.ts +27 -0
- package/lib/archive/db-ops/_shared/clear-write-ref-caches.js +34 -0
- package/lib/archive/db-ops/_shared/create-write-ref-caches.d.ts +17 -0
- package/lib/archive/db-ops/_shared/create-write-ref-caches.js +26 -0
- package/lib/archive/db-ops/_shared/decode-json-ref.d.ts +17 -0
- package/lib/archive/db-ops/_shared/decode-json-ref.js +31 -0
- package/lib/archive/db-ops/_shared/load-response-headers-by-set-ids.d.ts +20 -0
- package/lib/archive/db-ops/_shared/load-response-headers-by-set-ids.js +53 -0
- package/lib/archive/db-ops/_shared/resolve-content-item-id.d.ts +61 -0
- package/lib/archive/db-ops/_shared/resolve-content-item-id.js +111 -0
- package/lib/archive/db-ops/_shared/resolve-url-or-blob.d.ts +23 -0
- package/lib/archive/db-ops/_shared/resolve-url-or-blob.js +29 -0
- package/lib/archive/db-ops/_shared/retry-setting.d.ts +16 -0
- package/lib/archive/db-ops/_shared/retry-setting.js +18 -0
- package/lib/archive/db-ops/_shared/safe-parse-json.d.ts +11 -0
- package/lib/archive/db-ops/_shared/safe-parse-json.js +18 -0
- package/lib/archive/db-ops/_shared/types.d.ts +53 -0
- package/lib/archive/db-ops/_shared/types.js +1 -0
- package/lib/archive/db-ops/_shared/upsert-blob-ref.d.ts +25 -0
- package/lib/archive/db-ops/_shared/upsert-blob-ref.js +48 -0
- package/lib/archive/db-ops/_shared/upsert-content-type-ref.d.ts +30 -0
- package/lib/archive/db-ops/_shared/upsert-content-type-ref.js +45 -0
- package/lib/archive/db-ops/_shared/upsert-json-ref.d.ts +22 -0
- package/lib/archive/db-ops/_shared/upsert-json-ref.js +41 -0
- package/lib/archive/db-ops/_shared/upsert-response-headers.d.ts +35 -0
- package/lib/archive/db-ops/_shared/upsert-response-headers.js +49 -0
- package/lib/archive/db-ops/_shared/upsert-url-ref.d.ts +39 -0
- package/lib/archive/db-ops/_shared/upsert-url-ref.js +62 -0
- package/lib/archive/db-ops/analysis/replace-analysis-violations.d.ts +28 -0
- package/lib/archive/db-ops/analysis/replace-analysis-violations.js +152 -0
- package/lib/archive/db-ops/anchors/get-anchors-on-page.d.ts +10 -0
- package/lib/archive/db-ops/anchors/get-anchors-on-page.js +21 -0
- package/lib/archive/db-ops/config/get-base-url.d.ts +8 -0
- package/lib/archive/db-ops/config/get-base-url.js +14 -0
- package/lib/archive/db-ops/config/get-config.d.ts +10 -0
- package/lib/archive/db-ops/config/get-config.js +27 -0
- package/lib/archive/db-ops/config/get-name.d.ts +8 -0
- package/lib/archive/db-ops/config/get-name.js +14 -0
- package/lib/archive/db-ops/config/info-column-allowlist.d.ts +7 -0
- package/lib/archive/db-ops/config/info-column-allowlist.js +26 -0
- package/lib/archive/db-ops/config/info-json-columns.d.ts +5 -0
- package/lib/archive/db-ops/config/info-json-columns.js +10 -0
- package/lib/archive/db-ops/config/set-config.d.ts +12 -0
- package/lib/archive/db-ops/config/set-config.js +21 -0
- package/lib/archive/db-ops/config/update-config.d.ts +17 -0
- package/lib/archive/db-ops/config/update-config.js +36 -0
- package/lib/archive/db-ops/errors/insert-crawl-error.d.ts +15 -0
- package/lib/archive/db-ops/errors/insert-crawl-error.js +21 -0
- package/lib/archive/db-ops/errors/insert-page-error.d.ts +21 -0
- package/lib/archive/db-ops/errors/insert-page-error.js +28 -0
- package/lib/archive/db-ops/errors/list-dns-burned-host-candidates.d.ts +22 -0
- package/lib/archive/db-ops/errors/list-dns-burned-host-candidates.js +141 -0
- package/lib/archive/db-ops/html/get-html-of-page-by-id.d.ts +18 -0
- package/lib/archive/db-ops/html/get-html-of-page-by-id.js +29 -0
- package/lib/archive/db-ops/inventory/record-inventory-run.d.ts +21 -0
- package/lib/archive/db-ops/inventory/record-inventory-run.js +38 -0
- package/lib/archive/db-ops/lifecycle/checkpoint.d.ts +8 -0
- package/lib/archive/db-ops/lifecycle/checkpoint.js +9 -0
- package/lib/archive/db-ops/lifecycle/destroy.d.ts +6 -0
- package/lib/archive/db-ops/lifecycle/destroy.js +7 -0
- package/lib/archive/db-ops/lifecycle/init.d.ts +22 -0
- package/lib/archive/db-ops/lifecycle/init.js +42 -0
- package/lib/archive/db-ops/meta/get-jsonld-of-page.d.ts +13 -0
- package/lib/archive/db-ops/meta/get-jsonld-of-page.js +27 -0
- package/lib/archive/db-ops/meta/get-tags-of-page.d.ts +12 -0
- package/lib/archive/db-ops/meta/get-tags-of-page.js +28 -0
- package/lib/archive/db-ops/pages/order/set-url-order.d.ts +8 -0
- package/lib/archive/db-ops/pages/order/set-url-order.js +32 -0
- package/lib/archive/db-ops/pages/read/build-page-query.d.ts +18 -0
- package/lib/archive/db-ops/pages/read/build-page-query.js +40 -0
- package/lib/archive/db-ops/pages/read/get-crawling-state.d.ts +70 -0
- package/lib/archive/db-ops/pages/read/get-crawling-state.js +98 -0
- package/lib/archive/db-ops/pages/read/get-existing-page-urls.d.ts +15 -0
- package/lib/archive/db-ops/pages/read/get-existing-page-urls.js +30 -0
- package/lib/archive/db-ops/pages/read/get-page-count.d.ts +12 -0
- package/lib/archive/db-ops/pages/read/get-page-count.js +21 -0
- package/lib/archive/db-ops/pages/read/get-page-source-by-url.d.ts +24 -0
- package/lib/archive/db-ops/pages/read/get-page-source-by-url.js +28 -0
- package/lib/archive/db-ops/pages/read/get-pages-with-rels.d.ts +38 -0
- package/lib/archive/db-ops/pages/read/get-pages-with-rels.js +107 -0
- package/lib/archive/db-ops/pages/read/get-pages.d.ts +11 -0
- package/lib/archive/db-ops/pages/read/get-pages.js +51 -0
- package/lib/archive/db-ops/pages/read/get-scraped-html-page-count.d.ts +18 -0
- package/lib/archive/db-ops/pages/read/get-scraped-html-page-count.js +25 -0
- package/lib/archive/db-ops/pages/read/reconstruct-page-rows.d.ts +31 -0
- package/lib/archive/db-ops/pages/read/reconstruct-page-rows.js +32 -0
- package/lib/archive/db-ops/pages/reset/repromote-external-pages.d.ts +24 -0
- package/lib/archive/db-ops/pages/reset/repromote-external-pages.js +93 -0
- package/lib/archive/db-ops/pages/reset/reset-failed-pages.d.ts +47 -0
- package/lib/archive/db-ops/pages/reset/reset-failed-pages.js +124 -0
- package/lib/archive/db-ops/pages/write/insert-inventory-seeds.d.ts +37 -0
- package/lib/archive/db-ops/pages/write/insert-inventory-seeds.js +72 -0
- package/lib/archive/db-ops/pages/write/insert-jsonld.d.ts +17 -0
- package/lib/archive/db-ops/pages/write/insert-jsonld.js +49 -0
- package/lib/archive/db-ops/pages/write/insert-page.d.ts +36 -0
- package/lib/archive/db-ops/pages/write/insert-page.js +208 -0
- package/lib/archive/db-ops/pages/write/insert-tags.d.ts +16 -0
- package/lib/archive/db-ops/pages/write/insert-tags.js +34 -0
- package/lib/archive/db-ops/pages/write/link-redirect-sources.d.ts +36 -0
- package/lib/archive/db-ops/pages/write/link-redirect-sources.js +93 -0
- package/lib/archive/db-ops/pages/write/record-redirect.d.ts +35 -0
- package/lib/archive/db-ops/pages/write/record-redirect.js +100 -0
- package/lib/archive/db-ops/pages/write/set-skipped-page.d.ts +13 -0
- package/lib/archive/db-ops/pages/write/set-skipped-page.js +22 -0
- package/lib/archive/db-ops/pages/write/update-page.d.ts +29 -0
- package/lib/archive/db-ops/pages/write/update-page.js +334 -0
- package/lib/archive/db-ops/pages/write/write-page-html-blob.d.ts +19 -0
- package/lib/archive/db-ops/pages/write/write-page-html-blob.js +41 -0
- package/lib/archive/db-ops/referrers/get-redirects-for-pages.d.ts +9 -0
- package/lib/archive/db-ops/referrers/get-redirects-for-pages.js +15 -0
- package/lib/archive/db-ops/referrers/get-referrers-of-page.d.ts +17 -0
- package/lib/archive/db-ops/referrers/get-referrers-of-page.js +32 -0
- package/lib/archive/db-ops/referrers/get-referrers-of-resource.d.ts +8 -0
- package/lib/archive/db-ops/referrers/get-referrers-of-resource.js +15 -0
- package/lib/archive/db-ops/resources/build-resource-query.d.ts +25 -0
- package/lib/archive/db-ops/resources/build-resource-query.js +29 -0
- package/lib/archive/db-ops/resources/get-existing-resource-urls.d.ts +9 -0
- package/lib/archive/db-ops/resources/get-existing-resource-urls.js +24 -0
- package/lib/archive/db-ops/resources/get-resource-by-url.d.ts +13 -0
- package/lib/archive/db-ops/resources/get-resource-by-url.js +22 -0
- package/lib/archive/db-ops/resources/get-resource-url-list.d.ts +9 -0
- package/lib/archive/db-ops/resources/get-resource-url-list.js +13 -0
- package/lib/archive/db-ops/resources/get-resources.d.ts +8 -0
- package/lib/archive/db-ops/resources/get-resources.js +11 -0
- package/lib/archive/db-ops/resources/insert-inventory-resources.d.ts +24 -0
- package/lib/archive/db-ops/resources/insert-inventory-resources.js +64 -0
- package/lib/archive/db-ops/resources/insert-resource-referrers.d.ts +15 -0
- package/lib/archive/db-ops/resources/insert-resource-referrers.js +54 -0
- package/lib/archive/db-ops/resources/insert-resource.d.ts +34 -0
- package/lib/archive/db-ops/resources/insert-resource.js +73 -0
- package/lib/archive/db-ops/resources/reconstruct-resource-rows.d.ts +26 -0
- package/lib/archive/db-ops/resources/reconstruct-resource-rows.js +30 -0
- package/lib/archive/decode-html-blob.d.ts +18 -0
- package/lib/archive/decode-html-blob.js +31 -0
- package/lib/archive/derive-lineage-from-parent.d.ts +37 -0
- package/lib/archive/derive-lineage-from-parent.js +42 -0
- package/lib/archive/drop-legacy-tables.d.ts +45 -0
- package/lib/archive/drop-legacy-tables.js +56 -0
- package/lib/archive/filesystem/rename.js +1 -1
- package/lib/archive/get-failed-page-messages.d.ts +44 -0
- package/lib/archive/get-failed-page-messages.js +132 -0
- package/lib/archive/init-schema.d.ts +35 -39
- package/lib/archive/init-schema.js +111 -320
- package/lib/archive/is-inventory-source.d.ts +21 -0
- package/lib/archive/is-inventory-source.js +22 -0
- package/lib/archive/limited-page-ids.d.ts +2 -1
- package/lib/archive/limited-page-ids.js +5 -4
- package/lib/archive/meta/assert-compatible-version.d.ts +24 -3
- package/lib/archive/meta/assert-compatible-version.js +24 -3
- package/lib/archive/meta/types.d.ts +87 -1
- package/lib/archive/meta/types.js +34 -2
- package/lib/archive/migrate-entity-tables.d.ts +45 -0
- package/lib/archive/migrate-entity-tables.js +56 -0
- package/lib/archive/migrate-ref-tables.d.ts +25 -0
- package/lib/archive/migrate-ref-tables.js +38 -0
- package/lib/archive/page-meta-column-maps.d.ts +32 -0
- package/lib/archive/page-meta-column-maps.js +43 -0
- package/lib/archive/page.d.ts +6 -6
- package/lib/archive/page.js +5 -5
- package/lib/archive/peek-archive-lock.d.ts +2 -2
- package/lib/archive/peek-archive-lock.js +2 -2
- package/lib/archive/populate-entity-tables/collapse-anchor-rows.d.ts +41 -0
- package/lib/archive/populate-entity-tables/collapse-anchor-rows.js +87 -0
- package/lib/archive/populate-entity-tables/derive-dom-path.d.ts +35 -0
- package/lib/archive/populate-entity-tables/derive-dom-path.js +72 -0
- package/lib/archive/populate-entity-tables/is-blob-ref-value.d.ts +16 -0
- package/lib/archive/populate-entity-tables/is-blob-ref-value.js +19 -0
- package/lib/archive/populate-entity-tables/match-images-to-dom-paths.d.ts +66 -0
- package/lib/archive/populate-entity-tables/match-images-to-dom-paths.js +96 -0
- package/lib/archive/populate-entity-tables/populate-anchor-edges.d.ts +33 -0
- package/lib/archive/populate-entity-tables/populate-anchor-edges.js +153 -0
- package/lib/archive/populate-entity-tables/populate-content-items.d.ts +40 -0
- package/lib/archive/populate-entity-tables/populate-content-items.js +141 -0
- package/lib/archive/populate-entity-tables/populate-entities.d.ts +81 -0
- package/lib/archive/populate-entity-tables/populate-entities.js +111 -0
- package/lib/archive/populate-entity-tables/populate-image-items.d.ts +91 -0
- package/lib/archive/populate-entity-tables/populate-image-items.js +223 -0
- package/lib/archive/populate-entity-tables/populate-page-meta.d.ts +33 -0
- package/lib/archive/populate-entity-tables/populate-page-meta.js +267 -0
- package/lib/archive/populate-entity-tables/populate-resource-items.d.ts +22 -0
- package/lib/archive/populate-entity-tables/populate-resource-items.js +114 -0
- package/lib/archive/populate-entity-tables/populate-resource-ref-edges.d.ts +31 -0
- package/lib/archive/populate-entity-tables/populate-resource-ref-edges.js +33 -0
- package/lib/archive/populate-entity-tables/resolve-blob-refs.d.ts +31 -0
- package/lib/archive/populate-entity-tables/resolve-blob-refs.js +100 -0
- package/lib/archive/populate-entity-tables/resolve-content-type-refs.d.ts +22 -0
- package/lib/archive/populate-entity-tables/resolve-content-type-refs.js +27 -0
- package/lib/archive/populate-entity-tables/resolve-header-sets.d.ts +49 -0
- package/lib/archive/populate-entity-tables/resolve-header-sets.js +122 -0
- package/lib/archive/populate-entity-tables/resolve-json-refs.d.ts +25 -0
- package/lib/archive/populate-entity-tables/resolve-json-refs.js +67 -0
- package/lib/archive/populate-entity-tables/resolve-text-refs.d.ts +30 -0
- package/lib/archive/populate-entity-tables/resolve-text-refs.js +61 -0
- package/lib/archive/populate-entity-tables/resolve-url-or-blob-from-maps.d.ts +21 -0
- package/lib/archive/populate-entity-tables/resolve-url-or-blob-from-maps.js +27 -0
- package/lib/archive/populate-entity-tables/resolve-url-refs.d.ts +33 -0
- package/lib/archive/populate-entity-tables/resolve-url-refs.js +60 -0
- package/lib/archive/populate-entity-tables/test-utils/count-rows.d.ts +17 -0
- package/lib/archive/populate-entity-tables/test-utils/count-rows.js +20 -0
- package/lib/archive/populate-entity-tables/test-utils/seed-content-items.d.ts +25 -0
- package/lib/archive/populate-entity-tables/test-utils/seed-content-items.js +42 -0
- package/lib/archive/populate-entity-tables/test-utils/setup-entities-db.d.ts +23 -0
- package/lib/archive/populate-entity-tables/test-utils/setup-entities-db.js +178 -0
- package/lib/archive/populate-entity-tables/types.d.ts +157 -0
- package/lib/archive/populate-entity-tables/types.js +12 -0
- package/lib/archive/populate-entity-tables/upsert-text-refs.d.ts +38 -0
- package/lib/archive/populate-entity-tables/upsert-text-refs.js +78 -0
- package/lib/archive/populate-ref-tables/classify-content-type.d.ts +16 -0
- package/lib/archive/populate-ref-tables/classify-content-type.js +52 -0
- package/lib/archive/populate-ref-tables/compute-content-hash.d.ts +22 -0
- package/lib/archive/populate-ref-tables/compute-content-hash.js +26 -0
- package/lib/archive/populate-ref-tables/compute-header-flags.d.ts +16 -0
- package/lib/archive/populate-ref-tables/compute-header-flags.js +70 -0
- package/lib/archive/populate-ref-tables/content-type-rules.d.ts +38 -0
- package/lib/archive/populate-ref-tables/content-type-rules.js +133 -0
- package/lib/archive/populate-ref-tables/create-header-table-caches.d.ts +25 -0
- package/lib/archive/populate-ref-tables/create-header-table-caches.js +49 -0
- package/lib/archive/populate-ref-tables/data-uri-url-refs-limit.d.ts +15 -0
- package/lib/archive/populate-ref-tables/data-uri-url-refs-limit.js +15 -0
- package/lib/archive/populate-ref-tables/decode-data-uri.d.ts +21 -0
- package/lib/archive/populate-ref-tables/decode-data-uri.js +126 -0
- package/lib/archive/populate-ref-tables/decompose-header-set.d.ts +29 -0
- package/lib/archive/populate-ref-tables/decompose-header-set.js +157 -0
- package/lib/archive/populate-ref-tables/decompose-url.d.ts +25 -0
- package/lib/archive/populate-ref-tables/decompose-url.js +70 -0
- package/lib/archive/populate-ref-tables/header-stability.d.ts +19 -0
- package/lib/archive/populate-ref-tables/header-stability.js +22 -0
- package/lib/archive/populate-ref-tables/header-value-cache-key.d.ts +17 -0
- package/lib/archive/populate-ref-tables/header-value-cache-key.js +19 -0
- package/lib/archive/populate-ref-tables/normalize-mime.d.ts +24 -0
- package/lib/archive/populate-ref-tables/normalize-mime.js +36 -0
- package/lib/archive/populate-ref-tables/populate-blob-refs.d.ts +38 -0
- package/lib/archive/populate-ref-tables/populate-blob-refs.js +134 -0
- package/lib/archive/populate-ref-tables/populate-content-type-refs.d.ts +27 -0
- package/lib/archive/populate-ref-tables/populate-content-type-refs.js +70 -0
- package/lib/archive/populate-ref-tables/populate-header-tables.d.ts +35 -0
- package/lib/archive/populate-ref-tables/populate-header-tables.js +80 -0
- package/lib/archive/populate-ref-tables/populate-json-refs.d.ts +29 -0
- package/lib/archive/populate-ref-tables/populate-json-refs.js +101 -0
- package/lib/archive/populate-ref-tables/populate-refs.d.ts +51 -0
- package/lib/archive/populate-ref-tables/populate-refs.js +62 -0
- package/lib/archive/populate-ref-tables/populate-text-refs.d.ts +32 -0
- package/lib/archive/populate-ref-tables/populate-text-refs.js +133 -0
- package/lib/archive/populate-ref-tables/populate-url-refs.d.ts +28 -0
- package/lib/archive/populate-ref-tables/populate-url-refs.js +148 -0
- package/lib/archive/populate-ref-tables/test-utils/count-rows.d.ts +15 -0
- package/lib/archive/populate-ref-tables/test-utils/count-rows.js +17 -0
- package/lib/archive/populate-ref-tables/types.d.ts +197 -0
- package/lib/archive/populate-ref-tables/types.js +7 -0
- package/lib/archive/populate-ref-tables/upsert-one-header-set.d.ts +34 -0
- package/lib/archive/populate-ref-tables/upsert-one-header-set.js +208 -0
- package/lib/archive/populate-ref-tables/volatile-header-names.d.ts +20 -0
- package/lib/archive/populate-ref-tables/volatile-header-names.js +33 -0
- package/lib/archive/redirect-table.d.ts +4 -2
- package/lib/archive/redirect-table.js +15 -10
- package/lib/archive/resolve-redirect-chain.d.ts +3 -3
- package/lib/archive/resolve-redirect-chain.js +2 -2
- package/lib/archive/resource.d.ts +1 -1
- package/lib/archive/retarget-legacy-fk-tables.d.ts +47 -0
- package/lib/archive/retarget-legacy-fk-tables.js +107 -0
- package/lib/archive/test-utils/fk-parent-tables.d.ts +15 -0
- package/lib/archive/test-utils/fk-parent-tables.js +19 -0
- package/lib/archive/test-utils/seed-content-item.d.ts +35 -0
- package/lib/archive/test-utils/seed-content-item.js +42 -0
- package/lib/archive/test-utils/setup-legacy-fk-db.d.ts +33 -0
- package/lib/archive/test-utils/setup-legacy-fk-db.js +270 -0
- package/lib/archive/types.d.ts +151 -15
- package/lib/archive/verify-migration/capture-rejection.d.ts +24 -0
- package/lib/archive/verify-migration/capture-rejection.js +31 -0
- package/lib/archive/verify-migration/check-anchor-edges-count.d.ts +34 -0
- package/lib/archive/verify-migration/check-anchor-edges-count.js +72 -0
- package/lib/archive/verify-migration/check-anchor-edges-sum.d.ts +13 -0
- package/lib/archive/verify-migration/check-anchor-edges-sum.js +27 -0
- package/lib/archive/verify-migration/check-content-items-count.d.ts +16 -0
- package/lib/archive/verify-migration/check-content-items-count.js +30 -0
- package/lib/archive/verify-migration/check-content-type-preservation.d.ts +22 -0
- package/lib/archive/verify-migration/check-content-type-preservation.js +40 -0
- package/lib/archive/verify-migration/check-foreign-key-integrity.d.ts +31 -0
- package/lib/archive/verify-migration/check-foreign-key-integrity.js +47 -0
- package/lib/archive/verify-migration/check-image-items-count.d.ts +12 -0
- package/lib/archive/verify-migration/check-image-items-count.js +26 -0
- package/lib/archive/verify-migration/check-page-meta-count.d.ts +15 -0
- package/lib/archive/verify-migration/check-page-meta-count.js +31 -0
- package/lib/archive/verify-migration/check-reader-parity.d.ts +23 -0
- package/lib/archive/verify-migration/check-reader-parity.js +211 -0
- package/lib/archive/verify-migration/check-resource-items-count.d.ts +17 -0
- package/lib/archive/verify-migration/check-resource-items-count.js +33 -0
- package/lib/archive/verify-migration/check-url-round-trip.d.ts +43 -0
- package/lib/archive/verify-migration/check-url-round-trip.js +112 -0
- package/lib/archive/verify-migration/types.d.ts +70 -0
- package/lib/archive/verify-migration/types.js +63 -0
- package/lib/archive/verify-migration/verify-migration.d.ts +41 -0
- package/lib/archive/verify-migration/verify-migration.js +120 -0
- package/lib/classify-error-kind.d.ts +19 -0
- package/lib/classify-error-kind.js +122 -0
- package/lib/crawler/build-js-redirect-edge.d.ts +68 -0
- package/lib/crawler/build-js-redirect-edge.js +57 -0
- package/lib/crawler/build-redirect-event.d.ts +24 -0
- package/lib/crawler/build-redirect-event.js +28 -0
- package/lib/crawler/capture-image-dom-paths.d.ts +33 -0
- package/lib/crawler/capture-image-dom-paths.js +39 -0
- package/lib/crawler/clear-dns-burned-host-cache.d.ts +6 -0
- package/lib/crawler/clear-dns-burned-host-cache.js +11 -0
- package/lib/crawler/collect-image-dom-paths.d.ts +23 -0
- package/lib/crawler/collect-image-dom-paths.js +64 -0
- package/lib/crawler/crawler.d.ts +22 -1
- package/lib/crawler/crawler.js +679 -117
- package/lib/crawler/derive-js-redirect-target.d.ts +68 -0
- package/lib/crawler/derive-js-redirect-target.js +129 -0
- package/lib/crawler/derive-resource-source.d.ts +25 -15
- package/lib/crawler/derive-resource-source.js +28 -17
- package/lib/crawler/dns-burned-host-cache.d.ts +26 -0
- package/lib/crawler/dns-burned-host-cache.js +25 -0
- package/lib/crawler/dns-burned-host-short-circuit-counter.d.ts +13 -0
- package/lib/crawler/dns-burned-host-short-circuit-counter.js +11 -0
- package/lib/crawler/fetch-destination.d.ts +12 -4
- package/lib/crawler/fetch-destination.js +94 -16
- package/lib/crawler/inject-scope-auth.d.ts +1 -1
- package/lib/crawler/inject-scope-auth.js +1 -1
- package/lib/crawler/is-js-redirect-error-shape.d.ts +40 -0
- package/lib/crawler/is-js-redirect-error-shape.js +53 -0
- package/lib/crawler/is-puppeteer-fallback-candidate.d.ts +16 -0
- package/lib/crawler/is-puppeteer-fallback-candidate.js +63 -0
- package/lib/crawler/link-list.d.ts +21 -1
- package/lib/crawler/link-list.js +23 -3
- package/lib/crawler/normalize-content-type.d.ts +1 -1
- package/lib/crawler/normalize-content-type.js +1 -1
- package/lib/crawler/plan-sub-resource-emits.d.ts +63 -0
- package/lib/crawler/plan-sub-resource-emits.js +44 -0
- package/lib/crawler/preload-short-circuit-error.d.ts +22 -0
- package/lib/crawler/preload-short-circuit-error.js +25 -0
- package/lib/crawler/should-burn-host.d.ts +78 -0
- package/lib/crawler/should-burn-host.js +61 -0
- package/lib/crawler/should-get-fallback-on-head-failure.d.ts +38 -0
- package/lib/crawler/should-get-fallback-on-head-failure.js +46 -0
- package/lib/crawler/types.d.ts +108 -1
- package/lib/crawler-orchestrator.d.ts +22 -3
- package/lib/crawler-orchestrator.js +312 -73
- package/lib/crawler.d.ts +15 -2
- package/lib/crawler.js +24 -1
- package/lib/permanent-error-kinds.d.ts +43 -0
- package/lib/permanent-error-kinds.js +48 -0
- package/lib/types.d.ts +84 -0
- package/lib/utils/compute-file-sha256.d.ts +24 -0
- package/lib/utils/compute-file-sha256.js +56 -0
- package/lib/utils/error/emit-error-with-retry.d.ts +40 -0
- package/lib/utils/error/emit-error-with-retry.js +44 -0
- package/lib/utils/error/emit-error.d.ts +39 -0
- package/lib/utils/error/emit-error.js +41 -0
- package/package.json +12 -12
- package/lib/archive/migrate-crawl-errors.d.ts +0 -20
- package/lib/archive/migrate-crawl-errors.js +0 -38
- package/lib/archive/migrate-html-blob-tables.d.ts +0 -24
- package/lib/archive/migrate-html-blob-tables.js +0 -53
- package/lib/archive/migrate-page-errors.d.ts +0 -16
- package/lib/archive/migrate-page-errors.js +0 -35
- package/lib/archive/migrate-pages-resources-source.d.ts +0 -16
- package/lib/archive/migrate-pages-resources-source.js +0 -46
- package/lib/utils/error/error-emitter.d.ts +0 -18
- package/lib/utils/error/error-emitter.js +0 -29
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { classifyErrorKind } from '../classify-error-kind.js';
|
|
2
|
+
import NetTimeoutError from './net-timeout-error.js';
|
|
3
|
+
/**
|
|
4
|
+
* Decide whether a HEAD pre-flight failure should trigger a GET retry and
|
|
5
|
+
* stay OUT of `destinationCache`.
|
|
6
|
+
*
|
|
7
|
+
* The two contracts are intentionally tied to one helper: anything we'll GET
|
|
8
|
+
* later because the HEAD answer might be wrong is also the same thing we
|
|
9
|
+
* must NOT freeze into the per-session cache (or the second attempt would
|
|
10
|
+
* hit the stale cached failure and skip the live retry that
|
|
11
|
+
* `Crawler.#sendHeadRequest`'s `HEAD_TIMEOUT_ESCALATION_MS` is supposed to
|
|
12
|
+
* pay for).
|
|
13
|
+
*
|
|
14
|
+
* The eligible kinds are:
|
|
15
|
+
*
|
|
16
|
+
* - **`NetTimeoutError`** — the HEAD pre-flight race fired without a
|
|
17
|
+
* server response. The escalating retry can still succeed against a
|
|
18
|
+
* slow-but-reachable host.
|
|
19
|
+
* - **`parse-error`** — `Parse Error` / `Expected HTTP/` / `Unexpected end
|
|
20
|
+
* of stream`. Usually a middlebox rewriting / truncating the HEAD reply
|
|
21
|
+
* the GET path traverses differently.
|
|
22
|
+
* - **`connection-reset`** — `ECONNRESET` / `ERR_CONNECTION_RESET` etc.
|
|
23
|
+
* middlebox dropping the connection mid-response; a retry frequently
|
|
24
|
+
* succeeds.
|
|
25
|
+
*
|
|
26
|
+
* Everything else — DNS, TLS, refused, blocked, plain timeout — is treated
|
|
27
|
+
* as a persistent within-session verdict and IS cached so repeated calls on
|
|
28
|
+
* the same host pay the network cost once.
|
|
29
|
+
* @param error - The `Error` raised by the HEAD attempt.
|
|
30
|
+
* @returns `true` when the error warrants a GET fallback AND a cache skip.
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* shouldGetFallbackOnHeadFailure(new NetTimeoutError(url)); // true
|
|
34
|
+
* shouldGetFallbackOnHeadFailure(new Error('read ECONNRESET')); // true
|
|
35
|
+
* shouldGetFallbackOnHeadFailure(new Error('Parse Error')); // true
|
|
36
|
+
* shouldGetFallbackOnHeadFailure(new Error('getaddrinfo ENOTFOUND host')); // false
|
|
37
|
+
* shouldGetFallbackOnHeadFailure(new Error('ERR_CERT_DATE_INVALID')); // false
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export function shouldGetFallbackOnHeadFailure(error) {
|
|
41
|
+
if (error instanceof NetTimeoutError) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
const kind = classifyErrorKind(error.message);
|
|
45
|
+
return kind === 'parse-error' || kind === 'connection-reset';
|
|
46
|
+
}
|
package/lib/crawler/types.d.ts
CHANGED
|
@@ -12,6 +12,29 @@ export interface RedirectEdgeResult {
|
|
|
12
12
|
type: 'redirect-edge';
|
|
13
13
|
/** HEAD-resolved page data carrying the redirect chain (source → destination). */
|
|
14
14
|
pageData: PageData;
|
|
15
|
+
/**
|
|
16
|
+
* Where the chain came from. The caller needs this to decide whether the
|
|
17
|
+
* URLs in `pageData.redirectPaths` are already-known (HTTP chain — every
|
|
18
|
+
* hop was followed by the browser/HEAD pre-flight and the destination is
|
|
19
|
+
* already rendered) or brand-new (JS redirect — only the source was
|
|
20
|
+
* processed, the destination came out of `page.url()` and has never been
|
|
21
|
+
* touched).
|
|
22
|
+
*
|
|
23
|
+
* - `'http-chain'` — Returned when the HEAD pre-flight resolved a real
|
|
24
|
+
* 3xx chain and the destination has already been claimed via
|
|
25
|
+
* `#scrapedDestinations`. The crawler folds every URL in
|
|
26
|
+
* `redirectPaths` into the link-list's done-set; the destination is not
|
|
27
|
+
* re-enqueued because it is already in the archive.
|
|
28
|
+
* - `'js-redirect'` — Returned when `scraper.scrapeStart` threw because
|
|
29
|
+
* `page.goto()` resolved to `null` (client-side
|
|
30
|
+
* `window.location.replace()` / `<meta http-equiv="refresh">`) and
|
|
31
|
+
* `page.url()` exposed a different destination. `redirectPaths`
|
|
32
|
+
* contains exactly one URL: the JS-redirect target. The crawler MUST
|
|
33
|
+
* enqueue that destination so it reaches the browser, and MUST NOT
|
|
34
|
+
* fold it into the done-set (otherwise the dealer's `seen` rejects
|
|
35
|
+
* the push and the destination is silently lost from the archive).
|
|
36
|
+
*/
|
|
37
|
+
source: 'http-chain' | 'js-redirect';
|
|
15
38
|
}
|
|
16
39
|
/**
|
|
17
40
|
* The outcome of {@link Crawler.#scrapePage}: either a normal scrape result from
|
|
@@ -19,6 +42,52 @@ export interface RedirectEdgeResult {
|
|
|
19
42
|
* redirect destination was already rendered and only the edge needs recording.
|
|
20
43
|
*/
|
|
21
44
|
export type ScrapeOutcome = ScrapeResult | RedirectEdgeResult;
|
|
45
|
+
/**
|
|
46
|
+
* Internal envelope returned by {@link Crawler.#launchBrowserAndScrape} that
|
|
47
|
+
* augments beholder's {@link ScrapeResult} with the puppeteer-side
|
|
48
|
+
* post-navigation URL.
|
|
49
|
+
*
|
|
50
|
+
* **Why:** when `scraper.scrapeStart` throws because `page.goto()` resolved to
|
|
51
|
+
* `null` (the classic puppeteer symptom of a client-side
|
|
52
|
+
* `window.location.replace()` / meta-refresh firing mid-navigation), the only
|
|
53
|
+
* authoritative source for the URL the browser actually landed on is
|
|
54
|
+
* `page.url()` — neither the HEAD pre-flight nor the thrown error carries it.
|
|
55
|
+
* Capturing it here lets `#scrapePage` fold the source into a redirect edge
|
|
56
|
+
* instead of recording a hard `status = -1` that `--retry-failed` would chase
|
|
57
|
+
* forever (`Page.goto returned null` classifies as `protocol`, which is neither
|
|
58
|
+
* permanent nor a puppeteer-fallback kind — so the SQL filter resets it every
|
|
59
|
+
* pass and the next pass replays the same failure).
|
|
60
|
+
*
|
|
61
|
+
* `postNavigationUrl` is optional because:
|
|
62
|
+
* - successful / skipped outcomes do not need it (the success path already
|
|
63
|
+
* exposes the final URL via `pageData.url` + `redirectPaths`);
|
|
64
|
+
* - capturing can itself fail when the underlying browser context is already
|
|
65
|
+
* torn down (target closed, session killed) — we treat that as "no extra
|
|
66
|
+
* information" and fall through to the existing error path.
|
|
67
|
+
*/
|
|
68
|
+
export type BrowserScrapeResult = ScrapeResult & {
|
|
69
|
+
/**
|
|
70
|
+
* URL puppeteer reports via `page.url()` *after* a thrown navigation.
|
|
71
|
+
*
|
|
72
|
+
* Semantically only meaningful when the parent result is `type: 'error'`
|
|
73
|
+
* — `#launchBrowserAndScrape` sets it from inside its catch arm, and the
|
|
74
|
+
* success / skipped paths never write to it. The field is typed as
|
|
75
|
+
* optional on the whole envelope rather than narrowed to the error
|
|
76
|
+
* variant because beholder's `ScrapeResult` is not a discriminated
|
|
77
|
+
* union (all variants share the same shape and disambiguate via
|
|
78
|
+
* `type`), so narrowing here would force a parallel ad-hoc union with
|
|
79
|
+
* no compile-time payoff. Consumers MUST therefore check
|
|
80
|
+
* `result.type === 'error'` before reading `postNavigationUrl` — and in
|
|
81
|
+
* practice the only consumer is the JS-redirect rescue, which does
|
|
82
|
+
* exactly that.
|
|
83
|
+
*
|
|
84
|
+
* Consumers should also confirm the URL is meaningful via
|
|
85
|
+
* `deriveJsRedirectTarget` — `about:blank`, identity values,
|
|
86
|
+
* case-only or trailing-slash variants are all filtered there, not
|
|
87
|
+
* here.
|
|
88
|
+
*/
|
|
89
|
+
postNavigationUrl?: string;
|
|
90
|
+
};
|
|
22
91
|
/**
|
|
23
92
|
* Configuration options that control crawler behavior.
|
|
24
93
|
*
|
|
@@ -65,6 +134,19 @@ export interface CrawlerOptions extends Required<Pick<ParseURLOptions, 'disableQ
|
|
|
65
134
|
* resource-reuse optimization. See {@link ResourceLookup}.
|
|
66
135
|
*/
|
|
67
136
|
lookupResource: ResourceLookup | null;
|
|
137
|
+
/**
|
|
138
|
+
* Lookup for an already-persisted page's `source` column, or `null` when
|
|
139
|
+
* lineage propagation across sessions is not required. See
|
|
140
|
+
* {@link PageSourceLookup}.
|
|
141
|
+
*
|
|
142
|
+
* Injected by the orchestrator so that `#scrapePage` can resolve the
|
|
143
|
+
* parent's source on `--resume` / `--retry-failed` paths, where
|
|
144
|
+
* `inventoryMode` is not persisted but the page's `source` column is.
|
|
145
|
+
* Without this, sub-resources captured during a re-render of an
|
|
146
|
+
* inventory-labelled page would fall back to the DB DEFAULT `'crawled'`
|
|
147
|
+
* and lose their `'inventory-discovered'` provenance.
|
|
148
|
+
*/
|
|
149
|
+
lookupPageSource: PageSourceLookup | null;
|
|
68
150
|
/**
|
|
69
151
|
* When non-null, the crawler is running in `--inventory` mode. New page
|
|
70
152
|
* rows whose URL matches `seedUrls` are labelled `'inventory-seed'`;
|
|
@@ -99,6 +181,22 @@ export interface InventoryMode {
|
|
|
99
181
|
* @returns The recorded resource data, or `null` when no row matches.
|
|
100
182
|
*/
|
|
101
183
|
export type ResourceLookup = (urls: readonly string[]) => Promise<ResourceLookupResult | null>;
|
|
184
|
+
/**
|
|
185
|
+
* Looks up the `source` column of a previously persisted page by URL.
|
|
186
|
+
*
|
|
187
|
+
* Returns `undefined` when no row matches (e.g. a freshly-discovered URL
|
|
188
|
+
* that has not been INSERTed yet) so the caller can fall through to its
|
|
189
|
+
* default behaviour.
|
|
190
|
+
*
|
|
191
|
+
* Used by `Crawler` during sub-resource lineage propagation:
|
|
192
|
+
* `#scrapePage` consults this once per page to resolve the parent's
|
|
193
|
+
* lineage when the in-memory `inventoryMode` is unavailable (i.e. on
|
|
194
|
+
* `--resume` / `--retry-failed` sessions where inventory state lives only
|
|
195
|
+
* in the DB).
|
|
196
|
+
* @param urlWithoutHashAndAuth - The URL key (`url.withoutHashAndAuth` form) to look up.
|
|
197
|
+
* @returns The recorded `source`, or `undefined` when no matching row exists.
|
|
198
|
+
*/
|
|
199
|
+
export type PageSourceLookup = (urlWithoutHashAndAuth: string) => Promise<PageSource | undefined>;
|
|
102
200
|
/**
|
|
103
201
|
* Minimal sub-resource data needed to synthesize {@link PageData}
|
|
104
202
|
* without performing a network fetch.
|
|
@@ -152,7 +250,7 @@ export interface CrawlerEventTypes {
|
|
|
152
250
|
externalPage: {
|
|
153
251
|
/** The scraped page data for the external page. */
|
|
154
252
|
result: PageData;
|
|
155
|
-
/** Inventory provenance for new rows — see
|
|
253
|
+
/** Inventory provenance for new rows — see `CrawlerEventTypes.page.source`. */
|
|
156
254
|
source?: PageSource;
|
|
157
255
|
};
|
|
158
256
|
/**
|
|
@@ -236,5 +334,14 @@ export interface CrawlerEventTypes {
|
|
|
236
334
|
redirect: {
|
|
237
335
|
/** HEAD-resolved page data carrying the redirect chain (source → destination). */
|
|
238
336
|
result: PageData;
|
|
337
|
+
/**
|
|
338
|
+
* Inventory provenance for the redirect-edge call. Forwarded by the
|
|
339
|
+
* orchestrator to `Archive.setRedirect` → `Database.recordRedirect`
|
|
340
|
+
* so brand-new destination rows INSERTed by the edge-only path pick
|
|
341
|
+
* up the inventory label (and propagate it to intermediates) when
|
|
342
|
+
* the originating chain is in the inventory chain. `undefined` keeps
|
|
343
|
+
* the DB DEFAULT `'crawled'`.
|
|
344
|
+
*/
|
|
345
|
+
source: PageSource | undefined;
|
|
239
346
|
};
|
|
240
347
|
}
|
|
@@ -8,6 +8,9 @@ import Archive from './archive/archive.js';
|
|
|
8
8
|
* Default list of external URL prefixes excluded from crawling.
|
|
9
9
|
* Includes social media sharing endpoints that are commonly linked
|
|
10
10
|
* but provide no useful crawl data.
|
|
11
|
+
* @example
|
|
12
|
+
* // Merged ahead of user-supplied excludeUrls when a crawl starts:
|
|
13
|
+
* const excludeUrls = [...DEFAULT_EXCLUDED_EXTERNAL_URLS, 'https://ads.example.com'];
|
|
11
14
|
*/
|
|
12
15
|
export declare const DEFAULT_EXCLUDED_EXTERNAL_URLS: string[];
|
|
13
16
|
/**
|
|
@@ -89,13 +92,13 @@ export declare class CrawlerOrchestrator extends EventEmitter<CrawlEvent> {
|
|
|
89
92
|
* Sets up event listeners on the crawler, starts crawling, and resolves
|
|
90
93
|
* when the crawl completes. Discovered pages, external pages, skipped pages,
|
|
91
94
|
* and resources are forwarded to the archive for storage.
|
|
92
|
-
* @param list - The list of parsed URLs to crawl.
|
|
95
|
+
* @param list - The list of parsed URLs to crawl. May be empty when a resumed
|
|
96
|
+
* session already has pending pages queued (for example `--retry-failed`).
|
|
93
97
|
* @param opts - Optional crawl overrides.
|
|
94
98
|
* @param opts.recursive - Whether discovered URLs are followed. Defaults to
|
|
95
99
|
* `!fromList` (recursive unless the archive was created from a URL list), so
|
|
96
100
|
* existing callers keep their behaviour; the retry flow passes it explicitly.
|
|
97
101
|
* @returns A promise that resolves when crawling is complete.
|
|
98
|
-
* @throws {Error} If the URL list is empty.
|
|
99
102
|
*/
|
|
100
103
|
crawling(list: ExURL[], opts?: {
|
|
101
104
|
recursive?: boolean;
|
|
@@ -117,6 +120,12 @@ export declare class CrawlerOrchestrator extends EventEmitter<CrawlEvent> {
|
|
|
117
120
|
/**
|
|
118
121
|
* Write the archive to its configured file path.
|
|
119
122
|
*
|
|
123
|
+
* The crawler's write path inserts directly into the 0.13 entity
|
|
124
|
+
* tables (`content_items` / `page_meta` / `anchor_edges` / …) during
|
|
125
|
+
* `crawling` / `append` / `resume` / `retryFailed` / `inventory`, so by
|
|
126
|
+
* the time `write()` is called those tables are already populated.
|
|
127
|
+
* This method just tars.
|
|
128
|
+
*
|
|
120
129
|
* Emits `writeFileStart` before writing and `writeFileEnd` after
|
|
121
130
|
* the write completes successfully.
|
|
122
131
|
*/
|
|
@@ -200,10 +209,20 @@ export declare class CrawlerOrchestrator extends EventEmitter<CrawlEvent> {
|
|
|
200
209
|
* @param inventoryUrls - Pre-read URL list (one URL per element).
|
|
201
210
|
* @param options - Optional config overrides — most callers leave this blank and let the archived config flow through.
|
|
202
211
|
* @param initializedCallback - Hook invoked once the orchestrator is constructed but before `crawling` runs (the CLI uses it to attach progress reporting).
|
|
212
|
+
* @param sourceFileSha256 - **Pre-computed** SHA-256 hex digest of the
|
|
213
|
+
* source URL list. The orchestrator deliberately does NOT receive
|
|
214
|
+
* the file path: the path is privacy-sensitive (leaks user-home /
|
|
215
|
+
* OS structure when archives are shared) and we want it lifted off
|
|
216
|
+
* this boundary so no future log line / breadcrumb / error message
|
|
217
|
+
* inside the orchestrator can accidentally re-leak it. The CLI
|
|
218
|
+
* computes the digest via `computeFileSha256(resolvedListFile)`
|
|
219
|
+
* and passes it through here. Pass `null` for programmatic
|
|
220
|
+
* callers that built `inventoryUrls` in-memory; the audit row's
|
|
221
|
+
* `source_file_sha256` column will be `NULL`.
|
|
203
222
|
* @returns The orchestrator instance after a successful inventory pass.
|
|
204
223
|
* @throws {Error} When `inventoryUrls` is empty, the archive is in list mode, or pending URLs from a previous crawl remain unresolved.
|
|
205
224
|
*/
|
|
206
|
-
static inventory(archivePath: string, inventoryUrls: string[], options?: Partial<CrawlConfig>, initializedCallback?: CrawlInitializedCallback): Promise<CrawlerOrchestrator>;
|
|
225
|
+
static inventory(archivePath: string, inventoryUrls: string[], options?: Partial<CrawlConfig>, initializedCallback?: CrawlInitializedCallback, sourceFileSha256?: string | null): Promise<CrawlerOrchestrator>;
|
|
207
226
|
/**
|
|
208
227
|
* Re-fetch previously-failed pages in an existing `.nitpicker` archive.
|
|
209
228
|
*
|