@bearer/functions

Bearer Functions

Usage no npm install needed!

<script type="module">
  import bearerFunctions from 'https://cdn.skypack.dev/@bearer/functions';
</script>

README

@bearer/functions

Version npm bundle size (scoped) Downloads/week License

Usage

Creating a FetchData function

import { FetchData, TOAUTH2AuthContext } from '@bearer/functions'
import Client from './client'

export default class FunctionName extends FetchData implements FetchData<ReturnedData, any, TOAUTH2AuthContext> {
  // Uncomment the line above if you don't want your function to be called from the frontend
  // static serverSideRestricted = true

  async action(event: TFetchActionEvent<Params, TOAUTH2AuthContext>): TFetchPromise<ReturnedData> {
    // const token = event.context.auth.accessToken
    // Put your logic here
    return { data: [] }
  }
}

export type Params = {
  // name: string
}

export type ReturnedData = {
  // foo: string[]
}