simov / grant

OAuth Proxy
MIT License
4.08k stars 257 forks source link

Export the grant config and Options #288

Closed Joabesv closed 1 year ago

Joabesv commented 1 year ago

Hi there! thank you for the package!

was wondering if it's possible to export the grant config options interface in the fastify handler!

I'm willing to submit a pr.

simov commented 1 year ago

You mean the contents of the config folder? Not sure I'm following. As for the config of your Grant instance you can access them on the config property.

Joabesv commented 1 year ago

Hi there, thanks for the answer

when i say config i'm refering to the typescript types!

sort of something like this

import fastifyGrant,  {type GrantConfig } from 'grant-fastify'

const grantOptions = { ... } satisfies GrantConfig

so i can use it to assert my config is right!!

simov commented 1 year ago

I see, that was my second guess. Anyway, now when looking at it, it seems that the underlying interfaces were not exported in the meta modules. Though note that the meta grant-* modules are really only package names on NPM. There is 0 code there other than the export for the main module. The main module grant contains the entire code base, and it is always better to use that instead.

Have a look at this example. Also check out the other folders for the rest of the transport types, there is a fastify example for each one of them.

Joabesv commented 1 year ago

Using the main module solved it for me, thanks mate!

Appreciate the tips, and again thank you, for your package!