Compare commits
10 Commits
@blitzjs/a
...
@blitzjs/c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb232d126e | ||
|
|
b97366c427 | ||
|
|
11eeebee67 | ||
|
|
c89cb943bb | ||
|
|
3bcbad1a91 | ||
|
|
98d04ed613 | ||
|
|
cee2dec179 | ||
|
|
aec1bb076b | ||
|
|
2c72af7175 | ||
|
|
465a5c0720 |
@@ -3985,6 +3985,25 @@
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Zamfi99",
|
||||
"name": "Zamfira Costin-Andrei",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/19189337?v=4",
|
||||
"profile": "https://github.com/Zamfi99",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "potikhanovsergey",
|
||||
"name": "Sergey",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/71494201?v=4",
|
||||
"profile": "https://github.com/potikhanovsergey",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
6
.changeset/afraid-ligers-build.md
Normal file
6
.changeset/afraid-ligers-build.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@blitzjs/auth": patch
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fix bug that did not allow `Page.authenicate = {role: "" }` to correctly work
|
||||
6
.changeset/chatty-scissors-jump.md
Normal file
6
.changeset/chatty-scissors-jump.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
blitz-next: Fix `next/head` used in app directory warning
|
||||
5
.changeset/green-years-behave.md
Normal file
5
.changeset/green-years-behave.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Upgrade next, prisma and zod to latest versions in a newly created app
|
||||
13
.changeset/modern-insects-raise.md
Normal file
13
.changeset/modern-insects-raise.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
"@blitzjs/auth": patch
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Remove unintended dependency on next-auth by removing it from the core build of @blitzjs/auth
|
||||
|
||||
⚠️ Breaking Change for current users of `withNextAuthAdapter`
|
||||
|
||||
Update your import in `next.config.js` in the following way
|
||||
```diff
|
||||
-const { withNextAuthAdapter } = require("@blitzjs/auth")
|
||||
+const { withNextAuthAdapter } = require("@blitzjs/auth/next-auth")
|
||||
9
.changeset/moody-pandas-do.md
Normal file
9
.changeset/moody-pandas-do.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
"@blitzjs/auth": patch
|
||||
"@blitzjs/rpc": patch
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
- Introduce Blitz RPC's logging system to the `invoke` function which is the recommended way to call resolvers in nextjs `app` directory's react server components.
|
||||
|
||||
- This refactor also removes the re-introduced dependency between `blitz-auth` and `blitz-rpc`, allowing independent usage of `blitz-rpc`
|
||||
5
.changeset/neat-gorillas-switch.md
Normal file
5
.changeset/neat-gorillas-switch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/recipe-tailwind": patch
|
||||
---
|
||||
|
||||
Change tailwind recipe to install dependencies as devDependencies
|
||||
@@ -53,6 +53,7 @@
|
||||
"changesets": [
|
||||
"afraid-dancers-juggle",
|
||||
"afraid-ears-repair",
|
||||
"afraid-ligers-build",
|
||||
"big-boats-lay",
|
||||
"big-phones-bow",
|
||||
"big-turtles-tease",
|
||||
@@ -72,6 +73,7 @@
|
||||
"calm-tomatoes-drive",
|
||||
"chatty-fireants-leave",
|
||||
"chatty-gifts-whisper",
|
||||
"chatty-scissors-jump",
|
||||
"chilled-carrots-own",
|
||||
"chilly-candles-care",
|
||||
"chilly-jeans-fix",
|
||||
@@ -149,6 +151,7 @@
|
||||
"great-terms-rescue",
|
||||
"green-papayas-do",
|
||||
"green-pillows-hammer",
|
||||
"green-years-behave",
|
||||
"happy-bees-lick",
|
||||
"happy-hotels-visit",
|
||||
"happy-paws-join",
|
||||
@@ -196,12 +199,15 @@
|
||||
"mean-gorillas-reply",
|
||||
"modern-cameras-pull",
|
||||
"modern-games-dream",
|
||||
"modern-insects-raise",
|
||||
"modern-ligers-behave",
|
||||
"moody-bags-walk",
|
||||
"moody-crews-travel",
|
||||
"moody-pandas-do",
|
||||
"moody-spoons-rhyme",
|
||||
"moody-squids-cheer",
|
||||
"nasty-suns-wash",
|
||||
"neat-gorillas-switch",
|
||||
"nervous-beds-travel",
|
||||
"nervous-dolls-rule",
|
||||
"nervous-shrimps-serve",
|
||||
@@ -240,6 +246,7 @@
|
||||
"poor-walls-relax",
|
||||
"popular-teachers-pay",
|
||||
"pretty-games-march",
|
||||
"pretty-snakes-search",
|
||||
"purple-donkeys-smash",
|
||||
"purple-jars-begin",
|
||||
"purple-singers-greet",
|
||||
|
||||
5
.changeset/pretty-snakes-search.md
Normal file
5
.changeset/pretty-snakes-search.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/recipe-next-ui": patch
|
||||
---
|
||||
|
||||
Add `framer-motion` as a dependency of `next-ui`
|
||||
@@ -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-420-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-422-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">
|
||||
@@ -743,6 +743,10 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
|
||||
<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>
|
||||
<td align="center"><a href="https://github.com/rodobre"><img src="https://avatars.githubusercontent.com/u/52138375?v=4?s=100" width="100px;" alt=""/><br /><sub><b>rodobre</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=rodobre" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=rodobre" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/Zamfi99"><img src="https://avatars.githubusercontent.com/u/19189337?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Zamfira Costin-Andrei</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=Zamfi99" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=Zamfi99" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/potikhanovsergey"><img src="https://avatars.githubusercontent.com/u/71494201?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sergey</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=potikhanovsergey" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# next-blitz-auth
|
||||
|
||||
## 0.1.1-beta.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cee2dec17]
|
||||
- Updated dependencies [aec1bb076]
|
||||
- Updated dependencies [b97366c42]
|
||||
- Updated dependencies [3bcbad1a9]
|
||||
- @blitzjs/auth@2.0.0-beta.35
|
||||
- blitz@2.0.0-beta.35
|
||||
- @blitzjs/next@2.0.0-beta.35
|
||||
- @blitzjs/rpc@2.0.0-beta.35
|
||||
- @blitzjs/config@2.0.0-beta.35
|
||||
|
||||
## 0.1.1-beta.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {useAuthenticatedBlitzContext} from "@blitzjs/auth"
|
||||
import {useAuthenticatedBlitzContext} from "../../src/blitz-server"
|
||||
|
||||
export default async function RootLayout({children}: {children: React.ReactNode}) {
|
||||
await useAuthenticatedBlitzContext({
|
||||
|
||||
@@ -9,7 +9,6 @@ export default async function Home() {
|
||||
redirectTo: "/auth/login",
|
||||
})
|
||||
const user = await invoke(getCurrentUser, null)
|
||||
console.log("user", user)
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "next-blitz-auth",
|
||||
"version": "0.1.1-beta.10",
|
||||
"version": "0.1.1-beta.11",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"blitz:dev": "next dev",
|
||||
@@ -9,15 +9,15 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@hookform/error-message": "2.0.0",
|
||||
"@hookform/resolvers": "2.9.10",
|
||||
"@prisma/client": "^4.5.0",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"flatted": "3.2.7",
|
||||
"next": "13.5.2",
|
||||
"prisma": "^4.5.0",
|
||||
|
||||
@@ -13,7 +13,14 @@ const {api, getBlitzContext, useAuthenticatedBlitzContext, invoke} = setupBlitzS
|
||||
storage: PrismaStorage(db),
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
RpcServerPlugin({}),
|
||||
RpcServerPlugin({
|
||||
logging: {
|
||||
disablelevel: "debug",
|
||||
},
|
||||
onInvokeError(error) {
|
||||
console.log("onInvokeError", error)
|
||||
},
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@hookform/error-message": "2.0.0",
|
||||
"@hookform/resolvers": "2.9.10",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "13.5.2",
|
||||
"openid-client": "5.2.1",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { withNextAuthAdapter } = require("@blitzjs/auth")
|
||||
const { withNextAuthAdapter } = require("@blitzjs/auth/next-auth")
|
||||
const { withBlitz } = require("@blitzjs/next")
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@hookform/error-message": "2.0.0",
|
||||
"@hookform/resolvers": "2.9.10",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "13.5.2",
|
||||
"next-auth": "4.18.7",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -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 { NextAuthAdapter } from "@blitzjs/auth/next-auth"
|
||||
import db, { User } from "db"
|
||||
import { Role } from "types"
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
"schema": "./db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@prisma/client": "4.6.1",
|
||||
"@types/jest": "29.2.2",
|
||||
"@types/passport-twitter": "1.0.37",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jest": "29.3.0",
|
||||
"jest-environment-jsdom": "29.3.0",
|
||||
"next": "13.5.2",
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@hookform/error-message": "2.0.0",
|
||||
"@hookform/resolvers": "2.9.10",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"delay": "5.0.0",
|
||||
"next": "13.5.2",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {Ctx} from "blitz"
|
||||
import db from "../../db"
|
||||
|
||||
const getRand = () => Math.random().toString(36).substring(7)
|
||||
|
||||
export default async function login(_: any, ctx: Ctx) {
|
||||
await ctx.session.$create({userId: 1, role: "USER"})
|
||||
const user = await db.user.create({data: {email: `${getRand()}@example.com`}})
|
||||
await ctx.session.$create({userId: user.id, role: "USER"})
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import {useMutation, useQuery} from "@blitzjs/rpc"
|
||||
import {BlitzPage} from "@blitzjs/next"
|
||||
import logout from "../mutations/logout"
|
||||
import getAuthenticatedBasic from "../queries/getAuthenticatedBasic"
|
||||
import {Suspense} from "react"
|
||||
|
||||
function Content() {
|
||||
const [result] = useQuery(getAuthenticatedBasic, undefined)
|
||||
const [logoutMutation] = useMutation(logout)
|
||||
return (
|
||||
<div>
|
||||
<div id="content">{result}</div>
|
||||
<button
|
||||
id="logout"
|
||||
onClick={async () => {
|
||||
await logoutMutation()
|
||||
}}
|
||||
>
|
||||
logout
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const Authenticate: BlitzPage = () => {
|
||||
return (
|
||||
<div id="page">
|
||||
<Suspense fallback={"Loading..."}>
|
||||
<Content />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Authenticate.authenticate = {role: "USER", redirectTo: "/noauth-query"}
|
||||
|
||||
export default Authenticate
|
||||
@@ -0,0 +1,37 @@
|
||||
import {useMutation, useQuery} from "@blitzjs/rpc"
|
||||
import {BlitzPage} from "@blitzjs/next"
|
||||
import logout from "../mutations/logout"
|
||||
import getAuthenticatedBasic from "../queries/getAuthenticatedBasic"
|
||||
import {Suspense} from "react"
|
||||
|
||||
function Content() {
|
||||
const [result] = useQuery(getAuthenticatedBasic, undefined)
|
||||
const [logoutMutation] = useMutation(logout)
|
||||
return (
|
||||
<div>
|
||||
<div id="content">{result}</div>
|
||||
<button
|
||||
id="logout"
|
||||
onClick={async () => {
|
||||
await logoutMutation()
|
||||
}}
|
||||
>
|
||||
logout
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const Authenticate: BlitzPage = () => {
|
||||
return (
|
||||
<div id="page">
|
||||
<Suspense fallback={"Loading..."}>
|
||||
<Content />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Authenticate.authenticate = {role: "ADMIN", redirectTo: "/noauth-query"}
|
||||
|
||||
export default Authenticate
|
||||
@@ -0,0 +1,37 @@
|
||||
import {useMutation, useQuery} from "@blitzjs/rpc"
|
||||
import {BlitzPage} from "@blitzjs/next"
|
||||
import logout from "../mutations/logout"
|
||||
import getAuthenticatedBasic from "../queries/getAuthenticatedBasic"
|
||||
import {Suspense} from "react"
|
||||
|
||||
function Content() {
|
||||
const [result] = useQuery(getAuthenticatedBasic, undefined)
|
||||
const [logoutMutation] = useMutation(logout)
|
||||
return (
|
||||
<div>
|
||||
<div id="content">{result}</div>
|
||||
<button
|
||||
id="logout"
|
||||
onClick={async () => {
|
||||
await logoutMutation()
|
||||
}}
|
||||
>
|
||||
logout
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const Authenticate: BlitzPage = () => {
|
||||
return (
|
||||
<div id="page">
|
||||
<Suspense fallback={"Loading..."}>
|
||||
<Content />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Authenticate.authenticate = {role: "USER"}
|
||||
|
||||
export default Authenticate
|
||||
@@ -0,0 +1,37 @@
|
||||
import {useMutation, useQuery} from "@blitzjs/rpc"
|
||||
import {BlitzPage} from "@blitzjs/next"
|
||||
import logout from "../mutations/logout"
|
||||
import getAuthenticatedBasic from "../queries/getAuthenticatedBasic"
|
||||
import {Suspense} from "react"
|
||||
|
||||
function Content() {
|
||||
const [result] = useQuery(getAuthenticatedBasic, undefined)
|
||||
const [logoutMutation] = useMutation(logout)
|
||||
return (
|
||||
<div>
|
||||
<div id="content">{result}</div>
|
||||
<button
|
||||
id="logout"
|
||||
onClick={async () => {
|
||||
await logoutMutation()
|
||||
}}
|
||||
>
|
||||
logout
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const Authenticate: BlitzPage = () => {
|
||||
return (
|
||||
<div id="page">
|
||||
<Suspense fallback={"Loading..."}>
|
||||
<Content />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Authenticate.authenticate = {role: "ADMIN"}
|
||||
|
||||
export default Authenticate
|
||||
@@ -47,6 +47,14 @@ const runTests = () => {
|
||||
if (browser) await browser.close()
|
||||
})
|
||||
|
||||
it("Page.authenticate = {role} should work ", async () => {
|
||||
const browser = await webdriver(appPort, "/page-dot-authenticate-role")
|
||||
await browser.waitForElementByCss("#error")
|
||||
let text = await browser.elementByCss("#error").text()
|
||||
expect(text).toMatch(/AuthenticationError/)
|
||||
if (browser) await browser.close()
|
||||
})
|
||||
|
||||
it("should render error for protected layout", async () => {
|
||||
const browser = await webdriver(appPort, "/layout-authenticate")
|
||||
await browser.waitForElementByCss("#error")
|
||||
@@ -105,14 +113,28 @@ const runTests = () => {
|
||||
if (browser) await browser.close()
|
||||
})
|
||||
|
||||
it("Page.authenticate = {redirect} should work ", async () => {
|
||||
// Login
|
||||
it("Page.authenticate = {role} should throw authentication error ", async () => {
|
||||
let browser = await webdriver(appPort, "/login")
|
||||
await waitFor(200)
|
||||
await browser.elementByCss("#login").click()
|
||||
await waitFor(200)
|
||||
await browser.eval(`window.location = "/page-dot-authenticate-role"`)
|
||||
await browser.waitForElementByCss("#error")
|
||||
let text = await browser.elementByCss("#error").text()
|
||||
expect(text).toMatch(/AuthenticationError/)
|
||||
if (browser) await browser.close()
|
||||
})
|
||||
|
||||
await browser.eval(`window.location = "/page-dot-authenticate-redirect"`)
|
||||
it("Page.authenticate = {role: 'custom'} should work ", async () => {
|
||||
let browser = await webdriver(appPort, "/page-dot-authenticate-role-working")
|
||||
await browser.waitForElementByCss("#content")
|
||||
let text = await browser.elementByCss("#content").text()
|
||||
expect(text).toMatch(/authenticated-basic-result/)
|
||||
if (browser) await browser.close()
|
||||
})
|
||||
|
||||
it("Page.authenticate = {redirect} should work ", async () => {
|
||||
let browser = await webdriver(appPort, "/page-dot-authenticate-redirect")
|
||||
await browser.waitForElementByCss("#content")
|
||||
let text = await browser.elementByCss("#content").text()
|
||||
expect(text).toMatch(/authenticated-basic-result/)
|
||||
@@ -123,14 +145,26 @@ const runTests = () => {
|
||||
if (browser) await browser.close()
|
||||
})
|
||||
|
||||
it("Layout.authenticate = {redirect} should work ", async () => {
|
||||
// Login
|
||||
it("Page.authenticate = {role: 'custom', redirect: 'url'} should work ", async () => {
|
||||
let browser = await webdriver(appPort, "/login")
|
||||
await waitFor(200)
|
||||
await browser.elementByCss("#login").click()
|
||||
await waitFor(200)
|
||||
await browser.eval(`window.location = "/page-dot-authenticate-role-redirect"`)
|
||||
await browser.waitForElementByCss("#content")
|
||||
expect(await browser.url()).toMatch(/\/noauth-query/)
|
||||
if (browser) await browser.close()
|
||||
})
|
||||
|
||||
await browser.eval(`window.location = "/layout-authenticate-redirect"`)
|
||||
it("Page.authenticate = {role: 'custom', redirect: 'url'} should stay ", async () => {
|
||||
let browser = await webdriver(appPort, "/page-dot-authenticate-role-redirect-stay")
|
||||
await browser.waitForElementByCss("#content")
|
||||
expect(await browser.url()).toMatch(/\/page-dot-authenticate-role-redirect-stay/)
|
||||
if (browser) await browser.close()
|
||||
})
|
||||
|
||||
it("Layout.authenticate = {redirect} should work ", async () => {
|
||||
let browser = await webdriver(appPort, "/layout-authenticate-redirect")
|
||||
await browser.waitForElementByCss("#content")
|
||||
let text = await browser.elementByCss("#content").text()
|
||||
expect(text).toMatch(/authenticated-basic-result/)
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.5.2",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
"schema": "db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.5.2",
|
||||
"prisma": "4.6.1",
|
||||
@@ -28,7 +28,7 @@
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "13.5.2",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.5.2",
|
||||
"prisma": "4.6.1",
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
"prisma:studio": "prisma studio"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.5.2",
|
||||
"prisma": "4.6.1",
|
||||
@@ -28,7 +28,7 @@
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@prisma/client": "4.6.1",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "13.5.2",
|
||||
"prisma": "4.6.1",
|
||||
"react": "18.2.0",
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
"schema": "db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.5.2",
|
||||
"prisma": "4.6.1",
|
||||
@@ -27,7 +27,7 @@
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "13.5.2",
|
||||
"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": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "13.5.2",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
"schema": "db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/next": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/next": "2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@prisma/client": "4.6.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "13.5.2",
|
||||
"prisma": "4.6.1",
|
||||
@@ -28,7 +28,7 @@
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.34",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.34",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.35",
|
||||
"@blitzjs/next": "workspace:2.0.0-beta.35",
|
||||
"@blitzjs/rpc": "workspace:2.0.0-beta.35",
|
||||
"@tanstack/react-query": "4.13.0",
|
||||
"@testing-library/react": "13.4.0",
|
||||
"@types/express": "4.17.13",
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-plugin-prisma": "4.4.0",
|
||||
"pretty-quick": "3.1.3",
|
||||
"turbo": "1.10.7",
|
||||
"turbo": "1.10.9",
|
||||
"vitest": "0.25.3",
|
||||
"wait-on": "6.0.1"
|
||||
},
|
||||
@@ -44,5 +44,10 @@
|
||||
"ignoredRules": [
|
||||
"EXTERNAL_MISMATCH"
|
||||
]
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"next-auth@4.18.7": "patches/next-auth@4.18.7.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# @blitzjs/auth
|
||||
|
||||
## 2.0.0-beta.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- cee2dec17: Fix bug that did not allow `Page.authenicate = {role: "" }` to correctly work
|
||||
- b97366c42: Remove unintended dependency on next-auth by removing it from the core build of @blitzjs/auth
|
||||
|
||||
⚠️ Breaking Change for current users of `withNextAuthAdapter`
|
||||
|
||||
Update your import in `next.config.js` in the following way
|
||||
|
||||
```diff
|
||||
-const { withNextAuthAdapter } = require("@blitzjs/auth")
|
||||
+const { withNextAuthAdapter } = require("@blitzjs/auth/next-auth")
|
||||
```
|
||||
|
||||
- 3bcbad1a9: - Introduce Blitz RPC's logging system to the `invoke` function which is the recommended way to call resolvers in nextjs `app` directory's react server components.
|
||||
|
||||
- This refactor also removes the re-introduced dependency between `blitz-auth` and `blitz-rpc`, allowing independent usage of `blitz-rpc`
|
||||
|
||||
- Updated dependencies [cee2dec17]
|
||||
- Updated dependencies [aec1bb076]
|
||||
- Updated dependencies [b97366c42]
|
||||
- Updated dependencies [3bcbad1a9]
|
||||
- blitz@2.0.0-beta.35
|
||||
|
||||
## 2.0.0-beta.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/auth",
|
||||
"version": "2.0.0-beta.34",
|
||||
"version": "2.0.0-beta.35",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -50,7 +50,7 @@
|
||||
"url": "0.11.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "*",
|
||||
"next-auth": "*",
|
||||
"secure-password": "4.0.0"
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@testing-library/react": "13.4.0",
|
||||
"@testing-library/react-hooks": "8.0.1",
|
||||
"@types/cookie": "0.4.1",
|
||||
@@ -75,7 +75,7 @@
|
||||
"@types/jsonwebtoken": "8.5.8",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "13.5.2",
|
||||
"next-auth": "4.18.7",
|
||||
"react": "18.2.0",
|
||||
|
||||
@@ -310,12 +310,12 @@ function withBlitzAuthPlugin<TProps = any>(Page: ComponentType<TProps> | BlitzPa
|
||||
}, [])
|
||||
|
||||
let {authenticate, redirectAuthenticatedTo} = getAuthValues(Page, props)
|
||||
|
||||
useAuthorizeIf(
|
||||
authenticate === true,
|
||||
!!authenticate &&
|
||||
((typeof authenticate === "object" && authenticate.redirectTo === undefined) ||
|
||||
authenticate === true),
|
||||
!authenticate ? undefined : typeof authenticate === "object" ? authenticate.role : undefined,
|
||||
)
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
const publicData = getPublicDataStore().getData()
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import {AuthPluginOptions} from "./server"
|
||||
import {SessionConfigMethods} from "./shared"
|
||||
import type {Ctx} from "blitz"
|
||||
import type {AuthPluginOptions} from "./server"
|
||||
import type {SessionConfigMethods} from "./shared"
|
||||
|
||||
declare global {
|
||||
var sessionConfig: AuthPluginOptions & SessionConfigMethods
|
||||
var __BLITZ_SESSION_COOKIE_PREFIX: string | undefined
|
||||
var __BLITZ_SUSPENSE_ENABLED: boolean
|
||||
var __BLITZ_GET_RSC_CONTEXT: () => Promise<Ctx>
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
export * from "./passport/adapter"
|
||||
export * from "./next-auth/webpack"
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
} from "blitz"
|
||||
import {isLocalhost, SessionContext} from "../../../index-server"
|
||||
|
||||
export {withNextAuthAdapter} from "./webpack"
|
||||
|
||||
// next-auth internals
|
||||
import {toInternalRequest, toResponse} from "./internals/utils/web"
|
||||
import {getBody, getURL, setHeaders} from "./internals/utils/node"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {BlitzServerPlugin, RequestMiddleware, Ctx, createServerPlugin} from "blitz"
|
||||
import {RequestMiddleware, Ctx, createServerPlugin} from "blitz"
|
||||
import {assert} from "blitz"
|
||||
import {IncomingMessage, ServerResponse} from "http"
|
||||
import {PublicData, SessionModel, SessionConfigMethods} from "../shared/types"
|
||||
@@ -125,6 +125,7 @@ export const AuthServerPlugin = createServerPlugin((options: AuthPluginOptions)
|
||||
}
|
||||
return blitzSessionMiddleware
|
||||
}
|
||||
globalThis.__BLITZ_GET_RSC_CONTEXT = getBlitzContext
|
||||
return {
|
||||
requestMiddlewares: [authPluginSessionMiddleware()],
|
||||
exports: () => ({
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @blitzjs/next
|
||||
|
||||
## 2.0.0-beta.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- aec1bb076: blitz-next: Fix `next/head` used in app directory warning
|
||||
- Updated dependencies [cee2dec17]
|
||||
- Updated dependencies [aec1bb076]
|
||||
- Updated dependencies [b97366c42]
|
||||
- Updated dependencies [3bcbad1a9]
|
||||
- blitz@2.0.0-beta.35
|
||||
- @blitzjs/rpc@2.0.0-beta.35
|
||||
|
||||
## 2.0.0-beta.34
|
||||
|
||||
### Major Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/next",
|
||||
"version": "2.0.0-beta.34",
|
||||
"version": "2.0.0-beta.35",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -29,7 +29,7 @@
|
||||
"eslint.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blitzjs/rpc": "2.0.0-beta.34",
|
||||
"@blitzjs/rpc": "2.0.0-beta.35",
|
||||
"@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.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "*",
|
||||
"react": "*",
|
||||
"tslog": "4.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@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.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"cross-spawn": "7.0.3",
|
||||
"find-up": "4.1.0",
|
||||
"next": "13.5.2",
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import React from "react"
|
||||
import Head from "next/head"
|
||||
import {NextPageContext} from "next"
|
||||
import dynamic from "next/dynamic"
|
||||
const Head = dynamic(() => import("next/head").then((mod) => mod.default), {
|
||||
ssr: false,
|
||||
loading: () => null,
|
||||
})
|
||||
|
||||
const statusCodes: {[code: number]: string} = {
|
||||
400: "Bad Request",
|
||||
@@ -31,7 +35,6 @@ export class ErrorComponent<P = {}> extends React.Component<P & ErrorProps> {
|
||||
render() {
|
||||
const {statusCode} = this.props
|
||||
const title = this.props.title || statusCodes[statusCode] || "An unexpected error has occurred"
|
||||
|
||||
return (
|
||||
<div style={styles.error}>
|
||||
<Head>
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import "./global"
|
||||
import type {ClientPlugin, BlitzPluginWithProvider} from "blitz"
|
||||
import {reduceBlitzClientPlugins, Ctx} from "blitz"
|
||||
import Head from "next/head"
|
||||
import React, {ReactNode} from "react"
|
||||
import {withSuperJSONPage} from "./superjson"
|
||||
import {UrlObject} from "url"
|
||||
import {AppPropsType} from "next/dist/shared/lib/utils"
|
||||
import type {Router} from "next/router"
|
||||
import {BlitzProvider} from "./provider"
|
||||
import dynamic from "next/dynamic"
|
||||
export {Routes} from ".blitz"
|
||||
const Head = dynamic(() => import("next/head").then((mod) => mod.default), {
|
||||
ssr: false,
|
||||
loading: () => null,
|
||||
})
|
||||
|
||||
export {BlitzProvider} from "./provider"
|
||||
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @blitzjs/rpc
|
||||
|
||||
## 2.0.0-beta.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 3bcbad1a9: - Introduce Blitz RPC's logging system to the `invoke` function which is the recommended way to call resolvers in nextjs `app` directory's react server components.
|
||||
|
||||
- This refactor also removes the re-introduced dependency between `blitz-auth` and `blitz-rpc`, allowing independent usage of `blitz-rpc`
|
||||
|
||||
- Updated dependencies [cee2dec17]
|
||||
- Updated dependencies [aec1bb076]
|
||||
- Updated dependencies [b97366c42]
|
||||
- Updated dependencies [3bcbad1a9]
|
||||
- blitz@2.0.0-beta.35
|
||||
|
||||
## 2.0.0-beta.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/rpc",
|
||||
"version": "2.0.0-beta.34",
|
||||
"version": "2.0.0-beta.35",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -37,18 +37,18 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tanstack/query-core": "4.24.4",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "*",
|
||||
"react": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/auth": "2.0.0-beta.35",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@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.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"next": "13.5.2",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
|
||||
@@ -1,36 +1,15 @@
|
||||
import {FirstParam, PromiseReturnType, isClient, Ctx} from "blitz"
|
||||
import {type FirstParam, type PromiseReturnType, type Ctx, isClient} from "blitz"
|
||||
import {RpcClient} from "./rpc"
|
||||
|
||||
export async function invoke<T extends (...args: any) => any, TInput = FirstParam<T>>(
|
||||
queryFn: T,
|
||||
params: TInput,
|
||||
): Promise<PromiseReturnType<T>>
|
||||
export async function invoke<T extends (...args: any) => any, TInput = FirstParam<T>>(
|
||||
queryFn: T,
|
||||
params: TInput,
|
||||
isServer: boolean,
|
||||
): Promise<PromiseReturnType<T>>
|
||||
export async function invoke<T extends (...args: any) => any, TInput = FirstParam<T>>(
|
||||
queryFn: T,
|
||||
params: TInput,
|
||||
isServer = typeof window === "undefined" ? true : false,
|
||||
): Promise<PromiseReturnType<T>> {
|
||||
if (typeof queryFn === "undefined") {
|
||||
throw new Error(
|
||||
"invoke is missing the first argument - it must be a query or mutation function",
|
||||
)
|
||||
}
|
||||
|
||||
if (isServer) {
|
||||
const {getBlitzContext} = await import("@blitzjs/auth").catch((e) => {
|
||||
throw new Error(
|
||||
`invoke with isServer parameter can only be used in a Blitz powered Nextjs app directory. Make sure you have installed the @blitzjs/auth package.`,
|
||||
)
|
||||
})
|
||||
const ctx = await getBlitzContext()
|
||||
return queryFn(params, ctx) as PromiseReturnType<T>
|
||||
}
|
||||
|
||||
if (isClient) {
|
||||
const fn = queryFn as unknown as RpcClient
|
||||
return fn(params, {fromInvoke: true}) as PromiseReturnType<T>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import {QueryClient} from "@tanstack/react-query"
|
||||
import type {QueryClient} from "@tanstack/react-query"
|
||||
import type {RpcLoggerOptions} from "./server/plugin"
|
||||
import type {Ctx} from "blitz"
|
||||
|
||||
declare global {
|
||||
var queryClient: QueryClient
|
||||
var __BLITZ_SUSPENSE_ENABLED: boolean
|
||||
var blitzRpcRpcLoggerOptions: RpcLoggerOptions | undefined
|
||||
var __BLITZ_GET_RSC_CONTEXT: () => Promise<Ctx>
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import {assert, baseLogger, Ctx, newLine, prettyMs, ResolverConfig} from "blitz"
|
||||
import {assert, ResolverConfig} from "blitz"
|
||||
import {NextApiRequest, NextApiResponse} from "next"
|
||||
import {deserialize, parse, serialize as superjsonSerialize} from "superjson"
|
||||
import {resolve} from "path"
|
||||
import chalk from "chalk"
|
||||
import {LoaderOptions} from "./server/loader/utils/loader-utils"
|
||||
import {RpcLogger} from "./rpc-logger"
|
||||
import {RpcLoggerOptions} from "./server/plugin"
|
||||
|
||||
// TODO - optimize end user server bundles by not exporting all client stuff here
|
||||
export * from "./index-browser"
|
||||
@@ -146,63 +147,11 @@ async function getResolverMap(): Promise<ResolverFiles | null | undefined> {
|
||||
interface RpcConfig {
|
||||
onError?: (error: Error) => void
|
||||
formatError?: (error: Error) => Error
|
||||
logging?: {
|
||||
/**
|
||||
* allowList Represents the list of routes for which logging should be enabled
|
||||
* If allowList is defined then only those routes will be logged
|
||||
*/
|
||||
allowList?: string[]
|
||||
/**
|
||||
* blockList Represents the list of routes for which logging should be disabled
|
||||
* If blockList is defined then all routes except those will be logged
|
||||
*/
|
||||
blockList?: string[]
|
||||
/**
|
||||
* verbose Represents the flag to enable/disable logging
|
||||
* If verbose is true then Blitz RPC will log the input and output of each resolver
|
||||
*/
|
||||
verbose?: boolean
|
||||
/**
|
||||
* disablelevel Represents the flag to enable/disable logging for a particular level
|
||||
*/
|
||||
disablelevel?: "debug" | "info"
|
||||
}
|
||||
}
|
||||
|
||||
function isBlitzRPCVerbose(resolverName: string, config: RpcConfig, level: string) {
|
||||
// blitz rpc is by default verbose - to keep current behaviour
|
||||
if (!config.logging) {
|
||||
return true
|
||||
}
|
||||
//if logging exists and verbose is not defined then default to true
|
||||
if (config.logging && !("verbose" in config.logging)) {
|
||||
return true
|
||||
}
|
||||
const isLevelDisabled = config.logging?.disablelevel === level
|
||||
if (config.logging?.verbose) {
|
||||
// If allowList array is defined then allow only those routes in allowList
|
||||
if (config.logging?.allowList) {
|
||||
if (config.logging?.allowList?.includes(resolverName) && !isLevelDisabled) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// If blockList array is defined then allow all routes except those in blockList
|
||||
if (config.logging?.blockList) {
|
||||
if (!config.logging?.blockList?.includes(resolverName) && !isLevelDisabled) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// if both allowList and blockList are not defined, then allow all routes
|
||||
if (!config.logging?.allowList && !config.logging?.blockList && !isLevelDisabled) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
logging?: RpcLoggerOptions
|
||||
}
|
||||
|
||||
export function rpcHandler(config: RpcConfig) {
|
||||
return async function handleRpcRequest(req: NextApiRequest, res: NextApiResponse, ctx: Ctx) {
|
||||
return async function handleRpcRequest(req: NextApiRequest, res: NextApiResponse) {
|
||||
const resolverMap = await getResolverMap()
|
||||
assert(resolverMap, "No query or mutation resolvers found")
|
||||
assert(
|
||||
@@ -213,14 +162,7 @@ export function rpcHandler(config: RpcConfig) {
|
||||
const relativeRoutePath = (req.query.blitz as string[])?.join("/")
|
||||
const routePath = "/" + relativeRoutePath
|
||||
const resolverName = routePath.replace(/(\/api\/rpc)?\//, "")
|
||||
|
||||
const log = baseLogger().getSubLogger({
|
||||
name: "blitz-rpc",
|
||||
prefix: [resolverName + "()"],
|
||||
})
|
||||
const customChalk = new chalk.Instance({
|
||||
level: log.settings.type === "json" ? 0 : chalk.level,
|
||||
})
|
||||
const rpcLogger = new RpcLogger(resolverName, config.logging)
|
||||
|
||||
const loadableResolver = resolverMap?.[routePath]
|
||||
if (!loadableResolver) {
|
||||
@@ -245,7 +187,7 @@ export function rpcHandler(config: RpcConfig) {
|
||||
) {
|
||||
if (req.method === "POST" && typeof req.body.params === "undefined") {
|
||||
const error = {message: "Request body is missing the `params` key"}
|
||||
log.error(error.message)
|
||||
rpcLogger.error(error.message)
|
||||
res.status(400).json({
|
||||
result: null,
|
||||
error,
|
||||
@@ -267,21 +209,17 @@ export function rpcHandler(config: RpcConfig) {
|
||||
? parse(`${req.query.meta}`)
|
||||
: undefined,
|
||||
})
|
||||
if (isBlitzRPCVerbose(resolverName, config, "info")) {
|
||||
log.info(customChalk.dim("Starting with input:"), data ? data : JSON.stringify(data))
|
||||
}
|
||||
const startTime = Date.now()
|
||||
rpcLogger.timer.initResolver()
|
||||
rpcLogger.preResolver(data)
|
||||
|
||||
const result = await resolver(data, (res as any).blitzCtx)
|
||||
const resolverDuration = Date.now() - startTime
|
||||
rpcLogger.timer.resolverDuration()
|
||||
rpcLogger.postResolver(result)
|
||||
|
||||
if (isBlitzRPCVerbose(resolverName, config, "debug")) {
|
||||
log.debug(customChalk.dim("Result:"), result ? result : JSON.stringify(result))
|
||||
}
|
||||
|
||||
const serializerStartTime = Date.now()
|
||||
rpcLogger.timer.initSerialization()
|
||||
const serializedResult = superjsonSerialize(result)
|
||||
|
||||
const nextSerializerStartTime = Date.now()
|
||||
rpcLogger.timer.initNextJsSerialization()
|
||||
;(res as any).blitzResult = result
|
||||
res.json({
|
||||
result: serializedResult.json,
|
||||
@@ -290,27 +228,11 @@ export function rpcHandler(config: RpcConfig) {
|
||||
result: serializedResult.meta,
|
||||
},
|
||||
})
|
||||
rpcLogger.timer.nextJsSerializationDuration()
|
||||
rpcLogger.nextJsSerialization()
|
||||
|
||||
if (isBlitzRPCVerbose(resolverName, config, "debug")) {
|
||||
log.debug(
|
||||
customChalk.dim(
|
||||
`Next.js serialization:${prettyMs(Date.now() - nextSerializerStartTime)}`,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
const serializerDuration = Date.now() - serializerStartTime
|
||||
const duration = Date.now() - startTime
|
||||
if (isBlitzRPCVerbose(resolverName, config, "info")) {
|
||||
log.info(
|
||||
customChalk.dim(
|
||||
`Finished: resolver:${prettyMs(resolverDuration)} serializer:${prettyMs(
|
||||
serializerDuration,
|
||||
)} total:${prettyMs(duration)}`,
|
||||
),
|
||||
)
|
||||
}
|
||||
newLine()
|
||||
rpcLogger.timer.serializerDuration().totalDuration()
|
||||
rpcLogger.postResponse()
|
||||
|
||||
return
|
||||
} catch (error: any) {
|
||||
@@ -319,9 +241,7 @@ export function rpcHandler(config: RpcConfig) {
|
||||
}
|
||||
|
||||
config.onError?.(error)
|
||||
|
||||
log.error(new Error(error))
|
||||
newLine()
|
||||
rpcLogger.error(error)
|
||||
|
||||
if (!error.statusCode) {
|
||||
error.statusCode = 500
|
||||
@@ -341,7 +261,7 @@ export function rpcHandler(config: RpcConfig) {
|
||||
}
|
||||
} else {
|
||||
// Everything else is error
|
||||
log.warn(`${req.method} method not supported`)
|
||||
rpcLogger.warn(`${req.method} method not supported`)
|
||||
res.status(404).end()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class NextError extends Error {
|
||||
// -------------------------
|
||||
// useQuery
|
||||
// -------------------------
|
||||
type RestQueryResult<TResult, TError> = Omit<UseQueryResult<TResult, TError>, "data"> &
|
||||
export type RestQueryResult<TResult, TError> = Omit<UseQueryResult<TResult, TError>, "data"> &
|
||||
QueryCacheFunctions<TResult>
|
||||
|
||||
export function useQuery<
|
||||
@@ -131,7 +131,7 @@ export function useQuery<
|
||||
// -------------------------
|
||||
// usePaginatedQuery
|
||||
// -------------------------
|
||||
type RestPaginatedResult<TResult, TError> = Omit<UseQueryResult<TResult, TError>, "data"> &
|
||||
export type RestPaginatedResult<TResult, TError> = Omit<UseQueryResult<TResult, TError>, "data"> &
|
||||
QueryCacheFunctions<TResult>
|
||||
|
||||
export function usePaginatedQuery<
|
||||
@@ -219,7 +219,7 @@ export function usePaginatedQuery<
|
||||
// -------------------------
|
||||
// useInfiniteQuery
|
||||
// -------------------------
|
||||
interface RestInfiniteResult<TResult, TError>
|
||||
export interface RestInfiniteResult<TResult, TError>
|
||||
extends Omit<UseInfiniteQueryResult<TResult, TError>, "data">,
|
||||
QueryCacheFunctions<TResult> {
|
||||
pageParams: any
|
||||
|
||||
176
packages/blitz-rpc/src/rpc-logger.ts
Normal file
176
packages/blitz-rpc/src/rpc-logger.ts
Normal file
@@ -0,0 +1,176 @@
|
||||
import {baseLogger, newLine, prettyMs} from "blitz"
|
||||
import chalk, {type Chalk} from "chalk"
|
||||
import type {RpcLoggerOptions} from "./server/plugin"
|
||||
|
||||
type Logger = ReturnType<typeof baseLogger>
|
||||
type RpcLoggerState = {
|
||||
startTime: {
|
||||
[key: string]: number | undefined
|
||||
}
|
||||
duration: {
|
||||
resolver: number
|
||||
serializer: number
|
||||
total: number
|
||||
}
|
||||
verbosityInfo: boolean
|
||||
verbosityDebug: boolean
|
||||
}
|
||||
|
||||
export function isBlitzRPCVerbose(
|
||||
resolverName: string,
|
||||
level: string,
|
||||
loggingOptions?: RpcLoggerOptions,
|
||||
) {
|
||||
// blitz rpc is by default verbose - to keep current behavior
|
||||
if (!loggingOptions) {
|
||||
if (globalThis.blitzRpcRpcLoggerOptions) {
|
||||
loggingOptions = globalThis.blitzRpcRpcLoggerOptions
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
//if logging exists and verbose is not defined then default to true
|
||||
if (loggingOptions && !("verbose" in loggingOptions)) {
|
||||
loggingOptions.verbose = true
|
||||
}
|
||||
const isLevelDisabled = loggingOptions?.disablelevel === level
|
||||
if (loggingOptions?.verbose) {
|
||||
// If allowList array is defined then allow only those routes in allowList
|
||||
if (loggingOptions?.allowList) {
|
||||
if (loggingOptions?.allowList?.includes(resolverName) && !isLevelDisabled) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// If blockList array is defined then allow all routes except those in blockList
|
||||
if (loggingOptions?.blockList) {
|
||||
if (!loggingOptions?.blockList?.includes(resolverName) && !isLevelDisabled) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// if both allowList and blockList are not defined, then allow all routes
|
||||
if (!loggingOptions?.allowList && !loggingOptions?.blockList && !isLevelDisabled) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export class RpcLogger {
|
||||
#logger: Logger
|
||||
#customChalk: Chalk
|
||||
#state: RpcLoggerState
|
||||
constructor(resolverName: string, loggingOptions?: RpcLoggerOptions, loggerName?: string) {
|
||||
const logger = baseLogger().getSubLogger({
|
||||
name: loggerName ? loggerName : "blitz-rpc",
|
||||
prefix: [resolverName + "()"],
|
||||
})
|
||||
this.#logger = logger
|
||||
this.#customChalk = new chalk.Instance({
|
||||
level: logger.settings.type === "json" ? 0 : chalk.level,
|
||||
})
|
||||
const verbosityInfo = isBlitzRPCVerbose(resolverName, "info", loggingOptions)
|
||||
const verbosityDebug = isBlitzRPCVerbose(resolverName, "debug", loggingOptions)
|
||||
this.#state = {
|
||||
startTime: {
|
||||
total: Date.now(),
|
||||
},
|
||||
duration: {
|
||||
resolver: 0,
|
||||
serializer: 0,
|
||||
total: 0,
|
||||
},
|
||||
verbosityInfo,
|
||||
verbosityDebug,
|
||||
}
|
||||
}
|
||||
public timer = {
|
||||
reset: () => {
|
||||
this.#state.startTime = {}
|
||||
return this.timer
|
||||
},
|
||||
initResolver: () => {
|
||||
this.#state.startTime["resolver"] = Date.now()
|
||||
return this.timer
|
||||
},
|
||||
resolverDuration: () => {
|
||||
if (!this.#state.startTime["resolver"]) {
|
||||
throw new Error("resolverDuration called before initResolver")
|
||||
}
|
||||
this.#state.duration.resolver = Date.now() - this.#state.startTime["resolver"]
|
||||
return this.timer
|
||||
},
|
||||
initSerialization: () => {
|
||||
this.#state.startTime["serializer"] = Date.now()
|
||||
return this.timer
|
||||
},
|
||||
initNextJsSerialization: () => {
|
||||
this.#state.startTime["nextJsSerialization"] = Date.now()
|
||||
return this.timer
|
||||
},
|
||||
nextJsSerializationDuration: () => {
|
||||
if (!this.#state.startTime["nextJsSerialization"]) {
|
||||
throw new Error("nextJsSerializationDuration called before initNextJsSerialization")
|
||||
}
|
||||
this.#state.duration.serializer = Date.now() - this.#state.startTime["nextJsSerialization"]
|
||||
return this.timer
|
||||
},
|
||||
serializerDuration: () => {
|
||||
if (!this.#state.startTime["serializer"]) {
|
||||
throw new Error("serializerDuration called before initSerializer")
|
||||
}
|
||||
this.#state.duration.serializer = Date.now() - this.#state.startTime["serializer"]
|
||||
return this.timer
|
||||
},
|
||||
totalDuration: () => {
|
||||
if (!this.#state.startTime["total"]) {
|
||||
throw new Error("totalDuration called before initResolver")
|
||||
}
|
||||
this.#state.duration.total = Date.now() - this.#state.startTime["total"]
|
||||
return this.timer
|
||||
},
|
||||
}
|
||||
public preResolver(data: any) {
|
||||
if (this.#state.verbosityInfo) {
|
||||
this.#logger.info(
|
||||
this.#customChalk.dim("Starting with input:"),
|
||||
data ? data : JSON.stringify(data),
|
||||
)
|
||||
}
|
||||
}
|
||||
public postResolver(result: any) {
|
||||
if (this.#state.verbosityDebug) {
|
||||
this.#logger.debug(this.#customChalk.dim("Result:"), result ? result : JSON.stringify(result))
|
||||
}
|
||||
}
|
||||
public nextJsSerialization() {
|
||||
if (this.#state.verbosityDebug) {
|
||||
this.#logger.debug(
|
||||
this.#customChalk.dim(`Next.js serialization:${prettyMs(this.#state.duration.serializer)}`),
|
||||
)
|
||||
}
|
||||
}
|
||||
public postResponse() {
|
||||
if (this.#state.verbosityInfo) {
|
||||
this.#logger.info(
|
||||
this.#customChalk.dim(
|
||||
`Finished: resolver:${prettyMs(this.#state.duration.resolver)} serializer:${prettyMs(
|
||||
this.#state.duration.serializer,
|
||||
)} total:${prettyMs(this.#state.duration.total)}`,
|
||||
),
|
||||
)
|
||||
}
|
||||
newLine()
|
||||
}
|
||||
public error(e: any) {
|
||||
if (typeof e === "string") {
|
||||
this.#logger.error(e)
|
||||
}
|
||||
this.#logger.error(new Error(e))
|
||||
newLine()
|
||||
}
|
||||
public warn(e: string) {
|
||||
this.#logger.warn(e)
|
||||
newLine()
|
||||
}
|
||||
}
|
||||
26
packages/blitz-rpc/src/server/invoke.ts
Normal file
26
packages/blitz-rpc/src/server/invoke.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type {Ctx, FirstParam, PromiseReturnType} from "blitz"
|
||||
import {RpcLogger} from "../rpc-logger"
|
||||
import {RpcLoggerOptions} from "./plugin"
|
||||
|
||||
export async function invoke<T extends (...args: any) => any, TInput = FirstParam<T>>(
|
||||
queryFn: T,
|
||||
params: TInput,
|
||||
ctx?: Ctx,
|
||||
loggingOptions?: RpcLoggerOptions,
|
||||
): Promise<PromiseReturnType<T>> {
|
||||
if (typeof queryFn === "undefined") {
|
||||
throw new Error(
|
||||
"invoke is missing the first argument - it must be a query or mutation function",
|
||||
)
|
||||
}
|
||||
const rpcLogger = new RpcLogger((queryFn as any)._resolverName, loggingOptions, "blitz-invoke")
|
||||
rpcLogger.timer.initResolver()
|
||||
rpcLogger.preResolver(params)
|
||||
|
||||
const result = await queryFn(params, ctx)
|
||||
rpcLogger.postResolver(result)
|
||||
|
||||
rpcLogger.timer.resolverDuration().totalDuration()
|
||||
rpcLogger.postResponse()
|
||||
return result
|
||||
}
|
||||
@@ -1,11 +1,60 @@
|
||||
import {RequestMiddleware, createServerPlugin} from "blitz"
|
||||
import {invoke} from "../client/invoke"
|
||||
import {
|
||||
type FirstParam,
|
||||
type PromiseReturnType,
|
||||
type RequestMiddleware,
|
||||
createServerPlugin,
|
||||
} from "blitz"
|
||||
import {invoke} from "./invoke"
|
||||
|
||||
export const RpcServerPlugin = createServerPlugin(() => {
|
||||
export type RpcLoggerOptions = {
|
||||
/**
|
||||
* allowList Represents the list of routes for which logging should be enabled
|
||||
* If allowList is defined then only those routes will be logged
|
||||
*/
|
||||
allowList?: string[]
|
||||
/**
|
||||
* blockList Represents the list of routes for which logging should be disabled
|
||||
* If blockList is defined then all routes except those will be logged
|
||||
*/
|
||||
blockList?: string[]
|
||||
/**
|
||||
* verbose Represents the flag to enable/disable logging
|
||||
* If verbose is true then Blitz RPC will log the input and output of each resolver
|
||||
*/
|
||||
verbose?: boolean
|
||||
/**
|
||||
* disablelevel Represents the flag to enable/disable logging for a particular level
|
||||
*/
|
||||
disablelevel?: "debug" | "info"
|
||||
}
|
||||
|
||||
type RpcPluginOptions = {
|
||||
logging?: RpcLoggerOptions
|
||||
onInvokeError?: (error: unknown) => void
|
||||
}
|
||||
|
||||
export const RpcServerPlugin = createServerPlugin((options: RpcPluginOptions) => {
|
||||
if (options.logging) {
|
||||
globalThis.blitzRpcRpcLoggerOptions = options.logging
|
||||
}
|
||||
async function invokeWithCtx<T extends (...args: any) => any, TInput = FirstParam<T>>(
|
||||
queryFn: T,
|
||||
params: TInput,
|
||||
): Promise<PromiseReturnType<T>> {
|
||||
const ctx = await globalThis.__BLITZ_GET_RSC_CONTEXT()
|
||||
try {
|
||||
return await invoke(queryFn, params, ctx, options.logging)
|
||||
} catch (error) {
|
||||
if (options.onInvokeError) {
|
||||
options.onInvokeError(error)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
return {
|
||||
requestMiddlewares: [] as RequestMiddleware<any, any, void | Promise<void>>[],
|
||||
exports: () => ({
|
||||
invoke,
|
||||
invoke: invokeWithCtx,
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,29 @@
|
||||
# blitz
|
||||
|
||||
## 2.0.0-beta.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- cee2dec17: Fix bug that did not allow `Page.authenicate = {role: "" }` to correctly work
|
||||
- aec1bb076: blitz-next: Fix `next/head` used in app directory warning
|
||||
- b97366c42: Remove unintended dependency on next-auth by removing it from the core build of @blitzjs/auth
|
||||
|
||||
⚠️ Breaking Change for current users of `withNextAuthAdapter`
|
||||
|
||||
Update your import in `next.config.js` in the following way
|
||||
|
||||
```diff
|
||||
-const { withNextAuthAdapter } = require("@blitzjs/auth")
|
||||
+const { withNextAuthAdapter } = require("@blitzjs/auth/next-auth")
|
||||
```
|
||||
|
||||
- 3bcbad1a9: - Introduce Blitz RPC's logging system to the `invoke` function which is the recommended way to call resolvers in nextjs `app` directory's react server components.
|
||||
|
||||
- This refactor also removes the re-introduced dependency between `blitz-auth` and `blitz-rpc`, allowing independent usage of `blitz-rpc`
|
||||
|
||||
- Updated dependencies [c89cb943b]
|
||||
- @blitzjs/generator@2.0.0-beta.35
|
||||
|
||||
## 2.0.0-beta.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blitz",
|
||||
"version": "2.0.0-beta.34",
|
||||
"version": "2.0.0-beta.35",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -30,7 +30,7 @@
|
||||
"blitz": "bin/blitz"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/generator": "2.0.0-beta.34",
|
||||
"@blitzjs/generator": "2.0.0-beta.35",
|
||||
"@mrleebo/prisma-ast": "0.2.6",
|
||||
"@types/global-agent": "2.1.1",
|
||||
"arg": "5.0.1",
|
||||
@@ -80,7 +80,7 @@
|
||||
"watchpack": "2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@types/cookie": "0.4.1",
|
||||
"@types/cross-spawn": "6.0.2",
|
||||
"@types/debug": "4.1.7",
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @blitzjs/codemod
|
||||
|
||||
## 2.0.0-beta.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cee2dec17]
|
||||
- Updated dependencies [aec1bb076]
|
||||
- Updated dependencies [c89cb943b]
|
||||
- Updated dependencies [b97366c42]
|
||||
- Updated dependencies [3bcbad1a9]
|
||||
- blitz@2.0.0-beta.35
|
||||
- @blitzjs/generator@2.0.0-beta.35
|
||||
|
||||
## 2.0.0-beta.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/codemod",
|
||||
"version": "2.0.0-beta.34",
|
||||
"version": "2.0.0-beta.35",
|
||||
"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.34",
|
||||
"@blitzjs/generator": "2.0.0-beta.35",
|
||||
"arg": "5.0.1",
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"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": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@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.35
|
||||
|
||||
## 2.0.0-beta.34
|
||||
|
||||
## 2.0.0-beta.33
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@blitzjs/config",
|
||||
"private": true,
|
||||
"version": "2.0.0-beta.34",
|
||||
"version": "2.0.0-beta.35",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "5.42.1",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @blitzjs/generator
|
||||
|
||||
## 2.0.0-beta.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- c89cb943b: Upgrade next, prisma and zod to latest versions in a newly created app
|
||||
|
||||
## 2.0.0-beta.34
|
||||
|
||||
## 2.0.0-beta.33
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/generator",
|
||||
"version": "2.0.0-beta.34",
|
||||
"version": "2.0.0-beta.35",
|
||||
"homepage": "https://blitzjs.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -54,7 +54,7 @@
|
||||
"zod": "3.20.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@juanm04/cpx": "2.0.1",
|
||||
"@types/babel__core": "7.1.19",
|
||||
"@types/diff": "5.0.2",
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
"@blitzjs/auth": "latest",
|
||||
"@blitzjs/next": "latest",
|
||||
"@blitzjs/rpc": "latest",
|
||||
"@prisma/client": "4.6.1",
|
||||
"@prisma/client": "5.4.2",
|
||||
"blitz": "latest",
|
||||
"next": "13.4.5",
|
||||
"prisma": "4.6.1",
|
||||
"next": "13.5.4",
|
||||
"prisma": "5.4.2",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"secure-password": "4.0.0",
|
||||
"zod": "3.20.2"
|
||||
"zod": "3.22.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@typescript-eslint/parser": "5.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.34",
|
||||
"@blitzjs/config": "2.0.0-beta.35",
|
||||
"@types/react": "18.0.25",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"react": "18.2.0",
|
||||
|
||||
16
patches/next-auth@4.18.7.patch
Normal file
16
patches/next-auth@4.18.7.patch
Normal file
@@ -0,0 +1,16 @@
|
||||
diff --git a/package.json b/package.json
|
||||
index 42c10484d14e2b029157acf9a08087e8133b20d2..c5a6acce9dd9c8f24271be0b8ae19df680ea0f7b 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -34,7 +34,10 @@
|
||||
"./next": "./next/index.js",
|
||||
"./middleware": "./middleware.js",
|
||||
"./client/_utils": "./client/_utils.js",
|
||||
- "./providers/*": "./providers/*.js"
|
||||
+ "./providers/*": "./providers/*.js",
|
||||
+ "./core/init": "./core/init.js",
|
||||
+ "./core/lib/oauth/authorization-url": "./core/lib/oauth/authorization-url.js",
|
||||
+ "./core/lib/oauth/callback": "./core/lib/oauth/callback.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "pnpm clean && pnpm build:js && pnpm build:css",
|
||||
1400
pnpm-lock.yaml
generated
1400
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ export default RecipeBuilder()
|
||||
.setName("Base Web")
|
||||
.setDescription(`This will install all necessary dependencies and configure Base Web for use.`)
|
||||
.setOwner("Konrad Kalemba <konrad@kale.mba>")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "Add dependencies",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -6,7 +6,7 @@ export default RecipeBuilder()
|
||||
.setName("Bulma CSS")
|
||||
.setDescription(`This will install all necessary dependencies and configure Bulma for use.`)
|
||||
.setOwner("vivek7405@hey.com")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "npm dependencies",
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -73,7 +73,7 @@ export default RecipeBuilder()
|
||||
`This will install all necessary dependencies and configure BumbagProvider in your _app and _document`,
|
||||
)
|
||||
.setOwner("me@agusti.me")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "npm dependencies",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -108,7 +108,7 @@ export default RecipeBuilder()
|
||||
.setName("Chakra UI")
|
||||
.setDescription(`This will install all necessary dependencies and configure Chakra UI for use.`)
|
||||
.setOwner("zekan.fran369@gmail.com")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "npm dependencies",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -31,7 +31,7 @@ export default RecipeBuilder()
|
||||
.setName("Emotion")
|
||||
.setDescription(`This will install all necessary dependencies and configure Emotion for use.`)
|
||||
.setOwner("justin.r.hall+blitz@gmail.com")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "npm dependencies",
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -5,7 +5,7 @@ export default RecipeBuilder()
|
||||
.setName("Github Action Workflow For Yarn & MariaDB")
|
||||
.setDescription("This Github Action config will build and test your blitz app on each push")
|
||||
.setOwner("me@kevinlangleyjr.com")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addNewFilesStep({
|
||||
stepId: "addWorkflow",
|
||||
stepName: "Add .github/workflows/main.yml",
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34"
|
||||
"blitz": "2.0.0-beta.35"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ export default RecipeBuilder()
|
||||
.setName("Github Action Workflow For Yarn & Postgres")
|
||||
.setDescription("This Github Action config will build and test your blitz app on each push")
|
||||
.setOwner("b@bayer.ws")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addNewFilesStep({
|
||||
stepId: "addWorkflow",
|
||||
stepName: "Add .github/workflows/main.yml",
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34"
|
||||
"blitz": "2.0.0-beta.35"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export default RecipeBuilder()
|
||||
.setName("Ghost")
|
||||
.setDescription("Access your Ghost CMS directly in blitz via the Ghost SDK.")
|
||||
.setOwner("Mark Hughes <m@rkhugh.es>")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "Add npm dependencies",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -7,7 +7,7 @@ export default RecipeBuilder()
|
||||
`Implements a GraphQL API using Apollo Server that you can extend with your prisma models.`,
|
||||
)
|
||||
.setOwner("jeremy@jeremyliberman.com")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "Add dependencies",
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0",
|
||||
"uuid": "^8.3.1"
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ export default RecipeBuilder()
|
||||
.setName("LogRocket")
|
||||
.setDescription(`This will install all necessary dependencies and configure LogRocket for use.`)
|
||||
.setOwner("Kevin Langley Jr. <me@kevinlangleyjr.com>")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "Add dependencies",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -8,7 +8,7 @@ export default RecipeBuilder()
|
||||
"Configure your Blitz app's styling with Material-UI. This recipe will install all necessary dependencies and configure a base Material-UI setup for usage.",
|
||||
)
|
||||
.setOwner("s.pathak5995@gmail.com")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "Add npm dependencies",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -79,17 +79,22 @@ export default RecipeBuilder()
|
||||
.setName("Next UI")
|
||||
.setDescription(`This will install all necessary dependencies and configure Next UI for use.`)
|
||||
.setOwner("moyurusuto.mochi@gmail.com")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "install",
|
||||
stepName: "Install Next UI",
|
||||
explanation: `Import the Next UI provider into _app, so it is accessible in the whole app`,
|
||||
explanation: `Install Next UI and its dependencies`,
|
||||
packages: [
|
||||
{
|
||||
name: "@nextui-org/react",
|
||||
version: "latest",
|
||||
isDevDep: true,
|
||||
},
|
||||
{
|
||||
name: "framer-motion",
|
||||
version: "latest",
|
||||
isDevDep: false,
|
||||
},
|
||||
],
|
||||
})
|
||||
.addTransformFilesStep({
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -5,7 +5,7 @@ export default RecipeBuilder()
|
||||
.setName("Phusion Passenger")
|
||||
.setDescription("")
|
||||
.setOwner("peter.nyari@ioflair.com")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addNewFilesStep({
|
||||
stepId: "addPassengerEntrypoint",
|
||||
stepName: "Add passenger.js",
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34"
|
||||
"blitz": "2.0.0-beta.35"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34"
|
||||
"blitz": "2.0.0-beta.35"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default RecipeBuilder()
|
||||
.setName("Reflexjs")
|
||||
.setDescription("This will install all necessary dependencies and configure Reflexjs for use.")
|
||||
.setOwner("tundera <stackshuffle@gmail.com>")
|
||||
.setRepoLink("https://github.com/blitz-js/legacy-framework")
|
||||
.setRepoLink("https://github.com/blitz-js/blitz/")
|
||||
.addAddDependenciesStep({
|
||||
stepId: "addDeps",
|
||||
stepName: "npm dependencies",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "2.0.0-beta.34",
|
||||
"blitz": "2.0.0-beta.35",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user