diff --git a/Package.swift b/Package.swift index c44aaf5..5ba6d24 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.9 +// swift-tools-version:6.0 //===----------------------------------------------------------------------===// // @@ -24,8 +24,7 @@ import CompilerPluginSupport import PackageDescription -let swiftSettings: [SwiftSetting] = [.enableExperimentalFeature("StrictConcurrency=complete"), - ] +let swiftSettings: [SwiftSetting] = [] let package = Package( name: "dynamo-db-tables", @@ -65,6 +64,5 @@ let package = Package( .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"), ], swiftSettings: swiftSettings), - ], - swiftLanguageVersions: [.v5] + ] ) diff --git a/Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+updateItems.swift b/Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+updateItems.swift index ae017fe..3b21756 100644 --- a/Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+updateItems.swift +++ b/Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+updateItems.swift @@ -556,11 +556,11 @@ public extension AWSDynamoDBCompositePrimaryKeyTable { var errorCodeSet: Set = Set() // TODO: Remove errorCodeSet and return errorSet instead - var errorSet: Set = Set() + var errorSet: Set = Set() result.responses?.forEach { response in if let error = response.error, let code = error.code { errorCodeSet.insert(code) - errorSet.insert(error) + errorSet.insert(.init(code: error.code, item: error.item, message: error.message)) } } @@ -588,17 +588,13 @@ public extension AWSDynamoDBCompositePrimaryKeyTable { } } -extension DynamoDBClientTypes.BatchStatementError: Equatable { - public static func == (lhs: DynamoDBClientTypes.BatchStatementError, rhs: DynamoDBClientTypes.BatchStatementError) -> Bool { - guard lhs.code == rhs.code, lhs.item == rhs.item, lhs.message == rhs.message else { - return false - } - - return true - } +struct InternalBatchStatementError: Equatable { + var code: DynamoDBClientTypes.BatchStatementErrorCodeEnum? + var item: [Swift.String: DynamoDBClientTypes.AttributeValue]? + var message: Swift.String? } -extension DynamoDBClientTypes.BatchStatementError: Hashable { +extension InternalBatchStatementError: Hashable { public func hash(into hasher: inout Hasher) { hasher.combine(self.code) hasher.combine(self.message) diff --git a/Sources/DynamoDBTablesMacros/PolymorphicTransactionConstraintEntryMacro.swift b/Sources/DynamoDBTablesMacros/PolymorphicTransactionConstraintEntryMacro.swift index b9d0262..898f3e8 100644 --- a/Sources/DynamoDBTablesMacros/PolymorphicTransactionConstraintEntryMacro.swift +++ b/Sources/DynamoDBTablesMacros/PolymorphicTransactionConstraintEntryMacro.swift @@ -19,13 +19,13 @@ import SwiftSyntax import SwiftSyntaxMacros struct PolymorphicTransactionConstraintEntryMacroAttributes: MacroAttributes { - static var macroName: String = "PolymorphicTransactionConstraintEntry" + static let macroName: String = "PolymorphicTransactionConstraintEntry" - static var protocolName: String = "PolymorphicTransactionConstraintEntry" + static let protocolName: String = "PolymorphicTransactionConstraintEntry" - static var transformType: String = "WriteTransactionConstraintType" + static let transformType: String = "WriteTransactionConstraintType" - static var contextType: String = "PolymorphicWriteEntryContext" + static let contextType: String = "PolymorphicWriteEntryContext" } public enum PolymorphicTransactionConstraintEntryMacro: ExtensionMacro { diff --git a/Sources/DynamoDBTablesMacros/PolymorphicWriteEntryMacro.swift b/Sources/DynamoDBTablesMacros/PolymorphicWriteEntryMacro.swift index 1c3ec8b..f14fe13 100644 --- a/Sources/DynamoDBTablesMacros/PolymorphicWriteEntryMacro.swift +++ b/Sources/DynamoDBTablesMacros/PolymorphicWriteEntryMacro.swift @@ -19,13 +19,13 @@ import SwiftSyntax import SwiftSyntaxMacros struct PolymorphicWriteEntryMacroAttributes: MacroAttributes { - static var macroName: String = "PolymorphicWriteEntry" + static let macroName: String = "PolymorphicWriteEntry" - static var protocolName: String = "PolymorphicWriteEntry" + static let protocolName: String = "PolymorphicWriteEntry" - static var transformType: String = "WriteEntryTransformType" + static let transformType: String = "WriteEntryTransformType" - static var contextType: String = "PolymorphicWriteEntryContext" + static let contextType: String = "PolymorphicWriteEntryContext" } public enum PolymorphicWriteEntryMacro: ExtensionMacro { diff --git a/Tests/DynamoDBTablesTests/InMemoryDynamoDBCompositePrimaryKeyTableTests.swift b/Tests/DynamoDBTablesTests/InMemoryDynamoDBCompositePrimaryKeyTableTests.swift index e84c169..6722996 100644 --- a/Tests/DynamoDBTablesTests/InMemoryDynamoDBCompositePrimaryKeyTableTests.swift +++ b/Tests/DynamoDBTablesTests/InMemoryDynamoDBCompositePrimaryKeyTableTests.swift @@ -380,13 +380,21 @@ struct InMemoryDynamoDBCompositePrimaryKeyTableTests { #expect(retrievedItem1 != nil) try await table.deleteItem(existingItem: databaseItem) + + // suspend for a small interval so that the creation time of the recreated item is different + try await Task.sleep(for: .milliseconds(10)) + let recreatedItem = StandardTypedDatabaseItem.newItem(withKey: key, andValue: payload) _ = try await table.insertItem(recreatedItem) do { try await table.deleteItem(existingItem: databaseItem) + + Issue.record("Expected error was not thrown") } catch DynamoDBTableError.conditionalCheckFailed { // expected error + } catch { + Issue.record("Expected error was not thrown") } let retrievedItem2: StandardTypedDatabaseItem? = try await table.getItem(forKey: key)