Changelog
Unreleased
Fixed
EncryptedLocalStorageDriver.setnow respectsexpiresAfter(drivers/EncryptedLocalStorageDriver.ts). The driver now wraps every value in a{data, expiresAt}envelope before encrypting — matching the plain-driver shape — then decrypts and unwraps on read, applying the same expiry check the plain drivers use. The on-disk cypher format is still a single string, so storage layout is unchanged. Backward compatibility: legacy cyphers written by previous releases (raw value, no envelope) are still readable — when the decrypted payload doesn’t look like the envelope (typeof !== "object", nodatakey), the driver returns the value as-is with no expiration. Inherited byEncryptedSessionStorageDriver.RunTimeDriver.has(missingKey)now returnsfalse(drivers/RunTimeDriver.ts).RunTimeDriver.getItemnow returnsnull(instead ofundefined) for misses, aligning the driver with the Web Storage API contract and fixingBaseCacheEngine.has()for this driver. The base engine’shas()check (getItem(...) !== null) was already correct for the other drivers; this change brings RunTimeDriver into line.
Known limitations (intentionally preserved)
CacheConfigurations.valueParertypo (types.ts:67). The field is namedvalueParer— missing the secondsinParser. The matching field inBaseCacheEngineis_valueParser(correctly spelled). External code passing{ valueParser: ... }tosetCacheConfigurationsis silently ignored; the typo is preserved here for backward compatibility.clear()wipes the entire storage backend, not just keys under the prefix.localStorage.clear()/sessionStorage.clear()reset everything in the origin, including data owned by unrelated apps sharing the domain. There is no prefix-scoped variant. Document this prominently at the call site when sharing a domain.
Added
- Test suite. 96 vitest unit tests under happy-dom across
PlainLocalStorageDriver,PlainSessionStorageDriver,EncryptedLocalStorageDriver,EncryptedSessionStorageDriver,RunTimeDriver,CacheManager, the configuration helpers, and the public-export surface. Total: 96 passing, 0 skipped. - AI kit.
llms.txt,llms-full.txt, and askills/folder (README,overview,manager,local-storage,session-storage,runtime,encryption,custom-drivers,recipes) for tool-assisted development. - CI. GitHub Actions workflow: Node 18/20/22 on Ubuntu, plus Node 20 on Windows.
vitest.config.tsmodeled on the@mongez/dompattern. happy-dom environment (the Web Storage drivers need it), self-detecting sibling-alias helper (resolves@mongez/encryptionfrom the monorepo when present, falls back tonode_modulesin CI), and a sharedsetup.tsthat clears both Web Storage backends between tests.package.jsonfields.description(was generic),keywords(expanded with driver names, TTL, prefix, persist-adapter),sideEffects: false,scripts.test,scripts.test:watch, and devDependencies forhappy-dom,typescript,vitest.
Changed
Nothing in the runtime surface.
Removed
Nothing.
Tests
96 passing, 0 skipped1.2.4
(historical — no detailed changelog kept)
1.2.0 — 11 Nov 2022
- Removed
@mongez/encryptionfrom the runtime dependency closure and moved the encrypt/decrypt pair intosetCacheConfigurations({ encryption }). The encrypted drivers now require an explicit encryption pair in configuration before use.
1.1.6 — 07 Nov 2022
valueConverterandvaluePareraccepted in configuration.
1.1.0 — 04 Nov 2022
RunTimeDriverfor in-memory caching.PlainSessionStorageDriverandEncryptedSessionStorageDriver.- Per-entry expiration via
set(key, value, expiresAfter). getCacheConfigurationsandgetCacheConfig.