Releases: blitz-js/blitz
v2.0.0-beta.24
Blitz Toolkit Beta v24
Support for Next 13
Blitz does not require any breaking changes with the major upgrade of Next 12
➔ Next 13
for usage with the pages directory. You can even continue to use the old blitz layout with all your files in app. But you'll need to rename that directory if you want to use the new Next.js app router.
Read More about usage of Blitz Toolkit with Next 13
cadefb8 & 37aeaa7: Support for Next 13 App directory (beta)
From this release, the blitz toolkit will work out of the box with react server components.
Here are the highlights:
- New Blitz Auth Function
getBlitzCtx
to access the auth context in server components - New Blitz Auth Function
useAuthenticatedBlitzContext
to provide authorization utilities for server components - New wrapper
BlitzProvider
to be wrapped in theRootLayout
present in the (root)/layout.ts file. - Overload the
invoke
method to work when called inside a React Server Component
Patch for Next 13.2 Suspense Error
acc07ce: This updates the suspense patch to work with Next.js 13.2+. Hopefully, soon we can stop patching once Next.js catches up with all the other frameworks and properly exposes the onRecoverableError react hook.
🔨 Breaking Changes
Blitz Auth
9529dbd: Introducing a new import path for the Blitz wrapper SecurePassword
to fully decouple the library from @blitzjs/auth
Change to be made
-import {SecurePassword} from "@blitzjs/auth"
+import {SecurePassword} from "@blitzjs/auth/secure-password"
Automatic Upgrade
Automatically upgrade using codemod
(Make sure to git commit before running this command to avoid losing changes)
npx @blitzjs/codemod secure-password
🚀 New Features
6f18cbd: Next Auth Adapter
Blitz now provides an adapter that allows you to use any NextAuth Provider with Blitz session management in any Nextjs application.
Blitz session management gives you a lot more flexibility & control than NextAuth does.
Usage
// src/pages/api/auth/[...nextauth].ts
import { api } from "src/blitz-server"
import { NextAuthAdapter } from "@blitzjs/auth/next-auth"
import GithubProvider from "next-auth/providers/github"
import db, { User } from "db"
import { Role } from "types"
// Has to be defined separately for `profile` to be correctly typed below
const providers = [
GithubProvider({
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
}),
]
export default api(
NextAuthAdapter({
successRedirectUrl: "/",
errorRedirectUrl: "/error",
providers,
callback: async (user, account, profile, session) => {
...
},
})
)
ea7561b: Blitz Generator Overhaul
The Blitz generator has been completely overhauled to be more flexible, customizable and easier to use.
Credits
The comes as a cumulative effort from the work started by @maastrich in #2134 then continued and enhanced by @roesh in #2679 and finally fixed and polished by @siddhsuresh in #3869 .
Changes/Features
- Model Fields can now be specified in the generator command
> blitz generate model [fieldName]:[type]:[attribute]
Usage
> blitz generate all project name
> blitz generate all project name:string description:string? active:boolean
# with parent
> blitz generate model task \
name \
completed:boolean:default=false \
belongsTo:project?
-
The generate command can also be run multiple times to add more fields to the model. The generator will then mention the changes that will be made to the model and ask for confirmation before proceeding.
-
ea7561b: New
schema.ts
file will be generated with the requiredzod
schemas that can be used independently with the mutations, queries and components.
This fixes the problem of not being able to import the schemas defined in the mutations due to the RPC compilation
Security Fixes
6e88a84: Fixed security vulnerabilities in passport-adapter by upgrading passport and jsonwebtoken.
Testing Utility Fixes
cadefb8: Fix failing tests due to the error NextRouter is not mounted in next 13 blitz apps.
Template Fixes
- e228ba5: Fix a type error in reset password templates.
- 430f0b5: For new applications, update Prisma (prisma and @prisma/client) from 4.6.0 to 4.6.1 to solve
enum
issue with postgresql Prisma 4.6.0 drops and recreates enum field when runningdb
push even if the field has not changed prisma/prisma#16180
Credits
This release was made possible by the following contributors:
@flybayer, @siddhsuresh, @noxify, @tordans, @Vandivier, @exKAZUu
v2.0.0-beta.23
🔥 Breaking Changes
@blitzjs/auth
-
42a2cf9: BREAKING CHANGE: secure-password is now an
optional peerDependency
, if you are usingSecurePassword
api, you need to now installsecure-password
in your application.npm install secure-password
This helps users who do not use SecurePassword from having native package build issues.
🐞 Patches
blitz
- c3c7897: Updates internal functions and tests to support blitz apps that run tests with vitest
@blitzjs/rpc
- c3c7897: Updates internal functions and tests to support blitz apps that run tests with vitest
@blitzjs/generator
- cb63a0e: Guard
blitz g
input via an allow-list of characters; throw if unwanted characters are found. Prevents to break the blitz command by accident (#4021). - 6ec020c: Remove useEffect from reset password templates.
- d316d0d: Update all links to follow Next 13 format without a child anchor tag.
- 79c5e86: Add missing Layout.tsx for generated mimimalapp
v2.0.0-beta.22
🚀 Features/Improvements
blitz
- 8aa22a0: Add
currentPassword
to the default fields that are masked in the logger
@blitzjs/rpc
- 2703618: Change rpc route basepath to be one folder higher when using
includeRPC
in monorepos
@blitzjs/generator
- 7abfb90: Redesign the index page for newly generated blitz projects
🐞 Patches
blitz
- 989691e: Use
src
instead ofapp
folder forblitz generate custom-template
@blitzjs/auth
- 145d5a0: Fix failed
localStorage
access to not crash the application
@blitzjs/generator
- bcef81f: Fix missing
MockRouter
prop in test utils
v2.0.0-beta.21
🚀 Features/Improvements
blitz
- d692b4c: Fix suspense error
codegen
patch fornextjs
versions 13-13.0.6 - 10f98c6: Add an
href
property to the generated route manifest that will return a string of the pathname and include query params. - d5b8faa: Add regex to support inline and non-inline codebase and proper next.js package version check
@blitzjs/auth
- 82e8b64: Fixes adding
authError
query param in Passport adapter.
@blitzjs/next
- 10f98c6: Add an
href
property to the generated route manifest that will return a string of the pathname and include query params.
@blitzjs/rpc
- d692b4c: Fix suspense error
codegen
patch fornextjs
versions 13-13.0.6 - 0025856: Support full
api
of tanstackinvalidateQueries
🐞 Patches
@blitzjs/generator
- 77b7da0: Remove husky pre-push hook & update pre-commit hook to only run prettier
v2.0.0-beta.20
🚀 Features/Improvements
blitz
- 74a14b7: When db.$reset() rejects, reject with an Error object
- 6ece096: Decoupled Blitz RPC from Blitz Auth to allow independent use.
- a059627: Fix blitz install for recipes that use the path helper to check if ./src/pages directory is available, otherwise use ./pages
@blitzjs/auth
- 6ece096: Decoupled Blitz RPC from Blitz Auth to allow independent use.
- 03bad31: fix Cannot read properties of null (reading 'isReady') for pnpm/yarn v3
@blitzjs/next
- 6ece096: Decoupled Blitz RPC from Blitz Auth to allow independent use.
- 03bad31: fix Cannot read properties of null (reading 'isReady') for pnpm/yarn v3
@blitzjs/rpc
- 6ece096: Decoupled Blitz RPC from Blitz Auth to allow independent use.
- 03bad31: fix Cannot read properties of null (reading 'isReady') for pnpm/yarn v3
- 8c247e2: Switch from jest to vitest in new app templates
- 650a157: fix: allow
GET
requests withoutparams
andmeta
keys
🐞 Patches
@blitzjs/generator
- 8c247e2: Switch from jest to vitest in new app templates
v2.0.0-beta.19
🚀 Features/Improvements
blitz
- 942536d: update paginate.ts, return more params for more complex pagination control
- c1e0040: transpile packages to es2015 to support older browsers
- 696f48c: some providers need extra attributes, update for wrapAppWithProvider
- a6f32d1: Export enhancePrisma for client again (Fixes #3964)
- c126b81: fix for when using "blitz install" inside recipe with addRunCommandStep causes hangs up
- b33db08: Fix ambigious class warning log & upgrade superjson from 1.9.1 to 1.11.0
@blitzjs/auth
- c1e0040: transpile packages to es2015 to support older browsers
@blitzjs/next
- c1e0040: transpile packages to es2015 to support older browsers
- b33db08: Fix ambigious class warning log & upgrade superjson from 1.9.1 to 1.11.0
@blitzjs/rpc
- c1e0040: transpile packages to es2015 to support older browsers
- b493c93: fix resolverPath:root and make it work with monorepo resolver
- b33db08: Fix ambigious class warning log & upgrade superjson from 1.9.1 to 1.11.0
🐞 Patches
@blitzjs/generator
- b80c3d9: Fix form paths when running blitz generate all
v2.0.0-beta.18
v2.0.0-beta.17
🐞 Patches
blitz
- 5ea068b: Check if blitz-server & blitz-client is located in either the app or src directory and return the correct path for blitz recipes.
- 8b4bf99: Update dependencies
- 88caa18: Patch next13 for suspense error
@blitzjs/auth
- 8b4bf99: Update dependencies
- 97469a1: Added option
role
toauthenticate
property ofBlitzPage
to authenticate page with respect to the role of the user.String
value orArray
of strings can be passed to authorize users.
@blitzjs/next
- 8b4bf99: Update dependencies
- 97469a1: Added option
role
toauthenticate
property ofBlitzPage
to authenticate page with respect to the role of the user.String
value orArray
of strings can be passed to authorize users.
@blitzjs/rpc
- 8b4bf99: Update dependencies
@blitzjs/generator
v2.0.0-beta.16
🚀 Features/Improvements
@blitzjs/auth
- 55a43ce: maybe fix anon session CSRF issue + add ability to customize anon session expiry time
@blitzjs/next
- 11b548e: Change setupBlitzServer logger config to be optional. Will default to BlitzLogger
@blitzjs/rpc
- 55a43ce: maybe fix anon session CSRF issue + add ability to customize anon session expiry time
- ceb7db2: Add an opt-in GET request support to RPC specification by exporting a
config
object that has thehttpMethod
property.
fromquery
files.
🐞 Patches
blitz
- 1569bd5: Upgrade
tslog
to the latest version - ceb7db2: Add an opt-in GET request support to RPC specification by exporting a
config
object that has thehttpMethod
property.
fromquery
files. - 8e5903c: Fix
cannot find module db error
in JavaScript template. Replace requiring the config usingesbuild
with parsing usingjscodeshift
to get thecliConfig
values. Added logic to find theblitz-server
file insrc
directory - 4545912: Include resolvers in
src
directory in blitz console
@blitzjs/generator
v2.0.0-beta.15
🐞 Patches
blitz
- 1b798d9: Fix
useSession
hook by exportingenhancePrisma
from the server entry point instead of server