@hurairabaloch/cvent_integration
v1.0.0
Published
Cvent Integration Functions for EventZero
Readme
Cvent Integration Package
A TypeScript package for integrating with Cvent's API, providing type-safe functions for event management, budget tracking, and data synchronization.
Features
- 100% TypeScript: Fully typed with strict TypeScript configuration
- Mongoose Integration: Proper typing for all database models
- Cvent API Integration: Typed interfaces for Cvent API responses
- Automated Releases: GitHub Actions for CI/CD and automated NPM publishing
Installation
npm install @EventZeroHuddle/cvent_integrationUsage
import { CventService, syncAllEventsWithCvent, connectToDB, EventModal } from '@EventZeroHuddle/cvent_integration';
// Connect to database
await connectToDB();
// Sync events from Cvent
const syncEvent = {
_id: 'sync-id',
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
region: 'NORTH_AMERICA',
organizationId: 'org-id',
maxEvents: 100,
CventCustomFieldsEvent: [],
};
await syncAllEventsWithCvent(syncEvent);Development
Prerequisites
- Node.js 20+
- npm or yarn
Setup
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run linting
npm run lint
# Watch mode for development
npm run devGitHub Actions Workflows
This repository includes three GitHub Actions workflows:
1. CI Workflow (.github/workflows/ci.yml)
- Triggers: Pull requests to main branch
- Purpose: Ensures code quality and build integrity
- Actions:
- TypeScript compilation
- Linting
- Build artifact verification
2. Release Workflow (.github/workflows/release.yml)
- Triggers: Push to main branch
- Purpose: Simple automated release with incremental versioning
- Actions:
- Build and test
- Create GitHub release
- Publish to NPM
- Create git tags
3. Semantic Release Workflow (.github/workflows/semantic-release.yml)
- Triggers: Push to main branch
- Purpose: Intelligent versioning based on conventional commits
- Actions:
- Analyze commit messages
- Generate changelog
- Determine version bump (patch/minor/major)
- Publish to NPM
- Create GitHub release
Commit Convention
For semantic versioning to work properly, use conventional commits:
feat: add new feature (minor version bump)
fix: bug fix (patch version bump)
docs: documentation changes (no version bump)
style: formatting changes (no version bump)
refactor: code refactoring (no version bump)
test: add tests (no version bump)
chore: maintenance tasks (no version bump)Examples:
feat: add hotel booking integration→ minor version bumpfix: resolve authentication timeout issue→ patch version bumpfeat!: breaking change in API→ major version bump
Configuration
Environment Variables
The package requires the following environment variables:
MONGODB_CONNECTION_STRING=mongodb://...
API_NINJA_API_KEY=your-api-key
RESULT_URL=https://your-api.com/results/
INTEGRATION_ENGINE_SECRET_KEY=your-secret-keyNPM Registry
This package is configured to publish to GitHub Packages:
{
"publishConfig": {
"registry": "https://npm.pkg.github.com"
}
}API Reference
Services
CventService
obtainAccessToken(clientId, clientSecret, region)fetchAllEvents(clientId, clientSecret, region)getEventBudget(eventId, clientId, clientSecret, region)getFoodAndBeveragesBudgetItems(eventId, clientId, clientSecret, region)getAttendiesByEventId(clientId, clientSecret, region, eventId)getEventAirActual(clientId, clientSecret, region, eventId)
Event Services
syncAllEventsWithCvent(syncEvent)syncSingleEventWithCvent(cventEvent, syncEvent, organizationName)
Models
EventModal- Event database modelOrganizationModal- Organization database modelFlightModal- Flight database modelAccommodationModal- Accommodation database modelCventBudgetItemsModal- Budget items database model
License
ISC
Contributing
- Fork the repository
- Create a feature branch
- Make your changes with proper TypeScript typing
- Add tests if applicable
- Submit a pull request
The CI workflow will automatically run tests and linting on your pull request.
