- DATE:
- AUTHOR:
- PowerSync Product Team
Improved parameter query syntax in sync rules and enhancements
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:
Access to new JWT payload fields within sync rules, which were previously not accessible with
token_parameters
.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.Added support for client parameters with a consistent syntax.
Function definition documentation in the Dashboard's sync rules editor to guide usage.
Summary of updates
Added new functions to parameter queries:
request.jwt()
: Returns the entire (signed) JWT payload as a JSON string.request.parameters()
: Returns client parameters as a JSON string.request.user_id()
: Returns the token subject, same asrequest.jwt() ->> 'sub'
and also the same astoken_parameters.user_id
in the previous syntax.
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.