Eloquent

Documentation

@elqnt/types

Core TypeScript type definitions for the Eloquent platform. Provides foundational types used across all @elqnt/* packages.

Installation

npm install @elqnt/types

Entry Points

ImportDescription
@elqnt/typesCore types (ResponseMetadata, JSONSchema, etc.)
@elqnt/types/modelsModel types (UserStatus, Widget, Product)

Core Types

ResponseMetadata

Standard metadata included in all API responses.

import type { ResponseMetadata } from "@elqnt/types";

interface ResponseMetadata {
  success: boolean;
  timestamp: number;
  message?: string;
  error?: string;
  requestId?: string;
}

APIResponse

Unified response wrapper for HTTP endpoints.

import type { APIResponse, APIError } from "@elqnt/types";

interface APIResponse<T = unknown> {
  data?: T;
  error?: APIError;
  metadata?: ResponseMetadata;
}

interface APIError {
  code: string;      // e.g., "VALIDATION_ERROR", "NOT_FOUND"
  message: string;
  details?: Record<string, unknown>;
}

JSONSchema

JSON Schema type for dynamic forms and validation.

import type { JSONSchema } from "@elqnt/types";

interface JSONSchema {
  type: string;
  title?: string;
  description?: string;
  properties?: Record<string, JSONSchema>;
  items?: JSONSchema;
  required?: string[];

  // Validation
  minLength?: number;
  maxLength?: number;
  minimum?: number;
  maximum?: number;
  pattern?: string;
  format?: string;
  enum?: unknown[];

  // Extended properties
  "x-searchable"?: boolean;
  "x-unique"?: boolean;
  "x-displayOrder"?: number;
}

Variable

Variable type for workflow and agent configurations.

import type { Variable, DataType } from "@elqnt/types";

interface Variable {
  type: DataType;
  value: unknown;
  defaultValue?: unknown;
  validation?: VariableValidation;
  scope: VariableScope;
  description?: string;
  required: boolean;
}

type DataType =
  | "string"
  | "int"
  | "float"
  | "boolean"
  | "date"
  | "json"
  | "array"
  | "file";

Model Types

User Status

import type { UserStatusTS } from "@elqnt/types/models";

type UserStatusTS = "online" | "away" | "busy" | "offline";

Product Names

import type { ProductNameTS } from "@elqnt/types/models";

type ProductNameTS =
  | "shop-assist"
  | "public-sector"
  | "hub"
  | "finance"
  | "legal"
  | "real-estate"
  | "quick-mind"
  | "doc-brain"
  | "done-projects";

Widget Types

import type { Widget, ChartSettings, ChartType } from "@elqnt/types/models";

interface Widget {
  id?: string;
  userId: string;
  title: string;
  type: WidgetType;
  chartSettings?: ChartSettings;
  slotIndex: number;
}

type ChartType = "Bar chart" | "Line chart" | "Pie chart" | "Doughnut chart" | "Metric";

Migration Notice

Admin and billing types have moved to @elqnt/admin:

// OLD (deprecated)
import type { User, Org, Plan } from "@elqnt/types/models";

// NEW
import type { User, Org, Plan } from "@elqnt/admin/models";

See @elqnt/admin for:

  • User, Org, OrgRole, Permission
  • Billing types (Plan, OrganizationBilling, CreditBalance)
  • Onboarding and subscription types

Type Generation

Types are generated from Go using tygo:

cd backend && tygo generate

Source locations:

  • blazi/common/types@elqnt/types/models/types.ts
  • blazi/common/models/user@elqnt/types/models/user-models.ts

See Also