@med.me/adt-sdk
v1.0.28-alpha.1
Published
Medme ADT SDK
Downloads
16
Readme
@med.me/adt-sdk
Medme ADT SDK - TypeScript client library for ADT API
Installation
npm install @med.me/adt-sdk
# or
yarn add @med.me/adt-sdkUsage
import { OpenAPI, PatientService, ActivityService } from '@med.me/adt-sdk';
// Configure the API client
OpenAPI.BASE = 'http://localhost:5000';
OpenAPI.TOKEN = 'your-auth-token';
// Use the services
const patients = await PatientService.getPatients();
const activities = await ActivityService.getActivities();Development
Prerequisites
- Make sure the ADT backend (
adt-core) is running onhttp://localhost:5000 - Ensure you have the required dependencies installed
SDK Update Process
1. Update Backend API Schema
In the adt-core project:
yarn gen:openapi # Generate updated openapi.json
yarn start:dev # Start server to serve OpenAPI schema2. Regenerate SDK Code
In the adt-sdk project:
# Install dependencies (first time only)
yarn install
# Generate new SDK code from current backend
API_URL=http://localhost:5000/openapi-json yarn codegen-local
# Build the SDK
yarn build3. Update Frontend Project
In the adt-front project:
# Update SDK dependency
yarn installVersion Management
When updating the SDK with new changes:
Update version in
package.json:npm version patch # for bug fixes npm version minor # for new features npm version major # for breaking changesBuild and test:
yarn buildPublish (if using npm registry):
npm publish
Scripts
yarn codegen-local- Generate SDK code from local backend APIyarn build- Build the SDK for distribution
Project Structure
src/
├── core/ # Core API utilities
├── models/ # TypeScript type definitions
├── services/ # API service classes
└── index.ts # Main export fileNotes
- The SDK is automatically generated from OpenAPI specification
- Do not manually edit generated files in
src/- they will be overwritten - Always use the
codegen-localscript to update the SDK - The SDK uses fetch API client for HTTP requests
Troubleshooting
Common Issues
"openapi command not found"
yarn add -D openapi-typescript-codegenBackend not responding
- Ensure
adt-coreis running on port 5000 - Check that
/openapi-jsonendpoint is accessible
- Ensure
Build errors after regeneration
- Check for naming conflicts in generated types
- Verify OpenAPI schema is valid
Getting Help
If you encounter issues during SDK update:
- Check that backend API is running and accessible
- Verify the OpenAPI schema is valid
- Review generated code for any obvious issues
- Check console for specific error messages
