@superbee/core 0.2.0-pre.3 → 0.2.0-pre.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1082 -0
- package/dist/artifact-contract.d.ts +90 -0
- package/dist/artifact-contract.d.ts.map +1 -0
- package/dist/artifact-contract.js +205 -0
- package/dist/artifact-contract.js.map +1 -0
- package/dist/backend.d.ts +19 -1
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +83 -36
- package/dist/backend.js.map +1 -1
- package/dist/blob-contract.d.ts +80 -0
- package/dist/blob-contract.d.ts.map +1 -0
- package/dist/blob-contract.js +131 -0
- package/dist/blob-contract.js.map +1 -0
- package/dist/blob-journal.d.ts +302 -0
- package/dist/blob-journal.d.ts.map +1 -0
- package/dist/blob-journal.js +540 -0
- package/dist/blob-journal.js.map +1 -0
- package/dist/body-replace-guards.d.ts +52 -0
- package/dist/body-replace-guards.d.ts.map +1 -0
- package/dist/body-replace-guards.js +176 -0
- package/dist/body-replace-guards.js.map +1 -0
- package/dist/builtin-recipes/content.d.ts +93 -0
- package/dist/builtin-recipes/content.d.ts.map +1 -0
- package/dist/builtin-recipes/content.js +288 -0
- package/dist/builtin-recipes/content.js.map +1 -0
- package/dist/builtin-recipes.d.ts +10 -0
- package/dist/builtin-recipes.d.ts.map +1 -0
- package/dist/builtin-recipes.js +97 -0
- package/dist/builtin-recipes.js.map +1 -0
- package/dist/bundle-health/index.d.ts +14 -0
- package/dist/bundle-health/index.d.ts.map +1 -0
- package/dist/bundle-health/index.js +12 -0
- package/dist/bundle-health/index.js.map +1 -0
- package/dist/bundle-health/kind-findings.d.ts +44 -0
- package/dist/bundle-health/kind-findings.d.ts.map +1 -0
- package/dist/bundle-health/kind-findings.js +68 -0
- package/dist/bundle-health/kind-findings.js.map +1 -0
- package/dist/bundle-health/legacy-page.d.ts +39 -0
- package/dist/bundle-health/legacy-page.d.ts.map +1 -0
- package/dist/bundle-health/legacy-page.js +50 -0
- package/dist/bundle-health/legacy-page.js.map +1 -0
- package/dist/bundle-health/report.d.ts +202 -0
- package/dist/bundle-health/report.d.ts.map +1 -0
- package/dist/bundle-health/report.js +438 -0
- package/dist/bundle-health/report.js.map +1 -0
- package/dist/bundle-ops.d.ts +1 -1
- package/dist/bundle-ops.d.ts.map +1 -1
- package/dist/bundle-ops.js +2 -2
- package/dist/bundle-ops.js.map +1 -1
- package/dist/bundle.d.ts +2 -1
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +3 -3
- package/dist/bundle.js.map +1 -1
- package/dist/code-point-order.d.ts +8 -0
- package/dist/code-point-order.d.ts.map +1 -0
- package/dist/code-point-order.js +20 -0
- package/dist/code-point-order.js.map +1 -0
- package/dist/connector-request.d.ts +87 -0
- package/dist/connector-request.d.ts.map +1 -0
- package/dist/connector-request.js +370 -0
- package/dist/connector-request.js.map +1 -0
- package/dist/connectors.d.ts +262 -0
- package/dist/connectors.d.ts.map +1 -0
- package/dist/connectors.js +1179 -0
- package/dist/connectors.js.map +1 -0
- package/dist/cross-bundle.d.ts +135 -0
- package/dist/cross-bundle.d.ts.map +1 -0
- package/dist/cross-bundle.js +186 -0
- package/dist/cross-bundle.js.map +1 -0
- package/dist/dependencies.d.ts +94 -0
- package/dist/dependencies.d.ts.map +1 -0
- package/dist/dependencies.js +180 -0
- package/dist/dependencies.js.map +1 -0
- package/dist/document-codec.d.ts +5 -1
- package/dist/document-codec.d.ts.map +1 -1
- package/dist/document-codec.js +7 -4
- package/dist/document-codec.js.map +1 -1
- package/dist/document-field-actions.d.ts +31 -1
- package/dist/document-field-actions.d.ts.map +1 -1
- package/dist/document-field-actions.js +137 -34
- package/dist/document-field-actions.js.map +1 -1
- package/dist/document-mutation.d.ts +22 -10
- package/dist/document-mutation.d.ts.map +1 -1
- package/dist/document-mutation.js +61 -27
- package/dist/document-mutation.js.map +1 -1
- package/dist/document-write-policy.d.ts.map +1 -1
- package/dist/document-write-policy.js +4 -2
- package/dist/document-write-policy.js.map +1 -1
- package/dist/domain-model.d.ts +73 -0
- package/dist/domain-model.d.ts.map +1 -0
- package/dist/domain-model.js +169 -0
- package/dist/domain-model.js.map +1 -0
- package/dist/engine.d.ts +16 -8
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +42 -4
- package/dist/engine.js.map +1 -1
- package/dist/file-journaled-backend-internal.d.ts +21 -0
- package/dist/file-journaled-backend-internal.d.ts.map +1 -0
- package/dist/file-journaled-backend-internal.js +12 -0
- package/dist/file-journaled-backend-internal.js.map +1 -0
- package/dist/file-journaled-backend.d.ts +160 -0
- package/dist/file-journaled-backend.d.ts.map +1 -0
- package/dist/file-journaled-backend.js +1345 -0
- package/dist/file-journaled-backend.js.map +1 -0
- package/dist/filesystem-host.d.ts +15 -0
- package/dist/filesystem-host.d.ts.map +1 -0
- package/dist/filesystem-host.js +20 -0
- package/dist/filesystem-host.js.map +1 -0
- package/dist/filesystem-identity.d.ts +86 -4
- package/dist/filesystem-identity.d.ts.map +1 -1
- package/dist/filesystem-identity.js +338 -102
- package/dist/filesystem-identity.js.map +1 -1
- package/dist/filesystem-lock.d.ts +16 -3
- package/dist/filesystem-lock.d.ts.map +1 -1
- package/dist/filesystem-lock.js +323 -77
- package/dist/filesystem-lock.js.map +1 -1
- package/dist/filesystem-push-role.d.ts +77 -0
- package/dist/filesystem-push-role.d.ts.map +1 -0
- package/dist/filesystem-push-role.js +165 -0
- package/dist/filesystem-push-role.js.map +1 -0
- package/dist/filesystem.d.ts +17 -0
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/filesystem.js +18 -0
- package/dist/filesystem.js.map +1 -0
- package/dist/governed-body-write.d.ts +106 -0
- package/dist/governed-body-write.d.ts.map +1 -0
- package/dist/governed-body-write.js +251 -0
- package/dist/governed-body-write.js.map +1 -0
- package/dist/host-policy-snapshot.d.ts +9 -0
- package/dist/host-policy-snapshot.d.ts.map +1 -0
- package/dist/host-policy-snapshot.js +33 -0
- package/dist/host-policy-snapshot.js.map +1 -0
- package/dist/host-text.d.ts +31 -0
- package/dist/host-text.d.ts.map +1 -0
- package/dist/host-text.js +77 -0
- package/dist/host-text.js.map +1 -0
- package/dist/hosted-client/binding.d.ts +7 -0
- package/dist/hosted-client/binding.d.ts.map +1 -0
- package/dist/hosted-client/binding.js +10 -0
- package/dist/hosted-client/binding.js.map +1 -0
- package/dist/hosted-client/blob-delivery.d.ts +67 -0
- package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
- package/dist/hosted-client/blob-delivery.js +169 -0
- package/dist/hosted-client/blob-delivery.js.map +1 -0
- package/dist/hosted-client/blob-write.d.ts +386 -0
- package/dist/hosted-client/blob-write.d.ts.map +1 -0
- package/dist/hosted-client/blob-write.js +770 -0
- package/dist/hosted-client/blob-write.js.map +1 -0
- package/dist/hosted-client/bundle-listing.d.ts +46 -0
- package/dist/hosted-client/bundle-listing.d.ts.map +1 -0
- package/dist/hosted-client/bundle-listing.js +36 -0
- package/dist/hosted-client/bundle-listing.js.map +1 -0
- package/dist/hosted-client/client.d.ts +219 -0
- package/dist/hosted-client/client.d.ts.map +1 -0
- package/dist/hosted-client/client.js +309 -0
- package/dist/hosted-client/client.js.map +1 -0
- package/dist/hosted-client/directory.d.ts +46 -0
- package/dist/hosted-client/directory.d.ts.map +1 -0
- package/dist/hosted-client/directory.js +74 -0
- package/dist/hosted-client/directory.js.map +1 -0
- package/dist/hosted-client/errors.d.ts +26 -0
- package/dist/hosted-client/errors.d.ts.map +1 -0
- package/dist/hosted-client/errors.js +35 -0
- package/dist/hosted-client/errors.js.map +1 -0
- package/dist/hosted-client/inbox.d.ts +320 -0
- package/dist/hosted-client/inbox.d.ts.map +1 -0
- package/dist/hosted-client/inbox.js +379 -0
- package/dist/hosted-client/inbox.js.map +1 -0
- package/dist/hosted-client/index.d.ts +30 -0
- package/dist/hosted-client/index.d.ts.map +1 -0
- package/dist/hosted-client/index.js +32 -0
- package/dist/hosted-client/index.js.map +1 -0
- package/dist/hosted-client/journal.d.ts +103 -0
- package/dist/hosted-client/journal.d.ts.map +1 -0
- package/dist/hosted-client/journal.js +464 -0
- package/dist/hosted-client/journal.js.map +1 -0
- package/dist/hosted-client/node.d.ts +74 -0
- package/dist/hosted-client/node.d.ts.map +1 -0
- package/dist/hosted-client/node.js +219 -0
- package/dist/hosted-client/node.js.map +1 -0
- package/dist/hosted-client/reference.d.ts +12 -0
- package/dist/hosted-client/reference.d.ts.map +1 -0
- package/dist/hosted-client/reference.js +29 -0
- package/dist/hosted-client/reference.js.map +1 -0
- package/dist/hosted-client/write.d.ts +217 -0
- package/dist/hosted-client/write.d.ts.map +1 -0
- package/dist/hosted-client/write.js +418 -0
- package/dist/hosted-client/write.js.map +1 -0
- package/dist/hosted-transport/answer-rows.d.ts +243 -0
- package/dist/hosted-transport/answer-rows.d.ts.map +1 -0
- package/dist/hosted-transport/answer-rows.js +454 -0
- package/dist/hosted-transport/answer-rows.js.map +1 -0
- package/dist/hosted-transport/blob-reads.d.ts +35 -0
- package/dist/hosted-transport/blob-reads.d.ts.map +1 -0
- package/dist/hosted-transport/blob-reads.js +179 -0
- package/dist/hosted-transport/blob-reads.js.map +1 -0
- package/dist/hosted-transport/blob-write.d.ts +34 -0
- package/dist/hosted-transport/blob-write.d.ts.map +1 -0
- package/dist/hosted-transport/blob-write.js +115 -0
- package/dist/hosted-transport/blob-write.js.map +1 -0
- package/dist/hosted-transport/carrier.d.ts +151 -0
- package/dist/hosted-transport/carrier.d.ts.map +1 -0
- package/dist/hosted-transport/carrier.js +260 -0
- package/dist/hosted-transport/carrier.js.map +1 -0
- package/dist/hosted-transport/history-pages.d.ts +55 -0
- package/dist/hosted-transport/history-pages.d.ts.map +1 -0
- package/dist/hosted-transport/history-pages.js +69 -0
- package/dist/hosted-transport/history-pages.js.map +1 -0
- package/dist/hosted-transport/index.d.ts +18 -0
- package/dist/hosted-transport/index.d.ts.map +1 -0
- package/dist/hosted-transport/index.js +18 -0
- package/dist/hosted-transport/index.js.map +1 -0
- package/dist/hosted-transport/operations.d.ts +85 -0
- package/dist/hosted-transport/operations.d.ts.map +1 -0
- package/dist/hosted-transport/operations.js +128 -0
- package/dist/hosted-transport/operations.js.map +1 -0
- package/dist/hosted-transport/paged-reads.d.ts +87 -0
- package/dist/hosted-transport/paged-reads.d.ts.map +1 -0
- package/dist/hosted-transport/paged-reads.js +238 -0
- package/dist/hosted-transport/paged-reads.js.map +1 -0
- package/dist/hosted-transport/read-adapter.d.ts +256 -0
- package/dist/hosted-transport/read-adapter.d.ts.map +1 -0
- package/dist/hosted-transport/read-adapter.js +568 -0
- package/dist/hosted-transport/read-adapter.js.map +1 -0
- package/dist/hosted-transport/root-write.d.ts +114 -0
- package/dist/hosted-transport/root-write.d.ts.map +1 -0
- package/dist/hosted-transport/root-write.js +171 -0
- package/dist/hosted-transport/root-write.js.map +1 -0
- package/dist/hosted-transport/whole-document-transport.d.ts +204 -0
- package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -0
- package/dist/hosted-transport/whole-document-transport.js +447 -0
- package/dist/hosted-transport/whole-document-transport.js.map +1 -0
- package/dist/index.d.ts +34 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -8
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-backend.d.ts +28 -37
- package/dist/indexeddb-backend.d.ts.map +1 -1
- package/dist/indexeddb-backend.js +467 -113
- package/dist/indexeddb-backend.js.map +1 -1
- package/dist/journaled-backend.d.ts +232 -15
- package/dist/journaled-backend.d.ts.map +1 -1
- package/dist/journaled-backend.js +254 -55
- package/dist/journaled-backend.js.map +1 -1
- package/dist/kind-authoring.d.ts +170 -0
- package/dist/kind-authoring.d.ts.map +1 -0
- package/dist/kind-authoring.js +451 -0
- package/dist/kind-authoring.js.map +1 -0
- package/dist/kind-conformance-error.d.ts +15 -0
- package/dist/kind-conformance-error.d.ts.map +1 -0
- package/dist/kind-conformance-error.js +20 -0
- package/dist/kind-conformance-error.js.map +1 -0
- package/dist/kind-coverage.d.ts +99 -0
- package/dist/kind-coverage.d.ts.map +1 -0
- package/dist/kind-coverage.js +186 -0
- package/dist/kind-coverage.js.map +1 -0
- package/dist/kind-field-mutation.d.ts +4 -0
- package/dist/kind-field-mutation.d.ts.map +1 -1
- package/dist/kind-field-mutation.js +28 -3
- package/dist/kind-field-mutation.js.map +1 -1
- package/dist/kinds-load.js +4 -4
- package/dist/kinds-load.js.map +1 -1
- package/dist/kinds.d.ts +65 -2
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +341 -21
- package/dist/kinds.js.map +1 -1
- package/dist/link-types.d.ts +26 -0
- package/dist/link-types.d.ts.map +1 -0
- package/dist/link-types.js +57 -0
- package/dist/link-types.js.map +1 -0
- package/dist/links.d.ts +21 -3
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +213 -14
- package/dist/links.js.map +1 -1
- package/dist/managed-document-metadata.d.ts +2 -0
- package/dist/managed-document-metadata.d.ts.map +1 -0
- package/dist/managed-document-metadata.js +9 -0
- package/dist/managed-document-metadata.js.map +1 -0
- package/dist/memory-backend.d.ts.map +1 -1
- package/dist/memory-backend.js +6 -2
- package/dist/memory-backend.js.map +1 -1
- package/dist/paths.d.ts +16 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +25 -0
- package/dist/paths.js.map +1 -1
- package/dist/platform.d.ts +13 -2
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +16 -0
- package/dist/platform.js.map +1 -1
- package/dist/portable-export.d.ts +119 -0
- package/dist/portable-export.d.ts.map +1 -0
- package/dist/portable-export.js +501 -0
- package/dist/portable-export.js.map +1 -0
- package/dist/publication-filesystem.d.ts +1 -1
- package/dist/publication-filesystem.d.ts.map +1 -1
- package/dist/publication-filesystem.js +1 -1
- package/dist/publication-filesystem.js.map +1 -1
- package/dist/qualified-links.d.ts +67 -0
- package/dist/qualified-links.d.ts.map +1 -0
- package/dist/qualified-links.js +117 -0
- package/dist/qualified-links.js.map +1 -0
- package/dist/query-filter.d.ts +16 -2
- package/dist/query-filter.d.ts.map +1 -1
- package/dist/query-filter.js +40 -1
- package/dist/query-filter.js.map +1 -1
- package/dist/query-order.d.ts +22 -0
- package/dist/query-order.d.ts.map +1 -0
- package/dist/query-order.js +42 -0
- package/dist/query-order.js.map +1 -0
- package/dist/recipe-lifecycle/errors.d.ts +96 -0
- package/dist/recipe-lifecycle/errors.d.ts.map +1 -0
- package/dist/recipe-lifecycle/errors.js +122 -0
- package/dist/recipe-lifecycle/errors.js.map +1 -0
- package/dist/recipe-lifecycle/evolution.d.ts +112 -0
- package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
- package/dist/recipe-lifecycle/evolution.js +941 -0
- package/dist/recipe-lifecycle/evolution.js.map +1 -0
- package/dist/recipe-lifecycle/index.d.ts +30 -0
- package/dist/recipe-lifecycle/index.d.ts.map +1 -0
- package/dist/recipe-lifecycle/index.js +26 -0
- package/dist/recipe-lifecycle/index.js.map +1 -0
- package/dist/recipe-lifecycle/install.d.ts +155 -0
- package/dist/recipe-lifecycle/install.d.ts.map +1 -0
- package/dist/recipe-lifecycle/install.js +594 -0
- package/dist/recipe-lifecycle/install.js.map +1 -0
- package/dist/recipe-lifecycle/legacy-aliases.d.ts +16 -0
- package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
- package/dist/recipe-lifecycle/legacy-aliases.js +51 -0
- package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -0
- package/dist/recipe-lifecycle/stamp.d.ts +151 -0
- package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
- package/dist/recipe-lifecycle/stamp.js +364 -0
- package/dist/recipe-lifecycle/stamp.js.map +1 -0
- package/dist/recipes.d.ts +29 -1
- package/dist/recipes.d.ts.map +1 -1
- package/dist/recipes.js +137 -1
- package/dist/recipes.js.map +1 -1
- package/dist/record-overlay/apply.d.ts +43 -0
- package/dist/record-overlay/apply.d.ts.map +1 -0
- package/dist/record-overlay/apply.js +527 -0
- package/dist/record-overlay/apply.js.map +1 -0
- package/dist/record-overlay/canonical.d.ts +22 -0
- package/dist/record-overlay/canonical.d.ts.map +1 -0
- package/dist/record-overlay/canonical.js +47 -0
- package/dist/record-overlay/canonical.js.map +1 -0
- package/dist/record-overlay/digest.d.ts +4 -0
- package/dist/record-overlay/digest.d.ts.map +1 -0
- package/dist/record-overlay/digest.js +11 -0
- package/dist/record-overlay/digest.js.map +1 -0
- package/dist/record-overlay/errors.d.ts +44 -0
- package/dist/record-overlay/errors.d.ts.map +1 -0
- package/dist/record-overlay/errors.js +55 -0
- package/dist/record-overlay/errors.js.map +1 -0
- package/dist/record-overlay/findings.d.ts +5 -0
- package/dist/record-overlay/findings.d.ts.map +1 -0
- package/dist/record-overlay/findings.js +83 -0
- package/dist/record-overlay/findings.js.map +1 -0
- package/dist/record-overlay/index.d.ts +23 -0
- package/dist/record-overlay/index.d.ts.map +1 -0
- package/dist/record-overlay/index.js +21 -0
- package/dist/record-overlay/index.js.map +1 -0
- package/dist/record-overlay/plan.d.ts +12 -0
- package/dist/record-overlay/plan.d.ts.map +1 -0
- package/dist/record-overlay/plan.js +285 -0
- package/dist/record-overlay/plan.js.map +1 -0
- package/dist/record-overlay/policy.d.ts +69 -0
- package/dist/record-overlay/policy.d.ts.map +1 -0
- package/dist/record-overlay/policy.js +228 -0
- package/dist/record-overlay/policy.js.map +1 -0
- package/dist/record-overlay/redact.d.ts +3 -0
- package/dist/record-overlay/redact.d.ts.map +1 -0
- package/dist/record-overlay/redact.js +27 -0
- package/dist/record-overlay/redact.js.map +1 -0
- package/dist/record-overlay/signal-kind.d.ts +30 -0
- package/dist/record-overlay/signal-kind.d.ts.map +1 -0
- package/dist/record-overlay/signal-kind.js +38 -0
- package/dist/record-overlay/signal-kind.js.map +1 -0
- package/dist/record-overlay/signal-text.d.ts +45 -0
- package/dist/record-overlay/signal-text.d.ts.map +1 -0
- package/dist/record-overlay/signal-text.js +116 -0
- package/dist/record-overlay/signal-text.js.map +1 -0
- package/dist/record-overlay/source-index.d.ts +19 -0
- package/dist/record-overlay/source-index.d.ts.map +1 -0
- package/dist/record-overlay/source-index.js +102 -0
- package/dist/record-overlay/source-index.js.map +1 -0
- package/dist/record-overlay/types.d.ts +291 -0
- package/dist/record-overlay/types.d.ts.map +1 -0
- package/dist/record-overlay/types.js +2 -0
- package/dist/record-overlay/types.js.map +1 -0
- package/dist/remote-backend.d.ts +67 -67
- package/dist/remote-backend.d.ts.map +1 -1
- package/dist/remote-backend.js +168 -201
- package/dist/remote-backend.js.map +1 -1
- package/dist/remote-document-codec.d.ts +2 -1
- package/dist/remote-document-codec.d.ts.map +1 -1
- package/dist/remote-document-codec.js +3 -2
- package/dist/remote-document-codec.js.map +1 -1
- package/dist/remote-error.d.ts +38 -0
- package/dist/remote-error.d.ts.map +1 -0
- package/dist/remote-error.js +59 -0
- package/dist/remote-error.js.map +1 -0
- package/dist/remote-operations.d.ts +0 -40
- package/dist/remote-operations.d.ts.map +1 -1
- package/dist/remote-operations.js +26 -6
- package/dist/remote-operations.js.map +1 -1
- package/dist/remote-parsers.d.ts +86 -0
- package/dist/remote-parsers.d.ts.map +1 -0
- package/dist/remote-parsers.js +181 -0
- package/dist/remote-parsers.js.map +1 -0
- package/dist/remote.d.ts +5 -2
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +5 -1
- package/dist/remote.js.map +1 -1
- package/dist/search/backend-source.d.ts +6 -0
- package/dist/search/backend-source.d.ts.map +1 -0
- package/dist/search/backend-source.js +33 -0
- package/dist/search/backend-source.js.map +1 -0
- package/dist/search/contract.d.ts +151 -0
- package/dist/search/contract.d.ts.map +1 -0
- package/dist/search/contract.js +78 -0
- package/dist/search/contract.js.map +1 -0
- package/dist/search/errors.d.ts +30 -0
- package/dist/search/errors.d.ts.map +1 -0
- package/dist/search/errors.js +50 -0
- package/dist/search/errors.js.map +1 -0
- package/dist/search/identity.d.ts +12 -0
- package/dist/search/identity.d.ts.map +1 -0
- package/dist/search/identity.js +90 -0
- package/dist/search/identity.js.map +1 -0
- package/dist/search/index.d.ts +16 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +15 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/memory-source.d.ts +36 -0
- package/dist/search/memory-source.d.ts.map +1 -0
- package/dist/search/memory-source.js +235 -0
- package/dist/search/memory-source.js.map +1 -0
- package/dist/search/rank.d.ts +34 -0
- package/dist/search/rank.d.ts.map +1 -0
- package/dist/search/rank.js +129 -0
- package/dist/search/rank.js.map +1 -0
- package/dist/search/row-text.d.ts +38 -0
- package/dist/search/row-text.d.ts.map +1 -0
- package/dist/search/row-text.js +88 -0
- package/dist/search/row-text.js.map +1 -0
- package/dist/search/search.d.ts +28 -0
- package/dist/search/search.d.ts.map +1 -0
- package/dist/search/search.js +257 -0
- package/dist/search/search.js.map +1 -0
- package/dist/search/source.d.ts +67 -0
- package/dist/search/source.d.ts.map +1 -0
- package/dist/search/source.js +2 -0
- package/dist/search/source.js.map +1 -0
- package/dist/search/text.d.ts +47 -0
- package/dist/search/text.d.ts.map +1 -0
- package/dist/search/text.js +150 -0
- package/dist/search/text.js.map +1 -0
- package/dist/site-capabilities.d.ts +345 -0
- package/dist/site-capabilities.d.ts.map +1 -0
- package/dist/site-capabilities.js +724 -0
- package/dist/site-capabilities.js.map +1 -0
- package/dist/source-engine/guard.d.ts +78 -0
- package/dist/source-engine/guard.d.ts.map +1 -0
- package/dist/source-engine/guard.js +423 -0
- package/dist/source-engine/guard.js.map +1 -0
- package/dist/source-engine/index.d.ts +26 -0
- package/dist/source-engine/index.d.ts.map +1 -0
- package/dist/source-engine/index.js +21 -0
- package/dist/source-engine/index.js.map +1 -0
- package/dist/source-engine/machine-state.d.ts +74 -0
- package/dist/source-engine/machine-state.d.ts.map +1 -0
- package/dist/source-engine/machine-state.js +48 -0
- package/dist/source-engine/machine-state.js.map +1 -0
- package/dist/source-engine/observe.d.ts +18 -0
- package/dist/source-engine/observe.d.ts.map +1 -0
- package/dist/source-engine/observe.js +620 -0
- package/dist/source-engine/observe.js.map +1 -0
- package/dist/source-engine/overlay.d.ts +49 -0
- package/dist/source-engine/overlay.d.ts.map +1 -0
- package/dist/source-engine/overlay.js +114 -0
- package/dist/source-engine/overlay.js.map +1 -0
- package/dist/source-engine/robots.d.ts +53 -0
- package/dist/source-engine/robots.d.ts.map +1 -0
- package/dist/source-engine/robots.js +158 -0
- package/dist/source-engine/robots.js.map +1 -0
- package/dist/source-engine/types.d.ts +287 -0
- package/dist/source-engine/types.d.ts.map +1 -0
- package/dist/source-engine/types.js +2 -0
- package/dist/source-engine/types.js.map +1 -0
- package/dist/source-harness/conformance.d.ts +16 -0
- package/dist/source-harness/conformance.d.ts.map +1 -0
- package/dist/source-harness/conformance.js +266 -0
- package/dist/source-harness/conformance.js.map +1 -0
- package/dist/source-harness/fixture.d.ts +95 -0
- package/dist/source-harness/fixture.d.ts.map +1 -0
- package/dist/source-harness/fixture.js +273 -0
- package/dist/source-harness/fixture.js.map +1 -0
- package/dist/source-harness/index.d.ts +22 -0
- package/dist/source-harness/index.d.ts.map +1 -0
- package/dist/source-harness/index.js +19 -0
- package/dist/source-harness/index.js.map +1 -0
- package/dist/source-harness/peer.d.ts +74 -0
- package/dist/source-harness/peer.d.ts.map +1 -0
- package/dist/source-harness/peer.js +106 -0
- package/dist/source-harness/peer.js.map +1 -0
- package/dist/source-profiles/index.d.ts +31 -0
- package/dist/source-profiles/index.d.ts.map +1 -0
- package/dist/source-profiles/index.js +206 -0
- package/dist/source-profiles/index.js.map +1 -0
- package/dist/source-profiles/link-header.d.ts +6 -0
- package/dist/source-profiles/link-header.d.ts.map +1 -0
- package/dist/source-profiles/link-header.js +131 -0
- package/dist/source-profiles/link-header.js.map +1 -0
- package/dist/storage.d.ts +6 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +4 -1
- package/dist/storage.js.map +1 -1
- package/dist/types.d.ts +38 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -10
- package/dist/types.js.map +1 -1
- package/dist/uncertain-write.d.ts +161 -19
- package/dist/uncertain-write.d.ts.map +1 -1
- package/dist/uncertain-write.js +90 -31
- package/dist/uncertain-write.js.map +1 -1
- package/dist/versioning.d.ts +9 -4
- package/dist/versioning.d.ts.map +1 -1
- package/dist/versioning.js +9 -4
- package/dist/versioning.js.map +1 -1
- package/dist/write-identity.d.ts +5 -0
- package/dist/write-identity.d.ts.map +1 -0
- package/dist/write-identity.js +9 -0
- package/dist/write-identity.js.map +1 -0
- package/package.json +103 -2
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client side of the wire's heads and snapshot grammar (`docs/WIRE-PROTOCOL.md`, "Heads and
|
|
3
|
+
* snapshot"): what a heads answer must carry before its rows may be diffed as deletions, and
|
|
4
|
+
* how a snapshot body is read so that iterating it to completion is the completeness signal.
|
|
5
|
+
* {@link RemoteBackend.heads} and {@link RemoteBackend.snapshot} are thin callers over these
|
|
6
|
+
* two functions; a host that serves the same grammar through routes of its own validates the
|
|
7
|
+
* answers with the same functions rather than a second parser, since this grammar decides what
|
|
8
|
+
* a working copy deletes locally.
|
|
9
|
+
*
|
|
10
|
+
* Only `TextDecoder` and the Web Streams reader are used, so the same code runs in a browser, a
|
|
11
|
+
* Worker, and Node.
|
|
12
|
+
*/
|
|
13
|
+
import { headsDigest, isHeadsDigest } from "./heads-digest.js";
|
|
14
|
+
import { RemoteError, malformed } from "./remote-error.js";
|
|
15
|
+
/** A snapshot body that ended, or failed, before its terminator arrived with the announced count. */
|
|
16
|
+
export const SNAPSHOT_TRUNCATED = "SNAPSHOT_TRUNCATED";
|
|
17
|
+
/**
|
|
18
|
+
* A snapshot whose body arrived whole, with its terminator and the announced count, but whose
|
|
19
|
+
* rows digest to something other than the header announced. Not truncation: re-requesting will
|
|
20
|
+
* not necessarily repair it, since the authority contradicted itself. A consumer discards the
|
|
21
|
+
* documents' claim to the header digest either way.
|
|
22
|
+
*/
|
|
23
|
+
export const SNAPSHOT_DIGEST_MISMATCH = "SNAPSHOT_DIGEST_MISMATCH";
|
|
24
|
+
function isDocumentHead(value) {
|
|
25
|
+
if (typeof value !== "object" || value === null)
|
|
26
|
+
return false;
|
|
27
|
+
const head = value;
|
|
28
|
+
return typeof head.id === "string" && typeof head.version === "string";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The `200` body of `GET /heads`, admitted or refused as one: a well-formed digest, a `heads`
|
|
32
|
+
* array of `{ id, version }` rows, a `count` equal to the number of rows, and rows that digest
|
|
33
|
+
* by the documented recipe to the digest served. Anything else rejects as malformed (a
|
|
34
|
+
* {@link MalformedAnswer}, code `MALFORMED_ANSWER`) rather than being trusted. The
|
|
35
|
+
* recomputation is what stops a listing that is whole by its own count but not the state its
|
|
36
|
+
* digest names (a shortened listing under the real digest) from being diffed as a mass
|
|
37
|
+
* deletion. Rows keep the order served: the recipe sorts for itself, so order does not decide
|
|
38
|
+
* admission.
|
|
39
|
+
*/
|
|
40
|
+
export function parseHeadsAnswer(payload) {
|
|
41
|
+
const answer = payload;
|
|
42
|
+
if (!isHeadsDigest(answer?.digest))
|
|
43
|
+
throw malformed("wire heads answered without a well-formed digest");
|
|
44
|
+
if (!Array.isArray(answer.heads) || !answer.heads.every(isDocumentHead)) {
|
|
45
|
+
throw malformed("wire heads answered without a heads array of { id, version } rows");
|
|
46
|
+
}
|
|
47
|
+
if (answer.count !== answer.heads.length) {
|
|
48
|
+
throw malformed(`wire heads count ${String(answer.count)} disagrees with its ${answer.heads.length} row(s)`);
|
|
49
|
+
}
|
|
50
|
+
const heads = answer.heads.map(({ id, version }) => ({ id, version }));
|
|
51
|
+
const recomputed = headsDigest(heads);
|
|
52
|
+
if (recomputed !== answer.digest) {
|
|
53
|
+
throw malformed(`wire heads served digest ${answer.digest}, but its ${heads.length} row(s) digest to ${recomputed}`);
|
|
54
|
+
}
|
|
55
|
+
return { digest: answer.digest, heads };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Split a response body into its NDJSON lines as they arrive, decoding UTF-8 across chunk
|
|
59
|
+
* boundaries. A partial trailing line at the end of the body is a cut line and is not yielded; a
|
|
60
|
+
* transport failure while reading is reported as truncation, since either way the terminator
|
|
61
|
+
* never arrived. Leaving the loop early cancels the reader so the connection is released.
|
|
62
|
+
*/
|
|
63
|
+
async function* ndjsonLines(body, status) {
|
|
64
|
+
const reader = body.getReader();
|
|
65
|
+
const decoder = new TextDecoder();
|
|
66
|
+
let buffered = "";
|
|
67
|
+
try {
|
|
68
|
+
for (;;) {
|
|
69
|
+
let chunk;
|
|
70
|
+
try {
|
|
71
|
+
chunk = await reader.read();
|
|
72
|
+
}
|
|
73
|
+
catch (cause) {
|
|
74
|
+
throw new RemoteError("snapshot body failed before its end line arrived", SNAPSHOT_TRUNCATED, status, cause);
|
|
75
|
+
}
|
|
76
|
+
buffered += decoder.decode(chunk.value, { stream: !chunk.done });
|
|
77
|
+
let start = 0;
|
|
78
|
+
for (let newline = buffered.indexOf("\n"); newline !== -1; newline = buffered.indexOf("\n", start)) {
|
|
79
|
+
yield buffered.slice(start, newline);
|
|
80
|
+
start = newline + 1;
|
|
81
|
+
}
|
|
82
|
+
buffered = buffered.slice(start);
|
|
83
|
+
if (chunk.done)
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
await reader.cancel().catch(() => undefined);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function parseSnapshotLine(line) {
|
|
92
|
+
let record;
|
|
93
|
+
try {
|
|
94
|
+
record = JSON.parse(line);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
throw malformed("snapshot line is not JSON");
|
|
98
|
+
}
|
|
99
|
+
if (typeof record !== "object" || record === null)
|
|
100
|
+
throw malformed("snapshot line is not a JSON object");
|
|
101
|
+
return record;
|
|
102
|
+
}
|
|
103
|
+
function parseSnapshotHeader(line) {
|
|
104
|
+
const record = parseSnapshotLine(line);
|
|
105
|
+
if (record.kind !== "snapshot")
|
|
106
|
+
throw malformed("snapshot did not begin with its header line");
|
|
107
|
+
if (typeof record.count !== "number" || !Number.isInteger(record.count) || record.count < 0) {
|
|
108
|
+
throw malformed("snapshot header carries no document count");
|
|
109
|
+
}
|
|
110
|
+
if (!isHeadsDigest(record.digest))
|
|
111
|
+
throw malformed("snapshot header carries no well-formed digest");
|
|
112
|
+
return { count: record.count, digest: record.digest };
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The document lines of a snapshot, ending normally only at an `end` line whose count equals
|
|
116
|
+
* both the header's announcement and the documents actually seen, and only when the digest
|
|
117
|
+
* recomputed over the received heads equals the header's. Anything else is a rejection: a body
|
|
118
|
+
* that ends first is `SNAPSHOT_TRUNCATED`; a whole body whose heads digest differently is
|
|
119
|
+
* `SNAPSHOT_DIGEST_MISMATCH`; a line the contract does not admit is malformed. The digest is the
|
|
120
|
+
* client's own check of the listing it is about to trust: a count and a terminator say the body
|
|
121
|
+
* is whole, only the recipe says it is the state the header named.
|
|
122
|
+
*/
|
|
123
|
+
async function* snapshotDocuments(lines, header, status) {
|
|
124
|
+
let seen = 0;
|
|
125
|
+
const received = [];
|
|
126
|
+
for await (const line of lines) {
|
|
127
|
+
const record = parseSnapshotLine(line);
|
|
128
|
+
if (record.kind === "doc") {
|
|
129
|
+
if (typeof record.id !== "string" || typeof record.version !== "string" || typeof record.body !== "string") {
|
|
130
|
+
throw malformed("snapshot doc line lacks id, version, or body");
|
|
131
|
+
}
|
|
132
|
+
if (typeof record.frontmatter !== "object" || record.frontmatter === null || Array.isArray(record.frontmatter)) {
|
|
133
|
+
throw malformed("snapshot doc line lacks a frontmatter object");
|
|
134
|
+
}
|
|
135
|
+
seen += 1;
|
|
136
|
+
if (seen > header.count)
|
|
137
|
+
throw malformed(`snapshot delivered more than the ${header.count} announced document(s)`);
|
|
138
|
+
received.push({ id: record.id, version: record.version });
|
|
139
|
+
yield { id: record.id, version: record.version, frontmatter: record.frontmatter, body: record.body };
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (record.kind === "end") {
|
|
143
|
+
if (record.count !== seen || seen !== header.count) {
|
|
144
|
+
throw new RemoteError(`snapshot end line counts ${String(record.count)} document(s), but ${seen} of ${header.count} announced arrived`, SNAPSHOT_TRUNCATED, status);
|
|
145
|
+
}
|
|
146
|
+
const recomputed = headsDigest(received);
|
|
147
|
+
if (recomputed !== header.digest) {
|
|
148
|
+
throw new RemoteError(`snapshot header announced digest ${header.digest}, but its ${seen} document(s) digest to ${recomputed}`, SNAPSHOT_DIGEST_MISMATCH, status);
|
|
149
|
+
}
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
throw malformed(`snapshot line has unexpected kind ${JSON.stringify(record.kind)}`);
|
|
153
|
+
}
|
|
154
|
+
throw new RemoteError(`snapshot ended after ${seen} of ${header.count} document(s) without its end line`, SNAPSHOT_TRUNCATED, status);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Read a `GET /snapshot` body by the documented grammar. The header line is parsed before this
|
|
158
|
+
* resolves, so a body that ends before it rejects here with `SNAPSHOT_TRUNCATED` and a first
|
|
159
|
+
* line that is not the header rejects as malformed; the documents then stream through
|
|
160
|
+
* {@link RemoteSnapshot.docs}, which ends normally only for a whole body whose rows digest to
|
|
161
|
+
* the header's announcement (see {@link RemoteSnapshot}). Obtaining the response, checking its
|
|
162
|
+
* status, and re-requesting a truncated snapshot are the caller's: this function reads one body
|
|
163
|
+
* once and cancels the reader when the iteration is abandoned or fails.
|
|
164
|
+
*/
|
|
165
|
+
export async function readSnapshotStream(body, options = {}) {
|
|
166
|
+
const status = options.status ?? 200;
|
|
167
|
+
const lines = ndjsonLines(body, status);
|
|
168
|
+
const first = await lines.next();
|
|
169
|
+
if (first.done)
|
|
170
|
+
throw new RemoteError("snapshot ended before its header line", SNAPSHOT_TRUNCATED, status);
|
|
171
|
+
let header;
|
|
172
|
+
try {
|
|
173
|
+
header = parseSnapshotHeader(first.value);
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
await lines.return(undefined);
|
|
177
|
+
throw err;
|
|
178
|
+
}
|
|
179
|
+
return { header, docs: snapshotDocuments(lines, header, status) };
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=remote-parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-parsers.js","sourceRoot":"","sources":["../src/remote-parsers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAqB,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG3D,qGAAqG;AACrG,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAgDnE,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,IAAI,GAAG,KAA4C,CAAC;IAC1D,OAAO,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC;AACzE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,MAAM,GAAG,OAAwE,CAAC;IACxF,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;QAAE,MAAM,SAAS,CAAC,kDAAkD,CAAC,CAAC;IACxG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;QACxE,MAAM,SAAS,CAAC,mEAAmE,CAAC,CAAC;IACvF,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,KAA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IAAgC,EAAE,UAAqC,EAAE;IAChH,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC;IACrC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,KAAK,CAAC,IAAI;QAAE,MAAM,IAAI,WAAW,CAAC,uCAAuC,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC;IAC3G,IAAI,MAAsB,CAAC;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC9B,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;AACpE,CAAC"}
|
package/dist/remote.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/** Browser-safe client adapter for the Superbee wire protocol. */
|
|
2
|
-
export { RemoteBackend
|
|
3
|
-
export type { FetchLike, HeadsOptions,
|
|
2
|
+
export { RemoteBackend } from "./remote-backend.js";
|
|
3
|
+
export type { FetchLike, HeadsOptions, RemoteBackendOptions, WireCapabilities } from "./remote-backend.js";
|
|
4
|
+
export { RemoteError } from "./remote-error.js";
|
|
5
|
+
export { SNAPSHOT_DIGEST_MISMATCH, SNAPSHOT_TRUNCATED, parseHeadsAnswer, readSnapshotStream } from "./remote-parsers.js";
|
|
6
|
+
export type { HeadsResult, ReadSnapshotStreamOptions, RemoteSnapshot, SnapshotDocument, SnapshotHeader } from "./remote-parsers.js";
|
|
4
7
|
export { headsDigest, isHeadsDigest, sortHeads } from "./heads-digest.js";
|
|
5
8
|
export type { DocumentHead } from "./heads-digest.js";
|
|
6
9
|
//# sourceMappingURL=remote.d.ts.map
|
package/dist/remote.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzH,YAAY,EAAE,WAAW,EAAE,yBAAyB,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpI,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/remote.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/** Browser-safe client adapter for the Superbee wire protocol. */
|
|
2
|
-
export { RemoteBackend
|
|
2
|
+
export { RemoteBackend } from "./remote-backend.js";
|
|
3
|
+
export { RemoteError } from "./remote-error.js";
|
|
4
|
+
// The heads and snapshot grammar's reference validators, for a host that serves the same grammar
|
|
5
|
+
// through routes of its own; `RemoteBackend.heads` and `RemoteBackend.snapshot` call these.
|
|
6
|
+
export { SNAPSHOT_DIGEST_MISMATCH, SNAPSHOT_TRUNCATED, parseHeadsAnswer, readSnapshotStream } from "./remote-parsers.js";
|
|
3
7
|
export { headsDigest, isHeadsDigest, sortHeads } from "./heads-digest.js";
|
|
4
8
|
//# sourceMappingURL=remote.js.map
|
package/dist/remote.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,iGAAiG;AACjG,4FAA4F;AAC5F,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StorageBackend } from "../types.js";
|
|
2
|
+
import { type MemorySearchSourceOptionsV1, type MemorySearchSourceV1 } from "./memory-source.js";
|
|
3
|
+
/** Read a complete backend corpus in bounded batches. Failed reads refuse the whole search;
|
|
4
|
+
* the cursor key describes the versions actually read, including unsent working-copy edits. */
|
|
5
|
+
export declare function searchSourceFromBackend(backend: StorageBackend, options?: Omit<MemorySearchSourceOptionsV1, "key">): Promise<MemorySearchSourceV1>;
|
|
6
|
+
//# sourceMappingURL=backend-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend-source.d.ts","sourceRoot":"","sources":["../../src/search/backend-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAA0C,KAAK,2BAA2B,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAKzI;+FAC+F;AAC/F,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,cAAc,EACvB,OAAO,GAAE,IAAI,CAAC,2BAA2B,EAAE,KAAK,CAAM,GACrD,OAAO,CAAC,oBAAoB,CAAC,CAqB/B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { headsDigest } from "../heads-digest.js";
|
|
2
|
+
import { memorySearchSource, memorySearchBounds } from "./memory-source.js";
|
|
3
|
+
import { SearchLimitError, stopIfAsked } from "./errors.js";
|
|
4
|
+
import { documentSourceBytes } from "./row-text.js";
|
|
5
|
+
/** Read a complete backend corpus in bounded batches. Failed reads refuse the whole search;
|
|
6
|
+
* the cursor key describes the versions actually read, including unsent working-copy edits. */
|
|
7
|
+
export async function searchSourceFromBackend(backend, options = {}) {
|
|
8
|
+
const { maxDocuments, maxSourceBytes } = memorySearchBounds(options);
|
|
9
|
+
stopIfAsked(options.stop);
|
|
10
|
+
const ids = await backend.list();
|
|
11
|
+
if (ids.length > maxDocuments.max)
|
|
12
|
+
throw new SearchLimitError(maxDocuments.name, maxDocuments.max, ids.length);
|
|
13
|
+
const documents = [];
|
|
14
|
+
let sourceBytes = 0;
|
|
15
|
+
for (let start = 0; start < ids.length; start += 128) {
|
|
16
|
+
stopIfAsked(options.stop);
|
|
17
|
+
const batch = ids.slice(start, start + 128);
|
|
18
|
+
const results = await backend.readMany(batch);
|
|
19
|
+
if (results.length !== batch.length)
|
|
20
|
+
throw new TypeError("Search backend returned an incomplete batch.");
|
|
21
|
+
for (const [index, { doc, version }] of results.entries()) {
|
|
22
|
+
if (doc.id !== batch[index])
|
|
23
|
+
throw new TypeError("Search backend returned a different document identity.");
|
|
24
|
+
const document = { ...doc, version };
|
|
25
|
+
sourceBytes += documentSourceBytes(document);
|
|
26
|
+
if (sourceBytes > maxSourceBytes.max)
|
|
27
|
+
throw new SearchLimitError(maxSourceBytes.name, maxSourceBytes.max, sourceBytes);
|
|
28
|
+
documents.push(document);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return memorySearchSource(documents, { ...options, key: headsDigest(documents) });
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=backend-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend-source.js","sourceRoot":"","sources":["../../src/search/backend-source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAA+D,MAAM,oBAAoB,CAAC;AACzI,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD;+FAC+F;AAC/F,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAAuB,EACvB,UAAoD,EAAE;IAEtD,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACrE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,GAAG,CAAC,MAAM,GAAG,YAAY,CAAC,GAAG;QAAE,MAAM,IAAI,gBAAgB,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/G,MAAM,SAAS,GAAuB,EAAE,CAAC;IACzC,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,IAAI,GAAG,EAAE,CAAC;QACrD,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;YAAE,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;QACzG,KAAK,MAAM,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1D,IAAI,GAAG,CAAC,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC;gBAAE,MAAM,IAAI,SAAS,CAAC,wDAAwD,CAAC,CAAC;YAC3G,MAAM,QAAQ,GAAG,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC;YACrC,WAAW,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAC;YAC7C,IAAI,WAAW,GAAG,cAAc,CAAC,GAAG;gBAAE,MAAM,IAAI,gBAAgB,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YACvH,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,kBAAkB,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `documents.search.v1` contract: its constants, request and result types, and the frontmatter
|
|
3
|
+
* fields a search reads. Ranking and index limits are portal-webmcp 0.3.1's (algorithm
|
|
4
|
+
* `portal-webmcp-search/v1`, a long document indexed whole up to 65,536 body terms); the request
|
|
5
|
+
* limits are this contract's.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SEARCH_OPERATION_ID = "documents.search.v1";
|
|
8
|
+
/** The ranking algorithm, shared with portal-webmcp 0.3.1's `superbee_search_documents`. */
|
|
9
|
+
export declare const SEARCH_ALGORITHM = "portal-webmcp-search/v1";
|
|
10
|
+
/** Bumped whenever normalize, tokenize or searchRowText change what a document contributes to an
|
|
11
|
+
* index; the row-text golden (`test/fixtures/search-row-text-v<revision>.json`) pins it. */
|
|
12
|
+
export declare const SEARCH_TEXT_REVISION = 1;
|
|
13
|
+
/** Largest answer, as JSON. A page of long hits can exceed it before 50 hits: the page then ends
|
|
14
|
+
* early with a cursor at the cut. */
|
|
15
|
+
export declare const SEARCH_MAX_OUTPUT_BYTES: number;
|
|
16
|
+
export declare const SEARCH_LIMITS: Readonly<{
|
|
17
|
+
/** Largest query, UTF-8 bytes. */
|
|
18
|
+
readonly maxQueryBytes: 1024;
|
|
19
|
+
/** Distinct normalized query terms. */
|
|
20
|
+
readonly maxQueryTerms: 16;
|
|
21
|
+
readonly defaultRows: 10;
|
|
22
|
+
readonly maxRows: 50;
|
|
23
|
+
/** Excerpt length, UTF-8 bytes. */
|
|
24
|
+
readonly excerptBytes: 512;
|
|
25
|
+
/** Largest exact `type` or `tag` filter, UTF-8 bytes (the kernel query's filter bound). */
|
|
26
|
+
readonly maxFilterBytes: 256;
|
|
27
|
+
/** Largest id `prefix` filter, UTF-8 bytes (a document id's bound). */
|
|
28
|
+
readonly maxPrefixBytes: 512;
|
|
29
|
+
/** Largest cursor, UTF-8 bytes. */
|
|
30
|
+
readonly maxCursorBytes: 2048;
|
|
31
|
+
/** Values per facet, most frequent first. */
|
|
32
|
+
readonly maxFacetValues: 50;
|
|
33
|
+
readonly maxIndexDocuments: 20000;
|
|
34
|
+
readonly maxIndexSourceBytes: 67108864;
|
|
35
|
+
/** portal-webmcp's V1 value: a long document is indexed whole, never truncated; one over it is
|
|
36
|
+
* left out of the index and counted as skipped. */
|
|
37
|
+
readonly maxTermsPerDocument: 65536;
|
|
38
|
+
/** The default and ceiling of `searchDocuments`' `maxEvidenceInstances`: the most capped term
|
|
39
|
+
* instances a request's terms may hold across a corpus before it is refused as too broad. */
|
|
40
|
+
readonly maxEvidenceInstances: 400000;
|
|
41
|
+
}>;
|
|
42
|
+
/** Body occurrences of one distinct query term that can still add score. */
|
|
43
|
+
export declare const BODY_OCCURRENCE_CAP = 20;
|
|
44
|
+
/** Bytes an excerpt may reach behind its first body match before the match starts. */
|
|
45
|
+
export declare const EXCERPT_LEAD_BYTES = 256;
|
|
46
|
+
/** Documents processed between cancellation checks. */
|
|
47
|
+
export declare const SIGNAL_INTERVAL = 128;
|
|
48
|
+
export declare const SEARCH_MATCHES: readonly ["auto", "all", "any"];
|
|
49
|
+
export type SearchMatchV1 = (typeof SEARCH_MATCHES)[number];
|
|
50
|
+
export type SearchMatchModeV1 = "all" | "any";
|
|
51
|
+
export declare const SEARCH_FACETS: readonly ["type", "tags"];
|
|
52
|
+
export type SearchFacetV1 = (typeof SEARCH_FACETS)[number];
|
|
53
|
+
export declare const SEARCH_MATCH_FIELDS: readonly ["title", "type", "tag", "description", "id", "body"];
|
|
54
|
+
export type SearchMatchFieldV1 = (typeof SEARCH_MATCH_FIELDS)[number];
|
|
55
|
+
export declare const SEARCH_GUIDANCE: Readonly<{
|
|
56
|
+
all: "No document contains every query term. Retry with match \"any\", fewer terms, or different exact filters.";
|
|
57
|
+
any: "No document contains any searchable query term. Try domain-specific keywords or remove exact type and tag filters.";
|
|
58
|
+
/** The refusal of a request whose terms occur too often to rank (`maxEvidenceInstances`). */
|
|
59
|
+
broad: "The query's terms occur too often in this corpus to rank. Retry with fewer or more specific terms.";
|
|
60
|
+
}>;
|
|
61
|
+
/** One document of a search corpus: a read model row, or a working copy's head and body. */
|
|
62
|
+
export interface SearchDocumentV1 {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly version: string;
|
|
65
|
+
readonly frontmatter: Readonly<Record<string, unknown>>;
|
|
66
|
+
readonly body: string;
|
|
67
|
+
}
|
|
68
|
+
/** Cancellation for a long build or ranking: a signal, a host check that throws, or both. */
|
|
69
|
+
export interface SearchStopV1 {
|
|
70
|
+
readonly signal?: AbortSignal;
|
|
71
|
+
/** Called every SIGNAL_INTERVAL documents; throws to stop (for example a deadline). */
|
|
72
|
+
readonly check?: () => void;
|
|
73
|
+
}
|
|
74
|
+
/** The exact filters a source applies before it answers evidence. */
|
|
75
|
+
export interface SearchFiltersV1 {
|
|
76
|
+
readonly type?: string;
|
|
77
|
+
readonly tag?: string;
|
|
78
|
+
/** Leading characters of the document id. */
|
|
79
|
+
readonly prefix?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface SearchRequestV1 {
|
|
82
|
+
/** Free text, at most 1 KiB and 16 distinct terms after normalization. */
|
|
83
|
+
readonly query: string;
|
|
84
|
+
/** `auto` (default): every term, then any term without conversational words when nothing matched. */
|
|
85
|
+
readonly match?: SearchMatchV1;
|
|
86
|
+
/** Exact frontmatter `type`. */
|
|
87
|
+
readonly type?: string;
|
|
88
|
+
/** Exact declared tag. */
|
|
89
|
+
readonly tag?: string;
|
|
90
|
+
/** Leading characters of the document id, at most 512 bytes. */
|
|
91
|
+
readonly prefix?: string;
|
|
92
|
+
/** Hits per page, 1 to 50; default 10. */
|
|
93
|
+
readonly limit?: number;
|
|
94
|
+
/** A previous answer's `nextCursor`, for the same corpus, query, match and filters. */
|
|
95
|
+
readonly cursor?: string;
|
|
96
|
+
/** Value counts over every hit (not only this page), most frequent first, at most 50 each. */
|
|
97
|
+
readonly facets?: readonly SearchFacetV1[];
|
|
98
|
+
}
|
|
99
|
+
export interface SearchHitV1 {
|
|
100
|
+
readonly id: string;
|
|
101
|
+
readonly version: string;
|
|
102
|
+
readonly title?: string;
|
|
103
|
+
readonly type?: string;
|
|
104
|
+
readonly tags: readonly string[];
|
|
105
|
+
readonly score: number;
|
|
106
|
+
readonly matchedTerms: readonly {
|
|
107
|
+
readonly term: string;
|
|
108
|
+
readonly fields: readonly SearchMatchFieldV1[];
|
|
109
|
+
}[];
|
|
110
|
+
/** At most SEARCH_LIMITS.excerptBytes UTF-8 bytes: the body around the first match, else the description. */
|
|
111
|
+
readonly excerpt: string;
|
|
112
|
+
}
|
|
113
|
+
export interface SearchFacetValueV1 {
|
|
114
|
+
readonly value: string;
|
|
115
|
+
readonly count: number;
|
|
116
|
+
}
|
|
117
|
+
export interface SearchResultV1 {
|
|
118
|
+
readonly hits: readonly SearchHitV1[];
|
|
119
|
+
readonly query: {
|
|
120
|
+
readonly requestedMatch: SearchMatchV1;
|
|
121
|
+
readonly effectiveMatch: SearchMatchModeV1;
|
|
122
|
+
readonly fallbackUsed: boolean;
|
|
123
|
+
/** The terms matched: normalized, deduplicated, and without ignoredTerms after a fallback. */
|
|
124
|
+
readonly terms: readonly string[];
|
|
125
|
+
/** Conversational terms the fallback left out; absent when none were. */
|
|
126
|
+
readonly ignoredTerms?: readonly string[];
|
|
127
|
+
};
|
|
128
|
+
/** Hits across every page. */
|
|
129
|
+
readonly total: number;
|
|
130
|
+
readonly facets?: {
|
|
131
|
+
readonly type?: readonly SearchFacetValueV1[];
|
|
132
|
+
readonly tags?: readonly SearchFacetValueV1[];
|
|
133
|
+
};
|
|
134
|
+
readonly nextCursor?: string;
|
|
135
|
+
/** What was searched: every document, those indexed (reindexPending included), those the index
|
|
136
|
+
* cannot hold, and indexed rows awaiting re-derivation. */
|
|
137
|
+
readonly corpus: {
|
|
138
|
+
readonly documents: number;
|
|
139
|
+
readonly indexed: number;
|
|
140
|
+
readonly skipped: number;
|
|
141
|
+
readonly reindexPending: number;
|
|
142
|
+
};
|
|
143
|
+
/** Fixed advice when nothing matched. */
|
|
144
|
+
readonly guidance?: string;
|
|
145
|
+
}
|
|
146
|
+
export declare function documentTitle(document: SearchDocumentV1): string | undefined;
|
|
147
|
+
export declare function documentType(document: SearchDocumentV1): string | undefined;
|
|
148
|
+
export declare function documentDescription(document: SearchDocumentV1): string | undefined;
|
|
149
|
+
/** Declared string tags only; a non-array or non-string member contributes nothing. */
|
|
150
|
+
export declare function documentTags(document: SearchDocumentV1): readonly string[];
|
|
151
|
+
//# sourceMapp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AAE,MAAM,CAAC;IAC7B;+DAC2D;IAC3D,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAUD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAE5E;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAE3E;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAElF;AAED,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,MAAM,EAAE,CAG1E"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `documents.search.v1` contract: its constants, request and result types, and the frontmatter
|
|
3
|
+
* fields a search reads. Ranking and index limits are portal-webmcp 0.3.1's (algorithm
|
|
4
|
+
* `portal-webmcp-search/v1`, a long document indexed whole up to 65,536 body terms); the request
|
|
5
|
+
* limits are this contract's.
|
|
6
|
+
*/
|
|
7
|
+
export const SEARCH_OPERATION_ID = "documents.search.v1";
|
|
8
|
+
/** The ranking algorithm, shared with portal-webmcp 0.3.1's `superbee_search_documents`. */
|
|
9
|
+
export const SEARCH_ALGORITHM = "portal-webmcp-search/v1";
|
|
10
|
+
/** Bumped whenever normalize, tokenize or searchRowText change what a document contributes to an
|
|
11
|
+
* index; the row-text golden (`test/fixtures/search-row-text-v<revision>.json`) pins it. */
|
|
12
|
+
export const SEARCH_TEXT_REVISION = 1;
|
|
13
|
+
/** Largest answer, as JSON. A page of long hits can exceed it before 50 hits: the page then ends
|
|
14
|
+
* early with a cursor at the cut. */
|
|
15
|
+
export const SEARCH_MAX_OUTPUT_BYTES = 64 * 1024;
|
|
16
|
+
export const SEARCH_LIMITS = Object.freeze({
|
|
17
|
+
/** Largest query, UTF-8 bytes. */
|
|
18
|
+
maxQueryBytes: 1_024,
|
|
19
|
+
/** Distinct normalized query terms. */
|
|
20
|
+
maxQueryTerms: 16,
|
|
21
|
+
defaultRows: 10,
|
|
22
|
+
maxRows: 50,
|
|
23
|
+
/** Excerpt length, UTF-8 bytes. */
|
|
24
|
+
excerptBytes: 512,
|
|
25
|
+
/** Largest exact `type` or `tag` filter, UTF-8 bytes (the kernel query's filter bound). */
|
|
26
|
+
maxFilterBytes: 256,
|
|
27
|
+
/** Largest id `prefix` filter, UTF-8 bytes (a document id's bound). */
|
|
28
|
+
maxPrefixBytes: 512,
|
|
29
|
+
/** Largest cursor, UTF-8 bytes. */
|
|
30
|
+
maxCursorBytes: 2_048,
|
|
31
|
+
/** Values per facet, most frequent first. */
|
|
32
|
+
maxFacetValues: 50,
|
|
33
|
+
// Index limits, enforced while an in-memory index is built.
|
|
34
|
+
maxIndexDocuments: 20_000,
|
|
35
|
+
maxIndexSourceBytes: 67_108_864,
|
|
36
|
+
/** portal-webmcp's V1 value: a long document is indexed whole, never truncated; one over it is
|
|
37
|
+
* left out of the index and counted as skipped. */
|
|
38
|
+
maxTermsPerDocument: 65_536,
|
|
39
|
+
/** The default and ceiling of `searchDocuments`' `maxEvidenceInstances`: the most capped term
|
|
40
|
+
* instances a request's terms may hold across a corpus before it is refused as too broad. */
|
|
41
|
+
maxEvidenceInstances: 400_000,
|
|
42
|
+
});
|
|
43
|
+
/** Body occurrences of one distinct query term that can still add score. */
|
|
44
|
+
export const BODY_OCCURRENCE_CAP = 20;
|
|
45
|
+
/** Bytes an excerpt may reach behind its first body match before the match starts. */
|
|
46
|
+
export const EXCERPT_LEAD_BYTES = 256;
|
|
47
|
+
/** Documents processed between cancellation checks. */
|
|
48
|
+
export const SIGNAL_INTERVAL = 128;
|
|
49
|
+
export const SEARCH_MATCHES = Object.freeze(["auto", "all", "any"]);
|
|
50
|
+
export const SEARCH_FACETS = Object.freeze(["type", "tags"]);
|
|
51
|
+
export const SEARCH_MATCH_FIELDS = Object.freeze(["title", "type", "tag", "description", "id", "body"]);
|
|
52
|
+
export const SEARCH_GUIDANCE = Object.freeze({
|
|
53
|
+
all: 'No document contains every query term. Retry with match "any", fewer terms, or different exact filters.',
|
|
54
|
+
any: "No document contains any searchable query term. Try domain-specific keywords or remove exact type and tag filters.",
|
|
55
|
+
/** The refusal of a request whose terms occur too often to rank (`maxEvidenceInstances`). */
|
|
56
|
+
broad: "The query's terms occur too often in this corpus to rank. Retry with fewer or more specific terms.",
|
|
57
|
+
});
|
|
58
|
+
// The one place that decides which frontmatter members become searchable or displayable fields;
|
|
59
|
+
// nothing here reinterprets Markdown or adds Kind semantics.
|
|
60
|
+
function stringMember(frontmatter, key) {
|
|
61
|
+
const value = frontmatter[key];
|
|
62
|
+
return typeof value === "string" ? value : undefined;
|
|
63
|
+
}
|
|
64
|
+
export function documentTitle(document) {
|
|
65
|
+
return stringMember(document.frontmatter, "title");
|
|
66
|
+
}
|
|
67
|
+
export function documentType(document) {
|
|
68
|
+
return stringMember(document.frontmatter, "type");
|
|
69
|
+
}
|
|
70
|
+
export function documentDescription(document) {
|
|
71
|
+
return stringMember(document.frontmatter, "description");
|
|
72
|
+
}
|
|
73
|
+
/** Declared string tags only; a non-array or non-string member contributes nothing. */
|
|
74
|
+
export function documentTags(document) {
|
|
75
|
+
const value = document.frontmatter["tags"];
|
|
76
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/search/contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA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
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The corpus exceeds an index limit or a host's configured bound. A kernel answers
|
|
2
|
+
* `result_too_large`. */
|
|
3
|
+
export declare class SearchLimitError extends Error {
|
|
4
|
+
readonly limit: string;
|
|
5
|
+
readonly max: number;
|
|
6
|
+
readonly actual: number;
|
|
7
|
+
constructor(limit: string, max: number, actual: number, message?: string);
|
|
8
|
+
}
|
|
9
|
+
/** The request's terms hold more than `maxEvidenceInstances` capped instances. Still a
|
|
10
|
+
* `SearchLimitError` (`result_too_large`), but the corpus is searchable: the message is
|
|
11
|
+
* SEARCH_GUIDANCE.broad, to retry with fewer or more specific terms. */
|
|
12
|
+
export declare class SearchBroadQueryError extends SearchLimitError {
|
|
13
|
+
constructor(max: number, actual: number);
|
|
14
|
+
}
|
|
15
|
+
export type SearchInputReason = "request" | "query" | "empty-query" | "too-many-query-terms" | "match" | "filter" | "limit" | "facets" | "cursor";
|
|
16
|
+
/** The request is outside the contract. A kernel answers `invalid_input`. */
|
|
17
|
+
export declare class SearchInputError extends Error {
|
|
18
|
+
readonly reason: SearchInputReason;
|
|
19
|
+
constructor(reason: SearchInputReason);
|
|
20
|
+
}
|
|
21
|
+
/** A cancelled index build or ranking rejects; it never returns a partial answer. */
|
|
22
|
+
export declare class SearchAbortError extends Error {
|
|
23
|
+
constructor();
|
|
24
|
+
}
|
|
25
|
+
/** Throws as a stop asks: a signal already aborted, or a host check that throws. */
|
|
26
|
+
export declare function stopIfAsked(stop: {
|
|
27
|
+
readonly signal?: AbortSignal;
|
|
28
|
+
readonly check?: () => void;
|
|
29
|
+
} | undefined): void;
|
|
30
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/search/errors.ts"],"names":[],"mappings":"AAKA;yBACyB;AACzB,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,SAAkD;CAOlH;AAED;;wEAEwE;AACxE,qBAAa,qBAAsB,SAAQ,gBAAgB;gBAC7C,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAIxC;AAED,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,OAAO,GACP,aAAa,GACb,sBAAsB,GACtB,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,CAAC;AAEb,6EAA6E;AAC7E,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAEvB,MAAM,EAAE,iBAAiB;CAKtC;AAED,qFAAqF;AACrF,qBAAa,gBAAiB,SAAQ,KAAK;;CAK1C;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,SAAS,GAAG,IAAI,CAGlH"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// The ways a search refuses: a corpus over an index limit (or a host's configured bound), a request
|
|
2
|
+
// whose terms occur too often to rank, a request outside the contract, and a cancellation. Messages
|
|
3
|
+
// are fixed text; none repeats the caller's input.
|
|
4
|
+
import { SEARCH_GUIDANCE } from "./contract.js";
|
|
5
|
+
/** The corpus exceeds an index limit or a host's configured bound. A kernel answers
|
|
6
|
+
* `result_too_large`. */
|
|
7
|
+
export class SearchLimitError extends Error {
|
|
8
|
+
limit;
|
|
9
|
+
max;
|
|
10
|
+
actual;
|
|
11
|
+
constructor(limit, max, actual, message = `The search corpus exceeds its ${limit} limit.`) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "SearchLimitError";
|
|
14
|
+
this.limit = limit;
|
|
15
|
+
this.max = max;
|
|
16
|
+
this.actual = actual;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** The request's terms hold more than `maxEvidenceInstances` capped instances. Still a
|
|
20
|
+
* `SearchLimitError` (`result_too_large`), but the corpus is searchable: the message is
|
|
21
|
+
* SEARCH_GUIDANCE.broad, to retry with fewer or more specific terms. */
|
|
22
|
+
export class SearchBroadQueryError extends SearchLimitError {
|
|
23
|
+
constructor(max, actual) {
|
|
24
|
+
super("maxEvidenceInstances", max, actual, SEARCH_GUIDANCE.broad);
|
|
25
|
+
this.name = "SearchBroadQueryError";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** The request is outside the contract. A kernel answers `invalid_input`. */
|
|
29
|
+
export class SearchInputError extends Error {
|
|
30
|
+
reason;
|
|
31
|
+
constructor(reason) {
|
|
32
|
+
super(`The search request is invalid (${reason}).`);
|
|
33
|
+
this.name = "SearchInputError";
|
|
34
|
+
this.reason = reason;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** A cancelled index build or ranking rejects; it never returns a partial answer. */
|
|
38
|
+
export class SearchAbortError extends Error {
|
|
39
|
+
constructor() {
|
|
40
|
+
super("The search was cancelled.");
|
|
41
|
+
this.name = "AbortError";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Throws as a stop asks: a signal already aborted, or a host check that throws. */
|
|
45
|
+
export function stopIfAsked(stop) {
|
|
46
|
+
if (stop?.signal?.aborted)
|
|
47
|
+
throw new SearchAbortError();
|
|
48
|
+
stop?.check?.();
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/search/errors.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,oGAAoG;AACpG,mDAAm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AC;IACxD,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON for identity digests, cursor bodies, and byte measurement.
|
|
3
|
+
* Keys sort by UTF-16 code unit, `undefined` members are dropped, and anything
|
|
4
|
+
* outside plain JSON is rejected so a digest can never depend on host ordering.
|
|
5
|
+
*/
|
|
6
|
+
export declare function canonicalJson(value: unknown): string;
|
|
7
|
+
/** Locale-independent UTF-16 code-unit ordering; canonical order never uses host collation. */
|
|
8
|
+
export declare function codeUnitCompare(a: string, b: string): number;
|
|
9
|
+
export declare function base64UrlEncode(bytes: Uint8Array): string;
|
|
10
|
+
/** Strict unpadded base64url decoding; any stray character rejects the input. */
|
|
11
|
+
export declare function base64UrlDecode(value: string): Uint8Array | undefined;
|
|
12
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/search/identity.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIpD;AAwBD,+FAA+F;AAC/F,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAID,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAazD;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAwBrE"}
|