Skip to content

RESTHeart 9.17.1

Latest

Choose a tag to compare

@github-actions github-actions released this 19 Nov 19:16
· 309 commits to master since this release
5bfa5b5

The emails of the accounts and stripe plugins can now reach each user in their own language. The default templates come in eight languages, and the stripe plugin opens Checkout and the Customer Portal in the same language as its emails. The MQTT module is attached to a release for the first time.

A registration with a locale that is not a language code, such as en-US, is now refused. Read "Behaviour changes" below before you upgrade.

The language of an email is chosen for each recipient (#829)

Until 9.17.0 every email of restheart-accounts was written in default-locale, one language for the whole deployment. Now the language is, in order:

  1. the locale of the recipient's user document: the user's choice;
  2. the locale of the request that sends the email: the client's guess, for instance the language of the page the user is on;
  3. default-locale of accountsConfig.

The endpoints that send an email take an optional locale in their body:

Endpoint Email What locale does
POST /auth/register verification stored on the new user, and used for the email
POST /auth/invite invitation new user: stored on the user it creates, and used for the email. Existing user: used only if the user has no locale
POST /auth/resend-invite invitation used only if the user has no locale
POST /auth/forgot-password password reset used only if the user has no locale

A request to these endpoints never overwrites a stored locale. The user changes their own with PATCH /auth/profile, which now takes locale next to firstName and lastName.

locale is a language code of 2 to 5 letters, such as en or it, stored in lower case. Anything else gets 400. On POST /auth/forgot-password an invalid locale is refused before the account is looked up, so the answer stays the same for a known and an unknown email.

Default email templates in eight languages (#830)

The default templates of the accounts plugin (verification.html, password-reset.html, invite.html) and of the stripe plugin (order-confirmed.html, order-refunded.html, over-limit.html, payment-failed.html, subscription-canceled.html, trial-will-end.html) had every text in English and Italian. Every text is now also in Spanish, French, German, Dutch, Portuguese and Polish.

A deployment with default-locale: de, or a user with locale: de, gets the emails in German without a custom template. A language the template does not have falls back to English, as before.

German and French use the polite form. The other languages are informal, as the Italian is.

Stripe: emails, Checkout and the Customer Portal in the customer's language (#830)

Until 9.17.0 the stripe plugin wrote every email in English. Stripe does not report the language of a customer, so the plugin now chooses it and tells Stripe.

The emails. A subscription notification is written in the locale of the billing contact. With the default provider the billing contact is the user who created the team. An order notification is written in the locale kept on the order at checkout. Both fall back to default-locale, a new key of stripeConfig whose default is en.

The pages of Stripe. POST /stripe/checkout, POST /stripe/portal and POST /orders take an optional locale: the language of the page the buyer is on.

Request Language of the page
POST /stripe/checkout, POST /stripe/portal the locale of the request, else the one of the billing contact
POST /orders the locale of a signed-in buyer whose account carries it, else the one of the request

When neither has a language the plugin sets none on the session, and Stripe follows the browser as before. A language Stripe has no page for is used for the plugin's email only. The eight languages of the default templates are all among those Stripe has.

When the plugin creates a Stripe Customer it sets the language of the billing contact as the Customer's preferred_locales, so the receipts and invoices Stripe sends agree with the emails of the plugin.

For plugin developers:

  • SubscriptionOwnerProvider has the new method locale(SubscriptionOwner), which returns an empty Optional by default. A custom provider overrides it to name the language of its billing contact.
  • StripeConfigData has the new component defaultLocale. The constructor without it is still there.
  • org.restheart.emails.EmailLocale, in restheart-commons, validates a locale and applies the order above.

The MQTT module (#737)

restheart-mqtt bridges an MQTT broker into RESTHeart: the messages of a topic become Server-Sent Events, REST responses, MongoDB documents or the input of your own plugins. This is the first release that includes it.

The module is a separate archive, restheart-mqtt-9.17.1.zip and .tar.gz, attached to this release. The RESTHeart distribution and the Docker image do not contain it.

Two fixes since the snapshot builds:

  • At startup every topic filter was subscribed twice, and the log said "after reconnect" for a connection that was the first. It is now subscribed once.
  • session-expiry-seconds, reconnect.initial-delay-ms, reconnect.max-delay-ms, will.delay-seconds and will.message-expiry-seconds set to an ordinary number stopped RESTHeart at startup with a ClassCastException. The sample configuration sets two of them.

Fixes

  • A plugin with no configuration block (#732). @Inject("config") injected null, and a getOrDefault in @OnInit stopped RESTHeart at startup with a NullPointerException. The plugin now gets an empty map.
  • A permission whose mongo block is not valid. Such a permission allows nothing. On a read with filter, sort or sort_by RESTHeart skipped it, and a weaker permission of the same caller could serve the request. The request now gets 403. fileAclAuthorizer now denies a request matched by such a permission, as mongoAclAuthorizer did.
  • The log of a 403 for allowFilter. It named one permission that matched. It now says that no permission of the caller allows filter, sort and sort_by.

Behaviour changes

  • POST /auth/register validates locale. With a JSON Schema on the users collection a locale was already stored, as the client sent it. A value that is not a code of 2 to 5 letters, en-US included, now gets 400.
  • A JSON Schema on the users collection with additionalProperties: false must declare locale as an optional string. Otherwise a registration or an invitation with a locale is refused by the schema.
  • An email of the stripe plugin to a billing contact whose user document has a locale is written in that language. Before, it was in English.
  • PATCH /auth/profile with an empty body answers 400 with the message "At least one of firstName, lastName or locale is required".
  • A plugin that checked config == null to know it had no configuration block now finds an empty map.
  • A request matched by a permission whose mongo block is not valid gets 403. Before, a read with filter, sort or sort_by could be served by a weaker permission, and fileAclAuthorizer allowed the request.

Packages

  • Docker: softinstigate/restheart:9.17.1
  • Maven: the artifacts of this version are not on Maven Central yet. They are in the repository https://download.restheart.com/maven, see "Building against 9.17.1" below.
  • The zip and the tar.gz of RESTHeart and of the MQTT module are attached to this release.

Building against 9.17.1: the Maven repository

The Maven artifacts of 9.17.1 (org.restheart:restheart-commons and the other modules) could not be published to Maven Central with the release: the deployment was refused because our organization had reached the monthly file count limit of the Sonatype Central Portal, which resets on 2026-12-01. Until they are on Maven Central, they are served by a public, read-only Maven repository:

https://download.restheart.com/maven

The coordinates are the same as on Maven Central, so only the repository has to be added. No credentials are needed. Every other dependency keeps coming from Maven Central.

In the pom.xml of the project:

<repositories>
  <repository>
    <id>restheart</id>
    <url>https://download.restheart.com/maven</url>
    <releases><enabled>true</enabled></releases>
    <snapshots><enabled>false</enabled></snapshots>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>org.restheart</groupId>
    <artifactId>restheart-commons</artifactId>
    <version>9.17.1</version>
    <scope>provided</scope>
  </dependency>
</dependencies>

Or in ~/.m2/settings.xml, to leave the project untouched. It then applies to every project on that machine, and each developer and CI runner needs it:

<settings>
  <profiles>
    <profile>
      <id>restheart-repo</id>
      <repositories>
        <repository>
          <id>restheart</id>
          <url>https://download.restheart.com/maven</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>false</enabled></snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>restheart-repo</activeProfile>
  </activeProfiles>
</settings>

With Gradle:

repositories {
    mavenCentral()
    maven { url = uri("https://download.restheart.com/maven") }
}

Then build as usual, for instance mvn package. Notes:

  • If a build already failed to find 9.17.1, Maven remembers the miss for a day: run it once with -U, as in mvn -U package.
  • Only 9.17.1 is in this repository. Earlier versions are on Maven Central.
  • The jars and the poms are signed with the SoftInstigate key 99E55324217D927F, available from keys.openpgp.org; each file has its .asc, .md5 and .sha1 next to it.
  • When 9.17.1 is on Maven Central, remove the repository: nothing else changes. The jars there will have the same code but different checksums, because they come from a separate build. A project that pins the checksums of its dependencies has to refresh them.

For maintainers: publishing a version to the Maven repository

This is how the artifacts of a version are published by hand to https://download.restheart.com/maven, which is the prefix maven/ of the S3 bucket download.restheart.com. It needs AWS credentials that can write to the bucket and the SoftInstigate GPG key.

  1. Add a profile to ~/.m2/settings.xml. It is local to the machine, nothing of it is in this repository:

    <profile>
      <id>restheart-s3</id>
      <properties>
        <altDeploymentRepository>restheart-s3::s3://download.restheart.com/maven</altDeploymentRepository>
        <gpg.keyname>SoftInstigate</gpg.keyname>
        <doclint>none</doclint>
        <maven.javadoc.failOnError>false</maven.javadoc.failOnError>
        <quiet>true</quiet>
      </properties>
    </profile>
  2. Check out the tag of the version in a directory of its own, for instance git worktree add --detach ../restheart-9.17.1 9.17.1.

  3. In that directory create .mvn/extensions.xml, which lets Maven deploy to an s3:// URL:

    <extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0">
      <extension>
        <groupId>io.github.michaelboyles</groupId>
        <artifactId>s3-maven-extension</artifactId>
        <version>0.7.0</version>
      </extension>
    </extensions>
  4. Only for 9.17.1 and earlier tags: delete the <extensions> block with aws-maven from core/pom.xml. In that module it takes over s3:// and the deploy fails with "Unable to load AWS credentials". Later versions do not have it.

  5. Build, sign and deploy, with the AWS profile that can write to the bucket:

    AWS_PROFILE=<profile> ./mvnw -Prestheart-s3 -DskipTests \
        verify source:jar-no-fork javadoc:jar gpg:sign deploy:deploy
    

    Do not add -Pdeploy: that profile loads the Sonatype extension, which takes over the deploy and sends it to Maven Central. Maven talks to the bucket directly, so it adds the version to the maven-metadata.xml files that are already there.

  6. Verify from outside: download a jar and its .asc over HTTPS and check them with gpg --verify, then resolve the version from a project with an empty local repository (-Dmaven.repo.local=<empty dir>).

To try the procedure without touching the repository, add -DaltDeploymentRepository=restheart-s3::s3://download.restheart.com/maven-test to the command, then delete that prefix.