1.5.2 • Published 2 months ago

@wcpos/query v1.5.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

Query and Replication library for WooCommerce POS

Architectural Overview

  1. 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.
  1. 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.
  1. 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.
  1. 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.
  1. Mutation Management:
  • Tracks local changes that need to be pushed to the server.
  • Ensures data consistency between local changes and server updates.
  1. Conflict Resolution:
  • Handles conflicts that may arise during synchronization.
  • Implements strategies like 'server wins', 'client wins', or more sophisticated merge logic.
  1. Error Handling and Logging:
  • Robust error handling to manage network issues, API limits, etc.
  • Detailed logging for debugging and monitoring sync operations.
1.5.2

2 months ago

1.5.1

2 months ago

1.5.0

3 months ago

1.4.5

4 months ago

1.4.4

4 months ago

1.4.3

4 months ago

1.4.2

4 months ago

1.4.1

4 months ago

1.4.0

5 months ago