RLS policies implementeren, Demo auth flow

This commit is contained in:
colinislit
2025-11-15 23:59:38 +01:00
parent b1cfb339a2
commit 99804656d7
49 changed files with 5841 additions and 123 deletions

View File

@@ -3,13 +3,19 @@
*
* Loads JSON content files from the content directory structure.
* Supports server-side loading with TypeScript type safety.
* Also supports loading and parsing markdown files.
*
* @example
* ```ts
* const manifesto = await getContent<ManifestoContent>('nl', 'manifesto')
* const markdownSections = await getMarkdownContent('docs/manifesto.md')
* ```
*/
import { readFile } from 'fs/promises'
import { join } from 'path'
import { markdownToSections } from './markdown-parser'
export async function getContent<T>(
locale: string = 'nl',
file: string
@@ -23,6 +29,27 @@ export async function getContent<T>(
}
}
/**
* Load and parse markdown file to ManifestoSection format
* Useful for converting manifesto.md to React components
*/
export async function getMarkdownContent(
filePath: string
): Promise<Array<{
id: string
type: 'paragraph'
content: string
}>> {
try {
const fullPath = join(process.cwd(), filePath)
const markdown = await readFile(fullPath, 'utf-8')
return markdownToSections(markdown)
} catch (error) {
console.error(`Failed to load markdown: ${filePath}`, error)
throw new Error(`Markdown file not found: ${filePath}`)
}
}
/**
* Type-safe content loader with fallback
*