@work-bee/offline
v0.1.3
Published
offline workbee service worker middleware
Downloads
387
Maintainers
Readme
Install
npm install @work-bee/offlineData & Privacy
The offline middleware queues failed requests in IndexedDB for replay when connectivity returns. Understanding what is stored is important for privacy compliance.
What is stored: The full request (method, URL, headers, body) is serialized to IndexedDB. Headers listed in redactHeaders (defaults to ["authorization"]) are stripped before storage — session middleware re-adds credentials on retry.
Why: Requests must be stored faithfully so they can be replayed without data loss when the network is available again.
Retention: Queued requests persist in IndexedDB until they are successfully replayed or the user clears browser data.
Developer responsibility:
- Use the
redactHeadersoption to control which headers are stripped before storage (defaults to["authorization"]) - Use the
methodsoption to limit which HTTP methods are queued (defaults to POST, PUT, PATCH, DELETE) - Avoid queuing routes that carry highly sensitive data in the request body if persistence is not acceptable
- Consider calling
indexedDB.deleteDatabase('sw')on user logout to clear any queued requests
License
Licensed under MIT License. Copyright (c) 2026 will Farrell and the Workbee contributors.
