feat(s3-integration): implement complete S3 integration with Zustand store and endpoints
Summary
Implement complete S3 integration for ANIR document indexing system. This PR adds:
- S3 API endpoints layer with folder listing, indexation job management, and document tracking
- Zustand-based state store with robust error handling and automatic polling
- Full integration with S3 configuration components in the ANIR wizard
- TypeScript-first implementation with complete type safety
Changes Made
New Files
-
src/shared/api/endpoints/integration-service/s3-endpoints.ts- 7 endpoints for S3 operations
- Helper functions for common API calls
- Follows anir-wizard-endpoints pattern
-
src/shared/api/stores/integration-service/s3-store.ts- Zustand store for S3 state management
- Types:
FolderNode,IndexationJob,IndexedDocument - Actions: folder loading, job creation/polling, document management
- Error handling with
getErrorMessage()utility - Automatic job status polling
Modified Files
-
s3-config.tsx- Added S3 store import and usage
- Auto-load folders when account is selected
- Pass loading state to child components
-
s3-guide-card.tsx- Added optional
isLoadinganderrorprops - Ready for integration with store loading states
- Added optional
-
s3-indexing-card.tsx- Added store import and folder/loading state access
- Added
isLoadingprop to interface
-
s3-frequency-card.tsx- Added store import for consistency
- Access to loading state for future enhancements
API Integration
Endpoints Implemented
GET /integrations/folders/amazon_s3/{account_uid}?prefix={prefix}
POST /integrations/indexations/jobs
GET /integrations/indexations/jobs/{job_id}
GET /integrations/indexations/jobs
GET /integrations/indexations/stats
GET /integrations/indexations/documents
DELETE /integrations/indexations/documents/{doc_id}
Store Actions Available
-
loadFoldersS3(accountUid, prefix?)- Load S3 bucket folders -
createIndexationJob(request)- Create new indexation job -
getJobStatus(jobId)- Get single job status -
listJobs(filters?)- List all jobs with optional filters -
pollJobStatus(jobId, intervalMs?)- Auto-poll until job completes -
listIndexedDocuments(filters?)- List indexed documents -
deleteDocument(docId)- Delete indexed document -
selectFolder/deselectFolder()- Manage folder selection -
clearError/reset()- State utilities
Type Safety
New Types
FolderNode - S3 folder/file structure
IndexationJob - Job tracking with progress
IndexedDocument - Document metadata after indexing
IndexationJobRequest - Job creation payload
JobFilters/DocumentFilters - Query filters