fix: monitor objects and delete property
Fixes #217
This PR ensures changed in Session is set to true by:
- observing modifications to objects (and recursive objects) within Session
- observing when the
deletekeyword is used within Session (and recursive objects)
Checklist
- [x] run
npm run testandnpm run benchmark - [x] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [x] commit message and code follows the Developer's Certification of Origin and the Code of conduct
I still don't understand why it needs to be in module scope vs inside the plugin scope.
@mcollina Do you mean that sessionProxyCache should be moved into the scope of fastifySecureSession? I was not aware that fastifySecureSession would be called multiple times.
Edit: I've moved its scope.
I'm not sure why but the tests are now failing, I'm reverting.
https://github.com/fastify/fastify-secure-session/actions/runs/8631175011/job/23659036483#step:5:117
Feel free to open a fresh PR with this, but these kind of failures are why I generically prefer to avoid Proxy.