simov / grant

OAuth Proxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export the grant config and Options

Joabesv opened this issue · comments

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.

commented

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.

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!!

commented

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.

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

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