Skip to content

Commit

Permalink
1.5.0 (#18)
Browse files Browse the repository at this point in the history
* swift-docc-plugin 1.3.0

* async-http-client 1.19.0

* replaced deprecated .createNew with the new .singleton

* Adding _find capability. (#13)

* docs

* tabs

* renames

* added test for find method with body

* docs added

* findError added

* tests renamed

* added test for find method with generic type

* docs

* README updated

* updated dependencies

* docs updated

* try Swift 5.7.1

* Update build-ubuntu.yml

* Swift 5.7.3

* Revert "Swift 5.7.3"

This reverts commit ab8f67a.

* updated dependencies

* Docs updated

* Delete .github/workflows/CodeQL.yml

* dependencies updated

* fixed when update method didn’t use passed dateEncodingStrategy

* noData error added

* migrating to new HTTPClientRequest from HTTPClient.Request wip

* migrating to new HTTPClientRequest from HTTPClient.Request wip

* migrating to new HTTPClientRequest from HTTPClient.Request wip

* migrating to new HTTPClientRequest from HTTPClient.Request wip

* migrating to new HTTPClientRequest from HTTPClient.Request wip

* migrating to new HTTPClientRequest from HTTPClient.Request wip

* …

* migrating to new HTTPClientRequest from HTTPClient.Request wip

* rename

* tests updated

* auth fixed

* collect body bytes before returning response

* param renamed to make keep backward compatibility with old methods

* marking old find as deprecated

* private

* deprecated message

* renames

* moved deprecations

* docs

* docs

* added Codable to CouchDBRepresentable protocol

* added RowsResponse model

* docs

* Vapor tutorial updated

* docs

* docs and refactoring

* docs and refactoring

* Tutorials updated

* docs

* platforms list updated

* minimum swift version 5.8

* workflow updated

* Update build-ubuntu.yml

* Update build-macos.yml

* import NIOFoundationCompat to fix building on Ubuntu

* using async-http-client from 1.21.0. Not calling http

* Using HTTPClient.shared if eventLoopGroup not provided. No more calls httpClient.syncShutdown() if using shared singleton

---------

Co-authored-by: Gregório Gevartosky Torrezan <[email protected]>
  • Loading branch information
makoni and gevartosky authored Apr 8, 2024
1 parent 46f38da commit 380fe33
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 39 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-server/async-http-client.git",
"state" : {
"revision" : "291438696abdd48d2a83b52465c176efbd94512b",
"version" : "1.20.1"
"revision" : "fb308ee72f3d4c082a507033f94afa7395963ef3",
"version" : "1.21.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
.library(name: "CouchDBClient", targets: ["CouchDBClient"]),
],
dependencies: [
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.0.0"),
.package(url: "https://github.com/swift-server/async-http-client", from: "1.21.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0")
],
targets: [
Expand Down
16 changes: 10 additions & 6 deletions Sources/CouchDBClient/CouchDB+Deprecated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ extension CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -110,12 +112,14 @@ extension CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down
80 changes: 50 additions & 30 deletions Sources/CouchDBClient/CouchDBClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -214,12 +216,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -253,12 +257,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -312,12 +318,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -426,12 +434,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -580,12 +590,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -661,12 +673,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -803,12 +817,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -915,12 +931,14 @@ public class CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down Expand Up @@ -1006,12 +1024,14 @@ internal extension CouchDBClient {
if let eventLoopGroup = eventLoopGroup {
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
} else {
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
httpClient = HTTPClient.shared
}

defer {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
if eventLoopGroup != nil {
DispatchQueue.main.async {
try? httpClient.syncShutdown()
}
}
}

Expand Down

0 comments on commit 380fe33

Please sign in to comment.