Skip to content

Commit

Permalink
Merge branch 'release/8.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
maximkhatskevich committed Feb 17, 2024
2 parents 01c7215 + c5f9dd3 commit 696f6fb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
11 changes: 0 additions & 11 deletions Sources/XCEUniFlow/0_Helpers/Publisher+Dispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,6 @@ extension Publisher where Output == ProcessedActionReport, Failure == Never
}
}

public
extension Publisher where Output == StateStorage.History.Element, Failure == Never
{
func `as`<T: MutationDecriptor>(
_: T.Type
) -> AnyPublisher<T, Failure> {

compactMap(T.init(from:)).eraseToAnyPublisher()
}
}

// MARK: - Access log - Processed - get features statuses (dashboard)

public
Expand Down
16 changes: 15 additions & 1 deletion Sources/XCEUniFlow/4_Dispatcher/Dispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,21 @@ extension Dispatcher
/// within scope of this dispatcher.
func on<T: MutationDecriptor>( _: T.Type) -> AnyPublisher<T, Never>
{
accessLog.onProcessed.perEachMutation.as(T.self)
accessLog
.onProcessed
.perEachMutation
.compactMap(T.init(from:))
.eraseToAnyPublisher()
}

/// Designeted convenience shortcut for observing all mutations
/// within scope of this dispatcher.
@available(macOS 12.0, *)
func when<T: MutationDecriptor>( _: T.Type) async -> T?
{
await on(T.self) // filter for certain mutation type
.values
.first { _ in true } // no further filtering is necessary
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extension InternalBindingBDD
description: description,
when: { $0.onProcessed
.perEachMutation
.as(M.self)
.compactMap(M.init(from:))
.eraseToAnyPublisher()
}
)
Expand Down

0 comments on commit 696f6fb

Please sign in to comment.