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
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { extendArray, isObject, isString, UuidMap } from '@standardnotes/utils'
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { remove } from 'lodash'
|
||||
import { ItemContent } from '../../Abstract/Content/ItemContent'
|
||||
import { ContentReference } from '../../Abstract/Item'
|
||||
|
||||
export interface CollectionElement {
|
||||
uuid: Uuid
|
||||
uuid: string
|
||||
content_type: ContentType
|
||||
dirty?: boolean
|
||||
deleted?: boolean
|
||||
@@ -32,17 +32,17 @@ export abstract class Collection<
|
||||
Encrypted extends EncryptedCollectionElement,
|
||||
Deleted extends DeletedCollectionElement,
|
||||
> {
|
||||
readonly map: Partial<Record<Uuid, Element>> = {}
|
||||
readonly map: Partial<Record<string, Element>> = {}
|
||||
readonly typedMap: Partial<Record<ContentType, Element[]>> = {}
|
||||
|
||||
/** An array of uuids of items that are dirty */
|
||||
dirtyIndex: Set<Uuid> = new Set()
|
||||
dirtyIndex: Set<string> = new Set()
|
||||
|
||||
/** An array of uuids of items that are not marked as deleted */
|
||||
nondeletedIndex: Set<Uuid> = new Set()
|
||||
nondeletedIndex: Set<string> = new Set()
|
||||
|
||||
/** An array of uuids of items that are errorDecrypting or waitingForKey */
|
||||
invalidsIndex: Set<Uuid> = new Set()
|
||||
invalidsIndex: Set<string> = new Set()
|
||||
|
||||
readonly referenceMap: UuidMap
|
||||
|
||||
@@ -73,7 +73,7 @@ export abstract class Collection<
|
||||
|
||||
constructor(
|
||||
copy = false,
|
||||
mapCopy?: Partial<Record<Uuid, Element>>,
|
||||
mapCopy?: Partial<Record<string, Element>>,
|
||||
typedMapCopy?: Partial<Record<ContentType, Element[]>>,
|
||||
referenceMapCopy?: UuidMap,
|
||||
conflictMapCopy?: UuidMap,
|
||||
@@ -89,7 +89,7 @@ export abstract class Collection<
|
||||
}
|
||||
}
|
||||
|
||||
public uuids(): Uuid[] {
|
||||
public uuids(): string[] {
|
||||
return Object.keys(this.map)
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ export abstract class Collection<
|
||||
return this.typedMap[contentType]?.slice() || []
|
||||
}
|
||||
} else {
|
||||
return Object.keys(this.map).map((uuid: Uuid) => {
|
||||
return Object.keys(this.map).map((uuid: string) => {
|
||||
return this.map[uuid]
|
||||
}) as Element[]
|
||||
}
|
||||
@@ -129,7 +129,7 @@ export abstract class Collection<
|
||||
return this.findAll(uuids)
|
||||
}
|
||||
|
||||
public findAll(uuids: Uuid[]): Element[] {
|
||||
public findAll(uuids: string[]): Element[] {
|
||||
const results: Element[] = []
|
||||
|
||||
for (const id of uuids) {
|
||||
@@ -142,11 +142,11 @@ export abstract class Collection<
|
||||
return results
|
||||
}
|
||||
|
||||
public find(uuid: Uuid): Element | undefined {
|
||||
public find(uuid: string): Element | undefined {
|
||||
return this.map[uuid]
|
||||
}
|
||||
|
||||
public has(uuid: Uuid): boolean {
|
||||
public has(uuid: string): boolean {
|
||||
return this.find(uuid) != undefined
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ export abstract class Collection<
|
||||
* If an item is not found, an `undefined` element
|
||||
* will be inserted into the array.
|
||||
*/
|
||||
public findAllIncludingBlanks<E extends Element>(uuids: Uuid[]): (E | Deleted | undefined)[] {
|
||||
public findAllIncludingBlanks<E extends Element>(uuids: string[]): (E | Deleted | undefined)[] {
|
||||
const results: (E | Deleted | undefined)[] = []
|
||||
|
||||
for (const id of uuids) {
|
||||
@@ -219,11 +219,11 @@ export abstract class Collection<
|
||||
}
|
||||
}
|
||||
|
||||
public uuidReferencesForUuid(uuid: Uuid): Uuid[] {
|
||||
public uuidReferencesForUuid(uuid: string): string[] {
|
||||
return this.referenceMap.getDirectRelationships(uuid)
|
||||
}
|
||||
|
||||
public uuidsThatReferenceUuid(uuid: Uuid): Uuid[] {
|
||||
public uuidsThatReferenceUuid(uuid: string): string[] {
|
||||
return this.referenceMap.getInverseRelationships(uuid)
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ export abstract class Collection<
|
||||
return this.findAll(uuids)
|
||||
}
|
||||
|
||||
public conflictsOf(uuid: Uuid): Element[] {
|
||||
public conflictsOf(uuid: string): Element[] {
|
||||
const uuids = this.conflictMap.getDirectRelationships(uuid)
|
||||
return this.findAll(uuids)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Uuid, ContentType } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
|
||||
export interface SortableItem {
|
||||
uuid: Uuid
|
||||
uuid: string
|
||||
content_type: ContentType
|
||||
created_at: Date
|
||||
userModifiedDate: Date
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ItemContent } from './../../../Abstract/Content/ItemContent'
|
||||
import { EncryptedItemInterface } from './../../../Abstract/Item/Interfaces/EncryptedItem'
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { SNIndex } from '../../Index/SNIndex'
|
||||
import { isDecryptedItem } from '../../../Abstract/Item/Interfaces/TypeCheck'
|
||||
import { DecryptedItemInterface } from '../../../Abstract/Item/Interfaces/DecryptedItem'
|
||||
@@ -24,7 +24,7 @@ export class ItemCollection
|
||||
this.discard(delta.discarded)
|
||||
}
|
||||
|
||||
public findDecrypted<T extends DecryptedItemInterface = DecryptedItemInterface>(uuid: Uuid): T | undefined {
|
||||
public findDecrypted<T extends DecryptedItemInterface = DecryptedItemInterface>(uuid: string): T | undefined {
|
||||
const result = this.find(uuid)
|
||||
|
||||
if (!result) {
|
||||
@@ -34,12 +34,12 @@ export class ItemCollection
|
||||
return isDecryptedItem(result) ? (result as T) : undefined
|
||||
}
|
||||
|
||||
public findAllDecrypted<T extends DecryptedItemInterface = DecryptedItemInterface>(uuids: Uuid[]): T[] {
|
||||
public findAllDecrypted<T extends DecryptedItemInterface = DecryptedItemInterface>(uuids: string[]): T[] {
|
||||
return this.findAll(uuids).filter(isDecryptedItem) as T[]
|
||||
}
|
||||
|
||||
public findAllDecryptedWithBlanks<C extends ItemContent = ItemContent>(
|
||||
uuids: Uuid[],
|
||||
uuids: string[],
|
||||
): (DecryptedItemInterface<C> | undefined)[] {
|
||||
const results = this.findAllIncludingBlanks(uuids)
|
||||
const mapped = results.map((i) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { removeFromArray } from '@standardnotes/utils'
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { isTag, SNTag } from '../../../Syncable/Tag/Tag'
|
||||
import { SNIndex } from '../../Index/SNIndex'
|
||||
import { ItemCollection } from './ItemCollection'
|
||||
@@ -7,12 +7,12 @@ import { ItemDelta } from '../../Index/ItemDelta'
|
||||
import { isDecryptedItem, ItemInterface } from '../../../Abstract/Item'
|
||||
|
||||
type AllNotesUuidSignifier = undefined
|
||||
export type TagItemCountChangeObserver = (tagUuid: Uuid | AllNotesUuidSignifier) => void
|
||||
export type TagItemCountChangeObserver = (tagUuid: string | AllNotesUuidSignifier) => void
|
||||
|
||||
export class TagItemsIndex implements SNIndex {
|
||||
private tagToItemsMap: Partial<Record<Uuid, Set<Uuid>>> = {}
|
||||
private allCountableItems = new Set<Uuid>()
|
||||
private countableItemsByType = new Map<ContentType, Set<Uuid>>()
|
||||
private tagToItemsMap: Partial<Record<string, Set<string>>> = {}
|
||||
private allCountableItems = new Set<string>()
|
||||
private countableItemsByType = new Map<ContentType, Set<string>>()
|
||||
|
||||
constructor(private collection: ItemCollection, public observers: TagItemCountChangeObserver[] = []) {}
|
||||
|
||||
@@ -32,7 +32,7 @@ export class TagItemsIndex implements SNIndex {
|
||||
}
|
||||
}
|
||||
|
||||
private notifyObservers(tagUuid: Uuid | undefined) {
|
||||
private notifyObservers(tagUuid: string | undefined) {
|
||||
for (const observer of this.observers) {
|
||||
observer(tagUuid)
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export class TagItemsIndex implements SNIndex {
|
||||
}
|
||||
}
|
||||
|
||||
private setForTag(uuid: Uuid): Set<Uuid> {
|
||||
private setForTag(uuid: string): Set<string> {
|
||||
let set = this.tagToItemsMap[uuid]
|
||||
if (!set) {
|
||||
set = new Set()
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ImmutablePayloadCollection } from './../Collection/Payload/ImmutablePay
|
||||
import { ConflictDelta } from './Conflict'
|
||||
import { isErrorDecryptingPayload, isDecryptedPayload } from '../../Abstract/Payload/Interfaces/TypeCheck'
|
||||
import { FullyFormedPayloadInterface, PayloadEmitSource } from '../../Abstract/Payload'
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { HistoryMap } from '../History'
|
||||
import { ServerSyncPushContextualPayload } from '../../Abstract/Contextual/ServerSyncPush'
|
||||
import { payloadByFinalizingSyncState } from './Utilities/ApplyDirtyState'
|
||||
@@ -18,7 +18,7 @@ export class DeltaRemoteRetrieved implements SyncDeltaInterface {
|
||||
readonly historyMap: HistoryMap,
|
||||
) {}
|
||||
|
||||
private isUuidOfPayloadCurrentlySavingOrSaved(uuid: Uuid): boolean {
|
||||
private isUuidOfPayloadCurrentlySavingOrSaved(uuid: string): boolean {
|
||||
return this.itemsSavedOrSaving.find((i) => i.uuid === uuid) != undefined
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { DecryptedItemInterface } from '../../Abstract/Item'
|
||||
import { SortableItem } from '../Collection/CollectionSort'
|
||||
import { ItemCollection } from '../Collection/Item/ItemCollection'
|
||||
|
||||
export type DisplayControllerCustomFilter = (element: DisplayItem) => boolean
|
||||
export type UuidToSortedPositionMap = Record<Uuid, number>
|
||||
export type UuidToSortedPositionMap = Record<string, number>
|
||||
export type DisplayItem = SortableItem & DecryptedItemInterface
|
||||
|
||||
export interface ReadonlyItemCollection {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { HistoryEntry } from './HistoryEntry'
|
||||
|
||||
export type HistoryMap = Record<Uuid, HistoryEntry[]>
|
||||
export type HistoryMap = Record<string, HistoryEntry[]>
|
||||
|
||||
export const historyMapFunctions = {
|
||||
getNewestRevision: (history: HistoryEntry[]): HistoryEntry | undefined => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { isValidUrl } from '@standardnotes/utils'
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import {
|
||||
FeatureIdentifier,
|
||||
ThirdPartyFeatureDescription,
|
||||
@@ -159,11 +159,11 @@ export class SNComponent extends DecryptedItem<ComponentContent> implements Comp
|
||||
return SNComponent.associativeAreas().includes(this.area)
|
||||
}
|
||||
|
||||
public isExplicitlyEnabledForItem(uuid: Uuid): boolean {
|
||||
public isExplicitlyEnabledForItem(uuid: string): boolean {
|
||||
return this.associatedItemIds.indexOf(uuid) !== -1
|
||||
}
|
||||
|
||||
public isExplicitlyDisabledForItem(uuid: Uuid): boolean {
|
||||
public isExplicitlyDisabledForItem(uuid: string): boolean {
|
||||
return this.disassociatedItemIds.indexOf(uuid) !== -1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ComponentArea, ComponentPermission } from '@standardnotes/features'
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ItemContent } from '../../Abstract/Content/ItemContent'
|
||||
import { ComponentPackageInfo } from './PackageInfo'
|
||||
|
||||
@@ -30,7 +29,7 @@ export interface ComponentInterface {
|
||||
legacy_url?: string
|
||||
isMobileDefault: boolean
|
||||
isDeprecated: boolean
|
||||
isExplicitlyEnabledForItem(uuid: Uuid): boolean
|
||||
isExplicitlyEnabledForItem(uuid: string): boolean
|
||||
}
|
||||
|
||||
export type ComponentContent = ComponentInterface & ItemContent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { addIfUnique, removeFromArray } from '@standardnotes/utils'
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ComponentPermission, FeatureDescription } from '@standardnotes/features'
|
||||
import { AppDataField } from '../../Abstract/Item/Types/AppDataField'
|
||||
import { ComponentContent } from './ComponentContent'
|
||||
@@ -46,23 +45,23 @@ export class ComponentMutator extends DecryptedItemMutator<ComponentContent> {
|
||||
this.mutableContent.offlineOnly = offlineOnly
|
||||
}
|
||||
|
||||
public associateWithItem(uuid: Uuid): void {
|
||||
public associateWithItem(uuid: string): void {
|
||||
const associated = this.mutableContent.associatedItemIds || []
|
||||
addIfUnique(associated, uuid)
|
||||
this.mutableContent.associatedItemIds = associated
|
||||
}
|
||||
|
||||
public disassociateWithItem(uuid: Uuid): void {
|
||||
public disassociateWithItem(uuid: string): void {
|
||||
const disassociated = this.mutableContent.disassociatedItemIds || []
|
||||
addIfUnique(disassociated, uuid)
|
||||
this.mutableContent.disassociatedItemIds = disassociated
|
||||
}
|
||||
|
||||
public removeAssociatedItemId(uuid: Uuid): void {
|
||||
public removeAssociatedItemId(uuid: string): void {
|
||||
removeFromArray(this.mutableContent.associatedItemIds || [], uuid)
|
||||
}
|
||||
|
||||
public removeDisassociatedItemId(uuid: Uuid): void {
|
||||
public removeDisassociatedItemId(uuid: string): void {
|
||||
removeFromArray(this.mutableContent.disassociatedItemIds || [], uuid)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { VectorIconNameOrEmoji, IconType } from './../../Utilities/Icon/IconType'
|
||||
import { ContentType, Uuid } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { DecryptedItem } from '../../Abstract/Item/Implementations/DecryptedItem'
|
||||
import { ItemInterface } from '../../Abstract/Item/Interfaces/ItemInterface'
|
||||
import { ContentReference } from '../../Abstract/Reference/ContentReference'
|
||||
@@ -41,7 +41,7 @@ export class SNTag extends DecryptedItem<TagContent> implements TagContentSpecia
|
||||
return this.noteReferences.length
|
||||
}
|
||||
|
||||
public get parentId(): Uuid | undefined {
|
||||
public get parentId(): string | undefined {
|
||||
const reference = this.references.find(isTagToParentTagReference)
|
||||
return reference?.uuid
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { ItemInterface } from '../../Abstract/Item/Interfaces/ItemInterface'
|
||||
|
||||
export function FindItem<I extends ItemInterface = ItemInterface>(items: I[], uuid: Uuid): I | undefined {
|
||||
export function FindItem<I extends ItemInterface = ItemInterface>(items: I[], uuid: string): I | undefined {
|
||||
return items.find((item) => item.uuid === uuid)
|
||||
}
|
||||
|
||||
export function SureFindItem<I extends ItemInterface = ItemInterface>(items: I[], uuid: Uuid): I {
|
||||
export function SureFindItem<I extends ItemInterface = ItemInterface>(items: I[], uuid: string): I {
|
||||
return FindItem(items, uuid) as I
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { PayloadInterface } from '../../Abstract/Payload/Interfaces/PayloadInterface'
|
||||
|
||||
export function FindPayload<P extends PayloadInterface = PayloadInterface>(payloads: P[], uuid: Uuid): P | undefined {
|
||||
export function FindPayload<P extends PayloadInterface = PayloadInterface>(payloads: P[], uuid: string): P | undefined {
|
||||
return payloads.find((payload) => payload.uuid === uuid)
|
||||
}
|
||||
|
||||
export function SureFindPayload<P extends PayloadInterface = PayloadInterface>(payloads: P[], uuid: Uuid): P {
|
||||
export function SureFindPayload<P extends PayloadInterface = PayloadInterface>(payloads: P[], uuid: string): P {
|
||||
return FindPayload(payloads, uuid) as P
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Uuid } from '@standardnotes/common'
|
||||
import { remove } from 'lodash'
|
||||
import { ImmutablePayloadCollection } from '../../Runtime/Collection/Payload/ImmutablePayloadCollection'
|
||||
import { ContentReference } from '../../Abstract/Reference/ContentReference'
|
||||
@@ -12,7 +11,7 @@ export function PayloadsByUpdatingReferencingPayloadReferences(
|
||||
payload: DecryptedPayloadInterface,
|
||||
baseCollection: ImmutablePayloadCollection<FullyFormedPayloadInterface>,
|
||||
add: FullyFormedPayloadInterface[] = [],
|
||||
removeIds: Uuid[] = [],
|
||||
removeIds: string[] = [],
|
||||
): SyncResolvedPayload[] {
|
||||
const referencingPayloads = baseCollection.elementsReferencingElement(payload).filter(isDecryptedPayload)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user