Releases: blitz-js/blitz
v2.0.0-beta.32
🐞 Patches
- 82649f3: Upgrade tslog to
4.9.0
.
This due a tslog issue that causes tslog to crash when attempting to log an error whose constructor expects more than one argument. - 8b01175: Updated
useAuthenticatedBlitzContext
to now returnAuthenticatedCtx
- 47c6b62: Update examples of generate all in docs to include one column in model.
v2.0.0-beta.31
v2.0.0-beta.30
🐞 Patches
- c5572be: blitz-auth: Fix webpack from following next-auth
🚀 New Features
-
7277349: ### Now we can configure Blitz RPC in the following way,
In your
[[...blitz]].ts
api file you can see the following settingslogging?: { /** * 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" }
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:
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 theblockList
v2.0.0-beta.29
🐞 Patches
blitz
- b6b9a1c: Fix Next-Auth integration:
Unable to use next-auth with provider: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]
- 61888d1: Fix log formatting to not show the path of blitz rpc
@blitzjs/auth
- b6b9a1c: Fix Next-Auth integration:
Unable to use next-auth with provider: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]
@blitzjs/generator
- 7aef610: Make Next.js version stick to 13.4.5 when generating a new app
v2.0.0-beta.28
🚀 Features/Improvements
@blitzjs/auth
-
1bb3a65: Stop exporting
useAuthenticatedBlitzContext
from@blitzjs/auth
this must be imported fromapp/blitz-server.ts
file in order to work correctly -
5166e5e: (feat) upgrade tslog to v4.8.2
@blitzjs/rpc
-
c7ac86b: Fixes enormous memory consumption of the dev server by changing the default import strategy to
require
instead ofimport
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:
/** * @type {import('@blitzjs/next').BlitzConfig} **/ const config = { blitz: { resolversDynamicImport: true, }, }
When
resolversDynamicImport
is set totrue
, the import strategy will be "import" instead of "require".On Vercel
If you are using Vercel,
resolversDynamicImport
will be set totrue
by default, since it is better for the separate chunks to be create for serverless lambdas.
🐞 Patches
blitz
- 5166e5e: (feat) upgrade tslog to v4.8.2
@blitzjs/next
- 5166e5e: (feat) upgrade tslog to v4.8.2
@blitzjs/rpc
-
5166e5e: (feat) upgrade tslog to v4.8.2
-
2533caf: Fix return type of
requestMiddlewares
inRpcServerPlugin
@blitzjs/generator
- 5166e5e: (feat) upgrade tslog to v4.8.2
🎉 New Contributors
Full Changelog: v2.0.0-beta.27...v2.0.0-beta.28
v2.0.0-beta.27
🚀 Features/Improvements
@blitzjs/next
- eda14fa: Add ability to format the error on the server before returning it to the client.
- 3d004dc: Fix the DYNAMIC_SERVER_USAGE error for Next.js 13.3.1+
@blitzjs/rpc
- eda14fa: Add ability to format the error on the server before returning it to the client.
🐞 Patches
@blitzjs/auth
- 29c2b02: Fix: Add missing entry to expose next-auth adapter in Blitz Auth
@blitzjs/generator
- d814c2d: fix: add missing key prop to LabelSelectField
v2.0.0-beta.26
v2.0.0-beta.25
🐞 Patches
- f84d77a: Fix return type of the
invoke
method from returning type function to return the type of resolved data
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