FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.9k stars 140 forks source link

Move `createSession` and `readSession` to session stores #1145

Closed LoicPoullain closed 2 years ago

LoicPoullain commented 2 years ago

Issue

These functions independent are a bit weird. It would make senses to make them part of the session stores.

Solution and steps

Breaking changes and new features

// Before
readSession(this.store);
createSession(this.store);
// After
this.store.readSession();
this.store.createSession();

Checklist

codecov-commenter commented 2 years ago

Codecov Report

Merging #1145 (d61befe) into v3-0-0 (29eb5b5) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           v3-0-0    #1145      +/-   ##
==========================================
+ Coverage   98.84%   98.86%   +0.02%     
==========================================
  Files          93       98       +5     
  Lines        1648     1769     +121     
  Branches      382      420      +38     
==========================================
+ Hits         1629     1749     +120     
- Misses         19       20       +1     
Impacted Files Coverage Δ
packages/core/src/index.ts 0.00% <ø> (ø)
packages/core/src/sessions/core/index.ts 100.00% <ø> (ø)
...core/src/sessions/http/utils/check-user-id-type.ts 100.00% <ø> (ø)
packages/core/src/sessions/core/session-store.ts 95.45% <100.00%> (+9.74%) :arrow_up:
...ckages/core/src/sessions/http/use-sessions.hook.ts 98.66% <100.00%> (ø)
...sessions/http/utils/get-session-id-from-request.ts 100.00% <100.00%> (ø)
packages/core/src/sessions/http/utils/index.ts 100.00% <100.00%> (ø)
...sessions/http/utils/get-csrf-token-from-request.ts 100.00% <0.00%> (ø)
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.