chore: remove workspaces from code base (#2220)
This commit is contained in:
@@ -9,7 +9,6 @@ import { ApplicationEventCallback } from '../Event/ApplicationEventCallback'
|
||||
import { FeaturesClientInterface } from '../Feature/FeaturesClientInterface'
|
||||
import { SubscriptionClientInterface } from '../Subscription/SubscriptionClientInterface'
|
||||
import { DeviceInterface } from '../Device/DeviceInterface'
|
||||
import { WorkspaceClientInterface } from '../Workspace/WorkspaceClientInterface'
|
||||
import { ItemsClientInterface } from '../Item/ItemsClientInterface'
|
||||
import { MutatorClientInterface } from '../Mutator/MutatorClientInterface'
|
||||
import { StorageValueModes } from '../Storage/StorageTypes'
|
||||
@@ -51,7 +50,6 @@ export interface ApplicationInterface {
|
||||
get user(): UserClientInterface
|
||||
get files(): FilesClientInterface
|
||||
get subscriptions(): SubscriptionClientInterface
|
||||
get workspaces(): WorkspaceClientInterface
|
||||
readonly identifier: ApplicationIdentifier
|
||||
readonly platform: Platform
|
||||
deviceInterface: DeviceInterface
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { Workspace, WorkspaceUser } from '@standardnotes/api'
|
||||
|
||||
export interface WorkspaceClientInterface {
|
||||
createWorkspace(dto: {
|
||||
workspaceType: WorkspaceType
|
||||
encryptedWorkspaceKey?: string
|
||||
encryptedPrivateKey?: string
|
||||
publicKey?: string
|
||||
workspaceName?: string
|
||||
}): Promise<{ uuid: string } | null>
|
||||
inviteToWorkspace(dto: {
|
||||
inviteeEmail: string
|
||||
workspaceUuid: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
}): Promise<{ uuid: string } | null>
|
||||
acceptInvite(dto: {
|
||||
inviteUuid: string
|
||||
userUuid: string
|
||||
publicKey: string
|
||||
encryptedPrivateKey: string
|
||||
}): Promise<{ success: boolean }>
|
||||
listWorkspaces(): Promise<{ ownedWorkspaces: Array<Workspace>; joinedWorkspaces: Array<Workspace> }>
|
||||
listWorkspaceUsers(dto: { workspaceUuid: string }): Promise<{ users: Array<WorkspaceUser> }>
|
||||
initiateKeyshare(dto: {
|
||||
workspaceUuid: string
|
||||
userUuid: string
|
||||
encryptedWorkspaceKey: string
|
||||
}): Promise<{ success: boolean }>
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
import { WorkspaceApiServiceInterface, Workspace, WorkspaceUser } from '@standardnotes/api'
|
||||
import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
|
||||
import { AbstractService } from '../Service/AbstractService'
|
||||
import { WorkspaceClientInterface } from './WorkspaceClientInterface'
|
||||
|
||||
export class WorkspaceManager extends AbstractService implements WorkspaceClientInterface {
|
||||
constructor(
|
||||
private workspaceApiService: WorkspaceApiServiceInterface,
|
||||
protected override internalEventBus: InternalEventBusInterface,
|
||||
) {
|
||||
super(internalEventBus)
|
||||
}
|
||||
|
||||
async initiateKeyshare(dto: {
|
||||
workspaceUuid: string
|
||||
userUuid: string
|
||||
encryptedWorkspaceKey: string
|
||||
}): Promise<{ success: boolean }> {
|
||||
try {
|
||||
const result = await this.workspaceApiService.initiateKeyshare(dto)
|
||||
|
||||
if (result.data.error !== undefined) {
|
||||
return { success: false }
|
||||
}
|
||||
|
||||
return result.data
|
||||
} catch (error) {
|
||||
return { success: false }
|
||||
}
|
||||
}
|
||||
|
||||
async listWorkspaceUsers(dto: { workspaceUuid: string }): Promise<{ users: WorkspaceUser[] }> {
|
||||
try {
|
||||
const result = await this.workspaceApiService.listWorkspaceUsers(dto)
|
||||
|
||||
if (result.data.error !== undefined) {
|
||||
return { users: [] }
|
||||
}
|
||||
|
||||
return result.data
|
||||
} catch (error) {
|
||||
return { users: [] }
|
||||
}
|
||||
}
|
||||
|
||||
async listWorkspaces(): Promise<{ ownedWorkspaces: Workspace[]; joinedWorkspaces: Workspace[] }> {
|
||||
try {
|
||||
const result = await this.workspaceApiService.listWorkspaces()
|
||||
|
||||
if (result.data.error !== undefined) {
|
||||
return { ownedWorkspaces: [], joinedWorkspaces: [] }
|
||||
}
|
||||
|
||||
return result.data
|
||||
} catch (error) {
|
||||
return { ownedWorkspaces: [], joinedWorkspaces: [] }
|
||||
}
|
||||
}
|
||||
|
||||
async acceptInvite(dto: {
|
||||
inviteUuid: string
|
||||
userUuid: string
|
||||
publicKey: string
|
||||
encryptedPrivateKey: string
|
||||
}): Promise<{ success: boolean }> {
|
||||
try {
|
||||
const result = await this.workspaceApiService.acceptInvite(dto)
|
||||
|
||||
if (result.data.error !== undefined) {
|
||||
return { success: false }
|
||||
}
|
||||
|
||||
return result.data
|
||||
} catch (error) {
|
||||
return { success: false }
|
||||
}
|
||||
}
|
||||
|
||||
async inviteToWorkspace(dto: {
|
||||
inviteeEmail: string
|
||||
workspaceUuid: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
}): Promise<{ uuid: string } | null> {
|
||||
try {
|
||||
const result = await this.workspaceApiService.inviteToWorkspace(dto)
|
||||
|
||||
if (result.data.error !== undefined) {
|
||||
return null
|
||||
}
|
||||
|
||||
return result.data
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
async createWorkspace(dto: {
|
||||
workspaceType: WorkspaceType
|
||||
encryptedWorkspaceKey?: string
|
||||
encryptedPrivateKey?: string
|
||||
publicKey?: string
|
||||
workspaceName?: string
|
||||
}): Promise<{ uuid: string } | null> {
|
||||
try {
|
||||
const result = await this.workspaceApiService.createWorkspace(dto)
|
||||
|
||||
if (result.data.error !== undefined) {
|
||||
return null
|
||||
}
|
||||
|
||||
return result.data
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,5 +94,3 @@ export * from './Sync/SyncServiceInterface'
|
||||
export * from './Sync/SyncSource'
|
||||
export * from './User/UserClientInterface'
|
||||
export * from './User/UserService'
|
||||
export * from './Workspace/WorkspaceClientInterface'
|
||||
export * from './Workspace/WorkspaceManager'
|
||||
|
||||
Reference in New Issue
Block a user