@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
package/stores/container-contents/{groupRewrapOperation.js → operations/groupRewrapOperation.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { prepareContainerStateGroupRewrap } from "../../../workflows/container-contents/container-state/share/index.js";
|
|
2
|
+
import { containerStateHasCurrentGroupGrant } from "../../../workflows/container-contents/container-state/share/groupGrantVerification.js";
|
|
3
3
|
export async function prepareContainerGroupRewrap(state, containerId, groupId, accessLevel, options, isCurrent = () => true) {
|
|
4
4
|
if (state.runtime.infra.dbStatus !== "ready" ||
|
|
5
5
|
!state.snapshot.ready ||
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupRewrapOperation.js","sourceRoot":"","sources":["groupRewrapOperation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAE,MAAM,6DAA6D,CAAC;AAC/G,OAAO,EAAE,kCAAkC,EAAE,MAAM,oFAAoF,CAAC;AAOxI,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,KAAkC,EAClC,WAAmB,EACnB,OAAe,EACf,WAA8C,EAC9C,OAAwD,EACxD,YAAiC,GAAG,EAAE,CAAC,IAAI;IAE3C,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO;QACxC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK;QACrB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe;QACnC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAC3B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7D,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,gCAAgC,CAAC;QACzD,WAAW;QACX,cAAc;QACd,OAAO;QACP,oBAAoB,EAAE,OAAO,EAAE,oBAAoB;QACnD,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;QACxD,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,YAAY,EAAE,SAAS;KACxB,CAAC,CAAC;IACH,OAAO,SAAS,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,KAAkC,EAClC,WAAmB,EACnB,OAAe,EACf,WAA8C,EAC9C,iBAA0C,EAC1C,mBAA2B,EAC3B,sBAA8B,EAC9B,YAAiC,GAAG,EAAE,CAAC,IAAI;IAE3C,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO;QACxC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK;QACrB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe;QACnC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAC3B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,WAAW,KAAK,mBAAmB,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACrE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,kCAAkC,CAAC;QACvD,WAAW;QACX,cAAc;QACd,mBAAmB;QACnB,iBAAiB;QACjB,sBAAsB;QACtB,OAAO;QACP,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;QACxD,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,YAAY,EAAE,SAAS;KACxB,CAAC,CAAC;IACH,OAAO,SAAS,EAAE,IAAI,OAAO,CAAC;AAChC,CAAC","sourcesContent":["import type { ReferencedPrincipalHead } from \"@tearleads/crypto\";\nimport { prepareContainerStateGroupRewrap } from \"../../../workflows/container-contents/container-state/share\";\nimport { containerStateHasCurrentGroupGrant } from \"../../../workflows/container-contents/container-state/share/groupGrantVerification\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport type {\n ContainerContentsShareAccessLevel,\n ContainerContentsStoreState,\n} from \"../types\";\n\nexport async function prepareContainerGroupRewrap(\n state: ContainerContentsStoreState,\n containerId: string,\n groupId: string,\n accessLevel: ContainerContentsShareAccessLevel,\n options?: { requireExistingGrant?: boolean } | undefined,\n isCurrent: ContainerWriteGuard = () => true,\n) {\n if (\n state.runtime.infra.dbStatus !== \"ready\" ||\n !state.snapshot.ready ||\n !state.runtime.auth.isAuthenticated ||\n !state.runtime.state.online\n ) {\n return null;\n }\n const containerState = state.containersById.get(containerId);\n if (!containerState) {\n return null;\n }\n\n const preparation = await prepareContainerStateGroupRewrap({\n accessLevel,\n containerState,\n groupId,\n requireExistingGrant: options?.requireExistingGrant,\n resolveProjectionUserKey: state.resolveProjectionUserKey,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n });\n return isCurrent() ? preparation : null;\n}\n\nexport async function verifyContainerGroupRewrapCurrent(\n state: ContainerContentsStoreState,\n containerId: string,\n groupId: string,\n accessLevel: ContainerContentsShareAccessLevel,\n expectedGroupHead: ReferencedPrincipalHead,\n expectedContainerId: string,\n expectedOrganizationId: string,\n isCurrent: ContainerWriteGuard = () => true,\n): Promise<boolean> {\n if (\n state.runtime.infra.dbStatus !== \"ready\" ||\n !state.snapshot.ready ||\n !state.runtime.auth.isAuthenticated ||\n !state.runtime.state.online\n ) {\n return false;\n }\n if (containerId !== expectedContainerId) {\n return false;\n }\n const containerState = state.containersById.get(expectedContainerId);\n if (!containerState) {\n return false;\n }\n\n const current = await containerStateHasCurrentGroupGrant({\n accessLevel,\n containerState,\n expectedContainerId,\n expectedGroupHead,\n expectedOrganizationId,\n groupId,\n resolveProjectionUserKey: state.resolveProjectionUserKey,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n });\n return isCurrent() && current;\n}\n"]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { createChildContainerState } from "
|
|
2
|
-
import { deleteContainerState } from "
|
|
3
|
-
import { assertLocalChildPathFits, assertLocalMovePathFits, } from "
|
|
4
|
-
import { installContainerMetadataRecord, renameContainerMetadataStateFromRuntime, } from "
|
|
5
|
-
import { createDetachedContainerMetadataState, installDetachedContainerMetadataState, } from "
|
|
6
|
-
import { persistContainerState } from "
|
|
7
|
-
import {
|
|
8
|
-
import { getContainerContentsStoreLogLabel } from "
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { probeExistingSystemContainer } from "
|
|
14
|
-
import { findRootContainerState, findSystemContainerStateForRoot, } from "
|
|
15
|
-
import { finalizeCreatedSystemContainer } from "
|
|
16
|
-
import { hasAdvancedManagedPrincipalReference } from "
|
|
17
|
-
import { isContainerInSubtree, toContainerNode } from "
|
|
1
|
+
import { createChildContainerState } from "../../../workflows/container-contents/container-state/create/createChild.js";
|
|
2
|
+
import { deleteContainerState } from "../../../workflows/container-contents/container-state/delete.js";
|
|
3
|
+
import { assertLocalChildPathFits, assertLocalMovePathFits, } from "../../../workflows/container-contents/container-state/localPathDepth.js";
|
|
4
|
+
import { installContainerMetadataRecord, renameContainerMetadataStateFromRuntime, } from "../../../workflows/container-contents/metadata/index.js";
|
|
5
|
+
import { createDetachedContainerMetadataState, installDetachedContainerMetadataState, } from "../../../workflows/container-contents/metadata/metadataStateIsolation.js";
|
|
6
|
+
import { persistContainerState } from "../containerState/containerStatePersistence.js";
|
|
7
|
+
import { removeMissingContainerState } from "../containerState/missingContainerState.js";
|
|
8
|
+
import { getContainerContentsStoreLogLabel } from "../logLabel.js";
|
|
9
|
+
import { invalidateRemoteContainerWrites, invalidateRemoteSystemContainerWrite, } from "../remoteWrites/remoteWriteGuards.js";
|
|
10
|
+
import { updateContainerContentsSnapshot } from "../state.js";
|
|
11
|
+
import { updateExistingSystemContainer } from "../systemContainers/existingSystemContainer.js";
|
|
12
|
+
import { ensureOrganizationMetadataSystemContainer } from "../systemContainers/organizationMetadataSystemContainer.js";
|
|
13
|
+
import { probeExistingSystemContainer } from "../systemContainers/systemContainerHydration.js";
|
|
14
|
+
import { findRootContainerState, findSystemContainerStateForRoot, } from "../systemContainers/systemContainerLookup.js";
|
|
15
|
+
import { finalizeCreatedSystemContainer } from "../systemContainers/systemContainerPostCreate.js";
|
|
16
|
+
import { hasAdvancedManagedPrincipalReference } from "../systemContainers/systemContainerPromotion.js";
|
|
17
|
+
import { isContainerInSubtree, toContainerNode } from "../utils.js";
|
|
18
18
|
export async function createChildContainer(state, syncAgent, parentId, name, isCurrent = () => true) {
|
|
19
19
|
const trimmedName = name.trim();
|
|
20
20
|
if (state.runtime.infra.dbStatus !== "ready" ||
|
|
@@ -298,4 +298,4 @@ export async function moveContainer(state, syncAgent, containerId, parentId, isC
|
|
|
298
298
|
state.runtime.util.log(`${getContainerContentsStoreLogLabel(state)}: ${action} ${containerId} under ${parentId}`);
|
|
299
299
|
return toContainerNode(existingState);
|
|
300
300
|
}
|
|
301
|
-
//# sourceMappingURL=
|
|
301
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0EAA0E,CAAC;AACrH,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AACpG,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EACL,8BAA8B,EAC9B,uCAAuC,GACxC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EACL,+BAA+B,EAC/B,oCAAoC,GACrC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAK3D,OAAO,EAAE,6BAA6B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,CAAC;IACnE,MAAM,WAAW,GAAG,iBAAiB;QACnC,CAAC,CAAC;YACE,UAAU,EAAE;gBACV,iBAAiB,EAAE,QAAQ;gBAC3B,yBAAyB,EAAE,aAAa,CAAC,SAAS,CAAC,QAAQ;aAC5D;SACF;QACH,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,CAAC;IACtD,MAAM,SAAS,GAAG,MAAM,qBAAqB,CAAC,KAAK,EAAE,aAAa,EAAE;QAClE,KAAK,EAAE,EAAE,QAAQ,EAAE;QACnB,WAAW;QACX,SAAS;KACV,CAAC,CAAC;IACH,IAAI,SAAS,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO,IAAI,CAAC;IAClE,SAAS,CAAC,YAAY,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,iBAAiB;QAC9B,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,iBAAiB,CAAC;IACtB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CACpB,GAAG,iCAAiC,CAAC,KAAK,CAAC,KAAK,MAAM,IAAI,WAAW,UAAU,QAAQ,EAAE,CAC1F,CAAC;IACF,OAAO,eAAe,CAAC,aAAa,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import type { ContainerSystemSlot } from \"@tearleads/validators/containerSystemSlot\";\nimport { createChildContainerState } from \"../../../workflows/container-contents/container-state/create/createChild\";\nimport { deleteContainerState } from \"../../../workflows/container-contents/container-state/delete\";\nimport {\n assertLocalChildPathFits,\n assertLocalMovePathFits,\n} from \"../../../workflows/container-contents/container-state/localPathDepth\";\nimport {\n installContainerMetadataRecord,\n renameContainerMetadataStateFromRuntime,\n} from \"../../../workflows/container-contents/metadata\";\nimport {\n createDetachedContainerMetadataState,\n installDetachedContainerMetadataState,\n} from \"../../../workflows/container-contents/metadata/metadataStateIsolation\";\nimport { persistContainerState } from \"../containerState/containerStatePersistence\";\nimport { removeMissingContainerState } from \"../containerState/missingContainerState\";\nimport { getContainerContentsStoreLogLabel } from \"../logLabel\";\nimport {\n invalidateRemoteContainerWrites,\n invalidateRemoteSystemContainerWrite,\n} from \"../remoteWrites/remoteWriteGuards\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport { updateContainerContentsSnapshot } from \"../state\";\nimport type {\n ContainerContentsStoreSyncAgent,\n ContainerState,\n} from \"../syncAgent\";\nimport { updateExistingSystemContainer } from \"../systemContainers/existingSystemContainer\";\nimport { ensureOrganizationMetadataSystemContainer } from \"../systemContainers/organizationMetadataSystemContainer\";\nimport { probeExistingSystemContainer } from \"../systemContainers/systemContainerHydration\";\nimport {\n findRootContainerState,\n findSystemContainerStateForRoot,\n} from \"../systemContainers/systemContainerLookup\";\nimport { finalizeCreatedSystemContainer } from \"../systemContainers/systemContainerPostCreate\";\nimport { hasAdvancedManagedPrincipalReference } from \"../systemContainers/systemContainerPromotion\";\nimport type {\n ContainerContentsStoreState,\n EnsureSystemContainerOptions,\n} from \"../types\";\nimport { isContainerInSubtree, toContainerNode } from \"../utils\";\n\nexport async function createChildContainer(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n parentId: string,\n name: string,\n isCurrent: ContainerWriteGuard = () => true,\n) {\n const trimmedName = name.trim();\n if (\n state.runtime.infra.dbStatus !== \"ready\" ||\n !state.snapshot.ready ||\n !trimmedName\n ) {\n return null;\n }\n\n const parentState = state.containersById.get(parentId);\n if (!parentState) {\n return null;\n }\n assertLocalChildPathFits(state.containersById, parentId);\n\n const created = await createChildContainerState({\n createRemote: false,\n name: trimmedName,\n parentState,\n persistence: state.persistence,\n resolveProjectionUserKey: state.resolveProjectionUserKey,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n });\n if (!created || !isCurrent()) return null;\n\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 `${getContainerContentsStoreLogLabel(state)}: created container \"${trimmedName}\"`,\n );\n return toContainerNode(created.containerState);\n}\n\nfunction canEnsureSystemContainer(\n state: ContainerContentsStoreState,\n name: string,\n): boolean {\n return (\n state.runtime.infra.dbStatus === \"ready\" && state.snapshot.ready && !!name\n );\n}\n\nasync function findOrHydrateSystemContainer(input: {\n isCurrent: ContainerWriteGuard;\n state: ContainerContentsStoreState;\n syncAgent: ContainerContentsStoreSyncAgent;\n systemSlot: ContainerSystemSlot;\n}): Promise<ContainerState | null> {\n const { isCurrent, state, syncAgent, systemSlot } = input;\n const existing = findSystemContainerStateForRoot(\n state,\n systemSlot,\n findRootContainerState(state),\n );\n if (\n existing ||\n !state.runtime.auth.isAuthenticated ||\n !state.runtime.state.online\n ) {\n return existing;\n }\n await probeExistingSystemContainer({\n logLabel: getContainerContentsStoreLogLabel(state),\n rootState: findRootContainerState(state),\n state,\n syncAgent,\n systemSlot,\n });\n return isCurrent()\n ? findSystemContainerStateForRoot(\n state,\n systemSlot,\n findRootContainerState(state),\n )\n : null;\n}\n\nfunction canCreateSystemContainer(\n state: ContainerContentsStoreState,\n rootState: ContainerState,\n systemSlot: ContainerSystemSlot,\n options: EnsureSystemContainerOptions,\n): boolean {\n if (\n options.skipAdvancedManagedRoot &&\n hasAdvancedManagedPrincipalReference(rootState)\n ) {\n state.runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: skipped background system container \"${systemSlot}\" because the root has advanced managed-principal references`,\n );\n return false;\n }\n\n return true;\n}\n\nexport async function ensureSystemContainer(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n systemSlot: ContainerSystemSlot,\n name: string,\n options: EnsureSystemContainerOptions = {},\n isCurrent: ContainerWriteGuard = () => true,\n) {\n const trimmedName = name.trim();\n if (!canEnsureSystemContainer(state, trimmedName)) {\n return null;\n }\n\n const metadata = await ensureOrganizationMetadataSystemContainer({\n state,\n syncAgent,\n systemSlot,\n options,\n isCurrent,\n });\n if (!isCurrent()) return null;\n if (metadata.handled) return metadata.container;\n\n return ensureChildSystemContainer(\n state,\n syncAgent,\n systemSlot,\n trimmedName,\n options,\n isCurrent,\n );\n}\n\nasync function ensureChildSystemContainer(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n systemSlot: ContainerSystemSlot,\n trimmedName: string,\n options: EnsureSystemContainerOptions,\n isCurrent: ContainerWriteGuard,\n) {\n const allowSynchronousRemoteBootstrap = !options.deferRemoteBootstrap;\n const existing = allowSynchronousRemoteBootstrap\n ? await findOrHydrateSystemContainer({\n isCurrent,\n state,\n syncAgent,\n systemSlot,\n })\n : findSystemContainerStateForRoot(\n state,\n systemSlot,\n findRootContainerState(state),\n );\n if (!isCurrent()) return null;\n if (existing) {\n return updateExistingSystemContainer(\n state,\n syncAgent,\n existing,\n options,\n isCurrent,\n );\n }\n\n const rootState = findRootContainerState(state);\n if (!rootState) {\n return null;\n }\n if (!canCreateSystemContainer(state, rootState, systemSlot, options))\n return null;\n\n if (options.deferRemoteBootstrap) {\n invalidateRemoteSystemContainerWrite(\n state,\n rootState.container.id,\n systemSlot,\n );\n invalidateRemoteContainerWrites(state, [rootState.container.id]);\n }\n const createRemote =\n allowSynchronousRemoteBootstrap &&\n state.runtime.auth.isAuthenticated &&\n Boolean(state.runtime.crypto.encapsulationKeyPair);\n const created = await createChildContainerState({\n systemSlot,\n createRemote,\n icon: options.icon,\n name: trimmedName,\n parentState: rootState,\n persistence: state.persistence,\n queueRemoteSync: !options.deferRemoteSync,\n resolveProjectionUserKey: state.resolveProjectionUserKey,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n });\n if (!created || !isCurrent()) {\n if (createRemote && !isCurrent()) {\n state.containerParentIdsNeedingHydration.add(rootState.container.id);\n syncAgent.scheduleRemoteHydration();\n }\n return null;\n }\n\n const finalized = await finalizeCreatedSystemContainer({\n created,\n logLabel: getContainerContentsStoreLogLabel(state),\n state,\n syncAgent,\n systemSlot,\n isCurrent,\n });\n if (!finalized || !isCurrent()) return null;\n if (finalized.adopted) {\n const updated = await updateExistingSystemContainer(\n state,\n syncAgent,\n finalized.containerState,\n options,\n isCurrent,\n );\n if (!updated) return null;\n }\n return toContainerNode(finalized.containerState);\n}\n\nexport async function deleteContainer(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n containerId: string,\n isCurrent: ContainerWriteGuard = () => true,\n) {\n if (state.runtime.infra.dbStatus !== \"ready\" || !state.snapshot.ready) {\n return null;\n }\n\n const existingState = state.containersById.get(containerId);\n if (\n !existingState ||\n existingState.container.parentId === null ||\n (existingState.container.systemSlot ?? null) !== null ||\n Array.from(state.containersById.values()).some(\n (containerState) => containerState.container.parentId === containerId,\n )\n ) {\n return null;\n }\n\n const isRemoteContainer = Boolean(existingState.record.documentId);\n if (isRemoteContainer) {\n if (!state.runtime.auth.isAuthenticated || !state.runtime.state.online) {\n return null;\n }\n }\n\n const deletedNode = toContainerNode(existingState);\n const deleted = await deleteContainerState({\n containerState: existingState,\n persistence: state.persistence,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n });\n if (deleted === \"remote-failed\") {\n return null;\n }\n if (\n deleted === \"local-conflict\" ||\n deleted === \"remote-deleted\" ||\n !isCurrent()\n ) {\n state.localContainersNeedRefresh = true;\n await syncAgent.refreshLocalContainers();\n // The delete committed before this operation lost its generation. Evict\n // only the exact state it deleted: a concurrent replacement with the same\n // id owns a different object and must survive.\n if (\n deleted === \"deleted\" &&\n state.containersById.get(existingState.container.id) === existingState\n ) {\n state.containersById.delete(existingState.container.id);\n state.documentStoresNeedPriming = true;\n if (state.initialized) {\n updateContainerContentsSnapshot(state);\n }\n }\n if (isRemoteContainer) {\n await syncAgent.requestRemoteHydration({\n followDiscoveredParentLanes: false,\n parentIds: [existingState.container.parentId],\n resetAllLaneWatermarks: true,\n });\n }\n return null;\n }\n\n state.containersById.delete(existingState.container.id);\n // The persistence cascade may have orphaned descendant documents (row 3);\n // re-arm document priming and nudge the lane so their null-scoped passes\n // run now rather than on the next unrelated trigger.\n state.documentStoresNeedPriming = true;\n syncAgent.scheduleSync();\n updateContainerContentsSnapshot(state);\n state.runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: deleted container \"${existingState.container.name}\"`,\n );\n return deletedNode;\n}\n\nexport async function renameContainer(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n containerId: string,\n name: string,\n isCurrent: ContainerWriteGuard = () => true,\n) {\n const trimmedName = name.trim();\n if (\n state.runtime.infra.dbStatus !== \"ready\" ||\n !state.snapshot.ready ||\n !trimmedName\n ) {\n return null;\n }\n\n const existingState = state.containersById.get(containerId);\n if (!existingState) {\n return null;\n }\n\n if (existingState.container.name === trimmedName) {\n return toContainerNode(existingState);\n }\n\n const detachedState =\n await createDetachedContainerMetadataState(existingState);\n if (!isCurrent()) return null;\n const renamed = await renameContainerMetadataStateFromRuntime({\n metadataState: detachedState,\n name: trimmedName,\n persistence: state.persistence,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n });\n if (!isCurrent()) return null;\n if (!renamed) {\n removeMissingContainerState(state, existingState);\n return null;\n }\n\n detachedState.container = renamed.container;\n installContainerMetadataRecord(detachedState, renamed.record);\n installDetachedContainerMetadataState(existingState, detachedState);\n updateContainerContentsSnapshot(state);\n syncAgent.scheduleSync();\n state.runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: renamed container to \"${trimmedName}\"`,\n );\n return toContainerNode(existingState);\n}\n\nexport async function moveContainer(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n containerId: string,\n parentId: string,\n isCurrent: ContainerWriteGuard = () => true,\n) {\n if (state.runtime.infra.dbStatus !== \"ready\" || !state.snapshot.ready) {\n return null;\n }\n\n const existingState = state.containersById.get(containerId);\n const targetParentState = state.containersById.get(parentId);\n if (\n !existingState ||\n !targetParentState ||\n existingState.container.parentId === null ||\n (existingState.container.systemSlot ?? null) !== null ||\n isContainerInSubtree(state.containersById, parentId, containerId)\n ) {\n return null;\n }\n\n if (existingState.container.parentId === parentId) {\n return toContainerNode(existingState);\n }\n assertLocalMovePathFits(state.containersById, containerId, parentId);\n\n const isRemoteContainer = Boolean(existingState.record.documentId);\n const saveOptions = isRemoteContainer\n ? {\n moveIntent: {\n parentContainerId: parentId,\n previousParentContainerId: existingState.container.parentId,\n },\n }\n : { createIntent: { parentContainerId: parentId } };\n const persisted = await persistContainerState(state, existingState, {\n patch: { parentId },\n saveOptions,\n isCurrent,\n });\n if (persisted.status !== \"persisted\" || !isCurrent()) return null;\n syncAgent.scheduleSync();\n const action = isRemoteContainer\n ? \"queued container move\"\n : \"moved container\";\n state.runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: ${action} ${containerId} under ${parentId}`,\n );\n return toContainerNode(existingState);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purgeContainerOperation.js","sourceRoot":"","sources":["purgeContainerOperation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,oEAAoE;AACpE,iFAAiF;AACjF,6EAA6E;AAC7E,+EAA+E;AAC/E,6EAA6E;AAC7E,gFAAgF;AAChF,4CAA4C;AAC5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,KAAkC,EAClC,SAA0C,EAC1C,WAAmB,EACnB,OAAsB,EACtB,YAAiC,GAAG,EAAE,CAAC,IAAI;IAE3C,OAAO,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE;QAC1E,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CACjC,qBAAqB,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,MAAM,CAAC,kBAAkB,CAAC,MAAM,0BAA0B,MAAM,CAAC,WAAW,UAAU;QACxI,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,WAAW,CAAC;QACvE,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CACzB,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI;YAClC,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,IAAI;KACjD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { PurgeOptions } from \"../../../workflows/container-contents/container-state/purge/purgeProgress\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport type { ContainerContentsStoreSyncAgent } from \"../syncAgent\";\nimport type { ContainerContentsStoreState } from \"../types\";\nimport { runContainerPurge } from \"./containerPurgeCore\";\n\n// Permanently destroy a container and everything beneath it. Unlike\n// deleteContainer (a leaf-only hard delete), this cascades: documents whose last\n// link is inside the subtree are purged, multi-folder documents are unlinked\n// from the subtree only, and descendant containers are deleted leaf-first. The\n// caller (the trash \"Delete Forever\" action) restricts this to folders under\n// trash; here we keep the same structural guards deleteContainer uses — never a\n// root and never a system container itself.\nexport async function purgeContainer(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n containerId: string,\n options?: PurgeOptions,\n isCurrent: ContainerWriteGuard = () => true,\n): Promise<boolean> {\n return runContainerPurge(state, syncAgent, containerId, options, isCurrent, {\n describeResult: (target, result) =>\n `purged container \"${target.container.name}\" (${result.purgedContainerIds.length} container(s) removed, ${result.failedCount} failed)`,\n didSucceed: (result) => result.purgedContainerIds.includes(containerId),\n validateTarget: (target) =>\n target.container.parentId !== null &&\n (target.container.systemSlot ?? null) === null,\n });\n}\n"]}
|
package/stores/container-contents/{reportShareFailure.js → operations/reportShareFailure.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isKeyingVerificationError } from "
|
|
2
|
-
import { isProjectionVerificationCancelledError } from "
|
|
3
|
-
import { isDatabaseUnavailableError } from "
|
|
4
|
-
import { getContainerContentsStoreLogLabel } from "
|
|
1
|
+
import { isKeyingVerificationError } from "../../../data/keyingProjectionVerification/error.js";
|
|
2
|
+
import { isProjectionVerificationCancelledError } from "../../../workflows/containers/index.js";
|
|
3
|
+
import { isDatabaseUnavailableError } from "../../../workflows/documents/index.js";
|
|
4
|
+
import { getContainerContentsStoreLogLabel } from "../logLabel.js";
|
|
5
5
|
// Both host callbacks are declared `=> void` but may be async (see
|
|
6
6
|
// Tearleads.logError), and this runs from a catch that rethrows to the caller,
|
|
7
7
|
// where a throwing logger would replace the share failure with its own.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reportShareFailure.js","sourceRoot":"","sources":["reportShareFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAE,sCAAsC,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAGhE,mEAAmE;AACnE,+EAA+E;AAC/E,wEAAwE;AACxE,SAAS,cAAc,CAAC,IAAmB;IACzC,IAAI,CAAC;QACH,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;IAChE,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAkC,EAClC,SAAiB,EACjB,KAAc;IAEd,MAAM,OAAO,GAAG,GAAG,iCAAiC,CAAC,KAAK,CAAC,KAAK,SAAS,SAAS,CAAC;IACnF,uEAAuE;IACvE,6EAA6E;IAC7E,2EAA2E;IAC3E,2EAA2E;IAC3E,0EAA0E;IAC1E,oCAAoC;IACpC,IACE,0BAA0B,CAAC,KAAK,CAAC;QACjC,sCAAsC,CAAC,KAAK,CAAC;QAC7C,yBAAyB,CAAC,KAAK,CAAC,EAChC,CAAC;QACD,cAAc,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;IACxC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,cAAc,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IAED,cAAc,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import { isKeyingVerificationError } from \"../../../data/keyingProjectionVerification/error\";\nimport { isProjectionVerificationCancelledError } from \"../../../workflows/containers\";\nimport { isDatabaseUnavailableError } from \"../../../workflows/documents\";\nimport { getContainerContentsStoreLogLabel } from \"../logLabel\";\nimport type { ContainerContentsStoreState } from \"../types\";\n\n// Both host callbacks are declared `=> void` but may be async (see\n// Tearleads.logError), and this runs from a catch that rethrows to the caller,\n// where a throwing logger would replace the share failure with its own.\nfunction dispatchToHost(call: () => unknown): void {\n try {\n void Promise.resolve(call()).catch(() => undefined);\n } catch {\n // Hosts may throw synchronously or return a rejected promise.\n }\n}\n\n/**\n * Report a thrown container share through the host's diagnostics before the\n * failure propagates to the UI. The app can only show a generic label, so this\n * is the one place the actual failure — a persistence error or an invariant\n * throw — is observable off the device.\n * Purely observational: the error is always rethrown by the caller unchanged.\n */\nexport function reportContainerShareFailure(\n state: ContainerContentsStoreState,\n operation: string,\n error: unknown,\n): void {\n const message = `${getContainerContentsStoreLogLabel(state)}: ${operation} failed`;\n // Not an app failure, so it stays local: the runtime is released under\n // in-flight callers on every identity switch and host-driven database retry,\n // a projection verification cancelled by a newer generation re-runs on its\n // own, and a keying verification refusal (a rollback or a relabeled group,\n // which a duplicate grant can race into) belongs to the security-incident\n // path rather than app diagnostics.\n if (\n isDatabaseUnavailableError(error) ||\n isProjectionVerificationCancelledError(error) ||\n isKeyingVerificationError(error)\n ) {\n dispatchToHost(() => state.runtime.util.log(message));\n return;\n }\n\n const { logError } = state.runtime.util;\n if (!logError) {\n dispatchToHost(() => state.runtime.util.log(message));\n return;\n }\n\n dispatchToHost(() => logError(message, error));\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { installContainerMetadataRecord, setContainerIconMetadataStateFromRuntime, } from "
|
|
2
|
-
import { createDetachedContainerMetadataState, installDetachedContainerMetadataState, } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { updateContainerContentsSnapshot } from "
|
|
6
|
-
import { toContainerNode } from "
|
|
1
|
+
import { installContainerMetadataRecord, setContainerIconMetadataStateFromRuntime, } from "../../../workflows/container-contents/metadata/index.js";
|
|
2
|
+
import { createDetachedContainerMetadataState, installDetachedContainerMetadataState, } from "../../../workflows/container-contents/metadata/metadataStateIsolation.js";
|
|
3
|
+
import { removeMissingContainerState } from "../containerState/missingContainerState.js";
|
|
4
|
+
import { getContainerContentsStoreLogLabel } from "../logLabel.js";
|
|
5
|
+
import { updateContainerContentsSnapshot } from "../state.js";
|
|
6
|
+
import { toContainerNode } from "../utils.js";
|
|
7
7
|
// Set the icon shown for a container. Mirrors renameContainer's write path: it
|
|
8
8
|
// writes the icon into the container metadata document (CRDT), enqueues the
|
|
9
9
|
// incremental update, persists, and schedules a sync. A null icon clears the
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setContainerIconOperation.js","sourceRoot":"","sources":["setContainerIconOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,wCAAwC,GACzC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,oCAAoC,EACpC,qCAAqC,GACtC,MAAM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,EAAE,SAAS;KACxB,CAAC,CAAC;IACH,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO,IAAI,CAAC;IAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,2BAA2B,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAC5C,8BAA8B,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9D,qCAAqC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IACpE,+BAA+B,CAAC,KAAK,CAAC,CAAC;IACvC,SAAS,CAAC,YAAY,EAAE,CAAC;IACzB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CACpB,GAAG,iCAAiC,CAAC,KAAK,CAAC,mBAAmB,WAAW,aAAa,cAAc,IAAI,QAAQ,GAAG,CACpH,CAAC;IACF,OAAO,eAAe,CAAC,aAAa,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import {\n installContainerMetadataRecord,\n setContainerIconMetadataStateFromRuntime,\n} from \"../../../workflows/container-contents/metadata\";\nimport {\n createDetachedContainerMetadataState,\n installDetachedContainerMetadataState,\n} from \"../../../workflows/container-contents/metadata/metadataStateIsolation\";\nimport { removeMissingContainerState } from \"../containerState/missingContainerState\";\nimport { getContainerContentsStoreLogLabel } from \"../logLabel\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport { updateContainerContentsSnapshot } from \"../state\";\nimport type { ContainerContentsStoreSyncAgent } from \"../syncAgent\";\nimport type { ContainerContentsStoreState } from \"../types\";\nimport { toContainerNode } from \"../utils\";\n\n// Set the icon shown for a container. Mirrors renameContainer's write path: it\n// writes the icon into the container metadata document (CRDT), enqueues the\n// incremental update, persists, and schedules a sync. A null icon clears the\n// custom icon back to the default folder. No-ops when the icon is unchanged.\nexport async function setContainerIcon(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n containerId: string,\n icon: string | null,\n isCurrent: ContainerWriteGuard = () => true,\n) {\n if (state.runtime.infra.dbStatus !== \"ready\" || !state.snapshot.ready) {\n return null;\n }\n\n const existingState = state.containersById.get(containerId);\n if (!existingState) {\n return null;\n }\n\n const normalizedIcon = icon?.trim() || null;\n if ((existingState.container.icon ?? null) === normalizedIcon) {\n return toContainerNode(existingState);\n }\n\n const detachedState =\n await createDetachedContainerMetadataState(existingState);\n if (!isCurrent()) return null;\n const updated = await setContainerIconMetadataStateFromRuntime({\n icon: normalizedIcon,\n metadataState: detachedState,\n persistence: state.persistence,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n });\n if (!isCurrent()) return null;\n if (!updated) {\n removeMissingContainerState(state, existingState);\n return null;\n }\n\n detachedState.container = updated.container;\n installContainerMetadataRecord(detachedState, updated.record);\n installDetachedContainerMetadataState(existingState, detachedState);\n updateContainerContentsSnapshot(state);\n syncAgent.scheduleSync();\n state.runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: set container ${containerId} icon to \"${normalizedIcon ?? \"folder\"}\"`,\n );\n return toContainerNode(existingState);\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { runWithSecurityIncidentReporting } from "
|
|
2
|
-
import { shareContainerState, shareContainerStateWithGroup, } from "
|
|
3
|
-
import { installContainerMetadataRecord } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { runWithSecurityIncidentReporting } from "../../../data/keyingProjectionVerification/error.js";
|
|
2
|
+
import { shareContainerState, shareContainerStateWithGroup, } from "../../../workflows/container-contents/container-state/share/index.js";
|
|
3
|
+
import { installContainerMetadataRecord } from "../../../workflows/container-contents/metadata/index.js";
|
|
4
|
+
import { removeMissingContainerState } from "../containerState/missingContainerState.js";
|
|
5
|
+
import { getContainerContentsStoreLogLabel } from "../logLabel.js";
|
|
6
|
+
import { updateContainerContentsSnapshot } from "../state.js";
|
|
6
7
|
import { reportContainerShareFailure } from "./reportShareFailure.js";
|
|
7
|
-
import { updateContainerContentsSnapshot } from "./state.js";
|
|
8
8
|
export async function shareContainerUsing(state, syncAgent, containerId, share, logMessage, isCurrent = () => true) {
|
|
9
9
|
if (state.runtime.infra.dbStatus !== "ready" ||
|
|
10
10
|
!state.snapshot.ready ||
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shareOperations.js","sourceRoot":"","sources":["shareOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EACL,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,6DAA6D,CAAC;AAErE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAS3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEnE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAAkC,EAClC,SAA0C,EAC1C,WAAmB,EACnB,KAE+C,EAC/C,UAAkB,EAClB,YAAiC,GAAG,EAAE,CAAC,IAAI;IAE3C,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO;QACxC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK;QACrB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe;QACnC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM;QAC3B,CAAC,SAAS,EAAE,EACZ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC5D,MAAM,uBAAuB,GAAG,aAAa,EA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AsB,EACzC;QACE,QAAQ,EAAE,WAAW;QACrB,UAAU,EAAE,WAAW;QACvB,SAAS,EAAE,uBAAuB;QAClC,cAAc,EAAE,cAAc,CAAC,SAAS,CAAC,cAAc;KACxD,EACD,GAAG,EAAE,CACH,4BAA4B,CAAC;QAC3B,WAAW;QACX,cAAc;QACd,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,gBAAgB,EAAE,OAAO;QACzB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,wBAAwB,EAAE,KAAK,CAAC,wBAAwB;QACxD,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,YAAY,EAAE,SAAS;KACxB,CAAC,CACL,EACH,oBAAoB,WAAW,eAAe,OAAO,EAAE,EACvD,SAAS,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { runWithSecurityIncidentReporting } from \"../../../data/keyingProjectionVerification/error\";\nimport {\n shareContainerState,\n shareContainerStateWithGroup,\n} from \"../../../workflows/container-contents/container-state/share\";\nimport type { SharedContainerStateResult } from \"../../../workflows/container-contents/container-state/types\";\nimport { installContainerMetadataRecord } from \"../../../workflows/container-contents/metadata\";\nimport { removeMissingContainerState } from \"../containerState/missingContainerState\";\nimport { getContainerContentsStoreLogLabel } from \"../logLabel\";\nimport type { ContainerWriteGuard } from \"../remoteWrites/writeGeneration\";\nimport { updateContainerContentsSnapshot } from \"../state\";\nimport type {\n ContainerContentsStoreSyncAgent,\n ContainerState,\n} from \"../syncAgent\";\nimport type {\n ContainerContentsShareAccessLevel,\n ContainerContentsStoreState,\n} from \"../types\";\nimport { reportContainerShareFailure } from \"./reportShareFailure\";\n\nexport async function shareContainerUsing(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n containerId: string,\n share: (\n containerState: ContainerState,\n ) => Promise<SharedContainerStateResult | null>,\n logMessage: string,\n isCurrent: ContainerWriteGuard = () => true,\n) {\n if (\n state.runtime.infra.dbStatus !== \"ready\" ||\n !state.snapshot.ready ||\n !state.runtime.auth.isAuthenticated ||\n !state.runtime.state.online ||\n !isCurrent()\n ) {\n return false;\n }\n\n const existingState = state.containersById.get(containerId);\n const expectedAccessStateHash = existingState?.record.accessStateHash;\n if (\n !existingState?.record.documentId ||\n typeof expectedAccessStateHash !== \"string\" ||\n expectedAccessStateHash.length === 0\n ) {\n return false;\n }\n\n let shared: SharedContainerStateResult | null;\n try {\n shared = await share(existingState);\n } catch (error) {\n reportContainerShareFailure(state, \"share\", error);\n throw error;\n }\n if (!shared || !isCurrent() || shared.status === \"confirmed\") {\n if (!isCurrent() || shared?.status === \"confirmed\") {\n state.localContainersNeedRefresh = true;\n state.containerParentIdsNeedingHydration.add(\n existingState.container.parentId,\n );\n void syncAgent.refreshLocalContainers();\n syncAgent.scheduleRemoteHydration();\n }\n return shared?.status === \"confirmed\" || shared?.status === \"persisted\";\n }\n if (shared.status === \"missing\") {\n removeMissingContainerState(state, existingState);\n return false;\n }\n\n existingState.container = shared.container;\n installContainerMetadataRecord(existingState, shared.record);\n updateContainerContentsSnapshot(state);\n if (shared.status === \"identity-superseded\") return false;\n\n await syncAgent.primeDocumentsForSharedSubtree(containerId, isCurrent);\n if (!isCurrent()) return true;\n syncAgent.scheduleSync();\n state.runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: ${logMessage}`,\n );\n return true;\n}\n\nexport async function shareContainerWithUser(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n containerId: string,\n userId: string,\n isCurrent: ContainerWriteGuard = () => true,\n) {\n return shareContainerUsing(\n state,\n syncAgent,\n containerId,\n (containerState) =>\n shareContainerState({\n accessLevel: \"write\",\n containerState,\n persistence: state.persistence,\n recipientUserId: userId,\n resolveProjectionUserKey: state.resolveProjectionUserKey,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n }),\n `shared container ${containerId} with ${userId}`,\n isCurrent,\n );\n}\n\nexport async function shareContainerWithGroup(\n state: ContainerContentsStoreState,\n syncAgent: ContainerContentsStoreSyncAgent,\n containerId: string,\n groupId: string,\n accessLevel: ContainerContentsShareAccessLevel,\n options: {\n expectedGroupName?: string | undefined;\n knownContainerKeks?: ReadonlyMap<string, Uint8Array> | undefined;\n requireExistingGrant?: boolean | undefined;\n } = {},\n isCurrent: ContainerWriteGuard = () => true,\n) {\n return shareContainerUsing(\n state,\n syncAgent,\n containerId,\n (containerState) =>\n // A group share is where a relabeled directory row would misdirect a\n // key wrap, so its verification failures (the signed-name mismatch\n // above all) are recorded as security incidents, not just surfaced.\n runWithSecurityIncidentReporting(\n state.runtime.util.reportSecurityIncident,\n {\n objectId: containerId,\n objectKind: \"container\",\n operation: \"container.share.group\",\n organizationId: containerState.container.organizationId,\n },\n () =>\n shareContainerStateWithGroup({\n accessLevel,\n containerState,\n expectedGroupName: options.expectedGroupName,\n knownContainerKeks: options.knownContainerKeks,\n persistence: state.persistence,\n recipientGroupId: groupId,\n requireExistingGrant: options.requireExistingGrant,\n resolveProjectionUserKey: state.resolveProjectionUserKey,\n runtime: state.runtime,\n stillCurrent: isCurrent,\n }),\n ),\n `shared container ${containerId} with group ${groupId}`,\n isCurrent,\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteBackedContainerState.js","sourceRoot":"","sources":["remoteBackedContainerState.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,4BAA4B,CAC1C,cAA8B;IAE9B,OAAO,CACL,OAAO,cAAc,CAAC,SAAS,CAAC,kBAAkB,KAAK,QAAQ;QAC/D,cAAc,CAAC,SAAS,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC;QACtD,OAAO,cAAc,CAAC,MAAM,CAAC,UAAU,KAAK,QAAQ;QACpD,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;QAC3C,OAAO,cAAc,CAAC,MAAM,CAAC,eAAe,KAAK,QAAQ;QACzD,cAAc,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CACjD,CAAC;AACJ,CAAC","sourcesContent":["import type { ContainerState } from \"../../../workflows/container-contents/remoteHydration\";\n\nexport function isRemoteBackedContainerState(\n containerState: ContainerState,\n): boolean {\n return (\n typeof containerState.container.metadataDocumentId === \"string\" &&\n containerState.container.metadataDocumentId.length > 0 &&\n typeof containerState.record.documentId === \"string\" &&\n containerState.record.documentId.length > 0 &&\n typeof containerState.record.accessStateHash === \"string\" &&\n containerState.record.accessStateHash.length > 0\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { errorMessage } from "
|
|
2
|
-
import { createRemoteContainerIngestor, } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { errorMessage } from "../../../data/shared/errorMessage.js";
|
|
2
|
+
import { createRemoteContainerIngestor, } from "../../../workflows/container-contents/remoteHydration/index.js";
|
|
3
|
+
import { resumeContainerContentsRecoveryHydration } from "../hydration/remoteHydrationRequest.js";
|
|
4
|
+
import { getContainerContentsStoreLogLabel } from "../logLabel.js";
|
|
5
5
|
export async function resumeRemoteContainerRecoveryWork(input) {
|
|
6
6
|
try {
|
|
7
7
|
await input.resumeIngestion();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteContainerIngestion.js","sourceRoot":"","sources":["remoteContainerIngestion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EACL,6BAA6B,GAG9B,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,wCAAwC,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAQhE,MAAM,CAAC,KAAK,UAAU,iCAAiC,CAAC,KAKvD;IACC,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,eAAe,EAAE,CAAC;IAChC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CAAC,IAAI,CAAC,GAAG,CACpB,GAAG,iCAAiC,CAAC,KAAK,CAAC,wCAAwC,YAAY,CAAC,KAAK,CAAC,EAAE,CACzG,CAAC;YACJ,CAAC;YACD,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC1B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CACpB,GAAG,iCAAiC,CAAC,KAAK,CAAC,kDAAkD,YAAY,CAAC,KAAK,CAAC,EAAE,CACnH,CAAC;YACJ,CAAC;YACD,eAAe,EAAE,KAAK,IAAI,EAAE;gBAC1B,MAAM,wCAAwC,CAAC,KAAK,CAAC,CAAC;YACxD,CAAC;YACD,eAAe;SAChB,CAAC;KACL,CAAC;AACJ,CAAC","sourcesContent":["import { errorMessage } from \"../../../data/shared/errorMessage\";\nimport {\n createRemoteContainerIngestor,\n type RemoteContainer,\n type RemoteContainerHydrationHost,\n} from \"../../../workflows/container-contents/remoteHydration\";\nimport { resumeContainerContentsRecoveryHydration } from \"../hydration/remoteHydrationRequest\";\nimport { getContainerContentsStoreLogLabel } from \"../logLabel\";\nimport type { ContainerContentsStoreSyncState } from \"../syncAgent/syncAgentTypes\";\n\ninterface RemoteContainerIngestionController {\n ingest: (remoteContainer: RemoteContainer) => Promise<void>;\n resumeInterruptedWork: () => Promise<void>;\n}\n\nexport async function resumeRemoteContainerRecoveryWork(input: {\n onIngestionError: (error: unknown) => void;\n onHydrationError: (error: unknown) => void;\n resumeHydration: () => Promise<void>;\n resumeIngestion: () => Promise<void>;\n}): Promise<void> {\n try {\n await input.resumeIngestion();\n } catch (error) {\n input.onIngestionError(error);\n return;\n }\n try {\n await input.resumeHydration();\n } catch (error) {\n input.onHydrationError(error);\n }\n}\n\nexport function createRemoteContainerIngestionController(input: {\n host: RemoteContainerHydrationHost;\n scheduleSync: () => void;\n state: ContainerContentsStoreSyncState;\n}): RemoteContainerIngestionController {\n const { host, scheduleSync, state } = input;\n const remoteContainerIngestor = createRemoteContainerIngestor({\n getSerializationBarrier: () => state.initializePromise,\n host,\n state,\n });\n const scheduleAfterIngestion = () => {\n if (\n state.runtime.infra.dbStatus === \"ready\" &&\n state.documentStoresNeedPriming\n ) {\n scheduleSync();\n }\n };\n const resumeIngestion = async () => {\n const hadPendingIngestion = remoteContainerIngestor.hasPending();\n await remoteContainerIngestor.resume();\n if (hadPendingIngestion) {\n scheduleAfterIngestion();\n }\n };\n\n return {\n ingest: async (remoteContainer) => {\n await remoteContainerIngestor(remoteContainer);\n scheduleAfterIngestion();\n },\n resumeInterruptedWork: () =>\n resumeRemoteContainerRecoveryWork({\n onHydrationError: (error) => {\n state.runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: failed to resume remote hydration: ${errorMessage(error)}`,\n );\n },\n onIngestionError: (error) => {\n state.runtime.util.log(\n `${getContainerContentsStoreLogLabel(state)}: failed to resume remote container ingestion: ${errorMessage(error)}`,\n );\n },\n resumeHydration: async () => {\n await resumeContainerContentsRecoveryHydration(state);\n },\n resumeIngestion,\n }),\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { invalidateContainerProjections } from "
|
|
1
|
+
import { invalidateContainerProjections } from "../../../workflows/container-contents/container-state/projectionCache.js";
|
|
2
2
|
/**
|
|
3
3
|
* Drop every cached writer projection a hint invalidates, before hydration
|
|
4
4
|
* lands, so the next share or move fetches a fresh one instead of submitting
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteEventProjectionInvalidation.js","sourceRoot":"","sources":["remoteEventProjectionInvalidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,uEAAuE,CAAC;AAGvH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAA0E,EAC1E,WAA8B;IAE9B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACrC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IACnC,KAAK,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QACxD,IAAI,QAAQ,GAAG,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC;QACjD,KACE,IAAI,KAAK,GAAG,CAAC,EACb,QAAQ,KAAK,IAAI;YACjB,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;YACpB,KAAK,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,EACjC,KAAK,EAAE;YAEP,QAAQ,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC;QAC5E,IAAI,QAAQ,KAAK,IAAI;YAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpD,IAAI,cAAc;YAAE,8BAA8B,CAAC,cAAc,CAAC,CAAC;IACrE,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,4BAA4B,CAAC,WAAW,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import { invalidateContainerProjections } from \"../../../workflows/container-contents/container-state/projectionCache\";\nimport type { ContainerContentsStoreSyncState } from \"../syncAgent/syncAgentTypes\";\n\n/**\n * Drop every cached writer projection a hint invalidates, before hydration\n * lands, so the next share or move fetches a fresh one instead of submitting\n * against a stale manifest and conflicting. Descendants cite the same ancestor\n * manifests in their paths, so the locally known subtree under each invalidated\n * container is dropped too (an unhydrated subtree has nothing cached). Both\n * layers go: the in-memory copies on each container state, and the api-client's\n * cached writer projections that cite an invalidated container. Document\n * projections cite their paths too, so they are found by citation rather than\n * through the links, which live in SQLite; projections citing none of them stay\n * cached (#2395). Each open document store drops its own in-memory copy on the\n * same hint.\n */\nexport function invalidateCachedProjections(\n state: Pick<ContainerContentsStoreSyncState, \"containersById\" | \"runtime\">,\n invalidated: readonly string[],\n): void {\n if (invalidated.length === 0) return;\n const roots = new Set(invalidated);\n const stale = new Set(invalidated);\n for (const [id, containerState] of state.containersById) {\n let parentId = containerState.container.parentId;\n for (\n let depth = 0;\n parentId !== null &&\n !roots.has(parentId) &&\n depth < state.containersById.size;\n depth++\n )\n parentId = state.containersById.get(parentId)?.container.parentId ?? null;\n if (parentId !== null) stale.add(id);\n }\n for (const id of stale) {\n const containerState = state.containersById.get(id);\n if (containerState) invalidateContainerProjections(containerState);\n }\n state.runtime.apiClient.evictWriterProjectionsCiting(invalidated);\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { listContainerParentIdsForEventHydration, listContainerProjectionInvalidationIds, } from "
|
|
2
|
-
import { listContainerMetadataDocumentUpdateIds } from "
|
|
3
|
-
import { observeContainerBackgroundHydration } from "
|
|
4
|
-
import { bumpMetadataSyncSeq } from "
|
|
1
|
+
import { listContainerParentIdsForEventHydration, listContainerProjectionInvalidationIds, } from "../../../workflows/container-contents/containerEvents.js";
|
|
2
|
+
import { listContainerMetadataDocumentUpdateIds } from "../../../workflows/container-contents/metadata/index.js";
|
|
3
|
+
import { observeContainerBackgroundHydration } from "../hydration/backgroundHydration.js";
|
|
4
|
+
import { bumpMetadataSyncSeq } from "../syncAgent/metadataSyncSignal.js";
|
|
5
5
|
import { invalidateCachedProjections } from "./remoteEventProjectionInvalidation.js";
|
|
6
6
|
export function handleContainerContentsRemoteEvents(input) {
|
|
7
7
|
const { requestHydration, scheduleSync, state } = input;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteEventSync.js","sourceRoot":"","sources":["remoteEventSync.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,EACvC,sCAAsC,GACvC,MAAM,uDAAuD,C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Ac,CAAC,MAAM,EAAE,EAC7B,KAAK,CAAC,gCAAgC,CACvC,CAAC;IACF,KAAK,MAAM,kBAAkB,IAAI,mBAAmB,EAAE,CAAC;QACrD,KAAK,CAAC,8BAA8B,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC7D,mBAAmB,CAAC,KAAK,CAAC,yBAAyB,EAAE,kBAAkB,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnC,YAAY,EAAE,CAAC;IACjB,CAAC;AACH,CAAC","sourcesContent":["import {\n listContainerParentIdsForEventHydration,\n listContainerProjectionInvalidationIds,\n} from \"../../../workflows/container-contents/containerEvents\";\nimport { listContainerMetadataDocumentUpdateIds } from \"../../../workflows/container-contents/metadata\";\nimport { observeContainerBackgroundHydration } from \"../hydration/backgroundHydration\";\nimport { bumpMetadataSyncSeq } from \"../syncAgent/metadataSyncSignal\";\nimport type { ContainerContentsStoreSyncState } from \"../syncAgent/syncAgentTypes\";\nimport { invalidateCachedProjections } from \"./remoteEventProjectionInvalidation\";\n\nexport function handleContainerContentsRemoteEvents(input: {\n requestHydration: () => Promise<void>;\n scheduleSync: () => void;\n state: ContainerContentsStoreSyncState;\n}): void {\n const { requestHydration, scheduleSync, state } = input;\n // Metadata events are classified through the initialized container records.\n // Do not consume the cursor while a replacement database is still loading;\n // initialization calls this handler again once those identities exist.\n if (!state.initialized) {\n return;\n }\n const nextEvents = state.runtime.state.events.slice(state.lastEventCount);\n state.lastEventCount = state.runtime.state.events.length;\n // A peer's grant, rekey, or recite changed a manifest this client's cached\n // projections cite, without evicting this subscriber.\n invalidateCachedProjections(\n state,\n listContainerProjectionInvalidationIds(nextEvents),\n );\n let addedHydrationLane = false;\n for (const parentId of listContainerParentIdsForEventHydration(nextEvents)) {\n if (!state.containerParentIdsNeedingHydration.has(parentId)) {\n addedHydrationLane = true;\n }\n state.containerParentIdsNeedingHydration.add(parentId);\n }\n if (addedHydrationLane) {\n observeContainerBackgroundHydration(state, requestHydration());\n }\n\n const metadataDocumentIds = listContainerMetadataDocumentUpdateIds(\n nextEvents,\n state.containersById.values(),\n state.locallyAcceptedMetadataUpdateIds,\n );\n for (const metadataDocumentId of metadataDocumentIds) {\n state.metadataDocumentIdsNeedingSync.add(metadataDocumentId);\n bumpMetadataSyncSeq(state.metadataSyncSignalSeqById, metadataDocumentId);\n }\n if (metadataDocumentIds.length > 0) {\n scheduleSync();\n }\n}\n"]}
|
package/stores/container-contents/{remoteWriteGuards.js → remoteWrites/remoteWriteGuards.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { findOrganizationSystemRootState, findSystemContainerStateForRoot, } from "
|
|
2
|
-
import { isContainerInSubtree } from "
|
|
1
|
+
import { findOrganizationSystemRootState, findSystemContainerStateForRoot, } from "../systemContainers/systemContainerLookup.js";
|
|
2
|
+
import { isContainerInSubtree } from "../utils.js";
|
|
3
3
|
const activeByState = new WeakMap();
|
|
4
4
|
/** Invalidate remote settlement only when a local edit touches its subtree. */
|
|
5
5
|
export function invalidateRemoteContainerWrites(state, changedIds, movedId) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteWriteGuards.js","sourceRoot":"","sources":["remoteWriteGuards.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAYhD,MAAM,aAAa,GAAG,IAAI,OAAO,EAG9B,CAAC;AAEJ,+EAA+E;AAC/E,MAAM,UAAU,+BAA+B,CAC7C,KAAkC,EAClC,UAAoC,EACpC,OAAgB;IAEhB,IAAI,UAAU,EAAE,MAAM,KAAK,CAAC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO;IAC9D,KAAK,MAAM,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,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AE,MAAM,CAAC,CAAC;IACjC,MAAM,KAAK,GAAsB,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC3D,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClB,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO;QAC5B,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,oCAAoC,CAClD,KAAkC,EAClC,MAAc,EACd,UAA+B;IAE/B,KAAK,MAAM,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;QACnD,IACE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;YAC/B,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM;YAC7B,KAAK,CAAC,KAAK,CAAC,UAAU,KAAK,UAAU,EACrC,CAAC;YACD,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { ContainerSystemSlot } from \"@tearleads/validators/containerSystemSlot\";\nimport {\n findOrganizationSystemRootState,\n findSystemContainerStateForRoot,\n} from \"../systemContainers/systemContainerLookup\";\nimport type { ContainerContentsStoreState } from \"../types\";\nimport { isContainerInSubtree } from \"../utils\";\n\nexport type RemoteContainerWriteScope =\n | string\n | {\n rootId: string;\n systemSlot: ContainerSystemSlot;\n };\ninterface ActiveRemoteWrite {\n changed: boolean;\n scope: RemoteContainerWriteScope | undefined;\n}\nconst activeByState = new WeakMap<\n ContainerContentsStoreState,\n Set<ActiveRemoteWrite>\n>();\n\n/** Invalidate remote settlement only when a local edit touches its subtree. */\nexport function invalidateRemoteContainerWrites(\n state: ContainerContentsStoreState,\n changedIds: readonly string[] | null,\n movedId?: string,\n): void {\n if (changedIds?.length === 0 && movedId === undefined) return;\n for (const write of activeByState.get(state) ?? []) {\n let rootId: string | undefined;\n if (typeof write.scope === \"object\") {\n const root = state.containersById.get(write.scope.rootId);\n if (root) {\n rootId = (\n findSystemContainerStateForRoot(\n state,\n write.scope.systemSlot,\n root,\n ) ??\n findOrganizationSystemRootState(\n state,\n root.container.organizationId ||\n state.runtime.auth.organizationId ||\n \"\",\n write.scope.systemSlot,\n )\n )?.container.id;\n }\n } else {\n rootId = write.scope;\n }\n if (\n write.scope === undefined ||\n changedIds === null ||\n (rootId !== undefined &&\n (changedIds.some((id) =>\n isContainerInSubtree(state.containersById, id, rootId),\n ) ||\n (movedId !== undefined &&\n isContainerInSubtree(state.containersById, rootId, movedId))))\n ) {\n write.changed = true;\n }\n }\n}\n\nexport function trackRemoteContainerWrite(\n state: ContainerContentsStoreState,\n scope?: RemoteContainerWriteScope,\n) {\n const active = activeByState.get(state) ?? new Set<ActiveRemoteWrite>();\n activeByState.set(state, active);\n const write: ActiveRemoteWrite = { changed: false, scope };\n active.add(write);\n return {\n changed: () => write.changed,\n dispose: () => {\n active.delete(write);\n },\n };\n}\n\n/** An undiscovered system child has a stable slot before it has a local id. */\nexport function invalidateRemoteSystemContainerWrite(\n state: ContainerContentsStoreState,\n rootId: string,\n systemSlot: ContainerSystemSlot,\n): void {\n for (const write of activeByState.get(state) ?? []) {\n if (\n typeof write.scope === \"object\" &&\n write.scope.rootId === rootId &&\n write.scope.systemSlot === systemSlot\n ) {\n write.changed = true;\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { errorMessage } from "
|
|
1
|
+
import { errorMessage } from "../../../data/shared/errorMessage.js";
|
|
2
2
|
import { trackRemoteContainerWrite, } from "./remoteWriteGuards.js";
|
|
3
3
|
import { captureContainerWriteGeneration } from "./writeGeneration.js";
|
|
4
4
|
const remoteWritesByState = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteWriteQueue.js","sourceR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AI,CAAC,SAAS,EAAE;gBAAE,OAAO,WAAW,CAAC;YACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC;YACrC,uEAAuE;YACvE,OAAO,cAAc,EAAE;gBACrB,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,0BAA0B,CAAC;gBAC1D,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,WAAW,CAAC;QAClB,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,cAAc,EAAE,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;gBAC1C,wEAAwE;gBACxE,sEAAsE;gBACtE,oEAAoE;gBACpE,KAAK,CAAC,0BAA0B,GAAG,IAAI,CAAC;gBACxC,KAAK,SAAS,CAAC,sBAAsB,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;oBAC/D,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CACpB,6CAA6C,YAAY,CAAC,KAAK,CAAC,GAAG,CACpE,CAAC;gBACJ,CAAC,CAAC,CAAC;gBACH,SAAS,CAAC,uBAAuB,EAAE,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,mBAAmB,CAAC,GAAG,CAAC,KAAK,EAAE;QAC7B,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,IAAI,CAAC,IAAI,CACb,GAAG,EAAE,CAAC,SAAS,EACf,GAAG,EAAE,CAAC,SAAS,CAChB;KACF,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { errorMessage } from \"../../../data/shared/errorMessage\";\nimport type { ContainerContentsStoreSyncAgent } from \"../syncAgent\";\nimport type { ContainerContentsStoreState } from \"../types\";\nimport {\n type RemoteContainerWriteScope,\n trackRemoteContainerWrite,\n} from \"./remoteWriteGuards\";\nimport { captureContainerWriteGeneration } from \"./writeGeneration\";\n\nconst remoteWritesByState = new WeakMap<\n ContainerContentsStoreState,\n { current: () => boolean; tail: Promise<void> }\n>();\n\n/** Online operations serialize together; local writes never wait for their I/O. */\nexport function chainRemoteContainerTask<T>(\n state: ContainerContentsStoreState,\n syncAgent: Pick<\n ContainerContentsStoreSyncAgent,\n \"refreshLocalContainers\" | \"scheduleRemoteHydration\"\n >,\n staleResult: T,\n work: (isCurrent: () => boolean) => Promise<T>,\n scope?: RemoteContainerWriteScope,\n options: { preserveResultOnLocalWrite?: boolean } = {},\n): Promise<T> {\n const contextCurrent = captureContainerWriteGeneration(state);\n const previous = remoteWritesByState.get(state);\n const tail = previous?.current() ? previous.tail : Promise.resolve();\n const task = tail.then(async () => {\n if (!contextCurrent()) return staleResult;\n // Install the guard at one local queue boundary. New writes can proceed\n // immediately afterward; an ongoing stream cannot starve the remote task.\n const boundary = state.writeChain\n .catch(() => null)\n .then(() => trackRemoteContainerWrite(state, scope));\n state.writeChain = boundary.then(() => null);\n const tracked = await boundary;\n const isCurrent = () => contextCurrent() && !tracked.changed();\n try {\n if (!isCurrent()) return staleResult;\n const result = await work(isCurrent);\n // Only completed operations opt in. A replaced runtime always cancels.\n return contextCurrent() &&\n (!tracked.changed() || options.preserveResultOnLocalWrite)\n ? result\n : staleResult;\n } finally {\n tracked.dispose();\n if (contextCurrent() && tracked.changed()) {\n // The HTTP side may have committed before a new local write invalidated\n // this operation. Reconcile its authoritative result without allowing\n // the older operation to install state over the user's newer write.\n state.localContainersNeedRefresh = true;\n void syncAgent.refreshLocalContainers().catch((error: unknown) => {\n state.runtime.util.log(\n `Container contents: local refresh failed (${errorMessage(error)})`,\n );\n });\n syncAgent.scheduleRemoteHydration();\n }\n }\n });\n remoteWritesByState.set(state, {\n current: contextCurrent,\n tail: task.then(\n () => undefined,\n () => undefined,\n ),\n });\n return task;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeGeneration.js","sourceRoot":"","sources":["writeGeneration.ts"],"names":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,UAAU,+BAA+B,CAC7C,KAAkC;IAElC,MAAM,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;IACtD,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACtC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAC9B,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IAC9C,OAAO,GAAG,EAAE,CACV,KAAK,CAAC,mBAAmB,KAAK,mBAAmB;QACjD,KAAK,CAAC,WAAW,KAAK,WAAW;QACjC,KAAK,CAAC,eAAe,KAAK,eAAe;QACzC,CAAC,8BAA8B,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import type { ContainerContentsStoreRuntime } from \"../syncAgent/syncAgentTypes\";\nimport type { ContainerContentsStoreState } from \"../types\";\n\nexport type ContainerWriteGuard = () => boolean;\n\nexport function didContainerWriteRuntimeChange(\n previousRuntime: ContainerContentsStoreRuntime,\n currentRuntime: ContainerContentsStoreRuntime,\n): boolean {\n return (\n previousRuntime.adoptRootContainer !== currentRuntime.adoptRootContainer ||\n previousRuntime.apiClient !== currentRuntime.apiClient ||\n previousRuntime.auth.defaultOrganizationId !==\n currentRuntime.auth.defaultOrganizationId ||\n previousRuntime.auth.isAuthenticated !==\n currentRuntime.auth.isAuthenticated ||\n previousRuntime.auth.organizationId !==\n currentRuntime.auth.organizationId ||\n previousRuntime.auth.userId !== currentRuntime.auth.userId ||\n previousRuntime.crypto.encapsulationKeyPair !==\n currentRuntime.crypto.encapsulationKeyPair ||\n previousRuntime.crypto.signingFingerprint !==\n currentRuntime.crypto.signingFingerprint ||\n previousRuntime.crypto.signingKeyPair !==\n currentRuntime.crypto.signingKeyPair ||\n previousRuntime.infra.blobStore !== currentRuntime.infra.blobStore ||\n previousRuntime.infra.dbStatus !== currentRuntime.infra.dbStatus ||\n previousRuntime.infra.documentProjectors !==\n currentRuntime.infra.documentProjectors ||\n previousRuntime.infra.execSql !== currentRuntime.infra.execSql ||\n previousRuntime.resolveTrustedUserIdentity !==\n currentRuntime.resolveTrustedUserIdentity ||\n previousRuntime.state.containerId !== currentRuntime.state.containerId ||\n previousRuntime.state.domainScope !== currentRuntime.state.domainScope\n );\n}\n\nexport function captureContainerWriteGeneration(\n state: ContainerContentsStoreState,\n): ContainerWriteGuard {\n const lifecycleGeneration = state.lifecycleGeneration;\n const persistence = state.persistence;\n const runtime = state.runtime;\n const writeGeneration = state.writeGeneration;\n return () =>\n state.lifecycleGeneration === lifecycleGeneration &&\n state.persistence === persistence &&\n state.writeGeneration === writeGeneration &&\n !didContainerWriteRuntimeChange(runtime, state.runtime);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContainerContentsPersistence } from "../../workflows/container-contents/containerPersistence.js";
|
|
2
|
-
import type { ContainerContentsStoreRuntime, ContainerContentsStoreSyncAgent } from "./syncAgentTypes.js";
|
|
2
|
+
import type { ContainerContentsStoreRuntime, ContainerContentsStoreSyncAgent } from "./syncAgent/syncAgentTypes.js";
|
|
3
3
|
import type { ContainerContentsStoreState } from "./types.js";
|
|
4
4
|
export declare function createContainerContentsStoreState(initialRuntime: ContainerContentsStoreRuntime, persistence: ContainerContentsPersistence, logLabel?: string | undefined): ContainerContentsStoreState;
|
|
5
5
|
export declare function updateContainerContentsSnapshot(state: ContainerContentsStoreState): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createContainerContentsProjectionUserKeyResolver, didContainerContentsProjectionKeyRuntimeChange, } from "../../workflows/container-contents/projectionKeys.js";
|
|
2
2
|
import { didRegainSyncPrerequisites } from "../../workflows/container-contents/syncLane.js";
|
|
3
|
-
import { ContainerStateMap } from "./containerStateMap.js";
|
|
3
|
+
import { ContainerStateMap } from "./containerState/containerStateMap.js";
|
|
4
|
+
import { didContainerWriteRuntimeChange } from "./remoteWrites/writeGeneration.js";
|
|
4
5
|
import { getSnapshotNodes } from "./utils.js";
|
|
5
|
-
import { didContainerWriteRuntimeChange } from "./writeGeneration.js";
|
|
6
6
|
function areSyncStatesEqual(left, right) {
|
|
7
7
|
return (left.lastError === right.lastError &&
|
|
8
8
|
left.pendingAttachmentBytes === right.pendingAttachmentBytes &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["state.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gDAAgD,EAChD,8CAA8C,GAC/C,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAUxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAEnE,SAAS,kBAAkB,CACzB,IAAgC,EAChC,KAAiC;IAEjC,OAAO,CACL,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;QAClC,IAAI,CAAC,sBAAsB,KAAK,KAAK,CAAC,sBAAsB;QAC5D,IAAI,CAAC,sBAAsB,KAAK,KAAK,CAAC,sBAAsB;QAC5D,IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB;QACpD,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAC7B,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAC5B,IAAkC,EAClC,KAAmC;IAEnC,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QACpC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,CACL,SAAS,KAAK,SAAS;YACvB,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS;YAC1C,QAA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QACpB,0BAA0B,CAAC,eAAe,EAAE,WAAW,CAAC,EACxD,CAAC;QACD,2EAA2E;QAC3E,yEAAyE;QACzE,oEAAoE;QACpE,SAAS,CAAC,YAAY,EAAE,CAAC;QACzB,SAAS,CAAC,uBAAuB,EAAE,CAAC;IACtC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,+CAA+C,CAC7D,KAGC,EACD,OAA+B;IAE/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,6BAA6B;QAAE,OAAO;IAC1E,KAAK,CAAC,6BAA6B,GAAG,KAAK,CAAC;IAC5C,KAAK,OAAO,EAAE,CAAC,IAAI,CACjB,CAAC,SAAS,EAAE,EAAE;QACZ,IAAI,CAAC,SAAS;YAAE,KAAK,CAAC,6BAA6B,GAAG,IAAI,CAAC;IAC7D,CAAC,EACD,GAAG,EAAE;QACH,KAAK,CAAC,6BAA6B,GAAG,IAAI,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAkC,EAClC,eAA6C,EAC7C,SAA0C;IAE1C,IAAI,KAAK,CAAC,WAAW,KAAK,eAAe,EAAE,CAAC;QAC1C,OAAO;IACT,CAAC;IACD,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;IACpC,KAAK,CAAC,oBAAoB,IAAI,CAAC,CAAC;IAChC,KAAK,CAAC,eAAe,IAAI,CAAC,CAAC;IAC3B,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,2BAA2B,CAAC,KAAK,CAAC,CAAC;IACnC,SAAS,CAAC,iBAAiB,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import type { ContainerContentsPersistence } from \"../../workflows/container-contents/containerPersistence\";\nimport {\n createContainerContentsProjectionUserKeyResolver,\n didContainerContentsProjectionKeyRuntimeChange,\n} from \"../../workflows/container-contents/projectionKeys\";\nimport { didRegainSyncPrerequisites } from \"../../workflows/container-contents/syncLane\";\nimport { ContainerStateMap } from \"./containerStateMap\";\nimport type {\n ContainerContentsStoreRuntime,\n ContainerContentsStoreSyncAgent,\n} from \"./syncAgentTypes\";\nimport type {\n ContainerContentsSnapshot,\n ContainerContentsStoreState,\n ContainerNode,\n} from \"./types\";\nimport { getSnapshotNodes } from \"./utils\";\nimport { didContainerWriteRuntimeChange } from \"./writeGeneration\";\n\nfunction areSyncStatesEqual(\n left: ContainerNode[\"syncState\"],\n right: ContainerNode[\"syncState\"],\n): boolean {\n return (\n left.lastError === right.lastError &&\n left.pendingAttachmentBytes === right.pendingAttachmentBytes &&\n left.pendingAttachmentCount === right.pendingAttachmentCount &&\n left.pendingUpdateCount === right.pendingUpdateCount &&\n left.status === right.status\n );\n}\n\nfunction areSnapshotNodesEqual(\n left: ReadonlyArray<ContainerNode>,\n right: ReadonlyArray<ContainerNode>,\n): boolean {\n if (left.length !== right.length) {\n return false;\n }\n\n return left.every((leftNode, index) => {\n const rightNode = right[index];\n return (\n rightNode !== undefined &&\n leftNode.createdAt === rightNode.createdAt &&\n leftNode.effectiveAccessLevel === rightNode.effectiveAccessLevel &&\n leftNode.id === rightNode.id &&\n leftNode.icon === rightNode.icon &&\n leftNode.kind === rightNode.kind &&\n leftNode.metadataDocumentId === rightNode.metadataDocumentId &&\n leftNode.metadataReady === rightNode.metadataReady &&\n leftNode.name === rightNode.name &&\n leftNode.organizationId === rightNode.organizationId &&\n leftNode.parentId === rightNode.parentId &&\n areSyncStatesEqual(leftNode.syncState, rightNode.syncState) &&\n leftNode.systemSlot === rightNode.systemSlot &&\n leftNode.updatedAt === rightNode.updatedAt\n );\n });\n}\n\nfunction didStructuralRuntimeChange(\n previousRuntime: ContainerContentsStoreRuntime,\n nextRuntime: ContainerContentsStoreRuntime,\n): boolean {\n // Structural sync also depends on connectivity and event delivery. Local\n // writes use only the identity and storage checks shared below.\n return (\n didContainerWriteRuntimeChange(previousRuntime, nextRuntime) ||\n previousRuntime.state.online !== nextRuntime.state.online ||\n previousRuntime.state.peerScope !== nextRuntime.state.peerScope ||\n previousRuntime.state.serverEventsConnectionGeneration !==\n nextRuntime.state.serverEventsConnectionGeneration ||\n previousRuntime.util.isRemoteSyncBlocked !==\n nextRuntime.util.isRemoteSyncBlocked\n );\n}\n\nexport function createContainerContentsStoreState(\n initialRuntime: ContainerContentsStoreRuntime,\n persistence: ContainerContentsPersistence,\n logLabel?: string | undefined,\n): ContainerContentsStoreState {\n return {\n containersById: new ContainerStateMap(),\n containerParentIdsNeedingHydration: new Set(),\n documentStoresNeedPriming: true,\n initializeGeneration: null,\n initializePromise: null,\n initialized: false,\n localContainerRefreshPromise: null,\n localContainerRefreshGeneration: null,\n localContainerRefreshStructuralGeneration: null,\n localContainersNeedRefresh: false,\n lifecycleGeneration: 0,\n lastEventCount: 0,\n listeners: new Set(),\n locallyAcceptedMetadataUpdateIds: new Set(),\n logLabel,\n metadataDocumentIdsNeedingSync: new Set(),\n metadataSyncSignalSeqById: new Map(),\n persistence,\n remoteHydrationPromise: null,\n remoteHydrationGeneration: null,\n remoteHydrationStructuralGeneration: null,\n remoteReconnectRefreshPending: false,\n resolveProjectionUserKey:\n createContainerContentsProjectionUserKeyResolver(initialRuntime),\n rootLaneHydrated: false,\n runtime: initialRuntime,\n snapshot: {\n nodes: [],\n ready: false,\n },\n syncLane: null,\n structuralGeneration: 0,\n writeGeneration: 0,\n writeChain: Promise.resolve<ContainerNode | null>(null),\n };\n}\n\nfunction emitContainerContentsStore(state: ContainerContentsStoreState) {\n for (const listener of state.listeners) {\n listener();\n }\n}\n\nfunction setContainerContentsSnapshot(\n state: ContainerContentsStoreState,\n next: ContainerContentsSnapshot,\n) {\n if (\n next.ready === state.snapshot.ready &&\n areSnapshotNodesEqual(next.nodes, state.snapshot.nodes)\n ) {\n return;\n }\n\n state.snapshot = next;\n emitContainerContentsStore(state);\n}\n\nexport function updateContainerContentsSnapshot(\n state: ContainerContentsStoreState,\n) {\n setContainerContentsSnapshot(state, {\n nodes: getSnapshotNodes(state.containersById),\n ready: true,\n });\n}\n\nfunction resetContainerContentsStore(state: ContainerContentsStoreState) {\n state.lifecycleGeneration += 1;\n state.containersById = new ContainerStateMap();\n state.containerParentIdsNeedingHydration = new Set();\n state.documentStoresNeedPriming = true;\n state.initialized = false;\n state.localContainersNeedRefresh = false;\n // Runtime events are snapshots, not a destructive queue. A replacement\n // executor or persistence adapter has not observed any of them, even when\n // their effects were already applied to the previous database. Replay the\n // snapshot after replacement initialization rebuilds metadata identities.\n state.lastEventCount = 0;\n // Accepted-echo suppression state must not survive a reset: after a\n // database loss the tree rehydrates from remote, and a retained id would\n // suppress the next matching remote update signal. Mirrors\n // clearDocumentStoreState in the document store lane.\n state.locallyAcceptedMetadataUpdateIds = new Set();\n state.metadataDocumentIdsNeedingSync = new Set();\n state.metadataSyncSignalSeqById = new Map();\n state.rootLaneHydrated = false;\n state.writeChain = Promise.resolve<ContainerNode | null>(null);\n setContainerContentsSnapshot(state, {\n nodes: [],\n ready: false,\n });\n}\n\nexport function subscribeToContainerContentsStore(\n state: ContainerContentsStoreState,\n listener: () => void,\n) {\n state.listeners.add(listener);\n return () => state.listeners.delete(listener);\n}\n\nexport function updateContainerContentsStoreRuntime(\n state: ContainerContentsStoreState,\n nextRuntime: ContainerContentsStoreRuntime,\n syncAgent: ContainerContentsStoreSyncAgent,\n) {\n const previousRuntime = state.runtime;\n const runtimeReplaced = didStructuralRuntimeChange(\n previousRuntime,\n nextRuntime,\n );\n if (didContainerWriteRuntimeChange(previousRuntime, nextRuntime)) {\n state.writeGeneration += 1;\n }\n const executorReplaced =\n previousRuntime.infra.execSql !== nextRuntime.infra.execSql;\n const serverEventsConnectionChanged =\n previousRuntime.state.serverEventsConnectionGeneration !==\n nextRuntime.state.serverEventsConnectionGeneration;\n if (runtimeReplaced) {\n state.structuralGeneration += 1;\n state.localContainersNeedRefresh = true;\n }\n const contextChanged =\n previousRuntime.auth.organizationId !== nextRuntime.auth.organizationId ||\n previousRuntime.state.containerId !== nextRuntime.state.containerId;\n if (\n didContainerContentsProjectionKeyRuntimeChange(previousRuntime, nextRuntime)\n ) {\n state.resolveProjectionUserKey =\n createContainerContentsProjectionUserKeyResolver(nextRuntime);\n }\n state.runtime = nextRuntime;\n if (serverEventsConnectionChanged) {\n state.remoteReconnectRefreshPending = true;\n }\n\n if (nextRuntime.infra.dbStatus !== \"ready\") {\n if (state.snapshot.ready || state.initialized || state.initializePromise) {\n resetContainerContentsStore(state);\n }\n return;\n }\n\n if (executorReplaced) {\n // The in-memory tree and lane markers belong to the previous executor.\n // Rebuild them from the replacement database before any remote sync can\n // observe or persist the old database's state.\n resetContainerContentsStore(state);\n syncAgent.ensureInitialized();\n syncAgent.handleRemoteEvents();\n return;\n }\n\n // Gaining authentication within a domain scope does not change identity\n // (the scope is keyed on the signing fingerprint), so the locally-loaded\n // tree stays valid. Reconcile it in place instead of resetting — resetting\n // here is what blanked Explorer and forced a re-read on first open after\n // register. Identity/storage changes are handled by scope rotation and the\n // dbStatus-loss branch above.\n if (\n state.snapshot.ready &&\n (contextChanged || didRegainSyncPrerequisites(previousRuntime, nextRuntime))\n ) {\n state.localContainersNeedRefresh = true;\n state.documentStoresNeedPriming = true;\n void syncAgent.refreshLocalContainers();\n // The refresh alone does not run the sync lane; schedule it so newly\n // eligible documents (e.g. this organization's orphans) prime now.\n syncAgent.scheduleSync();\n }\n\n syncAgent.ensureInitialized();\n\n syncAgent.handleRemoteEvents();\n\n if (runtimeReplaced) {\n void syncAgent.refreshLocalContainers();\n syncAgent.scheduleSync();\n }\n\n consumePendingContainerContentsReconnectRefresh(state, syncAgent.refresh);\n\n if (\n state.snapshot.ready &&\n didRegainSyncPrerequisites(previousRuntime, nextRuntime)\n ) {\n // A pass blocked by missing prerequisites consumes its lane request before\n // returning early. Re-arm it directly when they return even if hydration\n // finds no remote delta; this also primes unopened document stores.\n syncAgent.scheduleSync();\n syncAgent.scheduleRemoteHydration();\n }\n}\n\nexport function consumePendingContainerContentsReconnectRefresh(\n state: {\n remoteReconnectRefreshPending: boolean;\n snapshot: { ready: boolean };\n },\n refresh: () => Promise<boolean>,\n): void {\n if (!state.snapshot.ready || !state.remoteReconnectRefreshPending) return;\n state.remoteReconnectRefreshPending = false;\n void refresh().then(\n (refreshed) => {\n if (!refreshed) state.remoteReconnectRefreshPending = true;\n },\n () => {\n state.remoteReconnectRefreshPending = true;\n },\n );\n}\n\nexport function updateContainerContentsStorePersistence(\n state: ContainerContentsStoreState,\n nextPersistence: ContainerContentsPersistence,\n syncAgent: ContainerContentsStoreSyncAgent,\n): void {\n if (state.persistence === nextPersistence) {\n return;\n }\n state.persistence = nextPersistence;\n state.structuralGeneration += 1;\n state.writeGeneration += 1;\n // Persistence replacement changes the authoritative local data source even\n // when the SQLite executor itself is stable. Clear storage-backed state and\n // let initialization load the replacement before scheduling remote work.\n resetContainerContentsStore(state);\n syncAgent.ensureInitialized();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["state.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gDAAgD,EAChD,8CAA8C,GAC/C,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAUhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,SAAS,kBAAkB,CACzB,IAAgC,EAChC,KAAiC;IAEjC,OAAO,CACL,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;QAClC,IAAI,CAAC,sBAAsB,KAAK,KAAK,CAAC,sBAAsB;QAC5D,IAAI,CAAC,sBAAsB,KAAK,KAAK,CAAC,sBAAsB;QAC5D,IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB;QACpD,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAC7B,CAAC;AACJ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,CAAC,CAAC;IAChC,KAAK,CAAC,eAAe,IAAI,CAAC,CAAC;IAC3B,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,2BAA2B,CAAC,KAAK,CAAC,CAAC;IACnC,SAAS,CAAC,iBAAiB,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import type { ContainerContentsPersistence } from \"../../workflows/container-contents/containerPersistence\";\nimport {\n createContainerContentsProjectionUserKeyResolver,\n didContainerContentsProjectionKeyRuntimeChange,\n} from \"../../workflows/container-contents/projectionKeys\";\nimport { didRegainSyncPrerequisites } from \"../../workflows/container-contents/syncLane\";\nimport { ContainerStateMap } from \"./containerState/containerStateMap\";\nimport { didContainerWriteRuntimeChange } from \"./remoteWrites/writeGeneration\";\nimport type {\n ContainerContentsStoreRuntime,\n ContainerContentsStoreSyncAgent,\n} from \"./syncAgent/syncAgentTypes\";\nimport type {\n ContainerContentsSnapshot,\n ContainerContentsStoreState,\n ContainerNode,\n} from \"./types\";\nimport { getSnapshotNodes } from \"./utils\";\n\nfunction areSyncStatesEqual(\n left: ContainerNode[\"syncState\"],\n right: ContainerNode[\"syncState\"],\n): boolean {\n return (\n left.lastError === right.lastError &&\n left.pendingAttachmentBytes === right.pendingAttachmentBytes &&\n left.pendingAttachmentCount === right.pendingAttachmentCount &&\n left.pendingUpdateCount === right.pendingUpdateCount &&\n left.status === right.status\n );\n}\n\nfunction areSnapshotNodesEqual(\n left: ReadonlyArray<ContainerNode>,\n right: ReadonlyArray<ContainerNode>,\n): boolean {\n if (left.length !== right.length) {\n return false;\n }\n\n return left.every((leftNode, index) => {\n const rightNode = right[index];\n return (\n rightNode !== undefined &&\n leftNode.createdAt === rightNode.createdAt &&\n leftNode.effectiveAccessLevel === rightNode.effectiveAccessLevel &&\n leftNode.id === rightNode.id &&\n leftNode.icon === rightNode.icon &&\n leftNode.kind === rightNode.kind &&\n leftNode.metadataDocumentId === rightNode.metadataDocumentId &&\n leftNode.metadataReady === rightNode.metadataReady &&\n leftNode.name === rightNode.name &&\n leftNode.organizationId === rightNode.organizationId &&\n leftNode.parentId === rightNode.parentId &&\n areSyncStatesEqual(leftNode.syncState, rightNode.syncState) &&\n leftNode.systemSlot === rightNode.systemSlot &&\n leftNode.updatedAt === rightNode.updatedAt\n );\n });\n}\n\nfunction didStructuralRuntimeChange(\n previousRuntime: ContainerContentsStoreRuntime,\n nextRuntime: ContainerContentsStoreRuntime,\n): boolean {\n // Structural sync also depends on connectivity and event delivery. Local\n // writes use only the identity and storage checks shared below.\n return (\n didContainerWriteRuntimeChange(previousRuntime, nextRuntime) ||\n previousRuntime.state.online !== nextRuntime.state.online ||\n previousRuntime.state.peerScope !== nextRuntime.state.peerScope ||\n previousRuntime.state.serverEventsConnectionGeneration !==\n nextRuntime.state.serverEventsConnectionGeneration ||\n previousRuntime.util.isRemoteSyncBlocked !==\n nextRuntime.util.isRemoteSyncBlocked\n );\n}\n\nexport function createContainerContentsStoreState(\n initialRuntime: ContainerContentsStoreRuntime,\n persistence: ContainerContentsPersistence,\n logLabel?: string | undefined,\n): ContainerContentsStoreState {\n return {\n containersById: new ContainerStateMap(),\n containerParentIdsNeedingHydration: new Set(),\n documentStoresNeedPriming: true,\n initializeGeneration: null,\n initializePromise: null,\n initialized: false,\n localContainerRefreshPromise: null,\n localContainerRefreshGeneration: null,\n localContainerRefreshStructuralGeneration: null,\n localContainersNeedRefresh: false,\n lifecycleGeneration: 0,\n lastEventCount: 0,\n listeners: new Set(),\n locallyAcceptedMetadataUpdateIds: new Set(),\n logLabel,\n metadataDocumentIdsNeedingSync: new Set(),\n metadataSyncSignalSeqById: new Map(),\n persistence,\n remoteHydrationPromise: null,\n remoteHydrationGeneration: null,\n remoteHydrationStructuralGeneration: null,\n remoteReconnectRefreshPending: false,\n resolveProjectionUserKey:\n createContainerContentsProjectionUserKeyResolver(initialRuntime),\n rootLaneHydrated: false,\n runtime: initialRuntime,\n snapshot: {\n nodes: [],\n ready: false,\n },\n syncLane: null,\n structuralGeneration: 0,\n writeGeneration: 0,\n writeChain: Promise.resolve<ContainerNode | null>(null),\n };\n}\n\nfunction emitContainerContentsStore(state: ContainerContentsStoreState) {\n for (const listener of state.listeners) {\n listener();\n }\n}\n\nfunction setContainerContentsSnapshot(\n state: ContainerContentsStoreState,\n next: ContainerContentsSnapshot,\n) {\n if (\n next.ready === state.snapshot.ready &&\n areSnapshotNodesEqual(next.nodes, state.snapshot.nodes)\n ) {\n return;\n }\n\n state.snapshot = next;\n emitContainerContentsStore(state);\n}\n\nexport function updateContainerContentsSnapshot(\n state: ContainerContentsStoreState,\n) {\n setContainerContentsSnapshot(state, {\n nodes: getSnapshotNodes(state.containersById),\n ready: true,\n });\n}\n\nfunction resetContainerContentsStore(state: ContainerContentsStoreState) {\n state.lifecycleGeneration += 1;\n state.containersById = new ContainerStateMap();\n state.containerParentIdsNeedingHydration = new Set();\n state.documentStoresNeedPriming = true;\n state.initialized = false;\n state.localContainersNeedRefresh = false;\n // Runtime events are snapshots, not a destructive queue. A replacement\n // executor or persistence adapter has not observed any of them, even when\n // their effects were already applied to the previous database. Replay the\n // snapshot after replacement initialization rebuilds metadata identities.\n state.lastEventCount = 0;\n // Accepted-echo suppression state must not survive a reset: after a\n // database loss the tree rehydrates from remote, and a retained id would\n // suppress the next matching remote update signal. Mirrors\n // clearDocumentStoreState in the document store lane.\n state.locallyAcceptedMetadataUpdateIds = new Set();\n state.metadataDocumentIdsNeedingSync = new Set();\n state.metadataSyncSignalSeqById = new Map();\n state.rootLaneHydrated = false;\n state.writeChain = Promise.resolve<ContainerNode | null>(null);\n setContainerContentsSnapshot(state, {\n nodes: [],\n ready: false,\n });\n}\n\nexport function subscribeToContainerContentsStore(\n state: ContainerContentsStoreState,\n listener: () => void,\n) {\n state.listeners.add(listener);\n return () => state.listeners.delete(listener);\n}\n\nexport function updateContainerContentsStoreRuntime(\n state: ContainerContentsStoreState,\n nextRuntime: ContainerContentsStoreRuntime,\n syncAgent: ContainerContentsStoreSyncAgent,\n) {\n const previousRuntime = state.runtime;\n const runtimeReplaced = didStructuralRuntimeChange(\n previousRuntime,\n nextRuntime,\n );\n if (didContainerWriteRuntimeChange(previousRuntime, nextRuntime)) {\n state.writeGeneration += 1;\n }\n const executorReplaced =\n previousRuntime.infra.execSql !== nextRuntime.infra.execSql;\n const serverEventsConnectionChanged =\n previousRuntime.state.serverEventsConnectionGeneration !==\n nextRuntime.state.serverEventsConnectionGeneration;\n if (runtimeReplaced) {\n state.structuralGeneration += 1;\n state.localContainersNeedRefresh = true;\n }\n const contextChanged =\n previousRuntime.auth.organizationId !== nextRuntime.auth.organizationId ||\n previousRuntime.state.containerId !== nextRuntime.state.containerId;\n if (\n didContainerContentsProjectionKeyRuntimeChange(previousRuntime, nextRuntime)\n ) {\n state.resolveProjectionUserKey =\n createContainerContentsProjectionUserKeyResolver(nextRuntime);\n }\n state.runtime = nextRuntime;\n if (serverEventsConnectionChanged) {\n state.remoteReconnectRefreshPending = true;\n }\n\n if (nextRuntime.infra.dbStatus !== \"ready\") {\n if (state.snapshot.ready || state.initialized || state.initializePromise) {\n resetContainerContentsStore(state);\n }\n return;\n }\n\n if (executorReplaced) {\n // The in-memory tree and lane markers belong to the previous executor.\n // Rebuild them from the replacement database before any remote sync can\n // observe or persist the old database's state.\n resetContainerContentsStore(state);\n syncAgent.ensureInitialized();\n syncAgent.handleRemoteEvents();\n return;\n }\n\n // Gaining authentication within a domain scope does not change identity\n // (the scope is keyed on the signing fingerprint), so the locally-loaded\n // tree stays valid. Reconcile it in place instead of resetting — resetting\n // here is what blanked Explorer and forced a re-read on first open after\n // register. Identity/storage changes are handled by scope rotation and the\n // dbStatus-loss branch above.\n if (\n state.snapshot.ready &&\n (contextChanged || didRegainSyncPrerequisites(previousRuntime, nextRuntime))\n ) {\n state.localContainersNeedRefresh = true;\n state.documentStoresNeedPriming = true;\n void syncAgent.refreshLocalContainers();\n // The refresh alone does not run the sync lane; schedule it so newly\n // eligible documents (e.g. this organization's orphans) prime now.\n syncAgent.scheduleSync();\n }\n\n syncAgent.ensureInitialized();\n\n syncAgent.handleRemoteEvents();\n\n if (runtimeReplaced) {\n void syncAgent.refreshLocalContainers();\n syncAgent.scheduleSync();\n }\n\n consumePendingContainerContentsReconnectRefresh(state, syncAgent.refresh);\n\n if (\n state.snapshot.ready &&\n didRegainSyncPrerequisites(previousRuntime, nextRuntime)\n ) {\n // A pass blocked by missing prerequisites consumes its lane request before\n // returning early. Re-arm it directly when they return even if hydration\n // finds no remote delta; this also primes unopened document stores.\n syncAgent.scheduleSync();\n syncAgent.scheduleRemoteHydration();\n }\n}\n\nexport function consumePendingContainerContentsReconnectRefresh(\n state: {\n remoteReconnectRefreshPending: boolean;\n snapshot: { ready: boolean };\n },\n refresh: () => Promise<boolean>,\n): void {\n if (!state.snapshot.ready || !state.remoteReconnectRefreshPending) return;\n state.remoteReconnectRefreshPending = false;\n void refresh().then(\n (refreshed) => {\n if (!refreshed) state.remoteReconnectRefreshPending = true;\n },\n () => {\n state.remoteReconnectRefreshPending = true;\n },\n );\n}\n\nexport function updateContainerContentsStorePersistence(\n state: ContainerContentsStoreState,\n nextPersistence: ContainerContentsPersistence,\n syncAgent: ContainerContentsStoreSyncAgent,\n): void {\n if (state.persistence === nextPersistence) {\n return;\n }\n state.persistence = nextPersistence;\n state.structuralGeneration += 1;\n state.writeGeneration += 1;\n // Persistence replacement changes the authoritative local data source even\n // when the SQLite executor itself is stable. Clear storage-backed state and\n // let initialization load the replacement before scheduling remote work.\n resetContainerContentsStore(state);\n syncAgent.ensureInitialized();\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RemoteContainerHydrationHost } from "
|
|
1
|
+
import type { RemoteContainerHydrationHost } from "../../../workflows/container-contents/remoteHydration/index.js";
|
|
2
2
|
import type { ContainerContentsStoreSyncAgent, ContainerContentsStoreSyncState } from "./syncAgentTypes.js";
|
|
3
|
-
export type { ContainerState } from "
|
|
3
|
+
export type { ContainerState } from "../../../workflows/container-contents/remoteHydration/index.js";
|
|
4
4
|
export type { ContainerContentsStoreRuntime, ContainerContentsStoreSyncAgent, ContainerContentsStoreSyncState, RefreshRootLaneOptions, } from "./syncAgentTypes.js";
|
|
5
5
|
export declare function createContainerContentsStoreSyncAgent(input: {
|
|
6
6
|
host: RemoteContainerHydrationHost;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { loadLocalContainerStates } from "
|
|
2
|
-
import { isDatabaseUnavailableError, registerContainerContentsSyncLane, } from "
|
|
3
|
-
import { createRestoredAccessReconciler } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { consumePendingContainerContentsReconnectRefresh } from "
|
|
1
|
+
import { loadLocalContainerStates } from "../../../workflows/container-contents/localState.js";
|
|
2
|
+
import { isDatabaseUnavailableError, registerContainerContentsSyncLane, } from "../../../workflows/container-contents/syncLane.js";
|
|
3
|
+
import { createRestoredAccessReconciler } from "../accessRestorationSweep.js";
|
|
4
|
+
import { primeStoreDocumentSubtree } from "../documentWork/documentRecovery.js";
|
|
5
|
+
import { observeContainerBackgroundHydration } from "../hydration/backgroundHydration.js";
|
|
6
|
+
import { refreshAllRemoteHydration, refreshRootRemoteHydration, } from "../hydration/remoteHydrationRefresh.js";
|
|
7
|
+
import { requestContainerContentsRemoteHydration } from "../hydration/remoteHydrationRequest.js";
|
|
8
|
+
import { hasStartupContainerSyncWork, scheduleStaleStartupRemoteHydration, } from "../hydration/startupHydration.js";
|
|
9
|
+
import { refreshLocalContainerStates } from "../localRefresh.js";
|
|
10
|
+
import { getContainerContentsStoreLogLabel } from "../logLabel.js";
|
|
11
|
+
import { createRemoteContainerIngestionController } from "../remoteEvents/remoteContainerIngestion.js";
|
|
12
|
+
import { handleContainerContentsRemoteEvents } from "../remoteEvents/remoteEventSync.js";
|
|
13
|
+
import { consumePendingContainerContentsReconnectRefresh } from "../state.js";
|
|
14
14
|
import { runContainerContentsStoreSyncIteration } from "./syncLaneIteration.js";
|
|
15
15
|
function requestContainerContentsStoreSync(state) {
|
|
16
16
|
state.syncLane?.requestSync();
|
|
@@ -238,4 +238,4 @@ export function createContainerContentsStoreSyncAgent(input) {
|
|
|
238
238
|
scheduleSync,
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
-
//# sourceMappingURL=
|
|
241
|
+
//# sourceMappingURL=index.js.map
|