Skip to content

Commit

Permalink
Merge branch 'main' of github.com:redwoodjs/redwood into feat/dc-rc-o…
Browse files Browse the repository at this point in the history
…g-gen-mw-p2

* 'main' of github.com:redwoodjs/redwood:
  fix(deps): update React to latest canary 19.x (#10496)
  fix(upgrade): Download yarn patches (#10497)
  Revert React 19 upgrade (#10482 and #10491) (#10495)
  Modified type for describeScenario (#10468)
  fix(upgrade): Download yarn patches (#10491)
  fix(deps): update React to latest canary 19.x (#10482)
  chore(dataMigrate): Fix package.json directory value (#10490)
  RSC: css preinit: Add required option precedence (#10481)
  chore(renovate): Remove config for unused package (#10489)
  RSC: Update test projects to use new @apollo/client-react-streaming (#10488)
  RSC: Remove unused vite patch from test-project-rsa (#10487)
  chore(ssr): Switch to use `@apollo/client-react-streaming` package (#10484)
  chore(docs): Move .mdx import into separate file (#10486)
  fix(cli): avoid `npx` during upgrade command (#10479)
  fix: Fixes Unknown Fragment issues due to GraphQL Tag type mismatch in web (#10357)
  RSC: Clean up some comments and logs (#10480)
  feat: redwoodjs/auth-dbauth-middleware - Part 2/3 - Auth Middleware for dbAuth to authenticate users via cookie (#10447)
  • Loading branch information
dac09 committed Apr 22, 2024
2 parents bae0489 + 859d93b commit 4cf78fb
Show file tree
Hide file tree
Showing 57 changed files with 1,084 additions and 198 deletions.
4 changes: 4 additions & 0 deletions .changesets/10447.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- feat(auth): redwoodjs/auth-dbauth-middleware - Auth Middleware for dbAuth to authenticate users via cookie

* Implements createDbAuthMiddleware in @redwoodjs/auth-dbauth-middleware:build
* Used to register middleware for dbAuth in RedwoodJS projects
3 changes: 3 additions & 0 deletions .changesets/10479.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- fix(cli): avoid `npx` during upgrade command (#10479) by @Josh-Walker-GM

This change fixes a problem with the `yarn rw upgrade` command when you don't have `npx` installed. If you don't have `npx` installed you will now have to manually run a command to dedupe dependencies rather than this being done for you automatically during the upgrade command. If this is the case, the `npx` command will be logged to the console when you run `yarn rw upgrade`.
5 changes: 5 additions & 0 deletions .changesets/young-spiders-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- PR title (#PR number) by @PR author

fix: Fixes Unknown Fragment issues due to GraphQL Tag type mismatch in web (#10357) by @dthyresson

Users reported in #10322 an incompatibility with fragments and when using gql from global web. The TS errors were caused by the global web gql type not being compatible with the standard graphql-tag type.
9 changes: 0 additions & 9 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@
"sort-package-json",
"zx"
]
},

{
"groupName": "experimental",
"enabled": false,

"matchPackageNames": [
"@apollo/experimental-nextjs-app-support"
]
}
]
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"redwoodjs",
"rsdw",
"RWJS",
"superjson",
"tailwindcss",
"waku"
]
Expand Down
4 changes: 2 additions & 2 deletions __fixtures__/fragment-test-project/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"@redwoodjs/router": "7.0.0",
"@redwoodjs/web": "7.0.0",
"humanize-string": "2.1.0",
"react": "18.3.0-canary-a870b2d54-20240314",
"react-dom": "18.3.0-canary-a870b2d54-20240314"
"react": "19.0.0-canary-36e62c603-20240418",
"react-dom": "19.0.0-canary-36e62c603-20240418"
},
"devDependencies": {
"@redwoodjs/vite": "7.0.0",
Expand Down

This file was deleted.

3 changes: 2 additions & 1 deletion __fixtures__/test-project-rsa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"packageManager": "yarn@4.1.1",
"resolutions": {
"vite@4.4.9": "patch:vite@npm%3A4.4.9#./.yarn/patches/vite-npm-4.4.9-e845c1bbf8.patch"
"@apollo/client-react-streaming/superjson": "^1.12.2",
"@apollo/client/rehackt": "0.0.0-pr.10.0"
}
}
6 changes: 3 additions & 3 deletions __fixtures__/test-project-rsa/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
]
},
"dependencies": {
"@apollo/experimental-nextjs-app-support": "0.0.0-commit-b8a73fe",
"@apollo/client-react-streaming": "0.10.0",
"@redwoodjs/forms": "8.0.0-canary.144",
"@redwoodjs/router": "8.0.0-canary.144",
"@redwoodjs/web": "8.0.0-canary.144",
"react": "18.3.0-canary-a870b2d54-20240314",
"react-dom": "18.3.0-canary-a870b2d54-20240314"
"react": "19.0.0-canary-36e62c603-20240418",
"react-dom": "19.0.0-canary-36e62c603-20240418"
},
"devDependencies": {
"@redwoodjs/vite": "8.0.0-canary.144",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@
"prisma": {
"seed": "yarn rw exec seed"
},
"packageManager": "yarn@4.1.1"
"packageManager": "yarn@4.1.1",
"resolutions": {
"@apollo/client-react-streaming/superjson": "^1.12.2",
"@apollo/client/rehackt": "0.0.0-pr.10.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
]
},
"dependencies": {
"@apollo/experimental-nextjs-app-support": "0.0.0-commit-b8a73fe",
"@apollo/client-react-streaming": "0.10.0",
"@jtoar/throw-on-client": "0.0.1",
"@redwoodjs/forms": "7.0.0-canary.1011",
"@redwoodjs/router": "7.0.0-canary.1011",
"@redwoodjs/web": "7.0.0-canary.1011",
"@tobbe.dev/rsc-test": "0.0.5",
"client-only": "0.0.1",
"react": "18.3.0-canary-a870b2d54-20240314",
"react-dom": "18.3.0-canary-a870b2d54-20240314"
"react": "19.0.0-canary-36e62c603-20240418",
"react-dom": "19.0.0-canary-36e62c603-20240418"
},
"devDependencies": {
"@redwoodjs/vite": "7.0.0-canary.1011",
Expand Down
6 changes: 5 additions & 1 deletion __fixtures__/test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@
"prisma": {
"seed": "yarn rw exec seed"
},
"packageManager": "yarn@4.1.1"
"packageManager": "yarn@4.1.1",
"resolutions": {
"@storybook/react-dom-shim@npm:7.6.17": "https://verdaccio.tobbe.dev/@storybook/react-dom-shim/-/react-dom-shim-8.0.8.tgz",
"@apollo/client/rehackt": "0.0.0-pr.10.0"
}
}
4 changes: 2 additions & 2 deletions __fixtures__/test-project/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"@redwoodjs/router": "7.0.0",
"@redwoodjs/web": "7.0.0",
"humanize-string": "2.1.0",
"react": "18.3.0-canary-a870b2d54-20240314",
"react-dom": "18.3.0-canary-a870b2d54-20240314"
"react": "19.0.0-canary-36e62c603-20240418",
"react-dom": "19.0.0-canary-36e62c603-20240418"
},
"devDependencies": {
"@redwoodjs/vite": "7.0.0",
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/ReactPlayer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use client'

import ReactPlayer from 'react-player'

export default ReactPlayer
2 changes: 1 addition & 1 deletion docs/docs/project-configuration-dev-test-build.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Project Configuration
description: Advanced project configuration
---

import ReactPlayer from 'react-player'
import ReactPlayer from './ReactPlayer'

# Project Configuration: Dev, Test, Build

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"vscode-languageserver": "6.1.1",
"vscode-languageserver-protocol": "3.15.3",
"vscode-languageserver-textdocument": "1.0.11",
"vscode-languageserver-types": "3.17.5"
"vscode-languageserver-types": "3.17.5",
"@storybook/react-dom-shim@npm:7.6.17": "https://verdaccio.tobbe.dev/@storybook/react-dom-shim/-/react-dom-shim-8.0.8.tgz"
},
"devDependencies": {
"@actions/cache": "3.2.4",
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export const parseAuthorizationHeader = (
export type AuthContextPayload = [
Decoded,
{ type: string } & AuthorizationHeader,
{ event: APIGatewayProxyEvent | Request; context: LambdaContext },
// @MARK: Context is not passed when using middleware auth
{ event: APIGatewayProxyEvent | Request; context?: LambdaContext },
]

export type Decoder = (
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/auth0/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@babel/cli": "7.24.1",
"@babel/core": "^7.22.20",
"@types/react": "^18.2.55",
"react": "18.3.0-canary-a870b2d54-20240314",
"react": "19.0.0-canary-36e62c603-20240418",
"typescript": "5.4.5",
"vitest": "1.4.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@babel/core": "^7.22.20",
"@types/netlify-identity-widget": "1.9.6",
"@types/react": "^18.2.55",
"react": "18.3.0-canary-a870b2d54-20240314",
"react": "19.0.0-canary-36e62c603-20240418",
"typescript": "5.4.5",
"vitest": "1.4.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/clerk/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@clerk/clerk-react": "4.30.7",
"@clerk/types": "3.62.1",
"@types/react": "^18.2.55",
"react": "18.3.0-canary-a870b2d54-20240314",
"react": "19.0.0-canary-36e62c603-20240418",
"typescript": "5.4.5",
"vitest": "1.4.0"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ interface WebAuthnFlowOptions {

export type UserType = Record<string | number, any>

export type DbAuthResponse = Promise<{
headers: {
[x: string]: string | string[]
}
body?: string | undefined
statusCode: number
}>

type AuthMethodOutput = [
string | Record<string, any> | boolean | undefined, // body
Headers?,
Expand Down
37 changes: 37 additions & 0 deletions packages/auth-providers/dbAuth/middleware/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# DbAuth Middleware


```tsx filename='entry.server.tsx'
import type { TagDescriptor } from '@redwoodjs/web'

import App from './App'
import { createDbAuthMiddleware } from '@redwoodjs/auth-dbauth-middleware'
import { Document } from './Document'

// eslint-disable-next-line no-restricted-imports
import { handler as dbAuthHandler } from '$api/src/functions/auth'
import { cookieName } from '$api/src/lib/auth'
import { getCurrentUser } from '$api/src/lib/auth'
interface Props {
css: string[]
meta?: TagDescriptor[]
}

export const registerMiddleware = () => {
const dbAuthMiddleware = createDbAuthMiddleware({
cookieName,
dbAuthHandler,
getCurrentUser,
// dbAuthUrl? optional
})
return [dbAuthMiddleware]
}

export const ServerEntry: React.FC<Props> = ({ css, meta }) => {
return (
<Document css={css} meta={meta}>
<App />
</Document>
)
}
```
3 changes: 3 additions & 0 deletions packages/auth-providers/dbAuth/middleware/build.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { build } from '@redwoodjs/framework-tools'

await build()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* eslint-env node */

module.exports =
require('../dist/vite-plugin-auth-dbauth-middleware.js').default
48 changes: 48 additions & 0 deletions packages/auth-providers/dbAuth/middleware/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@redwoodjs/auth-dbauth-middleware",
"version": "7.0.0",
"repository": {
"type": "git",
"url": "https://github.com/redwoodjs/redwood.git",
"directory": "packages/auth-providers/dbAuth/middleware"
},
"license": "MIT",
"exports": {
".": {
"default": "./dist/index.js"
},
"./plugin": {
"import": "./dist/vite-plugin-auth-dbauth-middleware.js",
"default": "./cjsWrappers/plugin.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist",
"cjsWrappers"
],
"scripts": {
"build": "tsx ./build.mts && yarn build:types",
"build:pack": "yarn pack -o redwoodjs-auth-dbauth-middleware.tgz",
"build:types": "tsc --build --verbose",
"prepublishOnly": "NODE_ENV=production yarn build",
"test": "vitest run",
"test:watch": "vitest watch"
},
"dependencies": {
"@redwoodjs/auth-dbauth-api": "workspace:*"
},
"devDependencies": {
"@redwoodjs/api": "workspace:*",
"@redwoodjs/framework-tools": "workspace:*",
"@redwoodjs/graphql-server": "workspace:*",
"@redwoodjs/vite": "workspace:*",
"@types/aws-lambda": "8.10.136",
"ts-toolbelt": "9.6.0",
"tsx": "4.7.1",
"typescript": "5.4.5",
"vitest": "1.4.0"
},
"gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
}
Loading

0 comments on commit 4cf78fb

Please sign in to comment.