Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export the type FastifySupabasePluginOpts #28

Open
atom-vision opened this issue Apr 23, 2024 · 1 comment · May be fixed by #38
Open

Export the type FastifySupabasePluginOpts #28

atom-vision opened this issue Apr 23, 2024 · 1 comment · May be fixed by #38
Labels
enhancement New feature or request

Comments

@atom-vision
Copy link

Problem:
Trying to create a separate plugin file which returns a plugin that registers fastifySupabase. Looks like the following:

import { SupabaseClientOptions } from '@supabase/supabase-js'
import fastifySupabase from '@psteinroe/fastify-supabase'
import fp from 'fastify-plugin'

type FastifySupabasePluginOpts = {
  url: string
  serviceKey: string
  anonKey: string
  options?: SupabaseClientOptions<'public'>
}

export default fp<FastifySupabasePluginOpts>(async (fastify, opts) => {
  fastify.register(fastifySupabase, {
    url: opts.url,
    anonKey: opts.anonKey,
    serviceKey: opts.serviceKey,
    // you can pass any `SupabaseClientOptions`
    options: opts.options
  })
})

A potential solution:
Would help if the type FastifySupabasePluginOpts was also exported so that we can use it like

import fastifySupabase, { FastifySupabasePluginOpts } from '@psteinroe/fastify-supabase'
@atom-vision atom-vision added the enhancement New feature or request label Apr 23, 2024
@vehm
Copy link

vehm commented Oct 8, 2024

I just opened a pull request that addresses this: #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants