@aimform/identity-sdk
v0.2.0
Published
Aimform Identity — Auth, Organizations, Profiles, Spaces, Entities, Conversations, Tools, Workflows, Permissions. Clean namespace API.
Maintainers
Readme
@aimform/identity-sdk
Aimform Identity SDK — clean namespace API for the Aimform Identity Service.
npm install @aimform/identity-sdkQuick Start
import { Identity, Organizations, Spaces, Entities, Conversations, Auth } from "@aimform/identity-sdk";
// Configure once
Identity.configure({
baseUrl: "https://identity.aimform.com",
token: "your-session-token",
});
// Organizations
const orgs = await Organizations.list();
const org = await Organizations.create({ name: "My Company", slug: "my-co" });
// Spaces
const spaces = await Spaces.list(org.id);
const space = await Spaces.create(org.id, { name: "General", slug: "general" });
// Entities
const entities = await Entities.list(org.id, space.id);
const entity = await Entities.create(org.id, space.id, {
entity_type: "case",
properties: { status: "active", priority: "high" },
});
// Conversations
const conversations = await Conversations.list(org.id);
const conversation = await Conversations.create(org.id, { title: "Support chat" });
await Conversations.send(org.id, conversation.id, { role: "user", content: "Hello!" });
// Tools
const tools = await Tools.list(org.id);
await Tools.create(org.id, { name: "search_docs", description: "Search documents", implementation: "external_call" });Browser Client (Auth + localStorage)
import { Identity, Auth, Organizations } from "@aimform/identity-sdk/client";
Identity.configure({ baseUrl: "https://identity.aimform.com" });
// Auth auto-manages token in localStorage
await Auth.register("[email protected]", "password123", "Jane Doe");
await Auth.login("[email protected]", "password123");
Auth.logout();
// Use any module — token is attached automatically
const orgs = await Organizations.list();API Reference
Identity
| Method | Description |
|--------|-------------|
| Identity.configure({ baseUrl, token? }) | Set base URL and token |
Auth (client only)
| Method | Description |
|--------|-------------|
| Auth.register(email, password, name?) | Register → auto-login |
| Auth.login(email, password) | Login → stores token |
| Auth.logout() | Logout → clears token |
| Auth.validate() | Check session validity |
| Auth.me() | Current user + organizations |
Organizations
| Method | Description |
|--------|-------------|
| Organizations.list() | List user's organizations |
| Organizations.get(orgId) | Get org + members |
| Organizations.create({ name, slug }) | Create new org |
| Organizations.update(orgId, { name?, slug? }) | Update org |
Members
| Method | Description |
|--------|-------------|
| Members.list(orgId) | List org members |
| Members.invite(orgId, { email, role? }) | Invite a member |
| Members.remove(orgId, memberId) | Remove a member |
Spaces
| Method | Description |
|--------|-------------|
| Spaces.list(orgId) | List spaces |
| Spaces.get(orgId, spaceId) | Get space + entity count |
| Spaces.create(orgId, { name, slug }) | Create space |
| Spaces.update(orgId, spaceId, data) | Update space |
| Spaces.remove(orgId, spaceId) | Delete space |
Entities
| Method | Description |
|--------|-------------|
| Entities.list(orgId, spaceId, entityType?) | List entities |
| Entities.get(orgId, spaceId, entityId) | Get entity + blocks |
| Entities.create(orgId, spaceId, data) | Create entity |
| Entities.update(orgId, spaceId, entityId, data) | Update entity |
| Entities.remove(orgId, spaceId, entityId) | Delete entity |
Blocks
| Method | Description |
|--------|-------------|
| Blocks.add(orgId, spaceId, entityId, data) | Add block to entity |
| Blocks.update(orgId, spaceId, entityId, blockId, data) | Update block |
Conversations
| Method | Description |
|--------|-------------|
| Conversations.list(orgId) | List conversations |
| Conversations.get(orgId, conversationId) | Get conversation + messages |
| Conversations.create(orgId, { title? }) | Create conversation |
| Conversations.send(orgId, conversationId, { role, content, tool_calls? }) | Append message |
Tools
| Method | Description |
|--------|-------------|
| Tools.list(orgId) | List tool definitions |
| Tools.get(orgId, toolId) | Get tool |
| Tools.create(orgId, data) | Create tool |
| Tools.update(orgId, toolId, data) | Update tool |
| Tools.remove(orgId, toolId) | Delete tool |
Workflows
| Method | Description |
|--------|-------------|
| Workflows.list(orgId) | List workflows |
| Workflows.get(orgId, workflowId) | Get workflow |
| Workflows.create(orgId, data) | Create workflow |
| Workflows.update(orgId, workflowId, data) | Update workflow |
| Workflows.remove(orgId, workflowId) | Delete workflow |
Permissions
| Method | Description |
|--------|-------------|
| Permissions.check(orgId, { action, entity_type, entity_id? }) | Check permission |
| Permissions.listPolicies(orgId) | List policies |
| Permissions.createPolicy(orgId, data) | Create policy |
| Permissions.assignRole(orgId, { profileId, role }) | Assign role |
Connections
| Method | Description |
|--------|-------------|
| Connections.list(orgId) | List connections |
| Connections.create(orgId, data) | Create connection |
| Connections.remove(orgId, connectionId) | Delete connection |
Profiles
| Method | Description |
|--------|-------------|
| Profiles.get(orgId) | Get current user's profile |
| Profiles.update(orgId, data) | Update profile |
Files
| Method | Description |
|--------|-------------|
| Files.list(orgId) | List files |
| Files.getUploadUrl(orgId, { filename, contentType }) | Get presigned upload URL |
| Files.remove(orgId, fileId) | Delete file |
Types
import type {
Organization, Space, Entity, Block, Profile,
Conversation, ConversationMessage, Connection,
ToolDefinition, Workflow, PermissionPolicy,
} from "@aimform/identity-sdk";License
MIT
