UNPKG

anaf-ts-sdk

Version:

Complete TypeScript SDK for Romanian ANAF API -E-Factura, Company checks

51 lines (50 loc) 1.74 kB
/** * ANAF e-Factura TypeScript SDK * * A comprehensive TypeScript SDK for interacting with the Romanian ANAF e-Factura system. * Provides OAuth 2.0 authentication, document upload/download, validation, UBL generation, * and company data lookup from the public ANAF API. * * @example * ```typescript * import { AnafAuthenticator, AnafEfacturaClient, AnafDetailsClient } from 'efactura-ts-sdk'; * * // Setup authentication * const auth = new AnafAuthenticator({ * clientId: 'your-oauth-client-id', * clientSecret: 'your-oauth-client-secret', * redirectUri: 'https://your-app.com/callback' * }); * * // Setup API client * const client = new AnafEfacturaClient({ * vatNumber: 'RO12345678', * testMode: true * }); * * // Setup company details client * const detailsClient = new AnafDetailsClient(); * * // Authenticate and get tokens * const authUrl = auth.getAuthorizationUrl(); * const tokens = await auth.exchangeCodeForToken(authCode); * * // Use tokens for API operations * const uploadResult = await client.uploadDocument(tokens.access_token, xmlContent); * * // Fetch company data * const companyData = await detailsClient.getCompanyData('RO12345678'); * ``` */ export { AnafEfacturaClient } from './AnafClient'; export { AnafAuthenticator } from './AnafAuthenticator'; export { AnafDetailsClient } from './AnafDetailsClient'; export { UblBuilder } from './UblBuilder'; export * from './types'; export * from './errors'; export * from './ubl'; export * as Utils from './utils/xmlParser'; export * as DateUtils from './utils/dateUtils'; export * as FormUtils from './utils/formEncoder'; export * as Constants from './constants'; export { AnafEfacturaClient as default } from './AnafClient';