@uql/core 3.8.5 → 3.9.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 (73) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +23 -23
  3. package/dist/browser/uql-browser.min.js +42 -38
  4. package/dist/browser/uql-browser.min.js.map +1 -1
  5. package/dist/dialect/abstractSqlDialect.d.ts +27 -0
  6. package/dist/dialect/abstractSqlDialect.d.ts.map +1 -1
  7. package/dist/dialect/abstractSqlDialect.js +77 -0
  8. package/dist/dialect/abstractSqlDialect.js.map +1 -1
  9. package/dist/maria/mariadbQuerier.d.ts.map +1 -1
  10. package/dist/maria/mariadbQuerier.js +0 -2
  11. package/dist/maria/mariadbQuerier.js.map +1 -1
  12. package/dist/migrate/migrator.js +1 -1
  13. package/dist/migrate/migrator.js.map +1 -1
  14. package/dist/mongo/mongoDialect.d.ts +8 -0
  15. package/dist/mongo/mongoDialect.d.ts.map +1 -1
  16. package/dist/mongo/mongoDialect.js +93 -4
  17. package/dist/mongo/mongoDialect.js.map +1 -1
  18. package/dist/mongo/mongodbQuerier.d.ts +3 -3
  19. package/dist/mongo/mongodbQuerier.d.ts.map +1 -1
  20. package/dist/mongo/mongodbQuerier.js +6 -6
  21. package/dist/mongo/mongodbQuerier.js.map +1 -1
  22. package/dist/mysql/mysql2Querier.d.ts.map +1 -1
  23. package/dist/mysql/mysql2Querier.js +0 -2
  24. package/dist/mysql/mysql2Querier.js.map +1 -1
  25. package/dist/mysql/mysqlDialect.d.ts +12 -1
  26. package/dist/mysql/mysqlDialect.d.ts.map +1 -1
  27. package/dist/mysql/mysqlDialect.js +79 -0
  28. package/dist/mysql/mysqlDialect.js.map +1 -1
  29. package/dist/neon/neonQuerier.d.ts.map +1 -1
  30. package/dist/neon/neonQuerier.js +0 -2
  31. package/dist/neon/neonQuerier.js.map +1 -1
  32. package/dist/postgres/pgQuerier.d.ts.map +1 -1
  33. package/dist/postgres/pgQuerier.js +0 -2
  34. package/dist/postgres/pgQuerier.js.map +1 -1
  35. package/dist/postgres/postgresDialect.d.ts +11 -0
  36. package/dist/postgres/postgresDialect.d.ts.map +1 -1
  37. package/dist/postgres/postgresDialect.js +74 -0
  38. package/dist/postgres/postgresDialect.js.map +1 -1
  39. package/dist/querier/abstractPoolQuerier.d.ts.map +1 -1
  40. package/dist/querier/abstractPoolQuerier.js.map +1 -1
  41. package/dist/querier/abstractQuerier.d.ts +52 -5
  42. package/dist/querier/abstractQuerier.d.ts.map +1 -1
  43. package/dist/querier/abstractQuerier.js +66 -29
  44. package/dist/querier/abstractQuerier.js.map +1 -1
  45. package/dist/querier/abstractSqlQuerier.d.ts +10 -3
  46. package/dist/querier/abstractSqlQuerier.d.ts.map +1 -1
  47. package/dist/querier/abstractSqlQuerier.js +29 -5
  48. package/dist/querier/abstractSqlQuerier.js.map +1 -1
  49. package/dist/querier/decorator/log.js +1 -1
  50. package/dist/querier/decorator/log.js.map +1 -1
  51. package/dist/sqlite/sqliteDialect.d.ts +9 -0
  52. package/dist/sqlite/sqliteDialect.d.ts.map +1 -1
  53. package/dist/sqlite/sqliteDialect.js +69 -1
  54. package/dist/sqlite/sqliteDialect.js.map +1 -1
  55. package/dist/sqlite/sqliteQuerierPool.d.ts +2 -0
  56. package/dist/sqlite/sqliteQuerierPool.d.ts.map +1 -1
  57. package/dist/type/logger.d.ts +2 -1
  58. package/dist/type/logger.d.ts.map +1 -1
  59. package/dist/type/migration.d.ts +3 -3
  60. package/dist/type/migration.d.ts.map +1 -1
  61. package/dist/type/querier.d.ts +47 -1
  62. package/dist/type/querier.d.ts.map +1 -1
  63. package/dist/type/querier.js.map +1 -1
  64. package/dist/type/query.d.ts +30 -0
  65. package/dist/type/query.d.ts.map +1 -1
  66. package/dist/type/query.js.map +1 -1
  67. package/dist/type/utility.d.ts +2 -0
  68. package/dist/type/utility.d.ts.map +1 -1
  69. package/dist/util/logger.d.ts +5 -4
  70. package/dist/util/logger.d.ts.map +1 -1
  71. package/dist/util/logger.js +11 -10
  72. package/dist/util/logger.js.map +1 -1
  73. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
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
- ## [3.8.5](https://github.com/rogerpadilla/uql/compare/@uql/core@3.8.4...@uql/core@3.8.5) (2026-01-09)
6
+ ## [3.9.1](https://github.com/rogerpadilla/uql/compare/@uql/core@3.9.0...@uql/core@3.9.1) (2026-02-13)
7
7
 
8
8
  **Note:** Version bump only for package @uql/core
9
9
 
@@ -17,6 +17,21 @@ All notable changes to this project will be documented in this file. Please add
17
17
 
18
18
  date format is [yyyy-mm-dd]
19
19
 
20
+ ## [3.9.0] - 2026-02-13
21
+ ### New Features
22
+ - **New Query Operators**: Added `$between`, `$isNull`, `$isNotNull`, `$all`, `$size`, and `$elemMatch` operators with full support across PostgreSQL, MySQL, SQLite, and MongoDB.
23
+ - **Dual-API Pattern**: Querier read and delete methods (`findOne`, `findMany`, `findManyAndCount`, `count`, `deleteMany`) now accept either the classic `(Entity, query)` call or an RPC-friendly `({ $entity: Entity, ...query })` call. This enables cleaner serialization for RPC/REST endpoints.
24
+
25
+ ### Improvements & Refactoring
26
+ - **Structured Slow-Query Config**: Replaced flat `slowQueryThreshold: number` with a `slowQuery: { threshold, logParams? }` object. Use `logParams: false` to suppress sensitive query parameters from slow-query logs.
27
+ - **DRY Dialect Refactor**: Extracted shared `$elemMatch` field-condition logic into `buildJsonFieldCondition` in `AbstractSqlDialect` with a `JsonFieldConfig` type. Each SQL dialect now passes a small config object (~10 lines) instead of duplicating a ~60-line switch across MySQL, PostgreSQL, and SQLite.
28
+ - **Safer Abstract Base**: `$all`, `$size`, and `$elemMatch` now throw in the abstract SQL dialect base class, forcing each dialect subclass to provide its own implementation. This prevents silent inheritance of dialect-specific syntax.
29
+ - **Type Safety**: Removed `$entity` from base `QuerySearch` type; it now exists only in dedicated intersection types (`QueryWithEntity`, `QueryOneWithEntity`, `QuerySearchWithEntity`), preventing it from leaking into unrelated query contexts.
30
+
31
+ ### Bug Fixes
32
+ - **SQLite `$in`/`$nin` Fix**: Fixed a critical bug where `buildJsonFieldOperator` used `vals.shift()` inside `.map()`, mutating the input array and only processing half the values.
33
+ - **Accurate Slow-Query Logging**: The `@Log()` timer now excludes connection establishment (TCP/SSL handshake) time. Previously, the first query on a new connection could trigger false slow-query alerts. Connection setup (`lazyConnect()`) is now centralized in `all()`/`run()` outside the `@Log()` scope.
34
+
20
35
  ## [3.8.4] - 2026-01-09
21
36
  ### Improvements
22
37
  - **Strict Type Polish**: Replaced remaining `any` type usage with `unknown` in the SQL introspection layer for improved safety. Refactored `toNumber` to handle more robustly various database numeric results during schema crawling.
package/README.md CHANGED
@@ -6,10 +6,6 @@
6
6
 
7
7
  **[UQL](https://uql.app)** 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
 
9
- - **Runs Everywhere**: Node.js, Bun, Deno, Cloudflare Workers, Electron, React Native, and the Browser.
10
- - **Unified API**: A consistent query interface for PostgreSQL (incl. CockroachDB, YugabyteDB), MySQL (incl. TiDB, Aurora), MariaDB, SQLite, LibSQL, Neon, Cloudflare D1, and MongoDB.
11
-
12
-  
13
9
 
14
10
  ```ts
15
11
  const users = await querier.findMany(User, {
@@ -22,17 +18,6 @@ const users = await querier.findMany(User, {
22
18
 
23
19
   
24
20
 
25
- ## Why UQL?
26
-
27
- | Feature | **UQL** | Traditional ORMs |
28
- | :------------------- | :------------------------------------------------------------------------ | :------------------------------------------------------ |
29
- | **API** | **Unified & Intuitive**: Same syntax for SQL & NoSQL. | Fragmented: SQL and Mongo feel like different worlds. |
30
- | **Safety** | **Deep Type-Safety**: Validates relations & operators at any depth. | Surface-level: Often loses types in complex joins. |
31
- | **Syntax** | **Serializable JSON**: Pure data, perfect for APIs/Websockets. | Method-Chaining: Hard to transport over the wire. |
32
- | **Efficiency** | **Sticky Connections**: Minimal overhead, human-readable SQL. | Heavy: Often generates "SQL Soup" that's hard to debug. |
33
-
34
-  
35
-
36
21
  ## Features
37
22
 
38
23
  | Feature | Description |
@@ -116,14 +101,29 @@ UQL separates the **intent** of your data from its **storage**. Both properties
116
101
  | **`columnType`** | **Physical Type** (Implementation). **Highest Priority**. Bypasses UQL's inference for exact SQL control. | Raw SQL types: `'varchar(100)'`, `'decimal(10,2)'`, `'smallint'`, etc. |
117
102
 
118
103
  ```ts
119
- @Field() // Inference: Maps to TEXT (Postgres) or VARCHAR(255) (MySQL) automatically.
120
- name?: string;
104
+ // Automatic inference from TypeScript types
105
+ @Field() name?: string; // → TEXT (Postgres), VARCHAR(255) (MySQL)
106
+ @Field() age?: number; // → INTEGER
107
+ @Field() isActive?: boolean; // → BOOLEAN
108
+ @Field() createdAt?: Date; // → TIMESTAMP
121
109
 
122
- @Field({ type: 'uuid' }) // Recommended: Cross-database abstraction for UUIDs.
123
- id?: string;
110
+ // Semantic types - portable across all databases
111
+ @Field({ type: 'uuid' }) // → UUID (Postgres), CHAR(36) (MySQL), TEXT (SQLite)
112
+ externalId?: string;
124
113
 
125
- @Field({ columnType: 'varchar(500)' }) // Control: Explicitly forces a specific SQL type.
114
+ @Field({ type: 'json' }) // JSONB (Postgres), JSON (MySQL), TEXT (SQLite)
115
+ metadata?: Record<string, unknown>;
116
+
117
+ // Logical types with constraints - portable with control
118
+ @Field({ type: 'varchar', length: 500 })
126
119
  bio?: string;
120
+
121
+ @Field({ type: 'decimal', precision: 10, scale: 2 })
122
+ price?: number;
123
+
124
+ // Exact SQL type - when you need dialect-specific control
125
+ @Field({ columnType: 'smallint' })
126
+ statusCode?: number;
127
127
  ```
128
128
 
129
129
 
@@ -238,8 +238,8 @@ export const pool = new PgQuerierPool(
238
238
  { host: 'localhost', database: 'uql_app', max: 10 },
239
239
  {
240
240
  logger: ['error', 'warn', 'migration'],
241
- slowQueryThreshold: 1000,
242
241
  namingStrategy: new SnakeCaseNamingStrategy()
242
+ slowQuery: { threshold: 1000 },
243
243
  }
244
244
  );
245
245
 
@@ -370,9 +370,9 @@ Use the CLI to manage your database schema evolution.
370
370
 
371
371
  | Command | Description |
372
372
  | :--- | :--- |
373
+ | `generate:from-db` | **Scaffolds Entities** from an existing database. Includes **Smart Relation Detection**. |
373
374
  | `generate <name>` | Creates an empty timestamped file for **manual** SQL migrations (e.g., data backfills). |
374
375
  | `generate:entities <name>` | **Auto-generates** a migration by diffing your entities against the current DB schema. |
375
- | `generate:from-db` | **Scaffolds Entities** from an existing database. Includes **Smart Relation Detection**. |
376
376
  | `drift:check` | **Drift Detection**: Compares your defined entities against the actual database schema and reports discrepancies. |
377
377
  | `up` | Applies all pending migrations. |
378
378
  | `down` | Rolls back the last applied migration batch. |
@@ -454,7 +454,7 @@ UQL features a professional-grade, structured logging system designed for high v
454
454
  | Level | Description |
455
455
  | :-------------------- | :-------------------------------------------------------------------------------------- |
456
456
  | `query` | **Standard Queries**: Beautifully formatted SQL/Command logs with execution time. |
457
- | `slowQuery` | **Bottleneck Alerts**: Dedicated logging for queries exceeding your threshold. |
457
+ | `slowQuery` | **Bottleneck Alerts**: Dedicated logging for queries exceeding your threshold. Use `logParams: false` to omit sensitive data. |
458
458
  | `error` / `warn` | **System Health**: Detailed error traces and potential issue warnings. |
459
459
  | `migration` | **Audit Trail**: Step-by-step history of schema changes. |
460
460
  | `skippedMigration` | **Safety**: Logs blocked unsafe schema changes during autoSync. |
@@ -18,19 +18,19 @@ var _dec, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, /**
18
18
  */ _init_createdAt, /**
19
19
  * 'onUpdate' property can be used to specify a custom mechanism for
20
20
  * obtaining the value of a field when updating:
21
- */ _init_updatedAt, _dec7, _initClass, _BaseEntity, _dec8, _dec9, _dec10, _init_name, _init_description, _init_kind, _dec11, _initClass1, _BaseEntity1, _dec12, _dec13, /**
21
+ */ _init_updatedAt, _initProto, _dec7, _initClass, _BaseEntity, _dec8, _dec9, _dec10, _init_name, _init_description, _init_kind, _initProto1, _dec11, _initClass1, _BaseEntity1, _dec12, _dec13, /**
22
22
  * an entity can specify its own ID Field and still inherit the others
23
23
  * columns/relations from its parent entity.
24
- */ _init_pk, _init_picture, _dec14, _initClass2, _BaseEntity2, _dec15, _dec16, _dec17, _dec18, _dec19, _init_name1, _init_email, _init_password, /**
24
+ */ _init_pk, _init_picture, _initProto2, _dec14, _initClass2, _BaseEntity2, _dec15, _dec16, _dec17, _dec18, _dec19, _init_name1, _init_email, _init_password, /**
25
25
  * `mappedBy` property can be a callback or a string (callback is useful for auto-refactoring).
26
- */ _init_profile, _init_users, _dec20, _initClass3, _dec21, _dec22, _init_id1, _init_name2, _dec23, _initClass4, _BaseEntity3, _dec24, _dec25, _dec26, _dec27, _init_name3, _init_description1, _init_parentLedgerId, _init_parentLedger, _dec28, _initClass5, _BaseEntity4, _dec29, _dec30, _dec31, /**
26
+ */ _init_profile, _init_users, _initProto3, _dec20, _initClass3, _dec21, _dec22, _init_id1, _init_name2, _initProto4, _dec23, _initClass4, _BaseEntity3, _dec24, _dec25, _dec26, _dec27, _init_name3, _init_description1, _init_parentLedgerId, _init_parentLedger, _initProto5, _dec28, _initClass5, _BaseEntity4, _dec29, _dec30, _dec31, /**
27
27
  * an entity can override the ID Field and still inherit the others
28
28
  * columns/relations from its parent entity.
29
29
  * 'onInsert' property can be used to specify a custom mechanism for
30
30
  * auto-generating the primary-key's value when inserting.
31
- */ _init_pk1, _init_name4, _init_description2, _dec32, _initClass6, _BaseEntity5, _dec33, _dec34, _dec35, _dec36, _dec37, _init_name5, _init_percentage, _init_categoryId, _init_category, _init_description3, _dec38, _initClass7, _BaseEntity6, _dec39, _dec40, _dec41, _init_name6, _init_measureUnits, /**
31
+ */ _init_pk1, _init_name4, _init_description2, _initProto6, _dec32, _initClass6, _BaseEntity5, _dec33, _dec34, _dec35, _dec36, _dec37, _init_name5, _init_percentage, _init_categoryId, _init_category, _init_description3, _initProto7, _dec38, _initClass7, _BaseEntity6, _dec39, _dec40, _dec41, _init_name6, _init_measureUnits, /**
32
32
  * `onDelete` callback allows to specify which field will be used when deleting/querying this entity.
33
- */ _init_deletedAt, _dec42, _initClass8, _BaseEntity7, _dec43, _dec44, _dec45, _dec46, _init_name7, _init_categoryId1, _init_category1, _init_deletedAt1, _dec47, _initClass9, _BaseEntity8, _dec48, _dec49, _dec50, _init_name8, _init_address, _init_description4, _dec51, _initClass10, _BaseEntity9, _dec52, _dec53, _dec54, _dec55, _dec56, _dec57, _dec58, _dec59, _dec60, _dec61, _dec62, _dec63, _dec64, _dec65, _dec66, _init_name9, _init_description5, _init_code, _init_buyLedgerAccountId, _init_buyLedgerAccount, _init_saleLedgerAccountId, _init_saleLedgerAccount, _init_taxId, _init_tax, _init_measureUnitId, _init_measureUnit, _init_salePrice, _init_inventoryable, _init_tags, _init_tagsCount, _dec67, _initClass11, _BaseEntity10, _dec68, _dec69, _dec70, _init_name10, _init_items, _init_itemsCount, _dec71, _initClass12, _dec72, _dec73, _dec74, _init_id2, _init_itemId, _init_tagId, _dec75, _initClass13, _BaseEntity11, _dec76, _dec77, _dec78, _init_itemAdjustments, _init_date, _init_description6, _dec79, _initClass14, _BaseEntity12, _dec80, _dec81, _dec82, _dec83, _dec84, _dec85, _dec86, _dec87, _init_itemId1, _init_item, _init_number, _init_buyPrice, _init_storehouseId, _init_storehouse, _init_inventoryAdjustmentId, _init_inventoryAdjustment;
33
+ */ _init_deletedAt, _initProto8, _dec42, _initClass8, _BaseEntity7, _dec43, _dec44, _dec45, _dec46, _init_name7, _init_categoryId1, _init_category1, _init_deletedAt1, _initProto9, _dec47, _initClass9, _BaseEntity8, _dec48, _dec49, _dec50, _init_name8, _init_address, _init_description4, _initProto10, _dec51, _initClass10, _BaseEntity9, _dec52, _dec53, _dec54, _dec55, _dec56, _dec57, _dec58, _dec59, _dec60, _dec61, _dec62, _dec63, _dec64, _dec65, _dec66, _init_name9, _init_description5, _init_code, _init_buyLedgerAccountId, _init_buyLedgerAccount, _init_saleLedgerAccountId, _init_saleLedgerAccount, _init_taxId, _init_tax, _init_measureUnitId, _init_measureUnit, _init_salePrice, _init_inventoryable, _init_tags, _init_tagsCount, _initProto11, _dec67, _initClass11, _BaseEntity10, _dec68, _dec69, _dec70, _init_name10, _init_items, _init_itemsCount, _initProto12, _dec71, _initClass12, _dec72, _dec73, _dec74, _init_id2, _init_itemId, _init_tagId, _initProto13, _dec75, _initClass13, _BaseEntity11, _dec76, _dec77, _dec78, _init_itemAdjustments, _init_date, _init_description6, _initProto14, _dec79, _initClass14, _BaseEntity12, _dec80, _dec81, _dec82, _dec83, _dec84, _dec85, _dec86, _dec87, _init_itemId1, _init_item, _init_number, _init_buyPrice, _init_storehouseId, _init_storehouse, _init_inventoryAdjustmentId, _init_inventoryAdjustment, _initProto15;
34
34
  _dec = Id(), _dec1 = Field({
35
35
  references: ()=>_Company
36
36
  }), _dec2 = ManyToOne({
@@ -49,7 +49,7 @@ _dec = Id(), _dec1 = Field({
49
49
  * (so common fields' declaration is easily reused).
50
50
  */ class BaseEntity {
51
51
  static{
52
- ({ e: [_init_id, _init_companyId, _init_company, _init_creatorId, _init_creator, _init_createdAt, _init_updatedAt] } = _apply_decs_2203_r(this, [
52
+ ({ e: [_init_id, _init_companyId, _init_company, _init_creatorId, _init_creator, _init_createdAt, _init_updatedAt, _initProto] } = _apply_decs_2203_r(this, [
53
53
  [
54
54
  _dec,
55
55
  0,
@@ -88,7 +88,7 @@ _dec = Id(), _dec1 = Field({
88
88
  ], []));
89
89
  }
90
90
  constructor(){
91
- this.id = _init_id(this);
91
+ this.id = (_initProto(this), _init_id(this));
92
92
  this.companyId = _init_companyId(this);
93
93
  this.company = _init_company(this);
94
94
  this.creatorId = _init_creatorId(this);
@@ -103,7 +103,7 @@ _dec7 = Entity(), _dec8 = Field(), _dec9 = Field(), _dec10 = Field({
103
103
  });
104
104
  class Company extends (_BaseEntity = BaseEntity) {
105
105
  static{
106
- ({ e: [_init_name, _init_description, _init_kind], c: [_Company, _initClass] } = _apply_decs_2203_r(this, [
106
+ ({ e: [_init_name, _init_description, _init_kind, _initProto1], c: [_Company, _initClass] } = _apply_decs_2203_r(this, [
107
107
  [
108
108
  _dec8,
109
109
  0,
@@ -127,7 +127,7 @@ class Company extends (_BaseEntity = BaseEntity) {
127
127
  _initClass();
128
128
  }
129
129
  constructor(...args){
130
- super(...args), this.name = _init_name(this), this.description = _init_description(this), this.kind = _init_kind(this);
130
+ super(...args), this.name = (_initProto1(this), _init_name(this)), this.description = _init_description(this), this.kind = _init_kind(this);
131
131
  }
132
132
  }
133
133
  let _Profile;
@@ -138,7 +138,7 @@ _dec11 = Entity({
138
138
  });
139
139
  class Profile extends (_BaseEntity1 = BaseEntity) {
140
140
  static{
141
- ({ e: [_init_pk, _init_picture], c: [_Profile, _initClass1] } = _apply_decs_2203_r(this, [
141
+ ({ e: [_init_pk, _init_picture, _initProto2], c: [_Profile, _initClass1] } = _apply_decs_2203_r(this, [
142
142
  [
143
143
  _dec12,
144
144
  0,
@@ -157,7 +157,7 @@ class Profile extends (_BaseEntity1 = BaseEntity) {
157
157
  _initClass1();
158
158
  }
159
159
  constructor(...args){
160
- super(...args), this.pk = _init_pk(this), this.picture = _init_picture(this);
160
+ super(...args), this.pk = (_initProto2(this), _init_pk(this)), this.picture = _init_picture(this);
161
161
  }
162
162
  }
163
163
  let _User;
@@ -175,7 +175,7 @@ _dec14 = Entity(), _dec15 = Field(), _dec16 = Field({
175
175
  });
176
176
  class User extends (_BaseEntity2 = BaseEntity) {
177
177
  static{
178
- ({ e: [_init_name1, _init_email, _init_password, _init_profile, _init_users], c: [_User, _initClass2] } = _apply_decs_2203_r(this, [
178
+ ({ e: [_init_name1, _init_email, _init_password, _init_profile, _init_users, _initProto3], c: [_User, _initClass2] } = _apply_decs_2203_r(this, [
179
179
  [
180
180
  _dec15,
181
181
  0,
@@ -209,7 +209,7 @@ class User extends (_BaseEntity2 = BaseEntity) {
209
209
  _initClass2();
210
210
  }
211
211
  constructor(...args){
212
- super(...args), this.name = _init_name1(this), this.email = _init_email(this), this.password = _init_password(this), this.profile = _init_profile(this), this.users = _init_users(this);
212
+ super(...args), this.name = (_initProto3(this), _init_name1(this)), this.email = _init_email(this), this.password = _init_password(this), this.profile = _init_profile(this), this.users = _init_users(this);
213
213
  }
214
214
  }
215
215
  let _UserWithNonUpdatableId;
@@ -218,7 +218,7 @@ _dec20 = Entity(), _dec21 = Id({
218
218
  }), _dec22 = Field();
219
219
  class UserWithNonUpdatableId {
220
220
  static{
221
- ({ e: [_init_id1, _init_name2], c: [_UserWithNonUpdatableId, _initClass3] } = _apply_decs_2203_r(this, [
221
+ ({ e: [_init_id1, _init_name2, _initProto4], c: [_UserWithNonUpdatableId, _initClass3] } = _apply_decs_2203_r(this, [
222
222
  [
223
223
  _dec21,
224
224
  0,
@@ -237,7 +237,7 @@ class UserWithNonUpdatableId {
237
237
  _initClass3();
238
238
  }
239
239
  constructor(){
240
- this.id = _init_id1(this);
240
+ this.id = (_initProto4(this), _init_id1(this));
241
241
  this.name = _init_name2(this);
242
242
  }
243
243
  }
@@ -247,7 +247,7 @@ _dec23 = Entity(), _dec24 = Field(), _dec25 = Field(), _dec26 = Field({
247
247
  }), _dec27 = ManyToOne();
248
248
  class LedgerAccount extends (_BaseEntity3 = BaseEntity) {
249
249
  static{
250
- ({ e: [_init_name3, _init_description1, _init_parentLedgerId, _init_parentLedger], c: [_LedgerAccount, _initClass4] } = _apply_decs_2203_r(this, [
250
+ ({ e: [_init_name3, _init_description1, _init_parentLedgerId, _init_parentLedger, _initProto5], c: [_LedgerAccount, _initClass4] } = _apply_decs_2203_r(this, [
251
251
  [
252
252
  _dec24,
253
253
  0,
@@ -276,7 +276,7 @@ class LedgerAccount extends (_BaseEntity3 = BaseEntity) {
276
276
  _initClass4();
277
277
  }
278
278
  constructor(...args){
279
- super(...args), this.name = _init_name3(this), this.description = _init_description1(this), this.parentLedgerId = _init_parentLedgerId(this), this.parentLedger = _init_parentLedger(this);
279
+ super(...args), this.name = (_initProto5(this), _init_name3(this)), this.description = _init_description1(this), this.parentLedgerId = _init_parentLedgerId(this), this.parentLedger = _init_parentLedger(this);
280
280
  }
281
281
  }
282
282
  let _TaxCategory;
@@ -285,7 +285,7 @@ _dec28 = Entity(), _dec29 = Id({
285
285
  }), _dec30 = Field(), _dec31 = Field();
286
286
  class TaxCategory extends (_BaseEntity4 = BaseEntity) {
287
287
  static{
288
- ({ e: [_init_pk1, _init_name4, _init_description2], c: [_TaxCategory, _initClass5] } = _apply_decs_2203_r(this, [
288
+ ({ e: [_init_pk1, _init_name4, _init_description2, _initProto6], c: [_TaxCategory, _initClass5] } = _apply_decs_2203_r(this, [
289
289
  [
290
290
  _dec29,
291
291
  0,
@@ -309,7 +309,7 @@ class TaxCategory extends (_BaseEntity4 = BaseEntity) {
309
309
  _initClass5();
310
310
  }
311
311
  constructor(...args){
312
- super(...args), this.pk = _init_pk1(this), this.name = _init_name4(this), this.description = _init_description2(this);
312
+ super(...args), this.pk = (_initProto6(this), _init_pk1(this)), this.name = _init_name4(this), this.description = _init_description2(this);
313
313
  }
314
314
  }
315
315
  let _Tax;
@@ -318,7 +318,7 @@ _dec32 = Entity(), _dec33 = Field(), _dec34 = Field(), _dec35 = Field({
318
318
  }), _dec36 = ManyToOne(), _dec37 = Field();
319
319
  class Tax extends (_BaseEntity5 = BaseEntity) {
320
320
  static{
321
- ({ e: [_init_name5, _init_percentage, _init_categoryId, _init_category, _init_description3], c: [_Tax, _initClass6] } = _apply_decs_2203_r(this, [
321
+ ({ e: [_init_name5, _init_percentage, _init_categoryId, _init_category, _init_description3, _initProto7], c: [_Tax, _initClass6] } = _apply_decs_2203_r(this, [
322
322
  [
323
323
  _dec33,
324
324
  0,
@@ -352,7 +352,7 @@ class Tax extends (_BaseEntity5 = BaseEntity) {
352
352
  _initClass6();
353
353
  }
354
354
  constructor(...args){
355
- super(...args), this.name = _init_name5(this), this.percentage = _init_percentage(this), this.categoryId = _init_categoryId(this), this.category = _init_category(this), this.description = _init_description3(this);
355
+ super(...args), this.name = (_initProto7(this), _init_name5(this)), this.percentage = _init_percentage(this), this.categoryId = _init_categoryId(this), this.category = _init_category(this), this.description = _init_description3(this);
356
356
  }
357
357
  }
358
358
  let _MeasureUnitCategory;
@@ -366,7 +366,7 @@ _dec38 = Entity({
366
366
  });
367
367
  class MeasureUnitCategory extends (_BaseEntity6 = BaseEntity) {
368
368
  static{
369
- ({ e: [_init_name6, _init_measureUnits, _init_deletedAt], c: [_MeasureUnitCategory, _initClass7] } = _apply_decs_2203_r(this, [
369
+ ({ e: [_init_name6, _init_measureUnits, _init_deletedAt, _initProto8], c: [_MeasureUnitCategory, _initClass7] } = _apply_decs_2203_r(this, [
370
370
  [
371
371
  _dec39,
372
372
  0,
@@ -390,7 +390,7 @@ class MeasureUnitCategory extends (_BaseEntity6 = BaseEntity) {
390
390
  _initClass7();
391
391
  }
392
392
  constructor(...args){
393
- super(...args), this.name = _init_name6(this), this.measureUnits = _init_measureUnits(this), this.deletedAt = _init_deletedAt(this);
393
+ super(...args), this.name = (_initProto8(this), _init_name6(this)), this.measureUnits = _init_measureUnits(this), this.deletedAt = _init_deletedAt(this);
394
394
  }
395
395
  }
396
396
  let _MeasureUnit;
@@ -405,7 +405,7 @@ _dec42 = Entity({
405
405
  });
406
406
  class MeasureUnit extends (_BaseEntity7 = BaseEntity) {
407
407
  static{
408
- ({ e: [_init_name7, _init_categoryId1, _init_category1, _init_deletedAt1], c: [_MeasureUnit, _initClass8] } = _apply_decs_2203_r(this, [
408
+ ({ e: [_init_name7, _init_categoryId1, _init_category1, _init_deletedAt1, _initProto9], c: [_MeasureUnit, _initClass8] } = _apply_decs_2203_r(this, [
409
409
  [
410
410
  _dec43,
411
411
  0,
@@ -434,14 +434,14 @@ class MeasureUnit extends (_BaseEntity7 = BaseEntity) {
434
434
  _initClass8();
435
435
  }
436
436
  constructor(...args){
437
- super(...args), this.name = _init_name7(this), this.categoryId = _init_categoryId1(this), this.category = _init_category1(this), this.deletedAt = _init_deletedAt1(this);
437
+ super(...args), this.name = (_initProto9(this), _init_name7(this)), this.categoryId = _init_categoryId1(this), this.category = _init_category1(this), this.deletedAt = _init_deletedAt1(this);
438
438
  }
439
439
  }
440
440
  let _Storehouse;
441
441
  _dec47 = Entity(), _dec48 = Field(), _dec49 = Field(), _dec50 = Field();
442
442
  class Storehouse extends (_BaseEntity8 = BaseEntity) {
443
443
  static{
444
- ({ e: [_init_name8, _init_address, _init_description4], c: [_Storehouse, _initClass9] } = _apply_decs_2203_r(this, [
444
+ ({ e: [_init_name8, _init_address, _init_description4, _initProto10], c: [_Storehouse, _initClass9] } = _apply_decs_2203_r(this, [
445
445
  [
446
446
  _dec48,
447
447
  0,
@@ -465,7 +465,7 @@ class Storehouse extends (_BaseEntity8 = BaseEntity) {
465
465
  _initClass9();
466
466
  }
467
467
  constructor(...args){
468
- super(...args), this.name = _init_name8(this), this.address = _init_address(this), this.description = _init_description4(this);
468
+ super(...args), this.name = (_initProto10(this), _init_name8(this)), this.address = _init_address(this), this.description = _init_description4(this);
469
469
  }
470
470
  }
471
471
  let _Item;
@@ -503,7 +503,7 @@ _dec51 = Entity(), _dec52 = Field(), _dec53 = Field(), _dec54 = Field(), _dec55
503
503
  });
504
504
  class Item extends (_BaseEntity9 = BaseEntity) {
505
505
  static{
506
- ({ e: [_init_name9, _init_description5, _init_code, _init_buyLedgerAccountId, _init_buyLedgerAccount, _init_saleLedgerAccountId, _init_saleLedgerAccount, _init_taxId, _init_tax, _init_measureUnitId, _init_measureUnit, _init_salePrice, _init_inventoryable, _init_tags, _init_tagsCount], c: [_Item, _initClass10] } = _apply_decs_2203_r(this, [
506
+ ({ e: [_init_name9, _init_description5, _init_code, _init_buyLedgerAccountId, _init_buyLedgerAccount, _init_saleLedgerAccountId, _init_saleLedgerAccount, _init_taxId, _init_tax, _init_measureUnitId, _init_measureUnit, _init_salePrice, _init_inventoryable, _init_tags, _init_tagsCount, _initProto11], c: [_Item, _initClass10] } = _apply_decs_2203_r(this, [
507
507
  [
508
508
  _dec52,
509
509
  0,
@@ -587,7 +587,7 @@ class Item extends (_BaseEntity9 = BaseEntity) {
587
587
  _initClass10();
588
588
  }
589
589
  constructor(...args){
590
- super(...args), this.name = _init_name9(this), this.description = _init_description5(this), this.code = _init_code(this), this.buyLedgerAccountId = _init_buyLedgerAccountId(this), this.buyLedgerAccount = _init_buyLedgerAccount(this), this.saleLedgerAccountId = _init_saleLedgerAccountId(this), this.saleLedgerAccount = _init_saleLedgerAccount(this), this.taxId = _init_taxId(this), this.tax = _init_tax(this), this.measureUnitId = _init_measureUnitId(this), this.measureUnit = _init_measureUnit(this), this.salePrice = _init_salePrice(this), this.inventoryable = _init_inventoryable(this), this.tags = _init_tags(this), this.tagsCount = _init_tagsCount(this);
590
+ super(...args), this.name = (_initProto11(this), _init_name9(this)), this.description = _init_description5(this), this.code = _init_code(this), this.buyLedgerAccountId = _init_buyLedgerAccountId(this), this.buyLedgerAccount = _init_buyLedgerAccount(this), this.saleLedgerAccountId = _init_saleLedgerAccountId(this), this.saleLedgerAccount = _init_saleLedgerAccount(this), this.taxId = _init_taxId(this), this.tax = _init_tax(this), this.measureUnitId = _init_measureUnitId(this), this.measureUnit = _init_measureUnit(this), this.salePrice = _init_salePrice(this), this.inventoryable = _init_inventoryable(this), this.tags = _init_tags(this), this.tagsCount = _init_tagsCount(this);
591
591
  }
592
592
  }
593
593
  let _Tag;
@@ -611,7 +611,7 @@ _dec67 = Entity(), _dec68 = Field(), _dec69 = ManyToMany({
611
611
  });
612
612
  class Tag extends (_BaseEntity10 = BaseEntity) {
613
613
  static{
614
- ({ e: [_init_name10, _init_items, _init_itemsCount], c: [_Tag, _initClass11] } = _apply_decs_2203_r(this, [
614
+ ({ e: [_init_name10, _init_items, _init_itemsCount, _initProto12], c: [_Tag, _initClass11] } = _apply_decs_2203_r(this, [
615
615
  [
616
616
  _dec68,
617
617
  0,
@@ -635,7 +635,7 @@ class Tag extends (_BaseEntity10 = BaseEntity) {
635
635
  _initClass11();
636
636
  }
637
637
  constructor(...args){
638
- super(...args), this.name = _init_name10(this), this.items = _init_items(this), this.itemsCount = _init_itemsCount(this);
638
+ super(...args), this.name = (_initProto12(this), _init_name10(this)), this.items = _init_items(this), this.itemsCount = _init_itemsCount(this);
639
639
  }
640
640
  }
641
641
  let _ItemTag;
@@ -646,7 +646,7 @@ _dec71 = Entity(), _dec72 = Id(), _dec73 = Field({
646
646
  });
647
647
  class ItemTag {
648
648
  static{
649
- ({ e: [_init_id2, _init_itemId, _init_tagId], c: [_ItemTag, _initClass12] } = _apply_decs_2203_r(this, [
649
+ ({ e: [_init_id2, _init_itemId, _init_tagId, _initProto13], c: [_ItemTag, _initClass12] } = _apply_decs_2203_r(this, [
650
650
  [
651
651
  _dec72,
652
652
  0,
@@ -670,7 +670,7 @@ class ItemTag {
670
670
  _initClass12();
671
671
  }
672
672
  constructor(){
673
- this.id = _init_id2(this);
673
+ this.id = (_initProto13(this), _init_id2(this));
674
674
  this.itemId = _init_itemId(this);
675
675
  this.tagId = _init_tagId(this);
676
676
  }
@@ -683,7 +683,7 @@ _dec75 = Entity(), _dec76 = OneToMany({
683
683
  }), _dec77 = Field(), _dec78 = Field();
684
684
  class InventoryAdjustment extends (_BaseEntity11 = BaseEntity) {
685
685
  static{
686
- ({ e: [_init_itemAdjustments, _init_date, _init_description6], c: [_InventoryAdjustment, _initClass13] } = _apply_decs_2203_r(this, [
686
+ ({ e: [_init_itemAdjustments, _init_date, _init_description6, _initProto14], c: [_InventoryAdjustment, _initClass13] } = _apply_decs_2203_r(this, [
687
687
  [
688
688
  _dec76,
689
689
  0,
@@ -707,7 +707,7 @@ class InventoryAdjustment extends (_BaseEntity11 = BaseEntity) {
707
707
  _initClass13();
708
708
  }
709
709
  constructor(...args){
710
- super(...args), this.itemAdjustments = _init_itemAdjustments(this), this.date = _init_date(this), this.description = _init_description6(this);
710
+ super(...args), this.itemAdjustments = (_initProto14(this), _init_itemAdjustments(this)), this.date = _init_date(this), this.description = _init_description6(this);
711
711
  }
712
712
  }
713
713
  let _ItemAdjustment;
@@ -720,7 +720,7 @@ _dec79 = Entity(), _dec80 = Field({
720
720
  }), _dec87 = ManyToOne();
721
721
  class ItemAdjustment extends (_BaseEntity12 = BaseEntity) {
722
722
  static{
723
- ({ e: [_init_itemId1, _init_item, _init_number, _init_buyPrice, _init_storehouseId, _init_storehouse, _init_inventoryAdjustmentId, _init_inventoryAdjustment], c: [_ItemAdjustment, _initClass14] } = _apply_decs_2203_r(this, [
723
+ ({ e: [_init_itemId1, _init_item, _init_number, _init_buyPrice, _init_storehouseId, _init_storehouse, _init_inventoryAdjustmentId, _init_inventoryAdjustment, _initProto15], c: [_ItemAdjustment, _initClass14] } = _apply_decs_2203_r(this, [
724
724
  [
725
725
  _dec80,
726
726
  0,
@@ -769,7 +769,7 @@ class ItemAdjustment extends (_BaseEntity12 = BaseEntity) {
769
769
  _initClass14();
770
770
  }
771
771
  constructor(...args){
772
- super(...args), this.itemId = _init_itemId1(this), this.item = _init_item(this), this.number = _init_number(this), this.buyPrice = _init_buyPrice(this), this.storehouseId = _init_storehouseId(this), this.storehouse = _init_storehouse(this), this.inventoryAdjustmentId = _init_inventoryAdjustmentId(this), this.inventoryAdjustment = _init_inventoryAdjustment(this);
772
+ super(...args), this.itemId = (_initProto15(this), _init_itemId1(this)), this.item = _init_item(this), this.number = _init_number(this), this.buyPrice = _init_buyPrice(this), this.storehouseId = _init_storehouseId(this), this.storehouse = _init_storehouse(this), this.inventoryAdjustmentId = _init_inventoryAdjustmentId(this), this.inventoryAdjustment = _init_inventoryAdjustment(this);
773
773
  }
774
774
  }
775
775
 
@@ -1390,6 +1390,10 @@ function printProps(keys, props, config, indentation, depth, refs, printer) {
1390
1390
  const colors = config.colors;
1391
1391
  return keys.map((key)=>{
1392
1392
  const value = props[key];
1393
+ // hidden injected value that should not be printed
1394
+ if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && value.match(/__vitest_\d+__/)) {
1395
+ return "";
1396
+ }
1393
1397
  let printed = printer(value, config, indentationNext, depth, refs);
1394
1398
  if (typeof value !== "string") {
1395
1399
  if (printed.includes("\n")) {
@@ -3926,7 +3930,7 @@ let defaultSuite;
3926
3930
  let currentTestFilepath;
3927
3931
  function assert(condition, message) {
3928
3932
  if (!condition) {
3929
- throw new Error(`Vitest failed to find ${message}. This is a bug in Vitest. Please, open an issue with reproduction.`);
3933
+ throw new Error(`Vitest failed to find ${message}. One of the following is possible:` + "\n- \"vitest\" is imported directly without running \"vitest\" command" + "\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)" + "\n- \"vitest\" is imported inside Vite / Vitest config file" + "\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n");
3930
3934
  }
3931
3935
  }
3932
3936
  function getRunner() {