Deprecate legacy login/register methods, update types
- Mark login() and register() as @deprecated (use Better Auth directly) - Sync types with backend changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1c2bbad844
commit
6e1689f858
3 files changed
+158
-2
No files matched your search
+59
-2
@@ -2,10 +2,13 @@ import type {
|
|||||||
ElydoraClientConfig,
|
ElydoraClientConfig,
|
||||||
CreateOperationParams,
|
CreateOperationParams,
|
||||||
EOR,
|
EOR,
|
||||||
|
IntegrationType,
|
||||||
RegisterAgentRequest,
|
RegisterAgentRequest,
|
||||||
RegisterAgentResponse,
|
RegisterAgentResponse,
|
||||||
GetAgentResponse,
|
GetAgentResponse,
|
||||||
ListAgentsResponse,
|
ListAgentsResponse,
|
||||||
|
UpdateAgentResponse,
|
||||||
|
FreezeAgentResponse,
|
||||||
UnfreezeAgentResponse,
|
UnfreezeAgentResponse,
|
||||||
DeleteAgentResponse,
|
DeleteAgentResponse,
|
||||||
SubmitOperationResponse,
|
SubmitOperationResponse,
|
||||||
@@ -24,6 +27,11 @@ import type {
|
|||||||
RotateApiTokenResponse,
|
RotateApiTokenResponse,
|
||||||
JWKSResponse,
|
JWKSResponse,
|
||||||
HealthResponse,
|
HealthResponse,
|
||||||
|
DeepHealthResponse,
|
||||||
|
ListWebhooksResponse,
|
||||||
|
RegisterWebhookResponse,
|
||||||
|
ListMembersResponse,
|
||||||
|
ListAdminEventsResponse,
|
||||||
AuthRegisterResponse,
|
AuthRegisterResponse,
|
||||||
AuthLoginResponse,
|
AuthLoginResponse,
|
||||||
ErrorResponse,
|
ErrorResponse,
|
||||||
@@ -90,6 +98,9 @@ export class ElydoraClient {
|
|||||||
// Auth (static methods — no instance needed)
|
// Auth (static methods — no instance needed)
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use Better Auth endpoints directly. See docs.
|
||||||
|
*/
|
||||||
static async register(
|
static async register(
|
||||||
baseUrl: string,
|
baseUrl: string,
|
||||||
email: string,
|
email: string,
|
||||||
@@ -111,6 +122,9 @@ export class ElydoraClient {
|
|||||||
return handleResponse<AuthRegisterResponse>(res);
|
return handleResponse<AuthRegisterResponse>(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use Better Auth endpoints directly. See docs.
|
||||||
|
*/
|
||||||
static async login(
|
static async login(
|
||||||
baseUrl: string,
|
baseUrl: string,
|
||||||
email: string,
|
email: string,
|
||||||
@@ -154,8 +168,12 @@ export class ElydoraClient {
|
|||||||
return this.request<GetAgentResponse>('GET', `/v1/agents/${encodeURIComponent(agentId)}`);
|
return this.request<GetAgentResponse>('GET', `/v1/agents/${encodeURIComponent(agentId)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async freezeAgent(agentId: string, reason: string): Promise<void> {
|
async updateAgent(agentId: string, integType: IntegrationType): Promise<UpdateAgentResponse> {
|
||||||
await this.request<unknown>('POST', `/v1/agents/${encodeURIComponent(agentId)}/freeze`, { reason });
|
return this.request<UpdateAgentResponse>('PATCH', `/v1/agents/${encodeURIComponent(agentId)}`, { integration_type: integType });
|
||||||
|
}
|
||||||
|
|
||||||
|
async freezeAgent(agentId: string, reason: string): Promise<FreezeAgentResponse> {
|
||||||
|
return this.request<FreezeAgentResponse>('POST', `/v1/agents/${encodeURIComponent(agentId)}/freeze`, { reason });
|
||||||
}
|
}
|
||||||
|
|
||||||
async listAgents(): Promise<ListAgentsResponse> {
|
async listAgents(): Promise<ListAgentsResponse> {
|
||||||
@@ -328,6 +346,45 @@ export class ElydoraClient {
|
|||||||
return handleResponse<HealthResponse>(res);
|
return handleResponse<HealthResponse>(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async deepHealth(): Promise<DeepHealthResponse> {
|
||||||
|
const url = `${this.baseUrl}/v1/health/deep`;
|
||||||
|
const res = await fetch(url, { method: 'GET', headers: { 'Accept': 'application/json' } });
|
||||||
|
return handleResponse<DeepHealthResponse>(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Webhooks
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
async listWebhooks(): Promise<ListWebhooksResponse> {
|
||||||
|
return this.request<ListWebhooksResponse>('GET', '/v1/webhooks');
|
||||||
|
}
|
||||||
|
|
||||||
|
async registerWebhook(endpointUrl: string, events: string[], secret: string): Promise<RegisterWebhookResponse> {
|
||||||
|
return this.request<RegisterWebhookResponse>('POST', '/v1/webhooks', { endpoint_url: endpointUrl, events, secret });
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteWebhook(webhookId: string): Promise<void> {
|
||||||
|
await this.request<unknown>('DELETE', `/v1/webhooks/${encodeURIComponent(webhookId)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Members
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
async listMembers(): Promise<ListMembersResponse> {
|
||||||
|
return this.request<ListMembersResponse>('GET', '/v1/members');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// Admin events
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
async listAdminEvents(limit?: number): Promise<ListAdminEventsResponse> {
|
||||||
|
const query = limit ? `?limit=${limit}` : '';
|
||||||
|
return this.request<ListAdminEventsResponse>('GET', `/v1/admin/events${query}`);
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Internal HTTP helpers
|
// Internal HTTP helpers
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ export type {
|
|||||||
KeyStatus,
|
KeyStatus,
|
||||||
ExportStatus,
|
ExportStatus,
|
||||||
RbacRole,
|
RbacRole,
|
||||||
|
IntegrationType,
|
||||||
|
AdminAction,
|
||||||
ErrorCode,
|
ErrorCode,
|
||||||
|
|
||||||
// Entities
|
// Entities
|
||||||
@@ -33,6 +35,8 @@ export type {
|
|||||||
Receipt,
|
Receipt,
|
||||||
Epoch,
|
Epoch,
|
||||||
Organization,
|
Organization,
|
||||||
|
AdminEvent,
|
||||||
|
AgentAssignment,
|
||||||
User,
|
User,
|
||||||
Export,
|
Export,
|
||||||
|
|
||||||
@@ -47,6 +51,9 @@ export type {
|
|||||||
RegisterAgentResponse,
|
RegisterAgentResponse,
|
||||||
GetAgentResponse,
|
GetAgentResponse,
|
||||||
ListAgentsResponse,
|
ListAgentsResponse,
|
||||||
|
UpdateAgentRequest,
|
||||||
|
UpdateAgentResponse,
|
||||||
|
FreezeAgentResponse,
|
||||||
UnfreezeAgentResponse,
|
UnfreezeAgentResponse,
|
||||||
DeleteAgentResponse,
|
DeleteAgentResponse,
|
||||||
SubmitOperationResponse,
|
SubmitOperationResponse,
|
||||||
@@ -66,6 +73,11 @@ export type {
|
|||||||
JWK,
|
JWK,
|
||||||
JWKSResponse,
|
JWKSResponse,
|
||||||
HealthResponse,
|
HealthResponse,
|
||||||
|
DeepHealthResponse,
|
||||||
|
ListWebhooksResponse,
|
||||||
|
RegisterWebhookResponse,
|
||||||
|
ListMembersResponse,
|
||||||
|
ListAdminEventsResponse,
|
||||||
AuthRegisterResponse,
|
AuthRegisterResponse,
|
||||||
AuthLoginResponse,
|
AuthLoginResponse,
|
||||||
ErrorResponse,
|
ErrorResponse,
|
||||||
|
|||||||
@@ -11,6 +11,16 @@ export type RbacRole =
|
|||||||
| 'compliance_auditor'
|
| 'compliance_auditor'
|
||||||
| 'readonly_investigator'
|
| 'readonly_investigator'
|
||||||
| 'integration_engineer';
|
| 'integration_engineer';
|
||||||
|
export type IntegrationType =
|
||||||
|
| 'claudecode' | 'cursor' | 'gemini' | 'kirocli' | 'kiroide'
|
||||||
|
| 'opencode' | 'copilot' | 'letta' | 'codex' | 'kimi'
|
||||||
|
| 'enterprise' | 'gui' | 'sdk' | 'other';
|
||||||
|
export type AdminAction =
|
||||||
|
| 'agent.register' | 'agent.update' | 'agent.freeze' | 'agent.unfreeze'
|
||||||
|
| 'agent.revoke' | 'agent.delete' | 'key.revoke' | 'export.create'
|
||||||
|
| 'org.create' | 'org.update'
|
||||||
|
| 'member.invite' | 'member.remove' | 'member.role_change'
|
||||||
|
| 'agent.assign' | 'agent.unassign';
|
||||||
export type ErrorCode =
|
export type ErrorCode =
|
||||||
| 'INVALID_SIGNATURE'
|
| 'INVALID_SIGNATURE'
|
||||||
| 'UNKNOWN_AGENT'
|
| 'UNKNOWN_AGENT'
|
||||||
@@ -36,6 +46,7 @@ export interface Agent {
|
|||||||
readonly org_id: string;
|
readonly org_id: string;
|
||||||
readonly display_name: string;
|
readonly display_name: string;
|
||||||
readonly responsible_entity: string;
|
readonly responsible_entity: string;
|
||||||
|
readonly integration_type: IntegrationType;
|
||||||
readonly status: AgentStatus;
|
readonly status: AgentStatus;
|
||||||
readonly created_at: number;
|
readonly created_at: number;
|
||||||
readonly updated_at: number;
|
readonly updated_at: number;
|
||||||
@@ -92,10 +103,32 @@ export interface Epoch {
|
|||||||
export interface Organization {
|
export interface Organization {
|
||||||
readonly org_id: string;
|
readonly org_id: string;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
readonly description: string;
|
||||||
|
readonly ba_org_id: string | null;
|
||||||
readonly created_at: number;
|
readonly created_at: number;
|
||||||
readonly updated_at: number;
|
readonly updated_at: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AdminEvent {
|
||||||
|
readonly event_id: string;
|
||||||
|
readonly org_id: string;
|
||||||
|
readonly actor: string;
|
||||||
|
readonly action: string;
|
||||||
|
readonly target_type: string;
|
||||||
|
readonly target_id: string;
|
||||||
|
readonly details: string | null;
|
||||||
|
readonly created_at: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AgentAssignment {
|
||||||
|
readonly id: string;
|
||||||
|
readonly agent_id: string;
|
||||||
|
readonly user_id: string;
|
||||||
|
readonly org_id: string;
|
||||||
|
readonly assigned_by: string;
|
||||||
|
readonly created_at: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface User {
|
export interface User {
|
||||||
readonly user_id: string;
|
readonly user_id: string;
|
||||||
readonly org_id: string;
|
readonly org_id: string;
|
||||||
@@ -219,6 +252,8 @@ export interface GetEpochResponse {
|
|||||||
readonly epoch: Epoch;
|
readonly epoch: Epoch;
|
||||||
readonly anchor?: {
|
readonly anchor?: {
|
||||||
readonly tsa_token?: string;
|
readonly tsa_token?: string;
|
||||||
|
readonly tsa_url?: string;
|
||||||
|
readonly anchored_at?: number;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,14 +286,66 @@ export interface ListAgentsResponse {
|
|||||||
readonly agents: Agent[];
|
readonly agents: Agent[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UpdateAgentRequest {
|
||||||
|
readonly integration_type: IntegrationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateAgentResponse {
|
||||||
|
readonly agent: Agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FreezeAgentResponse {
|
||||||
|
readonly agent: Agent;
|
||||||
|
readonly previous_status: AgentStatus;
|
||||||
|
}
|
||||||
|
|
||||||
export interface UnfreezeAgentResponse {
|
export interface UnfreezeAgentResponse {
|
||||||
readonly agent: Agent;
|
readonly agent: Agent;
|
||||||
|
readonly previous_status: AgentStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteAgentResponse {
|
export interface DeleteAgentResponse {
|
||||||
readonly deleted: boolean;
|
readonly deleted: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ListWebhooksResponse {
|
||||||
|
readonly webhooks: unknown[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RegisterWebhookResponse {
|
||||||
|
readonly webhook_id: string;
|
||||||
|
readonly endpoint_url: string;
|
||||||
|
readonly events: string[];
|
||||||
|
readonly created_at: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListMembersResponse {
|
||||||
|
readonly members: {
|
||||||
|
readonly member_id: string;
|
||||||
|
readonly user_id: string;
|
||||||
|
readonly role: string;
|
||||||
|
readonly joined_at: string;
|
||||||
|
readonly email: string;
|
||||||
|
readonly display_name: string;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListAdminEventsResponse {
|
||||||
|
readonly events: AdminEvent[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeepHealthResponse {
|
||||||
|
readonly status: 'healthy' | 'degraded';
|
||||||
|
readonly version: string;
|
||||||
|
readonly protocol_version: string;
|
||||||
|
readonly timestamp: number;
|
||||||
|
readonly dependencies: {
|
||||||
|
readonly d1: { status: 'ok' | 'failed'; latency_ms: number; error?: string };
|
||||||
|
readonly r2: { status: 'ok' | 'failed'; latency_ms: number; error?: string };
|
||||||
|
readonly kv: { status: 'ok' | 'failed'; latency_ms: number; error?: string };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface GetMeResponse {
|
export interface GetMeResponse {
|
||||||
readonly user: User;
|
readonly user: User;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user