DATE:
AUTHOR:
PowerSync Product Team
PowerSync Service PowerSync Dashboard/Admin Portal

Improved parameter query syntax in sync rules and enhancements

DATE:
AUTHOR: PowerSync Product Team

We are excited to announce enhancements to the syntax of parameter queries in sync rules, along with additional functionality. This is part of our ongoing effort to make sync rules more powerful and intuitive. The highlights are:

  1. Access to new JWT payload fields within sync rules, which were previously not accessible with token_parameters.

  2. We removed the concept of token_parameters, as it wasn't always clear to new developers how it corresponds to the JWT. The JWT payload can now be used directly in parameter queries, making usage a little more intuitive.

  3. Added support for client parameters with a consistent syntax.

  4. Function definition documentation in the Dashboard's sync rules editor to guide usage.

Summary of updates

  1. Added new functions to parameter queries:

    1. request.jwt(): Returns the entire (signed) JWT payload as a JSON string.

    2. request.parameters(): Returns client parameters as a JSON string.

    3. request.user_id(): Returns the token subject, same as request.jwt() ->> 'sub' and also the same as token_parameters.user_id in the previous syntax.

  2. Introduced basic documentation for each function definition in the sync rules editor:

Get started

The previous syntax using token_parameters in parameter queries is still fully functional, but we recommend updating your sync rules to the new syntax to take advantage of the benefits listed above. Get started or migrate to this new syntax with examples listed in our docs here.

Powered by LaunchNotes