@nitpicker/archive 0.0.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +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 +1055 -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 +803 -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 +45 -0
- package/lib/filesystem/parse-tar-size-field.d.ts +13 -0
- package/lib/filesystem/parse-tar-size-field.js +37 -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 +132 -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/compare-strings.d.ts +12 -0
- package/lib/test-utils/compare-strings.js +14 -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,146 @@
|
|
|
1
|
+
/** chunk size for `WHERE … IN (?)` SQLite parameter packing. */
|
|
2
|
+
const CHUNK_SIZE = 500;
|
|
3
|
+
/**
|
|
4
|
+
* Bulk-resolve a raw error message (plus its timestamp) for each given page
|
|
5
|
+
* id, using only sources reachable from a {@link Knex} handle. Read order:
|
|
6
|
+
* `page_errors` (keyed by `pageId`, the most direct signal a scrape attempt
|
|
7
|
+
* recorded), then `crawl_errors` (keyed by `url`, the crawler-channel
|
|
8
|
+
* record for failures that happened before a page row was scraped).
|
|
9
|
+
*
|
|
10
|
+
* **Known limitation — pre-`crawl_errors` archives**: This helper does NOT
|
|
11
|
+
* read `error.log`. The `crawl_errors` table is created empty (by
|
|
12
|
+
* `initSchema` on fresh archives, by `scripts/migrate-to-0.13.mjs` on
|
|
13
|
+
* migrated ones) and historical lines from `error.log` are never
|
|
14
|
+
* back-filled, so an archive whose failures live only in `error.log`
|
|
15
|
+
* will resolve every id to "no message" here. The
|
|
16
|
+
* downstream `Database.resetFailedPages` treats absence as `unknown` (still
|
|
17
|
+
* retryable), so legacy archives lose the permanent-kind exclusion until a
|
|
18
|
+
* fresh crawl run populates `crawl_errors` / `page_errors`. The trade-off
|
|
19
|
+
* (no error.log parsing in the writer path) keeps the writer dependency
|
|
20
|
+
* surface narrow and avoids re-implementing the parser already living in
|
|
21
|
+
* `@nitpicker/query`'s `resolveFailedPageMessages` — which the crawler
|
|
22
|
+
* package cannot import (reverse-direction dependency). When this matters
|
|
23
|
+
* in practice, run the archive through one fresh `crawl --retry-failed`
|
|
24
|
+
* pass first to populate the structured tables.
|
|
25
|
+
*
|
|
26
|
+
* Pages with no message in any consulted source are simply absent from the
|
|
27
|
+
* returned map; callers treat the absence as "unclassifiable, keep retrying"
|
|
28
|
+
* (i.e. `unknown`).
|
|
29
|
+
* @param instance - The {@link Knex} handle.
|
|
30
|
+
* @param ids - Candidate `pages.id` values.
|
|
31
|
+
* @param urls - The corresponding `pages.url` values, in the same order as
|
|
32
|
+
* `ids`. Length and indexing MUST match `ids` so the page → url join can be
|
|
33
|
+
* reconstructed without a second `pages` round-trip.
|
|
34
|
+
* @returns `Map<pageId, FailedPageMessage>` populated only for ids whose
|
|
35
|
+
* message was found in one of the consulted tables.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const messages = await getFailedPageMessages(
|
|
39
|
+
* instance,
|
|
40
|
+
* candidates.map(c => c.id),
|
|
41
|
+
* candidates.map(c => c.url),
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export async function getFailedPageMessages(instance, ids, urls) {
|
|
46
|
+
if (ids.length === 0) {
|
|
47
|
+
return new Map();
|
|
48
|
+
}
|
|
49
|
+
if (ids.length !== urls.length) {
|
|
50
|
+
throw new Error(`getFailedPageMessages: ids.length (${ids.length}) !== urls.length (${urls.length}) — must be 1:1`);
|
|
51
|
+
}
|
|
52
|
+
const messageByPageId = new Map();
|
|
53
|
+
if (await instance.schema.hasTable('page_errors')) {
|
|
54
|
+
for (let i = 0; i < ids.length; i += CHUNK_SIZE) {
|
|
55
|
+
const chunk = ids.slice(i, i + CHUNK_SIZE);
|
|
56
|
+
// `orderBy('id', 'asc')` makes the per-pageId "first row seen"
|
|
57
|
+
// behavior deterministic regardless of SQLite's natural ROWID
|
|
58
|
+
// scan order, which is otherwise implementation-defined under
|
|
59
|
+
// concurrent / migrated archives. Without the explicit order, a
|
|
60
|
+
// reset that classified a page as `unknown` once could classify
|
|
61
|
+
// it as `parse-error` on the next run when the rows happen to be
|
|
62
|
+
// returned in a different order.
|
|
63
|
+
const rows = (await instance('page_errors')
|
|
64
|
+
.select('pageId', 'message', 'createdAt')
|
|
65
|
+
.whereIn('pageId', chunk)
|
|
66
|
+
.orderBy('id', 'asc'));
|
|
67
|
+
for (const row of rows) {
|
|
68
|
+
// Earliest-id wins. Schema permits multiple rows per pageId
|
|
69
|
+
// (the same scrape can record several phase errors); the
|
|
70
|
+
// first row inserted is usually the trigger cause, later
|
|
71
|
+
// rows are follow-on noise from the same failure cascade.
|
|
72
|
+
//
|
|
73
|
+
// An empty `message` is treated as "no signal" and ignored
|
|
74
|
+
// so the crawl_errors lookup can fill it in. Without this,
|
|
75
|
+
// a page_errors row with `message=''` (recorded by a
|
|
76
|
+
// scraper phase that fired its trigger but had no error
|
|
77
|
+
// text) would short-circuit and we'd lose access to the
|
|
78
|
+
// crawl_errors row that classifies the failure as
|
|
79
|
+
// `dns` / `tls` / `client-blocked` etc. — defeating
|
|
80
|
+
// `--retry-failed`'s permanent-kind exclusion.
|
|
81
|
+
if (row.message !== '' && !messageByPageId.has(row.pageId)) {
|
|
82
|
+
messageByPageId.set(row.pageId, {
|
|
83
|
+
message: row.message,
|
|
84
|
+
createdAt: row.createdAt,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const idsMissing = ids.filter((id) => !messageByPageId.has(id));
|
|
91
|
+
if (idsMissing.length === 0 || !(await instance.schema.hasTable('crawl_errors'))) {
|
|
92
|
+
// Early-exit short-circuits BOTH the idToUrl Map construction and
|
|
93
|
+
// the crawl_errors round-trip. On a 1M-page archive where every
|
|
94
|
+
// failed page already has a `page_errors` row, this avoids walking
|
|
95
|
+
// the candidate list a second time.
|
|
96
|
+
return messageByPageId;
|
|
97
|
+
}
|
|
98
|
+
const idToUrl = new Map();
|
|
99
|
+
for (const [i, id] of ids.entries()) {
|
|
100
|
+
const url = urls[i];
|
|
101
|
+
if (url !== undefined) {
|
|
102
|
+
idToUrl.set(id, url);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const missingUrls = [];
|
|
106
|
+
for (const id of idsMissing) {
|
|
107
|
+
const url = idToUrl.get(id);
|
|
108
|
+
if (url !== undefined) {
|
|
109
|
+
missingUrls.push(url);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const urlToMessage = new Map();
|
|
113
|
+
for (let i = 0; i < missingUrls.length; i += CHUNK_SIZE) {
|
|
114
|
+
const chunk = missingUrls.slice(i, i + CHUNK_SIZE);
|
|
115
|
+
const rows = (await instance('crawl_errors')
|
|
116
|
+
.select('url', 'message', 'createdAt')
|
|
117
|
+
.whereIn('url', chunk));
|
|
118
|
+
for (const row of rows) {
|
|
119
|
+
if (row.url === null) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
// Latest-createdAt wins (fixes a previously-undefined
|
|
123
|
+
// selection among duplicate URLs — SQLite's natural scan
|
|
124
|
+
// order is implementation-defined). The most recent message
|
|
125
|
+
// is the most relevant one for both classification and outage
|
|
126
|
+
// attribution: an old NXDOMAIN followed by a network-outage
|
|
127
|
+
// blip should resolve to the outage-era message, not whichever
|
|
128
|
+
// happened to be inserted first.
|
|
129
|
+
const existing = urlToMessage.get(row.url);
|
|
130
|
+
if (existing === undefined || row.createdAt > existing.createdAt) {
|
|
131
|
+
urlToMessage.set(row.url, { message: row.message, createdAt: row.createdAt });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const id of idsMissing) {
|
|
136
|
+
const url = idToUrl.get(id);
|
|
137
|
+
if (url === undefined) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const resolved = urlToMessage.get(url);
|
|
141
|
+
if (resolved !== undefined) {
|
|
142
|
+
messageByPageId.set(id, resolved);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return messageByPageId;
|
|
146
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely parses a JSON string, returning a fallback value if parsing fails or the input is not a string.
|
|
3
|
+
* Logs a warning via {@link dbLog} when invalid JSON is detected, including a truncated preview
|
|
4
|
+
* of the data and the parse error message.
|
|
5
|
+
* @template T The expected type of the parsed JSON value and the fallback.
|
|
6
|
+
* @param data - The data to parse. Only string values are parsed; other types return the fallback.
|
|
7
|
+
* @param fallback - The value to return if parsing fails or the result is falsy.
|
|
8
|
+
* @returns The parsed JSON value, or the fallback.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getJSON<T>(data: unknown, fallback: T): T;
|
package/lib/get-json.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { dbLog } from './debug.js';
|
|
2
|
+
/**
|
|
3
|
+
* Safely parses a JSON string, returning a fallback value if parsing fails or the input is not a string.
|
|
4
|
+
* Logs a warning via {@link dbLog} when invalid JSON is detected, including a truncated preview
|
|
5
|
+
* of the data and the parse error message.
|
|
6
|
+
* @template T The expected type of the parsed JSON value and the fallback.
|
|
7
|
+
* @param data - The data to parse. Only string values are parsed; other types return the fallback.
|
|
8
|
+
* @param fallback - The value to return if parsing fails or the result is falsy.
|
|
9
|
+
* @returns The parsed JSON value, or the fallback.
|
|
10
|
+
*/
|
|
11
|
+
export function getJSON(data, fallback) {
|
|
12
|
+
try {
|
|
13
|
+
if (typeof data === 'string') {
|
|
14
|
+
const result = JSON.parse(data);
|
|
15
|
+
if (result) {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
return fallback;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
dbLog('Warning: Invalid JSON detected in database field. Using fallback value. Data: %s, Error: %s', String(data).slice(0, 200), error instanceof Error ? error.message : String(error));
|
|
23
|
+
}
|
|
24
|
+
return fallback;
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HtmlMatchOutcome, SelectorPlan } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Decides whether any element of one stored HTML document matches a planned
|
|
4
|
+
* selector list, using the cheapest stage that is exact: an ordered-literal
|
|
5
|
+
* prefilter, then the start tags alone for selectors one tag decides, then
|
|
6
|
+
* an open-element stack. The matcher itself is native (`@nitpicker/core`).
|
|
7
|
+
*
|
|
8
|
+
* The result is a judgement about the stored string read as markup with
|
|
9
|
+
* balanced tags (the interpretation rules are in `@nitpicker/cli`'s
|
|
10
|
+
* `docs/query.md`), not a DOM query. Tag and attribute names ignore ASCII
|
|
11
|
+
* case only.
|
|
12
|
+
* @param options - The plan and the document.
|
|
13
|
+
* @param options.plan - The validated selector list.
|
|
14
|
+
* @param options.html - The stored markup, as a string or as UTF-8 bytes.
|
|
15
|
+
* @returns The verdict, which stages ran, and how many elements the stack tested.
|
|
16
|
+
* @throws {Error} With code `InvalidArg` if the plan is malformed.
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const { matched } = matchSelectorHtml({ plan, html: '<p><img src="a.png"></p>' });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function matchSelectorHtml(options: {
|
|
23
|
+
readonly plan: SelectorPlan;
|
|
24
|
+
readonly html: string | Uint8Array;
|
|
25
|
+
}): HtmlMatchOutcome;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { matchSelectorHtml as matchSelectorHtmlNatively } from '@nitpicker/core/match-selector-html';
|
|
2
|
+
/**
|
|
3
|
+
* Decides whether any element of one stored HTML document matches a planned
|
|
4
|
+
* selector list, using the cheapest stage that is exact: an ordered-literal
|
|
5
|
+
* prefilter, then the start tags alone for selectors one tag decides, then
|
|
6
|
+
* an open-element stack. The matcher itself is native (`@nitpicker/core`).
|
|
7
|
+
*
|
|
8
|
+
* The result is a judgement about the stored string read as markup with
|
|
9
|
+
* balanced tags (the interpretation rules are in `@nitpicker/cli`'s
|
|
10
|
+
* `docs/query.md`), not a DOM query. Tag and attribute names ignore ASCII
|
|
11
|
+
* case only.
|
|
12
|
+
* @param options - The plan and the document.
|
|
13
|
+
* @param options.plan - The validated selector list.
|
|
14
|
+
* @param options.html - The stored markup, as a string or as UTF-8 bytes.
|
|
15
|
+
* @returns The verdict, which stages ran, and how many elements the stack tested.
|
|
16
|
+
* @throws {Error} With code `InvalidArg` if the plan is malformed.
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const { matched } = matchSelectorHtml({ plan, html: '<p><img src="a.png"></p>' });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function matchSelectorHtml(options) {
|
|
23
|
+
// Passing archive's types to core's wrapper, and taking its result as
|
|
24
|
+
// archive's type, is the check that the two still mirror each other: a
|
|
25
|
+
// drift in either direction fails to compile here.
|
|
26
|
+
const outcome = matchSelectorHtmlNatively(options);
|
|
27
|
+
return outcome;
|
|
28
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SelectorPlan, SnapshotMatchOutcome, StoredHtmlSnapshot } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Judges a batch of stored HTML snapshots (rows of `page_html_blobs`)
|
|
4
|
+
* against a planned selector list: each is decompressed, read as UTF-8 and
|
|
5
|
+
* judged as {@link import('./match-selector-html.js').matchSelectorHtml}
|
|
6
|
+
* does, in parallel on the native thread pool, one decoded document per
|
|
7
|
+
* thread at a time.
|
|
8
|
+
*
|
|
9
|
+
* A snapshot that cannot be decompressed, or has a codec other than `zstd`
|
|
10
|
+
* or `none`, fails the whole call; it is never judged "no match".
|
|
11
|
+
* @param options - The plan and the batch.
|
|
12
|
+
* @param options.plan - The validated selector list.
|
|
13
|
+
* @param options.snapshots - The stored snapshots, in the order the verdicts are returned.
|
|
14
|
+
* @param options.signal - Stops the call at its next snapshot, or within the next mebibyte of a decompression under way; a call still waiting for its turn stops when the turn comes.
|
|
15
|
+
* @returns One verdict per snapshot, in input order.
|
|
16
|
+
* @throws {Error} If a codec is not `zstd` or `none`, or the batch takes more than 4 GiB.
|
|
17
|
+
* The returned promise rejects (`snapshot <n> could not be decoded`) if a snapshot's
|
|
18
|
+
* zstd data is corrupt or decompresses past `MAX_DECODED_SNAPSHOT_BYTES`, or with code
|
|
19
|
+
* `InvalidArg` if the plan is malformed, and with the signal's reason if `signal` aborted
|
|
20
|
+
* before the call finished.
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const verdicts = await matchSelectorSnapshots({
|
|
24
|
+
* plan,
|
|
25
|
+
* snapshots: rows.map((row) => ({ body: row.body, codec: row.codec })),
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function matchSelectorSnapshots(options: {
|
|
30
|
+
readonly plan: SelectorPlan;
|
|
31
|
+
readonly snapshots: readonly StoredHtmlSnapshot[];
|
|
32
|
+
readonly signal?: AbortSignal;
|
|
33
|
+
}): Promise<SnapshotMatchOutcome[]>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { matchSelectorSnapshots as matchSelectorSnapshotsNatively } from '@nitpicker/core/match-selector-snapshots';
|
|
2
|
+
/**
|
|
3
|
+
* Judges a batch of stored HTML snapshots (rows of `page_html_blobs`)
|
|
4
|
+
* against a planned selector list: each is decompressed, read as UTF-8 and
|
|
5
|
+
* judged as {@link import('./match-selector-html.js').matchSelectorHtml}
|
|
6
|
+
* does, in parallel on the native thread pool, one decoded document per
|
|
7
|
+
* thread at a time.
|
|
8
|
+
*
|
|
9
|
+
* A snapshot that cannot be decompressed, or has a codec other than `zstd`
|
|
10
|
+
* or `none`, fails the whole call; it is never judged "no match".
|
|
11
|
+
* @param options - The plan and the batch.
|
|
12
|
+
* @param options.plan - The validated selector list.
|
|
13
|
+
* @param options.snapshots - The stored snapshots, in the order the verdicts are returned.
|
|
14
|
+
* @param options.signal - Stops the call at its next snapshot, or within the next mebibyte of a decompression under way; a call still waiting for its turn stops when the turn comes.
|
|
15
|
+
* @returns One verdict per snapshot, in input order.
|
|
16
|
+
* @throws {Error} If a codec is not `zstd` or `none`, or the batch takes more than 4 GiB.
|
|
17
|
+
* The returned promise rejects (`snapshot <n> could not be decoded`) if a snapshot's
|
|
18
|
+
* zstd data is corrupt or decompresses past `MAX_DECODED_SNAPSHOT_BYTES`, or with code
|
|
19
|
+
* `InvalidArg` if the plan is malformed, and with the signal's reason if `signal` aborted
|
|
20
|
+
* before the call finished.
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const verdicts = await matchSelectorSnapshots({
|
|
24
|
+
* plan,
|
|
25
|
+
* snapshots: rows.map((row) => ({ body: row.body, codec: row.codec })),
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function matchSelectorSnapshots(options) {
|
|
30
|
+
// Passing archive's types to core's wrapper, and taking its result as
|
|
31
|
+
// archive's type, is the check that the two still mirror each other.
|
|
32
|
+
return matchSelectorSnapshotsNatively(options);
|
|
33
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SearchPattern, SnapshotSearchOutcome } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Counts the occurrences of a search pattern in one stored HTML document and
|
|
4
|
+
* cuts a snippet around the first. The document is read as UTF-8 (an invalid
|
|
5
|
+
* sequence becomes U+FFFD); positions and lengths are in Unicode scalar
|
|
6
|
+
* values; `matchCount` counts non-overlapping matches; the snippet is a
|
|
7
|
+
* window of `snippetLength` characters centred on the first match, with
|
|
8
|
+
* whitespace collapsed and the ends trimmed.
|
|
9
|
+
* @param options - The pattern and the document.
|
|
10
|
+
* @param options.pattern - The pattern and its flags.
|
|
11
|
+
* @param options.html - The stored markup, as a string or as UTF-8 bytes.
|
|
12
|
+
* @param options.snippetLength - Window size in characters.
|
|
13
|
+
* @returns The match count and the snippet (empty when nothing matched).
|
|
14
|
+
* @throws {Error} With code `InvalidArg` if the pattern cannot be compiled.
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const { matchCount } = searchHtmlDocument({
|
|
18
|
+
* pattern: { source: 'a+', literal: false, ignoreCase: false, multiLine: false, dotAll: false },
|
|
19
|
+
* html: '<p>aa b a</p>',
|
|
20
|
+
* snippetLength: 20,
|
|
21
|
+
* });
|
|
22
|
+
* matchCount; // 2
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function searchHtmlDocument(options: {
|
|
26
|
+
readonly pattern: SearchPattern;
|
|
27
|
+
readonly html: string | Uint8Array;
|
|
28
|
+
readonly snippetLength: number;
|
|
29
|
+
}): SnapshotSearchOutcome;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { searchHtmlDocument as searchHtmlDocumentNatively } from '@nitpicker/core/search-html-document';
|
|
2
|
+
/**
|
|
3
|
+
* Counts the occurrences of a search pattern in one stored HTML document and
|
|
4
|
+
* cuts a snippet around the first. The document is read as UTF-8 (an invalid
|
|
5
|
+
* sequence becomes U+FFFD); positions and lengths are in Unicode scalar
|
|
6
|
+
* values; `matchCount` counts non-overlapping matches; the snippet is a
|
|
7
|
+
* window of `snippetLength` characters centred on the first match, with
|
|
8
|
+
* whitespace collapsed and the ends trimmed.
|
|
9
|
+
* @param options - The pattern and the document.
|
|
10
|
+
* @param options.pattern - The pattern and its flags.
|
|
11
|
+
* @param options.html - The stored markup, as a string or as UTF-8 bytes.
|
|
12
|
+
* @param options.snippetLength - Window size in characters.
|
|
13
|
+
* @returns The match count and the snippet (empty when nothing matched).
|
|
14
|
+
* @throws {Error} With code `InvalidArg` if the pattern cannot be compiled.
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const { matchCount } = searchHtmlDocument({
|
|
18
|
+
* pattern: { source: 'a+', literal: false, ignoreCase: false, multiLine: false, dotAll: false },
|
|
19
|
+
* html: '<p>aa b a</p>',
|
|
20
|
+
* snippetLength: 20,
|
|
21
|
+
* });
|
|
22
|
+
* matchCount; // 2
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function searchHtmlDocument(options) {
|
|
26
|
+
return searchHtmlDocumentNatively(options);
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SearchPattern, SnapshotSearchOutcome, StoredHtmlSnapshot } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Searches a batch of stored HTML snapshots (rows of `page_html_blobs`) for
|
|
4
|
+
* a pattern: each is decompressed, read as UTF-8 and searched as
|
|
5
|
+
* {@link import('./search-html-document.js').searchHtmlDocument} does, in
|
|
6
|
+
* parallel on the native thread pool, one decoded document per thread at a
|
|
7
|
+
* time.
|
|
8
|
+
*
|
|
9
|
+
* A snapshot that cannot be decompressed, or has a codec other than `zstd`
|
|
10
|
+
* or `none`, fails the whole call; it is never reported as "no match".
|
|
11
|
+
* @param options - The pattern, the snippet size and the batch.
|
|
12
|
+
* @param options.pattern - The pattern and its flags.
|
|
13
|
+
* @param options.snippetLength - Window size in characters.
|
|
14
|
+
* @param options.snapshots - The stored snapshots, in the order the outcomes are returned.
|
|
15
|
+
* @param options.signal - Stops the call at its next snapshot, or within the next mebibyte of a decompression under way; a call still waiting for its turn stops when the turn comes.
|
|
16
|
+
* @returns One outcome per snapshot, in input order; `matchCount` is 0 where nothing matched.
|
|
17
|
+
* @throws {Error} If a codec is not `zstd` or `none`, or the batch takes more than 4 GiB.
|
|
18
|
+
* The returned promise rejects (`snapshot <n> could not be decoded`) if a snapshot's
|
|
19
|
+
* zstd data is corrupt or decompresses past `MAX_DECODED_SNAPSHOT_BYTES`, or with code
|
|
20
|
+
* `InvalidArg` if the pattern cannot be compiled, and with the signal's reason if `signal`
|
|
21
|
+
* aborted before the call finished.
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const outcomes = await searchHtmlSnapshots({
|
|
25
|
+
* pattern: { source: 'gtag(', literal: true, ignoreCase: false, multiLine: false, dotAll: false },
|
|
26
|
+
* snippetLength: 160,
|
|
27
|
+
* snapshots: rows.map((row) => ({ body: row.body, codec: row.codec })),
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function searchHtmlSnapshots(options: {
|
|
32
|
+
readonly pattern: SearchPattern;
|
|
33
|
+
readonly snippetLength: number;
|
|
34
|
+
readonly snapshots: readonly StoredHtmlSnapshot[];
|
|
35
|
+
readonly signal?: AbortSignal;
|
|
36
|
+
}): Promise<SnapshotSearchOutcome[]>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { searchHtmlSnapshots as searchHtmlSnapshotsNatively } from '@nitpicker/core/search-html-snapshots';
|
|
2
|
+
/**
|
|
3
|
+
* Searches a batch of stored HTML snapshots (rows of `page_html_blobs`) for
|
|
4
|
+
* a pattern: each is decompressed, read as UTF-8 and searched as
|
|
5
|
+
* {@link import('./search-html-document.js').searchHtmlDocument} does, in
|
|
6
|
+
* parallel on the native thread pool, one decoded document per thread at a
|
|
7
|
+
* time.
|
|
8
|
+
*
|
|
9
|
+
* A snapshot that cannot be decompressed, or has a codec other than `zstd`
|
|
10
|
+
* or `none`, fails the whole call; it is never reported as "no match".
|
|
11
|
+
* @param options - The pattern, the snippet size and the batch.
|
|
12
|
+
* @param options.pattern - The pattern and its flags.
|
|
13
|
+
* @param options.snippetLength - Window size in characters.
|
|
14
|
+
* @param options.snapshots - The stored snapshots, in the order the outcomes are returned.
|
|
15
|
+
* @param options.signal - Stops the call at its next snapshot, or within the next mebibyte of a decompression under way; a call still waiting for its turn stops when the turn comes.
|
|
16
|
+
* @returns One outcome per snapshot, in input order; `matchCount` is 0 where nothing matched.
|
|
17
|
+
* @throws {Error} If a codec is not `zstd` or `none`, or the batch takes more than 4 GiB.
|
|
18
|
+
* The returned promise rejects (`snapshot <n> could not be decoded`) if a snapshot's
|
|
19
|
+
* zstd data is corrupt or decompresses past `MAX_DECODED_SNAPSHOT_BYTES`, or with code
|
|
20
|
+
* `InvalidArg` if the pattern cannot be compiled, and with the signal's reason if `signal`
|
|
21
|
+
* aborted before the call finished.
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const outcomes = await searchHtmlSnapshots({
|
|
25
|
+
* pattern: { source: 'gtag(', literal: true, ignoreCase: false, multiLine: false, dotAll: false },
|
|
26
|
+
* snippetLength: 160,
|
|
27
|
+
* snapshots: rows.map((row) => ({ body: row.body, codec: row.codec })),
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function searchHtmlSnapshots(options) {
|
|
32
|
+
// Passing archive's types to core's wrapper, and taking its result as
|
|
33
|
+
// archive's type, is the check that the two still mirror each other.
|
|
34
|
+
return searchHtmlSnapshotsNatively(options);
|
|
35
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of the stored-HTML matcher, defined here so `@nitpicker/query` and
|
|
3
|
+
* the CLI never depend on `@nitpicker/core`'s own types. Each is structurally
|
|
4
|
+
* identical to its counterpart in core; the wrappers in this directory pass
|
|
5
|
+
* values across, so a drift fails to compile there.
|
|
6
|
+
*/
|
|
7
|
+
/** How two adjacent compounds of a complex selector are joined. */
|
|
8
|
+
export type SelectorCombinator = 'descendant' | 'child';
|
|
9
|
+
/** The attribute selector operators the matcher evaluates. */
|
|
10
|
+
export type SelectorAttributeOperator = 'exists' | 'equals' | 'includes' | 'dash' | 'prefix' | 'suffix' | 'substring';
|
|
11
|
+
/** One attribute condition of a compound (`[a]`, `[a^=v]`, `.cls`, `#id`, ...). */
|
|
12
|
+
export interface SelectorAttributeTest {
|
|
13
|
+
/** Lower-cased attribute name. */
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly operator: SelectorAttributeOperator;
|
|
16
|
+
/** The selector's literal value (empty for `exists`). */
|
|
17
|
+
readonly value: string;
|
|
18
|
+
/** Whether values compare ignoring ASCII case. */
|
|
19
|
+
readonly ignoreCase: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** An `An+B` position test (`:nth-child`, `:nth-of-type`, `:first-*`). */
|
|
22
|
+
export interface SelectorNthTest {
|
|
23
|
+
readonly kind: 'child' | 'of-type';
|
|
24
|
+
readonly a: number;
|
|
25
|
+
readonly b: number;
|
|
26
|
+
}
|
|
27
|
+
/** The compound inside `:not(...)` — a compound without negations of its own. */
|
|
28
|
+
export interface SelectorNegatedCompound {
|
|
29
|
+
/** Lower-cased tag name, or `null` for any element. */
|
|
30
|
+
readonly tag: string | null;
|
|
31
|
+
readonly attributes: readonly SelectorAttributeTest[];
|
|
32
|
+
readonly nth: readonly SelectorNthTest[];
|
|
33
|
+
}
|
|
34
|
+
/** A compound selector: every condition must hold on one element. */
|
|
35
|
+
export interface SelectorCompound extends SelectorNegatedCompound {
|
|
36
|
+
readonly negations: readonly SelectorNegatedCompound[];
|
|
37
|
+
}
|
|
38
|
+
/** One comma alternative of a selector list. */
|
|
39
|
+
export interface SelectorAlternative {
|
|
40
|
+
/** Compounds in source (ancestor-first) order; between 1 and 30. */
|
|
41
|
+
readonly compounds: readonly SelectorCompound[];
|
|
42
|
+
/** `combinators[j - 1]` joins `compounds[j - 1]` and `compounds[j]`. */
|
|
43
|
+
readonly combinators: readonly SelectorCombinator[];
|
|
44
|
+
/**
|
|
45
|
+
* Lower-cased printable-ASCII literals that must occur in the document in
|
|
46
|
+
* this order for the alternative to match, or `null` when none can be derived.
|
|
47
|
+
*/
|
|
48
|
+
readonly prefilterLiterals: readonly string[] | null;
|
|
49
|
+
/**
|
|
50
|
+
* Whether one start tag decides this alternative: a single compound with
|
|
51
|
+
* no position test whose attribute values have a single stored form.
|
|
52
|
+
*/
|
|
53
|
+
readonly direct: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** A validated selector list as the matcher evaluates it. */
|
|
56
|
+
export interface SelectorPlan {
|
|
57
|
+
readonly alternatives: readonly SelectorAlternative[];
|
|
58
|
+
/** Whether any alternative tests `:nth-child` / `:first-child`. */
|
|
59
|
+
readonly needsChildIndex: boolean;
|
|
60
|
+
/** Whether any alternative tests `:nth-of-type` / `:first-of-type`. */
|
|
61
|
+
readonly needsTypeIndex: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** The verdict on one document and which stages produced it. */
|
|
64
|
+
export interface HtmlMatchOutcome {
|
|
65
|
+
/** Whether an element of the document matches the selector list. */
|
|
66
|
+
readonly matched: boolean;
|
|
67
|
+
/** The ordered-literal prefilter rejected the document; its markup was never read. */
|
|
68
|
+
readonly prefiltered: boolean;
|
|
69
|
+
/** The open-element stack ran over the document. */
|
|
70
|
+
readonly tokenized: boolean;
|
|
71
|
+
/** Elements the stack tested (zero when it did not run). */
|
|
72
|
+
readonly elementsVisited: number;
|
|
73
|
+
}
|
|
74
|
+
/** One stored HTML snapshot as it sits in `page_html_blobs`. */
|
|
75
|
+
export interface StoredHtmlSnapshot {
|
|
76
|
+
/** The stored bytes. */
|
|
77
|
+
readonly body: Uint8Array;
|
|
78
|
+
/** `page_html_blobs.codec`: `zstd` or `none`; anything else is rejected. */
|
|
79
|
+
readonly codec: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* What `query search-html` looks for: a literal substring or a regular
|
|
83
|
+
* expression (Rust `regex` syntax) with its flags.
|
|
84
|
+
*/
|
|
85
|
+
export interface SearchPattern {
|
|
86
|
+
/** The literal text, or the regular expression's source. */
|
|
87
|
+
readonly source: string;
|
|
88
|
+
/** Match `source` as plain text; the flags are then ignored. */
|
|
89
|
+
readonly literal: boolean;
|
|
90
|
+
/** `i`. */
|
|
91
|
+
readonly ignoreCase: boolean;
|
|
92
|
+
/** `m`: `^` and `$` match at every `\n`. */
|
|
93
|
+
readonly multiLine: boolean;
|
|
94
|
+
/** `s`: `.` matches `\n` too. */
|
|
95
|
+
readonly dotAll: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** What a search found in one document. */
|
|
98
|
+
export interface SnapshotSearchOutcome {
|
|
99
|
+
/** Non-overlapping matches; 0 when the document does not match. */
|
|
100
|
+
readonly matchCount: number;
|
|
101
|
+
/** Whitespace-collapsed window around the first match; empty when there is none. */
|
|
102
|
+
readonly snippet: string;
|
|
103
|
+
}
|
|
104
|
+
/** The verdict on one snapshot of a batch. */
|
|
105
|
+
export interface SnapshotMatchOutcome {
|
|
106
|
+
readonly matched: boolean;
|
|
107
|
+
/** The ordered-literal prefilter rejected the document; its markup was never read. */
|
|
108
|
+
readonly prefiltered: boolean;
|
|
109
|
+
/** The open-element stack ran over the document. */
|
|
110
|
+
readonly tokenized: boolean;
|
|
111
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of the stored-HTML matcher, defined here so `@nitpicker/query` and
|
|
3
|
+
* the CLI never depend on `@nitpicker/core`'s own types. Each is structurally
|
|
4
|
+
* identical to its counterpart in core; the wrappers in this directory pass
|
|
5
|
+
* values across, so a drift fails to compile there.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SearchPattern } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compiles a `query search-html` pattern and reports whether it matches the
|
|
4
|
+
* empty string. The pattern is a literal, or a regular expression in the
|
|
5
|
+
* syntax of Rust's `regex` crate (no backreferences or look-around).
|
|
6
|
+
* @param pattern - The pattern and its flags.
|
|
7
|
+
* @returns Whether the pattern matches the empty string, which `search-html` rejects.
|
|
8
|
+
* @throws {Error} With code `InvalidArg` and the regex engine's message if the
|
|
9
|
+
* pattern is not valid, uses an unsupported construct, or is too large.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* validateSearchPattern({ source: 'a*', literal: false, ignoreCase: false, multiLine: false, dotAll: false }); // true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateSearchPattern(pattern: SearchPattern): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { validateSearchPattern as validateSearchPatternNatively } from '@nitpicker/core/validate-search-pattern';
|
|
2
|
+
/**
|
|
3
|
+
* Compiles a `query search-html` pattern and reports whether it matches the
|
|
4
|
+
* empty string. The pattern is a literal, or a regular expression in the
|
|
5
|
+
* syntax of Rust's `regex` crate (no backreferences or look-around).
|
|
6
|
+
* @param pattern - The pattern and its flags.
|
|
7
|
+
* @returns Whether the pattern matches the empty string, which `search-html` rejects.
|
|
8
|
+
* @throws {Error} With code `InvalidArg` and the regex engine's message if the
|
|
9
|
+
* pattern is not valid, uses an unsupported construct, or is too large.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* validateSearchPattern({ source: 'a*', literal: false, ignoreCase: false, multiLine: false, dotAll: false }); // true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export function validateSearchPattern(pattern) {
|
|
16
|
+
return validateSearchPatternNatively(pattern);
|
|
17
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Knex } from 'knex';
|
|
2
|
+
/**
|
|
3
|
+
* Initializes the archive database schema if tables do not exist.
|
|
4
|
+
*
|
|
5
|
+
* The schema is composed of five groups, each owned by a dedicated DDL
|
|
6
|
+
* function so the migration script (`scripts/migrate-to-0.13.mjs`) can
|
|
7
|
+
* provision the exact same shapes on archives it upgrades:
|
|
8
|
+
*
|
|
9
|
+
* - **`info`** (inline below): single-row crawl configuration.
|
|
10
|
+
* - **Ref / header dictionary tables** ({@link createRefTables}):
|
|
11
|
+
* `url_refs`, `content_type_refs`, `text_refs`, `json_refs`,
|
|
12
|
+
* `blob_refs`, `header_name_refs`, `header_value_refs`, `header_sets`,
|
|
13
|
+
* `header_set_entries`, `header_flags`. See that file for column-level
|
|
14
|
+
* rationale and the reason `blob_refs` uses a regular rowid PK instead
|
|
15
|
+
* of WITHOUT ROWID.
|
|
16
|
+
* - **Entity / edge tables** ({@link createEntityTables}):
|
|
17
|
+
* `content_items`, `page_meta`, `resource_items`, `anchor_edges`,
|
|
18
|
+
* `resource_ref_edges`, `image_items` — the write-model the crawler
|
|
19
|
+
* writes during a crawl and every reader queries. Must run AFTER
|
|
20
|
+
* `createRefTables` because most entity tables reference ref-table PKs.
|
|
21
|
+
* - **Adjunct tables** ({@link createAdjunctTables}): `page_errors`,
|
|
22
|
+
* `crawl_errors`, `technology_signals`, `page_technologies`, `page_jsonld`, `list_reconcile_runs`,
|
|
23
|
+
* `page_html_blobs` +
|
|
24
|
+
* `page_html_ref`. Must run AFTER `createEntityTables` because the
|
|
25
|
+
* page-scoped tables FK into `content_items(id)`.
|
|
26
|
+
* - **Template classification tables** ({@link createTemplateTables}):
|
|
27
|
+
* `page_templates`, `page_template_clusters`, `page_template_labels` —
|
|
28
|
+
* the crawl-end DOM-structure classification, kept apart from the
|
|
29
|
+
* adjunct tables because it has its own producer and write path.
|
|
30
|
+
*
|
|
31
|
+
* The legacy flat write-model tables (`pages` / `anchors` / `images` /
|
|
32
|
+
* `resources` / `resources-referrers`) are deliberately NOT created:
|
|
33
|
+
* they only exist inside pre-0.13 archives, where they serve as the
|
|
34
|
+
* populate source for `scripts/migrate-to-0.13.mjs` before that script
|
|
35
|
+
* drops them.
|
|
36
|
+
*
|
|
37
|
+
* **PRAGMA `page_size` and `journal_mode`** are set BEFORE any
|
|
38
|
+
* `CREATE TABLE` because SQLite only honors `page_size` changes against
|
|
39
|
+
* an empty database, and `journal_mode = WAL` is persistent. Other
|
|
40
|
+
* per-connection PRAGMAs live in {@link applyConnectionPragmas}.
|
|
41
|
+
*
|
|
42
|
+
* Pre-0.13 migration is intentionally absent. `assertCompatibleVersion`
|
|
43
|
+
* (called before `initSchema`) rejects older archives with a friendly
|
|
44
|
+
* error naming the migration scripts to run; `v0.x` policy allows
|
|
45
|
+
* breaking changes.
|
|
46
|
+
* @param instance - The Knex query builder instance connected to the database.
|
|
47
|
+
*/
|
|
48
|
+
export declare function initSchema(instance: Knex): Promise<void>;
|