JSON-stringifies and LZ-compresses a value, returning an LzEnvelope.
When useStorageCompression is false in config.json, the value is stored
as-is (no compression). If serialization fails (e.g. circular structures)
the original value is returned untouched and an error is logged.
Decodes a value read from chrome.storage. If the value is an LzEnvelope, it is decompressed and JSON-parsed; otherwise the value is returned unchanged (backward-compatible passthrough for legacy data).
Encodes every value of an items map for chrome.storage.X.set.
Decodes every value of an items map returned from chrome.storage.X.get.
Tolerates mixed compressed and legacy entries (used by full-scan reads
such as chrome.storage.local.get(null)).
Decodes the oldValue / newValue of every change in a
chrome.storage.onChanged payload.
Envelope wrapping a compressed JSON payload. Detected on read via isLzEnvelope.
Listener registered by callers of cstorage.onChanged.addListener.
Wire-format version. Bumped if the envelope shape ever changes.
Compression-aware wrapper around chrome.storage. Use exactly like
chrome.storage.local / chrome.storage.session, but values are
transparently LZ-compressed at rest.
Type-guard: returns
trueifvalueis an LzEnvelope.