Awesome
typeson-registry-sca-reverter
Version 4.0.0 of IndexedDBShim uses a later version of typeson-registry's Structured Cloning Algorithm serialization/parsing format by default.
This small utility allows IndexedDBShim databases created under version 3.0.0 (and thus the earlier typeson-registry format) to be used with version 4.0.0 of IndexedDBShim. (It should also be usable for converting back typeson-registry storage for non-IndexedDBShim uses as well.)
Note that it does not prevent new types added to
typeson-registry/IndexedDBShim from being usable (e.g., BigInt
),
so data stored under the converted form will not be usable on older versions
of IndexedDBShim, but it does allow data stored under older versions of
IndexedDBShim to continue to be read.
You must set config early, e.g., within the call to setGlobalVars
in
the non-invasive distribution of IndexedDBShim.
Note that while the code was mostly the same as that working previously within IndexedDBShim, some code has been added without testing, so you ought to do your own testing to confirm.
setGlobalVars(null, {
registerSCA: typesonRegistrySCAReverter
});
Or you may set the config before any indexedDB calls:
shimIndexedDB.__setConfig({
registerSCA: typesonRegistrySCAReverter
});
// Safe to use indexedDB now...
To-dos
- Add tests