@nitpicker/archive 0.0.0 → 0.25.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/LICENSE +191 -0
- package/README.md +106 -0
- package/lib/apply-connection-pragmas.d.ts +18 -0
- package/lib/apply-connection-pragmas.js +40 -0
- package/lib/archive-accessor.d.ts +265 -0
- package/lib/archive-accessor.js +477 -0
- package/lib/archive-lock.d.ts +45 -0
- package/lib/archive-lock.js +154 -0
- package/lib/archive.d.ts +736 -0
- package/lib/archive.js +1056 -0
- package/lib/body-hash/compute-body-hash.d.ts +32 -0
- package/lib/body-hash/compute-body-hash.js +35 -0
- package/lib/cache/clear-archive-cache-entry.d.ts +18 -0
- package/lib/cache/clear-archive-cache-entry.js +24 -0
- package/lib/cache/clear-archive-cache-root.d.ts +26 -0
- package/lib/cache/clear-archive-cache-root.js +32 -0
- package/lib/cache/compute-archive-cache-key.d.ts +39 -0
- package/lib/cache/compute-archive-cache-key.js +95 -0
- package/lib/cache/extract-archive-to-cache.d.ts +57 -0
- package/lib/cache/extract-archive-to-cache.js +326 -0
- package/lib/cache/get-archive-cache-root.d.ts +20 -0
- package/lib/cache/get-archive-cache-root.js +53 -0
- package/lib/cache/is-archive-cache-disabled.d.ts +24 -0
- package/lib/cache/is-archive-cache-disabled.js +34 -0
- package/lib/cache/list-archive-cache-entries.d.ts +23 -0
- package/lib/cache/list-archive-cache-entries.js +130 -0
- package/lib/cache/path-exists.d.ts +9 -0
- package/lib/cache/path-exists.js +18 -0
- package/lib/cache/resolve-archive-cache-dir.d.ts +26 -0
- package/lib/cache/resolve-archive-cache-dir.js +32 -0
- package/lib/cache/types.d.ts +33 -0
- package/lib/cache/types.js +1 -0
- package/lib/content-type/is-html-content-type.d.ts +17 -0
- package/lib/content-type/is-html-content-type.js +19 -0
- package/lib/content-type/normalize-content-type.d.ts +14 -0
- package/lib/content-type/normalize-content-type.js +20 -0
- package/lib/create-adjunct-tables.d.ts +66 -0
- package/lib/create-adjunct-tables.js +510 -0
- package/lib/create-entity-tables.d.ts +191 -0
- package/lib/create-entity-tables.js +387 -0
- package/lib/create-progress-reporter.d.ts +30 -0
- package/lib/create-progress-reporter.js +38 -0
- package/lib/create-ref-tables.d.ts +35 -0
- package/lib/create-ref-tables.js +185 -0
- package/lib/create-template-tables.d.ts +28 -0
- package/lib/create-template-tables.js +92 -0
- package/lib/database.d.ts +549 -0
- package/lib/database.js +804 -0
- package/lib/db-ops/_shared/clear-write-ref-caches.d.ts +27 -0
- package/lib/db-ops/_shared/clear-write-ref-caches.js +35 -0
- package/lib/db-ops/_shared/compress-payload.d.ts +26 -0
- package/lib/db-ops/_shared/compress-payload.js +30 -0
- package/lib/db-ops/_shared/create-write-ref-caches.d.ts +17 -0
- package/lib/db-ops/_shared/create-write-ref-caches.js +27 -0
- package/lib/db-ops/_shared/decode-json-ref.d.ts +17 -0
- package/lib/db-ops/_shared/decode-json-ref.js +31 -0
- package/lib/db-ops/_shared/keyset-paginate-by-id.d.ts +49 -0
- package/lib/db-ops/_shared/keyset-paginate-by-id.js +69 -0
- package/lib/db-ops/_shared/load-response-headers-by-set-ids.d.ts +20 -0
- package/lib/db-ops/_shared/load-response-headers-by-set-ids.js +53 -0
- package/lib/db-ops/_shared/resolve-content-item-id.d.ts +62 -0
- package/lib/db-ops/_shared/resolve-content-item-id.js +143 -0
- package/lib/db-ops/_shared/resolve-url-or-blob.d.ts +23 -0
- package/lib/db-ops/_shared/resolve-url-or-blob.js +29 -0
- package/lib/db-ops/_shared/retry-setting.d.ts +16 -0
- package/lib/db-ops/_shared/retry-setting.js +18 -0
- package/lib/db-ops/_shared/safe-parse-json.d.ts +11 -0
- package/lib/db-ops/_shared/safe-parse-json.js +18 -0
- package/lib/db-ops/_shared/types.d.ts +94 -0
- package/lib/db-ops/_shared/types.js +1 -0
- package/lib/db-ops/_shared/upsert-blob-ref.d.ts +25 -0
- package/lib/db-ops/_shared/upsert-blob-ref.js +48 -0
- package/lib/db-ops/_shared/upsert-content-type-ref.d.ts +30 -0
- package/lib/db-ops/_shared/upsert-content-type-ref.js +45 -0
- package/lib/db-ops/_shared/upsert-json-ref.d.ts +22 -0
- package/lib/db-ops/_shared/upsert-json-ref.js +41 -0
- package/lib/db-ops/_shared/upsert-response-headers.d.ts +35 -0
- package/lib/db-ops/_shared/upsert-response-headers.js +49 -0
- package/lib/db-ops/_shared/upsert-url-ref.d.ts +39 -0
- package/lib/db-ops/_shared/upsert-url-ref.js +62 -0
- package/lib/db-ops/anchors/get-anchors-on-page.d.ts +10 -0
- package/lib/db-ops/anchors/get-anchors-on-page.js +21 -0
- package/lib/db-ops/config/get-base-url.d.ts +8 -0
- package/lib/db-ops/config/get-base-url.js +14 -0
- package/lib/db-ops/config/get-config.d.ts +10 -0
- package/lib/db-ops/config/get-config.js +29 -0
- package/lib/db-ops/config/get-created-cwd.d.ts +11 -0
- package/lib/db-ops/config/get-created-cwd.js +13 -0
- package/lib/db-ops/config/get-name.d.ts +8 -0
- package/lib/db-ops/config/get-name.js +14 -0
- package/lib/db-ops/config/info-column-allowlist.d.ts +7 -0
- package/lib/db-ops/config/info-column-allowlist.js +29 -0
- package/lib/db-ops/config/info-json-columns.d.ts +5 -0
- package/lib/db-ops/config/info-json-columns.js +11 -0
- package/lib/db-ops/config/set-config.d.ts +12 -0
- package/lib/db-ops/config/set-config.js +21 -0
- package/lib/db-ops/config/update-config.d.ts +17 -0
- package/lib/db-ops/config/update-config.js +36 -0
- package/lib/db-ops/console-logs/compute-console-log-hash.d.ts +19 -0
- package/lib/db-ops/console-logs/compute-console-log-hash.js +30 -0
- package/lib/db-ops/console-logs/replace-console-logs.d.ts +34 -0
- package/lib/db-ops/console-logs/replace-console-logs.js +123 -0
- package/lib/db-ops/console-logs/stringify-console-log-args.d.ts +16 -0
- package/lib/db-ops/console-logs/stringify-console-log-args.js +26 -0
- package/lib/db-ops/console-logs/types.d.ts +38 -0
- package/lib/db-ops/console-logs/types.js +1 -0
- package/lib/db-ops/console-logs/upsert-console-log-item.d.ts +29 -0
- package/lib/db-ops/console-logs/upsert-console-log-item.js +52 -0
- package/lib/db-ops/dedupe-cap/accumulate-dedupe-cap-rejected-count.d.ts +18 -0
- package/lib/db-ops/dedupe-cap/accumulate-dedupe-cap-rejected-count.js +23 -0
- package/lib/db-ops/dedupe-cap/finalize-dedupe-cap-event.d.ts +12 -0
- package/lib/db-ops/dedupe-cap/finalize-dedupe-cap-event.js +15 -0
- package/lib/db-ops/dedupe-cap/insert-dedupe-cap-event.d.ts +14 -0
- package/lib/db-ops/dedupe-cap/insert-dedupe-cap-event.js +30 -0
- package/lib/db-ops/dedupe-cap/list-dedupe-cap-observations.d.ts +57 -0
- package/lib/db-ops/dedupe-cap/list-dedupe-cap-observations.js +87 -0
- package/lib/db-ops/dedupe-cap/list-dedupe-cap-shape-keys.d.ts +21 -0
- package/lib/db-ops/dedupe-cap/list-dedupe-cap-shape-keys.js +27 -0
- package/lib/db-ops/errors/insert-crawl-error.d.ts +15 -0
- package/lib/db-ops/errors/insert-crawl-error.js +21 -0
- package/lib/db-ops/errors/insert-page-error.d.ts +21 -0
- package/lib/db-ops/errors/insert-page-error.js +30 -0
- package/lib/db-ops/errors/list-dns-burned-host-candidates.d.ts +33 -0
- package/lib/db-ops/errors/list-dns-burned-host-candidates.js +158 -0
- package/lib/db-ops/html/read-page-html-blob.d.ts +17 -0
- package/lib/db-ops/html/read-page-html-blob.js +20 -0
- package/lib/db-ops/lifecycle/checkpoint.d.ts +8 -0
- package/lib/db-ops/lifecycle/checkpoint.js +9 -0
- package/lib/db-ops/lifecycle/destroy.d.ts +6 -0
- package/lib/db-ops/lifecycle/destroy.js +7 -0
- package/lib/db-ops/lifecycle/init.d.ts +58 -0
- package/lib/db-ops/lifecycle/init.js +122 -0
- package/lib/db-ops/list-reconcile/record-list-reconcile-run.d.ts +22 -0
- package/lib/db-ops/list-reconcile/record-list-reconcile-run.js +41 -0
- package/lib/db-ops/meta/get-audios-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-audios-of-page.js +15 -0
- package/lib/db-ops/meta/get-buttons-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-buttons-of-page.js +15 -0
- package/lib/db-ops/meta/get-canvases-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-canvases-of-page.js +15 -0
- package/lib/db-ops/meta/get-custom-elements-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-custom-elements-of-page.js +15 -0
- package/lib/db-ops/meta/get-headings-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-headings-of-page.js +15 -0
- package/lib/db-ops/meta/get-iframes-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-iframes-of-page.js +15 -0
- package/lib/db-ops/meta/get-jsonld-of-page.d.ts +13 -0
- package/lib/db-ops/meta/get-jsonld-of-page.js +27 -0
- package/lib/db-ops/meta/get-main-content-images-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-main-content-images-of-page.js +15 -0
- package/lib/db-ops/meta/get-main-content-tables-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-main-content-tables-of-page.js +15 -0
- package/lib/db-ops/meta/get-page-technologies-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-page-technologies-of-page.js +15 -0
- package/lib/db-ops/meta/get-technology-signals-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-technology-signals-of-page.js +15 -0
- package/lib/db-ops/meta/get-videos-of-page.d.ts +11 -0
- package/lib/db-ops/meta/get-videos-of-page.js +15 -0
- package/lib/db-ops/outages/close-network-outage.d.ts +12 -0
- package/lib/db-ops/outages/close-network-outage.js +15 -0
- package/lib/db-ops/outages/close-stale-open-network-outages.d.ts +26 -0
- package/lib/db-ops/outages/close-stale-open-network-outages.js +42 -0
- package/lib/db-ops/outages/compute-outage-clamp-timestamp.d.ts +26 -0
- package/lib/db-ops/outages/compute-outage-clamp-timestamp.js +31 -0
- package/lib/db-ops/outages/insert-network-outage.d.ts +14 -0
- package/lib/db-ops/outages/insert-network-outage.js +29 -0
- package/lib/db-ops/outages/list-network-outages.d.ts +28 -0
- package/lib/db-ops/outages/list-network-outages.js +42 -0
- package/lib/db-ops/pages/order/set-url-order.d.ts +13 -0
- package/lib/db-ops/pages/order/set-url-order.js +38 -0
- package/lib/db-ops/pages/read/build-page-query.d.ts +18 -0
- package/lib/db-ops/pages/read/build-page-query.js +40 -0
- package/lib/db-ops/pages/read/get-crawling-state.d.ts +117 -0
- package/lib/db-ops/pages/read/get-crawling-state.js +161 -0
- package/lib/db-ops/pages/read/get-existing-page-urls.d.ts +15 -0
- package/lib/db-ops/pages/read/get-existing-page-urls.js +30 -0
- package/lib/db-ops/pages/read/get-page-count.d.ts +12 -0
- package/lib/db-ops/pages/read/get-page-count.js +21 -0
- package/lib/db-ops/pages/read/get-page-source-by-url.d.ts +24 -0
- package/lib/db-ops/pages/read/get-page-source-by-url.js +28 -0
- package/lib/db-ops/pages/read/get-pages-with-rels.d.ts +38 -0
- package/lib/db-ops/pages/read/get-pages-with-rels.js +107 -0
- package/lib/db-ops/pages/read/get-pages.d.ts +11 -0
- package/lib/db-ops/pages/read/get-pages.js +51 -0
- package/lib/db-ops/pages/read/get-scraped-html-page-count.d.ts +18 -0
- package/lib/db-ops/pages/read/get-scraped-html-page-count.js +25 -0
- package/lib/db-ops/pages/read/reconstruct-page-rows.d.ts +31 -0
- package/lib/db-ops/pages/read/reconstruct-page-rows.js +32 -0
- package/lib/db-ops/pages/reset/clear-page-derived-rows.d.ts +20 -0
- package/lib/db-ops/pages/reset/clear-page-derived-rows.js +37 -0
- package/lib/db-ops/pages/reset/repromote-external-pages.d.ts +30 -0
- package/lib/db-ops/pages/reset/repromote-external-pages.js +91 -0
- package/lib/db-ops/pages/reset/reset-failed-pages.d.ts +88 -0
- package/lib/db-ops/pages/reset/reset-failed-pages.js +216 -0
- package/lib/db-ops/pages/reset/reset-pages-by-urls.d.ts +80 -0
- package/lib/db-ops/pages/reset/reset-pages-by-urls.js +151 -0
- package/lib/db-ops/pages/reset/retryable-image-scan-codes.d.ts +24 -0
- package/lib/db-ops/pages/reset/retryable-image-scan-codes.js +24 -0
- package/lib/db-ops/pages/write/insert-audios.d.ts +14 -0
- package/lib/db-ops/pages/write/insert-audios.js +25 -0
- package/lib/db-ops/pages/write/insert-buttons.d.ts +14 -0
- package/lib/db-ops/pages/write/insert-buttons.js +29 -0
- package/lib/db-ops/pages/write/insert-canvases.d.ts +14 -0
- package/lib/db-ops/pages/write/insert-canvases.js +26 -0
- package/lib/db-ops/pages/write/insert-custom-elements.d.ts +27 -0
- package/lib/db-ops/pages/write/insert-custom-elements.js +40 -0
- package/lib/db-ops/pages/write/insert-headings.d.ts +15 -0
- package/lib/db-ops/pages/write/insert-headings.js +27 -0
- package/lib/db-ops/pages/write/insert-iframes.d.ts +14 -0
- package/lib/db-ops/pages/write/insert-iframes.js +28 -0
- package/lib/db-ops/pages/write/insert-inventory-content-items.d.ts +38 -0
- package/lib/db-ops/pages/write/insert-inventory-content-items.js +60 -0
- package/lib/db-ops/pages/write/insert-inventory-seeds.d.ts +36 -0
- package/lib/db-ops/pages/write/insert-inventory-seeds.js +48 -0
- package/lib/db-ops/pages/write/insert-inventory-skipped-pages.d.ts +42 -0
- package/lib/db-ops/pages/write/insert-inventory-skipped-pages.js +56 -0
- package/lib/db-ops/pages/write/insert-jsonld.d.ts +17 -0
- package/lib/db-ops/pages/write/insert-jsonld.js +49 -0
- package/lib/db-ops/pages/write/insert-main-content-images.d.ts +20 -0
- package/lib/db-ops/pages/write/insert-main-content-images.js +32 -0
- package/lib/db-ops/pages/write/insert-main-content-tables.d.ts +14 -0
- package/lib/db-ops/pages/write/insert-main-content-tables.js +29 -0
- package/lib/db-ops/pages/write/insert-page.d.ts +56 -0
- package/lib/db-ops/pages/write/insert-page.js +259 -0
- package/lib/db-ops/pages/write/insert-technologies.d.ts +25 -0
- package/lib/db-ops/pages/write/insert-technologies.js +45 -0
- package/lib/db-ops/pages/write/insert-videos.d.ts +14 -0
- package/lib/db-ops/pages/write/insert-videos.js +28 -0
- package/lib/db-ops/pages/write/link-redirect-sources.d.ts +42 -0
- package/lib/db-ops/pages/write/link-redirect-sources.js +101 -0
- package/lib/db-ops/pages/write/record-redirect.d.ts +35 -0
- package/lib/db-ops/pages/write/record-redirect.js +100 -0
- package/lib/db-ops/pages/write/set-skipped-page.d.ts +13 -0
- package/lib/db-ops/pages/write/set-skipped-page.js +24 -0
- package/lib/db-ops/pages/write/update-page.d.ts +40 -0
- package/lib/db-ops/pages/write/update-page.js +419 -0
- package/lib/db-ops/pages/write/write-page-html-blob.d.ts +19 -0
- package/lib/db-ops/pages/write/write-page-html-blob.js +41 -0
- package/lib/db-ops/referrers/get-redirects-for-pages.d.ts +9 -0
- package/lib/db-ops/referrers/get-redirects-for-pages.js +15 -0
- package/lib/db-ops/referrers/get-referrers-of-page.d.ts +17 -0
- package/lib/db-ops/referrers/get-referrers-of-page.js +32 -0
- package/lib/db-ops/referrers/get-referrers-of-resource.d.ts +8 -0
- package/lib/db-ops/referrers/get-referrers-of-resource.js +15 -0
- package/lib/db-ops/resources/build-resource-query.d.ts +25 -0
- package/lib/db-ops/resources/build-resource-query.js +29 -0
- package/lib/db-ops/resources/get-existing-resource-urls.d.ts +9 -0
- package/lib/db-ops/resources/get-existing-resource-urls.js +24 -0
- package/lib/db-ops/resources/get-resource-by-url.d.ts +13 -0
- package/lib/db-ops/resources/get-resource-by-url.js +22 -0
- package/lib/db-ops/resources/get-resource-url-list.d.ts +17 -0
- package/lib/db-ops/resources/get-resource-url-list.js +26 -0
- package/lib/db-ops/resources/get-resources.d.ts +8 -0
- package/lib/db-ops/resources/get-resources.js +11 -0
- package/lib/db-ops/resources/insert-inventory-resources.d.ts +24 -0
- package/lib/db-ops/resources/insert-inventory-resources.js +64 -0
- package/lib/db-ops/resources/insert-resource-referrers.d.ts +15 -0
- package/lib/db-ops/resources/insert-resource-referrers.js +54 -0
- package/lib/db-ops/resources/insert-resource.d.ts +34 -0
- package/lib/db-ops/resources/insert-resource.js +73 -0
- package/lib/db-ops/resources/reconstruct-resource-rows.d.ts +26 -0
- package/lib/db-ops/resources/reconstruct-resource-rows.js +30 -0
- package/lib/db-ops/templates/assign-template-labels.d.ts +60 -0
- package/lib/db-ops/templates/assign-template-labels.js +187 -0
- package/lib/db-ops/templates/replace-page-templates.d.ts +44 -0
- package/lib/db-ops/templates/replace-page-templates.js +174 -0
- package/lib/db-ops/templates/serialize-template-cluster-reason.d.ts +16 -0
- package/lib/db-ops/templates/serialize-template-cluster-reason.js +17 -0
- package/lib/db-ops/templates/types.d.ts +103 -0
- package/lib/db-ops/templates/types.js +1 -0
- package/lib/debug.d.ts +8 -0
- package/lib/debug.js +9 -0
- package/lib/decode-html-blob.d.ts +20 -0
- package/lib/decode-html-blob.js +23 -0
- package/lib/decode-page-html-blob-bytes.d.ts +25 -0
- package/lib/decode-page-html-blob-bytes.js +29 -0
- package/lib/decode-stored-blob-bytes.d.ts +25 -0
- package/lib/decode-stored-blob-bytes.js +47 -0
- package/lib/derive-lineage-from-parent.d.ts +37 -0
- package/lib/derive-lineage-from-parent.js +42 -0
- package/lib/drop-legacy-tables.d.ts +45 -0
- package/lib/drop-legacy-tables.js +56 -0
- package/lib/error-kind/classify-error-kind.d.ts +20 -0
- package/lib/error-kind/classify-error-kind.js +136 -0
- package/lib/error-kind/network-related-error-kinds.d.ts +23 -0
- package/lib/error-kind/network-related-error-kinds.js +28 -0
- package/lib/error-kind/permanent-error-kinds.d.ts +48 -0
- package/lib/error-kind/permanent-error-kinds.js +54 -0
- package/lib/error-kind/types.d.ts +54 -0
- package/lib/error-kind/types.js +1 -0
- package/lib/filesystem/append-text.d.ts +9 -0
- package/lib/filesystem/append-text.js +14 -0
- package/lib/filesystem/copy-dir-sync.d.ts +6 -0
- package/lib/filesystem/copy-dir-sync.js +9 -0
- package/lib/filesystem/copy-dir.d.ts +7 -0
- package/lib/filesystem/copy-dir.js +13 -0
- package/lib/filesystem/copy-file-with-progress.d.ts +20 -0
- package/lib/filesystem/copy-file-with-progress.js +34 -0
- package/lib/filesystem/exists.d.ts +6 -0
- package/lib/filesystem/exists.js +9 -0
- package/lib/filesystem/get-file-list.d.ts +8 -0
- package/lib/filesystem/get-file-list.js +12 -0
- package/lib/filesystem/is-dir.d.ts +6 -0
- package/lib/filesystem/is-dir.js +10 -0
- package/lib/filesystem/mkdir.d.ts +8 -0
- package/lib/filesystem/mkdir.js +15 -0
- package/lib/filesystem/output-binary.d.ts +12 -0
- package/lib/filesystem/output-binary.js +17 -0
- package/lib/filesystem/output-json.d.ts +9 -0
- package/lib/filesystem/output-json.js +14 -0
- package/lib/filesystem/output-text.d.ts +11 -0
- package/lib/filesystem/output-text.js +32 -0
- package/lib/filesystem/parse-pax-path.d.ts +18 -0
- package/lib/filesystem/parse-pax-path.js +47 -0
- package/lib/filesystem/parse-tar-size-field.d.ts +13 -0
- package/lib/filesystem/parse-tar-size-field.js +40 -0
- package/lib/filesystem/peek-tar-top-dir.d.ts +35 -0
- package/lib/filesystem/peek-tar-top-dir.js +215 -0
- package/lib/filesystem/read-json.d.ts +7 -0
- package/lib/filesystem/read-json.js +11 -0
- package/lib/filesystem/read-text.d.ts +6 -0
- package/lib/filesystem/read-text.js +10 -0
- package/lib/filesystem/readline.d.ts +11 -0
- package/lib/filesystem/readline.js +26 -0
- package/lib/filesystem/remove.d.ts +5 -0
- package/lib/filesystem/remove.js +10 -0
- package/lib/filesystem/rename.d.ts +16 -0
- package/lib/filesystem/rename.js +48 -0
- package/lib/filesystem/tar.d.ts +23 -0
- package/lib/filesystem/tar.js +78 -0
- package/lib/filesystem/untar.d.ts +33 -0
- package/lib/filesystem/untar.js +84 -0
- package/lib/get-failed-page-messages.d.ts +56 -0
- package/lib/get-failed-page-messages.js +146 -0
- package/lib/get-json.d.ts +10 -0
- package/lib/get-json.js +25 -0
- package/lib/html-snapshot/match-selector-html.d.ts +25 -0
- package/lib/html-snapshot/match-selector-html.js +28 -0
- package/lib/html-snapshot/match-selector-snapshots.d.ts +33 -0
- package/lib/html-snapshot/match-selector-snapshots.js +33 -0
- package/lib/html-snapshot/search-html-document.d.ts +29 -0
- package/lib/html-snapshot/search-html-document.js +27 -0
- package/lib/html-snapshot/search-html-snapshots.d.ts +36 -0
- package/lib/html-snapshot/search-html-snapshots.js +35 -0
- package/lib/html-snapshot/types.d.ts +111 -0
- package/lib/html-snapshot/types.js +7 -0
- package/lib/html-snapshot/validate-search-pattern.d.ts +15 -0
- package/lib/html-snapshot/validate-search-pattern.js +17 -0
- package/lib/init-schema.d.ts +48 -0
- package/lib/init-schema.js +124 -0
- package/lib/is-inventory-source.d.ts +21 -0
- package/lib/is-inventory-source.js +22 -0
- package/lib/is-within-outage-window.d.ts +49 -0
- package/lib/is-within-outage-window.js +33 -0
- package/lib/isolated-cluster/create-isolated-cluster-run.d.ts +24 -0
- package/lib/isolated-cluster/create-isolated-cluster-run.js +26 -0
- package/lib/libsql-dialect.d.ts +115 -0
- package/lib/libsql-dialect.js +116 -0
- package/lib/limited-page-ids.d.ts +9 -0
- package/lib/limited-page-ids.js +18 -0
- package/lib/meta/assert-compatible-version.d.ts +60 -0
- package/lib/meta/assert-compatible-version.js +93 -0
- package/lib/meta/classify-jsonld-type.d.ts +23 -0
- package/lib/meta/classify-jsonld-type.js +43 -0
- package/lib/meta/compare-semver.d.ts +23 -0
- package/lib/meta/compare-semver.js +51 -0
- package/lib/meta/compute-main-contents-denormalized.d.ts +41 -0
- package/lib/meta/compute-main-contents-denormalized.js +88 -0
- package/lib/meta/compute-page-denormalized.d.ts +20 -0
- package/lib/meta/compute-page-denormalized.js +35 -0
- package/lib/meta/derive-flat-from-meta.d.ts +34 -0
- package/lib/meta/derive-flat-from-meta.js +158 -0
- package/lib/meta/derive-meta-extras.d.ts +20 -0
- package/lib/meta/derive-meta-extras.js +23 -0
- package/lib/meta/extract-tags-for-archive.d.ts +17 -0
- package/lib/meta/extract-tags-for-archive.js +36 -0
- package/lib/meta/parse-main-content-class-list.d.ts +19 -0
- package/lib/meta/parse-main-content-class-list.js +34 -0
- package/lib/meta/summarize-jsonld.d.ts +17 -0
- package/lib/meta/summarize-jsonld.js +29 -0
- package/lib/meta/technologies/combine-technology-confidence.d.ts +46 -0
- package/lib/meta/technologies/combine-technology-confidence.js +93 -0
- package/lib/meta/technologies/convert-legacy-page-tags-to-inserts.d.ts +45 -0
- package/lib/meta/technologies/convert-legacy-page-tags-to-inserts.js +53 -0
- package/lib/meta/technologies/convert-tag-row-to-wappalyzer-signal.d.ts +33 -0
- package/lib/meta/technologies/convert-tag-row-to-wappalyzer-signal.js +46 -0
- package/lib/meta/technologies/extract-technologies-for-archive.d.ts +33 -0
- package/lib/meta/technologies/extract-technologies-for-archive.js +30 -0
- package/lib/meta/technologies/match-js-license-comment-signal.d.ts +21 -0
- package/lib/meta/technologies/match-js-license-comment-signal.js +23 -0
- package/lib/meta/technologies/match-structural-technology-signals.d.ts +26 -0
- package/lib/meta/technologies/match-structural-technology-signals.js +48 -0
- package/lib/meta/technologies/normalize-wappalyzer-entries.d.ts +25 -0
- package/lib/meta/technologies/normalize-wappalyzer-entries.js +35 -0
- package/lib/meta/technologies/technology-signal-definitions.d.ts +44 -0
- package/lib/meta/technologies/technology-signal-definitions.js +60 -0
- package/lib/meta/technologies/types.d.ts +70 -0
- package/lib/meta/technologies/types.js +13 -0
- package/lib/meta/types.d.ts +1490 -0
- package/lib/meta/types.js +65 -0
- package/lib/migrate-content-items-alias-of-id.d.ts +52 -0
- package/lib/migrate-content-items-alias-of-id.js +69 -0
- package/lib/migrate-content-items-dedupe-cap-event-id.d.ts +46 -0
- package/lib/migrate-content-items-dedupe-cap-event-id.js +62 -0
- package/lib/migrate-content-items-is-metadata-only.d.ts +44 -0
- package/lib/migrate-content-items-is-metadata-only.js +60 -0
- package/lib/migrate-entity-tables.d.ts +55 -0
- package/lib/migrate-entity-tables.js +66 -0
- package/lib/migrate-info-created-cwd.d.ts +17 -0
- package/lib/migrate-info-created-cwd.js +36 -0
- package/lib/migrate-info-main-content-selector.d.ts +16 -0
- package/lib/migrate-info-main-content-selector.js +35 -0
- package/lib/migrate-info-request-header-names.d.ts +16 -0
- package/lib/migrate-info-request-header-names.js +35 -0
- package/lib/migrate-info-roots.d.ts +20 -0
- package/lib/migrate-info-roots.js +52 -0
- package/lib/migrate-inventory-runs-to-list-reconcile-runs.d.ts +34 -0
- package/lib/migrate-inventory-runs-to-list-reconcile-runs.js +51 -0
- package/lib/migrate-list-reconcile-runs-exclude-skipped.d.ts +25 -0
- package/lib/migrate-list-reconcile-runs-exclude-skipped.js +44 -0
- package/lib/migrate-list-reconcile-runs-invalid-skipped.d.ts +16 -0
- package/lib/migrate-list-reconcile-runs-invalid-skipped.js +35 -0
- package/lib/migrate-main-contents-columns.d.ts +26 -0
- package/lib/migrate-main-contents-columns.js +61 -0
- package/lib/migrate-page-meta-body-hash.d.ts +44 -0
- package/lib/migrate-page-meta-body-hash.js +63 -0
- package/lib/migrate-page-meta-console-error-count.d.ts +27 -0
- package/lib/migrate-page-meta-console-error-count.js +45 -0
- package/lib/migrate-page-meta-custom-element-count.d.ts +33 -0
- package/lib/migrate-page-meta-custom-element-count.js +51 -0
- package/lib/migrate-page-meta-image-scan.d.ts +27 -0
- package/lib/migrate-page-meta-image-scan.js +52 -0
- package/lib/migrate-page-tags-to-page-technologies.d.ts +39 -0
- package/lib/migrate-page-tags-to-page-technologies.js +79 -0
- package/lib/migrate-ref-tables.d.ts +25 -0
- package/lib/migrate-ref-tables.js +38 -0
- package/lib/native-executor/check-native-executor-config.d.ts +17 -0
- package/lib/native-executor/check-native-executor-config.js +20 -0
- package/lib/page-meta-column-maps.d.ts +32 -0
- package/lib/page-meta-column-maps.js +43 -0
- package/lib/page.d.ts +546 -0
- package/lib/page.js +764 -0
- package/lib/peek-archive-lock.d.ts +40 -0
- package/lib/peek-archive-lock.js +62 -0
- package/lib/populate-entity-tables/collapse-anchor-rows.d.ts +41 -0
- package/lib/populate-entity-tables/collapse-anchor-rows.js +87 -0
- package/lib/populate-entity-tables/derive-dom-path.d.ts +35 -0
- package/lib/populate-entity-tables/derive-dom-path.js +72 -0
- package/lib/populate-entity-tables/is-blob-ref-value.d.ts +16 -0
- package/lib/populate-entity-tables/is-blob-ref-value.js +19 -0
- package/lib/populate-entity-tables/match-images-to-dom-paths.d.ts +66 -0
- package/lib/populate-entity-tables/match-images-to-dom-paths.js +96 -0
- package/lib/populate-entity-tables/populate-anchor-edges.d.ts +33 -0
- package/lib/populate-entity-tables/populate-anchor-edges.js +153 -0
- package/lib/populate-entity-tables/populate-content-items.d.ts +40 -0
- package/lib/populate-entity-tables/populate-content-items.js +141 -0
- package/lib/populate-entity-tables/populate-entities.d.ts +81 -0
- package/lib/populate-entity-tables/populate-entities.js +110 -0
- package/lib/populate-entity-tables/populate-image-items.d.ts +91 -0
- package/lib/populate-entity-tables/populate-image-items.js +226 -0
- package/lib/populate-entity-tables/populate-page-meta.d.ts +33 -0
- package/lib/populate-entity-tables/populate-page-meta.js +267 -0
- package/lib/populate-entity-tables/populate-resource-items.d.ts +22 -0
- package/lib/populate-entity-tables/populate-resource-items.js +114 -0
- package/lib/populate-entity-tables/populate-resource-ref-edges.d.ts +31 -0
- package/lib/populate-entity-tables/populate-resource-ref-edges.js +33 -0
- package/lib/populate-entity-tables/resolve-blob-refs.d.ts +31 -0
- package/lib/populate-entity-tables/resolve-blob-refs.js +100 -0
- package/lib/populate-entity-tables/resolve-content-type-refs.d.ts +22 -0
- package/lib/populate-entity-tables/resolve-content-type-refs.js +27 -0
- package/lib/populate-entity-tables/resolve-header-sets.d.ts +49 -0
- package/lib/populate-entity-tables/resolve-header-sets.js +122 -0
- package/lib/populate-entity-tables/resolve-json-refs.d.ts +25 -0
- package/lib/populate-entity-tables/resolve-json-refs.js +67 -0
- package/lib/populate-entity-tables/resolve-text-refs.d.ts +30 -0
- package/lib/populate-entity-tables/resolve-text-refs.js +61 -0
- package/lib/populate-entity-tables/resolve-url-or-blob-from-maps.d.ts +21 -0
- package/lib/populate-entity-tables/resolve-url-or-blob-from-maps.js +27 -0
- package/lib/populate-entity-tables/resolve-url-refs.d.ts +33 -0
- package/lib/populate-entity-tables/resolve-url-refs.js +60 -0
- package/lib/populate-entity-tables/test-utils/count-rows.d.ts +17 -0
- package/lib/populate-entity-tables/test-utils/count-rows.js +20 -0
- package/lib/populate-entity-tables/test-utils/seed-content-items.d.ts +25 -0
- package/lib/populate-entity-tables/test-utils/seed-content-items.js +42 -0
- package/lib/populate-entity-tables/test-utils/setup-entities-db.d.ts +30 -0
- package/lib/populate-entity-tables/test-utils/setup-entities-db.js +175 -0
- package/lib/populate-entity-tables/types.d.ts +157 -0
- package/lib/populate-entity-tables/types.js +12 -0
- package/lib/populate-entity-tables/upsert-text-refs.d.ts +38 -0
- package/lib/populate-entity-tables/upsert-text-refs.js +78 -0
- package/lib/populate-ref-tables/classify-content-type.d.ts +16 -0
- package/lib/populate-ref-tables/classify-content-type.js +52 -0
- package/lib/populate-ref-tables/compute-content-hash.d.ts +22 -0
- package/lib/populate-ref-tables/compute-content-hash.js +26 -0
- package/lib/populate-ref-tables/compute-header-flags.d.ts +16 -0
- package/lib/populate-ref-tables/compute-header-flags.js +70 -0
- package/lib/populate-ref-tables/content-type-rules.d.ts +38 -0
- package/lib/populate-ref-tables/content-type-rules.js +133 -0
- package/lib/populate-ref-tables/create-header-table-caches.d.ts +25 -0
- package/lib/populate-ref-tables/create-header-table-caches.js +49 -0
- package/lib/populate-ref-tables/data-uri-url-refs-limit.d.ts +15 -0
- package/lib/populate-ref-tables/data-uri-url-refs-limit.js +15 -0
- package/lib/populate-ref-tables/decode-data-uri.d.ts +21 -0
- package/lib/populate-ref-tables/decode-data-uri.js +126 -0
- package/lib/populate-ref-tables/decompose-header-set.d.ts +29 -0
- package/lib/populate-ref-tables/decompose-header-set.js +157 -0
- package/lib/populate-ref-tables/decompose-url.d.ts +25 -0
- package/lib/populate-ref-tables/decompose-url.js +70 -0
- package/lib/populate-ref-tables/header-stability.d.ts +19 -0
- package/lib/populate-ref-tables/header-stability.js +22 -0
- package/lib/populate-ref-tables/header-value-cache-key.d.ts +17 -0
- package/lib/populate-ref-tables/header-value-cache-key.js +19 -0
- package/lib/populate-ref-tables/normalize-mime.d.ts +24 -0
- package/lib/populate-ref-tables/normalize-mime.js +36 -0
- package/lib/populate-ref-tables/populate-blob-refs.d.ts +38 -0
- package/lib/populate-ref-tables/populate-blob-refs.js +134 -0
- package/lib/populate-ref-tables/populate-content-type-refs.d.ts +27 -0
- package/lib/populate-ref-tables/populate-content-type-refs.js +70 -0
- package/lib/populate-ref-tables/populate-header-tables.d.ts +35 -0
- package/lib/populate-ref-tables/populate-header-tables.js +80 -0
- package/lib/populate-ref-tables/populate-json-refs.d.ts +29 -0
- package/lib/populate-ref-tables/populate-json-refs.js +101 -0
- package/lib/populate-ref-tables/populate-refs.d.ts +51 -0
- package/lib/populate-ref-tables/populate-refs.js +62 -0
- package/lib/populate-ref-tables/populate-text-refs.d.ts +32 -0
- package/lib/populate-ref-tables/populate-text-refs.js +133 -0
- package/lib/populate-ref-tables/populate-url-refs.d.ts +28 -0
- package/lib/populate-ref-tables/populate-url-refs.js +148 -0
- package/lib/populate-ref-tables/test-utils/count-rows.d.ts +15 -0
- package/lib/populate-ref-tables/test-utils/count-rows.js +17 -0
- package/lib/populate-ref-tables/types.d.ts +197 -0
- package/lib/populate-ref-tables/types.js +7 -0
- package/lib/populate-ref-tables/upsert-one-header-set.d.ts +34 -0
- package/lib/populate-ref-tables/upsert-one-header-set.js +208 -0
- package/lib/populate-ref-tables/volatile-header-names.d.ts +20 -0
- package/lib/populate-ref-tables/volatile-header-names.js +33 -0
- package/lib/redirect-table.d.ts +9 -0
- package/lib/redirect-table.js +28 -0
- package/lib/release-finished-statements.d.ts +42 -0
- package/lib/release-finished-statements.js +45 -0
- package/lib/resolve-redirect-chain.d.ts +33 -0
- package/lib/resolve-redirect-chain.js +27 -0
- package/lib/resource.d.ts +46 -0
- package/lib/resource.js +62 -0
- package/lib/retarget-legacy-fk-tables.d.ts +61 -0
- package/lib/retarget-legacy-fk-tables.js +137 -0
- package/lib/safe-path.d.ts +9 -0
- package/lib/safe-path.js +17 -0
- package/lib/scope/build-scope-map.d.ts +21 -0
- package/lib/scope/build-scope-map.js +32 -0
- package/lib/scope/find-scope-entry.d.ts +25 -0
- package/lib/scope/find-scope-entry.js +45 -0
- package/lib/template-classification/classify-archive-page-templates.d.ts +42 -0
- package/lib/template-classification/classify-archive-page-templates.js +70 -0
- package/lib/template-classification/classify-page-templates.d.ts +33 -0
- package/lib/template-classification/classify-page-templates.js +60 -0
- package/lib/template-classification/collect-page-ids-with-html.d.ts +24 -0
- package/lib/template-classification/collect-page-ids-with-html.js +30 -0
- package/lib/template-classification/collect-page-stylesheet-urls.d.ts +32 -0
- package/lib/template-classification/collect-page-stylesheet-urls.js +130 -0
- package/lib/template-classification/create-content-root-hint.d.ts +41 -0
- package/lib/template-classification/create-content-root-hint.js +51 -0
- package/lib/template-classification/create-page-cluster-factory.d.ts +36 -0
- package/lib/template-classification/create-page-cluster-factory.js +52 -0
- package/lib/template-classification/load-page-cluster-candidates.d.ts +32 -0
- package/lib/template-classification/load-page-cluster-candidates.js +93 -0
- package/lib/template-classification/page-cluster/resolve-page-cluster-keys.d.ts +34 -0
- package/lib/template-classification/page-cluster/resolve-page-cluster-keys.js +236 -0
- package/lib/template-classification/page-cluster/types.d.ts +123 -0
- package/lib/template-classification/page-cluster/types.js +1 -0
- package/lib/template-classification/types.d.ts +234 -0
- package/lib/template-classification/types.js +1 -0
- package/lib/test-utils/build-full-schema-test-db.d.ts +34 -0
- package/lib/test-utils/build-full-schema-test-db.js +74 -0
- package/lib/test-utils/create-legacy-analysis-tables.d.ts +13 -0
- package/lib/test-utils/create-legacy-analysis-tables.js +37 -0
- package/lib/test-utils/fk-parent-tables.d.ts +15 -0
- package/lib/test-utils/fk-parent-tables.js +19 -0
- package/lib/test-utils/seed-content-item.d.ts +35 -0
- package/lib/test-utils/seed-content-item.js +42 -0
- package/lib/test-utils/setup-legacy-fk-db.d.ts +34 -0
- package/lib/test-utils/setup-legacy-fk-db.js +271 -0
- package/lib/transfer/attach-source-database.d.ts +31 -0
- package/lib/transfer/attach-source-database.js +40 -0
- package/lib/transfer/build-split-config.d.ts +30 -0
- package/lib/transfer/build-split-config.js +42 -0
- package/lib/transfer/clear-replaced-page-rows.d.ts +23 -0
- package/lib/transfer/clear-replaced-page-rows.js +61 -0
- package/lib/transfer/concat-archives.d.ts +55 -0
- package/lib/transfer/concat-archives.js +95 -0
- package/lib/transfer/concat-source-transfer-phases.d.ts +10 -0
- package/lib/transfer/concat-source-transfer-phases.js +17 -0
- package/lib/transfer/content-item-rank-sql.d.ts +21 -0
- package/lib/transfer/content-item-rank-sql.js +23 -0
- package/lib/transfer/copy-anchor-edges.d.ts +28 -0
- package/lib/transfer/copy-anchor-edges.js +42 -0
- package/lib/transfer/copy-dictionaries-for-concat.d.ts +39 -0
- package/lib/transfer/copy-dictionaries-for-concat.js +81 -0
- package/lib/transfer/copy-dictionaries-for-split.d.ts +29 -0
- package/lib/transfer/copy-dictionaries-for-split.js +224 -0
- package/lib/transfer/copy-header-set-children.d.ts +27 -0
- package/lib/transfer/copy-header-set-children.js +51 -0
- package/lib/transfer/copy-image-items.d.ts +21 -0
- package/lib/transfer/copy-image-items.js +62 -0
- package/lib/transfer/copy-inventory-source-lists.d.ts +30 -0
- package/lib/transfer/copy-inventory-source-lists.js +61 -0
- package/lib/transfer/copy-journal-tables.d.ts +30 -0
- package/lib/transfer/copy-journal-tables.js +56 -0
- package/lib/transfer/copy-page-console-logs.d.ts +16 -0
- package/lib/transfer/copy-page-console-logs.js +27 -0
- package/lib/transfer/copy-page-html-blobs.d.ts +31 -0
- package/lib/transfer/copy-page-html-blobs.js +43 -0
- package/lib/transfer/copy-page-meta.d.ts +27 -0
- package/lib/transfer/copy-page-meta.js +68 -0
- package/lib/transfer/copy-page-template-clusters.d.ts +31 -0
- package/lib/transfer/copy-page-template-clusters.js +56 -0
- package/lib/transfer/copy-page-template-labels.d.ts +34 -0
- package/lib/transfer/copy-page-template-labels.js +88 -0
- package/lib/transfer/copy-resource-items.d.ts +29 -0
- package/lib/transfer/copy-resource-items.js +89 -0
- package/lib/transfer/copy-resource-ref-edges.d.ts +20 -0
- package/lib/transfer/copy-resource-ref-edges.js +33 -0
- package/lib/transfer/copy-simple-page-scoped-tables.d.ts +15 -0
- package/lib/transfer/copy-simple-page-scoped-tables.js +34 -0
- package/lib/transfer/count-external-pages-in-scope.d.ts +26 -0
- package/lib/transfer/count-external-pages-in-scope.js +40 -0
- package/lib/transfer/create-transfer-temp-tables.d.ts +30 -0
- package/lib/transfer/create-transfer-temp-tables.js +59 -0
- package/lib/transfer/dictionary-copy-specs.d.ts +32 -0
- package/lib/transfer/dictionary-copy-specs.js +28 -0
- package/lib/transfer/drop-transfer-temp-tables.d.ts +9 -0
- package/lib/transfer/drop-transfer-temp-tables.js +18 -0
- package/lib/transfer/flatten-redirect-chains.d.ts +44 -0
- package/lib/transfer/flatten-redirect-chains.js +74 -0
- package/lib/transfer/insert-content-items.d.ts +35 -0
- package/lib/transfer/insert-content-items.js +116 -0
- package/lib/transfer/list-transfer-columns.d.ts +35 -0
- package/lib/transfer/list-transfer-columns.js +45 -0
- package/lib/transfer/mark-in-scope-content-items.d.ts +31 -0
- package/lib/transfer/mark-in-scope-content-items.js +54 -0
- package/lib/transfer/merge-archive-configs.d.ts +51 -0
- package/lib/transfer/merge-archive-configs.js +85 -0
- package/lib/transfer/plan-content-items-for-concat.d.ts +33 -0
- package/lib/transfer/plan-content-items-for-concat.js +51 -0
- package/lib/transfer/plan-content-items-for-split.d.ts +42 -0
- package/lib/transfer/plan-content-items-for-split.js +83 -0
- package/lib/transfer/plan-resource-items.d.ts +40 -0
- package/lib/transfer/plan-resource-items.js +69 -0
- package/lib/transfer/quote-transfer-identifier.d.ts +18 -0
- package/lib/transfer/quote-transfer-identifier.js +20 -0
- package/lib/transfer/reclassify-resource-externality.d.ts +37 -0
- package/lib/transfer/reclassify-resource-externality.js +66 -0
- package/lib/transfer/remap-redirect-dest-ids.d.ts +34 -0
- package/lib/transfer/remap-redirect-dest-ids.js +51 -0
- package/lib/transfer/replace-content-items.d.ts +39 -0
- package/lib/transfer/replace-content-items.js +83 -0
- package/lib/transfer/simple-page-scoped-tables.d.ts +25 -0
- package/lib/transfer/simple-page-scoped-tables.js +38 -0
- package/lib/transfer/split-archive.d.ts +55 -0
- package/lib/transfer/split-archive.js +98 -0
- package/lib/transfer/split-source-transfer-phases.d.ts +11 -0
- package/lib/transfer/split-source-transfer-phases.js +18 -0
- package/lib/transfer/transfer-action.d.ts +34 -0
- package/lib/transfer/transfer-action.js +32 -0
- package/lib/transfer/transfer-archive-rows.d.ts +65 -0
- package/lib/transfer/transfer-archive-rows.js +156 -0
- package/lib/transfer/transfer-dictionary-tables.d.ts +12 -0
- package/lib/transfer/transfer-dictionary-tables.js +22 -0
- package/lib/transfer/transfer-post-phases.d.ts +10 -0
- package/lib/transfer/transfer-post-phases.js +13 -0
- package/lib/transfer/transfer-source-alias.d.ts +9 -0
- package/lib/transfer/transfer-source-alias.js +9 -0
- package/lib/transfer/types.d.ts +111 -0
- package/lib/transfer/types.js +35 -0
- package/lib/types.d.ts +772 -0
- package/lib/types.js +1 -0
- package/lib/url-alias/compute-tier-a-alias-key.d.ts +44 -0
- package/lib/url-alias/compute-tier-a-alias-key.js +47 -0
- package/lib/url-alias/compute-tier-b-alias-key.d.ts +23 -0
- package/lib/url-alias/compute-tier-b-alias-key.js +26 -0
- package/lib/url-alias/group-alias-candidates.d.ts +27 -0
- package/lib/url-alias/group-alias-candidates.js +29 -0
- package/lib/url-alias/types.d.ts +12 -0
- package/lib/url-alias/types.js +1 -0
- package/lib/url-pattern/compute-shape-key.d.ts +58 -0
- package/lib/url-pattern/compute-shape-key.js +129 -0
- package/lib/url-pattern/decompose-url.d.ts +33 -0
- package/lib/url-pattern/decompose-url.js +79 -0
- package/lib/url-pattern/reconstruct-url.d.ts +15 -0
- package/lib/url-pattern/reconstruct-url.js +33 -0
- package/lib/url-sort/compute-url-sort-ranks.d.ts +30 -0
- package/lib/url-sort/compute-url-sort-ranks.js +33 -0
- package/lib/utils/array/each-splitted.d.ts +10 -0
- package/lib/utils/array/each-splitted.js +14 -0
- package/lib/utils/debug.d.ts +8 -0
- package/lib/utils/debug.js +8 -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/lib/utils/object/parse-response-headers.d.ts +12 -0
- package/lib/utils/object/parse-response-headers.js +26 -0
- package/lib/utils/object/redact-request-headers.d.ts +15 -0
- package/lib/utils/object/redact-request-headers.js +27 -0
- package/lib/utils/types/types.d.ts +383 -0
- package/lib/utils/types/types.js +1 -0
- package/lib/verify-migration/capture-rejection.d.ts +24 -0
- package/lib/verify-migration/capture-rejection.js +31 -0
- package/lib/verify-migration/check-anchor-edges-count.d.ts +34 -0
- package/lib/verify-migration/check-anchor-edges-count.js +72 -0
- package/lib/verify-migration/check-anchor-edges-sum.d.ts +13 -0
- package/lib/verify-migration/check-anchor-edges-sum.js +27 -0
- package/lib/verify-migration/check-content-items-count.d.ts +16 -0
- package/lib/verify-migration/check-content-items-count.js +30 -0
- package/lib/verify-migration/check-content-type-preservation.d.ts +22 -0
- package/lib/verify-migration/check-content-type-preservation.js +40 -0
- package/lib/verify-migration/check-foreign-key-integrity.d.ts +31 -0
- package/lib/verify-migration/check-foreign-key-integrity.js +47 -0
- package/lib/verify-migration/check-image-items-count.d.ts +12 -0
- package/lib/verify-migration/check-image-items-count.js +26 -0
- package/lib/verify-migration/check-page-meta-count.d.ts +15 -0
- package/lib/verify-migration/check-page-meta-count.js +31 -0
- package/lib/verify-migration/check-reader-parity.d.ts +23 -0
- package/lib/verify-migration/check-reader-parity.js +182 -0
- package/lib/verify-migration/check-resource-items-count.d.ts +17 -0
- package/lib/verify-migration/check-resource-items-count.js +33 -0
- package/lib/verify-migration/check-url-round-trip.d.ts +43 -0
- package/lib/verify-migration/check-url-round-trip.js +112 -0
- package/lib/verify-migration/types.d.ts +70 -0
- package/lib/verify-migration/types.js +63 -0
- package/lib/verify-migration/verify-migration.d.ts +41 -0
- package/lib/verify-migration/verify-migration.js +120 -0
- package/lib/with-bulk-write-pragmas.d.ts +51 -0
- package/lib/with-bulk-write-pragmas.js +132 -0
- package/lib/write-queue.d.ts +32 -0
- package/lib/write-queue.js +55 -0
- package/package.json +350 -3
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { computeShapeKey } from '../../../url-pattern/compute-shape-key.js';
|
|
2
|
+
import { listDedupeCapShapeKeys } from '../../dedupe-cap/list-dedupe-cap-shape-keys.js';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves the current crawling state by listing scraped and pending URLs.
|
|
5
|
+
*
|
|
6
|
+
* `scraped` is straightforward: every page row whose `scraped` flag is `1`
|
|
7
|
+
* — that is, every URL the crawl reached a terminal state on, including
|
|
8
|
+
* setSkippedPage / setExternalPage / outright setPage success or failure.
|
|
9
|
+
*
|
|
10
|
+
* `pending` is intentionally STRICT — not "every `scraped = 0` row".
|
|
11
|
+
* Four filters apply:
|
|
12
|
+
*
|
|
13
|
+
* 1. `scraped = 0` — work still incomplete.
|
|
14
|
+
* 2. `is_external = 0` — only in-scope work. External URLs go through a
|
|
15
|
+
* HEAD-only path that always lands on `scraped = 1` (either setPage or
|
|
16
|
+
* setExternalPage). A row with `is_external = 1 AND scraped = 0` is
|
|
17
|
+
* therefore a data anomaly, and resume / inventory / append have no
|
|
18
|
+
* business retrying it on the next session.
|
|
19
|
+
* 3. `EXISTS (anchor_edges with href_page_id = content_items.id) OR source
|
|
20
|
+
* != 'crawled'` — the row was either discovered as an anchor destination
|
|
21
|
+
* during a previous scrape OR was explicitly tagged with a non-default
|
|
22
|
+
* source label (`'inventory-seed'`, `'inventory-discovered'`, …). Both
|
|
23
|
+
* halves of the OR represent "deliberately enqueued, expected to be
|
|
24
|
+
* processed", which is exactly what `resume` should pick up.
|
|
25
|
+
*
|
|
26
|
+
* The orphan filter targets the **predicted-discard leak** in
|
|
27
|
+
* `@nitpicker/crawler`'s `crawler/crawler.ts` where `shouldDiscardPredicted` returns true but no
|
|
28
|
+
* `emit('skip')` follows. Such placeholders are inserted with the
|
|
29
|
+
* DB DEFAULT `source = 'crawled'` (no caller explicitly labels
|
|
30
|
+
* them) AND have no anchor referrer (predicted URLs are
|
|
31
|
+
* synthesised from pagination patterns, never anchored from a
|
|
32
|
+
* rendered page) — both halves of the OR are therefore false and
|
|
33
|
+
* the leak is excluded.
|
|
34
|
+
*
|
|
35
|
+
* The `source != 'crawled'` clause specifically saves the
|
|
36
|
+
* `--inventory` × `--retry-failed` interaction: an inventory-seed
|
|
37
|
+
* URL came from the operator's URL list (no anchor referrer) and
|
|
38
|
+
* `resetFailedPages` puts it back at `scraped = 0`. Without this
|
|
39
|
+
* clause those legitimate retries would be dropped on resume.
|
|
40
|
+
* 4. **Confirmed same-cluster trap exclusion** (issue #350): a row whose
|
|
41
|
+
* URL shape (`computeShapeKey`) matches a `dedupe_cap_events.shape_key`
|
|
42
|
+
* already recorded in this archive is dropped, UNLESS its `source` is
|
|
43
|
+
* `'inventory-seed'` (an operator-listed URL, not an anchor-discovered
|
|
44
|
+
* one — the same "explicit URL survives cap" carve-out `resetPagesByUrls`
|
|
45
|
+
* gives `--recrawl`). NOT the same as `resetFailedPages`'s own
|
|
46
|
+
* same-shape exclusion, which drops a matching candidate regardless of
|
|
47
|
+
* `source` — a `scraped=1, status=-1` inventory-seed row of a
|
|
48
|
+
* confirmed-capped shape is therefore excluded there too and never
|
|
49
|
+
* resets to `scraped=0` for `--retry-failed` to pick back up. That
|
|
50
|
+
* asymmetry pre-dates this filter and is unrelated to it (out of scope
|
|
51
|
+
* here): this filter only decides what `getCrawlingState` reports as
|
|
52
|
+
* `pending`, never whether a `scraped=1` row gets reset in the first
|
|
53
|
+
* place.
|
|
54
|
+
*
|
|
55
|
+
* Why this is needed: `--dedupe-cap`'s enqueue gate (`@nitpicker/crawler`'s `crawler/crawler.ts`
|
|
56
|
+
* `addUrl` closure) only stops a capped shape's anchor from being
|
|
57
|
+
* ADDED TO THE QUEUE in memory — it does not stop `replaceAnchorEdges`
|
|
58
|
+
* (`update-page.ts`) from writing a `scraped = 0` row for that same
|
|
59
|
+
* anchor (post-hoc marking, `content_items.dedupe_cap_event_id`,
|
|
60
|
+
* deliberately needs that row to exist). Before this filter, such a
|
|
61
|
+
* row still satisfied filter 3 (it has an anchor referrer) and entered
|
|
62
|
+
* `pending`, so `CrawlerOrchestrator#crawlUntilPendingClears`'s
|
|
63
|
+
* auto-retry loop (and any `--resume`/`--retry-failed`/`--append`) would
|
|
64
|
+
* requeue it — `Crawler#resume`'s `LinkList#resume` has no cap gate of
|
|
65
|
+
* its own — actually fetch the trap page, and its anchors would create
|
|
66
|
+
* a fresh batch of same-shape `scraped = 0` rows. Pending never shrank,
|
|
67
|
+
* so the loop ended in `PendingUrlsRemainError('no-progress')` even
|
|
68
|
+
* though nothing was actually wrong with the target site.
|
|
69
|
+
*
|
|
70
|
+
* Why not skip the row instead of merely omitting it from `pending`:
|
|
71
|
+
* this function is read-only — leaving `is_skipped`/`skip_reason`
|
|
72
|
+
* unset keeps `dedupe_cap_event_id` backfill (`viewer-build`) as the
|
|
73
|
+
* single place that judges a row "capped", matching the archive's
|
|
74
|
+
* existing dedupe-cap post-hoc-marking pattern rather than adding a
|
|
75
|
+
* second one here.
|
|
76
|
+
*
|
|
77
|
+
* A row whose shape cannot be computed (`computeShapeKey` returns
|
|
78
|
+
* `null`) stays in `pending` — no signal either way, same
|
|
79
|
+
* err-on-the-side-of-retrying choice `resetFailedPages` makes.
|
|
80
|
+
*
|
|
81
|
+
* The defensive shape is on purpose: the data source can drift into
|
|
82
|
+
* anomalous states under interruption, but the reader must never throw
|
|
83
|
+
* or feed garbage back into the dealer. A real in-scope URL that was
|
|
84
|
+
* truly interrupted mid-crawl will always have at least one anchor
|
|
85
|
+
* referrer (otherwise the dealer would not have queued it), so the
|
|
86
|
+
* strict filter loses no legitimate pending work.
|
|
87
|
+
*
|
|
88
|
+
* Seeds passed directly to `Crawler.start()` are NOT in the strict
|
|
89
|
+
* pending set when they were never picked by the dealer — they have no
|
|
90
|
+
* DB row at all in that case (`linkList.add` is purely in-memory until
|
|
91
|
+
* `setPage` runs). A Ctrl-C between dealer pick and `setPage` likewise
|
|
92
|
+
* leaves no row to recover. Recovery of un-picked seeds is the
|
|
93
|
+
* responsibility of the caller (e.g. re-running `--inventory ./list.txt`
|
|
94
|
+
* with the same URL list).
|
|
95
|
+
*
|
|
96
|
+
* The query uses an explicit `ci` alias on the `content_items` table so the
|
|
97
|
+
* correlated `EXISTS` subquery can join via `whereRaw('anchor_edges.href_page_id
|
|
98
|
+
* = ci.id')`. A future refactor that renames the alias must update both
|
|
99
|
+
* sites — the raw string in the subquery cannot be grep-resolved
|
|
100
|
+
* automatically. Read-only / stub viewer connections never call this
|
|
101
|
+
* method (they do not need to know about pending state), so the EXISTS
|
|
102
|
+
* shape is safe to use without the `migrate*` guards that other writer
|
|
103
|
+
* methods carry.
|
|
104
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
105
|
+
* @returns An object with `scraped` (completed URLs), `pending` (the
|
|
106
|
+
* strict set of in-scope, anchor-referenced, unfinished, non-capped
|
|
107
|
+
* URLs), and `pendingMetadataOnly` (the subset of `pending` whose
|
|
108
|
+
* `content_items.is_metadata_only` was persisted as `1` — see
|
|
109
|
+
* `replaceAnchorEdges`/`resolveContentItemId`). Callers that resume a
|
|
110
|
+
* crawl (`Crawler#resume` → `LinkList#resume`) pass this subset through
|
|
111
|
+
* so a metadata-only anchor discovered before an interruption is not
|
|
112
|
+
* silently promoted to a full-scrape target on resume (#369).
|
|
113
|
+
*/
|
|
114
|
+
export async function getCrawlingState(knex) {
|
|
115
|
+
const ex = (r) => r.url;
|
|
116
|
+
const $scraped = await knex('content_items')
|
|
117
|
+
.join('url_refs', 'url_refs.id', 'content_items.url_id')
|
|
118
|
+
.select('url_refs.url as url')
|
|
119
|
+
.where('content_items.scraped', 1);
|
|
120
|
+
const scraped = $scraped.map(ex);
|
|
121
|
+
const $pending = await knex
|
|
122
|
+
.select('ur.url as url', 'ci.is_metadata_only as isMetadataOnly', 'ci.source as source')
|
|
123
|
+
.from({ ci: 'content_items' })
|
|
124
|
+
.join({ ur: 'url_refs' }, 'ur.id', 'ci.url_id')
|
|
125
|
+
.where('ci.scraped', 0)
|
|
126
|
+
.where('ci.is_external', 0)
|
|
127
|
+
.where((qb) => {
|
|
128
|
+
// "Anchored OR explicitly labelled". Either side is evidence
|
|
129
|
+
// that the row was deliberately enqueued for processing —
|
|
130
|
+
// only the predicted-discard leak (DEFAULT 'crawled' + no
|
|
131
|
+
// anchor) fails both halves. The `whereExists` callback
|
|
132
|
+
// uses `select('*')` since the column list is irrelevant
|
|
133
|
+
// inside an EXISTS check; calling through `client.raw(...)`
|
|
134
|
+
// would reach a private builder field.
|
|
135
|
+
qb.whereExists(function () {
|
|
136
|
+
this.select('*')
|
|
137
|
+
.from('anchor_edges')
|
|
138
|
+
.whereRaw('anchor_edges.href_page_id = ci.id');
|
|
139
|
+
}).orWhereNot('ci.source', 'crawled');
|
|
140
|
+
});
|
|
141
|
+
// Confirmed same-cluster trap exclusion (filter 4, see this function's
|
|
142
|
+
// JSDoc) — an archive with no recorded cap events behaves exactly as
|
|
143
|
+
// before this filter existed (`cappedShapeKeys.size === 0` short-circuits
|
|
144
|
+
// to a no-op, same guard `resetFailedPages` uses).
|
|
145
|
+
const cappedShapeKeys = new Set(await listDedupeCapShapeKeys(knex));
|
|
146
|
+
const $notCapped = cappedShapeKeys.size === 0
|
|
147
|
+
? $pending
|
|
148
|
+
: $pending.filter((row) => {
|
|
149
|
+
if (row.source === 'inventory-seed')
|
|
150
|
+
return true;
|
|
151
|
+
const shapeKey = computeShapeKey(row.url);
|
|
152
|
+
return shapeKey === null || !cappedShapeKeys.has(shapeKey);
|
|
153
|
+
});
|
|
154
|
+
const pending = $notCapped.map(ex);
|
|
155
|
+
const pendingMetadataOnly = $notCapped.filter((r) => r.isMetadataOnly === 1).map(ex);
|
|
156
|
+
return {
|
|
157
|
+
scraped,
|
|
158
|
+
pending,
|
|
159
|
+
pendingMetadataOnly,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Knex } from 'knex';
|
|
2
|
+
/**
|
|
3
|
+
* Return the subset of `urls` that already exist as `content_items` rows.
|
|
4
|
+
* Chunked into batches so SQLite's `IN (?, ?, …)` parameter limit
|
|
5
|
+
* (`SQLITE_MAX_VARIABLE_NUMBER`, default 999) cannot be hit even when the
|
|
6
|
+
* inventory list contains tens of thousands of URLs.
|
|
7
|
+
*
|
|
8
|
+
* Read-only — no transaction, no lock contention with the crawler write
|
|
9
|
+
* pipeline (callers run this BEFORE the `<archive>.bak` is taken and the
|
|
10
|
+
* crawl is started).
|
|
11
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
12
|
+
* @param urls - URL strings to probe (already in `withoutHashAndAuth` form).
|
|
13
|
+
* @returns URLs found among `content_items`. Order is not preserved.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getExistingPageUrls(knex: Knex, urls: readonly string[]): Promise<string[]>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { eachSplitted } from '../../../utils/array/each-splitted.js';
|
|
2
|
+
/**
|
|
3
|
+
* Return the subset of `urls` that already exist as `content_items` rows.
|
|
4
|
+
* Chunked into batches so SQLite's `IN (?, ?, …)` parameter limit
|
|
5
|
+
* (`SQLITE_MAX_VARIABLE_NUMBER`, default 999) cannot be hit even when the
|
|
6
|
+
* inventory list contains tens of thousands of URLs.
|
|
7
|
+
*
|
|
8
|
+
* Read-only — no transaction, no lock contention with the crawler write
|
|
9
|
+
* pipeline (callers run this BEFORE the `<archive>.bak` is taken and the
|
|
10
|
+
* crawl is started).
|
|
11
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
12
|
+
* @param urls - URL strings to probe (already in `withoutHashAndAuth` form).
|
|
13
|
+
* @returns URLs found among `content_items`. Order is not preserved.
|
|
14
|
+
*/
|
|
15
|
+
export async function getExistingPageUrls(knex, urls) {
|
|
16
|
+
if (urls.length === 0) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const found = [];
|
|
20
|
+
await eachSplitted([...urls], 500, async (chunk) => {
|
|
21
|
+
const rows = await knex('content_items')
|
|
22
|
+
.join('url_refs', 'url_refs.id', 'content_items.url_id')
|
|
23
|
+
.select('url_refs.url as url')
|
|
24
|
+
.whereIn('url_refs.url', chunk);
|
|
25
|
+
for (const row of rows) {
|
|
26
|
+
found.push(row.url);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return found;
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Knex } from 'knex';
|
|
2
|
+
/**
|
|
3
|
+
* Counts the total number of pages in the database.
|
|
4
|
+
*
|
|
5
|
+
* Pages live in `content_items` (resources are a physically separate
|
|
6
|
+
* `resource_items` table), so a bare count needs no type discriminator
|
|
7
|
+
* and no join.
|
|
8
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
9
|
+
* @returns The total page count.
|
|
10
|
+
* @throws {Error} If the count query fails.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getPageCount(knex: Knex): Promise<number>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { dbLog } from '../../../debug.js';
|
|
2
|
+
/**
|
|
3
|
+
* Counts the total number of pages in the database.
|
|
4
|
+
*
|
|
5
|
+
* Pages live in `content_items` (resources are a physically separate
|
|
6
|
+
* `resource_items` table), so a bare count needs no type discriminator
|
|
7
|
+
* and no join.
|
|
8
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
9
|
+
* @returns The total page count.
|
|
10
|
+
* @throws {Error} If the count query fails.
|
|
11
|
+
*/
|
|
12
|
+
export async function getPageCount(knex) {
|
|
13
|
+
const selected = await knex.count('id').from('content_items');
|
|
14
|
+
if (!selected[0]) {
|
|
15
|
+
throw new Error('No count');
|
|
16
|
+
}
|
|
17
|
+
// @ts-expect-error
|
|
18
|
+
const count = selected[0]['count(`id`)'];
|
|
19
|
+
dbLog('Number of pages: %d', count);
|
|
20
|
+
return count;
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PageSource } from '../../../types.js';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
|
+
/**
|
|
4
|
+
* Look up the `source` column of a single page by its URL key. Used by
|
|
5
|
+
* the orchestrator's `PageSourceLookup` injection so the Crawler can
|
|
6
|
+
* resolve a parent page's lineage on `--resume` / `--retry-failed`
|
|
7
|
+
* sessions, where the in-memory `inventoryMode` is no longer
|
|
8
|
+
* available but the DB still remembers what label was last persisted.
|
|
9
|
+
*
|
|
10
|
+
* Returns `undefined` when the URL has no `content_items` row (e.g. a
|
|
11
|
+
* brand-new URL that has not been seen yet) so the caller can fall
|
|
12
|
+
* through to its default behaviour without distinguishing "row absent"
|
|
13
|
+
* from "row present with NULL source" — the schema's
|
|
14
|
+
* `NOT NULL DEFAULT 'crawled'` makes a NULL value impossible in practice.
|
|
15
|
+
*
|
|
16
|
+
* Read-only — no transaction. URL text lives in `url_refs` (a UNIQUE
|
|
17
|
+
* column), so the lookup is a single indexed seek plus one PK join to
|
|
18
|
+
* `content_items`. The Crawler calls this at most once per page render,
|
|
19
|
+
* NOT per sub-resource, so the N+1 risk does not apply.
|
|
20
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
21
|
+
* @param url - URL key in `url.withoutHashAndAuth` form.
|
|
22
|
+
* @returns The recorded `source`, or `undefined` when no row exists.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getPageSourceByUrl(knex: Knex, url: string): Promise<PageSource | undefined>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Look up the `source` column of a single page by its URL key. Used by
|
|
3
|
+
* the orchestrator's `PageSourceLookup` injection so the Crawler can
|
|
4
|
+
* resolve a parent page's lineage on `--resume` / `--retry-failed`
|
|
5
|
+
* sessions, where the in-memory `inventoryMode` is no longer
|
|
6
|
+
* available but the DB still remembers what label was last persisted.
|
|
7
|
+
*
|
|
8
|
+
* Returns `undefined` when the URL has no `content_items` row (e.g. a
|
|
9
|
+
* brand-new URL that has not been seen yet) so the caller can fall
|
|
10
|
+
* through to its default behaviour without distinguishing "row absent"
|
|
11
|
+
* from "row present with NULL source" — the schema's
|
|
12
|
+
* `NOT NULL DEFAULT 'crawled'` makes a NULL value impossible in practice.
|
|
13
|
+
*
|
|
14
|
+
* Read-only — no transaction. URL text lives in `url_refs` (a UNIQUE
|
|
15
|
+
* column), so the lookup is a single indexed seek plus one PK join to
|
|
16
|
+
* `content_items`. The Crawler calls this at most once per page render,
|
|
17
|
+
* NOT per sub-resource, so the N+1 risk does not apply.
|
|
18
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
19
|
+
* @param url - URL key in `url.withoutHashAndAuth` form.
|
|
20
|
+
* @returns The recorded `source`, or `undefined` when no row exists.
|
|
21
|
+
*/
|
|
22
|
+
export async function getPageSourceByUrl(knex, url) {
|
|
23
|
+
const [row] = await knex('content_items')
|
|
24
|
+
.join('url_refs', 'url_refs.id', 'content_items.url_id')
|
|
25
|
+
.select('content_items.source as source')
|
|
26
|
+
.where('url_refs.url', url);
|
|
27
|
+
return row?.source;
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DB_Anchor, DB_Page, DB_Redirect, DB_Referrer } from '../../../types.js';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves pages along with their related redirect, anchor, and referrer
|
|
5
|
+
* data. Results are ordered by the natural URL sort order (materialised
|
|
6
|
+
* through {@link setUrlOrder} into `content_items.crawl_order` before the
|
|
7
|
+
* join queries run). Only non-redirected pages are returned in the
|
|
8
|
+
* top-level `pages` array; redirect sources are surfaced only through the
|
|
9
|
+
* `redirects` array so downstream reports (Sheets export) can attribute
|
|
10
|
+
* every source without double-counting the destination.
|
|
11
|
+
*
|
|
12
|
+
* **Redirect resolution stays a read-time join.** `anchor_edges.href_page_id`
|
|
13
|
+
* (like the legacy `anchors.hrefId` it replaces) is resolved by URL only at
|
|
14
|
+
* write time (`resolveContentItemId`), with no redirect-chain following —
|
|
15
|
+
* an anchor's target may itself become a redirect source discovered later
|
|
16
|
+
* in the crawl. `redirectTable()` joins the single `redirect_dest_id` hop
|
|
17
|
+
* at read time so `anchors[].url` reflects the final destination while
|
|
18
|
+
* `anchors[].href` keeps the immediate (pre-redirect) target URL; one hop
|
|
19
|
+
* suffices only because `linkRedirectSources` pre-flattens every hop's
|
|
20
|
+
* `redirect_dest_id` to the final destination at write time.
|
|
21
|
+
*
|
|
22
|
+
* **Deduped anchor identity.** `anchor_edges` collapses repeated
|
|
23
|
+
* `(page_id, href_page_id)` instances into one row with a `count`; `hash` /
|
|
24
|
+
* `textContent` below come from `first_hash` / `first_text_id` (the first
|
|
25
|
+
* observed instance), not every instance — an intentional behavior change
|
|
26
|
+
* from the legacy `anchors` table's one-row-per-instance model.
|
|
27
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
28
|
+
* @param offset - The number of rows to skip.
|
|
29
|
+
* @param limit - The maximum number of pages to return.
|
|
30
|
+
* @returns An object containing `pages`, `redirects`, `anchors`, and
|
|
31
|
+
* `referrers` arrays.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getPagesWithRels(knex: Knex, offset: number, limit: number): Promise<{
|
|
34
|
+
pages: DB_Page[];
|
|
35
|
+
redirects: DB_Redirect[];
|
|
36
|
+
anchors: DB_Anchor[];
|
|
37
|
+
referrers: DB_Referrer[];
|
|
38
|
+
}>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { dbLog } from '../../../debug.js';
|
|
2
|
+
import { limitedPageIds } from '../../../limited-page-ids.js';
|
|
3
|
+
import { redirectTable } from '../../../redirect-table.js';
|
|
4
|
+
import { setUrlOrder } from '../order/set-url-order.js';
|
|
5
|
+
import { buildPageQuery } from './build-page-query.js';
|
|
6
|
+
import { reconstructPageRows } from './reconstruct-page-rows.js';
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves pages along with their related redirect, anchor, and referrer
|
|
9
|
+
* data. Results are ordered by the natural URL sort order (materialised
|
|
10
|
+
* through {@link setUrlOrder} into `content_items.crawl_order` before the
|
|
11
|
+
* join queries run). Only non-redirected pages are returned in the
|
|
12
|
+
* top-level `pages` array; redirect sources are surfaced only through the
|
|
13
|
+
* `redirects` array so downstream reports (Sheets export) can attribute
|
|
14
|
+
* every source without double-counting the destination.
|
|
15
|
+
*
|
|
16
|
+
* **Redirect resolution stays a read-time join.** `anchor_edges.href_page_id`
|
|
17
|
+
* (like the legacy `anchors.hrefId` it replaces) is resolved by URL only at
|
|
18
|
+
* write time (`resolveContentItemId`), with no redirect-chain following —
|
|
19
|
+
* an anchor's target may itself become a redirect source discovered later
|
|
20
|
+
* in the crawl. `redirectTable()` joins the single `redirect_dest_id` hop
|
|
21
|
+
* at read time so `anchors[].url` reflects the final destination while
|
|
22
|
+
* `anchors[].href` keeps the immediate (pre-redirect) target URL; one hop
|
|
23
|
+
* suffices only because `linkRedirectSources` pre-flattens every hop's
|
|
24
|
+
* `redirect_dest_id` to the final destination at write time.
|
|
25
|
+
*
|
|
26
|
+
* **Deduped anchor identity.** `anchor_edges` collapses repeated
|
|
27
|
+
* `(page_id, href_page_id)` instances into one row with a `count`; `hash` /
|
|
28
|
+
* `textContent` below come from `first_hash` / `first_text_id` (the first
|
|
29
|
+
* observed instance), not every instance — an intentional behavior change
|
|
30
|
+
* from the legacy `anchors` table's one-row-per-instance model.
|
|
31
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
32
|
+
* @param offset - The number of rows to skip.
|
|
33
|
+
* @param limit - The maximum number of pages to return.
|
|
34
|
+
* @returns An object containing `pages`, `redirects`, `anchors`, and
|
|
35
|
+
* `referrers` arrays.
|
|
36
|
+
*/
|
|
37
|
+
export async function getPagesWithRels(knex, offset, limit) {
|
|
38
|
+
await setUrlOrder(knex);
|
|
39
|
+
dbLog('Get Pages');
|
|
40
|
+
const rawRows = await buildPageQuery(knex)
|
|
41
|
+
.whereNull('ci.redirect_dest_id')
|
|
42
|
+
.orderByRaw('`ci`.`crawl_order` ASC NULLS LAST')
|
|
43
|
+
.limit(limit)
|
|
44
|
+
.offset(offset);
|
|
45
|
+
const pages = await reconstructPageRows(knex, rawRows);
|
|
46
|
+
// When empty
|
|
47
|
+
if (pages.length === 0) {
|
|
48
|
+
return {
|
|
49
|
+
pages: [],
|
|
50
|
+
redirects: [],
|
|
51
|
+
referrers: [],
|
|
52
|
+
anchors: [],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
dbLog('Get Pages: Redirects');
|
|
56
|
+
const redirects = await knex
|
|
57
|
+
.with('limitedPages', limitedPageIds(limit, offset))
|
|
58
|
+
.with('redirect', redirectTable(false))
|
|
59
|
+
.select('id as pageId', 'from', 'fromId')
|
|
60
|
+
.from('redirect')
|
|
61
|
+
// Filter
|
|
62
|
+
.join('limitedPages', 'redirect.toId', '=', 'limitedPages.id')
|
|
63
|
+
// Sort
|
|
64
|
+
.orderBy('id', 'asc');
|
|
65
|
+
dbLog('Get Pages: Anchors');
|
|
66
|
+
const anchors = await knex
|
|
67
|
+
.with('limitedPages', limitedPageIds(limit, offset))
|
|
68
|
+
.with('redirect', redirectTable())
|
|
69
|
+
.select('limitedPages.id as pageId', 'href_url.url as url', 'redirect.from as href', 'href.is_external as isExternal', 'href_title.text as title', 'href.status as status', 'href.status_text as statusText', 'href_ctr.raw as contentType', 'anchor_edges.first_hash as hash', 'anchor_text.text as textContent')
|
|
70
|
+
.from('anchor_edges')
|
|
71
|
+
// Filters
|
|
72
|
+
.join('limitedPages', 'anchor_edges.page_id', '=', 'limitedPages.id')
|
|
73
|
+
// Resolves redirect
|
|
74
|
+
.join('redirect', 'anchor_edges.href_page_id', '=', 'redirect.fromId')
|
|
75
|
+
// Target
|
|
76
|
+
.join('content_items as href', 'redirect.toId', '=', 'href.id')
|
|
77
|
+
.join('url_refs as href_url', 'href.url_id', '=', 'href_url.id')
|
|
78
|
+
.leftJoin('content_type_refs as href_ctr', 'href.content_type_id', '=', 'href_ctr.id')
|
|
79
|
+
.leftJoin('page_meta as href_pm', 'href.id', '=', 'href_pm.page_id')
|
|
80
|
+
.leftJoin('text_refs as href_title', 'href_pm.title_text_id', '=', 'href_title.id')
|
|
81
|
+
.leftJoin('text_refs as anchor_text', 'anchor_edges.first_text_id', '=', 'anchor_text.id')
|
|
82
|
+
// Sort
|
|
83
|
+
.orderBy('anchor_edges.id', 'asc');
|
|
84
|
+
dbLog('Get Pages: Referrers');
|
|
85
|
+
const referrers = await knex
|
|
86
|
+
.with('limitedPages', limitedPageIds(limit, offset))
|
|
87
|
+
.with('redirect', redirectTable())
|
|
88
|
+
.select('redirect.toId as pageId', 'referrer_url.url as url', 'redirect.from as through', 'redirect.fromId as throughId', 'anchor_edges.first_hash as hash', 'anchor_text.text as textContent')
|
|
89
|
+
.from('anchor_edges')
|
|
90
|
+
// Resolves redirect
|
|
91
|
+
.join('redirect', 'anchor_edges.href_page_id', '=', 'redirect.fromId')
|
|
92
|
+
// Referrer
|
|
93
|
+
.join('content_items as referrer', 'anchor_edges.page_id', '=', 'referrer.id')
|
|
94
|
+
.join('url_refs as referrer_url', 'referrer.url_id', '=', 'referrer_url.id')
|
|
95
|
+
// Filters
|
|
96
|
+
.join('limitedPages', 'redirect.toId', '=', 'limitedPages.id')
|
|
97
|
+
.leftJoin('text_refs as anchor_text', 'anchor_edges.first_text_id', '=', 'anchor_text.id')
|
|
98
|
+
// Sort
|
|
99
|
+
.orderBy('anchor_edges.id', 'asc');
|
|
100
|
+
dbLog('Get Pages: Done');
|
|
101
|
+
return {
|
|
102
|
+
pages,
|
|
103
|
+
redirects,
|
|
104
|
+
anchors,
|
|
105
|
+
referrers,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DB_Page, PageFilter } from '../../../types.js';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves pages from the database with optional filtering, pagination via offset and limit.
|
|
5
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
6
|
+
* @param filter - An optional {@link PageFilter} to narrow results by content type and origin.
|
|
7
|
+
* @param offset - The number of rows to skip. Defaults to `0`.
|
|
8
|
+
* @param limit - The maximum number of rows to return. Defaults to `100000`.
|
|
9
|
+
* @returns An array of reconstructed {@link DB_Page} rows.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getPages(knex: Knex, filter?: PageFilter, offset?: number, limit?: number): Promise<DB_Page[]>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { buildPageQuery } from './build-page-query.js';
|
|
2
|
+
import { reconstructPageRows } from './reconstruct-page-rows.js';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves pages from the database with optional filtering, pagination via offset and limit.
|
|
5
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
6
|
+
* @param filter - An optional {@link PageFilter} to narrow results by content type and origin.
|
|
7
|
+
* @param offset - The number of rows to skip. Defaults to `0`.
|
|
8
|
+
* @param limit - The maximum number of rows to return. Defaults to `100000`.
|
|
9
|
+
* @returns An array of reconstructed {@link DB_Page} rows.
|
|
10
|
+
*/
|
|
11
|
+
export async function getPages(knex, filter, offset = 0, limit = 100_000) {
|
|
12
|
+
const q = buildPageQuery(knex);
|
|
13
|
+
switch (filter) {
|
|
14
|
+
case 'page': {
|
|
15
|
+
q.where('ctr.raw', 'text/html').andWhere('ci.is_target', 1);
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
case 'page-included-no-target': {
|
|
19
|
+
q.where('ctr.raw', 'text/html');
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case 'external-page': {
|
|
23
|
+
q.where('ctr.raw', 'text/html').andWhere('ci.is_external', 1);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case 'internal-page': {
|
|
27
|
+
q.where('ctr.raw', 'text/html').andWhere('ci.is_external', 0);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case 'no-page': {
|
|
31
|
+
q.where((qb) => {
|
|
32
|
+
qb.whereNull('ctr.raw').orWhereNot('ctr.raw', 'text/html');
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 'external-no-page': {
|
|
37
|
+
q.where((qb) => {
|
|
38
|
+
qb.whereNull('ctr.raw').orWhereNot('ctr.raw', 'text/html');
|
|
39
|
+
}).andWhere('ci.is_external', 1);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case 'internal-no-page': {
|
|
43
|
+
q.where((qb) => {
|
|
44
|
+
qb.whereNull('ctr.raw').orWhereNot('ctr.raw', 'text/html');
|
|
45
|
+
}).andWhere('ci.is_external', 0);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const rows = await q.limit(limit).offset(offset);
|
|
50
|
+
return reconstructPageRows(knex, rows);
|
|
51
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Knex } from 'knex';
|
|
2
|
+
/**
|
|
3
|
+
* Counts pages that were scraped as crawl targets (full HTML render).
|
|
4
|
+
*
|
|
5
|
+
* Used by the crawler to seed its `pagesScraped` counter on resume so the
|
|
6
|
+
* progress display reflects all browser-rendered HTML pages across sessions,
|
|
7
|
+
* not just the current one.
|
|
8
|
+
*
|
|
9
|
+
* "HTML page" is guaranteed by `content_type_refs.raw = 'text/html'`, NOT by
|
|
10
|
+
* `is_target` alone: `is_target` means "in-scope crawl target" and is set
|
|
11
|
+
* for in-scope non-HTML resources too (e.g. a PDF reached via the HEAD
|
|
12
|
+
* pre-flight is `is_target = 1`). Counting those would over-report the HTML
|
|
13
|
+
* page total, so page-ness is asserted at the read layer here rather than by
|
|
14
|
+
* trusting `is_target`.
|
|
15
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
16
|
+
* @returns The number of `text/html` rows with `is_target = 1` and `scraped = 1`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getScrapedHtmlPageCount(knex: Knex): Promise<number>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Counts pages that were scraped as crawl targets (full HTML render).
|
|
3
|
+
*
|
|
4
|
+
* Used by the crawler to seed its `pagesScraped` counter on resume so the
|
|
5
|
+
* progress display reflects all browser-rendered HTML pages across sessions,
|
|
6
|
+
* not just the current one.
|
|
7
|
+
*
|
|
8
|
+
* "HTML page" is guaranteed by `content_type_refs.raw = 'text/html'`, NOT by
|
|
9
|
+
* `is_target` alone: `is_target` means "in-scope crawl target" and is set
|
|
10
|
+
* for in-scope non-HTML resources too (e.g. a PDF reached via the HEAD
|
|
11
|
+
* pre-flight is `is_target = 1`). Counting those would over-report the HTML
|
|
12
|
+
* page total, so page-ness is asserted at the read layer here rather than by
|
|
13
|
+
* trusting `is_target`.
|
|
14
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
15
|
+
* @returns The number of `text/html` rows with `is_target = 1` and `scraped = 1`.
|
|
16
|
+
*/
|
|
17
|
+
export async function getScrapedHtmlPageCount(knex) {
|
|
18
|
+
const [row] = await knex('content_items')
|
|
19
|
+
.join('content_type_refs', 'content_type_refs.id', 'content_items.content_type_id')
|
|
20
|
+
.where('content_items.is_target', 1)
|
|
21
|
+
.andWhere('content_items.scraped', 1)
|
|
22
|
+
.andWhere('content_type_refs.raw', 'text/html')
|
|
23
|
+
.count('* as count');
|
|
24
|
+
return row ? Number(row.count) : 0;
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DB_Page } from '../../../types.js';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
|
+
/**
|
|
4
|
+
* Raw row shape produced by {@link ../read/build-page-query.js} before
|
|
5
|
+
* `responseHeaders` / `meta_extras` reconstruction.
|
|
6
|
+
*/
|
|
7
|
+
interface RawPageRow extends Omit<DB_Page, 'responseHeaders' | 'meta_extras' | 'networkLogs'> {
|
|
8
|
+
/** `content_items.header_set_id`, or null when no headers were recorded. */
|
|
9
|
+
headerSetId: number | null;
|
|
10
|
+
/** `json_refs.json_text` for `meta_extras`, or null when absent. */
|
|
11
|
+
extras_body: Buffer | string | null;
|
|
12
|
+
/** `json_refs.codec` for `meta_extras` (`'zstd'` or `'none'`), or null when absent. */
|
|
13
|
+
extras_codec: 'zstd' | 'none' | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Reconstructs `responseHeaders` (JSON string) and `meta_extras` (JSON
|
|
17
|
+
* string) for a batch of raw page rows. Headers load through
|
|
18
|
+
* {@link ../../_shared/load-response-headers-by-set-ids.js} (chunked
|
|
19
|
+
* batch lookup, never N+1); `meta_extras` decodes through
|
|
20
|
+
* {@link ../../_shared/decode-json-ref.js}. `networkLogs` has no 0.13
|
|
21
|
+
* equivalent (it is a legacy-only field nothing ever wrote past the
|
|
22
|
+
* pre-0.13 write path either) and is always `null`.
|
|
23
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
24
|
+
* @param rows - Raw rows from {@link ../read/build-page-query.js}.
|
|
25
|
+
* @returns Fully reconstructed `DB_Page` rows, in the same order as `rows`.
|
|
26
|
+
* @example
|
|
27
|
+
* const raw = await buildPageQuery(knex).where('ci.is_target', 1);
|
|
28
|
+
* const pages = await reconstructPageRows(knex, raw);
|
|
29
|
+
*/
|
|
30
|
+
export declare function reconstructPageRows(knex: Knex, rows: readonly RawPageRow[]): Promise<DB_Page[]>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { decodeJsonRef } from '../../_shared/decode-json-ref.js';
|
|
2
|
+
import { loadResponseHeadersBySetIds } from '../../_shared/load-response-headers-by-set-ids.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reconstructs `responseHeaders` (JSON string) and `meta_extras` (JSON
|
|
5
|
+
* string) for a batch of raw page rows. Headers load through
|
|
6
|
+
* {@link ../../_shared/load-response-headers-by-set-ids.js} (chunked
|
|
7
|
+
* batch lookup, never N+1); `meta_extras` decodes through
|
|
8
|
+
* {@link ../../_shared/decode-json-ref.js}. `networkLogs` has no 0.13
|
|
9
|
+
* equivalent (it is a legacy-only field nothing ever wrote past the
|
|
10
|
+
* pre-0.13 write path either) and is always `null`.
|
|
11
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
12
|
+
* @param rows - Raw rows from {@link ../read/build-page-query.js}.
|
|
13
|
+
* @returns Fully reconstructed `DB_Page` rows, in the same order as `rows`.
|
|
14
|
+
* @example
|
|
15
|
+
* const raw = await buildPageQuery(knex).where('ci.is_target', 1);
|
|
16
|
+
* const pages = await reconstructPageRows(knex, raw);
|
|
17
|
+
*/
|
|
18
|
+
export async function reconstructPageRows(knex, rows) {
|
|
19
|
+
const headerSetIds = [
|
|
20
|
+
...new Set(rows.map((r) => r.headerSetId).filter((id) => id != null)),
|
|
21
|
+
];
|
|
22
|
+
const headersBySetId = await loadResponseHeadersBySetIds(knex, headerSetIds);
|
|
23
|
+
return rows.map((row) => {
|
|
24
|
+
const { headerSetId, extras_body, extras_codec, ...rest } = row;
|
|
25
|
+
return {
|
|
26
|
+
...rest,
|
|
27
|
+
responseHeaders: JSON.stringify(headerSetId == null ? {} : (headersBySetId.get(headerSetId) ?? {})),
|
|
28
|
+
meta_extras: decodeJsonRef(extras_body, extras_codec),
|
|
29
|
+
networkLogs: null,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Knex } from 'knex';
|
|
2
|
+
/**
|
|
3
|
+
* Deletes every Scoped-Replace derived row for the given page ids, across the
|
|
4
|
+
* 17 tables a page's re-scrape needs to start clean.
|
|
5
|
+
*
|
|
6
|
+
* Shared by {@link resetFailedPages} and {@link repromoteExternalPages} —
|
|
7
|
+
* both un-scrape a page back to `scraped = 0` and need the same "delete this
|
|
8
|
+
* page's derived rows so the re-scrape can re-insert fresh data without
|
|
9
|
+
* duplicates" sweep. `page_errors` is deliberately NOT included here:
|
|
10
|
+
* `repromoteExternalPages` never cleared it (an external page's prior error
|
|
11
|
+
* history stays visible after being promoted back into scope), and folding
|
|
12
|
+
* it into this shared helper would silently change that existing behaviour.
|
|
13
|
+
* Callers that do want `page_errors` cleared (`resetFailedPages`) delete it
|
|
14
|
+
* themselves alongside this call.
|
|
15
|
+
* @param knex - Knex query builder connected to the archive DB.
|
|
16
|
+
* @param pageIds - `content_items.id` values whose derived rows should be
|
|
17
|
+
* deleted. Expected to already be chunked below
|
|
18
|
+
* `SQLITE_LIMIT_VARIABLE_NUMBER` by the caller.
|
|
19
|
+
*/
|
|
20
|
+
export declare function clearPageDerivedRows(knex: Knex, pageIds: readonly number[]): Promise<void>;
|