diff --git a/Package.swift b/Package.swift index fe48b4a7c1..a2989f5ec7 100644 --- a/Package.swift +++ b/Package.swift @@ -63,11 +63,13 @@ let package = Package( "VergeRx" ] ), + .target(name: "VergeTypedIdentifier"), .target( name: "VergeNormalization", dependencies: [ "VergeMacros", "VergeComparator", + "VergeTypedIdentifier", .product(name: "HashTreeCollections", package: "swift-collections"), ] ), diff --git a/Sources/VergeNormalization/Tables/TableType.swift b/Sources/VergeNormalization/Tables/TableType.swift index de0fc6bc42..bd911cd278 100644 --- a/Sources/VergeNormalization/Tables/TableType.swift +++ b/Sources/VergeNormalization/Tables/TableType.swift @@ -1,3 +1,4 @@ +import VergeTypedIdentifier /// a storage of the entity public protocol TableType: Equatable { diff --git a/Sources/VergeNormalization/VergeNormalization.swift b/Sources/VergeNormalization/VergeNormalization.swift index 8b13789179..cf88f4b5b2 100644 --- a/Sources/VergeNormalization/VergeNormalization.swift +++ b/Sources/VergeNormalization/VergeNormalization.swift @@ -1 +1 @@ - +@_exported import VergeTypedIdentifier diff --git a/Sources/VergeNormalization/EntityType.swift b/Sources/VergeTypedIdentifier/EntityType.swift similarity index 88% rename from Sources/VergeNormalization/EntityType.swift rename to Sources/VergeTypedIdentifier/EntityType.swift index 865218f3b9..2cac7b9da4 100644 --- a/Sources/VergeNormalization/EntityType.swift +++ b/Sources/VergeTypedIdentifier/EntityType.swift @@ -70,26 +70,11 @@ public protocol EntityType: Equatable, Sendable { associatedtype EntityIDRawType: _PrimitiveIdentifierConvertible - static var entityName: EntityTableIdentifier { get } - var entityID: EntityID { get } typealias EntityID = EntityIdentifier } -extension EntityType { - - /// Returns EntityName from reflection - /// - /// - Warning: - /// Taking the name in runtime, it's not fast. - /// To be faster, override this property each your entities. - public static var entityName: EntityTableIdentifier { - .init(Self.self) - } - -} - public struct EntityTableIdentifier: Hashable { public let name: String diff --git a/Sources/VergeNormalization/PrimitiveIdentifier.swift b/Sources/VergeTypedIdentifier/PrimitiveIdentifier.swift similarity index 100% rename from Sources/VergeNormalization/PrimitiveIdentifier.swift rename to Sources/VergeTypedIdentifier/PrimitiveIdentifier.swift