features
@particular/shared-links
Unified link management for transfer, share, upload, and claim flows
Installation
bun add @particular/shared-links
Subpath Imports
| Import Path | Description |
|---|---|
| @particular/shared-links/schema | Drizzle schema for shared_links table |
| @particular/shared-links/handlers | CRUD handlers for all link types |
| @particular/shared-links/config | initializeSharedLinks() and getSharedLinksConfig() |
| @particular/shared-links/metadata | Zod metadata parser per link type |
| @particular/shared-links/api | API route helpers |
| @particular/shared-links/server | Server-side utilities |
| @particular/shared-links/token | Token generation and validation |
Key Exports
| Export | Type | Description |
|---|---|---|
| SharedLinkHandlers | type | Type for all link CRUD handlers |
| createSharedLinkHandlers | function | Create handlers for a specific link type |
| initializeSharedLinks | function | Initialize shared links with db and hash callbacks |
| SharedLinkMetadataParser | type | Zod metadata parser type per link type |
| generateToken | function | Generate a secure shared link token |
Usage Examples
Initialize shared links
import { initializeSharedLinks, getSharedLinksConfig } from "@particular/shared-links/config";
import bcrypt from "bcryptjs";
import { db } from "./db";
export const sharedLinksConfig = initializeSharedLinks({
db,
hashPassword: (plain) => bcrypt.hash(plain, 12),
verifyPassword: (plain, hash) => bcrypt.compare(plain, hash),
});
export function getSharedLinkHandlers() {
return getSharedLinksConfig().getHandlers();
}