
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@lanonasis/memory-client
Advanced tools
Universal Memory as a Service (MaaS) Client SDK - Works everywhere: Browser, Node.js, React, Vue, Edge Functions
Memory as a Service (MaaS) Client SDK - Intelligent memory management with semantic search capabilities for JavaScript/TypeScript applications.
npm install @lanonasis/memory-client
yarn add @lanonasis/memory-client
pnpm add @lanonasis/memory-client
import { createMemoryClient } from '@lanonasis/memory-client';
// Initialize the client
const memoryClient = createMemoryClient({
apiUrl: 'https://api.lanonasis.com',
apiKey: 'your-api-key-here'
});
// Create a memory
const memory = await memoryClient.createMemory({
title: 'Important Code Pattern',
content: 'Use React.memo() for expensive components to prevent unnecessary re-renders',
memory_type: 'knowledge',
tags: ['react', 'performance', 'optimization']
});
// Search memories
const results = await memoryClient.searchMemories({
query: 'React performance optimization',
limit: 10
});
console.log('Found memories:', results.data?.results);
import { createProductionClient } from '@lanonasis/memory-client';
const client = createProductionClient(process.env.LANONASIS_API_KEY!);
// Test connection
const health = await client.healthCheck();
console.log('Service health:', health.data?.status);
import { createDevelopmentClient } from '@lanonasis/memory-client';
const client = createDevelopmentClient('dev-api-key');
interface MemoryClientConfig {
apiUrl: string; // API endpoint URL
apiKey?: string; // API key for authentication
authToken?: string; // Bearer token (alternative to API key)
timeout?: number; // Request timeout in milliseconds (default: 30000)
useGateway?: boolean; // Enable gateway mode (default: true)
headers?: Record<string, string>; // Custom headers
}
const memory = await client.createMemory({
title: 'Memory Title',
content: 'Memory content goes here...',
memory_type: 'context', // 'context' | 'project' | 'knowledge' | 'reference' | 'personal' | 'workflow'
tags: ['tag1', 'tag2'],
metadata: { source: 'api', version: '1.0' }
});
const results = await client.searchMemories({
query: 'search terms',
memory_types: ['knowledge', 'reference'],
tags: ['important'],
limit: 20,
threshold: 0.7 // Similarity threshold (0-1)
});
const memories = await client.listMemories({
page: 1,
limit: 50,
memory_type: 'project',
tags: ['work', 'important'],
sort: 'updated_at',
order: 'desc'
});
const updated = await client.updateMemory('memory-id', {
title: 'Updated Title',
tags: ['new-tag']
});
await client.deleteMemory('memory-id');
const topic = await client.createTopic({
name: 'Project Alpha',
description: 'Memories related to Project Alpha',
color: '#3B82F6',
icon: 'project'
});
const topics = await client.getTopics();
const stats = await client.getMemoryStats();
console.log('Total memories:', stats.data?.total_memories);
console.log('By type:', stats.data?.memories_by_type);
context - General contextual informationproject - Project-specific knowledgeknowledge - Educational or reference materialreference - Quick reference informationpersonal - User-specific private memoriesworkflow - Process and procedure documentationconst client = createMemoryClient({
apiUrl: 'https://api.lanonasis.com',
apiKey: 'your-api-key'
});
const client = createMemoryClient({
apiUrl: 'https://api.lanonasis.com',
authToken: 'your-bearer-token'
});
// Update API key
client.setApiKey('new-api-key');
// Update auth token
client.setAuthToken('new-token');
// Clear authentication
client.clearAuth();
Gateway mode provides enhanced performance through optimized routing and caching:
// Enable gateway mode (default)
const client = createMemoryClient({
apiUrl: 'https://api.lanonasis.com',
apiKey: 'your-key',
useGateway: true
});
// Direct API mode (for debugging)
const directClient = createMemoryClient({
apiUrl: 'https://api.lanonasis.com',
apiKey: 'your-key',
useGateway: false
});
import { useMemoryClient } from '@lanonasis/memory-client';
function MyComponent() {
const client = useMemoryClient({
apiUrl: process.env.NEXT_PUBLIC_API_URL!,
apiKey: process.env.NEXT_PUBLIC_API_KEY!
});
const [memories, setMemories] = useState([]);
useEffect(() => {
const loadMemories = async () => {
const result = await client.listMemories({ limit: 10 });
if (result.data) {
setMemories(result.data.data);
}
};
loadMemories();
}, [client]);
return <div>{/* Your component */}</div>;
}
All methods return a standardized response format:
interface ApiResponse<T> {
data?: T; // Success data
error?: string; // Error message
message?: string; // Additional info
}
// Example error handling
const result = await client.getMemory('invalid-id');
if (result.error) {
console.error('Failed to get memory:', result.error);
} else {
console.log('Memory:', result.data);
}
// Production
const prodClient = createMemoryClient({
apiUrl: 'https://api.lanonasis.com',
apiKey: process.env.LANONASIS_API_KEY,
timeout: 10000,
useGateway: true
});
// Development
const devClient = createMemoryClient({
apiUrl: 'http://localhost:3001',
apiKey: 'dev-key',
timeout: 30000,
useGateway: false
});
// Custom headers
const customClient = createMemoryClient({
apiUrl: 'https://api.lanonasis.com',
apiKey: 'your-key',
headers: {
'X-Client-Version': '1.0.0',
'X-Environment': 'production'
}
});
Full TypeScript support with comprehensive type definitions:
import type {
MemoryEntry,
CreateMemoryRequest,
SearchMemoryRequest,
MemoryType,
ApiResponse
} from '@lanonasis/memory-client';
// Strongly typed memory creation
const memory: CreateMemoryRequest = {
title: 'TypeScript Tips',
content: 'Use strict mode for better type safety',
memory_type: 'knowledge' as MemoryType,
tags: ['typescript', 'tips']
};
// Typed responses
const response: ApiResponse<MemoryEntry> = await client.createMemory(memory);
Check out the examples directory for complete implementation examples:
We welcome contributions! Please see our Contributing Guide for details.
MIT © Lanonasis Team
Made with ❤️ by the Lanonasis Team
FAQs
Universal Memory as a Service (MaaS) Client SDK - Works everywhere: Browser, Node.js, React, Vue, Edge Functions
The npm package @lanonasis/memory-client receives a total of 7 weekly downloads. As such, @lanonasis/memory-client popularity was classified as not popular.
We found that @lanonasis/memory-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.