feat(api): add listing workspace users
This commit is contained in:
Binary file not shown.
@@ -36,7 +36,7 @@
|
||||
"typescript": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/encryption": "workspace:*",
|
||||
"@standardnotes/models": "workspace:*",
|
||||
"@standardnotes/responses": "workspace:*",
|
||||
|
||||
@@ -3,4 +3,5 @@ export enum WorkspaceApiOperations {
|
||||
Inviting,
|
||||
Accepting,
|
||||
ListingWorkspaces,
|
||||
ListingWorkspaceUsers,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { WorkspaceType } from '@standardnotes/common'
|
||||
import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { HttpStatusCode } from '../../Http'
|
||||
import { WorkspaceCreationResponse } from '../../Response/Workspace/WorkspaceCreationResponse'
|
||||
import { WorkspaceInvitationAcceptingResponse } from '../../Response/Workspace/WorkspaceInvitationAcceptingResponse'
|
||||
import { WorkspaceInvitationResponse } from '../../Response/Workspace/WorkspaceInvitationResponse'
|
||||
import { WorkspaceListResponse } from '../../Response/Workspace/WorkspaceListResponse'
|
||||
import { WorkspaceUserListResponse } from '../../Response/Workspace/WorkspaceUserListResponse'
|
||||
import { WorkspaceServerInterface } from '../../Server/Workspace/WorkspaceServerInterface'
|
||||
|
||||
import { WorkspaceApiOperations } from './WorkspaceApiOperations'
|
||||
@@ -29,6 +30,10 @@ describe('WorkspaceApiService', () => {
|
||||
status: HttpStatusCode.Success,
|
||||
data: { ownedWorkspaces: [], joinedWorkspaces: [] },
|
||||
} as jest.Mocked<WorkspaceListResponse>)
|
||||
workspaceServer.listWorkspaceUsers = jest.fn().mockReturnValue({
|
||||
status: HttpStatusCode.Success,
|
||||
data: { users: [] },
|
||||
} as jest.Mocked<WorkspaceUserListResponse>)
|
||||
})
|
||||
|
||||
it('should create a workspace', async () => {
|
||||
@@ -97,7 +102,7 @@ describe('WorkspaceApiService', () => {
|
||||
const response = await createService().inviteToWorkspace({
|
||||
workspaceUuid: 'w-1-2-3',
|
||||
inviteeEmail: 'test@test.te',
|
||||
accessLevel: 'write-and-read',
|
||||
accessLevel: WorkspaceAccessLevel.WriteAndRead,
|
||||
})
|
||||
|
||||
expect(response).toEqual({
|
||||
@@ -123,7 +128,7 @@ describe('WorkspaceApiService', () => {
|
||||
await service.inviteToWorkspace({
|
||||
workspaceUuid: 'w-1-2-3',
|
||||
inviteeEmail: 'test@test.te',
|
||||
accessLevel: 'write-and-read',
|
||||
accessLevel: WorkspaceAccessLevel.WriteAndRead,
|
||||
})
|
||||
} catch (caughtError) {
|
||||
error = caughtError
|
||||
@@ -142,7 +147,7 @@ describe('WorkspaceApiService', () => {
|
||||
await createService().inviteToWorkspace({
|
||||
workspaceUuid: 'w-1-2-3',
|
||||
inviteeEmail: 'test@test.te',
|
||||
accessLevel: 'write-and-read',
|
||||
accessLevel: WorkspaceAccessLevel.WriteAndRead,
|
||||
})
|
||||
} catch (caughtError) {
|
||||
error = caughtError
|
||||
@@ -256,4 +261,47 @@ describe('WorkspaceApiService', () => {
|
||||
|
||||
expect(error).not.toBeNull()
|
||||
})
|
||||
|
||||
it('should list workspace users', async () => {
|
||||
const response = await createService().listWorkspaceUsers({ workspaceUuid: 'w-1-2-3' })
|
||||
|
||||
expect(response).toEqual({
|
||||
status: 200,
|
||||
data: {
|
||||
users: [],
|
||||
},
|
||||
})
|
||||
expect(workspaceServer.listWorkspaceUsers).toHaveBeenCalledWith({ workspaceUuid: 'w-1-2-3' })
|
||||
})
|
||||
|
||||
it('should not list workspace users if it is already listing them', async () => {
|
||||
const service = createService()
|
||||
Object.defineProperty(service, 'operationsInProgress', {
|
||||
get: () => new Map([[WorkspaceApiOperations.ListingWorkspaceUsers, true]]),
|
||||
})
|
||||
|
||||
let error = null
|
||||
try {
|
||||
await service.listWorkspaceUsers({ workspaceUuid: 'w-1-2-3' })
|
||||
} catch (caughtError) {
|
||||
error = caughtError
|
||||
}
|
||||
|
||||
expect(error).not.toBeNull()
|
||||
})
|
||||
|
||||
it('should not list workspace users if the server fails', async () => {
|
||||
workspaceServer.listWorkspaceUsers = jest.fn().mockImplementation(() => {
|
||||
throw new Error('Oops')
|
||||
})
|
||||
|
||||
let error = null
|
||||
try {
|
||||
await createService().listWorkspaceUsers({ workspaceUuid: 'w-1-2-3' })
|
||||
} catch (caughtError) {
|
||||
error = caughtError
|
||||
}
|
||||
|
||||
expect(error).not.toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Uuid, WorkspaceType } from '@standardnotes/common'
|
||||
import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
|
||||
import { ErrorMessage } from '../../Error/ErrorMessage'
|
||||
import { ApiCallError } from '../../Error/ApiCallError'
|
||||
@@ -7,6 +7,7 @@ import { WorkspaceInvitationAcceptingResponse } from '../../Response/Workspace/W
|
||||
import { WorkspaceInvitationResponse } from '../../Response/Workspace/WorkspaceInvitationResponse'
|
||||
import { WorkspaceServerInterface } from '../../Server/Workspace/WorkspaceServerInterface'
|
||||
import { WorkspaceListResponse } from '../../Response/Workspace/WorkspaceListResponse'
|
||||
import { WorkspaceUserListResponse } from '../../Response/Workspace/WorkspaceUserListResponse'
|
||||
|
||||
import { WorkspaceApiServiceInterface } from './WorkspaceApiServiceInterface'
|
||||
import { WorkspaceApiOperations } from './WorkspaceApiOperations'
|
||||
@@ -18,6 +19,20 @@ export class WorkspaceApiService implements WorkspaceApiServiceInterface {
|
||||
this.operationsInProgress = new Map()
|
||||
}
|
||||
|
||||
async listWorkspaceUsers(dto: { workspaceUuid: string }): Promise<WorkspaceUserListResponse> {
|
||||
this.lockOperation(WorkspaceApiOperations.ListingWorkspaceUsers)
|
||||
|
||||
try {
|
||||
const response = await this.workspaceServer.listWorkspaceUsers({ workspaceUuid: dto.workspaceUuid })
|
||||
|
||||
this.unlockOperation(WorkspaceApiOperations.ListingWorkspaceUsers)
|
||||
|
||||
return response
|
||||
} catch (error) {
|
||||
throw new ApiCallError(ErrorMessage.GenericFail)
|
||||
}
|
||||
}
|
||||
|
||||
async listWorkspaces(): Promise<WorkspaceListResponse> {
|
||||
this.lockOperation(WorkspaceApiOperations.ListingWorkspaces)
|
||||
|
||||
@@ -59,7 +74,7 @@ export class WorkspaceApiService implements WorkspaceApiServiceInterface {
|
||||
async inviteToWorkspace(dto: {
|
||||
inviteeEmail: string
|
||||
workspaceUuid: Uuid
|
||||
accessLevel: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
}): Promise<WorkspaceInvitationResponse> {
|
||||
this.lockOperation(WorkspaceApiOperations.Inviting)
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Uuid, WorkspaceType } from '@standardnotes/common'
|
||||
import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
|
||||
import { WorkspaceCreationResponse } from '../../Response/Workspace/WorkspaceCreationResponse'
|
||||
import { WorkspaceInvitationAcceptingResponse } from '../../Response/Workspace/WorkspaceInvitationAcceptingResponse'
|
||||
import { WorkspaceInvitationResponse } from '../../Response/Workspace/WorkspaceInvitationResponse'
|
||||
import { WorkspaceListResponse } from '../../Response/Workspace/WorkspaceListResponse'
|
||||
import { WorkspaceUserListResponse } from '../../Response/Workspace/WorkspaceUserListResponse'
|
||||
|
||||
export interface WorkspaceApiServiceInterface {
|
||||
createWorkspace(dto: {
|
||||
@@ -16,7 +17,7 @@ export interface WorkspaceApiServiceInterface {
|
||||
inviteToWorkspace(dto: {
|
||||
inviteeEmail: string
|
||||
workspaceUuid: Uuid
|
||||
accessLevel: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
}): Promise<WorkspaceInvitationResponse>
|
||||
acceptInvite(dto: {
|
||||
inviteUuid: Uuid
|
||||
@@ -25,4 +26,5 @@ export interface WorkspaceApiServiceInterface {
|
||||
encryptedPrivateKey: string
|
||||
}): Promise<WorkspaceInvitationAcceptingResponse>
|
||||
listWorkspaces(): Promise<WorkspaceListResponse>
|
||||
listWorkspaceUsers(dto: { workspaceUuid: Uuid }): Promise<WorkspaceUserListResponse>
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { Uuid, WorkspaceAccessLevel } from '@standardnotes/common'
|
||||
|
||||
export type WorkspaceInvitationRequestParams = {
|
||||
workspaceUuid: Uuid
|
||||
inviteeEmail: string
|
||||
accessLevel: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
[additionalParam: string]: unknown
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
|
||||
export type WorkspaceUserListRequestParams = {
|
||||
workspaceUuid: Uuid
|
||||
[additionalParam: string]: unknown
|
||||
}
|
||||
@@ -10,3 +10,4 @@ export * from './Workspace/WorkspaceCreationRequestParams'
|
||||
export * from './Workspace/WorkspaceInvitationAcceptingRequestParams'
|
||||
export * from './Workspace/WorkspaceInvitationRequestParams'
|
||||
export * from './Workspace/WorkspaceListRequestParams'
|
||||
export * from './Workspace/WorkspaceUserListRequestParams'
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Either } from '@standardnotes/common'
|
||||
|
||||
import { HttpErrorResponseBody } from '../../Http/HttpErrorResponseBody'
|
||||
import { HttpResponse } from '../../Http/HttpResponse'
|
||||
import { WorkspaceUserListResponseBody } from './WorkspaceUserListResponseBody'
|
||||
|
||||
export interface WorkspaceUserListResponse extends HttpResponse {
|
||||
data: Either<WorkspaceUserListResponseBody, HttpErrorResponseBody>
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { WorkspaceUser } from '@standardnotes/models'
|
||||
|
||||
export type WorkspaceUserListResponseBody = {
|
||||
users: Array<WorkspaceUser>
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { Uuid } from '@standardnotes/common'
|
||||
const WorkspacePaths = {
|
||||
createWorkspace: '/v1/workspaces',
|
||||
listWorkspaces: '/v1/workspaces',
|
||||
listWorkspaceUsers: (uuid: Uuid) => `/v1/workspaces/${uuid}/users`,
|
||||
inviteToWorkspace: (uuid: Uuid) => `/v1/workspaces/${uuid}/invites`,
|
||||
acceptInvite: (uuid: Uuid) => `/v1/invites/${uuid}/accept`,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { WorkspaceType } from '@standardnotes/common'
|
||||
import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { HttpServiceInterface, HttpStatusCode } from '../../Http'
|
||||
import { WorkspaceCreationResponse } from '../../Response/Workspace/WorkspaceCreationResponse'
|
||||
import { WorkspaceInvitationAcceptingResponse } from '../../Response/Workspace/WorkspaceInvitationAcceptingResponse'
|
||||
import { WorkspaceInvitationResponse } from '../../Response/Workspace/WorkspaceInvitationResponse'
|
||||
import { WorkspaceListResponse } from '../../Response/Workspace/WorkspaceListResponse'
|
||||
import { WorkspaceUserListResponse } from '../../Response/Workspace/WorkspaceUserListResponse'
|
||||
|
||||
import { WorkspaceServer } from './WorkspaceServer'
|
||||
|
||||
@@ -42,7 +43,7 @@ describe('WorkspaceServer', () => {
|
||||
const response = await createServer().inviteToWorkspace({
|
||||
inviteeEmail: 'test@test.te',
|
||||
workspaceUuid: 'w-1-2-3',
|
||||
accessLevel: 'write-and-read',
|
||||
accessLevel: WorkspaceAccessLevel.WriteAndRead,
|
||||
})
|
||||
|
||||
expect(response).toEqual({
|
||||
@@ -84,4 +85,18 @@ describe('WorkspaceServer', () => {
|
||||
data: { ownedWorkspaces: [], joinedWorkspaces: [] },
|
||||
})
|
||||
})
|
||||
|
||||
it('should list workspace users', async () => {
|
||||
httpService.get = jest.fn().mockReturnValue({
|
||||
status: HttpStatusCode.Success,
|
||||
data: { users: [] },
|
||||
} as jest.Mocked<WorkspaceUserListResponse>)
|
||||
|
||||
const response = await createServer().listWorkspaceUsers({ workspaceUuid: 'w-1-2-3' })
|
||||
|
||||
expect(response).toEqual({
|
||||
status: 200,
|
||||
data: { users: [] },
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -7,6 +7,8 @@ import { WorkspaceInvitationAcceptingRequestParams } from '../../Request/Workspa
|
||||
import { WorkspaceInvitationAcceptingResponse } from '../../Response/Workspace/WorkspaceInvitationAcceptingResponse'
|
||||
import { WorkspaceListRequestParams } from '../../Request/Workspace/WorkspaceListRequestParams'
|
||||
import { WorkspaceListResponse } from '../../Response/Workspace/WorkspaceListResponse'
|
||||
import { WorkspaceUserListRequestParams } from '../../Request/Workspace/WorkspaceUserListRequestParams'
|
||||
import { WorkspaceUserListResponse } from '../../Response/Workspace/WorkspaceUserListResponse'
|
||||
|
||||
import { Paths } from './Paths'
|
||||
import { WorkspaceServerInterface } from './WorkspaceServerInterface'
|
||||
@@ -14,6 +16,12 @@ import { WorkspaceServerInterface } from './WorkspaceServerInterface'
|
||||
export class WorkspaceServer implements WorkspaceServerInterface {
|
||||
constructor(private httpService: HttpServiceInterface) {}
|
||||
|
||||
async listWorkspaceUsers(params: WorkspaceUserListRequestParams): Promise<WorkspaceUserListResponse> {
|
||||
const response = await this.httpService.get(Paths.v1.listWorkspaceUsers(params.workspaceUuid), params)
|
||||
|
||||
return response as WorkspaceUserListResponse
|
||||
}
|
||||
|
||||
async listWorkspaces(params: WorkspaceListRequestParams): Promise<WorkspaceListResponse> {
|
||||
const response = await this.httpService.get(Paths.v1.listWorkspaces, params)
|
||||
|
||||
|
||||
@@ -6,10 +6,13 @@ import { WorkspaceInvitationAcceptingRequestParams } from '../../Request/Workspa
|
||||
import { WorkspaceInvitationAcceptingResponse } from '../../Response/Workspace/WorkspaceInvitationAcceptingResponse'
|
||||
import { WorkspaceListRequestParams } from '../../Request/Workspace/WorkspaceListRequestParams'
|
||||
import { WorkspaceListResponse } from '../../Response/Workspace/WorkspaceListResponse'
|
||||
import { WorkspaceUserListRequestParams } from '../../Request/Workspace/WorkspaceUserListRequestParams'
|
||||
import { WorkspaceUserListResponse } from '../../Response/Workspace/WorkspaceUserListResponse'
|
||||
|
||||
export interface WorkspaceServerInterface {
|
||||
createWorkspace(params: WorkspaceCreationRequestParams): Promise<WorkspaceCreationResponse>
|
||||
listWorkspaces(params: WorkspaceListRequestParams): Promise<WorkspaceListResponse>
|
||||
listWorkspaceUsers(params: WorkspaceUserListRequestParams): Promise<WorkspaceUserListResponse>
|
||||
inviteToWorkspace(params: WorkspaceInvitationRequestParams): Promise<WorkspaceInvitationResponse>
|
||||
acceptInvite(params: WorkspaceInvitationAcceptingRequestParams): Promise<WorkspaceInvitationAcceptingResponse>
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"typescript": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/models": "workspace:*",
|
||||
"@standardnotes/responses": "workspace:*",
|
||||
"@standardnotes/sncrypto-common": "workspace:*",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/auth": "^3.19.4",
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/security": "^1.2.0",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
},
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"ts-node": "^10.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/files": "workspace:*",
|
||||
"@standardnotes/utils": "workspace:*",
|
||||
"@types/wicg-file-system-access": "^2020.9.5",
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"ts-jest": "^28.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/encryption": "workspace:*",
|
||||
"@standardnotes/models": "workspace:*",
|
||||
"@standardnotes/responses": "workspace:*",
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"typescript": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/features": "workspace:*",
|
||||
"@standardnotes/responses": "workspace:*",
|
||||
"@standardnotes/utils": "workspace:*",
|
||||
|
||||
16
packages/models/src/Domain/Api/Workspace/WorkspaceUser.ts
Normal file
16
packages/models/src/Domain/Api/Workspace/WorkspaceUser.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Uuid, WorkspaceAccessLevel, WorkspaceUserStatus } from '@standardnotes/common'
|
||||
|
||||
export type WorkspaceUser = {
|
||||
uuid: Uuid
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
userUuid: Uuid
|
||||
userDisplayName: string | null
|
||||
workspaceUuid: Uuid
|
||||
encryptedWorkspaceKey: string | null
|
||||
publicKey: string | null
|
||||
encryptedPrivateKey: string | null
|
||||
status: WorkspaceUserStatus
|
||||
keyRotationIndex: number
|
||||
createdAt: number
|
||||
updatedAt: number
|
||||
}
|
||||
@@ -29,6 +29,7 @@ export * from './Api/Subscription/InvitationStatus'
|
||||
export * from './Api/Subscription/InviteeIdentifierType'
|
||||
export * from './Api/Subscription/InviterIdentifierType'
|
||||
export * from './Api/Workspace/Workspace'
|
||||
export * from './Api/Workspace/WorkspaceUser'
|
||||
export * from './Device/Environment'
|
||||
export * from './Device/Platform'
|
||||
export * from './Local/KeyParams/RootKeyParamsInterface'
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"ts-jest": "^28.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/features": "workspace:*",
|
||||
"@standardnotes/security": "^1.1.0",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"dependencies": {
|
||||
"@standardnotes/api": "workspace:^",
|
||||
"@standardnotes/auth": "^3.19.4",
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/encryption": "workspace:^",
|
||||
"@standardnotes/files": "workspace:^",
|
||||
"@standardnotes/models": "workspace:^",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Uuid, WorkspaceType } from '@standardnotes/common'
|
||||
import { Workspace } from '@standardnotes/models'
|
||||
import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { Workspace, WorkspaceUser } from '@standardnotes/models'
|
||||
|
||||
export interface WorkspaceClientInterface {
|
||||
createWorkspace(dto: {
|
||||
@@ -12,7 +12,7 @@ export interface WorkspaceClientInterface {
|
||||
inviteToWorkspace(dto: {
|
||||
inviteeEmail: string
|
||||
workspaceUuid: Uuid
|
||||
accessLevel: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
}): Promise<{ uuid: string } | null>
|
||||
acceptInvite(dto: {
|
||||
inviteUuid: Uuid
|
||||
@@ -21,4 +21,5 @@ export interface WorkspaceClientInterface {
|
||||
encryptedPrivateKey: string
|
||||
}): Promise<{ success: boolean }>
|
||||
listWorkspaces(): Promise<{ ownedWorkspaces: Array<Workspace>; joinedWorkspaces: Array<Workspace> }>
|
||||
listWorkspaceUsers(dto: { workspaceUuid: Uuid }): Promise<{ users: Array<WorkspaceUser> }>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { WorkspaceApiServiceInterface } from '@standardnotes/api'
|
||||
import { Uuid, WorkspaceType } from '@standardnotes/common'
|
||||
import { Workspace } from '@standardnotes/models'
|
||||
import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { Workspace, WorkspaceUser } from '@standardnotes/models'
|
||||
|
||||
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
|
||||
import { AbstractService } from '../Service/AbstractService'
|
||||
@@ -14,6 +14,20 @@ export class WorkspaceManager extends AbstractService implements WorkspaceClient
|
||||
super(internalEventBus)
|
||||
}
|
||||
|
||||
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()
|
||||
@@ -50,7 +64,7 @@ export class WorkspaceManager extends AbstractService implements WorkspaceClient
|
||||
async inviteToWorkspace(dto: {
|
||||
inviteeEmail: string
|
||||
workspaceUuid: Uuid
|
||||
accessLevel: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
}): Promise<{ uuid: string } | null> {
|
||||
try {
|
||||
const result = await this.workspaceApiService.inviteToWorkspace(dto)
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/api": "workspace:*",
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/domain-events": "^2.39.0",
|
||||
"@standardnotes/encryption": "workspace:*",
|
||||
"@standardnotes/features": "workspace:*",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"test": "jest spec --coverage --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"@standardnotes/filepicker": "workspace:^",
|
||||
"@standardnotes/services": "workspace:^",
|
||||
"@standardnotes/styles": "workspace:^",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"test": "jest spec"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/common": "^1.36.1",
|
||||
"@standardnotes/common": "^1.39.0",
|
||||
"dompurify": "^2.3.8",
|
||||
"lodash": "^4.17.21",
|
||||
"reflect-metadata": "^0.1.13"
|
||||
|
||||
30
yarn.lock
30
yarn.lock
@@ -6068,7 +6068,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/api@workspace:packages/api"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/encryption": "workspace:*"
|
||||
"@standardnotes/models": "workspace:*"
|
||||
"@standardnotes/responses": "workspace:*"
|
||||
@@ -6251,12 +6251,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@standardnotes/common@npm:^1.36.1":
|
||||
version: 1.36.1
|
||||
resolution: "@standardnotes/common@npm:1.36.1"
|
||||
"@standardnotes/common@npm:^1.39.0":
|
||||
version: 1.39.0
|
||||
resolution: "@standardnotes/common@npm:1.39.0"
|
||||
dependencies:
|
||||
reflect-metadata: ^0.1.13
|
||||
checksum: 4f2367d461aa1cd4e3ec132520310773183c3c9f8e423565aec315f5e5dffdce79f9704307a32fbfec17157f99d37d49982ad4272eee5aac0dbe37da34be054c
|
||||
checksum: 92cfad04a631cdcf971516be4bf0e066e9cb6e894017102ac406cd8964282e088653ebed282d7624f371d617418edce124d12a62964723697ed7fa33b6d6e4d0
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6443,7 +6443,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/encryption@workspace:packages/encryption"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/config": 2.4.3
|
||||
"@standardnotes/models": "workspace:*"
|
||||
"@standardnotes/responses": "workspace:*"
|
||||
@@ -6485,7 +6485,7 @@ __metadata:
|
||||
resolution: "@standardnotes/features@workspace:packages/features"
|
||||
dependencies:
|
||||
"@standardnotes/auth": ^3.19.4
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/security": ^1.2.0
|
||||
"@types/jest": ^28.1.5
|
||||
"@typescript-eslint/eslint-plugin": ^5.30.0
|
||||
@@ -6501,7 +6501,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/filepicker@workspace:packages/filepicker"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/files": "workspace:*"
|
||||
"@standardnotes/utils": "workspace:*"
|
||||
"@types/jest": ^28.1.5
|
||||
@@ -6519,7 +6519,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/files@workspace:packages/files"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/encryption": "workspace:*"
|
||||
"@standardnotes/models": "workspace:*"
|
||||
"@standardnotes/responses": "workspace:*"
|
||||
@@ -6905,7 +6905,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/models@workspace:packages/models"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/features": "workspace:*"
|
||||
"@standardnotes/responses": "workspace:*"
|
||||
"@standardnotes/utils": "workspace:*"
|
||||
@@ -6972,7 +6972,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/responses@workspace:packages/responses"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/features": "workspace:*"
|
||||
"@standardnotes/security": ^1.1.0
|
||||
"@types/jest": ^28.1.5
|
||||
@@ -7041,7 +7041,7 @@ __metadata:
|
||||
dependencies:
|
||||
"@standardnotes/api": "workspace:^"
|
||||
"@standardnotes/auth": ^3.19.4
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/encryption": "workspace:^"
|
||||
"@standardnotes/files": "workspace:^"
|
||||
"@standardnotes/models": "workspace:^"
|
||||
@@ -7156,7 +7156,7 @@ __metadata:
|
||||
"@babel/core": "*"
|
||||
"@babel/preset-env": "*"
|
||||
"@standardnotes/api": "workspace:*"
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/domain-events": ^2.39.0
|
||||
"@standardnotes/encryption": "workspace:*"
|
||||
"@standardnotes/features": "workspace:*"
|
||||
@@ -7309,7 +7309,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/ui-services@workspace:packages/ui-services"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@standardnotes/filepicker": "workspace:^"
|
||||
"@standardnotes/services": "workspace:^"
|
||||
"@standardnotes/styles": "workspace:^"
|
||||
@@ -7329,7 +7329,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/utils@workspace:packages/utils"
|
||||
dependencies:
|
||||
"@standardnotes/common": ^1.36.1
|
||||
"@standardnotes/common": ^1.39.0
|
||||
"@types/dompurify": ^2.3.3
|
||||
"@types/jest": ^28.1.5
|
||||
"@types/jsdom": ^16.2.14
|
||||
|
||||
Reference in New Issue
Block a user