SPL is a very small, lightweight, straightforward and non-evaluated expression language to sort, filter and paginate arrays of maps.
This package is a GraphQL Envelop plugin of the @SPL
directive, bringing SPL capabilities to your GraphQL API.
query GetUsers {
users @SPL(query: "SORT BY age LIMIT 3") {
name
age
}
}
To use the SPL Envelop plugin, you need to:
-
Install the package:
npm install @bouygues-telecom/spl-envelop-plugin
-
Import the plugin in your GraphQL Mesh configuration:
// ... import { splDirectiveTypeDef } from '@bouygues-telecom/spl-envelop-plugin' export const composeConfig = defineConfig({ // ... additionalTypeDefs: /* GraphQL */ ` ${splDirectiveTypeDef} `, })
-
Add the plugin to your GraphQL Mesh configuration:
// ... import { useSPL } from '@bouygues-telecom/spl-envelop-plugin' export const composeConfig = defineConfig({ // ... plugins: [ useSPL(), ], })