Add support for attaching meta data to custom filters
Background / User story
To support attaching(and retrieving) meta data to custom filters in the SDK (see: https://gitlab.com/eyeo/adblockplus/abc/webext-sdk/-/issues/157), this meta data needs to be stored in core.
There are two fields to associate with the filter:
-
created
- number value representing when filter was added -
tags
- an object, key-value pairs
What to change
- Store metadata in
SpecialSubscription
: it's an object with arbitrary fields-
FilterStorage.addFilter()
creates a newSpecialSubscription
if none specified - Change
FilterStorage.addFilter()
to take the metadata, or create new API
-
- Make sure the metadata is serialized
- Allow accessing the metadata
- Allow updating the metadata
- Update all related documentation
- Write tests to cover the changes
Integration notes
-
FilterStorage.addFilter()
now returns the Subscription object the filter was added to. -
FilterStrage.addFiltersWithMetadata()
has been added as a new API. It also return the subscription the filter was added too. - In both case, no subscription returned mean an error occured
- Added
FilterStorage.getMetadataForFilter()
andFilterStorage.setMetadataForFilter()
to access metadata - Added
FilterStorage.getSubscription()
to get subscription by URL - Changed
FilterStorage.hasSubscription()
to accept a URL in addition to the subscription itself
Edited by Hubert Figuière