Platformatic v0.10.0

Platformatic v0.10.0

Hi Folks,

Another week, another release of Platformatic. We are busy fixing bugs and improving things. If something is not working or it's not clear for you, reach out via Discord or through GitHub Issues.

The full release notes are available at: github.com/platformatic/platformatic/releas..

Here are the highlights of this release.

feat(config): Add schema JSON

Roberto Bianchi sent this amazing contribution to automatically generate the Platformatic DB configuration schema when doing plt db init, so that you can have autocompletion of all the configurations options. Check it out in action:

Fetch all relation keys when fetching relations in GraphQL

In #428, Anwar Salim found a bad crash of Platformatic DB when accessing a graph that was 3 level deep. As an example, the following query lead to a bad crash:

query companyWithSocialMedia {
  company {
    name
    companySocialMedias {
      username
      socialMedias {
        name
        baseUrl
      }
    }
  }
}

Here is the crash details:

TypeError: Cannot read properties of undefined (reading 'toString')
    at Wrapper.loader [as func] (/run/media/anwar/data/dev-playground/infodrop-monorepo/node_modules/@platformatic/db-core/node_modules/@platformatic/sql-graphql/lib/relationship.js:42:59)
    at /run/media/anwar/data/dev-playground/infodrop-monorepo/node_modules/single-user-cache/index.js:93:12
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

This was fixed in #432 by always fetching all foreign keys when reading rows from the database.

Always use string for BigInts

In previous releases of Platformatic DB, there was a loss of precision when using BigInt columns in MariaDB, MySQL and PostgreSQL. The change introduced in #434, make sure that BigInt columns are mapped to JavaScript strings and not numbers.

This feature was built last Monday during my stream:

Remove requirement for foreign keys to have _id suffix

In #319, Roberto Bianchi caught a corner we cut to ship Platformatic DB: we required all foreign key columns to end with _id. This was fixed in #430.

Setup user on demand in db-authorization

In this last minute addition, I moved the logic that is validating the user credential from a preHandler hook to an on-demand basis. In this way, we would be doing expensive computations (or remote call in case of webhook) at first use, saving precious latency.