Releases: makoni/couchdb-swift
2.3.3
2.3.2
2.3.1
What's Changed
- Bump github.com/apple/swift-nio-http2 from 1.37.0 to 1.38.0 by @dependabot[bot] in #36
- Other dependencies has been updated.
Full Changelog: 2.3.0...2.3.1
2.3.0
Major Features & Enhancements
-
Advanced Mango Queries Support
- Introduced a robust and type-safe MangoQuery API for building complex selectors, projections, sorting, and pagination in CouchDB.
- Added support for specifying indexes via
useIndexin queries to optimize performance.
-
Attachments API
- Added first-class support for uploading, downloading, and deleting document attachments (files/images).
- Comprehensive Attachments API test suite ensures reliability for file operations.
-
Index Management
- Added models and API for creating, listing, and managing Mango indexes (
MangoIndex,IndexDefinition). - Tutorial and code samples for creating indexes are now included in documentation.
- Added models and API for creating, listing, and managing Mango indexes (
-
Query Explain
- Added support for CouchDB Mango
_explainendpoint viaMangoExplainResponseto inspect how queries are executed and which indexes are used.
- Added support for CouchDB Mango
Documentation
- Expanded README with:
- Feature list
- Usage examples for Attachments API and Mango queries
- Supported platforms and Swift versions
- Testing instructions
- Added new in-code tutorials on:
- Advanced Mango Queries (selectors, sorting, projections, index usage)
- Creating Mango indexes
Testing
- New test suites for:
- Attachments API (upload, download, delete, and database setup/teardown)
- MangoQuery encoding/decoding, MangoIndex encoding, MangoValue decoding
- End-to-end index creation, listing, and query explain
- Improved error handling tests for document CRUD operations and database creation
Breaking Changes
-
Mango Queries API
- The
findmethod now expects aMangoQueryinstead of a generic selector dictionary. - Sort and projection parameters are now passed via
MangoQuery.
- The
-
Tests
- Existing tests for Mango queries have been refactored to use the new type-safe API.
Miscellaneous
- Various internal refactorings and improved error handling for database and document operations.
- Updated documentation links and structure for clarity.
- License explicitly stated in README.
Upgrade Notes:
If you use Mango queries or attachments, please update your code to use the new MangoQuery, MangoIndex, and attachment API signatures as shown in the updated documentation and code samples. For Swift 6+, enjoy strict concurrency and actor-based client; for Swift 5.x, use version 1.7.0.
2.2.0
Changelog for 2.2.0
This release focuses on improved error handling for "not found" cases and updates to related tests.
🛠 Improvements
Enhanced Not Found Error Handling
- The
getmethods throughout the client now return a new, explicitnotFounderror when a requested document or resource does not exist. - The error includes details from the CouchDB response, making debugging and user feedback more clear and actionable.
- Minor documentation and formatting updates.
Upgrade Notes:
If you rely on catching missing-document errors, update your error handling to use the new notFound case for more granular control.
Thank you for using couchdb-swift!
2.1.1
Highlights
- Improved conflict and error handling for document operations in
CouchDBClient. - Expanded and updated localization support for conflict errors.
- Enhanced test coverage for error scenarios and event loop group usage.
- Updated dependencies for better compatibility and performance.
- CI workflow improvements for Ubuntu and macOS.
Details
Core Enhancements
-
Conflict and Not Found Error Handling:
CouchDBClientnow throwsconflictErroranddeleteErrorwith detailed messages when update or delete operations encounter conflicts or not found responses.- Added support for localized error descriptions for conflict scenarios in multiple languages.
- Improved percent encoding for authentication credentials.
-
New and Expanded Tests:
- Added tests for database existence, create/delete conflicts, document not found, and event loop group usage.
- Added tests to verify conflict and not found errors are properly thrown and handled.
- Added test for
.findmethod with custom date decoding strategy.
Localization
Localizable.xcstrings:- Added translations for conflict error messages in 30+ languages.
- Minor adjustments and corrections to existing translations for better clarity.
Dependency Updates
Package.resolved:- Updated various dependencies to latest minor or patch versions, including:
async-http-client1.26.1swift-atomics1.3.0swift-certificates1.10.0swift-collections1.2.0swift-crypto3.12.3swift-docc-plugin1.4.5swift-http-structured-headers1.3.0swift-nio2.84.0swift-nio-extras1.28.0swift-nio-http21.37.0swift-nio-ssl2.32.0swift-nio-transport-services1.25.0swift-service-lifecycle2.8.0swift-system1.5.0
- Added new dependencies:
swift-asn1,swift-async-algorithms.
- Updated various dependencies to latest minor or patch versions, including:
CI/CD Workflows
-
macOS Build Workflow:
- Minor YAML formatting improvements.
-
Ubuntu Build Workflow:
- Added support for Swift 6.1.
- Updated
actions/checkoutto v4 for better compatibility. - Improved variable formatting.
-
Ubuntu Test Workflow:
- Improved YAML formatting and consistency.
- Ensured tests run against multiple CouchDB versions.
Other
- Bugfixes:
- Fixed date format parsing for cookies in authentication.
- Fixed minor translation issues in error messages.
2.1.0
Changed
- Renamed the library from
couchdb-vaportocouchdb-swiftto better reflect its purpose as a general CouchDB client for Swift, beyond Vapor-specific use cases. - Updated all references to the repository URL, badges, and package imports to align with the new name (
couchdb-swift). - Enhanced documentation for clarity and consistency, including better descriptions for initialization, features, and usage examples.
Added
- New Tutorial: Introduced a dedicated tutorial for integrating
CouchDBClientwith the Hummingbird server-side framework. - Added support for providing a custom
HTTPClientduring initialization, offering more flexibility for advanced use cases. - New method
shutdown()added to properly release resources associated with theHTTPClient. - Additional tests to ensure compatibility with custom
HTTPClientinstances and the newshutdown()method.
Improved
- Refactored the internal handling of
HTTPClientto simplify its creation and management, reducing redundancy across methods. - Expanded feature documentation in
CouchDBClient.doccto include detailed examples and step-by-step instructions for various use cases.
Fixed
- Minor inconsistencies in documentation and error-handling tutorials.
- Improved error messages for better debugging and clarity.
2.0.2
Version 2.0.2
- Added translations for error messages.
Version 2.0.1
This release significantly enhances the codebase by introducing support for Swift 6.0, adopting Swift Concurrency, updating dependencies, and improving overall code quality and documentation.
Major Updates
- Swift Tool Version Update: Updated the minimum required Swift tools version to 6.0.
- // swift-tools-version:5.8 + // swift-tools-version:6.0
Documentation Updates
- README:
- Enhanced documentation for concurrency and compatibility with both Swift and Vapor versions.
- Improved initialization examples and added instructions for avoiding hardcoded passwords.
- Revised usage examples to reflect new API changes.
Codebase Enhancements
- CouchDBClient: Updated to be an
actor. - Client Initialization: Introduced a new configuration struct
CouchDBClient.Configfor cleaner initialization.let config = CouchDBClient.Config( couchProtocol: .http, couchHost: "127.0.0.1", couchPort: 5984, userName: "admin", userPassword: "yourPassword" ) let couchDBClient = CouchDBClient(config: config)
Models and Protocol Updates
- CouchDBRepresentable:
- Changed
_idto a non-optional property and added methods for updating document revisions. - Conformance to
Sendablefor thread safety.
public protocol CouchDBRepresentable: Codable, Sendable { var _id: String { get } var _rev: String? { get } func updateRevision(_ newRevision: String) -> Self }
- Changed
- Error Handling:
- Enhanced error models to conform to
Sendableand added detailed documentation.
public struct CouchDBError: Error, Codable, Sendable { public let error: String public let reason: String }
- Enhanced error models to conform to
- Responses:
- Updated response models to conform to
Sendableand added detailed documentation for properties.
public struct CouchDBFindResponse<T: CouchDBRepresentable>: Codable, Sendable { let docs: [T] let bookmark: String? }
- Updated response models to conform to
Test Updates
- Unit Tests:
- Updated tests to align with the new client initialization and document handling methods.
struct ExpectedDoc: CouchDBRepresentable { var name: String var _id: String = NSUUID().uuidString var _rev: String? func updateRevision(_ newRevision: String) -> Self { return ExpectedDoc(name: name, _id: _id, _rev: newRevision) } }
Miscellaneous
- Code Cleanup:
- Removed unused imports and redundant code.
- Improved code formatting and added missing documentation.
2.0.1
Version 2.0.1
This release significantly enhances the codebase by introducing support for Swift 6.0, adopting Swift Concurrency, updating dependencies, and improving overall code quality and documentation.
Major Updates
- Swift Tool Version Update: Updated the minimum required Swift tools version to 6.0.
- // swift-tools-version:5.8 + // swift-tools-version:6.0
Documentation Updates
- README:
- Enhanced documentation for concurrency and compatibility with both Swift and Vapor versions.
- Improved initialization examples and added instructions for avoiding hardcoded passwords.
- Revised usage examples to reflect new API changes.
Codebase Enhancements
- CouchDBClient: Updated to be an
actor. - Client Initialization: Introduced a new configuration struct
CouchDBClient.Configfor cleaner initialization.let config = CouchDBClient.Config( couchProtocol: .http, couchHost: "127.0.0.1", couchPort: 5984, userName: "admin", userPassword: "yourPassword" ) let couchDBClient = CouchDBClient(config: config)
Models and Protocol Updates
- CouchDBRepresentable:
- Changed
_idto a non-optional property and added methods for updating document revisions. - Conformance to
Sendablefor thread safety.
public protocol CouchDBRepresentable: Codable, Sendable { var _id: String { get } var _rev: String? { get } func updateRevision(_ newRevision: String) -> Self }
- Changed
- Error Handling:
- Enhanced error models to conform to
Sendableand added detailed documentation.
public struct CouchDBError: Error, Codable, Sendable { public let error: String public let reason: String }
- Enhanced error models to conform to
- Responses:
- Updated response models to conform to
Sendableand added detailed documentation for properties.
public struct CouchDBFindResponse<T: CouchDBRepresentable>: Codable, Sendable { let docs: [T] let bookmark: String? }
- Updated response models to conform to
Test Updates
- Unit Tests:
- Updated tests to align with the new client initialization and document handling methods.
struct ExpectedDoc: CouchDBRepresentable { var name: String var _id: String = NSUUID().uuidString var _rev: String? func updateRevision(_ newRevision: String) -> Self { return ExpectedDoc(name: name, _id: _id, _rev: newRevision) } }
Miscellaneous
- Code Cleanup:
- Removed unused imports and redundant code.
- Improved code formatting and added missing documentation.
2.0.0
Version 2.0.0
This release significantly enhances the codebase by introducing support for Swift 6.0, adopting Swift Concurrency, updating dependencies, and improving overall code quality and documentation.
Major Updates
- Swift Tool Version Update: Updated the minimum required Swift tools version to 6.0.
- // swift-tools-version:5.8 + // swift-tools-version:6.0
Documentation Updates
- README:
- Enhanced documentation for concurrency and compatibility with both Swift and Vapor versions.
- Improved initialization examples and added instructions for avoiding hardcoded passwords.
- Revised usage examples to reflect new API changes.
Codebase Enhancements
- CouchDBClient: Updated to be an
actor. - Client Initialization: Introduced a new configuration struct
CouchDBClient.Configfor cleaner initialization.let config = CouchDBClient.Config( couchProtocol: .http, couchHost: "127.0.0.1", couchPort: 5984, userName: "admin", userPassword: "yourPassword" ) let couchDBClient = CouchDBClient(config: config)
Models and Protocol Updates
- CouchDBRepresentable:
- Changed
_idto a non-optional property and added methods for updating document revisions. - Conformance to
Sendablefor thread safety.
public protocol CouchDBRepresentable: Codable, Sendable { var _id: String { get } var _rev: String? { get } func updateRevision(_ newRevision: String) -> Self }
- Changed
- Error Handling:
- Enhanced error models to conform to
Sendableand added detailed documentation.
public struct CouchDBError: Error, Codable, Sendable { public let error: String public let reason: String }
- Enhanced error models to conform to
- Responses:
- Updated response models to conform to
Sendableand added detailed documentation for properties.
public struct CouchDBFindResponse<T: CouchDBRepresentable>: Codable, Sendable { let docs: [T] let bookmark: String? }
- Updated response models to conform to
Test Updates
- Unit Tests:
- Updated tests to align with the new client initialization and document handling methods.
struct ExpectedDoc: CouchDBRepresentable { var name: String var _id: String = NSUUID().uuidString var _rev: String? func updateRevision(_ newRevision: String) -> Self { return ExpectedDoc(name: name, _id: _id, _rev: newRevision) } }
Miscellaneous
- Code Cleanup:
- Removed unused imports and redundant code.
- Improved code formatting and added missing documentation.