JSPM

@lekoarts/clerk-loader

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q61543F
  • License MIT

Astro content loader for Clerk

Package Exports

  • @lekoarts/clerk-loader

Readme

Astro Clerk loader

This package provides a Clerk content loader for Astro's content layer. You can access a selection of Clerk Backend APIs by simply providing the method name.

Want to see an overview of all my loaders? Visit astro-loaders.lekoarts.de

Prerequisites

Installation

npm install @lekoarts/clerk-loader

Usage

Import @lekoarts/clerk-loader into src/content.config.ts and define your collections.

Important: You need to either define the Clerk Secret Key as an environment variable (CLERK_SECRET_KEY) or pass it as the secretKey option inside clientOptions.

import { clerkLoader } from '@lekoarts/clerk-loader'

const clerk = defineCollection({
  loader: clerkLoader({
    method: {
      name: 'users.getUserList',
    },
  }),
})

Options

method (required)

You must pass method.name to the loader. The available method names are generated through the PublicLoaderAPI and stored in dot notation (api.method). If the endpoint takes parameters, you can define them through method.options.

Use your IDE's autocompletion to discover all available options and method names.

import { clerkLoader } from '@lekoarts/clerk-loader'

const clerk = defineCollection({
  loader: clerkLoader({
    method: {
      name: 'users.getUserList',
      options: {
        last_active_at_since: 1234567890,
      }
    },
  }),
})

clientOptions (optional)

You can configure the underlying createClerkClient() call by passing in these options.