Skip to content

Commit 302790a

Browse files
feat!: Conforms to strict concurrency
1 parent d9ea95e commit 302790a

31 files changed

+164
-110
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ let package = Package(
1515
.testTarget(name: "GraphitiTests", dependencies: ["Graphiti"], resources: [
1616
.copy("FederationTests/GraphQL"),
1717
]),
18-
]
18+
],
19+
swiftLanguageVersions: [.v5, .version("6")]
1920
)

Sources/Graphiti/API/API.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import GraphQL
22

33
public protocol API {
4-
associatedtype Resolver
5-
associatedtype ContextType
4+
associatedtype Resolver: Sendable
5+
associatedtype ContextType: Sendable
66
var resolver: Resolver { get }
77
var schema: Schema<Resolver, ContextType> { get }
88
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
public struct NoArguments: Decodable {
1+
public struct NoArguments: Decodable, Sendable {
22
public init() {}
33
}

Sources/Graphiti/Coder/Coders.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import GraphQL
33

44
/// Struct containing a MapEncoder and MapDecoder. These decoders are passed through to the Schema objects and used in
55
/// all encoding and decoding from maps.
6-
public struct Coders {
6+
public struct Coders: Sendable {
77
public let decoder = MapDecoder()
88
public let encoder = MapEncoder()
99

Sources/Graphiti/Component/Component.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import GraphQL
22

3-
open class Component<Resolver, Context> {
3+
open class Component<Resolver: Sendable, Context: Sendable> {
44
let name: String
55
var description: String?
66
var componentType: ComponentType

Sources/Graphiti/Connection/Connection.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import GraphQL
33

4-
public struct Connection<Node> {
4+
public struct Connection<Node: Sendable>: Sendable {
55
public let edges: [Edge<Node>]
66
public let pageInfo: PageInfo
77
}
@@ -16,7 +16,7 @@ public extension Connection where Node: Identifiable, Node.ID: LosslessStringCon
1616
}
1717
}
1818

19-
public extension Sequence where Element: Identifiable,
19+
public extension Sequence where Element: Sendable, Element: Identifiable,
2020
Element.ID: LosslessStringConvertible {
2121
func connection(from arguments: Paginatable) throws -> Connection<Element> {
2222
try connection(from: arguments, makeCursor: Connection<Element>.cursor)
@@ -31,7 +31,7 @@ Element.ID: LosslessStringConvertible {
3131
}
3232
}
3333

34-
public extension Sequence {
34+
public extension Sequence where Element: Sendable {
3535
func connection(
3636
from arguments: Paginatable,
3737
makeCursor: @escaping (Element) throws -> String

Sources/Graphiti/Connection/ConnectionType.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import GraphQL
22

33
public final class ConnectionType<
4-
Resolver,
5-
Context,
6-
ObjectType
4+
Resolver: Sendable,
5+
Context: Sendable,
6+
ObjectType: Sendable
77
>: TypeComponent<
88
Resolver,
99
Context
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
protocol Edgeable {
1+
protocol Edgeable: Sendable {
22
associatedtype Node
33
var node: Node { get }
44
var cursor: String { get }
55
}
66

7-
public struct Edge<Node>: Edgeable {
7+
public struct Edge<Node: Sendable>: Edgeable {
88
public let node: Node
99
public let cursor: String
1010
}

Sources/Graphiti/Connection/PageInfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public struct PageInfo: Codable {
1+
public struct PageInfo: Codable, Sendable {
22
public let hasPreviousPage: Bool
33
public let hasNextPage: Bool
44
public let startCursor: String?

Sources/Graphiti/Connection/PagniationArguments/PaginationArguments.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
public protocol Paginatable: ForwardPaginatable, BackwardPaginatable {}
22

3-
public struct PaginationArguments: Paginatable {
3+
public struct PaginationArguments: Paginatable, Sendable {
44
public let first: Int?
55
public let last: Int?
66
public let after: String?

0 commit comments

Comments
 (0)