Compare commits
36 Commits
@blitzjs/a
...
siddharth/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95617216f7 | ||
|
|
8b01175b47 | ||
|
|
e40872efbb | ||
|
|
f76eab6bf6 | ||
|
|
8c7c7a8055 | ||
|
|
0f1beb55b7 | ||
|
|
82649f3415 | ||
|
|
231c2ff5ab | ||
|
|
47c6b62dcb | ||
|
|
61d03b6724 | ||
|
|
cf393786c0 | ||
|
|
33c1252b62 | ||
|
|
b55cbcfa65 | ||
|
|
875b34fcb8 | ||
|
|
47d10c8595 | ||
|
|
8d29b8afa9 | ||
|
|
f8bf8af28f | ||
|
|
5a88801e75 | ||
|
|
cae963ec7d | ||
|
|
6544d052bd | ||
|
|
857ede3445 | ||
|
|
3d8a8d87ae | ||
|
|
5a52fa76d9 | ||
|
|
9a6525fff7 | ||
|
|
87afb00289 | ||
|
|
8ad4dfd0eb | ||
|
|
9ee73fe3d5 | ||
|
|
5bd03a7dfa | ||
|
|
5ab010f289 | ||
|
|
bd3694a103 | ||
|
|
2dc401436d | ||
|
|
4b23aa4f8b | ||
|
|
8255172940 | ||
|
|
90f1741dac | ||
|
|
df3265b854 | ||
|
|
0ba2f4e77a |
@@ -3955,6 +3955,26 @@
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "maciej-ka",
|
||||
"name": "Maciej Kasprzyk",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5403694?v=4",
|
||||
"profile": "https://github.com/maciej-ka",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "justinsmid",
|
||||
"name": "Justin Smid",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/34271675?v=4",
|
||||
"profile": "https://github.com/justinsmid",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
5
.changeset/chilly-jeans-fix.md
Normal file
5
.changeset/chilly-jeans-fix.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Update examples of generate all in docs to include one column in model.
|
||||
9
.changeset/clever-hornets-talk.md
Normal file
9
.changeset/clever-hornets-talk.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
"blitz": patch
|
||||
"@blitzjs/next": patch
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Upgrade tslog to `4.9.0`.
|
||||
|
||||
This due a [tslog issue](https://github.com/fullstack-build/tslog/issues/227) that causes tslog to crash when attempting to log an error whose constructor expects more than one argument.
|
||||
8
.changeset/fifty-drinks-cry.md
Normal file
8
.changeset/fifty-drinks-cry.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"@blitzjs/auth": patch
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
blitz-auth: Support for Prisma v5
|
||||
|
||||
Internal: Make `handle` a required paramter while updating the `session` modal.
|
||||
5
.changeset/fresh-camels-return.md
Normal file
5
.changeset/fresh-camels-return.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/auth": patch
|
||||
---
|
||||
|
||||
Updated `useAuthenticatedBlitzContext` to now return `AuthenticatedCtx`
|
||||
6
.changeset/polite-papayas-joke.md
Normal file
6
.changeset/polite-papayas-joke.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@blitzjs/auth": major
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Migrate `next-auth` adapter to use `@auth/core`
|
||||
5
.changeset/poor-crabs-drum.md
Normal file
5
.changeset/poor-crabs-drum.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
blitz-rpc: Cleanup Event Listeners - Fix potential memory leak by cleaning up any residual event listeners set by blitz.
|
||||
@@ -114,6 +114,7 @@
|
||||
"few-elephants-approve",
|
||||
"few-hounds-worry",
|
||||
"few-shrimps-leave",
|
||||
"fifty-drinks-cry",
|
||||
"flat-bees-approve",
|
||||
"fluffy-coats-flow",
|
||||
"fluffy-mangos-begin",
|
||||
@@ -225,6 +226,7 @@
|
||||
"plenty-gifts-provide",
|
||||
"plenty-kiwis-greet",
|
||||
"polite-lizards-love",
|
||||
"poor-crabs-drum",
|
||||
"poor-peas-lick",
|
||||
"poor-penguins-look",
|
||||
"poor-shrimps-think",
|
||||
|
||||
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -131,10 +131,10 @@ jobs:
|
||||
with:
|
||||
version: 8.6.5
|
||||
|
||||
- name: Setup node@${{ matrix.NODE_VERSION }}
|
||||
- name: Setup node@18
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.NODE_VERSION }}
|
||||
node-version: 18
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install dependencies
|
||||
|
||||
1
.npmrc
1
.npmrc
@@ -1,4 +1,5 @@
|
||||
save-exact=true
|
||||
dedupe-peer-dependents=true
|
||||
strict-peer-dependencies=false
|
||||
|
||||
public-hoist-pattern[]=secure-password
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<img alt="" src="https://img.shields.io/badge/Join%20our%20community-6700EB.svg?style=for-the-badge&labelColor=000000&logoWidth=20&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAQ9SURBVHgB7d3dVdtAEIbhcSpICUoH0IEogQqSVBBSAU4FSSpIOoAORAfQgSghHXzZ1U/YcMD4R9rZmf2ec3y448LyiNf27iLiGIAmPLrweC9Un3DhrzG6EarLNP09nlwJ1SOZ/lQr5N80/S/p2QMVCBf5N17XCfm1Y/rBHqjAG9PPHvBsz+mf9WAP+HLA9M/YA14cOP2payH7jpj+VCtk1wnTP+vj7xCy6cTpn7EHLMLp059iD1iD8eveJbVCNsSLheX1YA/YgOWnf8YeKB3Wmf7Ud6Fy4f/FHmtpxbl3YlC4MJ/Cj0bWdwPnPbARg+L0S54XQHS32WwuxClzd4CM0z9rPfeAuTtA5ulPXYQ7wZ04Y+oOoDD9KZc9YOoOoDj9s4dwFzgXR6w1wIPoOvPWA9buAHEJ173o3gWiy3AnuBUHLEbgmYwvAk1/wuM8vAgexThzbwPDkx7/DHwVXfFOxP2GmsKd4Ab6zPeAyU8CI7AHFmH2BRCBPXAyk18GzUrqAXCTiR4ssyj0VFw/oCU8+e+RZ33AWz6KMaYbIIWxB+JSLs1bsbkeMN0AqakHvoku9oA2sAfqBvbAQdw0QArsgb25aYBUQT3QgT2gB+yBuqGcHij2UCqXDZACe2Anlw2QYg/QAOyBuoE98CL3DZDCuK4/rh/Q7oGL6U+TOvcNkJoijN8X1C48+T+g75eQDrAH/qmqAVJgDwyqaoAUe4AGYA/UDZX3QLUNkEIZPRCd5+6BahsgVUgPROwBTSijB7jpVAvGHriHvmw9wAZ4BpX1ABvgmakHtPcbRuwBTWAPULgAV9D/jKDY9YRvwvgEaurD44uQHvAol7qBW7WKluVtIHiUS7GyvA0s6CiXDnxrpQfsgbqBS7GKk/2jYHCrVlGyfxTMrVo0ALdq1Q3sgSKofh0M9oA61a+D2QM0AHugbmAPqClmSRjK2apVVQ8UsySsoK1aHdgDesCtWnUDeyCrIpeFg1u3sylyWTi3btMA7IG6gT2wuuK3hoE9sKrit4YVslWLPaAN7IG6ocKt2zmY2h4O9sDiTG0PZw/QANy6XTewBxZj9ogYVHy025LMHhEz9cBn0We6B0yfERReBLfhx0/R1YQHPx/QBPbA0VwcEwf2wNFcHBPHHjiem3MC2QPHcXdSaJjA+KfgTPQ8hhfjBzHC40mhlzJ+Xq9lK4a4PCs43AVaGTed5mZq+iOXZwWHi3AnOj2wFWNcnxYe7gTxLtBKHuamP/J+Wnh8a5irB7ZC5Yk9gPX1QuXC+usHWqGyhYvUYR0a7zboUOFCNVhnk0krZAOW7wFOvzXhom2xnEbIHizTA1wEYhWW6YFGyC6c1gOcfg9wfA80Qj7g8B7g9HuCww+haIR8wf49wOn3Cvv9k8tGyC/s7gFOv3fY3QONkH+v9MBWqB7PeqDn9FcIT//kcitUn6kHOu/T/xfWzlQy3dEHhwAAAABJRU5ErkJggg==">
|
||||
</a>
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-417-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
|
||||
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-419-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
<a aria-label="License" href="https://github.com/blitz-js/blitz/blob/main/LICENSE">
|
||||
<img alt="" src="https://img.shields.io/npm/l/blitz.svg?style=for-the-badge&labelColor=000000&color=blue">
|
||||
@@ -94,6 +94,11 @@ Your financial contributions help ensure Blitz continues to be developed and mai
|
||||
<td><a aria-label="Boostry" href="https://boostry.co.jp/?utm_source=BlitzJS&utm_medium=sponsorship&utm_campaign=BlitzJS_Sponsorship_2021">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/boostry.svg" width="200px">
|
||||
</a></td>
|
||||
<td>
|
||||
<a aria-label="Byteflow" href="https://byteflow.app/?ref=blitzjs">
|
||||
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/Byteflow.png" width="70px">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -732,6 +737,8 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
|
||||
<td align="center"><a href="https://github.com/nerixim"><img src="https://avatars.githubusercontent.com/u/26106502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nikita Kamaev</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=nerixim" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://webredone.com/"><img src="https://avatars.githubusercontent.com/u/11588823?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nikola Ivanov</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=nikola-wd" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="jayu.dev"><img src="https://avatars.githubusercontent.com/u/11561585?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jakub Mazurek</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=jayu" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=jayu" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/maciej-ka"><img src="https://avatars.githubusercontent.com/u/5403694?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Maciej Kasprzyk</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=maciej-ka" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=maciej-ka" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/justinsmid"><img src="https://avatars.githubusercontent.com/u/34271675?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Justin Smid</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=justinsmid" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=justinsmid" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# next-blitz-auth
|
||||
|
||||
## 0.1.1-beta.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [90f1741da]
|
||||
- Updated dependencies [df3265b85]
|
||||
- @blitzjs/auth@2.0.0-beta.31
|
||||
- blitz@2.0.0-beta.31
|
||||
- @blitzjs/rpc@2.0.0-beta.31
|
||||
- @blitzjs/next@2.0.0-beta.31
|
||||
- @blitzjs/config@2.0.0-beta.31
|
||||
|
||||
## 0.1.1-beta.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "next-blitz-auth",
|
||||
"version": "0.1.1-beta.6",
|
||||
"version": "0.1.1-beta.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"blitz:dev": "next dev",
|
||||
@@ -9,15 +9,15 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@hookform/error-message": "2.0.0",
|
||||
"@hookform/resolvers": "2.9.10",
|
||||
"@prisma/client": "^4.5.0",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"blitz": "workspace:*",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"flatted": "3.2.7",
|
||||
"next": "13.3.0",
|
||||
"prisma": "^4.5.0",
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@hookform/error-message": "2.0.0",
|
||||
"@hookform/resolvers": "2.9.10",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "13.3.0",
|
||||
"openid-client": "5.2.1",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const { withNextAuthAdapter } = require("@blitzjs/auth")
|
||||
const { withBlitz } = require("@blitzjs/next")
|
||||
|
||||
/**
|
||||
@@ -11,4 +10,4 @@ const config = {
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = withBlitz(withNextAuthAdapter(config))
|
||||
module.exports = withBlitz(config)
|
||||
|
||||
@@ -24,16 +24,16 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@auth/core": "0.10.0",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@hookform/error-message": "2.0.0",
|
||||
"@hookform/resolvers": "2.9.10",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "13.3.0",
|
||||
"next-auth": "4.18.7",
|
||||
"prisma": "4.6.1",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { api } from "src/blitz-server"
|
||||
import GithubProvider from "next-auth/providers/github"
|
||||
import { NextAuthAdapter, BlitzNextAuthOptions } from "@blitzjs/auth/next-auth"
|
||||
import GithubProvider from "@auth/core/providers/github"
|
||||
import { AuthAdapter } from "@blitzjs/auth/adapters/authjs"
|
||||
import db, { User } from "db"
|
||||
import { Role } from "types"
|
||||
|
||||
@@ -13,20 +13,23 @@ const providers = [
|
||||
]
|
||||
|
||||
export default api(
|
||||
NextAuthAdapter({
|
||||
AuthAdapter({
|
||||
successRedirectUrl: "/",
|
||||
errorRedirectUrl: "/error",
|
||||
providers,
|
||||
trustHost: true,
|
||||
secret: process.env.AUTH_SECRET,
|
||||
callback: async (user, account, profile, session) => {
|
||||
console.log("USER SIDE PROFILE_DATA", { user, account, profile })
|
||||
let newUser: User
|
||||
if (!user) throw new Error("No user found")
|
||||
try {
|
||||
newUser = await db.user.findFirstOrThrow({ where: { name: { equals: user.name } } })
|
||||
} catch (e) {
|
||||
newUser = await db.user.create({
|
||||
data: {
|
||||
email: user.email as string,
|
||||
name: user.name as string,
|
||||
email: user.email ?? "",
|
||||
name: user.name ?? "",
|
||||
role: "USER",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useCurrentUser } from "src/users/hooks/useCurrentUser"
|
||||
import logout from "src/auth/mutations/logout"
|
||||
import { useMutation } from "@blitzjs/rpc"
|
||||
import { BlitzPage } from "@blitzjs/next"
|
||||
import { Routes } from ".blitz"
|
||||
import styles from "src/styles/Home.module.css"
|
||||
|
||||
/*
|
||||
@@ -32,6 +31,8 @@ const UserInfo = () => {
|
||||
User id: <code>{currentUser.id}</code>
|
||||
<br />
|
||||
User role: <code>{currentUser.role}</code>
|
||||
<br />
|
||||
User email: <code>{currentUser.email}</code>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
@@ -44,11 +45,11 @@ const UserInfo = () => {
|
||||
<Link href={"/login"} className={styles.loginButton}>
|
||||
<strong>Login</strong>
|
||||
</Link>
|
||||
<Link href="/api/auth/github/login" passHref legacyBehavior>
|
||||
<a className="button small">
|
||||
<a href="/api/auth/github/signin">
|
||||
<p className="button small">
|
||||
<strong>Sign in with GitHub</strong>
|
||||
</a>
|
||||
</Link>
|
||||
</p>
|
||||
</a>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -79,8 +80,6 @@ const Home: BlitzPage = () => {
|
||||
|
||||
<h1>Your database & authentication is ready. Try it by signing up.</h1>
|
||||
|
||||
{/* Auth */}
|
||||
|
||||
<div className={styles.buttonContainer}>
|
||||
<Suspense fallback="Loading...">
|
||||
<UserInfo />
|
||||
@@ -99,7 +98,7 @@ const Home: BlitzPage = () => {
|
||||
<div className={styles.code}>
|
||||
<span>1</span>
|
||||
<pre>
|
||||
<code>blitz generate all project</code>
|
||||
<code>blitz generate all project name:string</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useQuery } from "@blitzjs/rpc"
|
||||
import getCurrentUser from "src/users/queries/getCurrentUser"
|
||||
|
||||
export const useCurrentUser = () => {
|
||||
console.log("useCurrentUser")
|
||||
const [user] = useQuery(getCurrentUser, null)
|
||||
return user
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
"schema": "./db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@prisma/client": "4.6.1",
|
||||
"@types/jest": "29.2.2",
|
||||
"@types/passport-twitter": "1.0.37",
|
||||
"blitz": "workspace:*",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"jest": "29.3.0",
|
||||
"jest-environment-jsdom": "29.3.0",
|
||||
"next": "13.3.0",
|
||||
|
||||
BIN
assets/Byteflow.png
Normal file
BIN
assets/Byteflow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1687709756,
|
||||
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1688221086,
|
||||
"narHash": "sha256-cdW6qUL71cNWhHCpMPOJjlw0wzSRP0pVlRn2vqX/VVg=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "cd99c2b3c9f160cd004318e0697f90bbd5960825",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
39
flake.nix
Normal file
39
flake.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
description = "The Blitzjs Monorepo";
|
||||
nixConfig.bash-prompt = "\[nix:blitz\]$ ";
|
||||
|
||||
inputs = {
|
||||
nixpkgs = {
|
||||
url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
};
|
||||
|
||||
flake-utils = {
|
||||
url = "github:numtide/flake-utils";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
formatter = pkgs.alejandra;
|
||||
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
nodejs-18_x
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
mkdir -p $out/bin
|
||||
${pkgs.nodejs-18_x}/bin/corepack enable --install-directory $out/bin
|
||||
export PATH="$out/bin:$PATH"
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -17,14 +17,14 @@
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@hookform/error-message": "2.0.0",
|
||||
"@hookform/resolvers": "2.9.10",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"delay": "5.0.0",
|
||||
"next": "13.3.0",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import webdriver from "../../utils/next-webdriver"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
let appPort: number = 3000
|
||||
|
||||
const runTests = () => {
|
||||
describe("Auth", () => {
|
||||
@@ -263,7 +263,7 @@ describe("Auth Tests", () => {
|
||||
describe("dev mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
appPort = await findPort()
|
||||
app = await blitzLaunchApp(appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.3.0",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -14,7 +14,7 @@ import fetch from "node-fetch"
|
||||
import {fromBase64} from "b64-lite"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
let appPort: number = 3000
|
||||
const HEADER_CSRF = "anti-csrf"
|
||||
const COOKIE_PUBLIC_DATA_TOKEN = "auth-tests-cookie-prefix_sPublicDataToken"
|
||||
const COOKIE_SESSION_TOKEN = "auth-tests-cookie-prefix_sSessionToken"
|
||||
@@ -43,7 +43,7 @@ const runTests = (mode?: string) => {
|
||||
const browser = await webdriver(appPort, "/authenticated-page")
|
||||
let errorMsg = await browser.elementById(`error`).text()
|
||||
expect(errorMsg).toMatch(/Error: You are not authenticated/)
|
||||
if (browser) browser.close()
|
||||
if (browser) void browser.close()
|
||||
},
|
||||
5000 * 60 * 2,
|
||||
)
|
||||
@@ -132,7 +132,7 @@ describe("Auth Tests", () => {
|
||||
describe("dev mode", async () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
appPort = await findPort()
|
||||
app = await blitzLaunchApp(appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
"schema": "db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.3.0",
|
||||
"prisma": "4.6.1",
|
||||
@@ -28,7 +28,7 @@
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
|
||||
@@ -15,7 +15,7 @@ import webdriver from "../../utils/next-webdriver"
|
||||
import {join} from "path"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
let appPort: number = 3000
|
||||
const appDir = join(__dirname, "../")
|
||||
|
||||
const runTests = (mode?: string) => {
|
||||
@@ -50,7 +50,7 @@ describe("getInitialProps Tests", () => {
|
||||
describe("dev mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
appPort = await findPort()
|
||||
app = await blitzLaunchApp(appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "13.3.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import {join} from "path"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
let appPort: number = 3000
|
||||
const appDir = join(__dirname, "../")
|
||||
|
||||
const runTests = () => {
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.3.0",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -7,7 +7,7 @@ import fetch from "node-fetch"
|
||||
import {fromBase64} from "b64-lite"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
let appPort: number = 3000
|
||||
const HEADER_CSRF = "anti-csrf"
|
||||
const COOKIE_PUBLIC_DATA_TOKEN = "auth-tests-cookie-prefix_sPublicDataToken"
|
||||
const COOKIE_SESSION_TOKEN = "auth-tests-cookie-prefix_sSessionToken"
|
||||
@@ -156,7 +156,7 @@ describe("Auth Tests", () => {
|
||||
describe("dev mode", async () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
appPort = await findPort()
|
||||
app = await blitzLaunchApp(appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.3.0",
|
||||
"prisma": "4.6.1",
|
||||
@@ -28,7 +28,7 @@
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
|
||||
@@ -15,7 +15,7 @@ import webdriver from "../../utils/next-webdriver"
|
||||
import {join} from "path"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
let appPort: number = 3000
|
||||
const appDir = join(__dirname, "../")
|
||||
|
||||
const runTests = (mode?: string) => {
|
||||
@@ -40,7 +40,7 @@ describe("No Suspense Tests", () => {
|
||||
describe("dev mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
appPort = await findPort()
|
||||
app = await blitzLaunchApp(appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@prisma/client": "4.6.1",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "13.3.0",
|
||||
"prisma": "4.6.1",
|
||||
"react": "18.2.0",
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
"schema": "db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.3.0",
|
||||
"prisma": "4.6.1",
|
||||
@@ -27,7 +27,7 @@
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import webdriver from "../../utils/next-webdriver"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
let appPort: number = 3000
|
||||
|
||||
const runTests = () => {
|
||||
describe("get query data", () => {
|
||||
@@ -114,7 +114,7 @@ describe("React Query Utils Tests", () => {
|
||||
describe("dev mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
appPort = await findPort()
|
||||
app = await blitzLaunchApp(appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "13.3.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "13.3.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
"schema": "db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/next": "2.0.0-beta.31",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "workspace:2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.3.0",
|
||||
"prisma": "4.6.1",
|
||||
@@ -28,7 +28,7 @@
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
|
||||
@@ -15,7 +15,7 @@ import webdriver from "../../utils/next-webdriver"
|
||||
import {join} from "path"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
let appPort: number = 3000
|
||||
const appDir = join(__dirname, "../")
|
||||
|
||||
const runTests = (mode?: string) => {
|
||||
@@ -39,7 +39,7 @@ describe("Trailing Slash Tests", () => {
|
||||
describe("dev mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
|
||||
appPort = await findPort()
|
||||
app = await blitzLaunchApp(appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
|
||||
11
package.json
11
package.json
@@ -13,7 +13,7 @@
|
||||
"prepare": "husky install",
|
||||
"build": "turbo run build",
|
||||
"build:apps": "turbo run buildapp --concurrency=1",
|
||||
"dev": "turbo run dev --no-cache --parallel",
|
||||
"dev": "turbo run dev --filter='./packages/*'",
|
||||
"lint": "turbo run lint",
|
||||
"test": "turbo run test",
|
||||
"clean": "turbo run clean && rm -rf node_modules",
|
||||
@@ -34,15 +34,20 @@
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-plugin-prisma": "4.4.0",
|
||||
"pretty-quick": "3.1.3",
|
||||
"turbo": "1.4.2",
|
||||
"turbo": "1.10.7",
|
||||
"vitest": "0.25.3",
|
||||
"wait-on": "6.0.1"
|
||||
},
|
||||
"npmClient": "pnpm",
|
||||
"packageManager": "pnpm@7.11.0",
|
||||
"packageManager": "pnpm@8.6.6",
|
||||
"manypkg": {
|
||||
"ignoredRules": [
|
||||
"EXTERNAL_MISMATCH"
|
||||
]
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"@auth/core@0.10.0": "patches/@auth__core@0.10.0.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
packages/blitz-auth/.gitignore
vendored
Normal file
1
packages/blitz-auth/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
adapters
|
||||
@@ -1,5 +1,17 @@
|
||||
# @blitzjs/auth
|
||||
|
||||
## 2.0.0-beta.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 90f1741da: blitz-auth: Support for Prisma v5
|
||||
|
||||
Internal: Make `handle` a required paramter while updating the `session` modal.
|
||||
|
||||
- Updated dependencies [90f1741da]
|
||||
- Updated dependencies [df3265b85]
|
||||
- blitz@2.0.0-beta.31
|
||||
|
||||
## 2.0.0-beta.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -5,7 +5,11 @@ const config: BuildConfig = {
|
||||
"./src/index-browser",
|
||||
"./src/index-server",
|
||||
"./src/server/secure-password",
|
||||
"./src/server/adapters/next-auth",
|
||||
{
|
||||
builder: "mkdist",
|
||||
input: "./src/adapters/",
|
||||
outDir: "./adapters",
|
||||
},
|
||||
],
|
||||
externals: ["index-browser.cjs", "index-browser.mjs", "react"],
|
||||
declaration: true,
|
||||
|
||||
1
packages/blitz-auth/next-auth.d.ts
vendored
1
packages/blitz-auth/next-auth.d.ts
vendored
@@ -1 +0,0 @@
|
||||
export * from "./dist/next-auth"
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = require("./dist/next-auth.cjs")
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/auth",
|
||||
"version": "2.0.0-beta.30",
|
||||
"version": "2.0.0-beta.31",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -24,7 +24,7 @@
|
||||
"files": [
|
||||
"dist/**",
|
||||
"secure-password.*",
|
||||
"next-auth.*"
|
||||
"adapters/**"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/b64-lite": "1.3.0",
|
||||
@@ -50,9 +50,9 @@
|
||||
"url": "0.11.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"blitz": "2.0.0-beta.30",
|
||||
"@auth/core": "*",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "*",
|
||||
"next-auth": "*",
|
||||
"secure-password": "4.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
@@ -62,12 +62,13 @@
|
||||
"secure-password": {
|
||||
"optional": true
|
||||
},
|
||||
"next-auth": {
|
||||
"@auth/core": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@auth/core": "0.10.0",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@testing-library/react": "13.4.0",
|
||||
"@testing-library/react-hooks": "8.0.1",
|
||||
"@types/cookie": "0.4.1",
|
||||
@@ -75,9 +76,8 @@
|
||||
"@types/jsonwebtoken": "8.5.8",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"blitz": "2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "13.3.0",
|
||||
"next-auth": "4.18.7",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"secure-password": "4.0.0",
|
||||
|
||||
1
packages/blitz-auth/src/.gitignore
vendored
Normal file
1
packages/blitz-auth/src/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!adapters
|
||||
2
packages/blitz-auth/src/adapters/authjs.ts
Normal file
2
packages/blitz-auth/src/adapters/authjs.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./authjs/adapter"
|
||||
export * from "./authjs/types"
|
||||
@@ -11,25 +11,26 @@ import {
|
||||
secureProxyMiddleware,
|
||||
truncateString,
|
||||
} from "blitz"
|
||||
import {isLocalhost, SessionContext} from "../../../index-server"
|
||||
|
||||
// next-auth internals
|
||||
import {toInternalRequest, toResponse} from "./internals/utils/web"
|
||||
import {getBody, getURL, setHeaders} from "./internals/utils/node"
|
||||
import type {RequestInternal, AuthOptions, User} from "next-auth"
|
||||
import type {Cookie} from "next-auth/core/lib/cookie"
|
||||
import type {AuthAction, InternalOptions} from "./internals/core/types"
|
||||
|
||||
import type {
|
||||
ApiHandlerIncomingMessage,
|
||||
BlitzNextAuthApiHandler,
|
||||
BlitzNextAuthOptions,
|
||||
} from "./types"
|
||||
import {Provider} from "next-auth/providers"
|
||||
import {isLocalhost} from "../utils"
|
||||
|
||||
import {init} from "next-auth/core/init"
|
||||
import getAuthorizationUrl from "next-auth/core/lib/oauth/authorization-url"
|
||||
import oAuthCallback from "next-auth/core/lib/oauth/callback"
|
||||
// next-auth internals
|
||||
import {getBody, getURL, setHeaders} from "./internals/core/node"
|
||||
import type {AuthAction, InternalOptions, RequestInternal} from "./internals/core/types"
|
||||
import type {OAuthConfig} from "@auth/core/providers"
|
||||
import type {Cookie} from "@auth/core/lib/cookie"
|
||||
|
||||
import {init} from "@auth/core/lib/init"
|
||||
import emailSignIn from "@auth/core/lib/email/signin"
|
||||
import {getAuthorizationUrl} from "@auth/core/lib/oauth/authorization-url"
|
||||
import {handleOAuth} from "@auth/core/lib/oauth/callback"
|
||||
import {handleState} from "@auth/core/lib/oauth/handle-state"
|
||||
import {toInternalRequest, toResponse} from "@auth/core/lib/web"
|
||||
import {assertConfig} from "@auth/core/lib/assert"
|
||||
|
||||
const INTERNAL_REDIRECT_URL_KEY = "_redirectUrl"
|
||||
|
||||
@@ -42,41 +43,38 @@ function switchURL(callbackUrl: string) {
|
||||
return `${url.protocol}//${url.host}${switchPathNameString}${url.search}${url.hash}`
|
||||
}
|
||||
|
||||
export function NextAuthAdapter<P extends Provider[]>(
|
||||
export function AuthAdapter<P extends OAuthConfig<any>[]>(
|
||||
config: BlitzNextAuthOptions<P>,
|
||||
): BlitzNextAuthApiHandler {
|
||||
return async function authHandler(req, res) {
|
||||
assert(
|
||||
req.query.nextauth,
|
||||
"req.query.nextauth is not defined. Page must be named [...auth].ts/js.",
|
||||
"req.query.nextauth is not defined. Page must be named [...nextauth].ts/js.",
|
||||
)
|
||||
assert(
|
||||
Array.isArray(req.query.nextauth),
|
||||
"req.query.nextauth must be an array. Page must be named [...auth].ts/js.",
|
||||
"req.query.nextauth must be an array. Page must be named [...nextauth].ts/js.",
|
||||
)
|
||||
if (!req.query.nextauth?.length) {
|
||||
return res.status(404).end()
|
||||
}
|
||||
const action = req.query.nextauth[1] as AuthAction
|
||||
if (!action || !["login", "callback"].includes(action)) {
|
||||
if (!action || !["signin", "callback"].includes(action)) {
|
||||
return res.status(404).end()
|
||||
}
|
||||
|
||||
const cookieSessionMiddleware = cookieSession({
|
||||
secret: process.env.SESSION_SECRET_KEY || "default-dev-secret",
|
||||
secure: process.env.NODE_ENV === "production" && !isLocalhost(req),
|
||||
})
|
||||
|
||||
const middleware: RequestMiddleware<ApiHandlerIncomingMessage, MiddlewareResponse<Ctx>>[] = [
|
||||
connectMiddleware(cookieSessionMiddleware as RequestMiddleware),
|
||||
]
|
||||
|
||||
if (config.secureProxy) {
|
||||
middleware.push(secureProxyMiddleware)
|
||||
}
|
||||
|
||||
const headers = new Headers(req.headers as any)
|
||||
const url = getURL(req.url, headers)
|
||||
log.debug("NEXT_AUTH_URL", url)
|
||||
if (url instanceof Error) {
|
||||
if (process.env.NODE_ENV !== "production") throw url
|
||||
const errorLogger = config.logger?.error ?? console.error
|
||||
@@ -92,37 +90,46 @@ export function NextAuthAdapter<P extends Provider[]>(
|
||||
method: req.method,
|
||||
...getBody(req),
|
||||
})
|
||||
|
||||
log.debug("NEXT_AUTH_REQUEST")
|
||||
const internalRequest = await toInternalRequest(request)
|
||||
log.debug("NEXT_AUTH_INTERNAL_REQUEST", internalRequest)
|
||||
if (internalRequest instanceof Error) {
|
||||
console.error((request as any).code, request)
|
||||
return new Response(`Error: This action with HTTP ${request.method} is not supported.`, {
|
||||
status: 400,
|
||||
return res.status(500).json({
|
||||
message:
|
||||
"There was a problem with the server configuration. Check the server logs for more information.",
|
||||
})
|
||||
}
|
||||
let {providerId} = internalRequest
|
||||
if (providerId?.includes("?")) {
|
||||
providerId = providerId.split("?")[0]
|
||||
const assertionResult = assertConfig(internalRequest, config)
|
||||
if (Array.isArray(assertionResult)) {
|
||||
assertionResult.forEach(log.error)
|
||||
} else if (assertionResult instanceof Error) {
|
||||
// Bail out early if there's an error in the user config
|
||||
log.error(assertionResult.message)
|
||||
return res.status(500).json({
|
||||
message:
|
||||
"There was a problem with the server configuration. Check the server logs for more information.",
|
||||
code: assertionResult.name,
|
||||
})
|
||||
}
|
||||
const callbackUrl = req.body?.callbackUrl ?? req.query?.callbackUrl?.toString()
|
||||
const {options, cookies} = await init({
|
||||
// @ts-ignore
|
||||
url: new URL(
|
||||
// @ts-ignore
|
||||
internalRequest.url!,
|
||||
internalRequest.url,
|
||||
process.env.APP_ORIGIN || process.env.BLITZ_DEV_SERVER_ORIGIN,
|
||||
),
|
||||
authOptions: config as unknown as AuthOptions,
|
||||
authOptions: config,
|
||||
action,
|
||||
providerId,
|
||||
callbackUrl: req.body?.callbackUrl ?? (req.query?.callbackUrl as string),
|
||||
providerId: internalRequest.providerId.includes("?")
|
||||
? internalRequest.providerId.split("?")[0]
|
||||
: internalRequest.providerId,
|
||||
callbackUrl,
|
||||
cookies: internalRequest.cookies,
|
||||
isPost: req.method === "POST",
|
||||
csrfDisabled: config.csrf?.enabled ?? false,
|
||||
})
|
||||
|
||||
options.provider.callbackUrl = switchURL(options.provider.callbackUrl)
|
||||
|
||||
log.debug("NEXT_AUTH_INTERNAL_OPTIONS", options)
|
||||
|
||||
await AuthHandler(middleware, config, internalRequest, action, options, cookies)
|
||||
.then(async ({middleware}) => {
|
||||
await handleRequestWithMiddleware<ApiHandlerIncomingMessage, MiddlewareResponse<Ctx>>(
|
||||
@@ -145,7 +152,14 @@ export function NextAuthAdapter<P extends Provider[]>(
|
||||
}
|
||||
}
|
||||
|
||||
async function AuthHandler<P extends Provider[]>(
|
||||
function defaultNormalizer(email?: string) {
|
||||
if (!email) throw new Error("Missing email from request body.")
|
||||
let [local, domain] = email.toLowerCase().trim().split("@")
|
||||
domain = domain?.split(",")[0]
|
||||
return `${local}@${domain}`
|
||||
}
|
||||
|
||||
export async function AuthHandler<P extends OAuthConfig<any>[]>(
|
||||
middleware: RequestMiddleware<ApiHandlerIncomingMessage, MiddlewareResponse<Ctx>>[],
|
||||
config: BlitzNextAuthOptions<P>,
|
||||
internalRequest: RequestInternal,
|
||||
@@ -156,23 +170,34 @@ async function AuthHandler<P extends Provider[]>(
|
||||
if (!options.provider) {
|
||||
throw new OAuthError("MISSING_PROVIDER_ERROR")
|
||||
}
|
||||
if (action === "login") {
|
||||
middleware.push(async (req, res, next) => {
|
||||
if (action === "signin") {
|
||||
middleware.push(async (req, res, _next) => {
|
||||
try {
|
||||
const _signin = await getAuthorizationUrl({options: options, query: req.query})
|
||||
if (_signin.cookies) cookies.push(..._signin.cookies)
|
||||
const session = res.blitzCtx.session as SessionContext
|
||||
assert(session, "Missing Blitz sessionMiddleware!")
|
||||
await session.$setPublicData({
|
||||
[INTERNAL_REDIRECT_URL_KEY]: _signin.redirect,
|
||||
} as any)
|
||||
const response = toResponse(_signin)
|
||||
setHeaders(response.headers, res)
|
||||
res.setHeader("Location", _signin.redirect)
|
||||
res.statusCode = 302
|
||||
res.end()
|
||||
if (options.provider.type === "oauth" || options.provider.type === "oidc") {
|
||||
const _signin = await getAuthorizationUrl(req.query, options)
|
||||
log.debug("NEXT_AUTH_SIGNIN", _signin)
|
||||
if (_signin.cookies) cookies.push(..._signin.cookies)
|
||||
await res.blitzCtx.session.$setPublicData({
|
||||
[INTERNAL_REDIRECT_URL_KEY]: _signin.redirect,
|
||||
} as any)
|
||||
const response = toResponse(_signin)
|
||||
setHeaders(response.headers, res)
|
||||
log.debug("NEXT_AUTH_SIGNIN_REDIRECT", _signin.redirect)
|
||||
res.setHeader("Location", _signin.redirect)
|
||||
res.statusCode = 302
|
||||
res.end()
|
||||
} else if (options.provider.type === "email") {
|
||||
const normalizer = options.provider.normalizeIdentifier ?? defaultNormalizer
|
||||
const email = normalizer(internalRequest.body?.email)
|
||||
const redirect = await emailSignIn(email, options, internalRequest)
|
||||
res.setHeader("Location", redirect)
|
||||
res.statusCode = 302
|
||||
res.end()
|
||||
} else {
|
||||
throw new OAuthError("UNSUPPORTED_PROVIDER_ERROR")
|
||||
}
|
||||
} catch (e) {
|
||||
log.error("OAUTH_SIGNIN_Error in NextAuthAdapter " + (e as Error).toString())
|
||||
log.error("OAUTH_SIGNIN_Error in AuthAdapter " + (e as Error).toString())
|
||||
console.log(e)
|
||||
const authErrorQueryStringKey = config.errorRedirectUrl.includes("?")
|
||||
? "&authError="
|
||||
@@ -187,19 +212,27 @@ async function AuthHandler<P extends Provider[]>(
|
||||
return {middleware}
|
||||
} else if (action === "callback") {
|
||||
middleware.push(
|
||||
// eslint-disable-next-line no-shadow
|
||||
connectMiddleware(async (req, res, next) => {
|
||||
connectMiddleware(async (req, res, _next) => {
|
||||
try {
|
||||
const {profile, account, OAuthProfile} = await oAuthCallback({
|
||||
query: internalRequest.query,
|
||||
body: internalRequest.body || {code: req.query.code, state: req.query.state},
|
||||
method: "POST",
|
||||
options: options as any,
|
||||
cookies: internalRequest.cookies,
|
||||
})
|
||||
const session = res.blitzCtx.session as SessionContext
|
||||
assert(session, "Missing Blitz sessionMiddleware!")
|
||||
const callback = await config.callback(profile as User, account, OAuthProfile!, session)
|
||||
const {proxyRedirect, randomState} = handleState(
|
||||
req.query,
|
||||
options.provider,
|
||||
options.isOnRedirectProxy,
|
||||
)
|
||||
if (proxyRedirect) {
|
||||
log.debug("proxy redirect", {proxyRedirect, randomState})
|
||||
res.setHeader("Location", proxyRedirect)
|
||||
res.statusCode = 302
|
||||
res.end()
|
||||
}
|
||||
const {cookies, profile, account, user} = await handleOAuth(
|
||||
req.query,
|
||||
internalRequest.cookies,
|
||||
options,
|
||||
)
|
||||
log.debug("NEXT_AUTH_CALLBACK", {cookies, profile, account, user})
|
||||
const session = res.blitzCtx.session
|
||||
const callback = await config.callback(user, account, profile as any, session)
|
||||
let _redirect = config.successRedirectUrl
|
||||
if (callback instanceof Object) {
|
||||
_redirect = callback.redirectUrl
|
||||
@@ -208,13 +241,12 @@ async function AuthHandler<P extends Provider[]>(
|
||||
redirect: _redirect,
|
||||
cookies: cookies,
|
||||
})
|
||||
|
||||
setHeaders(response.headers, res)
|
||||
res.setHeader("Location", _redirect)
|
||||
res.statusCode = 302
|
||||
res.end()
|
||||
} catch (e) {
|
||||
log.error("OAUTH_CALLBACK_Error in NextAuthAdapter " + (e as Error).toString())
|
||||
log.error("OAUTH_CALLBACK_Error in AuthAdapter " + (e as Error).toString())
|
||||
console.log(e)
|
||||
const authErrorQueryStringKey = config.errorRedirectUrl.includes("?")
|
||||
? "&authError="
|
||||
@@ -0,0 +1,3 @@
|
||||
# Auth Core Internals for Blitz
|
||||
|
||||
This directory contains the internals of the Auth Core being used by the blitz adapter.
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {CallbacksOptions, CookiesOptions, EventCallbacks} from "next-auth"
|
||||
import type {Adapter} from "next-auth/adapters"
|
||||
import type {JWTOptions} from "next-auth/jwt"
|
||||
import type {AuthConfig} from "@auth/core"
|
||||
import {EventCallbacks, PagesOptions, CookiesOptions, CallbacksOptions} from "@auth/core/types"
|
||||
import type {Adapter} from "@auth/core/adapters"
|
||||
import type {JWTOptions} from "@auth/core/jwt"
|
||||
import type {
|
||||
OAuthConfig,
|
||||
ProviderType,
|
||||
@@ -9,7 +10,7 @@ import type {
|
||||
AuthorizationEndpointHandler,
|
||||
EmailConfig,
|
||||
CredentialsConfig,
|
||||
} from "next-auth/providers"
|
||||
} from "@auth/core/providers"
|
||||
|
||||
export interface OAuthConfigInternal<P>
|
||||
extends Omit<OAuthConfig<P>, "authorization" | "token" | "userinfo"> {
|
||||
@@ -33,7 +34,7 @@ export type AuthAction =
|
||||
| "providers"
|
||||
| "session"
|
||||
| "csrf"
|
||||
| "login"
|
||||
| "signin"
|
||||
| "signout"
|
||||
| "callback"
|
||||
| "verify-request"
|
||||
@@ -61,26 +62,40 @@ export interface LoggerInstance extends Record<string, Function> {
|
||||
debug: (code: string, metadata: unknown) => void
|
||||
}
|
||||
|
||||
export interface InternalOptions<
|
||||
TProviderType = ProviderType,
|
||||
WithVerificationToken = TProviderType extends "email" ? true : false,
|
||||
> {
|
||||
export interface RequestInternal {
|
||||
url: URL
|
||||
method: "GET" | "POST"
|
||||
cookies?: Partial<Record<string, string>>
|
||||
headers?: Record<string, any>
|
||||
query?: Record<string, any>
|
||||
body?: Record<string, any>
|
||||
action: AuthAction
|
||||
providerId?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface InternalOptions<TProviderType = ProviderType> {
|
||||
providers: InternalProvider[]
|
||||
url: URL
|
||||
action: AuthAction
|
||||
provider: InternalProvider<TProviderType>
|
||||
csrfToken?: string
|
||||
csrfTokenVerified?: boolean
|
||||
secret: string
|
||||
theme: Theme
|
||||
debug: boolean
|
||||
logger: LoggerInstance
|
||||
session: Required<LoggerInstance>
|
||||
pages: any
|
||||
session: NonNullable<Required<AuthConfig["session"]>>
|
||||
pages: Partial<PagesOptions>
|
||||
jwt: JWTOptions
|
||||
events: Partial<EventCallbacks>
|
||||
adapter: WithVerificationToken extends true
|
||||
? Adapter<WithVerificationToken>
|
||||
: Adapter<WithVerificationToken> | undefined
|
||||
adapter: Required<Adapter> | undefined
|
||||
callbacks: CallbacksOptions
|
||||
cookies: CookiesOptions
|
||||
callbackUrl: string
|
||||
/**
|
||||
* If true, the OAuth callback is being proxied by the server to the original URL.
|
||||
* See also {@link OAuthConfigInternal.redirectProxyUrl}.
|
||||
*/
|
||||
isOnRedirectProxy: boolean
|
||||
}
|
||||
@@ -1,19 +1,22 @@
|
||||
import type {Ctx, MiddlewareResponse} from "blitz"
|
||||
import type {IncomingMessage} from "http"
|
||||
import type {AuthOptions, Profile, User} from "next-auth"
|
||||
import {SessionContext} from "../../../index-server"
|
||||
import oAuthCallback from "next-auth/core/lib/oauth/callback"
|
||||
import {OAuthConfig, Provider} from "next-auth/providers"
|
||||
import type {Account, Profile, User} from "@auth/core/types"
|
||||
import type {AuthConfig} from "@auth/core"
|
||||
import type {SessionContext} from "../../index-server"
|
||||
import type {OAuthConfig} from "@auth/core/providers"
|
||||
|
||||
export type BlitzNextAuthOptions<P extends Provider[]> = Omit<AuthOptions, "providers"> & {
|
||||
export type BlitzNextAuthOptions<P extends OAuthConfig<any>[]> = Omit<AuthConfig, "providers"> & {
|
||||
providers: P
|
||||
successRedirectUrl: string
|
||||
errorRedirectUrl: string
|
||||
secureProxy?: boolean
|
||||
csrf?: {
|
||||
enabled: boolean
|
||||
}
|
||||
callback: (
|
||||
user: User,
|
||||
account: Awaited<ReturnType<typeof oAuthCallback>>["account"],
|
||||
profile: P[0] extends OAuthConfig<any> ? Parameters<P[0]["profile"]>[0] : Profile,
|
||||
user: User | undefined,
|
||||
account: Account | undefined,
|
||||
profile: P[number] extends OAuthConfig<infer T> ? T : Profile,
|
||||
session: SessionContext,
|
||||
) => Promise<void | {redirectUrl: string}>
|
||||
}
|
||||
1
packages/blitz-auth/src/adapters/index.ts
Normal file
1
packages/blitz-auth/src/adapters/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./passport/adapter"
|
||||
@@ -1,7 +1,7 @@
|
||||
/* @eslint-disable no-redeclare */
|
||||
import cookieSession from "cookie-session"
|
||||
import passport from "passport"
|
||||
import {isLocalhost} from "../../index"
|
||||
import {isLocalhost} from "../utils"
|
||||
import {
|
||||
assert,
|
||||
connectMiddleware,
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
secureProxyMiddleware,
|
||||
truncateString,
|
||||
} from "blitz"
|
||||
import {SessionContext} from "../../../shared"
|
||||
import type {SessionContext} from "../../shared"
|
||||
import {
|
||||
BlitzPassportConfig,
|
||||
ApiHandler,
|
||||
@@ -1,6 +1,6 @@
|
||||
import type {AuthenticateOptions, Strategy} from "passport"
|
||||
import type {IncomingMessage, ServerResponse} from "http"
|
||||
import type {PublicData} from "../../../shared"
|
||||
import type {PublicData} from "../../shared"
|
||||
import type {Ctx, MiddlewareResponse} from "blitz"
|
||||
|
||||
export interface BlitzPassportConfigCallbackParams {
|
||||
9
packages/blitz-auth/src/adapters/utils/index.ts
Normal file
9
packages/blitz-auth/src/adapters/utils/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export function isLocalhost(req: any): boolean {
|
||||
let {host} = req.headers
|
||||
let localhost = false
|
||||
if (host) {
|
||||
host = host.split(":")[0]
|
||||
localhost = host === "localhost"
|
||||
}
|
||||
return localhost
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./global"
|
||||
|
||||
export * from "./adapters"
|
||||
export * from "./index-browser"
|
||||
export * from "./server"
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from "./passport/adapter"
|
||||
export * from "./next-auth/webpack"
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from "./next-auth/adapter"
|
||||
export * from "./next-auth/types"
|
||||
@@ -1,3 +0,0 @@
|
||||
# Next-auth Internals
|
||||
|
||||
This directory contains the internals of the Next-auth being used by the blitz adapter.
|
||||
@@ -1,39 +0,0 @@
|
||||
export interface InternalUrl {
|
||||
/** @default "http://localhost:3000" */
|
||||
origin: string
|
||||
/** @default "localhost:3000" */
|
||||
host: string
|
||||
/** @default "/api/auth" */
|
||||
path: string
|
||||
/** @default "http://localhost:3000/api/auth" */
|
||||
base: string
|
||||
/** @default "http://localhost:3000/api/auth" */
|
||||
toString: () => string
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Can we remove this?
|
||||
* Returns an `URL` like object to make requests/redirects from server-side
|
||||
*/
|
||||
export default function parseUrl(url?: string | URL): InternalUrl {
|
||||
const defaultUrl = new URL("http://localhost:3000/api/auth")
|
||||
|
||||
if (url && !url.toString().startsWith("http")) {
|
||||
url = `https://${url}`
|
||||
}
|
||||
|
||||
const _url = new URL(url ?? defaultUrl)
|
||||
const path = (_url.pathname === "/" ? defaultUrl.pathname : _url.pathname)
|
||||
// Remove trailing slash
|
||||
.replace(/\/$/, "")
|
||||
|
||||
const base = `${_url.origin}${path}`
|
||||
|
||||
return {
|
||||
origin: _url.origin,
|
||||
host: _url.host,
|
||||
path,
|
||||
base,
|
||||
toString: () => base,
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
import {OAuthError} from "blitz"
|
||||
import {serialize, parse as parseCookie} from "cookie"
|
||||
import type {ResponseInternal, RequestInternal} from "next-auth/core"
|
||||
import type {AuthAction} from "next-auth/core/types"
|
||||
|
||||
const decoder = new TextDecoder()
|
||||
|
||||
async function streamToString(stream: any): Promise<string> {
|
||||
const chunks: Uint8Array[] = []
|
||||
return await new Promise((resolve, reject) => {
|
||||
stream.on("data", (chunk: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>) =>
|
||||
chunks.push(Buffer.from(chunk)),
|
||||
)
|
||||
stream.on("error", (err: any) => reject(err))
|
||||
stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")))
|
||||
})
|
||||
}
|
||||
|
||||
async function readJSONBody(
|
||||
body: ReadableStream | Buffer,
|
||||
): Promise<Record<string, any> | undefined> {
|
||||
try {
|
||||
if ("getReader" in body) {
|
||||
const reader = body.getReader()
|
||||
const bytes: number[] = []
|
||||
while (true) {
|
||||
const {value, done} = await reader.read()
|
||||
if (done) break
|
||||
bytes.push(...value)
|
||||
}
|
||||
const b = new Uint8Array(bytes)
|
||||
return JSON.parse(decoder.decode(b))
|
||||
}
|
||||
|
||||
// node-fetch
|
||||
|
||||
if (typeof Buffer !== "undefined" && Buffer.isBuffer(body)) {
|
||||
return JSON.parse(body.toString("utf8"))
|
||||
}
|
||||
|
||||
return JSON.parse(await streamToString(body))
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
const actions = [ "providers", "session", "csrf", "login", "signout", "callback", "verify-request", "error", "_log"]
|
||||
|
||||
export async function toInternalRequest(req: Request): Promise<RequestInternal | Error> {
|
||||
try {
|
||||
// TODO: url.toString() should not include action and providerId
|
||||
// see init.ts
|
||||
const url = new URL(req.url.replace(/\/$/, ""))
|
||||
const {pathname} = url
|
||||
|
||||
const action = actions.find((a) => pathname.includes(a)) as AuthAction | undefined
|
||||
if (!action) {
|
||||
throw new OAuthError("Cannot detect action.")
|
||||
}
|
||||
|
||||
const providerIdOrAction = pathname.split("/").pop()
|
||||
let providerId
|
||||
if (
|
||||
providerIdOrAction &&
|
||||
!action.includes(providerIdOrAction) &&
|
||||
["login", "callback"].includes(action)
|
||||
) {
|
||||
providerId = providerIdOrAction
|
||||
}
|
||||
|
||||
return {
|
||||
//@ts-ignore
|
||||
url,
|
||||
action,
|
||||
providerId,
|
||||
method: req.method ?? "GET",
|
||||
headers: Object.fromEntries(req.headers),
|
||||
body: req.body ? await readJSONBody(req.body) : undefined,
|
||||
cookies: parseCookie(req.headers.get("cookie") ?? "") ?? {},
|
||||
error: url.searchParams.get("error") ?? undefined,
|
||||
query: Object.fromEntries(url.searchParams),
|
||||
}
|
||||
} catch (error) {
|
||||
return error as Error
|
||||
}
|
||||
}
|
||||
|
||||
export function toResponse(res: ResponseInternal): Response {
|
||||
const headers = new Headers(res.headers as unknown as HeadersInit)
|
||||
|
||||
res.cookies?.forEach((cookie) => {
|
||||
const {name, value, options} = cookie
|
||||
const cookieHeader = serialize(name, value, options)
|
||||
if (headers.has("Set-Cookie")) {
|
||||
headers.append("Set-Cookie", cookieHeader)
|
||||
} else {
|
||||
headers.set("Set-Cookie", cookieHeader)
|
||||
}
|
||||
})
|
||||
|
||||
const body =
|
||||
headers.get("content-type") === "application/json" ? JSON.stringify(res.body) : res.body
|
||||
|
||||
const response = new Response(body, {
|
||||
headers,
|
||||
status: res.redirect ? 302 : res.status ?? 200,
|
||||
})
|
||||
|
||||
if (res.redirect) {
|
||||
response.headers.set("Location", res.redirect)
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
//@ts-nocheck
|
||||
import path from "path"
|
||||
|
||||
export function withNextAuthAdapter(nextConfig) {
|
||||
const config = Object.assign({}, nextConfig)
|
||||
try {
|
||||
const nextAuthPath = path.dirname(require.resolve("next-auth"))
|
||||
const webpack = (config) => {
|
||||
config.resolve.alias = {
|
||||
...config.resolve.alias,
|
||||
"next-auth/core/lib/oauth/callback": path.join(nextAuthPath, "core/lib/oauth/callback.js"),
|
||||
"next-auth/core/lib/oauth/authorization-url": path.join(
|
||||
nextAuthPath,
|
||||
"core/lib/oauth/authorization-url.js",
|
||||
),
|
||||
"next-auth/core/init": path.join(nextAuthPath, "core/init.js"),
|
||||
}
|
||||
return config
|
||||
}
|
||||
if (typeof nextConfig.webpack === "function") {
|
||||
config.webpack = (config, options) => {
|
||||
return nextConfig.webpack(webpack(config), options)
|
||||
}
|
||||
}
|
||||
config.webpack = webpack
|
||||
return config
|
||||
} catch (e) {
|
||||
return config
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ interface PrismaClientWithSession {
|
||||
}): Promise<SessionModel>
|
||||
update(args: {
|
||||
data: Partial<SessionModel>
|
||||
where: {handle?: SessionModel["handle"]}
|
||||
where: {handle: SessionModel["handle"]}
|
||||
}): Promise<SessionModel>
|
||||
delete(args: {where: {handle?: SessionModel["handle"]}}): Promise<SessionModel>
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
log,
|
||||
baseLogger,
|
||||
chalk,
|
||||
AuthenticatedCtx,
|
||||
} from "blitz"
|
||||
import {
|
||||
EmptyPublicData,
|
||||
@@ -189,7 +190,7 @@ export async function getBlitzContext(): Promise<Ctx> {
|
||||
const req = new IncomingMessage(new Socket()) as IncomingMessage & {
|
||||
cookies: {[key: string]: string}
|
||||
}
|
||||
req.headers = Object.fromEntries(headers())
|
||||
req.headers = Object.fromEntries(headers() as any)
|
||||
const csrfToken = cookies().get(COOKIE_CSRF_TOKEN())
|
||||
if (csrfToken) {
|
||||
req.headers[HEADER_CSRF] = csrfToken.value
|
||||
@@ -219,7 +220,7 @@ export async function useAuthenticatedBlitzContext({
|
||||
redirectTo?: string | RouteUrlObject
|
||||
redirectAuthenticatedTo?: string | RouteUrlObject | ((ctx: Ctx) => string | RouteUrlObject)
|
||||
role?: string | string[]
|
||||
}): Promise<void> {
|
||||
}): Promise<AuthenticatedCtx> {
|
||||
const log = baseLogger().getSubLogger({name: "useAuthenticatedBlitzContext"})
|
||||
const customChalk = new chalk.Instance({
|
||||
level: log.settings.type === "json" ? 0 : chalk.level,
|
||||
@@ -268,6 +269,7 @@ export async function useAuthenticatedBlitzContext({
|
||||
redirect(redirectTo)
|
||||
}
|
||||
}
|
||||
return ctx as AuthenticatedCtx
|
||||
}
|
||||
|
||||
const makeProxyToPublicData = <T extends SessionContextClass>(ctxClass: T): T => {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
export * from "./auth-utils"
|
||||
export * from "./auth-plugin"
|
||||
export * from "./adapters"
|
||||
|
||||
export {
|
||||
SessionContextClass,
|
||||
getAllSessionHandlesForUser,
|
||||
|
||||
@@ -82,7 +82,7 @@ declare module "blitz" {
|
||||
export interface Ctx {
|
||||
session: SessionContext
|
||||
}
|
||||
export interface AuthenticatedMiddlewareCtx extends Omit<Ctx, "session"> {
|
||||
export interface AuthenticatedCtx extends Omit<Ctx, "session"> {
|
||||
session: AuthenticatedSessionContext
|
||||
}
|
||||
}
|
||||
|
||||
11
packages/blitz-auth/turbo.json
Normal file
11
packages/blitz-auth/turbo.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"extends": ["//"],
|
||||
"pipeline": {
|
||||
"dev": {
|
||||
"dependsOn": ["blitz#build"],
|
||||
"persistent": true,
|
||||
"cache": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,14 @@
|
||||
# @blitzjs/next
|
||||
|
||||
## 2.0.0-beta.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [90f1741da]
|
||||
- Updated dependencies [df3265b85]
|
||||
- blitz@2.0.0-beta.31
|
||||
- @blitzjs/rpc@2.0.0-beta.31
|
||||
|
||||
## 2.0.0-beta.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/next",
|
||||
"version": "2.0.0-beta.30",
|
||||
"version": "2.0.0-beta.31",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -29,7 +29,7 @@
|
||||
"eslint.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blitzjs/rpc": "2.0.0-beta.30",
|
||||
"@blitzjs/rpc": "2.0.0-beta.31",
|
||||
"@types/hoist-non-react-statics": "3.3.1",
|
||||
"debug": "4.3.3",
|
||||
"fs-extra": "10.0.1",
|
||||
@@ -38,13 +38,13 @@
|
||||
"supports-color": "8.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"blitz": "2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "*",
|
||||
"react": "*",
|
||||
"tslog": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@testing-library/dom": "8.13.0",
|
||||
"@testing-library/jest-dom": "5.16.3",
|
||||
"@testing-library/react": "13.4.0",
|
||||
@@ -55,7 +55,7 @@
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"@types/testing-library__react-hooks": "4.0.0",
|
||||
"blitz": "2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"cross-spawn": "7.0.3",
|
||||
"find-up": "4.1.0",
|
||||
"next": "13.3.0",
|
||||
@@ -64,7 +64,7 @@
|
||||
"react-dom": "18.2.0",
|
||||
"resolve-from": "5.0.0",
|
||||
"ts-jest": "27.1.4",
|
||||
"tslog": "4.8.2",
|
||||
"tslog": "4.9.0",
|
||||
"typescript": "^4.8.4",
|
||||
"unbuild": "0.7.6",
|
||||
"watch": "1.0.2"
|
||||
|
||||
11
packages/blitz-next/turbo.json
Normal file
11
packages/blitz-next/turbo.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"extends": ["//"],
|
||||
"pipeline": {
|
||||
"dev": {
|
||||
"dependsOn": ["@blitzjs/rpc#build", "blitz#build"],
|
||||
"persistent": true,
|
||||
"cache": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,13 @@
|
||||
# @blitzjs/rpc
|
||||
|
||||
## 2.0.0-beta.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [90f1741da]
|
||||
- Updated dependencies [df3265b85]
|
||||
- blitz@2.0.0-beta.31
|
||||
|
||||
## 2.0.0-beta.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/rpc",
|
||||
"version": "2.0.0-beta.30",
|
||||
"version": "2.0.0-beta.31",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -37,18 +37,18 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tanstack/query-core": "4.24.4",
|
||||
"blitz": "2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "*",
|
||||
"react": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.30",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/auth": "2.0.0-beta.31",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@tanstack/query-core": "4.24.4",
|
||||
"@types/debug": "4.1.7",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"blitz": "2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"next": "13.3.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type {SessionContext, SessionContextBase} from "@blitzjs/auth"
|
||||
import {Await, Ctx, EnsurePromise, AuthenticatedMiddlewareCtx} from "blitz"
|
||||
import {Await, Ctx, EnsurePromise, AuthenticatedCtx} from "blitz"
|
||||
import type {input as zInput, output as zOutput, ZodTypeAny} from "zod"
|
||||
|
||||
export type ParserType = "sync" | "async"
|
||||
@@ -271,7 +271,7 @@ interface ResolverAuthorize {
|
||||
<T, C = Ctx>(...args: Parameters<SessionContextBase["$authorize"]>): (
|
||||
input: T,
|
||||
ctx: C,
|
||||
) => ResultWithContext<T, AuthenticatedMiddlewareCtx>
|
||||
) => ResultWithContext<T, AuthenticatedCtx>
|
||||
}
|
||||
|
||||
const authorize: ResolverAuthorize = (...args) => {
|
||||
|
||||
11
packages/blitz-rpc/turbo.json
Normal file
11
packages/blitz-rpc/turbo.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"extends": ["//"],
|
||||
"pipeline": {
|
||||
"dev": {
|
||||
"dependsOn": ["@blitzjs/auth#build", "blitz#build"],
|
||||
"persistent": true,
|
||||
"cache": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,16 @@
|
||||
# blitz
|
||||
|
||||
## 2.0.0-beta.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 90f1741da: blitz-auth: Support for Prisma v5
|
||||
|
||||
Internal: Make `handle` a required paramter while updating the `session` modal.
|
||||
|
||||
- df3265b85: blitz-rpc: Cleanup Event Listeners - Fix potential memory leak by cleaning up any residual event listeners set by blitz.
|
||||
- @blitzjs/generator@2.0.0-beta.31
|
||||
|
||||
## 2.0.0-beta.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blitz",
|
||||
"version": "2.0.0-beta.30",
|
||||
"version": "2.0.0-beta.31",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -30,7 +30,7 @@
|
||||
"blitz": "bin/blitz"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/generator": "2.0.0-beta.30",
|
||||
"@blitzjs/generator": "2.0.0-beta.31",
|
||||
"@mrleebo/prisma-ast": "0.2.6",
|
||||
"@types/global-agent": "2.1.1",
|
||||
"arg": "5.0.1",
|
||||
@@ -76,11 +76,11 @@
|
||||
"tar": "6.1.11",
|
||||
"ts-node": "10.9.1",
|
||||
"tsconfig-paths": "4.0.0",
|
||||
"tslog": "4.8.2",
|
||||
"tslog": "4.9.0",
|
||||
"watchpack": "2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@types/cookie": "0.4.1",
|
||||
"@types/cross-spawn": "6.0.2",
|
||||
"@types/debug": "4.1.7",
|
||||
|
||||
@@ -5,4 +5,5 @@ declare global {
|
||||
beforeHttpRequest: BeforeHttpRequest
|
||||
beforeHttpResponse: BeforeHttpResponse
|
||||
}
|
||||
var __BLITZ_CLEAN_UP_LISTENERS: () => void
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ILogObj, ISettingsParam, Logger, IMeta} from "tslog"
|
||||
import {ILogObj, ISettingsParam, Logger} from "tslog"
|
||||
import c from "chalk"
|
||||
import {Table} from "console-table-printer"
|
||||
import ora from "ora"
|
||||
|
||||
@@ -89,13 +89,23 @@ export function reduceBlitzClientPlugins<TPlugins extends readonly ClientPlugin<
|
||||
globalThis.__BLITZ_MIDDLEWARE_HOOKS = middleware
|
||||
|
||||
if (isClient) {
|
||||
document.addEventListener("blitz:session-created", async () => {
|
||||
if (globalThis.__BLITZ_CLEAN_UP_LISTENERS) {
|
||||
globalThis.__BLITZ_CLEAN_UP_LISTENERS()
|
||||
}
|
||||
const onSessionCreated = async () => {
|
||||
await Promise.all(events.onSessionCreated())
|
||||
})
|
||||
document.addEventListener("blitz:rpc-error", async (e) => {
|
||||
}
|
||||
const onRpcError = async (e: Event): Promise<void> => {
|
||||
const customEvent = e as CustomEvent<Error>
|
||||
await Promise.all(events.onRpcError(customEvent.detail))
|
||||
})
|
||||
}
|
||||
document.addEventListener("blitz:session-created", onSessionCreated)
|
||||
document.addEventListener("blitz:rpc-error", onRpcError)
|
||||
|
||||
globalThis.__BLITZ_CLEAN_UP_LISTENERS = () => {
|
||||
document.removeEventListener("blitz:session-created", onSessionCreated)
|
||||
document.removeEventListener("blitz:rpc-error", onRpcError)
|
||||
}
|
||||
}
|
||||
|
||||
const withPlugins = compose(...providers)
|
||||
|
||||
@@ -2,7 +2,7 @@ import {UrlObject} from "url"
|
||||
// Context for plugins to declaration merge stuff into
|
||||
export interface Ctx {}
|
||||
|
||||
export interface AuthenticatedMiddlewareCtx {}
|
||||
export interface AuthenticatedCtx {}
|
||||
|
||||
export type CodegenField = {
|
||||
component: string
|
||||
@@ -17,7 +17,7 @@ export interface RouteUrlObject extends Pick<UrlObject, "pathname" | "query" | "
|
||||
href: string
|
||||
}
|
||||
|
||||
export interface AuthenticatedMiddlewareCtx {}
|
||||
export interface AuthenticatedCtx {}
|
||||
|
||||
export type EventHooks = {
|
||||
onSessionCreated?: OnSessionCreated
|
||||
|
||||
11
packages/blitz/turbo.json
Normal file
11
packages/blitz/turbo.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"extends": ["//"],
|
||||
"pipeline": {
|
||||
"dev": {
|
||||
"dependsOn": ["@blitzjs/generator#build"],
|
||||
"persistent": true,
|
||||
"cache": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,14 @@
|
||||
# @blitzjs/codemod
|
||||
|
||||
## 2.0.0-beta.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [90f1741da]
|
||||
- Updated dependencies [df3265b85]
|
||||
- blitz@2.0.0-beta.31
|
||||
- @blitzjs/generator@2.0.0-beta.31
|
||||
|
||||
## 2.0.0-beta.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/codemod",
|
||||
"version": "2.0.0-beta.30",
|
||||
"version": "2.0.0-beta.31",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "watch unbuild src --wait=0.2",
|
||||
@@ -25,9 +25,9 @@
|
||||
"@babel/plugin-proposal-class-properties": "7.17.12",
|
||||
"@babel/plugin-syntax-jsx": "7.17.12",
|
||||
"@babel/plugin-syntax-typescript": "7.17.12",
|
||||
"@blitzjs/generator": "2.0.0-beta.30",
|
||||
"@blitzjs/generator": "2.0.0-beta.31",
|
||||
"arg": "5.0.1",
|
||||
"blitz": "2.0.0-beta.30",
|
||||
"blitz": "2.0.0-beta.31",
|
||||
"chalk": "^4.1.0",
|
||||
"cross-spawn": "7.0.3",
|
||||
"debug": "4.3.3",
|
||||
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "7.12.10",
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@types/jscodeshift": "0.11.2",
|
||||
"@types/node": "18.11.9",
|
||||
"ast-types": "0.14.2",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# @blitzjs/config
|
||||
|
||||
## 2.0.0-beta.31
|
||||
|
||||
## 2.0.0-beta.30
|
||||
|
||||
## 2.0.0-beta.29
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@blitzjs/config",
|
||||
"private": true,
|
||||
"version": "2.0.0-beta.30",
|
||||
"version": "2.0.0-beta.31",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "5.42.1",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# @blitzjs/generator
|
||||
|
||||
## 2.0.0-beta.31
|
||||
|
||||
## 2.0.0-beta.30
|
||||
|
||||
## 2.0.0-beta.29
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/generator",
|
||||
"version": "2.0.0-beta.30",
|
||||
"version": "2.0.0-beta.31",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -48,13 +48,13 @@
|
||||
"prettier": "^2.7.1",
|
||||
"recast": "0.20.5",
|
||||
"supports-color": "8.1.1",
|
||||
"tslog": "4.8.2",
|
||||
"tslog": "4.9.0",
|
||||
"username": "5.1.0",
|
||||
"vinyl": "2.2.1",
|
||||
"zod": "3.20.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@juanm04/cpx": "2.0.1",
|
||||
"@types/babel__core": "7.1.19",
|
||||
"@types/diff": "5.0.2",
|
||||
|
||||
@@ -95,7 +95,7 @@ const Home: BlitzPage = () => {
|
||||
<div className={styles.code}>
|
||||
<span>1</span>
|
||||
<pre>
|
||||
<code>blitz generate all project</code>
|
||||
<code>blitz generate all project name:string</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@typescript-eslint/parser": "5.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.30",
|
||||
"@blitzjs/config": "2.0.0-beta.31",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"react": "18.2.0",
|
||||
|
||||
39
patches/@auth__core@0.10.0.patch
Normal file
39
patches/@auth__core@0.10.0.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
diff --git a/package.json b/package.json
|
||||
index dbd1f7f8e24dd70d74bb1bd5ad7bb1a244919ead..72b04f35527ec98dba059ba9e03eb35c08a27c1c 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -57,6 +57,34 @@
|
||||
},
|
||||
"./types": {
|
||||
"types": "./types.d.ts"
|
||||
+ },
|
||||
+ "./lib/init": {
|
||||
+ "types": "./lib/init.d.ts",
|
||||
+ "import": "./lib/init.js"
|
||||
+ },
|
||||
+ "./lib/email/signin":{
|
||||
+ "types": "./lib/email/signin.d.ts",
|
||||
+ "import": "./lib/email/signin.js"
|
||||
+ },
|
||||
+ "./lib/oauth/authorization-url": {
|
||||
+ "types": "./lib/oauth/authorization-url.d.ts",
|
||||
+ "import": "./lib/oauth/authorization-url.js"
|
||||
+ },
|
||||
+ "./lib/oauth/callback": {
|
||||
+ "types": "./lib/oauth/callback.d.ts",
|
||||
+ "import": "./lib/oauth/callback.js"
|
||||
+ },
|
||||
+ "./lib/oauth/handle-state": {
|
||||
+ "types": "./lib/oauth/handle-state.d.ts",
|
||||
+ "import": "./lib/oauth/handle-state.js"
|
||||
+ },
|
||||
+ "./lib/assert": {
|
||||
+ "types": "./lib/assert.d.ts",
|
||||
+ "import": "./lib/assert.js"
|
||||
+ },
|
||||
+ "./lib/web": {
|
||||
+ "types": "./lib/web.d.ts",
|
||||
+ "import": "./lib/web.js"
|
||||
}
|
||||
},
|
||||
"license": "ISC",
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user