From f681d132ffcc1d295bf63393c481c16ed8786629 Mon Sep 17 00:00:00 2001 From: Joel Carter Date: Mon, 11 Nov 2024 16:35:02 -0600 Subject: [PATCH] De-smurf naming --- Sources/XyoClient/ApiConfig.swift | 2 +- .../XyoClient/ArchivistApi/ArchivistApiConfig.swift | 2 +- .../XyoClient/BoundWitness/BoundWitnessBuilder.swift | 2 +- .../Module/{XyoModule.swift => AbstractModule.swift} | 2 +- Sources/XyoClient/XyoPanel.swift | 12 ++++++------ .../{XyoWitness.swift => AbstractWitness.swift} | 2 +- .../XyoClient/XyoWitness/Basic/BasicWitness.swift | 2 +- .../XyoClient/XyoWitness/Event/EventWitness.swift | 2 +- .../XyoWitness/SystemInfo/SystemInfoWitness.swift | 2 +- Tests/XyoClientTests/Panel.swift | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) rename Sources/XyoClient/Module/{XyoModule.swift => AbstractModule.swift} (86%) rename Sources/XyoClient/XyoWitness/{XyoWitness.swift => AbstractWitness.swift} (65%) diff --git a/Sources/XyoClient/ApiConfig.swift b/Sources/XyoClient/ApiConfig.swift index 2685abc..359ee29 100644 --- a/Sources/XyoClient/ApiConfig.swift +++ b/Sources/XyoClient/ApiConfig.swift @@ -1,4 +1,4 @@ -public class XyoApiConfig { +public class ApiConfig { var apiDomain: String var token: String? diff --git a/Sources/XyoClient/ArchivistApi/ArchivistApiConfig.swift b/Sources/XyoClient/ArchivistApi/ArchivistApiConfig.swift index 014b846..eb879a3 100644 --- a/Sources/XyoClient/ArchivistApi/ArchivistApiConfig.swift +++ b/Sources/XyoClient/ArchivistApi/ArchivistApiConfig.swift @@ -1,4 +1,4 @@ -public class XyoArchivistApiConfig: XyoApiConfig { +public class XyoArchivistApiConfig: ApiConfig { var apiModule: String public init(_ apiModule: String, _ apiDomain: String, _ token: String? = nil) { self.apiModule = apiModule diff --git a/Sources/XyoClient/BoundWitness/BoundWitnessBuilder.swift b/Sources/XyoClient/BoundWitness/BoundWitnessBuilder.swift index c1afddc..552da56 100644 --- a/Sources/XyoClient/BoundWitness/BoundWitnessBuilder.swift +++ b/Sources/XyoClient/BoundWitness/BoundWitnessBuilder.swift @@ -21,7 +21,7 @@ public class BoundWitnessBuilder { return self } - public func witnesses(_ witnesses: [XyoWitness]) -> BoundWitnessBuilder { + public func witnesses(_ witnesses: [AbstractWitness]) -> BoundWitnessBuilder { _witnesses.append(contentsOf: witnesses.map { witness in witness.address }) _previous_hashes.append(contentsOf: witnesses.map { witness in witness.previousHash }) return self diff --git a/Sources/XyoClient/Module/XyoModule.swift b/Sources/XyoClient/Module/AbstractModule.swift similarity index 86% rename from Sources/XyoClient/Module/XyoModule.swift rename to Sources/XyoClient/Module/AbstractModule.swift index db5ba30..5ab36a2 100644 --- a/Sources/XyoClient/Module/XyoModule.swift +++ b/Sources/XyoClient/Module/AbstractModule.swift @@ -1,4 +1,4 @@ -open class XyoModule: Module { +open class AbstractModule: Module { public let address: XyoAddress public var previousHash: String? diff --git a/Sources/XyoClient/XyoPanel.swift b/Sources/XyoClient/XyoPanel.swift index e8fa808..0fe66a4 100644 --- a/Sources/XyoClient/XyoPanel.swift +++ b/Sources/XyoClient/XyoPanel.swift @@ -6,13 +6,13 @@ public enum XyoPanelError: Error { public class XyoPanel { - public init(archivists: [XyoArchivistApiClient], witnesses: [XyoWitness]) { + public init(archivists: [XyoArchivistApiClient], witnesses: [AbstractWitness]) { self._archivists = archivists self._witnesses = witnesses } public convenience init( - archive: String? = nil, apiDomain: String? = nil, witnesses: [XyoWitness]? = nil, + archive: String? = nil, apiDomain: String? = nil, witnesses: [AbstractWitness]? = nil, token: String? = nil ) { let apiConfig = XyoArchivistApiConfig( @@ -23,7 +23,7 @@ public class XyoPanel { public convenience init(observe: (() -> XyoEventPayload?)?) { if observe != nil { - var witnesses = [XyoWitness]() + var witnesses = [AbstractWitness]() if let observe = observe { witnesses.append(XyoEventWitness(observe)) @@ -38,7 +38,7 @@ public class XyoPanel { public typealias XyoPanelReportCallback = (([String]) -> Void) private var _archivists: [XyoArchivistApiClient] - private var _witnesses: [XyoWitness] + private var _witnesses: [AbstractWitness] private var _previous_hash: String? public func report() throws -> [XyoPayload] { @@ -50,11 +50,11 @@ public class XyoPanel { } public func report( - _ adhocWitnesses: [XyoWitness], _ closure: XyoPanelReportCallback? + _ adhocWitnesses: [AbstractWitness], _ closure: XyoPanelReportCallback? ) throws -> [XyoPayload] { - var witnesses: [XyoWitness] = [] + var witnesses: [AbstractWitness] = [] witnesses.append(contentsOf: adhocWitnesses) witnesses.append(contentsOf: self._witnesses) let payloads = witnesses.map { witness in diff --git a/Sources/XyoClient/XyoWitness/XyoWitness.swift b/Sources/XyoClient/XyoWitness/AbstractWitness.swift similarity index 65% rename from Sources/XyoClient/XyoWitness/XyoWitness.swift rename to Sources/XyoClient/XyoWitness/AbstractWitness.swift index 2885ca2..4ac1c34 100644 --- a/Sources/XyoClient/XyoWitness/XyoWitness.swift +++ b/Sources/XyoClient/XyoWitness/AbstractWitness.swift @@ -1,4 +1,4 @@ -open class XyoWitness: XyoModule, Witness { +open class AbstractWitness: AbstractModule, Witness { open func observe() -> [XyoPayload] { preconditionFailure("This method must be overridden") } diff --git a/Sources/XyoClient/XyoWitness/Basic/BasicWitness.swift b/Sources/XyoClient/XyoWitness/Basic/BasicWitness.swift index da64a55..028f10b 100644 --- a/Sources/XyoClient/XyoWitness/Basic/BasicWitness.swift +++ b/Sources/XyoClient/XyoWitness/Basic/BasicWitness.swift @@ -1,6 +1,6 @@ import Foundation -open class XyoBasicWitness: XyoWitness { +open class XyoBasicWitness: AbstractWitness { public typealias TPayloadOut = XyoPayload diff --git a/Sources/XyoClient/XyoWitness/Event/EventWitness.swift b/Sources/XyoClient/XyoWitness/Event/EventWitness.swift index 08a8417..b7e4bc0 100644 --- a/Sources/XyoClient/XyoWitness/Event/EventWitness.swift +++ b/Sources/XyoClient/XyoWitness/Event/EventWitness.swift @@ -1,6 +1,6 @@ import Foundation -open class XyoEventWitness: XyoWitness { +open class XyoEventWitness: AbstractWitness { public init(_ observer: @escaping ObserverClosure) { _observer = observer diff --git a/Sources/XyoClient/XyoWitness/SystemInfo/SystemInfoWitness.swift b/Sources/XyoClient/XyoWitness/SystemInfo/SystemInfoWitness.swift index a9730f1..b081477 100644 --- a/Sources/XyoClient/XyoWitness/SystemInfo/SystemInfoWitness.swift +++ b/Sources/XyoClient/XyoWitness/SystemInfo/SystemInfoWitness.swift @@ -1,6 +1,6 @@ import Foundation -open class XyoSystemInfoWitness: XyoWitness { +open class XyoSystemInfoWitness: AbstractWitness { var allowPathMonitor: Bool diff --git a/Tests/XyoClientTests/Panel.swift b/Tests/XyoClientTests/Panel.swift index a54fd8c..1da2e8b 100644 --- a/Tests/XyoClientTests/Panel.swift +++ b/Tests/XyoClientTests/Panel.swift @@ -16,7 +16,7 @@ final class PanelTests: XCTestCase { let apiDomain = XyoPanel.Defaults.apiDomain let archive = XyoPanel.Defaults.apiModule let address = XyoAddress() - let witness = XyoWitness(address: address) + let witness = AbstractWitness(address: address) let panel = XyoPanel(archive: archive, apiDomain: apiDomain, witnesses: [witness]) XCTAssertNotNil(address) XCTAssertNotNil(panel)