# Changelog - Memorio

All notable changes to this project will be documented in this file.

---

## v3.0.2 (Current) - 2026-05-19 — Bug Fix, Security & API Expansion

### 🐛 Bug Fixes

- Removed dead code: `buildPathTracker` from `functions/state/index.ts` (unused Proxy builder, exported nowhere)
- Removed double `delete` in state `removeAll` handler (redundant null-check + delete on same key)
- Removed unbound `globalThis.state` reference in state init (would throw `ReferenceError` in strict mode)
- Removed `Object.freeze(observer)` referencing undeclared variable (`ReferenceError` on module load)
- Removed `confirm()` synchronous blocking call from `idb.db.delete` (library must not block main thread)

### 🔒 Security Improvements

- Removed `esbuild-sass-plugin` and `esbuild-scss-modules-plugin` from `devDependencies` (unnecessary for a library with no styles)
- Removed `injectStyle: true`, `sassPlugin()` and `.css` loader from `tsup.config.ts`
- Deleted `tsup.plugin.injectCss.ts` (code injection vector completely removed from build pipeline)
- `console.error`/`console.warn` → `console.debug` in `devtools` and `idb` error handlers (consistent debug-only logging policy)
- `store.set()` now blocks function values instead of silently logging and continuing
- All `PRIVATE License` headers in `functions/idb/` replaced with `MIT License`

### 🔧 Code Quality

- Added JSDoc to `observerFunction` in `functions/observer/index.ts`
- Added JSDoc to `cache` global in `functions/cache/index.ts`
- `lint` and `tsc` pass clean — 0 vulnerabilities from `npm audit`

### 🆕 API — New in 3.0.2

| Function | Description |
|----------|-------------|
| `memorio.isBrowser()` | Returns `true` when running in a browser |
| `memorio.isNode()` | Returns `true` when running in Node.js |
| `memorio.isDeno()` | Returns `true` when running in Deno |
| `memorio.isEdge()` | Returns `true` in Cloudflare Workers, Vercel Edge, etc. |
| `memorio.getCapabilities()` | Full capabilities object (`platform`, `hasLocalStorage`, `hasIndexedDB`, …) |
| `memorio.createContext(name?)` | Create multi-tenant isolated context |
| `memorio.listContexts()` | List all active isolated contexts |
| `memorio.deleteContext(id)` | Delete isolated context by ID |
| `memorio.isolate(name?)` | Shorthand alias for `createContext` |

### 🧪 Tests
- **Result: 8 suites · 95 passed · 3 skipped · 0 failed**

### 🗑️ Dependency Changes

| Removed | Reason |
|---------|--------|
| `esbuild-sass-plugin@3.7.0` | No SCSS in a library |
| `esbuild-scss-modules-plugin@1.1.1` | No SCSS in a library |
| 36 transitive packages | Removed from `node_modules` |

### 📝 Documentation Updates

- `docs/README.md`: replaced `console.log` with `console.debug` in usage examples; fixed `esbuild` badge → `tsup`
- `.github/CHANGELOG.md`: restructured with fix / security / changed sections
- `.github/HISTORY.md`: complete rewrite through v3.0.2
- `.github/SECURITY.md`: NIST/NSA standard + OWASP Top 10 mapping
- `.github/CITATION.cff`: license PRIVATE → MIT to match `package.json`
- `.project/*`: all context documents updated to v3.0.2

---

## v2.9.0 — 2026-05-13

### Added
- DevTools — `memorio.devtools.inspect()`, `stats()`, `exportData()`
- Logger with full history, stats and export
- Platform detection (`isBrowser`, `isNode`, `isDeno`, `isEdge`, `getCapabilities`)
- Session isolation via `crypto.randomUUID()`

### Changed
- Updated dependencies to latest versions
- Improved cross-platform support (Deno, Edge Workers, Node.js)

### Security
- Secure random session IDs replaced `Math.random()`
- Key validation (max 512 chars + character whitelist)

---

## v2.5.0 — 2026-02-17

- Initial release of memorio (state, store, session, cache, idb)
- Observer pattern (`observer`)
- `useObserver` React hook
