@elqnt/docs
v4.2.0
Published
Document management utilities for Eloquent platform
Readme
@elqnt/docs
Document management utilities for Eloquent platform. Provides API functions for managing document libraries, folders, and document references.
Building a custom app / using an AI coding agent? Read
SKILL.md— the full agent guide: the one-way architecture (domain types → translators → hook → context → components), the gateway-token flow, the three upload workflows (metadata / file+embeddings / raw text), semantic search, and the exact spec of the five hooks (useLibraries,useFolders,useDocuments,useDocumentSearch,useAdminDocIngestion). It ships in the package, so the contract is this package's own.d.ts— your code type-checks against it.
Installation
pnpm add @elqnt/docsQuick Start
import {
listLibrariesApi,
getDefaultLibraryApi,
listDocumentsApi,
createDocumentApi,
} from "@elqnt/docs/api";
// Get the default library
const defaultLib = await getDefaultLibraryApi({
baseUrl: "https://api.elqnt.ai",
orgId: "org-uuid",
});
// List documents in a library
const docs = await listDocumentsApi(defaultLib.data.library.id, {
baseUrl: "https://api.elqnt.ai",
orgId: "org-uuid",
page: 1,
pageSize: 20,
});Exports
| Import Path | Description |
|-------------|-------------|
| @elqnt/docs | All exports |
| @elqnt/docs/api | Browser API functions |
API Reference
Libraries
| Function | Description |
|----------|-------------|
| listLibrariesApi(options) | List all document libraries |
| getDefaultLibraryApi(options) | Get the default library |
| getLibraryApi(libraryId, options) | Get a specific library |
| createLibraryApi(library, options) | Create a new library |
| updateLibraryApi(libraryId, updates, options) | Update a library |
| deleteLibraryApi(libraryId, options) | Delete a library |
import {
listLibrariesApi,
createLibraryApi,
} from "@elqnt/docs/api";
// List libraries for a specific owner
const libraries = await listLibrariesApi({
baseUrl: "https://api.elqnt.ai",
orgId: "org-uuid",
ownerEmail: "[email protected]",
});
// Create a new library
const newLib = await createLibraryApi(
{ name: "Project Documents", description: "Docs for Project X" },
{ baseUrl: "https://api.elqnt.ai", orgId: "org-uuid" }
);Folders
| Function | Description |
|----------|-------------|
| listFoldersApi(libraryId, options) | List folders in a library |
| createFolderApi(folder, options) | Create a new folder |
| updateFolderApi(folderId, updates, options) | Update a folder |
| deleteFolderApi(folderId, options) | Delete a folder |
| moveFolderApi(folderId, destination, options) | Move folder to new location |
| copyFolderApi(folderId, destination, options) | Copy folder |
import { listFoldersApi, createFolderApi } from "@elqnt/docs/api";
// List folders in a library
const folders = await listFoldersApi(libraryId, {
baseUrl: "https://api.elqnt.ai",
orgId: "org-uuid",
parentFolderId: "parent-folder-id", // Optional: filter by parent
});
// Create a subfolder
const folder = await createFolderApi(
{ libraryId, name: "Reports", parentFolderId: "parent-id" },
{ baseUrl: "https://api.elqnt.ai", orgId: "org-uuid" }
);Documents
| Function | Description |
|----------|-------------|
| listDocumentsApi(libraryId, options) | List documents in a library |
| createDocumentApi(document, options) | Create a document reference |
| updateDocumentApi(referenceId, updates, options) | Update document metadata |
| deleteDocumentApi(referenceId, options) | Delete a document |
| moveDocumentApi(referenceId, destination, options) | Move document |
| copyDocumentApi(referenceId, destination, options) | Copy document |
import { listDocumentsApi, createDocumentApi } from "@elqnt/docs/api";
// List documents with pagination
const docs = await listDocumentsApi(libraryId, {
baseUrl: "https://api.elqnt.ai",
orgId: "org-uuid",
folderId: "folder-id", // Optional: filter by folder
page: 1,
pageSize: 50,
});
// Create a document reference
const doc = await createDocumentApi(
{
libraryId,
folderId: "folder-id",
name: "report.pdf",
mimeType: "application/pdf",
url: "https://storage.example.com/files/report.pdf",
},
{ baseUrl: "https://api.elqnt.ai", orgId: "org-uuid" }
);Document Analysis
import { getRawDocumentAnalysisApi } from "@elqnt/docs/api";
// Analyze a document (e.g., extract text from PDF)
const analysis = await getRawDocumentAnalysisApi(
{
fileUrl: "https://storage.example.com/files/report.pdf",
model: "document-ai",
fromPage: 1,
toPage: 10,
outputMarkdown: true,
},
{ baseUrl: "https://api.elqnt.ai", orgId: "org-uuid" }
);Types
import type {
// Libraries
DocLibrary,
// Folders
DocFolder,
// Documents
Document,
Chunk,
SearchResult,
SearchRequest,
} from "@elqnt/docs";Projects moved to the Done app — the docs
/projectsAPI anduseProjectshook were removed.
DocLibrary
interface DocLibrary {
id: string;
name: string;
description?: string;
isDefault?: boolean;
ownerEmail?: string;
createdAt?: string;
updatedAt?: string;
}DocFolder
interface DocFolder {
id: string;
libraryId: string;
name: string;
parentFolderId?: string;
createdAt?: string;
updatedAt?: string;
}DocReference
interface DocReference {
id: string;
libraryId: string;
folderId?: string;
name: string;
mimeType?: string;
size?: number;
url?: string;
metadata?: Record<string, unknown>;
createdAt?: string;
updatedAt?: string;
}Response Types
import type {
LibraryResponse,
LibrariesListResponse,
FolderResponse,
FoldersListResponse,
DocumentResponse,
DocumentsListResponse,
} from "@elqnt/docs/api";
// Example response structure
interface DocumentsListResponse {
references: DocReference[];
totalCount?: number;
metadata: ResponseMetadata;
}Peer Dependencies
react^18.0.0 || ^19.0.0
License
Private - Eloquent Platform
