@tearleads/client-sdk 0.1.63 → 0.1.65
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/client/organizations/organizationAccessRestoration.js +1 -1
- package/data/containers/shared/mutationAcknowledgement.js +1 -1
- package/data/containers/shared/mutationAcknowledgement.js.map +1 -1
- package/data/documents/blob/shared/projection.js +4 -4
- package/data/documents/blob/shared/projection.js.map +1 -1
- package/data/documents/shared/containerKek/containerKekCurrency.d.ts +22 -0
- package/data/documents/shared/containerKek/containerKekEntryVerification.js +15 -0
- package/data/documents/shared/containerKek/containerKekLogFetch.d.ts +18 -0
- package/data/documents/shared/containerKek/containerKekLogFetch.js +76 -0
- package/data/documents/shared/containerKek/containerKekPath.js +265 -0
- package/data/documents/shared/containerKek/containerKekPath.js.map +1 -0
- package/data/documents/shared/containerKek/containerKekPathHistory.d.ts +61 -0
- package/data/documents/shared/containerKek/containerKekPathHistory.js +223 -0
- package/data/documents/shared/containerKek/containerKekPathHistory.js.map +1 -0
- package/data/documents/shared/containerKek/containerKekPathVerification.d.ts +15 -0
- package/data/documents/shared/containerKek/containerKekPathVerification.js +23 -0
- package/data/documents/shared/containerKek/containerKekPathVerification.js.map +1 -0
- package/data/documents/shared/containerKek/containerKekWrapping.js +61 -0
- package/data/documents/shared/containerKek/containerKekWrapping.js.map +1 -0
- package/data/documents/shared/containerKek/keyringLogWalk.d.ts +45 -0
- package/data/documents/shared/containerKek/keyringLogWalk.js +204 -0
- package/data/documents/shared/containerKek/keyringRebuild.d.ts +60 -0
- package/data/documents/shared/containerKek/keyringRebuild.js +242 -0
- package/data/documents/shared/containerKek/keyringRebuild.js.map +1 -0
- package/data/documents/shared/crypto.js +2 -2
- package/data/documents/shared/crypto.js.map +1 -1
- package/data/documents/shared/events.js +1 -1
- package/data/documents/shared/projection/index.d.ts +25 -0
- package/data/documents/shared/projection/index.js +132 -0
- package/data/documents/shared/projection/index.js.map +1 -0
- package/data/documents/shared/projection/projectionContentKeys.d.ts +90 -0
- package/data/documents/shared/projection/projectionContentKeys.js +262 -0
- package/data/documents/shared/projection/projectionContentKeys.js.map +1 -0
- package/data/documents/shared/projection/projectionTargets.d.ts +38 -0
- package/data/documents/shared/projection/projectionTargets.js +164 -0
- package/data/documents/shared/projection/projectionTargets.js.map +1 -0
- package/data/documents/shared/responses.d.ts +1 -1
- package/data/documents/shared/responses.js +1 -1
- package/data/documents/shared/responses.js.map +1 -1
- package/data/documents/shared/sync/documentSyncUpdateDecryption.js +238 -0
- package/data/documents/shared/sync/documentSyncUpdateDecryption.js.map +1 -0
- package/data/documents/shared/sync/documentSyncUpdateIsolation.d.ts +55 -0
- package/data/documents/shared/sync/documentSyncUpdateIsolation.js +298 -0
- package/data/documents/shared/sync/documentSyncUpdateIsolation.js.map +1 -0
- package/data/documents/shared/sync/mutationAcknowledgement.js +10 -0
- package/data/documents/shared/sync/mutationAcknowledgement.js.map +1 -0
- package/data/documents/shared/sync/pullContinuation.js +53 -0
- package/data/documents/shared/sync/syncPagination.d.ts +20 -0
- package/data/documents/shared/sync/syncPagination.js +109 -0
- package/data/documents/shared/sync/syncPagination.js.map +1 -0
- package/data/documents/shared/sync/syncResponseAuthorization.js +63 -0
- package/data/documents/shared/sync/syncResponseAuthorization.js.map +1 -0
- package/data/documents/shared/sync/syncResponses.d.ts +11 -0
- package/data/documents/shared/sync/syncResponses.js +285 -0
- package/data/documents/shared/sync/syncResponses.js.map +1 -0
- package/data/documents/shared/sync/syncSubmitFailure.d.ts +9 -0
- package/data/documents/shared/types.d.ts +3 -3
- package/data/documents/shared/types.js.map +1 -1
- package/data/keyingProjectionVerification/checkpoints/accessManifestCheckpointEnforcement.js +61 -0
- package/data/keyingProjectionVerification/checkpoints/accessManifestCheckpointEnforcement.js.map +1 -0
- package/data/keyingProjectionVerification/checkpoints/bundleVerification.js +61 -0
- package/data/keyingProjectionVerification/checkpoints/bundleVerification.js.map +1 -0
- package/data/keyingProjectionVerification/checkpoints/checkpointContext.d.ts +45 -0
- package/data/keyingProjectionVerification/checkpoints/checkpointContext.js +120 -0
- package/data/keyingProjectionVerification/checkpoints/checkpointContext.js.map +1 -0
- package/data/keyingProjectionVerification/checkpoints/manifestCheckpointVerification.js +64 -0
- package/data/keyingProjectionVerification/checkpoints/manifestCheckpointVerification.js.map +1 -0
- package/data/keyingProjectionVerification/container/containerAncestorCitations.js +164 -0
- package/data/keyingProjectionVerification/container/containerAncestorCitations.js.map +1 -0
- package/data/keyingProjectionVerification/container/containerCreateManifest.js +28 -0
- package/data/keyingProjectionVerification/container/containerDestinationVerification.js +51 -0
- package/data/keyingProjectionVerification/container/containerDestinationVerification.js.map +1 -0
- package/data/keyingProjectionVerification/container/containerManifestVerification.js +285 -0
- package/data/keyingProjectionVerification/container/containerManifestVerification.js.map +1 -0
- package/data/keyingProjectionVerification/container/containerPathVerification.js +51 -0
- package/data/keyingProjectionVerification/container/containerPathVerification.js.map +1 -0
- package/data/keyingProjectionVerification/container/containerProjectionVerification.d.ts +25 -0
- package/data/keyingProjectionVerification/container/containerProjectionVerification.js +254 -0
- package/data/keyingProjectionVerification/container/containerProjectionVerification.js.map +1 -0
- package/data/keyingProjectionVerification/document/documentDependencyPaths.d.ts +17 -0
- package/data/keyingProjectionVerification/document/documentDependencyPaths.js +70 -0
- package/data/keyingProjectionVerification/document/documentDependencyPaths.js.map +1 -0
- package/data/keyingProjectionVerification/document/documentManifestPolicies.js +32 -0
- package/data/keyingProjectionVerification/document/documentManifestPolicies.js.map +1 -0
- package/data/keyingProjectionVerification/document/documentManifestPredecessor.js +12 -0
- package/data/keyingProjectionVerification/document/documentManifestVerification.js +135 -0
- package/data/keyingProjectionVerification/document/documentManifestVerification.js.map +1 -0
- package/data/keyingProjectionVerification/document/documentProjectionVerification.d.ts +24 -0
- package/data/keyingProjectionVerification/document/documentProjectionVerification.js +172 -0
- package/data/keyingProjectionVerification/document/documentProjectionVerification.js.map +1 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeCheckpointCurrency.js +100 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeCheckpointCurrency.js.map +1 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeCheckpointEnforcement.js +8 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeCheckpointEnforcement.js.map +1 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeDocumentChainVerification.js +177 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeDocumentChainVerification.js.map +1 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgePolicyCheckpoints.js +17 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgePolicyCheckpoints.js.map +1 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgePolicyCurrency.js +55 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgePolicyCurrency.js.map +1 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgePrincipalEvidence.js +116 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgePrincipalEvidence.js.map +1 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeProofVerification.d.ts +34 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeProofVerification.js +208 -0
- package/data/keyingProjectionVerification/documentPurge/documentPurgeProofVerification.js.map +1 -0
- package/data/keyingProjectionVerification/index.d.ts +4 -4
- package/data/keyingProjectionVerification/index.js +4 -4
- package/data/keyingProjectionVerification/index.js.map +1 -1
- package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js +45 -0
- package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js.map +1 -0
- package/data/keyingProjectionVerification/principalPolicy/organizationFounderBinding.js +41 -0
- package/data/keyingProjectionVerification/principalPolicy/organizationFounderBinding.js.map +1 -0
- package/data/keyingProjectionVerification/principalPolicy/principalPolicyCache.js +76 -0
- package/data/keyingProjectionVerification/principalPolicy/principalPolicyCache.js.map +1 -0
- package/data/keyingProjectionVerification/principalPolicy/principalPolicyVerification.js +252 -0
- package/data/keyingProjectionVerification/principalPolicy/principalPolicyVerification.js.map +1 -0
- package/data/keyingProjectionVerification/principalPolicy/projectionAuthorizationEvidence.js +63 -0
- package/data/keyingProjectionVerification/principalPolicy/projectionAuthorizationEvidence.js.map +1 -0
- package/data/keyingProjectionVerification/principalPolicy/projectionPolicyEvidence.js +23 -0
- package/data/keyingProjectionVerification/principalPolicy/projectionPolicyEvidence.js.map +1 -0
- package/data/keyingProjectionVerification/principalPolicy/resolvedPrincipalPolicy.js +72 -0
- package/data/keyingProjectionVerification/principalPolicy/resolvedPrincipalPolicy.js.map +1 -0
- package/data/persistence/container-contents/containerContentsPersistence.js +3 -3
- package/data/persistence/container-contents/containerContentsPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerContentsPersistenceTypes.d.ts +2 -2
- package/data/persistence/container-contents/containerContentsPersistenceTypes.js.map +1 -1
- package/data/persistence/container-contents/containerCreateIntentSettlement.js +1 -1
- package/data/persistence/container-contents/containerDeletionPersistence.js +2 -2
- package/data/persistence/container-contents/containerDocumentReassignment.js +2 -2
- package/data/persistence/container-contents/containerDocumentReassignment.js.map +1 -1
- package/data/persistence/container-contents/containerHydrationPersistence.js +3 -3
- package/data/persistence/container-contents/containerHydrationPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerIntentPersistence.js +1 -1
- package/data/persistence/container-contents/containerMetadataMutationPersistence.js +5 -5
- package/data/persistence/container-contents/containerMetadataMutationPersistence.js.map +1 -1
- package/data/persistence/container-contents/containerMetadataPullContinuationPersistence.js +1 -1
- package/data/persistence/container-contents/containerMetadataRows.js +3 -3
- package/data/persistence/container-contents/containerMetadataRows.js.map +1 -1
- package/data/persistence/container-contents/containerMoveAbandonPersistence.js +1 -1
- package/data/persistence/container-contents/containerMoveIntentRows.js +1 -1
- package/data/persistence/container-contents/containerPendingUpdatePersistence.js +3 -3
- package/data/persistence/container-contents/containerPendingUpdatePersistence.js.map +1 -1
- package/data/persistence/container-contents/containerRebindPersistence.js +1 -1
- package/data/persistence/container-contents/containerReconcilePersistence.js +2 -2
- package/data/persistence/container-contents/containerRecoveryPersistence.js +1 -1
- package/data/persistence/container-contents/containerRemovalWork.js +3 -3
- package/data/persistence/container-contents/containerRemovalWork.js.map +1 -1
- package/data/persistence/container-contents/containerStructuralRepair.js +1 -1
- package/data/persistence/container-contents/documentLinkRemovalRepair.js +2 -2
- package/data/persistence/container-contents/documentLinkRemovalRepair.js.map +1 -1
- package/data/persistence/container-contents/documentMoveIntentPersistence.js +2 -2
- package/data/persistence/container-contents/documentMoveIntentPersistence.js.map +1 -1
- package/data/persistence/container-contents/documentPlacementIntentEnqueue.js +2 -2
- package/data/persistence/container-contents/documentPlacementIntentEnqueue.js.map +1 -1
- package/data/persistence/container-contents/documentPurgePlacement.js +1 -1
- package/data/persistence/container-contents/dormantContainerMetadata.js +1 -1
- package/data/persistence/container-contents/dormantMetadataSweep.js +1 -1
- package/data/persistence/container-contents/pendingContainerCreate.js +1 -1
- package/data/persistence/container-contents/supersededContainerBindings.js +1 -1
- package/data/persistence/containers/containerPersistence.js +1 -1
- package/data/persistence/containers/containerSyncWatermarkPersistence.js +1 -1
- package/data/persistence/containers/documentContainerProjectionPersistence.js +1 -1
- package/data/persistence/containers/documentPlacement.js +1 -1
- package/data/persistence/documents/containerDocumentTombstoneHoldsPersistence.js +1 -1
- package/data/persistence/documents/documentDiscoveryEvidencePersistence.js +3 -3
- package/data/persistence/documents/documentDiscoveryEvidencePersistence.js.map +1 -1
- package/data/persistence/documents/documentDiscoveryReset.js +1 -1
- package/data/persistence/documents/documentDiscoveryReset.js.map +1 -1
- package/data/persistence/documents/documentsPersistence.js +3 -3
- package/data/persistence/documents/documentsPersistence.js.map +1 -1
- package/data/persistence/documents/internal/attachmentStagingPersistence.js +1 -1
- package/data/persistence/documents/internal/containerDocumentTombstoneHolds.js +1 -1
- package/data/persistence/documents/internal/containerDocumentTombstones.js +1 -1
- package/data/persistence/documents/internal/createDocumentWithHistoryCheckpoint.js +2 -2
- package/data/persistence/documents/internal/createDocumentWithHistoryCheckpoint.js.map +1 -1
- package/data/persistence/documents/internal/discardDocument.js +3 -3
- package/data/persistence/documents/internal/discardDocument.js.map +1 -1
- package/data/persistence/documents/internal/documentDeletionPersistence.js +4 -4
- package/data/persistence/documents/internal/documentDeletionPersistence.js.map +1 -1
- package/data/persistence/documents/internal/documentMutationPersistence.js +5 -5
- package/data/persistence/documents/internal/documentMutationPersistence.js.map +1 -1
- package/data/persistence/documents/internal/documentProjectionRows.js +1 -1
- package/data/persistence/documents/internal/documentPullContinuationPersistence.js +1 -1
- package/data/persistence/documents/internal/documentRows.js +2 -2
- package/data/persistence/documents/internal/documentRows.js.map +1 -1
- package/data/persistence/documents/internal/documentSummaryQueries.js +1 -1
- package/data/persistence/documents/internal/ensureDocumentsSchema.js +2 -2
- package/data/persistence/documents/internal/hydratedAttachmentPersistence.js +1 -1
- package/data/persistence/documents/internal/orphanSideRows.js +2 -2
- package/data/persistence/documents/internal/orphanSideRows.js.map +1 -1
- package/data/persistence/documents/internal/pendingCreateAdoption.js +1 -1
- package/data/persistence/documents/internal/rowQueryPersistence.js +2 -2
- package/data/persistence/documents/internal/syncQueuePersistence.js +3 -3
- package/data/persistence/documents/internal/syncQueuePersistence.js.map +1 -1
- package/data/persistence/documents/types.d.ts +3 -3
- package/data/persistence/documents/types.js.map +1 -1
- package/data/persistence/keyingCheckpoints/documentPurgeCheckpointPersistence.d.ts +10 -0
- package/data/persistence/keyingCheckpoints/documentPurgeCheckpointPersistence.js +43 -0
- package/data/persistence/keyingCheckpoints/documentPurgeCheckpointPersistence.js.map +1 -0
- package/data/persistence/keyingCheckpoints/keyingCheckpointAdvancePersistence.js +222 -0
- package/data/persistence/keyingCheckpoints/keyingCheckpointAdvancePersistence.js.map +1 -0
- package/data/persistence/keyingCheckpoints/keyingCheckpointEvidence.js +32 -0
- package/data/persistence/keyingCheckpoints/keyingCheckpointPersistence.js +133 -0
- package/data/persistence/keyingCheckpoints/keyingCheckpointPersistence.js.map +1 -0
- package/data/persistence/keyingCheckpoints/locallyAcknowledgedCheckpointPersistence.d.ts +53 -0
- package/data/persistence/keyingCheckpoints/locallyAcknowledgedCheckpointPersistence.js +167 -0
- package/data/persistence/keyingCheckpoints/locallyAcknowledgedCheckpointPersistence.js.map +1 -0
- package/data/persistence/keyingCheckpoints/organizationReplacementCheckpointPersistence.js +72 -0
- package/data/persistence/keyingCheckpoints/organizationReplacementCheckpointPersistence.js.map +1 -0
- package/data/persistence/keyingCheckpoints/principalAuthorizationCheckpoints.js +29 -0
- package/data/persistence/keyingCheckpoints/principalAuthorizationCheckpoints.js.map +1 -0
- package/data/persistence/organizationFounderPersistence.js +2 -2
- package/data/persistence/organizationFounderPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationAccessRevocationPersistence.js +3 -3
- package/data/persistence/organizations/organizationAccessRevocationPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationDataUsagePersistence.js +2 -2
- package/data/persistence/organizations/organizationDataUsagePersistence.js.map +1 -1
- package/data/persistence/organizations/organizationGroupNamePersistence.js +2 -2
- package/data/persistence/organizations/organizationGroupNamePersistence.js.map +1 -1
- package/data/persistence/organizations/organizationPresentationDenialPersistence.js +2 -2
- package/data/persistence/organizations/organizationPresentationDenialPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationProfileDocumentPointers.js +2 -2
- package/data/persistence/organizations/organizationProfileDocumentPointers.js.map +1 -1
- package/data/persistence/organizations/organizationProvisioningAttemptPersistence.js +1 -1
- package/data/persistence/organizations/organizationProvisioningAttemptPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelGrantPersistence.js +1 -1
- package/data/persistence/organizations/organizationReadModelGrantPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelMemberLoad.js +1 -1
- package/data/persistence/organizations/organizationReadModelMemberLoad.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelMembershipPersistence.js +1 -1
- package/data/persistence/organizations/organizationReadModelMembershipPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelPersistence.js +3 -3
- package/data/persistence/organizations/organizationReadModelPersistence.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelProjection.js +1 -1
- package/data/persistence/organizations/organizationReadModelProjection.js.map +1 -1
- package/data/persistence/organizations/organizationReadModelPurge.js +3 -3
- package/data/persistence/organizations/organizationReadModelPurge.js.map +1 -1
- package/data/persistence/principalCurrentAcknowledgementPersistence.d.ts +3 -3
- package/data/persistence/principalCurrentAcknowledgementPersistence.js +10 -10
- package/data/persistence/principalCurrentAcknowledgementPersistence.js.map +1 -1
- package/data/persistence/principalHistory/principalHistoryEvidencePersistence.d.ts +32 -0
- package/data/persistence/principalHistory/principalHistoryEvidencePersistence.js +92 -0
- package/data/persistence/principalHistory/principalHistoryEvidencePersistence.js.map +1 -0
- package/data/persistence/principalHistory/principalHistoryIncompleteRetention.js +26 -0
- package/data/persistence/principalHistory/principalHistoryIncompleteRetention.js.map +1 -0
- package/data/persistence/principalHistory/principalHistoryNodeRetention.js +201 -0
- package/data/persistence/principalHistory/principalHistoryNodeRetention.js.map +1 -0
- package/data/persistence/principalHistory/principalHistoryPrefixPersistence.d.ts +29 -0
- package/data/persistence/principalHistory/principalHistoryPrefixPersistence.js +102 -0
- package/data/persistence/principalHistory/principalHistoryPrefixPersistence.js.map +1 -0
- package/data/persistence/principalHistory/principalHistoryRootOwnership.js +71 -0
- package/data/persistence/principalHistory/principalHistoryRootOwnership.js.map +1 -0
- package/data/persistence/principalHistory/principalHistoryStagePersistence.d.ts +15 -0
- package/data/persistence/principalHistory/principalHistoryStagePersistence.js +96 -0
- package/data/persistence/principalHistory/principalHistoryStagePersistence.js.map +1 -0
- package/data/persistence/principalHistory/principalHistoryStageRetention.js +45 -0
- package/data/persistence/principalHistory/principalHistoryStageRetention.js.map +1 -0
- package/data/persistence/principalHistory/principalHistoryUnpublishedRetention.js +64 -0
- package/data/persistence/principalHistory/principalHistoryUnpublishedRetention.js.map +1 -0
- package/data/persistence/principalKeys/principalGrantRetirementPersistence.d.ts +9 -0
- package/data/persistence/principalKeys/principalGrantRetirementPersistence.js +43 -0
- package/data/persistence/principalKeys/principalGrantRetirementPersistence.js.map +1 -0
- package/data/persistence/principalKeys/principalKeyEnvelopeArchivePersistence.js +63 -0
- package/data/persistence/principalKeys/principalKeyEnvelopeArchivePersistence.js.map +1 -0
- package/data/persistence/principalKeys/principalKeyEnvelopeCandidates.js +87 -0
- package/data/persistence/principalKeys/principalKeyEnvelopeCandidates.js.map +1 -0
- package/data/persistence/principalMutationJournalPersistence.d.ts +1 -1
- package/data/persistence/principalMutationJournalPersistence.js +1 -1
- package/data/persistence/principalMutationJournalPersistence.js.map +1 -1
- package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js +49 -0
- package/data/persistence/principalPolicy/principalPolicyBundleIntegrity.js.map +1 -0
- package/data/persistence/principalPolicy/principalPolicyCheckpointSelection.js +26 -0
- package/data/persistence/principalPolicy/principalPolicyCheckpointSelection.js.map +1 -0
- package/data/persistence/principalPolicy/principalPolicyOrganizationPersistence.js +42 -0
- package/data/persistence/principalPolicy/principalPolicyOrganizationPersistence.js.map +1 -0
- package/data/persistence/principalPolicy/principalPolicyPersistence.js +279 -0
- package/data/persistence/principalPolicy/principalPolicyPersistence.js.map +1 -0
- package/data/persistence/principalPolicy/principalPolicyReferenceCheckpoint.js +27 -0
- package/data/persistence/principalPolicy/principalPolicyReferenceCheckpoint.js.map +1 -0
- package/data/persistence/principalPolicy/principalPolicyReferenceIndexPersistence.js +115 -0
- package/data/persistence/principalPolicy/principalPolicyReferenceIndexPersistence.js.map +1 -0
- package/data/persistence/principalPolicy/principalPolicyReferencePersistence.js +215 -0
- package/data/persistence/principalPolicy/principalPolicyReferencePersistence.js.map +1 -0
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyBundle.js +33 -0
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyBundle.js.map +1 -0
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js +56 -0
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyCurrent.js.map +1 -0
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyRetentionPersistence.js +18 -0
- package/data/persistence/principalPolicy/verifiedPrincipalPolicyRetentionPersistence.js.map +1 -0
- package/data/persistence/securityIncidentPersistence.js +1 -1
- package/data/persistence/securityIncidentPersistence.js.map +1 -1
- package/data/persistence/trustedUserIdentityPinPersistence.js +1 -1
- package/data/persistence/verifiedManifestBundlePersistence.d.ts +1 -1
- package/data/persistence/verifiedManifestBundlePersistence.js +4 -4
- package/data/persistence/verifiedManifestBundlePersistence.js.map +1 -1
- package/data/principals/organizationGroupRoles.js +2 -2
- package/data/principals/organizationGroupRoles.js.map +1 -1
- package/data/principals/principalHistoryPrefixProtection.js.map +1 -1
- package/data/principals/principalHistoryStageProtection.js.map +1 -1
- package/data/principals/principalPolicyCrypto.js +1 -1
- package/data/principals/principalPolicyCrypto.js.map +1 -1
- package/data/sqlite/documentPersistence/documentHistoryPersistence.d.ts +86 -0
- package/data/sqlite/documentPersistence/documentHistoryPersistence.js +304 -0
- package/data/sqlite/documentPersistence/documentHistoryPersistence.js.map +1 -0
- package/data/sqlite/documentPersistence/documentOrphanBlobReclaims.js +6 -0
- package/data/sqlite/documentPersistence/documentOrphanBlobReclaims.js.map +1 -0
- package/data/sqlite/documentPersistence/documentPendingUpdatePersistence.d.ts +103 -0
- package/data/sqlite/documentPersistence/documentPendingUpdatePersistence.js +243 -0
- package/data/sqlite/documentPersistence/documentPendingUpdatePersistence.js.map +1 -0
- package/data/sqlite/documentPersistence/documentPersistenceTypes.d.ts +79 -0
- package/data/sqlite/documentPersistence/documentPersistenceTypes.js.map +1 -0
- package/data/sqlite/documentPersistence/documentRecordPersistence.d.ts +275 -0
- package/data/sqlite/documentPersistence/documentRecordPersistence.js +103 -0
- package/data/sqlite/documentPersistence/documentRecordPersistence.js.map +1 -0
- package/data/sqlite/documentPersistence/documentSyncFailurePersistence.d.ts +39 -0
- package/data/sqlite/documentPersistence/documentSyncFailurePersistence.js +81 -0
- package/data/sqlite/documentPersistence/documentSyncFailurePersistence.js.map +1 -0
- package/data/sqlite/documentPersistence/index.d.ts +22 -0
- package/data/sqlite/documentPersistence/index.js +35 -0
- package/data/sqlite/documentPersistence/index.js.map +1 -0
- package/data/sqlite/schema/containerSchema.d.ts +1193 -0
- package/data/sqlite/schema/containerSchema.js +103 -0
- package/data/sqlite/schema/containerSchema.js.map +1 -0
- package/data/sqlite/schema/index.d.ts +8055 -0
- package/data/sqlite/schema/index.js +525 -0
- package/data/sqlite/schema/index.js.map +1 -0
- package/data/sqlite/schema/organizationDataUsageSchema.js +34 -0
- package/data/sqlite/schema/organizationDataUsageSchema.js.map +1 -0
- package/data/sqlite/schema/organizationProvisioningAttemptSchema.js +23 -0
- package/data/sqlite/schema/organizationProvisioningAttemptSchema.js.map +1 -0
- package/data/sqlite/schema/organizationReadModelTableRegistry.d.ts +1332 -0
- package/data/sqlite/schema/organizationReadModelTableRegistry.js +31 -0
- package/data/sqlite/schema/organizationReadModelTableRegistry.js.map +1 -0
- package/data/sqlite/schema/principalHistoryEvidenceSchema.d.ts +308 -0
- package/data/sqlite/schema/principalHistoryEvidenceSchema.js +48 -0
- package/data/sqlite/schema/principalHistoryEvidenceSchema.js.map +1 -0
- package/data/sqlite/schema/principalHistoryNodeRetentionSchema.js +30 -0
- package/data/sqlite/schema/principalHistoryNodeRetentionSchema.js.map +1 -0
- package/data/sqlite/schema/principalHistoryRetentionSchema.js +25 -0
- package/data/sqlite/schema/principalHistoryRetentionSchema.js.map +1 -0
- package/data/sqlite/schema/principalHistoryStageSchema.d.ts +161 -0
- package/data/sqlite/schema/principalHistoryStageSchema.js +34 -0
- package/data/sqlite/schema/principalHistoryStageSchema.js.map +1 -0
- package/data/sqlite/schema/principalMutationJournalSchema.d.ts +85 -0
- package/data/sqlite/schema/principalMutationJournalSchema.js +13 -0
- package/data/sqlite/schema/principalMutationJournalSchema.js.map +1 -0
- package/data/sqlite/schema/principalPolicySchema.js +72 -0
- package/data/sqlite/schema/principalPolicySchema.js.map +1 -0
- package/data/sqlite/schema/securityIncidentSchema.d.ts +224 -0
- package/data/sqlite/schema/securityIncidentSchema.js +28 -0
- package/data/sqlite/schema/securityIncidentSchema.js.map +1 -0
- package/data/sqlite/schema/verifiedManifestBundleSchema.d.ts +174 -0
- package/data/sqlite/schema/verifiedManifestBundleSchema.js +36 -0
- package/data/sqlite/schema/verifiedManifestBundleSchema.js.map +1 -0
- package/data/sqlite/sqlitePersistenceRuntime.d.ts +1 -1
- package/data/sqlite/sqlitePersistenceRuntime.js +1 -1
- package/package.json +1 -1
- package/sqlite/index.d.ts +1 -1
- package/sqlite/index.js +1 -1
- package/stores/container-contents/accessRestorationSweep.js +1 -1
- package/stores/container-contents/accessRestorationSweep.js.map +1 -1
- package/stores/container-contents/containerContentsStore.d.ts +1 -1
- package/stores/container-contents/containerContentsStore.js +12 -12
- package/stores/container-contents/containerContentsStore.js.map +1 -1
- package/stores/container-contents/containerState/containerStateMap.js.map +1 -0
- package/stores/container-contents/containerState/containerStatePersistence.js +57 -0
- package/stores/container-contents/containerState/containerStatePersistence.js.map +1 -0
- package/stores/container-contents/containerState/missingContainerState.js +10 -0
- package/stores/container-contents/containerState/missingContainerState.js.map +1 -0
- package/stores/container-contents/containerState/missingSyncedContainerState.js.map +1 -0
- package/stores/container-contents/containerState/reconcilableContainer.d.ts +48 -0
- package/stores/container-contents/containerState/reconcilableContainer.js.map +1 -0
- package/stores/container-contents/documentWork/documentRecovery.js +114 -0
- package/stores/container-contents/documentWork/documentRecovery.js.map +1 -0
- package/stores/container-contents/documentWork/documentRotation.js +13 -0
- package/stores/container-contents/documentWork/documentRotation.js.map +1 -0
- package/stores/container-contents/documentWork/index.js +29 -0
- package/stores/container-contents/documentWork/index.js.map +1 -0
- package/stores/container-contents/hydration/backgroundHydration.js +32 -0
- package/stores/container-contents/hydration/backgroundHydration.js.map +1 -0
- package/stores/container-contents/hydration/remoteHydrationRequest.js +245 -0
- package/stores/container-contents/hydration/remoteHydrationRequest.js.map +1 -0
- package/stores/container-contents/hydration/startupHydration.js +110 -0
- package/stores/container-contents/hydration/startupHydration.js.map +1 -0
- package/stores/container-contents/index.d.ts +3 -3
- package/stores/container-contents/index.js +2 -2
- package/stores/container-contents/index.js.map +1 -1
- package/stores/container-contents/localRefresh.js +2 -2
- package/stores/container-contents/localRefresh.js.map +1 -1
- package/stores/container-contents/operations/containerPurgeCore.js +98 -0
- package/stores/container-contents/operations/containerPurgeCore.js.map +1 -0
- package/stores/container-contents/operations/emptyTrashOperation.js.map +1 -0
- package/stores/container-contents/operations/groupRewrapOperation.js +52 -0
- package/stores/container-contents/operations/groupRewrapOperation.js.map +1 -0
- package/stores/container-contents/operations/index.js +301 -0
- package/stores/container-contents/operations/index.js.map +1 -0
- package/stores/container-contents/operations/purgeContainerOperation.js.map +1 -0
- package/stores/container-contents/operations/reportShareFailure.js +44 -0
- package/stores/container-contents/operations/reportShareFailure.js.map +1 -0
- package/stores/container-contents/operations/setContainerIconOperation.js +47 -0
- package/stores/container-contents/operations/setContainerIconOperation.js.map +1 -0
- package/stores/container-contents/operations/shareOperations.js +90 -0
- package/stores/container-contents/operations/shareOperations.js.map +1 -0
- package/stores/container-contents/remoteEvents/remoteBackedContainerState.js.map +1 -0
- package/stores/container-contents/remoteEvents/remoteContainerIngestion.js +59 -0
- package/stores/container-contents/remoteEvents/remoteContainerIngestion.js.map +1 -0
- package/stores/container-contents/remoteEvents/remoteEventProjectionInvalidation.js +36 -0
- package/stores/container-contents/remoteEvents/remoteEventProjectionInvalidation.js.map +1 -0
- package/stores/container-contents/remoteEvents/remoteEventSync.js +38 -0
- package/stores/container-contents/remoteEvents/remoteEventSync.js.map +1 -0
- package/stores/container-contents/remoteWrites/remoteWriteGuards.js +54 -0
- package/stores/container-contents/remoteWrites/remoteWriteGuards.js.map +1 -0
- package/stores/container-contents/remoteWrites/remoteWriteQueue.js +51 -0
- package/stores/container-contents/remoteWrites/remoteWriteQueue.js.map +1 -0
- package/stores/container-contents/remoteWrites/writeGeneration.js.map +1 -0
- package/stores/container-contents/state.d.ts +1 -1
- package/stores/container-contents/state.js +2 -2
- package/stores/container-contents/state.js.map +1 -1
- package/stores/container-contents/syncAgent/index.d.ts +8 -0
- package/stores/container-contents/syncAgent/index.js +241 -0
- package/stores/container-contents/syncAgent/index.js.map +1 -0
- package/stores/container-contents/syncAgent/metadataSyncSignal.js +37 -0
- package/stores/container-contents/syncAgent/metadataSyncSignal.js.map +1 -0
- package/stores/container-contents/syncAgent/syncAgentTypes.d.ts +81 -0
- package/stores/container-contents/syncAgent/syncAgentTypes.js.map +1 -0
- package/stores/container-contents/syncAgent/syncLaneIteration.js +237 -0
- package/stores/container-contents/syncAgent/syncLaneIteration.js.map +1 -0
- package/stores/container-contents/systemContainers/existingSystemContainer.js +58 -0
- package/stores/container-contents/systemContainers/existingSystemContainer.js.map +1 -0
- package/stores/container-contents/systemContainers/organizationMetadataSystemContainer.js +44 -0
- package/stores/container-contents/systemContainers/organizationMetadataSystemContainer.js.map +1 -0
- package/stores/container-contents/systemContainers/systemContainerHydration.js +30 -0
- package/stores/container-contents/systemContainers/systemContainerHydration.js.map +1 -0
- package/stores/container-contents/systemContainers/systemContainerIcon.js +42 -0
- package/stores/container-contents/systemContainers/systemContainerIcon.js.map +1 -0
- package/stores/container-contents/systemContainers/systemContainerLookup.js.map +1 -0
- package/stores/container-contents/systemContainers/systemContainerPostCreate.js +109 -0
- package/stores/container-contents/systemContainers/systemContainerPostCreate.js.map +1 -0
- package/stores/container-contents/systemContainers/systemContainerPromotion.js +49 -0
- package/stores/container-contents/systemContainers/systemContainerPromotion.js.map +1 -0
- package/stores/container-contents/types.d.ts +2 -2
- package/stores/container-contents/types.js.map +1 -1
- package/stores/documents/documentStore/attachmentUpload/attachmentSourceUpload.js +39 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentSourceUpload.js.map +1 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentStaging.js +84 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentStaging.js.map +1 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadAttempt.js +97 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadAttempt.js.map +1 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadLane.js +49 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadLane.js.map +1 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadResume.js +95 -0
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadResume.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentDetachState.js +54 -0
- package/stores/documents/documentStore/attachments/attachmentDetachState.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentHydration.js +90 -0
- package/stores/documents/documentStore/attachments/attachmentHydration.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentHydrationCommit.js +53 -0
- package/stores/documents/documentStore/attachments/attachmentHydrationCommit.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentIntents.js +39 -0
- package/stores/documents/documentStore/attachments/attachmentIntents.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentMutationPersistence.js +37 -0
- package/stores/documents/documentStore/attachments/attachmentMutationPersistence.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentPersistFollowup.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentPersistence.js +106 -0
- package/stores/documents/documentStore/attachments/attachmentPersistence.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentRemoval.js +136 -0
- package/stores/documents/documentStore/attachments/attachmentRemoval.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentSnapshot.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentWriteGeneration.js +32 -0
- package/stores/documents/documentStore/attachments/attachmentWriteGeneration.js.map +1 -0
- package/stores/documents/documentStore/attachments/index.js +241 -0
- package/stores/documents/documentStore/attachments/index.js.map +1 -0
- package/stores/documents/documentStore/history/documentHistoryCompaction.js +67 -0
- package/stores/documents/documentStore/history/documentHistoryCompaction.js.map +1 -0
- package/stores/documents/documentStore/history/durableDocumentReload.js +79 -0
- package/stores/documents/documentStore/history/durableDocumentReload.js.map +1 -0
- package/stores/documents/documentStore/history/historyRebuild.js +75 -0
- package/stores/documents/documentStore/history/historyRebuild.js.map +1 -0
- package/stores/documents/documentStore/index.d.ts +8 -0
- package/stores/documents/documentStore/index.js +215 -0
- package/stores/documents/documentStore/index.js.map +1 -0
- package/stores/documents/documentStore/initialization/deferredInitialUpdate.js +116 -0
- package/stores/documents/documentStore/initialization/deferredInitialUpdate.js.map +1 -0
- package/stores/documents/documentStore/initialization/index.js +330 -0
- package/stores/documents/documentStore/initialization/index.js.map +1 -0
- package/stores/documents/documentStore/initialization/initializationAttachments.js +9 -0
- package/stores/documents/documentStore/initialization/initializationAttachments.js.map +1 -0
- package/stores/documents/documentStore/initialization/initializationHistory.js +33 -0
- package/stores/documents/documentStore/initialization/initializationHistory.js.map +1 -0
- package/stores/documents/documentStore/initialization/initializationRecovery.js +107 -0
- package/stores/documents/documentStore/initialization/initializationRecovery.js.map +1 -0
- package/stores/documents/documentStore/mutationIdentityRevalidation.js.map +1 -1
- package/stores/documents/documentStore/mutations.js +2 -2
- package/stores/documents/documentStore/mutations.js.map +1 -1
- package/stores/documents/documentStore/pendingUpdateRefusal.js +1 -1
- package/stores/documents/documentStore/pendingUpdateRefusal.js.map +1 -1
- package/stores/documents/documentStore/persistence.js +3 -3
- package/stores/documents/documentStore/persistence.js.map +1 -1
- package/stores/documents/documentStore/rotation/index.js +307 -0
- package/stores/documents/documentStore/rotation/index.js.map +1 -0
- package/stores/documents/documentStore/rotation/rotationProvenance.js +52 -0
- package/stores/documents/documentStore/rotation/rotationProvenance.js.map +1 -0
- package/stores/documents/documentStore/rotation/rotationSettlement.js +222 -0
- package/stores/documents/documentStore/rotation/rotationSettlement.js.map +1 -0
- package/stores/documents/documentStore/rows.js +2 -2
- package/stores/documents/documentStore/rows.js.map +1 -1
- package/stores/documents/documentStore/state.js +1 -1
- package/stores/documents/documentStore/state.js.map +1 -1
- package/stores/documents/documentStore/sync/index.js +299 -0
- package/stores/documents/documentStore/sync/index.js.map +1 -0
- package/stores/documents/documentStore/sync/pullContinuationInvalidation.js +61 -0
- package/stores/documents/documentStore/sync/pullContinuationInvalidation.js.map +1 -0
- package/stores/documents/documentStore/sync/remoteRevalidationTelemetry.js +15 -0
- package/stores/documents/documentStore/sync/remoteRevalidationTelemetry.js.map +1 -0
- package/stores/documents/documentStore/sync/remoteWork.js.map +1 -0
- package/stores/documents/documentStore/sync/syncAcceptedUpdateIds.js.map +1 -0
- package/stores/documents/documentStore/sync/syncAttachmentSettlement.js +72 -0
- package/stores/documents/documentStore/sync/syncAttachmentSettlement.js.map +1 -0
- package/stores/documents/documentStore/sync/syncAttachments.js +323 -0
- package/stores/documents/documentStore/sync/syncAttachments.js.map +1 -0
- package/stores/documents/documentStore/sync/syncDetachedAttachments.js +129 -0
- package/stores/documents/documentStore/sync/syncDetachedAttachments.js.map +1 -0
- package/stores/documents/documentStore/sync/syncFinalize.js +204 -0
- package/stores/documents/documentStore/sync/syncFinalize.js.map +1 -0
- package/stores/documents/documentStore/sync/syncGeneration.js.map +1 -0
- package/stores/documents/documentStore/sync/syncOutgoingCoverage.js +96 -0
- package/stores/documents/documentStore/sync/syncOutgoingCoverage.js.map +1 -0
- package/stores/documents/documentStore/sync/syncRemoteSignals.js +67 -0
- package/stores/documents/documentStore/sync/syncRemoteSignals.js.map +1 -0
- package/stores/documents/documentStore/sync/syncRequest.js +157 -0
- package/stores/documents/documentStore/sync/syncRequest.js.map +1 -0
- package/stores/documents/documentStore/sync/syncShared.js +211 -0
- package/stores/documents/documentStore/sync/syncShared.js.map +1 -0
- package/stores/documents/documentStore/sync/syncUpdateImport.js +62 -0
- package/stores/documents/documentStore/sync/syncUpdateImport.js.map +1 -0
- package/stores/documents/documentStore/sync/versionCoverage.js +45 -0
- package/stores/documents/index.d.ts +1 -1
- package/stores/documents/index.js +1 -1
- package/stores/local-projection/localProjectionStore.d.ts +1 -1
- package/stores/local-projection/localProjectionStore.js +1 -1
- package/stores/local-projection/localProjectionStore.js.map +1 -1
- package/stores/local-projection/registry.d.ts +1 -1
- package/stores/local-projection/types.d.ts +1 -1
- package/workflows/blobs/detach.js +1 -1
- package/workflows/blobs/hydration/decrypt.js +2 -2
- package/workflows/blobs/hydration/decrypt.js.map +1 -1
- package/workflows/blobs/upload/index.js +1 -1
- package/workflows/blobs/verification/retainedAttachmentVerification.js +1 -1
- package/workflows/blobs/verification/writerProjection.js +1 -1
- package/workflows/container-contents/container-state/create/createAdoption.js +193 -0
- package/workflows/container-contents/container-state/create/createAdoption.js.map +1 -0
- package/workflows/container-contents/container-state/create/createChild.js +217 -0
- package/workflows/container-contents/container-state/create/createChild.js.map +1 -0
- package/workflows/container-contents/container-state/create/createIntentDepth.js +36 -0
- package/workflows/container-contents/container-state/create/createIntentDepth.js.map +1 -0
- package/workflows/container-contents/container-state/create/createIntentSettlement.js.map +1 -0
- package/workflows/container-contents/container-state/create/createIntentSync.js +354 -0
- package/workflows/container-contents/container-state/create/createIntentSync.js.map +1 -0
- package/workflows/container-contents/container-state/create/createTerminalFailure.js +19 -0
- package/workflows/container-contents/container-state/create/createTerminalFailure.js.map +1 -0
- package/workflows/container-contents/container-state/create/createWithMetadata.js +270 -0
- package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -0
- package/workflows/container-contents/container-state/create/createWithMetadataPlan.js +68 -0
- package/workflows/container-contents/container-state/create/createWithMetadataPlan.js.map +1 -0
- package/workflows/container-contents/container-state/purge/localPurgeScope.js +49 -0
- package/workflows/container-contents/container-state/purge/localPurgeScope.js.map +1 -0
- package/workflows/container-contents/container-state/purge/purgeTree.js +298 -0
- package/workflows/container-contents/container-state/purge/purgeTree.js.map +1 -0
- package/workflows/container-contents/container-state/purge/purgeTreeCollection.js.map +1 -0
- package/workflows/container-contents/container-state/purge/purgeTreeContainerDeletion.js +75 -0
- package/workflows/container-contents/container-state/purge/purgeTreeContainerDeletion.js.map +1 -0
- package/workflows/container-contents/container-state/purge/purgeTreeScope.js +175 -0
- package/workflows/container-contents/container-state/purge/purgeTreeScope.js.map +1 -0
- package/workflows/container-contents/container-state/purge/readLocalPurgeScope.js +18 -0
- package/workflows/container-contents/container-state/purge/readLocalPurgeScope.js.map +1 -0
- package/workflows/container-contents/container-state/remote.js +2 -2
- package/workflows/container-contents/container-state/remote.js.map +1 -1
- package/workflows/container-contents/container-state/share/groupGrantVerification.js +71 -0
- package/workflows/container-contents/container-state/share/groupGrantVerification.js.map +1 -0
- package/workflows/container-contents/container-state/share/groupShareEpoch.js +16 -0
- package/workflows/container-contents/container-state/share/groupShareEpoch.js.map +1 -0
- package/workflows/container-contents/container-state/share/index.js +283 -0
- package/workflows/container-contents/container-state/share/index.js.map +1 -0
- package/workflows/container-contents/container-state/share/sharePersistence.js +136 -0
- package/workflows/container-contents/container-state/share/sharePersistence.js.map +1 -0
- package/workflows/container-contents/documentDiscovery/documentDiscoveryApply.js +1 -1
- package/workflows/container-contents/documentDiscovery/documentDiscoveryApply.js.map +1 -1
- package/workflows/container-contents/documentDiscovery/index.js +1 -1
- package/workflows/container-contents/documentDiscovery/index.js.map +1 -1
- package/workflows/container-contents/documentLinks/index.js +1 -1
- package/workflows/container-contents/documentMove/documentMoveVanishedRefresh.js +1 -1
- package/workflows/container-contents/documentPriming/documentHydrationProbe.js +1 -1
- package/workflows/container-contents/documentPriming/index.js +1 -1
- package/workflows/container-contents/documentQueries/index.js +1 -1
- package/workflows/container-contents/documentQueries/sql.js +1 -1
- package/workflows/container-contents/info/blobInfo.js +1 -1
- package/workflows/container-contents/info/containerInfo.js +1 -1
- package/workflows/container-contents/info/documentInfo.js +1 -1
- package/workflows/container-contents/metadata/index.js +1 -1
- package/workflows/container-contents/metadata/index.js.map +1 -1
- package/workflows/container-contents/metadata/metadataEvents.d.ts +1 -1
- package/workflows/container-contents/metadata/metadataIncomingUpdateIsolation.js +2 -2
- package/workflows/container-contents/metadata/metadataIncomingUpdateIsolation.js.map +1 -1
- package/workflows/container-contents/metadata/metadataMutationPreparation.js +1 -1
- package/workflows/container-contents/metadata/metadataMutationPreparation.js.map +1 -1
- package/workflows/container-contents/metadata/metadataPullContinuationInvalidation.js +1 -1
- package/workflows/container-contents/metadata/metadataPullContinuationInvalidation.js.map +1 -1
- package/workflows/container-contents/metadata/metadataRemoteSync.d.ts +1 -1
- package/workflows/container-contents/metadata/metadataSyncErrors.js +2 -2
- package/workflows/container-contents/metadata/metadataSyncErrors.js.map +1 -1
- package/workflows/container-contents/metadata/metadataSyncSettlement.d.ts +1 -1
- package/workflows/container-contents/metadata/metadataSyncSettlement.js.map +1 -1
- package/workflows/container-contents/metadata/metadataTypes.d.ts +1 -1
- package/workflows/container-contents/metadata/metadataTypes.js.map +1 -1
- package/workflows/container-contents/pendingWrites/index.js +2 -2
- package/workflows/container-contents/pendingWrites/sources.js +1 -1
- package/workflows/container-contents/remoteHydration/destination/destinationPrefetch.js.map +1 -0
- package/workflows/container-contents/remoteHydration/destination/destinationRoleCache.js.map +1 -0
- package/workflows/container-contents/remoteHydration/destination/destinationRootReload.js +10 -0
- package/workflows/container-contents/remoteHydration/destination/destinationRootReload.js.map +1 -0
- package/workflows/container-contents/remoteHydration/destination/replacementBinding.js +75 -0
- package/workflows/container-contents/remoteHydration/destination/replacementBinding.js.map +1 -0
- package/workflows/container-contents/remoteHydration/destination/verifiedDestination.js +296 -0
- package/workflows/container-contents/remoteHydration/destination/verifiedDestination.js.map +1 -0
- package/workflows/container-contents/remoteHydration/index.js +4 -4
- package/workflows/container-contents/remoteHydration/index.js.map +1 -1
- package/workflows/container-contents/remoteHydration/lanes/childIndex.js.map +1 -0
- package/workflows/container-contents/remoteHydration/lanes/laneFetchMarkers.js +21 -0
- package/workflows/container-contents/remoteHydration/lanes/laneFetchMarkers.js.map +1 -0
- package/workflows/container-contents/remoteHydration/lanes/parentLaneFetch.js +61 -0
- package/workflows/container-contents/remoteHydration/lanes/parentLaneFetch.js.map +1 -0
- package/workflows/container-contents/remoteHydration/lanes/parentLaneQueue.js.map +1 -0
- package/workflows/container-contents/remoteHydration/principalPolicyCache.js +1 -1
- package/workflows/container-contents/remoteHydration/principalPolicyCache.js.map +1 -1
- package/workflows/container-contents/remoteHydration/reattachMetadata.js.map +1 -1
- package/workflows/container-contents/remoteHydration/reconciliation.js +2 -2
- package/workflows/container-contents/remoteHydration/reconciliation.js.map +1 -1
- package/workflows/container-contents/remoteHydration/remoteContainers/containerStateFingerprint.js.map +1 -0
- package/workflows/container-contents/remoteHydration/remoteContainers/insertRemoteContainer.js +135 -0
- package/workflows/container-contents/remoteHydration/remoteContainers/insertRemoteContainer.js.map +1 -0
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js +244 -0
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js.map +1 -0
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js +263 -0
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerState.js.map +1 -0
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerTimestamps.js.map +1 -0
- package/workflows/container-contents/remoteHydration/tombstoneApplication.js +2 -2
- package/workflows/container-contents/remoteHydration/tombstoneApplication.js.map +1 -1
- package/workflows/container-contents/tombstones/documentTombstoneEvidence.js +2 -2
- package/workflows/container-contents/tombstones/documentTombstoneEvidence.js.map +1 -1
- package/workflows/containers/child/create/createProjection.d.ts +6 -0
- package/workflows/containers/child/create/createProjection.js +43 -0
- package/workflows/containers/child/create/createProjection.js.map +1 -0
- package/workflows/containers/child/create/createSubmission.d.ts +56 -0
- package/workflows/containers/child/create/createSubmission.js +43 -0
- package/workflows/containers/child/create/createSubmission.js.map +1 -0
- package/workflows/containers/child/create/index.d.ts +24 -0
- package/workflows/containers/child/create/index.js +335 -0
- package/workflows/containers/child/create/index.js.map +1 -0
- package/workflows/containers/child/move/index.d.ts +23 -0
- package/workflows/containers/child/move/index.js +268 -0
- package/workflows/containers/child/move/index.js.map +1 -0
- package/workflows/containers/child/move/moveArtifacts.js +102 -0
- package/workflows/containers/child/move/moveArtifacts.js.map +1 -0
- package/workflows/containers/child/move/moveRotation.js +88 -0
- package/workflows/containers/child/move/moveRotation.js.map +1 -0
- package/workflows/containers/child/move/moveWraps.js +49 -0
- package/workflows/containers/child/move/moveWraps.js.map +1 -0
- package/workflows/containers/child/mutationSubmit.js +1 -1
- package/workflows/containers/child/mutationSubmit.js.map +1 -1
- package/workflows/containers/child/recite.js +2 -2
- package/workflows/containers/child/recite.js.map +1 -1
- package/workflows/containers/child/rekey/carriedDescendantRekeys.js +126 -0
- package/workflows/containers/child/rekey/carriedDescendantRekeys.js.map +1 -0
- package/workflows/containers/child/rekey/index.d.ts +32 -0
- package/workflows/containers/child/rekey/index.js +227 -0
- package/workflows/containers/child/rekey/index.js.map +1 -0
- package/workflows/containers/child/rekey/keyringOverrideLineage.d.ts +22 -0
- package/workflows/containers/child/rekey/keyringOverrideLineage.js +39 -0
- package/workflows/containers/child/rekey/rekeyProjection.d.ts +46 -0
- package/workflows/containers/child/rekey/rekeyProjection.js +151 -0
- package/workflows/containers/child/rekey/rekeyProjection.js.map +1 -0
- package/workflows/containers/child/rekey/rekeyRemote.d.ts +24 -0
- package/workflows/containers/child/rekey/rekeyRemote.js +64 -0
- package/workflows/containers/child/rekey/rekeyRemote.js.map +1 -0
- package/workflows/containers/child/revoke.js +5 -5
- package/workflows/containers/child/revoke.js.map +1 -1
- package/workflows/containers/child/rotation/replacementPrincipalPolicyReferences.js +19 -0
- package/workflows/containers/child/rotation/replacementPrincipalPolicyReferences.js.map +1 -0
- package/workflows/containers/child/rotation/rotationContext.js +64 -0
- package/workflows/containers/child/rotation/rotationContext.js.map +1 -0
- package/workflows/containers/child/rotation/rotationPrincipalPolicies.js +19 -0
- package/workflows/containers/child/rotation/rotationPrincipalPolicies.js.map +1 -0
- package/workflows/containers/child/rotation/rotationWraps.js +85 -0
- package/workflows/containers/child/rotation/rotationWraps.js.map +1 -0
- package/workflows/containers/child/share/currentShareGrantMutation.js +82 -0
- package/workflows/containers/child/share/currentShareGrantMutation.js.map +1 -0
- package/workflows/containers/child/share/currentSharePrincipalPolicy.js +83 -0
- package/workflows/containers/child/share/currentSharePrincipalPolicy.js.map +1 -0
- package/workflows/containers/child/share/index.d.ts +65 -0
- package/workflows/containers/child/share/index.js +256 -0
- package/workflows/containers/child/share/index.js.map +1 -0
- package/workflows/containers/child/share/runtimeCurrentGroupShare.js +79 -0
- package/workflows/containers/child/share/runtimeCurrentGroupShare.js.map +1 -0
- package/workflows/containers/child/share/shareAncestorRepair.js +95 -0
- package/workflows/containers/child/share/shareAncestorRepair.js.map +1 -0
- package/workflows/containers/child/share/shareMaterialization.d.ts +25 -0
- package/workflows/containers/child/share/shareMaterialization.js +164 -0
- package/workflows/containers/child/share/shareMaterialization.js.map +1 -0
- package/workflows/containers/child/share/sharePlanCore.d.ts +82 -0
- package/workflows/containers/child/share/sharePlanCore.js +191 -0
- package/workflows/containers/child/share/sharePlanCore.js.map +1 -0
- package/workflows/containers/child/share/sharePrincipalPolicy.d.ts +51 -0
- package/workflows/containers/child/share/sharePrincipalPolicy.js +194 -0
- package/workflows/containers/child/share/sharePrincipalPolicy.js.map +1 -0
- package/workflows/containers/child/share/shareProjection.js.map +1 -0
- package/workflows/containers/index.d.ts +13 -13
- package/workflows/containers/index.js +12 -12
- package/workflows/containers/index.js.map +1 -1
- package/workflows/containers/writeRefusal.js +1 -1
- package/workflows/containers/writeRefusal.js.map +1 -1
- package/workflows/documents/create/createAdoption.js +1 -1
- package/workflows/documents/create/createResponse.js +2 -2
- package/workflows/documents/create/createResponse.js.map +1 -1
- package/workflows/documents/create/index.js +1 -1
- package/workflows/documents/documentMutationCommit.d.ts +1 -1
- package/workflows/documents/documentMutationPreparation.d.ts +1 -1
- package/workflows/documents/documentMutationPreparation.js +1 -1
- package/workflows/documents/documentMutationPreparation.js.map +1 -1
- package/workflows/documents/index.d.ts +5 -5
- package/workflows/documents/index.js +5 -5
- package/workflows/documents/index.js.map +1 -1
- package/workflows/documents/linkSet/index.js +2 -2
- package/workflows/documents/linkSet/index.js.map +1 -1
- package/workflows/documents/linkSet/linkSetAuthority.js +2 -2
- package/workflows/documents/linkSet/linkSetAuthority.js.map +1 -1
- package/workflows/documents/linkSet/linkSetBlobRewraps.js +2 -2
- package/workflows/documents/linkSet/linkSetBlobRewraps.js.map +1 -1
- package/workflows/documents/linkSet/linkSetProjectionSeed.js +2 -2
- package/workflows/documents/linkSet/linkSetProjectionSeed.js.map +1 -1
- package/workflows/documents/linkSet/linkSetRemote.js +1 -1
- package/workflows/documents/linkSet/linkSetRemote.js.map +1 -1
- package/workflows/documents/purge/index.js +2 -2
- package/workflows/documents/purge/index.js.map +1 -1
- package/workflows/documents/sync/index.js +2 -2
- package/workflows/documents/sync/index.js.map +1 -1
- package/workflows/documents/sync/initialSync.js +1 -1
- package/workflows/documents/sync/readOnlyProjectionFailure.js +1 -1
- package/workflows/documents/sync/readOnlyProjectionFailure.js.map +1 -1
- package/workflows/documents/sync/readOnlySync.d.ts +3 -3
- package/workflows/documents/sync/readOnlySync.js +1 -1
- package/workflows/documents/sync/readOnlySync.js.map +1 -1
- package/workflows/documents/sync/reportDocumentSyncQuarantine.js.map +1 -1
- package/workflows/documents/sync/syncAttemptPlanning.js +2 -2
- package/workflows/documents/sync/syncAttemptPlanning.js.map +1 -1
- package/workflows/documents/sync/syncAttemptState.d.ts +2 -2
- package/workflows/documents/sync/syncAttemptState.js.map +1 -1
- package/workflows/documents/sync/syncResponseResult.js +2 -2
- package/workflows/documents/sync/syncResponseResult.js.map +1 -1
- package/workflows/documents/syncFailures/index.js +1 -1
- package/workflows/documents/syncFailures/index.js.map +1 -1
- package/workflows/documents/syncFailures/syncAbandon.js.map +1 -1
- package/workflows/documents/syncFailures/syncFailureClassification.js +1 -1
- package/workflows/documents/syncFailures/syncFailureClassification.js.map +1 -1
- package/workflows/documents/syncPlan/syncContentKeys.d.ts +1 -1
- package/workflows/documents/syncPlan/syncContentKeys.js +3 -3
- package/workflows/documents/syncPlan/syncContentKeys.js.map +1 -1
- package/workflows/documents/syncPlan/syncPlanMaterial.js +2 -2
- package/workflows/documents/syncPlan/syncPlanMaterial.js.map +1 -1
- package/workflows/documents/syncRekeys/syncAutomaticContainerRekeys.js +4 -4
- package/workflows/documents/syncRekeys/syncAutomaticContainerRekeys.js.map +1 -1
- package/workflows/documents/syncRekeys/syncContainerRekeyPreparation.js +1 -1
- package/workflows/documents/syncRekeys/syncRecoveryRekey.d.ts +1 -1
- package/workflows/documents/syncRekeys/syncRecoveryRekey.js +1 -1
- package/workflows/organizations/currentOrganizationAuthority.js +2 -2
- package/workflows/organizations/currentOrganizationAuthority.js.map +1 -1
- package/workflows/organizations/groupMetadata/groupMetadataAccess.js +1 -1
- package/workflows/organizations/groupMetadata/groupMetadataAccess.js.map +1 -1
- package/workflows/organizations/groupMetadata/groupMetadataContainerAuthority.js +1 -1
- package/workflows/organizations/groupMetadata/groupMetadataContainerAuthority.js.map +1 -1
- package/workflows/organizations/groupNames/currentOrganizationGroupNames.js +1 -1
- package/workflows/organizations/groupNames/currentOrganizationGroupNames.js.map +1 -1
- package/workflows/organizations/groupNames/groupNameUniqueness.js +3 -3
- package/workflows/organizations/groupNames/groupNameUniqueness.js.map +1 -1
- package/workflows/organizations/groupNames/organizationGroupNamePolicies.js +2 -2
- package/workflows/organizations/groupNames/organizationGroupNamePolicies.js.map +1 -1
- package/workflows/organizations/groupPolicy/currentGroupPolicyMutationContext.js +1 -1
- package/workflows/organizations/groupPolicy/currentGroupPolicyMutationContext.js.map +1 -1
- package/workflows/organizations/groupPolicy/groupPolicyMutationContext.js +2 -2
- package/workflows/organizations/groupPolicy/groupPolicyMutationContext.js.map +1 -1
- package/workflows/organizations/groupPolicy/groupPolicyMutationEvidence.js +1 -1
- package/workflows/organizations/groupPolicy/groupPolicyMutationEvidence.js.map +1 -1
- package/workflows/organizations/groupPolicy/groupPolicyVerification.js +1 -1
- package/workflows/organizations/groupPolicy/groupPolicyVerification.js.map +1 -1
- package/workflows/organizations/groups/createCurrentOrganizationGroup.js +1 -1
- package/workflows/organizations/groups/createCurrentOrganizationGroup.js.map +1 -1
- package/workflows/organizations/groups/deleteOrganizationGroup.js +1 -1
- package/workflows/organizations/groups/deleteOrganizationGroup.js.map +1 -1
- package/workflows/organizations/groups/organizationGroupDirectory.js +1 -1
- package/workflows/organizations/groups/organizationGroupDirectory.js.map +1 -1
- package/workflows/organizations/principalMutations/runtimeCurrentOrganizationMutation.js +1 -1
- package/workflows/organizations/principalMutations/runtimeCurrentOrganizationMutation.js.map +1 -1
- package/workflows/organizations/provisioning/organizationReplacementVerification.js +1 -1
- package/workflows/organizations/provisioning/organizationReplacementVerification.js.map +1 -1
- package/workflows/organizations/readModel/listLocalOrganizations.js +1 -1
- package/workflows/organizations/readModel/localReadModelDetails.js +1 -1
- package/workflows/organizations/readModel/localReadModelDetails.js.map +1 -1
- package/workflows/organizations/rematerialization/precedingPrincipalRematerialization.js +1 -1
- package/workflows/organizations/rematerialization/precedingPrincipalRematerialization.js.map +1 -1
- package/workflows/organizations/rematerialization/principalContainerRematerialization.js +5 -5
- package/workflows/organizations/rematerialization/principalContainerRematerialization.js.map +1 -1
- package/workflows/organizations/rematerialization/principalContainerRematerializationPlanning.js +1 -1
- package/workflows/organizations/rematerialization/principalContainerRematerializationPlanning.js.map +1 -1
- package/workflows/organizations/rematerialization/principalContainerRematerializationTargets.js +1 -1
- package/workflows/organizations/rematerialization/principalContainerRematerializationTargets.js.map +1 -1
- package/workflows/principals/acknowledgements/acknowledgedPrincipalCurrents.js +1 -1
- package/workflows/principals/acknowledgements/acknowledgedPrincipalCurrents.js.map +1 -1
- package/workflows/principals/acknowledgements/acknowledgedPrincipalPredecessor.d.ts +1 -1
- package/workflows/principals/acknowledgements/acknowledgedPrincipalPredecessor.js +1 -1
- package/workflows/principals/acknowledgements/acknowledgedPrincipalPredecessor.js.map +1 -1
- package/workflows/principals/acknowledgements/initialPrincipalCurrentPublication.js +1 -1
- package/workflows/principals/acknowledgements/initialPrincipalCurrentPublication.js.map +1 -1
- package/workflows/principals/acknowledgements/reconcileAcknowledgedPrincipalCurrent.js +2 -2
- package/workflows/principals/acknowledgements/reconcileAcknowledgedPrincipalCurrent.js.map +1 -1
- package/workflows/principals/externalAdminPolicy.js +2 -2
- package/workflows/principals/externalAdminPolicy.js.map +1 -1
- package/workflows/principals/historyRecovery/loadRecoveredPrincipalHistoryPage.js +2 -2
- package/workflows/principals/historyRecovery/loadRecoveredPrincipalHistoryPage.js.map +1 -1
- package/workflows/principals/historyRecovery/principalHistoryRecoveryPrefix.js +1 -1
- package/workflows/principals/historyRecovery/principalHistoryRecoveryPrefix.js.map +1 -1
- package/workflows/principals/historyRecovery/principalHistoryRecoveryReferences.js +1 -1
- package/workflows/principals/historyRecovery/principalHistoryRecoveryReferences.js.map +1 -1
- package/workflows/principals/historyRecovery/principalHistoryRecoveryStage.js +1 -1
- package/workflows/principals/historyRecovery/principalHistoryRecoveryStage.js.map +1 -1
- package/workflows/principals/historyRecovery/recoverPrincipalPolicyHistory.js +3 -3
- package/workflows/principals/historyRecovery/recoverPrincipalPolicyHistory.js.map +1 -1
- package/workflows/principals/policyCache/index.js +4 -4
- package/workflows/principals/policyCache/index.js.map +1 -1
- package/workflows/principals/policyCache/principalPolicyCacheAdvance.js +1 -1
- package/workflows/principals/policyCache/principalPolicyCacheAdvance.js.map +1 -1
- package/workflows/principals/policyCache/principalPolicyOrganizationScope.js +3 -3
- package/workflows/principals/policyCache/principalPolicyOrganizationScope.js.map +1 -1
- package/workflows/principals/policyRepair.js +1 -1
- package/workflows/principals/policyRepair.js.map +1 -1
- package/workflows/principals/publicHistory/publicPrincipalHistoryAuthority.js.map +1 -1
- package/workflows/principals/publicHistory/publicPrincipalHistoryPage.js +2 -2
- package/workflows/principals/publicHistory/publicPrincipalHistoryPage.js.map +1 -1
- package/workflows/principals/publicHistory/publicPrincipalHistoryProgress.js +3 -3
- package/workflows/principals/publicHistory/publicPrincipalHistoryProgress.js.map +1 -1
- package/workflows/principals/publicHistory/publicPrincipalHistoryTypes.d.ts +2 -2
- package/workflows/principals/publicHistory/publicPrincipalHistoryTypes.js.map +1 -1
- package/workflows/principals/publicHistory/publicProjectionPrincipal.js +1 -1
- package/workflows/principals/publicHistory/publicProjectionPrincipal.js.map +1 -1
- package/workflows/principals/publicHistory/recoverPublicPrincipalHistory.js +1 -1
- package/workflows/principals/publicHistory/recoverPublicPrincipalHistory.js.map +1 -1
- package/workflows/principals/publicHistory/selectPublicPrincipalHistory.js +1 -1
- package/workflows/principals/publicHistory/selectPublicPrincipalHistory.js.map +1 -1
- package/workflows/principals/recoveryOperation/principalRecoveryDirectory.js +1 -1
- package/workflows/principals/recoveryOperation/principalRecoveryDirectory.js.map +1 -1
- package/workflows/principals/recoveryOperation/principalRecoveryMemoValidity.js +1 -1
- package/workflows/principals/recoveryOperation/principalRecoveryMemoValidity.js.map +1 -1
- package/workflows/registration/organizationProvisioningArtifacts.d.ts +1 -1
- package/workflows/registration/persistRegistrationBootstrap.d.ts +2 -2
- package/workflows/registration/persistRegistrationBootstrap.js +2 -2
- package/workflows/registration/persistRegistrationBootstrap.js.map +1 -1
- package/workflows/registration/provisioningAcknowledgement.js +1 -1
- package/workflows/registration/provisioningAcknowledgement.js.map +1 -1
- package/workflows/registration/provisioningBootstrapBuilders.js +1 -1
- package/workflows/registration/registrationPrincipalPolicyPersistence.js +1 -1
- package/workflows/registration/registrationPrincipalPolicyPersistence.js.map +1 -1
- package/workflows/sync/remoteReset.js +7 -7
- package/workflows/sync/remoteReset.js.map +1 -1
- package/workflows/sync/remoteResetAttachments.js +1 -1
- package/workflows/sync/remoteResetCursorScope.js +1 -1
- package/workflows/sync/remoteResetPlans.js +1 -1
- package/workflows/sync/remoteResetPrincipalScope.js +5 -5
- package/workflows/sync/remoteResetPrincipalScope.js.map +1 -1
- package/workflows/sync/remoteResetScope.js +1 -1
- package/data/documents/shared/containerKekCurrency.d.ts +0 -22
- package/data/documents/shared/containerKekEntryVerification.js +0 -15
- package/data/documents/shared/containerKekLogFetch.d.ts +0 -18
- package/data/documents/shared/containerKekLogFetch.js +0 -76
- package/data/documents/shared/containerKekPath.js +0 -265
- package/data/documents/shared/containerKekPath.js.map +0 -1
- package/data/documents/shared/containerKekPathHistory.d.ts +0 -61
- package/data/documents/shared/containerKekPathHistory.js +0 -223
- package/data/documents/shared/containerKekPathHistory.js.map +0 -1
- package/data/documents/shared/containerKekPathVerification.d.ts +0 -15
- package/data/documents/shared/containerKekPathVerification.js +0 -23
- package/data/documents/shared/containerKekPathVerification.js.map +0 -1
- package/data/documents/shared/containerKekWrapping.js +0 -61
- package/data/documents/shared/containerKekWrapping.js.map +0 -1
- package/data/documents/shared/documentSyncUpdateDecryption.js +0 -238
- package/data/documents/shared/documentSyncUpdateDecryption.js.map +0 -1
- package/data/documents/shared/documentSyncUpdateIsolation.d.ts +0 -55
- package/data/documents/shared/documentSyncUpdateIsolation.js +0 -298
- package/data/documents/shared/documentSyncUpdateIsolation.js.map +0 -1
- package/data/documents/shared/keyringLogWalk.d.ts +0 -45
- package/data/documents/shared/keyringLogWalk.js +0 -204
- package/data/documents/shared/keyringRebuild.d.ts +0 -60
- package/data/documents/shared/keyringRebuild.js +0 -242
- package/data/documents/shared/keyringRebuild.js.map +0 -1
- package/data/documents/shared/mutationAcknowledgement.js +0 -10
- package/data/documents/shared/mutationAcknowledgement.js.map +0 -1
- package/data/documents/shared/projection.d.ts +0 -25
- package/data/documents/shared/projection.js +0 -132
- package/data/documents/shared/projection.js.map +0 -1
- package/data/documents/shared/projectionContentKeys.d.ts +0 -90
- package/data/documents/shared/projectionContentKeys.js +0 -262
- package/data/documents/shared/projectionContentKeys.js.map +0 -1
- package/data/documents/shared/projectionTargets.d.ts +0 -38
- package/data/documents/shared/projectionTargets.js +0 -164
- package/data/documents/shared/projectionTargets.js.map +0 -1
- package/data/documents/shared/pullContinuation.js +0 -53
- package/data/documents/shared/syncPagination.d.ts +0 -20
- package/data/documents/shared/syncPagination.js +0 -109
- package/data/documents/shared/syncPagination.js.map +0 -1
- package/data/documents/shared/syncResponseAuthorization.js +0 -63
- package/data/documents/shared/syncResponseAuthorization.js.map +0 -1
- package/data/documents/shared/syncResponses.d.ts +0 -11
- package/data/documents/shared/syncResponses.js +0 -285
- package/data/documents/shared/syncResponses.js.map +0 -1
- package/data/documents/shared/syncSubmitFailure.d.ts +0 -9
- package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js +0 -61
- package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js.map +0 -1
- package/data/keyingProjectionVerification/bundleVerification.js +0 -61
- package/data/keyingProjectionVerification/bundleVerification.js.map +0 -1
- package/data/keyingProjectionVerification/checkpointContext.d.ts +0 -45
- package/data/keyingProjectionVerification/checkpointContext.js +0 -120
- package/data/keyingProjectionVerification/checkpointContext.js.map +0 -1
- package/data/keyingProjectionVerification/containerAncestorCitations.js +0 -164
- package/data/keyingProjectionVerification/containerAncestorCitations.js.map +0 -1
- package/data/keyingProjectionVerification/containerCreateManifest.js +0 -28
- package/data/keyingProjectionVerification/containerDestinationVerification.js +0 -51
- package/data/keyingProjectionVerification/containerDestinationVerification.js.map +0 -1
- package/data/keyingProjectionVerification/containerManifestVerification.js +0 -285
- package/data/keyingProjectionVerification/containerManifestVerification.js.map +0 -1
- package/data/keyingProjectionVerification/containerPathVerification.js +0 -51
- package/data/keyingProjectionVerification/containerPathVerification.js.map +0 -1
- package/data/keyingProjectionVerification/containerProjectionVerification.d.ts +0 -25
- package/data/keyingProjectionVerification/containerProjectionVerification.js +0 -254
- package/data/keyingProjectionVerification/containerProjectionVerification.js.map +0 -1
- package/data/keyingProjectionVerification/documentDependencyPaths.d.ts +0 -17
- package/data/keyingProjectionVerification/documentDependencyPaths.js +0 -70
- package/data/keyingProjectionVerification/documentDependencyPaths.js.map +0 -1
- package/data/keyingProjectionVerification/documentManifestPolicies.js +0 -32
- package/data/keyingProjectionVerification/documentManifestPolicies.js.map +0 -1
- package/data/keyingProjectionVerification/documentManifestPredecessor.js +0 -12
- package/data/keyingProjectionVerification/documentManifestVerification.js +0 -135
- package/data/keyingProjectionVerification/documentManifestVerification.js.map +0 -1
- package/data/keyingProjectionVerification/documentProjectionVerification.d.ts +0 -24
- package/data/keyingProjectionVerification/documentProjectionVerification.js +0 -172
- package/data/keyingProjectionVerification/documentProjectionVerification.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgeCheckpointCurrency.js +0 -100
- package/data/keyingProjectionVerification/documentPurgeCheckpointCurrency.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgeCheckpointEnforcement.js +0 -8
- package/data/keyingProjectionVerification/documentPurgeCheckpointEnforcement.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgeDocumentChainVerification.js +0 -177
- package/data/keyingProjectionVerification/documentPurgeDocumentChainVerification.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgePolicyCheckpoints.js +0 -17
- package/data/keyingProjectionVerification/documentPurgePolicyCheckpoints.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgePolicyCurrency.js +0 -55
- package/data/keyingProjectionVerification/documentPurgePolicyCurrency.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgePrincipalEvidence.js +0 -116
- package/data/keyingProjectionVerification/documentPurgePrincipalEvidence.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgeProofVerification.d.ts +0 -34
- package/data/keyingProjectionVerification/documentPurgeProofVerification.js +0 -208
- package/data/keyingProjectionVerification/documentPurgeProofVerification.js.map +0 -1
- package/data/keyingProjectionVerification/manifestCheckpointVerification.js +0 -64
- package/data/keyingProjectionVerification/manifestCheckpointVerification.js.map +0 -1
- package/data/keyingProjectionVerification/mergeProjectionPolicyEvidence.js +0 -45
- package/data/keyingProjectionVerification/mergeProjectionPolicyEvidence.js.map +0 -1
- package/data/keyingProjectionVerification/organizationFounderBinding.js +0 -41
- package/data/keyingProjectionVerification/organizationFounderBinding.js.map +0 -1
- package/data/keyingProjectionVerification/principalPolicyCache.js +0 -76
- package/data/keyingProjectionVerification/principalPolicyCache.js.map +0 -1
- package/data/keyingProjectionVerification/principalPolicyVerification.js +0 -252
- package/data/keyingProjectionVerification/principalPolicyVerification.js.map +0 -1
- package/data/keyingProjectionVerification/projectionAuthorizationEvidence.js +0 -63
- package/data/keyingProjectionVerification/projectionAuthorizationEvidence.js.map +0 -1
- package/data/keyingProjectionVerification/projectionPolicyEvidence.js +0 -23
- package/data/keyingProjectionVerification/projectionPolicyEvidence.js.map +0 -1
- package/data/keyingProjectionVerification/resolvedPrincipalPolicy.js +0 -72
- package/data/keyingProjectionVerification/resolvedPrincipalPolicy.js.map +0 -1
- package/data/persistence/documentPurgeCheckpointPersistence.d.ts +0 -10
- package/data/persistence/documentPurgeCheckpointPersistence.js +0 -43
- package/data/persistence/documentPurgeCheckpointPersistence.js.map +0 -1
- package/data/persistence/keyingCheckpointAdvancePersistence.js +0 -222
- package/data/persistence/keyingCheckpointAdvancePersistence.js.map +0 -1
- package/data/persistence/keyingCheckpointEvidence.js +0 -32
- package/data/persistence/keyingCheckpointPersistence.js +0 -133
- package/data/persistence/keyingCheckpointPersistence.js.map +0 -1
- package/data/persistence/locallyAcknowledgedCheckpointPersistence.d.ts +0 -53
- package/data/persistence/locallyAcknowledgedCheckpointPersistence.js +0 -167
- package/data/persistence/locallyAcknowledgedCheckpointPersistence.js.map +0 -1
- package/data/persistence/organizationReplacementCheckpointPersistence.js +0 -72
- package/data/persistence/organizationReplacementCheckpointPersistence.js.map +0 -1
- package/data/persistence/principalAuthorizationCheckpoints.js +0 -29
- package/data/persistence/principalAuthorizationCheckpoints.js.map +0 -1
- package/data/persistence/principalGrantRetirementPersistence.d.ts +0 -9
- package/data/persistence/principalGrantRetirementPersistence.js +0 -43
- package/data/persistence/principalGrantRetirementPersistence.js.map +0 -1
- package/data/persistence/principalHistoryEvidencePersistence.d.ts +0 -32
- package/data/persistence/principalHistoryEvidencePersistence.js +0 -92
- package/data/persistence/principalHistoryEvidencePersistence.js.map +0 -1
- package/data/persistence/principalHistoryIncompleteRetention.js +0 -26
- package/data/persistence/principalHistoryIncompleteRetention.js.map +0 -1
- package/data/persistence/principalHistoryNodeRetention.js +0 -201
- package/data/persistence/principalHistoryNodeRetention.js.map +0 -1
- package/data/persistence/principalHistoryPrefixPersistence.d.ts +0 -29
- package/data/persistence/principalHistoryPrefixPersistence.js +0 -102
- package/data/persistence/principalHistoryPrefixPersistence.js.map +0 -1
- package/data/persistence/principalHistoryRootOwnership.js +0 -71
- package/data/persistence/principalHistoryRootOwnership.js.map +0 -1
- package/data/persistence/principalHistoryStagePersistence.d.ts +0 -15
- package/data/persistence/principalHistoryStagePersistence.js +0 -96
- package/data/persistence/principalHistoryStagePersistence.js.map +0 -1
- package/data/persistence/principalHistoryStageRetention.js +0 -45
- package/data/persistence/principalHistoryStageRetention.js.map +0 -1
- package/data/persistence/principalHistoryUnpublishedRetention.js +0 -64
- package/data/persistence/principalHistoryUnpublishedRetention.js.map +0 -1
- package/data/persistence/principalKeyEnvelopeArchivePersistence.js +0 -63
- package/data/persistence/principalKeyEnvelopeArchivePersistence.js.map +0 -1
- package/data/persistence/principalKeyEnvelopeCandidates.js +0 -87
- package/data/persistence/principalKeyEnvelopeCandidates.js.map +0 -1
- package/data/persistence/principalPolicyBundleIntegrity.js +0 -49
- package/data/persistence/principalPolicyBundleIntegrity.js.map +0 -1
- package/data/persistence/principalPolicyCheckpointSelection.js +0 -26
- package/data/persistence/principalPolicyCheckpointSelection.js.map +0 -1
- package/data/persistence/principalPolicyOrganizationPersistence.js +0 -42
- package/data/persistence/principalPolicyOrganizationPersistence.js.map +0 -1
- package/data/persistence/principalPolicyPersistence.js +0 -279
- package/data/persistence/principalPolicyPersistence.js.map +0 -1
- package/data/persistence/principalPolicyReferenceCheckpoint.js +0 -27
- package/data/persistence/principalPolicyReferenceCheckpoint.js.map +0 -1
- package/data/persistence/principalPolicyReferenceIndexPersistence.js +0 -115
- package/data/persistence/principalPolicyReferenceIndexPersistence.js.map +0 -1
- package/data/persistence/principalPolicyReferencePersistence.js +0 -215
- package/data/persistence/principalPolicyReferencePersistence.js.map +0 -1
- package/data/persistence/verifiedPrincipalPolicyBundle.js +0 -33
- package/data/persistence/verifiedPrincipalPolicyBundle.js.map +0 -1
- package/data/persistence/verifiedPrincipalPolicyCurrent.js +0 -56
- package/data/persistence/verifiedPrincipalPolicyCurrent.js.map +0 -1
- package/data/persistence/verifiedPrincipalPolicyRetentionPersistence.js +0 -18
- package/data/persistence/verifiedPrincipalPolicyRetentionPersistence.js.map +0 -1
- package/data/sqlite/containerSchema.d.ts +0 -1193
- package/data/sqlite/containerSchema.js +0 -103
- package/data/sqlite/containerSchema.js.map +0 -1
- package/data/sqlite/documentHistoryPersistence.d.ts +0 -86
- package/data/sqlite/documentHistoryPersistence.js +0 -304
- package/data/sqlite/documentHistoryPersistence.js.map +0 -1
- package/data/sqlite/documentOrphanBlobReclaims.js +0 -6
- package/data/sqlite/documentOrphanBlobReclaims.js.map +0 -1
- package/data/sqlite/documentPendingUpdatePersistence.d.ts +0 -103
- package/data/sqlite/documentPendingUpdatePersistence.js +0 -243
- package/data/sqlite/documentPendingUpdatePersistence.js.map +0 -1
- package/data/sqlite/documentPersistence.d.ts +0 -22
- package/data/sqlite/documentPersistence.js +0 -35
- package/data/sqlite/documentPersistence.js.map +0 -1
- package/data/sqlite/documentPersistenceTypes.d.ts +0 -79
- package/data/sqlite/documentPersistenceTypes.js.map +0 -1
- package/data/sqlite/documentRecordPersistence.d.ts +0 -275
- package/data/sqlite/documentRecordPersistence.js +0 -103
- package/data/sqlite/documentRecordPersistence.js.map +0 -1
- package/data/sqlite/documentSyncFailurePersistence.d.ts +0 -39
- package/data/sqlite/documentSyncFailurePersistence.js +0 -81
- package/data/sqlite/documentSyncFailurePersistence.js.map +0 -1
- package/data/sqlite/organizationDataUsageSchema.js +0 -34
- package/data/sqlite/organizationDataUsageSchema.js.map +0 -1
- package/data/sqlite/organizationProvisioningAttemptSchema.js +0 -23
- package/data/sqlite/organizationProvisioningAttemptSchema.js.map +0 -1
- package/data/sqlite/organizationReadModelTableRegistry.d.ts +0 -1332
- package/data/sqlite/organizationReadModelTableRegistry.js +0 -31
- package/data/sqlite/organizationReadModelTableRegistry.js.map +0 -1
- package/data/sqlite/principalHistoryEvidenceSchema.d.ts +0 -308
- package/data/sqlite/principalHistoryEvidenceSchema.js +0 -48
- package/data/sqlite/principalHistoryEvidenceSchema.js.map +0 -1
- package/data/sqlite/principalHistoryNodeRetentionSchema.js +0 -30
- package/data/sqlite/principalHistoryNodeRetentionSchema.js.map +0 -1
- package/data/sqlite/principalHistoryRetentionSchema.js +0 -25
- package/data/sqlite/principalHistoryRetentionSchema.js.map +0 -1
- package/data/sqlite/principalHistoryStageSchema.d.ts +0 -161
- package/data/sqlite/principalHistoryStageSchema.js +0 -34
- package/data/sqlite/principalHistoryStageSchema.js.map +0 -1
- package/data/sqlite/principalMutationJournalSchema.d.ts +0 -85
- package/data/sqlite/principalMutationJournalSchema.js +0 -13
- package/data/sqlite/principalMutationJournalSchema.js.map +0 -1
- package/data/sqlite/principalPolicySchema.js +0 -72
- package/data/sqlite/principalPolicySchema.js.map +0 -1
- package/data/sqlite/schema.d.ts +0 -8055
- package/data/sqlite/schema.js +0 -525
- package/data/sqlite/schema.js.map +0 -1
- package/data/sqlite/securityIncidentSchema.d.ts +0 -224
- package/data/sqlite/securityIncidentSchema.js +0 -28
- package/data/sqlite/securityIncidentSchema.js.map +0 -1
- package/data/sqlite/verifiedManifestBundleSchema.d.ts +0 -174
- package/data/sqlite/verifiedManifestBundleSchema.js +0 -36
- package/data/sqlite/verifiedManifestBundleSchema.js.map +0 -1
- package/stores/container-contents/backgroundHydration.js +0 -32
- package/stores/container-contents/backgroundHydration.js.map +0 -1
- package/stores/container-contents/containerPurgeCore.js +0 -98
- package/stores/container-contents/containerPurgeCore.js.map +0 -1
- package/stores/container-contents/containerStateMap.js.map +0 -1
- package/stores/container-contents/containerStatePersistence.js +0 -57
- package/stores/container-contents/containerStatePersistence.js.map +0 -1
- package/stores/container-contents/documentRecovery.js +0 -114
- package/stores/container-contents/documentRecovery.js.map +0 -1
- package/stores/container-contents/documentRotation.js +0 -13
- package/stores/container-contents/documentRotation.js.map +0 -1
- package/stores/container-contents/documentWork.js +0 -29
- package/stores/container-contents/documentWork.js.map +0 -1
- package/stores/container-contents/emptyTrashOperation.js.map +0 -1
- package/stores/container-contents/existingSystemContainer.js +0 -58
- package/stores/container-contents/existingSystemContainer.js.map +0 -1
- package/stores/container-contents/groupRewrapOperation.js +0 -52
- package/stores/container-contents/groupRewrapOperation.js.map +0 -1
- package/stores/container-contents/metadataSyncSignal.js +0 -37
- package/stores/container-contents/metadataSyncSignal.js.map +0 -1
- package/stores/container-contents/missingContainerState.js +0 -10
- package/stores/container-contents/missingContainerState.js.map +0 -1
- package/stores/container-contents/missingSyncedContainerState.js.map +0 -1
- package/stores/container-contents/operations.js +0 -301
- package/stores/container-contents/operations.js.map +0 -1
- package/stores/container-contents/organizationMetadataSystemContainer.js +0 -44
- package/stores/container-contents/organizationMetadataSystemContainer.js.map +0 -1
- package/stores/container-contents/purgeContainerOperation.js.map +0 -1
- package/stores/container-contents/reconcilableContainer.d.ts +0 -48
- package/stores/container-contents/reconcilableContainer.js.map +0 -1
- package/stores/container-contents/remoteBackedContainerState.js.map +0 -1
- package/stores/container-contents/remoteContainerIngestion.js +0 -59
- package/stores/container-contents/remoteContainerIngestion.js.map +0 -1
- package/stores/container-contents/remoteEventProjectionInvalidation.js +0 -36
- package/stores/container-contents/remoteEventProjectionInvalidation.js.map +0 -1
- package/stores/container-contents/remoteEventSync.js +0 -38
- package/stores/container-contents/remoteEventSync.js.map +0 -1
- package/stores/container-contents/remoteHydrationRequest.js +0 -245
- package/stores/container-contents/remoteHydrationRequest.js.map +0 -1
- package/stores/container-contents/remoteWriteGuards.js +0 -54
- package/stores/container-contents/remoteWriteGuards.js.map +0 -1
- package/stores/container-contents/remoteWriteQueue.js +0 -51
- package/stores/container-contents/remoteWriteQueue.js.map +0 -1
- package/stores/container-contents/reportShareFailure.js +0 -44
- package/stores/container-contents/reportShareFailure.js.map +0 -1
- package/stores/container-contents/setContainerIconOperation.js +0 -47
- package/stores/container-contents/setContainerIconOperation.js.map +0 -1
- package/stores/container-contents/shareOperations.js +0 -90
- package/stores/container-contents/shareOperations.js.map +0 -1
- package/stores/container-contents/startupHydration.js +0 -110
- package/stores/container-contents/startupHydration.js.map +0 -1
- package/stores/container-contents/syncAgent.d.ts +0 -8
- package/stores/container-contents/syncAgent.js +0 -241
- package/stores/container-contents/syncAgent.js.map +0 -1
- package/stores/container-contents/syncAgentTypes.d.ts +0 -81
- package/stores/container-contents/syncAgentTypes.js.map +0 -1
- package/stores/container-contents/syncLaneIteration.js +0 -237
- package/stores/container-contents/syncLaneIteration.js.map +0 -1
- package/stores/container-contents/systemContainerHydration.js +0 -30
- package/stores/container-contents/systemContainerHydration.js.map +0 -1
- package/stores/container-contents/systemContainerIcon.js +0 -42
- package/stores/container-contents/systemContainerIcon.js.map +0 -1
- package/stores/container-contents/systemContainerLookup.js.map +0 -1
- package/stores/container-contents/systemContainerPostCreate.js +0 -109
- package/stores/container-contents/systemContainerPostCreate.js.map +0 -1
- package/stores/container-contents/systemContainerPromotion.js +0 -49
- package/stores/container-contents/systemContainerPromotion.js.map +0 -1
- package/stores/container-contents/writeGeneration.js.map +0 -1
- package/stores/documents/documentStore/attachmentDetachState.js +0 -54
- package/stores/documents/documentStore/attachmentDetachState.js.map +0 -1
- package/stores/documents/documentStore/attachmentHydration.js +0 -90
- package/stores/documents/documentStore/attachmentHydration.js.map +0 -1
- package/stores/documents/documentStore/attachmentHydrationCommit.js +0 -53
- package/stores/documents/documentStore/attachmentHydrationCommit.js.map +0 -1
- package/stores/documents/documentStore/attachmentIntents.js +0 -39
- package/stores/documents/documentStore/attachmentIntents.js.map +0 -1
- package/stores/documents/documentStore/attachmentMutationPersistence.js +0 -37
- package/stores/documents/documentStore/attachmentMutationPersistence.js.map +0 -1
- package/stores/documents/documentStore/attachmentPersistFollowup.js.map +0 -1
- package/stores/documents/documentStore/attachmentPersistence.js +0 -106
- package/stores/documents/documentStore/attachmentPersistence.js.map +0 -1
- package/stores/documents/documentStore/attachmentRemoval.js +0 -136
- package/stores/documents/documentStore/attachmentRemoval.js.map +0 -1
- package/stores/documents/documentStore/attachmentSnapshot.js.map +0 -1
- package/stores/documents/documentStore/attachmentSourceUpload.js +0 -39
- package/stores/documents/documentStore/attachmentSourceUpload.js.map +0 -1
- package/stores/documents/documentStore/attachmentStaging.js +0 -84
- package/stores/documents/documentStore/attachmentStaging.js.map +0 -1
- package/stores/documents/documentStore/attachmentUploadAttempt.js +0 -97
- package/stores/documents/documentStore/attachmentUploadAttempt.js.map +0 -1
- package/stores/documents/documentStore/attachmentUploadLane.js +0 -49
- package/stores/documents/documentStore/attachmentUploadLane.js.map +0 -1
- package/stores/documents/documentStore/attachmentUploadResume.js +0 -95
- package/stores/documents/documentStore/attachmentUploadResume.js.map +0 -1
- package/stores/documents/documentStore/attachmentWriteGeneration.js +0 -32
- package/stores/documents/documentStore/attachmentWriteGeneration.js.map +0 -1
- package/stores/documents/documentStore/attachments.js +0 -241
- package/stores/documents/documentStore/attachments.js.map +0 -1
- package/stores/documents/documentStore/deferredInitialUpdate.js +0 -116
- package/stores/documents/documentStore/deferredInitialUpdate.js.map +0 -1
- package/stores/documents/documentStore/documentHistoryCompaction.js +0 -67
- package/stores/documents/documentStore/documentHistoryCompaction.js.map +0 -1
- package/stores/documents/documentStore/durableDocumentReload.js +0 -79
- package/stores/documents/documentStore/durableDocumentReload.js.map +0 -1
- package/stores/documents/documentStore/historyRebuild.js +0 -75
- package/stores/documents/documentStore/historyRebuild.js.map +0 -1
- package/stores/documents/documentStore/initialization.js +0 -330
- package/stores/documents/documentStore/initialization.js.map +0 -1
- package/stores/documents/documentStore/initializationAttachments.js +0 -9
- package/stores/documents/documentStore/initializationAttachments.js.map +0 -1
- package/stores/documents/documentStore/initializationHistory.js +0 -33
- package/stores/documents/documentStore/initializationHistory.js.map +0 -1
- package/stores/documents/documentStore/initializationRecovery.js +0 -107
- package/stores/documents/documentStore/initializationRecovery.js.map +0 -1
- package/stores/documents/documentStore/pullContinuationInvalidation.js +0 -61
- package/stores/documents/documentStore/pullContinuationInvalidation.js.map +0 -1
- package/stores/documents/documentStore/remoteRevalidationTelemetry.js +0 -15
- package/stores/documents/documentStore/remoteRevalidationTelemetry.js.map +0 -1
- package/stores/documents/documentStore/remoteWork.js.map +0 -1
- package/stores/documents/documentStore/rotation.js +0 -307
- package/stores/documents/documentStore/rotation.js.map +0 -1
- package/stores/documents/documentStore/rotationProvenance.js +0 -52
- package/stores/documents/documentStore/rotationProvenance.js.map +0 -1
- package/stores/documents/documentStore/rotationSettlement.js +0 -222
- package/stores/documents/documentStore/rotationSettlement.js.map +0 -1
- package/stores/documents/documentStore/sync.js +0 -299
- package/stores/documents/documentStore/sync.js.map +0 -1
- package/stores/documents/documentStore/syncAcceptedUpdateIds.js.map +0 -1
- package/stores/documents/documentStore/syncAttachmentSettlement.js +0 -72
- package/stores/documents/documentStore/syncAttachmentSettlement.js.map +0 -1
- package/stores/documents/documentStore/syncAttachments.js +0 -323
- package/stores/documents/documentStore/syncAttachments.js.map +0 -1
- package/stores/documents/documentStore/syncDetachedAttachments.js +0 -129
- package/stores/documents/documentStore/syncDetachedAttachments.js.map +0 -1
- package/stores/documents/documentStore/syncFinalize.js +0 -204
- package/stores/documents/documentStore/syncFinalize.js.map +0 -1
- package/stores/documents/documentStore/syncGeneration.js.map +0 -1
- package/stores/documents/documentStore/syncOutgoingCoverage.js +0 -96
- package/stores/documents/documentStore/syncOutgoingCoverage.js.map +0 -1
- package/stores/documents/documentStore/syncRemoteSignals.js +0 -67
- package/stores/documents/documentStore/syncRemoteSignals.js.map +0 -1
- package/stores/documents/documentStore/syncRequest.js +0 -157
- package/stores/documents/documentStore/syncRequest.js.map +0 -1
- package/stores/documents/documentStore/syncShared.js +0 -211
- package/stores/documents/documentStore/syncShared.js.map +0 -1
- package/stores/documents/documentStore/syncUpdateImport.js +0 -62
- package/stores/documents/documentStore/syncUpdateImport.js.map +0 -1
- package/stores/documents/documentStore/versionCoverage.js +0 -45
- package/stores/documents/documentStore.d.ts +0 -8
- package/stores/documents/documentStore.js +0 -215
- package/stores/documents/documentStore.js.map +0 -1
- package/workflows/container-contents/container-state/createAdoption.js +0 -193
- package/workflows/container-contents/container-state/createAdoption.js.map +0 -1
- package/workflows/container-contents/container-state/createChild.js +0 -217
- package/workflows/container-contents/container-state/createChild.js.map +0 -1
- package/workflows/container-contents/container-state/createIntentDepth.js +0 -36
- package/workflows/container-contents/container-state/createIntentDepth.js.map +0 -1
- package/workflows/container-contents/container-state/createIntentSettlement.js.map +0 -1
- package/workflows/container-contents/container-state/createIntentSync.js +0 -354
- package/workflows/container-contents/container-state/createIntentSync.js.map +0 -1
- package/workflows/container-contents/container-state/createTerminalFailure.js +0 -19
- package/workflows/container-contents/container-state/createTerminalFailure.js.map +0 -1
- package/workflows/container-contents/container-state/createWithMetadata.js +0 -270
- package/workflows/container-contents/container-state/createWithMetadata.js.map +0 -1
- package/workflows/container-contents/container-state/createWithMetadataPlan.js +0 -68
- package/workflows/container-contents/container-state/createWithMetadataPlan.js.map +0 -1
- package/workflows/container-contents/container-state/groupGrantVerification.js +0 -71
- package/workflows/container-contents/container-state/groupGrantVerification.js.map +0 -1
- package/workflows/container-contents/container-state/groupShareEpoch.js +0 -16
- package/workflows/container-contents/container-state/groupShareEpoch.js.map +0 -1
- package/workflows/container-contents/container-state/localPurgeScope.js +0 -49
- package/workflows/container-contents/container-state/localPurgeScope.js.map +0 -1
- package/workflows/container-contents/container-state/purgeTree.js +0 -298
- package/workflows/container-contents/container-state/purgeTree.js.map +0 -1
- package/workflows/container-contents/container-state/purgeTreeCollection.js.map +0 -1
- package/workflows/container-contents/container-state/purgeTreeContainerDeletion.js +0 -75
- package/workflows/container-contents/container-state/purgeTreeContainerDeletion.js.map +0 -1
- package/workflows/container-contents/container-state/purgeTreeScope.js +0 -175
- package/workflows/container-contents/container-state/purgeTreeScope.js.map +0 -1
- package/workflows/container-contents/container-state/readLocalPurgeScope.js +0 -18
- package/workflows/container-contents/container-state/readLocalPurgeScope.js.map +0 -1
- package/workflows/container-contents/container-state/share.js +0 -283
- package/workflows/container-contents/container-state/share.js.map +0 -1
- package/workflows/container-contents/container-state/sharePersistence.js +0 -136
- package/workflows/container-contents/container-state/sharePersistence.js.map +0 -1
- package/workflows/container-contents/remoteHydration/childIndex.js.map +0 -1
- package/workflows/container-contents/remoteHydration/containerStateFingerprint.js.map +0 -1
- package/workflows/container-contents/remoteHydration/destinationPrefetch.js.map +0 -1
- package/workflows/container-contents/remoteHydration/destinationRoleCache.js.map +0 -1
- package/workflows/container-contents/remoteHydration/destinationRootReload.js +0 -10
- package/workflows/container-contents/remoteHydration/destinationRootReload.js.map +0 -1
- package/workflows/container-contents/remoteHydration/insertRemoteContainer.js +0 -135
- package/workflows/container-contents/remoteHydration/insertRemoteContainer.js.map +0 -1
- package/workflows/container-contents/remoteHydration/laneFetchMarkers.js +0 -21
- package/workflows/container-contents/remoteHydration/laneFetchMarkers.js.map +0 -1
- package/workflows/container-contents/remoteHydration/parentLaneFetch.js +0 -61
- package/workflows/container-contents/remoteHydration/parentLaneFetch.js.map +0 -1
- package/workflows/container-contents/remoteHydration/parentLaneQueue.js.map +0 -1
- package/workflows/container-contents/remoteHydration/remoteContainerPageHydration.js +0 -244
- package/workflows/container-contents/remoteHydration/remoteContainerPageHydration.js.map +0 -1
- package/workflows/container-contents/remoteHydration/remoteContainerState.js +0 -263
- package/workflows/container-contents/remoteHydration/remoteContainerState.js.map +0 -1
- package/workflows/container-contents/remoteHydration/remoteContainerTimestamps.js.map +0 -1
- package/workflows/container-contents/remoteHydration/replacementBinding.js +0 -75
- package/workflows/container-contents/remoteHydration/replacementBinding.js.map +0 -1
- package/workflows/container-contents/remoteHydration/verifiedDestination.js +0 -296
- package/workflows/container-contents/remoteHydration/verifiedDestination.js.map +0 -1
- package/workflows/containers/child/carriedDescendantRekeys.js +0 -126
- package/workflows/containers/child/carriedDescendantRekeys.js.map +0 -1
- package/workflows/containers/child/create.d.ts +0 -24
- package/workflows/containers/child/create.js +0 -335
- package/workflows/containers/child/create.js.map +0 -1
- package/workflows/containers/child/createProjection.d.ts +0 -6
- package/workflows/containers/child/createProjection.js +0 -43
- package/workflows/containers/child/createProjection.js.map +0 -1
- package/workflows/containers/child/createSubmission.d.ts +0 -56
- package/workflows/containers/child/createSubmission.js +0 -43
- package/workflows/containers/child/createSubmission.js.map +0 -1
- package/workflows/containers/child/currentShareGrantMutation.js +0 -82
- package/workflows/containers/child/currentShareGrantMutation.js.map +0 -1
- package/workflows/containers/child/currentSharePrincipalPolicy.js +0 -83
- package/workflows/containers/child/currentSharePrincipalPolicy.js.map +0 -1
- package/workflows/containers/child/keyringOverrideLineage.d.ts +0 -22
- package/workflows/containers/child/keyringOverrideLineage.js +0 -39
- package/workflows/containers/child/move.d.ts +0 -23
- package/workflows/containers/child/move.js +0 -268
- package/workflows/containers/child/move.js.map +0 -1
- package/workflows/containers/child/moveArtifacts.js +0 -102
- package/workflows/containers/child/moveArtifacts.js.map +0 -1
- package/workflows/containers/child/moveRotation.js +0 -88
- package/workflows/containers/child/moveRotation.js.map +0 -1
- package/workflows/containers/child/moveWraps.js +0 -49
- package/workflows/containers/child/moveWraps.js.map +0 -1
- package/workflows/containers/child/rekey.d.ts +0 -32
- package/workflows/containers/child/rekey.js +0 -227
- package/workflows/containers/child/rekey.js.map +0 -1
- package/workflows/containers/child/rekeyProjection.d.ts +0 -46
- package/workflows/containers/child/rekeyProjection.js +0 -151
- package/workflows/containers/child/rekeyProjection.js.map +0 -1
- package/workflows/containers/child/rekeyRemote.d.ts +0 -24
- package/workflows/containers/child/rekeyRemote.js +0 -64
- package/workflows/containers/child/rekeyRemote.js.map +0 -1
- package/workflows/containers/child/replacementPrincipalPolicyReferences.js +0 -19
- package/workflows/containers/child/replacementPrincipalPolicyReferences.js.map +0 -1
- package/workflows/containers/child/rotationContext.js +0 -64
- package/workflows/containers/child/rotationContext.js.map +0 -1
- package/workflows/containers/child/rotationPrincipalPolicies.js +0 -19
- package/workflows/containers/child/rotationPrincipalPolicies.js.map +0 -1
- package/workflows/containers/child/rotationWraps.js +0 -85
- package/workflows/containers/child/rotationWraps.js.map +0 -1
- package/workflows/containers/child/runtimeCurrentGroupShare.js +0 -79
- package/workflows/containers/child/runtimeCurrentGroupShare.js.map +0 -1
- package/workflows/containers/child/share.d.ts +0 -65
- package/workflows/containers/child/share.js +0 -256
- package/workflows/containers/child/share.js.map +0 -1
- package/workflows/containers/child/shareAncestorRepair.js +0 -95
- package/workflows/containers/child/shareAncestorRepair.js.map +0 -1
- package/workflows/containers/child/shareMaterialization.d.ts +0 -25
- package/workflows/containers/child/shareMaterialization.js +0 -164
- package/workflows/containers/child/shareMaterialization.js.map +0 -1
- package/workflows/containers/child/sharePlanCore.d.ts +0 -82
- package/workflows/containers/child/sharePlanCore.js +0 -191
- package/workflows/containers/child/sharePlanCore.js.map +0 -1
- package/workflows/containers/child/sharePrincipalPolicy.d.ts +0 -51
- package/workflows/containers/child/sharePrincipalPolicy.js +0 -194
- package/workflows/containers/child/sharePrincipalPolicy.js.map +0 -1
- package/workflows/containers/child/shareProjection.js.map +0 -1
- /package/data/documents/shared/{containerKekCurrency.js → containerKek/containerKekCurrency.js} +0 -0
- /package/data/documents/shared/{containerKekCurrency.js.map → containerKek/containerKekCurrency.js.map} +0 -0
- /package/data/documents/shared/{containerKekEntryVerification.js.map → containerKek/containerKekEntryVerification.js.map} +0 -0
- /package/data/documents/shared/{containerKekLogFetch.js.map → containerKek/containerKekLogFetch.js.map} +0 -0
- /package/data/documents/shared/{containerKekPath.d.ts → containerKek/containerKekPath.d.ts} +0 -0
- /package/data/documents/shared/{keyringLogWalk.js.map → containerKek/keyringLogWalk.js.map} +0 -0
- /package/data/documents/shared/{pullContinuation.d.ts → sync/pullContinuation.d.ts} +0 -0
- /package/data/documents/shared/{pullContinuation.js.map → sync/pullContinuation.js.map} +0 -0
- /package/data/documents/shared/{syncSubmitFailure.js → sync/syncSubmitFailure.js} +0 -0
- /package/data/documents/shared/{syncSubmitFailure.js.map → sync/syncSubmitFailure.js.map} +0 -0
- /package/data/keyingProjectionVerification/{containerCreateManifest.js.map → container/containerCreateManifest.js.map} +0 -0
- /package/data/keyingProjectionVerification/{documentContainerProjections.js → document/documentContainerProjections.js} +0 -0
- /package/data/keyingProjectionVerification/{documentContainerProjections.js.map → document/documentContainerProjections.js.map} +0 -0
- /package/data/keyingProjectionVerification/{documentManifestPredecessor.js.map → document/documentManifestPredecessor.js.map} +0 -0
- /package/data/persistence/{keyingCheckpointEvidence.js.map → keyingCheckpoints/keyingCheckpointEvidence.js.map} +0 -0
- /package/data/persistence/{storedPrincipalPolicyBundle.js → principalPolicy/storedPrincipalPolicyBundle.js} +0 -0
- /package/data/persistence/{storedPrincipalPolicyBundle.js.map → principalPolicy/storedPrincipalPolicyBundle.js.map} +0 -0
- /package/data/sqlite/{documentPersistenceTypes.js → documentPersistence/documentPersistenceTypes.js} +0 -0
- /package/data/sqlite/{containerDocumentTombstoneHoldSchema.d.ts → schema/containerDocumentTombstoneHoldSchema.d.ts} +0 -0
- /package/data/sqlite/{containerDocumentTombstoneHoldSchema.js → schema/containerDocumentTombstoneHoldSchema.js} +0 -0
- /package/data/sqlite/{containerDocumentTombstoneHoldSchema.js.map → schema/containerDocumentTombstoneHoldSchema.js.map} +0 -0
- /package/data/sqlite/{documentAttachmentSchema.d.ts → schema/documentAttachmentSchema.d.ts} +0 -0
- /package/data/sqlite/{documentAttachmentSchema.js → schema/documentAttachmentSchema.js} +0 -0
- /package/data/sqlite/{documentAttachmentSchema.js.map → schema/documentAttachmentSchema.js.map} +0 -0
- /package/data/sqlite/{documentDiscoveryEvidenceSchema.js → schema/documentDiscoveryEvidenceSchema.js} +0 -0
- /package/data/sqlite/{documentDiscoveryEvidenceSchema.js.map → schema/documentDiscoveryEvidenceSchema.js.map} +0 -0
- /package/data/sqlite/{documentPlacementIntentSchema.js → schema/documentPlacementIntentSchema.js} +0 -0
- /package/data/sqlite/{documentPlacementIntentSchema.js.map → schema/documentPlacementIntentSchema.js.map} +0 -0
- /package/data/sqlite/{localIntentSchema.d.ts → schema/localIntentSchema.d.ts} +0 -0
- /package/data/sqlite/{localIntentSchema.js → schema/localIntentSchema.js} +0 -0
- /package/data/sqlite/{localIntentSchema.js.map → schema/localIntentSchema.js.map} +0 -0
- /package/data/sqlite/{organizationFounderSchema.js → schema/organizationFounderSchema.js} +0 -0
- /package/data/sqlite/{organizationFounderSchema.js.map → schema/organizationFounderSchema.js.map} +0 -0
- /package/data/sqlite/{organizationReadModelSchema.js → schema/organizationReadModelSchema.js} +0 -0
- /package/data/sqlite/{organizationReadModelSchema.js.map → schema/organizationReadModelSchema.js.map} +0 -0
- /package/data/sqlite/{principalGrantRetirementSchema.js → schema/principalGrantRetirementSchema.js} +0 -0
- /package/data/sqlite/{principalGrantRetirementSchema.js.map → schema/principalGrantRetirementSchema.js.map} +0 -0
- /package/data/sqlite/{principalPolicySchema.d.ts → schema/principalPolicySchema.d.ts} +0 -0
- /package/stores/container-contents/{containerStateMap.js → containerState/containerStateMap.js} +0 -0
- /package/stores/container-contents/{missingSyncedContainerState.js → containerState/missingSyncedContainerState.js} +0 -0
- /package/stores/container-contents/{reconcilableContainer.js → containerState/reconcilableContainer.js} +0 -0
- /package/stores/container-contents/{remoteHydrationRefresh.js → hydration/remoteHydrationRefresh.js} +0 -0
- /package/stores/container-contents/{remoteHydrationRefresh.js.map → hydration/remoteHydrationRefresh.js.map} +0 -0
- /package/stores/container-contents/{emptyTrashOperation.js → operations/emptyTrashOperation.js} +0 -0
- /package/stores/container-contents/{purgeContainerOperation.js → operations/purgeContainerOperation.js} +0 -0
- /package/stores/container-contents/{remoteBackedContainerState.js → remoteEvents/remoteBackedContainerState.js} +0 -0
- /package/stores/container-contents/{writeGeneration.js → remoteWrites/writeGeneration.js} +0 -0
- /package/stores/container-contents/{syncAgentTypes.js → syncAgent/syncAgentTypes.js} +0 -0
- /package/stores/container-contents/{systemContainerLookup.js → systemContainers/systemContainerLookup.js} +0 -0
- /package/stores/documents/documentStore/{attachmentPersistFollowup.js → attachments/attachmentPersistFollowup.js} +0 -0
- /package/stores/documents/documentStore/{attachmentSnapshot.js → attachments/attachmentSnapshot.js} +0 -0
- /package/stores/documents/documentStore/{remoteWork.js → sync/remoteWork.js} +0 -0
- /package/stores/documents/documentStore/{syncAcceptedUpdateIds.js → sync/syncAcceptedUpdateIds.js} +0 -0
- /package/stores/documents/documentStore/{syncGeneration.js → sync/syncGeneration.js} +0 -0
- /package/stores/documents/documentStore/{versionCoverage.js.map → sync/versionCoverage.js.map} +0 -0
- /package/workflows/container-contents/container-state/{createIntentSettlement.js → create/createIntentSettlement.js} +0 -0
- /package/workflows/container-contents/container-state/{purgeProgress.d.ts → purge/purgeProgress.d.ts} +0 -0
- /package/workflows/container-contents/container-state/{purgeProgress.js → purge/purgeProgress.js} +0 -0
- /package/workflows/container-contents/container-state/{purgeProgress.js.map → purge/purgeProgress.js.map} +0 -0
- /package/workflows/container-contents/container-state/{purgeTreeCollection.js → purge/purgeTreeCollection.js} +0 -0
- /package/workflows/container-contents/remoteHydration/{destinationPrefetch.js → destination/destinationPrefetch.js} +0 -0
- /package/workflows/container-contents/remoteHydration/{destinationRoleCache.js → destination/destinationRoleCache.js} +0 -0
- /package/workflows/container-contents/remoteHydration/{childIndex.js → lanes/childIndex.js} +0 -0
- /package/workflows/container-contents/remoteHydration/{parentLaneQueue.js → lanes/parentLaneQueue.js} +0 -0
- /package/workflows/container-contents/remoteHydration/{containerStateFingerprint.js → remoteContainers/containerStateFingerprint.js} +0 -0
- /package/workflows/container-contents/remoteHydration/{remoteContainerTimestamps.js → remoteContainers/remoteContainerTimestamps.js} +0 -0
- /package/workflows/containers/child/{keyringOverrideLineage.js.map → rekey/keyringOverrideLineage.js.map} +0 -0
- /package/workflows/containers/child/{shareProjection.js → share/shareProjection.js} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type DocumentContentKeyTarget } from "../../../../internal/crypto/index.js";
|
|
2
|
+
import type { ContainerManifestRef, DocumentContentKeyTargetEnvelope } from "../../../../internal/validators/request/index.js";
|
|
3
|
+
import type { ContainerKeyingPathResponse, DocumentWriterProjectionResponse } from "../../../../internal/validators/response/index.js";
|
|
4
|
+
import type { DocumentLinkSetMutationOperation } from "../types.js";
|
|
5
|
+
export declare function deriveDocumentCreateTargets(projection: ContainerKeyingPathResponse): DocumentContentKeyTarget[];
|
|
6
|
+
export declare function mergeTargetEnvelopes(targets: readonly DocumentContentKeyTarget[], envelopes: readonly DocumentContentKeyTargetEnvelope[]): DocumentContentKeyTargetEnvelope[];
|
|
7
|
+
export declare function describeProjectionTargetKek(projection: ContainerKeyingPathResponse): string;
|
|
8
|
+
export declare function deriveDocumentTargetFromProjection(projection: ContainerKeyingPathResponse): DocumentContentKeyTarget;
|
|
9
|
+
export declare function readLinkedContainerIdsFromDocumentManifest(writerProjection: DocumentWriterProjectionResponse): string[];
|
|
10
|
+
/**
|
|
11
|
+
* The targets a content-key (re)wrap may address. The server's KEK target list
|
|
12
|
+
* only says which linked containers the bundle must cover; the epoch each
|
|
13
|
+
* envelope lands on comes from that container's verified authorizing-path
|
|
14
|
+
* leaf, never from the server row. A listed epoch that is not the linked
|
|
15
|
+
* container's verified current head — a predecessor a revoked member still
|
|
16
|
+
* holds, or another container's epoch — therefore fails before any wrap, as
|
|
17
|
+
* does a container listed twice. A linked container with no authorizing path
|
|
18
|
+
* is an availability gap, not tampering: its KEK is simply unavailable here.
|
|
19
|
+
*/
|
|
20
|
+
export declare function verifiedDocumentWrapTargets(input: {
|
|
21
|
+
linkedContainerIds: readonly string[];
|
|
22
|
+
serverTargets: readonly DocumentContentKeyTarget[];
|
|
23
|
+
writerProjection: DocumentWriterProjectionResponse;
|
|
24
|
+
}): DocumentContentKeyTarget[];
|
|
25
|
+
export declare function currentDocumentTargets(writerProjection: DocumentWriterProjectionResponse): DocumentContentKeyTarget[];
|
|
26
|
+
/**
|
|
27
|
+
* Reduce a single container path (root→leaf chain) to {containerId,
|
|
28
|
+
* manifestHash} references. The server already stores each manifest and resolves
|
|
29
|
+
* it from its own store, so a write echoes only the hashes instead of
|
|
30
|
+
* re-embedding the full signed bundles it received in the writer projection.
|
|
31
|
+
*/
|
|
32
|
+
export declare function containerPathRefs(path: ContainerKeyingPathResponse["path"]): ContainerManifestRef[];
|
|
33
|
+
export declare function authorizingContainerPathRefs(writerProjection: DocumentWriterProjectionResponse): ContainerManifestRef[][];
|
|
34
|
+
export declare function authorizingContainerPathRefsForLinkSet(input: {
|
|
35
|
+
operation: DocumentLinkSetMutationOperation;
|
|
36
|
+
targetContainerId: string;
|
|
37
|
+
writerProjection: DocumentWriterProjectionResponse;
|
|
38
|
+
}): ContainerManifestRef[][];
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { KeyingVerificationError, } from "../../../../internal/crypto/index.js";
|
|
2
|
+
import { isPlainObject as isPlainRecord } from "../../../../internal/validators/isPlainObject.js";
|
|
3
|
+
import { describeDocumentTargetKek, normalizeDocumentKekTargetResponse, readManifestContainerId, serializeCanonical, sortDocumentTargets, targetEnvelopeReference, targetKey, uniqueSortedStrings, } from "../readers.js";
|
|
4
|
+
export function deriveDocumentCreateTargets(projection) {
|
|
5
|
+
const targetIndex = projection.path.length - 1;
|
|
6
|
+
const targetManifest = projection.path[targetIndex];
|
|
7
|
+
if (!targetManifest) {
|
|
8
|
+
throw new Error("Container writer projection path is empty");
|
|
9
|
+
}
|
|
10
|
+
if (readManifestContainerId(targetManifest) !== projection.containerId) {
|
|
11
|
+
throw new Error("Container writer projection target path is inconsistent");
|
|
12
|
+
}
|
|
13
|
+
const targetKek = projection.containerKeks[targetIndex];
|
|
14
|
+
if (!targetKek) {
|
|
15
|
+
throw new Error("Container writer projection target KEK is unavailable");
|
|
16
|
+
}
|
|
17
|
+
if (targetKek.containerId !== projection.containerId) {
|
|
18
|
+
throw new Error("Container writer projection target KEK is inconsistent");
|
|
19
|
+
}
|
|
20
|
+
if (targetKek.accessManifestHash !== targetManifest.manifestHash) {
|
|
21
|
+
throw new Error("Container writer projection target KEK is stale");
|
|
22
|
+
}
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
containerId: targetKek.containerId,
|
|
26
|
+
containerManifestHash: targetKek.accessManifestHash,
|
|
27
|
+
containerKeyEpochId: targetKek.containerKeyEpochId,
|
|
28
|
+
containerKeyEpoch: targetKek.containerKeyEpoch,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
export function mergeTargetEnvelopes(targets, envelopes) {
|
|
33
|
+
const expectedByKey = new Map(targets.map((target) => [targetKey(target), target]));
|
|
34
|
+
const envelopeByKey = new Map();
|
|
35
|
+
for (const envelope of envelopes) {
|
|
36
|
+
const key = targetKey(envelope);
|
|
37
|
+
if (!expectedByKey.has(key)) {
|
|
38
|
+
throw new Error("Document content-key target envelope is unexpected");
|
|
39
|
+
}
|
|
40
|
+
if (envelopeByKey.has(key)) {
|
|
41
|
+
throw new Error("Document content-key target envelope is duplicated");
|
|
42
|
+
}
|
|
43
|
+
if (envelope.wrappedKey.length === 0) {
|
|
44
|
+
throw new Error("Document content-key target envelope is empty");
|
|
45
|
+
}
|
|
46
|
+
if (!isPlainRecord(envelope.wrappingMetadata)) {
|
|
47
|
+
throw new Error("Document content-key target wrapping metadata must be an object");
|
|
48
|
+
}
|
|
49
|
+
envelopeByKey.set(key, envelope);
|
|
50
|
+
}
|
|
51
|
+
return sortDocumentTargets(targets).map((target) => {
|
|
52
|
+
const envelope = envelopeByKey.get(targetKey(target));
|
|
53
|
+
if (!envelope) {
|
|
54
|
+
throw new Error("Document content-key target envelope is missing");
|
|
55
|
+
}
|
|
56
|
+
return envelope;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function projectionLeafContainerId(projection) {
|
|
60
|
+
const leafBundle = projection.path.at(-1);
|
|
61
|
+
return leafBundle ? readManifestContainerId(leafBundle) : null;
|
|
62
|
+
}
|
|
63
|
+
export function describeProjectionTargetKek(projection) {
|
|
64
|
+
const targetKek = projection.containerKeks.at(-1);
|
|
65
|
+
const containerId = projectionLeafContainerId(projection) ??
|
|
66
|
+
targetKek?.containerId ??
|
|
67
|
+
projection.containerId;
|
|
68
|
+
return targetKek
|
|
69
|
+
? `container ${containerId} epoch ${targetKek.containerKeyEpochId}`
|
|
70
|
+
: `container ${containerId}`;
|
|
71
|
+
}
|
|
72
|
+
export function deriveDocumentTargetFromProjection(projection) {
|
|
73
|
+
const target = deriveDocumentCreateTargets(projection)[0];
|
|
74
|
+
if (!target) {
|
|
75
|
+
throw new Error("Document target projection is unavailable");
|
|
76
|
+
}
|
|
77
|
+
return target;
|
|
78
|
+
}
|
|
79
|
+
export function readLinkedContainerIdsFromDocumentManifest(writerProjection) {
|
|
80
|
+
const state = writerProjection.documentManifest.state;
|
|
81
|
+
const linkedContainerIds = isPlainRecord(state)
|
|
82
|
+
? Reflect.get(state, "linkedContainerIds")
|
|
83
|
+
: undefined;
|
|
84
|
+
if (!Array.isArray(linkedContainerIds) ||
|
|
85
|
+
linkedContainerIds.some((containerId) => typeof containerId !== "string" || containerId.length === 0)) {
|
|
86
|
+
throw new Error("Document link-set state is invalid");
|
|
87
|
+
}
|
|
88
|
+
return uniqueSortedStrings(linkedContainerIds);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The targets a content-key (re)wrap may address. The server's KEK target list
|
|
92
|
+
* only says which linked containers the bundle must cover; the epoch each
|
|
93
|
+
* envelope lands on comes from that container's verified authorizing-path
|
|
94
|
+
* leaf, never from the server row. A listed epoch that is not the linked
|
|
95
|
+
* container's verified current head — a predecessor a revoked member still
|
|
96
|
+
* holds, or another container's epoch — therefore fails before any wrap, as
|
|
97
|
+
* does a container listed twice. A linked container with no authorizing path
|
|
98
|
+
* is an availability gap, not tampering: its KEK is simply unavailable here.
|
|
99
|
+
*/
|
|
100
|
+
export function verifiedDocumentWrapTargets(input) {
|
|
101
|
+
const verifiedByKey = new Map();
|
|
102
|
+
const verifiedContainerIds = new Set();
|
|
103
|
+
for (const projection of input.writerProjection.authorizingContainerPaths) {
|
|
104
|
+
const target = deriveDocumentTargetFromProjection(projection);
|
|
105
|
+
verifiedByKey.set(targetKey(target), target);
|
|
106
|
+
verifiedContainerIds.add(target.containerId);
|
|
107
|
+
}
|
|
108
|
+
const containerIds = input.serverTargets.map((target) => target.containerId);
|
|
109
|
+
if (new Set(containerIds).size !== containerIds.length) {
|
|
110
|
+
throw new KeyingVerificationError("duplicate_entry", "Document content-key targets name a linked container more than once");
|
|
111
|
+
}
|
|
112
|
+
const linkedContainerIds = uniqueSortedStrings(input.linkedContainerIds);
|
|
113
|
+
const sortedContainerIds = uniqueSortedStrings(containerIds);
|
|
114
|
+
if (sortedContainerIds.length !== linkedContainerIds.length ||
|
|
115
|
+
sortedContainerIds.some((id, index) => id !== linkedContainerIds[index])) {
|
|
116
|
+
throw new KeyingVerificationError("object_mismatch", "Document content-key targets do not match the linked containers");
|
|
117
|
+
}
|
|
118
|
+
return sortDocumentTargets(input.serverTargets.map((target) => {
|
|
119
|
+
const verified = verifiedByKey.get(targetKey(target));
|
|
120
|
+
if (verified) {
|
|
121
|
+
return verified;
|
|
122
|
+
}
|
|
123
|
+
if (!verifiedContainerIds.has(target.containerId)) {
|
|
124
|
+
throw new Error(`Document content-key re-wrap KEK is unavailable for ${describeDocumentTargetKek(target)}`);
|
|
125
|
+
}
|
|
126
|
+
throw new KeyingVerificationError("object_mismatch", `Document content-key target is not the verified head of ${describeDocumentTargetKek(target)}`);
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
export function currentDocumentTargets(writerProjection) {
|
|
130
|
+
const targets = normalizeDocumentKekTargetResponse(writerProjection.documentKekTargets);
|
|
131
|
+
const bundleTargets = sortDocumentTargets(writerProjection.contentKeyBundle.targets.map(targetEnvelopeReference));
|
|
132
|
+
if (serializeCanonical(targets, "KEK targets") !==
|
|
133
|
+
serializeCanonical(bundleTargets, "content-key targets")) {
|
|
134
|
+
throw new Error("Document link-set content-key targets mismatch");
|
|
135
|
+
}
|
|
136
|
+
return targets;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Reduce a single container path (root→leaf chain) to {containerId,
|
|
140
|
+
* manifestHash} references. The server already stores each manifest and resolves
|
|
141
|
+
* it from its own store, so a write echoes only the hashes instead of
|
|
142
|
+
* re-embedding the full signed bundles it received in the writer projection.
|
|
143
|
+
*/
|
|
144
|
+
export function containerPathRefs(path) {
|
|
145
|
+
return path.map((bundle) => {
|
|
146
|
+
const containerId = readManifestContainerId(bundle);
|
|
147
|
+
if (!containerId) {
|
|
148
|
+
throw new Error("Container path manifest is missing a container id");
|
|
149
|
+
}
|
|
150
|
+
return { containerId, manifestHash: bundle.manifestHash };
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
export function authorizingContainerPathRefs(writerProjection) {
|
|
154
|
+
return writerProjection.authorizingContainerPaths.map((projection) => containerPathRefs(projection.path));
|
|
155
|
+
}
|
|
156
|
+
export function authorizingContainerPathRefsForLinkSet(input) {
|
|
157
|
+
const paths = input.writerProjection.authorizingContainerPaths.filter((projection) => input.operation === "link" ||
|
|
158
|
+
projectionLeafContainerId(projection) !== input.targetContainerId);
|
|
159
|
+
if (paths.length === 0) {
|
|
160
|
+
throw new Error("Document link-set authorizing paths are missing");
|
|
161
|
+
}
|
|
162
|
+
return paths.map((projection) => containerPathRefs(projection.path));
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=projectionTargets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectionTargets.js","sourceRoot":"","sources":["projectionTargets.ts"],"names":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AAU,iBAAiB,CAC/B,IAAyC;IAEzC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACzB,MAAM,WAAW,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,gBAAkD;IAElD,OAAO,gBAAgB,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACnE,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CACnC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sCAAsC,CAAC,KAItD;IACC,MAAM,KAAK,GAAG,KAAK,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,MAAM,CACnE,CAAC,UAAU,EAAE,EAAE,CACb,KAAK,CAAC,SAAS,KAAK,MAAM;QAC1B,yBAAyB,CAAC,UAAU,CAAC,KAAK,KAAK,CAAC,iBAAiB,CACpE,CAAC;IACF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import {\n type DocumentContentKeyTarget,\n KeyingVerificationError,\n} from \"@tearleads/crypto\";\nimport { isPlainObject as isPlainRecord } from \"@tearleads/validators/isPlainObject\";\nimport type {\n ContainerManifestRef,\n DocumentContentKeyTargetEnvelope,\n} from \"@tearleads/validators/request\";\nimport type {\n ContainerKeyingPathResponse,\n DocumentWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\nimport {\n describeDocumentTargetKek,\n normalizeDocumentKekTargetResponse,\n readManifestContainerId,\n serializeCanonical,\n sortDocumentTargets,\n targetEnvelopeReference,\n targetKey,\n uniqueSortedStrings,\n} from \"../readers\";\nimport type { DocumentLinkSetMutationOperation } from \"../types\";\n\nexport function deriveDocumentCreateTargets(\n projection: ContainerKeyingPathResponse,\n): DocumentContentKeyTarget[] {\n const targetIndex = projection.path.length - 1;\n const targetManifest = projection.path[targetIndex];\n if (!targetManifest) {\n throw new Error(\"Container writer projection path is empty\");\n }\n\n if (readManifestContainerId(targetManifest) !== projection.containerId) {\n throw new Error(\"Container writer projection target path is inconsistent\");\n }\n\n const targetKek = projection.containerKeks[targetIndex];\n if (!targetKek) {\n throw new Error(\"Container writer projection target KEK is unavailable\");\n }\n if (targetKek.containerId !== projection.containerId) {\n throw new Error(\"Container writer projection target KEK is inconsistent\");\n }\n if (targetKek.accessManifestHash !== targetManifest.manifestHash) {\n throw new Error(\"Container writer projection target KEK is stale\");\n }\n\n return [\n {\n containerId: targetKek.containerId,\n containerManifestHash: targetKek.accessManifestHash,\n containerKeyEpochId: targetKek.containerKeyEpochId,\n containerKeyEpoch: targetKek.containerKeyEpoch,\n },\n ];\n}\n\nexport function mergeTargetEnvelopes(\n targets: readonly DocumentContentKeyTarget[],\n envelopes: readonly DocumentContentKeyTargetEnvelope[],\n): DocumentContentKeyTargetEnvelope[] {\n const expectedByKey = new Map(\n targets.map((target) => [targetKey(target), target]),\n );\n const envelopeByKey = new Map<string, DocumentContentKeyTargetEnvelope>();\n\n for (const envelope of envelopes) {\n const key = targetKey(envelope);\n if (!expectedByKey.has(key)) {\n throw new Error(\"Document content-key target envelope is unexpected\");\n }\n if (envelopeByKey.has(key)) {\n throw new Error(\"Document content-key target envelope is duplicated\");\n }\n if (envelope.wrappedKey.length === 0) {\n throw new Error(\"Document content-key target envelope is empty\");\n }\n if (!isPlainRecord(envelope.wrappingMetadata)) {\n throw new Error(\n \"Document content-key target wrapping metadata must be an object\",\n );\n }\n envelopeByKey.set(key, envelope);\n }\n\n return sortDocumentTargets(targets).map((target) => {\n const envelope = envelopeByKey.get(targetKey(target));\n if (!envelope) {\n throw new Error(\"Document content-key target envelope is missing\");\n }\n return envelope;\n });\n}\n\nfunction projectionLeafContainerId(\n projection: ContainerKeyingPathResponse,\n): string | null {\n const leafBundle = projection.path.at(-1);\n return leafBundle ? readManifestContainerId(leafBundle) : null;\n}\n\nexport function describeProjectionTargetKek(\n projection: ContainerKeyingPathResponse,\n): string {\n const targetKek = projection.containerKeks.at(-1);\n const containerId =\n projectionLeafContainerId(projection) ??\n targetKek?.containerId ??\n projection.containerId;\n return targetKek\n ? `container ${containerId} epoch ${targetKek.containerKeyEpochId}`\n : `container ${containerId}`;\n}\n\nexport function deriveDocumentTargetFromProjection(\n projection: ContainerKeyingPathResponse,\n): DocumentContentKeyTarget {\n const target = deriveDocumentCreateTargets(projection)[0];\n if (!target) {\n throw new Error(\"Document target projection is unavailable\");\n }\n return target;\n}\n\nexport function readLinkedContainerIdsFromDocumentManifest(\n writerProjection: DocumentWriterProjectionResponse,\n): string[] {\n const state = writerProjection.documentManifest.state;\n const linkedContainerIds = isPlainRecord(state)\n ? Reflect.get(state, \"linkedContainerIds\")\n : undefined;\n if (\n !Array.isArray(linkedContainerIds) ||\n linkedContainerIds.some(\n (containerId) =>\n typeof containerId !== \"string\" || containerId.length === 0,\n )\n ) {\n throw new Error(\"Document link-set state is invalid\");\n }\n\n return uniqueSortedStrings(linkedContainerIds);\n}\n\n/**\n * The targets a content-key (re)wrap may address. The server's KEK target list\n * only says which linked containers the bundle must cover; the epoch each\n * envelope lands on comes from that container's verified authorizing-path\n * leaf, never from the server row. A listed epoch that is not the linked\n * container's verified current head — a predecessor a revoked member still\n * holds, or another container's epoch — therefore fails before any wrap, as\n * does a container listed twice. A linked container with no authorizing path\n * is an availability gap, not tampering: its KEK is simply unavailable here.\n */\nexport function verifiedDocumentWrapTargets(input: {\n linkedContainerIds: readonly string[];\n serverTargets: readonly DocumentContentKeyTarget[];\n writerProjection: DocumentWriterProjectionResponse;\n}): DocumentContentKeyTarget[] {\n const verifiedByKey = new Map<string, DocumentContentKeyTarget>();\n const verifiedContainerIds = new Set<string>();\n for (const projection of input.writerProjection.authorizingContainerPaths) {\n const target = deriveDocumentTargetFromProjection(projection);\n verifiedByKey.set(targetKey(target), target);\n verifiedContainerIds.add(target.containerId);\n }\n\n const containerIds = input.serverTargets.map((target) => target.containerId);\n if (new Set(containerIds).size !== containerIds.length) {\n throw new KeyingVerificationError(\n \"duplicate_entry\",\n \"Document content-key targets name a linked container more than once\",\n );\n }\n const linkedContainerIds = uniqueSortedStrings(input.linkedContainerIds);\n const sortedContainerIds = uniqueSortedStrings(containerIds);\n if (\n sortedContainerIds.length !== linkedContainerIds.length ||\n sortedContainerIds.some((id, index) => id !== linkedContainerIds[index])\n ) {\n throw new KeyingVerificationError(\n \"object_mismatch\",\n \"Document content-key targets do not match the linked containers\",\n );\n }\n\n return sortDocumentTargets(\n input.serverTargets.map((target) => {\n const verified = verifiedByKey.get(targetKey(target));\n if (verified) {\n return verified;\n }\n if (!verifiedContainerIds.has(target.containerId)) {\n throw new Error(\n `Document content-key re-wrap KEK is unavailable for ${describeDocumentTargetKek(target)}`,\n );\n }\n throw new KeyingVerificationError(\n \"object_mismatch\",\n `Document content-key target is not the verified head of ${describeDocumentTargetKek(target)}`,\n );\n }),\n );\n}\n\nexport function currentDocumentTargets(\n writerProjection: DocumentWriterProjectionResponse,\n): DocumentContentKeyTarget[] {\n const targets = normalizeDocumentKekTargetResponse(\n writerProjection.documentKekTargets,\n );\n const bundleTargets = sortDocumentTargets(\n writerProjection.contentKeyBundle.targets.map(targetEnvelopeReference),\n );\n\n if (\n serializeCanonical(targets, \"KEK targets\") !==\n serializeCanonical(bundleTargets, \"content-key targets\")\n ) {\n throw new Error(\"Document link-set content-key targets mismatch\");\n }\n\n return targets;\n}\n\n/**\n * Reduce a single container path (root→leaf chain) to {containerId,\n * manifestHash} references. The server already stores each manifest and resolves\n * it from its own store, so a write echoes only the hashes instead of\n * re-embedding the full signed bundles it received in the writer projection.\n */\nexport function containerPathRefs(\n path: ContainerKeyingPathResponse[\"path\"],\n): ContainerManifestRef[] {\n return path.map((bundle) => {\n const containerId = readManifestContainerId(bundle);\n if (!containerId) {\n throw new Error(\"Container path manifest is missing a container id\");\n }\n return { containerId, manifestHash: bundle.manifestHash };\n });\n}\n\nexport function authorizingContainerPathRefs(\n writerProjection: DocumentWriterProjectionResponse,\n): ContainerManifestRef[][] {\n return writerProjection.authorizingContainerPaths.map((projection) =>\n containerPathRefs(projection.path),\n );\n}\n\nexport function authorizingContainerPathRefsForLinkSet(input: {\n operation: DocumentLinkSetMutationOperation;\n targetContainerId: string;\n writerProjection: DocumentWriterProjectionResponse;\n}): ContainerManifestRef[][] {\n const paths = input.writerProjection.authorizingContainerPaths.filter(\n (projection) =>\n input.operation === \"link\" ||\n projectionLeafContainerId(projection) !== input.targetContainerId,\n );\n if (paths.length === 0) {\n throw new Error(\"Document link-set authorizing paths are missing\");\n }\n\n return paths.map((projection) => containerPathRefs(projection.path));\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DocumentCreateResponse, DocumentLinkSetMutationResponse, DocumentWriterProjectionResponse } from "../../../internal/validators/response/index.js";
|
|
2
2
|
import type { DocumentCreatePlan, DocumentLinkSetMutationPlan, PersistedDocumentCreateState } from "./types.js";
|
|
3
|
-
export { DocumentSyncResponseUpdateContentKeyError, isRetryableDocumentSyncConflict, isUpstreamDeletedDocumentSyncFailure, persistedDocumentSyncStateFromResponse, submitDocumentSync, } from "./syncResponses.js";
|
|
3
|
+
export { DocumentSyncResponseUpdateContentKeyError, isRetryableDocumentSyncConflict, isUpstreamDeletedDocumentSyncFailure, persistedDocumentSyncStateFromResponse, submitDocumentSync, } from "./sync/syncResponses.js";
|
|
4
4
|
export declare function assertDocumentCreateResponseMatchesPlan(plan: DocumentCreatePlan, response: DocumentCreateResponse): void;
|
|
5
5
|
export declare function persistedDocumentCreateStateFromResponse(plan: DocumentCreatePlan, response: DocumentCreateResponse): PersistedDocumentCreateState;
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPlainObject as isPlainRecord } from "../../../internal/validators/isPlainObject.js";
|
|
2
2
|
import { readRecordString, serializeCanonical, serializedPersistedDocumentState, } from "./readers.js";
|
|
3
|
-
export { DocumentSyncResponseUpdateContentKeyError, isRetryableDocumentSyncConflict, isUpstreamDeletedDocumentSyncFailure, persistedDocumentSyncStateFromResponse, submitDocumentSync, } from "./syncResponses.js";
|
|
3
|
+
export { DocumentSyncResponseUpdateContentKeyError, isRetryableDocumentSyncConflict, isUpstreamDeletedDocumentSyncFailure, persistedDocumentSyncStateFromResponse, submitDocumentSync, } from "./sync/syncResponses.js";
|
|
4
4
|
function assertDocumentMutationManifestMatchesPlan(input) {
|
|
5
5
|
const { label, plan, response } = input;
|
|
6
6
|
if (response.id !== plan.documentId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.js","sourceRoot":"","sources":["responses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAMrF,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,WAAW,CAAC;AAOnB,OAAO,EACL,yCAAyC,EACzC,+BAA+B,EAC/B,oCAAoC,EACpC,sCAAsC,EACtC,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAkBzB,SAAS,yCAAyC,CAAC,KAKlD;IACC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACxC,IAAI,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,cAAc,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E;QACvB,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,sBAAsB,EAAE,QAAQ,CAAC,cAAc;KAChD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { isPlainObject as isPlainRecord } from \"@tearleads/validators/isPlainObject\";\nimport type {\n DocumentCreateResponse,\n DocumentLinkSetMutationResponse,\n DocumentWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\nimport {\n readRecordString,\n serializeCanonical,\n serializedPersistedDocumentState,\n} from \"./readers\";\nimport type {\n DocumentCreatePlan,\n DocumentLinkSetMutationPlan,\n PersistedDocumentCreateState,\n} from \"./types\";\n\nexport {\n DocumentSyncResponseUpdateContentKeyError,\n isRetryableDocumentSyncConflict,\n isUpstreamDeletedDocumentSyncFailure,\n persistedDocumentSyncStateFromResponse,\n submitDocumentSync,\n} from \"./syncResponses\";\n\ntype DocumentMutationPlan = Pick<\n DocumentCreatePlan,\n | \"documentId\"\n | \"event\"\n | \"eventHash\"\n | \"manifest\"\n | \"manifestHash\"\n | \"state\"\n | \"targetHash\"\n | \"targets\"\n> & {\n // Link and unlink bodies are both serialized canonically, so the shared\n // matcher does not care which event body shape the plan carries.\n body: unknown;\n};\n\nfunction assertDocumentMutationManifestMatchesPlan(input: {\n label: string;\n plan: DocumentMutationPlan;\n probeStateDocumentId: boolean;\n response: DocumentCreateResponse | DocumentLinkSetMutationResponse;\n}): void {\n const { label, plan, response } = input;\n if (response.id !== plan.documentId) {\n throw new Error(`${label} id mismatch`);\n }\n if (response.accessManifest.manifestHash !== plan.manifestHash) {\n throw new Error(`${label} manifest hash mismatch`);\n }\n if (\n serializeCanonical(response.accessManifest.manifest, \"manifest\") !==\n serializeCanonical(plan.manifest, \"manifest\")\n ) {\n throw new Error(`${label} manifest mismatch`);\n }\n\n const responseEvent = response.accessManifest.event;\n if (!isPlainRecord(responseEvent)) {\n throw new Error(`${label} event bundle is invalid`);\n }\n if (\n readRecordString(responseEvent, \"eventHash\", \"event bundle\") !==\n plan.eventHash\n ) {\n throw new Error(`${label} event hash mismatch`);\n }\n if (\n serializeCanonical(Reflect.get(responseEvent, \"event\"), \"event\") !==\n serializeCanonical(plan.event, \"event\")\n ) {\n throw new Error(`${label} event mismatch`);\n }\n if (\n serializeCanonical(Reflect.get(responseEvent, \"body\"), \"event body\") !==\n serializeCanonical(plan.body, \"event body\")\n ) {\n throw new Error(`${label} event body mismatch`);\n }\n\n const responseState = response.accessManifest.state;\n if (input.probeStateDocumentId) {\n if (!isPlainRecord(responseState)) {\n throw new Error(`${label} state is invalid`);\n }\n if (\n readRecordString(responseState, \"documentId\", \"document state\") !==\n plan.documentId\n ) {\n throw new Error(`${label} document id mismatch`);\n }\n }\n if (\n serializeCanonical(responseState, \"state\") !==\n serializeCanonical(plan.state, \"state\")\n ) {\n throw new Error(`${label} state mismatch`);\n }\n}\n\nfunction assertDocumentMutationKeyBundlesMatchPlan(input: {\n expectedContentKeyEpoch: number;\n expectedContentKeyTargets: unknown;\n label: string;\n plan: DocumentMutationPlan;\n response: DocumentCreateResponse | DocumentLinkSetMutationResponse;\n}): void {\n const { label, plan, response } = input;\n if (response.contentKeyBundle.documentId !== plan.documentId) {\n throw new Error(`${label} content-key document mismatch`);\n }\n if (\n response.contentKeyBundle.contentKeyEpoch !== input.expectedContentKeyEpoch\n ) {\n throw new Error(`${label} content-key epoch mismatch`);\n }\n if (response.contentKeyBundle.linkSetManifestHash !== plan.manifestHash) {\n throw new Error(`${label} link manifest mismatch`);\n }\n if (response.contentKeyBundle.targetHash !== plan.targetHash) {\n throw new Error(`${label} target hash mismatch`);\n }\n if (\n serializeCanonical(\n response.contentKeyBundle.targets,\n \"content-key targets\",\n ) !==\n serializeCanonical(input.expectedContentKeyTargets, \"content-key targets\")\n ) {\n throw new Error(`${label} content-key targets mismatch`);\n }\n if (response.documentKekTargets.documentId !== plan.documentId) {\n throw new Error(`${label} target document mismatch`);\n }\n if (response.documentKekTargets.linkSetManifestHash !== plan.manifestHash) {\n throw new Error(`${label} target manifest mismatch`);\n }\n if (response.documentKekTargets.documentKeyTargetHash !== plan.targetHash) {\n throw new Error(`${label} document target hash mismatch`);\n }\n if (\n serializeCanonical(response.documentKekTargets.targets, \"KEK targets\") !==\n serializeCanonical(plan.targets, \"KEK targets\")\n ) {\n throw new Error(`${label} KEK targets mismatch`);\n }\n}\n\nfunction assertDocumentMutationResponseMatchesPlan(input: {\n expectedContentKeyEpoch: number;\n expectedContentKeyTargets: unknown;\n label: string;\n plan: DocumentMutationPlan;\n probeStateDocumentId: boolean;\n response: DocumentCreateResponse | DocumentLinkSetMutationResponse;\n}): void {\n assertDocumentMutationManifestMatchesPlan(input);\n assertDocumentMutationKeyBundlesMatchPlan(input);\n}\n\nexport function assertDocumentCreateResponseMatchesPlan(\n plan: DocumentCreatePlan,\n response: DocumentCreateResponse,\n): void {\n assertDocumentMutationResponseMatchesPlan({\n expectedContentKeyEpoch: plan.request.contentKeyBundle.contentKeyEpoch,\n expectedContentKeyTargets: plan.request.contentKeyBundle.targets,\n label: \"Document create response\",\n plan,\n probeStateDocumentId: true,\n response,\n });\n}\n\nexport function persistedDocumentCreateStateFromResponse(\n plan: DocumentCreatePlan,\n response: DocumentCreateResponse,\n): PersistedDocumentCreateState {\n assertDocumentCreateResponseMatchesPlan(plan, response);\n\n return serializedPersistedDocumentState({\n contentKeyBundle: response.contentKeyBundle,\n documentId: response.id,\n documentKekTargets: response.documentKekTargets,\n documentManifestBundle: response.accessManifest,\n });\n}\n\n/**\n * Builds the persisted create-state from a fetched writer projection, for the\n * idempotent-create adopt path where the original create response (which\n * `persistedDocumentCreateStateFromResponse` consumes) was lost. The projection\n * carries the same committed manifest, content-key bundle and KEK targets — the\n * caller must verify it with `assertDocumentWriterProjectionConsistent` first.\n */\nexport function persistedDocumentCreateStateFromWriterProjection(\n writerProjection: DocumentWriterProjectionResponse,\n): PersistedDocumentCreateState {\n return serializedPersistedDocumentState({\n contentKeyBundle: writerProjection.contentKeyBundle,\n documentId: writerProjection.documentId,\n documentKekTargets: writerProjection.documentKekTargets,\n documentManifestBundle: writerProjection.documentManifest,\n });\n}\n\nexport function persistedDocumentLinkSetMutationStateFromResponse(\n plan: DocumentLinkSetMutationPlan,\n response: DocumentLinkSetMutationResponse,\n): PersistedDocumentCreateState {\n assertDocumentMutationResponseMatchesPlan({\n expectedContentKeyEpoch: plan.contentKeyEpoch,\n expectedContentKeyTargets: plan.request.contentKeyBundle.targets,\n label: \"Document link-set response\",\n plan,\n probeStateDocumentId: false,\n response,\n });\n\n return serializedPersistedDocumentState({\n contentKeyBundle: response.contentKeyBundle,\n documentId: response.id,\n documentKekTargets: response.documentKekTargets,\n documentManifestBundle: response.accessManifest,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["responses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAMrF,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,WAAW,CAAC;AAOnB,OAAO,EACL,yCAAyC,EACzC,+BAA+B,EAC/B,oCAAoC,EACpC,sCAAsC,EACtC,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAkB9B,SAAS,yCAAyC,CAAC,KAKlD;IACC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACxC,IAAI,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,cAAc,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,QAAQ,CAAC,cAAc,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,yBAAyB,CAAC,CAAC;IACrD,CAAC;IACD,IACE,kBAAkB,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC;QACh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AAU,wCAAwC,CACtD,IAAwB,EACxB,QAAgC;IAEhC,uCAAuC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAExD,OAAO,gCAAgC,CAAC;QACtC,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,UAAU,EAAE,QAAQ,CAAC,EAAE;QACvB,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,sBAAsB,EAAE,QAAQ,CAAC,cAAc;KAChD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gDAAgD,CAC9D,gBAAkD;IAElD,OAAO,gCAAgC,CAAC;QACtC,gBAAgB,EAAE,gBAAgB,CAAC,gBAAgB;QACnD,UAAU,EAAE,gBAAgB,CAAC,UAAU;QACvC,kBAAkB,EAAE,gBAAgB,CAAC,kBAAkB;QACvD,sBAAsB,EAAE,gBAAgB,CAAC,gBAAgB;KAC1D,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iDAAiD,CAC/D,IAAiC,EACjC,QAAyC;IAEzC,yCAAyC,CAAC;QACxC,uBAAuB,EAAE,IAAI,CAAC,eAAe;QAC7C,yBAAyB,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO;QAChE,KAAK,EAAE,4BAA4B;QACnC,IAAI;QACJ,oBAAoB,EAAE,KAAK;QAC3B,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO,gCAAgC,CAAC;QACtC,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,UAAU,EAAE,QAAQ,CAAC,EAAE;QACvB,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,sBAAsB,EAAE,QAAQ,CAAC,cAAc;KAChD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { isPlainObject as isPlainRecord } from \"@tearleads/validators/isPlainObject\";\nimport type {\n DocumentCreateResponse,\n DocumentLinkSetMutationResponse,\n DocumentWriterProjectionResponse,\n} from \"@tearleads/validators/response\";\nimport {\n readRecordString,\n serializeCanonical,\n serializedPersistedDocumentState,\n} from \"./readers\";\nimport type {\n DocumentCreatePlan,\n DocumentLinkSetMutationPlan,\n PersistedDocumentCreateState,\n} from \"./types\";\n\nexport {\n DocumentSyncResponseUpdateContentKeyError,\n isRetryableDocumentSyncConflict,\n isUpstreamDeletedDocumentSyncFailure,\n persistedDocumentSyncStateFromResponse,\n submitDocumentSync,\n} from \"./sync/syncResponses\";\n\ntype DocumentMutationPlan = Pick<\n DocumentCreatePlan,\n | \"documentId\"\n | \"event\"\n | \"eventHash\"\n | \"manifest\"\n | \"manifestHash\"\n | \"state\"\n | \"targetHash\"\n | \"targets\"\n> & {\n // Link and unlink bodies are both serialized canonically, so the shared\n // matcher does not care which event body shape the plan carries.\n body: unknown;\n};\n\nfunction assertDocumentMutationManifestMatchesPlan(input: {\n label: string;\n plan: DocumentMutationPlan;\n probeStateDocumentId: boolean;\n response: DocumentCreateResponse | DocumentLinkSetMutationResponse;\n}): void {\n const { label, plan, response } = input;\n if (response.id !== plan.documentId) {\n throw new Error(`${label} id mismatch`);\n }\n if (response.accessManifest.manifestHash !== plan.manifestHash) {\n throw new Error(`${label} manifest hash mismatch`);\n }\n if (\n serializeCanonical(response.accessManifest.manifest, \"manifest\") !==\n serializeCanonical(plan.manifest, \"manifest\")\n ) {\n throw new Error(`${label} manifest mismatch`);\n }\n\n const responseEvent = response.accessManifest.event;\n if (!isPlainRecord(responseEvent)) {\n throw new Error(`${label} event bundle is invalid`);\n }\n if (\n readRecordString(responseEvent, \"eventHash\", \"event bundle\") !==\n plan.eventHash\n ) {\n throw new Error(`${label} event hash mismatch`);\n }\n if (\n serializeCanonical(Reflect.get(responseEvent, \"event\"), \"event\") !==\n serializeCanonical(plan.event, \"event\")\n ) {\n throw new Error(`${label} event mismatch`);\n }\n if (\n serializeCanonical(Reflect.get(responseEvent, \"body\"), \"event body\") !==\n serializeCanonical(plan.body, \"event body\")\n ) {\n throw new Error(`${label} event body mismatch`);\n }\n\n const responseState = response.accessManifest.state;\n if (input.probeStateDocumentId) {\n if (!isPlainRecord(responseState)) {\n throw new Error(`${label} state is invalid`);\n }\n if (\n readRecordString(responseState, \"documentId\", \"document state\") !==\n plan.documentId\n ) {\n throw new Error(`${label} document id mismatch`);\n }\n }\n if (\n serializeCanonical(responseState, \"state\") !==\n serializeCanonical(plan.state, \"state\")\n ) {\n throw new Error(`${label} state mismatch`);\n }\n}\n\nfunction assertDocumentMutationKeyBundlesMatchPlan(input: {\n expectedContentKeyEpoch: number;\n expectedContentKeyTargets: unknown;\n label: string;\n plan: DocumentMutationPlan;\n response: DocumentCreateResponse | DocumentLinkSetMutationResponse;\n}): void {\n const { label, plan, response } = input;\n if (response.contentKeyBundle.documentId !== plan.documentId) {\n throw new Error(`${label} content-key document mismatch`);\n }\n if (\n response.contentKeyBundle.contentKeyEpoch !== input.expectedContentKeyEpoch\n ) {\n throw new Error(`${label} content-key epoch mismatch`);\n }\n if (response.contentKeyBundle.linkSetManifestHash !== plan.manifestHash) {\n throw new Error(`${label} link manifest mismatch`);\n }\n if (response.contentKeyBundle.targetHash !== plan.targetHash) {\n throw new Error(`${label} target hash mismatch`);\n }\n if (\n serializeCanonical(\n response.contentKeyBundle.targets,\n \"content-key targets\",\n ) !==\n serializeCanonical(input.expectedContentKeyTargets, \"content-key targets\")\n ) {\n throw new Error(`${label} content-key targets mismatch`);\n }\n if (response.documentKekTargets.documentId !== plan.documentId) {\n throw new Error(`${label} target document mismatch`);\n }\n if (response.documentKekTargets.linkSetManifestHash !== plan.manifestHash) {\n throw new Error(`${label} target manifest mismatch`);\n }\n if (response.documentKekTargets.documentKeyTargetHash !== plan.targetHash) {\n throw new Error(`${label} document target hash mismatch`);\n }\n if (\n serializeCanonical(response.documentKekTargets.targets, \"KEK targets\") !==\n serializeCanonical(plan.targets, \"KEK targets\")\n ) {\n throw new Error(`${label} KEK targets mismatch`);\n }\n}\n\nfunction assertDocumentMutationResponseMatchesPlan(input: {\n expectedContentKeyEpoch: number;\n expectedContentKeyTargets: unknown;\n label: string;\n plan: DocumentMutationPlan;\n probeStateDocumentId: boolean;\n response: DocumentCreateResponse | DocumentLinkSetMutationResponse;\n}): void {\n assertDocumentMutationManifestMatchesPlan(input);\n assertDocumentMutationKeyBundlesMatchPlan(input);\n}\n\nexport function assertDocumentCreateResponseMatchesPlan(\n plan: DocumentCreatePlan,\n response: DocumentCreateResponse,\n): void {\n assertDocumentMutationResponseMatchesPlan({\n expectedContentKeyEpoch: plan.request.contentKeyBundle.contentKeyEpoch,\n expectedContentKeyTargets: plan.request.contentKeyBundle.targets,\n label: \"Document create response\",\n plan,\n probeStateDocumentId: true,\n response,\n });\n}\n\nexport function persistedDocumentCreateStateFromResponse(\n plan: DocumentCreatePlan,\n response: DocumentCreateResponse,\n): PersistedDocumentCreateState {\n assertDocumentCreateResponseMatchesPlan(plan, response);\n\n return serializedPersistedDocumentState({\n contentKeyBundle: response.contentKeyBundle,\n documentId: response.id,\n documentKekTargets: response.documentKekTargets,\n documentManifestBundle: response.accessManifest,\n });\n}\n\n/**\n * Builds the persisted create-state from a fetched writer projection, for the\n * idempotent-create adopt path where the original create response (which\n * `persistedDocumentCreateStateFromResponse` consumes) was lost. The projection\n * carries the same committed manifest, content-key bundle and KEK targets — the\n * caller must verify it with `assertDocumentWriterProjectionConsistent` first.\n */\nexport function persistedDocumentCreateStateFromWriterProjection(\n writerProjection: DocumentWriterProjectionResponse,\n): PersistedDocumentCreateState {\n return serializedPersistedDocumentState({\n contentKeyBundle: writerProjection.contentKeyBundle,\n documentId: writerProjection.documentId,\n documentKekTargets: writerProjection.documentKekTargets,\n documentManifestBundle: writerProjection.documentManifest,\n });\n}\n\nexport function persistedDocumentLinkSetMutationStateFromResponse(\n plan: DocumentLinkSetMutationPlan,\n response: DocumentLinkSetMutationResponse,\n): PersistedDocumentCreateState {\n assertDocumentMutationResponseMatchesPlan({\n expectedContentKeyEpoch: plan.contentKeyEpoch,\n expectedContentKeyTargets: plan.request.contentKeyBundle.targets,\n label: \"Document link-set response\",\n plan,\n probeStateDocumentId: false,\n response,\n });\n\n return serializedPersistedDocumentState({\n contentKeyBundle: response.contentKeyBundle,\n documentId: response.id,\n documentKekTargets: response.documentKekTargets,\n documentManifestBundle: response.accessManifest,\n });\n}\n"]}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { assertAesGcmIv, CONTENT_RECORD_ENCRYPTION_SUITE, computeContentRecordNonceDomainHash, computeDocumentContentRecordCiphertextHash, computeDocumentContentRecordMetadataHash, } from "../../../../internal/crypto/index.js";
|
|
2
|
+
import { base64ToBytes } from "../../../../internal/encoding/index.js";
|
|
3
|
+
import { versionVectorsEqual } from "../../../../internal/loro/index.js";
|
|
4
|
+
import { isPlainObject as isPlainRecord } from "../../../../internal/validators/isPlainObject.js";
|
|
5
|
+
import { contentRecordAdditionalDataBytes } from "../contentRecordAdditionalData.js";
|
|
6
|
+
import { deriveDocumentContentRecordKey, deriveDocumentPlaintextHashKey, } from "../contentRecordKeys.js";
|
|
7
|
+
import { assertDecryptedDocumentUpdateMetadata } from "../documentUpdateIntegrity.js";
|
|
8
|
+
import { assertDocumentUpdatePlaintextHash } from "../plaintextHash.js";
|
|
9
|
+
import { assertOnlyRecordKeys, asWebCryptoBytes, readRecordPositiveInteger, readRecordString, readWriteHeader, } from "../readers.js";
|
|
10
|
+
import { DOCUMENT_ENCRYPTED_LORO_UPDATE_FORMAT, DOCUMENT_ENCRYPTED_UPDATE_KEYS, } from "../types.js";
|
|
11
|
+
import { isolateDocumentSyncUpdateError } from "./documentSyncUpdateIsolation.js";
|
|
12
|
+
function parseDocumentEncryptedUpdate(encryptedData) {
|
|
13
|
+
let value;
|
|
14
|
+
try {
|
|
15
|
+
value = JSON.parse(encryptedData);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
throw new Error("Document encrypted update is invalid JSON");
|
|
19
|
+
}
|
|
20
|
+
if (!isPlainRecord(value)) {
|
|
21
|
+
throw new Error("Document encrypted update must be an object");
|
|
22
|
+
}
|
|
23
|
+
assertOnlyRecordKeys(value, DOCUMENT_ENCRYPTED_UPDATE_KEYS, "Document encrypted update");
|
|
24
|
+
if (readRecordString(value, "format", "Document encrypted update") !==
|
|
25
|
+
DOCUMENT_ENCRYPTED_LORO_UPDATE_FORMAT) {
|
|
26
|
+
throw new Error("Document encrypted update format is invalid");
|
|
27
|
+
}
|
|
28
|
+
const version = readRecordPositiveInteger(value, "version", "Document encrypted update");
|
|
29
|
+
if (version !== 1) {
|
|
30
|
+
throw new Error(`Document encrypted update version ${version} is invalid; expected 1`);
|
|
31
|
+
}
|
|
32
|
+
if (readRecordString(value, "encryptionSuite", "Document encrypted update") !==
|
|
33
|
+
CONTENT_RECORD_ENCRYPTION_SUITE) {
|
|
34
|
+
throw new Error("Document encrypted update suite is invalid");
|
|
35
|
+
}
|
|
36
|
+
const iv = base64ToBytes(readRecordString(value, "iv", "Document encrypted update"));
|
|
37
|
+
assertAesGcmIv(iv, "Document encrypted update IV is invalid");
|
|
38
|
+
return {
|
|
39
|
+
ciphertext: base64ToBytes(readRecordString(value, "ciphertext", "Document encrypted update")),
|
|
40
|
+
contentKeyEpoch: readRecordPositiveInteger(value, "contentKeyEpoch", "Document encrypted update"),
|
|
41
|
+
contentRecordId: readRecordString(value, "contentRecordId", "Document encrypted update"),
|
|
42
|
+
metadataHash: readRecordString(value, "metadataHash", "Document encrypted update"),
|
|
43
|
+
nonceDomainHash: readRecordString(value, "nonceDomainHash", "Document encrypted update"),
|
|
44
|
+
iv,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async function assertDocumentEncryptedUpdateMatchesHeader(input) {
|
|
48
|
+
const { encrypted, update } = input;
|
|
49
|
+
const hasCheckpointMetadata = update.checkpointKind !== undefined ||
|
|
50
|
+
update.checkpointPayloadKind !== undefined ||
|
|
51
|
+
update.sourceVersionVector !== undefined;
|
|
52
|
+
if (hasCheckpointMetadata &&
|
|
53
|
+
(update.checkpointKind !== "rotate_baseline" ||
|
|
54
|
+
update.checkpointPayloadKind !== "full_history_snapshot" ||
|
|
55
|
+
!update.sourceVersionVector ||
|
|
56
|
+
!versionVectorsEqual(update.sourceVersionVector, update.partialEndVersionVector))) {
|
|
57
|
+
throw new Error("Document rotation checkpoint metadata mismatch");
|
|
58
|
+
}
|
|
59
|
+
if (encrypted.contentKeyEpoch !== input.contentKeyEpoch) {
|
|
60
|
+
throw new Error("Document encrypted update content-key epoch mismatch");
|
|
61
|
+
}
|
|
62
|
+
if (update.documentId !== input.documentId) {
|
|
63
|
+
throw new Error("Document encrypted update document id mismatch");
|
|
64
|
+
}
|
|
65
|
+
if (encrypted.contentRecordId !==
|
|
66
|
+
readRecordString(update.writeHeader, "contentRecordId", "write header")) {
|
|
67
|
+
throw new Error("Document encrypted update content record mismatch");
|
|
68
|
+
}
|
|
69
|
+
const metadataHash = await computeDocumentContentRecordMetadataHash({
|
|
70
|
+
...(update.checkpointKind === undefined
|
|
71
|
+
? {}
|
|
72
|
+
: { checkpointKind: update.checkpointKind }),
|
|
73
|
+
...(update.checkpointPayloadKind === undefined
|
|
74
|
+
? {}
|
|
75
|
+
: { checkpointPayloadKind: update.checkpointPayloadKind }),
|
|
76
|
+
documentId: input.documentId,
|
|
77
|
+
partialEndVersionVector: update.partialEndVersionVector,
|
|
78
|
+
partialStartVersionVector: update.partialStartVersionVector,
|
|
79
|
+
plaintextHash: update.plaintextHash,
|
|
80
|
+
...(update.sourceVersionVector === undefined
|
|
81
|
+
? {}
|
|
82
|
+
: { sourceVersionVector: update.sourceVersionVector }),
|
|
83
|
+
updateId: update.id,
|
|
84
|
+
});
|
|
85
|
+
if (encrypted.metadataHash !== metadataHash ||
|
|
86
|
+
encrypted.metadataHash !==
|
|
87
|
+
readRecordString(update.writeHeader, "metadataHash", "write header")) {
|
|
88
|
+
throw new Error("Document encrypted update metadata hash mismatch");
|
|
89
|
+
}
|
|
90
|
+
const nonceDomainHash = await computeContentRecordNonceDomainHash({
|
|
91
|
+
version: 1,
|
|
92
|
+
organizationId: input.organizationId,
|
|
93
|
+
objectKind: "document",
|
|
94
|
+
objectId: input.documentId,
|
|
95
|
+
contentKeyEpoch: input.contentKeyEpoch,
|
|
96
|
+
encryptionSuite: CONTENT_RECORD_ENCRYPTION_SUITE,
|
|
97
|
+
contentRecordId: encrypted.contentRecordId,
|
|
98
|
+
});
|
|
99
|
+
if (encrypted.nonceDomainHash !== nonceDomainHash ||
|
|
100
|
+
encrypted.nonceDomainHash !==
|
|
101
|
+
readRecordString(update.writeHeader, "nonceDomainHash", "write header")) {
|
|
102
|
+
throw new Error("Document encrypted update nonce domain mismatch");
|
|
103
|
+
}
|
|
104
|
+
const ciphertextHash = await computeDocumentContentRecordCiphertextHash(input.encryptedData);
|
|
105
|
+
if (ciphertextHash !==
|
|
106
|
+
readRecordString(update.writeHeader, "ciphertextHash", "write header")) {
|
|
107
|
+
throw new Error("Document encrypted update ciphertext hash mismatch");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function verifiedEncryptedSyncUpdate(input) {
|
|
111
|
+
try {
|
|
112
|
+
const encrypted = parseDocumentEncryptedUpdate(input.update.encryptedData);
|
|
113
|
+
await assertDocumentEncryptedUpdateMatchesHeader({
|
|
114
|
+
encrypted,
|
|
115
|
+
encryptedData: input.update.encryptedData,
|
|
116
|
+
...input,
|
|
117
|
+
});
|
|
118
|
+
return encrypted;
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
throw isolateDocumentSyncUpdateError({
|
|
122
|
+
cause: error,
|
|
123
|
+
responseUpdate: input.update,
|
|
124
|
+
stage: "encrypted_record",
|
|
125
|
+
updateId: input.update.id,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** Verifies the encrypted record's structure and every binding to its header. */
|
|
130
|
+
export async function assertDocumentSyncUpdateEncryptedRecord(update) {
|
|
131
|
+
let contentKeyEpoch;
|
|
132
|
+
let documentId;
|
|
133
|
+
let organizationId;
|
|
134
|
+
try {
|
|
135
|
+
const header = readWriteHeader(update.writeHeader, "Document sync response write header");
|
|
136
|
+
if (header.objectKind !== "document") {
|
|
137
|
+
throw new Error("Document sync response write header kind mismatch");
|
|
138
|
+
}
|
|
139
|
+
contentKeyEpoch = header.contentKeyEpoch;
|
|
140
|
+
documentId = header.objectId;
|
|
141
|
+
organizationId = header.organizationId;
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
throw isolateDocumentSyncUpdateError({
|
|
145
|
+
cause: error,
|
|
146
|
+
responseUpdate: update,
|
|
147
|
+
stage: "write_header",
|
|
148
|
+
updateId: update.id,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
await verifiedEncryptedSyncUpdate({
|
|
152
|
+
contentKeyEpoch,
|
|
153
|
+
documentId,
|
|
154
|
+
organizationId,
|
|
155
|
+
update,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async function decryptPayload(input) {
|
|
159
|
+
try {
|
|
160
|
+
const keyInput = {
|
|
161
|
+
contentKeyMaterial: input.contentKeyMaterial,
|
|
162
|
+
contentKeyEpoch: input.contentKeyEpoch,
|
|
163
|
+
contentRecordId: input.encrypted.contentRecordId,
|
|
164
|
+
documentId: input.documentId,
|
|
165
|
+
organizationId: input.organizationId,
|
|
166
|
+
};
|
|
167
|
+
const [recordKey, plaintextHashKey] = await Promise.all([
|
|
168
|
+
deriveDocumentContentRecordKey({ ...keyInput, usage: "decrypt" }),
|
|
169
|
+
deriveDocumentPlaintextHashKey(keyInput),
|
|
170
|
+
]);
|
|
171
|
+
const updateData = new Uint8Array(await crypto.subtle.decrypt({
|
|
172
|
+
name: "AES-GCM",
|
|
173
|
+
iv: asWebCryptoBytes(input.encrypted.iv),
|
|
174
|
+
additionalData: contentRecordAdditionalDataBytes({
|
|
175
|
+
contentKeyEpoch: input.contentKeyEpoch,
|
|
176
|
+
contentRecordId: input.encrypted.contentRecordId,
|
|
177
|
+
documentId: input.documentId,
|
|
178
|
+
metadataHash: input.encrypted.metadataHash,
|
|
179
|
+
nonceDomainHash: input.encrypted.nonceDomainHash,
|
|
180
|
+
organizationId: input.organizationId,
|
|
181
|
+
}),
|
|
182
|
+
}, recordKey, asWebCryptoBytes(input.encrypted.ciphertext)));
|
|
183
|
+
return { plaintextHashKey, updateData };
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
throw isolateDocumentSyncUpdateError({
|
|
187
|
+
cause: error,
|
|
188
|
+
responseUpdate: input.update,
|
|
189
|
+
stage: "decrypt",
|
|
190
|
+
updateId: input.update.id,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
export async function decryptDocumentSyncUpdate(input) {
|
|
195
|
+
const encrypted = await verifiedEncryptedSyncUpdate(input);
|
|
196
|
+
const { plaintextHashKey, updateData } = await decryptPayload({
|
|
197
|
+
...input,
|
|
198
|
+
encrypted,
|
|
199
|
+
});
|
|
200
|
+
try {
|
|
201
|
+
await assertDocumentUpdatePlaintextHash(updateData, input.update.plaintextHash, plaintextHashKey);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
throw isolateDocumentSyncUpdateError({
|
|
205
|
+
cause: error,
|
|
206
|
+
responseUpdate: input.update,
|
|
207
|
+
stage: "plaintext_integrity",
|
|
208
|
+
updateId: input.update.id,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
assertDecryptedDocumentUpdateMetadata(updateData, input.update);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
throw isolateDocumentSyncUpdateError({
|
|
216
|
+
cause: error,
|
|
217
|
+
responseUpdate: input.update,
|
|
218
|
+
stage: "loro_metadata",
|
|
219
|
+
updateId: input.update.id,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
...(input.update.checkpointKind === undefined
|
|
224
|
+
? {}
|
|
225
|
+
: { checkpointKind: input.update.checkpointKind }),
|
|
226
|
+
...(input.update.checkpointPayloadKind === undefined
|
|
227
|
+
? {}
|
|
228
|
+
: { checkpointPayloadKind: input.update.checkpointPayloadKind }),
|
|
229
|
+
id: input.update.id,
|
|
230
|
+
partialEndVersionVector: input.update.partialEndVersionVector,
|
|
231
|
+
partialStartVersionVector: input.update.partialStartVersionVector,
|
|
232
|
+
...(input.update.sourceVersionVector === undefined
|
|
233
|
+
? {}
|
|
234
|
+
: { sourceVersionVector: input.update.sourceVersionVector }),
|
|
235
|
+
updateData,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=documentSyncUpdateDecryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentSyncUpdateDecryption.js","sourceRoot":"","sources":["documentSyncUpdateDecryption.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,+BAA+B,EAC/B,mCAAmC,EACnC,0CAA0C,EAC1C,wCAAwC,GACzC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,qCAAqC,EACrC,8BAA8B,GAE/B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAI/E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AC,MAAM,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,8BAA8B,CAAC;YACnC,KAAK,EAAE,KAAK;YACZ,cAAc,EAAE,KAAK,CAAC,MAAM;YAC5B,KAAK,EAAE,eAAe;YACtB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;IACD,OAAO;QACL,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,KAAK,SAAS;YAC3C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QACpD,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,KAAK,SAAS;YAClD,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,qBAAqB,EAAE,KAAK,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAClE,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE;QACnB,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;QAC7D,yBAAyB,EAAE,KAAK,CAAC,MAAM,CAAC,yBAAyB;QACjE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,KAAK,SAAS;YAChD,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC9D,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["import {\n assertAesGcmIv,\n CONTENT_RECORD_ENCRYPTION_SUITE,\n computeContentRecordNonceDomainHash,\n computeDocumentContentRecordCiphertextHash,\n computeDocumentContentRecordMetadataHash,\n} from \"@tearleads/crypto\";\nimport { base64ToBytes } from \"@tearleads/encoding\";\nimport { versionVectorsEqual } from \"@tearleads/loro\";\nimport { isPlainObject as isPlainRecord } from \"@tearleads/validators/isPlainObject\";\nimport type { DocumentSyncResponse } from \"@tearleads/validators/response\";\nimport { contentRecordAdditionalDataBytes } from \"../contentRecordAdditionalData\";\nimport {\n deriveDocumentContentRecordKey,\n deriveDocumentPlaintextHashKey,\n} from \"../contentRecordKeys\";\nimport { assertDecryptedDocumentUpdateMetadata } from \"../documentUpdateIntegrity\";\nimport { assertDocumentUpdatePlaintextHash } from \"../plaintextHash\";\nimport {\n assertOnlyRecordKeys,\n asWebCryptoBytes,\n readRecordPositiveInteger,\n readRecordString,\n readWriteHeader,\n} from \"../readers\";\nimport {\n type DecryptedDocumentSyncUpdate,\n DOCUMENT_ENCRYPTED_LORO_UPDATE_FORMAT,\n DOCUMENT_ENCRYPTED_UPDATE_KEYS,\n type ParsedDocumentEncryptedUpdate,\n} from \"../types\";\nimport { isolateDocumentSyncUpdateError } from \"./documentSyncUpdateIsolation\";\n\ntype SyncResponseUpdate = DocumentSyncResponse[\"updates\"][number];\n\nfunction parseDocumentEncryptedUpdate(\n encryptedData: string,\n): ParsedDocumentEncryptedUpdate {\n let value: unknown;\n try {\n value = JSON.parse(encryptedData);\n } catch {\n throw new Error(\"Document encrypted update is invalid JSON\");\n }\n if (!isPlainRecord(value)) {\n throw new Error(\"Document encrypted update must be an object\");\n }\n assertOnlyRecordKeys(\n value,\n DOCUMENT_ENCRYPTED_UPDATE_KEYS,\n \"Document encrypted update\",\n );\n if (\n readRecordString(value, \"format\", \"Document encrypted update\") !==\n DOCUMENT_ENCRYPTED_LORO_UPDATE_FORMAT\n ) {\n throw new Error(\"Document encrypted update format is invalid\");\n }\n const version = readRecordPositiveInteger(\n value,\n \"version\",\n \"Document encrypted update\",\n );\n if (version !== 1) {\n throw new Error(\n `Document encrypted update version ${version} is invalid; expected 1`,\n );\n }\n if (\n readRecordString(value, \"encryptionSuite\", \"Document encrypted update\") !==\n CONTENT_RECORD_ENCRYPTION_SUITE\n ) {\n throw new Error(\"Document encrypted update suite is invalid\");\n }\n\n const iv = base64ToBytes(\n readRecordString(value, \"iv\", \"Document encrypted update\"),\n );\n assertAesGcmIv(iv, \"Document encrypted update IV is invalid\");\n return {\n ciphertext: base64ToBytes(\n readRecordString(value, \"ciphertext\", \"Document encrypted update\"),\n ),\n contentKeyEpoch: readRecordPositiveInteger(\n value,\n \"contentKeyEpoch\",\n \"Document encrypted update\",\n ),\n contentRecordId: readRecordString(\n value,\n \"contentRecordId\",\n \"Document encrypted update\",\n ),\n metadataHash: readRecordString(\n value,\n \"metadataHash\",\n \"Document encrypted update\",\n ),\n nonceDomainHash: readRecordString(\n value,\n \"nonceDomainHash\",\n \"Document encrypted update\",\n ),\n iv,\n };\n}\n\nasync function assertDocumentEncryptedUpdateMatchesHeader(input: {\n contentKeyEpoch: number;\n documentId: string;\n encrypted: ParsedDocumentEncryptedUpdate;\n encryptedData: string;\n organizationId: string;\n update: SyncResponseUpdate;\n}): Promise<void> {\n const { encrypted, update } = input;\n const hasCheckpointMetadata =\n update.checkpointKind !== undefined ||\n update.checkpointPayloadKind !== undefined ||\n update.sourceVersionVector !== undefined;\n if (\n hasCheckpointMetadata &&\n (update.checkpointKind !== \"rotate_baseline\" ||\n update.checkpointPayloadKind !== \"full_history_snapshot\" ||\n !update.sourceVersionVector ||\n !versionVectorsEqual(\n update.sourceVersionVector,\n update.partialEndVersionVector,\n ))\n ) {\n throw new Error(\"Document rotation checkpoint metadata mismatch\");\n }\n if (encrypted.contentKeyEpoch !== input.contentKeyEpoch) {\n throw new Error(\"Document encrypted update content-key epoch mismatch\");\n }\n if (update.documentId !== input.documentId) {\n throw new Error(\"Document encrypted update document id mismatch\");\n }\n if (\n encrypted.contentRecordId !==\n readRecordString(update.writeHeader, \"contentRecordId\", \"write header\")\n ) {\n throw new Error(\"Document encrypted update content record mismatch\");\n }\n\n const metadataHash = await computeDocumentContentRecordMetadataHash({\n ...(update.checkpointKind === undefined\n ? {}\n : { checkpointKind: update.checkpointKind }),\n ...(update.checkpointPayloadKind === undefined\n ? {}\n : { checkpointPayloadKind: update.checkpointPayloadKind }),\n documentId: input.documentId,\n partialEndVersionVector: update.partialEndVersionVector,\n partialStartVersionVector: update.partialStartVersionVector,\n plaintextHash: update.plaintextHash,\n ...(update.sourceVersionVector === undefined\n ? {}\n : { sourceVersionVector: update.sourceVersionVector }),\n updateId: update.id,\n });\n if (\n encrypted.metadataHash !== metadataHash ||\n encrypted.metadataHash !==\n readRecordString(update.writeHeader, \"metadataHash\", \"write header\")\n ) {\n throw new Error(\"Document encrypted update metadata hash mismatch\");\n }\n\n const nonceDomainHash = await computeContentRecordNonceDomainHash({\n version: 1,\n organizationId: input.organizationId,\n objectKind: \"document\",\n objectId: input.documentId,\n contentKeyEpoch: input.contentKeyEpoch,\n encryptionSuite: CONTENT_RECORD_ENCRYPTION_SUITE,\n contentRecordId: encrypted.contentRecordId,\n });\n if (\n encrypted.nonceDomainHash !== nonceDomainHash ||\n encrypted.nonceDomainHash !==\n readRecordString(update.writeHeader, \"nonceDomainHash\", \"write header\")\n ) {\n throw new Error(\"Document encrypted update nonce domain mismatch\");\n }\n const ciphertextHash = await computeDocumentContentRecordCiphertextHash(\n input.encryptedData,\n );\n if (\n ciphertextHash !==\n readRecordString(update.writeHeader, \"ciphertextHash\", \"write header\")\n ) {\n throw new Error(\"Document encrypted update ciphertext hash mismatch\");\n }\n}\n\nasync function verifiedEncryptedSyncUpdate(input: {\n contentKeyEpoch: number;\n documentId: string;\n organizationId: string;\n update: SyncResponseUpdate;\n}): Promise<ParsedDocumentEncryptedUpdate> {\n try {\n const encrypted = parseDocumentEncryptedUpdate(input.update.encryptedData);\n await assertDocumentEncryptedUpdateMatchesHeader({\n encrypted,\n encryptedData: input.update.encryptedData,\n ...input,\n });\n return encrypted;\n } catch (error) {\n throw isolateDocumentSyncUpdateError({\n cause: error,\n responseUpdate: input.update,\n stage: \"encrypted_record\",\n updateId: input.update.id,\n });\n }\n}\n\n/** Verifies the encrypted record's structure and every binding to its header. */\nexport async function assertDocumentSyncUpdateEncryptedRecord(\n update: SyncResponseUpdate,\n): Promise<void> {\n let contentKeyEpoch: number;\n let documentId: string;\n let organizationId: string;\n try {\n const header = readWriteHeader(\n update.writeHeader,\n \"Document sync response write header\",\n );\n if (header.objectKind !== \"document\") {\n throw new Error(\"Document sync response write header kind mismatch\");\n }\n contentKeyEpoch = header.contentKeyEpoch;\n documentId = header.objectId;\n organizationId = header.organizationId;\n } catch (error) {\n throw isolateDocumentSyncUpdateError({\n cause: error,\n responseUpdate: update,\n stage: \"write_header\",\n updateId: update.id,\n });\n }\n await verifiedEncryptedSyncUpdate({\n contentKeyEpoch,\n documentId,\n organizationId,\n update,\n });\n}\n\nasync function decryptPayload(input: {\n contentKeyEpoch: number;\n contentKeyMaterial: CryptoKey;\n documentId: string;\n encrypted: ParsedDocumentEncryptedUpdate;\n organizationId: string;\n update: SyncResponseUpdate;\n}): Promise<{ plaintextHashKey: CryptoKey; updateData: Uint8Array }> {\n try {\n const keyInput = {\n contentKeyMaterial: input.contentKeyMaterial,\n contentKeyEpoch: input.contentKeyEpoch,\n contentRecordId: input.encrypted.contentRecordId,\n documentId: input.documentId,\n organizationId: input.organizationId,\n };\n const [recordKey, plaintextHashKey] = await Promise.all([\n deriveDocumentContentRecordKey({ ...keyInput, usage: \"decrypt\" }),\n deriveDocumentPlaintextHashKey(keyInput),\n ]);\n const updateData = new Uint8Array(\n await crypto.subtle.decrypt(\n {\n name: \"AES-GCM\",\n iv: asWebCryptoBytes(input.encrypted.iv),\n additionalData: contentRecordAdditionalDataBytes({\n contentKeyEpoch: input.contentKeyEpoch,\n contentRecordId: input.encrypted.contentRecordId,\n documentId: input.documentId,\n metadataHash: input.encrypted.metadataHash,\n nonceDomainHash: input.encrypted.nonceDomainHash,\n organizationId: input.organizationId,\n }),\n },\n recordKey,\n asWebCryptoBytes(input.encrypted.ciphertext),\n ),\n );\n return { plaintextHashKey, updateData };\n } catch (error) {\n throw isolateDocumentSyncUpdateError({\n cause: error,\n responseUpdate: input.update,\n stage: \"decrypt\",\n updateId: input.update.id,\n });\n }\n}\n\nexport async function decryptDocumentSyncUpdate(input: {\n contentKeyEpoch: number;\n contentKeyMaterial: CryptoKey;\n documentId: string;\n organizationId: string;\n update: SyncResponseUpdate;\n}): Promise<DecryptedDocumentSyncUpdate> {\n const encrypted = await verifiedEncryptedSyncUpdate(input);\n const { plaintextHashKey, updateData } = await decryptPayload({\n ...input,\n encrypted,\n });\n try {\n await assertDocumentUpdatePlaintextHash(\n updateData,\n input.update.plaintextHash,\n plaintextHashKey,\n );\n } catch (error) {\n throw isolateDocumentSyncUpdateError({\n cause: error,\n responseUpdate: input.update,\n stage: \"plaintext_integrity\",\n updateId: input.update.id,\n });\n }\n try {\n assertDecryptedDocumentUpdateMetadata(updateData, input.update);\n } catch (error) {\n throw isolateDocumentSyncUpdateError({\n cause: error,\n responseUpdate: input.update,\n stage: \"loro_metadata\",\n updateId: input.update.id,\n });\n }\n return {\n ...(input.update.checkpointKind === undefined\n ? {}\n : { checkpointKind: input.update.checkpointKind }),\n ...(input.update.checkpointPayloadKind === undefined\n ? {}\n : { checkpointPayloadKind: input.update.checkpointPayloadKind }),\n id: input.update.id,\n partialEndVersionVector: input.update.partialEndVersionVector,\n partialStartVersionVector: input.update.partialStartVersionVector,\n ...(input.update.sourceVersionVector === undefined\n ? {}\n : { sourceVersionVector: input.update.sourceVersionVector }),\n updateData,\n };\n}\n"]}
|