diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 0000000..deed87f --- /dev/null +++ b/.swiftformat @@ -0,0 +1,19 @@ +# Swift version +--swiftversion 5.8 + +# file options +--exclude .build + +# rules + +# format options +--ifdef no-indent +--nospaceoperators ...,..< +--self insert +--allman false + +#--maxwidth 150 +--wraparguments after-first +--wrapparameters after-first +--wrapcollections after-first +--closingparen same-line diff --git a/Package.resolved b/Package.resolved index 044fa48..d835fd6 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift", "state" : { - "revision" : "459da1e556d2486b354dad4ef5fd4c266bd3285c", - "version" : "0.29.0" + "revision" : "b6380f683b31072d77b601c88674461c11bcad5a", + "version" : "0.30.0" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift.git", "state" : { - "revision" : "454ad2b1de7b5f27fe74b88d4030c55a230c8e62", - "version" : "0.40.0" + "revision" : "22ac271a961d9c8cec2308bf853f773c04146260", + "version" : "0.44.0" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "e42afe5f27ff916fb0803b1b37563d8c6d14abcf", - "version" : "0.45.0" + "revision" : "c9caeb7c2df39ac0d4d4c6182c40426b7ec4485a", + "version" : "0.49.0" } }, { @@ -50,8 +50,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-metrics.git", "state" : { - "revision" : "971ba26378ab69c43737ee7ba967a896cb74c0d1", - "version" : "2.4.1" + "revision" : "ce594e71e92a1610015017f83f402894df540e51", + "version" : "2.4.4" + } + }, + { + "identity" : "swiftformat", + "kind" : "remoteSourceControl", + "location" : "https://github.com/nicklockwood/SwiftFormat", + "state" : { + "revision" : "4bf475154c1c98dcdf751037f930f8e5c72597a4", + "version" : "0.53.10" } } ], diff --git a/Package.swift b/Package.swift index abd42b0..0e54814 100644 --- a/Package.swift +++ b/Package.swift @@ -37,7 +37,8 @@ let package = Package( .package(url: "https://github.com/awslabs/aws-sdk-swift.git", from: "0.40.0"), .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-metrics.git", "1.0.0"..<"3.0.0"), - .package(url: "https://github.com/JohnSundell/CollectionConcurrencyKit", from :"0.2.0") + .package(url: "https://github.com/JohnSundell/CollectionConcurrencyKit", from :"0.2.0"), + .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.53.9"), ], targets: [ .target( diff --git a/Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+updateItems.swift b/Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+updateItems.swift index c4ff7c3..4819404 100644 --- a/Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+updateItems.swift +++ b/Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+updateItems.swift @@ -446,6 +446,16 @@ 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 + } +} + extension DynamoDBClientTypes.BatchStatementError: Hashable { public func hash(into hasher: inout Hasher) { diff --git a/Sources/DynamoDBTables/DynamoDBClientTypes_AttributeValue+Codable.swift b/Sources/DynamoDBTables/DynamoDBClientTypes_AttributeValue+Codable.swift new file mode 100644 index 0000000..df6aac3 --- /dev/null +++ b/Sources/DynamoDBTables/DynamoDBClientTypes_AttributeValue+Codable.swift @@ -0,0 +1,183 @@ +// Code generated by smithy-swift-codegen. DO NOT EDIT! +// swiftlint:disable identifier_name cyclomatic_complexity function_body_length + +import AWSClientRuntime +import ClientRuntime +import AWSDynamoDB + +public struct Key: CodingKey { + public let stringValue: String + public init(stringValue: String) { + self.stringValue = stringValue + self.intValue = nil + } + + public init(_ stringValue: String) { + self.stringValue = stringValue + self.intValue = nil + } + + public let intValue: Int? + public init?(intValue: Int) { + return nil + } +} + +extension DynamoDBClientTypes.AttributeValue: Swift.Codable { + enum CodingKeys: Swift.String, Swift.CodingKey { + case b = "B" + case bool = "BOOL" + case bs = "BS" + case l = "L" + case m = "M" + case n = "N" + case ns = "NS" + case null = "NULL" + case s = "S" + case ss = "SS" + case sdkUnknown + } + + public func encode(to encoder: Swift.Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case let .b(b): + try container.encode(b.base64EncodedString(), forKey: .b) + case let .bool(bool): + try container.encode(bool, forKey: .bool) + case let .bs(bs): + var bsContainer = container.nestedUnkeyedContainer(forKey: .bs) + for binaryattributevalue0 in bs { + try bsContainer.encode(binaryattributevalue0.base64EncodedString()) + } + case let .l(l): + var lContainer = container.nestedUnkeyedContainer(forKey: .l) + for attributevalue0 in l { + try lContainer.encode(attributevalue0) + } + case let .m(m): + var mContainer = container.nestedContainer(keyedBy: Key.self, forKey: .m) + for (dictKey0, mapAttributeValue0) in m { + try mContainer.encode(mapAttributeValue0, forKey: Key(stringValue: dictKey0)) + } + case let .n(n): + try container.encode(n, forKey: .n) + case let .ns(ns): + var nsContainer = container.nestedUnkeyedContainer(forKey: .ns) + for numberattributevalue0 in ns { + try nsContainer.encode(numberattributevalue0) + } + case let .null(null): + try container.encode(null, forKey: .null) + case let .s(s): + try container.encode(s, forKey: .s) + case let .ss(ss): + var ssContainer = container.nestedUnkeyedContainer(forKey: .ss) + for stringattributevalue0 in ss { + try ssContainer.encode(stringattributevalue0) + } + case let .sdkUnknown(sdkUnknown): + try container.encode(sdkUnknown, forKey: .sdkUnknown) + } + } + + public init(from decoder: Swift.Decoder) throws { + let values = try decoder.container(keyedBy: CodingKeys.self) + let sDecoded = try values.decodeIfPresent(Swift.String.self, forKey: .s) + if let s = sDecoded { + self = .s(s) + return + } + let nDecoded = try values.decodeIfPresent(Swift.String.self, forKey: .n) + if let n = nDecoded { + self = .n(n) + return + } + let bDecoded = try values.decodeIfPresent(ClientRuntime.Data.self, forKey: .b) + if let b = bDecoded { + self = .b(b) + return + } + let ssContainer = try values.decodeIfPresent([Swift.String?].self, forKey: .ss) + var ssDecoded0:[Swift.String]? = nil + if let ssContainer = ssContainer { + ssDecoded0 = [Swift.String]() + for string0 in ssContainer { + if let string0 = string0 { + ssDecoded0?.append(string0) + } + } + } + if let ss = ssDecoded0 { + self = .ss(ss) + return + } + let nsContainer = try values.decodeIfPresent([Swift.String?].self, forKey: .ns) + var nsDecoded0:[Swift.String]? = nil + if let nsContainer = nsContainer { + nsDecoded0 = [Swift.String]() + for string0 in nsContainer { + if let string0 = string0 { + nsDecoded0?.append(string0) + } + } + } + if let ns = nsDecoded0 { + self = .ns(ns) + return + } + let bsContainer = try values.decodeIfPresent([ClientRuntime.Data?].self, forKey: .bs) + var bsDecoded0:[ClientRuntime.Data]? = nil + if let bsContainer = bsContainer { + bsDecoded0 = [ClientRuntime.Data]() + for blob0 in bsContainer { + if let blob0 = blob0 { + bsDecoded0?.append(blob0) + } + } + } + if let bs = bsDecoded0 { + self = .bs(bs) + return + } + let mContainer = try values.decodeIfPresent([Swift.String: DynamoDBClientTypes.AttributeValue?].self, forKey: .m) + var mDecoded0: [Swift.String:DynamoDBClientTypes.AttributeValue]? = nil + if let mContainer = mContainer { + mDecoded0 = [Swift.String:DynamoDBClientTypes.AttributeValue]() + for (key0, attributevalue0) in mContainer { + if let attributevalue0 = attributevalue0 { + mDecoded0?[key0] = attributevalue0 + } + } + } + if let m = mDecoded0 { + self = .m(m) + return + } + let lContainer = try values.decodeIfPresent([DynamoDBClientTypes.AttributeValue?].self, forKey: .l) + var lDecoded0:[DynamoDBClientTypes.AttributeValue]? = nil + if let lContainer = lContainer { + lDecoded0 = [DynamoDBClientTypes.AttributeValue]() + for union0 in lContainer { + if let union0 = union0 { + lDecoded0?.append(union0) + } + } + } + if let l = lDecoded0 { + self = .l(l) + return + } + let nullDecoded = try values.decodeIfPresent(Swift.Bool.self, forKey: .null) + if let null = nullDecoded { + self = .null(null) + return + } + let boolDecoded = try values.decodeIfPresent(Swift.Bool.self, forKey: .bool) + if let bool = boolDecoded { + self = .bool(bool) + return + } + self = .sdkUnknown("") + } +}