Skip to content

Commit

Permalink
SPT-1998 fix pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mrandrewsmith committed May 31, 2024
1 parent 4a7125c commit 3bb5d4a
Show file tree
Hide file tree
Showing 45 changed files with 73 additions and 72 deletions.
4 changes: 2 additions & 2 deletions NodeKit/NodeKit/CacheNode/ETag/ETagConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
/// These constants are described in accordance with RFC and AppleDeveloper.
public enum ETagConstants {

/// In the **response** headers, the eTag token should be placed under **this** key.
/// There should be the eTag token under **this** key in the **response** headers.
///
/// - SeeAlso:
/// - [AppleDeveloper](https://developer.apple.com/documentation/foundation/httpurlresponse/1417930-allheaderfields)
Expand All @@ -21,7 +21,7 @@ public enum ETagConstants {
return "Etag"
}

/// In the **request** headers, the eTag token should be placed under **this** key.
/// /// There should be the eTag token under **this** key in the **response** headers.
///
/// - SeeAlso: [RFC-7232](https://tools.ietf.org/html/rfc7232#section-3.2)
///
Expand Down
6 changes: 3 additions & 3 deletions NodeKit/NodeKit/CacheNode/ETag/URLETagReaderNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ open class URLETagReaderNode: AsyncNode {
public var next: any TransportLayerNode

/// The key to retrieve the eTag token from the headers.
/// By default, it has the value `eTagRequestHeaderKey`.
/// The default value is `eTagRequestHeaderKey`.
public var etagHeaderKey: String

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - next: The next node for processing.
/// - eTagHeaderKey: The key to add the eTag token to the request.
/// - eTagHeaderKey: The key to retrieve the eTag token from the headers.
public init(next: some TransportLayerNode,
etagHeaderKey: String = ETagConstants.eTagRequestHeaderKey) {
self.next = next
Expand Down
12 changes: 6 additions & 6 deletions NodeKit/NodeKit/CacheNode/ETag/URLETagSaverNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ open class URLETagSaverNode: AsyncNode {
public var next: (any ResponsePostprocessorLayerNode)?

/// The key to retrieve the eTag token from the headers.
/// By default, it has the value `ETagConstants.eTagResponseHeaderKey`.
/// The default value is `ETagConstants.eTagResponseHeaderKey`.
public var eTagHeaderKey: String

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - next: The next node for processing.
Expand Down Expand Up @@ -61,16 +61,16 @@ open class URLETagSaverNode: AsyncNode {
public extension URL {

/// Takes the original URL
/// Gets the dictionary of query parameters
/// Gets dictionary of query parameters
/// If there are no parameters - returns `self.absoluteString`
/// If parameters exist - sorts them, joins into one string
/// If parameters exist - sorts them and joins them into one string
/// Removes query parameters from the original URL
/// Concatenates the string representation of the URL without parameters with the parameter string
///
/// **IMPORTANT**
///
/// The resulting string may be an invalid URL - since the task of this method is to obtain a unique identifier from the URL
/// Moreover, the order of query parameters is not important.
/// The resulting string may be an invalid URL - since the purpose of this method is to extract a unique identifier from the URL
/// Moreover, the order of query parameters does not matter.
func withOrderedQuery() -> String? {
guard var comp = URLComponents(string: self.absoluteString) else {
return nil
Expand Down
10 changes: 5 additions & 5 deletions NodeKit/NodeKit/CacheNode/FirstCachePolicyNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ enum BaseFirstCachePolicyNodeError: Error {
}

/// This node implements the caching policy
/// "Read from cache first, then request from server"
/// "First, read from the cache, then request from the server"
/// - Important: In general, the listener may be notified twice. The first time when the response is read from the cache, and the second time when it is received from the server.
class FirstCachePolicyNode: AsyncStreamNode {
// MARK: - Nested

/// Type for the node reading from URL cache
/// Type of the node reading from URL cache
typealias CacheReaderNode = AsyncNode<URLNetworkRequest, Json>

/// Type for the next node
/// Type of the next node
typealias NextProcessorNode = AsyncNode<RawURLRequest, Json>

// MARK: - Properties
Expand All @@ -39,11 +39,11 @@ class FirstCachePolicyNode: AsyncStreamNode {

// MARK: - Init and Deinit

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - cacheReaderNode: Node for reading from cache.
/// - next: The next node for processing.
/// - next: Next node for processing.
init(cacheReaderNode: any CacheReaderNode, next: any NextProcessorNode) {
self.cacheReaderNode = cacheReaderNode
self.next = next
Expand Down
2 changes: 1 addition & 1 deletion NodeKit/NodeKit/CacheNode/IfServerFailsFromCacheNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ open class IfConnectionFailedFromCacheNode: AsyncNode {
/// Node that reads data from the URL cache.
public var cacheReaderNode: any AsyncNode<URLNetworkRequest, Json>

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - next: The next node for processing.
Expand Down
2 changes: 1 addition & 1 deletion NodeKit/NodeKit/CacheNode/URLNotModifiedTriggerNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class URLNotModifiedTriggerNode: AsyncNode {

// MARK: - Init and deinit

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - next: The next node for processing.
Expand Down
2 changes: 1 addition & 1 deletion NodeKit/NodeKit/Chains/ChainBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ open class URLChainBuilder<Route: URLRouteProvider>: ChainConfigBuilder, ChainBu
public let serviceChainProvider: ServiceChainProvider
public let logFilter: [String]

/// Model for configuring URL query in the request.
/// Model for configuring URL query of the request.
public var config: URLQueryConfigModel

/// Array of header providers for the request.
Expand Down
10 changes: 5 additions & 5 deletions NodeKit/NodeKit/Core/Convertion/DTOConvertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
/// The composition of protocols ``DTOEncodable`` and ``DTODecodable``.
public typealias DTOConvertible = DTOEncodable & DTODecodable

/// Describes an entity from the upper DTO layer.
/// Describes an entity from the higher DTO layer.
/// Can convert itself to the DTO layer.
public protocol DTOEncodable {
/// DTO entity type.
Expand All @@ -16,21 +16,21 @@ public protocol DTOEncodable {
func toDTO() throws -> DTO
}

/// Describes an entity from the upper DTO layer.
/// Describes an entity from the higher DTO layer.
/// Can convert the DTO layer into itself.
public protocol DTODecodable {
/// DTO entity type.
associatedtype DTO: RawDecodable

/// Converts a model from the lower-level DTO into a model of the upper-level DTO.
/// Converts a model from the lower-level DTO into a model of the higher-level DTO.
///
/// - Parameter from: The lower-level DTO model from which to obtain the upper-level model.
/// - Parameter from: The lower-level DTO model from which to obtain the higher-level model.
/// - Returns: The conversion result.
/// - Throws: Any user-defined exceptions may occur.
static func from(dto: DTO) throws -> Self
}

/// Allowing one-line mapping of optional models.
/// Syntactic sugar that allows one-line mapping of optional models.
public extension Optional where Wrapped: DTODecodable {
static func from(dto: Wrapped.DTO?) throws -> Wrapped? {
guard let guarded = dto else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extension Dictionary: RawMappable where Dictionary.Key == String, Dictionary.Val
return self
}

/// Returns the ``Json`` received as input.
/// Just returns the input.
/// - Throws: Does not throw errors.
public static func from(raw: Json) throws -> Json {
return raw
Expand Down
2 changes: 1 addition & 1 deletion NodeKit/NodeKit/Core/Node/Async/AsyncNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public extension AsyncNode {
/// Method for obtaining a Publisher to subscribe to the result.
/// Base implementation of ``CombineCompatibleNode``.
/// Calls the `process` method with a new task upon each subscription.
/// Calls `cancel` on the task when c`ancel` is invoked in `AnyCancellable` object.
/// Calls `cancel` on the task when `cancel` is invoked in `AnyCancellable` object.
///
/// - Parameters:
/// - data: Input data for the node.
Expand Down
2 changes: 1 addition & 1 deletion NodeKit/NodeKit/Core/Node/Async/AsyncStreamNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extension AsyncStreamNode {
/// Method for obtaining a Publisher to subscribe to the result.
/// Base implementation of ``CombineCompatibleNode``.
/// Calls the `process` method with a new task upon each subscription.
/// Calls `cancel` on the task when c`ancel` is invoked in `AnyCancellable` object.
/// Calls `cancel` on the task when `cancel` is invoked in `AnyCancellable` object.
///
/// - Parameters:
/// - data: Input data for the node.
Expand Down
2 changes: 1 addition & 1 deletion NodeKit/NodeKit/Core/Node/Node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public extension Node {
return "\(type(of: self))"
}

/// Name of the object in format:
/// Name of the object in following format:
/// <<<===\(self.objectName)===>>>" + `String.lineTabDeilimeter`
var logViewObjectName: String {
return "<<<===\(self.objectName)===>>>" + .lineTabDeilimeter
Expand Down
8 changes: 4 additions & 4 deletions NodeKit/NodeKit/Core/Node/NodeResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public typealias NodeResult<Output> = Result<Output, Error>

public extension NodeResult {

/// Asynchronous positive result transformation method
/// Method for asynchronous transformation of positive result
///
/// - Parameter transform: Asynchronous function to transform the positive result
/// - Returns: The result of applying the transformation.
Expand All @@ -26,7 +26,7 @@ public extension NodeResult {
}
}

/// Asynchronous error transformation method
/// Method for asynchronous transformation of negative result
///
/// - Parameter transform: Asynchronous function to transform the error
/// - Returns: The result of applying the transformation.
Expand All @@ -41,7 +41,7 @@ public extension NodeResult {
}
}

/// Positive result transformation method that can throw an Exception
/// Method for transformation of positive result that can throw an Exception
///
/// - Parameter transform: Transformation function that can throw an Exception
/// - Returns: The result of applying the transformation or an Exception.
Expand Down Expand Up @@ -73,7 +73,7 @@ public extension NodeResult {
}
}

/// Method that calls an asynchronous function, checking if the task is still alive.
/// Method that calls an asynchronous function and checks if the task was canceled.
/// If the task was canceled, it returns a `CancellationError`.
///
/// - Parameters:
Expand Down
2 changes: 1 addition & 1 deletion NodeKit/NodeKit/Encodings/URLJsonRequestEncodingNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open class URLJsonRequestEncodingNode<Type>: AsyncNode {
/// The next node for processing.
public var next: any AsyncNode<TransportURLRequest, Type>

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - next: The next node for processing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ open class DTOMapperNode<Input, Output>: AsyncNode where Input: RawEncodable, Ou
/// The next node for processing.
public var next: any AsyncNode<Input.Raw, Output.Raw>

/// Initializes the node.
/// Initializer.
///
/// - Parameter next: The next node for processing.
public init(next: any AsyncNode<Input.Raw, Output.Raw>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ open class RawEncoderNode<Input, Output>: AsyncNode where Input: RawEncodable {
/// The next node for processing.
open var next: any AsyncNode<Input.Raw, Output>

/// Initializes the node.
/// Initializer.
///
/// - Parameter next: The next node for processing.
public init(next: some AsyncNode<Input.Raw, Output>) {
self.next = next
}

/// Tries to convert the model to Raw, and then simply passes the conversion result to the next node.
/// Tries to convert the model to Raw and then simply passes the conversion result to the next node.
/// If an error occurs during conversion, it aborts the chain execution.
///
/// - Parameter data: The incoming model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open class DTOEncoderNode<Input, Output>: AsyncNode where Input: DTOEncodable {
self.rawEncodable = rawEncodable
}

/// Tries to convert the model to a DTO, and then passes the conversion result to the next node.
/// Tries to convert the model to a DTO and then passes the conversion result to the next node.
/// If an error occurs during conversion, it interrupts the execution of the chain.
///
/// - Parameter data: Incoming model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ public class ModelInputNode<Input, Output>: AsyncNode where Input: DTOEncodable,
/// The next node for processing.
public var next: any AsyncNode<Input.DTO, Output.DTO>

/// Initializes the node.
/// Initializer.
///
/// - Parameter next: The next node for processing.
public init(next: any AsyncNode<Input.DTO, Output.DTO>) {
self.next = next
}

/// Passes control to the next node,
/// and upon receiving a response, attempts to map the lower DTO layer to the upper one.
/// and upon receiving a response, attempts to map the lower DTO layer to the higher one.
///
/// - Parameter data: Data for the request.
open func process(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ open class VoidInputNode<Output>: AsyncNode {
/// The next node for processing.
public var next: any AsyncNode<Json, Output>

/// Initializes the node.
/// Initializer.
///
/// - Parameter next: The next node for processing.
public init(next: any AsyncNode<Json, Output>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

/// The task of this node is to add metadata to the created request.
/// The purpose of this node is to add metadata to the created request.
/// Initializes the chain for building an HTTP request.
open class MetadataConnectorNode<Raw, Output>: AsyncNode {

Expand All @@ -10,7 +10,7 @@ open class MetadataConnectorNode<Raw, Output>: AsyncNode {
/// Metadata for request.
public var metadata: [String: String]

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - next: The next node in the chain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

/// Model for network request.
/// It serves as an intermediate representation for passing data within the chain.
/// It is later converted into ``RoutableRequestModel``.
/// It is subsequently converted into ``RoutableRequestModel``.
public struct RequestModel<Raw> {
/// Метаданные
public var metadata: [String: String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
/// Model for network request.
/// It serves as an intermediate representation.
/// It is the next stage after ``RequestModel``.
/// It is later converted into ``EncodableRequestModel``.
/// It is subsequently converted into ``EncodableRequestModel``.
public struct RoutableRequestModel<Route, Raw> {
/// Метаданные
public var metadata: [String: String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open class MultipartURLRequestTrasformatorNode<Type>: AsyncNode {
/// HTTP method for the request.
open var method: Method

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - next: The next node for processing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
/// This node adds encoding to the request being created.
open class RequestEncoderNode<Raw, Route, Encoding, Output>: AsyncNode {

/// Type for the next node.
/// Type of the next node.
public typealias NextNode = AsyncNode<EncodableRequestModel<Route, Raw, Encoding>, Output>

/// The next node for processing.
Expand All @@ -20,7 +20,7 @@ open class RequestEncoderNode<Raw, Route, Encoding, Output>: AsyncNode {
/// Encoding for the request.
public var encoding: Encoding

/// Initializes the node.
/// Initializer.
///
/// - Parameters:
/// - next: The next node for processing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
/// This node adds a route to the request.
open class RequestRouterNode<Raw, Route, Output>: AsyncNode {

/// Type for the next node.
/// Type of the next node.
public typealias NextNode = AsyncNode<RoutableRequestModel<Route, Raw>, Output>

/// The next node for processing.
Expand All @@ -20,7 +20,7 @@ open class RequestRouterNode<Raw, Route, Output>: AsyncNode {
/// Route for the request.
public var route: Route

/// Initializes the node
/// Initializer
///
/// - Parameters:
/// - next: The next node for processing.
Expand Down
Loading

0 comments on commit 3bb5d4a

Please sign in to comment.