refactor: remove Uuid and RoleName from @standardnotes/common in favour of @standardnotes/domain-core value objects (#2167)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Either, Uuid } from '@standardnotes/common'
|
||||
import { Either } from '@standardnotes/common'
|
||||
import { Role } from '@standardnotes/auth'
|
||||
import { FilesApiInterface } from '@standardnotes/files'
|
||||
import { Session } from '@standardnotes/domain-core'
|
||||
@@ -13,7 +13,7 @@ export enum ApiServiceEvent {
|
||||
}
|
||||
|
||||
export type MetaReceivedData = {
|
||||
userUuid: Uuid
|
||||
userUuid: string
|
||||
userRoles: Role[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { EncryptionProviderInterface } from '@standardnotes/encryption'
|
||||
import { PayloadEmitSource, FileItem, CreateEncryptedBackupFileContextPayload } from '@standardnotes/models'
|
||||
import { ClientDisplayableError } from '@standardnotes/responses'
|
||||
@@ -20,7 +20,7 @@ import { log, LoggingDomain } from '../Logging'
|
||||
|
||||
export class FilesBackupService extends AbstractService implements BackupServiceInterface {
|
||||
private itemsObserverDisposer: () => void
|
||||
private pendingFiles = new Set<Uuid>()
|
||||
private pendingFiles = new Set<string>()
|
||||
private mappingCache?: FileBackupsMapping['files']
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ComponentArea, FeatureIdentifier } from '@standardnotes/features'
|
||||
import { ActionObserver, PermissionDialog, SNComponent, SNNote } from '@standardnotes/models'
|
||||
|
||||
@@ -15,7 +14,7 @@ export interface ComponentManagerInterface {
|
||||
destroyComponentViewer(viewer: ComponentViewerInterface): void
|
||||
createComponentViewer(
|
||||
component: SNComponent,
|
||||
contextItem?: Uuid,
|
||||
contextItem?: string,
|
||||
actionObserver?: ActionObserver,
|
||||
urlOverride?: string,
|
||||
): ComponentViewerInterface
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DatabaseItemMetadata } from './DatabaseItemMetadata'
|
||||
import { DatabaseLoadOptions } from './DatabaseLoadOptions'
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
|
||||
/**
|
||||
* Sorts payloads according by most recently modified first, according to the priority,
|
||||
@@ -47,7 +47,7 @@ function SortPayloadsByRecentAndContentPriority<T extends DatabaseItemMetadata =
|
||||
*/
|
||||
function SortPayloadsByRecentAndUuidPriority<T extends DatabaseItemMetadata = DatabaseItemMetadata>(
|
||||
payloads: T[],
|
||||
uuidPriorityList: Uuid[],
|
||||
uuidPriorityList: string[],
|
||||
): T[] {
|
||||
return payloads.sort((a, b) => {
|
||||
const dateResult = new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { FeatureDescription, FeatureIdentifier } from '@standardnotes/features'
|
||||
import { SNComponent } from '@standardnotes/models'
|
||||
import { RoleName } from '@standardnotes/common'
|
||||
|
||||
import { FeatureStatus } from './FeatureStatus'
|
||||
import { SetOfflineFeaturesFunctionResponse } from './SetOfflineFeaturesFunctionResponse'
|
||||
@@ -12,7 +11,7 @@ export interface FeaturesClientInterface {
|
||||
|
||||
getFeatureStatus(featureId: FeatureIdentifier): FeatureStatus
|
||||
|
||||
hasMinimumRole(role: RoleName): boolean
|
||||
hasMinimumRole(role: string): boolean
|
||||
|
||||
setOfflineFeaturesCode(code: string): Promise<SetOfflineFeaturesFunctionResponse>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* istanbul ignore file */
|
||||
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import {
|
||||
SNNote,
|
||||
FileItem,
|
||||
@@ -129,14 +129,14 @@ export interface ItemsClientInterface {
|
||||
/**
|
||||
* Finds an item by UUID.
|
||||
*/
|
||||
findItem<T extends DecryptedItemInterface = DecryptedItemInterface>(uuid: Uuid): T | undefined
|
||||
findItem<T extends DecryptedItemInterface = DecryptedItemInterface>(uuid: string): T | undefined
|
||||
|
||||
/**
|
||||
* Finds an item by predicate.
|
||||
*/
|
||||
findItems<T extends DecryptedItemInterface>(uuids: Uuid[]): T[]
|
||||
findItems<T extends DecryptedItemInterface>(uuids: string[]): T[]
|
||||
|
||||
findSureItem<T extends DecryptedItemInterface = DecryptedItemInterface>(uuid: Uuid): T
|
||||
findSureItem<T extends DecryptedItemInterface = DecryptedItemInterface>(uuid: string): T
|
||||
|
||||
/**
|
||||
* Finds an item by predicate.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { GetSingleItemResponse } from '@standardnotes/responses'
|
||||
|
||||
export interface ItemsServerInterface {
|
||||
getSingleItem(itemUuid: Uuid): Promise<GetSingleItemResponse>
|
||||
getSingleItem(itemUuid: string): Promise<GetSingleItemResponse>
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { Invitation } from '@standardnotes/models'
|
||||
import { AppleIAPReceipt } from './AppleIAPReceipt'
|
||||
|
||||
export interface SubscriptionClientInterface {
|
||||
listSubscriptionInvitations(): Promise<Invitation[]>
|
||||
inviteToSubscription(inviteeEmail: string): Promise<boolean>
|
||||
cancelInvitation(inviteUuid: Uuid): Promise<boolean>
|
||||
acceptInvitation(inviteUuid: Uuid): Promise<{ success: true } | { success: false; message: string }>
|
||||
cancelInvitation(inviteUuid: string): Promise<boolean>
|
||||
acceptInvitation(inviteUuid: string): Promise<{ success: true } | { success: false; message: string }>
|
||||
confirmAppleIAP(
|
||||
receipt: AppleIAPReceipt,
|
||||
subscriptionToken: string,
|
||||
|
||||
@@ -3,7 +3,6 @@ import { SubscriptionApiServiceInterface } from '@standardnotes/api'
|
||||
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
|
||||
import { AbstractService } from '../Service/AbstractService'
|
||||
import { SubscriptionClientInterface } from './SubscriptionClientInterface'
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { AppleIAPReceipt } from './AppleIAPReceipt'
|
||||
|
||||
export class SubscriptionManager extends AbstractService implements SubscriptionClientInterface {
|
||||
@@ -48,7 +47,7 @@ export class SubscriptionManager extends AbstractService implements Subscription
|
||||
}
|
||||
}
|
||||
|
||||
async cancelInvitation(inviteUuid: Uuid): Promise<boolean> {
|
||||
async cancelInvitation(inviteUuid: string): Promise<boolean> {
|
||||
try {
|
||||
const result = await this.subscriptionApiService.cancelInvite(inviteUuid)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { Workspace, WorkspaceUser } from '@standardnotes/api'
|
||||
|
||||
export interface WorkspaceClientInterface {
|
||||
@@ -11,20 +11,20 @@ export interface WorkspaceClientInterface {
|
||||
}): Promise<{ uuid: string } | null>
|
||||
inviteToWorkspace(dto: {
|
||||
inviteeEmail: string
|
||||
workspaceUuid: Uuid
|
||||
workspaceUuid: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
}): Promise<{ uuid: string } | null>
|
||||
acceptInvite(dto: {
|
||||
inviteUuid: Uuid
|
||||
userUuid: Uuid
|
||||
inviteUuid: string
|
||||
userUuid: string
|
||||
publicKey: string
|
||||
encryptedPrivateKey: string
|
||||
}): Promise<{ success: boolean }>
|
||||
listWorkspaces(): Promise<{ ownedWorkspaces: Array<Workspace>; joinedWorkspaces: Array<Workspace> }>
|
||||
listWorkspaceUsers(dto: { workspaceUuid: Uuid }): Promise<{ users: Array<WorkspaceUser> }>
|
||||
listWorkspaceUsers(dto: { workspaceUuid: string }): Promise<{ users: Array<WorkspaceUser> }>
|
||||
initiateKeyshare(dto: {
|
||||
workspaceUuid: Uuid
|
||||
userUuid: Uuid
|
||||
workspaceUuid: string
|
||||
userUuid: string
|
||||
encryptedWorkspaceKey: string
|
||||
}): Promise<{ success: boolean }>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WorkspaceApiServiceInterface, Workspace, WorkspaceUser } from '@standardnotes/api'
|
||||
import { Uuid, WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { WorkspaceAccessLevel, WorkspaceType } from '@standardnotes/common'
|
||||
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
|
||||
import { AbstractService } from '../Service/AbstractService'
|
||||
import { WorkspaceClientInterface } from './WorkspaceClientInterface'
|
||||
@@ -79,7 +79,7 @@ export class WorkspaceManager extends AbstractService implements WorkspaceClient
|
||||
|
||||
async inviteToWorkspace(dto: {
|
||||
inviteeEmail: string
|
||||
workspaceUuid: Uuid
|
||||
workspaceUuid: string
|
||||
accessLevel: WorkspaceAccessLevel
|
||||
}): Promise<{ uuid: string } | null> {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user