This is the auto-generated Federated SDK for ArcNexus. It provides a unified client for accessing all module APIs.
import { api } from '@/lib/api';
// Access module SDKs
const users = await api.user.list();To expose your module's API through the SDK, follow these steps:
- Create SDK Entry Point: Create
src/sdk/index.tsinside your module (e.g.,modules/my-module/src/sdk/index.ts). - Inherit BaseResource: Export a class that extends
BaseResourcefrom@nexical/sdk-core. - Naming Convention: The class MUST be named
{ModuleName}SDK(PascalCase). For example, if your module ismodules/team, the class must beTeamSDK. - Auto-Discovery: Run
npm run gen:sdk(or restart the dev server) to auto-discover your new SDK module.
// modules/team/src/sdk/index.ts
import { BaseResource } from '@nexical/sdk';
export class TeamSDK extends BaseResource {
async list() {
return this.request('GET', '/teams');
}
async create(data: { name: string }) {
return this.request('POST', '/teams', data);
}
}Import DTOs directly from your module's source (e.g., ../types) to ensure strong typing in your SDK methods.