Releases: wasp-lang/wasp
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/
v0.14.0-rc1
Read the pre-release docs here: https://wasp-docs-on-main.pages.dev/
v0.13.2
0.13.2 (2024-04-11)
🐞 Bug fixes
- Fixed problems with Wasp's type inference in projects created using Wasp 0.13.1.
v0.13.1
0.13.1 (2024-04-04)
🐞 Bug fixes
- Vite HMR now works correctly with Wasp's new project structure (no more full-page reloads).
- Keycloak UI helpers are now correctly exported.
🔧 Small improvements
-
Improved how IDE auto-imports symbols from the
wasp
package. If you have an existing project, add these lines to yourtsconfig.json
to getter better IDE support:{ "compilerOptions" { "target": "esnext", "moduleResolution": "bundler", // ... } // ... }
v0.13.0
⚠️ Breaking changes
Wasp 0.13.0 switches away from using Passport for our OAuth providers in favor of Arctic from the Lucia ecosystem. This change simplifies the codebase and makes it easier to add new OAuth providers in the future.
This however, means that there are breaking changes in the way you define OAuth providers in your Wasp project.
Read the migration guide at https://wasp-lang.dev/docs/migrate-from-0-12-to-0-13 for more details.
🎉 New features
- Wasp adds support for Keycloak as an OAuth provider.
- Wasp now supports defining the
WASP_SERVER_URL
environment variable and exposes it asserverUrl
in the server config which can be imported fromwasp/server
.
🐞 Bug fixes
- Projects that import
wasp/auth/types
no longer fail when building the web app. - Wasp now displays OAuth related errors in the browser instead of redirecting to the login page.
🔧 Small improvements
- Wasp uses Oslo for handling JWTs.
v0.13.0-rc2
Updates tag for starters (#1903)
v0.13.0-rc1
Fixes tests for 0.13.0 RC (#1899)
v0.12.4
🐞 Bug fixes
- Projects that import
wasp/auth/types
no longer fail when building the web app.
v0.12.3
0.12.3
🎉 New features
- Wasp AI switched from GPT 3.5 Turbo 0613 to GPT 3.5 Turbo 0125, which gives it bigger context, ensuring generation doesn't fail for bigger apps, while also being cheaper.