@nitpicker/crawler 0.12.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 +63 -16
- package/lib/archive/archive.js +56 -17
- 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 +92 -345
- package/lib/archive/database.js +168 -1942
- 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 +1 -1
- package/lib/archive/derive-lineage-from-parent.js +1 -1
- 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 +5 -4
- package/lib/archive/get-failed-page-messages.js +5 -4
- package/lib/archive/init-schema.d.ts +35 -39
- package/lib/archive/init-schema.js +99 -460
- 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 +127 -24
- 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/crawler/build-redirect-event.d.ts +1 -1
- package/lib/crawler/build-redirect-event.js +1 -1
- 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 +1 -1
- package/lib/crawler/clear-dns-burned-host-cache.js +1 -1
- 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 +19 -0
- package/lib/crawler/crawler.js +40 -26
- package/lib/crawler/dns-burned-host-cache.d.ts +3 -3
- package/lib/crawler/dns-burned-host-cache.js +3 -3
- package/lib/crawler/dns-burned-host-short-circuit-counter.d.ts +2 -2
- package/lib/crawler/dns-burned-host-short-circuit-counter.js +2 -2
- package/lib/crawler/inject-scope-auth.d.ts +1 -1
- package/lib/crawler/inject-scope-auth.js +1 -1
- package/lib/crawler/normalize-content-type.d.ts +1 -1
- package/lib/crawler/normalize-content-type.js +1 -1
- package/lib/crawler/types.d.ts +3 -3
- package/lib/crawler-orchestrator.d.ts +9 -0
- package/lib/crawler-orchestrator.js +44 -28
- package/lib/crawler.d.ts +12 -0
- package/lib/crawler.js +21 -0
- package/lib/permanent-error-kinds.d.ts +1 -1
- package/lib/permanent-error-kinds.js +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/utils/compute-file-sha256.d.ts +5 -4
- package/lib/utils/compute-file-sha256.js +5 -4
- package/lib/utils/error/emit-error-with-retry.d.ts +1 -1
- package/lib/utils/error/emit-error-with-retry.js +1 -1
- package/package.json +10 -10
- 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-inventory-runs.d.ts +0 -29
- package/lib/archive/migrate-inventory-runs.js +0 -52
- 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
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates the 10 dictionary tables of the 0.13 format (issue #190) and their index.
|
|
3
|
+
*
|
|
4
|
+
* These are the ref / header dictionary tables that form the durable
|
|
5
|
+
* write-model of the 0.13 format: `url_refs`, `content_type_refs`,
|
|
6
|
+
* `text_refs`, `json_refs`, `blob_refs`, `header_name_refs`,
|
|
7
|
+
* `header_value_refs`, `header_sets` (+ `idx_header_sets_stable`),
|
|
8
|
+
* `header_set_entries`, `header_flags`.
|
|
9
|
+
*
|
|
10
|
+
* The DDL is shared between fresh-archive provisioning ({@link initSchema}
|
|
11
|
+
* calls this on a brand new DB) and the lazy migration path
|
|
12
|
+
* ({@link migrateRefTables} calls it on archives created before the
|
|
13
|
+
* 0.13 format). Keeping the schema in one function guarantees that both
|
|
14
|
+
* origin points produce byte-identical tables — a divergence would silently
|
|
15
|
+
* break the 0.13 population step, which relies on the exact UNIQUE
|
|
16
|
+
* constraints and CHECK clauses declared here.
|
|
17
|
+
*
|
|
18
|
+
* Hash columns store 32-byte BLAKE3 as `BLOB`, matching `page_html_blobs.hash`.
|
|
19
|
+
* `blob_refs` intentionally uses a regular integer rowid PK (unlike
|
|
20
|
+
* `page_html_blobs`) because `image_items.src_blob_id` (added in 0.13)
|
|
21
|
+
* needs a plain integer FK and auto-increment is incompatible with WITHOUT
|
|
22
|
+
* ROWID; `UNIQUE(hash)` still enforces content-addressable dedup.
|
|
23
|
+
*
|
|
24
|
+
* `header_set_entries` is WITHOUT ROWID because the composite PK
|
|
25
|
+
* `(header_set_id, name_id, occurrence)` is the natural clustering key and
|
|
26
|
+
* every column is small — the same reasoning as `page_html_blobs`.
|
|
27
|
+
*
|
|
28
|
+
* `header_sets.raw_json_hash` is a temporary column used only by the
|
|
29
|
+
* legacy-to-0.13 population step for lookups against the legacy
|
|
30
|
+
* `responseHeaders` JSON; a follow-up cleanup migration is expected to
|
|
31
|
+
* drop it.
|
|
32
|
+
* @param instance - The Knex query builder instance connected to the database.
|
|
33
|
+
*/
|
|
34
|
+
export async function createRefTables(instance) {
|
|
35
|
+
// Unified URL dictionary. `url` is the natural unique key; scheme /
|
|
36
|
+
// host / port / path / query_hash / fragment are pre-decomposed columns
|
|
37
|
+
// filled by the 0.13 population step so filters like
|
|
38
|
+
// "same-host resources" avoid re-parsing the URL string per row.
|
|
39
|
+
// `query_hash` is BLAKE3 of the raw query string — storing query strings
|
|
40
|
+
// inline would defeat dedup on tracker URLs.
|
|
41
|
+
await instance.raw(`
|
|
42
|
+
CREATE TABLE url_refs (
|
|
43
|
+
id INTEGER PRIMARY KEY,
|
|
44
|
+
url TEXT NOT NULL UNIQUE,
|
|
45
|
+
scheme TEXT,
|
|
46
|
+
host TEXT,
|
|
47
|
+
port INTEGER,
|
|
48
|
+
path TEXT,
|
|
49
|
+
query_hash BLOB,
|
|
50
|
+
fragment TEXT
|
|
51
|
+
)
|
|
52
|
+
`);
|
|
53
|
+
// Content-type dictionary. `raw` is the wire value (unique).
|
|
54
|
+
// `normalized` is the lowercase MIME with parameters stripped;
|
|
55
|
+
// `category` is the coarse bucket used by viewer filters ('html',
|
|
56
|
+
// 'image', ...). Populated in 0.13 by `classifyContentType`.
|
|
57
|
+
await instance.raw(`
|
|
58
|
+
CREATE TABLE content_type_refs (
|
|
59
|
+
id INTEGER PRIMARY KEY,
|
|
60
|
+
raw TEXT NOT NULL UNIQUE,
|
|
61
|
+
normalized TEXT NOT NULL,
|
|
62
|
+
category TEXT NOT NULL
|
|
63
|
+
)
|
|
64
|
+
`);
|
|
65
|
+
// Short-text dictionary. Covers anchor textContent, image alt, page
|
|
66
|
+
// meta strings, and dom_path. The `(hash, text)` composite UNIQUE
|
|
67
|
+
// mirrors `analysis_text_refs` so lookups prefix-seek on `hash`. The
|
|
68
|
+
// two dictionaries stay separate because merging would require
|
|
69
|
+
// re-keying every existing `analysis_violations` row (out of scope
|
|
70
|
+
// for the 0.13 migration; revisit in a later cleanup pass).
|
|
71
|
+
await instance.raw(`
|
|
72
|
+
CREATE TABLE text_refs (
|
|
73
|
+
id INTEGER PRIMARY KEY,
|
|
74
|
+
hash BLOB NOT NULL,
|
|
75
|
+
text TEXT NOT NULL,
|
|
76
|
+
UNIQUE(hash, text)
|
|
77
|
+
)
|
|
78
|
+
`);
|
|
79
|
+
// Large JSON payload dictionary. Covers `pages.meta_extras`. `hash` is
|
|
80
|
+
// BLAKE3 of the pre-compression JSON bytes; `codec` records whether
|
|
81
|
+
// `json_text` is zstd-compressed. Sizes are stored so consumers can
|
|
82
|
+
// estimate savings without decompressing.
|
|
83
|
+
await instance.raw(`
|
|
84
|
+
CREATE TABLE json_refs (
|
|
85
|
+
id INTEGER PRIMARY KEY,
|
|
86
|
+
hash BLOB NOT NULL UNIQUE,
|
|
87
|
+
json_text BLOB NOT NULL,
|
|
88
|
+
codec TEXT NOT NULL CHECK(codec IN ('zstd', 'none')),
|
|
89
|
+
size_raw INTEGER NOT NULL,
|
|
90
|
+
size_stored INTEGER NOT NULL
|
|
91
|
+
)
|
|
92
|
+
`);
|
|
93
|
+
// Large binary payload dictionary. Covers `data:` URIs longer than
|
|
94
|
+
// 512 bytes attached to `<img>` src / currentSrc. Well-formed http(s)
|
|
95
|
+
// URLs virtually never exceed 512 chars, so this threshold routes all
|
|
96
|
+
// data URIs here without misclassifying URLs.
|
|
97
|
+
await instance.raw(`
|
|
98
|
+
CREATE TABLE blob_refs (
|
|
99
|
+
id INTEGER PRIMARY KEY,
|
|
100
|
+
hash BLOB NOT NULL UNIQUE,
|
|
101
|
+
body BLOB NOT NULL,
|
|
102
|
+
codec TEXT NOT NULL CHECK(codec IN ('zstd', 'none')),
|
|
103
|
+
size_raw INTEGER NOT NULL,
|
|
104
|
+
size_stored INTEGER NOT NULL
|
|
105
|
+
)
|
|
106
|
+
`);
|
|
107
|
+
// Response-header decomposition tables. `responseHeaders` on the old
|
|
108
|
+
// `pages` / `resources` tables was a JSON blob whose raw hash barely
|
|
109
|
+
// deduped (99.4 % distinct on the reference archive) because volatile
|
|
110
|
+
// headers like `Date` / `ETag` / `CF-Ray` change every response. The
|
|
111
|
+
// five tables below split header sets into (name, value, occurrence)
|
|
112
|
+
// tuples so a stable-only hash can achieve real dedup, and expose the
|
|
113
|
+
// commonly-checked security flags as pre-computed booleans in
|
|
114
|
+
// `header_flags` so `checkHeaders` no longer needs a per-row LIKE
|
|
115
|
+
// scan.
|
|
116
|
+
await instance.raw(`
|
|
117
|
+
CREATE TABLE header_name_refs (
|
|
118
|
+
id INTEGER PRIMARY KEY,
|
|
119
|
+
name TEXT NOT NULL UNIQUE
|
|
120
|
+
)
|
|
121
|
+
`);
|
|
122
|
+
await instance.raw(`
|
|
123
|
+
CREATE TABLE header_value_refs (
|
|
124
|
+
id INTEGER PRIMARY KEY,
|
|
125
|
+
hash BLOB NOT NULL,
|
|
126
|
+
value TEXT NOT NULL,
|
|
127
|
+
UNIQUE(hash, value)
|
|
128
|
+
)
|
|
129
|
+
`);
|
|
130
|
+
// `raw_json_hash` is BLAKE3 of the raw `responseHeaders` JSON string
|
|
131
|
+
// exactly as stored in the old tables — kept only so the 0.13
|
|
132
|
+
// migration can look up an existing `header_sets.id` without calling
|
|
133
|
+
// any SQL function (SQLite has no built-in BLAKE3). Scheduled for drop
|
|
134
|
+
// in a follow-up cleanup migration.
|
|
135
|
+
// `raw_hash` is BLAKE3 of the sorted `name=value` pairs of every
|
|
136
|
+
// header (stable + volatile); `stable_hash` is BLAKE3 of the sorted
|
|
137
|
+
// `name=value` pairs of stable headers only.
|
|
138
|
+
// Both `raw_json_hash` and `raw_hash` are UNIQUE so a JS-side upsert
|
|
139
|
+
// can guarantee dedup — duplicate raw JSON strings map to the same
|
|
140
|
+
// row and same PK.
|
|
141
|
+
// `idx_header_sets_stable` accelerates the "how many pages share this
|
|
142
|
+
// stable header profile" lookup that 0.13 readers use.
|
|
143
|
+
await instance.raw(`
|
|
144
|
+
CREATE TABLE header_sets (
|
|
145
|
+
id INTEGER PRIMARY KEY,
|
|
146
|
+
raw_json_hash BLOB NOT NULL UNIQUE,
|
|
147
|
+
raw_hash BLOB NOT NULL UNIQUE,
|
|
148
|
+
stable_hash BLOB NOT NULL,
|
|
149
|
+
volatile_hash BLOB,
|
|
150
|
+
entry_count INTEGER NOT NULL,
|
|
151
|
+
stable_entry_count INTEGER NOT NULL
|
|
152
|
+
)
|
|
153
|
+
`);
|
|
154
|
+
await instance.raw('CREATE INDEX idx_header_sets_stable ON header_sets(stable_hash)');
|
|
155
|
+
// `occurrence` is the 1-based index among entries sharing the same
|
|
156
|
+
// `(header_set_id, name_id)` pair. HTTP allows a header name to appear
|
|
157
|
+
// multiple times in one response (e.g. multiple `Set-Cookie` lines);
|
|
158
|
+
// the composite PK preserves all values without truncation.
|
|
159
|
+
await instance.raw(`
|
|
160
|
+
CREATE TABLE header_set_entries (
|
|
161
|
+
header_set_id INTEGER NOT NULL REFERENCES header_sets(id),
|
|
162
|
+
name_id INTEGER NOT NULL REFERENCES header_name_refs(id),
|
|
163
|
+
occurrence INTEGER NOT NULL,
|
|
164
|
+
value_id INTEGER NOT NULL REFERENCES header_value_refs(id),
|
|
165
|
+
is_volatile INTEGER NOT NULL,
|
|
166
|
+
PRIMARY KEY(header_set_id, name_id, occurrence)
|
|
167
|
+
) WITHOUT ROWID
|
|
168
|
+
`);
|
|
169
|
+
// Pre-computed booleans for the security / caching header checks that
|
|
170
|
+
// `checkHeaders` currently expresses as per-row LIKE predicates over
|
|
171
|
+
// `responseHeaders`. Populated in 0.13 by reusing
|
|
172
|
+
// `headerPresenceExpression`'s logic so the flag rules stay in one
|
|
173
|
+
// place. `cache_policy` is a short summary string captured for display;
|
|
174
|
+
// nullable when the header is absent.
|
|
175
|
+
await instance.raw(`
|
|
176
|
+
CREATE TABLE header_flags (
|
|
177
|
+
header_set_id INTEGER PRIMARY KEY REFERENCES header_sets(id),
|
|
178
|
+
has_csp INTEGER NOT NULL,
|
|
179
|
+
has_x_frame_options INTEGER NOT NULL,
|
|
180
|
+
has_x_content_type_options INTEGER NOT NULL,
|
|
181
|
+
has_hsts INTEGER NOT NULL,
|
|
182
|
+
has_referrer_policy INTEGER NOT NULL,
|
|
183
|
+
has_permissions_policy INTEGER NOT NULL,
|
|
184
|
+
has_set_cookie INTEGER NOT NULL,
|
|
185
|
+
cache_policy TEXT
|
|
186
|
+
)
|
|
187
|
+
`);
|
|
188
|
+
}
|