Skip to content

Export the type FastifySupabasePluginOpts #28

@atom-vision

Description

@atom-vision

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions