@dooor-ai/cortexdb 0.6.0 → 0.6.2

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 CHANGED
@@ -1,6 +1,24 @@
1
1
  # CortexDB TypeScript SDK
2
2
 
3
- Official TypeScript/JavaScript client for CortexDB.
3
+ <div align="center">
4
+
5
+ ```
6
+ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗
7
+ ██╔══██╗██╔═══██╗██╔═══██╗██╔═══██╗██╔══██╗
8
+ ██║ ██║██║ ██║██║ ██║██║ ██║██████╔╝
9
+ ██║ ██║██║ ██║██║ ██║██║ ██║██╔══██╗
10
+ ██████╔╝╚██████╔╝╚██████╔╝╚██████╔╝██║ ██║
11
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
12
+ ```
13
+
14
+ **Official TypeScript/JavaScript SDK for CortexDB**
15
+
16
+ [![npm version](https://img.shields.io/npm/v/@dooor-ai/cortexdb.svg)](https://www.npmjs.com/package/@dooor-ai/cortexdb)
17
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
18
+
19
+ </div>
20
+
21
+ ---
4
22
 
5
23
  ## What is CortexDB?
6
24
 
@@ -25,6 +43,7 @@ CortexDB handles the complex infrastructure of vector databases (Qdrant), object
25
43
  - **Type-safe**: Full TypeScript support with comprehensive type definitions
26
44
  - **Modern API**: Async/await using native fetch (Node.js 18+)
27
45
  - **Infra management**: Database (`client.databases`) and embedding provider (`client.embeddingProviders`) APIs built-in
46
+ - **🆕 TypeScript Decorators**: Define schemas using decorators (like TypeORM) with full IDE support - see [Schema Decorators Guide](./SCHEMA_DECORATORS_GUIDE.md)
28
47
 
29
48
  ## Installation
30
49
 
@@ -247,7 +266,7 @@ const created = await client.records.create(
247
266
  'articles',
248
267
  {
249
268
  title: 'Machine Learning Basics',
250
- content: 'Machine learning é um subconjunto de IA focado em aprender com dados...',
269
+ content: 'Machine learning is a subset of AI focused on learning from data...',
251
270
  year: 2024,
252
271
  },
253
272
  {
@@ -277,33 +296,32 @@ const results = await client.records.list('articles', {
277
296
 
278
297
  ### Schema CLI (YAML)
279
298
 
280
- Instale o CLI (recomendado em devDependencies):
299
+ Install the CLI (recommended in devDependencies):
281
300
 
282
301
  ```bash
283
302
  npm install --save-dev dooor
284
303
  ```
285
304
 
286
- Utilize o CLI unificado `dooor` para sincronizar schemas declarativos:
287
- Instale também a extensão “Dooor Tools no VS Code/Cursor para validação em tempo real (Open VSX).
288
-
305
+ Use the unified `dooor` CLI to synchronize declarative schemas.
306
+ Also install the "Dooor Tools" extension in VS Code/Cursor for real-time validation (Open VSX).
289
307
 
290
308
  ```bash
291
- # Verificar diferenças entre YAML local e CortexDB
309
+ # Check differences between local YAML and CortexDB
292
310
  npx dooor schema diff --dir dooor/schemas
293
311
 
294
- # Criar coleções que ainda não existem
312
+ # Create collections that don't exist yet
295
313
  npx dooor schema apply --dir dooor/schemas
296
314
 
297
- # Aplicar sem gerar tipos (por padrão o apply gera)
315
+ # Apply without generating types (by default apply already generates them)
298
316
  npx dooor schema apply --no-generate-types
299
317
 
300
- # Gerar tipos TypeScript para uso nos serviços
318
+ # Generate TypeScript types for use in services
301
319
  npx dooor schema generate-types --dir dooor/schemas --out src/generated/cortex-schema.ts
302
320
  ```
303
321
 
304
- ### Tipagem automática das coleções
322
+ ### Automatic Collection Typing
305
323
 
306
- Após sincronizar o schema, o CLI gera `dooor/generated/cortex-schema.ts` com os tipos derivados. Informe esse schema ao SDK para ganhar autocomplete e validação semelhantes ao Prisma:
324
+ After synchronizing the schema, the CLI generates `dooor/generated/cortex-schema.ts` with derived types. Provide this schema to the SDK to get Prisma-like autocomplete and validation:
307
325
 
308
326
  ```ts
309
327
  import { CortexClient } from '@dooor-ai/cortexdb';
@@ -328,12 +346,11 @@ const payload: CollectionCreateInput<'tool_calls'> = {
328
346
  await client.records.create('tool_calls', payload);
329
347
  ```
330
348
 
331
- Os generics se propagam para `records.update`, `records.list`, `records.get` e `records.search`. Se preferir o modo dinâmico antigo, instancie `new CortexClient()` sem parâmetro genérico.
332
-
349
+ Generics propagate to `records.update`, `records.list`, `records.get`, and `records.search`. If you prefer the old dynamic mode, instantiate `new CortexClient()` without the generic parameter.
333
350
 
334
- Defina `CORTEXDB_CONNECTION` (ex.: `cortexdb://key@host:8000`) ou as variáveis `CORTEXDB_BASE_URL` + `CORTEXDB_API_KEY` antes de rodar os comandos. Se nenhum diretório for informado, o CLI procura automaticamente em `dooor/schemas`.
351
+ Set `CORTEXDB_CONNECTION` (e.g., `cortexdb://key@host:8000`) or the `CORTEXDB_BASE_URL` + `CORTEXDB_API_KEY` variables before running commands. If no directory is specified, the CLI automatically looks in `dooor/schemas`.
335
352
 
336
- Para evitar repetir flags, configure `dooor/config.yaml` na raiz do projeto:
353
+ To avoid repeating flags, configure `dooor/config.yaml` at the project root:
337
354
 
338
355
  ```yaml
339
356
  cortexdb:
@@ -345,7 +362,7 @@ schema:
345
362
  typesOut: dooor/generated/cortex-schema.ts
346
363
  ```
347
364
 
348
- Você pode sobrescrever com `dooor/config.local.yaml` ou apontar outro caminho via `DOOOR_CONFIG`.
365
+ You can override with `dooor/config.local.yaml` or point to another path via `DOOOR_CONFIG`.
349
366
 
350
367
  ### Semantic Search
351
368
 
package/dist/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from "./ai-providers/api";
8
8
  export * from "./types";
9
9
  export * from "./exceptions";
10
10
  export * from "./http/client";
11
+ export { Collection, Field, FieldOptions, CollectionOptions, ManyToOne, OneToOne, OneToMany, ManyToMany, ManyToOneOptions, OneToOneOptions, OneToManyOptions, ManyToManyOptions, RelationOptions, loadTypeScriptSchemasSync, LoadedCollection, validateSchema, formatValidationErrors, ValidationError, ValidationResult, } from "./schema-decorators";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,SAAS,CAAC;AAGxB,cAAc,cAAc,CAAC;AAG7B,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;AAChC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,SAAS,CAAC;AAGxB,cAAc,cAAc,CAAC;AAG7B,cAAc,eAAe,CAAC;AAI9B,OAAO,EACL,UAAU,EACV,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAEhB,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.formatValidationErrors = exports.validateSchema = exports.loadTypeScriptSchemasSync = exports.ManyToMany = exports.OneToMany = exports.OneToOne = exports.ManyToOne = exports.Field = exports.Collection = void 0;
18
19
  // Main client
19
20
  __exportStar(require("./client"), exports);
20
21
  // API classes
@@ -29,4 +30,17 @@ __exportStar(require("./types"), exports);
29
30
  __exportStar(require("./exceptions"), exports);
30
31
  // HTTP Client (for advanced usage)
31
32
  __exportStar(require("./http/client"), exports);
33
+ // Schema decorators (for TypeScript-based schema definitions)
34
+ // Note: Collection decorator shadows the Collection interface from types
35
+ var schema_decorators_1 = require("./schema-decorators");
36
+ Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return schema_decorators_1.Collection; } });
37
+ Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return schema_decorators_1.Field; } });
38
+ Object.defineProperty(exports, "ManyToOne", { enumerable: true, get: function () { return schema_decorators_1.ManyToOne; } });
39
+ Object.defineProperty(exports, "OneToOne", { enumerable: true, get: function () { return schema_decorators_1.OneToOne; } });
40
+ Object.defineProperty(exports, "OneToMany", { enumerable: true, get: function () { return schema_decorators_1.OneToMany; } });
41
+ Object.defineProperty(exports, "ManyToMany", { enumerable: true, get: function () { return schema_decorators_1.ManyToMany; } });
42
+ Object.defineProperty(exports, "loadTypeScriptSchemasSync", { enumerable: true, get: function () { return schema_decorators_1.loadTypeScriptSchemasSync; } });
43
+ // Validation
44
+ Object.defineProperty(exports, "validateSchema", { enumerable: true, get: function () { return schema_decorators_1.validateSchema; } });
45
+ Object.defineProperty(exports, "formatValidationErrors", { enumerable: true, get: function () { return schema_decorators_1.formatValidationErrors; } });
32
46
  //# sourceMappingURL=index.js.map
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;AAC9B,kDAAgC;AAChC,kDAAgC;AAChC,qDAAmC;AAEnC,QAAQ;AACR,0CAAwB;AAExB,aAAa;AACb,+CAA6B;AAE7B,mCAAmC;AACnC,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;AAChC,qDAAmC;AAEnC,QAAQ;AACR,0CAAwB;AAExB,aAAa;AACb,+CAA6B;AAE7B,mCAAmC;AACnC,gDAA8B;AAE9B,8DAA8D;AAC9D,yEAAyE;AACzE,yDAqB6B;AApB3B,+GAAA,UAAU,OAAA;AACV,0GAAA,KAAK,OAAA;AAGL,8GAAA,SAAS,OAAA;AACT,6GAAA,QAAQ,OAAA;AACR,8GAAA,SAAS,OAAA;AACT,+GAAA,UAAU,OAAA;AAMV,8HAAA,yBAAyB,OAAA;AAEzB,aAAa;AACb,mHAAA,cAAc,OAAA;AACd,2HAAA,sBAAsB,OAAA"}