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 { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { ComponentPermission } from '@standardnotes/features'
|
||||
|
||||
import { IncomingComponentItemPayload } from './IncomingComponentItemPayload'
|
||||
@@ -14,7 +14,7 @@ export type MessageData = Partial<{
|
||||
permissions?: ComponentPermission[]
|
||||
/** Related to the component-registered action */
|
||||
componentData?: Record<string, unknown>
|
||||
uuid?: Uuid
|
||||
uuid?: string
|
||||
environment?: string
|
||||
platform?: string
|
||||
activeThemeUrls?: string[]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { AppData, DefaultAppDomain } from '../Item/Types/DefaultAppDomain'
|
||||
import { ContentReference } from '../Reference/ContentReference'
|
||||
import { AppDataField } from '../Item/Types/AppDataField'
|
||||
@@ -8,7 +7,7 @@ export interface SpecializedContent {}
|
||||
|
||||
export interface ItemContent {
|
||||
references: ContentReference[]
|
||||
conflict_of?: Uuid
|
||||
conflict_of?: string
|
||||
protected?: boolean
|
||||
trashed?: boolean
|
||||
pinned?: boolean
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ItemContent } from '../Content/ItemContent'
|
||||
import { ContextPayload } from './ContextPayload'
|
||||
|
||||
@@ -6,7 +5,7 @@ export interface BackupFileDecryptedContextualPayload<C extends ItemContent = It
|
||||
content: C
|
||||
created_at_timestamp: number
|
||||
created_at: Date
|
||||
duplicate_of?: Uuid
|
||||
duplicate_of?: string
|
||||
updated_at: Date
|
||||
updated_at_timestamp: number
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ContextPayload } from './ContextPayload'
|
||||
|
||||
export interface BackupFileEncryptedContextualPayload extends ContextPayload {
|
||||
@@ -6,7 +5,7 @@ export interface BackupFileEncryptedContextualPayload extends ContextPayload {
|
||||
content: string
|
||||
created_at_timestamp: number
|
||||
created_at: Date
|
||||
duplicate_of?: Uuid
|
||||
duplicate_of?: string
|
||||
enc_item_key: string
|
||||
items_key_id: string | undefined
|
||||
updated_at: Date
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ContextPayload } from './ContextPayload'
|
||||
import { ItemContent } from '../Content/ItemContent'
|
||||
import { DecryptedPayloadInterface, DeletedPayloadInterface, EncryptedPayloadInterface } from '../Payload'
|
||||
@@ -19,7 +18,7 @@ export interface LocalStorageEncryptedContextualPayload extends ContextPayload {
|
||||
created_at_timestamp: number
|
||||
created_at: Date
|
||||
dirty: boolean
|
||||
duplicate_of: Uuid | undefined
|
||||
duplicate_of: string | undefined
|
||||
enc_item_key: string
|
||||
errorDecrypting: boolean
|
||||
items_key_id: string | undefined
|
||||
@@ -34,7 +33,7 @@ export interface LocalStorageDecryptedContextualPayload<C extends ItemContent =
|
||||
created_at: Date
|
||||
deleted: false
|
||||
dirty: boolean
|
||||
duplicate_of?: Uuid
|
||||
duplicate_of?: string
|
||||
updated_at_timestamp: number
|
||||
updated_at: Date
|
||||
}
|
||||
@@ -45,7 +44,7 @@ export interface LocalStorageDeletedContextualPayload extends ContextPayload {
|
||||
created_at: Date
|
||||
deleted: true
|
||||
dirty: true
|
||||
duplicate_of?: Uuid
|
||||
duplicate_of?: string
|
||||
updated_at_timestamp: number
|
||||
updated_at: Date
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ItemContent } from '../Content/ItemContent'
|
||||
import { DecryptedPayloadInterface, DeletedPayloadInterface, isDecryptedPayload } from '../Payload'
|
||||
import { ContextPayload } from './ContextPayload'
|
||||
@@ -7,7 +6,7 @@ export interface OfflineSyncPushContextualPayload extends ContextPayload {
|
||||
content: ItemContent | undefined
|
||||
created_at_timestamp: number
|
||||
created_at: Date
|
||||
duplicate_of?: Uuid
|
||||
duplicate_of?: string
|
||||
updated_at_timestamp: number
|
||||
updated_at: Date
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { DeletedPayloadInterface, EncryptedPayloadInterface } from '../Payload'
|
||||
import { ContextPayload } from './ContextPayload'
|
||||
|
||||
@@ -7,7 +6,7 @@ export interface ServerSyncPushContextualPayload extends ContextPayload {
|
||||
content: string | undefined
|
||||
created_at_timestamp: number
|
||||
created_at: Date
|
||||
duplicate_of?: Uuid
|
||||
duplicate_of?: string
|
||||
enc_item_key?: string
|
||||
items_key_id?: string
|
||||
updated_at_timestamp: number
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { dateToLocalizedString, useBoolean } from '@standardnotes/utils'
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { DecryptedTransferPayload } from './../../TransferPayload/Interfaces/DecryptedTransferPayload'
|
||||
import { AppDataField } from '../Types/AppDataField'
|
||||
import { ComponentDataDomain, DefaultAppDomain } from '../Types/DefaultAppDomain'
|
||||
@@ -15,7 +14,7 @@ export class DecryptedItem<C extends ItemContent = ItemContent>
|
||||
extends GenericItem<DecryptedPayloadInterface<C>>
|
||||
implements DecryptedItemInterface<C>
|
||||
{
|
||||
public readonly conflictOf?: Uuid
|
||||
public readonly conflictOf?: string
|
||||
public readonly protected: boolean = false
|
||||
public readonly trashed: boolean = false
|
||||
public readonly pinned: boolean = false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { dateToLocalizedString, deepFreeze } from '@standardnotes/utils'
|
||||
import { TransferPayload } from './../../TransferPayload/Interfaces/TransferPayload'
|
||||
import { ItemContentsDiffer } from '../../../Utilities/Item/ItemContentsDiffer'
|
||||
@@ -13,7 +13,7 @@ import { isDecryptedItem, isDeletedItem, isEncryptedErroredItem } from '../Inter
|
||||
|
||||
export abstract class GenericItem<P extends PayloadInterface = PayloadInterface> implements ItemInterface<P> {
|
||||
payload: P
|
||||
public readonly duplicateOf?: Uuid
|
||||
public readonly duplicateOf?: string
|
||||
public readonly createdAtString?: string
|
||||
public updatedAtString?: string
|
||||
public userModifiedDate: Date
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { AppDataField } from '../Types/AppDataField'
|
||||
import { ComponentDataDomain, DefaultAppDomain } from '../Types/DefaultAppDomain'
|
||||
import { ContentReference } from '../../Reference/ContentReference'
|
||||
@@ -15,8 +14,8 @@ export interface DecryptedItemInterface<C extends ItemContent = ItemContent>
|
||||
SortableItem,
|
||||
SearchableItem {
|
||||
readonly content: C
|
||||
readonly conflictOf?: Uuid
|
||||
readonly duplicateOf?: Uuid
|
||||
readonly conflictOf?: string
|
||||
readonly duplicateOf?: string
|
||||
readonly protected: boolean
|
||||
readonly trashed: boolean
|
||||
readonly pinned: boolean
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Uuid, ContentType } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { TransferPayload } from './../../TransferPayload/Interfaces/TransferPayload'
|
||||
import { PayloadInterface } from '../../Payload/Interfaces/PayloadInterface'
|
||||
import { PredicateInterface } from '../../../Runtime/Predicate/Interface'
|
||||
@@ -8,12 +8,12 @@ import { SingletonStrategy } from '../Types/SingletonStrategy'
|
||||
|
||||
export interface ItemInterface<P extends PayloadInterface = PayloadInterface> {
|
||||
payload: P
|
||||
readonly conflictOf?: Uuid
|
||||
readonly duplicateOf?: Uuid
|
||||
readonly conflictOf?: string
|
||||
readonly duplicateOf?: string
|
||||
readonly createdAtString?: string
|
||||
readonly updatedAtString?: string
|
||||
|
||||
uuid: Uuid
|
||||
uuid: string
|
||||
|
||||
content_type: ContentType
|
||||
created_at: Date
|
||||
|
||||
@@ -2,7 +2,6 @@ import { DecryptedItemInterface } from './../Interfaces/DecryptedItem'
|
||||
import { Copy } from '@standardnotes/utils'
|
||||
import { MutationType } from '../Types/MutationType'
|
||||
import { PrefKey } from '../../../Syncable/UserPrefs/PrefKey'
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ItemContent } from '../../Content/ItemContent'
|
||||
import { AppDataField } from '../Types/AppDataField'
|
||||
import { DefaultAppDomain, DomainDataValueType, ItemDomainKey } from '../Types/DefaultAppDomain'
|
||||
@@ -66,7 +65,7 @@ export class DecryptedItemMutator<C extends ItemContent = ItemContent> extends I
|
||||
this.setAppDataItem(AppDataField.UserModifiedDate, date)
|
||||
}
|
||||
|
||||
public set conflictOf(conflictOf: Uuid | undefined) {
|
||||
public set conflictOf(conflictOf: string | undefined) {
|
||||
this.mutableContent.conflict_of = conflictOf
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
|
||||
import { MutationType } from '../Types/MutationType'
|
||||
|
||||
import { ItemMutator } from './ItemMutator'
|
||||
|
||||
export type TransactionalMutation = {
|
||||
itemUuid: Uuid
|
||||
itemUuid: string
|
||||
mutate: (mutator: ItemMutator) => void
|
||||
mutationType?: MutationType
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { Copy } from '@standardnotes/utils'
|
||||
import { SyncResolvedParams, SyncResolvedPayload } from '../../../Runtime/Deltas/Utilities/SyncResolvedPayload'
|
||||
import { FillItemContent, ItemContent } from '../../Content/ItemContent'
|
||||
@@ -29,7 +28,7 @@ export class DecryptedPayload<
|
||||
return this.content.references || []
|
||||
}
|
||||
|
||||
public getReference(uuid: Uuid): ContentReference {
|
||||
public getReference(uuid: string): ContentReference {
|
||||
const result = this.references.find((ref) => ref.uuid === uuid)
|
||||
|
||||
if (!result) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { DecryptedTransferPayload } from './../../TransferPayload/Interfaces/DecryptedTransferPayload'
|
||||
import { ItemContent } from '../../Content/ItemContent'
|
||||
import { ContentReference } from '../../Reference/ContentReference'
|
||||
@@ -11,5 +10,5 @@ export interface DecryptedPayloadInterface<C extends ItemContent = ItemContent>
|
||||
|
||||
ejected(): DecryptedTransferPayload<C>
|
||||
get references(): ContentReference[]
|
||||
getReference(uuid: Uuid): ContentReference
|
||||
getReference(uuid: string): ContentReference
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { SyncResolvedParams, SyncResolvedPayload } from './../../../Runtime/Deltas/Utilities/SyncResolvedPayload'
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { ItemContent } from '../../Content/ItemContent'
|
||||
import { TransferPayload } from '../../TransferPayload/Interfaces/TransferPayload'
|
||||
import { PayloadSource } from '../Types/PayloadSource'
|
||||
|
||||
export interface PayloadInterface<T extends TransferPayload = TransferPayload, C extends ItemContent = ItemContent> {
|
||||
readonly source: PayloadSource
|
||||
readonly uuid: Uuid
|
||||
readonly uuid: string
|
||||
readonly content_type: ContentType
|
||||
content: C | string | undefined
|
||||
deleted: boolean
|
||||
@@ -26,7 +26,7 @@ export interface PayloadInterface<T extends TransferPayload = TransferPayload, C
|
||||
readonly lastSyncBegan?: Date
|
||||
readonly lastSyncEnd?: Date
|
||||
|
||||
readonly duplicate_of?: Uuid
|
||||
readonly duplicate_of?: string
|
||||
|
||||
/**
|
||||
* "Ejected" means a payload for
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { ItemContent } from '../../Content/ItemContent'
|
||||
|
||||
export interface TransferPayload<C extends ItemContent = ItemContent> {
|
||||
uuid: Uuid
|
||||
uuid: string
|
||||
content_type: ContentType
|
||||
content: C | string | undefined
|
||||
deleted?: boolean
|
||||
@@ -19,5 +19,5 @@ export interface TransferPayload<C extends ItemContent = ItemContent> {
|
||||
lastSyncBegan?: Date
|
||||
lastSyncEnd?: Date
|
||||
|
||||
duplicate_of?: Uuid
|
||||
duplicate_of?: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user