diff --git a/.yarn/cache/@standardnotes-domain-core-npm-1.33.1-7384cc311d-4caba6cd6f.zip b/.yarn/cache/@standardnotes-domain-core-npm-1.34.1-ad84c73ba0-29fa0ee786.zip similarity index 82% rename from .yarn/cache/@standardnotes-domain-core-npm-1.33.1-7384cc311d-4caba6cd6f.zip rename to .yarn/cache/@standardnotes-domain-core-npm-1.34.1-ad84c73ba0-29fa0ee786.zip index a45021733..4f76236bb 100644 Binary files a/.yarn/cache/@standardnotes-domain-core-npm-1.33.1-7384cc311d-4caba6cd6f.zip and b/.yarn/cache/@standardnotes-domain-core-npm-1.34.1-ad84c73ba0-29fa0ee786.zip differ diff --git a/packages/api/package.json b/packages/api/package.json index b71659235..3b07adc4e 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -36,7 +36,7 @@ }, "dependencies": { "@standardnotes/common": "^1.50.0", - "@standardnotes/domain-core": "^1.33.1", + "@standardnotes/domain-core": "^1.34.1", "@standardnotes/models": "workspace:*", "@standardnotes/responses": "workspace:*", "@standardnotes/utils": "workspace:*", diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 025f7aa9d..4876e860e 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -35,7 +35,7 @@ }, "dependencies": { "@electron/remote": "^2.0.9", - "@standardnotes/domain-core": "^1.33.1", + "@standardnotes/domain-core": "^1.34.1", "@standardnotes/electron-clear-data": "1.1.1", "@standardnotes/web": "workspace:*", "axios": "^1.1.3", diff --git a/packages/encryption/package.json b/packages/encryption/package.json index aa0612063..e4f242e6d 100644 --- a/packages/encryption/package.json +++ b/packages/encryption/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@standardnotes/common": "^1.50.0", - "@standardnotes/domain-core": "^1.33.1", + "@standardnotes/domain-core": "^1.34.1", "@standardnotes/models": "workspace:*", "@standardnotes/responses": "workspace:*", "@standardnotes/sncrypto-common": "workspace:*", diff --git a/packages/features/package.json b/packages/features/package.json index ce5146c88..e86e668db 100644 --- a/packages/features/package.json +++ b/packages/features/package.json @@ -26,7 +26,7 @@ }, "dependencies": { "@standardnotes/common": "^1.50.0", - "@standardnotes/domain-core": "^1.33.1", + "@standardnotes/domain-core": "^1.34.1", "reflect-metadata": "^0.1.13" }, "devDependencies": { diff --git a/packages/models/package.json b/packages/models/package.json index 7c257cf0a..1d20ccc45 100644 --- a/packages/models/package.json +++ b/packages/models/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "@standardnotes/common": "^1.50.0", - "@standardnotes/domain-core": "^1.33.1", + "@standardnotes/domain-core": "^1.34.1", "@standardnotes/features": "workspace:*", "@standardnotes/responses": "workspace:*", "@standardnotes/sncrypto-common": "workspace:^", diff --git a/packages/services/package.json b/packages/services/package.json index f47c58148..a9184c3e1 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -18,7 +18,7 @@ "dependencies": { "@standardnotes/api": "workspace:^", "@standardnotes/common": "^1.50.0", - "@standardnotes/domain-core": "^1.33.1", + "@standardnotes/domain-core": "^1.34.1", "@standardnotes/encryption": "workspace:^", "@standardnotes/features": "workspace:^", "@standardnotes/files": "workspace:^", diff --git a/packages/services/src/Domain/SharedVaults/SharedVaultService.ts b/packages/services/src/Domain/SharedVaults/SharedVaultService.ts index a63f9dd12..21d084727 100644 --- a/packages/services/src/Domain/SharedVaults/SharedVaultService.ts +++ b/packages/services/src/Domain/SharedVaults/SharedVaultService.ts @@ -96,7 +96,7 @@ export class SharedVaultService await this.handleNotification(event.payload as NotificationServiceEventPayload) break case SyncEvent.ReceivedRemoteSharedVaults: - void this.notifyEventSync(SharedVaultServiceEvent.SharedVaultStatusChanged) + void this.notifyEvent(SharedVaultServiceEvent.SharedVaultStatusChanged) break } } @@ -113,7 +113,20 @@ export class SharedVaultService break } case NotificationType.TYPES.UserRemovedFromSharedVault: { - this.vaultUsers.invalidateVaultUsersCache(event.eventPayload.props.primaryIdentifier.value).catch(console.error) + const vaultOrError = this._getVault.execute({ + sharedVaultUuid: event.eventPayload.props.primaryIdentifier.value, + }) + if (!vaultOrError.isFailed()) { + const vault = vaultOrError.getValue() + + this.vaultUsers + .invalidateVaultUsersCache(event.eventPayload.props.primaryIdentifier.value) + .catch(console.error) + + await this._syncLocalVaultsWithRemoteSharedVaults.execute([vault]) + + void this.notifyEvent(SharedVaultServiceEvent.SharedVaultStatusChanged) + } break } case NotificationType.TYPES.SharedVaultItemRemoved: { @@ -124,14 +137,15 @@ export class SharedVaultService break } case NotificationType.TYPES.SharedVaultFileRemoved: - case NotificationType.TYPES.SharedVaultFileUploaded: { + case NotificationType.TYPES.SharedVaultFileUploaded: + case NotificationType.TYPES.UserDesignatedAsSurvivor: { const vaultOrError = this._getVault.execute({ sharedVaultUuid: event.eventPayload.props.primaryIdentifier.value, }) if (!vaultOrError.isFailed()) { await this._syncLocalVaultsWithRemoteSharedVaults.execute([vaultOrError.getValue()]) - void this.notifyEventSync(SharedVaultServiceEvent.SharedVaultStatusChanged) + void this.notifyEvent(SharedVaultServiceEvent.SharedVaultStatusChanged) } break diff --git a/packages/snjs/mocha/TestRegistry/BaseTests.js b/packages/snjs/mocha/TestRegistry/BaseTests.js index 9e8c38d70..f0c296012 100644 --- a/packages/snjs/mocha/TestRegistry/BaseTests.js +++ b/packages/snjs/mocha/TestRegistry/BaseTests.js @@ -1,59 +1,63 @@ -export const BaseTests = [ - 'memory.test.js', - 'protocol.test.js', - 'utils.test.js', - '000.test.js', - '001.test.js', - '002.test.js', - '003.test.js', - '004.test.js', - 'username.test.js', - 'app-group.test.js', - 'application.test.js', - 'payload.test.js', - 'payload_encryption.test.js', - 'item.test.js', - 'item_manager.test.js', - 'features.test.js', - 'settings.test.js', - 'mfa_service.test.js', - 'mutator.test.js', - 'mutator_service.test.js', - 'payload_manager.test.js', - 'collections.test.js', - 'note_display_criteria.test.js', - 'keys.test.js', - 'key_params.test.js', - 'key_recovery_service.test.js', - 'backups.test.js', - 'upgrading.test.js', - 'model_tests/importing.test.js', - 'model_tests/appmodels.test.js', - 'model_tests/items.test.js', - 'model_tests/mapping.test.js', - 'model_tests/notes_smart_tags.test.js', - 'model_tests/notes_tags.test.js', - 'model_tests/notes_tags_folders.test.js', - 'model_tests/performance.test.js', - 'sync_tests/offline.test.js', - 'sync_tests/notes_tags.test.js', - 'sync_tests/online.test.js', - 'sync_tests/conflicting.test.js', - 'sync_tests/integrity.test.js', - 'auth-fringe-cases.test.js', - 'auth.test.js', - 'device_auth.test.js', - 'storage.test.js', - 'protection.test.js', - 'singletons.test.js', - 'migrations/migration.test.js', - 'migrations/tags-to-folders.test.js', - 'history.test.js', - 'actions.test.js', - 'preferences.test.js', - 'files.test.js', - 'session.test.js', - 'session-invalidation.test.js', - 'subscriptions.test.js', - 'recovery.test.js', -] +export const BaseTests = { + enabled: true, + exclusive: false, + files: [ + 'memory.test.js', + 'protocol.test.js', + 'utils.test.js', + '000.test.js', + '001.test.js', + '002.test.js', + '003.test.js', + '004.test.js', + 'username.test.js', + 'app-group.test.js', + 'application.test.js', + 'payload.test.js', + 'payload_encryption.test.js', + 'item.test.js', + 'item_manager.test.js', + 'features.test.js', + 'settings.test.js', + 'mfa_service.test.js', + 'mutator.test.js', + 'mutator_service.test.js', + 'payload_manager.test.js', + 'collections.test.js', + 'note_display_criteria.test.js', + 'keys.test.js', + 'key_params.test.js', + 'key_recovery_service.test.js', + 'backups.test.js', + 'upgrading.test.js', + 'model_tests/importing.test.js', + 'model_tests/appmodels.test.js', + 'model_tests/items.test.js', + 'model_tests/mapping.test.js', + 'model_tests/notes_smart_tags.test.js', + 'model_tests/notes_tags.test.js', + 'model_tests/notes_tags_folders.test.js', + 'model_tests/performance.test.js', + 'sync_tests/offline.test.js', + 'sync_tests/notes_tags.test.js', + 'sync_tests/online.test.js', + 'sync_tests/conflicting.test.js', + 'sync_tests/integrity.test.js', + 'auth-fringe-cases.test.js', + 'auth.test.js', + 'device_auth.test.js', + 'storage.test.js', + 'protection.test.js', + 'singletons.test.js', + 'migrations/migration.test.js', + 'migrations/tags-to-folders.test.js', + 'history.test.js', + 'actions.test.js', + 'preferences.test.js', + 'files.test.js', + 'session.test.js', + 'session-invalidation.test.js', + 'subscriptions.test.js', + 'recovery.test.js', + ] +} diff --git a/packages/snjs/mocha/TestRegistry/VaultTests.js b/packages/snjs/mocha/TestRegistry/VaultTests.js index d1df71260..38c846164 100644 --- a/packages/snjs/mocha/TestRegistry/VaultTests.js +++ b/packages/snjs/mocha/TestRegistry/VaultTests.js @@ -23,5 +23,6 @@ export const VaultTests = { 'vaults/files.test.js', 'vaults/limits.test.js', 'vaults/quota.test.js', + 'vaults/surviving.test.js', ], } diff --git a/packages/snjs/mocha/lib/Collaboration.js b/packages/snjs/mocha/lib/Collaboration.js index 2edb42629..38fe83938 100644 --- a/packages/snjs/mocha/lib/Collaboration.js +++ b/packages/snjs/mocha/lib/Collaboration.js @@ -41,7 +41,7 @@ export const acceptAllInvites = async (context) => { } } -const inviteContext = async (context, contactContext, sharedVault, contact, permission) => { +export const inviteContext = async (context, contactContext, sharedVault, contact, permission) => { contactContext.lockSyncing() const inviteOrError = await context.vaultInvites.inviteContactToSharedVault(sharedVault, contact, permission) @@ -207,3 +207,12 @@ export const moveItemToVault = async (context, sharedVault, item) => { return result.getValue() } + +export const designateSharedVaultSurvior = async (context, sharedVault, survivorUuid) => { + const result = await context.vaultUsers.designateSurvivor(sharedVault, survivorUuid) + if (result.isFailed()) { + throw new Error(result.getError()) + } + + return result.getValue() +} diff --git a/packages/snjs/mocha/test.html b/packages/snjs/mocha/test.html index a3ba9fc8c..461c1bdf2 100644 --- a/packages/snjs/mocha/test.html +++ b/packages/snjs/mocha/test.html @@ -38,6 +38,14 @@