chore: remove workspaces from code base (#2220)
This commit is contained in:
@@ -22,10 +22,6 @@ import {
|
||||
WebSocketApiServiceInterface,
|
||||
WebSocketServer,
|
||||
WebSocketServerInterface,
|
||||
WorkspaceApiService,
|
||||
WorkspaceApiServiceInterface,
|
||||
WorkspaceServer,
|
||||
WorkspaceServerInterface,
|
||||
} from '@standardnotes/api'
|
||||
import * as Common from '@standardnotes/common'
|
||||
import * as ExternalServices from '@standardnotes/services'
|
||||
@@ -57,8 +53,6 @@ import {
|
||||
FileService,
|
||||
SubscriptionClientInterface,
|
||||
SubscriptionManager,
|
||||
WorkspaceClientInterface,
|
||||
WorkspaceManager,
|
||||
ChallengePrompt,
|
||||
Challenge,
|
||||
ErrorAlertStrings,
|
||||
@@ -155,9 +149,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
private declare subscriptionApiService: SubscriptionApiServiceInterface
|
||||
private declare subscriptionServer: SubscriptionServerInterface
|
||||
private declare subscriptionManager: SubscriptionClientInterface
|
||||
private declare workspaceApiService: WorkspaceApiServiceInterface
|
||||
private declare workspaceServer: WorkspaceServerInterface
|
||||
private declare workspaceManager: WorkspaceClientInterface
|
||||
private declare webSocketApiService: WebSocketApiServiceInterface
|
||||
private declare webSocketServer: WebSocketServerInterface
|
||||
private sessionManager!: InternalServices.SNSessionManager
|
||||
@@ -275,10 +266,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return this.subscriptionManager
|
||||
}
|
||||
|
||||
get workspaces(): ExternalServices.WorkspaceClientInterface {
|
||||
return this.workspaceManager
|
||||
}
|
||||
|
||||
get signInWithRecoveryCodes(): UseCaseInterface<void> {
|
||||
return this._signInWithRecoveryCodes
|
||||
}
|
||||
@@ -1184,9 +1171,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
this.createWebSocketServer()
|
||||
this.createWebSocketApiService()
|
||||
this.createSubscriptionManager()
|
||||
this.createWorkspaceServer()
|
||||
this.createWorkspaceApiService()
|
||||
this.createWorkspaceManager()
|
||||
this.createWebSocketsService()
|
||||
this.createSessionManager()
|
||||
this.createHistoryManager()
|
||||
@@ -1235,9 +1219,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
;(this.subscriptionApiService as unknown) = undefined
|
||||
;(this.subscriptionServer as unknown) = undefined
|
||||
;(this.subscriptionManager as unknown) = undefined
|
||||
;(this.workspaceApiService as unknown) = undefined
|
||||
;(this.workspaceServer as unknown) = undefined
|
||||
;(this.workspaceManager as unknown) = undefined
|
||||
;(this.webSocketApiService as unknown) = undefined
|
||||
;(this.webSocketServer as unknown) = undefined
|
||||
;(this.sessionManager as unknown) = undefined
|
||||
@@ -1484,18 +1465,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
this.subscriptionManager = new SubscriptionManager(this.subscriptionApiService, this.internalEventBus)
|
||||
}
|
||||
|
||||
private createWorkspaceServer() {
|
||||
this.workspaceServer = new WorkspaceServer(this.httpService)
|
||||
}
|
||||
|
||||
private createWorkspaceApiService() {
|
||||
this.workspaceApiService = new WorkspaceApiService(this.workspaceServer)
|
||||
}
|
||||
|
||||
private createWorkspaceManager() {
|
||||
this.workspaceManager = new WorkspaceManager(this.workspaceApiService, this.internalEventBus)
|
||||
}
|
||||
|
||||
private createItemManager() {
|
||||
this.itemManager = new InternalServices.ItemManager(this.payloadManager, this.internalEventBus)
|
||||
this.services.push(this.itemManager)
|
||||
|
||||
@@ -88,7 +88,6 @@
|
||||
<script type="module" src="files.test.js"></script>
|
||||
<script type="module" src="session.test.js"></script>
|
||||
<script type="module" src="subscriptions.test.js"></script>
|
||||
<script type="module" src="workspaces.test.js"></script>
|
||||
<script type="module" src="recovery.test.js"></script>
|
||||
<script type="module">
|
||||
mocha.run();
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
import * as Factory from './lib/factory.js'
|
||||
chai.use(chaiAsPromised)
|
||||
const expect = chai.expect
|
||||
|
||||
describe.skip('workspaces', function () {
|
||||
this.timeout(Factory.TwentySecondTimeout)
|
||||
|
||||
let ownerContext
|
||||
let owner
|
||||
let inviteeContext
|
||||
let invitee
|
||||
|
||||
afterEach(async function () {
|
||||
await Factory.safeDeinit(ownerContext.application)
|
||||
await Factory.safeDeinit(inviteeContext.application)
|
||||
localStorage.clear()
|
||||
})
|
||||
|
||||
beforeEach(async function () {
|
||||
localStorage.clear()
|
||||
|
||||
ownerContext = await Factory.createAppContextWithFakeCrypto()
|
||||
await ownerContext.launch()
|
||||
const ownerRegistrationResponse = await ownerContext.register()
|
||||
owner = ownerRegistrationResponse.user
|
||||
|
||||
inviteeContext = await Factory.createAppContextWithFakeCrypto()
|
||||
await inviteeContext.launch()
|
||||
const inviteeRegistrationResponse = await inviteeContext.register()
|
||||
invitee = inviteeRegistrationResponse.user
|
||||
})
|
||||
|
||||
it('should create workspaces for user', async () => {
|
||||
await ownerContext.application.workspaceManager.createWorkspace({
|
||||
workspaceType: 'team',
|
||||
encryptedWorkspaceKey: 'foo',
|
||||
encryptedPrivateKey: 'bar',
|
||||
publicKey: 'buzz',
|
||||
workspaceName: 'Acme Team',
|
||||
})
|
||||
|
||||
await ownerContext.application.workspaceManager.createWorkspace({
|
||||
workspaceType: 'private',
|
||||
encryptedWorkspaceKey: 'foo',
|
||||
encryptedPrivateKey: 'bar',
|
||||
publicKey: 'buzz',
|
||||
})
|
||||
|
||||
const { ownedWorkspaces, joinedWorkspaces } = await ownerContext.application.workspaceManager.listWorkspaces()
|
||||
|
||||
expect(joinedWorkspaces.length).to.equal(0)
|
||||
|
||||
expect(ownedWorkspaces.length).to.equal(2)
|
||||
})
|
||||
|
||||
it('should allow inviting and adding users to a workspace', async () => {
|
||||
const { uuid } = await ownerContext.application.workspaceManager.createWorkspace({
|
||||
workspaceType: 'team',
|
||||
encryptedWorkspaceKey: 'foo',
|
||||
encryptedPrivateKey: 'bar',
|
||||
publicKey: 'buzz',
|
||||
workspaceName: 'Acme Team',
|
||||
})
|
||||
|
||||
const result = await ownerContext.application.workspaceManager.inviteToWorkspace({
|
||||
inviteeEmail: 'test@standardnotes.com',
|
||||
workspaceUuid: uuid,
|
||||
accessLevel: 'read-only'
|
||||
})
|
||||
|
||||
await inviteeContext.application.workspaceManager.acceptInvite({
|
||||
inviteUuid: result.uuid,
|
||||
userUuid: invitee.uuid,
|
||||
publicKey: 'foobar',
|
||||
encryptedPrivateKey: 'buzz',
|
||||
})
|
||||
|
||||
let listUsersResult = await inviteeContext.application.workspaceManager.listWorkspaceUsers({ workspaceUuid: uuid })
|
||||
let inviteeAssociation = listUsersResult.users.find(user => user.userDisplayName === 'test@standardnotes.com')
|
||||
|
||||
expect(inviteeAssociation.userUuid).to.equal(invitee.uuid)
|
||||
expect(inviteeAssociation.status).to.equal('pending-keyshare')
|
||||
|
||||
await ownerContext.application.workspaceManager.initiateKeyshare({
|
||||
workspaceUuid: inviteeAssociation.workspaceUuid,
|
||||
userUuid: inviteeAssociation.userUuid,
|
||||
encryptedWorkspaceKey: 'foobarbuzz',
|
||||
})
|
||||
|
||||
listUsersResult = await inviteeContext.application.workspaceManager.listWorkspaceUsers({ workspaceUuid: uuid })
|
||||
inviteeAssociation = listUsersResult.users.find(user => user.userDisplayName === 'test@standardnotes.com')
|
||||
|
||||
expect(inviteeAssociation.userUuid).to.equal(invitee.uuid)
|
||||
expect(inviteeAssociation.status).to.equal('active')
|
||||
expect(inviteeAssociation.encryptedWorkspaceKey).to.equal('foobarbuzz')
|
||||
|
||||
const { ownedWorkspaces, joinedWorkspaces } = await inviteeContext.application.workspaceManager.listWorkspaces()
|
||||
|
||||
expect(joinedWorkspaces.length).to.equal(1)
|
||||
|
||||
expect(ownedWorkspaces.length).to.equal(0)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user