@sinequa/atomic-spfx
v0.0.120
Published
 
Maintainers
Keywords
Readme
@sinequa/atomic
A modern TypeScript package designed for use with Sinequa, providing web API helpers, authentication, configurations, and utilities.
Table of Contents
Features
- Web API Helpers: Simplify API calls with helpers for aggregations, datasets, preview, principal, query, and more.
- Authentication: Easy-to-use authentication utilities (OAuth, SAML, JWT, CSRF, etc.).
- Configurations: Centralized and type-safe configuration management.
- SharePoint Framework (SPFx) Support: Built-in AadHttpClient integration for Azure AD authentication in SPFx applications.
- Helpers & Utilities: Includes bisect, date, logger, syslang, and more.
- Type Definitions: Strongly-typed interfaces for API endpoints and data structures.
- ...and many more functions to help you build with Sinequa.
Explore the full feature set in the online documentation.
Installation
npm install @sinequa/atomicUsage
Import and use helpers in your TypeScript project:
import { fetchQuery, fetchAggregation, isAuthenticated } from '@sinequa/atomic';
// Example: Fetch data
const data = await fetchQuery({ query: 'example' });
// Example: Check authentication
if (isAuthenticated()) {
// ...
}SharePoint Framework (SPFx) Integration
For SharePoint Framework applications, initialize AadHttpClient for Azure AD authentication:
import { AadHttpClient } from '@microsoft/sp-http';
import { initializeAadHttpClient, get, post } from '@sinequa/atomic';
// In your SPFx web part onInit method:
const aadHttpClient = await this.context.aadHttpClientFactory
.getClient('api://your-sinequa-api-id');
initializeAadHttpClient(aadHttpClient);
// Now all HTTP calls automatically use Azure AD authentication
const results = await get('api/v1/query', new URLSearchParams({ query: 'example' }));See the AadHttpClient Migration Guide for detailed setup instructions.
Documentation
Comprehensive documentation is available in the Atomic Documentation Portal.
License
This project is licensed under the MIT License. See the LICENSE file for details.
