@agent-teams/engineering-foundation 0.16.1 → 0.17.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/changesets-prerelease-state.d.ts +10 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/changesets-prerelease-state.d.ts.map +1 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/changesets-prerelease-state.js +69 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/changesets-prerelease-state.js.map +1 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/filesystem-public-api-repository.d.ts +3 -2
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/filesystem-public-api-repository.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/filesystem-public-api-repository.js +66 -13
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/filesystem-public-api-repository.js.map +1 -1
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/public-api-baseline-mapper.d.ts +1 -1
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/public-api-baseline-mapper.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/public-api-baseline-mapper.js +5 -2
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/public-api-baseline-mapper.js.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/model/public-api.d.ts +2 -0
- package/dist/capabilities/public-api-compatibility/application/model/public-api.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/ports/public-api-repository.d.ts +3 -2
- package/dist/capabilities/public-api-compatibility/application/ports/public-api-repository.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/use-cases/promote-public-api-baselines.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/use-cases/promote-public-api-baselines.js +40 -5
- package/dist/capabilities/public-api-compatibility/application/use-cases/promote-public-api-baselines.js.map +1 -1
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile-v2.d.ts +26 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile-v2.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile-v2.js +74 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile-v2.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader-v2.d.ts +9 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader-v2.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader-v2.js +41 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader-v2.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-contract-validator.d.ts +1 -1
- package/dist/document-authoring/adapters/node/node-document-contract-validator.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-contract-validator.js +1 -1
- package/dist/document-authoring/adapters/node/node-document-contract-validator.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-file-state.d.ts +1 -1
- package/dist/document-authoring/adapters/node/node-document-file-state.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-file-state.js +17 -1
- package/dist/document-authoring/adapters/node/node-document-file-state.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-metadata-sidecar-reader.d.ts +9 -0
- package/dist/document-authoring/adapters/node/node-document-metadata-sidecar-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-metadata-sidecar-reader.js +87 -0
- package/dist/document-authoring/adapters/node/node-document-metadata-sidecar-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-parent-materializer.d.ts +39 -0
- package/dist/document-authoring/adapters/node/node-document-parent-materializer.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-parent-materializer.js +270 -0
- package/dist/document-authoring/adapters/node/node-document-parent-materializer.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.js +11 -3
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.d.ts +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.js +18 -1
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-publisher.d.ts +1 -1
- package/dist/document-authoring/adapters/node/node-document-publisher.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-publisher.js +102 -11
- package/dist/document-authoring/adapters/node/node-document-publisher.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-reachability-projector.d.ts +1 -1
- package/dist/document-authoring/adapters/node/node-document-reachability-projector.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-structure-verifier.d.ts +1 -1
- package/dist/document-authoring/adapters/node/node-document-structure-verifier.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-transaction-coordinator.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-transaction-coordinator.js +1 -1
- package/dist/document-authoring/adapters/node/node-document-transaction-coordinator.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-metadata-instance-validator.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-metadata-instance-validator.js +6 -0
- package/dist/document-authoring/adapters/node/node-metadata-instance-validator.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-path-authority.d.ts +53 -0
- package/dist/document-authoring/adapters/node/node-path-authority.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-path-authority.js +186 -0
- package/dist/document-authoring/adapters/node/node-path-authority.js.map +1 -0
- package/dist/document-authoring/adapters/node/recapture-document-publication-paths.d.ts +2 -1
- package/dist/document-authoring/adapters/node/recapture-document-publication-paths.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/recapture-document-publication-paths.js +21 -77
- package/dist/document-authoring/adapters/node/recapture-document-publication-paths.js.map +1 -1
- package/dist/document-authoring/application/model/document-authoring-profile-description.d.ts +53 -0
- package/dist/document-authoring/application/model/document-authoring-profile-description.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-authoring-profile-description.js +2 -0
- package/dist/document-authoring/application/model/document-authoring-profile-description.js.map +1 -0
- package/dist/document-authoring/application/model/document-catalog.d.ts +29 -0
- package/dist/document-authoring/application/model/document-catalog.d.ts.map +1 -1
- package/dist/document-authoring/application/model/document-find.d.ts +5 -1
- package/dist/document-authoring/application/model/document-find.d.ts.map +1 -1
- package/dist/document-authoring/application/model/document-parent-materialization.d.ts +26 -0
- package/dist/document-authoring/application/model/document-parent-materialization.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-parent-materialization.js +2 -0
- package/dist/document-authoring/application/model/document-parent-materialization.js.map +1 -0
- package/dist/document-authoring/application/model/document-planning.d.ts +29 -2
- package/dist/document-authoring/application/model/document-planning.d.ts.map +1 -1
- package/dist/document-authoring/application/model/document-receipt.d.ts +28 -1
- package/dist/document-authoring/application/model/document-receipt.d.ts.map +1 -1
- package/dist/document-authoring/application/model/document-transaction-inspection.d.ts +23 -0
- package/dist/document-authoring/application/model/document-transaction-inspection.d.ts.map +1 -1
- package/dist/document-authoring/application/model/document-transaction.d.ts +91 -3
- package/dist/document-authoring/application/model/document-transaction.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/assert-artifact-owner-allowed.d.ts +3 -0
- package/dist/document-authoring/application/policies/assert-artifact-owner-allowed.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/assert-artifact-owner-allowed.js +8 -0
- package/dist/document-authoring/application/policies/assert-artifact-owner-allowed.js.map +1 -0
- package/dist/document-authoring/application/policies/assert-v2-planning-profile.d.ts +3 -0
- package/dist/document-authoring/application/policies/assert-v2-planning-profile.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/assert-v2-planning-profile.js +7 -0
- package/dist/document-authoring/application/policies/assert-v2-planning-profile.js.map +1 -0
- package/dist/document-authoring/application/policies/document-authoring-semantic-digests.d.ts +30 -0
- package/dist/document-authoring/application/policies/document-authoring-semantic-digests.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-authoring-semantic-digests.js +157 -0
- package/dist/document-authoring/application/policies/document-authoring-semantic-digests.js.map +1 -0
- package/dist/document-authoring/application/policies/document-catalog-authority-stability.d.ts +12 -0
- package/dist/document-authoring/application/policies/document-catalog-authority-stability.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-catalog-authority-stability.js +16 -0
- package/dist/document-authoring/application/policies/document-catalog-authority-stability.js.map +1 -0
- package/dist/document-authoring/application/policies/document-catalog-sidecar.d.ts +10 -0
- package/dist/document-authoring/application/policies/document-catalog-sidecar.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-catalog-sidecar.js +66 -0
- package/dist/document-authoring/application/policies/document-catalog-sidecar.js.map +1 -0
- package/dist/document-authoring/application/policies/document-command-projection.d.ts +1 -1
- package/dist/document-authoring/application/policies/document-command-projection.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/document-contract-digests.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/document-contract-digests.js +61 -7
- package/dist/document-authoring/application/policies/document-contract-digests.js.map +1 -1
- package/dist/document-authoring/application/policies/document-receipt-policy.d.ts +3 -3
- package/dist/document-authoring/application/policies/document-receipt-policy.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/document-receipt-policy.js +43 -4
- package/dist/document-authoring/application/policies/document-receipt-policy.js.map +1 -1
- package/dist/document-authoring/application/policies/document-transaction-digests.d.ts +2 -2
- package/dist/document-authoring/application/policies/document-transaction-digests.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/document-transaction-digests.js.map +1 -1
- package/dist/document-authoring/application/policies/document-transaction-envelope-body.d.ts +28 -0
- package/dist/document-authoring/application/policies/document-transaction-envelope-body.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-transaction-envelope-body.js +140 -0
- package/dist/document-authoring/application/policies/document-transaction-envelope-body.js.map +1 -0
- package/dist/document-authoring/application/policies/document-transaction-envelope-policy.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/document-transaction-envelope-policy.js +47 -6
- package/dist/document-authoring/application/policies/document-transaction-envelope-policy.js.map +1 -1
- package/dist/document-authoring/application/policies/inspect-catalog-document.d.ts +8 -1
- package/dist/document-authoring/application/policies/inspect-catalog-document.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/inspect-catalog-document.js +48 -0
- package/dist/document-authoring/application/policies/inspect-catalog-document.js.map +1 -1
- package/dist/document-authoring/application/policies/project-catalog-metadata.d.ts +7 -0
- package/dist/document-authoring/application/policies/project-catalog-metadata.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/project-catalog-metadata.js +165 -0
- package/dist/document-authoring/application/policies/project-catalog-metadata.js.map +1 -0
- package/dist/document-authoring/application/policies/same-document-catalog-snapshot.d.ts +3 -0
- package/dist/document-authoring/application/policies/same-document-catalog-snapshot.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/same-document-catalog-snapshot.js +24 -0
- package/dist/document-authoring/application/policies/same-document-catalog-snapshot.js.map +1 -0
- package/dist/document-authoring/application/ports/authoring-profile-reader.d.ts +10 -0
- package/dist/document-authoring/application/ports/authoring-profile-reader.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/document-authority-recompiler.d.ts +1 -1
- package/dist/document-authoring/application/ports/document-authority-recompiler.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/document-contract-validator.d.ts +1 -1
- package/dist/document-authoring/application/ports/document-contract-validator.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/document-file-state.d.ts +1 -1
- package/dist/document-authoring/application/ports/document-file-state.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/document-metadata-sidecar-reader.d.ts +13 -0
- package/dist/document-authoring/application/ports/document-metadata-sidecar-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-metadata-sidecar-reader.js +2 -0
- package/dist/document-authoring/application/ports/document-metadata-sidecar-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/document-parent-materializer.d.ts +24 -0
- package/dist/document-authoring/application/ports/document-parent-materializer.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-parent-materializer.js +2 -0
- package/dist/document-authoring/application/ports/document-parent-materializer.js.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.d.ts +1 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/document-publisher.d.ts +1 -1
- package/dist/document-authoring/application/ports/document-publisher.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/document-reachability-projector.d.ts +1 -1
- package/dist/document-authoring/application/ports/document-reachability-projector.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/document-structure-verifier.d.ts +1 -1
- package/dist/document-authoring/application/ports/document-structure-verifier.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/documentation-catalog-reader-v2.d.ts +11 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader-v2.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader-v2.js +2 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader-v2.js.map +1 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.d.ts +2 -2
- package/dist/document-authoring/application/ports/documentation-catalog-reader.d.ts.map +1 -1
- package/dist/document-authoring/application/ports/documentation-search-catalog-reader-v2.d.ts +9 -0
- package/dist/document-authoring/application/ports/documentation-search-catalog-reader-v2.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/documentation-search-catalog-reader-v2.js +2 -0
- package/dist/document-authoring/application/ports/documentation-search-catalog-reader-v2.js.map +1 -0
- package/dist/document-authoring/application/ports/metadata-instance-validator.d.ts +1 -0
- package/dist/document-authoring/application/ports/metadata-instance-validator.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/apply-document-plan.d.ts +1 -1
- package/dist/document-authoring/application/use-cases/apply-document-plan.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/apply-document-plan.js +150 -54
- package/dist/document-authoring/application/use-cases/apply-document-plan.js.map +1 -1
- package/dist/document-authoring/application/use-cases/apply-document-recovery-receipt.d.ts +14 -0
- package/dist/document-authoring/application/use-cases/apply-document-recovery-receipt.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/apply-document-recovery-receipt.js +17 -0
- package/dist/document-authoring/application/use-cases/apply-document-recovery-receipt.js.map +1 -0
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts +18 -1
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.js +81 -26
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.js.map +1 -1
- package/dist/document-authoring/application/use-cases/compile-document-plan.d.ts +1 -1
- package/dist/document-authoring/application/use-cases/compile-document-plan.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/compile-document-plan.js +50 -6
- package/dist/document-authoring/application/use-cases/compile-document-plan.js.map +1 -1
- package/dist/document-authoring/application/use-cases/document-parent-materialization-continuation.d.ts +3 -0
- package/dist/document-authoring/application/use-cases/document-parent-materialization-continuation.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/document-parent-materialization-continuation.js +79 -0
- package/dist/document-authoring/application/use-cases/document-parent-materialization-continuation.js.map +1 -0
- package/dist/document-authoring/application/use-cases/document-transaction-continuation.d.ts +18 -13
- package/dist/document-authoring/application/use-cases/document-transaction-continuation.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/document-transaction-continuation.js +88 -165
- package/dist/document-authoring/application/use-cases/document-transaction-continuation.js.map +1 -1
- package/dist/document-authoring/application/use-cases/document-transaction-receipts.d.ts +21 -0
- package/dist/document-authoring/application/use-cases/document-transaction-receipts.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/document-transaction-receipts.js +180 -0
- package/dist/document-authoring/application/use-cases/document-transaction-receipts.js.map +1 -0
- package/dist/document-authoring/application/use-cases/find-documents.d.ts +7 -1
- package/dist/document-authoring/application/use-cases/find-documents.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/find-documents.js +19 -0
- package/dist/document-authoring/application/use-cases/find-documents.js.map +1 -1
- package/dist/document-authoring/application/use-cases/load-v2-profile-description.d.ts +15 -0
- package/dist/document-authoring/application/use-cases/load-v2-profile-description.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/load-v2-profile-description.js +12 -0
- package/dist/document-authoring/application/use-cases/load-v2-profile-description.js.map +1 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.d.ts +12 -4
- package/dist/document-authoring/application/use-cases/plan-documentation-document.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/plan-documentation-document.js +25 -28
- package/dist/document-authoring/application/use-cases/plan-documentation-document.js.map +1 -1
- package/dist/document-authoring/application/use-cases/recapture-directory-receipt-evidence.d.ts +8 -0
- package/dist/document-authoring/application/use-cases/recapture-directory-receipt-evidence.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/recapture-directory-receipt-evidence.js +32 -0
- package/dist/document-authoring/application/use-cases/recapture-directory-receipt-evidence.js.map +1 -0
- package/dist/document-authoring/application/use-cases/recover-document-transaction.d.ts +1 -1
- package/dist/document-authoring/application/use-cases/recover-document-transaction.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/recover-document-transaction.js +148 -20
- package/dist/document-authoring/application/use-cases/recover-document-transaction.js.map +1 -1
- package/dist/document-authoring/application/use-cases/run-document-doctor.d.ts +2 -2
- package/dist/document-authoring/application/use-cases/run-document-doctor.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/run-document-doctor.js.map +1 -1
- package/dist/document-authoring/application/use-cases/run-document-new.d.ts +4 -4
- package/dist/document-authoring/application/use-cases/run-document-new.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/run-document-new.js.map +1 -1
- package/dist/document-authoring/application/use-cases/run-document-recover.d.ts +3 -3
- package/dist/document-authoring/application/use-cases/run-document-recover.d.ts.map +1 -1
- package/dist/document-authoring/composition/describe-document-authoring-profile-v2.d.ts +8 -0
- package/dist/document-authoring/composition/describe-document-authoring-profile-v2.d.ts.map +1 -0
- package/dist/document-authoring/composition/describe-document-authoring-profile-v2.js +183 -0
- package/dist/document-authoring/composition/describe-document-authoring-profile-v2.js.map +1 -0
- package/dist/document-authoring/composition/inspect-document-authoring-environment-v1.d.ts +7 -0
- package/dist/document-authoring/composition/inspect-document-authoring-environment-v1.d.ts.map +1 -0
- package/dist/document-authoring/composition/inspect-document-authoring-environment-v1.js +10 -0
- package/dist/document-authoring/composition/inspect-document-authoring-environment-v1.js.map +1 -0
- package/dist/document-authoring/composition/inspect-document-transaction.d.ts +3 -1
- package/dist/document-authoring/composition/inspect-document-transaction.d.ts.map +1 -1
- package/dist/document-authoring/composition/inspect-document-transaction.js +50 -13
- package/dist/document-authoring/composition/inspect-document-transaction.js.map +1 -1
- package/dist/document-authoring/composition/node-document-authority-recompiler.d.ts +1 -1
- package/dist/document-authoring/composition/node-document-authority-recompiler.d.ts.map +1 -1
- package/dist/document-authoring/composition/node-document-authority-recompiler.js +22 -3
- package/dist/document-authoring/composition/node-document-authority-recompiler.js.map +1 -1
- package/dist/document-authoring/composition/node-document-commands.js +2 -2
- package/dist/document-authoring/composition/node-document-planning.d.ts +2 -2
- package/dist/document-authoring/composition/node-document-planning.d.ts.map +1 -1
- package/dist/document-authoring/composition/node-document-planning.js +28 -7
- package/dist/document-authoring/composition/node-document-planning.js.map +1 -1
- package/dist/document-authoring/composition/node-document-writing-private.d.ts +1 -1
- package/dist/document-authoring/composition/node-document-writing-private.d.ts.map +1 -1
- package/dist/document-authoring/composition/node-document-writing-private.js +5 -3
- package/dist/document-authoring/composition/node-document-writing-private.js.map +1 -1
- package/dist/document-authoring/composition/node-document-writing.d.ts +1 -1
- package/dist/document-authoring/composition/node-document-writing.d.ts.map +1 -1
- package/dist/document-authoring/index.d.ts +29 -8
- package/dist/document-authoring/index.d.ts.map +1 -1
- package/dist/document-authoring/index.js +50 -3
- package/dist/document-authoring/index.js.map +1 -1
- package/dist/document-authoring/qualification/index.d.ts +22 -0
- package/dist/document-authoring/qualification/index.d.ts.map +1 -0
- package/dist/document-authoring/qualification/index.js +131 -0
- package/dist/document-authoring/qualification/index.js.map +1 -0
- package/dist/foundation-state-contract.d.ts +1 -0
- package/dist/foundation-state-contract.d.ts.map +1 -1
- package/dist/foundation-state-contract.js +1 -0
- package/dist/foundation-state-contract.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/local-mode/inspection.d.ts.map +1 -1
- package/dist/local-mode/inspection.js +12 -1
- package/dist/local-mode/inspection.js.map +1 -1
- package/dist/mutation/index.d.ts +11 -0
- package/dist/mutation/index.d.ts.map +1 -0
- package/dist/mutation/index.js +5 -0
- package/dist/mutation/index.js.map +1 -0
- package/dist/package-self-check.d.ts +1 -1
- package/dist/package-self-check.d.ts.map +1 -1
- package/dist/package-self-check.js +12 -0
- package/dist/package-self-check.js.map +1 -1
- package/dist/public-api-surface.d.ts +1 -0
- package/dist/public-api-surface.d.ts.map +1 -1
- package/dist/public-api-surface.js +1 -0
- package/dist/public-api-surface.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.d.ts +2 -0
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.d.ts.map +1 -1
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.js +31 -23
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.d.ts.map +1 -1
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.js +21 -0
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-create-and-bind-directory.d.ts +15 -0
- package/dist/repository-mutation/adapters/node/node-create-and-bind-directory.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-create-and-bind-directory.js +23 -0
- package/dist/repository-mutation/adapters/node/node-create-and-bind-directory.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-directory-materialization.d.ts +37 -0
- package/dist/repository-mutation/adapters/node/node-directory-materialization.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-directory-materialization.js +224 -0
- package/dist/repository-mutation/adapters/node/node-directory-materialization.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.d.ts +28 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.js +194 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.d.ts +25 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.js +129 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.d.ts +12 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.js +46 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.d.ts +21 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.js +178 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.d.ts +4 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.js +43 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.d.ts +11 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.js +888 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.d.ts +20 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.js +546 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.d.ts +1 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.d.ts.map +1 -1
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.js +1 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.js.map +1 -1
- package/dist/repository-mutation/application/model/directory-materialization.d.ts +35 -0
- package/dist/repository-mutation/application/model/directory-materialization.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/directory-materialization.js +11 -0
- package/dist/repository-mutation/application/model/directory-materialization.js.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.d.ts +63 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.js +15 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.js.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction.d.ts +64 -0
- package/dist/repository-mutation/application/model/known-file-transaction.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction.js +2 -0
- package/dist/repository-mutation/application/model/known-file-transaction.js.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.d.ts +8 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.d.ts.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.js +241 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.js.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.d.ts +7 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.d.ts.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.js +215 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.js.map +1 -0
- package/dist/schema-catalog.d.ts.map +1 -1
- package/dist/schema-catalog.js +12 -0
- package/dist/schema-catalog.js.map +1 -1
- package/dist/schema-ids.d.ts +1 -1
- package/dist/schema-ids.d.ts.map +1 -1
- package/dist/schema-ids.js +8 -0
- package/dist/schema-ids.js.map +1 -1
- package/dist/semantic-version.d.ts +1 -0
- package/dist/semantic-version.d.ts.map +1 -1
- package/dist/semantic-version.js +11 -0
- package/dist/semantic-version.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-envelope-bindings.d.ts +2 -2
- package/dist/transaction-coordination/adapters/node/document-envelope-bindings.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-envelope-bindings.js +33 -19
- package/dist/transaction-coordination/adapters/node/document-envelope-bindings.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.d.ts +1 -1
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-transaction-status.d.ts +9 -0
- package/dist/transaction-coordination/adapters/node/document-transaction-status.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/document-transaction-status.js +26 -0
- package/dist/transaction-coordination/adapters/node/document-transaction-status.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/known-file-transaction-status.d.ts +8 -0
- package/dist/transaction-coordination/adapters/node/known-file-transaction-status.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/known-file-transaction-status.js +50 -0
- package/dist/transaction-coordination/adapters/node/known-file-transaction-status.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js +42 -36
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js.map +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.d.ts +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.d.ts.map +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.js +13 -2
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.js.map +1 -1
- package/dist/transaction-coordination/application/model/internal-transaction-status.d.ts +15 -3
- package/dist/transaction-coordination/application/model/internal-transaction-status.d.ts.map +1 -1
- package/dist/transaction-coordination/application/model/transaction-status.d.ts +6 -2
- package/dist/transaction-coordination/application/model/transaction-status.d.ts.map +1 -1
- package/package.json +17 -1
- package/schemas/document-authoring-profile/v2.schema.json +168 -0
- package/schemas/document-parent-materialization/v2.schema.json +65 -0
- package/schemas/document-plan/v2.schema.json +85 -0
- package/schemas/document-receipt/v2.schema.json +108 -0
- package/schemas/foundation-transaction-envelope/v4.schema.json +164 -0
- package/schemas/foundation-transaction-envelope/v5.schema.json +94 -0
- package/schemas/known-file-transaction-plan/v1.schema.json +65 -0
- package/schemas/known-file-transaction-receipt/v1.schema.json +36 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { BoundDirectoryCreation, CapturedDirectory, DirectoryCreatePolicy, DirectoryMaterializationProjection, UnboundDirectoryCreationRecovery } from "../../application/model/directory-materialization.js";
|
|
2
|
+
import type { PortablePathIdentity } from "../../application/model/path-identity.js";
|
|
3
|
+
export interface DirectoryIdentityBindingPort {
|
|
4
|
+
bindCreatedDirectory(directory: CapturedDirectory & {
|
|
5
|
+
readonly parentIdentity: PortablePathIdentity;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
interface DirectoryCreationFaultPoint {
|
|
9
|
+
readonly phase: "after-mkdir-before-capture" | "after-parent-sync-before-bind";
|
|
10
|
+
readonly repositoryPath: string;
|
|
11
|
+
}
|
|
12
|
+
export type DirectoryCreationFaultInjector = (point: DirectoryCreationFaultPoint) => Promise<void> | void;
|
|
13
|
+
export declare function projectDirectoryMaterialization(options: {
|
|
14
|
+
readonly createPolicy: DirectoryCreatePolicy;
|
|
15
|
+
readonly repositoryPath: string;
|
|
16
|
+
readonly repositoryRoot: string;
|
|
17
|
+
}): Promise<DirectoryMaterializationProjection>;
|
|
18
|
+
export declare function recaptureExactDirectoryIdentity(options: {
|
|
19
|
+
readonly expectedIdentity: PortablePathIdentity;
|
|
20
|
+
readonly repositoryPath: string;
|
|
21
|
+
readonly repositoryRoot: string;
|
|
22
|
+
}): Promise<CapturedDirectory>;
|
|
23
|
+
export declare function createAndBindOneDirectory(options: {
|
|
24
|
+
readonly binding: Pick<DirectoryIdentityBindingPort, "bindCreatedDirectory">;
|
|
25
|
+
readonly createPolicy: DirectoryCreatePolicy;
|
|
26
|
+
readonly expectedParentIdentity: PortablePathIdentity;
|
|
27
|
+
readonly faultInjector?: DirectoryCreationFaultInjector;
|
|
28
|
+
readonly mode?: number;
|
|
29
|
+
readonly repositoryPath: string;
|
|
30
|
+
readonly repositoryRoot: string;
|
|
31
|
+
}): Promise<BoundDirectoryCreation>;
|
|
32
|
+
export declare function classifyUnboundDirectoryCreation(options: {
|
|
33
|
+
readonly repositoryPath: string;
|
|
34
|
+
readonly repositoryRoot: string;
|
|
35
|
+
}): Promise<UnboundDirectoryCreationRecovery>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=node-directory-materialization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-directory-materialization.d.ts","sourceRoot":"","sources":["../../../../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qB,CAAC;IAC7C,QAAQ,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;IACtD,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;IACxD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAoFlC;AAED,wBAAsB,gCAAgC,CAAC,OAAO,EAAE;IAC9D,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAY5C"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { lstat, mkdir, readdir, realpath } from "node:fs/promises";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { DirectoryMutationError } from "../../application/model/directory-materialization.js";
|
|
4
|
+
import { portableRepositoryPathIdentity, portableRepositoryPathProblem } from "../../application/model/repository-path.js";
|
|
5
|
+
import { syncDirectoryStrictly } from "./node-directory-durability.js";
|
|
6
|
+
import { createAndBindNodeDirectory } from "./node-create-and-bind-directory.js";
|
|
7
|
+
import { isLexicallyContainedPath } from "./node-repository-path.js";
|
|
8
|
+
function errorCode(error) {
|
|
9
|
+
return error instanceof Error && "code" in error
|
|
10
|
+
? error.code
|
|
11
|
+
: undefined;
|
|
12
|
+
}
|
|
13
|
+
function isMissing(error) {
|
|
14
|
+
return errorCode(error) === "ENOENT";
|
|
15
|
+
}
|
|
16
|
+
function sameIdentity(left, right) {
|
|
17
|
+
return (left.dev === right.dev &&
|
|
18
|
+
left.ino === right.ino &&
|
|
19
|
+
left.birthtimeNs === right.birthtimeNs);
|
|
20
|
+
}
|
|
21
|
+
function identityFromMetadata(metadata) {
|
|
22
|
+
const identity = {
|
|
23
|
+
birthtimeNs: metadata.birthtimeNs,
|
|
24
|
+
dev: metadata.dev,
|
|
25
|
+
ino: metadata.ino
|
|
26
|
+
};
|
|
27
|
+
if (identity.birthtimeNs === 0n ||
|
|
28
|
+
identity.dev === 0n ||
|
|
29
|
+
identity.ino === 0n) {
|
|
30
|
+
throw new DirectoryMutationError("IDENTITY_UNAVAILABLE", "The filesystem did not provide a nonzero directory identity.");
|
|
31
|
+
}
|
|
32
|
+
return identity;
|
|
33
|
+
}
|
|
34
|
+
function assertRepositoryPath(repositoryPath) {
|
|
35
|
+
const problem = portableRepositoryPathProblem(repositoryPath);
|
|
36
|
+
if (problem !== undefined) {
|
|
37
|
+
throw new DirectoryMutationError("INVALID_PATH", `Invalid portable repository directory path (${problem}): ${repositoryPath}.`);
|
|
38
|
+
}
|
|
39
|
+
return repositoryPath.split("/");
|
|
40
|
+
}
|
|
41
|
+
async function captureRealDirectory(absolutePath, repositoryPath) {
|
|
42
|
+
const metadata = await lstat(absolutePath, { bigint: true });
|
|
43
|
+
if (metadata.isSymbolicLink()) {
|
|
44
|
+
throw new DirectoryMutationError("SYMLINK", `Repository directory must not be a symbolic link: ${repositoryPath}.`);
|
|
45
|
+
}
|
|
46
|
+
if (!metadata.isDirectory()) {
|
|
47
|
+
throw new DirectoryMutationError("NOT_DIRECTORY", `Repository path is not a directory: ${repositoryPath}.`);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
absolutePath,
|
|
51
|
+
identity: identityFromMetadata(metadata),
|
|
52
|
+
repositoryPath
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async function assertCanonicalContainment(canonicalRoot, directory) {
|
|
56
|
+
const canonical = await realpath(directory.absolutePath);
|
|
57
|
+
if (!isLexicallyContainedPath(canonicalRoot, canonical)) {
|
|
58
|
+
throw new DirectoryMutationError("OUTSIDE_ROOT", `Repository directory resolves outside its root: ${directory.repositoryPath}.`);
|
|
59
|
+
}
|
|
60
|
+
const recaptured = await captureRealDirectory(directory.absolutePath, directory.repositoryPath);
|
|
61
|
+
if (!sameIdentity(directory.identity, recaptured.identity)) {
|
|
62
|
+
throw new DirectoryMutationError("CONCURRENT_CHANGE", `Directory identity changed while checking containment: ${directory.repositoryPath}.`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function assertNoAlias(parent, requestedName) {
|
|
66
|
+
const requestedIdentity = portableRepositoryPathIdentity(requestedName);
|
|
67
|
+
const entries = await readdir(parent);
|
|
68
|
+
const aliases = entries.filter((entry) => portableRepositoryPathIdentity(entry) === requestedIdentity);
|
|
69
|
+
if (aliases.some((entry) => entry !== requestedName)) {
|
|
70
|
+
throw new DirectoryMutationError("ALIAS_COLLISION", `Portable case/NFC alias collides with requested directory: ${requestedName}.`);
|
|
71
|
+
}
|
|
72
|
+
return aliases.includes(requestedName);
|
|
73
|
+
}
|
|
74
|
+
async function captureRoot(repositoryRoot) {
|
|
75
|
+
const absoluteRoot = resolve(repositoryRoot);
|
|
76
|
+
const root = await captureRealDirectory(absoluteRoot, ".");
|
|
77
|
+
const canonicalRoot = await realpath(absoluteRoot);
|
|
78
|
+
const recapturedRoot = await captureRealDirectory(canonicalRoot, ".");
|
|
79
|
+
if (!sameIdentity(root.identity, recapturedRoot.identity)) {
|
|
80
|
+
throw new DirectoryMutationError("CONCURRENT_CHANGE", "Repository root identity changed while it was captured.");
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
canonicalRoot,
|
|
84
|
+
root: recapturedRoot
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async function captureExistingPath(canonicalRoot, repositoryPath) {
|
|
88
|
+
if (repositoryPath === ".") {
|
|
89
|
+
return captureRealDirectory(canonicalRoot, ".");
|
|
90
|
+
}
|
|
91
|
+
let current = canonicalRoot;
|
|
92
|
+
let captured = await captureRealDirectory(canonicalRoot, ".");
|
|
93
|
+
const traversed = [];
|
|
94
|
+
for (const segment of assertRepositoryPath(repositoryPath)) {
|
|
95
|
+
await assertNoAlias(current, segment);
|
|
96
|
+
traversed.push(segment);
|
|
97
|
+
current = join(current, segment);
|
|
98
|
+
captured = await captureRealDirectory(current, traversed.join("/"));
|
|
99
|
+
await assertCanonicalContainment(canonicalRoot, captured);
|
|
100
|
+
}
|
|
101
|
+
return captured;
|
|
102
|
+
}
|
|
103
|
+
export async function projectDirectoryMaterialization(options) {
|
|
104
|
+
const segments = assertRepositoryPath(options.repositoryPath);
|
|
105
|
+
const { canonicalRoot, root } = await captureRoot(options.repositoryRoot);
|
|
106
|
+
let anchor = root;
|
|
107
|
+
let currentAbsolute = canonicalRoot;
|
|
108
|
+
const traversed = [];
|
|
109
|
+
const missingDirectories = [];
|
|
110
|
+
for (const segment of segments) {
|
|
111
|
+
traversed.push(segment);
|
|
112
|
+
currentAbsolute = join(currentAbsolute, segment);
|
|
113
|
+
const repositoryPath = traversed.join("/");
|
|
114
|
+
if (missingDirectories.length > 0) {
|
|
115
|
+
missingDirectories.push({ absolutePath: currentAbsolute, repositoryPath });
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const exists = await assertNoAlias(dirname(currentAbsolute), segment);
|
|
119
|
+
if (!exists) {
|
|
120
|
+
missingDirectories.push({
|
|
121
|
+
absolutePath: currentAbsolute,
|
|
122
|
+
repositoryPath
|
|
123
|
+
});
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const captured = await captureRealDirectory(currentAbsolute, repositoryPath);
|
|
127
|
+
await assertCanonicalContainment(canonicalRoot, captured);
|
|
128
|
+
anchor = captured;
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
anchor,
|
|
132
|
+
createPolicy: options.createPolicy,
|
|
133
|
+
finalParent: {
|
|
134
|
+
absolutePath: join(canonicalRoot, ...segments),
|
|
135
|
+
repositoryPath: options.repositoryPath
|
|
136
|
+
},
|
|
137
|
+
missingDirectories,
|
|
138
|
+
repositoryRoot: root
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
export async function recaptureExactDirectoryIdentity(options) {
|
|
142
|
+
assertRepositoryPath(options.repositoryPath);
|
|
143
|
+
const { canonicalRoot } = await captureRoot(options.repositoryRoot);
|
|
144
|
+
const captured = await captureExistingPath(canonicalRoot, options.repositoryPath);
|
|
145
|
+
if (!sameIdentity(captured.identity, options.expectedIdentity)) {
|
|
146
|
+
throw new DirectoryMutationError("CONCURRENT_CHANGE", `Directory identity changed: ${options.repositoryPath}.`);
|
|
147
|
+
}
|
|
148
|
+
return captured;
|
|
149
|
+
}
|
|
150
|
+
export async function createAndBindOneDirectory(options) {
|
|
151
|
+
const segments = assertRepositoryPath(options.repositoryPath);
|
|
152
|
+
if (options.createPolicy !== "allow") {
|
|
153
|
+
throw new DirectoryMutationError("CREATE_FORBIDDEN", `Directory creation is forbidden by policy: ${options.repositoryPath}.`);
|
|
154
|
+
}
|
|
155
|
+
return createAndBindNodeDirectory({
|
|
156
|
+
ambiguousError: (error) => new DirectoryMutationError("AMBIGUOUS_CREATION", `Directory may exist without a durable identity binding: ${options.repositoryPath}. Manual recovery is required.`, { cause: error, manualRecoveryRequired: true }),
|
|
157
|
+
async bind(bound) {
|
|
158
|
+
await options.binding.bindCreatedDirectory(bound);
|
|
159
|
+
},
|
|
160
|
+
async captureParent() {
|
|
161
|
+
const { canonicalRoot } = await captureRoot(options.repositoryRoot);
|
|
162
|
+
const absolutePath = join(canonicalRoot, ...segments);
|
|
163
|
+
const parentPath = dirname(absolutePath);
|
|
164
|
+
const parentRepositoryPath = segments.slice(0, -1).join("/") || ".";
|
|
165
|
+
const parent = await captureExistingPath(canonicalRoot, parentRepositoryPath);
|
|
166
|
+
if (!sameIdentity(parent.identity, options.expectedParentIdentity)) {
|
|
167
|
+
throw new DirectoryMutationError("CONCURRENT_CHANGE", `Parent directory identity changed: ${parentRepositoryPath}.`);
|
|
168
|
+
}
|
|
169
|
+
await assertNoAlias(parentPath, segments.at(-1) ?? "");
|
|
170
|
+
return { absolutePath, canonicalRoot, parent, parentPath, parentRepositoryPath };
|
|
171
|
+
},
|
|
172
|
+
async createAndObserve(parent, markCreated) {
|
|
173
|
+
await mkdir(parent.absolutePath, {
|
|
174
|
+
mode: options.mode ?? 0o755,
|
|
175
|
+
recursive: false
|
|
176
|
+
});
|
|
177
|
+
markCreated();
|
|
178
|
+
// Portable Node cannot atomically return mkdir's identity. The first
|
|
179
|
+
// observation is authoritative only for cooperative writers.
|
|
180
|
+
const observed = await captureRealDirectory(parent.absolutePath, options.repositoryPath);
|
|
181
|
+
await options.faultInjector?.({
|
|
182
|
+
phase: "after-mkdir-before-capture",
|
|
183
|
+
repositoryPath: options.repositoryPath
|
|
184
|
+
});
|
|
185
|
+
return observed;
|
|
186
|
+
},
|
|
187
|
+
async recapture(parent, observed) {
|
|
188
|
+
const captured = await captureExistingPath(parent.canonicalRoot, options.repositoryPath);
|
|
189
|
+
const recapturedParent = await captureExistingPath(parent.canonicalRoot, parent.parentRepositoryPath);
|
|
190
|
+
await assertNoAlias(parent.parentPath, segments.at(-1) ?? "");
|
|
191
|
+
if (!sameIdentity(observed.identity, captured.identity) ||
|
|
192
|
+
!sameIdentity(recapturedParent.identity, parent.parent.identity)) {
|
|
193
|
+
throw new DirectoryMutationError("CONCURRENT_CHANGE", `Created directory or its parent changed before binding: ${options.repositoryPath}.`);
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
...captured,
|
|
197
|
+
outcome: "created-and-bound",
|
|
198
|
+
parentIdentity: parent.parent.identity
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
async syncParent(parent) {
|
|
202
|
+
await syncDirectoryStrictly(parent.parentPath);
|
|
203
|
+
await options.faultInjector?.({
|
|
204
|
+
phase: "after-parent-sync-before-bind",
|
|
205
|
+
repositoryPath: options.repositoryPath
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
export async function classifyUnboundDirectoryCreation(options) {
|
|
211
|
+
assertRepositoryPath(options.repositoryPath);
|
|
212
|
+
const { canonicalRoot } = await captureRoot(options.repositoryRoot);
|
|
213
|
+
try {
|
|
214
|
+
const captured = await captureExistingPath(canonicalRoot, options.repositoryPath);
|
|
215
|
+
return { observedIdentity: captured.identity, outcome: "ambiguous-manual" };
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
if (isMissing(error)) {
|
|
219
|
+
return { outcome: "not-created" };
|
|
220
|
+
}
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=node-directory-materialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-directory-materialization.js","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-directory-materialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAE9F,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAiBrE,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK;QAC9C,CAAC,CAAE,KAA+B,CAAC,IAAI;QACvC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,SAAS,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAC;AACvC,CAAC;AAED,SAAS,YAAY,CACnB,IAA0B,EAC1B,KAA2B;IAE3B,OAAO,CACL,IAAI,CAAC,GAAG,KAAK,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C/C,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC5B,KAAK,EAAE,+BAA+B;gBACtC,cAAc,EAAE,OAAO,CAAC,cAAc;aACvC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,OAGtD;IACC,oBAAoB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACpE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,aAAa,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QAClF,OAAO,EAAE,gBAAgB,EAAE,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;QACpC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { KnownFileImageV1 } from "../../application/model/known-file-transaction.js";
|
|
2
|
+
import type { KnownFileTransactionJournalV1 } from "../../application/model/known-file-transaction-journal.js";
|
|
3
|
+
import { deserializeKnownFileIdentity } from "../../application/model/known-file-transaction-journal.js";
|
|
4
|
+
import { captureFileHandleIdentity } from "./node-bounded-regular-file.js";
|
|
5
|
+
import { type ObservedKnownFile } from "./node-known-file-transaction-filesystem.js";
|
|
6
|
+
export declare function knownFileCapturePaths(options: {
|
|
7
|
+
readonly operationPath: string;
|
|
8
|
+
readonly operationIndex: number;
|
|
9
|
+
readonly parent: string;
|
|
10
|
+
readonly planDigest: string;
|
|
11
|
+
}): {
|
|
12
|
+
readonly captured: string;
|
|
13
|
+
readonly directory: string;
|
|
14
|
+
readonly retired: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function cleanupCommittedKnownFileCaptures(root: string, journal: KnownFileTransactionJournalV1, faultInjector?: (point: {
|
|
17
|
+
readonly operationIndex: number;
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly phase: "after-committed-capture-unlinked";
|
|
20
|
+
}) => Promise<void> | void): Promise<void>;
|
|
21
|
+
export declare function observeRecoveryFile(path: string, maximumBytes: number): Promise<ObservedKnownFile>;
|
|
22
|
+
export declare function prepareRollbackTemporary(options: {
|
|
23
|
+
readonly expectedIdentity?: ReturnType<typeof deserializeKnownFileIdentity>;
|
|
24
|
+
readonly operationPath: string;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
readonly preimage: KnownFileImageV1;
|
|
27
|
+
}): Promise<Awaited<ReturnType<typeof captureFileHandleIdentity>>>;
|
|
28
|
+
//# sourceMappingURL=node-known-file-recovery-filesystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-filesystem.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-filesystem.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAC/G,OAAO,EAAE,4BAA4B,EAAE,MAAM,2DAA2D,CAAC;AACzG,OAAO,EACL,yBAAyB,EAG1B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,6CAA6C,CAAC;AAErD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAWtF;AAuBD,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,6BAA6B,EACtC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;IACtB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,kCAAkC,CAAC;CACpD,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GACzB,OAAO,CAAC,IAAI,CAAC,CA6Ff;AAED,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAoB5B;AAED,wBAAsB,wBAAwB,CAAC,OAAO,EAAE;IACtD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC;IAC5E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;CACrC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAuFjE"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { constants, lstat, open, readdir, rmdir, unlink } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, join } from "node:path";
|
|
3
|
+
import { deserializeKnownFileIdentity } from "../../application/model/known-file-transaction-journal.js";
|
|
4
|
+
import { captureFileHandleIdentity, readBoundedRegularFile, readBoundedRegularFileHandle } from "./node-bounded-regular-file.js";
|
|
5
|
+
import { syncDirectoryStrictly } from "./node-directory-durability.js";
|
|
6
|
+
import { knownFileErrorCode, knownFileCaptureDirectoryName, knownFileImageBytes, KnownFileTransactionError, matchesKnownFileImage, sameKnownFileIdentity } from "./node-known-file-transaction-filesystem.js";
|
|
7
|
+
export function knownFileCapturePaths(options) {
|
|
8
|
+
const directory = join(options.parent, knownFileCaptureDirectoryName(options.operationPath, options.planDigest, options.operationIndex));
|
|
9
|
+
return {
|
|
10
|
+
captured: join(directory, "preimage"),
|
|
11
|
+
directory,
|
|
12
|
+
retired: join(directory, "retired")
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
async function assertCaptureDirectoryIdentity(path, expected, displayPath) {
|
|
16
|
+
const metadata = await lstat(path, { bigint: true }).catch((error) => {
|
|
17
|
+
if (knownFileErrorCode(error) === "ENOENT") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
throw error;
|
|
21
|
+
});
|
|
22
|
+
if (metadata === null) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (!metadata.isDirectory() || metadata.isSymbolicLink() ||
|
|
26
|
+
metadata.birthtimeNs !== expected.birthtimeNs || metadata.dev !== expected.dev ||
|
|
27
|
+
metadata.ino !== expected.ino) {
|
|
28
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Transaction capture directory changed: ${displayPath}.`);
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
export async function cleanupCommittedKnownFileCaptures(root, journal, faultInjector) {
|
|
33
|
+
for (const [index, journalOperation] of journal.operations.entries()) {
|
|
34
|
+
if (!("temporaryIdentity" in journalOperation) ||
|
|
35
|
+
journalOperation.captureDirectoryIdentity === undefined) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const operation = journal.plan.operations[index];
|
|
39
|
+
const parent = dirname(join(root, ...operation.path.split("/")));
|
|
40
|
+
const paths = knownFileCapturePaths({
|
|
41
|
+
operationIndex: index,
|
|
42
|
+
operationPath: operation.path,
|
|
43
|
+
parent,
|
|
44
|
+
planDigest: journal.plan.planDigest
|
|
45
|
+
});
|
|
46
|
+
if (operation.precondition.state !== "known-file" ||
|
|
47
|
+
journalOperation.matchedPreimage === undefined) {
|
|
48
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Committed replacement lacks exact preimage authority: ${operation.path}.`);
|
|
49
|
+
}
|
|
50
|
+
const preimage = operation.precondition.acceptedPreimages[journalOperation.matchedPreimage];
|
|
51
|
+
if (journalOperation.rollbackTemporaryIdentity !== undefined) {
|
|
52
|
+
const rollbackPath = join(parent, `.${basename(operation.path)}.agent-teams.rollback.${index}.tmp`);
|
|
53
|
+
const rollback = await observeRecoveryFile(rollbackPath, preimage.size);
|
|
54
|
+
if (rollback.state === "file") {
|
|
55
|
+
const expectedRollback = deserializeKnownFileIdentity(journalOperation.rollbackTemporaryIdentity);
|
|
56
|
+
if (rollback.identity === undefined ||
|
|
57
|
+
!sameKnownFileIdentity(rollback.identity, expectedRollback) ||
|
|
58
|
+
!matchesKnownFileImage(rollback, preimage)) {
|
|
59
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Committed rollback copy changed: ${operation.path}.`);
|
|
60
|
+
}
|
|
61
|
+
await unlink(rollbackPath);
|
|
62
|
+
await syncDirectoryStrictly(parent);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const expectedDirectory = deserializeKnownFileIdentity(journalOperation.captureDirectoryIdentity);
|
|
66
|
+
const directoryExists = await assertCaptureDirectoryIdentity(paths.directory, expectedDirectory, operation.path);
|
|
67
|
+
if (!directoryExists) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const entries = (await readdir(paths.directory)).toSorted();
|
|
71
|
+
if (entries.length === 0) {
|
|
72
|
+
await rmdir(paths.directory);
|
|
73
|
+
await syncDirectoryStrictly(parent);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (journalOperation.capturedPreimageIdentity === undefined) {
|
|
77
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Committed replacement lacks captured preimage authority: ${operation.path}.`);
|
|
78
|
+
}
|
|
79
|
+
const captured = await readBoundedRegularFile(paths.captured, operation.precondition.acceptedPreimages[journalOperation.matchedPreimage].size);
|
|
80
|
+
const expectedCaptured = deserializeKnownFileIdentity(journalOperation.capturedPreimageIdentity);
|
|
81
|
+
if (captured.outcome !== "read" ||
|
|
82
|
+
!sameKnownFileIdentity(captured.identity, expectedCaptured) ||
|
|
83
|
+
!matchesKnownFileImage({
|
|
84
|
+
state: "file", bytes: captured.bytes, identity: captured.identity,
|
|
85
|
+
mode: captured.mode & 0o777
|
|
86
|
+
}, preimage)) {
|
|
87
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Committed captured preimage changed: ${operation.path}.`);
|
|
88
|
+
}
|
|
89
|
+
if (entries.join(",") !== "preimage") {
|
|
90
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Committed capture directory contains foreign evidence: ${operation.path}.`);
|
|
91
|
+
}
|
|
92
|
+
await unlink(paths.captured);
|
|
93
|
+
await syncDirectoryStrictly(paths.directory);
|
|
94
|
+
await faultInjector?.({
|
|
95
|
+
operationIndex: index,
|
|
96
|
+
path: operation.path,
|
|
97
|
+
phase: "after-committed-capture-unlinked"
|
|
98
|
+
});
|
|
99
|
+
await rmdir(paths.directory);
|
|
100
|
+
await syncDirectoryStrictly(parent);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export async function observeRecoveryFile(path, maximumBytes) {
|
|
104
|
+
let observed;
|
|
105
|
+
try {
|
|
106
|
+
observed = await readBoundedRegularFile(path, maximumBytes);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
if (knownFileErrorCode(error) === "ENOENT") {
|
|
110
|
+
return { state: "absent" };
|
|
111
|
+
}
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
if (observed.outcome !== "read") {
|
|
115
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", "Recovery path is not one stable bounded regular file.");
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
state: "file",
|
|
119
|
+
bytes: observed.bytes,
|
|
120
|
+
identity: observed.identity,
|
|
121
|
+
mode: observed.mode & 0o777
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export async function prepareRollbackTemporary(options) {
|
|
125
|
+
let handle;
|
|
126
|
+
let rollbackIdentity;
|
|
127
|
+
let created = false;
|
|
128
|
+
try {
|
|
129
|
+
handle = await open(options.path, "wx", 0o600);
|
|
130
|
+
created = true;
|
|
131
|
+
rollbackIdentity = await captureFileHandleIdentity(handle);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (knownFileErrorCode(error) !== "EEXIST") {
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
if (options.expectedIdentity === undefined) {
|
|
138
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Rollback temporary exists without durable identity authority: ${options.operationPath}.`);
|
|
139
|
+
}
|
|
140
|
+
const noFollow = process.platform === "win32" ? 0 : constants.O_NOFOLLOW;
|
|
141
|
+
handle = await open(options.path, constants.O_RDWR | noFollow);
|
|
142
|
+
try {
|
|
143
|
+
const stale = await readBoundedRegularFileHandle(handle, options.path, options.preimage.size);
|
|
144
|
+
if (stale.outcome !== "read" || !matchesKnownFileImage({
|
|
145
|
+
state: "file", bytes: stale.bytes, identity: stale.identity,
|
|
146
|
+
mode: stale.mode & 0o777
|
|
147
|
+
}, options.preimage)) {
|
|
148
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Rollback temporary is foreign or modified: ${options.operationPath}.`);
|
|
149
|
+
}
|
|
150
|
+
rollbackIdentity = await captureFileHandleIdentity(handle);
|
|
151
|
+
if (!sameKnownFileIdentity(rollbackIdentity, stale.identity) ||
|
|
152
|
+
!sameKnownFileIdentity(rollbackIdentity, options.expectedIdentity)) {
|
|
153
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Rollback temporary changed while it was opened: ${options.operationPath}.`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (inspectionError) {
|
|
157
|
+
await handle.close();
|
|
158
|
+
throw inspectionError;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (created) {
|
|
162
|
+
try {
|
|
163
|
+
const bytes = knownFileImageBytes(options.preimage);
|
|
164
|
+
await handle.truncate(0);
|
|
165
|
+
let offset = 0;
|
|
166
|
+
while (offset < bytes.byteLength) {
|
|
167
|
+
const { bytesWritten } = await handle.write(bytes, offset, bytes.byteLength - offset, offset);
|
|
168
|
+
if (bytesWritten === 0) {
|
|
169
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_FAILED", `Rollback temporary write made no progress: ${options.operationPath}.`);
|
|
170
|
+
}
|
|
171
|
+
offset += bytesWritten;
|
|
172
|
+
}
|
|
173
|
+
await handle.chmod(options.preimage.mode);
|
|
174
|
+
await handle.sync();
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
await handle.close();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
await handle.close();
|
|
182
|
+
}
|
|
183
|
+
const prepared = await readBoundedRegularFile(options.path, options.preimage.size);
|
|
184
|
+
if (prepared.outcome !== "read" ||
|
|
185
|
+
!sameKnownFileIdentity(prepared.identity, rollbackIdentity) ||
|
|
186
|
+
!matchesKnownFileImage({
|
|
187
|
+
state: "file", bytes: prepared.bytes, identity: prepared.identity,
|
|
188
|
+
mode: prepared.mode & 0o777
|
|
189
|
+
}, options.preimage)) {
|
|
190
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Rollback temporary changed before publication: ${options.operationPath}.`);
|
|
191
|
+
}
|
|
192
|
+
return rollbackIdentity;
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=node-known-file-recovery-filesystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-filesystem.js","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-filesystem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,IAAI,EACJ,OAAO,EACP,KAAK,EACL,MAAM,EAEP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2DAA2D,CAAC;AACzG,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EAEtB,MAAM,6CAA6C,CAAC;AAErD,MAAM,UAAU,qBAAqB,CAAC,OAKrC;IACC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,6BAA6B,CAClE,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,cAAc,CACvB,CAAC,CAAC;IACH,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;QACrC,SAAS;QACT,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,8BAA8B,CAC3C,IAAY,EACZ,QAAyD,EACzD,WAAmB;IAEnB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE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OAAO,CAAC,aAAa,GAAG,CACvE,CAAC;gBACJ,CAAC;gBACD,MAAM,IAAI,YAAY,CAAC;YACzB,CAAC;YACD,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;gBAAS,CAAC;YACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnF,IAAI,QAAQ,CAAC,OAAO,KAAK,MAAM;QAC7B,CAAC,qBAAqB,CAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;QAC3D,CAAC,qBAAqB,CAAC;YACrB,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YACjE,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,KAAK;SAC5B,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,yBAAyB,CACjC,8BAA8B,EAC9B,kDAAkD,OAAO,CAAC,aAAa,GAAG,CAC3E,CAAC;IACJ,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { KnownFileImageV1, KnownFileTransactionPlanV1 } from "../../application/model/known-file-transaction.js";
|
|
2
|
+
import type { KnownFileTransactionJournalOperationV1 } from "../../application/model/known-file-transaction-journal.js";
|
|
3
|
+
import { captureFileHandleIdentity } from "./node-bounded-regular-file.js";
|
|
4
|
+
export declare class KnownFileTransactionError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
constructor(code: string, message: string, options?: ErrorOptions);
|
|
7
|
+
}
|
|
8
|
+
export interface ObservedKnownFile {
|
|
9
|
+
readonly state: "absent" | "file";
|
|
10
|
+
readonly bytes?: Buffer;
|
|
11
|
+
readonly identity?: Awaited<ReturnType<typeof captureFileHandleIdentity>>;
|
|
12
|
+
readonly mode?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function knownFileErrorCode(error: unknown): string | undefined;
|
|
15
|
+
export declare function sameKnownFileIdentity(left: Awaited<ReturnType<typeof captureFileHandleIdentity>>, right: Awaited<ReturnType<typeof captureFileHandleIdentity>>): boolean;
|
|
16
|
+
export declare function knownFileImageBytes(image: KnownFileImageV1): Buffer;
|
|
17
|
+
export declare function matchesKnownFileImage(observed: ObservedKnownFile, image: KnownFileImageV1): boolean;
|
|
18
|
+
export declare function knownFileTemporaryName(path: string, planDigest: string, operationIndex: number): string;
|
|
19
|
+
export declare function knownFileCaptureDirectoryName(path: string, planDigest: string, operationIndex: number): string;
|
|
20
|
+
export declare function canonicalKnownFileRoot(consumerRoot: string): Promise<string>;
|
|
21
|
+
export declare function knownFileAliasEntry(parent: string, requested: string): Promise<string | undefined>;
|
|
22
|
+
export declare function observeKnownFile(root: string, repositoryPath: string, maximumBytes: number): Promise<ObservedKnownFile>;
|
|
23
|
+
export declare function maximumKnownFileEvidenceBytes(operation: KnownFileTransactionPlanV1["operations"][number]): number;
|
|
24
|
+
export declare function classifyKnownFileOperation(operation: KnownFileTransactionPlanV1["operations"][number], observed: ObservedKnownFile): KnownFileTransactionJournalOperationV1;
|
|
25
|
+
//# sourceMappingURL=node-known-file-transaction-filesystem.d.ts.map
|
package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-transaction-filesystem.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-transaction-filesystem.ts"],"names":[],"mappings":"A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