@superbee/core 0.2.0-pre.9 → 0.4.10-pre.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +1339 -6
- package/dist/backend.d.ts +50 -2
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +311 -33
- 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-pages.d.ts +20 -0
- package/dist/body-pages.d.ts.map +1 -0
- package/dist/body-pages.js +56 -0
- package/dist/body-pages.js.map +1 -0
- package/dist/body-replace-guards.d.ts +81 -0
- package/dist/body-replace-guards.d.ts.map +1 -0
- package/dist/body-replace-guards.js +271 -0
- package/dist/body-replace-guards.js.map +1 -0
- package/dist/bounded-yaml.d.ts +28 -0
- package/dist/bounded-yaml.d.ts.map +1 -0
- package/dist/bounded-yaml.js +182 -0
- package/dist/bounded-yaml.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/site.d.ts +5 -0
- package/dist/builtin-recipes/site.d.ts.map +1 -0
- package/dist/builtin-recipes/site.js +83 -0
- package/dist/builtin-recipes/site.js.map +1 -0
- package/dist/builtin-recipes.d.ts +13 -0
- package/dist/builtin-recipes.d.ts.map +1 -0
- package/dist/builtin-recipes.js +123 -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 +45 -0
- package/dist/bundle-health/kind-findings.d.ts.map +1 -0
- package/dist/bundle-health/kind-findings.js +67 -0
- package/dist/bundle-health/kind-findings.js.map +1 -0
- package/dist/bundle-health/legacy-page.d.ts +21 -0
- package/dist/bundle-health/legacy-page.d.ts.map +1 -0
- package/dist/bundle-health/legacy-page.js +25 -0
- package/dist/bundle-health/legacy-page.js.map +1 -0
- package/dist/bundle-health/report.d.ts +191 -0
- package/dist/bundle-health/report.d.ts.map +1 -0
- package/dist/bundle-health/report.js +419 -0
- package/dist/bundle-health/report.js.map +1 -0
- package/dist/bundle-ops.d.ts +10 -4
- package/dist/bundle-ops.d.ts.map +1 -1
- package/dist/bundle-ops.js +15 -8
- package/dist/bundle-ops.js.map +1 -1
- package/dist/bundle.d.ts +2 -4
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +3 -12
- 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/convention-record.d.ts +9 -0
- package/dist/convention-record.d.ts.map +1 -0
- package/dist/convention-record.js +13 -0
- package/dist/convention-record.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 +208 -0
- package/dist/dependencies.d.ts.map +1 -0
- package/dist/dependencies.js +367 -0
- package/dist/dependencies.js.map +1 -0
- package/dist/document-codec.d.ts +4 -1
- package/dist/document-codec.d.ts.map +1 -1
- package/dist/document-codec.js +3 -1
- package/dist/document-codec.js.map +1 -1
- package/dist/document-field-actions.d.ts +21 -3
- package/dist/document-field-actions.d.ts.map +1 -1
- package/dist/document-field-actions.js +105 -40
- package/dist/document-field-actions.js.map +1 -1
- package/dist/document-mutation.d.ts +44 -18
- package/dist/document-mutation.d.ts.map +1 -1
- package/dist/document-mutation.js +192 -86
- package/dist/document-mutation.js.map +1 -1
- package/dist/document-persistence.d.ts +12 -0
- package/dist/document-persistence.d.ts.map +1 -0
- package/dist/document-persistence.js +44 -0
- package/dist/document-persistence.js.map +1 -0
- package/dist/document-replace-rules.d.ts +44 -0
- package/dist/document-replace-rules.d.ts.map +1 -0
- package/dist/document-replace-rules.js +41 -0
- package/dist/document-replace-rules.js.map +1 -0
- package/dist/document-scan.d.ts +26 -0
- package/dist/document-scan.d.ts.map +1 -0
- package/dist/document-scan.js +70 -0
- package/dist/document-scan.js.map +1 -0
- package/dist/document-transfer.d.ts +314 -0
- package/dist/document-transfer.d.ts.map +1 -0
- package/dist/document-transfer.js +1404 -0
- package/dist/document-transfer.js.map +1 -0
- package/dist/document-write-policy.d.ts +15 -4
- package/dist/document-write-policy.d.ts.map +1 -1
- package/dist/document-write-policy.js +41 -27
- 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/edge-harness/corpus.d.ts +9 -0
- package/dist/edge-harness/corpus.d.ts.map +1 -0
- package/dist/edge-harness/corpus.js +57 -0
- package/dist/edge-harness/corpus.js.map +1 -0
- package/dist/edge-harness/index.d.ts +21 -0
- package/dist/edge-harness/index.d.ts.map +1 -0
- package/dist/edge-harness/index.js +537 -0
- package/dist/edge-harness/index.js.map +1 -0
- package/dist/edges/find.d.ts +14 -0
- package/dist/edges/find.d.ts.map +1 -0
- package/dist/edges/find.js +46 -0
- package/dist/edges/find.js.map +1 -0
- package/dist/edges/index.d.ts +13 -0
- package/dist/edges/index.d.ts.map +1 -0
- package/dist/edges/index.js +5 -0
- package/dist/edges/index.js.map +1 -0
- package/dist/edges/memory-source.d.ts +8 -0
- package/dist/edges/memory-source.d.ts.map +1 -0
- package/dist/edges/memory-source.js +164 -0
- package/dist/edges/memory-source.js.map +1 -0
- package/dist/edges/read-bounds.d.ts +6 -0
- package/dist/edges/read-bounds.d.ts.map +1 -0
- package/dist/edges/read-bounds.js +13 -0
- package/dist/edges/read-bounds.js.map +1 -0
- package/dist/edges/source.d.ts +123 -0
- package/dist/edges/source.d.ts.map +1 -0
- package/dist/edges/source.js +2 -0
- package/dist/edges/source.js.map +1 -0
- package/dist/edges/walk.d.ts +7 -0
- package/dist/edges/walk.d.ts.map +1 -0
- package/dist/edges/walk.js +14 -0
- package/dist/edges/walk.js.map +1 -0
- package/dist/engine.d.ts +54 -18
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +137 -108
- package/dist/engine.js.map +1 -1
- package/dist/errors.d.ts +40 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +80 -4
- package/dist/errors.js.map +1 -1
- package/dist/file-journaled-backend-internal.d.ts +2 -0
- package/dist/file-journaled-backend-internal.d.ts.map +1 -1
- package/dist/file-journaled-backend-internal.js +2 -0
- package/dist/file-journaled-backend-internal.js.map +1 -1
- package/dist/file-journaled-backend.d.ts +38 -40
- package/dist/file-journaled-backend.d.ts.map +1 -1
- package/dist/file-journaled-backend.js +284 -52
- package/dist/file-journaled-backend.js.map +1 -1
- package/dist/filesystem-identity.d.ts +116 -17
- package/dist/filesystem-identity.d.ts.map +1 -1
- package/dist/filesystem-identity.js +532 -51
- package/dist/filesystem-identity.js.map +1 -1
- package/dist/filesystem-lock.d.ts +9 -2
- package/dist/filesystem-lock.d.ts.map +1 -1
- package/dist/filesystem-lock.js +134 -17
- package/dist/filesystem-lock.js.map +1 -1
- package/dist/filesystem-temp-name.d.ts +9 -0
- package/dist/filesystem-temp-name.d.ts.map +1 -0
- package/dist/filesystem-temp-name.js +20 -0
- package/dist/filesystem-temp-name.js.map +1 -0
- package/dist/filesystem.d.ts +6 -0
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +2 -1
- package/dist/filesystem.js.map +1 -1
- package/dist/freshness.d.ts +16 -1
- package/dist/freshness.d.ts.map +1 -1
- package/dist/freshness.js +47 -17
- package/dist/freshness.js.map +1 -1
- package/dist/frontmatter-contract.d.ts +14 -0
- package/dist/frontmatter-contract.d.ts.map +1 -1
- package/dist/frontmatter-contract.js +22 -0
- package/dist/frontmatter-contract.js.map +1 -1
- package/dist/frontmatter-splitter.d.ts +6 -0
- package/dist/frontmatter-splitter.d.ts.map +1 -1
- package/dist/frontmatter-splitter.js +8 -0
- package/dist/frontmatter-splitter.js.map +1 -1
- package/dist/frontmatter.d.ts +17 -7
- package/dist/frontmatter.d.ts.map +1 -1
- package/dist/frontmatter.js +52 -11
- package/dist/frontmatter.js.map +1 -1
- package/dist/governed-body-write.d.ts.map +1 -1
- package/dist/governed-body-write.js +13 -6
- 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/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 +249 -0
- package/dist/hosted-client/client.d.ts.map +1 -0
- package/dist/hosted-client/client.js +381 -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 +31 -0
- package/dist/hosted-client/index.d.ts.map +1 -0
- package/dist/hosted-client/index.js +33 -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/view-content.d.ts +184 -0
- package/dist/hosted-client/view-content.d.ts.map +1 -0
- package/dist/hosted-client/view-content.js +268 -0
- package/dist/hosted-client/view-content.js.map +1 -0
- package/dist/hosted-client/write.d.ts +219 -0
- package/dist/hosted-client/write.d.ts.map +1 -0
- package/dist/hosted-client/write.js +419 -0
- package/dist/hosted-client/write.js.map +1 -0
- package/dist/hosted-transport/answer-rows.d.ts +132 -4
- package/dist/hosted-transport/answer-rows.d.ts.map +1 -1
- package/dist/hosted-transport/answer-rows.js +211 -11
- package/dist/hosted-transport/answer-rows.js.map +1 -1
- package/dist/hosted-transport/attribution.d.ts +32 -0
- package/dist/hosted-transport/attribution.d.ts.map +1 -0
- package/dist/hosted-transport/attribution.js +38 -0
- package/dist/hosted-transport/attribution.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 +35 -11
- package/dist/hosted-transport/carrier.d.ts.map +1 -1
- package/dist/hosted-transport/carrier.js +101 -57
- package/dist/hosted-transport/carrier.js.map +1 -1
- package/dist/hosted-transport/document-backend.d.ts +74 -0
- package/dist/hosted-transport/document-backend.d.ts.map +1 -0
- package/dist/hosted-transport/document-backend.js +160 -0
- package/dist/hosted-transport/document-backend.js.map +1 -0
- package/dist/hosted-transport/index.d.ts +7 -4
- package/dist/hosted-transport/index.d.ts.map +1 -1
- package/dist/hosted-transport/index.js +7 -4
- package/dist/hosted-transport/index.js.map +1 -1
- package/dist/hosted-transport/operations.d.ts +6 -0
- package/dist/hosted-transport/operations.d.ts.map +1 -1
- package/dist/hosted-transport/operations.js +2 -1
- package/dist/hosted-transport/operations.js.map +1 -1
- package/dist/hosted-transport/port-run.d.ts +41 -0
- package/dist/hosted-transport/port-run.d.ts.map +1 -0
- package/dist/hosted-transport/port-run.js +92 -0
- package/dist/hosted-transport/port-run.js.map +1 -0
- package/dist/hosted-transport/read-adapter.d.ts +19 -3
- package/dist/hosted-transport/read-adapter.d.ts.map +1 -1
- package/dist/hosted-transport/read-adapter.js +18 -5
- package/dist/hosted-transport/read-adapter.js.map +1 -1
- package/dist/hosted-transport/root-write.d.ts.map +1 -1
- package/dist/hosted-transport/root-write.js +5 -2
- package/dist/hosted-transport/root-write.js.map +1 -1
- package/dist/hosted-transport/whole-document-transport.d.ts +56 -7
- package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -1
- package/dist/hosted-transport/whole-document-transport.js +120 -31
- package/dist/hosted-transport/whole-document-transport.js.map +1 -1
- package/dist/identity-fold.d.ts +16 -0
- package/dist/identity-fold.d.ts.map +1 -0
- package/dist/identity-fold.js +24 -0
- package/dist/identity-fold.js.map +1 -0
- package/dist/index-projection.d.ts +2 -1
- package/dist/index-projection.d.ts.map +1 -1
- package/dist/index-projection.js +38 -28
- package/dist/index-projection.js.map +1 -1
- package/dist/index.d.ts +59 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -20
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-backend.d.ts +0 -31
- package/dist/indexeddb-backend.d.ts.map +1 -1
- package/dist/indexeddb-backend.js +5 -2
- 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 +14 -4
- package/dist/journaled-backend.d.ts.map +1 -1
- package/dist/journaled-backend.js +19 -78
- package/dist/journaled-backend.js.map +1 -1
- package/dist/json-data.d.ts +3 -0
- package/dist/json-data.d.ts.map +1 -0
- package/dist/json-data.js +19 -0
- package/dist/json-data.js.map +1 -0
- package/dist/kind-authoring.d.ts +188 -0
- package/dist/kind-authoring.d.ts.map +1 -0
- package/dist/kind-authoring.js +520 -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 +16 -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 +100 -0
- package/dist/kind-coverage.d.ts.map +1 -0
- package/dist/kind-coverage.js +185 -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 +7 -2
- 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/kind-undeclared-fields.d.ts +72 -0
- package/dist/kind-undeclared-fields.d.ts.map +1 -0
- package/dist/kind-undeclared-fields.js +124 -0
- package/dist/kind-undeclared-fields.js.map +1 -0
- package/dist/kinds-load.d.ts.map +1 -1
- package/dist/kinds-load.js +8 -5
- package/dist/kinds-load.js.map +1 -1
- package/dist/kinds.d.ts +105 -13
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +369 -30
- package/dist/kinds.js.map +1 -1
- package/dist/link-add.d.ts +81 -0
- package/dist/link-add.d.ts.map +1 -0
- package/dist/link-add.js +94 -0
- package/dist/link-add.js.map +1 -0
- 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-findings.d.ts +132 -0
- package/dist/link-findings.d.ts.map +1 -0
- package/dist/link-findings.js +263 -0
- package/dist/link-findings.js.map +1 -0
- package/dist/link-types.d.ts +34 -0
- package/dist/link-types.d.ts.map +1 -0
- package/dist/link-types.js +79 -0
- package/dist/link-types.js.map +1 -0
- package/dist/links.d.ts +68 -9
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +370 -57
- package/dist/links.js.map +1 -1
- package/dist/local-search-index.d.ts +86 -0
- package/dist/local-search-index.d.ts.map +1 -0
- package/dist/local-search-index.js +1055 -0
- package/dist/local-search-index.js.map +1 -0
- package/dist/managed-document-metadata.d.ts +5 -0
- package/dist/managed-document-metadata.d.ts.map +1 -0
- package/dist/managed-document-metadata.js +10 -0
- package/dist/managed-document-metadata.js.map +1 -0
- package/dist/markdown-syntax.d.ts +39 -0
- package/dist/markdown-syntax.d.ts.map +1 -0
- package/dist/markdown-syntax.js +10170 -0
- package/dist/markdown-syntax.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 +40 -2
- package/dist/memory-backend.js.map +1 -1
- package/dist/mutation-attribution.d.ts +2 -1
- package/dist/mutation-attribution.d.ts.map +1 -1
- package/dist/mutation-attribution.js.map +1 -1
- package/dist/okf-actor.d.ts +14 -3
- package/dist/okf-actor.d.ts.map +1 -1
- package/dist/okf-actor.js +25 -4
- package/dist/okf-actor.js.map +1 -1
- package/dist/okf-authored-values.d.ts +2 -0
- package/dist/okf-authored-values.d.ts.map +1 -1
- package/dist/okf-authored-values.js +4 -0
- package/dist/okf-authored-values.js.map +1 -1
- package/dist/okf-authoring.d.ts +7 -0
- package/dist/okf-authoring.d.ts.map +1 -0
- package/dist/okf-authoring.js +30 -0
- package/dist/okf-authoring.js.map +1 -0
- package/dist/okf-standard-fields.d.ts +4 -0
- package/dist/okf-standard-fields.d.ts.map +1 -1
- package/dist/okf-standard-fields.js +24 -14
- package/dist/okf-standard-fields.js.map +1 -1
- package/dist/okf-timestamps.d.ts +2 -2
- package/dist/okf-timestamps.d.ts.map +1 -1
- package/dist/okf-timestamps.js +25 -15
- package/dist/okf-timestamps.js.map +1 -1
- package/dist/page.d.ts +3 -7
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +3 -7
- package/dist/page.js.map +1 -1
- package/dist/path-fold.d.ts +67 -0
- package/dist/path-fold.d.ts.map +1 -0
- package/dist/path-fold.js +107 -0
- package/dist/path-fold.js.map +1 -0
- package/dist/paths.d.ts +46 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +114 -1
- package/dist/paths.js.map +1 -1
- package/dist/platform.d.ts +13 -0
- 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-contract.d.ts +17 -0
- package/dist/portable-export-contract.d.ts.map +1 -0
- package/dist/portable-export-contract.js +59 -0
- package/dist/portable-export-contract.js.map +1 -0
- package/dist/portable-export.d.ts +115 -0
- package/dist/portable-export.d.ts.map +1 -0
- package/dist/portable-export.js +452 -0
- package/dist/portable-export.js.map +1 -0
- package/dist/portable-frontmatter.d.ts +17 -0
- package/dist/portable-frontmatter.d.ts.map +1 -1
- package/dist/portable-frontmatter.js +42 -5
- package/dist/portable-frontmatter.js.map +1 -1
- 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 +121 -0
- package/dist/qualified-links.js.map +1 -0
- package/dist/query-filter.d.ts +11 -4
- package/dist/query-filter.d.ts.map +1 -1
- package/dist/query-filter.js +25 -6
- package/dist/query-filter.js.map +1 -1
- package/dist/query-order.d.ts.map +1 -1
- package/dist/query-order.js +2 -1
- package/dist/query-order.js.map +1 -1
- 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 +134 -0
- package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
- package/dist/recipe-lifecycle/evolution.js +1047 -0
- package/dist/recipe-lifecycle/evolution.js.map +1 -0
- package/dist/recipe-lifecycle/index.d.ts +38 -0
- package/dist/recipe-lifecycle/index.d.ts.map +1 -0
- package/dist/recipe-lifecycle/index.js +31 -0
- package/dist/recipe-lifecycle/index.js.map +1 -0
- package/dist/recipe-lifecycle/install.d.ts +172 -0
- package/dist/recipe-lifecycle/install.d.ts.map +1 -0
- package/dist/recipe-lifecycle/install.js +652 -0
- package/dist/recipe-lifecycle/install.js.map +1 -0
- package/dist/recipe-lifecycle/legacy-aliases.d.ts +4 -0
- package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
- package/dist/recipe-lifecycle/legacy-aliases.js +22 -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/set-commit.d.ts +31 -0
- package/dist/recipe-lifecycle/set-commit.d.ts.map +1 -0
- package/dist/recipe-lifecycle/set-commit.js +37 -0
- package/dist/recipe-lifecycle/set-commit.js.map +1 -0
- package/dist/recipe-lifecycle/stamp.d.ts +146 -0
- package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
- package/dist/recipe-lifecycle/stamp.js +361 -0
- package/dist/recipe-lifecycle/stamp.js.map +1 -0
- package/dist/recipe-qualify.d.ts +80 -0
- package/dist/recipe-qualify.d.ts.map +1 -0
- package/dist/recipe-qualify.js +352 -0
- package/dist/recipe-qualify.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/recipe-sources.d.ts +209 -0
- package/dist/recipe-sources.d.ts.map +1 -0
- package/dist/recipe-sources.js +607 -0
- package/dist/recipe-sources.js.map +1 -0
- package/dist/recipes.d.ts +45 -1
- package/dist/recipes.d.ts.map +1 -1
- package/dist/recipes.js +138 -1
- package/dist/recipes.js.map +1 -1
- package/dist/record-overlay/apply.d.ts +45 -0
- package/dist/record-overlay/apply.d.ts.map +1 -0
- package/dist/record-overlay/apply.js +535 -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 +86 -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 +77 -0
- package/dist/record-overlay/policy.d.ts.map +1 -0
- package/dist/record-overlay/policy.js +238 -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 +52 -0
- package/dist/record-overlay/signal-text.d.ts.map +1 -0
- package/dist/record-overlay/signal-text.js +126 -0
- package/dist/record-overlay/signal-text.js.map +1 -0
- package/dist/record-overlay/source-index.d.ts +21 -0
- package/dist/record-overlay/source-index.d.ts.map +1 -0
- package/dist/record-overlay/source-index.js +109 -0
- package/dist/record-overlay/source-index.js.map +1 -0
- package/dist/record-overlay/types.d.ts +293 -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/relationships.d.ts +71 -0
- package/dist/relationships.d.ts.map +1 -0
- package/dist/relationships.js +87 -0
- package/dist/relationships.js.map +1 -0
- package/dist/remote-backend.d.ts +11 -21
- package/dist/remote-backend.d.ts.map +1 -1
- package/dist/remote-backend.js +20 -15
- 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-operations.d.ts +0 -41
- package/dist/remote-operations.d.ts.map +1 -1
- package/dist/remote-operations.js +14 -2
- package/dist/remote-operations.js.map +1 -1
- package/dist/remote-parsers.d.ts +19 -0
- package/dist/remote-parsers.d.ts.map +1 -1
- package/dist/remote-parsers.js.map +1 -1
- package/dist/remote.d.ts +2 -4
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +2 -3
- package/dist/remote.js.map +1 -1
- package/dist/reserved-write.d.ts +9 -0
- package/dist/reserved-write.d.ts.map +1 -0
- package/dist/reserved-write.js +15 -0
- package/dist/reserved-write.js.map +1 -0
- 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 +57 -0
- package/dist/search/backend-source.js.map +1 -0
- package/dist/search/contract.d.ts +162 -0
- package/dist/search/contract.d.ts.map +1 -0
- package/dist/search/contract.js +82 -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 +238 -0
- package/dist/search/memory-source.js.map +1 -0
- package/dist/search/rank.d.ts +29 -0
- package/dist/search/rank.d.ts.map +1 -0
- package/dist/search/rank.js +132 -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 +265 -0
- package/dist/search/search.js.map +1 -0
- package/dist/search/source.d.ts +70 -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 +49 -0
- package/dist/search/text.d.ts.map +1 -0
- package/dist/search/text.js +165 -0
- package/dist/search/text.js.map +1 -0
- package/dist/search-index.d.ts +9 -0
- package/dist/search-index.d.ts.map +1 -0
- package/dist/search-index.js +9 -0
- package/dist/search-index.js.map +1 -0
- package/dist/sha256.d.ts.map +1 -1
- package/dist/sha256.js +3 -2
- package/dist/sha256.js.map +1 -1
- 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/site-manifest.d.ts +51 -0
- package/dist/site-manifest.d.ts.map +1 -0
- package/dist/site-manifest.js +115 -0
- package/dist/site-manifest.js.map +1 -0
- package/dist/skip-reasons.d.ts +12 -0
- package/dist/skip-reasons.d.ts.map +1 -0
- package/dist/skip-reasons.js +15 -0
- package/dist/skip-reasons.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 +513 -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 +35 -0
- package/dist/source-engine/index.d.ts.map +1 -0
- package/dist/source-engine/index.js +27 -0
- package/dist/source-engine/index.js.map +1 -0
- package/dist/source-engine/machine-state.d.ts +87 -0
- package/dist/source-engine/machine-state.d.ts.map +1 -0
- package/dist/source-engine/machine-state.js +94 -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 +276 -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 +105 -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/target-consumer.d.ts +12 -0
- package/dist/source-engine/target-consumer.d.ts.map +1 -0
- package/dist/source-engine/target-consumer.js +15 -0
- package/dist/source-engine/target-consumer.js.map +1 -0
- package/dist/source-engine/target-descriptor.d.ts +3 -0
- package/dist/source-engine/target-descriptor.d.ts.map +1 -0
- package/dist/source-engine/target-descriptor.js +26 -0
- package/dist/source-engine/target-descriptor.js.map +1 -0
- package/dist/source-engine/target.d.ts +82 -0
- package/dist/source-engine/target.d.ts.map +1 -0
- package/dist/source-engine/target.js +213 -0
- package/dist/source-engine/target.js.map +1 -0
- package/dist/source-engine/types.d.ts +296 -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-harness/contract.d.ts +109 -0
- package/dist/storage-harness/contract.d.ts.map +1 -0
- package/dist/storage-harness/contract.js +853 -0
- package/dist/storage-harness/contract.js.map +1 -0
- package/dist/storage-harness/index.d.ts +39 -0
- package/dist/storage-harness/index.d.ts.map +1 -0
- package/dist/storage-harness/index.js +55 -0
- package/dist/storage-harness/index.js.map +1 -0
- package/dist/storage.d.ts +10 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +10 -2
- 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 +78 -0
- package/dist/string-identity-agreement.js.map +1 -0
- package/dist/system-documents.d.ts +82 -0
- package/dist/system-documents.d.ts.map +1 -0
- package/dist/system-documents.js +127 -0
- package/dist/system-documents.js.map +1 -0
- package/dist/types.d.ts +28 -4
- 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 +119 -6
- package/dist/uncertain-write.d.ts.map +1 -1
- package/dist/uncertain-write.js +67 -32
- package/dist/uncertain-write.js.map +1 -1
- package/dist/validation.d.ts +5 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/verification.d.ts +22 -10
- package/dist/verification.d.ts.map +1 -1
- package/dist/verification.js +87 -39
- package/dist/verification.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 +184 -10
package/dist/backend.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* rename). It is the DEGENERATE case of the seam's hard contract: `version` is the
|
|
9
9
|
* SHA of the on-disk bytes, and `versions()` reports only the single current
|
|
10
10
|
* revision because a plain filesystem keeps no history. Compare-and-swap is
|
|
11
|
-
* serialized per logical identity across processes by
|
|
11
|
+
* serialized per exact-root domain, then per logical identity, across processes by private runtime locks;
|
|
12
12
|
* a process-local promise queue avoids filesystem polling among callers in one process.
|
|
13
13
|
* `MemoryBackend`
|
|
14
14
|
* (`memory-backend.ts`) implements the SAME contract for the hard case; a remote
|
|
@@ -23,15 +23,27 @@
|
|
|
23
23
|
* A remote backend that stores already-structured documents need not parse markdown
|
|
24
24
|
* at all — parsing is an implementation detail of THIS adapter, not of the seam.
|
|
25
25
|
*/
|
|
26
|
+
import { type InventoryGuard } from "./inventory-guard.js";
|
|
27
|
+
import type { WalkPathClass } from "./paths.js";
|
|
28
|
+
import { type QueryOptions } from "./document-scan.js";
|
|
29
|
+
import { type RelationshipSource } from "./relationships.js";
|
|
26
30
|
import type { BlobKey, ConceptId, DeleteOptions, OkfDocument, ReadBlobResult, ReadResult, ReservedFilename, ReservedReadResult, StorageBackend, Version, VersionInfo, WriteOptions } from "./types.js";
|
|
27
|
-
import type { FilesystemBackendOptions } from "./filesystem-host.js";
|
|
31
|
+
import type { FilesystemBackendOptions, FilesystemHostPolicy } from "./filesystem-host.js";
|
|
28
32
|
/**
|
|
29
33
|
* The default {@link StorageBackend}: a filesystem-backed OKF bundle rooted at an
|
|
30
34
|
* absolute directory. Concept documents are markdown files at `<id>.md`; reserved
|
|
31
35
|
* files live at `<dir>/index.md` and `<dir>/log.md`.
|
|
32
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* Run `body` holding the root lock every backend write to the bundle at `root` holds, for an outside
|
|
39
|
+
* step that moves files under the root (a Git rebase, say), so writes land before or after it,
|
|
40
|
+
* never inside it. `body` receives no capability and must not write through a backend for the same
|
|
41
|
+
* root: that write would wait on this lock.
|
|
42
|
+
*/
|
|
43
|
+
export declare function withFilesystemRootMutationLock<T>(root: string, body: () => Promise<T>, hostPolicy?: FilesystemHostPolicy): Promise<T>;
|
|
33
44
|
export declare class FilesystemBackend implements StorageBackend {
|
|
34
45
|
#private;
|
|
46
|
+
get inventoryGuard(): InventoryGuard;
|
|
35
47
|
/**
|
|
36
48
|
* The root is resolved once here: a relative root would otherwise re-resolve against the
|
|
37
49
|
* process's current directory on every operation, so a later `chdir` would silently move the
|
|
@@ -40,6 +52,8 @@ export declare class FilesystemBackend implements StorageBackend {
|
|
|
40
52
|
constructor(root: string, options?: FilesystemBackendOptions);
|
|
41
53
|
read(id: ConceptId): Promise<ReadResult>;
|
|
42
54
|
readMany(ids: ConceptId[]): Promise<ReadResult[]>;
|
|
55
|
+
/** Cache contains parsed link facts only. Every reuse still opens the exact, readable file. */
|
|
56
|
+
relationshipSources(options?: QueryOptions): Promise<RelationshipSource[] | undefined>;
|
|
43
57
|
write(id: ConceptId, doc: OkfDocument, options?: WriteOptions): Promise<Version>;
|
|
44
58
|
delete(id: ConceptId, options?: DeleteOptions): Promise<boolean>;
|
|
45
59
|
versions(id: ConceptId): Promise<VersionInfo[]>;
|
|
@@ -52,6 +66,7 @@ export declare class FilesystemBackend implements StorageBackend {
|
|
|
52
66
|
deleteBlob(key: BlobKey, options?: DeleteOptions): Promise<boolean>;
|
|
53
67
|
existsBlob(key: BlobKey): Promise<boolean>;
|
|
54
68
|
listBlobs(prefix?: string): Promise<BlobKey[]>;
|
|
69
|
+
classifyChangedPath(relPath: string): WalkPathClass;
|
|
55
70
|
capabilities(): {
|
|
56
71
|
readonly history: false;
|
|
57
72
|
readonly enforced_cas: true;
|
|
@@ -60,11 +75,44 @@ export declare class FilesystemBackend implements StorageBackend {
|
|
|
60
75
|
readonly backlinks: false;
|
|
61
76
|
};
|
|
62
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Replace one bundle-relative file whole, under the same identity lock, exact spelling and
|
|
80
|
+
* raw-bytes compare-and-swap as `writeBlob`, for a caller that owns which files it may write (a
|
|
81
|
+
* board conflict keep of a file that is not a document). `expectedVersion` is the version of the
|
|
82
|
+
* bytes the caller judged, or null when it judged the file absent.
|
|
83
|
+
*/
|
|
84
|
+
export declare function replaceFilesystemFile(backend: FilesystemBackend, rel: string, bytes: Uint8Array, expectedVersion: Version | null): Promise<Version>;
|
|
85
|
+
/** Read-only exact-spelling metadata observation for a safe blob pathname. Reads no body and
|
|
86
|
+
* creates no directories; alias/unsafe observations retain the identity owner's typed refusal. */
|
|
87
|
+
export declare function probeFilesystemPath(backend: FilesystemBackend, key: string): Promise<"exact" | "absent">;
|
|
88
|
+
/**
|
|
89
|
+
* The content stamp of a document's file, by `lstat`, for derived state kept outside the bundle (the
|
|
90
|
+
* local search index): equal settled stamps mean equal bytes. `undefined` when the stamp cannot
|
|
91
|
+
* vouch for the file (absent, a link, an untrusted volume); the caller then reads the document.
|
|
92
|
+
*/
|
|
93
|
+
export declare function filesystemDocumentStamp(backend: FilesystemBackend, id: ConceptId): Promise<{
|
|
94
|
+
value: string;
|
|
95
|
+
settled: boolean;
|
|
96
|
+
} | undefined>;
|
|
63
97
|
/** Internal exact-byte authority for the publication adapter; not part of StorageBackend. */
|
|
64
98
|
export declare function readRawFilesystemDocument(backend: FilesystemBackend, id: ConceptId): Promise<{
|
|
65
99
|
bytes: Uint8Array;
|
|
66
100
|
version: Version;
|
|
67
101
|
}>;
|
|
102
|
+
/**
|
|
103
|
+
* {@link readRawFilesystemDocument} for many documents in one observation pass, so a capture
|
|
104
|
+
* lists each directory once instead of twice per document. `read` answers exactly what
|
|
105
|
+
* `readRawFilesystemDocument` would, in the caller's order; `finish` ends the pass and returns
|
|
106
|
+
* the ids whose answers the end-of-pass check could not confirm, for the caller to read again
|
|
107
|
+
* with `readRawFilesystemDocument`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function openRawFilesystemDocumentPass(backend: FilesystemBackend): {
|
|
110
|
+
read(id: ConceptId): Promise<{
|
|
111
|
+
bytes: Uint8Array;
|
|
112
|
+
version: Version;
|
|
113
|
+
}>;
|
|
114
|
+
finish(): Promise<ConceptId[]>;
|
|
115
|
+
};
|
|
68
116
|
/** Internal exact-byte authority for reserved publication objects. */
|
|
69
117
|
export declare function readRawFilesystemReserved(backend: FilesystemBackend, dir: string, name: ReservedFilename): Promise<{
|
|
70
118
|
bytes: Uint8Array;
|
package/dist/backend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"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"}
|
package/dist/backend.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* rename). It is the DEGENERATE case of the seam's hard contract: `version` is the
|
|
9
9
|
* SHA of the on-disk bytes, and `versions()` reports only the single current
|
|
10
10
|
* revision because a plain filesystem keeps no history. Compare-and-swap is
|
|
11
|
-
* serialized per logical identity across processes by
|
|
11
|
+
* serialized per exact-root domain, then per logical identity, across processes by private runtime locks;
|
|
12
12
|
* a process-local promise queue avoids filesystem polling among callers in one process.
|
|
13
13
|
* `MemoryBackend`
|
|
14
14
|
* (`memory-backend.ts`) implements the SAME contract for the hard case; a remote
|
|
@@ -23,16 +23,80 @@
|
|
|
23
23
|
* A remote backend that stores already-structured documents need not parse markdown
|
|
24
24
|
* at all — parsing is an implementation detail of THIS adapter, not of the seam.
|
|
25
25
|
*/
|
|
26
|
+
var _a;
|
|
26
27
|
import path from "node:path";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
28
|
+
import { assertInventoryGuardBound, bindInventoryGuard, captureInventoryGuardRequest, compareInventoryPremises, guardEdition, inventoryDigest, INVENTORY_GUARD_DOMAIN, InventoryGuardUnsupported, InventoryGuardConflict } from "./inventory-guard.js";
|
|
29
|
+
import { parseMarkdown, preservesStoredTimestamp, stringifyDoc } from "./frontmatter.js";
|
|
30
|
+
import { isOkfRecord } from "./okf-authored-values.js";
|
|
31
|
+
import { deriveRelationshipSource, readBundleOkfVersion } from "./engine.js";
|
|
29
32
|
import { resolveContentType } from "./content-type.js";
|
|
30
|
-
import { assertSafeBlobKey, assertSafeConceptId, assertSafeReservedDir, assertSafeReservedFilename, compareStorageKeys, conceptIdFromPath, isReservedFile, pathFromConceptId, toPosix, } from "./paths.js";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
+
import { assertSafeBlobKey, assertSafeConceptId, assertSafeFilePath, assertSafeReservedDir, assertSafeReservedFilename, classifyWalkPath, compareStorageKeys, conceptIdFromPath, hasMarkdownExtension, isHiddenWalkEntry, isReservedFile, pathFromConceptId, toPosix, } from "./paths.js";
|
|
34
|
+
import { assertStorableReservedWrite } from "./reserved-write.js";
|
|
35
|
+
import { readManyExisting } from "./document-scan.js";
|
|
36
|
+
import { relationshipProjectionForEdition, resolveRelationshipSources } from "./relationships.js";
|
|
37
|
+
import { ConcurrentReplacementError, InvalidInputError } from "./errors.js";
|
|
38
|
+
import { mutateExact, createFilesystemMutationCoordinator, filesystemRootMutationKey, filesystemRootWitness, createNodeFilesystemIdentityPort, observeExact, openObservationPass, probeExact, } from "./filesystem-identity.js";
|
|
33
39
|
import { mutationActorFromFrontmatter } from "./mutation-attribution.js";
|
|
34
|
-
import { blobVersion,
|
|
40
|
+
import { blobVersion, VersionConflict, versionOfBytes } from "./versioning.js";
|
|
41
|
+
function relationshipCacheFormat(projection) {
|
|
42
|
+
// Old readers must rebuild instead of reusing facts derived under the 0.3 rules.
|
|
43
|
+
return projection.conceptsOnly ? 3 : 1;
|
|
44
|
+
}
|
|
45
|
+
function cachedRelationshipSource(value, projection) {
|
|
46
|
+
if (!isOkfRecord(value))
|
|
47
|
+
return;
|
|
48
|
+
const { id, title, type, stamp, links, concept } = value;
|
|
49
|
+
// A record without `type` predates heads that carry it, and is derived again.
|
|
50
|
+
if (typeof id !== "string" || (typeof title !== "string" && title !== null) ||
|
|
51
|
+
(typeof type !== "string" && type !== null) || typeof stamp !== "string" || !Array.isArray(links))
|
|
52
|
+
return;
|
|
53
|
+
const occurrences = [];
|
|
54
|
+
for (const occurrence of links) {
|
|
55
|
+
if (!isOkfRecord(occurrence))
|
|
56
|
+
return;
|
|
57
|
+
const { from, to, text, href } = occurrence;
|
|
58
|
+
if (typeof from !== "string" || typeof to !== "string" ||
|
|
59
|
+
typeof text !== "string" || typeof href !== "string")
|
|
60
|
+
return;
|
|
61
|
+
occurrences.push({ from, to, text, href });
|
|
62
|
+
}
|
|
63
|
+
if (projection.conceptsOnly && typeof concept !== "boolean")
|
|
64
|
+
return;
|
|
65
|
+
return { id, title, type, stamp, links: occurrences, ...(typeof concept === "boolean" ? { concept } : {}) };
|
|
66
|
+
}
|
|
67
|
+
function cachedRelationshipSources(raw, projection, edition) {
|
|
68
|
+
if (raw === undefined)
|
|
69
|
+
return;
|
|
70
|
+
let cache;
|
|
71
|
+
try {
|
|
72
|
+
cache = JSON.parse(raw);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!isOkfRecord(cache) || cache.format !== relationshipCacheFormat(projection) || !Array.isArray(cache.sources))
|
|
78
|
+
return;
|
|
79
|
+
// A cache hit must also reflect the reader's frontmatter decoding, which a hit skips.
|
|
80
|
+
if ((cache.edition !== null && typeof cache.edition !== "string") ||
|
|
81
|
+
preservesStoredTimestamp(cache.edition ?? undefined) !== preservesStoredTimestamp(edition))
|
|
82
|
+
return;
|
|
83
|
+
// Older local caches qualified their parser with the root edition separately.
|
|
84
|
+
const parser = cache.format === 3 && cache.parser === "links/v3" && cache.edition === "0.3"
|
|
85
|
+
? "links/v3/okf-0.3" : cache.parser;
|
|
86
|
+
if (parser !== projection.parserVersion)
|
|
87
|
+
return;
|
|
88
|
+
const records = new Map();
|
|
89
|
+
for (const value of cache.sources) {
|
|
90
|
+
const record = cachedRelationshipSource(value, projection);
|
|
91
|
+
if (record === undefined)
|
|
92
|
+
return;
|
|
93
|
+
records.set(record.id, record);
|
|
94
|
+
}
|
|
95
|
+
return records;
|
|
96
|
+
}
|
|
35
97
|
const publicationContexts = new WeakMap();
|
|
98
|
+
/** Each backend's own locked exact mutation, for {@link replaceFilesystemFile}; never handed out. */
|
|
99
|
+
const fileMutations = new WeakMap();
|
|
36
100
|
/** First trimmed non-empty string among `vals`, else `undefined`. */
|
|
37
101
|
function firstString(...vals) {
|
|
38
102
|
for (const v of vals) {
|
|
@@ -77,8 +141,8 @@ async function walkFiles(port, root, keep, sub = "") {
|
|
|
77
141
|
const entries = (await port.entries(path.join(root, sub))) ?? [];
|
|
78
142
|
const out = [];
|
|
79
143
|
for (const entry of entries) {
|
|
80
|
-
if (entry.name
|
|
81
|
-
continue;
|
|
144
|
+
if (isHiddenWalkEntry(entry.name))
|
|
145
|
+
continue;
|
|
82
146
|
const rel = sub === "" ? entry.name : `${sub}/${entry.name}`;
|
|
83
147
|
if (entry.kind === "directory") {
|
|
84
148
|
out.push(...(await walkFiles(port, root, keep, rel)));
|
|
@@ -101,9 +165,82 @@ function reservedPath(dir, name) {
|
|
|
101
165
|
* absolute directory. Concept documents are markdown files at `<id>.md`; reserved
|
|
102
166
|
* files live at `<dir>/index.md` and `<dir>/log.md`.
|
|
103
167
|
*/
|
|
168
|
+
/**
|
|
169
|
+
* Run `body` holding the root lock every backend write to the bundle at `root` holds, for an outside
|
|
170
|
+
* step that moves files under the root (a Git rebase, say), so writes land before or after it,
|
|
171
|
+
* never inside it. `body` receives no capability and must not write through a backend for the same
|
|
172
|
+
* root: that write would wait on this lock.
|
|
173
|
+
*/
|
|
174
|
+
export function withFilesystemRootMutationLock(root, body, hostPolicy) {
|
|
175
|
+
return createFilesystemMutationCoordinator(createNodeFilesystemIdentityPort(hostPolicy), path.resolve(root), hostPolicy).run(body);
|
|
176
|
+
}
|
|
104
177
|
export class FilesystemBackend {
|
|
105
178
|
#root;
|
|
106
179
|
#port;
|
|
180
|
+
#coordinator;
|
|
181
|
+
/** The coordinator is private: no transaction callback or held-root capability escapes. */
|
|
182
|
+
#withRootMutation(body) {
|
|
183
|
+
return this.#coordinator.run(body);
|
|
184
|
+
}
|
|
185
|
+
#mutateExact(rel, body) {
|
|
186
|
+
return this.#withRootMutation(() => mutateExact(this.#port, this.#root, rel, body));
|
|
187
|
+
}
|
|
188
|
+
#assertInventoryGuard() {
|
|
189
|
+
if (Object.getPrototypeOf(this) !== _a.prototype || ["read", "readMany", "list", "write", "delete", "writeReserved", "writeBlob", "deleteBlob", "readReserved"].some(name => this[name] !== _a.prototype[name])) {
|
|
190
|
+
throw new InventoryGuardUnsupported("unqualified_filesystem_override");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
get inventoryGuard() {
|
|
194
|
+
this.#assertInventoryGuard();
|
|
195
|
+
return bindInventoryGuard(this, {
|
|
196
|
+
observeTarget: () => this.#withRootMutation(() => { this.#assertInventoryGuard(); return this.#guardTarget(); }),
|
|
197
|
+
compareInventoryAndWrite: async (input) => {
|
|
198
|
+
const request = captureInventoryGuardRequest(input);
|
|
199
|
+
const raw = stringifyDoc(request.doc.frontmatter, request.doc.body);
|
|
200
|
+
return this.#withRootMutation(async () => {
|
|
201
|
+
this.#assertInventoryGuard();
|
|
202
|
+
const target = await this.#guardTarget();
|
|
203
|
+
const inventory = [];
|
|
204
|
+
const ids = await this.list();
|
|
205
|
+
assertInventoryGuardBound(ids.length);
|
|
206
|
+
const deadline = performance.now() + 5_000;
|
|
207
|
+
for (const id of ids) {
|
|
208
|
+
if (performance.now() > deadline)
|
|
209
|
+
throw new InventoryGuardUnsupported("inventory_scan_time_bound");
|
|
210
|
+
// Parse as well as retaining exact raw bytes: malformed/undecodable input is unknown.
|
|
211
|
+
const raw = await readRawFilesystemDocument(this, id);
|
|
212
|
+
parseMarkdown(new TextDecoder("utf-8", { fatal: true }).decode(raw.bytes), pathFromConceptId(id), { okfVersion: target.edition });
|
|
213
|
+
inventory.push({ id, version: raw.version });
|
|
214
|
+
}
|
|
215
|
+
if (performance.now() > deadline)
|
|
216
|
+
throw new InventoryGuardUnsupported("inventory_scan_time_bound");
|
|
217
|
+
compareInventoryPremises(request, target, inventory);
|
|
218
|
+
// The private already-held path cannot reacquire root or invoke a public override.
|
|
219
|
+
const version = await mutateExact(this.#port, this.#root, pathFromConceptId(request.id), async (leaf) => {
|
|
220
|
+
compareInventoryPremises(request, await this.#guardTarget(), inventory);
|
|
221
|
+
const bytes = await leaf.current();
|
|
222
|
+
if (bytes === null || versionOfBytes(bytes.toString("utf8")) !== request.expectedVersion)
|
|
223
|
+
throw new InventoryGuardConflict("target_version");
|
|
224
|
+
await leaf.replace(Buffer.from(raw, "utf8"));
|
|
225
|
+
return versionOfBytes(raw);
|
|
226
|
+
});
|
|
227
|
+
return { version, target, inventory_digest: inventoryDigest(inventory) };
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
async #guardTarget() {
|
|
233
|
+
const witness = await filesystemRootWitness(this.#port, this.#root);
|
|
234
|
+
const metadata = await readRawFilesystemReserved(this, "", "index.md");
|
|
235
|
+
// A lossy replacement character cannot stand in for an exact root-metadata premise.
|
|
236
|
+
const content = metadata === null ? null : new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(metadata.bytes);
|
|
237
|
+
const edition = guardEdition(content);
|
|
238
|
+
const after = await filesystemRootWitness(this.#port, this.#root);
|
|
239
|
+
if (witness !== after)
|
|
240
|
+
throw new InventoryGuardConflict("identity");
|
|
241
|
+
const store = versionOfBytes(`${await filesystemRootMutationKey(this.#root)}:${this.#coordinator.namespace()}:${witness}`);
|
|
242
|
+
return { contract: "inventory-guard/v1", domain: INVENTORY_GUARD_DOMAIN, adapter: "filesystem", store, edition, root_version: blobVersion(metadata.bytes) };
|
|
243
|
+
}
|
|
107
244
|
/**
|
|
108
245
|
* The root is resolved once here: a relative root would otherwise re-resolve against the
|
|
109
246
|
* process's current directory on every operation, so a later `chdir` would silently move the
|
|
@@ -112,26 +249,21 @@ export class FilesystemBackend {
|
|
|
112
249
|
constructor(root, options = {}) {
|
|
113
250
|
this.#port = createNodeFilesystemIdentityPort(options.hostPolicy);
|
|
114
251
|
this.#root = path.resolve(root);
|
|
252
|
+
this.#coordinator = createFilesystemMutationCoordinator(this.#port, this.#root, options.hostPolicy);
|
|
115
253
|
publicationContexts.set(this, { root: this.#root, port: this.#port });
|
|
254
|
+
fileMutations.set(this, (rel, body) => this.#mutateExact(rel, body));
|
|
116
255
|
}
|
|
117
256
|
async read(id) {
|
|
118
257
|
return this.#readWithEdition(id, () => this.#readEdition());
|
|
119
258
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return await readBundleOkfVersion(this);
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
// Malformed metadata must not hide otherwise readable documents from repair tools.
|
|
126
|
-
if (!(error instanceof MalformedDocumentError))
|
|
127
|
-
throw error;
|
|
128
|
-
return undefined;
|
|
129
|
-
}
|
|
259
|
+
#readEdition() {
|
|
260
|
+
return readBundleOkfVersion(this, { allowMalformedRoot: true });
|
|
130
261
|
}
|
|
131
|
-
async #readWithEdition(id, edition) {
|
|
262
|
+
async #readWithEdition(id, edition, pass) {
|
|
132
263
|
assertSafeConceptId(id);
|
|
133
264
|
const rel = pathFromConceptId(id);
|
|
134
|
-
const
|
|
265
|
+
const read = (handle) => readBytes(this.#port, handle);
|
|
266
|
+
const observed = pass ? await pass.observe(rel, read) : await observeExact(this.#port, this.#root, rel, read);
|
|
135
267
|
if (observed.state === "absent")
|
|
136
268
|
throw notFound(this.#root, rel);
|
|
137
269
|
const raw = observed.value.toString("utf8");
|
|
@@ -144,7 +276,7 @@ export class FilesystemBackend {
|
|
|
144
276
|
assertSafeConceptId(id);
|
|
145
277
|
const out = [];
|
|
146
278
|
// Preserve the existing extension point for subclasses that customize document reads.
|
|
147
|
-
if (this.read !==
|
|
279
|
+
if (this.read !== _a.prototype.read) {
|
|
148
280
|
for (const id of ids)
|
|
149
281
|
out.push(await this.read(id));
|
|
150
282
|
return out;
|
|
@@ -153,10 +285,88 @@ export class FilesystemBackend {
|
|
|
153
285
|
// lookup preserves document-before-root error ordering and avoids I/O for an empty batch.
|
|
154
286
|
let editionPromise;
|
|
155
287
|
const edition = () => editionPromise ??= this.#readEdition();
|
|
288
|
+
// One observation pass per batch, so each directory is listed once rather than twice per
|
|
289
|
+
// document; a path the pass's end check reports is read again on its own.
|
|
290
|
+
return this.#readBatch(ids, (id, pass) => this.#readWithEdition(id, edition, pass));
|
|
291
|
+
}
|
|
292
|
+
async #readBatch(ids, read) {
|
|
293
|
+
const pass = openObservationPass(this.#port, this.#root);
|
|
294
|
+
const out = [];
|
|
156
295
|
for (const id of ids)
|
|
157
|
-
out.push(await
|
|
296
|
+
out.push(await read(id, pass));
|
|
297
|
+
const retry = new Set(await pass.finish());
|
|
298
|
+
for (let index = 0; index < ids.length; index++) {
|
|
299
|
+
if (retry.has(pathFromConceptId(ids[index])))
|
|
300
|
+
out[index] = await read(ids[index]);
|
|
301
|
+
}
|
|
158
302
|
return out;
|
|
159
303
|
}
|
|
304
|
+
/** Cache contains parsed link facts only. Every reuse still opens the exact, readable file. */
|
|
305
|
+
async relationshipSources(options = {}) {
|
|
306
|
+
if (Object.getPrototypeOf(this) !== _a.prototype ||
|
|
307
|
+
this.read !== _a.prototype.read ||
|
|
308
|
+
this.readMany !== _a.prototype.readMany ||
|
|
309
|
+
this.list !== _a.prototype.list)
|
|
310
|
+
return undefined;
|
|
311
|
+
const ids = await this.list();
|
|
312
|
+
if (ids.length === 0)
|
|
313
|
+
return [];
|
|
314
|
+
const edition = await this.#readEdition();
|
|
315
|
+
const projection = relationshipProjectionForEdition(edition);
|
|
316
|
+
if (!projection)
|
|
317
|
+
return undefined;
|
|
318
|
+
const key = await filesystemRootMutationKey(this.#root);
|
|
319
|
+
const cache = this.#port.relationshipCache?.(this.#root, key);
|
|
320
|
+
if (!cache)
|
|
321
|
+
return undefined;
|
|
322
|
+
const cached = cachedRelationshipSources(await cache.read(), projection, edition) ?? new Map();
|
|
323
|
+
const read = (id, pass) => this.#observeRelationshipSource(id, edition, projection, cached.get(id), pass);
|
|
324
|
+
const backend = { read, readMany: (batch) => this.#readBatch(batch, read) };
|
|
325
|
+
// The exact path observation pass is sequential. A bounded cohort of independent passes
|
|
326
|
+
// keeps the storage I/O busy without letting one scan open the entire bundle at once.
|
|
327
|
+
const batchSize = Math.ceil(ids.length / 8);
|
|
328
|
+
const batches = await Promise.all(Array.from({ length: Math.ceil(ids.length / batchSize) }, async (_, index) => {
|
|
329
|
+
const skipped = [];
|
|
330
|
+
const onSkip = options.onSkip ? (row) => skipped.push(row) : undefined;
|
|
331
|
+
const sources = await readManyExisting(backend, ids.slice(index * batchSize, (index + 1) * batchSize), onSkip, undefined, onSkip);
|
|
332
|
+
return { sources, skipped };
|
|
333
|
+
}));
|
|
334
|
+
const records = batches.flatMap(batch => batch.sources);
|
|
335
|
+
for (const { skipped } of batches)
|
|
336
|
+
for (const row of skipped)
|
|
337
|
+
options.onSkip?.(row);
|
|
338
|
+
if (records.length !== cached.size || records.some(record => cached.get(record.id) !== record)) {
|
|
339
|
+
await cache.write(JSON.stringify({
|
|
340
|
+
format: relationshipCacheFormat(projection),
|
|
341
|
+
parser: projection.parserVersion,
|
|
342
|
+
edition: edition ?? null,
|
|
343
|
+
sources: records.filter(record => record.stamp !== null),
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
return resolveRelationshipSources(records, edition);
|
|
347
|
+
}
|
|
348
|
+
async #observeRelationshipSource(id, edition, projection, cached, pass) {
|
|
349
|
+
const rel = pathFromConceptId(id);
|
|
350
|
+
const read = async (handle) => {
|
|
351
|
+
const before = await this.#port.contentStamp?.(handle);
|
|
352
|
+
if (before && cached?.stamp === before.value)
|
|
353
|
+
return { cached };
|
|
354
|
+
const bytes = await readBytes(this.#port, handle);
|
|
355
|
+
if (bytes === null)
|
|
356
|
+
return null;
|
|
357
|
+
const after = await this.#port.contentStamp?.(handle);
|
|
358
|
+
if (before?.value !== after?.value)
|
|
359
|
+
throw new ConcurrentReplacementError(rel, 1);
|
|
360
|
+
return { bytes, stamp: before?.settled ? before.value : null };
|
|
361
|
+
};
|
|
362
|
+
const observed = pass ? await pass.observe(rel, read) : await observeExact(this.#port, this.#root, rel, read);
|
|
363
|
+
if (observed.state === "absent")
|
|
364
|
+
throw notFound(this.#root, rel);
|
|
365
|
+
if (observed.value.cached)
|
|
366
|
+
return observed.value.cached;
|
|
367
|
+
const { frontmatter, body } = parseMarkdown(observed.value.bytes.toString("utf8"), rel, { okfVersion: edition });
|
|
368
|
+
return { ...deriveRelationshipSource({ id, frontmatter, body }, projection), stamp: observed.value.stamp };
|
|
369
|
+
}
|
|
160
370
|
async write(id, doc, options = {}) {
|
|
161
371
|
assertSafeConceptId(id);
|
|
162
372
|
const raw = stringifyDoc(doc.frontmatter, doc.body ?? "");
|
|
@@ -164,7 +374,7 @@ export class FilesystemBackend {
|
|
|
164
374
|
// The whole check-then-write section runs inside one identity-keyed critical section, local
|
|
165
375
|
// and same-user cross-process; an unconditional writer holds it too so it cannot move the
|
|
166
376
|
// target between another process's version check and write.
|
|
167
|
-
return mutateExact(
|
|
377
|
+
return this.#mutateExact(rel, async (target) => {
|
|
168
378
|
if (options.expectedVersion !== undefined) {
|
|
169
379
|
const bytes = await target.current();
|
|
170
380
|
const current = bytes === null ? null : versionOfBytes(bytes.toString("utf8"));
|
|
@@ -184,7 +394,7 @@ export class FilesystemBackend {
|
|
|
184
394
|
}
|
|
185
395
|
async delete(id, options = {}) {
|
|
186
396
|
assertSafeConceptId(id);
|
|
187
|
-
return mutateExact(
|
|
397
|
+
return this.#mutateExact(pathFromConceptId(id), async (target) => {
|
|
188
398
|
const bytes = await target.current();
|
|
189
399
|
if (bytes === null)
|
|
190
400
|
return false; // absent ⇒ idempotent no-op, EVEN under CAS
|
|
@@ -224,7 +434,7 @@ export class FilesystemBackend {
|
|
|
224
434
|
return [];
|
|
225
435
|
const { raw, mtime } = observed.value;
|
|
226
436
|
const { frontmatter } = parseMarkdown(raw, rel);
|
|
227
|
-
const actor = mutationActorFromFrontmatter(frontmatter) ??
|
|
437
|
+
const actor = mutationActorFromFrontmatter(frontmatter) ?? "unattributed";
|
|
228
438
|
const timestamp = firstString(frontmatter.timestamp) ?? mtime.toISOString();
|
|
229
439
|
// Single current revision: a plain filesystem retains no prior versions.
|
|
230
440
|
return [{ version: versionOfBytes(raw), actor, timestamp }];
|
|
@@ -263,12 +473,11 @@ export class FilesystemBackend {
|
|
|
263
473
|
return { content, version: versionOfBytes(content) };
|
|
264
474
|
}
|
|
265
475
|
async writeReserved(dir, name, content, options = {}) {
|
|
266
|
-
|
|
267
|
-
assertSafeReservedFilename(name);
|
|
476
|
+
assertStorableReservedWrite(dir, name, content);
|
|
268
477
|
const rel = reservedPath(dir, name);
|
|
269
478
|
// Same identity-keyed critical section as `write()`. A reserved-file read-modify-write
|
|
270
479
|
// depends on a genuine `VersionConflict` under contention.
|
|
271
|
-
return mutateExact(
|
|
480
|
+
return this.#mutateExact(rel, async (target) => {
|
|
272
481
|
if (options.expectedVersion !== undefined) {
|
|
273
482
|
const bytes = await target.current();
|
|
274
483
|
const current = bytes === null ? null : versionOfBytes(bytes.toString("utf8"));
|
|
@@ -299,7 +508,7 @@ export class FilesystemBackend {
|
|
|
299
508
|
// The WHOLE check-then-write section runs inside the identity lock, exactly like write(),
|
|
300
509
|
// so N concurrent CAS writers to the SAME blob key queue instead of racing the version
|
|
301
510
|
// check (B3). Raw-bytes versioning: hashing through a UTF-8 decode would corrupt binary (B1).
|
|
302
|
-
return mutateExact(
|
|
511
|
+
return this.#mutateExact(key, async (target) => {
|
|
303
512
|
if (options.expectedVersion !== undefined) {
|
|
304
513
|
const existing = await target.current();
|
|
305
514
|
const current = existing === null ? null : blobVersion(existing);
|
|
@@ -318,7 +527,7 @@ export class FilesystemBackend {
|
|
|
318
527
|
}
|
|
319
528
|
async deleteBlob(key, options = {}) {
|
|
320
529
|
assertSafeBlobKey(key);
|
|
321
|
-
return mutateExact(
|
|
530
|
+
return this.#mutateExact(key, async (target) => {
|
|
322
531
|
const existing = await target.current();
|
|
323
532
|
if (existing === null)
|
|
324
533
|
return false; // absent (or a directory-shaped path) ⇒ idempotent no-op
|
|
@@ -343,12 +552,15 @@ export class FilesystemBackend {
|
|
|
343
552
|
// Skipping dot-entries is what excludes the adapter's own dot-prefixed temp files and `.git`
|
|
344
553
|
// from a blob listing (I3), not just the write-time `assertSafeBlobKey` guard. The
|
|
345
554
|
// `.md`-extension check is case-insensitive, mirroring `assertSafeBlobKey`.
|
|
346
|
-
const files = await walkFiles(this.#port, this.#root, (name) => !name
|
|
555
|
+
const files = await walkFiles(this.#port, this.#root, (name) => !hasMarkdownExtension(name));
|
|
347
556
|
const keys = files.map(toPosix);
|
|
348
557
|
const filtered = prefix ? keys.filter((k) => k.startsWith(prefix)) : keys;
|
|
349
558
|
filtered.sort(compareStorageKeys);
|
|
350
559
|
return filtered;
|
|
351
560
|
}
|
|
561
|
+
classifyChangedPath(relPath) {
|
|
562
|
+
return classifyWalkPath(relPath);
|
|
563
|
+
}
|
|
352
564
|
capabilities() {
|
|
353
565
|
return {
|
|
354
566
|
history: false,
|
|
@@ -359,23 +571,89 @@ export class FilesystemBackend {
|
|
|
359
571
|
};
|
|
360
572
|
}
|
|
361
573
|
}
|
|
574
|
+
_a = FilesystemBackend;
|
|
362
575
|
function publicationContext(backend) {
|
|
363
576
|
const context = publicationContexts.get(backend);
|
|
364
577
|
if (!context)
|
|
365
578
|
throw new InvalidInputError("Unknown filesystem backend publication source.");
|
|
366
579
|
return context;
|
|
367
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* Replace one bundle-relative file whole, under the same identity lock, exact spelling and
|
|
583
|
+
* raw-bytes compare-and-swap as `writeBlob`, for a caller that owns which files it may write (a
|
|
584
|
+
* board conflict keep of a file that is not a document). `expectedVersion` is the version of the
|
|
585
|
+
* bytes the caller judged, or null when it judged the file absent.
|
|
586
|
+
*/
|
|
587
|
+
export async function replaceFilesystemFile(backend, rel, bytes, expectedVersion) {
|
|
588
|
+
assertSafeFilePath(rel);
|
|
589
|
+
const mutate = fileMutations.get(backend);
|
|
590
|
+
if (!mutate)
|
|
591
|
+
throw new InvalidInputError("Unknown filesystem backend.");
|
|
592
|
+
return mutate(rel, async (target) => {
|
|
593
|
+
const existing = await target.current();
|
|
594
|
+
const current = existing === null ? null : blobVersion(existing);
|
|
595
|
+
if (current !== expectedVersion)
|
|
596
|
+
throw new VersionConflict(rel, expectedVersion, current);
|
|
597
|
+
await target.replace(bytes);
|
|
598
|
+
return blobVersion(bytes);
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
/** Read-only exact-spelling metadata observation for a safe blob pathname. Reads no body and
|
|
602
|
+
* creates no directories; alias/unsafe observations retain the identity owner's typed refusal. */
|
|
603
|
+
export async function probeFilesystemPath(backend, key) {
|
|
604
|
+
assertSafeBlobKey(key);
|
|
605
|
+
const { root, port } = publicationContext(backend);
|
|
606
|
+
return (await probeExact(port, root, key)).state;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* The content stamp of a document's file, by `lstat`, for derived state kept outside the bundle (the
|
|
610
|
+
* local search index): equal settled stamps mean equal bytes. `undefined` when the stamp cannot
|
|
611
|
+
* vouch for the file (absent, a link, an untrusted volume); the caller then reads the document.
|
|
612
|
+
*/
|
|
613
|
+
export function filesystemDocumentStamp(backend, id) {
|
|
614
|
+
const { root, port } = publicationContext(backend);
|
|
615
|
+
return port.pathContentStamp?.(path.join(root, pathFromConceptId(id))) ?? Promise.resolve(undefined);
|
|
616
|
+
}
|
|
368
617
|
/** Internal exact-byte authority for the publication adapter; not part of StorageBackend. */
|
|
369
618
|
export async function readRawFilesystemDocument(backend, id) {
|
|
619
|
+
return readRawDocumentIn(backend, id);
|
|
620
|
+
}
|
|
621
|
+
async function readRawDocumentIn(backend, id, pass) {
|
|
370
622
|
assertSafeConceptId(id);
|
|
371
623
|
const { root, port } = publicationContext(backend);
|
|
372
624
|
const rel = pathFromConceptId(id);
|
|
373
|
-
const
|
|
625
|
+
const read = (handle) => readBytes(port, handle);
|
|
626
|
+
const observed = pass ? await pass.observe(rel, read) : await observeExact(port, root, rel, read);
|
|
374
627
|
if (observed.state === "absent")
|
|
375
628
|
throw notFound(root, rel);
|
|
376
629
|
const raw = new TextDecoder("utf-8", { fatal: true }).decode(observed.value);
|
|
377
630
|
return { bytes: observed.value.slice(), version: versionOfBytes(raw) };
|
|
378
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* {@link readRawFilesystemDocument} for many documents in one observation pass, so a capture
|
|
634
|
+
* lists each directory once instead of twice per document. `read` answers exactly what
|
|
635
|
+
* `readRawFilesystemDocument` would, in the caller's order; `finish` ends the pass and returns
|
|
636
|
+
* the ids whose answers the end-of-pass check could not confirm, for the caller to read again
|
|
637
|
+
* with `readRawFilesystemDocument`.
|
|
638
|
+
*/
|
|
639
|
+
export function openRawFilesystemDocumentPass(backend) {
|
|
640
|
+
const { root, port } = publicationContext(backend);
|
|
641
|
+
const pass = openObservationPass(port, root);
|
|
642
|
+
const ids = new Map();
|
|
643
|
+
return {
|
|
644
|
+
read(id) {
|
|
645
|
+
assertSafeConceptId(id);
|
|
646
|
+
ids.set(pathFromConceptId(id), id);
|
|
647
|
+
return readRawDocumentIn(backend, id, pass);
|
|
648
|
+
},
|
|
649
|
+
async finish() {
|
|
650
|
+
return (await pass.finish()).flatMap((rel) => {
|
|
651
|
+
const id = ids.get(rel);
|
|
652
|
+
return id === undefined ? [] : [id];
|
|
653
|
+
});
|
|
654
|
+
},
|
|
655
|
+
};
|
|
656
|
+
}
|
|
379
657
|
/** Internal exact-byte authority for reserved publication objects. */
|
|
380
658
|
export async function readRawFilesystemReserved(backend, dir, name) {
|
|
381
659
|
assertSafeReservedDir(dir);
|