@tearleads/client-sdk 0.1.63 → 0.1.64
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/data/documents/blob/shared/projection.js +1 -1
- package/data/documents/blob/shared/projection.js.map +1 -1
- package/data/documents/shared/projectionContentKeys.js +1 -1
- package/data/documents/shared/projectionContentKeys.js.map +1 -1
- package/data/documents/shared/syncResponseAuthorization.js +1 -1
- package/data/documents/shared/syncResponseAuthorization.js.map +1 -1
- package/data/keyingProjectionVerification/{accessManifestCheckpointEnforcement.js → checkpoints/accessManifestCheckpointEnforcement.js} +2 -2
- package/data/keyingProjectionVerification/checkpoints/accessManifestCheckpointEnforcement.js.map +1 -0
- package/data/keyingProjectionVerification/{bundleVerification.js → checkpoints/bundleVerification.js} +5 -5
- package/data/keyingProjectionVerification/checkpoints/bundleVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{checkpointContext.d.ts → checkpoints/checkpointContext.d.ts} +6 -6
- package/data/keyingProjectionVerification/{checkpointContext.js → checkpoints/checkpointContext.js} +6 -6
- package/data/keyingProjectionVerification/checkpoints/checkpointContext.js.map +1 -0
- package/data/keyingProjectionVerification/{manifestCheckpointVerification.js → checkpoints/manifestCheckpointVerification.js} +2 -2
- package/data/keyingProjectionVerification/checkpoints/manifestCheckpointVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{containerAncestorCitations.js → container/containerAncestorCitations.js} +4 -4
- package/data/keyingProjectionVerification/container/containerAncestorCitations.js.map +1 -0
- package/data/keyingProjectionVerification/{containerCreateManifest.js → container/containerCreateManifest.js} +1 -1
- package/data/keyingProjectionVerification/{containerDestinationVerification.js → container/containerDestinationVerification.js} +4 -4
- package/data/keyingProjectionVerification/container/containerDestinationVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{containerManifestVerification.js → container/containerManifestVerification.js} +7 -7
- package/data/keyingProjectionVerification/container/containerManifestVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{containerPathVerification.js → container/containerPathVerification.js} +2 -2
- package/data/keyingProjectionVerification/container/containerPathVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{containerProjectionVerification.d.ts → container/containerProjectionVerification.d.ts} +7 -7
- package/data/keyingProjectionVerification/{containerProjectionVerification.js → container/containerProjectionVerification.js} +9 -9
- package/data/keyingProjectionVerification/container/containerProjectionVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{documentDependencyPaths.d.ts → document/documentDependencyPaths.d.ts} +1 -1
- package/data/keyingProjectionVerification/{documentDependencyPaths.js → document/documentDependencyPaths.js} +3 -3
- package/data/keyingProjectionVerification/document/documentDependencyPaths.js.map +1 -0
- package/data/keyingProjectionVerification/{documentManifestPolicies.js → document/documentManifestPolicies.js} +2 -2
- package/data/keyingProjectionVerification/document/documentManifestPolicies.js.map +1 -0
- package/data/keyingProjectionVerification/{documentManifestPredecessor.js → document/documentManifestPredecessor.js} +1 -1
- package/data/keyingProjectionVerification/{documentManifestVerification.js → document/documentManifestVerification.js} +5 -5
- package/data/keyingProjectionVerification/document/documentManifestVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{documentProjectionVerification.d.ts → document/documentProjectionVerification.d.ts} +4 -4
- package/data/keyingProjectionVerification/{documentProjectionVerification.js → document/documentProjectionVerification.js} +9 -9
- package/data/keyingProjectionVerification/document/documentProjectionVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{documentPurgeCheckpointCurrency.js → documentPurge/documentPurgeCheckpointCurrency.js} +12 -12
- package/data/keyingProjectionVerification/documentPurge/documentPurgeCheckpointCurrency.js.map +1 -0
- package/data/keyingProjectionVerification/{documentPurgeCheckpointEnforcement.js → documentPurge/documentPurgeCheckpointEnforcement.js} +2 -2
- package/data/keyingProjectionVerification/documentPurge/documentPurgeCheckpointEnforcement.js.map +1 -0
- package/data/keyingProjectionVerification/{documentPurgeDocumentChainVerification.js → documentPurge/documentPurgeDocumentChainVerification.js} +8 -8
- package/data/keyingProjectionVerification/documentPurge/documentPurgeDocumentChainVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{documentPurgePolicyCheckpoints.js → documentPurge/documentPurgePolicyCheckpoints.js} +2 -2
- package/data/keyingProjectionVerification/documentPurge/documentPurgePolicyCheckpoints.js.map +1 -0
- package/data/keyingProjectionVerification/{documentPurgePolicyCurrency.js → documentPurge/documentPurgePolicyCurrency.js} +4 -4
- package/data/keyingProjectionVerification/documentPurge/documentPurgePolicyCurrency.js.map +1 -0
- package/data/keyingProjectionVerification/{documentPurgePrincipalEvidence.js → documentPurge/documentPurgePrincipalEvidence.js} +3 -3
- package/data/keyingProjectionVerification/documentPurge/documentPurgePrincipalEvidence.js.map +1 -0
- package/data/keyingProjectionVerification/{documentPurgeProofVerification.d.ts → documentPurge/documentPurgeProofVerification.d.ts} +5 -5
- package/data/keyingProjectionVerification/{documentPurgeProofVerification.js → documentPurge/documentPurgeProofVerification.js} +10 -10
- 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/{mergeProjectionPolicyEvidence.js → principalPolicy/mergeProjectionPolicyEvidence.js} +2 -2
- package/data/keyingProjectionVerification/principalPolicy/mergeProjectionPolicyEvidence.js.map +1 -0
- package/data/keyingProjectionVerification/{organizationFounderBinding.js → principalPolicy/organizationFounderBinding.js} +3 -3
- package/data/keyingProjectionVerification/principalPolicy/organizationFounderBinding.js.map +1 -0
- package/data/keyingProjectionVerification/{principalPolicyCache.js → principalPolicy/principalPolicyCache.js} +6 -6
- package/data/keyingProjectionVerification/principalPolicy/principalPolicyCache.js.map +1 -0
- package/data/keyingProjectionVerification/{principalPolicyVerification.js → principalPolicy/principalPolicyVerification.js} +12 -12
- package/data/keyingProjectionVerification/principalPolicy/principalPolicyVerification.js.map +1 -0
- package/data/keyingProjectionVerification/{projectionAuthorizationEvidence.js → principalPolicy/projectionAuthorizationEvidence.js} +3 -3
- package/data/keyingProjectionVerification/principalPolicy/projectionAuthorizationEvidence.js.map +1 -0
- package/data/keyingProjectionVerification/{projectionPolicyEvidence.js → principalPolicy/projectionPolicyEvidence.js} +3 -3
- package/data/keyingProjectionVerification/principalPolicy/projectionPolicyEvidence.js.map +1 -0
- package/data/keyingProjectionVerification/{resolvedPrincipalPolicy.js → principalPolicy/resolvedPrincipalPolicy.js} +6 -6
- package/data/keyingProjectionVerification/principalPolicy/resolvedPrincipalPolicy.js.map +1 -0
- package/package.json +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/{containerStatePersistence.js → containerState/containerStatePersistence.js} +2 -2
- package/stores/container-contents/containerState/containerStatePersistence.js.map +1 -0
- package/stores/container-contents/{missingContainerState.js → containerState/missingContainerState.js} +1 -1
- package/stores/container-contents/containerState/missingContainerState.js.map +1 -0
- package/stores/container-contents/containerState/missingSyncedContainerState.js.map +1 -0
- package/stores/container-contents/{reconcilableContainer.d.ts → containerState/reconcilableContainer.d.ts} +1 -1
- package/stores/container-contents/containerState/reconcilableContainer.js.map +1 -0
- package/stores/container-contents/{documentRecovery.js → documentWork/documentRecovery.js} +6 -6
- package/stores/container-contents/documentWork/documentRecovery.js.map +1 -0
- package/stores/container-contents/{documentRotation.js → documentWork/documentRotation.js} +2 -2
- package/stores/container-contents/documentWork/documentRotation.js.map +1 -0
- package/stores/container-contents/{documentWork.js → documentWork/index.js} +1 -1
- package/stores/container-contents/documentWork/index.js.map +1 -0
- package/stores/container-contents/{backgroundHydration.js → hydration/backgroundHydration.js} +3 -3
- package/stores/container-contents/hydration/backgroundHydration.js.map +1 -0
- package/stores/container-contents/{remoteHydrationRequest.js → hydration/remoteHydrationRequest.js} +3 -3
- package/stores/container-contents/hydration/remoteHydrationRequest.js.map +1 -0
- package/stores/container-contents/{startupHydration.js → hydration/startupHydration.js} +3 -3
- 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/{containerPurgeCore.js → operations/containerPurgeCore.js} +4 -4
- package/stores/container-contents/operations/containerPurgeCore.js.map +1 -0
- package/stores/container-contents/operations/emptyTrashOperation.js.map +1 -0
- package/stores/container-contents/{groupRewrapOperation.js → operations/groupRewrapOperation.js} +2 -2
- package/stores/container-contents/operations/groupRewrapOperation.js.map +1 -0
- package/stores/container-contents/{operations.js → operations/index.js} +18 -18
- package/stores/container-contents/operations/index.js.map +1 -0
- package/stores/container-contents/operations/purgeContainerOperation.js.map +1 -0
- package/stores/container-contents/{reportShareFailure.js → operations/reportShareFailure.js} +4 -4
- package/stores/container-contents/operations/reportShareFailure.js.map +1 -0
- package/stores/container-contents/{setContainerIconOperation.js → operations/setContainerIconOperation.js} +6 -6
- package/stores/container-contents/operations/setContainerIconOperation.js.map +1 -0
- package/stores/container-contents/{shareOperations.js → operations/shareOperations.js} +6 -6
- package/stores/container-contents/operations/shareOperations.js.map +1 -0
- package/stores/container-contents/remoteEvents/remoteBackedContainerState.js.map +1 -0
- package/stores/container-contents/{remoteContainerIngestion.js → remoteEvents/remoteContainerIngestion.js} +4 -4
- package/stores/container-contents/remoteEvents/remoteContainerIngestion.js.map +1 -0
- package/stores/container-contents/{remoteEventProjectionInvalidation.js → remoteEvents/remoteEventProjectionInvalidation.js} +1 -1
- package/stores/container-contents/remoteEvents/remoteEventProjectionInvalidation.js.map +1 -0
- package/stores/container-contents/{remoteEventSync.js → remoteEvents/remoteEventSync.js} +4 -4
- package/stores/container-contents/remoteEvents/remoteEventSync.js.map +1 -0
- package/stores/container-contents/{remoteWriteGuards.js → remoteWrites/remoteWriteGuards.js} +2 -2
- package/stores/container-contents/remoteWrites/remoteWriteGuards.js.map +1 -0
- package/stores/container-contents/{remoteWriteQueue.js → remoteWrites/remoteWriteQueue.js} +1 -1
- 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.d.ts → syncAgent/index.d.ts} +2 -2
- package/stores/container-contents/{syncAgent.js → syncAgent/index.js} +14 -14
- package/stores/container-contents/syncAgent/index.js.map +1 -0
- package/stores/container-contents/{metadataSyncSignal.js → syncAgent/metadataSyncSignal.js} +1 -1
- package/stores/container-contents/{metadataSyncSignal.js.map → syncAgent/metadataSyncSignal.js.map} +1 -1
- package/stores/container-contents/{syncAgentTypes.d.ts → syncAgent/syncAgentTypes.d.ts} +5 -5
- package/stores/container-contents/syncAgent/syncAgentTypes.js.map +1 -0
- package/stores/container-contents/{syncLaneIteration.js → syncAgent/syncLaneIteration.js} +11 -11
- package/stores/container-contents/syncAgent/syncLaneIteration.js.map +1 -0
- package/stores/container-contents/{existingSystemContainer.js → systemContainers/existingSystemContainer.js} +4 -4
- package/stores/container-contents/systemContainers/existingSystemContainer.js.map +1 -0
- package/stores/container-contents/{organizationMetadataSystemContainer.js → systemContainers/organizationMetadataSystemContainer.js} +2 -2
- package/stores/container-contents/systemContainers/organizationMetadataSystemContainer.js.map +1 -0
- package/stores/container-contents/{systemContainerHydration.js → systemContainers/systemContainerHydration.js} +3 -3
- package/stores/container-contents/systemContainers/systemContainerHydration.js.map +1 -0
- package/stores/container-contents/{systemContainerIcon.js → systemContainers/systemContainerIcon.js} +5 -5
- package/stores/container-contents/systemContainers/systemContainerIcon.js.map +1 -0
- package/stores/container-contents/systemContainers/systemContainerLookup.js.map +1 -0
- package/stores/container-contents/{systemContainerPostCreate.js → systemContainers/systemContainerPostCreate.js} +2 -2
- package/stores/container-contents/systemContainers/systemContainerPostCreate.js.map +1 -0
- package/stores/container-contents/{systemContainerPromotion.js → systemContainers/systemContainerPromotion.js} +1 -1
- 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/{attachmentSourceUpload.js → attachmentUpload/attachmentSourceUpload.js} +4 -4
- package/stores/documents/documentStore/attachmentUpload/attachmentSourceUpload.js.map +1 -0
- package/stores/documents/documentStore/{attachmentStaging.js → attachmentUpload/attachmentStaging.js} +5 -5
- package/stores/documents/documentStore/attachmentUpload/attachmentStaging.js.map +1 -0
- package/stores/documents/documentStore/{attachmentUploadAttempt.js → attachmentUpload/attachmentUploadAttempt.js} +2 -2
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadAttempt.js.map +1 -0
- package/stores/documents/documentStore/{attachmentUploadLane.js → attachmentUpload/attachmentUploadLane.js} +1 -1
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadLane.js.map +1 -0
- package/stores/documents/documentStore/{attachmentUploadResume.js → attachmentUpload/attachmentUploadResume.js} +4 -4
- package/stores/documents/documentStore/attachmentUpload/attachmentUploadResume.js.map +1 -0
- package/stores/documents/documentStore/{attachmentDetachState.js → attachments/attachmentDetachState.js} +1 -1
- package/stores/documents/documentStore/attachments/attachmentDetachState.js.map +1 -0
- package/stores/documents/documentStore/{attachmentHydration.js → attachments/attachmentHydration.js} +5 -5
- package/stores/documents/documentStore/attachments/attachmentHydration.js.map +1 -0
- package/stores/documents/documentStore/{attachmentHydrationCommit.js → attachments/attachmentHydrationCommit.js} +3 -3
- package/stores/documents/documentStore/attachments/attachmentHydrationCommit.js.map +1 -0
- package/stores/documents/documentStore/{attachmentIntents.js → attachments/attachmentIntents.js} +2 -2
- package/stores/documents/documentStore/attachments/attachmentIntents.js.map +1 -0
- package/stores/documents/documentStore/{attachmentMutationPersistence.js → attachments/attachmentMutationPersistence.js} +4 -4
- package/stores/documents/documentStore/attachments/attachmentMutationPersistence.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentPersistFollowup.js.map +1 -0
- package/stores/documents/documentStore/{attachmentPersistence.js → attachments/attachmentPersistence.js} +4 -4
- package/stores/documents/documentStore/attachments/attachmentPersistence.js.map +1 -0
- package/stores/documents/documentStore/{attachmentRemoval.js → attachments/attachmentRemoval.js} +11 -11
- package/stores/documents/documentStore/attachments/attachmentRemoval.js.map +1 -0
- package/stores/documents/documentStore/attachments/attachmentSnapshot.js.map +1 -0
- package/stores/documents/documentStore/{attachmentWriteGeneration.js → attachments/attachmentWriteGeneration.js} +2 -2
- package/stores/documents/documentStore/attachments/attachmentWriteGeneration.js.map +1 -0
- package/stores/documents/documentStore/{attachments.js → attachments/index.js} +11 -11
- package/stores/documents/documentStore/attachments/index.js.map +1 -0
- package/stores/documents/documentStore/{documentHistoryCompaction.js → history/documentHistoryCompaction.js} +4 -4
- package/stores/documents/documentStore/history/documentHistoryCompaction.js.map +1 -0
- package/stores/documents/documentStore/{durableDocumentReload.js → history/durableDocumentReload.js} +6 -6
- package/stores/documents/documentStore/history/durableDocumentReload.js.map +1 -0
- package/stores/documents/documentStore/{historyRebuild.js → history/historyRebuild.js} +6 -6
- package/stores/documents/documentStore/history/historyRebuild.js.map +1 -0
- package/stores/documents/{documentStore.d.ts → documentStore/index.d.ts} +5 -5
- package/stores/documents/{documentStore.js → documentStore/index.js} +18 -18
- package/stores/documents/documentStore/index.js.map +1 -0
- package/stores/documents/documentStore/{deferredInitialUpdate.js → initialization/deferredInitialUpdate.js} +9 -9
- package/stores/documents/documentStore/initialization/deferredInitialUpdate.js.map +1 -0
- package/stores/documents/documentStore/{initialization.js → initialization/index.js} +14 -14
- package/stores/documents/documentStore/initialization/index.js.map +1 -0
- package/stores/documents/documentStore/{initializationAttachments.js → initialization/initializationAttachments.js} +1 -1
- package/stores/documents/documentStore/initialization/initializationAttachments.js.map +1 -0
- package/stores/documents/documentStore/{initializationHistory.js → initialization/initializationHistory.js} +3 -3
- package/stores/documents/documentStore/initialization/initializationHistory.js.map +1 -0
- package/stores/documents/documentStore/{initializationRecovery.js → initialization/initializationRecovery.js} +7 -7
- 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.js → rotation/index.js} +14 -14
- package/stores/documents/documentStore/rotation/index.js.map +1 -0
- package/stores/documents/documentStore/{rotationProvenance.js → rotation/rotationProvenance.js} +2 -2
- package/stores/documents/documentStore/rotation/rotationProvenance.js.map +1 -0
- package/stores/documents/documentStore/{rotationSettlement.js → rotation/rotationSettlement.js} +9 -9
- 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.js → sync/index.js} +7 -7
- package/stores/documents/documentStore/sync/index.js.map +1 -0
- package/stores/documents/documentStore/{pullContinuationInvalidation.js → sync/pullContinuationInvalidation.js} +3 -3
- package/stores/documents/documentStore/sync/pullContinuationInvalidation.js.map +1 -0
- package/stores/documents/documentStore/{remoteRevalidationTelemetry.js → sync/remoteRevalidationTelemetry.js} +1 -1
- 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/{syncAttachmentSettlement.js → sync/syncAttachmentSettlement.js} +3 -3
- package/stores/documents/documentStore/sync/syncAttachmentSettlement.js.map +1 -0
- package/stores/documents/documentStore/{syncAttachments.js → sync/syncAttachments.js} +7 -7
- package/stores/documents/documentStore/sync/syncAttachments.js.map +1 -0
- package/stores/documents/documentStore/{syncDetachedAttachments.js → sync/syncDetachedAttachments.js} +7 -7
- package/stores/documents/documentStore/sync/syncDetachedAttachments.js.map +1 -0
- package/stores/documents/documentStore/{syncFinalize.js → sync/syncFinalize.js} +9 -9
- package/stores/documents/documentStore/sync/syncFinalize.js.map +1 -0
- package/stores/documents/documentStore/sync/syncGeneration.js.map +1 -0
- package/stores/documents/documentStore/{syncOutgoingCoverage.js → sync/syncOutgoingCoverage.js} +4 -4
- package/stores/documents/documentStore/sync/syncOutgoingCoverage.js.map +1 -0
- package/stores/documents/documentStore/{syncRemoteSignals.js → sync/syncRemoteSignals.js} +4 -4
- package/stores/documents/documentStore/sync/syncRemoteSignals.js.map +1 -0
- package/stores/documents/documentStore/{syncRequest.js → sync/syncRequest.js} +8 -8
- package/stores/documents/documentStore/sync/syncRequest.js.map +1 -0
- package/stores/documents/documentStore/{syncShared.js → sync/syncShared.js} +8 -8
- package/stores/documents/documentStore/sync/syncShared.js.map +1 -0
- package/stores/documents/documentStore/{syncUpdateImport.js → sync/syncUpdateImport.js} +3 -3
- package/stores/documents/documentStore/sync/syncUpdateImport.js.map +1 -0
- package/stores/documents/documentStore/{versionCoverage.js → sync/versionCoverage.js} +1 -1
- 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/hydration/decrypt.js +1 -1
- package/workflows/blobs/hydration/decrypt.js.map +1 -1
- package/workflows/container-contents/container-state/{createAdoption.js → create/createAdoption.js} +6 -6
- package/workflows/container-contents/container-state/create/createAdoption.js.map +1 -0
- package/workflows/container-contents/container-state/{createChild.js → create/createChild.js} +7 -7
- package/workflows/container-contents/container-state/create/createChild.js.map +1 -0
- package/workflows/container-contents/container-state/{createIntentDepth.js → create/createIntentDepth.js} +2 -2
- 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/{createIntentSync.js → create/createIntentSync.js} +7 -7
- package/workflows/container-contents/container-state/create/createIntentSync.js.map +1 -0
- package/workflows/container-contents/container-state/{createTerminalFailure.js → create/createTerminalFailure.js} +2 -2
- package/workflows/container-contents/container-state/create/createTerminalFailure.js.map +1 -0
- package/workflows/container-contents/container-state/{createWithMetadata.js → create/createWithMetadata.js} +9 -9
- package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -0
- package/workflows/container-contents/container-state/{createWithMetadataPlan.js → create/createWithMetadataPlan.js} +4 -4
- package/workflows/container-contents/container-state/create/createWithMetadataPlan.js.map +1 -0
- package/workflows/container-contents/container-state/{localPurgeScope.js → purge/localPurgeScope.js} +1 -1
- package/workflows/container-contents/container-state/purge/localPurgeScope.js.map +1 -0
- package/workflows/container-contents/container-state/{purgeTree.js → purge/purgeTree.js} +5 -5
- 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/{purgeTreeContainerDeletion.js → purge/purgeTreeContainerDeletion.js} +1 -1
- package/workflows/container-contents/container-state/purge/purgeTreeContainerDeletion.js.map +1 -0
- package/workflows/container-contents/container-state/{purgeTreeScope.js → purge/purgeTreeScope.js} +8 -8
- package/workflows/container-contents/container-state/purge/purgeTreeScope.js.map +1 -0
- package/workflows/container-contents/container-state/{readLocalPurgeScope.js → purge/readLocalPurgeScope.js} +3 -3
- 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/{groupGrantVerification.js → share/groupGrantVerification.js} +8 -8
- package/workflows/container-contents/container-state/share/groupGrantVerification.js.map +1 -0
- package/workflows/container-contents/container-state/{groupShareEpoch.js → share/groupShareEpoch.js} +2 -2
- package/workflows/container-contents/container-state/share/groupShareEpoch.js.map +1 -0
- package/workflows/container-contents/container-state/{share.js → share/index.js} +8 -8
- package/workflows/container-contents/container-state/share/index.js.map +1 -0
- package/workflows/container-contents/container-state/{sharePersistence.js → share/sharePersistence.js} +3 -3
- 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/metadata/metadataSyncErrors.js +1 -1
- package/workflows/container-contents/metadata/metadataSyncErrors.js.map +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/{destinationRootReload.js → destination/destinationRootReload.js} +1 -1
- package/workflows/container-contents/remoteHydration/destination/destinationRootReload.js.map +1 -0
- package/workflows/container-contents/remoteHydration/{replacementBinding.js → destination/replacementBinding.js} +5 -5
- package/workflows/container-contents/remoteHydration/destination/replacementBinding.js.map +1 -0
- package/workflows/container-contents/remoteHydration/{verifiedDestination.js → destination/verifiedDestination.js} +9 -9
- 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/{laneFetchMarkers.js → lanes/laneFetchMarkers.js} +1 -1
- package/workflows/container-contents/remoteHydration/lanes/laneFetchMarkers.js.map +1 -0
- package/workflows/container-contents/remoteHydration/{parentLaneFetch.js → lanes/parentLaneFetch.js} +2 -2
- 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/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/{insertRemoteContainer.js → remoteContainers/insertRemoteContainer.js} +6 -6
- package/workflows/container-contents/remoteHydration/remoteContainers/insertRemoteContainer.js.map +1 -0
- package/workflows/container-contents/remoteHydration/{remoteContainerPageHydration.js → remoteContainers/remoteContainerPageHydration.js} +7 -7
- package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js.map +1 -0
- package/workflows/container-contents/remoteHydration/{remoteContainerState.js → remoteContainers/remoteContainerState.js} +9 -9
- 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/containers/child/{createProjection.d.ts → create/createProjection.d.ts} +2 -2
- package/workflows/containers/child/{createProjection.js → create/createProjection.js} +2 -2
- package/workflows/containers/child/create/createProjection.js.map +1 -0
- package/workflows/containers/child/{createSubmission.d.ts → create/createSubmission.d.ts} +7 -7
- package/workflows/containers/child/{createSubmission.js → create/createSubmission.js} +2 -2
- package/workflows/containers/child/create/createSubmission.js.map +1 -0
- package/workflows/containers/child/{create.d.ts → create/index.d.ts} +5 -5
- package/workflows/containers/child/{create.js → create/index.js} +15 -15
- package/workflows/containers/child/create/index.js.map +1 -0
- package/workflows/containers/child/{move.d.ts → move/index.d.ts} +5 -5
- package/workflows/containers/child/{move.js → move/index.js} +12 -12
- package/workflows/containers/child/move/index.js.map +1 -0
- package/workflows/containers/child/{moveArtifacts.js → move/moveArtifacts.js} +3 -3
- package/workflows/containers/child/move/moveArtifacts.js.map +1 -0
- package/workflows/containers/child/{moveRotation.js → move/moveRotation.js} +3 -3
- package/workflows/containers/child/move/moveRotation.js.map +1 -0
- package/workflows/containers/child/{moveWraps.js → move/moveWraps.js} +5 -5
- 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/{carriedDescendantRekeys.js → rekey/carriedDescendantRekeys.js} +4 -4
- package/workflows/containers/child/rekey/carriedDescendantRekeys.js.map +1 -0
- package/workflows/containers/child/{rekey.d.ts → rekey/index.d.ts} +6 -6
- package/workflows/containers/child/{rekey.js → rekey/index.js} +13 -13
- package/workflows/containers/child/rekey/index.js.map +1 -0
- package/workflows/containers/child/{keyringOverrideLineage.d.ts → rekey/keyringOverrideLineage.d.ts} +1 -1
- package/workflows/containers/child/{keyringOverrideLineage.js → rekey/keyringOverrideLineage.js} +1 -1
- package/workflows/containers/child/{rekeyProjection.d.ts → rekey/rekeyProjection.d.ts} +2 -2
- package/workflows/containers/child/{rekeyProjection.js → rekey/rekeyProjection.js} +3 -3
- package/workflows/containers/child/rekey/rekeyProjection.js.map +1 -0
- package/workflows/containers/child/{rekeyRemote.d.ts → rekey/rekeyRemote.d.ts} +6 -6
- package/workflows/containers/child/{rekeyRemote.js → rekey/rekeyRemote.js} +2 -2
- 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/{replacementPrincipalPolicyReferences.js → rotation/replacementPrincipalPolicyReferences.js} +2 -2
- package/workflows/containers/child/rotation/replacementPrincipalPolicyReferences.js.map +1 -0
- package/workflows/containers/child/{rotationContext.js → rotation/rotationContext.js} +5 -5
- package/workflows/containers/child/rotation/rotationContext.js.map +1 -0
- package/workflows/containers/child/{rotationPrincipalPolicies.js → rotation/rotationPrincipalPolicies.js} +2 -2
- package/workflows/containers/child/rotation/rotationPrincipalPolicies.js.map +1 -0
- package/workflows/containers/child/{rotationWraps.js → rotation/rotationWraps.js} +1 -1
- package/workflows/containers/child/rotation/rotationWraps.js.map +1 -0
- package/workflows/containers/child/{currentShareGrantMutation.js → share/currentShareGrantMutation.js} +6 -6
- package/workflows/containers/child/share/currentShareGrantMutation.js.map +1 -0
- package/workflows/containers/child/{currentSharePrincipalPolicy.js → share/currentSharePrincipalPolicy.js} +10 -10
- package/workflows/containers/child/share/currentSharePrincipalPolicy.js.map +1 -0
- package/workflows/containers/child/{share.d.ts → share/index.d.ts} +8 -8
- package/workflows/containers/child/{share.js → share/index.js} +10 -10
- package/workflows/containers/child/share/index.js.map +1 -0
- package/workflows/containers/child/{runtimeCurrentGroupShare.js → share/runtimeCurrentGroupShare.js} +6 -6
- package/workflows/containers/child/share/runtimeCurrentGroupShare.js.map +1 -0
- package/workflows/containers/child/{shareAncestorRepair.js → share/shareAncestorRepair.js} +4 -4
- package/workflows/containers/child/share/shareAncestorRepair.js.map +1 -0
- package/workflows/containers/child/{shareMaterialization.d.ts → share/shareMaterialization.d.ts} +5 -5
- package/workflows/containers/child/{shareMaterialization.js → share/shareMaterialization.js} +7 -7
- package/workflows/containers/child/share/shareMaterialization.js.map +1 -0
- package/workflows/containers/child/{sharePlanCore.d.ts → share/sharePlanCore.d.ts} +7 -7
- package/workflows/containers/child/{sharePlanCore.js → share/sharePlanCore.js} +6 -6
- package/workflows/containers/child/share/sharePlanCore.js.map +1 -0
- package/workflows/containers/child/{sharePrincipalPolicy.d.ts → share/sharePrincipalPolicy.d.ts} +9 -9
- package/workflows/containers/child/{sharePrincipalPolicy.js → share/sharePrincipalPolicy.js} +13 -13
- 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 +10 -10
- package/workflows/containers/index.js +10 -10
- package/workflows/containers/index.js.map +1 -1
- package/workflows/documents/linkSet/linkSetAuthority.js +1 -1
- package/workflows/documents/linkSet/linkSetAuthority.js.map +1 -1
- package/workflows/documents/linkSet/linkSetBlobRewraps.js +1 -1
- package/workflows/documents/linkSet/linkSetBlobRewraps.js.map +1 -1
- package/workflows/documents/linkSet/linkSetProjectionSeed.js +1 -1
- package/workflows/documents/linkSet/linkSetProjectionSeed.js.map +1 -1
- package/workflows/documents/purge/index.js +1 -1
- package/workflows/documents/purge/index.js.map +1 -1
- package/workflows/documents/syncRekeys/syncAutomaticContainerRekeys.js +2 -2
- package/workflows/documents/syncRekeys/syncAutomaticContainerRekeys.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/policyCache/index.js +1 -1
- package/workflows/principals/policyCache/index.js.map +1 -1
- package/workflows/principals/policyRepair.js +1 -1
- package/workflows/principals/policyRepair.js.map +1 -1
- package/workflows/registration/organizationProvisioningArtifacts.d.ts +1 -1
- package/workflows/registration/provisioningBootstrapBuilders.js +1 -1
- package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js.map +0 -1
- package/data/keyingProjectionVerification/bundleVerification.js.map +0 -1
- package/data/keyingProjectionVerification/checkpointContext.js.map +0 -1
- package/data/keyingProjectionVerification/containerAncestorCitations.js.map +0 -1
- package/data/keyingProjectionVerification/containerDestinationVerification.js.map +0 -1
- package/data/keyingProjectionVerification/containerManifestVerification.js.map +0 -1
- package/data/keyingProjectionVerification/containerPathVerification.js.map +0 -1
- package/data/keyingProjectionVerification/containerProjectionVerification.js.map +0 -1
- package/data/keyingProjectionVerification/documentDependencyPaths.js.map +0 -1
- package/data/keyingProjectionVerification/documentManifestPolicies.js.map +0 -1
- package/data/keyingProjectionVerification/documentManifestVerification.js.map +0 -1
- package/data/keyingProjectionVerification/documentProjectionVerification.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgeCheckpointCurrency.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgeCheckpointEnforcement.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgeDocumentChainVerification.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgePolicyCheckpoints.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgePolicyCurrency.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgePrincipalEvidence.js.map +0 -1
- package/data/keyingProjectionVerification/documentPurgeProofVerification.js.map +0 -1
- package/data/keyingProjectionVerification/manifestCheckpointVerification.js.map +0 -1
- package/data/keyingProjectionVerification/mergeProjectionPolicyEvidence.js.map +0 -1
- package/data/keyingProjectionVerification/organizationFounderBinding.js.map +0 -1
- package/data/keyingProjectionVerification/principalPolicyCache.js.map +0 -1
- package/data/keyingProjectionVerification/principalPolicyVerification.js.map +0 -1
- package/data/keyingProjectionVerification/projectionAuthorizationEvidence.js.map +0 -1
- package/data/keyingProjectionVerification/projectionPolicyEvidence.js.map +0 -1
- package/data/keyingProjectionVerification/resolvedPrincipalPolicy.js.map +0 -1
- package/stores/container-contents/backgroundHydration.js.map +0 -1
- package/stores/container-contents/containerPurgeCore.js.map +0 -1
- package/stores/container-contents/containerStateMap.js.map +0 -1
- package/stores/container-contents/containerStatePersistence.js.map +0 -1
- package/stores/container-contents/documentRecovery.js.map +0 -1
- package/stores/container-contents/documentRotation.js.map +0 -1
- package/stores/container-contents/documentWork.js.map +0 -1
- package/stores/container-contents/emptyTrashOperation.js.map +0 -1
- package/stores/container-contents/existingSystemContainer.js.map +0 -1
- package/stores/container-contents/groupRewrapOperation.js.map +0 -1
- package/stores/container-contents/missingContainerState.js.map +0 -1
- package/stores/container-contents/missingSyncedContainerState.js.map +0 -1
- package/stores/container-contents/operations.js.map +0 -1
- package/stores/container-contents/organizationMetadataSystemContainer.js.map +0 -1
- package/stores/container-contents/purgeContainerOperation.js.map +0 -1
- package/stores/container-contents/reconcilableContainer.js.map +0 -1
- package/stores/container-contents/remoteBackedContainerState.js.map +0 -1
- package/stores/container-contents/remoteContainerIngestion.js.map +0 -1
- package/stores/container-contents/remoteEventProjectionInvalidation.js.map +0 -1
- package/stores/container-contents/remoteEventSync.js.map +0 -1
- package/stores/container-contents/remoteHydrationRequest.js.map +0 -1
- package/stores/container-contents/remoteWriteGuards.js.map +0 -1
- package/stores/container-contents/remoteWriteQueue.js.map +0 -1
- package/stores/container-contents/reportShareFailure.js.map +0 -1
- package/stores/container-contents/setContainerIconOperation.js.map +0 -1
- package/stores/container-contents/shareOperations.js.map +0 -1
- package/stores/container-contents/startupHydration.js.map +0 -1
- package/stores/container-contents/syncAgent.js.map +0 -1
- package/stores/container-contents/syncAgentTypes.js.map +0 -1
- package/stores/container-contents/syncLaneIteration.js.map +0 -1
- package/stores/container-contents/systemContainerHydration.js.map +0 -1
- package/stores/container-contents/systemContainerIcon.js.map +0 -1
- package/stores/container-contents/systemContainerLookup.js.map +0 -1
- package/stores/container-contents/systemContainerPostCreate.js.map +0 -1
- package/stores/container-contents/systemContainerPromotion.js.map +0 -1
- package/stores/container-contents/writeGeneration.js.map +0 -1
- package/stores/documents/documentStore/attachmentDetachState.js.map +0 -1
- package/stores/documents/documentStore/attachmentHydration.js.map +0 -1
- package/stores/documents/documentStore/attachmentHydrationCommit.js.map +0 -1
- package/stores/documents/documentStore/attachmentIntents.js.map +0 -1
- package/stores/documents/documentStore/attachmentMutationPersistence.js.map +0 -1
- package/stores/documents/documentStore/attachmentPersistFollowup.js.map +0 -1
- package/stores/documents/documentStore/attachmentPersistence.js.map +0 -1
- package/stores/documents/documentStore/attachmentRemoval.js.map +0 -1
- package/stores/documents/documentStore/attachmentSnapshot.js.map +0 -1
- package/stores/documents/documentStore/attachmentSourceUpload.js.map +0 -1
- package/stores/documents/documentStore/attachmentStaging.js.map +0 -1
- package/stores/documents/documentStore/attachmentUploadAttempt.js.map +0 -1
- package/stores/documents/documentStore/attachmentUploadLane.js.map +0 -1
- package/stores/documents/documentStore/attachmentUploadResume.js.map +0 -1
- package/stores/documents/documentStore/attachmentWriteGeneration.js.map +0 -1
- package/stores/documents/documentStore/attachments.js.map +0 -1
- package/stores/documents/documentStore/deferredInitialUpdate.js.map +0 -1
- package/stores/documents/documentStore/documentHistoryCompaction.js.map +0 -1
- package/stores/documents/documentStore/durableDocumentReload.js.map +0 -1
- package/stores/documents/documentStore/historyRebuild.js.map +0 -1
- package/stores/documents/documentStore/initialization.js.map +0 -1
- package/stores/documents/documentStore/initializationAttachments.js.map +0 -1
- package/stores/documents/documentStore/initializationHistory.js.map +0 -1
- package/stores/documents/documentStore/initializationRecovery.js.map +0 -1
- package/stores/documents/documentStore/pullContinuationInvalidation.js.map +0 -1
- package/stores/documents/documentStore/remoteRevalidationTelemetry.js.map +0 -1
- package/stores/documents/documentStore/remoteWork.js.map +0 -1
- package/stores/documents/documentStore/rotation.js.map +0 -1
- package/stores/documents/documentStore/rotationProvenance.js.map +0 -1
- package/stores/documents/documentStore/rotationSettlement.js.map +0 -1
- package/stores/documents/documentStore/sync.js.map +0 -1
- package/stores/documents/documentStore/syncAcceptedUpdateIds.js.map +0 -1
- package/stores/documents/documentStore/syncAttachmentSettlement.js.map +0 -1
- package/stores/documents/documentStore/syncAttachments.js.map +0 -1
- package/stores/documents/documentStore/syncDetachedAttachments.js.map +0 -1
- package/stores/documents/documentStore/syncFinalize.js.map +0 -1
- package/stores/documents/documentStore/syncGeneration.js.map +0 -1
- package/stores/documents/documentStore/syncOutgoingCoverage.js.map +0 -1
- package/stores/documents/documentStore/syncRemoteSignals.js.map +0 -1
- package/stores/documents/documentStore/syncRequest.js.map +0 -1
- package/stores/documents/documentStore/syncShared.js.map +0 -1
- package/stores/documents/documentStore/syncUpdateImport.js.map +0 -1
- package/stores/documents/documentStore.js.map +0 -1
- package/workflows/container-contents/container-state/createAdoption.js.map +0 -1
- package/workflows/container-contents/container-state/createChild.js.map +0 -1
- 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.map +0 -1
- package/workflows/container-contents/container-state/createTerminalFailure.js.map +0 -1
- package/workflows/container-contents/container-state/createWithMetadata.js.map +0 -1
- package/workflows/container-contents/container-state/createWithMetadataPlan.js.map +0 -1
- package/workflows/container-contents/container-state/groupGrantVerification.js.map +0 -1
- package/workflows/container-contents/container-state/groupShareEpoch.js.map +0 -1
- package/workflows/container-contents/container-state/localPurgeScope.js.map +0 -1
- 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.map +0 -1
- package/workflows/container-contents/container-state/purgeTreeScope.js.map +0 -1
- package/workflows/container-contents/container-state/readLocalPurgeScope.js.map +0 -1
- package/workflows/container-contents/container-state/share.js.map +0 -1
- 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.map +0 -1
- package/workflows/container-contents/remoteHydration/insertRemoteContainer.js.map +0 -1
- package/workflows/container-contents/remoteHydration/laneFetchMarkers.js.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/workflows/container-contents/remoteHydration/verifiedDestination.js.map +0 -1
- package/workflows/containers/child/carriedDescendantRekeys.js.map +0 -1
- package/workflows/containers/child/create.js.map +0 -1
- package/workflows/containers/child/createProjection.js.map +0 -1
- package/workflows/containers/child/createSubmission.js.map +0 -1
- package/workflows/containers/child/currentShareGrantMutation.js.map +0 -1
- package/workflows/containers/child/currentSharePrincipalPolicy.js.map +0 -1
- package/workflows/containers/child/move.js.map +0 -1
- package/workflows/containers/child/moveArtifacts.js.map +0 -1
- package/workflows/containers/child/moveRotation.js.map +0 -1
- package/workflows/containers/child/moveWraps.js.map +0 -1
- package/workflows/containers/child/rekey.js.map +0 -1
- package/workflows/containers/child/rekeyProjection.js.map +0 -1
- package/workflows/containers/child/rekeyRemote.js.map +0 -1
- package/workflows/containers/child/replacementPrincipalPolicyReferences.js.map +0 -1
- package/workflows/containers/child/rotationContext.js.map +0 -1
- package/workflows/containers/child/rotationPrincipalPolicies.js.map +0 -1
- package/workflows/containers/child/rotationWraps.js.map +0 -1
- package/workflows/containers/child/runtimeCurrentGroupShare.js.map +0 -1
- package/workflows/containers/child/share.js.map +0 -1
- package/workflows/containers/child/shareAncestorRepair.js.map +0 -1
- package/workflows/containers/child/shareMaterialization.js.map +0 -1
- package/workflows/containers/child/sharePlanCore.js.map +0 -1
- package/workflows/containers/child/sharePrincipalPolicy.js.map +0 -1
- package/workflows/containers/child/shareProjection.js.map +0 -1
- /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/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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kDAAkD,CAAC;AAE5F,OAAO,EACL,0BAA0B,EAC1B,iCAAiC,GAClC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OA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AC;oBAChB,2BAA2B,EAAE,KAAK;oBAClC,SAAS,EAAE,CAAC,iBAAiB,CAAC;iBAC/B,CAAC,CAAC;YACL,CAAC;YACD,KAAK;SACN,CAAC;KACL,CAAC,CAAC;IAEH,OAAO;QACL,iBAAiB,EAAE,GAAG,EAAE;YACtB,uCAAuC,CAAC;gBACtC,kBAAkB;gBAClB,IAAI;gBACJ,qBAAqB,EAAE,OAAO;gBAC9B,kBAAkB;gBAClB,YAAY;gBACZ,KAAK;aACN,CAAC,CAAC;YACH,KAAK,kBAAkB,EAAE,CAAC;QAC5B,CAAC;QACD,kBAAkB;QAClB,qBAAqB,EAAE,wBAAwB,CAAC,MAAM;QACtD,8BAA8B,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE,CAC7D,yBAAyB,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,CAAC;QAC9D,sBAAsB,EAAE,GAAG,EAAE,CAAC,2BAA2B,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC1E,OAAO;QACP,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE,CAC3B,0BAA0B,CAAC;YACzB,0BAA0B,EAAE,OAAO,EAAE,0BAA0B;YAC/D,SAAS,EAAE,OAAO,EAAE,SAAS;YAC7B,gBAAgB,EAAE,uBAAuB;YACzC,KAAK;SACN,CAAC;QACJ,sBAAsB,EAAE,gBAAgB;QACxC,uBAAuB,EAAE,iBAAiB;QAC1C,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import { loadLocalContainerStates } from \"../../../workflows/container-contents/localState\";\nimport type { RemoteContainerHydrationHost } from \"../../../workflows/container-contents/remoteHydration\";\nimport {\n isDatabaseUnavailableError,\n registerContainerContentsSyncLane,\n} from \"../../../workflows/container-contents/syncLane\";\nimport { createRestoredAccessReconciler } from \"../accessRestorationSweep\";\nimport { primeStoreDocumentSubtree } from \"../documentWork/documentRecovery\";\nimport { observeContainerBackgroundHydration } from \"../hydration/backgroundHydration\";\nimport {\n type RemoteHydrationRefreshOptions,\n refreshAllRemoteHydration,\n refreshRootRemoteHydration,\n} from \"../hydration/remoteHydrationRefresh\";\nimport { requestContainerContentsRemoteHydration } from \"../hydration/remoteHydrationRequest\";\nimport {\n hasStartupContainerSyncWork,\n scheduleStaleStartupRemoteHydration,\n} from \"../hydration/startupHydration\";\nimport { refreshLocalContainerStates } from \"../localRefresh\";\nimport { getContainerContentsStoreLogLabel } from \"../logLabel\";\nimport { createRemoteContainerIngestionController } from \"../remoteEvents/remoteContainerIngestion\";\nimport { handleContainerContentsRemoteEvents } from \"../remoteEvents/remoteEventSync\";\nimport { consumePendingContainerContentsReconnectRefresh } from \"../state\";\nimport type {\n ContainerContentsStoreSyncAgent,\n ContainerContentsStoreSyncState,\n} from \"./syncAgentTypes\";\nimport { runContainerContentsStoreSyncIteration } from \"./syncLaneIteration\";\n\nexport type { ContainerState } from \"../../../workflows/container-contents/remoteHydration\";\nexport type {\n ContainerContentsStoreRuntime,\n ContainerContentsStoreSyncAgent,\n ContainerContentsStoreSyncState,\n RefreshRootLaneOptions,\n} from \"./syncAgentTypes\";\n\nfunction requestContainerContentsStoreSync(\n state: ContainerContentsStoreSyncState,\n) {\n state.syncLane?.requestSync();\n}\n\nasync function initializeContainerContentsStore(input: {\n handleRemoteEvents: () => void;\n host: RemoteContainerHydrationHost;\n isCurrent: () => boolean;\n resumeRecoveryWork: () => Promise<void>;\n scheduleSync: () => void;\n state: ContainerContentsStoreSyncState;\n}) {\n const {\n handleRemoteEvents,\n host,\n isCurrent,\n resumeRecoveryWork,\n scheduleSync,\n state,\n } = input;\n const persistence = state.persistence;\n const loadRuntime = state.runtime;\n if (loadRuntime.infra.dbStatus !== \"ready\") {\n return;\n }\n\n const localContainerStates = await loadLocalContainerStates({\n persistence,\n runtime: loadRuntime,\n });\n if (!isCurrent()) {\n return;\n }\n\n for (const containerState of localContainerStates) {\n state.containersById.set(containerState.container.id, containerState);\n }\n\n state.initialized = true;\n\n const shouldScheduleStaleRootRecovery =\n await scheduleStaleStartupRemoteHydration({\n isCurrent,\n requestHydration: () =>\n requestContainerContentsRemoteHydration({\n host,\n resumeRecoveryWork,\n scheduleSync,\n state,\n }),\n state,\n });\n if (!isCurrent()) {\n return;\n }\n const runtime = state.runtime;\n const hasPendingRestorationSweep =\n typeof runtime.auth.userId === \"string\" &&\n (\n await persistence.listDormantMetadataSweepRequests(\n loadRuntime.infra.execSql,\n runtime.auth.userId,\n )\n ).length > 0;\n if (!isCurrent()) {\n return;\n }\n\n host.updateSnapshot();\n handleRemoteEvents();\n\n runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: loaded ${state.containersById.size} container(s)`,\n );\n\n const currentRuntime = state.runtime;\n if (currentRuntime.auth.isAuthenticated && currentRuntime.state.online) {\n const hasStartupWork =\n shouldScheduleStaleRootRecovery ||\n hasPendingRestorationSweep ||\n (await hasStartupContainerSyncWork(state));\n if (!isCurrent() || !hasStartupWork) {\n return;\n }\n currentRuntime.util.log(\n shouldScheduleStaleRootRecovery\n ? `${getContainerContentsStoreLogLabel(state)}: startup detected stale root recovery; scheduling lane pass`\n : `${getContainerContentsStoreLogLabel(state)}: startup detected durable sync work; scheduling lane pass`,\n );\n scheduleSync();\n }\n}\n\nfunction waitForStaleLocalRefreshBeforeInitialization(input: {\n handleRemoteEvents: () => void;\n host: RemoteContainerHydrationHost;\n refreshAfterReconnect: () => Promise<boolean>;\n resumeRecoveryWork: () => Promise<void>;\n scheduleSync: () => void;\n state: ContainerContentsStoreSyncState;\n}): boolean {\n const { state } = input;\n const activeRefresh = state.localContainerRefreshPromise;\n if (\n !activeRefresh ||\n (state.localContainerRefreshGeneration === state.lifecycleGeneration &&\n state.localContainerRefreshStructuralGeneration ===\n state.structuralGeneration)\n ) {\n return false;\n }\n\n const lifecycleGeneration = state.lifecycleGeneration;\n state.initializeGeneration = lifecycleGeneration;\n const releaseInitializationBarrier = () => {\n if (state.initializePromise !== initializationBarrier) {\n return;\n }\n state.initializePromise = null;\n state.initializeGeneration = null;\n if (state.runtime.infra.dbStatus === \"ready\") {\n ensureContainerContentsStoreInitialized(input);\n }\n };\n const initializationBarrier = activeRefresh.then(\n releaseInitializationBarrier,\n releaseInitializationBarrier,\n );\n state.initializePromise = initializationBarrier;\n return true;\n}\n\nfunction ensureContainerContentsStoreInitialized(input: {\n handleRemoteEvents: () => void;\n host: RemoteContainerHydrationHost;\n refreshAfterReconnect: () => Promise<boolean>;\n resumeRecoveryWork: () => Promise<void>;\n scheduleSync: () => void;\n state: ContainerContentsStoreSyncState;\n}) {\n const { handleRemoteEvents, host, resumeRecoveryWork, scheduleSync, state } =\n input;\n if (state.initialized || state.runtime.infra.dbStatus !== \"ready\") {\n return;\n }\n if (state.initializePromise) {\n return;\n }\n if (waitForStaleLocalRefreshBeforeInitialization(input)) {\n return;\n }\n\n const lifecycleGeneration = state.lifecycleGeneration;\n const persistence = state.persistence;\n const execSql = state.runtime.infra.execSql;\n const isCurrent = () =>\n state.lifecycleGeneration === lifecycleGeneration &&\n state.persistence === persistence &&\n state.runtime.infra.execSql === execSql;\n state.initializeGeneration = lifecycleGeneration;\n const initializePromise = initializeContainerContentsStore({\n handleRemoteEvents,\n host,\n isCurrent,\n resumeRecoveryWork,\n scheduleSync,\n state,\n })\n .catch((error: unknown) => {\n if (!isCurrent() || isDatabaseUnavailableError(error)) {\n return;\n }\n\n throw error;\n })\n .finally(() => {\n if (state.initializePromise !== initializePromise) {\n return;\n }\n state.initializePromise = null;\n state.initializeGeneration = null;\n if (isCurrent()) {\n consumePendingContainerContentsReconnectRefresh(\n state,\n input.refreshAfterReconnect,\n );\n } else if (state.runtime.infra.dbStatus === \"ready\") {\n ensureContainerContentsStoreInitialized(input);\n }\n });\n state.initializePromise = initializePromise;\n}\n\n// Read the runtime lazily: updateRuntime replaces state.runtime, so a\n// reference captured at lane registration would report into a dead identity's\n// host. Returns the host's result: both callbacks are declared `=> void` but\n// may be async, and the lane reporter only catches a rejection it is handed.\nfunction logSyncLaneFailure(\n state: ContainerContentsStoreSyncState,\n message: string,\n error: unknown,\n): unknown {\n const { log, logError } = state.runtime.util;\n return logError ? logError(message, error) : log(message);\n}\n\nfunction createHydrationRequester(input: {\n host: RemoteContainerHydrationHost;\n resumeRecoveryWork: () => Promise<void>;\n scheduleSync: () => void;\n state: ContainerContentsStoreSyncState;\n}): ContainerContentsStoreSyncAgent[\"requestRemoteHydration\"] {\n return (options = {}) =>\n requestContainerContentsRemoteHydration({\n ...input,\n followDiscoveredParentLanes: options.followDiscoveredParentLanes,\n parentIds: options.parentIds,\n resetAllLaneWatermarks: options.resetAllLaneWatermarks,\n });\n}\n\nexport function createContainerContentsStoreSyncAgent(input: {\n host: RemoteContainerHydrationHost;\n state: ContainerContentsStoreSyncState;\n}): ContainerContentsStoreSyncAgent {\n const { host, state } = input;\n const scheduleSync = () => requestContainerContentsStoreSync(state);\n const remoteContainerIngestion = createRemoteContainerIngestionController({\n host,\n scheduleSync,\n state,\n });\n const resumeRecoveryWork = remoteContainerIngestion.resumeInterruptedWork;\n\n const requestHydration = createHydrationRequester({\n host,\n resumeRecoveryWork,\n scheduleSync,\n state,\n });\n const requestRefreshHydration = (options: RemoteHydrationRefreshOptions) =>\n requestContainerContentsRemoteHydration({\n ...options,\n host,\n resumeRecoveryWork,\n scheduleSync,\n state,\n });\n const scheduleHydration = (\n options?: Parameters<typeof requestHydration>[0],\n ) => observeContainerBackgroundHydration(state, requestHydration(options));\n const refresh: ContainerContentsStoreSyncAgent[\"refresh\"] = (options) =>\n refreshAllRemoteHydration({\n // Explicit user refresh must rediscover children hidden by unsigned hints.\n resetAllLaneWatermarks: options?.resetAllLaneWatermarks,\n requestHydration: requestRefreshHydration,\n state,\n });\n const handleRemoteEvents = () =>\n handleContainerContentsRemoteEvents({\n requestHydration,\n scheduleSync,\n state,\n });\n const reconcileRestoredAccess = createRestoredAccessReconciler({\n requestHydration: requestRefreshHydration,\n state,\n });\n\n state.syncLane = registerContainerContentsSyncLane({\n domainScope: state.runtime.state.domainScope,\n logError: (message, error) => logSyncLaneFailure(state, message, error),\n run: () =>\n runContainerContentsStoreSyncIteration({\n host,\n reconcileRestoredAccess,\n requestRemoteReconciliation: (parentContainerId) => {\n scheduleHydration({\n followDiscoveredParentLanes: false,\n parentIds: [parentContainerId],\n });\n },\n state,\n }),\n });\n\n return {\n ensureInitialized: () => {\n ensureContainerContentsStoreInitialized({\n handleRemoteEvents,\n host,\n refreshAfterReconnect: refresh,\n resumeRecoveryWork,\n scheduleSync,\n state,\n });\n void resumeRecoveryWork();\n },\n handleRemoteEvents,\n ingestRemoteContainer: remoteContainerIngestion.ingest,\n primeDocumentsForSharedSubtree: (rootContainerId, isCurrent) =>\n primeStoreDocumentSubtree(state, rootContainerId, isCurrent),\n refreshLocalContainers: () => refreshLocalContainerStates({ host, state }),\n refresh,\n refreshRootLane: (options) =>\n refreshRootRemoteHydration({\n includeActiveRootChildLane: options?.includeActiveRootChildLane,\n parentIds: options?.parentIds,\n requestHydration: requestRefreshHydration,\n state,\n }),\n requestRemoteHydration: requestHydration,\n scheduleRemoteHydration: scheduleHydration,\n scheduleSync,\n };\n}\n"]}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* the document store's `remoteUpdateSignalSeq` clear (the document store is
|
|
17
17
|
* single-document, so it needs only one counter).
|
|
18
18
|
*/
|
|
19
|
-
import { sequenceUnchanged } from "
|
|
19
|
+
import { sequenceUnchanged } from "../../../workflows/container-contents/syncLane.js";
|
|
20
20
|
/** Read an id's current enqueue sequence, defaulting to 0 when never queued. */
|
|
21
21
|
export function readMetadataSyncSeq(seqById, id) {
|
|
22
22
|
return seqById.get(id) ?? 0;
|
package/stores/container-contents/{metadataSyncSignal.js.map → syncAgent/metadataSyncSignal.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadataSyncSignal.js","sourceRoot":"","sources":["metadataSyncSignal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"metadataSyncSignal.js","sourceRoot":"","sources":["metadataSyncSignal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,gFAAgF;AAChF,MAAM,UAAU,mBAAmB,CACjC,OAAoC,EACpC,EAAU;IAEV,OAAO,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CACjC,OAA4B,EAC5B,EAAU;IAEV,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iCAAiC,CAAC,KAKjD;IACC,IACE,iBAAiB,CACf,mBAAmB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,EAC5C,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CACzC,EACD,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Convergence-safety helpers for the container-contents metadata sync lane.\n *\n * `syncSingleContainerMetadata` reads `forceReadSync` for a container, then\n * awaits a network GET of the container's metadata document. A remote\n * rename/move event delivered during that await re-queues the container's\n * metadata id and advances that id's entry in `metadataSyncSignalSeqById`. If\n * the pass then deleted the id unconditionally it would erase that fresh\n * re-queue, leaving the structural projection (name/icon) stale until an\n * unrelated later event re-armed it.\n *\n * The pass therefore snapshots the id's sequence before its GET and only clears\n * the queued id when that id's sequence is unchanged at pass end. The sequence\n * is tracked per metadata document id (not a single global counter) so a remote\n * event for an unrelated container does not block clearing this one. Mirrors\n * the document store's `remoteUpdateSignalSeq` clear (the document store is\n * single-document, so it needs only one counter).\n */\n\nimport { sequenceUnchanged } from \"../../../workflows/container-contents/syncLane\";\n\n/** Read an id's current enqueue sequence, defaulting to 0 when never queued. */\nexport function readMetadataSyncSeq(\n seqById: ReadonlyMap<string, number>,\n id: string,\n): number {\n return seqById.get(id) ?? 0;\n}\n\n/** Advance an id's enqueue sequence (called when a remote event re-queues it). */\nexport function bumpMetadataSyncSeq(\n seqById: Map<string, number>,\n id: string,\n): void {\n seqById.set(id, readMetadataSyncSeq(seqById, id) + 1);\n}\n\n/**\n * Delete `id` from the needs-sync queue only if no remote event re-queued that\n * specific id since `consumedSeqById` was snapshotted at pass entry.\n */\nexport function clearMetadataSyncQueueIfUnchanged(input: {\n needingSync: Set<string>;\n seqById: ReadonlyMap<string, number>;\n consumedSeqById: ReadonlyMap<string, number>;\n id: string;\n}): void {\n if (\n sequenceUnchanged(\n readMetadataSyncSeq(input.seqById, input.id),\n input.consumedSeqById.get(input.id) ?? 0,\n )\n ) {\n input.needingSync.delete(input.id);\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ContainerContentsPersistence } from "
|
|
2
|
-
import type { ContainerContentsProjectionUserKeyResolver } from "
|
|
3
|
-
import type { ContainerState, RemoteContainer } from "
|
|
4
|
-
import type { ContainerContentsStoreWorkflowRuntime } from "
|
|
5
|
-
import type { ContainerContentsSyncLane } from "
|
|
1
|
+
import type { ContainerContentsPersistence } from "../../../workflows/container-contents/containerPersistence.js";
|
|
2
|
+
import type { ContainerContentsProjectionUserKeyResolver } from "../../../workflows/container-contents/projectionKeys.js";
|
|
3
|
+
import type { ContainerState, RemoteContainer } from "../../../workflows/container-contents/remoteHydration/index.js";
|
|
4
|
+
import type { ContainerContentsStoreWorkflowRuntime } from "../../../workflows/container-contents/runtime.js";
|
|
5
|
+
import type { ContainerContentsSyncLane } from "../../../workflows/container-contents/syncLane.js";
|
|
6
6
|
export type ContainerContentsStoreRuntime = ContainerContentsStoreWorkflowRuntime;
|
|
7
7
|
export interface RefreshRootLaneOptions {
|
|
8
8
|
readonly includeActiveRootChildLane?: boolean | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syncAgentTypes.js","sourceRoot":"","sources":["syncAgentTypes.ts"],"names":[],"mappings":"","sourcesContent":["import type { ContainerContentsPersistence } from \"../../../workflows/container-contents/containerPersistence\";\nimport type { ContainerContentsProjectionUserKeyResolver } from \"../../../workflows/container-contents/projectionKeys\";\nimport type {\n ContainerState,\n RemoteContainer,\n} from \"../../../workflows/container-contents/remoteHydration\";\nimport type { ContainerContentsStoreWorkflowRuntime } from \"../../../workflows/container-contents/runtime\";\nimport type { ContainerContentsSyncLane } from \"../../../workflows/container-contents/syncLane\";\n\nexport type ContainerContentsStoreRuntime =\n ContainerContentsStoreWorkflowRuntime;\n\nexport interface RefreshRootLaneOptions {\n readonly includeActiveRootChildLane?: boolean | undefined;\n // Extra parent lanes to re-list alongside the root lane. Used by the\n // resync_required handler to re-list affected containers' parent lanes so a\n // tombstone only visible there is still applied without the full crawl.\n readonly parentIds?: ReadonlyArray<string | null> | undefined;\n}\n\nexport interface ContainerContentsStoreSyncAgent {\n ensureInitialized: () => void;\n handleRemoteEvents: () => void;\n ingestRemoteContainer: (remoteContainer: RemoteContainer) => Promise<void>;\n primeDocumentsForSharedSubtree: (\n rootContainerId: string,\n isCurrent?: (() => boolean) | undefined,\n ) => Promise<void>;\n refreshLocalContainers: () => Promise<void>;\n refresh: (options?: { resetAllLaneWatermarks?: boolean }) => Promise<boolean>;\n refreshRootLane: (options?: RefreshRootLaneOptions) => Promise<boolean>;\n requestRemoteHydration: (options?: {\n followDiscoveredParentLanes?: boolean | undefined;\n parentIds?: ReadonlyArray<string | null> | undefined;\n resetAllLaneWatermarks?: boolean | undefined;\n }) => Promise<void>;\n scheduleRemoteHydration: () => void;\n scheduleSync: () => void;\n}\n\nexport interface ContainerContentsStoreSyncState {\n containersById: Map<string, ContainerState>;\n documentStoresNeedPriming: boolean;\n initializeGeneration: number | null;\n initializePromise: Promise<void> | null;\n initialized: boolean;\n localContainerRefreshPromise: Promise<void> | null;\n localContainerRefreshGeneration: number | null;\n localContainerRefreshStructuralGeneration: number | null;\n localContainersNeedRefresh: boolean;\n /** Invalidates asynchronous hydration work when this store is reset. */\n lifecycleGeneration: number;\n /** Invalidates structural work when its runtime or persistence is replaced. */\n structuralGeneration: number;\n /** Invalidates writes across write-relevant runtime ABA transitions. */\n writeGeneration: number;\n lastEventCount: number;\n /**\n * Update ids this client sent for container metadata documents, registered\n * before the network await of each metadata sync pass. The author's own\n * `document_update_created` echo consumes its ids here instead of arming a\n * redundant forced read-sync; a genuine peer update always carries unknown\n * ids and still forces one. Shared across all metadata docs in the store —\n * update ids are globally unique.\n */\n locallyAcceptedMetadataUpdateIds: Set<string>;\n logLabel?: string | undefined;\n metadataDocumentIdsNeedingSync: Set<string>;\n /**\n * Per-metadata-document enqueue sequence. Bumped for a specific id whenever a\n * remote event re-queues it in {@link metadataDocumentIdsNeedingSync}. A sync\n * pass snapshots the id's sequence before its GET and only clears the id if it\n * is unchanged at pass end, so a mid-pass re-queue of THIS container is not\n * erased. Keyed per id (not a single global counter) so a remote event for an\n * unrelated container does not force a redundant re-sync of this one. See\n * `clearMetadataSyncQueueIfUnchanged`.\n */\n metadataSyncSignalSeqById: Map<string, number>;\n containerParentIdsNeedingHydration: Set<string | null>;\n persistence: ContainerContentsPersistence;\n remoteHydrationPromise: Promise<void> | null;\n remoteHydrationGeneration: number | null;\n remoteHydrationStructuralGeneration: number | null;\n remoteReconnectRefreshPending: boolean;\n resolveProjectionUserKey: ContainerContentsProjectionUserKeyResolver;\n /** True after this store has fully applied an authoritative root lane. */\n rootLaneHydrated: boolean;\n runtime: ContainerContentsStoreRuntime;\n snapshot: { ready: boolean };\n syncLane: ContainerContentsSyncLane | null;\n}\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { syncPendingContainerCreateIntents } from "
|
|
2
|
-
import { syncPendingContainerMoveIntents } from "
|
|
3
|
-
import { syncPendingDocumentMoveIntents, } from "
|
|
4
|
-
import { syncContainerMetadataState } from "
|
|
5
|
-
import { createContainerContentsDocumentsRuntime } from "
|
|
6
|
-
import { openDocumentStore, requestDomainDocumentSync } from "
|
|
7
|
-
import { relinkDocumentStoreWithCommitSideEffect } from "
|
|
8
|
-
import { DocumentRemoteWorkBusyError } from "
|
|
9
|
-
import {
|
|
10
|
-
import { runContainerDocumentWork } from "
|
|
1
|
+
import { syncPendingContainerCreateIntents } from "../../../workflows/container-contents/container-state/create/createIntentSync.js";
|
|
2
|
+
import { syncPendingContainerMoveIntents } from "../../../workflows/container-contents/container-state/moveIntentSync.js";
|
|
3
|
+
import { syncPendingDocumentMoveIntents, } from "../../../workflows/container-contents/documentMove/documentMoveIntentSync.js";
|
|
4
|
+
import { syncContainerMetadataState } from "../../../workflows/container-contents/metadata/index.js";
|
|
5
|
+
import { createContainerContentsDocumentsRuntime } from "../../../workflows/container-contents/runtime.js";
|
|
6
|
+
import { openDocumentStore, requestDomainDocumentSync } from "../../documents/index.js";
|
|
7
|
+
import { relinkDocumentStoreWithCommitSideEffect } from "../../documents/documentStore/internalRelink.js";
|
|
8
|
+
import { DocumentRemoteWorkBusyError } from "../../documents/documentStore/sync/remoteWork.js";
|
|
9
|
+
import { removeMissingSyncedContainerState } from "../containerState/missingSyncedContainerState.js";
|
|
10
|
+
import { runContainerDocumentWork } from "../documentWork/index.js";
|
|
11
|
+
import { primeStoreDocuments, recoverStoreStaleRoot, } from "../documentWork/documentRecovery.js";
|
|
11
12
|
import { bumpMetadataSyncSeq, clearMetadataSyncQueueIfUnchanged, readMetadataSyncSeq, } from "./metadataSyncSignal.js";
|
|
12
|
-
import { removeMissingSyncedContainerState } from "./missingSyncedContainerState.js";
|
|
13
13
|
function requestContainerContentsStoreSync(state) {
|
|
14
14
|
state.syncLane?.requestSync();
|
|
15
15
|
}
|
|
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AE,CAAC,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC;QAC3D,gBAAgB,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC;QAC/D,oBAAoB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,yBAAyB;QAC3D,sEAAsE;QACtE,wEAAwE;QACxE,sEAAsE;QACtE,yDAAyD;QACzD,wBAAwB,EAAE,GAAG,EAAE,CAC7B,6BAA6B,CAAC;YAC5B,eAAe;YACf,SAAS;YACT,mBAAmB,EAAE,qBAAqB;YAC1C,KAAK;SACN,CAAC;KACL,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { syncPendingContainerCreateIntents } from \"../../../workflows/container-contents/container-state/create/createIntentSync\";\nimport { syncPendingContainerMoveIntents } from \"../../../workflows/container-contents/container-state/moveIntentSync\";\nimport {\n type DocumentMoveIntentSyncHost,\n syncPendingDocumentMoveIntents,\n} from \"../../../workflows/container-contents/documentMove/documentMoveIntentSync\";\nimport { syncContainerMetadataState } from \"../../../workflows/container-contents/metadata\";\nimport type {\n ContainerState,\n RemoteContainerHydrationHost,\n} from \"../../../workflows/container-contents/remoteHydration\";\nimport { createContainerContentsDocumentsRuntime } from \"../../../workflows/container-contents/runtime\";\nimport { openDocumentStore, requestDomainDocumentSync } from \"../../documents\";\nimport { relinkDocumentStoreWithCommitSideEffect } from \"../../documents/documentStore/internalRelink\";\nimport { DocumentRemoteWorkBusyError } from \"../../documents/documentStore/sync/remoteWork\";\nimport { removeMissingSyncedContainerState } from \"../containerState/missingSyncedContainerState\";\nimport { runContainerDocumentWork } from \"../documentWork\";\nimport {\n primeStoreDocuments,\n recoverStoreStaleRoot,\n} from \"../documentWork/documentRecovery\";\nimport {\n bumpMetadataSyncSeq,\n clearMetadataSyncQueueIfUnchanged,\n readMetadataSyncSeq,\n} from \"./metadataSyncSignal\";\nimport type {\n ContainerContentsStoreRuntime,\n ContainerContentsStoreSyncState,\n} from \"./syncAgentTypes\";\n\ntype ContainerContentsStorePrimeDocumentRuntime = ReturnType<\n typeof createContainerContentsDocumentsRuntime\n>;\ntype SyncContainerMetadata = typeof syncContainerMetadataState;\n\nfunction requestContainerContentsStoreSync(\n state: ContainerContentsStoreSyncState,\n) {\n state.syncLane?.requestSync();\n}\n\nfunction createRemoteSyncBlocker(runtime: ContainerContentsStoreRuntime) {\n return (organizationId: string) =>\n runtime.util.isRemoteSyncBlocked?.(organizationId) ?? false;\n}\n\nfunction captureStructuralSyncGeneration(\n state: ContainerContentsStoreSyncState,\n runtime: ContainerContentsStoreRuntime,\n) {\n const activeContainerId = runtime.state.containerId;\n const activeOrganizationId = runtime.auth.organizationId;\n const lifecycleGeneration = state.lifecycleGeneration;\n const structuralGeneration = state.structuralGeneration;\n const domainScope = runtime.state.domainScope;\n const execSql = runtime.infra.execSql;\n const resolveProjectionUserKey = state.resolveProjectionUserKey;\n const syncLane = state.syncLane;\n return () =>\n state.lifecycleGeneration === lifecycleGeneration &&\n state.structuralGeneration === structuralGeneration &&\n state.runtime.auth.organizationId === activeOrganizationId &&\n state.runtime.state.containerId === activeContainerId &&\n state.runtime.state.domainScope === domainScope &&\n state.runtime.infra.execSql === execSql &&\n state.resolveProjectionUserKey === resolveProjectionUserKey &&\n state.syncLane === syncLane &&\n !syncLane?.isDisposed?.();\n}\n\nfunction createContainerContentsStoreDocumentMoveHost(\n state: ContainerContentsStoreSyncState,\n isCurrent: () => boolean,\n): DocumentMoveIntentSyncHost<ContainerContentsStorePrimeDocumentRuntime> {\n const runtime = state.runtime;\n const domainScope = runtime.state.domainScope;\n return {\n documentWorkflowRuntime: (containerId) =>\n createContainerContentsDocumentsRuntime(runtime, containerId),\n openDocumentStore: ({ containerId, documentId, localId }) => {\n const store = openDocumentStore(\n domainScope,\n localId,\n createContainerContentsDocumentsRuntime(runtime, containerId),\n documentId,\n );\n return {\n assertCanRotateContentKey: () =>\n store.assertCanRotateContentKey().catch((error: unknown) => {\n if (error instanceof DocumentRemoteWorkBusyError) {\n void error.whenIdle.then(() => {\n if (isCurrent()) requestContainerContentsStoreSync(state);\n });\n }\n throw error;\n }),\n ensureInitialized: () => store.ensureInitialized(),\n relink: ({ commitSideEffect, ...input }) =>\n commitSideEffect\n ? relinkDocumentStoreWithCommitSideEffect(\n store,\n input,\n commitSideEffect,\n )\n : store.relink(input),\n requestSync: () => store.requestSync(),\n updateRuntime: (nextRuntime) => store.updateRuntime(nextRuntime),\n };\n },\n };\n}\n\nfunction syncPendingStoreDocumentMoves(input: {\n isCreatePending: (containerId: string) => boolean;\n isCurrent: () => boolean;\n isRemoteSyncBlocked: (organizationId: string) => boolean;\n state: ContainerContentsStoreSyncState;\n}) {\n return syncPendingDocumentMoveIntents({\n host: createContainerContentsStoreDocumentMoveHost(\n input.state,\n input.isCurrent,\n ),\n isCreatePending: input.isCreatePending,\n isCurrent: input.isCurrent,\n isRemoteSyncBlocked: input.isRemoteSyncBlocked,\n state: input.state,\n });\n}\n\nasync function syncSingleContainerMetadata(input: {\n host: RemoteContainerHydrationHost;\n isCurrent: () => boolean;\n state: ContainerContentsStoreSyncState;\n containerState: ContainerState;\n encapsulationKeyPair: NonNullable<\n ContainerContentsStoreRuntime[\"crypto\"][\"encapsulationKeyPair\"]\n >;\n syncContainerMetadata?: SyncContainerMetadata | undefined;\n}) {\n const { containerState, encapsulationKeyPair, host, isCurrent, state } =\n input;\n const metadataDocumentId = containerState.record.documentId;\n // Snapshot this signal before the GET so a mid-pass event survives clearing.\n const consumedSeqById = new Map<string, number>();\n if (typeof metadataDocumentId === \"string\") {\n consumedSeqById.set(\n metadataDocumentId,\n readMetadataSyncSeq(state.metadataSyncSignalSeqById, metadataDocumentId),\n );\n }\n const synced = await (\n input.syncContainerMetadata ?? syncContainerMetadataState\n )({\n forceReadSync:\n typeof metadataDocumentId === \"string\" &&\n state.metadataDocumentIdsNeedingSync.has(metadataDocumentId),\n locallyAcceptedUpdateIds: state.locallyAcceptedMetadataUpdateIds,\n isCurrent,\n metadataState: containerState,\n onDurableStateNeedsReload: () => {\n const currentDocumentId = state.containersById.get(\n containerState.container.id,\n )?.record.documentId;\n if (typeof currentDocumentId === \"string\") {\n state.metadataDocumentIdsNeedingSync.add(currentDocumentId);\n bumpMetadataSyncSeq(state.metadataSyncSignalSeqById, currentDocumentId);\n }\n requestContainerContentsStoreSync(state);\n },\n persistence: state.persistence,\n resolveProjectionUserKey: state.resolveProjectionUserKey,\n runtime: state.runtime,\n targetSecretKey: encapsulationKeyPair.secretKey,\n });\n if (!isCurrent() || !synced) {\n return;\n }\n if (\"missing\" in synced) {\n removeMissingSyncedContainerState(\n state,\n containerState,\n host.updateSnapshot,\n );\n return;\n }\n\n for (const id of [metadataDocumentId, synced.record.documentId]) {\n if (typeof id === \"string\") {\n clearMetadataSyncQueueIfUnchanged({\n consumedSeqById,\n id,\n needingSync: state.metadataDocumentIdsNeedingSync,\n seqById: state.metadataSyncSignalSeqById,\n });\n }\n }\n // syncContainerMetadataState settles its detached candidate into this live\n // object while preserving any metadata edit that completed or queued during\n // the remote pass. Do not install its returned detached record again here:\n // doing so would overwrite that preserved live edit.\n host.updateSnapshot();\n\n if (synced.shouldRequestFollowupSync) {\n requestContainerContentsStoreSync(state);\n }\n}\n\n/**\n * A folder whose create has not settled can carry a listed identity that\n * adoption has not verified, or has refused. Folder moves, document moves and\n * metadata edits wait for it; child and document creates wait in their own\n * create paths.\n */\nasync function loadPendingCreatePredicate(\n state: ContainerContentsStoreSyncState,\n): Promise<(containerId: string) => boolean> {\n const pending = await state.persistence.listPendingCreateIntents(\n state.runtime.infra.execSql,\n );\n const pendingIds = new Set(pending.map((intent) => intent.containerId));\n return (containerId) => pendingIds.has(containerId);\n}\n\ninterface ContainerContentsStoreSyncIterationInput {\n host: RemoteContainerHydrationHost;\n reconcileRestoredAccess: (isCurrent: () => boolean) => Promise<void>;\n requestRemoteReconciliation: (parentContainerId: string | null) => void;\n state: ContainerContentsStoreSyncState;\n syncContainerMetadata?: SyncContainerMetadata | undefined;\n}\n\nexport async function runContainerContentsStoreSyncIteration(\n input: ContainerContentsStoreSyncIterationInput,\n) {\n const { host, reconcileRestoredAccess, requestRemoteReconciliation, state } =\n input;\n const runtime = state.runtime;\n const encapsulationKeyPair = runtime.crypto.encapsulationKeyPair;\n if (\n runtime.infra.dbStatus !== \"ready\" ||\n !state.snapshot.ready ||\n !runtime.state.online ||\n !runtime.auth.isAuthenticated ||\n !encapsulationKeyPair\n ) {\n return;\n }\n const domainScope = runtime.state.domainScope;\n const isCurrent = captureStructuralSyncGeneration(state, runtime);\n\n await reconcileRestoredAccess(isCurrent);\n if (!isCurrent()) {\n return;\n }\n const isOrganizationBlocked = createRemoteSyncBlocker(runtime);\n\n const createdContainerCount = await syncPendingContainerCreateIntents({\n host,\n isCurrent,\n isRemoteSyncBlocked: isOrganizationBlocked,\n requestRemoteReconciliation,\n state,\n });\n if (!isCurrent()) {\n return;\n }\n if (createdContainerCount > 0) {\n state.documentStoresNeedPriming = true;\n host.updateSnapshot();\n }\n const isCreatePending = await loadPendingCreatePredicate(state);\n if (!isCurrent()) {\n return;\n }\n\n const movedContainerCount = await syncPendingContainerMoveIntents({\n host,\n isCreatePending,\n isCurrent,\n isRemoteSyncBlocked: isOrganizationBlocked,\n requestRemoteReconciliation,\n state,\n });\n if (!isCurrent()) {\n return;\n }\n if (movedContainerCount > 0) {\n state.documentStoresNeedPriming = true;\n host.updateSnapshot();\n requestDomainDocumentSync(domainScope);\n requestContainerContentsStoreSync(state);\n }\n\n for (const containerState of Array.from(state.containersById.values())) {\n if (isCreatePending(containerState.container.id)) continue;\n await syncSingleContainerMetadata({\n containerState,\n encapsulationKeyPair,\n host,\n isCurrent,\n state,\n syncContainerMetadata: input.syncContainerMetadata,\n });\n if (!isCurrent()) {\n return;\n }\n }\n\n // Root adoption notifies session consumers synchronously. Let container\n // metadata converge first so a recovered system container is never exposed\n // under its placeholder name when the active root changes.\n await runContainerDocumentWork({\n isCurrent,\n onContextChanged: () => {\n if (isCurrent()) {\n requestContainerContentsStoreSync(state);\n }\n },\n onDocumentsMoved: () => {\n if (isCurrent()) {\n requestDomainDocumentSync(domainScope);\n requestContainerContentsStoreSync(state);\n }\n },\n primeDocuments: () => primeStoreDocuments(state, isCurrent),\n recoverStaleRoot: () => recoverStoreStaleRoot(state, isCurrent),\n shouldPrimeDocuments: () => state.documentStoresNeedPriming,\n // Document move intents live in the structural phase because they may\n // target containers created locally in the same session, such as Trash.\n // Root recovery rewrites stale endpoints and returns their intents to\n // pending, so replay follows recovery in this same pass.\n syncPendingDocumentMoves: () =>\n syncPendingStoreDocumentMoves({\n isCreatePending,\n isCurrent,\n isRemoteSyncBlocked: isOrganizationBlocked,\n state,\n }),\n });\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { persistContainerState } from "
|
|
2
|
-
import { getContainerContentsStoreLogLabel } from "
|
|
3
|
-
import { invalidateRemoteContainerWrites } from "
|
|
1
|
+
import { persistContainerState } from "../containerState/containerStatePersistence.js";
|
|
2
|
+
import { getContainerContentsStoreLogLabel } from "../logLabel.js";
|
|
3
|
+
import { invalidateRemoteContainerWrites } from "../remoteWrites/remoteWriteGuards.js";
|
|
4
|
+
import { toContainerNode } from "../utils.js";
|
|
4
5
|
import { applySystemContainerIcon } from "./systemContainerIcon.js";
|
|
5
6
|
import { findRootContainerState } from "./systemContainerLookup.js";
|
|
6
7
|
import { promoteExistingLocalSystemContainerSync } from "./systemContainerPromotion.js";
|
|
7
|
-
import { toContainerNode } from "./utils.js";
|
|
8
8
|
export async function updateExistingSystemContainer(state, syncAgent, existing, options, isCurrent) {
|
|
9
9
|
if ("icon" in options) {
|
|
10
10
|
const iconApplied = await applySystemContainerIcon({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"existingSystemContainer.js","sourceRoot":"","sources":["existingSystemContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,iCAAiC,EAAE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C7D,cAAc,EAAE,QAAQ;QACxB,QAAQ,EAAE,iCAAiC,CAAC,KAAK,CAAC;QAClD,OAAO;QACP,gBAAgB,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE;YACpD,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBACjC,+BAA+B,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;YACxE,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,KAAK,EAAE,cAAc,EAAE;gBAChE,WAAW,EAAE,SAAS,CAAC,iBAAiB;oBACtC,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,EAAE,EAAE;oBACtE,CAAC,CAAC,SAAS;gBACb,WAAW,EAAE,SAAS,CAAC,cAAc;gBACrC,SAAS;aACV,CAAC,CAAC;YACH,OAAO,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;QACvC,CAAC;QACD,SAAS,EAAE,sBAAsB,CAAC,KAAK,CAAC;QACxC,KAAK;QACL,SAAS;QACT,SAAS;KACV,CAAC,CAAC;IACH,OAAO,QAAQ,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC","sourcesContent":["import { persistContainerState } from \"../containerState/containerStatePersistence\";\nimport { getContainerContentsStoreLogLabel } from \"../logLabel\";\nimport { invalidateRemoteContainerWrites } from \"../remoteWrites/remoteWriteGuards\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport type {\n ContainerContentsStoreSyncAgent,\n ContainerState,\n} from \"../syncAgent\";\nimport type {\n ContainerContentsStoreState,\n EnsureSystemContainerOptions,\n} from \"../types\";\nimport { toContainerNode } from \"../utils\";\nimport { applySystemContainerIcon } from \"./systemContainerIcon\";\nimport { findRootContainerState } from \"./systemContainerLookup\";\nimport { promoteExistingLocalSystemContainerSync } from \"./systemContainerPromotion\";\n\nexport async function updateExistingSystemContainer(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n existing: ContainerState,\n options: EnsureSystemContainerOptions,\n isCurrent: ContainerWriteGuard,\n) {\n if (\"icon\" in options) {\n const iconApplied = await applySystemContainerIcon({\n containerState: existing,\n icon: options.icon,\n persistIcon: async (containerState, icon, update) => {\n if (options.deferRemoteBootstrap) {\n invalidateRemoteContainerWrites(state, [containerState.container.id]);\n }\n const result = await persistContainerState(state, containerState, {\n patch: { icon },\n updateView: false,\n localMetadataPatch: { icon },\n localUpdate: update,\n isCurrent,\n });\n return result.status;\n },\n state,\n syncAgent,\n isCurrent,\n });\n if (!iconApplied || !isCurrent()) {\n return null;\n }\n }\n const promoted = await promoteExistingLocalSystemContainerSync({\n containerState: existing,\n logLabel: getContainerContentsStoreLogLabel(state),\n options,\n persistPromotion: async (containerState, promotion) => {\n if (options.deferRemoteBootstrap) {\n invalidateRemoteContainerWrites(state, [containerState.container.id]);\n }\n const result = await persistContainerState(state, containerState, {\n saveOptions: promotion.queueCreateIntent\n ? { createIntent: { parentContainerId: promotion.parentContainerId } }\n : undefined,\n localUpdate: promotion.metadataUpdate,\n isCurrent,\n });\n return result.status === \"persisted\";\n },\n rootState: findRootContainerState(state),\n state,\n syncAgent,\n isCurrent,\n });\n return promoted && isCurrent() ? toContainerNode(existing) : null;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { deriveOrganizationMetadataContainerSystemSlot, } from "
|
|
1
|
+
import { deriveOrganizationMetadataContainerSystemSlot, } from "../../../internal/validators/containerSystemSlot.js";
|
|
2
|
+
import { getContainerContentsStoreLogLabel } from "../logLabel.js";
|
|
2
3
|
import { updateExistingSystemContainer } from "./existingSystemContainer.js";
|
|
3
|
-
import { getContainerContentsStoreLogLabel } from "./logLabel.js";
|
|
4
4
|
import { probeExistingSystemContainer } from "./systemContainerHydration.js";
|
|
5
5
|
import { findOrganizationSystemRootState } from "./systemContainerLookup.js";
|
|
6
6
|
/** Metadata is provisioned with reserved grants; generic ensure cannot create it. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organizationMetadataSystemContainer.js","sourceRoot":"","sources":["organizationMetadataSystemContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,6CAA6C,GAC9C,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAOhE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,qFAAqF;AACrF,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAAC,KAM/D;IACC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACxD,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC;IACzD,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAW,CAAC;IACxD,MAAM,YAAY,GAAG,MAAM,6CAA6C,CAAC;QACvE,cAAc;KACf,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,GAAG,EAAE,CACrB,KAAK,CAAC,SAAS,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,KAAK,cAAc,CAAC;IAC5E,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAW,CAAC;IACrE,IAAI,UAAU,KAAK,YAAY;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAW,CAAC;IAEpE,IAAI,QAAQ,GAAG,+BAA+B,CAC5C,KAAK,EACL,cAAc,EACd,UAAU,CACX,CAAC;IACF,IACE,CAAC,QAAQ;QACT,CAAC,OAAO,CAAC,oBAAoB;QAC7B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe;QAClC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAC1B,CAAC;QACD,MAAM,4BAA4B,CAAC;YACjC,QAAQ,EAAE,iCAAiC,CAAC,KAAK,CAAC;YAClD,SAAS,EAAE,IAAI;YACf,KAAK;YACL,SAAS;YACT,UAAU;YACV,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,EAAE;YAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAW,CAAC;QACrE,QAAQ,GAAG,+BAA+B,CACxC,KAAK,EACL,cAAc,EACd,UAAU,CACX,CAAC;IACJ,CAAC;IACD,OAAO;QACL,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,QAAQ;YACjB,CAAC,CAAC,MAAM,6BAA6B,CACjC,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,SAAS,CACV;YACH,CAAC,CAAC,IAAI;KACA,CAAC;AACb,CAAC","sourcesContent":["import {\n type ContainerSystemSlot,\n deriveOrganizationMetadataContainerSystemSlot,\n} from \"@tearleads/validators/containerSystemSlot\";\nimport { getContainerContentsStoreLogLabel } from \"../logLabel\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport type { ContainerContentsStoreSyncAgent } from \"../syncAgent\";\nimport type {\n ContainerContentsStoreState,\n EnsureSystemContainerOptions,\n} from \"../types\";\nimport { updateExistingSystemContainer } from \"./existingSystemContainer\";\nimport { probeExistingSystemContainer } from \"./systemContainerHydration\";\nimport { findOrganizationSystemRootState } from \"./systemContainerLookup\";\n\n/** Metadata is provisioned with reserved grants; generic ensure cannot create it. */\nexport async function ensureOrganizationMetadataSystemContainer(input: {\n readonly state: ContainerContentsStoreState;\n readonly syncAgent: ContainerContentsStoreSyncAgent;\n readonly systemSlot: ContainerSystemSlot;\n readonly options: EnsureSystemContainerOptions;\n readonly isCurrent: ContainerWriteGuard;\n}) {\n const { state, syncAgent, systemSlot, options } = input;\n const organizationId = state.runtime.auth.organizationId;\n if (!organizationId) return { handled: false } as const;\n const metadataSlot = await deriveOrganizationMetadataContainerSystemSlot({\n organizationId,\n });\n const isCurrent = () =>\n input.isCurrent() && state.runtime.auth.organizationId === organizationId;\n if (!isCurrent()) return { handled: true, container: null } as const;\n if (systemSlot !== metadataSlot) return { handled: false } as const;\n\n let existing = findOrganizationSystemRootState(\n state,\n organizationId,\n systemSlot,\n );\n if (\n !existing &&\n !options.deferRemoteBootstrap &&\n state.runtime.auth.isAuthenticated &&\n state.runtime.state.online\n ) {\n await probeExistingSystemContainer({\n logLabel: getContainerContentsStoreLogLabel(state),\n rootState: null,\n state,\n syncAgent,\n systemSlot,\n independentRoot: true,\n });\n if (!isCurrent()) return { handled: true, container: null } as const;\n existing = findOrganizationSystemRootState(\n state,\n organizationId,\n systemSlot,\n );\n }\n return {\n handled: true,\n container: existing\n ? await updateExistingSystemContainer(\n state,\n syncAgent,\n existing,\n options,\n isCurrent,\n )\n : null,\n } as const;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { reportAndRethrowKeyingVerificationError } from "
|
|
2
|
-
import { errorMessage } from "
|
|
3
|
-
import { isDatabaseUnavailableError } from "
|
|
1
|
+
import { reportAndRethrowKeyingVerificationError } from "../../../data/keyingProjectionVerification/error.js";
|
|
2
|
+
import { errorMessage } from "../../../data/shared/errorMessage.js";
|
|
3
|
+
import { isDatabaseUnavailableError } from "../../../workflows/container-contents/syncLane.js";
|
|
4
4
|
// Best-effort remote probe for an already-existing system container. System
|
|
5
5
|
// containers occupy root lanes, so this probes those lanes (not a
|
|
6
6
|
// full-tree refresh). Device-first: a network failure must not abort
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemContainerHydration.js","sourceRoot":"","sources":["systemCont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AAuB,KAAK,CAAC,UAAU,aAAa,MAAM,GAAG,CAC/E,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { ContainerSystemSlot } from \"@tearleads/validators/containerSystemSlot\";\nimport { reportAndRethrowKeyingVerificationError } from \"../../../data/keyingProjectionVerification/error\";\nimport { errorMessage } from \"../../../data/shared/errorMessage\";\nimport { isDatabaseUnavailableError } from \"../../../workflows/container-contents/syncLane\";\nimport type {\n ContainerContentsStoreSyncAgent,\n ContainerState,\n} from \"../syncAgent\";\nimport type { ContainerContentsStoreState } from \"../types\";\n\n// Best-effort remote probe for an already-existing system container. System\n// containers occupy root lanes, so this probes those lanes (not a\n// full-tree refresh). Device-first: a network failure must not abort\n// provisioning, or a caller that waits on this container never observes it.\nexport async function probeExistingSystemContainer(input: {\n readonly logLabel: string;\n readonly rootState: ContainerState | null;\n readonly state: ContainerContentsStoreState;\n readonly syncAgent: ContainerContentsStoreSyncAgent;\n readonly systemSlot: ContainerSystemSlot;\n readonly independentRoot?: boolean;\n}): Promise<void> {\n try {\n await input.syncAgent.requestRemoteHydration({\n ...(input.independentRoot ? { followDiscoveredParentLanes: false } : {}),\n parentIds:\n input.rootState && !input.independentRoot\n ? [null, input.rootState.container.id]\n : [null],\n });\n } catch (error) {\n await reportAndRethrowKeyingVerificationError(\n error,\n input.state.runtime.util.reportSecurityIncident,\n {\n objectId: input.rootState?.container.id ?? null,\n objectKind: \"container\",\n operation: \"container.system.hydrate\",\n organizationId: input.rootState?.container.organizationId,\n },\n );\n if (!isDatabaseUnavailableError(error)) {\n const reason = errorMessage(error);\n input.state.runtime.util.log(\n `${input.logLabel}: remote probe for \"${input.systemSlot}\" failed (${reason})`,\n );\n }\n }\n}\n"]}
|
package/stores/container-contents/{systemContainerIcon.js → systemContainers/systemContainerIcon.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { encodeVersionVector, exportUpdatesSince } from "
|
|
2
|
-
import { getDefaultContainerName, readContainerMetadataValue, writeContainerMetadataValue, } from "
|
|
3
|
-
import { createDetachedContainerMetadataState, installDetachedContainerMetadataState, } from "
|
|
4
|
-
import { removeMissingContainerState } from "
|
|
5
|
-
import { updateContainerContentsSnapshot } from "
|
|
1
|
+
import { encodeVersionVector, exportUpdatesSince } from "../../../internal/loro/index.js";
|
|
2
|
+
import { getDefaultContainerName, readContainerMetadataValue, writeContainerMetadataValue, } from "../../../data/containers/containerMetadataDocument.js";
|
|
3
|
+
import { createDetachedContainerMetadataState, installDetachedContainerMetadataState, } from "../../../workflows/container-contents/metadata/metadataStateIsolation.js";
|
|
4
|
+
import { removeMissingContainerState } from "../containerState/missingContainerState.js";
|
|
5
|
+
import { updateContainerContentsSnapshot } from "../state.js";
|
|
6
6
|
function normalizeSystemContainerIcon(icon) {
|
|
7
7
|
return icon?.trim() || null;
|
|
8
8
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemContainerIcon.js","sourceRoot":"","sources":["systemContainerIcon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,uEAAuE,CAAC;AAE/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAEtF,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAa3D,SAAS,4BAA4B,CACnC,IAA+B;IAE/B,OAAO,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC;AAC9B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,KAO9C;IACC,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG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AAK,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QAC3C,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { encodeVersionVector, exportUpdatesSince } from \"@tearleads/loro\";\nimport {\n getDefaultContainerName,\n readContainerMetadataValue,\n writeContainerMetadataValue,\n} from \"../../../data/containers/containerMetadataDocument\";\nimport {\n createDetachedContainerMetadataState,\n installDetachedContainerMetadataState,\n} from \"../../../workflows/container-contents/metadata/metadataStateIsolation\";\nimport type { PersistContainerStateResult } from \"../../../workflows/container-contents/remoteHydration\";\nimport { removeMissingContainerState } from \"../containerState/missingContainerState\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport { updateContainerContentsSnapshot } from \"../state\";\nimport type {\n ContainerContentsStoreSyncAgent,\n ContainerState,\n} from \"../syncAgent\";\nimport type { ContainerContentsStoreState } from \"../types\";\n\ntype PersistSystemContainerIcon = (\n containerState: ContainerState,\n icon: string | null,\n update: Uint8Array,\n) => Promise<PersistContainerStateResult[\"status\"]>;\n\nfunction normalizeSystemContainerIcon(\n icon: string | null | undefined,\n): string | null {\n return icon?.trim() || null;\n}\n\nexport async function applySystemContainerIcon(input: {\n readonly containerState: ContainerState;\n readonly icon: string | null | undefined;\n readonly persistIcon: PersistSystemContainerIcon;\n readonly state: ContainerContentsStoreState;\n readonly syncAgent: ContainerContentsStoreSyncAgent;\n readonly isCurrent?: ContainerWriteGuard | undefined;\n}): Promise<boolean> {\n const isCurrent = input.isCurrent ?? (() => true);\n const icon = normalizeSystemContainerIcon(input.icon);\n const currentIcon = input.containerState.container.icon ?? null;\n if (currentIcon === icon) {\n return true;\n }\n\n if (!isCurrent()) return false;\n const persistenceCandidate = await createDetachedContainerMetadataState(\n input.containerState,\n );\n if (!isCurrent()) return false;\n const metadata = readContainerMetadataValue(\n persistenceCandidate.doc,\n getDefaultContainerName(persistenceCandidate.container.parentId),\n );\n const sourceVersionVector = encodeVersionVector(persistenceCandidate.doc);\n writeContainerMetadataValue(persistenceCandidate.doc, {\n ...metadata,\n icon,\n });\n const update = exportUpdatesSince(\n persistenceCandidate.doc,\n sourceVersionVector,\n );\n const persistenceStatus = await input.persistIcon(\n persistenceCandidate,\n icon,\n update,\n );\n if (persistenceStatus === \"missing\") {\n removeMissingContainerState(input.state, input.containerState);\n }\n if (persistenceStatus !== \"persisted\" || !isCurrent()) {\n return false;\n }\n installDetachedContainerMetadataState(\n input.containerState,\n persistenceCandidate,\n { preserveConcurrentMetadataEdit: true },\n );\n updateContainerContentsSnapshot(input.state);\n if (input.containerState.record.documentId) {\n input.syncAgent.scheduleSync();\n }\n return true;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemContainerLookup.js","sourceRoot":"","sources":["systemContainerLookup.ts"],"names":[],"mappings":"AAIA,SAAS,WAAW,CAAC,cAA8B;IACjD,OAAO,CACL,cAAc,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI;QAC1C,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CACrC,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,cAA8B;IACxD,OAAO,CACL,WAAW,CAAC,cAAc,CAAC;QAC3B,CAAC,cAAc,CAAC,SAAS,CAAC,cAAc;QACxC,CAAC,cAAc,CAAC,SAAS,CAAC,kBAAkB,CAC7C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAkC;IAElC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CACjE,WAAW,CACZ,CAAC;IACF,MAAM,gBAAgB,GACpB,UAAU,CAAC,IAAI,CACb,CAAC,cAAc,EAAE,EAAE,CACjB,cAAc,CAAC,SAAS,CAAC,EAAE,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,EAAE,SAAS,CAAC,cAAc,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC;IAC3E,MAAM,cAAc,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,IAAI,eAAe,CAAC;IAClE,KAAK,MAAM,cAAc,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC;QAC3D,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,CAAC;QAC3C,IAAI,SAAS,CAAC,UAAU,KAAK,UAAU;YAAE,SAAS;QAClD,IAAI,cAAc,IAAI,SAAS,CAAC,QAAQ,KAAK,cAAc;YAAE,SAAS;QACtE,MAAM,gBAAgB,GACpB,SAAS,IAAI,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;QAC1E,IACE,cAAc;YACd,CAAC,gBAAgB;YACjB,SAAS,CAAC,cAAc,KAAK,cAAc;YAE3C,SAAS;QACX,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,+BAA+B,CAC7C,KAAkC,EAClC,cAAsB,EACtB,UAA+B;IAE/B,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC;QAClD,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IACE,SAAS,CAAC,QAAQ,KAAK,IAAI;YAC3B,SAAS,CAAC,cAAc,KAAK,cAAc;YAC3C,SAAS,CAAC,UAAU,KAAK,UAAU;YAEnC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ContainerSystemSlot } from \"@tearleads/validators/containerSystemSlot\";\nimport type { ContainerState } from \"../syncAgent\";\nimport type { ContainerContentsStoreState } from \"../types\";\n\nfunction isRootState(containerState: ContainerState): boolean {\n return (\n containerState.container.parentId === null &&\n !containerState.container.systemSlot\n );\n}\n\nfunction isPreAuthRootState(containerState: ContainerState): boolean {\n return (\n isRootState(containerState) &&\n !containerState.container.organizationId &&\n !containerState.container.metadataDocumentId\n );\n}\n\nexport function findRootContainerState(\n state: ContainerContentsStoreState,\n): ContainerState | null {\n const rootStates = Array.from(state.containersById.values()).filter(\n isRootState,\n );\n const defaultRootState =\n rootStates.find(\n (containerState) =>\n containerState.container.id === state.runtime.state.containerId,\n ) ?? null;\n const organizationId = state.runtime.auth.organizationId;\n if (!organizationId) {\n return defaultRootState ?? rootStates[0] ?? null;\n }\n\n // Remote root roles have been verified during hydration. An acknowledgement\n // selects the personal merge destination; other organizations may be first\n // encountered on this device after joining or creating them elsewhere.\n const organizationRoots = rootStates.filter(\n (entry) => entry.container.organizationId === organizationId,\n );\n const acknowledgedRootId = state.runtime.auth.rootContainerId;\n const organizationRootState = acknowledgedRootId\n ? organizationRoots.find(\n (entry) => entry.container.id === acknowledgedRootId,\n )\n : organizationRoots.length === 1\n ? organizationRoots[0]\n : null;\n if (organizationRootState) {\n return organizationRootState;\n }\n\n if (defaultRootState && isPreAuthRootState(defaultRootState)) {\n return defaultRootState;\n }\n return rootStates.find(isPreAuthRootState) ?? null;\n}\n\nexport function findSystemContainerStateForRoot(\n state: ContainerContentsStoreState,\n systemSlot: ContainerSystemSlot,\n rootState: ContainerState | null,\n): ContainerState | null {\n const { rootContainerId } = state.runtime.auth;\n const organizationId =\n rootState?.container.organizationId || state.runtime.auth.organizationId;\n const expectedRootId = rootState?.container.id ?? rootContainerId;\n for (const containerState of state.containersById.values()) {\n const container = containerState.container;\n if (container.systemSlot !== systemSlot) continue;\n if (expectedRootId && container.parentId !== expectedRootId) continue;\n const isLocalCandidate =\n rootState && isPreAuthRootState(rootState) && !container.organizationId;\n if (\n organizationId &&\n !isLocalCandidate &&\n container.organizationId !== organizationId\n )\n continue;\n return containerState;\n }\n return null;\n}\n\n/** Callers must derive the metadata slot before using this as a destination. */\nexport function findOrganizationSystemRootState(\n state: ContainerContentsStoreState,\n organizationId: string,\n systemSlot: ContainerSystemSlot,\n): ContainerState | null {\n for (const entry of state.containersById.values()) {\n const container = entry.container;\n if (\n container.parentId === null &&\n container.organizationId === organizationId &&\n container.systemSlot === systemSlot\n )\n return entry;\n }\n return null;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isRemoteBackedContainerState } from "
|
|
2
|
-
import { updateContainerContentsSnapshot } from "
|
|
1
|
+
import { isRemoteBackedContainerState } from "../remoteEvents/remoteBackedContainerState.js";
|
|
2
|
+
import { updateContainerContentsSnapshot } from "../state.js";
|
|
3
3
|
import { findRootContainerState, findSystemContainerStateForRoot, } from "./systemContainerLookup.js";
|
|
4
4
|
function findSystemContainerCreatedAfterRemoteHydrationTarget(state, systemSlot, created) {
|
|
5
5
|
if (isRemoteBackedContainerState(created)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemContainerPostCreate.js","sourceRoot":"","sources":["systemContainerPostCreate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE1F,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAM3D,OAAO,EACL,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AAEjC,SAAS,oDAAoD,CAC3D,KAAkC,EAClC,UAA+B,EAC/B,OAAuB;IAEvB,IAAI,4BAA4B,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,WAAW,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,+BAA+B,CAClD,KAAK,EACL,UAAU,EACV,WAAW,CACZ,CAAC;IACF,IACE,CAAC,YAAY;QACb,YAAY,CAAC,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE;QAClD,CAAC,4BAA4B,CAAC,YAAY,CAAC,EAC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2E;IAC3E,8EAA8E;IAC9E,oEAAoE;IACpE,MAAM,UAAU,GAAG,oCAAoC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,0CAA0C,CAAC;YAC/C,OAAO;YACP,SAAS;YACT,UAAU;YACV,KAAK;SACN,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,EAAE;YAAE,OAAO,IAAI,CAAC;QAC9B,YAAY,GAAG,oDAAoD,CACjE,KAAK,EACL,UAAU,EACV,OAAO,CAAC,cAAc,CACvB,CAAC;QACF,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,yCAAyC,CAAC;gBAC9C,OAAO;gBACP,SAAS;gBACT,YAAY;gBACZ,KAAK;aACN,CAAC,CAAC;YACH,OAAO,SAAS,EAAE;gBAChB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE;gBACjD,CAAC,CAAC,IAAI,CAAC;QACX,CAAC;IACH,CAAC;IAED,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO,IAAI,CAAC;IAC9B,KAAK,CAAC,cAAc,CAAC,GAAG,CACtB,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,EACnC,OAAO,CAAC,cAAc,CACvB,CAAC;IACF,+BAA+B,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAC9B,SAAS,CAAC,YAAY,EAAE,CAAC;IAC3B,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CACpB,GAAG,KAAK,CAAC,QAAQ,+BAA+B,UAAU,GAAG,CAC9D,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type { ContainerSystemSlot } from \"@tearleads/validators/containerSystemSlot\";\nimport type { CreatedChildContainerState } from \"../../../workflows/container-contents/container-state/types\";\nimport { isRemoteBackedContainerState } from \"../remoteEvents/remoteBackedContainerState\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport { updateContainerContentsSnapshot } from \"../state\";\nimport type {\n ContainerContentsStoreSyncAgent,\n ContainerState,\n} from \"../syncAgent\";\nimport type { ContainerContentsStoreState } from \"../types\";\nimport {\n findRootContainerState,\n findSystemContainerStateForRoot,\n} from \"./systemContainerLookup\";\n\nfunction findSystemContainerCreatedAfterRemoteHydrationTarget(\n state: ContainerContentsStoreState,\n systemSlot: ContainerSystemSlot,\n created: ContainerState,\n): ContainerState | null {\n if (isRemoteBackedContainerState(created)) {\n return null;\n }\n\n const currentRoot = findRootContainerState(state);\n const remoteTarget = findSystemContainerStateForRoot(\n state,\n systemSlot,\n currentRoot,\n );\n if (\n !remoteTarget ||\n remoteTarget.container.id === created.container.id ||\n !isRemoteBackedContainerState(remoteTarget)\n ) {\n return null;\n }\n\n return remoteTarget;\n}\n\nfunction findCreatedSystemContainerRebaseRoot(input: {\n created: CreatedChildContainerState;\n state: ContainerContentsStoreState;\n}): ContainerState | null {\n const { containerState } = input.created;\n const currentRoot = findRootContainerState(input.state);\n if (\n !currentRoot ||\n !isRemoteBackedContainerState(currentRoot) ||\n (containerState.container.parentId === currentRoot.container.id &&\n containerState.container.organizationId ===\n currentRoot.container.organizationId)\n ) {\n return null;\n }\n return currentRoot;\n}\n\nasync function rebaseCreatedSystemContainerOntoRemoteRoot(input: {\n created: CreatedChildContainerState;\n isCurrent: ContainerWriteGuard;\n remoteRoot: ContainerState;\n state: ContainerContentsStoreState;\n}): Promise<void> {\n const { created, remoteRoot, state } = input;\n const containerState = created.containerState;\n const rebasedContainer = {\n ...containerState.container,\n organizationId: remoteRoot.container.organizationId,\n parentId: remoteRoot.container.id,\n };\n const persistedContainer = await state.persistence.saveContainer(\n state.runtime.infra.execSql,\n rebasedContainer,\n containerState.record,\n {\n ...(created.shouldRequestSync\n ? { createIntent: { parentContainerId: remoteRoot.container.id } }\n : {}),\n stillCurrent: input.isCurrent,\n },\n );\n if (!input.isCurrent()) return;\n containerState.container = persistedContainer;\n}\n\nasync function reconcileCreatedSystemContainerIntoTarget(input: {\n created: CreatedChildContainerState;\n isCurrent: ContainerWriteGuard;\n remoteTarget: ContainerState;\n state: ContainerContentsStoreState;\n}): Promise<void> {\n if (!input.isCurrent()) return;\n await input.state.persistence.reconcileLocalSystemContainer(\n input.state.runtime.infra.execSql,\n {\n localContainerId: input.created.containerState.container.id,\n remoteContainerId: input.remoteTarget.container.id,\n remoteOrganizationId: input.remoteTarget.container.organizationId,\n stillCurrent: input.isCurrent,\n },\n );\n}\n\nexport async function finalizeCreatedSystemContainer(input: {\n created: CreatedChildContainerState;\n logLabel: string;\n state: ContainerContentsStoreState;\n syncAgent: ContainerContentsStoreSyncAgent;\n systemSlot: ContainerSystemSlot;\n isCurrent?: ContainerWriteGuard | undefined;\n}): Promise<{ adopted: boolean; containerState: ContainerState } | null> {\n const { created, state, syncAgent, systemSlot } = input;\n const isCurrent = input.isCurrent ?? (() => true);\n // Keep the no-target check and local insertion in one synchronous turn. If\n // we yielded between them, remote root hydration could delete the captured\n // parent in that gap and this create would land as an orphan afterward.\n let remoteTarget = findSystemContainerCreatedAfterRemoteHydrationTarget(\n state,\n systemSlot,\n created.containerState,\n );\n if (remoteTarget) {\n await reconcileCreatedSystemContainerIntoTarget({\n created,\n isCurrent,\n remoteTarget,\n state,\n });\n return isCurrent() ? { adopted: true, containerState: remoteTarget } : null;\n }\n\n // The remote root can arrive before its system child. Rebase the persisted\n // candidate now so that a later same-slot child matches normal reconciliation\n // instead of leaving the candidate under the deleted pre-auth root.\n const remoteRoot = findCreatedSystemContainerRebaseRoot({ created, state });\n if (remoteRoot) {\n await rebaseCreatedSystemContainerOntoRemoteRoot({\n created,\n isCurrent,\n remoteRoot,\n state,\n });\n if (!isCurrent()) return null;\n remoteTarget = findSystemContainerCreatedAfterRemoteHydrationTarget(\n state,\n systemSlot,\n created.containerState,\n );\n if (remoteTarget) {\n await reconcileCreatedSystemContainerIntoTarget({\n created,\n isCurrent,\n remoteTarget,\n state,\n });\n return isCurrent()\n ? { adopted: true, containerState: remoteTarget }\n : null;\n }\n }\n\n if (!isCurrent()) return null;\n state.containersById.set(\n created.containerState.container.id,\n created.containerState,\n );\n updateContainerContentsSnapshot(state);\n if (created.shouldRequestSync) {\n syncAgent.scheduleSync();\n }\n state.runtime.util.log(\n `${input.logLabel}: ensured system container \"${systemSlot}\"`,\n );\n return { adopted: false, containerState: created.containerState };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { base64ToBytes } from "
|
|
1
|
+
import { base64ToBytes } from "../../../internal/encoding/index.js";
|
|
2
2
|
export function hasAdvancedManagedPrincipalReference(containerState) {
|
|
3
3
|
return (containerState.metadataReferencedPrincipals?.some((principal) => principal.version > 1) ?? false);
|
|
4
4
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemContainerPromotion.js","sourceRoot":"","sources":["systemContainerPromotion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAWpD,MAAM,UAAU,oCAAoC,CAClD,cAA8B;IAE9B,OAAO,CACL,cAAc,CAAC,4BAA4B,EAAE,IAAI,CAC/C,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,GAAG,CAAC,CACrC,IAAI,KAAK,CACX,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uCAAuC,CAAC,KAgB7D;IACC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACvE,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,iBAAiB,GAAG,cAAc,CAAC,SAAS,CAAC,QAA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rE;YACH,CAAC,CAAC,EAAE,CAAC;QACP,iBAAiB;QACjB,iBAAiB,EAAE,uBAAuB;KAC3C,CAAC,CAAC;IACH,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS,CAAC,YAAY,EAAE,CAAC;IACzB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CACpB,GAAG,KAAK,CAAC,QAAQ,8BAA8B,cAAc,CAAC,SAAS,CAAC,UAAU,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE,mBAAmB,CACrI,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { base64ToBytes } from \"@tearleads/encoding\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport type {\n ContainerContentsStoreSyncAgent,\n ContainerState,\n} from \"../syncAgent\";\nimport type {\n ContainerContentsStoreState,\n EnsureSystemContainerOptions,\n} from \"../types\";\n\nexport function hasAdvancedManagedPrincipalReference(\n containerState: ContainerState,\n): boolean {\n return (\n containerState.metadataReferencedPrincipals?.some(\n (principal) => principal.version > 1,\n ) ?? false\n );\n}\n\nexport async function promoteExistingLocalSystemContainerSync(input: {\n containerState: ContainerState;\n logLabel: string;\n options: EnsureSystemContainerOptions;\n persistPromotion: (\n containerState: ContainerState,\n promotion: {\n metadataUpdate?: Uint8Array | undefined;\n parentContainerId: string;\n queueCreateIntent: boolean;\n },\n ) => Promise<boolean>;\n rootState: ContainerState | null;\n state: ContainerContentsStoreState;\n syncAgent: ContainerContentsStoreSyncAgent;\n isCurrent?: ContainerWriteGuard | undefined;\n}): Promise<boolean> {\n const { containerState, options, rootState, state, syncAgent } = input;\n const isCurrent = input.isCurrent ?? (() => true);\n const parentContainerId = containerState.container.parentId;\n if (\n options.deferRemoteSync ||\n !state.runtime.auth.isAuthenticated ||\n !parentContainerId ||\n containerState.record.documentId\n ) {\n return true;\n }\n\n if (\n options.skipAdvancedManagedRoot &&\n rootState &&\n hasAdvancedManagedPrincipalReference(rootState)\n ) {\n return true;\n }\n\n const execSql = state.runtime.infra.execSql;\n const [pendingCreateIntents, pendingUpdates] = await Promise.all([\n state.persistence.listPendingCreateIntents(execSql),\n state.persistence.listPendingUpdates(execSql, containerState.container.id),\n ]);\n if (!isCurrent()) return false;\n const hasPendingCreateIntent = pendingCreateIntents.some(\n (intent) => intent.containerId === containerState.container.id,\n );\n const shouldQueueCreateIntent = !hasPendingCreateIntent;\n const shouldQueueMetadataUpdate = pendingUpdates.length === 0;\n if (!shouldQueueCreateIntent && !shouldQueueMetadataUpdate) {\n return true;\n }\n\n const persisted = await input.persistPromotion(containerState, {\n ...(shouldQueueMetadataUpdate\n ? {\n metadataUpdate: base64ToBytes(containerState.record.metadataUpdates),\n }\n : {}),\n parentContainerId,\n queueCreateIntent: shouldQueueCreateIntent,\n });\n if (!persisted || !isCurrent()) {\n return false;\n }\n\n syncAgent.scheduleSync();\n state.runtime.util.log(\n `${input.logLabel}: queued system container \"${containerState.container.systemSlot ?? containerState.container.id}\" for remote sync`,\n );\n return true;\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ContainerAccessLevel, ReferencedPrincipalHead } from "../../internal/crypto/index.js";
|
|
2
2
|
import type { ContainerSystemSlot } from "../../internal/validators/containerSystemSlot.js";
|
|
3
3
|
import type { ContainerWriterProjectionResponse } from "../../internal/validators/response/index.js";
|
|
4
|
-
import type { PurgeOptions } from "../../workflows/container-contents/container-state/purgeProgress.js";
|
|
4
|
+
import type { PurgeOptions } from "../../workflows/container-contents/container-state/purge/purgeProgress.js";
|
|
5
5
|
import type { ContainerContentsPersistence } from "../../workflows/container-contents/containerPersistence.js";
|
|
6
6
|
import type { ContainerDocumentObjectSyncState } from "../../workflows/container-contents/syncState.js";
|
|
7
|
-
import type { ContainerContentsStoreRuntime, ContainerContentsStoreSyncState, RefreshRootLaneOptions } from "./syncAgentTypes.js";
|
|
7
|
+
import type { ContainerContentsStoreRuntime, ContainerContentsStoreSyncState, RefreshRootLaneOptions } from "./syncAgent/syncAgentTypes.js";
|
|
8
8
|
export type ContainerContentsShareAccessLevel = ContainerAccessLevel;
|
|
9
9
|
export interface ContainerContentsStoreOptions {
|
|
10
10
|
logLabel?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ContainerAccessLevel,\n ReferencedPrincipalHead,\n} from \"@tearleads/crypto\";\nimport type { ContainerSystemSlot } from \"@tearleads/validators/containerSystemSlot\";\nimport type { ContainerWriterProjectionResponse } from \"@tearleads/validators/response\";\nimport type { PurgeOptions } from \"../../workflows/container-contents/container-state/purgeProgress\";\nimport type { ContainerContentsPersistence } from \"../../workflows/container-contents/containerPersistence\";\nimport type { ContainerDocumentObjectSyncState } from \"../../workflows/container-contents/syncState\";\nimport type {\n ContainerContentsStoreRuntime,\n ContainerContentsStoreSyncState,\n RefreshRootLaneOptions,\n} from \"./syncAgentTypes\";\n\n// Reuse the canonical access-level union from the crypto layer (the same source\n// `ContainerShareAccessLevel` chains to) rather than re-spelling the literals,\n// so the two can't drift.\nexport type ContainerContentsShareAccessLevel = ContainerAccessLevel;\n\nexport interface ContainerContentsStoreOptions {\n logLabel?: string | undefined;\n persistence?: ContainerContentsPersistence | undefined;\n}\n\nexport interface ContainerNode {\n systemSlot?: ContainerSystemSlot | null;\n createdAt?: string | null;\n effectiveAccessLevel?: ContainerAccessLevel | undefined;\n id: string;\n icon?: string | null;\n metadataDocumentId?: string | null;\n /** False while a discovered remote folder has no local metadata content. */\n metadataReady?: boolean;\n organizationId: string;\n name: string;\n parentId: string | null;\n syncState: ContainerDocumentObjectSyncState;\n kind: \"container\";\n updatedAt?: string | null;\n}\n\n// The store surface exposed through context: the snapshot fields plus the\n// store's mutation/refresh methods, spelled as a Pick so the two can't drift.\nexport type ContainerContentsContextValue = ContainerContentsSnapshot &\n Pick<\n ContainerContentsStore,\n | \"createChild\"\n | \"deleteContainer\"\n | \"emptyTrash\"\n | \"ensureSystemContainer\"\n | \"moveContainer\"\n | \"purgeContainer\"\n | \"refresh\"\n | \"refreshRootLane\"\n | \"renameContainer\"\n | \"requestSync\"\n | \"setContainerIcon\"\n | \"shareWithGroup\"\n | \"shareWithUser\"\n >;\n\nexport interface ContainerContentsSnapshot {\n nodes: ReadonlyArray<ContainerNode>;\n ready: boolean;\n}\n\nexport type ContainerGroupRewrapPreparation =\n | {\n status: \"not-granted\";\n }\n | {\n isCurrent(\n expectedGroupHead: ReferencedPrincipalHead,\n expectedContainerId: string,\n expectedOrganizationId: string,\n ): Promise<boolean>;\n rewrap(): Promise<boolean>;\n status: \"prepared\";\n };\n\n/**\n * Shared per-scope container tree and mutation store.\n *\n * Ordinary metadata/topology writes (`createChild`, `moveContainer`,\n * `renameContainer`, and `setContainerIcon`) commit to local persistence and\n * update subscribers before their queued remote sync converges. Destructive\n * and access-control operations retain their explicit remote-authority gates.\n */\nexport interface ContainerContentsStore {\n createChild: (\n parentId: string,\n name: string,\n ) => Promise<ContainerNode | null>;\n deleteContainer: (containerId: string) => Promise<boolean>;\n ensureSystemContainer: (\n systemSlot: ContainerSystemSlot,\n name: string,\n options?: EnsureSystemContainerOptions | undefined,\n ) => Promise<ContainerNode | null>;\n moveContainer: (\n containerId: string,\n parentId: string,\n ) => Promise<ContainerNode | null>;\n purgeContainer: (\n containerId: string,\n options?: PurgeOptions,\n ) => Promise<boolean>;\n emptyTrash: (\n trashContainerId: string,\n options?: PurgeOptions,\n ) => Promise<boolean>;\n // `options.requireExistingGrant` gates the preparation check only. The\n // prepared `rewrap` is always grant-preserving: it re-wraps a signed grant\n // and never mints one, so it carries no chosen group name, and it throws\n // (rather than healing through a policy mutation) when the container\n // manifest grants the group but the verified policy has no matching grant.\n prepareGroupRewrap: (\n containerId: string,\n groupId: string,\n accessLevel: ContainerContentsShareAccessLevel,\n options?: { requireExistingGrant?: boolean } | undefined,\n ) => Promise<ContainerGroupRewrapPreparation | null>;\n refresh: () => Promise<boolean>;\n refreshRootLane: (options?: RefreshRootLaneOptions) => Promise<boolean>;\n // Re-read root-lane containers from local SQLite into the snapshot with NO\n // server round-trip. Surfaces a just-persisted container — e.g. the Trash bin\n // that registration/org-creation provisioned server-side and wrote to SQLite\n // via persistRegistrationBootstrap — instantly, instead of waiting for the\n // remote root-lane pull. Idempotent with a later remote pull: the merge is\n // keyed by container id, so the pull reconciles in place rather than duplicating.\n refreshLocalContainers: () => Promise<void>;\n requestSync: () => void;\n renameContainer: (\n containerId: string,\n name: string,\n ) => Promise<ContainerNode | null>;\n setContainerIcon: (\n containerId: string,\n icon: string | null,\n ) => Promise<ContainerNode | null>;\n shareWithGroup: (\n containerId: string,\n groupId: string,\n accessLevel: ContainerContentsShareAccessLevel,\n options: {\n /**\n * The display name the group was chosen by. Required: the share fails\n * closed if the verified group policy commits a different name. Signed\n * names are unique within an organization by construction (enforced at\n * group creation), so the target's own name identifies it.\n */\n expectedGroupName: string;\n },\n ) => Promise<boolean>;\n shareWithUser: (containerId: string, userId: string) => Promise<boolean>;\n getCachedContainerWriterProjection: (\n containerId: string,\n ) => ContainerWriterProjectionResponse | null;\n getSnapshot: () => ContainerContentsSnapshot;\n subscribe: (listener: () => void) => () => void;\n updateRuntime: (runtime: ContainerContentsStoreRuntime) => void;\n}\n\nexport interface EnsureSystemContainerOptions {\n icon?: string | null | undefined;\n skipAdvancedManagedRoot?: boolean | undefined;\n // For local-first bootstrap paths where slow remote I/O must not block the\n // caller from creating the deterministic local system container.\n deferRemoteBootstrap?: boolean | undefined;\n // Create the deterministic local system container without queuing the remote\n // create. A later ensureSystemContainer call without this flag promotes the\n // local slot into the sync queue.\n deferRemoteSync?: boolean | undefined;\n}\n\nexport interface ContainerContentsStoreState\n extends ContainerContentsStoreSyncState {\n listeners: Set<() => void>;\n snapshot: ContainerContentsSnapshot;\n writeChain: Promise<ContainerNode | null>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ContainerAccessLevel,\n ReferencedPrincipalHead,\n} from \"@tearleads/crypto\";\nimport type { ContainerSystemSlot } from \"@tearleads/validators/containerSystemSlot\";\nimport type { ContainerWriterProjectionResponse } from \"@tearleads/validators/response\";\nimport type { PurgeOptions } from \"../../workflows/container-contents/container-state/purge/purgeProgress\";\nimport type { ContainerContentsPersistence } from \"../../workflows/container-contents/containerPersistence\";\nimport type { ContainerDocumentObjectSyncState } from \"../../workflows/container-contents/syncState\";\nimport type {\n ContainerContentsStoreRuntime,\n ContainerContentsStoreSyncState,\n RefreshRootLaneOptions,\n} from \"./syncAgent/syncAgentTypes\";\n\n// Reuse the canonical access-level union from the crypto layer (the same source\n// `ContainerShareAccessLevel` chains to) rather than re-spelling the literals,\n// so the two can't drift.\nexport type ContainerContentsShareAccessLevel = ContainerAccessLevel;\n\nexport interface ContainerContentsStoreOptions {\n logLabel?: string | undefined;\n persistence?: ContainerContentsPersistence | undefined;\n}\n\nexport interface ContainerNode {\n systemSlot?: ContainerSystemSlot | null;\n createdAt?: string | null;\n effectiveAccessLevel?: ContainerAccessLevel | undefined;\n id: string;\n icon?: string | null;\n metadataDocumentId?: string | null;\n /** False while a discovered remote folder has no local metadata content. */\n metadataReady?: boolean;\n organizationId: string;\n name: string;\n parentId: string | null;\n syncState: ContainerDocumentObjectSyncState;\n kind: \"container\";\n updatedAt?: string | null;\n}\n\n// The store surface exposed through context: the snapshot fields plus the\n// store's mutation/refresh methods, spelled as a Pick so the two can't drift.\nexport type ContainerContentsContextValue = ContainerContentsSnapshot &\n Pick<\n ContainerContentsStore,\n | \"createChild\"\n | \"deleteContainer\"\n | \"emptyTrash\"\n | \"ensureSystemContainer\"\n | \"moveContainer\"\n | \"purgeContainer\"\n | \"refresh\"\n | \"refreshRootLane\"\n | \"renameContainer\"\n | \"requestSync\"\n | \"setContainerIcon\"\n | \"shareWithGroup\"\n | \"shareWithUser\"\n >;\n\nexport interface ContainerContentsSnapshot {\n nodes: ReadonlyArray<ContainerNode>;\n ready: boolean;\n}\n\nexport type ContainerGroupRewrapPreparation =\n | {\n status: \"not-granted\";\n }\n | {\n isCurrent(\n expectedGroupHead: ReferencedPrincipalHead,\n expectedContainerId: string,\n expectedOrganizationId: string,\n ): Promise<boolean>;\n rewrap(): Promise<boolean>;\n status: \"prepared\";\n };\n\n/**\n * Shared per-scope container tree and mutation store.\n *\n * Ordinary metadata/topology writes (`createChild`, `moveContainer`,\n * `renameContainer`, and `setContainerIcon`) commit to local persistence and\n * update subscribers before their queued remote sync converges. Destructive\n * and access-control operations retain their explicit remote-authority gates.\n */\nexport interface ContainerContentsStore {\n createChild: (\n parentId: string,\n name: string,\n ) => Promise<ContainerNode | null>;\n deleteContainer: (containerId: string) => Promise<boolean>;\n ensureSystemContainer: (\n systemSlot: ContainerSystemSlot,\n name: string,\n options?: EnsureSystemContainerOptions | undefined,\n ) => Promise<ContainerNode | null>;\n moveContainer: (\n containerId: string,\n parentId: string,\n ) => Promise<ContainerNode | null>;\n purgeContainer: (\n containerId: string,\n options?: PurgeOptions,\n ) => Promise<boolean>;\n emptyTrash: (\n trashContainerId: string,\n options?: PurgeOptions,\n ) => Promise<boolean>;\n // `options.requireExistingGrant` gates the preparation check only. The\n // prepared `rewrap` is always grant-preserving: it re-wraps a signed grant\n // and never mints one, so it carries no chosen group name, and it throws\n // (rather than healing through a policy mutation) when the container\n // manifest grants the group but the verified policy has no matching grant.\n prepareGroupRewrap: (\n containerId: string,\n groupId: string,\n accessLevel: ContainerContentsShareAccessLevel,\n options?: { requireExistingGrant?: boolean } | undefined,\n ) => Promise<ContainerGroupRewrapPreparation | null>;\n refresh: () => Promise<boolean>;\n refreshRootLane: (options?: RefreshRootLaneOptions) => Promise<boolean>;\n // Re-read root-lane containers from local SQLite into the snapshot with NO\n // server round-trip. Surfaces a just-persisted container — e.g. the Trash bin\n // that registration/org-creation provisioned server-side and wrote to SQLite\n // via persistRegistrationBootstrap — instantly, instead of waiting for the\n // remote root-lane pull. Idempotent with a later remote pull: the merge is\n // keyed by container id, so the pull reconciles in place rather than duplicating.\n refreshLocalContainers: () => Promise<void>;\n requestSync: () => void;\n renameContainer: (\n containerId: string,\n name: string,\n ) => Promise<ContainerNode | null>;\n setContainerIcon: (\n containerId: string,\n icon: string | null,\n ) => Promise<ContainerNode | null>;\n shareWithGroup: (\n containerId: string,\n groupId: string,\n accessLevel: ContainerContentsShareAccessLevel,\n options: {\n /**\n * The display name the group was chosen by. Required: the share fails\n * closed if the verified group policy commits a different name. Signed\n * names are unique within an organization by construction (enforced at\n * group creation), so the target's own name identifies it.\n */\n expectedGroupName: string;\n },\n ) => Promise<boolean>;\n shareWithUser: (containerId: string, userId: string) => Promise<boolean>;\n getCachedContainerWriterProjection: (\n containerId: string,\n ) => ContainerWriterProjectionResponse | null;\n getSnapshot: () => ContainerContentsSnapshot;\n subscribe: (listener: () => void) => () => void;\n updateRuntime: (runtime: ContainerContentsStoreRuntime) => void;\n}\n\nexport interface EnsureSystemContainerOptions {\n icon?: string | null | undefined;\n skipAdvancedManagedRoot?: boolean | undefined;\n // For local-first bootstrap paths where slow remote I/O must not block the\n // caller from creating the deterministic local system container.\n deferRemoteBootstrap?: boolean | undefined;\n // Create the deterministic local system container without queuing the remote\n // create. A later ensureSystemContainer call without this flag promotes the\n // local slot into the sync queue.\n deferRemoteSync?: boolean | undefined;\n}\n\nexport interface ContainerContentsStoreState\n extends ContainerContentsStoreSyncState {\n listeners: Set<() => void>;\n snapshot: ContainerContentsSnapshot;\n writeChain: Promise<ContainerNode | null>;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { inspectBlobSource, } from "
|
|
2
|
-
import { DEFAULT_BLOB_CHUNK_SIZE_BYTES } from "
|
|
3
|
-
import { getDocumentAttachments } from "
|
|
4
|
-
import { deletePendingAttachment } from "
|
|
1
|
+
import { inspectBlobSource, } from "../../../../data/documents/blob/shared/blobSourceSnapshot.js";
|
|
2
|
+
import { DEFAULT_BLOB_CHUNK_SIZE_BYTES } from "../../../../data/documents/blob/shared/crypto.js";
|
|
3
|
+
import { getDocumentAttachments } from "../../../../data/documents/documentContent.js";
|
|
4
|
+
import { deletePendingAttachment } from "../attachments/attachmentPersistence.js";
|
|
5
5
|
import { resolveAttachmentUploadResume, } from "./attachmentUploadResume.js";
|
|
6
6
|
export function pendingAttachmentMatchesIntent(input) {
|
|
7
7
|
return (input.state.doc !== null &&
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentSourceUpload.js","sourceRoot":"","sources":["attachmentSourceUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,GAClB,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,OAAO,EAEL,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAQlC,MAAM,UAAU,8BAA8B,CAC5C,KAAyB;IAEzB,OAAO,CACL,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI;QACxB,sBAAsB,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAC1C,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,iBAAiB,CAAC,MAAM;YAC9C,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,iBAAiB,CAAC,aAAa,CAC/D,CACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,KAAyB;IAEzB,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;IACjE,0EAA0E;IAC1E,kEAAkE;IAClE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AI,KAAK,CAAC,yDAAyD,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import {\n type BlobSourceSnapshot,\n inspectBlobSource,\n} from \"../../../../data/documents/blob/shared/blobSourceSnapshot\";\nimport { DEFAULT_BLOB_CHUNK_SIZE_BYTES } from \"../../../../data/documents/blob/shared/crypto\";\nimport { getDocumentAttachments } from \"../../../../data/documents/documentContent\";\nimport type { BlobByteSource } from \"../../../../workflows/blobs\";\nimport type { PendingAttachmentRecord } from \"../../../../workflows/documents\";\nimport { deletePendingAttachment } from \"../attachments/attachmentPersistence\";\nimport type { DocumentStoreState } from \"../state\";\nimport type { DocumentStoreSyncGeneration } from \"../sync/syncGeneration\";\nimport {\n type AttachmentUploadResume,\n resolveAttachmentUploadResume,\n} from \"./attachmentUploadResume\";\n\ninterface PendingSourceInput {\n attachmentGeneration: DocumentStoreSyncGeneration;\n pendingAttachment: PendingAttachmentRecord;\n state: DocumentStoreState;\n}\n\nexport function pendingAttachmentMatchesIntent(\n input: PendingSourceInput,\n): boolean {\n return (\n input.state.doc !== null &&\n getDocumentAttachments(input.state.doc).some(\n (item) =>\n item.slotId === input.pendingAttachment.slotId &&\n item.contentSha256 === input.pendingAttachment.contentSha256,\n )\n );\n}\n\nexport async function dropUnavailablePendingAttachment(\n input: PendingSourceInput,\n): Promise<\"dropped\"> {\n const { state, pendingAttachment, attachmentGeneration } = input;\n // Unusable bytes or superseded intent cannot be retried. Delete only this\n // storage identity so a concurrently queued replacement survives.\n state.runtime.util.log(\n `Documents: dropping pending attachment ${pendingAttachment.slotId}; its bytes are unavailable or changed, or its content intent was superseded.`,\n );\n await deletePendingAttachment(\n state,\n pendingAttachment.slotId,\n pendingAttachment.storageKey,\n attachmentGeneration,\n );\n return \"dropped\";\n}\n\nexport async function resolveAttachmentSourceUpload(\n input: PendingSourceInput & {\n source: BlobByteSource;\n },\n): Promise<{\n readonly resume: AttachmentUploadResume;\n readonly snapshot: BlobSourceSnapshot;\n} | null> {\n let chunkSize =\n input.pendingAttachment.upload?.partSize ?? DEFAULT_BLOB_CHUNK_SIZE_BYTES;\n\n for (let attempt = 0; attempt < 3; attempt += 1) {\n const snapshot = await inspectBlobSource(input.source, chunkSize);\n if (!pendingAttachmentMatchesIntent(input)) return null;\n if (input.pendingAttachment.contentSha256 !== snapshot.sha256) {\n return null;\n }\n const resume = await resolveAttachmentUploadResume(\n input.state,\n input.pendingAttachment,\n snapshot.sha256,\n input.attachmentGeneration,\n );\n const resolvedChunkSize =\n resume.multipart?.partSize ?? DEFAULT_BLOB_CHUNK_SIZE_BYTES;\n if (!pendingAttachmentMatchesIntent(input)) return null;\n if (resolvedChunkSize === snapshot.chunkSize) {\n return { resume, snapshot };\n }\n chunkSize = resolvedChunkSize;\n }\n\n throw new Error(\"Blob source changed while preparing its upload identity\");\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createBlobByteSource } from "
|
|
2
|
-
import { runSerializedDocumentBlobMutation, runSerializedSqlMutation, } from "
|
|
3
|
-
import { assignLocalAttachmentSlots, upsertPendingAttachments, } from "
|
|
4
|
-
import { setReadySnapshot } from "
|
|
5
|
-
import { isDocumentStoreSyncGenerationCurrent, } from "
|
|
1
|
+
import { createBlobByteSource } from "../../../../workflows/blobs/index.js";
|
|
2
|
+
import { runSerializedDocumentBlobMutation, runSerializedSqlMutation, } from "../../../../workflows/documents/index.js";
|
|
3
|
+
import { assignLocalAttachmentSlots, upsertPendingAttachments, } from "../attachments/attachmentPersistence.js";
|
|
4
|
+
import { setReadySnapshot } from "../state.js";
|
|
5
|
+
import { isDocumentStoreSyncGenerationCurrent, } from "../sync/syncGeneration.js";
|
|
6
6
|
function localAttachmentRecords(localId, pendingAttachments) {
|
|
7
7
|
return pendingAttachments.map((pendingAttachment) => ({
|
|
8
8
|
blobId: null,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentStaging.js","sourceRoot":"","sources":["attachmentStaging.ts"],"names":[],"mappings":"AAAA,OAAO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jE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;IAClD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,2BAA2B,CAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC;QACjE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { createBlobByteSource } from \"../../../../workflows/blobs\";\nimport {\n type AttachmentStagingRows,\n type LocalAttachmentRecord,\n type PendingAttachmentRecord,\n runSerializedDocumentBlobMutation,\n runSerializedSqlMutation,\n} from \"../../../../workflows/documents\";\nimport type { DocumentAttachmentUpload } from \"../../types\";\nimport {\n assignLocalAttachmentSlots,\n upsertPendingAttachments,\n} from \"../attachments/attachmentPersistence\";\nimport { type DocumentStoreState, setReadySnapshot } from \"../state\";\nimport {\n type DocumentStoreSyncGeneration,\n isDocumentStoreSyncGenerationCurrent,\n} from \"../sync/syncGeneration\";\n\ninterface StagePendingAttachmentsInput {\n files: ReadonlyArray<DocumentAttachmentUpload>;\n generation: DocumentStoreSyncGeneration;\n pendingAttachments: PendingAttachmentRecord[];\n state: DocumentStoreState;\n}\n\nfunction localAttachmentRecords(\n localId: string,\n pendingAttachments: ReadonlyArray<PendingAttachmentRecord>,\n): LocalAttachmentRecord[] {\n return pendingAttachments.map((pendingAttachment) => ({\n blobId: null,\n byteLength: pendingAttachment.byteLength,\n contentSha256: pendingAttachment.contentSha256,\n detachedAt: null,\n localId,\n mimeType: pendingAttachment.mimeType,\n slotId: pendingAttachment.slotId,\n storageKey: pendingAttachment.storageKey,\n }));\n}\n\nasync function deleteStagedAttachmentBytes(input: {\n pendingAttachments: ReadonlyArray<PendingAttachmentRecord>;\n state: DocumentStoreState;\n}) {\n const { state } = input;\n const cleanupResults = await Promise.allSettled(\n input.pendingAttachments.map((attachment) =>\n state.runtime.infra.blobStore.deleteBytes(attachment.storageKey),\n ),\n );\n const failedCleanupCount = cleanupResults.filter(\n (result) => result.status === \"rejected\",\n ).length;\n if (failedCleanupCount > 0) {\n state.runtime.util.log(\n `Documents: failed to roll back ${failedCleanupCount} staged attachment operation${failedCleanupCount === 1 ? \"\" : \"s\"}.`,\n );\n }\n}\n\n/**\n * Roll back staged bytes that no committed row references. Like orphan\n * reclaim, check every held and pending reference under the key's lock: an\n * overlapping reset can leave a committed key referenced only by an upload.\n */\nexport async function deleteUnreferencedStagedAttachmentBytes(input: {\n generation: DocumentStoreSyncGeneration;\n pendingAttachments: ReadonlyArray<PendingAttachmentRecord>;\n state: DocumentStoreState;\n}): Promise<void> {\n const { execSql } = input.generation;\n const { state } = input;\n let failedCleanupCount = 0;\n for (const { storageKey } of input.pendingAttachments) {\n try {\n await runSerializedDocumentBlobMutation(execSql, storageKey, async () => {\n const referenced = await runSerializedSqlMutation(\n execSql,\n (lockedExecSql) =>\n state.persistence.orphanBlobs.isReferenced(\n lockedExecSql,\n storageKey,\n ),\n );\n if (!referenced)\n await state.runtime.infra.blobStore.deleteBytes(storageKey);\n });\n } catch {\n // A failed probe cannot prove that the atomic mutation rolled back, so\n // the bytes stay; a failed delete leaves them for a later sweep.\n failedCleanupCount += 1;\n }\n }\n if (failedCleanupCount > 0)\n state.runtime.util.log(\n `Documents: failed to roll back ${failedCleanupCount} staged attachment operation${failedCleanupCount === 1 ? \"\" : \"s\"}.`,\n );\n}\n\nasync function writePendingAttachmentBytes(\n input: StagePendingAttachmentsInput,\n): Promise<void> {\n for (const [index, pendingAttachment] of input.pendingAttachments.entries()) {\n const sourceFile = input.files[index];\n if (!sourceFile) continue;\n await input.state.runtime.infra.blobStore.writeByteSource(\n pendingAttachment.storageKey,\n createBlobByteSource(sourceFile.bytes),\n );\n }\n}\n\nexport function installPendingAttachmentRows(input: {\n localAttachments: ReadonlyArray<LocalAttachmentRecord>;\n pendingAttachments: ReadonlyArray<PendingAttachmentRecord>;\n state: DocumentStoreState;\n}): void {\n const { localAttachments, pendingAttachments, state } = input;\n assignLocalAttachmentSlots(state, localAttachments);\n upsertPendingAttachments(state, pendingAttachments);\n if (state.doc) {\n setReadySnapshot(\n state,\n state.doc,\n state.snapshot.syncing,\n state.snapshot.text,\n state.snapshot.structuredFields,\n );\n }\n}\n\nexport async function stagePendingAttachments(\n input: StagePendingAttachmentsInput,\n): Promise<AttachmentStagingRows | null> {\n const { pendingAttachments, state } = input;\n const localAttachments = localAttachmentRecords(\n state.localId,\n pendingAttachments,\n );\n\n try {\n await writePendingAttachmentBytes(input);\n\n if (!isDocumentStoreSyncGenerationCurrent(state, input.generation)) {\n await deleteStagedAttachmentBytes({ pendingAttachments, state });\n return null;\n }\n return { localAttachments, pendingAttachments };\n } catch (error) {\n await deleteStagedAttachmentBytes({ pendingAttachments, state });\n throw error;\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { reportAndRethrowKeyingVerificationError } from "
|
|
2
|
-
import { uploadPreparedDocumentAttachment as uploadDocumentAttachment } from "
|
|
1
|
+
import { reportAndRethrowKeyingVerificationError } from "../../../../data/keyingProjectionVerification/error.js";
|
|
2
|
+
import { uploadPreparedDocumentAttachment as uploadDocumentAttachment } from "../../../../workflows/blobs/upload/index.js";
|
|
3
3
|
export async function uploadAttachmentWithWriterProjectionRetry(input) {
|
|
4
4
|
let remoteSyncBlocked = false;
|
|
5
5
|
let checkedOrganizationId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentUploadAttempt.js","sourceRoot":"","sources":["attachmentUploadAttempt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,qDAAqD,CAAC;AAC9G,OAAO,EAAE,gCAAgC,IAAI,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAGlH,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAAC,KAI/D;IAKC,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAC9B,IAAI,qBAAyC,CAAC;IAC9C,IAAI,sBAES,CAAC;IACd,MA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K,UAAU,2BAA2B,CAAC,KAK1C;IACC,IAAI,CAAC;QACH,OAAO,MAAM,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,uCAAuC,CAC3C,KAAK,EACL,KAAK,CAAC,sBAAsB,EAC5B;YACE,QAAQ,EAAE,KAAK,CAAC,UAAU;YAC1B,UAAU,EAAE,UAAU;YACtB,SAAS,EAAE,4BAA4B;SACxC,CACF,CAAC;QACF,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { reportAndRethrowKeyingVerificationError } from \"../../../../data/keyingProjectionVerification/error\";\nimport { uploadPreparedDocumentAttachment as uploadDocumentAttachment } from \"../../../../workflows/blobs/upload\";\nimport type { DocumentStoreState } from \"../state\";\n\nexport async function uploadAttachmentWithWriterProjectionRetry(input: {\n baseUploadInput: Parameters<typeof uploadDocumentAttachment>[0];\n state: DocumentStoreState;\n writerProjection: DocumentStoreState[\"writerProjection\"];\n}): Promise<{\n error: unknown;\n remoteSyncBlocked: boolean;\n uploaded: Awaited<ReturnType<typeof uploadDocumentAttachment>>;\n}> {\n let remoteSyncBlocked = false;\n let checkedOrganizationId: string | undefined;\n let resolvedMultipartStage:\n | { readonly partSize: number; readonly stageId: string }\n | undefined;\n const onStageResolved = async (stage: {\n readonly partSize: number;\n readonly stageId: string;\n }) => {\n resolvedMultipartStage = stage;\n await input.baseUploadInput.onStageResolved?.(stage);\n };\n const baseUploadInput = {\n ...input.baseUploadInput,\n isRemoteSyncBlocked: (organizationId: string) => {\n checkedOrganizationId = organizationId;\n remoteSyncBlocked =\n input.state.runtime.util.isRemoteSyncBlocked?.(organizationId) ?? false;\n return remoteSyncBlocked;\n },\n onStageResolved,\n };\n let uploadError: unknown;\n let uploadThrew = false;\n let uploaded = await tryUploadDocumentAttachment({\n documentId: input.state.record?.documentId ?? input.state.localId,\n input: {\n ...baseUploadInput,\n writerProjection: input.writerProjection ?? undefined,\n },\n onError: (error) => {\n uploadThrew = true;\n uploadError = error;\n },\n reportSecurityIncident: input.state.runtime.util.reportSecurityIncident,\n });\n if (!uploaded && checkedOrganizationId !== undefined) {\n // The request itself may have produced the first 402 after the workflow's\n // preflight check. Re-read the same verified manifest org so that response\n // is treated as a billing pause even when there was no cached projection\n // available to trigger the retry path below.\n remoteSyncBlocked ||=\n input.state.runtime.util.isRemoteSyncBlocked?.(checkedOrganizationId) ??\n false;\n }\n if (\n !uploaded &&\n input.writerProjection &&\n !remoteSyncBlocked &&\n !uploadThrew\n ) {\n // A stale cached writer projection may have caused an ambiguous null. Retry\n // once with a fresh projection, but do not immediately replay a concrete\n // thrown failure or an expected billing pause.\n input.state.writerProjection = null;\n // Binding can return null after multipart staging succeeded. Carry that\n // resolved stage into the retry so it is resumed instead of orphaned.\n const retryUploadInput = resolvedMultipartStage\n ? {\n ...baseUploadInput,\n multipart: {\n ...(baseUploadInput.multipart ?? {}),\n partSize: resolvedMultipartStage.partSize,\n resumeStageId: resolvedMultipartStage.stageId,\n },\n }\n : baseUploadInput;\n uploaded = await tryUploadDocumentAttachment({\n documentId: input.state.record?.documentId ?? input.state.localId,\n input: retryUploadInput,\n onError: (error) => {\n uploadError = error;\n },\n reportSecurityIncident: input.state.runtime.util.reportSecurityIncident,\n });\n if (!uploaded && checkedOrganizationId !== undefined) {\n remoteSyncBlocked ||=\n input.state.runtime.util.isRemoteSyncBlocked?.(checkedOrganizationId) ??\n false;\n }\n }\n\n if (remoteSyncBlocked) {\n uploadError = undefined;\n }\n return { error: uploadError, remoteSyncBlocked, uploaded };\n}\n\nasync function tryUploadDocumentAttachment(input: {\n documentId: string;\n input: Parameters<typeof uploadDocumentAttachment>[0];\n onError: (error: unknown) => void;\n reportSecurityIncident: DocumentStoreState[\"runtime\"][\"util\"][\"reportSecurityIncident\"];\n}): ReturnType<typeof uploadDocumentAttachment> {\n try {\n return await uploadDocumentAttachment(input.input);\n } catch (error) {\n await reportAndRethrowKeyingVerificationError(\n error,\n input.reportSecurityIncident,\n {\n objectId: input.documentId,\n objectKind: \"document\",\n operation: \"document.attachment.upload\",\n },\n );\n input.onError(error);\n return null;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentUploadLane.js","sourceRoot":"","sources":["attachmentUploadLane.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,yBAAyB,GAE1B,MAAM,4BAA4B,CAAC;AASpC,SAAS,4BAA4B,CAAC,IAA+B;IACnE,OAAO,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC;AACvD,CAAC;AAED,SAAS,gCAAgC,CACvC,iBAA0C;IAE1C,OAAO,iBAAiB,CAAC,IAAI;QAC3B,CAAC,CAAC,GAAG,iBAAiB,CAAC,IAAI,UAAU,iBAAiB,CAAC,MAAM,GAAG;QAChE,CAAC,CAAC,QAAQ,iBAAiB,CAAC,MAAM,EAAE,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,iBAA0C,EAC1C,KAAc;IAEd,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,gCAAgC,gCAAgC,CAAC,iBAAiB,CAAC,GAAG,CACvF,CAAC;IACF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAE5D,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kCAAkC,CAAC,KAIlD;IACC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IACzD,MAAM,OAAO,GAAuC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEtE,MAAM,UAAU,GAAG,GAAmB,EAAE;QACtC,OAAO,CAAC,OAAO,KAAK,yBAAyB,CAC3C,WAAW,EACX,eAAe,MAAM,EAAE,EACvB;YACE,cAAc,EAAE,iBAAiB,CAAC,UAAU;YAC5C,KAAK,EAAE,4BAA4B,CAAC,iBAAiB,CAAC,IAAI,CAAC;SAC5D,CACF,CAAC;QACF,OAAO,OAAO,CAAC,OAAO,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO;QACL,QAAQ;YACN,oEAAoE;YACpE,8DAA8D;YAC9D,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,CAAC,KAAc;YACjB,UAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,aAAa,CAAC,KAAc;YAC1B,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,mBAAmB,CAAC,QAAQ;YAC1B,UAAU,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { DomainScope } from \"../../../../data/shared/domainScope\";\nimport type { MultipartUploadProgressListener } from \"../../../../workflows/blobs\";\nimport type { PendingAttachmentRecord } from \"../../../../workflows/documents\";\nimport {\n beginDomainSyncUploadLane,\n type UploadSyncLane,\n} from \"../../../../workflows/sync\";\n\nexport interface AttachmentUploadLaneReporter {\n complete: () => void;\n fail: (error: unknown) => void;\n failIfStarted: (error: unknown) => void;\n onMultipartProgress: MultipartUploadProgressListener;\n}\n\nfunction getAttachmentUploadLaneLabel(name: string | null | undefined): string {\n return name ? `Upload ${name}` : \"Attachment upload\";\n}\n\nfunction getAttachmentUploadFailureTarget(\n pendingAttachment: PendingAttachmentRecord,\n): string {\n return pendingAttachment.name\n ? `${pendingAttachment.name} (slot ${pendingAttachment.slotId})`\n : `slot ${pendingAttachment.slotId}`;\n}\n\nexport function createAttachmentUploadFailedError(\n pendingAttachment: PendingAttachmentRecord,\n cause: unknown,\n): Error {\n const error = new Error(\n `Attachment upload failed for ${getAttachmentUploadFailureTarget(pendingAttachment)}.`,\n );\n if (cause !== undefined) Reflect.set(error, \"cause\", cause);\n\n return error;\n}\n\n/**\n * Surfaces attachment uploads as observational lanes. The persisted blob id is\n * the lane identity: slot ids repeat across documents, while a retry must keep\n * updating the same row. Lane creation stays lazy until progress, failure, or\n * completion so a billing block before any upload work does not add noise.\n */\nexport function createAttachmentUploadLaneReporter(input: {\n blobId: string;\n domainScope: DomainScope;\n pendingAttachment: PendingAttachmentRecord;\n}): AttachmentUploadLaneReporter {\n const { blobId, domainScope, pendingAttachment } = input;\n const laneRef: { current: UploadSyncLane | null } = { current: null };\n\n const ensureLane = (): UploadSyncLane => {\n laneRef.current ??= beginDomainSyncUploadLane(\n domainScope,\n `blob-upload:${blobId}`,\n {\n blobStorageKey: pendingAttachment.storageKey,\n label: getAttachmentUploadLaneLabel(pendingAttachment.name),\n },\n );\n return laneRef.current;\n };\n\n return {\n complete() {\n // Completion must create/re-begin the lane too: a resumed stage can\n // already be complete before it emits any per-part callbacks.\n ensureLane().complete();\n },\n fail(error: unknown) {\n ensureLane().fail(error);\n },\n failIfStarted(error: unknown) {\n laneRef.current?.fail(error);\n },\n onMultipartProgress(progress) {\n ensureLane().reportProgress(progress);\n },\n };\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createAesGcmIv } from "
|
|
2
|
-
import { base64ToBytes, bytesToBase64 } from "
|
|
3
|
-
import { savePendingAttachmentUpload } from "
|
|
4
|
-
import { isDocumentStoreSyncGenerationCurrent, } from "
|
|
1
|
+
import { createAesGcmIv } from "../../../../internal/crypto/index.js";
|
|
2
|
+
import { base64ToBytes, bytesToBase64 } from "../../../../internal/encoding/index.js";
|
|
3
|
+
import { savePendingAttachmentUpload } from "../attachments/attachmentPersistence.js";
|
|
4
|
+
import { isDocumentStoreSyncGenerationCurrent, } from "../sync/syncGeneration.js";
|
|
5
5
|
function createPendingUploadIdentity(plaintextSha256) {
|
|
6
6
|
// Generated once and persisted before the first upload attempt. The source
|
|
7
7
|
// digest derives an envelope IV from this seed, then each chunk derives its
|