ltfi-wsap
Version:
Official Node.js/TypeScript SDK for LTFI-WSAP (Web System Alignment Protocol) by Kief Studio - Part of the LTFI ecosystem
198 lines (192 loc) • 5.17 kB
text/typescript
/**
* LTFI-WSAP Type Definitions
*/
interface WSAPConfig$1 {
apiKey: string;
baseURL: string;
timeout: number;
retries: number;
debug: boolean;
}
declare enum DisclosureLevel {
BASIC = "basic",
STANDARD = "standard",
DETAILED = "detailed",
COMPLETE = "complete"
}
declare enum VerificationStatus {
PENDING = "pending",
VERIFIED = "verified",
FAILED = "failed",
EXPIRED = "expired"
}
declare enum EntityType {
COMPANY = "company",
SOLE_PROP = "sole_prop",
PARTNERSHIP = "partnership",
FRANCHISE = "franchise",
SUBSIDIARY = "subsidiary",
NONPROFIT = "nonprofit",
GOVERNMENT = "government",
EDUCATION = "education",
HEALTHCARE = "healthcare",
RELIGIOUS = "religious",
ASSOCIATION = "association",
COMMUNITY = "community",
PERSONAL = "personal",
CREATOR = "creator",
OPENSOURCE = "opensource",
ONLINE_COMMUNITY = "online_community",
SAAS = "saas",
DAO = "dao",
AI_AGENT = "ai_agent",
PORTFOLIO = "portfolio",
MARKETPLACE = "marketplace",
PLATFORM = "platform",
EVENT = "event",
CAMPAIGN = "campaign",
PROJECT = "project",
OTHER = "other"
}
interface Entity {
id: number;
entity_id: string;
entity_type: string;
legal_name?: string;
display_name: string;
slug: string;
parent_entity?: number;
created_by: number;
is_active: boolean;
is_published: boolean;
is_verified: boolean;
template_id?: string;
inherits_from_parent: boolean;
wsap_data?: Record<string, any>;
created_at: Date;
updated_at: Date;
}
interface Domain {
domain: string;
is_verified: boolean;
is_primary: boolean;
verified_at?: Date;
}
interface Verification {
status: VerificationStatus;
method?: string;
verified_at?: Date;
verification_token?: string;
txt_record_name?: string;
txt_record_value?: string;
}
interface WSAPData {
version: string;
entity: Entity;
domains: Domain[];
verification: Verification;
disclosure_level: DisclosureLevel;
generated_at: Date;
basic_info?: Record<string, any>;
contact_info?: Record<string, any>;
legal_info?: Record<string, any>;
business_info?: Record<string, any>;
}
interface CreateEntityRequest {
entity_type: string;
legal_name?: string;
display_name: string;
domains?: string[];
description?: string;
}
interface UpdateEntityRequest {
legal_name?: string;
display_name?: string;
description?: string;
is_active?: boolean;
is_published?: boolean;
}
interface PaginatedResponse<T> {
count: number;
next?: string;
previous?: string;
results: T[];
}
interface AuthTokens {
access: string;
refresh: string;
}
interface User {
id: number;
username: string;
email: string;
first_name?: string;
last_name?: string;
is_active: boolean;
is_staff: boolean;
is_superuser: boolean;
groups: string[];
permissions: string[];
date_joined: Date;
}
/**
* LTFI-WSAP Client
*/
declare class WSAPClient {
private http;
private config;
constructor(config?: Partial<WSAPConfig$1>);
private handleError;
login(username: string, password: string): Promise<AuthTokens>;
refreshToken(refreshToken: string): Promise<string>;
getCurrentUser(): Promise<User>;
getPermissions(): Promise<any>;
listEntities(params?: {
page?: number;
pageSize?: number;
entityType?: string;
isVerified?: boolean;
search?: string;
}): Promise<PaginatedResponse<Entity>>;
getEntity(entityId: string): Promise<Entity>;
createEntity(data: CreateEntityRequest): Promise<Entity>;
updateEntity(entityId: string, data: UpdateEntityRequest): Promise<Entity>;
deleteEntity(entityId: string): Promise<void>;
initiateVerification(domain: string, method?: string): Promise<Verification>;
verifyDomain(domain: string): Promise<boolean>;
getVerificationStatus(domain: string): Promise<Verification>;
generateWSAP(entityId: string, disclosureLevel?: DisclosureLevel): Promise<WSAPData>;
fetchWSAP(domain: string): Promise<WSAPData>;
getWSAPUrl(domain: string): string;
healthCheck(): Promise<any>;
getStats(): Promise<any>;
}
/**
* LTFI-WSAP SDK Errors
*/
declare class WSAPError extends Error {
constructor(message: string);
}
declare class AuthenticationError extends WSAPError {
constructor(message: string);
}
declare class ValidationError extends WSAPError {
constructor(message: string);
}
declare class NotFoundError extends WSAPError {
constructor(message: string);
}
declare class RateLimitError extends WSAPError {
constructor(message: string);
}
/**
* LTFI-WSAP Configuration
*/
interface WSAPConfig {
apiKey: string;
baseURL: string;
timeout: number;
retries: number;
debug: boolean;
}
export { AuthenticationError, CreateEntityRequest, DisclosureLevel, Domain, Entity, EntityType, NotFoundError, RateLimitError, UpdateEntityRequest, ValidationError, Verification, VerificationStatus, WSAPClient, WSAPConfig, WSAPData, WSAPError };