-
Notifications
You must be signed in to change notification settings - Fork 255
[Main][Task] 27922617: Provide Custom Provider Under Web Worker for Offline Channel #2649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for custom storage providers in the Offline Channel, allowing developers to provide their own storage implementations for web worker environments. This enables more flexible storage solutions beyond the built-in LocalStorage, SessionStorage, and IndexedDB providers.
Key changes:
- Added
customProviderandcustomUnloadProviderconfiguration options to allow custom storage implementations - Enhanced provider initialization logic to prioritize custom providers over default ones
- Added comprehensive test coverage for custom provider scenarios
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| channels/offline-channel-js/src/OfflineBatchHandler.ts | Added custom provider initialization logic and fallback handling for unload scenarios |
| channels/offline-channel-js/src/Interfaces/IOfflineProvider.ts | Added interface definitions for customProvider and customUnloadProvider configuration options |
| channels/offline-channel-js/Tests/Unit/src/offlinechannel.tests.ts | Added import and registration for new custom provider tests |
| channels/offline-channel-js/Tests/Unit/src/customprovider.tests.ts | Added comprehensive test suite covering custom provider initialization, fallback scenarios, and storage operations |
Comments suppressed due to low confidence (1)
channels/offline-channel-js/Tests/Unit/src/customprovider.tests.ts:1
- The MockNoopProvider is missing the addEvent method implementation in the dynamicProto constructor. This method should be included to match the interface requirements.
import { AITestClass, Assert } from "@microsoft/ai-test-framework";
channels/offline-channel-js/Tests/Unit/src/offlinechannel.tests.ts
Outdated
Show resolved
Hide resolved
channels/offline-channel-js/Tests/Unit/src/customprovider.tests.ts
Outdated
Show resolved
Hide resolved
| return provider; | ||
| } | ||
| } catch (e) { | ||
| // eslint-disable-next-line no-empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we dont pass anything here then what is returned in _unloadProvider when an exception is thrown here? Will this be a type mismatch or will it pass an empty string?
No description provided.