1.7.2 • Published 7 months ago
@wcpos/query v1.7.2
Query and Replication library for WooCommerce POS
Architectural Overview
- RxDB Collections for Each Endpoint:
- Each WooCommerce REST API endpoint corresponds to an RxDB collection (e.g., 'products').
- Collections are initialized with schemas that reflect the data structure of their respective endpoints.
- ReplicationState Management:
- Manages synchronization between the local RxDB database and the WooCommerce REST API.
- Key Responsibilities: - Maintaining a list of all remote record IDs. - Periodically fetching records not present locally. - Fetching recently modified records. - On-demand fetching for immediate user requirements.
- Uses efficient, paginated API calls to avoid overloading the server.
- Implements conflict resolution strategies for data consistency.
- QueryState Management:
- Each user query has a corresponding QueryState.
- Manages emitting query results from the local RxDB database.
- Allows multiple, simultaneous queries per collection.
- Inspired by ReactQuery: Each QueryState has a unique identifier.
- Decoupled from ReplicationState, focused solely on querying the local database.
- Sync Strategies:
- Incremental Sync: Regularly fetches new or changed data based on remote IDs.
- On-Demand Sync: Triggered by user actions, e.g., searching for a product.
- Background Sync: Continuously updates the local database without hindering user experience.
- Full Sync: Occasionally, to ensure complete data consistency.
- Mutation Management:
- Tracks local changes that need to be pushed to the server.
- Ensures data consistency between local changes and server updates.
- Conflict Resolution:
- Handles conflicts that may arise during synchronization.
- Implements strategies like 'server wins', 'client wins', or more sophisticated merge logic.
- Error Handling and Logging:
- Robust error handling to manage network issues, API limits, etc.
- Detailed logging for debugging and monitoring sync operations.
1.7.2
7 months ago
1.7.1
8 months ago
1.7.0
8 months ago
1.6.8
12 months ago
1.6.7
1 year ago
1.6.6
1 year ago
1.6.4
1 year ago
1.6.3
1 year ago
1.6.2
1 year ago
1.6.1
1 year ago
1.6.0
1 year ago
1.6.5
1 year ago
1.5.5
1 year ago
1.5.6
1 year ago
1.5.4
1 year ago
1.5.3
1 year ago
1.5.2
1 year ago
1.5.1
1 year ago
1.5.0
1 year ago
1.4.5
1 year ago
1.4.4
1 year ago
1.4.3
1 year ago
1.4.2
1 year ago
1.4.1
1 year ago
1.4.0
2 years ago