uql-orm 0.2.10 → 0.3.1

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +24 -3
  2. package/README.md +5 -3
  3. package/dist/browser/uql-browser.min.js +880 -314
  4. package/dist/browser/uql-browser.min.js.map +1 -1
  5. package/dist/dialect/abstractSqlDialect.d.ts +28 -2
  6. package/dist/dialect/abstractSqlDialect.d.ts.map +1 -1
  7. package/dist/dialect/abstractSqlDialect.js +82 -5
  8. package/dist/dialect/abstractSqlDialect.js.map +1 -1
  9. package/dist/dialect/dialectConfig.d.ts +17 -1
  10. package/dist/dialect/dialectConfig.d.ts.map +1 -1
  11. package/dist/dialect/dialectConfig.js +39 -0
  12. package/dist/dialect/dialectConfig.js.map +1 -1
  13. package/dist/entity/decorator/index-decorator.d.ts +5 -4
  14. package/dist/entity/decorator/index-decorator.d.ts.map +1 -1
  15. package/dist/entity/decorator/index-decorator.js +1 -9
  16. package/dist/entity/decorator/index-decorator.js.map +1 -1
  17. package/dist/maria/mariaDialect.d.ts +5 -1
  18. package/dist/maria/mariaDialect.d.ts.map +1 -1
  19. package/dist/maria/mariaDialect.js +9 -0
  20. package/dist/maria/mariaDialect.js.map +1 -1
  21. package/dist/migrate/schemaGenerator.d.ts +10 -2
  22. package/dist/migrate/schemaGenerator.d.ts.map +1 -1
  23. package/dist/migrate/schemaGenerator.js +87 -23
  24. package/dist/migrate/schemaGenerator.js.map +1 -1
  25. package/dist/mongo/mongoDialect.d.ts +17 -1
  26. package/dist/mongo/mongoDialect.d.ts.map +1 -1
  27. package/dist/mongo/mongoDialect.js +55 -1
  28. package/dist/mongo/mongoDialect.js.map +1 -1
  29. package/dist/mongo/mongodbQuerier.d.ts +7 -0
  30. package/dist/mongo/mongodbQuerier.d.ts.map +1 -1
  31. package/dist/mongo/mongodbQuerier.js +63 -25
  32. package/dist/mongo/mongodbQuerier.js.map +1 -1
  33. package/dist/postgres/postgresDialect.d.ts +5 -1
  34. package/dist/postgres/postgresDialect.d.ts.map +1 -1
  35. package/dist/postgres/postgresDialect.js +16 -0
  36. package/dist/postgres/postgresDialect.js.map +1 -1
  37. package/dist/schema/canonicalType.d.ts +13 -1
  38. package/dist/schema/canonicalType.d.ts.map +1 -1
  39. package/dist/schema/canonicalType.js +47 -6
  40. package/dist/schema/canonicalType.js.map +1 -1
  41. package/dist/schema/schemaASTBuilder.d.ts.map +1 -1
  42. package/dist/schema/schemaASTBuilder.js +4 -0
  43. package/dist/schema/schemaASTBuilder.js.map +1 -1
  44. package/dist/schema/types.d.ts +5 -4
  45. package/dist/schema/types.d.ts.map +1 -1
  46. package/dist/schema/types.js.map +1 -1
  47. package/dist/sqlite/sqliteDialect.d.ts +5 -1
  48. package/dist/sqlite/sqliteDialect.d.ts.map +1 -1
  49. package/dist/sqlite/sqliteDialect.js +10 -0
  50. package/dist/sqlite/sqliteDialect.js.map +1 -1
  51. package/dist/type/entity.d.ts +34 -8
  52. package/dist/type/entity.d.ts.map +1 -1
  53. package/dist/type/entity.js.map +1 -1
  54. package/dist/type/migration.d.ts +5 -3
  55. package/dist/type/migration.d.ts.map +1 -1
  56. package/dist/type/query.d.ts +47 -2
  57. package/dist/type/query.d.ts.map +1 -1
  58. package/dist/type/query.js.map +1 -1
  59. package/dist/util/dialect.util.d.ts +3 -1
  60. package/dist/util/dialect.util.d.ts.map +1 -1
  61. package/dist/util/dialect.util.js +4 -0
  62. package/dist/util/dialect.util.js.map +1 -1
  63. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,13 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [0.2.10](https://github.com/rogerpadilla/uql/compare/uql-orm@0.2.9...uql-orm@0.2.10) (2026-03-11)
6
+ ## [0.3.1](https://github.com/rogerpadilla/uql/compare/uql-orm@0.3.0...uql-orm@0.3.1) (2026-03-12)
7
7
 
8
8
 
9
9
  ### Features
10
10
 
11
- * Add SVG drawing animations to the full logo and update the README to display it. ([4515203](https://github.com/rogerpadilla/uql/commit/45152032021b2a21ee4bbdf74cc3a48097003cb4))
12
- * enhance $size operator to support comparison objects for array lengths and relation counts. ([02037fb](https://github.com/rogerpadilla/uql/commit/02037fbb6113efab9d23c9809370704b2de3747a))
11
+ * implement MongoDB vector search functionality in dialect and querier ([2987574](https://github.com/rogerpadilla/uql/commit/2987574eaa10efc201ec17d0b6f72a144a1b49fb))
13
12
 
14
13
 
15
14
 
@@ -21,6 +20,28 @@ All notable changes to this project will be documented in this file. Please add
21
20
 
22
21
  date format is [yyyy-mm-dd]
23
22
 
23
+ ## [0.3.1] - 2026-03-12
24
+ ### New Features
25
+ - **MongoDB Atlas Vector Search**: Semantic search now supports MongoDB via the [`$vectorSearch`](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/) aggregation pipeline stage. Same `$sort` API — UQL internally translates to Atlas's native vector search with optimal pre-filtering (`$where` → `$vectorSearch.filter`), score projection via `$meta: 'vectorSearchScore'`, and secondary sort support. Configure with `@Index(['embedding'], { type: 'vectorSearch', name: 'my_index' })`.
26
+
27
+ ## [0.3.0] - 2026-03-12
28
+ ### New Features
29
+ - **Semantic Search**: First-class vector similarity search across PostgreSQL (pgvector), MariaDB, and SQLite. Query via `$sort` on vector fields:
30
+ ```ts
31
+ const results = await querier.findMany(Article, {
32
+ $sort: { embedding: { $vector: queryVec, $distance: 'cosine' } },
33
+ $limit: 10,
34
+ });
35
+ ```
36
+ Supports 5 distance metrics (`cosine`, `l2`, `inner`, `l1`, `hamming`), distance projection via `$project`, and the `WithDistance<E>` utility type. Each dialect generates native SQL: Postgres operators (`<=>`, `<->`), MariaDB (`VEC_DISTANCE_COSINE()`), SQLite (`vec_distance_cosine()`).
37
+ - **Vector Field Types**: `@Field({ type: 'vector', dimensions: 1536 })` for standard 32-bit embeddings, plus Postgres-specific `'halfvec'` (16-bit, 50% storage savings) and `'sparsevec'` (for SPLADE-style sparse embeddings). Automatic SQL mapping across dialects.
38
+ - **Vector Indexes**: `@Index()` supports HNSW and IVFFlat index types with `distance`, `m`, `efConstruction`, and `lists` options. Generates pgvector operator classes for Postgres, inline `VECTOR INDEX` for MariaDB, and standard indexes for SQLite.
39
+ - **Auto Extension Creation**: Schema generator automatically emits `CREATE EXTENSION IF NOT EXISTS vector` for Postgres tables containing vector columns.
40
+
41
+ ### Architecture
42
+ - **Schema Generator Dialect Config Refactor**: Eliminated all `this.dialect ===` branches from `schemaGenerator.ts` by adding new declarative `dialectConfig` properties (`columnComment`, `vectorIndexStyle`, `dropIndexSyntax`, `renameTableSyntax`, `booleanLiteral`, `alterColumnStrategy`, `vectorOpsClass`, `vectorExtension`). All dialect-specific behavior is now config-driven.
43
+ - **Unified CREATE INDEX**: `generateCreateIndexFromNode` now delegates to `generateCreateIndex`, eliminating duplicated SQL assembly and ensuring consistent vector index handling across both code paths.
44
+
24
45
  ## [0.2.7] - 2026-03-11
25
46
  ### New Features
26
47
  - **More `$size` Comparison Operators**: `$size` now accepts comparison operator objects in addition to exact numbers — e.g. `{ $size: { $gte: 2 } }`, `{ $size: { $gt: 0, $lte: 5 } }`, `{ $size: { $between: [1, 10] } }`. Supported operators: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between`.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <a href="https://uql-orm.dev"><img src="assets/logo.svg" alt="uql" width="80" /></a>
4
4
 
5
- [![tests](https://github.com/rogerpadilla/uql/actions/workflows/tests.yml/badge.svg)](https://github.com/rogerpadilla/uql) [![Coverage Status](https://coveralls.io/repos/github/rogerpadilla/uql/badge.svg?branch=main)](https://coveralls.io/github/rogerpadilla/uql?branch=main) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/rogerpadilla/uql/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/uql-orm.svg)](https://www.npmjs.com/package/uql-orm)
5
+ [![tests](https://github.com/rogerpadilla/uql/actions/workflows/tests.yml/badge.svg)](https://github.com/rogerpadilla/uql) [![Coverage Status](https://coveralls.io/repos/github/rogerpadilla/uql/badge.svg?branch=main)](https://coveralls.io/github/rogerpadilla/uql?branch=main) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/rogerpadilla/uql/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/uql-orm.svg)](https://www.npmjs.com/package/uql-orm) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-5865F2?logo=discord&logoColor=white)](https://discord.gg/DHJYp6MDS7)
6
6
 
7
7
  **[UQL](https://uql-orm.dev)** is the [smartest ORM](https://medium.com/@rogerpadillac/in-search-of-the-perfect-orm-e01fcc9bce3d) for TypeScript. It is engineered to be **fast**, **safe**, and **universally compatible**.
8
8
 
@@ -31,7 +31,8 @@ const users = await querier.findMany(User, {
31
31
  | **[Declarative Transactions](https://uql-orm.dev/querying/transactions)** | Standard `@Transactional()` and `@InjectQuerier()` decorators for NestJS/DI. |
32
32
  | **[Lifecycle Hooks](https://uql-orm.dev/entities/lifecycle-hooks)**| `@BeforeInsert`, `@AfterLoad` and 5 more decorators for validation, timestamps, and computed fields. |
33
33
  | **[Aggregate Queries](https://uql-orm.dev/querying/aggregate)** | `GROUP BY`, `HAVING`, `COUNT`, `SUM`, `AVG`, `MIN`, `MAX`, and `DISTINCT` across all dialects. |
34
- | **[Modern &amp; Versatile](https://uql-orm.dev/entities/virtual-fields)** | **Pure ESM**, high-res timing, [Soft-delete](https://uql-orm.dev/entities/soft-delete), and **Vector/JSONB/JSON** support. |
34
+ | **[Semantic Search](https://uql-orm.dev/querying/semantic-search)** | Vector similarity via `$sort` with `$vector`/`$distance`. Supports `vector`, `halfvec`, `sparsevec` types, HNSW/IVFFlat indexes, and 5 distance metrics across Postgres, MariaDB, SQLite, and MongoDB Atlas. |
35
+ | **[Modern & Versatile](https://uql-orm.dev/entities/virtual-fields)** | **Pure ESM**, high-res timing, [Soft-delete](https://uql-orm.dev/entities/soft-delete), and **JSONB/JSON** support. |
35
36
  | **[Database Migrations](https://www.uql-orm.dev/migrations)** | Built-in [Entity-First synchronization](https://uql-orm.dev/migrations#3-entity-first-synchronization-development) and a robust CLI for version-controlled schema evolution. |
36
37
  | **[Logging & Monitoring](https://www.uql-orm.dev/logging)** | Professional-grade monitoring with slow-query detection and colored output. |
37
38
 
@@ -101,7 +102,7 @@ UQL separates the **intent** of your data from its **storage**. Both properties
101
102
 
102
103
  | Property | Purpose | Values |
103
104
  | :--- | :--- | :--- |
104
- | **`type`** | **Logical Type** (Abstraction). Used for runtime behavior and automatic SQL mapping. | `String`, `Number`, `Boolean`, `Date`, `BigInt`, or semantic strings: `'uuid'`, `'json'`, `'vector'`. |
105
+ | **`type`** | **Logical Type** (Abstraction). Used for runtime behavior and automatic SQL mapping. | `String`, `Number`, `Boolean`, `Date`, `BigInt`, or semantic strings: `'uuid'`, `'json'`, `'vector'`, `'halfvec'`, `'sparsevec'`. |
105
106
  | **`columnType`** | **Physical Type** (Implementation). **Highest Priority**. Bypasses UQL's inference for exact SQL control. | Raw SQL types: `'varchar(100)'`, `'decimal(10,2)'`, `'smallint'`, etc. |
106
107
 
107
108
  ```ts
@@ -590,6 +591,7 @@ Learn more about UQL at [uql-orm.dev](https://uql-orm.dev) for details on:
590
591
 
591
592
  - [Complex Logical Operators](https://uql-orm.dev/querying/logical-operators)
592
593
  - [Aggregate Queries (GROUP BY, HAVING, DISTINCT)](https://uql-orm.dev/querying/aggregate)
594
+ - [Semantic Search (Vector Similarity)](https://uql-orm.dev/querying/semantic-search)
593
595
  - [Relationship Mapping (1-1, 1-M, M-M)](https://uql-orm.dev/querying/relations)
594
596
  - [Lifecycle Hooks](https://uql-orm.dev/entities/lifecycle-hooks)
595
597
  - [Soft Deletes &amp; Auditing](https://uql-orm.dev/entities/soft-delete)