@sherrylinks/slinks-core
v0.11.33-beta
Published
Core logic for SherryLinks adapters, context, observers, and wallet interactions
Readme
@sherrylinks/slinks-core
Core logic for SherryLinks adapters, context, observers, and wallet interactions.
Overview
This package provides the foundational building blocks for the SherryLinks ecosystem. It includes:
- Core type definitions and interfaces (e.g.,
SherryAdapter). - Trigger Directory logic for fetching and validating Trigger endpoints.
- Error handling classes (
SherryError,TriggerError, etc.). - Utility functions for formatting, proxifying URLs, and constants.
- Base classes and logic potentially used by platform observers.
This package is primarily intended as an internal dependency for @sherrylinks/slinks and @sherrylinks/slinks-extension, but some utilities might be useful independently.
Installation
While typically installed as a dependency of @sherrylinks/slinks, you can install it directly if needed:
npm install @sherrylinks/slinks-core
# or
yarn add @sherrylinks/slinks-core
# or
pnpm add @sherrylinks/slinks-coreUsage
Direct usage is less common, as most functionality is exposed through the @sherrylinks/slinks package. However, you might import types or specific utilities:
import { TriggerDirectory, API_REPOSITORY_URL, SherryError } from '@sherrylinks/slinks-core';
// Example: Using the directory
const directory = new TriggerDirectory(API_REPOSITORY_URL);
await directory.refresh();
const securityState = directory.lookup('https://app.sherry.social');
// Example: Using error types
try {
// ... some operation
} catch (error) {
if (error instanceof SherryError) {
console.error('SherryLinks Core Error:', error.message);
}
}Key Exports
TriggerDirectory: Class for managing and querying Trigger sources.SherryError,TriggerError,ValidationError, etc.: Custom error classes.API_REPOSITORY_URL,PROXY_URL: Constant URLs.- Utility functions (e.g.,
proxifyUrl,formatAddress). - Core types and interfaces.
License
MIT
