1
0
mirror of synced 2026-02-04 12:08:33 -05:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Siddharth Suresh
33f649f64c Update main.yml 2023-04-30 16:50:28 +05:30
Siddharth Suresh
8542c14952 Update main.yml 2023-04-30 16:43:49 +05:30
375 changed files with 6688 additions and 13163 deletions

View File

@@ -3896,124 +3896,6 @@
"doc",
"code"
]
},
{
"login": "dbrxnds",
"name": "David",
"avatar_url": "https://avatars.githubusercontent.com/u/32268383?v=4",
"profile": "https://github.com/dbrxnds",
"contributions": [
"doc",
"code",
"test"
]
},
{
"login": "gjmoed",
"name": "G.J. Moed",
"avatar_url": "https://avatars.githubusercontent.com/u/4458993?v=4",
"profile": "https://github.com/gjmoed",
"contributions": [
"doc",
"code"
]
},
{
"login": "GHKEN",
"name": "Tetsuya Fukuda",
"avatar_url": "https://avatars.githubusercontent.com/u/5304351?v=4",
"profile": "https://ghken.com",
"contributions": [
"doc",
"code"
]
},
{
"login": "nerixim",
"name": "Nikita Kamaev",
"avatar_url": "https://avatars.githubusercontent.com/u/26106502?v=4",
"profile": "https://github.com/nerixim",
"contributions": [
"doc"
]
},
{
"login": "nikola-wd",
"name": "Nikola Ivanov",
"avatar_url": "https://avatars.githubusercontent.com/u/11588823?v=4",
"profile": "https://webredone.com/",
"contributions": [
"doc"
]
},
{
"login": "jayu",
"name": "Jakub Mazurek",
"avatar_url": "https://avatars.githubusercontent.com/u/11561585?v=4",
"profile": "jayu.dev",
"contributions": [
"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"
]
},
{
"login": "rodobre",
"name": "rodobre",
"avatar_url": "https://avatars.githubusercontent.com/u/52138375?v=4",
"profile": "https://github.com/rodobre",
"contributions": [
"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"
]
},
{
"login": "papsavas",
"name": "Savvas Papageorgiadis",
"avatar_url": "https://avatars.githubusercontent.com/u/50584606?v=4",
"profile": "https://github.com/papsavas",
"contributions": [
"doc",
"code"
]
}
],
"contributorsPerLine": 7,

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/auth": patch
"blitz": patch
---
Fix bug that did not allow `Page.authenicate = {role: "" }` to correctly work

View File

@@ -1,9 +0,0 @@
---
"@blitzjs/auth": patch
"@blitzjs/next": patch
"@blitzjs/rpc": patch
"blitz": patch
"@blitzjs/generator": patch
---
(feat) upgrade tslog to v4.8.2

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/next": minor
"@blitzjs/rpc": minor
---
Add ability to format the error on the server before returning it to the client.

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/next": patch
"blitz": patch
---
blitz-next: Fix `next/head` used in app directory warning

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/generator": patch
---
Update examples of generate all in docs to include one column in model.

View File

@@ -1,9 +0,0 @@
---
"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.

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/auth": patch
"blitz": patch
---
blitz-auth: Fix webpack from following next-auth

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/rpc": patch
"blitz": patch
---
Add helpful error message when RPC resolvers have the same path

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/rpc": patch
---
Fix return type of `requestMiddlewares` in `RpcServerPlugin`

View File

@@ -1,8 +0,0 @@
---
"@blitzjs/auth": patch
"blitz": patch
---
blitz-auth: Support for Prisma v5
Internal: Make `handle` a required paramter while updating the `session` modal.

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/auth": patch
---
Updated `useAuthenticatedBlitzContext` to now return `AuthenticatedCtx`

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/next": minor
---
Fix the DYNAMIC_SERVER_USAGE error for Next.js 13.3.1+

View File

@@ -1,26 +0,0 @@
---
"@blitzjs/rpc": patch
---
Fixes enormous memory consumption of the dev server by changing the default import strategy to "require" instead of "import" which in webpack causes multiple chunks to be created for each import.
## Blitz Configuration
To configure this behaviour, you can add the following to your next.config.js:
```js
/**
* @type {import('@blitzjs/next').BlitzConfig}
**/
const config = {
blitz: {
resolversDynamicImport: true,
},
}
```
When `resolversDynamicImport` is set to `true`, the import strategy will be "import" instead of "require".
### On Vercel
If you are using Vercel, `resolversDynamicImport` will be set to `true` by default, since it is better for the separate chunks to be create for serverless lambdas.

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/generator": patch
---
Upgrade next, prisma and zod to latest versions in a newly created app

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/auth": patch
"blitz": patch
---
Automatically authorize role with usage of `redirectAuthenticatedTo` in `useAuthenticatedBlitzContext` utility

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/generator": patch
---
Make Next.js version stick to 13.4.5 when generating a new app

View File

@@ -1,6 +0,0 @@
---
"blitz": patch
---
- Removes language selection step from `blitz new` menu
- Make `formik` the default/recommended form library

View File

@@ -1,10 +0,0 @@
---
"@blitzjs/auth": patch
"@blitzjs/next": major
"@blitzjs/rpc": patch
"blitz": patch
---
⚠️ Breaking Change:
Next.js version 13.5 or above is now required to use `@blitzjs/next`
Fix `Error: Cannot find module 'next/dist/shared/lib/router/utils/resolve-href'` by updating the location of next.js internal function.

View File

@@ -1,9 +0,0 @@
---
"@blitzjs/auth": patch
"@blitzjs/next": patch
"@blitzjs/rpc": patch
"blitz": patch
---
Next 14 Compatibility

View File

@@ -1,13 +0,0 @@
---
"@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")

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/auth": minor
---
Stop exporting `useAuthenticatedBlitzContext` from `@blitzjs/auth` this must be imported from `app/blitz-server.ts` file in order to work correctly

View File

@@ -1,9 +0,0 @@
---
"@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`

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/recipe-tailwind": patch
---
Change tailwind recipe to install dependencies as devDependencies

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/rpc": patch
"blitz": patch
---
Fix for tslog error `TypeError: Cannot read properties of undefined (reading 'map')` while using custom errors.

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/rpc": patch
"blitz": patch
---
Allow `.tsx` & `.jsx` file extensions to be used for resolvers

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/generator": patch
---
new blitz app starter

View File

@@ -1,5 +0,0 @@
---
"blitz": patch
---
blitz-rpc: Cleanup Event Listeners - Fix potential memory leak by cleaning up any residual event listeners set by blitz.

View File

@@ -53,10 +53,8 @@
"changesets": [
"afraid-dancers-juggle",
"afraid-ears-repair",
"afraid-ligers-build",
"big-boats-lay",
"big-phones-bow",
"big-turtles-tease",
"blue-flowers-peel",
"blue-pigs-tan",
"brave-zebras-deny",
@@ -72,16 +70,12 @@
"calm-papayas-protect",
"calm-tomatoes-drive",
"chatty-fireants-leave",
"chatty-gifts-whisper",
"chatty-scissors-jump",
"chilled-carrots-own",
"chilly-candles-care",
"chilly-jeans-fix",
"chilly-nails-nail",
"clean-hats-pump",
"clean-hounds-laugh",
"clean-walls-wink",
"clever-hornets-talk",
"clever-radios-lie",
"cool-doors-invent",
"cool-horses-check",
@@ -90,10 +84,8 @@
"curly-rules-speak",
"curly-seas-serve",
"curvy-days-attend",
"curvy-drinks-perform",
"cyan-bulldogs-heal",
"cyan-cars-greet",
"cyan-rings-play",
"dirty-monkeys-greet",
"dirty-planets-chew",
"dull-rings-arrive",
@@ -116,10 +108,8 @@
"fast-toys-wash",
"fast-trainers-kneel",
"few-dogs-fetch",
"few-elephants-approve",
"few-hounds-worry",
"few-shrimps-leave",
"fifty-drinks-cry",
"flat-bees-approve",
"fluffy-coats-flow",
"fluffy-mangos-begin",
@@ -129,8 +119,6 @@
"four-meals-fry",
"four-radios-tickle",
"four-sheep-judge",
"fresh-camels-return",
"fresh-crews-chew",
"funny-cups-pay",
"fuzzy-bees-warn",
"fuzzy-dots-cross",
@@ -143,7 +131,6 @@
"gold-horses-punch",
"good-apes-drum",
"good-insects-wink",
"good-oranges-pretend",
"gorgeous-birds-warn",
"gorgeous-buses-scream",
"gorgeous-games-obey",
@@ -152,7 +139,6 @@
"great-terms-rescue",
"green-papayas-do",
"green-pillows-hammer",
"green-years-behave",
"happy-bees-lick",
"happy-hotels-visit",
"happy-paws-join",
@@ -166,7 +152,6 @@
"honest-comics-vanish",
"hot-cups-rhyme",
"hot-drinks-approve",
"hot-knives-vanish",
"hungry-baboons-swim",
"hungry-pens-collect",
"itchy-cups-double",
@@ -175,7 +160,6 @@
"khaki-ducks-cheer",
"khaki-pens-rest",
"kind-walls-suffer",
"large-hairs-battle",
"late-steaks-give",
"lazy-maps-sort",
"lemon-games-press",
@@ -184,7 +168,6 @@
"lemon-teachers-jam",
"light-donkeys-double",
"light-squids-draw",
"little-cycles-hang",
"little-pears-ring",
"long-bees-hope",
"long-dancers-jog",
@@ -194,33 +177,24 @@
"lovely-colts-share",
"lucky-cows-try",
"lucky-months-guess",
"lucky-teachers-sleep",
"lucky-years-turn",
"many-fans-fetch",
"mean-ears-speak",
"mean-gorillas-reply",
"modern-cameras-pull",
"modern-cups-cheat",
"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",
"new-coats-turn",
"new-olives-protect",
"nice-boxes-travel",
"nice-cats-lay",
"nice-deers-dream",
"nice-starfishes-live",
"nine-bags-rhyme",
"nine-birds-confess",
"nine-onions-admire",
"ninety-lies-press",
@@ -242,26 +216,21 @@
"plenty-gifts-provide",
"plenty-kiwis-greet",
"polite-lizards-love",
"poor-bikes-wait",
"poor-crabs-drum",
"poor-peas-lick",
"poor-penguins-look",
"poor-shrimps-think",
"poor-walls-relax",
"popular-teachers-pay",
"pretty-games-march",
"pretty-snakes-search",
"purple-donkeys-smash",
"purple-jars-begin",
"purple-singers-greet",
"quick-crews-occur",
"quick-cycles-confess",
"quick-dots-fetch",
"quiet-feet-travel",
"quiet-pans-hunt",
"quiet-sloths-rule",
"rare-crews-sleep",
"rare-squids-brake",
"red-badgers-retire",
"red-gorillas-marry",
"rich-chairs-invent",
@@ -270,7 +239,6 @@
"rotten-rocks-remember",
"rude-trainers-visit",
"serious-mugs-leave",
"shaggy-boxes-exercise",
"shaggy-carpets-brake",
"sharp-falcons-begin",
"sharp-olives-sip",
@@ -283,13 +251,11 @@
"silly-peas-work",
"silly-shoes-agree",
"six-apricots-kick",
"sixty-rockets-count",
"slimy-humans-impress",
"slimy-needles-taste",
"slow-impalas-tap",
"slow-walls-camp",
"slow-walls-poke",
"small-monkeys-battle",
"small-socks-confess",
"smooth-planets-admire",
"smooth-rice-clap",
@@ -319,7 +285,6 @@
"tall-radios-clean",
"tame-keys-reply",
"tame-pumpkins-nail",
"tame-rocks-unite",
"tasty-maps-fetch",
"tasty-news-collect",
"tasty-squids-sin",
@@ -357,9 +322,7 @@
"wicked-rings-walk",
"wise-eels-visit",
"wise-frogs-give",
"wise-lies-relate",
"wise-rabbits-complain",
"yellow-numbers-serve",
"young-birds-talk"
]
}

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/recipe-next-ui": patch
---
Add `framer-motion` as a dependency of `next-ui`

View File

@@ -1,5 +0,0 @@
---
"blitz": patch
---
Remove rouge `console.log` during start

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/rpc": minor
---
expose `ctx` to `rpcHandler` error callbacks in [[...blitz]].ts files

View File

@@ -1,9 +0,0 @@
---
"@blitzjs/next": patch
"blitz": patch
"@blitzjs/generator": patch
---
- Updates `ts-log` peer dependency to `4.9.0`
- Removes `javascript` from `blitz new` menu
- Hot Fix the `Update Schema` when using blitz generator

View File

@@ -1,70 +0,0 @@
---
"@blitzjs/rpc": patch
"blitz": patch
---
### Now we can configure Blitz RPC in the following way,
In your `[[...blitz]].ts` api file you can see the following settings
```ts
logging?: {
/**
* allowList Represents the list of routes for which logging should be enabled
* If whiteList 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"
}
```
```ts
import { rpcHandler } from "@blitzjs/rpc"
import { api } from "src/blitz-server"
export default api(
rpcHandler({
onError: console.log,
formatError: (error) => {
error.message = `FormatError handler: ${error.message}`
return error
},
logging: {
...
}
})
)
```
Example:
```ts
export default api(
rpcHandler({
onError: console.log,
formatError: (error) => {
error.message = `FormatError handler: ${error.message}`
return error
},
logging: {
verbose: true,
blockList: ["getCurrentUser", ...], //just write the resolver name [which is the resolver file name]
},
})
)
```
This is enable verbose blitz rpc logging for all resolvers except the resolvers `getCurrentUser` and others mentioned in the `blockList`

View File

@@ -1,6 +0,0 @@
---
"@blitzjs/auth": patch
"blitz": patch
---
Fix Next-Auth integration: `Unable to use next-auth with provider: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]`

View File

@@ -1,5 +0,0 @@
---
"blitz": patch
---
Fix log formatting to not show the path of blitz rpc

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/recipe-tailwind": minor
---
support both directory style in tailwind recipe

View File

@@ -7,8 +7,8 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
jobs:
@@ -17,13 +17,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
with:
version: 8.6.5
version: 7.11.0
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 18
node-version: 16
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
@@ -38,13 +38,13 @@ jobs:
name: Build
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
with:
version: 8.6.5
version: 7.11.0
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 18
node-version: 16
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- name: Build
@@ -62,20 +62,20 @@ jobs:
- windows-latest
fail-fast: false
env:
NODE_VERSION: 18
NODE_VERSION: 16
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
with:
version: 8.6.5
version: 7.11.0
- name: Setup node@16
uses: actions/setup-node@v2
with:
node-version: 18
node-version: 16
cache: "pnpm"
- name: Install dependencies
@@ -109,9 +109,44 @@ jobs:
tree -J -d -L 1 | jq -c '.[0].contents | map(.name | tostring) | map(select(. != "utils"))'
folders=$(tree -J -d -L 1 | jq -c '.[0].contents | map(.name | tostring) | map(select(. != "utils"))')
echo "folders=$folders" >> $GITHUB_OUTPUT
Generator:
name: :"Generator Test ${{matrix.language}}"
strategy:
matrix:
language:
- javascript
- typescript
os:
- ubuntu-latest
fail-fast: false
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PNPM
uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
with:
version: 7.11.0
- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
shell: bash
- name: Build
run: pnpm build
shell: bash
- name: Generate
run: |
mkdir test
cd test
pnpm blitz new . --language=${{matrix.language}}
Integration-Tests:
name: "Integration Test: ${{matrix.folder}} @ ${{ matrix.os }}"
name: "Integration Test: ${{matrix.folder}} @ ${{matrix.os}} "
needs: [find-integration-tests]
strategy:
matrix:
@@ -119,44 +154,36 @@ jobs:
os:
- ubuntu-latest
- windows-latest
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- run: echo ${{matrix.folder}}
- name: Checkout
if: matrix.folder != 'next-13-app-dir' || matrix.os != 'windows-latest'
uses: actions/checkout@v3
- name: Setup PNPM
if: matrix.folder != 'next-13-app-dir' || matrix.os != 'windows-latest'
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
with:
version: 8.6.5
version: 7.11.0
- name: Setup node@18
if: matrix.folder != 'next-13-app-dir' || matrix.os != 'windows-latest'
- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: 18
node-version: ${{ matrix.NODE_VERSION }}
cache: "pnpm"
- name: Install dependencies
if: matrix.folder != 'next-13-app-dir' || matrix.os != 'windows-latest'
run: pnpm install --frozen-lockfile
shell: bash
- name: Install playwright
if: matrix.folder != 'next-13-app-dir' || matrix.os != 'windows-latest'
run: |
pnpx playwright@1.28.0 install --with-deps
pnpx playwright@1.28.0 install --with-deps
shell: bash
- name: Build
if: matrix.folder != 'next-13-app-dir' || matrix.os != 'windows-latest'
run: pnpm build
shell: bash
- name: Test Packages
if: matrix.folder != 'next-13-app-dir' || matrix.os != 'windows-latest'
run: pnpm test -- --filter=./integration-tests/${{matrix.folder}}
shell: bash

View File

@@ -2,5 +2,5 @@
. "$(dirname "$0")/_/husky.sh"
pnpm manypkg check
# pnpm lint
pnpm lint
pnpm pretty-quick --staged

1
.npmrc
View File

@@ -1,5 +1,4 @@
save-exact=true
dedupe-peer-dependents=true
strict-peer-dependencies=false
public-hoist-pattern[]=secure-password

View File

@@ -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-423-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-411-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,11 +94,6 @@ 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>
@@ -126,11 +121,9 @@ Your financial contributions help ensure Blitz continues to be developed and mai
<table>
<tr>
<td>
<a aria-label="Flightcontrol" href="https://www.flightcontrol.dev?ref=blitzjs">
<img alt="" src="https://raw.githubusercontent.com/blitz-js/blitz/main/assets/flightcontrol.png" width="400px">
</a>
</td>
</tr>
</table>
@@ -731,22 +724,6 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
<td align="center"><a href="https://maotoramm.com"><img src="https://avatars.githubusercontent.com/u/5174884?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Maotora ᕙ(⇀‸↼‶)ᕗ</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=maotora" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=maotora" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/vitaliemiron"><img src="https://avatars.githubusercontent.com/u/45145592?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vitalie</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=vitaliemiron" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=vitaliemiron" title="Code">💻</a></td>
<td align="center"><a href="https://estevao.org"><img src="https://avatars.githubusercontent.com/u/19409687?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nelson Estevão</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=nelsonmestevao" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=nelsonmestevao" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/dbrxnds"><img src="https://avatars.githubusercontent.com/u/32268383?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=dbrxnds" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=dbrxnds" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=dbrxnds" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/gjmoed"><img src="https://avatars.githubusercontent.com/u/4458993?v=4?s=100" width="100px;" alt=""/><br /><sub><b>G.J. Moed</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=gjmoed" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=gjmoed" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://ghken.com"><img src="https://avatars.githubusercontent.com/u/5304351?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tetsuya Fukuda</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=GHKEN" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=GHKEN" title="Code">💻</a></td>
<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>
<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>
<td align="center"><a href="https://github.com/papsavas"><img src="https://avatars.githubusercontent.com/u/50584606?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Savvas Papageorgiadis</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=papsavas" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=papsavas" title="Code">💻</a></td>
</tr>
</table>

View File

@@ -1,144 +1,5 @@
# next-blitz-auth
## 0.1.1-beta.13
### Patch Changes
- Updated dependencies [86e8eb7c8]
- Updated dependencies [b84c5bedb]
- Updated dependencies [e5cd2c862]
- @blitzjs/rpc@2.0.0-beta.37
- blitz@2.0.0-beta.37
- @blitzjs/auth@2.0.0-beta.37
- @blitzjs/next@2.0.0-beta.37
- @blitzjs/config@2.0.0-beta.37
## 0.1.1-beta.12
### Patch Changes
- Updated dependencies [09e0c68db]
- @blitzjs/auth@2.0.0-beta.36
- blitz@2.0.0-beta.36
- @blitzjs/rpc@2.0.0-beta.36
- @blitzjs/next@2.0.0-beta.36
- @blitzjs/config@2.0.0-beta.36
## 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
- Updated dependencies [30fd61316]
- Updated dependencies [3ddb57072]
- Updated dependencies [fe8c937d2]
- blitz@2.0.0-beta.34
- @blitzjs/auth@2.0.0-beta.34
- @blitzjs/next@2.0.0-beta.34
- @blitzjs/rpc@2.0.0-beta.34
- @blitzjs/config@2.0.0-beta.34
## 0.1.1-beta.9
### Patch Changes
- Updated dependencies [19898a488]
- Updated dependencies [6811eab1a]
- Updated dependencies [022392c12]
- @blitzjs/rpc@2.0.0-beta.33
- blitz@2.0.0-beta.33
- @blitzjs/next@2.0.0-beta.33
- @blitzjs/auth@2.0.0-beta.33
- @blitzjs/config@2.0.0-beta.33
## 0.1.1-beta.8
### Patch Changes
- Updated dependencies [82649f341]
- Updated dependencies [8b01175b4]
- blitz@2.0.0-beta.32
- @blitzjs/next@2.0.0-beta.32
- @blitzjs/auth@2.0.0-beta.32
- @blitzjs/rpc@2.0.0-beta.32
- @blitzjs/config@2.0.0-beta.32
## 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
- Updated dependencies [c5572bec6]
- Updated dependencies [727734955]
- @blitzjs/auth@2.0.0-beta.30
- blitz@2.0.0-beta.30
- @blitzjs/rpc@2.0.0-beta.30
- @blitzjs/next@2.0.0-beta.30
- @blitzjs/config@2.0.0-beta.30
## 0.1.1-beta.5
### Patch Changes
- Updated dependencies [b6b9a1c5a]
- Updated dependencies [61888d1a3]
- @blitzjs/auth@2.0.0-beta.29
- blitz@2.0.0-beta.29
- @blitzjs/rpc@2.0.0-beta.29
- @blitzjs/next@2.0.0-beta.29
- @blitzjs/config@2.0.0-beta.29
## 0.1.1-beta.4
### Patch Changes
- Updated dependencies [5166e5e03]
- Updated dependencies [2533caf48]
- Updated dependencies [c7ac86b85]
- Updated dependencies [1bb3a6556]
- @blitzjs/auth@2.0.0-beta.28
- @blitzjs/next@2.0.0-beta.28
- @blitzjs/rpc@2.0.0-beta.28
- blitz@2.0.0-beta.28
- @blitzjs/config@2.0.0-beta.28
## 0.1.1-beta.3
### Patch Changes
- Updated dependencies [eda14fa8a]
- Updated dependencies [3d004dc41]
- Updated dependencies [29c2b029a]
- @blitzjs/next@2.0.0-beta.27
- @blitzjs/rpc@2.0.0-beta.27
- @blitzjs/auth@2.0.0-beta.27
- blitz@2.0.0-beta.27
- @blitzjs/config@2.0.0-beta.27
## 0.1.1-beta.2
### Patch Changes

View File

@@ -1,4 +1,4 @@
import {useAuthenticatedBlitzContext} from "../../blitz-server"
import {useAuthenticatedBlitzContext} from "@blitzjs/auth"
export default async function RootLayout({children}: {children: React.ReactNode}) {
await useAuthenticatedBlitzContext({

View File

@@ -1,6 +1,6 @@
"use client"
import {LoginForm} from "../../../auth/components/LoginForm"
import {LoginForm} from "../../../src/auth/components/LoginForm"
import {useRouter} from "next/navigation"
import {useSearchParams} from "next/navigation"

View File

@@ -1,7 +1,7 @@
"use client"
import {useRouter} from "next/navigation"
import SignupForm from "../../../auth/components/SignupForm"
import SignupForm from "../../../src/auth/components/SignupForm"
const SignUp = () => {
const router = useRouter()

View File

@@ -1,5 +1,5 @@
import "src/styles/globals.css"
import {BlitzProvider} from "../blitz-client"
import {BlitzProvider} from "../src/blitz-client"
import styles from "src/styles/Home.module.css"
export default function RootLayout({children}: {children: React.ReactNode}) {

View File

@@ -1,14 +1,15 @@
import Link from "next/link"
import styles from "src/styles/Home.module.css"
import Test from "./react-query"
import {invoke, useAuthenticatedBlitzContext} from "../blitz-server"
import getCurrentUser from "../users/queries/getCurrentUser"
import {invoke, useAuthenticatedBlitzContext} from "../src/blitz-server"
import getCurrentUser from "../src/users/queries/getCurrentUser"
export default async function Home() {
await useAuthenticatedBlitzContext({
redirectTo: "/auth/login",
})
const user = await invoke(getCurrentUser, null)
console.log("user", user)
return (
<div
style={{

View File

@@ -1,8 +1,8 @@
"use client"
import {useQuery, useMutation} from "@blitzjs/rpc"
import logout from "../auth/mutations/logout"
import getCurrentUser from "../users/queries/getCurrentUser"
import logout from "../src/auth/mutations/logout"
import getCurrentUser from "../src/users/queries/getCurrentUser"
import {useTransition} from "react"
import {useRouter} from "next/navigation"

View File

@@ -1,6 +1,11 @@
const {withBlitz} = require("@blitzjs/next")
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {
experimental: {
appDir: true,
serverComponentsExternalPackages: ["@prisma/client", "prisma"],
},
}
module.exports = withBlitz(nextConfig)

View File

@@ -1,6 +1,6 @@
{
"name": "next-blitz-auth",
"version": "0.1.1-beta.13",
"version": "0.1.1-beta.2",
"private": true,
"scripts": {
"blitz:dev": "next dev",
@@ -8,21 +8,18 @@
"blitz:start": "next start",
"lint": "next lint"
},
"prisma": {
"schema": "prisma/schema.prisma"
},
"dependencies": {
"@blitzjs/auth": "2.0.0-beta.37",
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/rpc": "2.0.0-beta.37",
"@blitzjs/auth": "workspace:*",
"@blitzjs/config": "workspace:*",
"@blitzjs/next": "workspace:*",
"@blitzjs/rpc": "workspace:*",
"@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.37",
"blitz": "workspace:*",
"flatted": "3.2.7",
"next": "14.0.4",
"next": "13.3.0",
"prisma": "^4.5.0",
"react": "18.2.0",
"react-dom": "18.2.0",

Binary file not shown.

View File

@@ -1,10 +1,11 @@
import db from "../../../prisma"
import {SecurePassword} from "@blitzjs/auth/secure-password"
// import {SecurePassword} from "@blitzjs/auth"
export default async function signup(input: {password: string; email: string}, ctx: any) {
const blitzContext = ctx
const hashedPassword = await SecurePassword.hash((input.password as string) || "test-password")
const email = input.email
// const hashedPassword = await SecurePassword.hash((input.password as string) || "test-password")
const hashedPassword = (input.password as string) || "test-password"
const email = (input.email as string) || "test" + Math.random() + "@test.com"
const user = await db.user.create({
data: {email, hashedPassword},
})

View File

@@ -13,14 +13,7 @@ const {api, getBlitzContext, useAuthenticatedBlitzContext, invoke} = setupBlitzS
storage: PrismaStorage(db),
isAuthorized: simpleRolesIsAuthorized,
}),
RpcServerPlugin({
logging: {
disablelevel: "debug",
},
onInvokeError(error) {
console.log("onInvokeError", error)
},
}),
RpcServerPlugin({}),
],
logger: BlitzLogger({}),
})

View File

@@ -1,4 +1,4 @@
import {rpcHandler} from "@blitzjs/rpc"
import {api} from "../../../blitz-server"
export default api(rpcHandler({onError: (error, ctx) => console.log(error)}))
export default api(rpcHandler({onError: console.log}))

View File

@@ -14,7 +14,6 @@
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"plugins": [
{
"name": "next"

View File

@@ -23,15 +23,15 @@
]
},
"dependencies": {
"@blitzjs/auth": "2.0.0-beta.37",
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/rpc": "2.0.0-beta.37",
"@blitzjs/auth": "workspace:*",
"@blitzjs/config": "workspace:*",
"@blitzjs/next": "workspace:*",
"@blitzjs/rpc": "workspace:*",
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "2.0.0-beta.37",
"next": "14.0.4",
"blitz": "workspace:2.0.0-beta.26",
"next": "13.3.0",
"openid-client": "5.2.1",
"prisma": "4.6.1",
"react": "18.2.0",

View File

@@ -1,4 +1,4 @@
import { rpcHandler } from "@blitzjs/rpc"
import { api } from "src/blitz-server"
export default api(rpcHandler({ onError: (error, ctx) => console.log(error) }))
export default api(rpcHandler({ onError: console.log }))

View File

@@ -2,13 +2,10 @@ const { withNextAuthAdapter } = require("@blitzjs/auth/next-auth")
const { withBlitz } = require("@blitzjs/next")
/**
* @type {import('next').NextConfig}
* @type {import('@blitzjs/next').BlitzConfig}
**/
const config = {
reactStrictMode: true,
blitz: {
resolversDynamicImport: true,
},
}
module.exports = withBlitz(withNextAuthAdapter(config))

View File

@@ -24,15 +24,15 @@
]
},
"dependencies": {
"@blitzjs/auth": "2.0.0-beta.37",
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/rpc": "2.0.0-beta.37",
"@blitzjs/auth": "workspace:*",
"@blitzjs/config": "workspace:*",
"@blitzjs/next": "workspace:*",
"@blitzjs/rpc": "workspace:*",
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "2.0.0-beta.37",
"next": "14.0.4",
"blitz": "workspace:2.0.0-beta.26",
"next": "13.3.0",
"next-auth": "4.18.7",
"prisma": "4.6.1",
"react": "18.2.0",

View File

@@ -10,7 +10,6 @@ type SignupFormProps = {
export const SignupForm = (props: SignupFormProps) => {
const [signupMutation] = useMutation(signup)
return (
<div>
<h1>Create an Account</h1>

View File

@@ -1,4 +1,5 @@
import db from "db"
import { SecurePassword } from "@blitzjs/auth/secure-password"
import { Role } from "types"
export default async function signup(input, ctx) {

View File

@@ -1,8 +1,9 @@
import type { BlitzCliConfig } from "blitz"
import { BlitzLogger } from "blitz"
import { setupBlitzServer } from "@blitzjs/next"
import { AuthServerPlugin, PrismaStorage, simpleRolesIsAuthorized } from "@blitzjs/auth"
import { AuthServerPlugin, PrismaStorage } from "@blitzjs/auth"
import db from "db"
import { simpleRolesIsAuthorized } from "@blitzjs/auth"
import { BlitzLogger } from "blitz"
export const cliConfig: BlitzCliConfig = {
customTemplates: "src/templates",
@@ -26,9 +27,6 @@ const { gSSP, gSP, api } = setupBlitzServer({
isAuthorized: simpleRolesIsAuthorized,
}),
],
formatError: (error) => {
return new Error("Formatted error" + error.message)
},
logger: BlitzLogger({}),
})

View File

@@ -1,6 +1,5 @@
import { api } from "src/blitz-server"
import GithubProvider from "next-auth/providers/github"
import EmailProvider from "next-auth/providers/email"
import { NextAuthAdapter, BlitzNextAuthOptions } from "@blitzjs/auth/next-auth"
import db, { User } from "db"
import { Role } from "types"
@@ -11,10 +10,6 @@ const providers = [
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
}),
EmailProvider({
from: process.env.GITHUB_CLIENT_ID as string,
server: process.env.GITHUB_CLIENT_SECRET as string,
}),
]
export default api(

View File

@@ -1,16 +1,4 @@
import { rpcHandler } from "@blitzjs/rpc"
import { api } from "src/blitz-server"
export default api(
rpcHandler({
onError: (error, ctx) => console.log(error),
formatError: (error, ctx) => {
error.message = `FormatError handler: ${error.message}`
return error
},
// logging: {
// verbose: true,
// blockList: ["/getCurrentUser"],
// },
})
)
export default api(rpcHandler({ onError: console.log }))

View File

@@ -1,3 +1,4 @@
import { useEffect, useState } from "react"
import Layout from "src/core/layouts/Layout"
import { LabeledTextField } from "src/core/components/LabeledTextField"
import { Form, FORM_ERROR } from "src/core/components/Form"

View File

@@ -38,13 +38,13 @@ const UserInfo = () => {
} else {
return (
<>
<Link href={"/auth/signup"} className={styles.button}>
<Link href={Routes.SignupPage()} className={styles.button}>
<strong>Sign Up</strong>
</Link>
<Link href={"/auth/login"} className={styles.loginButton}>
<Link href={Routes.LoginPage()} className={styles.loginButton}>
<strong>Login</strong>
</Link>
<Link href="/api/auth/github/login" passHref legacyBehavior>
<Link href="/api/auth/github/login" passHref>
<a className="button small">
<strong>Sign in with GitHub</strong>
</a>
@@ -99,7 +99,7 @@ const Home: BlitzPage = () => {
<div className={styles.code}>
<span>1</span>
<pre>
<code>blitz generate all project name:string</code>
<code>blitz generate all project</code>
</pre>
</div>

View File

@@ -0,0 +1,32 @@
/**
* @vitest-environment jsdom
*/
import { expect, vi, test } from "vitest"
import { render } from "test/utils"
import Home from "../src/pages/index"
vi.mock("public/logo.png", () => ({
default: { src: "/logo.png" },
}))
test.skip("renders blitz documentation link", () => {
// This is an example of how to ensure a specific item is in the document
// But it's disabled by default (by test.skip) so the test doesn't fail
// when you remove the default content from the page
// This is an example on how to mock api hooks when testing
vi.mock("src/users/hooks/useCurrentUser", () => ({
useCurrentUser: () => ({
id: 1,
name: "User",
email: "user@email.com",
role: "user",
}),
}))
const { getByText } = render(<Home />)
const linkElement = getByText(/Blitz Docs/i)
expect(linkElement).toBeInTheDocument()
})

View File

@@ -0,0 +1,3 @@
import "@testing-library/jest-dom"
export {}

View File

@@ -0,0 +1,106 @@
import { vi } from "vitest"
import { render as defaultRender } from "@testing-library/react"
import { renderHook as defaultRenderHook } from "@testing-library/react-hooks"
import { NextRouter } from "next/router"
import { BlitzProvider, RouterContext } from "@blitzjs/next"
import { QueryClient } from "@blitzjs/rpc"
export * from "@testing-library/react"
// --------------------------------------------------------------------------------
// This file customizes the render() and renderHook() test functions provided
// by React testing library. It adds a router context wrapper with a mocked router.
//
// You should always import `render` and `renderHook` from this file
//
// This is the place to add any other context providers you need while testing.
// --------------------------------------------------------------------------------
// --------------------------------------------------
// render()
// --------------------------------------------------
// Override the default test render with our own
//
// You can override the router mock like this:
//
// const { baseElement } = render(<MyComponent />, {
// router: { pathname: '/my-custom-pathname' },
// });
// --------------------------------------------------
const queryClient = new QueryClient()
export function render(
ui: RenderUI,
{ wrapper, router, dehydratedState, ...options }: RenderOptions = {}
) {
if (!wrapper) {
// Add a default context wrapper if one isn't supplied from the test
wrapper = ({ children }: { children: React.ReactNode }) => (
<BlitzProvider dehydratedState={dehydratedState} client={queryClient}>
<RouterContext.Provider value={{ ...mockRouter, ...router }}>
{children}
</RouterContext.Provider>
</BlitzProvider>
)
}
return defaultRender(ui, { wrapper, ...options })
}
// --------------------------------------------------
// renderHook()
// --------------------------------------------------
// Override the default test renderHook with our own
//
// You can override the router mock like this:
//
// const result = renderHook(() => myHook(), {
// router: { pathname: '/my-custom-pathname' },
// });
// --------------------------------------------------
export function renderHook(
hook: RenderHook,
{ wrapper, router, dehydratedState, ...options }: RenderOptions = {}
) {
if (!wrapper) {
// Add a default context wrapper if one isn't supplied from the test
wrapper = ({ children }: { children: React.ReactNode }) => (
<BlitzProvider dehydratedState={dehydratedState} client={queryClient}>
<RouterContext.Provider value={{ ...mockRouter, ...router }}>
{children}
</RouterContext.Provider>
</BlitzProvider>
)
}
return defaultRenderHook(hook, { wrapper, ...options })
}
export const mockRouter: NextRouter = {
basePath: "",
pathname: "/",
route: "/",
asPath: "/",
query: {},
isReady: true,
isLocaleDomain: false,
forward: vi.fn(),
prefetch: vi.fn(),
isPreview: false,
push: vi.fn(),
replace: vi.fn(),
reload: vi.fn(),
back: vi.fn(),
beforePopState: vi.fn(),
events: {
on: vi.fn(),
off: vi.fn(),
emit: vi.fn(),
},
isFallback: false,
}
type DefaultParams = Parameters<typeof defaultRender>
type RenderUI = DefaultParams[0]
type RenderOptions = DefaultParams[1] & { router?: Partial<NextRouter>; dehydratedState?: unknown }
type DefaultHookParams = Parameters<typeof defaultRenderHook>
type RenderHook = DefaultHookParams[0]

View File

@@ -16,17 +16,17 @@
"schema": "./db/schema.prisma"
},
"dependencies": {
"@blitzjs/auth": "2.0.0-beta.37",
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/rpc": "2.0.0-beta.37",
"@blitzjs/auth": "workspace:*",
"@blitzjs/config": "workspace:*",
"@blitzjs/next": "workspace:*",
"@blitzjs/rpc": "workspace:*",
"@prisma/client": "4.6.1",
"@types/jest": "29.2.2",
"@types/passport-twitter": "1.0.37",
"blitz": "2.0.0-beta.37",
"blitz": "workspace:*",
"jest": "29.3.0",
"jest-environment-jsdom": "29.3.0",
"next": "14.0.4",
"next": "13.3.0",
"passport-mock-strategy": "2.0.0",
"passport-twitter": "1.0.4",
"prisma": "4.6.1",

View File

@@ -13,6 +13,7 @@ const {gSSP, gSP, api} = setupBlitzServer({
}),
],
logger: BlitzLogger({
colorizePrettyLogs: true,
prefix: ["[blitz]>>>>>"],
}),
})

View File

@@ -1,4 +1,4 @@
import {rpcHandler} from "@blitzjs/rpc"
import {api} from "src/blitz-server"
export default api(rpcHandler({onError: (error, ctx) => console.log(error)}))
export default api(rpcHandler({onError: console.log}))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

61
flake.lock generated
View File

@@ -1,61 +0,0 @@
{
"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
}

View File

@@ -1,39 +0,0 @@
{
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"
'';
};
};
});
}

View File

@@ -17,16 +17,16 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "2.0.0-beta.37",
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/rpc": "2.0.0-beta.37",
"@blitzjs/auth": "workspace:2.0.0-beta.26",
"@blitzjs/config": "workspace:2.0.0-beta.26",
"@blitzjs/next": "workspace:2.0.0-beta.26",
"@blitzjs/rpc": "workspace:2.0.0-beta.26",
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "2.0.0-beta.37",
"blitz": "workspace:2.0.0-beta.26",
"delay": "5.0.0",
"next": "14.0.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -1,10 +1,6 @@
import {Ctx} from "blitz"
import db from "../../db"
const getRand = () => Math.random().toString(36).substring(7)
export default async function login(_: any, ctx: Ctx) {
const user = await db.user.create({data: {email: `${getRand()}@example.com`}})
await ctx.session.$create({userId: user.id, role: "USER"})
await ctx.session.$create({userId: 1, role: "USER"})
return true
}

View File

@@ -1,4 +1,4 @@
import {rpcHandler} from "@blitzjs/rpc"
import {api} from "../../../blitz-server"
export default api(rpcHandler({onError: (error, ctx) => console.log(error)}))
export default api(rpcHandler({onError: console.log}))

View File

@@ -1,37 +0,0 @@
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

View File

@@ -1,37 +0,0 @@
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

View File

@@ -1,37 +0,0 @@
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

View File

@@ -1,37 +0,0 @@
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

View File

@@ -1,11 +1,11 @@
import {afterAll, beforeAll, describe, expect, it} from "vitest"
import {describe, it, expect, beforeAll, afterAll} from "vitest"
import {
blitzBuild,
blitzLaunchApp,
blitzStart,
findPort,
killApp,
findPort,
runBlitzCommand,
blitzLaunchApp,
blitzBuild,
blitzStart,
waitFor,
} from "../../utils/next-test-utils"
import webdriver from "../../utils/next-webdriver"
@@ -13,10 +13,37 @@ import webdriver from "../../utils/next-webdriver"
let app: any
let appPort: number
let mode: "dev" | "server" = "dev"
const runTests = () => {
describe("Auth", () => {
/* TODO - Add a non flaky Integration Test for custom plugin
describe("custom plugin", () => {
it("custom plugin - events", async () => {
const browser = await webdriver(appPort, "/custom-plugin")
let text = await browser.elementByCss("#page").text()
await waitFor(250)
text = await browser.elementByCss("#page").text()
expect(text).toBe("Custom plugin Session Created")
await waitFor(3000)
text = await browser.elementByCss("#page").text()
expect(text).toBe("Custom plugin RPC Error")
if (browser) {
await browser.close()
}
})
it("custom plugin - middleware", async () => {
const browser = await webdriver(appPort, "/custom-plugin")
await waitFor(100)
let text = await browser.elementByCss("#before-req").text()
expect(text).toBe("customHeaderValue")
await waitFor(2000)
text = await browser.elementByCss("#before-res").text()
expect(text).toBe("55")
if (browser) {
await browser.close()
}
})
})
*/
describe("unauthenticated", () => {
it("should render result for open query", async () => {
const browser = await webdriver(appPort, "/noauth-query")
@@ -31,11 +58,7 @@ const runTests = () => {
const browser = await webdriver(appPort, "/authenticated-query")
await browser.waitForElementByCss("#error")
let text = await browser.elementByCss("#error").text()
if (mode === "server") {
expect(text).toMatch(/AuthenticationError/)
} else {
expect(text).toContain("Error")
}
expect(text).toMatch(/AuthenticationError/)
if (browser) await browser.close()
})
@@ -47,14 +70,6 @@ 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,36 +120,18 @@ const runTests = () => {
await waitFor(200)
await browser.waitForElementByCss("#error")
text = await browser.elementByCss("#error").text()
if (mode === "server") {
expect(text).toMatch(/AuthenticationError/)
} else {
expect(text).toContain("Error")
}
if (browser) await browser.close()
})
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()
})
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")
// Login
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-redirect"`)
await browser.waitForElementByCss("#content")
let text = await browser.elementByCss("#content").text()
expect(text).toMatch(/authenticated-basic-result/)
@@ -145,26 +142,14 @@ const runTests = () => {
if (browser) await browser.close()
})
it("Page.authenticate = {role: 'custom', redirect: 'url'} should work ", async () => {
it("Layout.authenticate = {redirect} should work ", async () => {
// Login
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()
})
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.eval(`window.location = "/layout-authenticate-redirect"`)
await browser.waitForElementByCss("#content")
let text = await browser.elementByCss("#content").text()
expect(text).toMatch(/authenticated-basic-result/)
@@ -277,7 +262,6 @@ const runTests = () => {
describe("Auth Tests", () => {
describe("dev mode", () => {
beforeAll(async () => {
mode = "dev"
try {
await runBlitzCommand(["prisma", "migrate", "reset", "--force"])
appPort = await findPort()
@@ -292,7 +276,6 @@ describe("Auth Tests", () => {
describe("server mode", () => {
beforeAll(async () => {
mode = "server"
try {
await runBlitzCommand(["prisma", "generate"])
await runBlitzCommand(["prisma", "migrate", "deploy"])

View File

@@ -17,13 +17,13 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "2.0.0-beta.37",
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/auth": "workspace:2.0.0-beta.26",
"@blitzjs/config": "workspace:2.0.0-beta.26",
"@blitzjs/next": "workspace:2.0.0-beta.26",
"@prisma/client": "4.6.1",
"blitz": "2.0.0-beta.37",
"blitz": "workspace:2.0.0-beta.26",
"lowdb": "3.0.0",
"next": "14.0.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -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) void browser.close()
if (browser) browser.close()
},
5000 * 60 * 2,
)

View File

@@ -16,19 +16,19 @@
"schema": "db/schema.prisma"
},
"dependencies": {
"@blitzjs/auth": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/rpc": "2.0.0-beta.37",
"@blitzjs/auth": "workspace:2.0.0-beta.26",
"@blitzjs/next": "workspace:2.0.0-beta.26",
"@blitzjs/rpc": "workspace:2.0.0-beta.26",
"@prisma/client": "4.6.1",
"blitz": "2.0.0-beta.37",
"blitz": "workspace:2.0.0-beta.26",
"lowdb": "3.0.0",
"next": "14.0.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/config": "workspace:2.0.0-beta.26",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",

View File

@@ -1,4 +1,4 @@
import {rpcHandler} from "@blitzjs/rpc"
import {api} from "../../../app/blitz-server"
export default api(rpcHandler({onError: (error, ctx) => console.log(error)}))
export default api(rpcHandler({onError: console.log}))

View File

@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@@ -11,11 +11,11 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
},
"dependencies": {
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/rpc": "2.0.0-beta.37",
"blitz": "2.0.0-beta.37",
"next": "14.0.4",
"@blitzjs/config": "workspace:2.0.0-beta.26",
"@blitzjs/next": "workspace:2.0.0-beta.26",
"@blitzjs/rpc": "workspace:2.0.0-beta.26",
"blitz": "workspace:2.0.0-beta.26",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},

View File

@@ -1,3 +1,3 @@
import {rpcHandler} from "@blitzjs/rpc"
export default rpcHandler({onError: (error, ctx) => console.log(error)})
export default rpcHandler({onError: console.log})

View File

@@ -1,16 +1,10 @@
{
"extends": "@blitzjs/config/tsconfig.nextjs.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "types", ".next/types/**/*.ts"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "types"],
"compilerOptions": {
"paths": {
"react": ["./node_modules/@types/react"]
},
"plugins": [
{
"name": "next"
}
],
"strictNullChecks": true
}
},
"exclude": ["node_modules"],
"baseUrl": "."

View File

@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@@ -1,2 +1,6 @@
const {withBlitz} = require("@blitzjs/next")
module.exports = withBlitz({})
module.exports = withBlitz({
experimental: {
appDir: true,
},
})

View File

@@ -17,14 +17,14 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "2.0.0-beta.37",
"@blitzjs/config": "2.0.0-beta.37",
"@blitzjs/next": "2.0.0-beta.37",
"@blitzjs/rpc": "2.0.0-beta.37",
"@blitzjs/auth": "workspace:2.0.0-beta.26",
"@blitzjs/config": "workspace:2.0.0-beta.26",
"@blitzjs/next": "workspace:2.0.0-beta.26",
"@blitzjs/rpc": "workspace:2.0.0-beta.26",
"@prisma/client": "4.6.1",
"blitz": "2.0.0-beta.37",
"blitz": "workspace:2.0.0-beta.26",
"lowdb": "3.0.0",
"next": "14.0.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -1,4 +1,4 @@
import {rpcHandler} from "@blitzjs/rpc"
import {api} from "../../../src/blitz-server"
export default api(rpcHandler({onError: (error, ctx) => console.log(error)}))
export default api(rpcHandler({onError: console.log}))

View File

@@ -6,7 +6,7 @@ import {BlitzRpcPlugin} from "@blitzjs/rpc"
export const {withBlitz, useSession, queryClient, BlitzProvider} = setupBlitzClient({
plugins: [
AuthClientPlugin({
cookiePrefix: "auth-tests-cookie-prefix",
cookiePrefix: "web-cookie-prefix",
}),
BlitzRpcPlugin({}),
],

View File

@@ -1,6 +1,13 @@
import {afterAll, beforeAll, describe, expect, it} from "vitest"
import {describe, it, expect, beforeAll, afterAll} from "vitest"
import waitPort from "wait-port"
import {blitzLaunchApp, findPort, killApp, runBlitzCommand} from "../../utils/next-test-utils"
import {
killApp,
findPort,
runBlitzCommand,
blitzLaunchApp,
blitzBuild,
blitzStart,
} from "../../utils/next-test-utils"
import webdriver from "../../utils/next-webdriver"
import fetch from "node-fetch"
@@ -36,7 +43,7 @@ const runTests = (mode?: string) => {
const browser = await webdriver(appPort, "/authenticated-client")
let errorMsg = await browser.elementById(`error`).text()
expect(errorMsg).toMatch(/Error: You are not authenticated/)
if (browser) await browser.close()
if (browser) browser.close()
},
5000 * 60 * 2,
)
@@ -48,7 +55,7 @@ const runTests = (mode?: string) => {
const browser = await webdriver(appPort, "/authenticated-server")
let errorMsg = await browser.elementById(`error`).text()
expect(errorMsg).toMatch(/Error: You are not authenticated/)
if (browser) await browser.close()
if (browser) browser.close()
},
5000 * 60 * 2,
)

View File

@@ -9,8 +9,7 @@
{
"name": "next"
}
],
"strictNullChecks": true
]
},
"exclude": ["node_modules"],
"baseUrl": "."

Some files were not shown because too many files have changed in this diff Show More