diff --git a/Examples/RoutingDemo/Sources/Middleware.swift b/Examples/RoutingDemo/Sources/Middleware.swift index 286c28a..737edc2 100644 --- a/Examples/RoutingDemo/Sources/Middleware.swift +++ b/Examples/RoutingDemo/Sources/Middleware.swift @@ -5,7 +5,9 @@ // bearer-token auth middleware that resolves to a `HikerID`. // +import AWSLambdaEvents import Foundation +import struct HTTPTypes.HTTPResponse import Logging import Routing diff --git a/Examples/RoutingDemo/Sources/main.swift b/Examples/RoutingDemo/Sources/main.swift index 464dbef..39b7796 100644 --- a/Examples/RoutingDemo/Sources/main.swift +++ b/Examples/RoutingDemo/Sources/main.swift @@ -10,6 +10,7 @@ import AWSLambdaEvents import AWSLambdaRuntime import Foundation +import struct HTTPTypes.HTTPResponse import Logging import Routing diff --git a/Examples/TrailLog/Sources/Middleware.swift b/Examples/TrailLog/Sources/Middleware.swift index ac85f0e..59ba676 100644 --- a/Examples/TrailLog/Sources/Middleware.swift +++ b/Examples/TrailLog/Sources/Middleware.swift @@ -7,7 +7,9 @@ // and short-circuit with `401` on failure. // +import AWSLambdaEvents import Foundation +import HTTPTypes import Logging import Routing @@ -16,8 +18,8 @@ import Routing /// through unchanged. struct LoggingMiddleware: MiddlewareProtocol { func handle( - _ input: HTTPRequest, - next: @Sendable (HTTPRequest, Logger) async throws -> RouteResponse, + _ input: Routing.HTTPRequest, + next: @Sendable (Routing.HTTPRequest, Logger) async throws -> RouteResponse, logger: Logger ) async throws -> RouteResponse { let method = input.event.context.http.method.rawValue @@ -33,7 +35,7 @@ struct LoggingMiddleware: MiddlewareProtocol { /// `HikerID`. A production middleware would verify a JWT against an /// identity provider and short-circuit with `401` on failure. struct AuthMiddleware: Middleware { - typealias Input = HTTPRequest + typealias Input = Routing.HTTPRequest typealias Value = HikerID struct HikerID: Sendable, Codable { @@ -41,7 +43,7 @@ struct AuthMiddleware: Middleware { } func process( - _ input: HTTPRequest, + _ input: Routing.HTTPRequest, logger _: Logger ) async throws -> MiddlewareAction { .next(HikerID(value: "demo-hiker")) diff --git a/Package.swift b/Package.swift index 31ffaec..f895c71 100644 --- a/Package.swift +++ b/Package.swift @@ -39,7 +39,7 @@ let package = Package( .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), .package( url: "https://github.com/awslabs/swift-aws-lambda-runtime", - from: "2.6.2" + from: "3.0.1" ), .package(url: "https://github.com/apple/swift-log.git", from: "1.6.0"), .package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0"), @@ -53,25 +53,25 @@ let package = Package( .product(name: "RoutingKit", package: "routing-kit"), .product(name: "HTTPTypes", package: "swift-http-types"), .product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"), - ] + ], ), .target( name: "DynamoQueries", dependencies: [ "DynamoQueriesMacros", .product(name: "Logging", package: "swift-log"), - ] + ], ), .target( name: "DynamoQueriesSoto", dependencies: [ "DynamoQueries", .product(name: "SotoDynamoDB", package: "soto"), - ] + ], ), .target( name: "DynamoQueriesTestSupport", - dependencies: ["DynamoQueries"] + dependencies: ["DynamoQueries"], ), .target( name: "DynamoQueriesSnapshotTesting", @@ -80,7 +80,7 @@ let package = Package( "DynamoQueriesTestSupport", .product(name: "SnapshotTesting", package: "swift-snapshot-testing"), .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), - ] + ], ), .macro( name: "DynamoQueriesMacros", @@ -89,21 +89,21 @@ let package = Package( .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), .product(name: "SwiftCompilerPlugin", package: "swift-syntax"), .product(name: "SwiftParser", package: "swift-syntax"), - ] + ], ), .testTarget( name: "RoutingTests", dependencies: [ "Routing", .product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"), - ] + ], ), .testTarget( name: "DynamoQueriesMacrosTests", dependencies: [ "DynamoQueriesMacros", .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"), - ] + ], ), .testTarget( name: "DynamoQueriesTests", @@ -114,7 +114,7 @@ let package = Package( "DynamoQueriesSnapshotTesting", .product(name: "SotoDynamoDB", package: "soto"), .product(name: "InlineSnapshotTesting", package: "swift-snapshot-testing"), - ] + ], ), .executableTarget( name: "RoutingDemo", @@ -123,12 +123,12 @@ let package = Package( .product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"), .product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"), ], - path: "Examples/RoutingDemo/Sources" + path: "Examples/RoutingDemo/Sources", ), .executableTarget( name: "DynamoQueriesDemo", dependencies: ["DynamoQueries", "DynamoQueriesTestSupport"], - path: "Examples/DynamoQueriesDemo/Sources" + path: "Examples/DynamoQueriesDemo/Sources", ), .executableTarget( name: "TrailLogDemo", @@ -138,7 +138,7 @@ let package = Package( .product(name: "AWSLambdaEvents", package: "swift-aws-lambda-events"), .product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"), ], - path: "Examples/TrailLog/Sources" + path: "Examples/TrailLog/Sources", ), .target( name: "APIGatewayV2Server", @@ -150,7 +150,19 @@ let package = Package( .product(name: "HummingbirdTLS", package: "hummingbird"), .product(name: "Logging", package: "swift-log"), .product(name: "AsyncHTTPClient", package: "async-http-client"), - ] + ], ), ] ) + +for target in package.targets { + target.swiftSettings = target.swiftSettings ?? [] + target.swiftSettings?.append(contentsOf: [ + .enableUpcomingFeature("ExistentialAny"), + .enableUpcomingFeature("ImmutableWeakCaptures"), + .enableUpcomingFeature("InferIsolatedConformances"), + .enableUpcomingFeature("InternalImportsByDefault"), + .enableUpcomingFeature("MemberImportVisibility"), + .enableUpcomingFeature("NonisolatedNonsendingByDefault"), + ]) +} diff --git a/Sources/APIGatewayV2Server/APIGatewayV2Server.swift b/Sources/APIGatewayV2Server/APIGatewayV2Server.swift index a92a749..4a35afb 100644 --- a/Sources/APIGatewayV2Server/APIGatewayV2Server.swift +++ b/Sources/APIGatewayV2Server/APIGatewayV2Server.swift @@ -10,8 +10,9 @@ import HTTPTypes import Hummingbird import HummingbirdCore import HummingbirdTLS -import Logging +public import Logging import NIOFoundationCompat +import NIOHTTP1 import NIOSSL /// Local development HTTP server that proxies requests to a Lambda local server. diff --git a/Sources/APIGatewayV2Server/LambdaRuntime+APIGateway.swift b/Sources/APIGatewayV2Server/LambdaRuntime+APIGateway.swift index fee80c7..9b6e48a 100644 --- a/Sources/APIGatewayV2Server/LambdaRuntime+APIGateway.swift +++ b/Sources/APIGatewayV2Server/LambdaRuntime+APIGateway.swift @@ -3,9 +3,9 @@ // LambdaKit // -import AWSLambdaRuntime +public import AWSLambdaRuntime import Foundation -import Logging +public import Logging /// Configuration for one local HTTP gateway server: the port to listen on, and /// an optional transformer to fill in what the real gateway would have put on diff --git a/Sources/APIGatewayV2Server/MutableAPIGatewayV2Request.swift b/Sources/APIGatewayV2Server/MutableAPIGatewayV2Request.swift index 8ccf62c..d3cf309 100644 --- a/Sources/APIGatewayV2Server/MutableAPIGatewayV2Request.swift +++ b/Sources/APIGatewayV2Server/MutableAPIGatewayV2Request.swift @@ -3,11 +3,11 @@ // LambdaKit // -import AWSLambdaEvents +public import AWSLambdaEvents import Foundation import HTTPTypes -import Hummingbird -import NIOCore +public import Hummingbird +public import NIOCore import NIOFoundationCompat public struct MutableAPIGatewayV2Request: Encodable, Sendable { diff --git a/Sources/DynamoQueries/Core/DynamoValue.swift b/Sources/DynamoQueries/Core/DynamoValue.swift index 8e76097..497c2f4 100644 --- a/Sources/DynamoQueries/Core/DynamoValue.swift +++ b/Sources/DynamoQueries/Core/DynamoValue.swift @@ -1,4 +1,4 @@ -import Foundation +public import Foundation /// A value matching one of DynamoDB's attribute-value variants. /// @@ -42,7 +42,7 @@ extension DynamoValue: Codable { case binarySet = "BS" } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) if let value = try container.decodeIfPresent(String.self, forKey: .string) { self = .string(value) @@ -89,7 +89,7 @@ extension DynamoValue: Codable { } } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) switch self { case .string(let value): try container.encode(value, forKey: .string) diff --git a/Sources/DynamoQueries/Query/Client/DynamoClient.swift b/Sources/DynamoQueries/Query/Client/DynamoClient.swift index 8795b65..5f94d5b 100644 --- a/Sources/DynamoQueries/Query/Client/DynamoClient.swift +++ b/Sources/DynamoQueries/Query/Client/DynamoClient.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// The transport-level interface a `DynamoClient` adapter implements. Each /// method is non-chainable on purpose. Chaining lives on the `*Input` types diff --git a/Sources/DynamoQueries/Query/Client/Logger+DynamoQueries.swift b/Sources/DynamoQueries/Query/Client/Logger+DynamoQueries.swift index d3d5e32..0d48a96 100644 --- a/Sources/DynamoQueries/Query/Client/Logger+DynamoQueries.swift +++ b/Sources/DynamoQueries/Query/Client/Logger+DynamoQueries.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging public extension Logger { /// The logger DynamoQueries `execute` calls use when the caller doesn't diff --git a/Sources/DynamoQueries/Query/Reads/BatchGet.swift b/Sources/DynamoQueries/Query/Reads/BatchGet.swift index 52a7861..06cd676 100644 --- a/Sources/DynamoQueries/Query/Reads/BatchGet.swift +++ b/Sources/DynamoQueries/Query/Reads/BatchGet.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// A multi-key read against a single table. Up to 100 keys per DynamoDB /// request, 16MB total per response. Adapters auto-retry the diff --git a/Sources/DynamoQueries/Query/Reads/GetItem.swift b/Sources/DynamoQueries/Query/Reads/GetItem.swift index c079956..17920c3 100644 --- a/Sources/DynamoQueries/Query/Reads/GetItem.swift +++ b/Sources/DynamoQueries/Query/Reads/GetItem.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// A single-item lookup keyed by primary key, parameterized by the model it /// returns. diff --git a/Sources/DynamoQueries/Query/Reads/MappedReads.swift b/Sources/DynamoQueries/Query/Reads/MappedReads.swift index 4aca15c..6377b9f 100644 --- a/Sources/DynamoQueries/Query/Reads/MappedReads.swift +++ b/Sources/DynamoQueries/Query/Reads/MappedReads.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// Mapped read inputs: the result of calling `.map` on a *collection / paged* /// read (`QueryInput`, `ScanInput`, `BatchGetInput`) or on `UpdateReturning`. @@ -42,8 +42,12 @@ public struct MappedPageSequence< var base: Base.AsyncIterator let transform: @Sendable (Model) throws -> Output - public mutating func next() async throws -> QueryPage? { - guard let page = try await base.next() else { return nil } + public mutating func next( + isolation actor: isolated (any Actor)? + ) async throws -> QueryPage? { + guard let page = try await base.next(isolation: actor) else { + return nil + } return try page.map(transform) } } diff --git a/Sources/DynamoQueries/Query/Reads/Pagination.swift b/Sources/DynamoQueries/Query/Reads/Pagination.swift index 2833a16..ffa361d 100644 --- a/Sources/DynamoQueries/Query/Reads/Pagination.swift +++ b/Sources/DynamoQueries/Query/Reads/Pagination.swift @@ -37,7 +37,7 @@ public struct PaginationToken: Sendable, Equatable { } extension PaginationToken: Codable { - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.singleValueContainer() let string = try container.decode(String.self) guard let token = PaginationToken(string: string) else { @@ -49,7 +49,7 @@ extension PaginationToken: Codable { self = token } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.singleValueContainer() try container.encode(self.stringValue) } diff --git a/Sources/DynamoQueries/Query/Reads/QueryInput.swift b/Sources/DynamoQueries/Query/Reads/QueryInput.swift index 9ea7561..1548e84 100644 --- a/Sources/DynamoQueries/Query/Reads/QueryInput.swift +++ b/Sources/DynamoQueries/Query/Reads/QueryInput.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// A compiled DynamoDB Query request, parameterized by the model it returns. /// diff --git a/Sources/DynamoQueries/Query/Reads/ReadProtocols.swift b/Sources/DynamoQueries/Query/Reads/ReadProtocols.swift index 5c5880b..cb95589 100644 --- a/Sources/DynamoQueries/Query/Reads/ReadProtocols.swift +++ b/Sources/DynamoQueries/Query/Reads/ReadProtocols.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// Read abstractions that let a call site name *what a read delivers* without /// naming *how it's stored*. Each has a primary associated type `Output`, so a diff --git a/Sources/DynamoQueries/Query/Reads/ScanInput.swift b/Sources/DynamoQueries/Query/Reads/ScanInput.swift index 096c344..198896f 100644 --- a/Sources/DynamoQueries/Query/Reads/ScanInput.swift +++ b/Sources/DynamoQueries/Query/Reads/ScanInput.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// A compiled DynamoDB Scan request, parameterized by the model it returns. /// diff --git a/Sources/DynamoQueries/Query/Schema/KeyAttribute.swift b/Sources/DynamoQueries/Query/Schema/KeyAttribute.swift index a5d3f13..6f4068e 100644 --- a/Sources/DynamoQueries/Query/Schema/KeyAttribute.swift +++ b/Sources/DynamoQueries/Query/Schema/KeyAttribute.swift @@ -1,4 +1,4 @@ -import Foundation +public import Foundation /// The DynamoDB scalar type of a key attribute. /// diff --git a/Sources/DynamoQueries/Query/Transactions/TransactGet.swift b/Sources/DynamoQueries/Query/Transactions/TransactGet.swift index 3e6fbf2..9d315d1 100644 --- a/Sources/DynamoQueries/Query/Transactions/TransactGet.swift +++ b/Sources/DynamoQueries/Query/Transactions/TransactGet.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// A primary-key read leg that can be composed into a `TransactGet { ... }` /// block *or* executed on its own. Both a plain `GetItemInput` and a mapped diff --git a/Sources/DynamoQueries/Query/Transactions/TransactWrite.swift b/Sources/DynamoQueries/Query/Transactions/TransactWrite.swift index da7ca84..a3c1222 100644 --- a/Sources/DynamoQueries/Query/Transactions/TransactWrite.swift +++ b/Sources/DynamoQueries/Query/Transactions/TransactWrite.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// Thrown by `TransactWriteInput.execute(using:)` when DynamoDB cancels the /// whole transaction. Reports the per-leg cancellation reasons in the same diff --git a/Sources/DynamoQueries/Query/Writes/BatchWrite.swift b/Sources/DynamoQueries/Query/Writes/BatchWrite.swift index 405d88b..efc1fd4 100644 --- a/Sources/DynamoQueries/Query/Writes/BatchWrite.swift +++ b/Sources/DynamoQueries/Query/Writes/BatchWrite.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// A multi-item write against a single table: up to 25 items (puts + /// deletes combined) per DynamoDB request, 16MB total. Adapters retry the diff --git a/Sources/DynamoQueries/Query/Writes/DeleteItem.swift b/Sources/DynamoQueries/Query/Writes/DeleteItem.swift index e9e1e40..6c2ab63 100644 --- a/Sources/DynamoQueries/Query/Writes/DeleteItem.swift +++ b/Sources/DynamoQueries/Query/Writes/DeleteItem.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// A delete request for a single item, addressed by primary key. Optionally /// guarded by a condition expression. The delete only fires if the diff --git a/Sources/DynamoQueries/Query/Writes/PutItem.swift b/Sources/DynamoQueries/Query/Writes/PutItem.swift index 8d6f93f..b7289f6 100644 --- a/Sources/DynamoQueries/Query/Writes/PutItem.swift +++ b/Sources/DynamoQueries/Query/Writes/PutItem.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// An insert-or-replace request for a single item. /// diff --git a/Sources/DynamoQueries/Query/Writes/UpdateItem.swift b/Sources/DynamoQueries/Query/Writes/UpdateItem.swift index 2228de8..9e6426b 100644 --- a/Sources/DynamoQueries/Query/Writes/UpdateItem.swift +++ b/Sources/DynamoQueries/Query/Writes/UpdateItem.swift @@ -1,4 +1,4 @@ -import Logging +public import Logging /// A targeted update against an existing item, identified by its primary /// key. Unlike `PutItem`, `UpdateItem` modifies only the attributes named in diff --git a/Sources/DynamoQueriesMacros/MarkerMacros.swift b/Sources/DynamoQueriesMacros/MarkerMacros.swift index 300e7c8..83f642b 100644 --- a/Sources/DynamoQueriesMacros/MarkerMacros.swift +++ b/Sources/DynamoQueriesMacros/MarkerMacros.swift @@ -1,5 +1,5 @@ -import SwiftSyntax -import SwiftSyntaxMacros +public import SwiftSyntax +public import SwiftSyntaxMacros /// Marks a property as the partition key. Generates no code. Read by @Table. public struct PartitionKeyMacro: PeerMacro { diff --git a/Sources/DynamoQueriesMacros/Plugin.swift b/Sources/DynamoQueriesMacros/Plugin.swift index f3f4267..917d822 100644 --- a/Sources/DynamoQueriesMacros/Plugin.swift +++ b/Sources/DynamoQueriesMacros/Plugin.swift @@ -3,7 +3,7 @@ import SwiftSyntaxMacros @main struct DynamoKitMacrosPlugin: CompilerPlugin { - let providingMacros: [Macro.Type] = [ + let providingMacros: [any Macro.Type] = [ TableMacro.self, PartitionKeyMacro.self, SortKeyMacro.self, diff --git a/Sources/DynamoQueriesMacros/TableMacro.swift b/Sources/DynamoQueriesMacros/TableMacro.swift index c6a6267..c072d4f 100644 --- a/Sources/DynamoQueriesMacros/TableMacro.swift +++ b/Sources/DynamoQueriesMacros/TableMacro.swift @@ -1,5 +1,5 @@ -import SwiftSyntax -import SwiftSyntaxMacros +public import SwiftSyntax +public import SwiftSyntaxMacros import SwiftParser public struct TableMacro: ExtensionMacro { diff --git a/Sources/DynamoQueriesSnapshotTesting/Snapshotting+Request.swift b/Sources/DynamoQueriesSnapshotTesting/Snapshotting+Request.swift index df6ea3a..2d9e44c 100644 --- a/Sources/DynamoQueriesSnapshotTesting/Snapshotting+Request.swift +++ b/Sources/DynamoQueriesSnapshotTesting/Snapshotting+Request.swift @@ -1,6 +1,6 @@ import DynamoQueries -import DynamoQueriesTestSupport -import SnapshotTesting +public import DynamoQueriesTestSupport +public import SnapshotTesting extension Snapshotting where Value: RenderableRequest, Format == String { /// A snapshot strategy that compares a DynamoDB request by its rendered diff --git a/Sources/DynamoQueriesSoto/SotoClient.swift b/Sources/DynamoQueriesSoto/SotoClient.swift index 56990b0..8fd93cb 100644 --- a/Sources/DynamoQueriesSoto/SotoClient.swift +++ b/Sources/DynamoQueriesSoto/SotoClient.swift @@ -1,6 +1,6 @@ -import DynamoQueries +public import DynamoQueries import Logging -import SotoDynamoDB +public import SotoDynamoDB import Foundation // MARK: - Helpers diff --git a/Sources/DynamoQueriesSoto/SotoCodableEncoder.swift b/Sources/DynamoQueriesSoto/SotoCodableEncoder.swift index 2d97df8..0f1b04a 100644 --- a/Sources/DynamoQueriesSoto/SotoCodableEncoder.swift +++ b/Sources/DynamoQueriesSoto/SotoCodableEncoder.swift @@ -1,4 +1,4 @@ -import DynamoQueries +public import DynamoQueries import SotoDynamoDB /// The default `DynamoExpressionRepresentation` for `Codable` aggregates: diff --git a/Sources/DynamoQueriesSoto/SotoSchema.swift b/Sources/DynamoQueriesSoto/SotoSchema.swift index 1f9d41d..457fff9 100644 --- a/Sources/DynamoQueriesSoto/SotoSchema.swift +++ b/Sources/DynamoQueriesSoto/SotoSchema.swift @@ -1,6 +1,6 @@ -import DynamoQueries +public import DynamoQueries import Logging -import SotoDynamoDB +public import SotoDynamoDB // MARK: - Schema → CreateTable // diff --git a/Sources/DynamoQueriesTestSupport/ExpectFailure.swift b/Sources/DynamoQueriesTestSupport/ExpectFailure.swift index 0f8e6df..1906242 100644 --- a/Sources/DynamoQueriesTestSupport/ExpectFailure.swift +++ b/Sources/DynamoQueriesTestSupport/ExpectFailure.swift @@ -1,4 +1,4 @@ -import DynamoQueries +public import DynamoQueries /// Run `operation` against a real `DynamoClient`, asserting it fails with a /// ``ConditionalCheckFailed`` parameterized by `Model`. Returns the typed diff --git a/Sources/DynamoQueriesTestSupport/FailingDynamoClient.swift b/Sources/DynamoQueriesTestSupport/FailingDynamoClient.swift index fc0aa5e..85e56d2 100644 --- a/Sources/DynamoQueriesTestSupport/FailingDynamoClient.swift +++ b/Sources/DynamoQueriesTestSupport/FailingDynamoClient.swift @@ -1,5 +1,5 @@ -import DynamoQueries -import Logging +public import DynamoQueries +public import Logging /// A `DynamoClient` whose whole job is to **fail**, so you can test how a /// repository or service reacts when DynamoDB errors. It throws a configured diff --git a/Sources/DynamoQueriesTestSupport/RecordingDynamoClient.swift b/Sources/DynamoQueriesTestSupport/RecordingDynamoClient.swift index 961cd2b..ccbad0b 100644 --- a/Sources/DynamoQueriesTestSupport/RecordingDynamoClient.swift +++ b/Sources/DynamoQueriesTestSupport/RecordingDynamoClient.swift @@ -1,5 +1,5 @@ -import DynamoQueries -import Logging +public import DynamoQueries +public import Logging /// A programmable `DynamoClient` test double: a **stub + spy**. It never talks /// to DynamoDB; instead it: @@ -74,10 +74,10 @@ public actor RecordingDynamoClient: DynamoClient { // MARK: - Injected errors - private var putErrors: [ObjectIdentifier: Error] = [:] - private var updateErrors: [ObjectIdentifier: Error] = [:] - private var deleteErrors: [ObjectIdentifier: Error] = [:] - private var transactWriteError: Error? + private var putErrors: [ObjectIdentifier: any Error] = [:] + private var updateErrors: [ObjectIdentifier: any Error] = [:] + private var deleteErrors: [ObjectIdentifier: any Error] = [:] + private var transactWriteError: (any Error)? // MARK: - DynamoClient @@ -243,19 +243,19 @@ public actor RecordingDynamoClient: DynamoClient { // MARK: - Error injection - public func throwOnPut(_ error: Error, for type: Model.Type) { + public func throwOnPut(_ error: any Error, for type: Model.Type) { putErrors[ObjectIdentifier(type)] = error } - public func throwOnUpdate(_ error: Error, for type: Model.Type) { + public func throwOnUpdate(_ error: any Error, for type: Model.Type) { updateErrors[ObjectIdentifier(type)] = error } - public func throwOnDelete(_ error: Error, for type: Model.Type) { + public func throwOnDelete(_ error: any Error, for type: Model.Type) { deleteErrors[ObjectIdentifier(type)] = error } - public func throwOnTransactWrite(_ error: Error) { + public func throwOnTransactWrite(_ error: any Error) { transactWriteError = error } @@ -358,7 +358,7 @@ public actor RecordingDynamoClient: DynamoClient { } private func throwIfPrimed( - _ errors: inout [ObjectIdentifier: Error], + _ errors: inout [ObjectIdentifier: any Error], _ type: Model.Type ) throws { if let error = errors.removeValue(forKey: ObjectIdentifier(type)) { diff --git a/Sources/DynamoQueriesTestSupport/RenderableRequest.swift b/Sources/DynamoQueriesTestSupport/RenderableRequest.swift index 518c551..63b4cfd 100644 --- a/Sources/DynamoQueriesTestSupport/RenderableRequest.swift +++ b/Sources/DynamoQueriesTestSupport/RenderableRequest.swift @@ -1,4 +1,4 @@ -import DynamoQueries +public import DynamoQueries import Foundation /// A DynamoDB request that can render itself to a deterministic, human-readable diff --git a/Sources/Routing/Engines/DictionaryRouter.swift b/Sources/Routing/Engines/DictionaryRouter.swift index d63943e..601975e 100644 --- a/Sources/Routing/Engines/DictionaryRouter.swift +++ b/Sources/Routing/Engines/DictionaryRouter.swift @@ -16,7 +16,7 @@ // protocols so that it can plug into our generic `RouterBuilder` as // the `Engine` parameter, identically to how `TrieRouter` does. -import RoutingKit +public import RoutingKit // MARK: - DictionaryRouterBuilder diff --git a/Sources/Routing/Errors/RequestBodyError.swift b/Sources/Routing/Errors/RequestBodyError.swift index 93aea8e..ddb0847 100644 --- a/Sources/Routing/Errors/RequestBodyError.swift +++ b/Sources/Routing/Errors/RequestBodyError.swift @@ -11,7 +11,7 @@ public enum RequestBodyError: Error { public var message: String { switch self { - case let .decodingFailed(error): + case .decodingFailed: "The request body could not be decoded." } } diff --git a/Sources/Routing/Middleware/Middleware.swift b/Sources/Routing/Middleware/Middleware.swift index 3914685..874079f 100644 --- a/Sources/Routing/Middleware/Middleware.swift +++ b/Sources/Routing/Middleware/Middleware.swift @@ -5,7 +5,7 @@ // Copyright © 2026 SongShift, LLC. All rights reserved. // -import Logging +public import Logging // MARK: - MiddlewareContext diff --git a/Sources/Routing/Middleware/MiddlewareCombinators.swift b/Sources/Routing/Middleware/MiddlewareCombinators.swift index cf8d3f1..a5d2e24 100644 --- a/Sources/Routing/Middleware/MiddlewareCombinators.swift +++ b/Sources/Routing/Middleware/MiddlewareCombinators.swift @@ -17,7 +17,7 @@ // the `handle` implementation that wires `next` callbacks together. // -import Logging +public import Logging // MARK: - Chain diff --git a/Sources/Routing/Middleware/MiddlewareProtocol.swift b/Sources/Routing/Middleware/MiddlewareProtocol.swift index 2c2e851..450d87e 100644 --- a/Sources/Routing/Middleware/MiddlewareProtocol.swift +++ b/Sources/Routing/Middleware/MiddlewareProtocol.swift @@ -5,7 +5,7 @@ // Copyright © 2026 SongShift, LLC. All rights reserved. // -import Logging +public import Logging // MARK: - Action diff --git a/Sources/Routing/Response.swift b/Sources/Routing/Response.swift index c2bc9fc..1e39bd5 100644 --- a/Sources/Routing/Response.swift +++ b/Sources/Routing/Response.swift @@ -5,8 +5,8 @@ // Copyright © 2026 SongShift, LLC. All rights reserved. // -import Foundation -import HTTPTypes +public import Foundation +public import HTTPTypes /// Wire-ready response. Produced by `Router.handle`, consumed by the edge. public struct Response: Sendable { diff --git a/Sources/Routing/Routable.swift b/Sources/Routing/Routable.swift index b6f3784..bee349f 100644 --- a/Sources/Routing/Routable.swift +++ b/Sources/Routing/Routable.swift @@ -5,7 +5,7 @@ // Copyright © 2026 SongShift, LLC. All rights reserved. // -import Foundation +public import Foundation /// A type that can be routed through a `Router`. /// diff --git a/Sources/Routing/Router.swift b/Sources/Routing/Router.swift index 73848cd..921c376 100644 --- a/Sources/Routing/Router.swift +++ b/Sources/Routing/Router.swift @@ -6,8 +6,9 @@ // import Foundation -import Logging -import RoutingKit +public import Logging +import HTTPTypes +public import RoutingKit /// The handler signature stored at every routing key for `Routable` `R`. public typealias RouteHandler = @Sendable (R, Logger) async throws -> RouteResponse diff --git a/Sources/Routing/Transports/HTTP/HTTPRequest.swift b/Sources/Routing/Transports/HTTP/HTTPRequest.swift index 64113cd..ad46919 100644 --- a/Sources/Routing/Transports/HTTP/HTTPRequest.swift +++ b/Sources/Routing/Transports/HTTP/HTTPRequest.swift @@ -5,8 +5,8 @@ // Copyright © 2026 SongShift, LLC. All rights reserved. // -import AWSLambdaEvents -import Foundation +public import AWSLambdaEvents +public import Foundation /// An HTTP request, modeled as a thin `@dynamicMemberLookup` wrapper around an /// AWS Lambda `APIGatewayV2Request` event. diff --git a/Sources/Routing/Transports/HTTP/HTTPRouter.swift b/Sources/Routing/Transports/HTTP/HTTPRouter.swift index b4b15af..c20d694 100644 --- a/Sources/Routing/Transports/HTTP/HTTPRouter.swift +++ b/Sources/Routing/Transports/HTTP/HTTPRouter.swift @@ -25,8 +25,10 @@ // `DictionaryRouter` engine instead, since WebSocket route keys are flat. // -import Logging -import RoutingKit +import AWSLambdaEvents +import HTTPTypes +public import Logging +public import RoutingKit // MARK: - HTTPRequest: routing key convention diff --git a/Sources/Routing/Transports/WebSocket/WebSocketRequest.swift b/Sources/Routing/Transports/WebSocket/WebSocketRequest.swift index cbddfa3..8c9d588 100644 --- a/Sources/Routing/Transports/WebSocket/WebSocketRequest.swift +++ b/Sources/Routing/Transports/WebSocket/WebSocketRequest.swift @@ -5,8 +5,8 @@ // Copyright © 2026 SongShift, LLC. All rights reserved. // -import AWSLambdaEvents -import Foundation +public import AWSLambdaEvents +public import Foundation /// A WebSocket message, modeled as a thin `@dynamicMemberLookup` wrapper around /// an AWS Lambda `APIGatewayWebSocketRequest` event. diff --git a/Sources/Routing/Transports/WebSocket/WebSocketRouter.swift b/Sources/Routing/Transports/WebSocket/WebSocketRouter.swift index 1a19218..d421d9e 100644 --- a/Sources/Routing/Transports/WebSocket/WebSocketRouter.swift +++ b/Sources/Routing/Transports/WebSocket/WebSocketRouter.swift @@ -24,8 +24,9 @@ // the problem. // -import Logging -import RoutingKit +import AWSLambdaEvents +public import Logging +public import RoutingKit // MARK: - WebSocketRequest: routing key convention diff --git a/Tests/DynamoQueriesMacrosTests/TableMacroTests.swift b/Tests/DynamoQueriesMacrosTests/TableMacroTests.swift index c7d635c..d91e789 100644 --- a/Tests/DynamoQueriesMacrosTests/TableMacroTests.swift +++ b/Tests/DynamoQueriesMacrosTests/TableMacroTests.swift @@ -1,10 +1,11 @@ import SwiftSyntaxMacros +import SwiftSyntaxMacrosGenericTestSupport import SwiftSyntaxMacrosTestSupport import XCTest @testable import DynamoQueriesMacros -private let testMacros: [String: Macro.Type] = [ +private let testMacros: [String: any Macro.Type] = [ "Table": TableMacro.self, "Index": IndexMacro.self, "PartitionKey": PartitionKeyMacro.self, diff --git a/Tests/DynamoQueriesTests/DynamoCoderTests.swift b/Tests/DynamoQueriesTests/DynamoCoderTests.swift index e6956bf..b1c2434 100644 --- a/Tests/DynamoQueriesTests/DynamoCoderTests.swift +++ b/Tests/DynamoQueriesTests/DynamoCoderTests.swift @@ -177,12 +177,12 @@ struct DynamoCoderTests { self.id = id self.nickname = nickname } - init(from decoder: Decoder) throws { + init(from decoder: any Decoder) throws { let c = try decoder.container(keyedBy: CodingKeys.self) self.id = try c.decode(String.self, forKey: .id) self.nickname = try c.decodeIfPresent(String.self, forKey: .nickname) } - func encode(to encoder: Encoder) throws { + func encode(to encoder: any Encoder) throws { var c = encoder.container(keyedBy: CodingKeys.self) try c.encode(id, forKey: .id) // Force-write nil so we exercise the encodeNil path rather diff --git a/Tests/DynamoQueriesTests/Models/TrailLog.swift b/Tests/DynamoQueriesTests/Models/TrailLog.swift index b342f4b..7fd55e6 100644 --- a/Tests/DynamoQueriesTests/Models/TrailLog.swift +++ b/Tests/DynamoQueriesTests/Models/TrailLog.swift @@ -1,7 +1,7 @@ -import DynamoQueries +public import DynamoQueries import DynamoQueriesSoto -import Foundation -import SotoDynamoDB +public import Foundation +public import SotoDynamoDB // Binary keys in the source are modeled as `String` here: DynamoQueries' diff --git a/Tests/RoutingTests/RouterBodyDecodingTests.swift b/Tests/RoutingTests/RouterBodyDecodingTests.swift index f193a41..527fb56 100644 --- a/Tests/RoutingTests/RouterBodyDecodingTests.swift +++ b/Tests/RoutingTests/RouterBodyDecodingTests.swift @@ -4,6 +4,7 @@ // Copyright © 2026 SongShift, LLC. All rights reserved. // +import HTTPTypes import Logging import Routing import Testing