import { ServerRoles, StreamRoles } from '@speckle/shared' import { UserWithOptionalRole } from '@/modules/core/repositories/users' import { ResourceTargets } from '@/modules/serverinvites/helpers/inviteHelper' import { ServerInviteRecord, StreamInviteRecord } from '@/modules/serverinvites/domain/types' import { StreamWithOptionalRole } from '@/modules/core/repositories/streams' export type QueryAllUserStreamInvites = ( userId: string ) => Promise type FindStreamInviteArgs = { target?: string | null token?: string | null inviteId?: string | null } export type FindStreamInvite = ( streamId: string, args: FindStreamInviteArgs ) => Promise export type FindUserByTarget = (target: string) => Promise type Invite = { resourceId?: string | null resourceTarget?: typeof ResourceTargets.Streams | null } export type FindResource = ( args: Invite ) => Promise type ServerInviteRecordInsertModel = Pick< ServerInviteRecord, | 'id' | 'target' | 'inviterId' | 'message' | 'resourceTarget' | 'resourceId' | 'role' | 'token' | 'serverRole' > export type InsertInviteAndDeleteOld = ( invite: ServerInviteRecordInsertModel, alternateTargets: string[] ) => Promise export type FindServerInvite = ( email?: string, token?: string ) => Promise export type QueryAllStreamInvites = (streamId: string) => Promise export type DeleteAllStreamInvites = (streamId: string) => Promise export type DeleteServerOnlyInvites = (email?: string) => Promise export type UpdateAllInviteTargets = ( oldTargets?: string | string[], newTarget?: string ) => Promise export type DeleteStreamInvite = (inviteId?: string) => Promise export type CountServerInvites = (searchQuery: string | null) => Promise export type FindServerInvites = ( searchQuery: string | null, limit: number, offset: number ) => Promise export type QueryServerInvites = ( searchQuery: string | null, limit: number, cursor: Date | null ) => Promise export type FindInvite = (inviteId?: string) => Promise export type DeleteInvite = (inviteId?: string) => Promise export type DeleteInvitesByTarget = ( targets?: string | string[], resourceTarget?: string, resourceId?: string ) => Promise export type QueryInvites = ( inviteIds?: readonly string[] ) => Promise export type DeleteAllUserInvites = (userId: string) => Promise export type FindInviteByToken = ( inviteToken?: string ) => Promise export type CreateInviteParams = { target: string inviterId: string message?: string | null resourceTarget?: typeof ResourceTargets.Streams resourceId?: string role?: StreamRoles serverRole?: ServerRoles | null }