Make session.driver optional in config schema#15208
Conversation
🦋 Changeset detectedLatest commit: 6c24dc1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Adapters like Cloudflare, Netlify, and Node provide default session drivers, so users should be able to configure session options (like ttl) without explicitly specifying a driver. Fixes #15202
c74d085 to
507260d
Compare
|
| 📦 Package | 🔒 Before | 🔓 After |
|---|---|---|
| @cloudflare/kv-asset-handler | trusted-with-provenance | none |
| @cloudflare/unenv-preset | trusted-with-provenance | none |
| workerd | trusted-with-provenance | none |
| ts-api-utils | provenance | none |
| miniflare | trusted-with-provenance | none |
| youch | provenance | none |
| @cloudflare/workerd-darwin-64 | trusted-with-provenance | none |
| @cloudflare/workerd-darwin-arm64 | trusted-with-provenance | none |
| @cloudflare/workerd-linux-64 | trusted-with-provenance | none |
| @cloudflare/workerd-linux-arm64 | trusted-with-provenance | none |
| @cloudflare/workerd-windows-64 | trusted-with-provenance | none |
| wrangler | trusted-with-provenance | none |
florian-lefebvre
left a comment
There was a problem hiding this comment.
I think you need to also update session/types.ts. There are several instances of driver: ... to update.
Once the types are updated, can you also add a type test in packages/astro/test/types/define-config.ts maybe?
ematipico
left a comment
There was a problem hiding this comment.
Looks good. Should address Florian's suggestion
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
| TDriver, | ||
| ] extends [never] | ||
| ? UnstorageConfig<keyof BuiltinDriverOptions> | ||
| ? CustomConfig |
There was a problem hiding this comment.
Is it possible to keep the unstorage config as the default somehow? IIRC from my tests it was the only way to keep autocomplete for now. Maybe try to update UnstorageConfig driver property to be optional
There was a problem hiding this comment.
That's odd, it's essentially the same as CustomConfig, but sure, can try that.
There was a problem hiding this comment.
Yeah I know it's weird. If the autocomplete works in the current state then we're good!
There was a problem hiding this comment.
I didn't check autocomplete with the previous change but this one works.
Adapters like Cloudflare, Netlify, and Node provide default session drivers, so users should be able to configure session options (like ttl) without explicitly specifying a driver.
Changes
Testing
Added test case to
packages/astro/test/units/config/config-validate.test.jsDocs
N/A, bug fix