Releases: wasp-lang/wasp
v0.15.1
v0.15.0
0.15.0
🎉 New Features and improvements
Write your app config in TypeScript (preview feature)
Wasp 0.15.0 ships a preview feature that lets you define your app in main.wasp.ts
using TypeScript instead of in main.wasp
using the Wasp DSL.
So, instead of this:
app TodoApp {
wasp: {
version: "^0.15.0"
},
title: "TodoApp",
auth: {
userEntity: User,
methods: {
usernameAndPassword: {}
},
onAuthFailedRedirectTo: "/login"
}
}
route RootRoute { path: "/", to: MainPage }
page MainPage {
authRequired: true,
component: import { MainPage } from "@src/MainPage"
}
You can now write this:
improt { App } from 'wasp-config'
const app = new App('TodoApp', {
wasp: {
version: '^0.15.0',
},
title: 'TodoApp',
})
app.auth({
userEntity: 'User',
methods: {
usernameAndPassword: {}
},
onAuthFailedRedirectTo: '/login',
})
const mainPage = app.page('MainPage', {
authRequired: true,
component: { import: 'MainPage', from: '@src/MainPage' },
})
app.route('RootRoute', { path: '/', to: mainPage })
To learn more about this feature and how to activate it, check out the Wasp TS config docs.
⚠️ Breaking Changes
There are some breaking changes with React Router 6 which will require you to update your code.
Also, the new version of Prisma may cause breaking changes depending on how you're using it.
Read more about breaking changes in the migration guide: https://wasp-lang.dev/docs/migration-guides/migrate-from-0-14-to-0-15 .
🐞 Bug fixes
- Allow setting a custom server URL when deploying to Fly.io. (by @Case-E)
- If the user uses native DB types for the
userEntity
, Wasp will use them correctly.
🔧 Small improvements
- Upgrade to the latest Prisma version which makes Wasp faster!
- Upgrade to the latest React Router version which sets us up for some cool new features in the future.
- Enable users to use Mailgun's EU region by setting the
MAILGUN_API_URL
env variable. - Validate
userEntity
ID field's@default
attribute.
Community contributions by @Case-E @therumbler
v0.15.0-rc2
v0.15.0-rc1
Pre-release docs: https://wasp-docs-on-main.pages.dev/docs
v0.14.2
Updated GPT models used in Wasp AI to latest models, since 3.5 are getting deprecated.
Default model used is now 4o (instead of old 4 + 3.5-turbo combo).
v0.14.1
🎉 New Features
- Wasp now supports
onBeforeLogin
andonAfterLogin
auth hooks! You can use these hooks to run custom logic before and after a user logs in. For example, you can use theonBeforeLogin
hook to check if the user is allowed to log in. - OAuth refresh tokens are here. If the OAuth provider supports refresh tokens, you'll be able to use them to refresh the access token when it expires. This is useful for using OAuth provider APIs in the background e.g. accessing user's calendar events.
⚠️ Breaking Changes
- To make the API consistent across different auth hooks, we change how the
onBeforeOAuthRedirect
hook receives theuniqueRequestId
value tooauth.uniqueRequestId
.
🐞 Bug fixes
- Prisma file parser now allows using empty arrays as default values.
🔧 Small improvements
- Replace
oslo/password
with directly using@node-rs/argon2
- We now use
websocket
transport for the WebSocket client to avoid issues when deploying the server behind a load balancer.
Community contributions by @rubyisrust @santolucito @sezercik @LLxD!
v0.14.1-rc2
Update 0.14.0 docs
v0.14.1-rc1
Update docs
v0.14.0
0.14.0 (2024-07-17)
🎉 New Features
-
Simplified Auth User API: Introduced a simpler API for accessing user auth fields (for example
username
,email
,isEmailVerified
) directly on theuser
object, eliminating the need for helper functions. -
Improved the API for calling Operations (Queries and Actions) directly on both the client and the server.
-
Improved API for calling Operations (Queries and Actions) directly.
-
Auth Hooks: you can now hook into the auth process with
onBeforeSignup
,onAfterSignup
hooks. You can also modify the OAuth redirect URL withonBeforeOAuthRedirect
hook.app myApp { ... auth: { onBeforeSignup: import { onBeforeSignup } from "...", onAfterSignup: import { onAfterSignup } from "...", onBeforeOAuthRedirect: import { onBeforeOAuthRedirect } from "...", }, }
-
Auth: you can now use Discord as a social auth provider (by @wardbox)
-
Using the Prisma Schema file directly: define your database schema in the
schema.prisma
file and Wasp will use it to generate the database schema and Prisma client code. -
Added the
wasp db reset
command for resetting the database.
⚠️ Breaking Changes & Migration Guide
New tsconfig.json
file
Wasp 0.14.0 requires some changes to your tsconfig.json
file.
Visit the migration guide for details.
Strict options when building the wasp
package
The wasp
package is now built with strictBindCallApply
, alwaysStrict
, noImplicitThis
, and strictFunctionTypes
.
This is a breaking change only if you have manually set your tsconfig.json
's strict
field to false
and are relying on it being more permissive.
To fix the errors, enable the options listed above and make sure your code type checks.
This quirk is only temporary. You'll soon be able to use any tsconfig.json
options you want.
Track this issue for progress: #1827
Directly calling Queries on the client
You can now call Queries directly from the client without dealing with
queryCacheKey
s. Wasp takes care of it under the hood:
Now:
const doneTasks = await getTasks({ isDone: true });
Before:
const doneTasks = await getTasks(getTasks.queryCacheKey, { isDone: true });
Accessing AuthUser
data
We had to make a couple of breaking changes to reach the new simpler Auth API:
-
You don't need to use
getUsername
to access the username:- Before: Used
getUsername
to access the username. - After: Directly use
user.identities.username?.id
.
- Before: Used
-
You don't need to use
getEmail
to access the email:- Before: Used
getEmail
to access the email. - After: Directly use
user.identities.email?.id
.
- Before: Used
-
Better API for accessing
providerData
:- Before: Required complex logic to access typed provider data.
- After: Directly use
user.identities.<provider>.<value>
for typed access.
-
Better API for accessing
getFirstProviderUserId
:- Before: Used
getFirstProviderUserId(user)
to get the ID. - After: Use
user.getFirstProviderUserId()
directly on the user object.
- Before: Used
-
You don't need to use
findUserIdentity
any more:- Before: Relied on
findUserIdentity
to check which user identity exists. - After: Directly check
user.identities.<provider>
existence.
- Before: Relied on
These changes improve code readability and lower the complexity of accessing user's auth fields. Follow the detailed migration steps to update your project to 0.14.0.
Using the Prisma Schema file
Wasp now uses the schema.prisma
file to generate the database schema and Prisma client code. This means that you should move your database schema from the main.wasp
file to the schema.prisma
file.
This means that this entity in main.wasp
:
entity Task {=psl
id Int @id @default(autoincrement())
description String
isDone Boolean
userId Int
user User @relation(fields: [userId], references: [id])
psl=}
will move to the schema.prisma
file:
model Task {
id Int @id @default(autoincrement())
description String
isDone Boolean
userId Int
user User @relation(fields: [userId], references: [id])
}
Read more about the migration steps in the migration guide.
Note on Auth Helper Functions (getUsername
, getEmail
etc.)
These changes only apply to getting auth fields from the user
object you receive from Wasp, for example in the authRequired
enabled pages or context.user
on the server. If you are fetching the user and auth fields with your own queries, you can keep using most of the helpers. Read more about using the auth helpers.
🐞 Bug fixes
- Updated the
tsconfig.json
to make sure IDEs don't underlineimport.meta.env
when users use client env vars. - Fixed
netlify.toml
to include the correct build path for the client app. - Fixed the client router to ensure that user defined routes don't override Wasp defined routes by moving the user defined routes to the end of the route list.
- Fixed the CRUD client helpers to accept the same params as the
useQuery
anduseAction
hooks.
🔧 Small improvements
- Improved the default loading spinner while waiting for the user to be fetched.
- Hided Prisma update message to avoid confusion since users shouldn't update Prisma by themselves.
- When an unknown OAuth error happens, Wasp now logs the error on the server to help with debugging.
- Improved default gitignore to more tightly target dotenv files and to allow for example dotenv files and .env.client.
- Improved the type signature of client auth helpers (e.g.
getEmail
) to make them accept the minimal required user object. - Improved the documentation and added extra TypeScript content.
- Improved RPC type inference.
v0.14.0-rc2
Read the pre-release docs here: https://wasp-docs-on-main.pages.dev/