This document contains development and contribution guidelines for the Meeting BaaS SDK v5.0.0.
- Node.js 18+
- pnpm
-
Clone the repository
git clone https://github.com/meeting-baas/sdk-generator.git cd sdk-generator -
Install dependencies
pnpm install
The SDK build process consists of several steps, each with a specific purpose:
# Generate TypeScript client from OpenAPI spec
pnpm openapi:generateThis step:
- Cleans the
src/generated/directory - Fetches the latest OpenAPI spec from
https://api.meetingbaas.com/openapi.json - Generates TypeScript client code using Orval
- Creates API functions, Zod schemas, and MSW mocks
- Outputs organized by API tags (default, calendars, webhooks)
pnpm buildThis step:
- Compiles the SDK using tsup
- Generates CommonJS, ESM, and TypeScript declaration files
- Outputs to
dist/directory - Creates tree-shakeable bundles
# Run all tests
pnpm test
# Run unit tests only
pnpm test:unit
# Run integration tests only
pnpm test:integration
# Run tests with coverage
pnpm test:coverage
# Run tests with UI
pnpm test:ui# Lint and format code
pnpm lint
# Fix formatting issues
pnpm lint:fix# Prepare for publishing (runs lint and build)
pnpm prepublishOnlyFor a complete development cycle from OpenAPI spec to published package:
# 1. Update OpenAPI client
pnpm openapi:rebuild
# 2. Build the SDK
pnpm build
# 3. Run tests
pnpm test
# 4. Check code quality
pnpm lint
# 5. Publish (if ready)
pnpm publishFor making changes to the SDK wrapper:
# 1. Make your changes to src/node/
# 2. Build the SDK
pnpm build
# 3. Run tests
pnpm test
# 4. Check code quality
pnpm lintWhen the OpenAPI spec changes:
# 1. Regenerate from latest spec
pnpm openapi:rebuild
# 2. Review generated changes
git diff src/generated/
# 3. Update SDK wrapper if needed
# 4. Build and test
pnpm build && pnpm testsrc/
├── generated/ # Generated OpenAPI client
│ ├── api/ # Generated API functions
│ │ ├── calendars/ # Calendar API functions
│ │ ├── default/ # Default API functions
│ │ └── webhooks/ # Webhook API functions
│ └── schema/ # Generated TypeScript types
├── node/ # SDK wrapper implementation
│ ├── api.ts # API wrapper functions
│ ├── client.ts # Main client factory
│ └── types.d.ts # Configuration types
└── index.ts # Main entry point
dist/ # Built output
├── index.js # CommonJS bundle
├── index.mjs # ES Module bundle
└── index.d.ts # TypeScript declarations
test/ # Test files
├── unit/ # Unit tests
├── integration/ # Integration tests
├── setup.ts # Test setup
└── error-handling.test.ts # Error handling tests
scripts/
├── preprocess.js # OpenAPI preprocessing
└── ... # Other build scripts
The SDK uses Orval for code generation from the OpenAPI specification:
- API Functions: Generated TypeScript functions for each endpoint
- Zod Schemas: Generated validation schemas for all parameters
- MSW Mocks: Generated mock handlers for testing
- TypeScript Types: Generated types for all API models
The SDK wrapper (src/node/) provides:
- Client Factory:
createBaasClient()function for creating clients - API Wrapper: Generic wrapper functions with error handling
- Type Safety: Discriminated union responses for type-safe error handling
- Validation: Automatic Zod schema validation for all parameters
All API methods return discriminated union responses:
type ApiResponse<T> =
| { success: true; data: T; error?: never }
| { success: false; error: ZodError | Error; data?: never }This provides:
- Type-safe error handling
- Automatic parameter validation
- Consistent error responses
- No need for try/catch blocks
Unit tests focus on:
- Client creation and configuration
- Parameter validation
- Error handling
- Individual method behavior
Integration tests focus on:
- End-to-end API calls
- Real API responses
- Error scenarios
- Complex workflows
Tests use MSW (Mock Service Worker) to:
- Mock API responses
- Test error scenarios
- Provide consistent test data
- Avoid real API calls during testing
The project uses Biome for:
- Code formatting
- Linting
- Type checking
- Import sorting
- Strict TypeScript configuration
- Generated types from OpenAPI spec
- Full type coverage
- No
anytypes
We welcome contributions to the Meeting BaaS SDK! Please feel free to submit issues or pull requests.
- Code Style: Follow the existing TypeScript code style
- Testing: Add tests for new features
- Documentation: Update both README.md and DEVELOPMENT.md as needed
- Commits: Use conventional commits format
- Create a feature branch
- Make your changes
- Run tests and build
- Submit a pull request
Ensure your changes pass:
# Run all checks
pnpm lint
pnpm build
pnpm test
pnpm test:coverageNo environment variables are required for development. The SDK uses the public OpenAPI specification.
If you encounter build issues:
-
Clean and rebuild:
pnpm clean pnpm openapi:rebuild pnpm build
-
Check TypeScript errors:
pnpm lint
-
Verify generated code:
ls src/generated/
If tests are failing:
-
Check mock setup:
pnpm test:unit
-
Verify API responses:
pnpm test:integration
-
Check test coverage:
pnpm test:coverage
If the automation fails:
- Check Workflow Logs: Review the failed workflow run
- Verify API Changes: Ensure the OpenAPI spec is accessible
- Test Locally: Run
pnpm openapi:rebuildto verify SDK generation - Manual Trigger: Use manual dispatch to retry the workflow
This SDK automatically stays up-to-date with the Meeting BaaS API through our automated workflow:
- Daily Checks: Monitors the API specification for changes
- Auto-Generation: Regenerates the SDK when changes are detected
- Multi-Node Testing: Tests across Node.js versions 18, 19, 20, 21, and 22
- Auto-Publishing: Publishes new versions when all tests pass
- Daily at 2 AM UTC: GitHub Actions checks for API changes
- Change Detection: Compares current vs. previous OpenAPI specification
- SDK Regeneration: If changes detected, regenerates TypeScript client
- Comprehensive Testing: Runs full test suite across multiple Node versions
- Auto-Publish: If all tests pass, bumps version and publishes to npm
- Always Current: SDK automatically reflects latest API changes
- Zero Maintenance: No manual intervention required
- Quality Assured: Only publishes if all tests pass
- Multi-Platform: Ensures compatibility across Node.js versions
You can manually trigger the update process:
- Go to the Actions tab
- Select "Auto Update SDK" workflow
- Click "Run workflow"
The automation uses three GitHub Actions workflows:
- Purpose: Reusable testing workflow
- Inputs:
node-versions: Array of Node.js versions to testupload-coverage: Whether to upload coverage artifacts
- Used by: Both
test.ymlandauto-update.yml
- Triggers: PRs, pushes to main/develop, manual dispatch
- Uses:
test-sdk.ymlwith full coverage upload
- Triggers: Daily schedule, manual dispatch
- Uses:
test-sdk.ymlwithout coverage upload (faster) - Flow: Check changes → Test → Bump version → Publish → Create release
To enable automated updates, ensure these GitHub secrets are configured:
NPM_TOKEN: NPM authentication token for publishingGITHUB_TOKEN: GitHub token (automatically provided)
- Workflow Status: Check the Actions tab
- Release History: View releases
- NPM Package: Monitor npm package