feat: template

This commit is contained in:
mertmit
2025-05-23 07:01:58 +00:00
parent c650e16edc
commit 5e64289905

View File

@@ -52,6 +52,8 @@ Each integration package contains its own tests in a `tests/` directory. All tes
## Creating a New Integration
Alternatively, you can create a new package manually:
1. Create a new package in the `packages` directory
2. Follow the integration package structure:
```
@@ -69,3 +71,83 @@ Each integration package contains its own tests in a `tests/` directory. All tes
3. Implement the required interfaces from `@noco-integrations/core`
4. Add tests for your integration
## Sync Integration Standardization Guidelines
This document outlines the standards and best practices for creating and maintaining sync integrations in the NocoDB integrations monorepo.
### Structure
Every sync integration should follow this structure:
```
packages/[provider]-sync/
├── package.json # Dependencies and metadata
├── tsconfig.json # TypeScript configuration
└── src/
├── index.ts # Integration entry point
├── integration.ts # Implementation class
├── form.ts # Configuration UI definition
└── manifest.ts # Integration metadata
```
### Implementation Standards
1. **Class Structure**
- Extend the `SyncIntegration` abstract class
- Implement all required methods:
- `getDestinationSchema()`
- `fetchData()`
- `formatData()`
- `getIncrementalKey()`
2. **Error Handling**
- Use try/catch blocks for all API calls
- Log errors with descriptive messages
- Include provider-specific error codes where possible
3. **Pagination**
- Implement proper pagination for all API endpoints
- Use provider-specific pagination mechanisms
4. **Data Mapping**
- Follow consistent patterns when mapping provider data to NocoDB schema
- Use helper methods for complex mappings
5. **Authentication**
- Use auth integrations correctly
- Handle token refresh when needed
### Code Style
1. **Naming Conventions**
- Class name: `[Provider]SyncIntegration`
- File names: lowercase with hyphens
- Config interface: `[Provider]SyncPayload`
2. **Logging**
- Use the built-in `this.log()` method
- Format log messages as `[Provider Sync] Message`
3. **Comments**
- Document complex logic or workarounds
### Configuration Form
1. **Required Fields**
- Authentication integration selection
- Provider-specific identifiers (repo, project, etc.)
2. **Optional Fields**
- Data filtering options (e.g., include closed items)
- Sync frequency settings
### Testing
1. **Manual Testing**
- Test with real provider accounts
- Verify incremental sync works correctly
2. **Automated Testing**
- Create unit tests for data mapping functions
- Use mocks for API responses