@sentropic/cluster-mesh 0.16.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -12
- package/assets/storage/comments/oracle/conformance.mjs +1 -0
- package/assets/storage/comments/oracle/manifest.json +24 -0
- package/assets/storage/comments/oracle/revision-hash-v1.json +1 -0
- package/assets/storage/comments/transport-v1.json +1 -0
- package/assets/storage/postgres/001-core.sql +51 -0
- package/assets/storage/postgres/002-map.sql +83 -0
- package/assets/storage/postgres/003-staged.sql +11 -0
- package/assets/storage/postgres/004-queries.sql +20 -0
- package/assets/storage/postgres/005-cleanup.sql +3 -0
- package/assets/storage/postgres/006-staged-coverage.sql +5 -0
- package/assets/storage/postgres/comments/001-projections.sql +18 -0
- package/assets/storage/postgres/comments/002-transport.sql +13 -0
- package/assets/storage/postgres/comments/003-exports.sql +9 -0
- package/assets/storage/postgres/comments/004-authority.sql +7 -0
- package/assets/storage/postgres/comments/005-lifecycle-evidence.sql +3 -0
- package/assets/storage/postgres/comments/006-review-evidence.sql +6 -0
- package/assets/storage/postgres/comments/manifest.json +89 -0
- package/assets/storage/postgres/manifest.json +81 -0
- package/dist/comments/admission.d.ts +11 -0
- package/dist/comments/admission.d.ts.map +1 -0
- package/dist/comments/admission.js +44 -0
- package/dist/comments/admission.js.map +1 -0
- package/dist/comments/authority-projection.d.ts +6 -0
- package/dist/comments/authority-projection.d.ts.map +1 -0
- package/dist/comments/authority-projection.js +80 -0
- package/dist/comments/authority-projection.js.map +1 -0
- package/dist/comments/authority.d.ts +14 -0
- package/dist/comments/authority.d.ts.map +1 -0
- package/dist/comments/authority.js +73 -0
- package/dist/comments/authority.js.map +1 -0
- package/dist/comments/binding-codec.d.ts +6 -0
- package/dist/comments/binding-codec.d.ts.map +1 -0
- package/dist/comments/binding-codec.js +86 -0
- package/dist/comments/binding-codec.js.map +1 -0
- package/dist/comments/boundary-codec.d.ts +27 -0
- package/dist/comments/boundary-codec.d.ts.map +1 -0
- package/dist/comments/boundary-codec.js +56 -0
- package/dist/comments/boundary-codec.js.map +1 -0
- package/dist/comments/command-contracts.d.ts +22 -0
- package/dist/comments/command-contracts.d.ts.map +1 -0
- package/dist/comments/command-contracts.js +2 -0
- package/dist/comments/command-contracts.js.map +1 -0
- package/dist/comments/command-services.d.ts +10 -0
- package/dist/comments/command-services.d.ts.map +1 -0
- package/dist/comments/command-services.js +21 -0
- package/dist/comments/command-services.js.map +1 -0
- package/dist/comments/context.d.ts +26 -0
- package/dist/comments/context.d.ts.map +1 -0
- package/dist/comments/context.js +123 -0
- package/dist/comments/context.js.map +1 -0
- package/dist/comments/contract.d.ts +2 -0
- package/dist/comments/contract.d.ts.map +1 -0
- package/dist/comments/contract.js +2 -0
- package/dist/comments/contract.js.map +1 -0
- package/dist/comments/export-authority.d.ts +5 -0
- package/dist/comments/export-authority.d.ts.map +1 -0
- package/dist/comments/export-authority.js +17 -0
- package/dist/comments/export-authority.js.map +1 -0
- package/dist/comments/export-control.d.ts +7 -0
- package/dist/comments/export-control.d.ts.map +1 -0
- package/dist/comments/export-control.js +58 -0
- package/dist/comments/export-control.js.map +1 -0
- package/dist/comments/export-pages.d.ts +7 -0
- package/dist/comments/export-pages.d.ts.map +1 -0
- package/dist/comments/export-pages.js +90 -0
- package/dist/comments/export-pages.js.map +1 -0
- package/dist/comments/export-prepare.d.ts +5 -0
- package/dist/comments/export-prepare.d.ts.map +1 -0
- package/dist/comments/export-prepare.js +112 -0
- package/dist/comments/export-prepare.js.map +1 -0
- package/dist/comments/export-readers.d.ts +18 -0
- package/dist/comments/export-readers.d.ts.map +1 -0
- package/dist/comments/export-readers.js +91 -0
- package/dist/comments/export-readers.js.map +1 -0
- package/dist/comments/export-services.d.ts +9 -0
- package/dist/comments/export-services.d.ts.map +1 -0
- package/dist/comments/export-services.js +30 -0
- package/dist/comments/export-services.js.map +1 -0
- package/dist/comments/fragment-codec.d.ts +8 -0
- package/dist/comments/fragment-codec.d.ts.map +1 -0
- package/dist/comments/fragment-codec.js +72 -0
- package/dist/comments/fragment-codec.js.map +1 -0
- package/dist/comments/http-authority.d.ts +12 -0
- package/dist/comments/http-authority.d.ts.map +1 -0
- package/dist/comments/http-authority.js +61 -0
- package/dist/comments/http-authority.js.map +1 -0
- package/dist/comments/http-boundary.d.ts +25 -0
- package/dist/comments/http-boundary.d.ts.map +1 -0
- package/dist/comments/http-boundary.js +76 -0
- package/dist/comments/http-boundary.js.map +1 -0
- package/dist/comments/import-authority.d.ts +5 -0
- package/dist/comments/import-authority.d.ts.map +1 -0
- package/dist/comments/import-authority.js +41 -0
- package/dist/comments/import-authority.js.map +1 -0
- package/dist/comments/import-control.d.ts +17 -0
- package/dist/comments/import-control.d.ts.map +1 -0
- package/dist/comments/import-control.js +82 -0
- package/dist/comments/import-control.js.map +1 -0
- package/dist/comments/import-effects.d.ts +12 -0
- package/dist/comments/import-effects.d.ts.map +1 -0
- package/dist/comments/import-effects.js +167 -0
- package/dist/comments/import-effects.js.map +1 -0
- package/dist/comments/import-policy.d.ts +4 -0
- package/dist/comments/import-policy.d.ts.map +1 -0
- package/dist/comments/import-policy.js +35 -0
- package/dist/comments/import-policy.js.map +1 -0
- package/dist/comments/import-prepare.d.ts +5 -0
- package/dist/comments/import-prepare.d.ts.map +1 -0
- package/dist/comments/import-prepare.js +123 -0
- package/dist/comments/import-prepare.js.map +1 -0
- package/dist/comments/import-projection.d.ts +5 -0
- package/dist/comments/import-projection.d.ts.map +1 -0
- package/dist/comments/import-projection.js +76 -0
- package/dist/comments/import-projection.js.map +1 -0
- package/dist/comments/import-recovery.d.ts +22 -0
- package/dist/comments/import-recovery.d.ts.map +1 -0
- package/dist/comments/import-recovery.js +95 -0
- package/dist/comments/import-recovery.js.map +1 -0
- package/dist/comments/import-services.d.ts +36 -0
- package/dist/comments/import-services.d.ts.map +1 -0
- package/dist/comments/import-services.js +38 -0
- package/dist/comments/import-services.js.map +1 -0
- package/dist/comments/import-state.d.ts +42 -0
- package/dist/comments/import-state.d.ts.map +1 -0
- package/dist/comments/import-state.js +33 -0
- package/dist/comments/import-state.js.map +1 -0
- package/dist/comments/index.d.ts +56 -0
- package/dist/comments/index.d.ts.map +1 -0
- package/dist/comments/index.js +28 -0
- package/dist/comments/index.js.map +1 -0
- package/dist/comments/installed-store.d.ts +4 -0
- package/dist/comments/installed-store.d.ts.map +1 -0
- package/dist/comments/installed-store.js +30 -0
- package/dist/comments/installed-store.js.map +1 -0
- package/dist/comments/lifecycle-contracts.d.ts +27 -0
- package/dist/comments/lifecycle-contracts.d.ts.map +1 -0
- package/dist/comments/lifecycle-contracts.js +3 -0
- package/dist/comments/lifecycle-contracts.js.map +1 -0
- package/dist/comments/lifecycle-evidence.d.ts +4 -0
- package/dist/comments/lifecycle-evidence.d.ts.map +1 -0
- package/dist/comments/lifecycle-evidence.js +31 -0
- package/dist/comments/lifecycle-evidence.js.map +1 -0
- package/dist/comments/lifecycle-io.d.ts +13 -0
- package/dist/comments/lifecycle-io.d.ts.map +1 -0
- package/dist/comments/lifecycle-io.js +69 -0
- package/dist/comments/lifecycle-io.js.map +1 -0
- package/dist/comments/lifecycle.d.ts +4 -0
- package/dist/comments/lifecycle.d.ts.map +1 -0
- package/dist/comments/lifecycle.js +135 -0
- package/dist/comments/lifecycle.js.map +1 -0
- package/dist/comments/limits.d.ts +4 -0
- package/dist/comments/limits.d.ts.map +1 -0
- package/dist/comments/limits.js +14 -0
- package/dist/comments/limits.js.map +1 -0
- package/dist/comments/postgres-projections.d.ts +5 -0
- package/dist/comments/postgres-projections.d.ts.map +1 -0
- package/dist/comments/postgres-projections.js +58 -0
- package/dist/comments/postgres-projections.js.map +1 -0
- package/dist/comments/postgres-queries.d.ts +3 -0
- package/dist/comments/postgres-queries.d.ts.map +1 -0
- package/dist/comments/postgres-queries.js +75 -0
- package/dist/comments/postgres-queries.js.map +1 -0
- package/dist/comments/postgres-records.d.ts +6 -0
- package/dist/comments/postgres-records.d.ts.map +1 -0
- package/dist/comments/postgres-records.js +74 -0
- package/dist/comments/postgres-records.js.map +1 -0
- package/dist/comments/postgres.d.ts +47 -0
- package/dist/comments/postgres.d.ts.map +1 -0
- package/dist/comments/postgres.js +142 -0
- package/dist/comments/postgres.js.map +1 -0
- package/dist/comments/purge.d.ts +5 -0
- package/dist/comments/purge.d.ts.map +1 -0
- package/dist/comments/purge.js +41 -0
- package/dist/comments/purge.js.map +1 -0
- package/dist/comments/read-audience.d.ts +3 -0
- package/dist/comments/read-audience.d.ts.map +1 -0
- package/dist/comments/read-audience.js +7 -0
- package/dist/comments/read-audience.js.map +1 -0
- package/dist/comments/read-command.d.ts +18 -0
- package/dist/comments/read-command.d.ts.map +1 -0
- package/dist/comments/read-command.js +65 -0
- package/dist/comments/read-command.js.map +1 -0
- package/dist/comments/record-effects.d.ts +4 -0
- package/dist/comments/record-effects.d.ts.map +1 -0
- package/dist/comments/record-effects.js +22 -0
- package/dist/comments/record-effects.js.map +1 -0
- package/dist/comments/record-validation.d.ts +4 -0
- package/dist/comments/record-validation.d.ts.map +1 -0
- package/dist/comments/record-validation.js +70 -0
- package/dist/comments/record-validation.js.map +1 -0
- package/dist/comments/relationships.d.ts +4 -0
- package/dist/comments/relationships.d.ts.map +1 -0
- package/dist/comments/relationships.js +19 -0
- package/dist/comments/relationships.js.map +1 -0
- package/dist/comments/review-evidence.d.ts +4 -0
- package/dist/comments/review-evidence.d.ts.map +1 -0
- package/dist/comments/review-evidence.js +52 -0
- package/dist/comments/review-evidence.js.map +1 -0
- package/dist/comments/revision-command.d.ts +5 -0
- package/dist/comments/revision-command.d.ts.map +1 -0
- package/dist/comments/revision-command.js +80 -0
- package/dist/comments/revision-command.js.map +1 -0
- package/dist/comments/router-binding.d.ts +9 -0
- package/dist/comments/router-binding.d.ts.map +1 -0
- package/dist/comments/router-binding.js +6 -0
- package/dist/comments/router-binding.js.map +1 -0
- package/dist/comments/services.d.ts +43 -0
- package/dist/comments/services.d.ts.map +1 -0
- package/dist/comments/services.js +20 -0
- package/dist/comments/services.js.map +1 -0
- package/dist/comments/storage-adapter.d.ts +16 -0
- package/dist/comments/storage-adapter.d.ts.map +1 -0
- package/dist/comments/storage-adapter.js +108 -0
- package/dist/comments/storage-adapter.js.map +1 -0
- package/dist/comments/storage-contracts.d.ts +57 -0
- package/dist/comments/storage-contracts.d.ts.map +1 -0
- package/dist/comments/storage-contracts.js +2 -0
- package/dist/comments/storage-contracts.js.map +1 -0
- package/dist/comments/storage-schema.d.ts +32 -0
- package/dist/comments/storage-schema.d.ts.map +1 -0
- package/dist/comments/storage-schema.js +70 -0
- package/dist/comments/storage-schema.js.map +1 -0
- package/dist/comments/store.d.ts +5 -0
- package/dist/comments/store.d.ts.map +1 -0
- package/dist/comments/store.js +43 -0
- package/dist/comments/store.js.map +1 -0
- package/dist/comments/transport-contracts.d.ts +110 -0
- package/dist/comments/transport-contracts.d.ts.map +1 -0
- package/dist/comments/transport-contracts.js +29 -0
- package/dist/comments/transport-contracts.js.map +1 -0
- package/dist/compose/comments.d.ts +31 -0
- package/dist/compose/comments.d.ts.map +1 -0
- package/dist/compose/comments.js +48 -0
- package/dist/compose/comments.js.map +1 -0
- package/dist/compose/mcp.d.ts +87 -0
- package/dist/compose/mcp.d.ts.map +1 -0
- package/dist/compose/mcp.js +186 -0
- package/dist/compose/mcp.js.map +1 -0
- package/dist/hono/comments-router.d.ts +4 -0
- package/dist/hono/comments-router.d.ts.map +1 -0
- package/dist/hono/comments-router.js +83 -0
- package/dist/hono/comments-router.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/comments/index.d.ts +3 -0
- package/dist/integrations/comments/index.d.ts.map +1 -0
- package/dist/integrations/comments/index.js +3 -0
- package/dist/integrations/comments/index.js.map +1 -0
- package/dist/integrations/mcp/artifacts.d.ts +19 -0
- package/dist/integrations/mcp/artifacts.d.ts.map +1 -0
- package/dist/integrations/mcp/artifacts.js +26 -0
- package/dist/integrations/mcp/artifacts.js.map +1 -0
- package/dist/loaders/comments/index.d.ts +5 -0
- package/dist/loaders/comments/index.d.ts.map +1 -0
- package/dist/loaders/comments/index.js +6 -0
- package/dist/loaders/comments/index.js.map +1 -0
- package/dist/loaders/mcp/artifacts.d.ts +9 -0
- package/dist/loaders/mcp/artifacts.d.ts.map +1 -0
- package/dist/loaders/mcp/artifacts.js +10 -0
- package/dist/loaders/mcp/artifacts.js.map +1 -0
- package/dist/loaders/mcp/bridge.d.ts +8 -0
- package/dist/loaders/mcp/bridge.d.ts.map +1 -0
- package/dist/loaders/mcp/bridge.js +9 -0
- package/dist/loaders/mcp/bridge.js.map +1 -0
- package/dist/loaders/mcp/entry.d.ts +8 -0
- package/dist/loaders/mcp/entry.d.ts.map +1 -0
- package/dist/loaders/mcp/entry.js +9 -0
- package/dist/loaders/mcp/entry.js.map +1 -0
- package/dist/loaders/mcp/hono.d.ts +8 -0
- package/dist/loaders/mcp/hono.d.ts.map +1 -0
- package/dist/loaders/mcp/hono.js +9 -0
- package/dist/loaders/mcp/hono.js.map +1 -0
- package/dist/loaders/mcp/index.d.ts +7 -0
- package/dist/loaders/mcp/index.d.ts.map +1 -0
- package/dist/loaders/mcp/index.js +7 -0
- package/dist/loaders/mcp/index.js.map +1 -0
- package/dist/loaders/mcp/registry.d.ts +8 -0
- package/dist/loaders/mcp/registry.d.ts.map +1 -0
- package/dist/loaders/mcp/registry.js +9 -0
- package/dist/loaders/mcp/registry.js.map +1 -0
- package/dist/loaders/mcp/stdio.d.ts +8 -0
- package/dist/loaders/mcp/stdio.d.ts.map +1 -0
- package/dist/loaders/mcp/stdio.js +9 -0
- package/dist/loaders/mcp/stdio.js.map +1 -0
- package/dist/mcp/registry.d.ts +38 -0
- package/dist/mcp/registry.d.ts.map +1 -0
- package/dist/mcp/registry.js +171 -0
- package/dist/mcp/registry.js.map +1 -0
- package/dist/mcp/stdio.d.ts +37 -0
- package/dist/mcp/stdio.d.ts.map +1 -0
- package/dist/mcp/stdio.js +47 -0
- package/dist/mcp/stdio.js.map +1 -0
- package/dist/mesh.d.ts +9 -1
- package/dist/mesh.d.ts.map +1 -1
- package/dist/mesh.js +4 -2
- package/dist/mesh.js.map +1 -1
- package/dist/modules/catalog.d.ts +10 -2
- package/dist/modules/catalog.d.ts.map +1 -1
- package/dist/modules/catalog.js +30 -3
- package/dist/modules/catalog.js.map +1 -1
- package/dist/modules/contracts.d.ts +2 -2
- package/dist/modules/contracts.d.ts.map +1 -1
- package/dist/modules/contracts.js +7 -1
- package/dist/modules/contracts.js.map +1 -1
- package/dist/modules/topology-guard-mcp.d.ts +2 -0
- package/dist/modules/topology-guard-mcp.d.ts.map +1 -0
- package/dist/modules/topology-guard-mcp.js +7 -0
- package/dist/modules/topology-guard-mcp.js.map +1 -0
- package/dist/storage/atomic.d.ts +108 -0
- package/dist/storage/atomic.d.ts.map +1 -0
- package/dist/storage/atomic.js +163 -0
- package/dist/storage/atomic.js.map +1 -0
- package/dist/storage/authority.d.ts +37 -0
- package/dist/storage/authority.d.ts.map +1 -0
- package/dist/storage/authority.js +88 -0
- package/dist/storage/authority.js.map +1 -0
- package/dist/storage/backend.d.ts +80 -0
- package/dist/storage/backend.d.ts.map +1 -0
- package/dist/storage/backend.js +92 -0
- package/dist/storage/backend.js.map +1 -0
- package/dist/storage/contracts.d.ts +64 -0
- package/dist/storage/contracts.d.ts.map +1 -0
- package/dist/storage/contracts.js +129 -0
- package/dist/storage/contracts.js.map +1 -0
- package/dist/storage/descriptor.d.ts +52 -0
- package/dist/storage/descriptor.d.ts.map +1 -0
- package/dist/storage/descriptor.js +94 -0
- package/dist/storage/descriptor.js.map +1 -0
- package/dist/storage/errors.d.ts +49 -0
- package/dist/storage/errors.d.ts.map +1 -0
- package/dist/storage/errors.js +119 -0
- package/dist/storage/errors.js.map +1 -0
- package/dist/storage/index.d.ts +16 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +15 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/indexed-history.d.ts +15 -0
- package/dist/storage/indexed-history.d.ts.map +1 -0
- package/dist/storage/indexed-history.js +37 -0
- package/dist/storage/indexed-history.js.map +1 -0
- package/dist/storage/indexed-map.d.ts +20 -0
- package/dist/storage/indexed-map.d.ts.map +1 -0
- package/dist/storage/indexed-map.js +50 -0
- package/dist/storage/indexed-map.js.map +1 -0
- package/dist/storage/indexed-tree.d.ts +16 -0
- package/dist/storage/indexed-tree.d.ts.map +1 -0
- package/dist/storage/indexed-tree.js +86 -0
- package/dist/storage/indexed-tree.js.map +1 -0
- package/dist/storage/kernel.d.ts +49 -0
- package/dist/storage/kernel.d.ts.map +1 -0
- package/dist/storage/kernel.js +104 -0
- package/dist/storage/kernel.js.map +1 -0
- package/dist/storage/manifest.d.ts +56 -0
- package/dist/storage/manifest.d.ts.map +1 -0
- package/dist/storage/manifest.js +131 -0
- package/dist/storage/manifest.js.map +1 -0
- package/dist/storage/mutation-coordinator.d.ts +35 -0
- package/dist/storage/mutation-coordinator.d.ts.map +1 -0
- package/dist/storage/mutation-coordinator.js +123 -0
- package/dist/storage/mutation-coordinator.js.map +1 -0
- package/dist/storage/postgres/blobs.d.ts +5 -0
- package/dist/storage/postgres/blobs.d.ts.map +1 -0
- package/dist/storage/postgres/blobs.js +45 -0
- package/dist/storage/postgres/blobs.js.map +1 -0
- package/dist/storage/postgres/cleanup.d.ts +17 -0
- package/dist/storage/postgres/cleanup.d.ts.map +1 -0
- package/dist/storage/postgres/cleanup.js +70 -0
- package/dist/storage/postgres/cleanup.js.map +1 -0
- package/dist/storage/postgres/codec.d.ts +9 -0
- package/dist/storage/postgres/codec.d.ts.map +1 -0
- package/dist/storage/postgres/codec.js +34 -0
- package/dist/storage/postgres/codec.js.map +1 -0
- package/dist/storage/postgres/core.d.ts +53 -0
- package/dist/storage/postgres/core.d.ts.map +1 -0
- package/dist/storage/postgres/core.js +210 -0
- package/dist/storage/postgres/core.js.map +1 -0
- package/dist/storage/postgres/coverage.d.ts +4 -0
- package/dist/storage/postgres/coverage.d.ts.map +1 -0
- package/dist/storage/postgres/coverage.js +28 -0
- package/dist/storage/postgres/coverage.js.map +1 -0
- package/dist/storage/postgres/digest.d.ts +14 -0
- package/dist/storage/postgres/digest.d.ts.map +1 -0
- package/dist/storage/postgres/digest.js +67 -0
- package/dist/storage/postgres/digest.js.map +1 -0
- package/dist/storage/postgres/effects.d.ts +27 -0
- package/dist/storage/postgres/effects.d.ts.map +1 -0
- package/dist/storage/postgres/effects.js +130 -0
- package/dist/storage/postgres/effects.js.map +1 -0
- package/dist/storage/postgres/errors.d.ts +16 -0
- package/dist/storage/postgres/errors.d.ts.map +1 -0
- package/dist/storage/postgres/errors.js +51 -0
- package/dist/storage/postgres/errors.js.map +1 -0
- package/dist/storage/postgres/hidden-coverage.d.ts +12 -0
- package/dist/storage/postgres/hidden-coverage.d.ts.map +1 -0
- package/dist/storage/postgres/hidden-coverage.js +43 -0
- package/dist/storage/postgres/hidden-coverage.js.map +1 -0
- package/dist/storage/postgres/hidden-session.d.ts +6 -0
- package/dist/storage/postgres/hidden-session.d.ts.map +1 -0
- package/dist/storage/postgres/hidden-session.js +20 -0
- package/dist/storage/postgres/hidden-session.js.map +1 -0
- package/dist/storage/postgres/index.d.ts +29 -0
- package/dist/storage/postgres/index.d.ts.map +1 -0
- package/dist/storage/postgres/index.js +40 -0
- package/dist/storage/postgres/index.js.map +1 -0
- package/dist/storage/postgres/installed-contracts.d.ts +41 -0
- package/dist/storage/postgres/installed-contracts.d.ts.map +1 -0
- package/dist/storage/postgres/installed-contracts.js +2 -0
- package/dist/storage/postgres/installed-contracts.js.map +1 -0
- package/dist/storage/postgres/installed.d.ts +9 -0
- package/dist/storage/postgres/installed.d.ts.map +1 -0
- package/dist/storage/postgres/installed.js +197 -0
- package/dist/storage/postgres/installed.js.map +1 -0
- package/dist/storage/postgres/journal.d.ts +24 -0
- package/dist/storage/postgres/journal.d.ts.map +1 -0
- package/dist/storage/postgres/journal.js +237 -0
- package/dist/storage/postgres/journal.js.map +1 -0
- package/dist/storage/postgres/lifecycle.d.ts +8 -0
- package/dist/storage/postgres/lifecycle.d.ts.map +1 -0
- package/dist/storage/postgres/lifecycle.js +164 -0
- package/dist/storage/postgres/lifecycle.js.map +1 -0
- package/dist/storage/postgres/maintenance-readers.d.ts +22 -0
- package/dist/storage/postgres/maintenance-readers.d.ts.map +1 -0
- package/dist/storage/postgres/maintenance-readers.js +60 -0
- package/dist/storage/postgres/maintenance-readers.js.map +1 -0
- package/dist/storage/postgres/manifests.d.ts +11 -0
- package/dist/storage/postgres/manifests.d.ts.map +1 -0
- package/dist/storage/postgres/manifests.js +105 -0
- package/dist/storage/postgres/manifests.js.map +1 -0
- package/dist/storage/postgres/migrations.d.ts +46 -0
- package/dist/storage/postgres/migrations.d.ts.map +1 -0
- package/dist/storage/postgres/migrations.js +182 -0
- package/dist/storage/postgres/migrations.js.map +1 -0
- package/dist/storage/postgres/module-effects.d.ts +7 -0
- package/dist/storage/postgres/module-effects.d.ts.map +1 -0
- package/dist/storage/postgres/module-effects.js +59 -0
- package/dist/storage/postgres/module-effects.js.map +1 -0
- package/dist/storage/postgres/ordinary-transactions.d.ts +12 -0
- package/dist/storage/postgres/ordinary-transactions.d.ts.map +1 -0
- package/dist/storage/postgres/ordinary-transactions.js +168 -0
- package/dist/storage/postgres/ordinary-transactions.js.map +1 -0
- package/dist/storage/postgres/preparation.d.ts +12 -0
- package/dist/storage/postgres/preparation.d.ts.map +1 -0
- package/dist/storage/postgres/preparation.js +127 -0
- package/dist/storage/postgres/preparation.js.map +1 -0
- package/dist/storage/postgres/profiles.d.ts +107 -0
- package/dist/storage/postgres/profiles.d.ts.map +1 -0
- package/dist/storage/postgres/profiles.js +75 -0
- package/dist/storage/postgres/profiles.js.map +1 -0
- package/dist/storage/postgres/protocol.d.ts +115 -0
- package/dist/storage/postgres/protocol.d.ts.map +1 -0
- package/dist/storage/postgres/protocol.js +20 -0
- package/dist/storage/postgres/protocol.js.map +1 -0
- package/dist/storage/postgres/queries.d.ts +22 -0
- package/dist/storage/postgres/queries.d.ts.map +1 -0
- package/dist/storage/postgres/queries.js +113 -0
- package/dist/storage/postgres/queries.js.map +1 -0
- package/dist/storage/postgres/readers.d.ts +43 -0
- package/dist/storage/postgres/readers.d.ts.map +1 -0
- package/dist/storage/postgres/readers.js +139 -0
- package/dist/storage/postgres/readers.js.map +1 -0
- package/dist/storage/postgres/recovery.d.ts +15 -0
- package/dist/storage/postgres/recovery.d.ts.map +1 -0
- package/dist/storage/postgres/recovery.js +71 -0
- package/dist/storage/postgres/recovery.js.map +1 -0
- package/dist/storage/postgres/registered-effects.d.ts +2 -0
- package/dist/storage/postgres/registered-effects.d.ts.map +1 -0
- package/dist/storage/postgres/registered-effects.js +2 -0
- package/dist/storage/postgres/registered-effects.js.map +1 -0
- package/dist/storage/postgres/roots.d.ts +34 -0
- package/dist/storage/postgres/roots.d.ts.map +1 -0
- package/dist/storage/postgres/roots.js +127 -0
- package/dist/storage/postgres/roots.js.map +1 -0
- package/dist/storage/postgres/scope.d.ts +136 -0
- package/dist/storage/postgres/scope.d.ts.map +1 -0
- package/dist/storage/postgres/scope.js +275 -0
- package/dist/storage/postgres/scope.js.map +1 -0
- package/dist/storage/postgres/seals.d.ts +23 -0
- package/dist/storage/postgres/seals.d.ts.map +1 -0
- package/dist/storage/postgres/seals.js +149 -0
- package/dist/storage/postgres/seals.js.map +1 -0
- package/dist/storage/postgres/snapshots.d.ts +13 -0
- package/dist/storage/postgres/snapshots.d.ts.map +1 -0
- package/dist/storage/postgres/snapshots.js +55 -0
- package/dist/storage/postgres/snapshots.js.map +1 -0
- package/dist/storage/postgres/staged-module.d.ts +23 -0
- package/dist/storage/postgres/staged-module.d.ts.map +1 -0
- package/dist/storage/postgres/staged-module.js +38 -0
- package/dist/storage/postgres/staged-module.js.map +1 -0
- package/dist/storage/postgres/staged.d.ts +15 -0
- package/dist/storage/postgres/staged.d.ts.map +1 -0
- package/dist/storage/postgres/staged.js +190 -0
- package/dist/storage/postgres/staged.js.map +1 -0
- package/dist/storage/postgres/transactions.d.ts +9 -0
- package/dist/storage/postgres/transactions.d.ts.map +1 -0
- package/dist/storage/postgres/transactions.js +86 -0
- package/dist/storage/postgres/transactions.js.map +1 -0
- package/dist/storage/postgres/units.d.ts +55 -0
- package/dist/storage/postgres/units.d.ts.map +1 -0
- package/dist/storage/postgres/units.js +57 -0
- package/dist/storage/postgres/units.js.map +1 -0
- package/dist/storage/profiles.d.ts +24 -0
- package/dist/storage/profiles.d.ts.map +1 -0
- package/dist/storage/profiles.js +88 -0
- package/dist/storage/profiles.js.map +1 -0
- package/dist/storage/projection-runtime.d.ts +46 -0
- package/dist/storage/projection-runtime.d.ts.map +1 -0
- package/dist/storage/projection-runtime.js +105 -0
- package/dist/storage/projection-runtime.js.map +1 -0
- package/dist/storage/readers.d.ts +47 -0
- package/dist/storage/readers.d.ts.map +1 -0
- package/dist/storage/readers.js +136 -0
- package/dist/storage/readers.js.map +1 -0
- package/dist/storage/record-runtime.d.ts +85 -0
- package/dist/storage/record-runtime.d.ts.map +1 -0
- package/dist/storage/record-runtime.js +387 -0
- package/dist/storage/record-runtime.js.map +1 -0
- package/dist/storage/root-facade.d.ts +128 -0
- package/dist/storage/root-facade.d.ts.map +1 -0
- package/dist/storage/root-facade.js +116 -0
- package/dist/storage/root-facade.js.map +1 -0
- package/dist/storage/root-journal.d.ts +25 -0
- package/dist/storage/root-journal.d.ts.map +1 -0
- package/dist/storage/root-journal.js +121 -0
- package/dist/storage/root-journal.js.map +1 -0
- package/dist/storage/root-lifecycle.d.ts +11 -0
- package/dist/storage/root-lifecycle.d.ts.map +1 -0
- package/dist/storage/root-lifecycle.js +114 -0
- package/dist/storage/root-lifecycle.js.map +1 -0
- package/dist/storage/root-manifest.d.ts +15 -0
- package/dist/storage/root-manifest.d.ts.map +1 -0
- package/dist/storage/root-manifest.js +79 -0
- package/dist/storage/root-manifest.js.map +1 -0
- package/dist/storage/root-profiles.d.ts +104 -0
- package/dist/storage/root-profiles.d.ts.map +1 -0
- package/dist/storage/root-profiles.js +35 -0
- package/dist/storage/root-profiles.js.map +1 -0
- package/dist/storage/root-query.d.ts +31 -0
- package/dist/storage/root-query.d.ts.map +1 -0
- package/dist/storage/root-query.js +70 -0
- package/dist/storage/root-query.js.map +1 -0
- package/dist/storage/root-snapshot.d.ts +13 -0
- package/dist/storage/root-snapshot.d.ts.map +1 -0
- package/dist/storage/root-snapshot.js +59 -0
- package/dist/storage/root-snapshot.js.map +1 -0
- package/dist/storage/scope-runtime.d.ts +155 -0
- package/dist/storage/scope-runtime.d.ts.map +1 -0
- package/dist/storage/scope-runtime.js +597 -0
- package/dist/storage/scope-runtime.js.map +1 -0
- package/dist/storage/staged-codec.d.ts +32 -0
- package/dist/storage/staged-codec.d.ts.map +1 -0
- package/dist/storage/staged-codec.js +86 -0
- package/dist/storage/staged-codec.js.map +1 -0
- package/dist/storage/staged-core.d.ts +43 -0
- package/dist/storage/staged-core.d.ts.map +1 -0
- package/dist/storage/staged-core.js +120 -0
- package/dist/storage/staged-core.js.map +1 -0
- package/dist/storage/staged-effects.d.ts +13 -0
- package/dist/storage/staged-effects.d.ts.map +1 -0
- package/dist/storage/staged-effects.js +101 -0
- package/dist/storage/staged-effects.js.map +1 -0
- package/dist/storage/staged-factory.d.ts +22 -0
- package/dist/storage/staged-factory.d.ts.map +1 -0
- package/dist/storage/staged-factory.js +36 -0
- package/dist/storage/staged-factory.js.map +1 -0
- package/dist/storage/staged-operations.d.ts +22 -0
- package/dist/storage/staged-operations.d.ts.map +1 -0
- package/dist/storage/staged-operations.js +125 -0
- package/dist/storage/staged-operations.js.map +1 -0
- package/dist/storage/staged-preparation.d.ts +19 -0
- package/dist/storage/staged-preparation.d.ts.map +1 -0
- package/dist/storage/staged-preparation.js +128 -0
- package/dist/storage/staged-preparation.js.map +1 -0
- package/dist/storage/staged-recovery.d.ts +27 -0
- package/dist/storage/staged-recovery.d.ts.map +1 -0
- package/dist/storage/staged-recovery.js +49 -0
- package/dist/storage/staged-recovery.js.map +1 -0
- package/dist/storage/staged-seal.d.ts +37 -0
- package/dist/storage/staged-seal.d.ts.map +1 -0
- package/dist/storage/staged-seal.js +120 -0
- package/dist/storage/staged-seal.js.map +1 -0
- package/dist/storage/staged-state.d.ts +156 -0
- package/dist/storage/staged-state.d.ts.map +1 -0
- package/dist/storage/staged-state.js +43 -0
- package/dist/storage/staged-state.js.map +1 -0
- package/dist/storage/staged-units.d.ts +95 -0
- package/dist/storage/staged-units.d.ts.map +1 -0
- package/dist/storage/staged-units.js +129 -0
- package/dist/storage/staged-units.js.map +1 -0
- package/dist/storage/tokens.d.ts +50 -0
- package/dist/storage/tokens.d.ts.map +1 -0
- package/dist/storage/tokens.js +135 -0
- package/dist/storage/tokens.js.map +1 -0
- package/dist/token-exchange.d.ts +176 -0
- package/dist/token-exchange.d.ts.map +1 -0
- package/dist/token-exchange.js +377 -0
- package/dist/token-exchange.js.map +1 -0
- package/dist/trust/token-exchange-http.d.ts +93 -0
- package/dist/trust/token-exchange-http.d.ts.map +1 -0
- package/dist/trust/token-exchange-http.js +364 -0
- package/dist/trust/token-exchange-http.js.map +1 -0
- package/dist/trust.d.ts +2 -7
- package/dist/trust.d.ts.map +1 -1
- package/dist/trust.js.map +1 -1
- package/package.json +56 -2
package/README.md
CHANGED
|
@@ -105,6 +105,36 @@ implement server-to-server federation.
|
|
|
105
105
|
|
|
106
106
|
## Lazy integration surface (0.12+, tuple of 0.14)
|
|
107
107
|
|
|
108
|
+
### Comments and generic storage candidate (0.19)
|
|
109
|
+
|
|
110
|
+
The `0.19.0` candidate adds `/storage` (neutral shared kernel),
|
|
111
|
+
`/storage/postgres` (host-injected SQL driver and migration assets), `/comments`,
|
|
112
|
+
`/comments/hono`, `/loaders/comments` and `/compose/comments`. Selecting comments
|
|
113
|
+
requires optional peer `@sentropic/comments ^0.3.0`; the qualified exact peer is
|
|
114
|
+
`0.3.0`. Root/generic storage and disabled comments composition do not evaluate it.
|
|
115
|
+
The host owns database connections, migration history, issued scope grants and
|
|
116
|
+
domain capability/resolution/decision ports. Startup verifies installed assets;
|
|
117
|
+
it never schedules migrations or opens its own connection.
|
|
118
|
+
|
|
119
|
+
`createCommentsPostgresStorage` and `createCommentsModule` expose the unchanged
|
|
120
|
+
24-method M1 persistence store, operational content/lifecycle services, and seven
|
|
121
|
+
bounded import/export/receipt methods. Transactions use `store.transaction().run`.
|
|
122
|
+
Use issued `module.withContext(grant, callback)` contexts. Full-runtime Hono
|
|
123
|
+
composition uses `createCanonicalCommentsNamespaceModule` and a host grant resolver;
|
|
124
|
+
raw lifecycle append and physical-completion routes are unavailable. Dedicated
|
|
125
|
+
review/submission/assignment operational APIs and SQLite parity remain separate.
|
|
126
|
+
|
|
127
|
+
The archive includes checksum-ordered PostgreSQL SQL assets and the digest-pinned
|
|
128
|
+
unchanged M1 conformance oracle under `assets/storage/`. The repository
|
|
129
|
+
[host guide](https://github.com/rhanka/sentropic/blob/feat/cluster-mesh-comments-m2/docs/comments-annotations/immo-host-guide.md)
|
|
130
|
+
and [installed evidence](https://github.com/rhanka/sentropic/blob/feat/cluster-mesh-comments-m2/docs/comments-annotations/evidence/installed-module.md)
|
|
131
|
+
describe exact calls, fragment/terminal receipt rules and tested bounds. Import
|
|
132
|
+
preparation stays private until one canonical root publication; acknowledgements
|
|
133
|
+
are progress rather than complete receipts. The host retains exact qualified
|
|
134
|
+
archive/lock bytes before any separately approved delivery.
|
|
135
|
+
|
|
136
|
+
### Optional provider leaves
|
|
137
|
+
|
|
108
138
|
Cluster Mesh is the single integration surface for llm-mesh and llm-gateway. Those
|
|
109
139
|
providers stay independent packages and never depend on cluster-mesh. They are
|
|
110
140
|
**optional peers**: a bare install pulls none of them, and the root entry
|
|
@@ -115,11 +145,19 @@ providers stay independent packages and never depend on cluster-mesh. They are
|
|
|
115
145
|
| `/llm-mesh`, `/llm-mesh/facade`, `/llm-mesh/enrollment`, `/llm-mesh/node`, `/llm-mesh/transport/cloud-code` | matching `@sentropic/llm-mesh` entry | `@sentropic/llm-mesh >=0.22.0 <0.27.0` |
|
|
116
146
|
| `/gateway` | `@sentropic/llm-gateway` root (neither auth mode) | llm-mesh + `@sentropic/llm-gateway >=0.19.0 <0.21.0` |
|
|
117
147
|
| `/gateway/auth` (service mode) | `@sentropic/llm-gateway/auth` | gateway + `@sentropic/mcp-auth >=0.2.1 <0.3.0`, `jose ^5.10.0` |
|
|
118
|
-
| `/gateway/auth-hono` (session mode) | `@sentropic/llm-gateway/auth-hono` | gateway + `@sentropic/auth-hono ^0.15.0` |
|
|
148
|
+
| `/gateway/auth-hono` (session mode) | `@sentropic/llm-gateway/auth-hono` | gateway + `@sentropic/auth-hono ^0.15.0 \|\| ^0.16.0` |
|
|
119
149
|
| `/loaders/<leaf>` | async typed loader (`loadLlmMesh`, `loadGateway`, `loadGatewayAuth`, ...) | as its leaf, resolved on call |
|
|
120
150
|
| `/compose/llm-mesh`, `/compose/gateway` | `createLlmMeshNamespaceModule`, `createGatewayNamespaceModule` | as the loaders they call |
|
|
151
|
+
| `/mcp/registry`, `/mcp/stdio` | `@sentropic/mcp-platform` MCP kernel entries | `@sentropic/mcp-platform >=0.3.0 <0.4.0` (plus `@modelcontextprotocol/sdk ^1.31.0` for the stdio transport) |
|
|
152
|
+
| `/compose/mcp`, `/loaders/mcp` | `createMcpNamespaceModule`, `loadMcpPlatform{Registry,Stdio,Bridge,Entry,Hono}` | as its leaf, resolved on call |
|
|
153
|
+
| `/mcp/artifacts` | `createArtifactsBuiltin` over `@sentropic/artifacts/mcp` | `@sentropic/artifacts >=0.1.0 <0.2.0`, `@sentropic/mcp-platform >=0.3.0 <0.4.0` |
|
|
154
|
+
|
|
155
|
+
The `./mcp/artifacts` export provides the `sentropic.artifacts` builtin factory;
|
|
156
|
+
its optional `@sentropic/artifacts >=0.1.0 <0.2.0` peer must be installed when
|
|
157
|
+
that leaf is imported. `loadArtifactsMcp` from `./loaders/mcp` acquires the same
|
|
158
|
+
provider through the module registry. The root entry remains usable without it.
|
|
121
159
|
|
|
122
|
-
Static
|
|
160
|
+
Static provider re-export leaves use `export *`: same values,
|
|
123
161
|
types, overloads and class identity. Importing a leaf selects that provider; a
|
|
124
162
|
missing provider fails native ESM linking of the importing module. Loaders take a
|
|
125
163
|
registry from `createClusterMeshModules({ disabled? })` (one per composition root) and
|
|
@@ -129,7 +167,7 @@ load_failed | source_unavailable`). Recognize it with `isClusterMeshModuleUnavai
|
|
|
129
167
|
or by `code`, never by `instanceof` (duplicate copies have distinct constructors).
|
|
130
168
|
`modules.probe()` reports metadata-only availability without evaluating providers;
|
|
131
169
|
pass `modules` to `createDegenerateClusterMesh` to expose `capabilities.modules`.
|
|
132
|
-
|
|
170
|
+
Other catalogued capabilities are listed as `source_unavailable` until a
|
|
133
171
|
later minor delivers them.
|
|
134
172
|
|
|
135
173
|
**Startup preflight (fail closed before bind).** llm-gateway imports its auth peers
|
|
@@ -177,15 +215,16 @@ resolution anchor at the installed package; bundling the root inline (as the API
|
|
|
177
215
|
build does) embeds no provider code. TypeScript >= 5.7 is required with
|
|
178
216
|
`skipLibCheck: false` (hono's declarations); with `skipLibCheck: true`, a missing
|
|
179
217
|
peer surfaces as TS2305 on the named import. Frozen tuple (committed lockfile):
|
|
180
|
-
cluster-mesh 0.
|
|
181
|
-
oauth-verify 0.1.0, jose 5.10.0, hono 4.
|
|
182
|
-
(llm-gateway 0.20.
|
|
218
|
+
cluster-mesh 0.18.0, llm-mesh 0.26.1, llm-gateway 0.20.1, mcp-auth 0.2.2,
|
|
219
|
+
oauth-verify 0.1.0, jose 5.10.0, hono 4.13.0; session mode with auth-hono 0.16.0
|
|
220
|
+
(llm-gateway 0.20.1's declared peer range `^0.15.0 || ^0.16.0`); the latest versions inside
|
|
183
221
|
every declared range are re-qualified on each release run. The previous tuple
|
|
184
222
|
(llm-mesh 0.21.x, llm-gateway 0.18.x) is refused, see "Upgrading to 0.13" below.
|
|
185
223
|
|
|
186
|
-
The current release target is **cluster-mesh 0.
|
|
187
|
-
llm-gateway 0.20.
|
|
188
|
-
|
|
224
|
+
The current release target is **cluster-mesh 0.18.0, llm-mesh 0.26.1 and
|
|
225
|
+
llm-gateway 0.20.1** (cluster-mesh 0.18.0 is the unpublished branch candidate;
|
|
226
|
+
main carries llm-mesh 0.26.1 and llm-gateway 0.20.0 — see the Post-Rebase Gate in
|
|
227
|
+
BRANCH.md). Final sibling archive qualification
|
|
189
228
|
and the selected-lock integrity refresh remain release gates; the selected fixture
|
|
190
229
|
retains the baseline until that final refresh. The widened ranges retain the prior
|
|
191
230
|
qualified minors.
|
|
@@ -275,17 +314,28 @@ qualification and is rejected in production.
|
|
|
275
314
|
|
|
276
315
|
## Gated seams
|
|
277
316
|
|
|
278
|
-
The public surface already defines the future federal ports
|
|
279
|
-
closed for all of them
|
|
317
|
+
The public surface already defines the future federal ports. The v1 runtime fails
|
|
318
|
+
closed for all of them except RFC 8693 token exchange, which is available when a
|
|
319
|
+
binding plus policy is configured (see below):
|
|
280
320
|
|
|
281
321
|
- inter-server discovery and member revocation;
|
|
282
|
-
- RFC 8693 token exchange;
|
|
283
322
|
- remote signed-projection resolution;
|
|
284
323
|
- memory snapshot replication and purge.
|
|
285
324
|
|
|
286
325
|
Invoking one of these seams throws `CapabilityGatedError`. The package exposes no broker
|
|
287
326
|
HTTP route, trusted-issuer store, inter-server directory, or replication runtime.
|
|
288
327
|
|
|
328
|
+
## RFC 8693 token exchange (configured)
|
|
329
|
+
|
|
330
|
+
`createDegenerateClusterMesh({ tokenExchange })` wires the exchange client when the
|
|
331
|
+
binding plus policy passes its local preflight; otherwise `capabilities.tokenExchange`
|
|
332
|
+
stays `'gated'`. The production binding (`trust/token-exchange-http.ts`) performs an
|
|
333
|
+
authenticated RFC 8693 form POST with `client_secret_basic`, validates the returned
|
|
334
|
+
token (signature, issuer, exact audience, subject, workload `client_id`, mandatory
|
|
335
|
+
`act`, scope subset, TTL ceilings), and caches it for at most 60 seconds with an
|
|
336
|
+
early-use safety margin. `tokenExchange: 'available'` proves only this trust/egress
|
|
337
|
+
port: it neither delivers the MCP provider registry nor qualifies any module leaf.
|
|
338
|
+
|
|
289
339
|
## Construction
|
|
290
340
|
|
|
291
341
|
`createDegenerateClusterMesh` composes the membership, trust, wrap, device, and
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{COMMAND_CAPABILITIES as De,commandIdempotencyKey as je,commandPayloadDigest as F,computeProposedContentDigest as ge,defaultDenyCapabilityCheck as Be,resolveIdempotentReplay as fe,checkDecisionEvidence as we}from"@sentropic/comments";import{createAnnotationRevision as g,createCommentRevision as J,createThreadStructureRevision as Me}from"@sentropic/comments";import{hashRecord as C}from"@sentropic/comments";import{createReviewEvent as k,projectReviewState as Q}from"@sentropic/comments";import{createLifecycleEvent as m,createOperationAuditEvent as ye,projectLifecycleState as R}from"@sentropic/comments";import{createPreparedSubmissionManifest as be}from"@sentropic/comments";var t=(n,e)=>{if(!n)throw new Error(`Conformance failure: ${e}`)},r=async(n,e,i)=>{try{await n()}catch(v){let c=v.code;t(typeof c=="string"&&c===e,`${i} (got ${String(c)})`);return}t(!1,`${i} (expected error ${e}, got success)`)},me=(n="a")=>({tenantId:"tenant-conformance",workspaceId:`ws-${n}`}),ve=(n,e="res-1")=>({scope:n,namespace:"conformance",kind:"document",id:e}),Ce=(n="src-v1")=>({variant:"observed",sourceVersion:n,evidence:"author-view-evidence"}),Ae=()=>({variant:"fixed-at-conversion",sourceVersion:"converted-v1",conversionRef:"conversion-op-1",historicalGap:!0}),Ve=()=>({variant:"unknown",classification:"evidence-gap"}),N=(n,e=Ce())=>({resource:n,source:e}),W=n=>({text:n,codec:{format:"plain",codecId:"plain-v1",specDigest:"plain-spec-digest-v1",extensions:[]}}),z=(n="author-1",e=1717e9)=>({registration:{principal:n,registeredAt:e},attribution:{variant:"human",assertionClass:"self-declared",evidence:"user-account"}}),Ee=()=>({body:{limit:1e6,unit:"utf8-bytes"},segment:{limit:1e5,unit:"utf8-bytes"},profile:{limit:1e5,unit:"canonical-bytes"},unitManifest:{limit:1e5,unit:"canonical-bytes"},unitPayload:{limit:1e6,unit:"utf8-bytes"},batchUnits:{limit:1e3,unit:"units"},batchManifest:{limit:1e6,unit:"canonical-bytes"},batchRequest:{limit:1e7,unit:"canonical-bytes"},pageRecords:{limit:500,unit:"records"},pageEncodedBytes:{limit:1e7,unit:"utf8-bytes"}}),qe=async n=>{let e=me(),i=Ee(),v=ve(e),c=(a,u=Ce())=>({scope:e,annotationId:"ann-1",primary:N(v,u),secondary:[],visualAnchors:[],body:W(a),provenance:z()}),p=g(null,c("first"),i);await n.appendAnnotationRevision(e,"ann-1",p,{kind:"creation",aggregateVersion:0});let h=g(p,c("second"),i),X=g(p,c("third"),i);t(h.hash!==X.hash,"cas: divergent edits hash differently"),await n.appendAnnotationRevision(e,"ann-1",h,{kind:"revision",revisionHash:p.hash}),await r(()=>n.appendAnnotationRevision(e,"ann-1",X,{kind:"revision",revisionHash:p.hash}),"cas-conflict","cas: the second writer against the same head conflicts");let Y=await n.getAnnotationChain(e,"ann-1");t(Y.length===2&&Y[1].hash===h.hash,"cas: exactly one winner");let Z=F({action:"revise",text:"second"}),I={digest:Z,resultIds:["ann-1"],resultHash:h.hash},x=je("conformance-key-1");await n.recordCommittedCommand(e,x,I);let ee=await n.findCommittedCommand(e,x);t(ee!==null&&ee.resultHash===h.hash,"replay: the committed command is indexed"),t(fe(I,Z).result===I,"replay: unchanged replay returns the committed result"),await r(()=>fe(I,F({action:"revise",text:"changed"})),"idempotency-conflict","replay: a changed replay conflicts"),await r(()=>n.recordCommittedCommand(e,x,{digest:F({other:!0}),resultIds:[],resultHash:null}),"idempotency-conflict","replay: a conflicting index write is rejected");for(let a of De)t(await Be.check("principal-1",a,[v])===!1,"authority: an unconfigured capability denies by default");let ne=[],ke={check:async(a,u,b)=>(ne.push([...b]),!0)},Re=ve(e,"res-2"),Ie=await ke.check("principal-1","revise",[v,Re]);t(Ie&&ne[0].length===2,"authority: a capability check covers every target");let te=me("b");t(await n.getAnnotationHead(te,"ann-1")===null,"scope: another workspace sees no chain");let _e={tenantId:"tenant-other",workspaceId:"ws-a"};t(await n.getAnnotationHead(_e,"ann-1")===null,"scope: another tenant sees no chain"),await r(()=>n.appendAnnotationRevision(te,"ann-1",h,{kind:"revision",revisionHash:p.hash}),"invalid-command","scope: a cross-scope append is rejected");let A=g(h,c("fourth",Ae()),i);await n.appendAnnotationRevision(e,"ann-1",A,{kind:"revision",revisionHash:h.hash});let V=g(A,c("fifth",Ve()),i);await n.appendAnnotationRevision(e,"ann-1",V,{kind:"revision",revisionHash:A.hash}),t((await n.getAnnotationHead(e,"ann-1"))?.hash===V.hash,"sources: observed, fixed-at-conversion and unknown indicators are all accepted");let d=V,f=(a,u,b={})=>({scope:e,annotationId:"ann-1",action:a,revisionHash:u,referencesEventHash:null,actor:{principal:"reviewer-1"},decision:null,proposal:null,executor:null,...b}),s=[];s.push(k(s,f("submit",d.hash),i));let E=k(s,f("validate",d.hash,{decision:{principal:"reviewer-1",outcome:"accept"}}),i);s.push(E);let D=k(s,f("contest",d.hash,{referencesEventHash:E.hash}),i);s.push(D);let ie=k(s,f("resolve-contest",d.hash,{referencesEventHash:D.hash,decision:{principal:"reviewer-2",outcome:"accept"}}),i);s.push(ie);let j=Q(s,d.hash);t(j.state==="contested","review: a resolved contest does not silently revalidate"),t(j.requiresRenewedValidation,"review: a resolved contest requires renewed validation"),t(j.contests.some(a=>a.eventHash===D.hash&&a.contestsEventHash===E.hash&&a.resolvedByEventHash===ie.hash),"review: the resolved contest stays visible with exact hashes"),s.push(k(s,f("validate",d.hash,{decision:{principal:"reviewer-3",outcome:"accept"}}),i)),t(Q(s,d.hash).state==="validated","review: renewed validation revalidates");let ae=Q(s,p.hash);t(ae.state==="none"&&ae.staleEventHashes.length===s.length,"review: events pinned to a superseded revision are stale");let w=null;for(let a of s)await n.appendReviewEvent(e,"ann-1",a,w===null?{kind:"creation",aggregateVersion:0}:{kind:"revision",revisionHash:w}),w=a.hash;let B=await n.getReviewChain(e,"ann-1");t(B.length===s.length&&B[B.length-1].hash===w,"review: the store chain matches the projected history"),await r(()=>n.appendReviewEvent(e,"ann-1",s[0],{kind:"revision",revisionHash:w}),"cas-conflict","review: a stale review append conflicts");let l=(a,u={})=>({scope:e,objectKind:"annotation",objectId:"ann-1",action:a,archiveKind:null,actor:{principal:"admin-1"},reason:null,...u}),o=[];o.push(m(o,l("archive",{archiveKind:"shared"}),i)),t(R(o).archived,"lifecycle: an archive is projected"),o.push(m(o,l("restore"),i)),t(!R(o).archived&&R(o).available,"lifecycle: an archive is reversible"),o.push(m(o,l("tombstone"),i)),t(!R(o).available,"lifecycle: a tombstone removes availability"),await r(()=>m(o,l("archive",{archiveKind:"shared"}),i),"tombstoned","lifecycle: a tombstoned object cannot be archived"),await r(()=>m(o,l("tombstone"),i),"tombstoned","lifecycle: a tombstone is irreversible"),await r(()=>m(o,l("restore"),i),"tombstoned","lifecycle: recovery cannot resurrect a tombstone"),o.push(m(o,l("purge-intent"),i)),o.push(m(o,l("purge-outcome"),i)),t(R(o).purge==="purged","lifecycle: the purge state is explicit");let y=null;for(let a of o)await n.appendLifecycleEvent(e,"annotation","ann-1",a,y===null?{kind:"creation",aggregateVersion:0}:{kind:"revision",revisionHash:y}),y=a.hash;let M=await n.getLifecycleChain(e,"annotation","ann-1");t(M.length===o.length&&M[M.length-1].hash===y,"lifecycle: the store chain matches the projected lifecycle"),await r(()=>n.appendLifecycleEvent(e,"annotation","ann-1",o[0],{kind:"revision",revisionHash:y}),"cas-conflict","lifecycle: a stale lifecycle append conflicts");let oe=a=>({scope:e,subject:"assignment",subjectId:"assign-1",operation:a,principal:"admin-1",audience:["aud-1"],detail:null}),_=ye([],oe("assign"),i),T=ye([_],oe("reassign"),i);await n.appendOperationAuditEvent(e,"assignment","assign-1",_,{kind:"creation",aggregateVersion:0}),await n.appendOperationAuditEvent(e,"assignment","assign-1",T,{kind:"revision",revisionHash:_.hash});let se=await n.getOperationAuditChain(e,"assignment","assign-1");t(se.length===2&&se[1].hash===T.hash,"audit: the audit chain stays separate and ordered"),await r(()=>n.appendOperationAuditEvent(e,"assignment","assign-1",T,{kind:"revision",revisionHash:_.hash}),"cas-conflict","audit: a stale audit append conflicts");let He={primary:N(v),secondary:[],visualAnchors:[],body:W("proposed content")},O=ge(He),re={actor:"author-1",action:"revise",scope:e,issuedAt:1717e9,expiresAt:null,revoked:!1,revocationVersion:0,authority:"host-authority",binding:{kind:"creation",aggregateVersion:0,proposedContentDigest:O}},Se=g(null,{...c("proposed content"),annotationId:"ann-g4"},i);t(Se.hash!==O,"g4: a decision never binds its own future output hash"),we(re,{actor:"author-1",action:"revise",scope:e,now:1717000000001,binding:{kind:"creation",aggregateVersion:0,proposedContentDigest:O}}),await r(()=>we(re,{actor:"author-1",action:"revise",scope:e,now:1717000000001,binding:{kind:"creation",aggregateVersion:0,proposedContentDigest:ge({tampered:!0})}}),"denied","g4: a mismatched proposed-content digest denies the action");let L=Me(null,{scope:e,threadId:"thread-plain",trigger:"initial-registration",primary:N(v),annotationId:null,provenance:z()},i);await n.appendThreadStructureRevision(e,"thread-plain",L,{kind:"creation",aggregateVersion:0});let Pe={id:"thread-plain",hash:L.hash},U=(a,u,b)=>({scope:e,threadId:"thread-plain",commentId:a,parentCommentId:null,structureRevision:Pe,annotationPin:b,body:W(u),provenance:z()});await n.appendCommentRevision(e,"comment-plain",J(null,U("comment-plain","plain reply",null),i),{kind:"creation",aggregateVersion:0});let K=J(null,U("comment-old-pin","pins the genesis revision",{annotationId:"ann-1",revisionHash:p.hash}),i);await n.appendCommentRevision(e,"comment-old-pin",K,{kind:"creation",aggregateVersion:0});let $=J(null,U("comment-new-pin","pins the head revision",{annotationId:"ann-1",revisionHash:d.hash}),i);await n.appendCommentRevision(e,"comment-new-pin",$,{kind:"creation",aggregateVersion:0}),t(K.annotationPin!==null&&$.annotationPin!==null&&K.annotationPin.revisionHash!==$.annotationPin.revisionHash,"pins: comments may pin different revisions of one annotation and coexist");let ce=await n.getThreadStructureChain(e,"thread-plain");t(ce.length===1&&ce[0].hash===L.hash,"structures: the thread chain is readable in order");let de={scope:e,submissionId:"sub-1",annotation:{annotationId:"ann-1",revisionHash:d.hash},selectedComments:[],selectedStructures:[],captureDigests:[],contractVersion:"contract-v1",profileVersion:"profile-v1",preparedBy:{principal:"author-1"}},H=be(de,i);await n.appendPreparedSubmissionManifest(e,"sub-1",H),t((await n.appendPreparedSubmissionManifest(e,"sub-1",H)).hash===H.hash,"submission: a genesis replay returns the stored manifest");let xe=be({...de,annotation:{annotationId:"ann-1",revisionHash:p.hash}},i);await r(()=>n.appendPreparedSubmissionManifest(e,"sub-1",xe),"idempotency-conflict","submission: a different manifest under the same submission id conflicts");let S={kind:"import-manifest",scope:e,importId:"imp-1",sourceUnitCount:2,admissibleManifestDigest:"admissible-digest-1",mappingVersion:"mapping-v1",hash:C("import-manifest",{scope:e,importId:"imp-1",sourceUnitCount:2,admissibleManifestDigest:"admissible-digest-1",mappingVersion:"mapping-v1"})};t((await n.appendImportManifest(e,"imp-1",S)).hash===S.hash,"import: a manifest genesis replay returns the stored record");let pe={kind:"unit-receipt",scope:e,unitId:"unit-1",manifestHash:S.hash,issuedAt:1717000000001,hash:C("unit-receipt",{scope:e,unitId:"unit-1",manifestHash:S.hash,issuedAt:1717000000001})};t((await n.appendUnitReceipt(e,"unit-1",pe)).hash===pe.hash,"import: a receipt genesis replay returns the stored record");let q={kind:"batch-receipt-snapshot",scope:e,batchId:"batch-1",receiptCount:1,snapshotDigest:"snapshot-digest-1",hash:C("batch-receipt-snapshot",{scope:e,batchId:"batch-1",receiptCount:1,snapshotDigest:"snapshot-digest-1"})},he={kind:"batch-receipt-snapshot",scope:e,batchId:"batch-1",receiptCount:2,snapshotDigest:"snapshot-digest-2",hash:C("batch-receipt-snapshot",{scope:e,batchId:"batch-1",receiptCount:2,snapshotDigest:"snapshot-digest-2"})};await n.appendBatchReceiptSnapshot(e,"batch-1",q,{kind:"creation",aggregateVersion:0}),await n.appendBatchReceiptSnapshot(e,"batch-1",he,{kind:"revision",revisionHash:q.hash}),await r(()=>n.appendBatchReceiptSnapshot(e,"batch-1",he,{kind:"revision",revisionHash:q.hash}),"cas-conflict","batch: a stale snapshot append conflicts");let le={kind:"conversion-report",scope:e,reportId:"cr-1",sourceUnitCount:2,completenessDeclared:!0,admissibleManifestDigest:"admissible-digest-1",hash:C("conversion-report",{scope:e,reportId:"cr-1",sourceUnitCount:2,completenessDeclared:!0,admissibleManifestDigest:"admissible-digest-1"})};await n.appendConversionReport(e,"cr-1",le,{kind:"creation",aggregateVersion:0}),t((await n.readChainPage(e,{kind:"conversion-reports",reportId:"cr-1"},{limit:10,cursor:null})).records[0].hash===le.hash,"conversion: the report chain is readable");let P=await n.readChainPage(e,{kind:"annotation-revisions",annotationId:"ann-1"},{limit:2,cursor:null});t(P.outcome==="page"&&P.records.length===2&&P.nextCursor!==null,"pagination: a page is bounded with a continuation cursor");let G=await n.readChainPage(e,{kind:"annotation-revisions",annotationId:"ann-1"},{limit:2,cursor:P.nextCursor});t(G.records.length===2&&G.nextCursor===null&&G.records[1].hash===d.hash,"pagination: cursor continuation reaches exhaustion at the head"),await r(()=>n.readChainPage(e,{kind:"annotation-revisions",annotationId:"ann-1"},{limit:0,cursor:null}),"invalid-command","pagination: a non-positive limit is rejected");let ue=await n.readChainPage(e,{kind:"prepared-submission-manifests",submissionId:"sub-1"},{limit:10,cursor:null});t(ue.records.length===1&&ue.records[0].hash===H.hash,"pagination: a genesis record reads as one page")};export{t as conformanceAssert,W as conformanceBody,Ee as conformanceCapacity,z as conformanceProvenance,ve as conformanceResource,me as conformanceScope,N as conformanceTarget,Ae as conversionSource,r as expectConformanceError,Ce as observedSource,qe as runCommentsConformance,Ve as unknownSource};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"peer": "@sentropic/comments@0.3.0",
|
|
4
|
+
"source": {
|
|
5
|
+
"path": "packages/comments/tests/conformance/comments-conformance.ts",
|
|
6
|
+
"sha256": "26cdaf181afbc73c145c57974c6762230757bc101a0418f8da0654f505fb7b00"
|
|
7
|
+
},
|
|
8
|
+
"vectors": {
|
|
9
|
+
"path": "packages/comments/tests/fixtures/revision-hash-v1.json",
|
|
10
|
+
"sha256": "26ee62b09d22f39438c344a9223564f08e696eeba95ddd0558f357407a40f0c0"
|
|
11
|
+
},
|
|
12
|
+
"artifacts": [
|
|
13
|
+
{
|
|
14
|
+
"file": "conformance.mjs",
|
|
15
|
+
"sha256": "a6ba1d58c054b5d9bbd6638586212d3fb9701b261d5c5e8b180de18f547f08f1"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"file": "revision-hash-v1.json",
|
|
19
|
+
"sha256": "bba49a941d968e023ba3750119b21e91213794562073f180e314a216534c3ad9"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"compiler": "esbuild@0.25.5",
|
|
23
|
+
"external": "@sentropic/comments"
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"hashVersion":"revision-hash-v1","records":[{"id":"annotation-genesis","kind":"annotation-revision","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"annotationId":"ann_corpus_1","link":{"sequence":1,"previousHash":null},"primary":{"resource":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"namespace":"ns_corpus","kind":"document","id":"res_corpus_1"},"source":{"variant":"observed","sourceVersion":"src_v1","evidence":"evidence_corpus_1"}},"secondary":[],"visualAnchors":[],"body":{"text":"corpus annotation body","codec":{"format":"plain","codecId":"plain-v1","specDigest":"spec-digest-plain-1","extensions":[]}},"provenance":{"registration":{"principal":"author_corpus","registeredAt":1717000000000},"attribution":{"variant":"human","assertionClass":"self-declared","evidence":"account"}}},"canonical":"{\"annotationId\":\"ann_corpus_1\",\"body\":{\"codec\":{\"codecId\":\"plain-v1\",\"extensions\":[],\"format\":\"plain\",\"specDigest\":\"spec-digest-plain-1\"},\"text\":\"corpus annotation body\"},\"hashVersion\":\"revision-hash-v1\",\"kind\":\"annotation-revision\",\"link\":{\"previousHash\":null,\"sequence\":1},\"primary\":{\"resource\":{\"id\":\"res_corpus_1\",\"kind\":\"document\",\"namespace\":\"ns_corpus\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"}},\"source\":{\"evidence\":\"evidence_corpus_1\",\"sourceVersion\":\"src_v1\",\"variant\":\"observed\"}},\"provenance\":{\"attribution\":{\"assertionClass\":\"self-declared\",\"evidence\":\"account\",\"variant\":\"human\"},\"registration\":{\"principal\":\"author_corpus\",\"registeredAt\":1717000000000}},\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"secondary\":[],\"visualAnchors\":[]}","digest":"42451a0808709bde5abc1f997540b6ee3a30e61b78813c15f0e30bca0bf28987"},{"id":"thread-structure-genesis","kind":"thread-structure-revision","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"threadId":"thr_corpus_1","link":{"sequence":1,"previousHash":null},"trigger":"initial-registration","primary":{"resource":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"namespace":"ns_corpus","kind":"document","id":"res_corpus_1"},"source":{"variant":"observed","sourceVersion":"src_v1","evidence":"evidence_corpus_1"}},"annotationId":null,"provenance":{"registration":{"principal":"author_corpus","registeredAt":1717000000000},"attribution":{"variant":"human","assertionClass":"self-declared","evidence":"account"}}},"canonical":"{\"annotationId\":null,\"hashVersion\":\"revision-hash-v1\",\"kind\":\"thread-structure-revision\",\"link\":{\"previousHash\":null,\"sequence\":1},\"primary\":{\"resource\":{\"id\":\"res_corpus_1\",\"kind\":\"document\",\"namespace\":\"ns_corpus\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"}},\"source\":{\"evidence\":\"evidence_corpus_1\",\"sourceVersion\":\"src_v1\",\"variant\":\"observed\"}},\"provenance\":{\"attribution\":{\"assertionClass\":\"self-declared\",\"evidence\":\"account\",\"variant\":\"human\"},\"registration\":{\"principal\":\"author_corpus\",\"registeredAt\":1717000000000}},\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"threadId\":\"thr_corpus_1\",\"trigger\":\"initial-registration\"}","digest":"d443ce13ca1ee5fb92b77504b529c5a4f87df8e083e7bc8aea43f0800009ecf9"},{"id":"comment-genesis","kind":"comment-revision","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"threadId":"thr_corpus_1","commentId":"cmt_corpus_1","link":{"sequence":1,"previousHash":null},"parentCommentId":null,"structureRevision":{"id":"thr_corpus_1","hash":"d443ce13ca1ee5fb92b77504b529c5a4f87df8e083e7bc8aea43f0800009ecf9"},"annotationPin":{"annotationId":"ann_corpus_1","revisionHash":"42451a0808709bde5abc1f997540b6ee3a30e61b78813c15f0e30bca0bf28987"},"body":{"text":"corpus comment body","codec":{"format":"plain","codecId":"plain-v1","specDigest":"spec-digest-plain-1","extensions":[]}},"provenance":{"registration":{"principal":"author_corpus","registeredAt":1717000000000},"attribution":{"variant":"human","assertionClass":"self-declared","evidence":"account"}}},"canonical":"{\"annotationPin\":{\"annotationId\":\"ann_corpus_1\",\"revisionHash\":\"42451a0808709bde5abc1f997540b6ee3a30e61b78813c15f0e30bca0bf28987\"},\"body\":{\"codec\":{\"codecId\":\"plain-v1\",\"extensions\":[],\"format\":\"plain\",\"specDigest\":\"spec-digest-plain-1\"},\"text\":\"corpus comment body\"},\"commentId\":\"cmt_corpus_1\",\"hashVersion\":\"revision-hash-v1\",\"kind\":\"comment-revision\",\"link\":{\"previousHash\":null,\"sequence\":1},\"parentCommentId\":null,\"provenance\":{\"attribution\":{\"assertionClass\":\"self-declared\",\"evidence\":\"account\",\"variant\":\"human\"},\"registration\":{\"principal\":\"author_corpus\",\"registeredAt\":1717000000000}},\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"structureRevision\":{\"hash\":\"d443ce13ca1ee5fb92b77504b529c5a4f87df8e083e7bc8aea43f0800009ecf9\",\"id\":\"thr_corpus_1\"},\"threadId\":\"thr_corpus_1\"}","digest":"1d6cc7dda5f6cf8492b5f72ba873fa54cc6b14fbb0a6281f5c74dc9edace233c"},{"id":"review-submit","kind":"review-event","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"annotationId":"ann_corpus_1","link":{"sequence":1,"previousHash":null},"action":"submit","revisionHash":"42451a0808709bde5abc1f997540b6ee3a30e61b78813c15f0e30bca0bf28987","referencesEventHash":null,"actor":{"principal":"reviewer_corpus"},"decision":null,"proposal":null,"executor":null},"canonical":"{\"action\":\"submit\",\"actor\":{\"principal\":\"reviewer_corpus\"},\"annotationId\":\"ann_corpus_1\",\"decision\":null,\"executor\":null,\"hashVersion\":\"revision-hash-v1\",\"kind\":\"review-event\",\"link\":{\"previousHash\":null,\"sequence\":1},\"proposal\":null,\"referencesEventHash\":null,\"revisionHash\":\"42451a0808709bde5abc1f997540b6ee3a30e61b78813c15f0e30bca0bf28987\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"}}","digest":"03f5bafc15c2a874a5f69c5b8eec99b6f1ae53c647147526adfd77672917d69b"},{"id":"prepared-submission","kind":"prepared-submission-manifest","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"submissionId":"sub_corpus_1","annotation":{"annotationId":"ann_corpus_1","revisionHash":"42451a0808709bde5abc1f997540b6ee3a30e61b78813c15f0e30bca0bf28987"},"selectedComments":[{"commentId":"cmt_corpus_1","revisionHash":"1d6cc7dda5f6cf8492b5f72ba873fa54cc6b14fbb0a6281f5c74dc9edace233c"}],"selectedStructures":[{"threadId":"thr_corpus_1","revisionHash":"d443ce13ca1ee5fb92b77504b529c5a4f87df8e083e7bc8aea43f0800009ecf9"}],"captureDigests":["capture-digest-1"],"contractVersion":"contract-v1","profileVersion":"profile-v1","preparedBy":{"principal":"author_corpus"}},"canonical":"{\"annotation\":{\"annotationId\":\"ann_corpus_1\",\"revisionHash\":\"42451a0808709bde5abc1f997540b6ee3a30e61b78813c15f0e30bca0bf28987\"},\"captureDigests\":[\"capture-digest-1\"],\"contractVersion\":\"contract-v1\",\"hashVersion\":\"revision-hash-v1\",\"kind\":\"prepared-submission-manifest\",\"preparedBy\":{\"principal\":\"author_corpus\"},\"profileVersion\":\"profile-v1\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"selectedComments\":[{\"commentId\":\"cmt_corpus_1\",\"revisionHash\":\"1d6cc7dda5f6cf8492b5f72ba873fa54cc6b14fbb0a6281f5c74dc9edace233c\"}],\"selectedStructures\":[{\"revisionHash\":\"d443ce13ca1ee5fb92b77504b529c5a4f87df8e083e7bc8aea43f0800009ecf9\",\"threadId\":\"thr_corpus_1\"}],\"submissionId\":\"sub_corpus_1\"}","digest":"020b8f4c7ffce229aa9bc1c0bb687e8a3e4a2fffd767cb2bca4090c77ca0fe92"},{"id":"import-manifest","kind":"import-manifest","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"importId":"imp_corpus_1","sourceUnitCount":3,"admissibleManifestDigest":"admissible-digest-1","mappingVersion":"mapping-v1"},"canonical":"{\"admissibleManifestDigest\":\"admissible-digest-1\",\"hashVersion\":\"revision-hash-v1\",\"importId\":\"imp_corpus_1\",\"kind\":\"import-manifest\",\"mappingVersion\":\"mapping-v1\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"sourceUnitCount\":3}","digest":"79bbe0fa99848166b7a212ab71dd78b94337b150680349eec3e72e1fa238bd53"},{"id":"unit-receipt","kind":"unit-receipt","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"unitId":"unit_corpus_1","manifestHash":"020b8f4c7ffce229aa9bc1c0bb687e8a3e4a2fffd767cb2bca4090c77ca0fe92","issuedAt":1717000000000},"canonical":"{\"hashVersion\":\"revision-hash-v1\",\"issuedAt\":1717000000000,\"kind\":\"unit-receipt\",\"manifestHash\":\"020b8f4c7ffce229aa9bc1c0bb687e8a3e4a2fffd767cb2bca4090c77ca0fe92\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"unitId\":\"unit_corpus_1\"}","digest":"9eb4e95819bc00e1fe23603ba15e2655cdc2e67d1538b34e10b7f5c73a0477c8"},{"id":"batch-receipt-snapshot","kind":"batch-receipt-snapshot","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"batchId":"batch_corpus_1","receiptCount":1,"snapshotDigest":"snapshot-digest-1"},"canonical":"{\"batchId\":\"batch_corpus_1\",\"hashVersion\":\"revision-hash-v1\",\"kind\":\"batch-receipt-snapshot\",\"receiptCount\":1,\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"snapshotDigest\":\"snapshot-digest-1\"}","digest":"5e32dec581af1cdcc267b168a47ef81c18b042a9c1462665694be69c7600355f"},{"id":"lifecycle-tombstone","kind":"lifecycle-event","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"objectKind":"annotation","objectId":"ann_corpus_1","link":{"sequence":1,"previousHash":null},"action":"tombstone","archiveKind":null,"actor":{"principal":"admin_corpus"},"reason":"retention-policy"},"canonical":"{\"action\":\"tombstone\",\"actor\":{\"principal\":\"admin_corpus\"},\"archiveKind\":null,\"hashVersion\":\"revision-hash-v1\",\"kind\":\"lifecycle-event\",\"link\":{\"previousHash\":null,\"sequence\":1},\"objectId\":\"ann_corpus_1\",\"objectKind\":\"annotation\",\"reason\":\"retention-policy\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"}}","digest":"703c231c186d3987caea8b16160e1f80874b631c15cfb4170e5ffb528d122b02"},{"id":"operation-audit-assignment","kind":"operation-audit-event","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"subject":"assignment","subjectId":"asg_corpus_1","link":{"sequence":1,"previousHash":null},"operation":"assign","principal":"admin_corpus","audience":["principal_corpus_1"],"detail":null},"canonical":"{\"audience\":[\"principal_corpus_1\"],\"detail\":null,\"hashVersion\":\"revision-hash-v1\",\"kind\":\"operation-audit-event\",\"link\":{\"previousHash\":null,\"sequence\":1},\"operation\":\"assign\",\"principal\":\"admin_corpus\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"subject\":\"assignment\",\"subjectId\":\"asg_corpus_1\"}","digest":"72de6e315b4018d0c77a65a9419551d620362a2db660a675f5c66e3d71bce84b"},{"id":"conversion-report","kind":"conversion-report","envelope":{"scope":{"tenantId":"tnt_corpus","workspaceId":"wsp_corpus"},"reportId":"conv_corpus_1","sourceUnitCount":3,"completenessDeclared":true,"admissibleManifestDigest":"admissible-digest-1"},"canonical":"{\"admissibleManifestDigest\":\"admissible-digest-1\",\"completenessDeclared\":true,\"hashVersion\":\"revision-hash-v1\",\"kind\":\"conversion-report\",\"reportId\":\"conv_corpus_1\",\"scope\":{\"tenantId\":\"tnt_corpus\",\"workspaceId\":\"wsp_corpus\"},\"sourceUnitCount\":3}","digest":"93a7b90fea4ea070b482a6db12570ccda0dd7f2cd4b91427c4722dd78a5f6632"}],"canonicalVectors":[{"id":"null-versus-absence","value":{"a":null,"b":1},"canonical":"{\"a\":null,\"b\":1}","digest":"c0bf82ad036cb0a5a03d6759c1b7b8b1f70a39b32dd96ed3977c7f2831ee3b56"},{"id":"key-sort-utf16","value":{"b":1,"a":2,"C":3},"canonical":"{\"C\":3,\"a\":2,\"b\":1}","digest":"27e01c26743085bff8e4a98d76dca93ebdb6c805f8136fae1216ee257d33f5c5"},{"id":"zero","value":0,"canonical":"0","digest":"5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9"},{"id":"string-escapes","value":{"k":"a\"b\\c\nd\te"},"canonical":"{\"k\":\"a\\\"b\\\\c\\nd\\te\"}","digest":"3f03d34684cffd9b06f22da7a3a058e7b523a4aa7ff4621c7d1cd71e8f287a63"},{"id":"unicode-text","value":{"text":"héllo — wörld"},"canonical":"{\"text\":\"héllo — wörld\"}","digest":"fb07b647ef29bcf39d9a5ccdf8554b95edff80ffa39e90476434c934c7176a75"},{"id":"nested-arrays","value":[[1,2],[null,true,"x"]],"canonical":"[[1,2],[null,true,\"x\"]]","digest":"182be8e00d09d090c1728814265790661278b45f4c3238bd84bc71f34c8d638b"}],"geometry":[{"id":"tie-upward","input":"0.1234565","millionths":123457},{"id":"below-tie","input":"0.1234564","millionths":123456},{"id":"negative-tie-upward","input":"-0.1234565","millionths":-123456},{"id":"negative-zero","input":"-0","millionths":0},{"id":"box-edges-200x100","frame":{"width":200,"height":100,"digest":"frame-digest-1"},"input":{"kind":"box","x":"0.25","y":"0.75","width":"0.5","height":"0.25"},"quantized":{"kind":"box","x":250000,"y":750000,"width":500000,"height":250000}},{"id":"box-full-frame","frame":{"width":200,"height":100,"digest":"frame-digest-1"},"input":{"kind":"box","x":"0","y":"0","width":"1","height":"1"},"quantized":{"kind":"box","x":0,"y":0,"width":1000000,"height":1000000}},{"id":"circle-complete-shorter-dimension","frame":{"width":200,"height":100,"digest":"frame-digest-1"},"input":{"kind":"circle","cx":"0.5","cy":"0.5","r":"0.5"},"quantized":{"kind":"circle","cx":500000,"cy":500000,"r":500000}},{"id":"circle-quarter-200x100","frame":{"width":200,"height":100,"digest":"frame-digest-1"},"input":{"kind":"circle","cx":"0.5","cy":"0.5","r":"0.25"},"quantized":{"kind":"circle","cx":500000,"cy":500000,"r":250000}}],"rejections":[{"id":"circle-overflow-200x100","frame":{"width":200,"height":100,"digest":"frame-digest-1"},"input":{"kind":"circle","cx":"0.5","cy":"0.5","r":"0.51"},"code":"circle-overflow"},{"id":"box-collapse","frame":{"width":200,"height":100,"digest":"frame-digest-1"},"input":{"kind":"box","x":"0.1","y":"0.1","width":"0","height":"0.5"},"code":"collapsed-size"},{"id":"decimal-exponent","input":"1.5e3","code":"invalid-decimal"},{"id":"decimal-leading-plus","input":"+1","code":"invalid-decimal"},{"id":"decimal-leading-dot","input":".5","code":"invalid-decimal"},{"id":"decimal-trailing-dot","input":"1.","code":"invalid-decimal"},{"id":"decimal-whitespace","input":" 1","code":"invalid-decimal"},{"id":"lone-surrogate","charCodes":[55296,97],"code":"invalid-envelope"},{"id":"float-value","value":0.5,"code":"invalid-envelope"},{"id":"unsafe-integer","value":9007199254740992,"code":"invalid-envelope"},{"id":"envelope-kind-override","code":"invalid-envelope"},{"id":"unknown-record-kind","kind":"not-a-kind","code":"invalid-kind"}]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"comments-transport-v1","encoding":"framed-jcs-utf8","fragmentDomain":["comments-fragment","v1"],"unitPayloadDomain":["comments-unit-payload","v1"],"unitRoot":{"unitId":"unit🦊","records":"1","payloadDigest":"7bf099a81f8514566b91c13510d82bad3863b916cf65bf500eeac47b8f459999"},"fragments":[{"version":"comments-transport-v1","manifest":{"scope":{"tenantId":"tenant\"","workspaceId":"workspace\\🦊"},"operationId":"operation\"\\","bindingDigest":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","unitId":"unit🦊","ordinal":"0","predecessorHash":null,"terminal":null},"payload":[{"kind":"unit-receipt","scope":{"tenantId":"tenant\"","workspaceId":"workspace\\🦊"},"unitId":"unit🦊","manifestHash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","issuedAt":1717000000123,"hash":"625ecac982dc1fbbcca8607558b68d59e6a103d730bda310a424d751f098950e"}],"digest":"f31f08a71e7ebfd7634a98fbbab860f430df6cebbe515351ed2f9eda601efe7e"},{"version":"comments-transport-v1","manifest":{"scope":{"tenantId":"tenant\"","workspaceId":"workspace\\🦊"},"operationId":"operation\"\\","bindingDigest":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","unitId":null,"ordinal":"1","predecessorHash":"f31f08a71e7ebfd7634a98fbbab860f430df6cebbe515351ed2f9eda601efe7e","terminal":{"fragmentCount":"2","unitRoots":[{"unitId":"unit🦊","records":"1","payloadDigest":"7bf099a81f8514566b91c13510d82bad3863b916cf65bf500eeac47b8f459999"}]}},"payload":[],"digest":"f48fce7c8ace3c77efc98bed6830123cdc7a3150683f095e1f2692ed0b89efbe"}]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
-- Applied only by the host migration authority; identifiers are rendered
|
|
2
|
+
-- from validated layout configuration. Canonical payloads remain bytea.
|
|
3
|
+
CREATE TABLE __DATA_SCHEMA__.modules (module text PRIMARY KEY, incarnation text NOT NULL);
|
|
4
|
+
CREATE TABLE __DATA_SCHEMA__.grants (
|
|
5
|
+
module text NOT NULL, token text NOT NULL, bytes bytea NOT NULL, revoked boolean NOT NULL DEFAULT false,
|
|
6
|
+
PRIMARY KEY (module, token)
|
|
7
|
+
);
|
|
8
|
+
CREATE TABLE __DATA_SCHEMA__.map_nodes (
|
|
9
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
10
|
+
key text COLLATE "C" NOT NULL, value bytea, left_id bigint, right_id bigint,
|
|
11
|
+
height integer NOT NULL CHECK (height > 0), size bigint NOT NULL CHECK (size > 0)
|
|
12
|
+
);
|
|
13
|
+
CREATE TABLE __DATA_SCHEMA__.scopes (
|
|
14
|
+
key text PRIMARY KEY, module text NOT NULL, tenant text NOT NULL, workspace text NOT NULL,
|
|
15
|
+
incarnation text NOT NULL, root bigint, version bigint NOT NULL DEFAULT 0 CHECK (version >= 0),
|
|
16
|
+
sequence bigint NOT NULL DEFAULT 0 CHECK (sequence >= 0), UNIQUE (module, tenant, workspace)
|
|
17
|
+
);
|
|
18
|
+
CREATE TABLE __DATA_SCHEMA__.payloads (
|
|
19
|
+
id text PRIMARY KEY, scope_key text NOT NULL, target text NOT NULL,
|
|
20
|
+
bytes bytea, hash text NOT NULL, erased boolean NOT NULL DEFAULT false,
|
|
21
|
+
CHECK (NOT erased OR bytes IS NULL)
|
|
22
|
+
);
|
|
23
|
+
CREATE INDEX payloads_target ON __DATA_SCHEMA__.payloads(scope_key, target, id);
|
|
24
|
+
CREATE TABLE __DATA_SCHEMA__.fences (
|
|
25
|
+
scope_key text NOT NULL, lane text NOT NULL, owner text NOT NULL, incarnation text NOT NULL,
|
|
26
|
+
epoch bigint NOT NULL CHECK (epoch >= 0), lease_until timestamptz,
|
|
27
|
+
PRIMARY KEY (scope_key, lane)
|
|
28
|
+
);
|
|
29
|
+
CREATE TABLE __DATA_SCHEMA__.units (
|
|
30
|
+
scope_key text NOT NULL, operation text NOT NULL, id text NOT NULL UNIQUE,
|
|
31
|
+
owner text NOT NULL, capability text NOT NULL, metadata jsonb NOT NULL,
|
|
32
|
+
PRIMARY KEY (scope_key, operation)
|
|
33
|
+
);
|
|
34
|
+
CREATE TABLE __DATA_SCHEMA__.fragments (
|
|
35
|
+
unit_id text NOT NULL, ordinal bigint NOT NULL CHECK (ordinal >= 0),
|
|
36
|
+
digest text NOT NULL, predecessor text, effects bytea, metadata jsonb NOT NULL,
|
|
37
|
+
PRIMARY KEY (unit_id, ordinal)
|
|
38
|
+
);
|
|
39
|
+
CREATE TABLE __DATA_SCHEMA__.journal (
|
|
40
|
+
scope_key text NOT NULL, sequence bigint NOT NULL CHECK (sequence > 0),
|
|
41
|
+
event_id text NOT NULL UNIQUE, event jsonb NOT NULL, PRIMARY KEY (scope_key, sequence)
|
|
42
|
+
);
|
|
43
|
+
CREATE TABLE __DATA_SCHEMA__.consumers (
|
|
44
|
+
scope_key text NOT NULL, consumer text NOT NULL, state jsonb NOT NULL,
|
|
45
|
+
PRIMARY KEY (scope_key, consumer)
|
|
46
|
+
);
|
|
47
|
+
CREATE TABLE __DATA_SCHEMA__.boundaries (
|
|
48
|
+
scope_key text NOT NULL, token text NOT NULL, owner text NOT NULL,
|
|
49
|
+
root bigint, version bigint NOT NULL, sequence bigint NOT NULL, metadata jsonb NOT NULL,
|
|
50
|
+
PRIMARY KEY (scope_key, token)
|
|
51
|
+
);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
-- Immutable AVL nodes: insertion copies the search path and rotations only.
|
|
2
|
+
CREATE FUNCTION __DATA_SCHEMA__.map_node(k text, v bytea, l bigint, r bigint) RETURNS bigint
|
|
3
|
+
LANGUAGE plpgsql SET search_path = pg_catalog AS $$
|
|
4
|
+
DECLARE lh integer := 0; rh integer := 0; ls bigint := 0; rs bigint := 0; result bigint;
|
|
5
|
+
BEGIN
|
|
6
|
+
IF l IS NOT NULL THEN SELECT height, size INTO STRICT lh, ls FROM __DATA_SCHEMA__.map_nodes WHERE id=l; END IF;
|
|
7
|
+
IF r IS NOT NULL THEN SELECT height, size INTO STRICT rh, rs FROM __DATA_SCHEMA__.map_nodes WHERE id=r; END IF;
|
|
8
|
+
INSERT INTO __DATA_SCHEMA__.map_nodes(key,value,left_id,right_id,height,size)
|
|
9
|
+
VALUES(k,v,l,r,1+greatest(lh,rh),1+ls+rs) RETURNING id INTO result;
|
|
10
|
+
RETURN result;
|
|
11
|
+
END $$;
|
|
12
|
+
CREATE FUNCTION __DATA_SCHEMA__.map_put(root bigint, k text, v bytea) RETURNS bigint
|
|
13
|
+
LANGUAGE plpgsql SET search_path = pg_catalog AS $$
|
|
14
|
+
DECLARE n __DATA_SCHEMA__.map_nodes; child __DATA_SCHEMA__.map_nodes; pivot __DATA_SCHEMA__.map_nodes;
|
|
15
|
+
l bigint; r bigint; lh integer := 0; rh integer := 0; ah integer := 0; bh integer := 0;
|
|
16
|
+
BEGIN
|
|
17
|
+
IF root IS NULL THEN RETURN __DATA_SCHEMA__.map_node(k,v,NULL,NULL); END IF;
|
|
18
|
+
SELECT * INTO STRICT n FROM __DATA_SCHEMA__.map_nodes WHERE id=root;
|
|
19
|
+
l:=n.left_id; r:=n.right_id;
|
|
20
|
+
IF k COLLATE "C" < n.key COLLATE "C" THEN l:=__DATA_SCHEMA__.map_put(l,k,v);
|
|
21
|
+
ELSIF k COLLATE "C" > n.key COLLATE "C" THEN r:=__DATA_SCHEMA__.map_put(r,k,v);
|
|
22
|
+
ELSE
|
|
23
|
+
IF v IS NOT DISTINCT FROM n.value THEN RETURN root; END IF;
|
|
24
|
+
RETURN __DATA_SCHEMA__.map_node(k,v,l,r);
|
|
25
|
+
END IF;
|
|
26
|
+
IF l IS NOT NULL THEN SELECT height INTO STRICT lh FROM __DATA_SCHEMA__.map_nodes WHERE id=l; END IF;
|
|
27
|
+
IF r IS NOT NULL THEN SELECT height INTO STRICT rh FROM __DATA_SCHEMA__.map_nodes WHERE id=r; END IF;
|
|
28
|
+
IF lh-rh > 1 THEN
|
|
29
|
+
SELECT * INTO STRICT child FROM __DATA_SCHEMA__.map_nodes WHERE id=l;
|
|
30
|
+
IF child.left_id IS NOT NULL THEN SELECT height INTO STRICT ah FROM __DATA_SCHEMA__.map_nodes WHERE id=child.left_id; END IF;
|
|
31
|
+
IF child.right_id IS NOT NULL THEN SELECT height INTO STRICT bh FROM __DATA_SCHEMA__.map_nodes WHERE id=child.right_id; END IF;
|
|
32
|
+
IF ah >= bh THEN
|
|
33
|
+
RETURN __DATA_SCHEMA__.map_node(child.key,child.value,child.left_id,__DATA_SCHEMA__.map_node(n.key,n.value,child.right_id,r));
|
|
34
|
+
END IF;
|
|
35
|
+
SELECT * INTO STRICT pivot FROM __DATA_SCHEMA__.map_nodes WHERE id=child.right_id;
|
|
36
|
+
RETURN __DATA_SCHEMA__.map_node(pivot.key,pivot.value,
|
|
37
|
+
__DATA_SCHEMA__.map_node(child.key,child.value,child.left_id,pivot.left_id),__DATA_SCHEMA__.map_node(n.key,n.value,pivot.right_id,r));
|
|
38
|
+
ELSIF rh-lh > 1 THEN
|
|
39
|
+
SELECT * INTO STRICT child FROM __DATA_SCHEMA__.map_nodes WHERE id=r;
|
|
40
|
+
IF child.left_id IS NOT NULL THEN SELECT height INTO STRICT ah FROM __DATA_SCHEMA__.map_nodes WHERE id=child.left_id; END IF;
|
|
41
|
+
IF child.right_id IS NOT NULL THEN SELECT height INTO STRICT bh FROM __DATA_SCHEMA__.map_nodes WHERE id=child.right_id; END IF;
|
|
42
|
+
IF bh >= ah THEN
|
|
43
|
+
RETURN __DATA_SCHEMA__.map_node(child.key,child.value,__DATA_SCHEMA__.map_node(n.key,n.value,l,child.left_id),child.right_id);
|
|
44
|
+
END IF;
|
|
45
|
+
SELECT * INTO STRICT pivot FROM __DATA_SCHEMA__.map_nodes WHERE id=child.left_id;
|
|
46
|
+
RETURN __DATA_SCHEMA__.map_node(pivot.key,pivot.value,
|
|
47
|
+
__DATA_SCHEMA__.map_node(n.key,n.value,l,pivot.left_id),__DATA_SCHEMA__.map_node(child.key,child.value,pivot.right_id,child.right_id));
|
|
48
|
+
END IF;
|
|
49
|
+
RETURN __DATA_SCHEMA__.map_node(n.key,n.value,l,r);
|
|
50
|
+
END $$;
|
|
51
|
+
CREATE FUNCTION __DATA_SCHEMA__.map_get(root bigint, k text) RETURNS bytea
|
|
52
|
+
LANGUAGE plpgsql STABLE SET search_path = pg_catalog AS $$
|
|
53
|
+
DECLARE n __DATA_SCHEMA__.map_nodes;
|
|
54
|
+
BEGIN
|
|
55
|
+
WHILE root IS NOT NULL LOOP
|
|
56
|
+
SELECT * INTO STRICT n FROM __DATA_SCHEMA__.map_nodes WHERE id=root;
|
|
57
|
+
IF k COLLATE "C" = n.key COLLATE "C" THEN RETURN n.value; END IF;
|
|
58
|
+
IF k COLLATE "C" < n.key COLLATE "C" THEN root:=n.left_id; ELSE root:=n.right_id; END IF;
|
|
59
|
+
END LOOP;
|
|
60
|
+
RETURN NULL;
|
|
61
|
+
END $$;
|
|
62
|
+
CREATE FUNCTION __DATA_SCHEMA__.map_at(root bigint, ordinal_position bigint) RETURNS TABLE(key text,value bytea)
|
|
63
|
+
LANGUAGE plpgsql STABLE SET search_path = pg_catalog AS $$
|
|
64
|
+
DECLARE n __DATA_SCHEMA__.map_nodes; left_size bigint;
|
|
65
|
+
BEGIN
|
|
66
|
+
IF ordinal_position < 0 THEN RETURN; END IF;
|
|
67
|
+
WHILE root IS NOT NULL LOOP
|
|
68
|
+
SELECT * INTO STRICT n FROM __DATA_SCHEMA__.map_nodes WHERE id=root;
|
|
69
|
+
left_size:=0;
|
|
70
|
+
IF n.left_id IS NOT NULL THEN SELECT size INTO STRICT left_size FROM __DATA_SCHEMA__.map_nodes WHERE id=n.left_id; END IF;
|
|
71
|
+
IF ordinal_position=left_size THEN key:=n.key; value:=n.value; RETURN NEXT; RETURN;
|
|
72
|
+
ELSIF ordinal_position<left_size THEN root:=n.left_id;
|
|
73
|
+
ELSE ordinal_position:=ordinal_position-left_size-1; root:=n.right_id; END IF;
|
|
74
|
+
END LOOP;
|
|
75
|
+
END $$;
|
|
76
|
+
CREATE FUNCTION __DATA_SCHEMA__.map_page(root bigint, ordinal_position bigint, page_size integer) RETURNS TABLE(key text,value bytea)
|
|
77
|
+
LANGUAGE plpgsql STABLE SET search_path = pg_catalog AS $$
|
|
78
|
+
BEGIN
|
|
79
|
+
IF page_size < 1 OR page_size > 1024 THEN RAISE EXCEPTION 'invalid map page size' USING ERRCODE='22023'; END IF;
|
|
80
|
+
FOR offset_value IN 0..page_size-1 LOOP
|
|
81
|
+
RETURN QUERY SELECT * FROM __DATA_SCHEMA__.map_at(root,ordinal_position+offset_value);
|
|
82
|
+
END LOOP;
|
|
83
|
+
END $$;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
ALTER TABLE __DATA_SCHEMA__.fragments ADD COLUMN dependency_part bytea NOT NULL;
|
|
2
|
+
ALTER TABLE __DATA_SCHEMA__.fragments ADD COLUMN effect_part bytea NOT NULL;
|
|
3
|
+
CREATE TABLE __DATA_SCHEMA__.staged_items (
|
|
4
|
+
id bigint GENERATED ALWAYS AS IDENTITY UNIQUE,
|
|
5
|
+
scope_key text NOT NULL, target text, unit_id text NOT NULL,
|
|
6
|
+
ordinal bigint NOT NULL, section integer NOT NULL CHECK (section BETWEEN 0 AND 8),
|
|
7
|
+
item integer NOT NULL CHECK (item >= 0), bytes bytea,
|
|
8
|
+
cost integer NOT NULL CHECK (cost > 0), PRIMARY KEY (unit_id,ordinal,section,item)
|
|
9
|
+
);
|
|
10
|
+
CREATE INDEX staged_items_scope ON __DATA_SCHEMA__.staged_items(scope_key,id);
|
|
11
|
+
CREATE INDEX payloads_scope ON __DATA_SCHEMA__.payloads(scope_key,id);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
ALTER TABLE __DATA_SCHEMA__.modules ADD COLUMN descriptor_digest text;
|
|
2
|
+
CREATE TABLE __DATA_SCHEMA__.consumer_actions (
|
|
3
|
+
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, scope_key text NOT NULL,
|
|
4
|
+
consumer text NOT NULL, operation text NOT NULL, owner text NOT NULL,
|
|
5
|
+
event_id text, recorded_at timestamptz NOT NULL DEFAULT clock_timestamp()
|
|
6
|
+
);
|
|
7
|
+
CREATE INDEX consumer_actions_scope ON __DATA_SCHEMA__.consumer_actions(scope_key,consumer,id);
|
|
8
|
+
CREATE FUNCTION __DATA_SCHEMA__.map_lower_bound(root bigint, lower_key text) RETURNS bigint
|
|
9
|
+
LANGUAGE plpgsql STABLE SET search_path = pg_catalog AS $$
|
|
10
|
+
DECLARE n __DATA_SCHEMA__.map_nodes; result bigint := 0; left_size bigint;
|
|
11
|
+
BEGIN
|
|
12
|
+
WHILE root IS NOT NULL LOOP
|
|
13
|
+
SELECT * INTO STRICT n FROM __DATA_SCHEMA__.map_nodes WHERE id=root;
|
|
14
|
+
left_size:=0;
|
|
15
|
+
IF n.left_id IS NOT NULL THEN SELECT size INTO STRICT left_size FROM __DATA_SCHEMA__.map_nodes WHERE id=n.left_id; END IF;
|
|
16
|
+
IF n.key COLLATE "C" < lower_key COLLATE "C" THEN result:=result+left_size+1; root:=n.right_id;
|
|
17
|
+
ELSE root:=n.left_id; END IF;
|
|
18
|
+
END LOOP;
|
|
19
|
+
RETURN result;
|
|
20
|
+
END $$;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
CREATE SCHEMA IF NOT EXISTS __COMMENTS_SCHEMA__;
|
|
2
|
+
CREATE TABLE __COMMENTS_SCHEMA__.comments_chains (
|
|
3
|
+
scope_key text NOT NULL, chain_key text COLLATE "C" NOT NULL,
|
|
4
|
+
PRIMARY KEY (scope_key,chain_key)
|
|
5
|
+
);
|
|
6
|
+
CREATE TABLE __COMMENTS_SCHEMA__.comments_headers (
|
|
7
|
+
scope_key text NOT NULL, chain_key text COLLATE "C" NOT NULL, hash text NOT NULL,
|
|
8
|
+
selection jsonb NOT NULL, links jsonb NOT NULL,
|
|
9
|
+
PRIMARY KEY (scope_key,chain_key,hash),
|
|
10
|
+
FOREIGN KEY (scope_key,chain_key) REFERENCES __COMMENTS_SCHEMA__.comments_chains(scope_key,chain_key)
|
|
11
|
+
);
|
|
12
|
+
CREATE TABLE __COMMENTS_SCHEMA__.comments_resources (
|
|
13
|
+
scope_key text NOT NULL, resource_key text COLLATE "C" NOT NULL,
|
|
14
|
+
chain_key text COLLATE "C" NOT NULL, hash text NOT NULL,
|
|
15
|
+
PRIMARY KEY (scope_key,resource_key,chain_key,hash),
|
|
16
|
+
FOREIGN KEY (scope_key,chain_key,hash) REFERENCES __COMMENTS_SCHEMA__.comments_headers(scope_key,chain_key,hash)
|
|
17
|
+
);
|
|
18
|
+
CREATE INDEX comments_resources_chain ON __COMMENTS_SCHEMA__.comments_resources(scope_key,chain_key,hash);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE __COMMENTS_SCHEMA__.comments_preparations (
|
|
2
|
+
scope_key text NOT NULL, operation_id text NOT NULL, kernel_operation text NOT NULL,
|
|
3
|
+
owner text NOT NULL, incarnation text NOT NULL, unit_id text,
|
|
4
|
+
batch_id text NOT NULL, manifest_hash text NOT NULL, state bytea NOT NULL,
|
|
5
|
+
PRIMARY KEY (scope_key,operation_id), UNIQUE (scope_key,kernel_operation), UNIQUE (scope_key,unit_id)
|
|
6
|
+
);
|
|
7
|
+
CREATE INDEX comments_preparations_batch ON __COMMENTS_SCHEMA__.comments_preparations(scope_key,batch_id,manifest_hash,operation_id);
|
|
8
|
+
CREATE TABLE __COMMENTS_SCHEMA__.comments_fragment_receipts (
|
|
9
|
+
scope_key text NOT NULL, operation_id text NOT NULL, ordinal bigint NOT NULL CHECK (ordinal >= 0),
|
|
10
|
+
transport_digest text NOT NULL, kernel_digest text NOT NULL, acknowledgement bytea NOT NULL,
|
|
11
|
+
PRIMARY KEY (scope_key,operation_id,ordinal),
|
|
12
|
+
FOREIGN KEY (scope_key,operation_id) REFERENCES __COMMENTS_SCHEMA__.comments_preparations(scope_key,operation_id)
|
|
13
|
+
);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
CREATE INDEX comments_review_evidence ON __COMMENTS_SCHEMA__.comments_headers
|
|
2
|
+
(scope_key,chain_key,(links->>'revisionHash'),((links->>'sequence')::bigint))
|
|
3
|
+
WHERE selection->>'kind'='review-events';
|
|
4
|
+
CREATE INDEX comments_review_references ON __COMMENTS_SCHEMA__.comments_headers
|
|
5
|
+
(scope_key,chain_key,(links->>'referencesEventHash'),(links->>'action'))
|
|
6
|
+
WHERE selection->>'kind'='review-events';
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"assets": [
|
|
4
|
+
{
|
|
5
|
+
"id": "cluster-mesh-pg/comments/001-projections@1",
|
|
6
|
+
"file": "comments/001-projections.sql",
|
|
7
|
+
"order": 1,
|
|
8
|
+
"dialect": "postgresql",
|
|
9
|
+
"mode": "transactional",
|
|
10
|
+
"fromVersion": 0,
|
|
11
|
+
"toVersion": 1,
|
|
12
|
+
"requires": [
|
|
13
|
+
"cluster-mesh-pg/006-staged-coverage@1"
|
|
14
|
+
],
|
|
15
|
+
"schemaRole": "comments",
|
|
16
|
+
"checksum": "de0689eec0c3c172bc36e4a4a54b6b800fc9f291efcfecd121e9663f9d5cd60b"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "cluster-mesh-pg/comments/002-transport@1",
|
|
20
|
+
"file": "comments/002-transport.sql",
|
|
21
|
+
"order": 2,
|
|
22
|
+
"dialect": "postgresql",
|
|
23
|
+
"mode": "transactional",
|
|
24
|
+
"fromVersion": 1,
|
|
25
|
+
"toVersion": 2,
|
|
26
|
+
"requires": [
|
|
27
|
+
"cluster-mesh-pg/comments/001-projections@1"
|
|
28
|
+
],
|
|
29
|
+
"schemaRole": "comments",
|
|
30
|
+
"checksum": "140b56c54aae928937c0214959deec74c4b9acf7d73a9c082f6f17e1e2f91c8e"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "cluster-mesh-pg/comments/003-exports@1",
|
|
34
|
+
"file": "comments/003-exports.sql",
|
|
35
|
+
"order": 3,
|
|
36
|
+
"dialect": "postgresql",
|
|
37
|
+
"mode": "transactional",
|
|
38
|
+
"fromVersion": 2,
|
|
39
|
+
"toVersion": 3,
|
|
40
|
+
"requires": [
|
|
41
|
+
"cluster-mesh-pg/comments/002-transport@1"
|
|
42
|
+
],
|
|
43
|
+
"schemaRole": "comments",
|
|
44
|
+
"checksum": "3059a66a5f620eacb8f8f702fd68c9dcfd0aa13edfc8e9c0b7868b7455267ed2"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "cluster-mesh-pg/comments/004-authority@1",
|
|
48
|
+
"file": "comments/004-authority.sql",
|
|
49
|
+
"order": 4,
|
|
50
|
+
"dialect": "postgresql",
|
|
51
|
+
"mode": "transactional",
|
|
52
|
+
"fromVersion": 3,
|
|
53
|
+
"toVersion": 4,
|
|
54
|
+
"requires": [
|
|
55
|
+
"cluster-mesh-pg/comments/003-exports@1"
|
|
56
|
+
],
|
|
57
|
+
"schemaRole": "comments",
|
|
58
|
+
"checksum": "4bc12c4aeb4f988fa30a1a5ff28d75059ea1a648c4d6e569fb61fca39842636b"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "cluster-mesh-pg/comments/005-lifecycle-evidence@1",
|
|
62
|
+
"file": "comments/005-lifecycle-evidence.sql",
|
|
63
|
+
"order": 5,
|
|
64
|
+
"dialect": "postgresql",
|
|
65
|
+
"mode": "transactional",
|
|
66
|
+
"fromVersion": 4,
|
|
67
|
+
"toVersion": 5,
|
|
68
|
+
"requires": [
|
|
69
|
+
"cluster-mesh-pg/comments/004-authority@1"
|
|
70
|
+
],
|
|
71
|
+
"schemaRole": "comments",
|
|
72
|
+
"checksum": "cd53d617d2f2076456764d3224cee3549d4ee7f4e1c83743361f56682a06b87b"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "cluster-mesh-pg/comments/006-review-evidence@1",
|
|
76
|
+
"file": "comments/006-review-evidence.sql",
|
|
77
|
+
"order": 6,
|
|
78
|
+
"dialect": "postgresql",
|
|
79
|
+
"mode": "transactional",
|
|
80
|
+
"fromVersion": 5,
|
|
81
|
+
"toVersion": 6,
|
|
82
|
+
"requires": [
|
|
83
|
+
"cluster-mesh-pg/comments/005-lifecycle-evidence@1"
|
|
84
|
+
],
|
|
85
|
+
"schemaRole": "comments",
|
|
86
|
+
"checksum": "a058e7aebee898368d8f385874425596949e73d008283418bdcf63c6f5c815dd"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|