MyGit

v0.14.0

wasp-lang/wasp

版本发布时间: 2024-07-17 23:10:03

wasp-lang/wasp最新发布版本:v0.15.0-rc1(2024-10-04 20:07:57)

0.14.0 (2024-07-17)

🎉 New Features

⚠️ 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: https://github.com/wasp-lang/wasp/issues/1827

Directly calling Queries on the client

You can now call Queries directly from the client without dealing with queryCacheKeys. 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:

  1. 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.
  2. 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.
  3. Better API for accessing providerData:

    • Before: Required complex logic to access typed provider data.
    • After: Directly use user.identities.<provider>.<value> for typed access.
  4. Better API for accessing getFirstProviderUserId:

    • Before: Used getFirstProviderUserId(user) to get the ID.
    • After: Use user.getFirstProviderUserId() directly on the user object.
  5. 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.

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

🔧 Small improvements

相关地址:原始地址 下载(tar) 下载(zip)

1、 wasp-linux-x86_64.tar.gz 77.38MB

2、 wasp-macos-x86_64.tar.gz 49.7MB

查看:2024-07-17发行的版本