@dooor-ai/cortexdb 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -27
- package/dist/client/index.d.ts +22 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +38 -1
- package/dist/client/index.js.map +1 -1
- package/dist/databases/api.d.ts +18 -0
- package/dist/databases/api.d.ts.map +1 -0
- package/dist/databases/api.js +29 -0
- package/dist/databases/api.js.map +1 -0
- package/dist/http/client.d.ts.map +1 -1
- package/dist/http/client.js +9 -2
- package/dist/http/client.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/api.d.ts +16 -0
- package/dist/providers/api.d.ts.map +1 -0
- package/dist/providers/api.js +25 -0
- package/dist/providers/api.js.map +1 -0
- package/dist/records/api.d.ts +5 -12
- package/dist/records/api.d.ts.map +1 -1
- package/dist/records/api.js +45 -6
- package/dist/records/api.js.map +1 -1
- package/dist/types/index.d.ts +100 -61
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +16 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/connection-string.d.ts +35 -0
- package/dist/utils/connection-string.d.ts.map +1 -0
- package/dist/utils/connection-string.js +79 -0
- package/dist/utils/connection-string.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ CortexDB handles the complex infrastructure of vector databases (Qdrant), object
|
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
|
-
- **Multi-modal document processing**: Upload PDFs, DOCX, XLSX files and
|
|
19
|
+
- **Multi-modal document processing**: Upload PDFs, DOCX, XLSX files and automaticamente extrair texto com OCR fallback
|
|
20
20
|
- **Semantic search**: Vector-based search using embeddings from OpenAI, Gemini, or custom providers
|
|
21
21
|
- **Automatic chunking**: Smart text splitting optimized for RAG applications
|
|
22
22
|
- **Flexible schema**: Define collections with typed fields (string, number, boolean, file, array)
|
|
@@ -24,6 +24,7 @@ CortexDB handles the complex infrastructure of vector databases (Qdrant), object
|
|
|
24
24
|
- **Storage control**: Choose where each field is stored (PostgreSQL, Qdrant, MinIO)
|
|
25
25
|
- **Type-safe**: Full TypeScript support with comprehensive type definitions
|
|
26
26
|
- **Modern API**: Async/await using native fetch (Node.js 18+)
|
|
27
|
+
- **Infra management**: APIs de bancos (`client.databases`) e provedores de embedding (`client.embeddingProviders`)
|
|
27
28
|
|
|
28
29
|
## Installation
|
|
29
30
|
|
|
@@ -46,7 +47,7 @@ pnpm add @dooor-ai/cortexdb
|
|
|
46
47
|
## Quick Start
|
|
47
48
|
|
|
48
49
|
```typescript
|
|
49
|
-
import { CortexClient, FieldType } from '@dooor-ai/cortexdb';
|
|
50
|
+
import { CortexClient, FieldType, StoreLocation } from '@dooor-ai/cortexdb';
|
|
50
51
|
|
|
51
52
|
async function main() {
|
|
52
53
|
const client = new CortexClient({
|
|
@@ -58,7 +59,8 @@ async function main() {
|
|
|
58
59
|
'documents',
|
|
59
60
|
[
|
|
60
61
|
{ name: 'title', type: FieldType.STRING },
|
|
61
|
-
{ name: 'content', type: FieldType.
|
|
62
|
+
{ name: 'content', type: FieldType.TEXT, vectorize: true },
|
|
63
|
+
{ name: 'published_at', type: FieldType.DATETIME, store_in: [StoreLocation.POSTGRES] }
|
|
62
64
|
],
|
|
63
65
|
'your-embedding-provider-id' // Required when vectorize=true
|
|
64
66
|
);
|
|
@@ -96,24 +98,58 @@ main();
|
|
|
96
98
|
```typescript
|
|
97
99
|
import { CortexClient } from '@dooor-ai/cortexdb';
|
|
98
100
|
|
|
99
|
-
//
|
|
100
|
-
const client = new CortexClient(
|
|
101
|
-
baseUrl: 'http://localhost:8000'
|
|
102
|
-
});
|
|
101
|
+
// Using connection string (recommended)
|
|
102
|
+
const client = new CortexClient('cortexdb://localhost:8000');
|
|
103
103
|
|
|
104
|
-
//
|
|
105
|
-
const client = new CortexClient(
|
|
106
|
-
baseUrl: 'https://api.cortexdb.com',
|
|
107
|
-
apiKey: 'your-api-key'
|
|
108
|
-
});
|
|
104
|
+
// With API key
|
|
105
|
+
const client = new CortexClient('cortexdb://my-api-key@localhost:8000');
|
|
109
106
|
|
|
110
|
-
//
|
|
107
|
+
// Production (HTTPS auto-detected)
|
|
108
|
+
const client = new CortexClient('cortexdb://my-key@api.cortexdb.com');
|
|
109
|
+
|
|
110
|
+
// Using options object (alternative)
|
|
111
111
|
const client = new CortexClient({
|
|
112
112
|
baseUrl: 'http://localhost:8000',
|
|
113
|
+
apiKey: 'your-api-key',
|
|
113
114
|
timeout: 60000 // 60 seconds
|
|
114
115
|
});
|
|
115
116
|
```
|
|
116
117
|
|
|
118
|
+
**Connection String Format:**
|
|
119
|
+
`cortexdb://[api_key@]host[:port]`
|
|
120
|
+
|
|
121
|
+
Benefits:
|
|
122
|
+
- Single string configuration
|
|
123
|
+
- Easy to store in environment variables
|
|
124
|
+
- Familiar pattern (like PostgreSQL, MongoDB, Redis)
|
|
125
|
+
- Auto-detects HTTP vs HTTPS
|
|
126
|
+
|
|
127
|
+
### Databases
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// Create database
|
|
131
|
+
await client.databases.create({ name: 'ai_docs', description: 'Knowledge base' });
|
|
132
|
+
|
|
133
|
+
// List databases
|
|
134
|
+
const databases = await client.databases.list();
|
|
135
|
+
|
|
136
|
+
// Delete database
|
|
137
|
+
await client.databases.delete('ai_docs');
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Embedding Providers
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
await client.embeddingProviders.create({
|
|
144
|
+
name: 'Gemini Flash',
|
|
145
|
+
provider: 'gemini',
|
|
146
|
+
embedding_model: 'models/text-embedding-004',
|
|
147
|
+
api_key: process.env.GEMINI_API_KEY!,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const providers = await client.embeddingProviders.list();
|
|
151
|
+
```
|
|
152
|
+
|
|
117
153
|
### Collections
|
|
118
154
|
|
|
119
155
|
Collections define the schema for your data. Each collection can have multiple fields with different types and storage options.
|
|
@@ -131,12 +167,12 @@ const collection = await client.collections.create(
|
|
|
131
167
|
},
|
|
132
168
|
{
|
|
133
169
|
name: 'content',
|
|
134
|
-
type: FieldType.
|
|
170
|
+
type: FieldType.TEXT,
|
|
135
171
|
vectorize: true // Enable semantic search on this field
|
|
136
172
|
},
|
|
137
173
|
{
|
|
138
174
|
name: 'year',
|
|
139
|
-
type: FieldType.
|
|
175
|
+
type: FieldType.INT,
|
|
140
176
|
store_in: [StoreLocation.POSTGRES, StoreLocation.QDRANT_PAYLOAD]
|
|
141
177
|
}
|
|
142
178
|
],
|
|
@@ -158,28 +194,37 @@ await client.collections.delete('articles');
|
|
|
158
194
|
Records are the actual data stored in collections. They must match the collection schema.
|
|
159
195
|
|
|
160
196
|
```typescript
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
197
|
+
import fs from 'node:fs';
|
|
198
|
+
|
|
199
|
+
// Create record (with optional file upload)
|
|
200
|
+
const created = await client.records.create(
|
|
201
|
+
'articles',
|
|
202
|
+
{
|
|
203
|
+
title: 'Machine Learning Basics',
|
|
204
|
+
content: 'Machine learning é um subconjunto de IA focado em aprender com dados...',
|
|
205
|
+
year: 2024,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
attachment: fs.readFileSync('ml-intro.pdf'),
|
|
209
|
+
}
|
|
210
|
+
);
|
|
167
211
|
|
|
168
212
|
// Get record by ID
|
|
169
|
-
const fetched = await client.records.get('articles',
|
|
213
|
+
const fetched = await client.records.get('articles', created.id);
|
|
170
214
|
|
|
171
215
|
// Update record
|
|
172
|
-
const updated = await client.records.update('articles',
|
|
173
|
-
year: 2025
|
|
216
|
+
const updated = await client.records.update('articles', created.id, {
|
|
217
|
+
year: 2025,
|
|
174
218
|
});
|
|
175
219
|
|
|
176
220
|
// Delete record
|
|
177
|
-
await client.records.delete('articles',
|
|
221
|
+
await client.records.delete('articles', created.id);
|
|
178
222
|
|
|
179
|
-
// List records with pagination
|
|
223
|
+
// List records with filters/pagination
|
|
180
224
|
const results = await client.records.list('articles', {
|
|
181
225
|
limit: 10,
|
|
182
|
-
offset: 0
|
|
226
|
+
offset: 0,
|
|
227
|
+
filters: { year: { $gte: 2023 } },
|
|
183
228
|
});
|
|
184
229
|
```
|
|
185
230
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** Main CortexDB client */
|
|
2
2
|
import { CollectionsAPI } from "../collections/api";
|
|
3
3
|
import { RecordsAPI } from "../records/api";
|
|
4
|
+
import { DatabasesAPI } from "../databases/api";
|
|
5
|
+
import { EmbeddingProvidersAPI } from "../providers/api";
|
|
4
6
|
export interface CortexClientOptions {
|
|
5
7
|
baseUrl?: string;
|
|
6
8
|
apiKey?: string;
|
|
@@ -10,7 +12,26 @@ export declare class CortexClient {
|
|
|
10
12
|
private http;
|
|
11
13
|
collections: CollectionsAPI;
|
|
12
14
|
records: RecordsAPI;
|
|
13
|
-
|
|
15
|
+
databases: DatabasesAPI;
|
|
16
|
+
embeddingProviders: EmbeddingProvidersAPI;
|
|
17
|
+
/**
|
|
18
|
+
* Create a new CortexDB client
|
|
19
|
+
*
|
|
20
|
+
* @param options - Configuration options or connection string
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Using options object
|
|
25
|
+
* const client = new CortexClient({
|
|
26
|
+
* baseUrl: 'http://localhost:8000',
|
|
27
|
+
* apiKey: 'my-key'
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Using connection string
|
|
31
|
+
* const client = new CortexClient('cortexdb://my-key@localhost:8000');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
constructor(options?: CortexClientOptions | string);
|
|
14
35
|
/**
|
|
15
36
|
* Check if the connection to CortexDB is working
|
|
16
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAG3B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAG3B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAa;IAClB,WAAW,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,YAAY,CAAC;IACxB,kBAAkB,EAAE,qBAAqB,CAAC;IAEjD;;;;;;;;;;;;;;;;OAgBG;gBACS,OAAO,GAAE,mBAAmB,GAAG,MAAW;IAyBtD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3C;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IASrC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dist/client/index.js
CHANGED
|
@@ -5,12 +5,49 @@ exports.CortexClient = void 0;
|
|
|
5
5
|
const client_1 = require("../http/client");
|
|
6
6
|
const api_1 = require("../collections/api");
|
|
7
7
|
const api_2 = require("../records/api");
|
|
8
|
+
const api_3 = require("../databases/api");
|
|
9
|
+
const api_4 = require("../providers/api");
|
|
10
|
+
const connection_string_1 = require("../utils/connection-string");
|
|
8
11
|
class CortexClient {
|
|
12
|
+
/**
|
|
13
|
+
* Create a new CortexDB client
|
|
14
|
+
*
|
|
15
|
+
* @param options - Configuration options or connection string
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Using options object
|
|
20
|
+
* const client = new CortexClient({
|
|
21
|
+
* baseUrl: 'http://localhost:8000',
|
|
22
|
+
* apiKey: 'my-key'
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Using connection string
|
|
26
|
+
* const client = new CortexClient('cortexdb://my-key@localhost:8000');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
9
29
|
constructor(options = {}) {
|
|
10
|
-
|
|
30
|
+
let baseUrl;
|
|
31
|
+
let apiKey;
|
|
32
|
+
let timeout;
|
|
33
|
+
// Handle connection string
|
|
34
|
+
if (typeof options === 'string') {
|
|
35
|
+
const parsed = (0, connection_string_1.parseConnectionString)(options);
|
|
36
|
+
baseUrl = parsed.baseUrl;
|
|
37
|
+
apiKey = parsed.apiKey;
|
|
38
|
+
timeout = 30000;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Handle options object
|
|
42
|
+
baseUrl = options.baseUrl || "http://localhost:8000";
|
|
43
|
+
apiKey = options.apiKey;
|
|
44
|
+
timeout = options.timeout || 30000;
|
|
45
|
+
}
|
|
11
46
|
this.http = new client_1.HTTPClient(baseUrl, apiKey, timeout);
|
|
12
47
|
this.collections = new api_1.CollectionsAPI(this.http);
|
|
13
48
|
this.records = new api_2.RecordsAPI(this.http);
|
|
49
|
+
this.databases = new api_3.DatabasesAPI(this.http);
|
|
50
|
+
this.embeddingProviders = new api_4.EmbeddingProvidersAPI(this.http);
|
|
14
51
|
}
|
|
15
52
|
/**
|
|
16
53
|
* Check if the connection to CortexDB is working
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";AAAA,2BAA2B;;;AAE3B,2CAA4C;AAC5C,4CAAoD;AACpD,wCAA4C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";AAAA,2BAA2B;;;AAE3B,2CAA4C;AAC5C,4CAAoD;AACpD,wCAA4C;AAC5C,0CAAgD;AAChD,0CAAyD;AACzD,kEAAmE;AAQnE,MAAa,YAAY;IAOvB;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,UAAwC,EAAE;QACpD,IAAI,OAAe,CAAC;QACpB,IAAI,MAA0B,CAAC;QAC/B,IAAI,OAAe,CAAC;QAEpB,2BAA2B;QAC3B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,IAAA,yCAAqB,EAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;YACzB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YACvB,OAAO,GAAG,KAAK,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,wBAAwB;YACxB,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,uBAAuB,CAAC;YACrD,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YACxB,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,mBAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,WAAW,GAAG,IAAI,oBAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,IAAI,gBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,IAAI,kBAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,kBAAkB,GAAG,IAAI,2BAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;YACrC,OAAO,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,6DAA6D;IAC/D,CAAC;CACF;AA1ED,oCA0EC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTTPClient } from "../http/client";
|
|
2
|
+
import { Database, DatabaseCreateInput } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* API for managing CortexDB databases.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DatabasesAPI {
|
|
7
|
+
private http;
|
|
8
|
+
constructor(http: HTTPClient);
|
|
9
|
+
/** List all databases registered in CortexDB. */
|
|
10
|
+
list(): Promise<Database[]>;
|
|
11
|
+
/** Retrieve a database by name. */
|
|
12
|
+
get(name: string): Promise<Database>;
|
|
13
|
+
/** Create a new database. */
|
|
14
|
+
create(payload: DatabaseCreateInput): Promise<Database>;
|
|
15
|
+
/** Delete a database (and all of its collections). */
|
|
16
|
+
delete(name: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/databases/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzD;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,iDAAiD;IAC3C,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIjC,mCAAmC;IAC7B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1C,6BAA6B;IACvB,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI7D,sDAAsD;IAChD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatabasesAPI = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* API for managing CortexDB databases.
|
|
6
|
+
*/
|
|
7
|
+
class DatabasesAPI {
|
|
8
|
+
constructor(http) {
|
|
9
|
+
this.http = http;
|
|
10
|
+
}
|
|
11
|
+
/** List all databases registered in CortexDB. */
|
|
12
|
+
async list() {
|
|
13
|
+
return this.http.get("/databases");
|
|
14
|
+
}
|
|
15
|
+
/** Retrieve a database by name. */
|
|
16
|
+
async get(name) {
|
|
17
|
+
return this.http.get(`/databases/${encodeURIComponent(name)}`);
|
|
18
|
+
}
|
|
19
|
+
/** Create a new database. */
|
|
20
|
+
async create(payload) {
|
|
21
|
+
return this.http.post("/databases", payload);
|
|
22
|
+
}
|
|
23
|
+
/** Delete a database (and all of its collections). */
|
|
24
|
+
async delete(name) {
|
|
25
|
+
await this.http.delete(`/databases/${encodeURIComponent(name)}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.DatabasesAPI = DatabasesAPI;
|
|
29
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/databases/api.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAa,YAAY;IACvB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,iDAAiD;IACjD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAa,YAAY,CAAC,CAAC;IACjD,CAAC;IAED,mCAAmC;IACnC,KAAK,CAAC,GAAG,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAW,cAAc,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,6BAA6B;IAC7B,KAAK,CAAC,MAAM,CAAC,OAA4B;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAW,YAAY,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,sDAAsD;IACtD,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AAtBD,oCAsBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/http/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IAExB;;;;;;OAMG;gBACS,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,MAAc;IAMrE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OAAO,CAAC,CAAC,CAAC;IAIlD;;;;;;OAMG;IACG,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAIpD;;;;;OAKG;IACG,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIzC;;;;;;;;OAQG;YACW,OAAO;CAoFtB"}
|
package/dist/http/client.js
CHANGED
|
@@ -84,16 +84,23 @@ class HTTPClient {
|
|
|
84
84
|
async request(method, path, body) {
|
|
85
85
|
const url = `${this.baseUrl}${path}`;
|
|
86
86
|
const headers = {
|
|
87
|
-
|
|
87
|
+
Accept: "application/json",
|
|
88
88
|
};
|
|
89
|
+
const isFormData = typeof FormData !== "undefined" && body instanceof FormData;
|
|
89
90
|
if (this.apiKey) {
|
|
90
91
|
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
91
92
|
}
|
|
93
|
+
if (!isFormData && body !== undefined && method !== "GET" && method !== "DELETE") {
|
|
94
|
+
headers["Content-Type"] = "application/json";
|
|
95
|
+
}
|
|
92
96
|
const options = {
|
|
93
97
|
method,
|
|
94
98
|
headers,
|
|
95
99
|
};
|
|
96
|
-
if (
|
|
100
|
+
if (isFormData) {
|
|
101
|
+
options.body = body;
|
|
102
|
+
}
|
|
103
|
+
else if (body !== undefined && method !== "GET" && method !== "DELETE") {
|
|
97
104
|
options.body = JSON.stringify(body);
|
|
98
105
|
}
|
|
99
106
|
try {
|
package/dist/http/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/http/client.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,8CAQuB;AAEvB;;GAEG;AACH,MAAa,UAAU;IAKrB;;;;;;OAMG;IACH,YAAY,OAAe,EAAE,MAAe,EAAE,UAAkB,KAAK;QACnE,IAAI,CAAC,OAAO,GAAG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AO,CAAC,EAAE,CAAC;gBAClE,MAAM,IAAI,oCAAuB,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAC;YACnE,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AApKD,gCAoKC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAG9B,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAG9B,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,SAAS,CAAC;AAGxB,cAAc,cAAc,CAAC;AAG7B,cAAc,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,8 @@ __exportStar(require("./client"), exports);
|
|
|
20
20
|
// API classes
|
|
21
21
|
__exportStar(require("./collections/api"), exports);
|
|
22
22
|
__exportStar(require("./records/api"), exports);
|
|
23
|
+
__exportStar(require("./databases/api"), exports);
|
|
24
|
+
__exportStar(require("./providers/api"), exports);
|
|
23
25
|
// Types
|
|
24
26
|
__exportStar(require("./types"), exports);
|
|
25
27
|
// Exceptions
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;;;;;;;;;;;;;;AAE9B,cAAc;AACd,2CAAyB;AAEzB,cAAc;AACd,oDAAkC;AAClC,gDAA8B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;;;;;;;;;;;;;;AAE9B,cAAc;AACd,2CAAyB;AAEzB,cAAc;AACd,oDAAkC;AAClC,gDAA8B;AAC9B,kDAAgC;AAChC,kDAAgC;AAEhC,QAAQ;AACR,0CAAwB;AAExB,aAAa;AACb,+CAA6B;AAE7B,mCAAmC;AACnC,gDAA8B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTTPClient } from "../http/client";
|
|
2
|
+
import { CreateEmbeddingProviderInput, EmbeddingProvider } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* API for managing embedding providers.
|
|
5
|
+
*/
|
|
6
|
+
export declare class EmbeddingProvidersAPI {
|
|
7
|
+
private http;
|
|
8
|
+
constructor(http: HTTPClient);
|
|
9
|
+
/** List configured embedding providers. */
|
|
10
|
+
list(): Promise<EmbeddingProvider[]>;
|
|
11
|
+
/** Register a new embedding provider. */
|
|
12
|
+
create(payload: CreateEmbeddingProviderInput): Promise<EmbeddingProvider>;
|
|
13
|
+
/** Delete an embedding provider by id. */
|
|
14
|
+
delete(providerId: string): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/providers/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE3E;;GAEG;AACH,qBAAa,qBAAqB;IACpB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,2CAA2C;IACrC,IAAI,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAI1C,yCAAyC;IACnC,MAAM,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI/E,0CAA0C;IACpC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGhD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmbeddingProvidersAPI = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* API for managing embedding providers.
|
|
6
|
+
*/
|
|
7
|
+
class EmbeddingProvidersAPI {
|
|
8
|
+
constructor(http) {
|
|
9
|
+
this.http = http;
|
|
10
|
+
}
|
|
11
|
+
/** List configured embedding providers. */
|
|
12
|
+
async list() {
|
|
13
|
+
return this.http.get("/providers/embeddings");
|
|
14
|
+
}
|
|
15
|
+
/** Register a new embedding provider. */
|
|
16
|
+
async create(payload) {
|
|
17
|
+
return this.http.post("/providers/embeddings", payload);
|
|
18
|
+
}
|
|
19
|
+
/** Delete an embedding provider by id. */
|
|
20
|
+
async delete(providerId) {
|
|
21
|
+
await this.http.delete(`/providers/embeddings/${encodeURIComponent(providerId)}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.EmbeddingProvidersAPI = EmbeddingProvidersAPI;
|
|
25
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/providers/api.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAa,qBAAqB;IAChC,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,2CAA2C;IAC3C,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAsB,uBAAuB,CAAC,CAAC;IACrE,CAAC;IAED,yCAAyC;IACzC,KAAK,CAAC,MAAM,CAAC,OAAqC;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAoB,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED,0CAA0C;IAC1C,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,yBAAyB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC;CACF;AAjBD,sDAiBC"}
|
package/dist/records/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Records API for CortexDB */
|
|
2
|
-
import {
|
|
2
|
+
import { CreateRecordResponse, QueryParams, QueryRecordsResponse, RecordDetails, SearchResponse, UpdateRecordResponse } from "../types";
|
|
3
3
|
import { HTTPClient } from "../http/client";
|
|
4
4
|
export declare class RecordsAPI {
|
|
5
5
|
private http;
|
|
@@ -7,28 +7,21 @@ export declare class RecordsAPI {
|
|
|
7
7
|
/**
|
|
8
8
|
* Create a new record
|
|
9
9
|
*/
|
|
10
|
-
create(collection: string, data:
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}, files?: {
|
|
13
|
-
[key: string]: File | Buffer;
|
|
14
|
-
}): Promise<CortexRecord>;
|
|
10
|
+
create(collection: string, data: Record<string, any>, files?: Record<string, File | Blob | Buffer>): Promise<CreateRecordResponse>;
|
|
15
11
|
/**
|
|
16
12
|
* Get a record by ID
|
|
17
13
|
*/
|
|
18
|
-
get(collection: string, id: string): Promise<
|
|
14
|
+
get(collection: string, id: string): Promise<RecordDetails>;
|
|
19
15
|
/**
|
|
20
16
|
* List records in a collection
|
|
21
17
|
*/
|
|
22
|
-
list(collection: string, params?: QueryParams): Promise<
|
|
23
|
-
records: CortexRecord[];
|
|
24
|
-
total: number;
|
|
25
|
-
}>;
|
|
18
|
+
list(collection: string, params?: QueryParams): Promise<QueryRecordsResponse>;
|
|
26
19
|
/**
|
|
27
20
|
* Update a record
|
|
28
21
|
*/
|
|
29
22
|
update(collection: string, id: string, data: {
|
|
30
23
|
[key: string]: any;
|
|
31
|
-
}): Promise<
|
|
24
|
+
}): Promise<UpdateRecordResponse>;
|
|
32
25
|
/**
|
|
33
26
|
* Delete a record
|
|
34
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/records/api.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/records/api.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,aAAa,EAEb,cAAc,EACd,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,qBAAa,UAAU;IACT,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC;;OAEG;IACG,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,GAC3C,OAAO,CAAC,oBAAoB,CAAC;IAOhC;;OAEG;IACG,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIjE;;OAEG;IACG,IAAI,CACR,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAWhC;;OAEG;IACG,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAOhC;;OAEG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D;;OAEG;IACG,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAChC,KAAK,GAAE,MAAW,GACjB,OAAO,CAAC,cAAc,CAAC;IAQ1B;;OAEG;YACW,eAAe;CAuD9B"}
|
package/dist/records/api.js
CHANGED
|
@@ -11,7 +11,6 @@ class RecordsAPI {
|
|
|
11
11
|
*/
|
|
12
12
|
async create(collection, data, files) {
|
|
13
13
|
if (files && Object.keys(files).length > 0) {
|
|
14
|
-
// Handle multipart/form-data for file uploads
|
|
15
14
|
return this.createWithFiles(collection, data, files);
|
|
16
15
|
}
|
|
17
16
|
return this.http.post(`/collections/${collection}/records`, data);
|
|
@@ -26,9 +25,11 @@ class RecordsAPI {
|
|
|
26
25
|
* List records in a collection
|
|
27
26
|
*/
|
|
28
27
|
async list(collection, params) {
|
|
29
|
-
// Use POST to query endpoint with filters
|
|
30
28
|
const response = await this.http.post(`/collections/${collection}/query`, params || {});
|
|
31
|
-
return
|
|
29
|
+
return {
|
|
30
|
+
records: response.results ?? [],
|
|
31
|
+
total: response.total ?? (response.results ? response.results.length : 0),
|
|
32
|
+
};
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* Update a record
|
|
@@ -53,9 +54,47 @@ class RecordsAPI {
|
|
|
53
54
|
* Create record with files
|
|
54
55
|
*/
|
|
55
56
|
async createWithFiles(collection, data, files) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (typeof FormData === "undefined") {
|
|
58
|
+
throw new Error("FormData is not available in this environment");
|
|
59
|
+
}
|
|
60
|
+
const form = new FormData();
|
|
61
|
+
Object.entries(data || {}).forEach(([key, value]) => {
|
|
62
|
+
if (value === undefined || value === null) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
form.append(key, JSON.stringify(value));
|
|
66
|
+
});
|
|
67
|
+
Object.entries(files).forEach(([key, fileValue]) => {
|
|
68
|
+
if (fileValue === undefined || fileValue === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let blob;
|
|
72
|
+
let filename;
|
|
73
|
+
if (typeof File !== "undefined" && fileValue instanceof File) {
|
|
74
|
+
blob = fileValue;
|
|
75
|
+
filename = fileValue.name;
|
|
76
|
+
}
|
|
77
|
+
else if (typeof Blob !== "undefined" && fileValue instanceof Blob) {
|
|
78
|
+
blob = fileValue;
|
|
79
|
+
}
|
|
80
|
+
else if (typeof Buffer !== "undefined" && Buffer.isBuffer(fileValue)) {
|
|
81
|
+
const bufferValue = fileValue;
|
|
82
|
+
const uint8array = new Uint8Array(bufferValue.byteLength);
|
|
83
|
+
uint8array.set(bufferValue);
|
|
84
|
+
blob = new Blob([uint8array.buffer]);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
throw new Error(`Unsupported file type for field '${key}'`);
|
|
88
|
+
}
|
|
89
|
+
if (!filename && blob.name) {
|
|
90
|
+
filename = blob.name;
|
|
91
|
+
}
|
|
92
|
+
if (!filename) {
|
|
93
|
+
filename = `${key}-${Date.now()}`;
|
|
94
|
+
}
|
|
95
|
+
form.append(key, blob, filename);
|
|
96
|
+
});
|
|
97
|
+
return this.http.post(`/collections/${collection}/records`, form);
|
|
59
98
|
}
|
|
60
99
|
}
|
|
61
100
|
exports.RecordsAPI = RecordsAPI;
|
package/dist/records/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/records/api.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/records/api.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;AAa/B,MAAa,UAAU;IACrB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,UAAkB,EAClB,IAAyB,EACz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I,CAAC;YAC5B,CAAC;iBAAM,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,SAAS,YAAY,IAAI,EAAE,CAAC;gBACpE,IAAI,GAAG,SAAS,CAAC;YACnB,CAAC;iBAAM,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBACvE,MAAM,WAAW,GAAG,SAAmB,CAAC;gBACxC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;gBAC1D,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBAC5B,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACvC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,GAAG,CAAC,CAAC;YAC9D,CAAC;YAED,IAAI,CAAC,QAAQ,IAAK,IAAa,CAAC,IAAI,EAAE,CAAC;gBACrC,QAAQ,GAAI,IAAa,CAAC,IAAI,CAAC;YACjC,CAAC;YACD,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,QAAQ,GAAG,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YACpC,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,gBAAgB,UAAU,UAAU,EACpC,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAxID,gCAwIC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,113 +1,152 @@
|
|
|
1
1
|
/** Core types for CortexDB TypeScript SDK */
|
|
2
|
-
export
|
|
2
|
+
export declare enum FieldType {
|
|
3
|
+
STRING = "string",
|
|
4
|
+
TEXT = "text",
|
|
5
|
+
INT = "int",
|
|
6
|
+
FLOAT = "float",
|
|
7
|
+
BOOLEAN = "boolean",
|
|
8
|
+
DATE = "date",
|
|
9
|
+
DATETIME = "datetime",
|
|
10
|
+
ENUM = "enum",
|
|
11
|
+
ARRAY = "array",
|
|
12
|
+
FILE = "file",
|
|
13
|
+
JSON = "json"
|
|
14
|
+
}
|
|
3
15
|
/**
|
|
4
16
|
* Storage location options for fields
|
|
5
17
|
*/
|
|
6
18
|
export declare enum StoreLocation {
|
|
7
19
|
POSTGRES = "postgres",
|
|
20
|
+
QDRANT = "qdrant",
|
|
8
21
|
QDRANT_PAYLOAD = "qdrant_payload",
|
|
9
22
|
MINIO = "minio"
|
|
10
23
|
}
|
|
24
|
+
export interface ExtractConfig {
|
|
25
|
+
extract_text?: boolean;
|
|
26
|
+
ocr_if_needed?: boolean;
|
|
27
|
+
chunk_size?: number;
|
|
28
|
+
chunk_overlap?: number;
|
|
29
|
+
}
|
|
11
30
|
export interface FieldDefinition {
|
|
12
31
|
name: string;
|
|
13
32
|
type: FieldType;
|
|
14
|
-
|
|
33
|
+
description?: string;
|
|
15
34
|
required?: boolean;
|
|
35
|
+
indexed?: boolean;
|
|
36
|
+
unique?: boolean;
|
|
37
|
+
filterable?: boolean;
|
|
38
|
+
vectorize?: boolean;
|
|
39
|
+
default?: any;
|
|
40
|
+
values?: any[];
|
|
16
41
|
store_in?: StoreLocation[];
|
|
42
|
+
schema?: FieldDefinition[];
|
|
43
|
+
extract_config?: ExtractConfig;
|
|
17
44
|
}
|
|
18
45
|
export interface CollectionConfig {
|
|
46
|
+
embedding_model?: string;
|
|
47
|
+
chunk_size?: number;
|
|
48
|
+
chunk_overlap?: number;
|
|
19
49
|
embedding_provider_id?: string;
|
|
20
50
|
}
|
|
21
51
|
export interface Collection {
|
|
52
|
+
id?: string;
|
|
22
53
|
name: string;
|
|
54
|
+
database?: string;
|
|
23
55
|
fields: FieldDefinition[];
|
|
24
56
|
config?: CollectionConfig;
|
|
57
|
+
created_at?: string;
|
|
58
|
+
updated_at?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface CollectionSchema extends Collection {
|
|
25
61
|
}
|
|
26
62
|
export interface CortexRecord {
|
|
27
63
|
id: string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
64
|
+
record: Record<string, any>;
|
|
65
|
+
files?: Record<string, string>;
|
|
31
66
|
created_at?: string;
|
|
32
67
|
updated_at?: string;
|
|
33
68
|
}
|
|
34
|
-
export interface
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
69
|
+
export interface CreateRecordResponse {
|
|
70
|
+
id: string;
|
|
71
|
+
vectors_created: number;
|
|
72
|
+
files: Record<string, string>;
|
|
38
73
|
}
|
|
39
|
-
export interface
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
74
|
+
export interface RecordDetails {
|
|
75
|
+
id: string;
|
|
76
|
+
record: Record<string, any>;
|
|
77
|
+
files?: Record<string, string>;
|
|
43
78
|
}
|
|
44
|
-
export interface
|
|
45
|
-
|
|
46
|
-
|
|
79
|
+
export interface UpdateRecordResponse {
|
|
80
|
+
id: string;
|
|
81
|
+
vectors_created: number;
|
|
82
|
+
updated_fields: string[];
|
|
47
83
|
}
|
|
48
84
|
export interface QueryParams {
|
|
49
|
-
filters?:
|
|
50
|
-
[key: string]: any;
|
|
51
|
-
};
|
|
85
|
+
filters?: Record<string, any>;
|
|
52
86
|
limit?: number;
|
|
53
87
|
offset?: number;
|
|
54
88
|
}
|
|
89
|
+
export interface QueryRecordsResponse {
|
|
90
|
+
records: Array<Record<string, any>>;
|
|
91
|
+
total: number;
|
|
92
|
+
}
|
|
55
93
|
export interface SearchRequest {
|
|
56
94
|
query: string;
|
|
57
|
-
filters?:
|
|
58
|
-
[key: string]: any;
|
|
59
|
-
};
|
|
95
|
+
filters?: Record<string, any>;
|
|
60
96
|
limit?: number;
|
|
61
97
|
}
|
|
62
|
-
export interface
|
|
98
|
+
export interface SearchHighlight {
|
|
99
|
+
field?: string;
|
|
100
|
+
text?: string;
|
|
101
|
+
chunk_index?: number;
|
|
102
|
+
score?: number;
|
|
103
|
+
}
|
|
104
|
+
export interface SearchResult {
|
|
63
105
|
id: string;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
106
|
+
score: number;
|
|
107
|
+
record: Record<string, any>;
|
|
108
|
+
files?: Record<string, string>;
|
|
109
|
+
highlights?: SearchHighlight[];
|
|
67
110
|
}
|
|
68
|
-
export interface
|
|
69
|
-
|
|
111
|
+
export interface SearchResponse {
|
|
112
|
+
results: SearchResult[];
|
|
113
|
+
total: number;
|
|
114
|
+
took_ms: number;
|
|
70
115
|
}
|
|
71
116
|
export interface CortexError {
|
|
72
|
-
detail
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Configuration for text extraction from files
|
|
76
|
-
*/
|
|
77
|
-
export interface ExtractConfig {
|
|
78
|
-
chunk_size?: number;
|
|
79
|
-
chunk_overlap?: number;
|
|
80
|
-
ocr_if_needed?: boolean;
|
|
117
|
+
detail?: string;
|
|
118
|
+
message?: string;
|
|
81
119
|
}
|
|
82
|
-
|
|
83
|
-
* Vector chunk representing a portion of text and its embedding
|
|
84
|
-
*/
|
|
85
|
-
export interface VectorChunk {
|
|
120
|
+
export interface Database {
|
|
86
121
|
id: string;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
122
|
+
name: string;
|
|
123
|
+
description?: string;
|
|
124
|
+
metadata?: Record<string, any>;
|
|
125
|
+
created_at?: string;
|
|
126
|
+
updated_at?: string;
|
|
91
127
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
filters?: {
|
|
97
|
-
[key: string]: any;
|
|
98
|
-
};
|
|
99
|
-
limit?: number;
|
|
100
|
-
offset?: number;
|
|
128
|
+
export interface DatabaseCreateInput {
|
|
129
|
+
name: string;
|
|
130
|
+
description?: string;
|
|
131
|
+
metadata?: Record<string, any>;
|
|
101
132
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
export interface CollectionSchema {
|
|
133
|
+
export type EmbeddingProviderType = "gemini";
|
|
134
|
+
export interface EmbeddingProvider {
|
|
135
|
+
id: string;
|
|
106
136
|
name: string;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
137
|
+
provider: EmbeddingProviderType;
|
|
138
|
+
embedding_model: string;
|
|
139
|
+
metadata?: Record<string, any>;
|
|
140
|
+
enabled: boolean;
|
|
141
|
+
has_api_key: boolean;
|
|
110
142
|
created_at?: string;
|
|
111
143
|
updated_at?: string;
|
|
112
144
|
}
|
|
145
|
+
export interface CreateEmbeddingProviderInput {
|
|
146
|
+
name: string;
|
|
147
|
+
provider: EmbeddingProviderType;
|
|
148
|
+
embedding_model: string;
|
|
149
|
+
api_key: string;
|
|
150
|
+
metadata?: Record<string, any>;
|
|
151
|
+
}
|
|
113
152
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,cAAc,mBAAmB;IACjC,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC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EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,qBAAqB,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC"}
|
package/dist/types/index.js
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/** Core types for CortexDB TypeScript SDK */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.StoreLocation = void 0;
|
|
4
|
+
exports.StoreLocation = exports.FieldType = void 0;
|
|
5
|
+
var FieldType;
|
|
6
|
+
(function (FieldType) {
|
|
7
|
+
FieldType["STRING"] = "string";
|
|
8
|
+
FieldType["TEXT"] = "text";
|
|
9
|
+
FieldType["INT"] = "int";
|
|
10
|
+
FieldType["FLOAT"] = "float";
|
|
11
|
+
FieldType["BOOLEAN"] = "boolean";
|
|
12
|
+
FieldType["DATE"] = "date";
|
|
13
|
+
FieldType["DATETIME"] = "datetime";
|
|
14
|
+
FieldType["ENUM"] = "enum";
|
|
15
|
+
FieldType["ARRAY"] = "array";
|
|
16
|
+
FieldType["FILE"] = "file";
|
|
17
|
+
FieldType["JSON"] = "json";
|
|
18
|
+
})(FieldType || (exports.FieldType = FieldType = {}));
|
|
5
19
|
/**
|
|
6
20
|
* Storage location options for fields
|
|
7
21
|
*/
|
|
8
22
|
var StoreLocation;
|
|
9
23
|
(function (StoreLocation) {
|
|
10
24
|
StoreLocation["POSTGRES"] = "postgres";
|
|
25
|
+
StoreLocation["QDRANT"] = "qdrant";
|
|
11
26
|
StoreLocation["QDRANT_PAYLOAD"] = "qdrant_payload";
|
|
12
27
|
StoreLocation["MINIO"] = "minio";
|
|
13
28
|
})(StoreLocation || (exports.StoreLocation = StoreLocation = {}));
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAE7C,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,0BAAa,CAAA;IACb,wBAAW,CAAA;IACX,4BAAe,CAAA;IACf,gCAAmB,CAAA;IACnB,0BAAa,CAAA;IACb,kCAAqB,CAAA;IACrB,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,0BAAa,CAAA;IACb,0BAAa,CAAA;AACf,CAAC,EAZW,SAAS,yBAAT,SAAS,QAYpB;AAED;;GAEG;AACH,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,kCAAiB,CAAA;IACjB,kDAAiC,CAAA;IACjC,gCAAe,CAAA;AACjB,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse CortexDB connection strings
|
|
3
|
+
*
|
|
4
|
+
* Format: cortexdb://[api_key@]host[:port]
|
|
5
|
+
*
|
|
6
|
+
* Examples:
|
|
7
|
+
* - cortexdb://localhost:8000
|
|
8
|
+
* - cortexdb://my_key@localhost:8000
|
|
9
|
+
* - cortexdb://my_key@api.cortexdb.com
|
|
10
|
+
*/
|
|
11
|
+
export interface ParsedConnection {
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse a CortexDB connection string
|
|
17
|
+
*
|
|
18
|
+
* @param connectionString - Connection string in format cortexdb://[api_key@]host[:port]
|
|
19
|
+
* @returns Parsed connection options
|
|
20
|
+
* @throws Error if connection string is invalid
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* parseConnectionString('cortexdb://localhost:8000')
|
|
25
|
+
* // { baseUrl: 'http://localhost:8000' }
|
|
26
|
+
*
|
|
27
|
+
* parseConnectionString('cortexdb://my_key@localhost:8000')
|
|
28
|
+
* // { baseUrl: 'http://localhost:8000', apiKey: 'my_key' }
|
|
29
|
+
*
|
|
30
|
+
* parseConnectionString('cortexdb://key@api.cortexdb.com:443')
|
|
31
|
+
* // { baseUrl: 'https://api.cortexdb.com:443', apiKey: 'key' }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseConnectionString(connectionString: string): ParsedConnection;
|
|
35
|
+
//# sourceMappingURL=connection-string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-string.d.ts","sourceRoot":"","sources":["../../src/utils/connection-string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,CAoDhF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parse CortexDB connection strings
|
|
4
|
+
*
|
|
5
|
+
* Format: cortexdb://[api_key@]host[:port]
|
|
6
|
+
*
|
|
7
|
+
* Examples:
|
|
8
|
+
* - cortexdb://localhost:8000
|
|
9
|
+
* - cortexdb://my_key@localhost:8000
|
|
10
|
+
* - cortexdb://my_key@api.cortexdb.com
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.parseConnectionString = parseConnectionString;
|
|
14
|
+
/**
|
|
15
|
+
* Parse a CortexDB connection string
|
|
16
|
+
*
|
|
17
|
+
* @param connectionString - Connection string in format cortexdb://[api_key@]host[:port]
|
|
18
|
+
* @returns Parsed connection options
|
|
19
|
+
* @throws Error if connection string is invalid
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* parseConnectionString('cortexdb://localhost:8000')
|
|
24
|
+
* // { baseUrl: 'http://localhost:8000' }
|
|
25
|
+
*
|
|
26
|
+
* parseConnectionString('cortexdb://my_key@localhost:8000')
|
|
27
|
+
* // { baseUrl: 'http://localhost:8000', apiKey: 'my_key' }
|
|
28
|
+
*
|
|
29
|
+
* parseConnectionString('cortexdb://key@api.cortexdb.com:443')
|
|
30
|
+
* // { baseUrl: 'https://api.cortexdb.com:443', apiKey: 'key' }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function parseConnectionString(connectionString) {
|
|
34
|
+
// Remove cortexdb:// prefix
|
|
35
|
+
if (!connectionString.startsWith('cortexdb://')) {
|
|
36
|
+
throw new Error('Connection string must start with "cortexdb://"');
|
|
37
|
+
}
|
|
38
|
+
const withoutProtocol = connectionString.slice('cortexdb://'.length);
|
|
39
|
+
// Split by @ to separate api_key from host
|
|
40
|
+
let apiKey;
|
|
41
|
+
let hostPart;
|
|
42
|
+
if (withoutProtocol.includes('@')) {
|
|
43
|
+
const parts = withoutProtocol.split('@');
|
|
44
|
+
if (parts.length !== 2) {
|
|
45
|
+
throw new Error('Invalid connection string format');
|
|
46
|
+
}
|
|
47
|
+
apiKey = parts[0];
|
|
48
|
+
hostPart = parts[1];
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
hostPart = withoutProtocol;
|
|
52
|
+
}
|
|
53
|
+
// Parse host and port
|
|
54
|
+
let host;
|
|
55
|
+
let port;
|
|
56
|
+
if (hostPart.includes(':')) {
|
|
57
|
+
const hostPortParts = hostPart.split(':');
|
|
58
|
+
host = hostPortParts[0];
|
|
59
|
+
port = hostPortParts[1];
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
host = hostPart;
|
|
63
|
+
}
|
|
64
|
+
// Determine protocol (https for port 443 or production domains, http otherwise)
|
|
65
|
+
const isSecure = port === '443' ||
|
|
66
|
+
host.includes('cortexdb.com') ||
|
|
67
|
+
(!host.includes('localhost') && !host.startsWith('127.'));
|
|
68
|
+
const protocol = isSecure ? 'https' : 'http';
|
|
69
|
+
// Build base URL
|
|
70
|
+
let baseUrl = `${protocol}://${host}`;
|
|
71
|
+
if (port && !(port === '443' && isSecure) && !(port === '80' && !isSecure)) {
|
|
72
|
+
baseUrl += `:${port}`;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
baseUrl,
|
|
76
|
+
apiKey
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=connection-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-string.js","sourceRoot":"","sources":["../../src/utils/connection-string.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AA0BH,sDAoDC;AAvED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,qBAAqB,CAAC,gBAAwB;IAC5D,4BAA4B;IAC5B,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,eAAe,GAAG,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAErE,2CAA2C;IAC3C,IAAI,MAA0B,CAAC;IAC/B,IAAI,QAAgB,CAAC;IAErB,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kCAAk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