Skip to content

Commit

Permalink
Update package
Browse files Browse the repository at this point in the history
  • Loading branch information
vmanot committed Nov 5, 2024
1 parent e8bc37c commit 860e675
Show file tree
Hide file tree
Showing 36 changed files with 227 additions and 133 deletions.
33 changes: 33 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"originHash" : "34cbc493f77f3125d8e5ee71eaf10a961a63d68471367996e3880e96a237e7f2",
"pins" : [
{
"identity" : "swallow",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vmanot/Swallow.git",
"state" : {
"branch" : "master",
"revision" : "6227a1114e341daf54e90df61e173599b187a9b1"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
"version" : "1.1.4"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "2bc86522d115234d1f588efe2bcb4ce4be8f8b82",
"version" : "510.0.3"
}
}
],
"version" : 3
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Dispatch
import Swallow

public struct DispatchMutexDevice: ScopedReadWriteMutex, @unchecked Sendable {
public struct DispatchMutexDevice: ScopedReadWriteMutexProtocol, @unchecked Sendable {
@MutexProtected<DispatchQueue, OSUnfairLock>
private var queue: DispatchQueue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ extension _ActorSideEffectSpecification {
}
}

public struct TaskEffectSpecifications {
public enum _TaskEffectSpecificationSymbol {
public struct _ActorSideEffectsSpecifications {
public enum _ActorSideEffectSpecificationSymbol {
case keyPath(AnyKeyPath)
}

/// Apply an effect on the change of something.
public struct OnChange<Content: _ActorSideEffectSpecification>: _ActorSideEffectSpecification {
public let value: _TaskEffectSpecificationSymbol
public let value: _ActorSideEffectSpecificationSymbol
public let content: Content

init(value: _TaskEffectSpecificationSymbol, content: Content) {
init(value: _ActorSideEffectSpecificationSymbol, content: Content) {
self.value = value
self.content = content
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ open class PassthroughTask<Success, Error: Swift.Error>: ObservableTask {
status: Status,
_objectWillChange: ObservableObjectPublisher
) {
guard TaskStatusDescription(status) != TaskStatusDescription(_status) else {
guard ObservableTaskStatusDescription(status) != ObservableTaskStatusDescription(_status) else {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public struct TaskSuccessPublisher<Upstream: ObservableTask> {

extension TaskSuccessPublisher: SingleOutputPublisher {
public typealias Output = Upstream.Success
public typealias Failure = TaskFailure<Upstream.Error>
public typealias Failure = ObservableTaskFailure<Upstream.Error>
}

// MARK: - API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public protocol ObservableTask<Success, Error>: Cancellable, Identifiable, Objec
}

extension ObservableTask {
public var statusDescription: TaskStatusDescription {
public var statusDescription: ObservableTaskStatusDescription {
.init(status)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Swallow

public struct ObservableTaskOutputPublisher<Base: ObservableTask>: Publisher {
public typealias Output = TaskOutput<Base.Success, Base.Error>
public typealias Failure = TaskFailure<Base.Error>
public typealias Failure = ObservableTaskFailure<Base.Error>

private let base: Base

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Runtime
import Swallow

public final class OpaqueObservableTask: CustomStringConvertible, ObjCObject, ObservableTask {
public typealias StatusDescription = TaskStatusDescription
public typealias StatusDescription = ObservableTaskStatusDescription

public typealias Success = Any
public typealias Error = Swift.Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ extension ObservableTaskStatus {
}

public var isOutput: Bool {
TaskStatusDescription(self).isOutput
ObservableTaskStatusDescription(self).isOutput
}

public var isFailure: Bool {
TaskStatusDescription(self).isFailure
ObservableTaskStatusDescription(self).isFailure
}

public var isCompletion: Bool {
TaskStatusDescription(self).isCompletion
ObservableTaskStatusDescription(self).isCompletion
}
}

Expand Down Expand Up @@ -85,7 +85,7 @@ extension ObservableTaskStatus {
}
}

public var failure: TaskFailure<Error>? {
public var failure: ObservableTaskFailure<Error>? {
switch self {
case .canceled:
return .canceled
Expand All @@ -96,7 +96,7 @@ extension ObservableTaskStatus {
}
}

public init(_ failure: TaskFailure<Error>) {
public init(_ failure: ObservableTaskFailure<Error>) {
switch failure {
case .canceled:
self = .canceled
Expand Down Expand Up @@ -297,7 +297,7 @@ extension ObservableTaskStatus {
}
}

public init(_ status: Result<TaskOutput<Success, Error>, TaskFailure<Error>>) {
public init(_ status: Result<TaskOutput<Success, Error>, ObservableTaskFailure<Error>>) {
switch status {
case .success(let output): do {
switch output {
Expand Down Expand Up @@ -331,10 +331,3 @@ extension Result {
}
}
}

// MARK: - Deprecated

@available(*, deprecated, renamed: "ObservableTaskStatusType")
public typealias TaskStatusType = ObservableTaskStatusType
@available(*, deprecated, renamed: "ObservableTaskStatus")
public typealias TaskStatus<T, U: Error> = ObservableTaskStatus<T, U>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Swallow
import SwiftUI

@frozen
public enum TaskStatusDescription: CustomDebugStringConvertible, Hashable {
public enum ObservableTaskStatusDescription: CustomDebugStringConvertible, Hashable {
case idle
case active
case paused
Expand All @@ -33,7 +33,7 @@ public enum TaskStatusDescription: CustomDebugStringConvertible, Hashable {
}
}

extension TaskStatusDescription {
extension ObservableTaskStatusDescription {
public var isTerminal: Bool {
switch self {
case .success, .canceled, .error:
Expand Down Expand Up @@ -66,7 +66,7 @@ extension TaskStatusDescription {
}
}

extension TaskStatusDescription {
extension ObservableTaskStatusDescription {
public var isCompletion: Bool {
switch self {
case .idle, .active, .paused:
Expand All @@ -77,7 +77,7 @@ extension TaskStatusDescription {
}
}

extension TaskStatusDescription {
extension ObservableTaskStatusDescription {
public var isActive: Bool {
switch self {
case .active:
Expand Down Expand Up @@ -124,15 +124,15 @@ extension TaskStatusDescription {

// MARK: - Auxiliary

extension TaskStatusDescription {
extension ObservableTaskStatusDescription {
public enum Comparison {
case idle
case active
case success
case failure

public static func == (
lhs: TaskStatusDescription?,
lhs: ObservableTaskStatusDescription?,
rhs: Self
) -> Bool {
if let lhs = lhs {
Expand Down Expand Up @@ -165,7 +165,7 @@ extension TaskStatusDescription {
}

public static func != (
lhs: TaskStatusDescription?,
lhs: ObservableTaskStatusDescription?,
rhs: Self
) -> Bool {
!(lhs == rhs)
Expand All @@ -175,12 +175,12 @@ extension TaskStatusDescription {

extension ObservableTaskStatus {
@_disfavoredOverload
public static func == (lhs: Self, rhs: TaskStatusDescription.Comparison) -> Bool {
TaskStatusDescription(lhs) == rhs
public static func == (lhs: Self, rhs: ObservableTaskStatusDescription.Comparison) -> Bool {
ObservableTaskStatusDescription(lhs) == rhs
}

@_disfavoredOverload
public static func != (lhs: Self, rhs: TaskStatusDescription.Comparison) -> Bool {
TaskStatusDescription(lhs) != rhs
public static func != (lhs: Self, rhs: ObservableTaskStatusDescription.Comparison) -> Bool {
ObservableTaskStatusDescription(lhs) != rhs
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Swallow

/// An enumeration that represents the source of task failure.
@frozen
public enum TaskFailure<Error: Swift.Error>: _ErrorX, HashEquatable {
public enum ObservableTaskFailure<Error: Swift.Error>: _ErrorX, HashEquatable {
case canceled
case error(Error)

Expand Down Expand Up @@ -43,7 +43,7 @@ public enum TaskFailure<Error: Swift.Error>: _ErrorX, HashEquatable {

// MARK: - Initializers

extension TaskFailure {
extension ObservableTaskFailure {
public init?<Success>(_ status: ObservableTaskStatus<Success, Error>) {
if let failure = status.failure {
self = failure
Expand All @@ -56,7 +56,7 @@ extension TaskFailure {
// MARK: - Supplementary

extension AnyError {
public init(from failure: TaskFailure<Error>) {
public init(from failure: ObservableTaskFailure<Error>) {
switch failure {
case .canceled:
self.init(erasing: CancellationError())
Expand All @@ -69,7 +69,7 @@ extension AnyError {
extension Subscribers.Completion {
public static func failure<Error>(
_ error: Error
) -> Self where Failure == TaskFailure<Error> {
) -> Self where Failure == ObservableTaskFailure<Error> {
.failure(.error(error))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public enum TaskResult<Success, Error: Swift.Error> {
}
}

public init?(from result: Result<TaskOutput<Success, Error>, TaskFailure<Error>>) {
public init?(from result: Result<TaskOutput<Success, Error>, ObservableTaskFailure<Error>>) {
switch result {
case .success(let output):
guard let success = output.value else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public struct TaskButton<Success, Error: Swift.Error, Label: View>: View {
}
}

private var displayTaskStatus: TaskStatusDescription {
private var displayTaskStatus: ObservableTaskStatusDescription {
if let status = task?.statusDescription {
return status
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ public struct TaskButtonConfiguration {
public let isInterruptible: Bool
public let isRestartable: Bool

public let status: TaskStatusDescription
public let status: ObservableTaskStatusDescription
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import Combine
import Swift

public struct TaskButtonStatus: Hashable {
public let description: TaskStatusDescription
public let description: ObservableTaskStatusDescription
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Combine
import Swallow

public protocol _ObservableTaskGroupType: _CancellablesProviding, ObservableObject {
typealias TaskHistory = [TaskStatusDescription]
typealias TaskHistory = [ObservableTaskStatusDescription]

associatedtype Key

Expand All @@ -18,7 +18,7 @@ public protocol _ObservableTaskGroupType: _CancellablesProviding, ObservableObje
@MainActor
func _opaque_lastStatus(
forCustomTaskIdentifier identifier: AnyHashable
) throws -> TaskStatusDescription?
) throws -> ObservableTaskStatusDescription?
}

public class _AnyObservableTaskGroup: ObservableObject {
Expand All @@ -31,7 +31,7 @@ extension _ObservableTaskGroup {
@MainActor
public func _opaque_lastStatus(
forCustomTaskIdentifier identifier: AnyHashable
) throws -> TaskStatusDescription? {
) throws -> ObservableTaskStatusDescription? {
self.lastStatus(forCustomTaskIdentifier: try cast(identifier.base, to: Key.self))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ extension _ObservableTaskGroup {

public func lastStatus(
forCustomTaskIdentifier identifier: CustomIdentifier
) -> TaskStatusDescription? {
) -> ObservableTaskStatusDescription? {
guard keepHistory else {
assertionFailure()

Expand Down Expand Up @@ -194,7 +194,7 @@ extension _ObservableTaskGroup {
@MainActor
public func status(
ofMostRecent action: Key
) -> TaskStatusDescription? {
) -> ObservableTaskStatusDescription? {
if let status = self[customIdentifier: action].last?.statusDescription {
return status
} else {
Expand All @@ -205,8 +205,8 @@ extension _ObservableTaskGroup {
@MainActor
public func status<T>(
ofMostRecent casePath: CasePath<Key, T>
) -> TaskStatusDescription? {
return #try(.optimistic) { () -> TaskStatusDescription? in
) -> ObservableTaskStatusDescription? {
return #try(.optimistic) { () -> ObservableTaskStatusDescription? in
guard let id = try _customIdentifier(ofMostRecent: casePath) else {
return nil
}
Expand All @@ -233,7 +233,7 @@ extension _ObservableTaskGroup: Sequence {
fileprivate var source: Weak<OpaqueObservableTask>?

public let customIdentifier: Key?
public let status: TaskStatusDescription?
public let status: ObservableTaskStatusDescription?
public let history: TaskHistory

public init(
Expand Down
6 changes: 5 additions & 1 deletion Sources/Merge/Intramodular/Process/OSAScriptProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ extension OSAScriptProcess {
public static func _osascript_launchPathAndArguments(
for executableURLAndArguments: (executableURL: URL?, arguments: [String]?)
) throws -> (launchPath: String, arguments: [String]) {
enum Error: Swift.Error {
case executablePathMissing
}

guard let executablePath: String = executableURLAndArguments.executableURL?.path else {
throw NSError(domain: "OSAScriptProcessError", code: 0, userInfo: [NSLocalizedDescriptionKey: "Executable URL is not set."])
throw Error.executablePathMissing
}

let argumentsString: String?
Expand Down
Loading

0 comments on commit 860e675

Please sign in to comment.