@superbee/core 0.2.0-pre.4 → 0.2.0-pre.40
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 +1209 -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 +22 -2
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +153 -38
- package/dist/backend.js.map +1 -1
- package/dist/blob-contract.d.ts +82 -0
- package/dist/blob-contract.d.ts.map +1 -0
- package/dist/blob-contract.js +134 -0
- package/dist/blob-contract.js.map +1 -0
- package/dist/blob-journal.d.ts +303 -0
- package/dist/blob-journal.d.ts.map +1 -0
- package/dist/blob-journal.js +541 -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 +207 -0
- package/dist/bundle-health/report.d.ts.map +1 -0
- package/dist/bundle-health/report.js +454 -0
- package/dist/bundle-health/report.js.map +1 -0
- package/dist/bundle-ops.d.ts +3 -2
- package/dist/bundle-ops.d.ts.map +1 -1
- package/dist/bundle-ops.js +4 -4
- package/dist/bundle-ops.js.map +1 -1
- package/dist/bundle.d.ts +3 -4
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +5 -14
- 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/code-unit-order.d.ts +15 -0
- package/dist/code-unit-order.d.ts.map +1 -0
- package/dist/code-unit-order.js +17 -0
- package/dist/code-unit-order.js.map +1 -0
- package/dist/connector-request.d.ts +112 -0
- package/dist/connector-request.d.ts.map +1 -0
- package/dist/connector-request.js +495 -0
- package/dist/connector-request.js.map +1 -0
- package/dist/connectors.d.ts +297 -0
- package/dist/connectors.d.ts.map +1 -0
- package/dist/connectors.js +1233 -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 +191 -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 +7 -2
- package/dist/document-codec.d.ts.map +1 -1
- package/dist/document-codec.js +8 -5
- 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 +35 -13
- package/dist/document-mutation.d.ts.map +1 -1
- package/dist/document-mutation.js +124 -60
- package/dist/document-mutation.js.map +1 -1
- package/dist/document-transfer.d.ts +208 -0
- package/dist/document-transfer.d.ts.map +1 -0
- package/dist/document-transfer.js +928 -0
- package/dist/document-transfer.js.map +1 -0
- 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 +21 -9
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +72 -14
- 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 +97 -21
- package/dist/filesystem-identity.d.ts.map +1 -1
- package/dist/filesystem-identity.js +398 -119
- 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/frontmatter.d.ts +8 -6
- package/dist/frontmatter.d.ts.map +1 -1
- package/dist/frontmatter.js +5 -4
- package/dist/frontmatter.js.map +1 -1
- package/dist/governed-body-write.d.ts +8 -1
- package/dist/governed-body-write.d.ts.map +1 -1
- package/dist/governed-body-write.js +9 -2
- package/dist/governed-body-write.js.map +1 -1
- package/dist/heads-digest.d.ts.map +1 -1
- package/dist/heads-digest.js +2 -1
- package/dist/heads-digest.js.map +1 -1
- 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 +68 -0
- package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
- package/dist/hosted-client/blob-delivery.js +170 -0
- package/dist/hosted-client/blob-delivery.js.map +1 -0
- package/dist/hosted-client/blob-write.d.ts +387 -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 +457 -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/identity-fold.d.ts +18 -0
- package/dist/identity-fold.d.ts.map +1 -0
- package/dist/identity-fold.js +22 -0
- package/dist/identity-fold.js.map +1 -0
- package/dist/index.d.ts +41 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -9
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-backend.d.ts +25 -33
- package/dist/indexeddb-backend.d.ts.map +1 -1
- package/dist/indexeddb-backend.js +264 -8
- package/dist/indexeddb-backend.js.map +1 -1
- package/dist/inventory-guard.d.ts +58 -0
- package/dist/inventory-guard.d.ts.map +1 -0
- package/dist/inventory-guard.js +169 -0
- package/dist/inventory-guard.js.map +1 -0
- package/dist/journaled-backend.d.ts +149 -9
- package/dist/journaled-backend.d.ts.map +1 -1
- package/dist/journaled-backend.js +64 -58
- 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 +452 -0
- package/dist/kind-authoring.js.map +1 -0
- package/dist/kind-changes.d.ts +45 -0
- package/dist/kind-changes.d.ts.map +1 -0
- package/dist/kind-changes.js +96 -0
- package/dist/kind-changes.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-deprecation.d.ts +32 -0
- package/dist/kind-deprecation.d.ts.map +1 -0
- package/dist/kind-deprecation.js +141 -0
- package/dist/kind-deprecation.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 +111 -2
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +386 -20
- package/dist/kinds.js.map +1 -1
- package/dist/link-emit.d.ts +29 -0
- package/dist/link-emit.d.ts.map +1 -0
- package/dist/link-emit.js +39 -0
- package/dist/link-emit.js.map +1 -0
- package/dist/link-types.d.ts +27 -0
- package/dist/link-types.d.ts.map +1 -0
- package/dist/link-types.js +60 -0
- package/dist/link-types.js.map +1 -0
- package/dist/links.d.ts +52 -3
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +259 -18
- 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 +3 -0
- package/dist/memory-backend.d.ts.map +1 -1
- package/dist/memory-backend.js +44 -2
- package/dist/memory-backend.js.map +1 -1
- package/dist/okf-actor.d.ts +1 -0
- package/dist/okf-actor.d.ts.map +1 -1
- package/dist/okf-actor.js +1 -0
- package/dist/okf-actor.js.map +1 -1
- package/dist/okf-authoring.d.ts +4 -0
- package/dist/okf-authoring.d.ts.map +1 -0
- package/dist/okf-authoring.js +12 -0
- package/dist/okf-authoring.js.map +1 -0
- package/dist/okf-standard-fields.d.ts +3 -0
- package/dist/okf-standard-fields.d.ts.map +1 -1
- package/dist/okf-standard-fields.js +3 -0
- package/dist/okf-standard-fields.js.map +1 -1
- package/dist/path-fold.d.ts +39 -0
- package/dist/path-fold.d.ts.map +1 -0
- package/dist/path-fold.js +41 -0
- package/dist/path-fold.js.map +1 -0
- package/dist/paths.d.ts +18 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +32 -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 +43 -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 +124 -0
- package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
- package/dist/recipe-lifecycle/evolution.js +993 -0
- package/dist/recipe-lifecycle/evolution.js.map +1 -0
- package/dist/recipe-lifecycle/index.d.ts +34 -0
- package/dist/recipe-lifecycle/index.d.ts.map +1 -0
- package/dist/recipe-lifecycle/index.js +28 -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 +604 -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/retirement-apply.d.ts +59 -0
- package/dist/recipe-lifecycle/retirement-apply.d.ts.map +1 -0
- package/dist/recipe-lifecycle/retirement-apply.js +165 -0
- package/dist/recipe-lifecycle/retirement-apply.js.map +1 -0
- package/dist/recipe-lifecycle/retirement.d.ts +89 -0
- package/dist/recipe-lifecycle/retirement.d.ts.map +1 -0
- package/dist/recipe-lifecycle/retirement.js +347 -0
- package/dist/recipe-lifecycle/retirement.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/recipe-set-preflight.d.ts +139 -0
- package/dist/recipe-set-preflight.d.ts.map +1 -0
- package/dist/recipe-set-preflight.js +536 -0
- package/dist/recipe-set-preflight.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 +74 -0
- package/dist/record-overlay/policy.d.ts.map +1 -0
- package/dist/record-overlay/policy.js +235 -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 +58 -13
- package/dist/remote-backend.d.ts.map +1 -1
- package/dist/remote-backend.js +156 -36
- 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 +17 -1
- package/dist/remote-error.d.ts.map +1 -1
- package/dist/remote-error.js +32 -2
- package/dist/remote-error.js.map +1 -1
- 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 +1 -1
- package/dist/remote-parsers.js +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/driver.d.ts +40 -0
- package/dist/source-engine/driver.d.ts.map +1 -0
- package/dist/source-engine/driver.js +392 -0
- package/dist/source-engine/driver.js.map +1 -0
- package/dist/source-engine/evidence.d.ts +39 -0
- package/dist/source-engine/evidence.d.ts.map +1 -0
- package/dist/source-engine/evidence.js +54 -0
- package/dist/source-engine/evidence.js.map +1 -0
- package/dist/source-engine/guard.d.ts +87 -0
- package/dist/source-engine/guard.d.ts.map +1 -0
- package/dist/source-engine/guard.js +427 -0
- package/dist/source-engine/guard.js.map +1 -0
- package/dist/source-engine/index.d.ts +33 -0
- package/dist/source-engine/index.d.ts.map +1 -0
- package/dist/source-engine/index.js +26 -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 +10 -0
- package/dist/source-engine/observe.d.ts.map +1 -0
- package/dist/source-engine/observe.js +270 -0
- package/dist/source-engine/observe.js.map +1 -0
- package/dist/source-engine/overlay.d.ts +50 -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/snapshot.d.ts +104 -0
- package/dist/source-engine/snapshot.d.ts.map +1 -0
- package/dist/source-engine/snapshot.js +240 -0
- package/dist/source-engine/snapshot.js.map +1 -0
- package/dist/source-engine/types.d.ts +292 -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 +97 -0
- package/dist/source-harness/fixture.d.ts.map +1 -0
- package/dist/source-harness/fixture.js +276 -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 +9 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +6 -1
- package/dist/storage.js.map +1 -1
- package/dist/string-identity-agreement.d.ts +35 -0
- package/dist/string-identity-agreement.d.ts.map +1 -0
- package/dist/string-identity-agreement.js +72 -0
- package/dist/string-identity-agreement.js.map +1 -0
- package/dist/types.d.ts +41 -6
- 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 +157 -17
- package/dist/uncertain-write.d.ts.map +1 -1
- package/dist/uncertain-write.js +86 -30
- 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/view-launch-contract.d.ts +14 -0
- package/dist/view-launch-contract.d.ts.map +1 -0
- package/dist/view-launch-contract.js +23 -0
- package/dist/view-launch-contract.js.map +1 -0
- 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 +140 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { captureBodyReplacePosture } from "./body-replace-guards.js";
|
|
1
2
|
/**
|
|
2
3
|
* The uncertain-write transport over a wire authority: one {@link OperationTransport} that
|
|
3
4
|
* delivers a `document.write` intent as an identified `PUT` through {@link RemoteBackend} and
|
|
@@ -13,8 +14,9 @@
|
|
|
13
14
|
* or the authority's own runtime failure, says nothing about whether the write was applied, so
|
|
14
15
|
* the primitive classifies it as unknown and resolves it by lookup, which is the whole reason
|
|
15
16
|
* the identity exists. A 4xx is final because the authority answered and declined. A local
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* refusal is also final because no PUT was sent, not because the authority recorded an outcome:
|
|
18
|
+
* an intent kind other than `document.write`, content that does not parse, or metadata the wire
|
|
19
|
+
* cannot encode is refused `USAGE` without a PUT.
|
|
18
20
|
*
|
|
19
21
|
* The transport is only sound against an authority that implements identity. A host that
|
|
20
22
|
* predates it ignores the header, applies every retry as a fresh write, and answers the lookup
|
|
@@ -32,8 +34,8 @@
|
|
|
32
34
|
* the verdict visible uses {@link openRemoteOperationTransport} or reads `wireCapabilities()`
|
|
33
35
|
* itself. And the check is memoized on success: a host downgraded afterwards is not detected,
|
|
34
36
|
* so one unidentified resubmission can reach it. Because every identified write is guarded by
|
|
35
|
-
* its base, that exposure is bounded to a spurious conflict at a moved head,
|
|
36
|
-
* application.
|
|
37
|
+
* its base, that exposure is bounded to a spurious conflict at a moved head, or a second
|
|
38
|
+
* application when the head has returned to the base's exact content.
|
|
37
39
|
*
|
|
38
40
|
* This module imports nothing from Node so a browser working copy and a Node consumer share
|
|
39
41
|
* one transport over one client adapter.
|
|
@@ -79,13 +81,28 @@ function buildTransport(remote, options) {
|
|
|
79
81
|
};
|
|
80
82
|
const transport = {
|
|
81
83
|
async submit(intent) {
|
|
84
|
+
// Refused rather than thrown: the primitive classifies a throw as unknown, and an intent
|
|
85
|
+
// that can never be sent would then stay pending as possibly delivered on every push.
|
|
82
86
|
if (intent.kind !== "document.write") {
|
|
83
|
-
|
|
87
|
+
return { kind: "refused", code: "USAGE", message: `remote operation transport: unsupported intent kind '${intent.kind}'`, executed: false };
|
|
84
88
|
}
|
|
85
|
-
|
|
89
|
+
let parsed;
|
|
90
|
+
let posture;
|
|
91
|
+
try {
|
|
92
|
+
const descriptor = Object.getOwnPropertyDescriptor(intent, "bodyReplace");
|
|
93
|
+
if (descriptor && !("value" in descriptor))
|
|
94
|
+
throw new Error("bodyReplace must be an explicit data field.");
|
|
95
|
+
posture = captureBodyReplacePosture(descriptor?.value);
|
|
96
|
+
parsed = parseMarkdown(intent.content, pathFromConceptId(intent.target));
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return { kind: "refused", code: "USAGE", message: error instanceof Error ? error.message : String(error), executed: false };
|
|
100
|
+
}
|
|
101
|
+
const { frontmatter, body } = parsed;
|
|
86
102
|
const writeOptions = {
|
|
87
103
|
expectedVersion: intent.base,
|
|
88
104
|
requestId: intent.requestId,
|
|
105
|
+
...(posture === undefined ? {} : { bodyReplace: posture }),
|
|
89
106
|
...(options.actor === undefined ? {} : { actor: options.actor }),
|
|
90
107
|
};
|
|
91
108
|
try {
|
|
@@ -100,6 +117,9 @@ function buildTransport(remote, options) {
|
|
|
100
117
|
return { kind: "refused", code: "USAGE", message: error.message };
|
|
101
118
|
if (error instanceof VersionConflict)
|
|
102
119
|
return { kind: "conflict", actual: error.actual };
|
|
120
|
+
// The reference router authorizes before it claims a key: a 401 or 403 executed nothing.
|
|
121
|
+
if (error instanceof RemoteError && (error.status === 401 || error.status === 403))
|
|
122
|
+
return { kind: "refused", code: error.code, message: error.message, executed: false };
|
|
103
123
|
if (error instanceof RemoteError && error.status < 500)
|
|
104
124
|
return { kind: "refused", code: error.code, message: error.message };
|
|
105
125
|
throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-operations.js","sourceRoot":"","sources":["../src/remote-operations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"remote-operations.js","sourceRoot":"","sources":["../src/remote-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAA2B,MAAM,0BAA0B,CAAC;AAC9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAOzD,kFAAkF;AAClF,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,wBAAwB,CAAC;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,gDAAgD,OAAO,sFAAsF,CAAC,CAAC;QACrJ,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC3C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,MAAqB,EAAE,UAA2C,EAAE;IACrH,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,MAAM,KAAK,CAAC,eAAe,EAAE,CAAC;IAC9B,OAAO,KAAK,CAAC,SAAS,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAqB,EAAE,UAA2C,EAAE;IACjH,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC;AAED,SAAS,cAAc,CAAC,MAAqB,EAAE,OAAwC;IACrF,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,MAAM,eAAe,GAAG,KA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,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAC1K,IAAI,KAAK,YAAY,WAAW,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG;oBAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;gBAC7H,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,SAAiB;YAC5B,MAAM,eAAe,EAAE,CAAC;YACxB,OAAO,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC;IACF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/remote-parsers.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface ReadSnapshotStreamOptions {
|
|
|
66
66
|
* The `200` body of `GET /heads`, admitted or refused as one: a well-formed digest, a `heads`
|
|
67
67
|
* array of `{ id, version }` rows, a `count` equal to the number of rows, and rows that digest
|
|
68
68
|
* by the documented recipe to the digest served. Anything else rejects as malformed (a
|
|
69
|
-
* {@link
|
|
69
|
+
* {@link MalformedAnswer}, code `MALFORMED_ANSWER`) rather than being trusted. The
|
|
70
70
|
* recomputation is what stops a listing that is whole by its own count but not the state its
|
|
71
71
|
* digest names (a shortened listing under the real digest) from being diffed as a mass
|
|
72
72
|
* deletion. Rows keep the order served: the recipe sorts for itself, so order does not decide
|
package/dist/remote-parsers.js
CHANGED
|
@@ -31,7 +31,7 @@ function isDocumentHead(value) {
|
|
|
31
31
|
* The `200` body of `GET /heads`, admitted or refused as one: a well-formed digest, a `heads`
|
|
32
32
|
* array of `{ id, version }` rows, a `count` equal to the number of rows, and rows that digest
|
|
33
33
|
* by the documented recipe to the digest served. Anything else rejects as malformed (a
|
|
34
|
-
* {@link
|
|
34
|
+
* {@link MalformedAnswer}, code `MALFORMED_ANSWER`) rather than being trusted. The
|
|
35
35
|
* recomputation is what stops a listing that is whole by its own count but not the state its
|
|
36
36
|
* digest names (a shortened listing under the real digest) from being diffed as a mass
|
|
37
37
|
* deletion. Rows keep the order served: the recipe sorts for itself, so order does not decide
|
|
@@ -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,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,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
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/search/contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAE1D;4FAC4F;AAC5F,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;qCACqC;AACrC,eAAO,MAAM,uBAAuB,QAAY,CAAC;AAEjD,eAAO,MAAM,aAAa;IACxB,kCAAkC;;IAElC,uCAAuC;;;;IAIvC,mCAAmC;;IAEnC,2FAA2F;;IAE3F,uEAAuE;;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,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;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAE1D;4FAC4F;AAC5F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;qCACqC;AACrC,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,kCAAkC;IAClC,aAAa,EAAE,KAAK;IACpB,uCAAuC;IACvC,aAAa,EAAE,EAAE;IACjB,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,EAAE;IAC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C,CAAC;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAA0B;IACtD,OAAO,YAAY,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAA0B;IACrD,OAAO,YAAY,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAA0B;IAC5D,OAAO,YAAY,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAC3D,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,YAAY,CAAC,QAA0B;IACrD,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACzG,CAAC"}
|
|
@@ -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,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;yBACyB;AACzB,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,KAAK,CAAS;IACd,GAAG,CAAS;IACZ,MAAM,CAAS;IAExB,YAAY,KAAa,EAAE,GAAW,EAAE,MAAc,EAAE,OAAO,GAAG,iCAAiC,KAAK,SAAS;QAC/G,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;wEAEwE;AACxE,MAAM,OAAO,qBAAsB,SAAQ,gBAAgB;IACzD,YAAY,GAAW,EAAE,MAAc;QACrC,KAAK,CAAC,sBAAsB,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAaD,6EAA6E;AAC7E,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,MAAM,CAAoB;IAEnC,YAAY,MAAyB;QACnC,KAAK,CAAC,kCAAkC,MAAM,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,qFAAqF;AACrF,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC;QACE,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED,oFAAoF;AACpF,MAAM,UAAU,WAAW,CAAC,IAAgF;IAC1G,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO;QAAE,MAAM,IAAI,gBAAgB,EAAE,CAAC;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"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Canonical JSON, code-unit order and strict base64url for the index identity and cursors. Moved from
|
|
2
|
+
// portal-webmcp 0.3.1 (`identity.ts`); private to the subpath. SHA-256 is core's (`../sha256.ts`).
|
|
3
|
+
/**
|
|
4
|
+
* Canonical JSON for identity digests, cursor bodies, and byte measurement.
|
|
5
|
+
* Keys sort by UTF-16 code unit, `undefined` members are dropped, and anything
|
|
6
|
+
* outside plain JSON is rejected so a digest can never depend on host ordering.
|
|
7
|
+
*/
|
|
8
|
+
export function canonicalJson(value) {
|
|
9
|
+
const rendered = serialize(value);
|
|
10
|
+
if (rendered === undefined)
|
|
11
|
+
throw new TypeError("canonical JSON received an undefined root");
|
|
12
|
+
return rendered;
|
|
13
|
+
}
|
|
14
|
+
function serialize(value) {
|
|
15
|
+
if (value === undefined)
|
|
16
|
+
return undefined;
|
|
17
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
18
|
+
return JSON.stringify(value);
|
|
19
|
+
if (typeof value === "number") {
|
|
20
|
+
if (!Number.isFinite(value))
|
|
21
|
+
throw new TypeError("canonical JSON received a non-finite number");
|
|
22
|
+
return JSON.stringify(value);
|
|
23
|
+
}
|
|
24
|
+
if (Array.isArray(value))
|
|
25
|
+
return `[${value.map((item) => serialize(item) ?? "null").join(",")}]`;
|
|
26
|
+
if (typeof value === "object") {
|
|
27
|
+
const prototype = Object.getPrototypeOf(value);
|
|
28
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
29
|
+
throw new TypeError("canonical JSON received a non-plain object");
|
|
30
|
+
const members = [];
|
|
31
|
+
for (const key of Object.keys(value).sort(codeUnitCompare)) {
|
|
32
|
+
const rendered = serialize(value[key]);
|
|
33
|
+
if (rendered !== undefined)
|
|
34
|
+
members.push(`${JSON.stringify(key)}:${rendered}`);
|
|
35
|
+
}
|
|
36
|
+
return `{${members.join(",")}}`;
|
|
37
|
+
}
|
|
38
|
+
throw new TypeError("canonical JSON received a non-JSON value");
|
|
39
|
+
}
|
|
40
|
+
/** Locale-independent UTF-16 code-unit ordering; canonical order never uses host collation. */
|
|
41
|
+
export function codeUnitCompare(a, b) {
|
|
42
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
43
|
+
}
|
|
44
|
+
const BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
45
|
+
export function base64UrlEncode(bytes) {
|
|
46
|
+
let out = "";
|
|
47
|
+
for (let index = 0; index < bytes.byteLength; index += 3) {
|
|
48
|
+
const a = bytes[index];
|
|
49
|
+
const b = bytes[index + 1];
|
|
50
|
+
const c = bytes[index + 2];
|
|
51
|
+
out += BASE64URL[a >> 2] + BASE64URL[((a & 0b11) << 4) | ((b ?? 0) >> 4)];
|
|
52
|
+
if (b === undefined)
|
|
53
|
+
break;
|
|
54
|
+
out += BASE64URL[((b & 0b1111) << 2) | ((c ?? 0) >> 6)];
|
|
55
|
+
if (c === undefined)
|
|
56
|
+
break;
|
|
57
|
+
out += BASE64URL[c & 0b111111];
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/** Strict unpadded base64url decoding; any stray character rejects the input. */
|
|
62
|
+
export function base64UrlDecode(value) {
|
|
63
|
+
if (value.length % 4 === 1)
|
|
64
|
+
return undefined;
|
|
65
|
+
const bits = [];
|
|
66
|
+
for (const character of value) {
|
|
67
|
+
const index = BASE64URL.indexOf(character);
|
|
68
|
+
if (index < 0)
|
|
69
|
+
return undefined;
|
|
70
|
+
bits.push(index);
|
|
71
|
+
}
|
|
72
|
+
const bytes = new Uint8Array(Math.floor((bits.length * 6) / 8));
|
|
73
|
+
let accumulator = 0;
|
|
74
|
+
let width = 0;
|
|
75
|
+
let cursor = 0;
|
|
76
|
+
for (const sextet of bits) {
|
|
77
|
+
accumulator = (accumulator << 6) | sextet;
|
|
78
|
+
width += 6;
|
|
79
|
+
if (width >= 8) {
|
|
80
|
+
width -= 8;
|
|
81
|
+
bytes[cursor] = (accumulator >> width) & 0xff;
|
|
82
|
+
cursor += 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Reject non-canonical trailing bits so one byte string has exactly one encoding.
|
|
86
|
+
if (width > 0 && (accumulator & ((1 << width) - 1)) !== 0)
|
|
87
|
+
return undefined;
|
|
88
|
+
return bytes;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/search/identity.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,mGAAmG;AAEnG;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,QAAQ,KAAK,SAAS;QAAE,MAAM,IAAI,SAAS,CAAC,2CAA2C,CAAC,CAAC;IAC7F,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,KAAK,K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5E,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@superbee/core/search`: the one `documents.search.v1` engine. The contract, query rules,
|
|
3
|
+
* ranking, the any-term fallback, facets, cursors and page budgets live here; a backend supplies
|
|
4
|
+
* what it searches through the `SearchSource` seam, and `memorySearchSource` indexes a complete
|
|
5
|
+
* corpus in memory. Pure ECMAScript with no dependency, so a Worker, a browser page and the CLI run
|
|
6
|
+
* the same code. Ranking is portal-webmcp 0.3.1's (`portal-webmcp-search/v1`).
|
|
7
|
+
*/
|
|
8
|
+
export { BODY_OCCURRENCE_CAP, SEARCH_ALGORITHM, SEARCH_FACETS, SEARCH_GUIDANCE, SEARCH_LIMITS, SEARCH_MATCHES, SEARCH_MATCH_FIELDS, SEARCH_MAX_OUTPUT_BYTES, SEARCH_OPERATION_ID, SEARCH_TEXT_REVISION, type SearchDocumentV1, type SearchFacetV1, type SearchFacetValueV1, type SearchFiltersV1, type SearchHitV1, type SearchMatchFieldV1, type SearchMatchModeV1, type SearchMatchV1, type SearchRequestV1, type SearchResultV1, type SearchStopV1, } from "./contract.js";
|
|
9
|
+
export { SearchAbortError, SearchBroadQueryError, SearchInputError, SearchLimitError, type SearchInputReason, } from "./errors.js";
|
|
10
|
+
export { normalize, normalizeQuery, phrase, relaxQuery, tokenize, type NormalizedQueryV1, type RelaxedQueryV1, } from "./text.js";
|
|
11
|
+
export { documentSourceBytes, normalizerFingerprint, searchRowText, textVersion, type SearchRowTextV1, } from "./row-text.js";
|
|
12
|
+
export type { SearchCorpusSizeV1, SearchEvidenceBatchV1, SearchEvidenceBoundsV1, SearchEvidenceV1, SearchSource, SearchTextV1, } from "./source.js";
|
|
13
|
+
export { memorySearchSource, type MemorySearchSourceOptionsV1, type MemorySearchSourceV1 } from "./memory-source.js";
|
|
14
|
+
export { searchDocuments, validateSearchRequest, type SearchOptionsV1, type SearchScopeV1 } from "./search.js";
|
|
15
|
+
export { searchSourceFromBackend } from "./backend-source.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|