-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:redwoodjs/redwood into dt-implement…
…-dbauth-middleware * 'main' of github.com:redwoodjs/redwood: chore(location): Accept URL-like object (#10467) fix(router): Remove barrel exports from router.tsx (#10464) chore(dbauth-mw): Refactor web side dbAuth creation (#10460) chore(router): Prevent circular dependency for namedRoutes (#10463) chore(router): route-validators: Better types and clean up comments (#10462) feat(server-auth): dbAuth 3/3 - handle login, logout, signup, etc. requests if forwarded from middleware (#10457) docs(router): Document new NavLink className replacement behavior (#10401) chore(refactor): Split the router out into smaller logical units (#10434) feat(server-auth): Part 1/3: dbAuth middleware support (web side changes) (#10444) chore(auth): Build: Put ESM at the root, and CJS in /cjs (#10458) fix(ssr): Successfully serve static assets like `favicon.png` (#10455) chore(deps): update chore (#10367) (docs) Fix useCache headers and links (#10451) chore: remove aws-lambda (#10450) chore(deps): update dependency typescript to v5.4.5 (#10452) feat(og-gen): Update implementation of useLocation | Update App template (#10441) feat(og-gen): Adds package and vite plugin for dynamic og generation (#10439)
- Loading branch information
Showing
137 changed files
with
2,182 additions
and
1,295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- feat(og-gen): Adds package and vite plugin for dynamic og generation (#10439) by @dac09 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
- feat(og-gen): Update implementation of useLocation | Update App template (#10441) by @dac09 | ||
**Updated App.tsx template** | ||
We modified the `App.tsx` template to accept possible children, and render them if present. This lets the og:image handler inject your component into the Document tree, without including the entire Router, but still style your og:image component using whatever you used to style the rest of your app (Tailwind, perhaps?) | ||
|
||
**Updated useLocation implementation** | ||
We also modified the `useLocation()` hook to now return everything that the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) returns. Previously it only returned three attributes of the url (pathname, search, hash), now it returns everything available to a call to `new URL()` (origin, href, searchParams, etc.). | ||
|
||
The reason for this is now that we have SSR, we can get access to more details in the hook - in this case we needed origin | ||
|
||
Both changes should be non-breaking! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- feat(server-auth): Part 1/3: dbAuth middleware support (web side changes) (#10444) by @dac09 | ||
Adds ability to `createMiddlewareAuth` in dbAuth client which: | ||
1. Updates the dbAuth web client to speak to middleware instead of graphql | ||
2. Implements fetching current user from middleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
- feat(server-auth): dbAuth 3/3 - handle login, logout, signup, etc. requests if forwarded from middleware (#10457) by @dac09 | ||
|
||
This PR updates the DbAuthHandler class to handle requests forwarded from middleware, so it can generate responses for login, logout, signup, etc. These are POST requests - it used to be to the `/auth` function, but now they will be captured by dbAuth middleware and forwarded onto DbAuthHandler. | ||
|
||
**High level changes:** | ||
- use the `Headers` class in each of the "method" responses. This allows us to set multi-value headers like Set-Cookie. A simple object would not. See type `AuthMethodOutput` | ||
- extracts `buildResponse` into a testable function and adds test. For `Set-Cookie` headers we return an array of strings. | ||
|
||
In the middleware here's the code I had for the final conversion: | ||
```ts | ||
if (AUTHHANDLER_REQUEST) { | ||
const output = await dbAuthHandler(req) | ||
|
||
const finalHeaders = new Headers() | ||
Object.entries(output.headers).forEach(([key, value]) => { | ||
if (Array.isArray(value)) { | ||
value.forEach((v) => finalHeaders.append(key, v)) | ||
} else { | ||
finalHeaders.append(key, value) | ||
} | ||
}) | ||
|
||
return new MiddlewareResponse(output.body, { | ||
headers: finalHeaders, | ||
status: output.statusCode, | ||
}) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
- chore(dbauth-mw): Refactor web side dbAuth creation (#10460) by @dac09 | ||
|
||
This PR changes how the webside auth is initialised, by removing the `createMiddlewareAuth` function, instead it just detects it internally. | ||
|
||
For dbAuth this is what it will looks like: | ||
|
||
```js:web/src/auth.ts | ||
import { | ||
createDbAuthClient, | ||
createAuth, | ||
} from '@redwoodjs/auth-dbauth-web' | ||
|
||
const dbAuthClient = createDbAuthClient({ | ||
middleware: true, | ||
}) | ||
|
||
// Internally we know to use the middleware version of the client | ||
// because middleware is set to true above! | ||
export const { AuthProvider, useAuth } = createAuth(dbAuthClient) | ||
|
||
``` | ||
|
||
For other auth providers we are going to export a similar looking function: | ||
|
||
```js | ||
import { createAuth, createSupabaseAuthClient } from '@redwoodjs/auth-supabase-web' | ||
|
||
// This function is new, and just wraps creating supabase👇 | ||
const supabaseClient = createSupabaseAuthClient({ | ||
supabaseUrl: process.env.SUPABASE_URL || '', | ||
supabaseKey: process.env.SUPABASE_KEY || '', | ||
middleware: true | ||
}) | ||
|
||
export const { AuthProvider, useAuth } = createAuth(supabaseClient) | ||
``` | ||
|
||
This also means our users won't need to change where supabase client is imported from, for example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
- fix(router): Remove barrel exports from router.tsx (#10464) by @Tobbe | ||
|
||
We were using both `index.ts` and `router.tsx` as barrel export files. We | ||
should move away from barrel exports at some point, and we definitely don't | ||
need two files doing it in the same package. Everything that was exported from | ||
`router.tsx` is already exported by other files (except `Router` itself). So I | ||
updated the code to import from there directly instead. | ||
|
||
This is a breaking change for anyone who does | ||
`import ... from '@redwoodjs/router/dist/router'` in their project. Which | ||
hopefully isn't very many. | ||
- The quick fix is to find the original export and pull from there instead | ||
- The real fix is to talk to us on the core team and see if we can provide an | ||
official way of solving it instead of relying on internal implementation | ||
details 🙂 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
"devDependencies": { | ||
"@docusaurus/module-type-aliases": "3.1.1", | ||
"@docusaurus/tsconfig": "3.1.1", | ||
"typescript": "5.4.3" | ||
"typescript": "5.4.5" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.