Skip to content

BouyguesTelecom/spl-envelop-plugin

Repository files navigation

Simple Predicate Langage (SPL)

NPM Version

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.

Usage

query GetUsers {
  users @SPL(query: "SORT BY age LIMIT 3") {
    name
    age
  }
}

Getting Started

To use the SPL Envelop plugin, you need to:

  1. Install the package:

    npm install @bouygues-telecom/spl-envelop-plugin
  2. Import the plugin in your GraphQL Mesh configuration:

    // ...
    import { splDirectiveTypeDef } from '@bouygues-telecom/spl-envelop-plugin'
    
    export const composeConfig = defineConfig({
      // ...
      additionalTypeDefs: /* GraphQL */ `
        ${splDirectiveTypeDef}
      `,
    })
  3. Add the plugin to your GraphQL Mesh configuration:

    // ...
    import { useSPL } from '@bouygues-telecom/spl-envelop-plugin'
    
    export const composeConfig = defineConfig({
      // ...
      plugins: [
        useSPL(),
      ],
    })

About

Simple Predicate Language, as an GraphQL Envelop plugin

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published