🚀 TypeScript-klient för Amido DAX Web API - Konverterad från .NET NuGet-paketet
AmidoAB.Dax.WebClient
En modern, typsäker TypeScript-klient för DAX Web API med fullständig HMAC-SHA256-autentisering och omfattande stöd för alla DAX-endpoints.
Detta är en reverse-engineered TypeScript-konvertering av Amidos .NET NuGet-paket AmidoAB.Dax.WebClient.
- 🔧 Tredjepartsimplementation: Denna kod är inte officiellt underhållen eller godkänd av Amido AB
- 📞 Support: All support för DAX Web API, autentisering och användning sker exklusivt via Amido AB
- 📚 Officiell dokumentation: Se Amido DAX Documentation för korrekt API-användning
- 🏢 Kontakt: För frågor om DAX, kontakta Amido på hej@amido.se
- ⚖️ Ansvar: Användning sker på egen risk - verifiera alltid mot officiell DAX-dokumentation
Rekommendation: Använd detta för utveckling och tester, men förlita dig på Amidos officiella klienter för produktion.
- 🔐 Säker Autentisering: HMAC-SHA256 signerade HTTP-förfrågningar
- 🚀 Full Type Safety: Komplett TypeScript-stöd med omfattande interfaces
- 📡 Modern HTTP-klient: Byggd på Axios med automatisk retry-logik
- 🔧 Crypto-verktyg: Hjälpfunktioner för nyckelgenerering och kryptering
- 📝 Komplett API-stöd: Stöd för alla DAX Web API-endpoints
- 🛠 Utvecklarvänlig: Lättanvänd gränssnitt med detaljerad felhantering
- 📦 Lättviktig: Minimala dependencies, optimerad för Node.js och webbläsare
- 🔄 Automatisk signering: Inbyggd HMAC-SHA256 signering av alla requests
npm install dax-webclient-tsimport { DaxWebClient, DaxConfiguration, CryptoUtils } from 'dax-webclient-ts';
// Generate or use existing credentials
const config: DaxConfiguration = {
baseUrl: 'https://your-dax-instance.com',
apiKey: 'your-api-key',
privateKey: 'your-private-key',
timeout: 30000
};
// Create client instance
const client = new DaxWebClient(config);
// Use the client
async function example() {
try {
// Health check
const health = await client.healthCheck();
console.log('DAX API Status:', health.data.status);
// Get current user
const user = await client.getCurrentUser();
console.log('Current user:', user.data.username);
// List connections
const connections = await client.listConnections();
console.log('Found connections:', connections.data.totalCount);
} catch (error) {
console.error('DAX API Error:', error);
}
}The DaxConfiguration interface accepts the following options:
interface DaxConfiguration {
baseUrl: string; // DAX API base URL
apiKey: string; // Your API key
privateKey: string; // Your private key for signing requests
timeout?: number; // Request timeout in milliseconds (default: 30000)
}// Get current user
const user = await client.getCurrentUser();
// Get user by ID
const user = await client.getUserById('user-id');// Create a connection
const connection = await client.createConnection({
name: 'My Connection',
type: 'http',
sourceSystem: 'my-system',
targetSystem: 'target-system',
configuration: {
endpoint: 'https://api.example.com',
timeout: 5000
}
});
// List connections with filters
const connections = await client.listConnections({
type: 'http',
status: 'connected',
page: 1,
pageSize: 20
});
// Get connection by ID
const connection = await client.getConnectionById('connection-id');
// Update connection
const updated = await client.updateConnection('connection-id', {
name: 'Updated Connection',
status: 'disconnected'
});
// Delete connection
await client.deleteConnection('connection-id');// Send a message
const message = await client.sendMessage({
connectionId: 'connection-id',
messageType: 'data-sync',
payload: {
records: [...],
timestamp: new Date().toISOString()
}
});
// List messages with filters
const messages = await client.listMessages({
connectionId: 'connection-id',
messageType: 'data-sync',
direction: 'outbound',
status: 'completed',
page: 1,
pageSize: 50
});
// Get message by ID
const message = await client.getMessageById('message-id');// Get organization
const org = await client.getOrganizationById('org-id');
// List projects
const projects = await client.listProjects('org-id');
// Get project
const project = await client.getProjectById('project-id');The client automatically signs all HTTP requests using HMAC-SHA256 authentication. The signing process includes:
- Canonical string generation from HTTP method, URL, headers, and body
- HMAC-SHA256 signature using your private key
- Automatic inclusion of signature headers in requests
The client provides structured error information:
try {
await client.getCurrentUser();
} catch (error) {
console.error('Error code:', error.code);
console.error('Error message:', error.message);
console.error('Error details:', error.details);
}import { CryptoUtils } from 'dax-webclient-ts';
// Generate API key
const apiKey = CryptoUtils.generateApiKey();
// Generate private key
const privateKey = CryptoUtils.generatePrivateKey();
// Hash strings
const hash = CryptoUtils.hashString('sensitive-data');
// Encrypt/decrypt data
const encrypted = CryptoUtils.encryptData('data', 'key');
const decrypted = CryptoUtils.decryptData(encrypted, 'key');import { ValidationUtils } from 'dax-webclient-ts';
// Validate API key
const isValidKey = ValidationUtils.isValidApiKey('your-api-key');
// Validate URL
const isValidUrl = ValidationUtils.isValidUrl('https://example.com');
// Validate email
const isValidEmail = ValidationUtils.validateEmail('user@example.com');import { RetryUtils } from 'dax-webclient-ts';
// Retry operations with exponential backoff
const result = await RetryUtils.withRetry(
async () => {
// Your operation here
return await someAsyncOperation();
},
3, // max retries
1000 // initial delay in ms
);npm run buildnpm testnpm run devThis project is licensed under the MIT License - see the LICENSE file for details.
- DAX Web API: All support sker via Amido AB
- Dokumentation: Amido DAX Documentation
- Kontakt: hej@amido.se
- Felrapportering: Rapportera DAX-relaterade problem direkt till Amido
- Endast för TypeScript-konverteringsproblem
- Buggar i denna implementation
- Förbättringsförslag för klienten
- INTE för DAX API-frågor
Denna reverse-engineered klient tillhandahålls "som den är" utan någon garanti. Användning sker på egen risk. För produktionsanvändning, rekommenderar Amido AB deras officiella .NET-klienter.
Amido AB är utvecklaren av DAX-plattformen. Denna TypeScript-klient är en oberoende konvertering av deras .NET-bibliotek för att möjliggöra TypeScript/Node.js-integration.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
- Initial TypeScript implementation
- Full API coverage for DAX Web API
- HMAC-SHA256 authentication
- Comprehensive error handling
- Utility functions for crypto and validation