llms.txt@packages/api ยท diff
git:20260328.16667d9 to git:20260616.363929e
4 added, 4 removed. Audit A to A.
- # @cyberfabric/api
+ # @gears-frontx/api
> API communication protocols and service registry for FrontX SDK. Supports REST, SSE, and mock protocols.
- Part of the FrontX SDK Layer (L1) - can be used independently without other @cyberfabric packages. Peer dependency on axios.
+ Part of the FrontX SDK Layer (L1) - can be used independently without other @gears-frontx packages. Peer dependency on axios.
## Core API
- [BaseApiService](https://frontx.dev/docs/api/service): Abstract base class for domain services
- [apiRegistry](https://frontx.dev/docs/api/registry): Central registry for service instances
- [RestProtocol](https://frontx.dev/docs/api/rest): HTTP REST communication
- [MockPlugin](https://frontx.dev/docs/api/mock): Mock data for development/testing
## Key Patterns
- One service per domain (accounts, billing, etc.)
- Services extend BaseApiService
- Mock data registered separately from service
- Plugin system for request/response modification
- Type safety via module augmentation
## Quick Start
```typescript
- import { BaseApiService, RestProtocol, apiRegistry, MockMap } from '@cyberfabric/api';
+ import { BaseApiService, RestProtocol, apiRegistry, MockMap } from '@gears-frontx/api';
// Define service
class AccountsApiService extends BaseApiService {
constructor() {
super({ baseURL: '/api/accounts' }, new RestProtocol());
}
async getCurrentUser() {
return this.protocol(RestProtocol).get('/user/current');
}
}
// Module augmentation
- declare module '@cyberfabric/api' {
+ declare module '@gears-frontx/api' {
interface ApiServicesMap {
accounts: AccountsApiService;
}
}
// Register and use
apiRegistry.register('accounts', AccountsApiService);
apiRegistry.initialize({ useMockApi: true });
const accounts = apiRegistry.getService('accounts');
```
## Optional
- [SSE Protocol](https://frontx.dev/docs/api/sse): Server-Sent Events support
- [Custom Plugins](https://frontx.dev/docs/api/plugins): Auth, logging, retry plugins