Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
b63f1cd
swift-docc-plugin 1.3.0
makoni Aug 22, 2023
aa93653
async-http-client 1.19.0
makoni Aug 22, 2023
4788d8a
replaced deprecated .createNew with the new .singleton
makoni Aug 22, 2023
fcb6c8d
Merge branch 'master' into develop
makoni Sep 15, 2023
37c4bf6
Adding _find capability. (#13)
gevartosky Jan 16, 2024
7db38dd
docs
makoni Jan 16, 2024
4e37384
tabs
makoni Jan 16, 2024
a70250c
renames
makoni Jan 16, 2024
e2f2b50
added test for find method with body
makoni Jan 16, 2024
f9aa3ab
docs added
makoni Jan 16, 2024
e5602ae
findError added
makoni Jan 16, 2024
0e06ef6
tests renamed
makoni Jan 16, 2024
c941657
added test for find method with generic type
makoni Jan 16, 2024
e6b6566
docs
makoni Jan 16, 2024
d4f520f
README updated
makoni Jan 16, 2024
78e7d10
updated dependencies
makoni Jan 16, 2024
51966c3
docs updated
makoni Jan 16, 2024
1118bb3
try Swift 5.7.1
makoni Jan 16, 2024
dfdc610
Update build-ubuntu.yml
makoni Jan 16, 2024
842bc38
Merge branch 'develop' of github.com:makoni/couchdb-vapor into develop
makoni Jan 16, 2024
ab8f67a
Swift 5.7.3
makoni Jan 16, 2024
896eef9
Revert "Swift 5.7.3"
makoni Jan 16, 2024
4798e40
Merge branch 'master' into develop
makoni Jan 17, 2024
04f3bdd
updated dependencies
makoni Feb 24, 2024
bdeedda
Docs updated
makoni Feb 24, 2024
2dd69f6
Delete .github/workflows/CodeQL.yml
makoni Feb 24, 2024
1c34ed3
Merge branch 'master' into develop
makoni Feb 24, 2024
33cb174
dependencies updated
makoni Mar 26, 2024
abce15f
fixed when update method didn’t use passed dateEncodingStrategy
makoni Mar 26, 2024
0cac14d
Merge branch 'master' into develop
makoni Mar 26, 2024
1a522e0
noData error added
makoni Apr 2, 2024
a1dcfaf
migrating to new HTTPClientRequest from HTTPClient.Request wip
makoni Apr 2, 2024
0bb6982
migrating to new HTTPClientRequest from HTTPClient.Request wip
makoni Apr 2, 2024
ad36014
migrating to new HTTPClientRequest from HTTPClient.Request wip
makoni Apr 2, 2024
73ffa10
migrating to new HTTPClientRequest from HTTPClient.Request wip
makoni Apr 2, 2024
c60fead
migrating to new HTTPClientRequest from HTTPClient.Request wip
makoni Apr 2, 2024
dd00301
migrating to new HTTPClientRequest from HTTPClient.Request wip
makoni Apr 2, 2024
febe7b3
makoni Apr 2, 2024
5260938
migrating to new HTTPClientRequest from HTTPClient.Request wip
makoni Apr 2, 2024
c1cd49a
rename
makoni Apr 2, 2024
d9e4ec8
tests updated
makoni Apr 5, 2024
20497eb
auth fixed
makoni Apr 5, 2024
d8eab77
collect body bytes before returning response
makoni Apr 5, 2024
8520826
param renamed to make keep backward compatibility with old methods
makoni Apr 5, 2024
7af5c33
marking old find as deprecated
makoni Apr 5, 2024
ca0caa2
private
makoni Apr 5, 2024
78f5666
deprecated message
makoni Apr 5, 2024
a54dfcf
renames
makoni Apr 5, 2024
d6c9c9c
moved deprecations
makoni Apr 5, 2024
eecb20f
docs
makoni Apr 5, 2024
469247f
docs
makoni Apr 6, 2024
31187b5
added Codable to CouchDBRepresentable protocol
makoni Apr 7, 2024
f337240
added RowsResponse model
makoni Apr 7, 2024
6cd2d09
docs
makoni Apr 7, 2024
8d47cd2
Vapor tutorial updated
makoni Apr 7, 2024
dba25fe
docs
makoni Apr 7, 2024
ebab497
docs and refactoring
makoni Apr 7, 2024
cc290e1
docs and refactoring
makoni Apr 7, 2024
d8343b1
Tutorials updated
makoni Apr 7, 2024
952f8e2
docs
makoni Apr 7, 2024
093c7c3
platforms list updated
makoni Apr 7, 2024
79bd657
minimum swift version 5.8
makoni Apr 7, 2024
e1737a7
workflow updated
makoni Apr 7, 2024
2a6c964
Update build-ubuntu.yml
makoni Apr 7, 2024
04bcd15
Update build-macos.yml
makoni Apr 7, 2024
a70d23e
import NIOFoundationCompat to fix building on Ubuntu
makoni Apr 7, 2024
804e23f
Merge branch 'master' into develop
makoni Apr 7, 2024
22e006e
Merge branch 'master' into develop
makoni Apr 8, 2024
7acc1b6
using async-http-client from 1.21.0. Not calling http
makoni Apr 8, 2024
c9ec8c1
Using HTTPClient.shared if eventLoopGroup not provided. No more calls…
makoni Apr 8, 2024
aef587b
Merge branch 'master' into develop
makoni Apr 8, 2024
5de558e
Merge branch 'master' into develop
makoni Apr 11, 2024
8604500
docs updated
makoni Apr 11, 2024
49637d2
docs updated
makoni Apr 11, 2024
ef10c9c
Merge branch 'master' into develop
makoni Apr 15, 2024
a57f6ad
Vapor tutorial updated
makoni Apr 15, 2024
8190603
A SwiftUI tutorial
makoni Apr 15, 2024
8b6e347
tutorial fixed
makoni Apr 15, 2024
6e734f4
updated dependencies
makoni May 12, 2024
69ea902
Merge branch 'master' into develop
makoni May 12, 2024
253922a
Package.resolved
makoni May 12, 2024
9c335d5
Merge branch 'master' into develop
makoni May 12, 2024
e160d36
docs updated
makoni May 14, 2024
6a7688e
userName param is now required for CouchDB init
makoni May 14, 2024
6065ecf
cleanup
makoni May 14, 2024
217ad06
docs
makoni May 14, 2024
be0d222
docs
makoni May 14, 2024
716e5c4
docs
makoni May 14, 2024
90eb7ac
docs
makoni May 14, 2024
25aaaf8
docs
makoni May 14, 2024
50dd933
docs
makoni May 14, 2024
89ac475
docs
makoni May 14, 2024
5127014
docs
makoni May 14, 2024
2d05724
docs
makoni May 14, 2024
a2b3104
docs
makoni May 14, 2024
267a151
docs
makoni May 14, 2024
f07ce31
docs
makoni May 14, 2024
1abd1ff
docs
makoni May 14, 2024
7de12c6
docs
makoni May 14, 2024
5060dbf
docs
makoni May 14, 2024
fbe9620
docs
makoni May 14, 2024
7f18a5c
Merge branch 'master' into develop
makoni May 14, 2024
b22dacc
Merge branch 'master' into develop
makoni Jun 12, 2024
cdbc2a2
dependencices updated
makoni Jun 12, 2024
de02a49
Merge branch 'master' into develop
makoni Jun 12, 2024
3eb4598
updated swift-docc-plugin URL. Updated dependencies to latest versions.
makoni Sep 19, 2024
90e52fc
Update build-ubuntu.yml
makoni Sep 19, 2024
1c2a050
Merge branch 'master' into develop
makoni Sep 20, 2024
dba42f9
dependencies updated
makoni Nov 24, 2024
786ed75
deleted deprecated methods
makoni Nov 24, 2024
cc6b830
Sendable conformance
makoni Nov 24, 2024
337a562
swift-format added
makoni Nov 24, 2024
ce45dd1
formatting
makoni Nov 24, 2024
08186d5
formatting
makoni Nov 24, 2024
c0e5941
revert sendable
makoni Nov 24, 2024
277ddd4
updated dependencies
makoni Feb 13, 2025
336af62
Merge branch 'master' into develop
makoni Mar 28, 2025
24a57c4
Sensable conformance
makoni Mar 31, 2025
8b9a995
updated CouchDBRepresentable protocol
makoni Mar 31, 2025
829d9e3
Sendable conformance
makoni Mar 31, 2025
cd550f2
Strict concurrency implemented
makoni Mar 31, 2025
680090b
Swift 6
makoni Mar 31, 2025
b8b6956
docs updated
makoni Mar 31, 2025
eff7662
errors and docs
makoni Mar 31, 2025
163bf1f
docs
makoni Mar 31, 2025
f5a50b5
docs
makoni Mar 31, 2025
e0de805
docs wip
makoni Mar 31, 2025
fd63ca5
docs
makoni Mar 31, 2025
341b094
wip
makoni Mar 31, 2025
3b07085
wip
makoni Mar 31, 2025
bb4e14e
docs
makoni Mar 31, 2025
7cee97b
docs
makoni Mar 31, 2025
9be480b
get only _rev
makoni Mar 31, 2025
ece077a
tutorials updated
makoni Mar 31, 2025
a5a971d
docs
makoni Mar 31, 2025
729c830
Update README.md
makoni Mar 31, 2025
63fb9c4
Update README.md
makoni Mar 31, 2025
61bba29
updated GitHub actions configs
makoni Mar 31, 2025
cb7bc48
Merge branch 'master' into develop
makoni Mar 31, 2025
71ae1ac
dependencies updated
makoni Mar 31, 2025
5631a6c
updated docs
makoni Mar 31, 2025
a0b1201
code formatting
makoni Mar 31, 2025
5c6f638
Merge branch 'master' into develop
makoni Apr 1, 2025
ddcc5ef
refactoring
makoni Apr 5, 2025
17e00a0
localized error messages
makoni Apr 5, 2025
f74ed51
Added error messages translations
makoni Apr 5, 2025
8147a69
More translations
makoni Apr 8, 2025
1238adf
fixes for Linux
makoni Apr 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PackageDescription

let package = Package(
name: "couchdb-vapor",
defaultLocalization: "en",
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
Expand All @@ -21,7 +22,11 @@ let package = Package(
name: "CouchDBClient",
dependencies: [
.product(name: "AsyncHTTPClient", package: "async-http-client")
]),
],
resources: [
.process("Localizable.xcstrings")
]
),
.testTarget(
name: "CouchDBClientTests",
dependencies: ["CouchDBClient"])
Expand Down
76 changes: 0 additions & 76 deletions Sources/CouchDBClient/CouchDBClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,82 +11,6 @@ import NIOHTTP1
import NIOFoundationCompat
import AsyncHTTPClient

/// An enumeration representing the various errors that can occur when interacting with CouchDB through a client.
/// This enum conforms to both `Error` and `Sendable`, making it suitable for error handling and thread-safe operations.
public enum CouchDBClientError: Error, Sendable {
/// The `id` property is empty or missing in the provided document.
/// This error indicates that the document does not have a valid identifier.
case idMissing

/// The `_rev` property is empty or missing in the provided document.
/// This error indicates that the document does not have a valid revision token for concurrency control.
case revMissing

/// The `GET` request was unsuccessful.
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
case getError(error: CouchDBError)

/// The `INSERT` request was unsuccessful.
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
case insertError(error: CouchDBError)

/// The `DELETE` request was unsuccessful.
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
case deleteError(error: CouchDBError)

/// The `UPDATE` request was unsuccessful.
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
case updateError(error: CouchDBError)

/// The `FIND` request was unsuccessful.
/// - Parameter error: The `CouchDBError` returned by the server, providing details about the issue.
case findError(error: CouchDBError)

/// The response from CouchDB was unrecognized or could not be processed.
/// This error indicates that the response was not in the expected format.
case unknownResponse

/// Authentication failed due to incorrect username or password.
/// This error suggests that the provided credentials were invalid.
case unauthorized

/// The response body is missing required data.
/// This error indicates that the server response lacked the expected content.
case noData
}

/// Extends the `CouchDBClientError` enumeration to provide localized error descriptions.
/// This extension conforms to the `LocalizedError` protocol, offering user-friendly messages
/// that describe the nature of each error in detail.
extension CouchDBClientError: LocalizedError {
/// A textual description of the error, tailored for user-facing contexts.
/// The message provides specific details about the error type and underlying cause.
public var errorDescription: String? {
switch self {
case .idMissing:
return "The 'id' property is empty or missing in the provided document."
case .revMissing:
return "The '_rev' property is empty or missing in the provided document."
case .getError(let error):
return "The GET request wasn't successful: \(error.localizedDescription)"
case .insertError(let error):
return "The INSERT request wasn't successful: \(error.localizedDescription)"
case .updateError(let error):
return "The UPDATE request wasn't successful: \(error.localizedDescription)"
case .deleteError(let error):
return "The DELETE request wasn't successful: \(error.localizedDescription)"
case .findError(let error):
return "The FIND request wasn't successful: \(error.localizedDescription)"
case .unknownResponse:
return "The response from CouchDB was unrecognized or invalid."
case .unauthorized:
return "Authentication failed due to an incorrect username or password."
case .noData:
return "The response body is missing the expected data."
}
}
}

/// A CouchDB client actor with methods using Swift Concurrency.
public actor CouchDBClient {
/// A configuration model for CouchDB client setup.
Expand Down
Loading