uql-orm 0.11.0 → 0.14.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/CHANGELOG.md +109 -47
- package/README.md +1 -0
- package/dist/browser/http/http.d.ts.map +1 -1
- package/dist/browser/http/http.js.map +1 -1
- package/dist/browser/querier/httpQuerier.d.ts.map +1 -1
- package/dist/browser/querier/httpQuerier.js +2 -2
- package/dist/browser/querier/httpQuerier.js.map +1 -1
- package/dist/browser/type/clientQuerier.d.ts +2 -2
- package/dist/browser/uql-browser.min.js +2 -2
- package/dist/browser/uql-browser.min.js.map +5 -5
- package/dist/bunSql/bunSqlPostgresDialect.d.ts.map +1 -1
- package/dist/bunSql/bunSqlPostgresDialect.js.map +1 -1
- package/dist/bunSql/bunSqlQuerier.d.ts.map +1 -1
- package/dist/bunSql/bunSqlQuerier.js.map +1 -1
- package/dist/bunSql/bunSqlQuerierPool.d.ts.map +1 -1
- package/dist/bunSql/bunSqlQuerierPool.js.map +1 -1
- package/dist/cockroachdb/crdbQuerierPool.d.ts.map +1 -1
- package/dist/context/context.browser.d.ts +7 -0
- package/dist/context/context.browser.d.ts.map +1 -0
- package/dist/context/context.browser.js +28 -0
- package/dist/context/context.browser.js.map +1 -0
- package/dist/context/context.d.ts +15 -0
- package/dist/context/context.d.ts.map +1 -0
- package/dist/context/context.js +21 -0
- package/dist/context/context.js.map +1 -0
- package/dist/context/securityError.d.ts +5 -0
- package/dist/context/securityError.d.ts.map +1 -0
- package/dist/context/securityError.js +5 -0
- package/dist/context/securityError.js.map +1 -0
- package/dist/d1/d1Querier.d.ts.map +1 -1
- package/dist/d1/d1Querier.js.map +1 -1
- package/dist/d1/d1QuerierPool.d.ts.map +1 -1
- package/dist/dialect/abstractDialect.d.ts.map +1 -1
- package/dist/dialect/abstractDialect.js.map +1 -1
- package/dist/dialect/abstractSqlDialect.d.ts +3 -1
- package/dist/dialect/abstractSqlDialect.d.ts.map +1 -1
- package/dist/dialect/abstractSqlDialect.js +24 -25
- package/dist/dialect/abstractSqlDialect.js.map +1 -1
- package/dist/dialect/mysqlLikeSqlDialect.d.ts.map +1 -1
- package/dist/dialect/mysqlLikeSqlDialect.js.map +1 -1
- package/dist/dialect/queryContext.d.ts.map +1 -1
- package/dist/dialect/queryContext.js.map +1 -1
- package/dist/entity/decorator/entity.d.ts.map +1 -1
- package/dist/entity/decorator/field.d.ts.map +1 -1
- package/dist/entity/decorator/filter.d.ts +8 -0
- package/dist/entity/decorator/filter.d.ts.map +1 -0
- package/dist/entity/decorator/filter.js +12 -0
- package/dist/entity/decorator/filter.js.map +1 -0
- package/dist/entity/decorator/id.d.ts.map +1 -1
- package/dist/entity/decorator/id.js.map +1 -1
- package/dist/entity/decorator/index-decorator.d.ts.map +1 -1
- package/dist/entity/decorator/index-decorator.js.map +1 -1
- package/dist/entity/decorator/index.d.ts +2 -1
- package/dist/entity/decorator/index.d.ts.map +1 -1
- package/dist/entity/decorator/index.js +2 -1
- package/dist/entity/decorator/index.js.map +1 -1
- package/dist/entity/decorator/relation.d.ts.map +1 -1
- package/dist/entity/metadata/definition.d.ts +2 -1
- package/dist/entity/metadata/definition.d.ts.map +1 -1
- package/dist/entity/metadata/definition.js +43 -6
- package/dist/entity/metadata/definition.js.map +1 -1
- package/dist/entity/test-helpers.d.ts +1 -1
- package/dist/entity/test-helpers.d.ts.map +1 -1
- package/dist/entity/test-helpers.js +1 -0
- package/dist/entity/test-helpers.js.map +1 -1
- package/dist/express/querierMiddleware.js.map +1 -1
- package/dist/http/contract.d.ts +25 -25
- package/dist/http/contract.d.ts.map +1 -1
- package/dist/http/fetchHandler.js.map +1 -1
- package/dist/http/handler.d.ts +10 -4
- package/dist/http/handler.d.ts.map +1 -1
- package/dist/http/handler.js +21 -16
- package/dist/http/handler.js.map +1 -1
- package/dist/http/query.d.ts +1 -1
- package/dist/http/query.d.ts.map +1 -1
- package/dist/http/query.js +21 -3
- package/dist/http/query.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/libsql/libsqlQuerier.d.ts.map +1 -1
- package/dist/libsql/libsqlQuerier.js.map +1 -1
- package/dist/libsql/libsqlQuerierPool.d.ts +1 -1
- package/dist/libsql/libsqlQuerierPool.d.ts.map +1 -1
- package/dist/libsql/libsqlQuerierPool.js +1 -1
- package/dist/maria/mariaDialect.d.ts.map +1 -1
- package/dist/maria/mariaDialect.js.map +1 -1
- package/dist/maria/mariadbQuerier.d.ts.map +1 -1
- package/dist/maria/mariadbQuerierPool.d.ts.map +1 -1
- package/dist/maria/mariadbQuerierPool.js +1 -1
- package/dist/migrate/builder/columnBuilder.d.ts.map +1 -1
- package/dist/migrate/builder/columnBuilder.js.map +1 -1
- package/dist/migrate/builder/expressions.d.ts.map +1 -1
- package/dist/migrate/builder/expressions.js.map +1 -1
- package/dist/migrate/builder/migrationBuilder.d.ts.map +1 -1
- package/dist/migrate/builder/migrationBuilder.js.map +1 -1
- package/dist/migrate/builder/tableBuilder.d.ts.map +1 -1
- package/dist/migrate/builder/tableBuilder.js.map +1 -1
- package/dist/migrate/cli.d.ts +1 -1
- package/dist/migrate/cli.js +1 -1
- package/dist/migrate/codegen/entityCodeGenerator.d.ts.map +1 -1
- package/dist/migrate/codegen/entityCodeGenerator.js.map +1 -1
- package/dist/migrate/codegen/entityMerger.d.ts.map +1 -1
- package/dist/migrate/codegen/entityMerger.js +1 -1
- package/dist/migrate/codegen/entityMerger.js.map +1 -1
- package/dist/migrate/codegen/migrationCodeGenerator.d.ts.map +1 -1
- package/dist/migrate/codegen/migrationCodeGenerator.js.map +1 -1
- package/dist/migrate/codegen/smartRelationDetector.d.ts.map +1 -1
- package/dist/migrate/codegen/smartRelationDetector.js.map +1 -1
- package/dist/migrate/drift/driftDetector.d.ts.map +1 -1
- package/dist/migrate/drift/driftDetector.js.map +1 -1
- package/dist/migrate/generator/mongoSchemaGenerator.d.ts.map +1 -1
- package/dist/migrate/generator/mongoSchemaGenerator.js.map +1 -1
- package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts.map +1 -1
- package/dist/migrate/introspection/baseSqlIntrospector.d.ts.map +1 -1
- package/dist/migrate/introspection/baseSqlIntrospector.js.map +1 -1
- package/dist/migrate/introspection/mongoIntrospector.d.ts.map +1 -1
- package/dist/migrate/introspection/mongoIntrospector.js.map +1 -1
- package/dist/migrate/introspection/mysqlIntrospector.d.ts.map +1 -1
- package/dist/migrate/introspection/mysqlIntrospector.js.map +1 -1
- package/dist/migrate/introspection/postgresIntrospector.d.ts.map +1 -1
- package/dist/migrate/introspection/postgresIntrospector.js.map +1 -1
- package/dist/migrate/introspection/sqliteIntrospector.d.ts.map +1 -1
- package/dist/migrate/introspection/sqliteIntrospector.js.map +1 -1
- package/dist/migrate/migrator.d.ts.map +1 -1
- package/dist/migrate/migrator.js.map +1 -1
- package/dist/migrate/schemaGenerator.d.ts.map +1 -1
- package/dist/migrate/schemaGenerator.js.map +1 -1
- package/dist/migrate/storage/databaseStorage.d.ts.map +1 -1
- package/dist/migrate/storage/databaseStorage.js.map +1 -1
- package/dist/migrate/storage/jsonStorage.d.ts.map +1 -1
- package/dist/migrate/sync/schemaSync.d.ts.map +1 -1
- package/dist/migrate/sync/schemaSync.js.map +1 -1
- package/dist/mongo/mongoDialect.d.ts +7 -5
- package/dist/mongo/mongoDialect.d.ts.map +1 -1
- package/dist/mongo/mongoDialect.js +20 -17
- package/dist/mongo/mongoDialect.js.map +1 -1
- package/dist/mongo/mongodbQuerier.d.ts +5 -5
- package/dist/mongo/mongodbQuerier.d.ts.map +1 -1
- package/dist/mongo/mongodbQuerier.js +29 -29
- package/dist/mongo/mongodbQuerier.js.map +1 -1
- package/dist/mongo/mongodbQuerierPool.d.ts.map +1 -1
- package/dist/mysql/mysql2Querier.d.ts.map +1 -1
- package/dist/mysql/mysql2QuerierPool.d.ts.map +1 -1
- package/dist/namingStrategy/defaultNamingStrategy.d.ts.map +1 -1
- package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts.map +1 -1
- package/dist/neon/neonQuerierPool.d.ts.map +1 -1
- package/dist/nestjs/index.d.ts +1 -0
- package/dist/nestjs/index.d.ts.map +1 -1
- package/dist/nestjs/index.js +1 -0
- package/dist/nestjs/index.js.map +1 -1
- package/dist/nestjs/uqlContextInterceptor.d.ts +14 -0
- package/dist/nestjs/uqlContextInterceptor.d.ts.map +1 -0
- package/dist/nestjs/uqlContextInterceptor.js +26 -0
- package/dist/nestjs/uqlContextInterceptor.js.map +1 -0
- package/dist/nestjs/uqlModule.d.ts +32 -11
- package/dist/nestjs/uqlModule.d.ts.map +1 -1
- package/dist/nestjs/uqlModule.js +30 -11
- package/dist/nestjs/uqlModule.js.map +1 -1
- package/dist/postgres/abstractPgQuerier.d.ts.map +1 -1
- package/dist/postgres/abstractPgQuerierPool.d.ts +1 -1
- package/dist/postgres/abstractPgQuerierPool.d.ts.map +1 -1
- package/dist/postgres/abstractPgQuerierPool.js +1 -1
- package/dist/postgres/abstractPgQuerierPool.js.map +1 -1
- package/dist/postgres/pgDialect.d.ts.map +1 -1
- package/dist/postgres/pgDialect.js.map +1 -1
- package/dist/postgres/pgQuerierPool.d.ts.map +1 -1
- package/dist/postgres/postgresDialect.d.ts.map +1 -1
- package/dist/postgres/postgresDialect.js.map +1 -1
- package/dist/postgres/postgresWireDriverCapabilities.d.ts +1 -1
- package/dist/postgres/postgresWireDriverCapabilities.js +1 -1
- package/dist/querier/abstractPoolQuerier.d.ts.map +1 -1
- package/dist/querier/abstractPoolQuerier.js.map +1 -1
- package/dist/querier/abstractQuerier.d.ts +29 -26
- package/dist/querier/abstractQuerier.d.ts.map +1 -1
- package/dist/querier/abstractQuerier.js +48 -43
- package/dist/querier/abstractQuerier.js.map +1 -1
- package/dist/querier/abstractQuerierPool.d.ts.map +1 -1
- package/dist/querier/abstractQuerierPool.js.map +1 -1
- package/dist/querier/abstractSqlQuerier.d.ts +6 -6
- package/dist/querier/abstractSqlQuerier.d.ts.map +1 -1
- package/dist/querier/abstractSqlQuerier.js +16 -14
- package/dist/querier/abstractSqlQuerier.js.map +1 -1
- package/dist/querier/decorator/injectQuerier.d.ts.map +1 -1
- package/dist/querier/decorator/injectQuerier.js +1 -1
- package/dist/querier/decorator/log.d.ts.map +1 -1
- package/dist/querier/decorator/serialized.d.ts.map +1 -1
- package/dist/querier/decorator/transactional.d.ts.map +1 -1
- package/dist/querier/decorator/transactional.js +1 -1
- package/dist/querier/decorator/transactional.js.map +1 -1
- package/dist/schema/schemaAST.d.ts.map +1 -1
- package/dist/schema/schemaASTBuilder.d.ts +2 -2
- package/dist/schema/schemaASTBuilder.d.ts.map +1 -1
- package/dist/schema/schemaASTBuilder.js +2 -2
- package/dist/schema/schemaASTBuilder.js.map +1 -1
- package/dist/schema/schemaASTDiffer.d.ts.map +1 -1
- package/dist/schema/schemaASTDiffer.js.map +1 -1
- package/dist/sqlite/sqliteDialect.d.ts.map +1 -1
- package/dist/sqlite/sqliteDialect.js.map +1 -1
- package/dist/sqlite/sqliteQuerier.d.ts.map +1 -1
- package/dist/sqlite/sqliteQuerier.js.map +1 -1
- package/dist/sqlite/sqliteQuerierPool.d.ts.map +1 -1
- package/dist/sqlite/sqliteQuerierPool.js.map +1 -1
- package/dist/type/entity.d.ts +22 -7
- package/dist/type/entity.d.ts.map +1 -1
- package/dist/type/querier.d.ts +23 -16
- package/dist/type/querier.d.ts.map +1 -1
- package/dist/type/querier.js.map +1 -1
- package/dist/type/querierPool.d.ts +1 -1
- package/dist/type/query.d.ts +71 -21
- package/dist/type/query.d.ts.map +1 -1
- package/dist/type/query.js.map +1 -1
- package/dist/type/universalQuerier.d.ts +1 -1
- package/dist/util/ansiSqlLiteral.d.ts +1 -1
- package/dist/util/ansiSqlLiteral.js +1 -1
- package/dist/util/ansiSqlLiteral.js.map +1 -1
- package/dist/util/dialect.util.d.ts +27 -3
- package/dist/util/dialect.util.d.ts.map +1 -1
- package/dist/util/dialect.util.js +77 -0
- package/dist/util/dialect.util.js.map +1 -1
- package/dist/util/filters.util.d.ts +11 -0
- package/dist/util/filters.util.d.ts.map +1 -0
- package/dist/util/filters.util.js +12 -0
- package/dist/util/filters.util.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +1 -0
- package/dist/util/index.js.map +1 -1
- package/dist/util/logger.d.ts +1 -1
- package/dist/util/logger.d.ts.map +1 -1
- package/dist/util/logger.js +1 -1
- package/dist/util/logger.js.map +1 -1
- package/dist/util/raw.d.ts +1 -1
- package/dist/util/raw.js +1 -1
- package/dist/util/sql.util.js +1 -1
- package/dist/util/sql.util.js.map +1 -1
- package/package.json +22 -10
package/CHANGELOG.md
CHANGED
|
@@ -4,12 +4,74 @@ All notable changes to this project will be documented in this file. Please add
|
|
|
4
4
|
|
|
5
5
|
date format is [yyyy-mm-dd]
|
|
6
6
|
|
|
7
|
+
## [0.14.0] - 2026-07-08
|
|
8
|
+
|
|
9
|
+
Query filters, multi-tenancy / row-level security, and soft-delete restore. Upgrade straight from 0.12.0 - 0.13.0 was pulled before anyone could install it (its root import dragged `node:async_hooks` into browser bundles), so 0.14.0 is the first published build of these features and bundles cleanly on the client again.
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- **Query filters** - attach a named condition to an entity and it applies to every query automatically until you turn it off. Great for "active only" or visibility rules:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
@Filter('active', { condition: { status: 'active' }, default: false })
|
|
17
|
+
@Entity()
|
|
18
|
+
class Task {}
|
|
19
|
+
|
|
20
|
+
querier.findMany(Task, {}, { filters: { active: true } }); // on for this call
|
|
21
|
+
querier.findMany(Task, {}, { filters: false }); // all filters off
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- **Multi-tenancy / row-level security** - mark a filter `security` and resolve it from a per-request context. It applies to every query (relations and cascades included), can't be turned off, and a client can't widen it with their own `$where`:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
@Filter('tenant', {
|
|
28
|
+
// no tenant in context -> the query throws instead of running unscoped
|
|
29
|
+
condition: (ctx) => (ctx?.tenantId != null ? { companyId: ctx.tenantId } : undefined),
|
|
30
|
+
security: true,
|
|
31
|
+
})
|
|
32
|
+
@Entity()
|
|
33
|
+
class Invoice {}
|
|
34
|
+
|
|
35
|
+
await withContext({ tenantId }, () => querier.findMany(Invoice, {}));
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Set the context once at the HTTP boundary and every request is scoped automatically:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
createRequestHandler({ getContext: (req) => ({ tenantId: req.user.tenantId }) });
|
|
42
|
+
// NestJS: UqlModule.forRoot({ pool, getContext: (req) => ({ tenantId: req.user.tenantId }) })
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- **Restore soft-deleted rows** - `restoreOneById` / `restoreMany` bring rows back. Include trashed rows in any read with `withDeleted()`, or list only trashed ones with a plain query (`{ $where: { deletedAt: { $ne: null } } }`). Reads and updates take an options argument now too, so these toggles work on every operation, not just delete.
|
|
46
|
+
|
|
47
|
+
- **NestJS `forRootAsync`** - build the pool from injected providers such as `ConfigService`.
|
|
48
|
+
|
|
49
|
+
### Breaking Changes
|
|
50
|
+
|
|
51
|
+
- **Permanent deletes now use `hardDelete`** (was `{ softDelete: false }`). With a soft-delete field, delete soft-deletes by default; pass `{ hardDelete: true }` to remove rows for good. Over HTTP, `DELETE ?hardDelete=true` (was `?softDelete=true`):
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
await querier.deleteOneById(User, id); // soft delete
|
|
55
|
+
await querier.deleteOneById(User, id, { hardDelete: true }); // permanent
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Bug Fixes
|
|
59
|
+
|
|
60
|
+
- Soft-delete now works on **subclasses** that inherit the soft-delete field from a base entity.
|
|
61
|
+
- A cascading delete no longer throws when a related entity isn't soft-deletable - it's removed instead; MongoDB delete behavior now matches SQL.
|
|
62
|
+
|
|
63
|
+
## [0.12.0] - 2026-07-06
|
|
64
|
+
|
|
65
|
+
### Breaking Changes
|
|
66
|
+
|
|
67
|
+
- **`softDelete` moves from `@Entity` to `@Field`.** Mark the field itself - `@Field({ softDelete: true })` - instead of naming it on the entity (`@Entity({ softDelete: 'deletedAt' })`). This makes the field reference typo-proof (it's the decorated property, not a string) and lets the marker carry the value stamped on delete: `true` stamps the current timestamp (`new Date()`), or pass a callback for anything else, e.g. `@Field({ softDelete: () => Date.now() })` for an epoch-millis column. The stamp goes through the same value formatter as `onInsert`/`onUpdate`, so a `QueryRaw` (e.g. `() => raw(() => 'NOW()')`) is emitted inline. At most one field per entity may be marked. Reads still filter deleted rows via `<field> IS NULL`, and the `deleteMany(..., { softDelete })` query option is unchanged.
|
|
68
|
+
|
|
7
69
|
## [0.11.0] - 2026-07-06
|
|
8
70
|
|
|
9
71
|
### Breaking Changes
|
|
10
72
|
|
|
11
|
-
- **`softDelete` is configured by field name instead of `boolean`**: use `@Entity({ softDelete: 'deletedAt' })`
|
|
12
|
-
- **Removed `onDelete` and `foreignKey` from `@Field` options** (`FieldOptions`). `onDelete` was only a soft-delete marker, now superseded by the entity-level `softDelete` above; `foreignKey` was non-functional (never read)
|
|
73
|
+
- **`softDelete` is configured by field name instead of `boolean`**: use `@Entity({ softDelete: 'deletedAt' })` - naming the timestamp field - instead of `@Entity({ softDelete: true })` paired with `@Field({ onDelete: Date.now })`. On delete, the named field is stamped with `Date.now()`.
|
|
74
|
+
- **Removed `onDelete` and `foreignKey` from `@Field` options** (`FieldOptions`). `onDelete` was only a soft-delete marker, now superseded by the entity-level `softDelete` above; `foreignKey` was non-functional (never read) - foreign keys are derived from `references`/relations.
|
|
13
75
|
|
|
14
76
|
### Features
|
|
15
77
|
|
|
@@ -20,7 +82,7 @@ date format is [yyyy-mm-dd]
|
|
|
20
82
|
### Bug Fixes
|
|
21
83
|
|
|
22
84
|
- **Dropped idle connections no longer crash the process**: `pg`-based pools (Postgres, CockroachDB, Neon) now handle the pool's `'error'` event instead of leaving it unhandled. Postgres and CockroachDB also default to `keepAlive: true`, so idle connections drop less often to begin with.
|
|
23
|
-
- **Foreign key columns now match their referenced primary key type**: `@Field({ references: () => User })` with no explicit `type` fell back to the TypeScript property type (e.g. `string`
|
|
85
|
+
- **Foreign key columns now match their referenced primary key type**: `@Field({ references: () => User })` with no explicit `type` fell back to the TypeScript property type (e.g. `string` -> TEXT) instead of `User`'s actual primary key type (e.g. `UUID`), which could fail inserts and joins. Explicit types are still respected.
|
|
24
86
|
|
|
25
87
|
## [0.10.1] - 2026-07-03
|
|
26
88
|
|
|
@@ -30,7 +92,7 @@ date format is [yyyy-mm-dd]
|
|
|
30
92
|
|
|
31
93
|
### Bug Fixes
|
|
32
94
|
|
|
33
|
-
- **`uql-orm@0.10.0` on npm shipped only the browser bundle** (5 files; `dist/index.js` missing, so every server-side import failed). The package build shared the repo root's `tsBuildInfoFile` (introduced 2026-06-29 in an unrelated config cleanup): after `clean` wiped `dist`, `tsc -b` trusted the stale build info and emitted nothing, and the release published the partial `dist`. The build info is now package-local and the errant root-level one has been removed entirely, restoring the isolation each package had before that cleanup. `prepack` no longer checks two hardcoded files (which would have missed this exact failure
|
|
95
|
+
- **`uql-orm@0.10.0` on npm shipped only the browser bundle** (5 files; `dist/index.js` missing, so every server-side import failed). The package build shared the repo root's `tsBuildInfoFile` (introduced 2026-06-29 in an unrelated config cleanup): after `clean` wiped `dist`, `tsc -b` trusted the stale build info and emitted nothing, and the release published the partial `dist`. The build info is now package-local and the errant root-level one has been removed entirely, restoring the isolation each package had before that cleanup. `prepack` no longer checks two hardcoded files (which would have missed this exact failure - neither covered `uql-orm/migrate`); it now verifies every path declared in `main`, `types`, `bin`, and `exports` exists in `dist` before packing, derived straight from `package.json` so the check can't go stale as exports are added. Use 0.10.1 instead of 0.10.0.
|
|
34
96
|
|
|
35
97
|
## [0.10.0] - 2026-07-02
|
|
36
98
|
|
|
@@ -70,7 +132,7 @@ date format is [yyyy-mm-dd]
|
|
|
70
132
|
### Bug Fixes
|
|
71
133
|
|
|
72
134
|
- **`$entity` dual-API restored**: Querier read/delete methods (`findOne`, `findMany`, `findManyAndCount`, `count`, `deleteMany`, `findManyStream`) now use TypeScript overloads instead of union types, enabling correct entity inference for both `(Entity, query)` and `({ $entity: Entity, ...query })` call patterns.
|
|
73
|
-
- **`$select` / `$exclude` overlap resolved**: Both are now structurally identical map types (`{ [K in FieldKey<E>]?: BooleanLike }`)
|
|
135
|
+
- **`$select` / `$exclude` overlap resolved**: Both are now structurally identical map types (`{ [K in FieldKey<E>]?: BooleanLike }`) - whitelist (`$select`) vs. blacklist (`$exclude`). `$exclude` reverted to map form (was incorrectly changed to array), matching runtime `Object.entries()` usage.
|
|
74
136
|
- **`$exclude` JSDoc**: Updated comment from "array of field names" to map syntax `{ name: true }`.
|
|
75
137
|
|
|
76
138
|
### Security
|
|
@@ -97,7 +159,7 @@ date format is [yyyy-mm-dd]
|
|
|
97
159
|
### Dependencies
|
|
98
160
|
|
|
99
161
|
- Updated dev and prod dependencies.
|
|
100
|
-
- Docker images bumped: MySQL `9.6`
|
|
162
|
+
- Docker images bumped: MySQL `9.6` -> `9.7`, MariaDB `12.3-rc` -> `12.3` (now stable).
|
|
101
163
|
|
|
102
164
|
## [0.8.5] - 2026-05-24
|
|
103
165
|
|
|
@@ -141,13 +203,13 @@ date format is [yyyy-mm-dd]
|
|
|
141
203
|
|
|
142
204
|
### Bug Fixes
|
|
143
205
|
|
|
144
|
-
- **[#86](https://github.com/rogerpadilla/uql/issues/86)
|
|
206
|
+
- **[#86](https://github.com/rogerpadilla/uql/issues/86) - Invalid generated migration TypeScript with LibSQL**: `uql-migrate generate:entities` embedded SQL inside a JS **template literal**; SQLite/LibSQL identifier quotes use **backticks**, which **terminated** the outer literal and produced invalid `.ts` (so `uql-migrate up` could not even load the migration). Generated files now use **`JSON.stringify`** for each `querier.run(...)` argument (double-quoted string literals), so SQL may contain backticks, `"`, newlines, `${` inside string data, etc., without breaking TypeScript.
|
|
145
207
|
|
|
146
|
-
- **[#87](https://github.com/rogerpadilla/uql/issues/87)
|
|
208
|
+
- **[#87](https://github.com/rogerpadilla/uql/issues/87) - `uql-migrate` against libsql + sqld (HTTP) with multiple statements in one `run`**: **sqld** does not accept **multiple SQL statements** in a single `execute` / `run` call; a migration that bundled `CREATE TABLE ...;` and `CREATE INDEX ...;` in one string failed at runtime even when the TypeScript was valid. **Entity-generated migrations** now emit **one `await querier.run("...")` per statement**, and **`Migrator` / `syncForce` / `autoSync` / `MigrationBuilder`** apply create-table DDL **statement-by-statement**, matching sqld's behavior.
|
|
147
209
|
|
|
148
210
|
### Breaking Changes
|
|
149
211
|
|
|
150
|
-
- **`SchemaGenerator` create-table DDL** (supports the [#87](https://github.com/rogerpadilla/uql/issues/87) fix end-to-end): **`generateCreateTable`**, **`generateCreateTableFromNode`**, and **`generateCreateTableFromDefinition`** now return **`string[]`**
|
|
212
|
+
- **`SchemaGenerator` create-table DDL** (supports the [#87](https://github.com/rogerpadilla/uql/issues/87) fix end-to-end): **`generateCreateTable`**, **`generateCreateTableFromNode`**, and **`generateCreateTableFromDefinition`** now return **`string[]`** - one string per logical statement (`CREATE EXTENSION` if needed, `CREATE TABLE`, each separate `CREATE INDEX`, ...). They used to return a **single** newline-joined `string`. **Migrate custom code** by taking the array and either calling `querier.run(stmt)` for each element or using **`.join('\n')`** when you need one script blob. **`MongoSchemaGenerator`** uses the same signatures; each method returns a **one-element** array containing the JSON sync command string.
|
|
151
213
|
|
|
152
214
|
## [0.8.0] - 2026-04-03
|
|
153
215
|
|
|
@@ -157,7 +219,7 @@ date format is [yyyy-mm-dd]
|
|
|
157
219
|
|
|
158
220
|
### Breaking Changes (Internal API)
|
|
159
221
|
|
|
160
|
-
- **Entity metadata registry**: Runtime storage uses `Symbol.for('uql-orm/entity/metadata')` (replaces `uql-orm/entity/decorator`). Code that reached into `globalThis` with the old symbol will not see entities registered under the new key. Deep imports of `.../entity/decorator/definition.js` should use `.../entity/metadata/definition.js`. **`getOrCreateMeta` removed**
|
|
222
|
+
- **Entity metadata registry**: Runtime storage uses `Symbol.for('uql-orm/entity/metadata')` (replaces `uql-orm/entity/decorator`). Code that reached into `globalThis` with the old symbol will not see entities registered under the new key. Deep imports of `.../entity/decorator/definition.js` should use `.../entity/metadata/definition.js`. **`getOrCreateMeta` removed** - use **`ensureMeta`** from the same module if you need imperative "get or init" behavior.
|
|
161
223
|
|
|
162
224
|
## [0.7.10] - 2026-04-02
|
|
163
225
|
|
|
@@ -178,13 +240,13 @@ date format is [yyyy-mm-dd]
|
|
|
178
240
|
## [0.7.7] - 2026-03-31
|
|
179
241
|
|
|
180
242
|
### Breaking Changes (Internal API)
|
|
181
|
-
- **Pools and config**: `QuerierPool` exposes `dialect` (renamed from `dialectInstance`). The engine id string is `dialect.dialectName` (replacing the old `dialect` property on the dialect instance). Removed top-level `dialect` from `Config` and `MigratorOptions
|
|
243
|
+
- **Pools and config**: `QuerierPool` exposes `dialect` (renamed from `dialectInstance`). The engine id string is `dialect.dialectName` (replacing the old `dialect` property on the dialect instance). Removed top-level `dialect` from `Config` and `MigratorOptions`-migrations and `uql-migrate` use **`pool.dialect.dialectName`** only.
|
|
182
244
|
- **Dialect API**: Removed `dialectConfig` / `DialectConfig` from the public dialect barrel. Configure behavior with `DialectOptions`, `DialectFeatures` on `AbstractDialect.features`, and **per-driver dialect classes** attached to each pool.
|
|
183
245
|
|
|
184
246
|
### Improvements
|
|
185
247
|
|
|
186
248
|
- **Per-driver dialect classes**: Pools use explicit dialect types (e.g. `PgDialect`, `NeonDialect`, `MySql2Dialect`, `BetterSqlite3Dialect`, `LibsqlDialect`, `D1SqliteDialect`, `MongodbNativeDialect`, `BunSqlPostgresDialect`). Migrator and schema generation read **`pool.dialect.dialectName`** instead of a separate config field.
|
|
187
|
-
- **PostgreSQL (`pg` vs Bun SQL)**: `PgDialect` uses base Postgres defaults (native JS arrays for `ANY`/`ALL`, `$n::jsonb` for JSON). Bun SQL Postgres uses `BunSqlPostgresDialect` with `POSTGRES_WIRE_DRIVER_CAPABILITIES` from `uql-orm/postgres/wireCapabilities` plus `explicitJsonCast` where Bun
|
|
249
|
+
- **PostgreSQL (`pg` vs Bun SQL)**: `PgDialect` uses base Postgres defaults (native JS arrays for `ANY`/`ALL`, `$n::jsonb` for JSON). Bun SQL Postgres uses `BunSqlPostgresDialect` with `POSTGRES_WIRE_DRIVER_CAPABILITIES` from `uql-orm/postgres/wireCapabilities` plus `explicitJsonCast` where Bun's bindings require `( $n::text )::jsonb` and array literal encoding.
|
|
188
250
|
- **Migrations CLI**: Exported **`assertCliConfig`** (`uql-orm/migrate`) validates the default-exported config shape before commands run.
|
|
189
251
|
- **Escaping**: Inlined **`escapeAnsiSqlLiteral`** for Postgres/SQLite literal escaping; dropped **`sqlstring-sqlite`** from those code paths. Prefer bound parameters for user input in production.
|
|
190
252
|
- **Types and tests**: `Config.pool` is typed as `QuerierPool<Querier, AbstractDialect>`. **`createMockQuerierPool`** is available from `uql-orm/test`.
|
|
@@ -232,7 +294,7 @@ date format is [yyyy-mm-dd]
|
|
|
232
294
|
- **Bun SQL Support**: Added a first-class adapter for Bun's unified `sql` driver (`uql-orm/bunSql`). A single `BunSqlQuerierPool` infers the UQL dialect from `SQL.Options` (URL, `adapter`, or `filename`) and routes SQL generation to PostgreSQL, MySQL, MariaDB, SQLite, or CockroachDB ASTs. Includes dialect-aware option normalization (`inferDialect`, `normalizeBunOpts`), row/insert-id normalization for Bun result shapes, and a minimal `pool.query` shim for pg-compatible consumers.
|
|
233
295
|
|
|
234
296
|
### Breaking Changes
|
|
235
|
-
- **`$ne` is null-safe everywhere**: Non-null `$ne` now uses dialect-native null-safe inequality so rows with `NULL` in the compared column are included when they differ from the bound value (PostgreSQL/CockroachDB: `IS DISTINCT FROM`; SQLite: `IS NOT`; MySQL/MariaDB: `NOT (col <=> ?)`). This matches typical ORM expectations and fixes subtle
|
|
297
|
+
- **`$ne` is null-safe everywhere**: Non-null `$ne` now uses dialect-native null-safe inequality so rows with `NULL` in the compared column are included when they differ from the bound value (PostgreSQL/CockroachDB: `IS DISTINCT FROM`; SQLite: `IS NOT`; MySQL/MariaDB: `NOT (col <=> ?)`). This matches typical ORM expectations and fixes subtle "missing rows" bugs versus plain `<>` SQL. Queries that relied on SQL's three-valued logic excluding `NULL` from `$ne` matches may return more rows; use `{$ne: null}` / `$isNull` / `$isNotNull` explicitly for null-only filters.
|
|
236
298
|
|
|
237
299
|
### Security
|
|
238
300
|
- **SQL Injection Prevention for JSON**: Hardened JSON-path operators across all SQL dialects with strict identifier and key escaping.
|
|
@@ -271,14 +333,14 @@ date format is [yyyy-mm-dd]
|
|
|
271
333
|
- **CockroachDB Support**: Added first-class support for `cockroachdb` dialect, leveraging its PostgreSQL wire-compatibility. Includes native `upsert` support and seamlessly mapped driver execution.
|
|
272
334
|
|
|
273
335
|
### Testing
|
|
274
|
-
- **Vector search integration tests**: Added 7 end-to-end tests for `findMany` with `$sort: { $vector }` against a real Postgres+pgvector database
|
|
336
|
+
- **Vector search integration tests**: Added 7 end-to-end tests for `findMany` with `$sort: { $vector }` against a real Postgres+pgvector database - covers cosine/L2 similarity ordering, `$project` distance projection, filter+sort combo, `$limit`, and empty-table edge case.
|
|
275
337
|
- Docker Postgres image switched to `pgvector/pgvector:pg18` for pgvector extension support.
|
|
276
338
|
- Test DDL generator now handles `vector`, `halfvec`, and `sparsevec` column types.
|
|
277
339
|
|
|
278
340
|
## [0.4.4] - 2026-03-14
|
|
279
341
|
### Dependencies
|
|
280
|
-
- **Vite 7
|
|
281
|
-
- **TypeScript 5.9
|
|
342
|
+
- **Vite 7 -> 8**: Upgraded to Vite 8 (powered by Rolldown), replacing the `vite-tsconfig-paths` plugin with Vite's built-in `resolve.tsconfigPaths` option.
|
|
343
|
+
- **TypeScript 5.9 -> 6.0**: Upgraded to TypeScript 6.0.1-rc. Removed 6 redundant compiler options now default in TS6: `strict`, `strictNullChecks`, `noImplicitAny`, `esModuleInterop`, `allowSyntheticDefaultImports`, `useDefineForClassFields`.
|
|
282
344
|
- Removed `vite-tsconfig-paths` (replaced by built-in Vite 8 feature).
|
|
283
345
|
|
|
284
346
|
## [0.4.1] - 2026-03-13
|
|
@@ -287,7 +349,7 @@ date format is [yyyy-mm-dd]
|
|
|
287
349
|
|
|
288
350
|
## [0.4.0] - 2026-03-13
|
|
289
351
|
### New Features
|
|
290
|
-
- **`findManyStream()`
|
|
352
|
+
- **`findManyStream()` - Cursor-Based Async Iteration**: Stream query results row-by-row via `for await...of`. No relation-filling or lifecycle hooks - optimized for raw throughput on large result sets.
|
|
291
353
|
```ts
|
|
292
354
|
for await (const user of querier.findManyStream(User, { $where: { active: true } })) {
|
|
293
355
|
process.stdout.write(user.name + '\n');
|
|
@@ -295,11 +357,11 @@ date format is [yyyy-mm-dd]
|
|
|
295
357
|
```
|
|
296
358
|
Supports both the classic `(Entity, query)` and `$entity`-field dual-API patterns.
|
|
297
359
|
- **Native Streaming for All Major Drivers**: Each driver now uses its optimal streaming API instead of falling back to `internalAll()`:
|
|
298
|
-
- **SQLite** (`better-sqlite3`): `.iterate()`
|
|
299
|
-
- **MongoDB**: `FindCursor` async iterable
|
|
300
|
-
- **MariaDB**: `queryStream()`
|
|
301
|
-
- **PostgreSQL**: `pg-query-stream`
|
|
302
|
-
- **MySQL2**: `Connection.query().stream()`
|
|
360
|
+
- **SQLite** (`better-sqlite3`): `.iterate()` - sync, zero-copy row iteration.
|
|
361
|
+
- **MongoDB**: `FindCursor` async iterable - native driver cursor with `buildFindCursor` helper (extracted from `findMany` for DRY reuse).
|
|
362
|
+
- **MariaDB**: `queryStream()` - first-class streaming API since v3.0, with backpressure.
|
|
363
|
+
- **PostgreSQL**: `pg-query-stream` - server-side cursors via optional peer dependency.
|
|
364
|
+
- **MySQL2**: `Connection.query().stream()` - Readable stream from non-promise connection.
|
|
303
365
|
- **LibSQL / D1 / Neon**: Graceful fallback to `internalAll()` (HTTP-based, no streaming API).
|
|
304
366
|
|
|
305
367
|
### Breaking Changes
|
|
@@ -314,7 +376,7 @@ date format is [yyyy-mm-dd]
|
|
|
314
376
|
|
|
315
377
|
## [0.3.2] - 2026-03-12
|
|
316
378
|
### Improvements
|
|
317
|
-
- **Upsert `created` Flag**: added `created?: boolean` to `QueryUpdateResult`
|
|
379
|
+
- **Upsert `created` Flag**: added `created?: boolean` to `QueryUpdateResult` - `true` when the record was inserted, `false` when updated. Supported on PostgreSQL, MySQL, and MongoDB. Returns `undefined` on SQLite and MariaDB where the driver cannot determine this.
|
|
318
380
|
|
|
319
381
|
### Bug Fixes
|
|
320
382
|
- **MongoDB `upsertOne`**: Fixed `firstId` always being `undefined` on insert by switching from `returnDocument: 'before'` to `returnDocument: 'after'`.
|
|
@@ -324,7 +386,7 @@ date format is [yyyy-mm-dd]
|
|
|
324
386
|
|
|
325
387
|
## [0.3.1] - 2026-03-12
|
|
326
388
|
### New Features
|
|
327
|
-
- **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
|
|
389
|
+
- **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' })`.
|
|
328
390
|
|
|
329
391
|
## [0.3.0] - 2026-03-12
|
|
330
392
|
### New Features
|
|
@@ -346,7 +408,7 @@ date format is [yyyy-mm-dd]
|
|
|
346
408
|
|
|
347
409
|
## [0.2.7] - 2026-03-11
|
|
348
410
|
### New Features
|
|
349
|
-
- **More `$size` Comparison Operators**: `$size` now accepts comparison operator objects in addition to exact numbers
|
|
411
|
+
- **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`.
|
|
350
412
|
- **Relation Count Filtering**: `$size` on to-many relations (OneToMany, ManyToMany) now generates efficient `COUNT(*)` subqueries. E.g. `{ tags: { $size: { $gte: 2 } } }` produces `WHERE (SELECT COUNT(*) FROM ...) >= $1`.
|
|
351
413
|
|
|
352
414
|
### Test Coverage
|
|
@@ -354,7 +416,7 @@ date format is [yyyy-mm-dd]
|
|
|
354
416
|
|
|
355
417
|
## [0.2.6] - 2026-03-11
|
|
356
418
|
### Documentation
|
|
357
|
-
- **README
|
|
419
|
+
- **README - Migrations & Synchronization**: Rewrote the section with an entity-first intro explaining that UQL auto-generates migrations from entities. Reordered CLI commands to lead with `generate:entities`, renumbered usage examples, and added a concrete quick-start snippet.
|
|
358
420
|
|
|
359
421
|
## [0.2.5] - 2026-03-11
|
|
360
422
|
### Branding
|
|
@@ -372,7 +434,7 @@ date format is [yyyy-mm-dd]
|
|
|
372
434
|
- **Aggregate Queries guide**: Added dedicated [aggregate documentation page](https://uql-orm.dev/querying/aggregate) covering `$group`, `$having`, `$where` vs `$having`, sorting/pagination, and `$distinct`.
|
|
373
435
|
- **README**: Added Aggregate Queries to features table, new §4 subsection with code examples and generated SQL, and "Learn more" link.
|
|
374
436
|
- **Querier methods table**: Added `aggregate()` to the website's querier reference.
|
|
375
|
-
- **Simplified tsconfig**: Removed `module`/`target` from recommended config
|
|
437
|
+
- **Simplified tsconfig**: Removed `module`/`target` from recommended config - only decorator flags are UQL-specific. Added Pure ESM note.
|
|
376
438
|
|
|
377
439
|
## [0.2.2] - 2026-03-09
|
|
378
440
|
### New Features
|
|
@@ -384,8 +446,8 @@ date format is [yyyy-mm-dd]
|
|
|
384
446
|
$sort: { total: -1 },
|
|
385
447
|
});
|
|
386
448
|
```
|
|
387
|
-
- **SQL**: Generates `SELECT
|
|
388
|
-
- **MongoDB**: Generates a full aggregation pipeline (`$match
|
|
449
|
+
- **SQL**: Generates `SELECT ... GROUP BY ... HAVING ... ORDER BY` with proper escaping and parameterization.
|
|
450
|
+
- **MongoDB**: Generates a full aggregation pipeline (`$match -> $group -> $project -> $match -> $sort -> $skip -> $limit`).
|
|
389
451
|
- **`$distinct` support**: Added `$distinct` option to `Query<E>` for `SELECT DISTINCT` queries.
|
|
390
452
|
|
|
391
453
|
### Bug Fixes
|
|
@@ -401,8 +463,8 @@ date format is [yyyy-mm-dd]
|
|
|
401
463
|
- **`compareFieldOperator` compaction**: Reduced from 142 to 85 lines (−40%) by extracting `COMPARE_OP_MAP` (simple comparison operators), `LIKE_OP_MAP` (8 string/LIKE operators), and unifying `$in`/`$nin` into a single code path.
|
|
402
464
|
- **`saveRelation` split**: Decomposed the 61-line monolith into a dispatcher + 3 focused helpers by cardinality: `saveToMany` (1:M + M:M), `saveOneToOne` (1:1), `saveManyToOne` (M:1).
|
|
403
465
|
- **`buildAggregateStages` complexity reduction**: Extracted `buildHavingFilter()` helper from the MongoDB aggregation pipeline builder, bringing cognitive complexity under the linter threshold.
|
|
404
|
-
- **`deleteMany` DRY**: Eliminated duplicated `emitHook
|
|
405
|
-
- **`directionMap` deduplication**: Extracted the `asc/desc
|
|
466
|
+
- **`deleteMany` DRY**: Eliminated duplicated `emitHook -> internalDeleteMany -> deleteRelations` logic by reusing the `resolveEntityAndQuery()` pattern.
|
|
467
|
+
- **`directionMap` deduplication**: Extracted the `asc/desc -> 1/-1` mapping into a static `SORT_DIRECTION_MAP` constant shared by `sort()` and `aggregateSort()`.
|
|
406
468
|
- **`parseGroupMap` shared utility**: Eliminated `$group` parsing duplication between SQL and MongoDB dialects with a single generator function in `dialect.util.ts`.
|
|
407
469
|
- **`transformOperators` compaction**: Replaced verbose `if/else if` chains with a static `MONGO_COMPARISON_OP_MAP` lookup, and absorbed `$like`/`$ilike` into `REGEX_OP_MAP`.
|
|
408
470
|
- **`putChildrenInParents` simplification**: Simplified child-grouping loop using explicit initialization pattern.
|
|
@@ -446,14 +508,14 @@ date format is [yyyy-mm-dd]
|
|
|
446
508
|
- **Typed `raw()` Return**: `raw()` now returns `QueryRaw` instead of `any`, enabling IDE autocompletion and compile-time validation.
|
|
447
509
|
|
|
448
510
|
### Bug Fixes
|
|
449
|
-
- **Fixed `IsolationLevel` Typo**: Corrected `'repeteable read'`
|
|
511
|
+
- **Fixed `IsolationLevel` Typo**: Corrected `'repeteable read'` -> `'repeatable read'` in the `IsolationLevel` type.
|
|
450
512
|
|
|
451
513
|
### Security
|
|
452
514
|
- **`raw()` Safety Documentation**: Added JSDoc warning that `raw()` bypasses SQL parameterization, with guidance to use `$where` operators for user-supplied data.
|
|
453
515
|
|
|
454
516
|
## [0.1.4] - 2026-03-08
|
|
455
517
|
### Bug Fixes
|
|
456
|
-
- **Fixed Virtual Field Alias in Relations**: `getRawValue` was missing a dot separator in prefixed aliases and had a stale dot
|
|
518
|
+
- **Fixed Virtual Field Alias in Relations**: `getRawValue` was missing a dot separator in prefixed aliases and had a stale dot->underscore replacement from the old convention. Added tests to prevent regressions.
|
|
457
519
|
|
|
458
520
|
## [0.1.3] - 2026-03-08
|
|
459
521
|
### Code Quality
|
|
@@ -469,10 +531,10 @@ date format is [yyyy-mm-dd]
|
|
|
469
531
|
|
|
470
532
|
## [0.1.0] - 2026-03-08
|
|
471
533
|
### Package Rename
|
|
472
|
-
- **Renamed `@uql/core`
|
|
473
|
-
- **Version Reset to `0.1.0`**: Fresh start to reflect UQL's modern, fast-moving nature. All functionality from `@uql/core@3.15.0` is preserved
|
|
534
|
+
- **Renamed `@uql/core` -> `uql-orm`**: The package is now published as an unscoped name for better SEO, discoverability, and simpler install commands (`npm install uql-orm`).
|
|
535
|
+
- **Version Reset to `0.1.0`**: Fresh start to reflect UQL's modern, fast-moving nature. All functionality from `@uql/core@3.15.0` is preserved - this is a rename, not a rewrite.
|
|
474
536
|
- **New Homepage**: [uql-orm.dev](https://uql-orm.dev)
|
|
475
|
-
- **Migration**: Update your imports from `@uql/core`
|
|
537
|
+
- **Migration**: Update your imports from `@uql/core` -> `uql-orm` (e.g., `import { Entity } from 'uql-orm'`). Sub-path imports follow the same pattern (e.g., `uql-orm/postgres`, `uql-orm/migrate`).
|
|
476
538
|
|
|
477
539
|
## [3.15.0] - 2026-03-07
|
|
478
540
|
### New Features
|
|
@@ -503,7 +565,7 @@ date format is [yyyy-mm-dd]
|
|
|
503
565
|
|
|
504
566
|
### Architecture
|
|
505
567
|
- **Renamed Internal Methods**: `insertMany`/`updateMany` in `AbstractSqlQuerier` and `MongodbQuerier` are now `internalInsertMany`/`internalUpdateMany` (protected). Public `insertMany`/`updateMany` in `AbstractQuerier` wrap them with hook emission.
|
|
506
|
-
- **New Utility**: `runHooks()` in `util/hook.util.ts`
|
|
568
|
+
- **New Utility**: `runHooks()` in `util/hook.util.ts` - lightweight hook invocation engine using `entity.prototype[method].call(payload, ctx)`.
|
|
507
569
|
- **Hook Inheritance**: Entity hooks are inherited from parent classes (parent hooks execute first).
|
|
508
570
|
|
|
509
571
|
### Test Coverage
|
|
@@ -512,7 +574,7 @@ date format is [yyyy-mm-dd]
|
|
|
512
574
|
## [3.14.0] - 2026-03-07
|
|
513
575
|
### Type Safety
|
|
514
576
|
- **Map-Only `$select`**: `$select` now only accepts the map form (e.g., `{ id: true, name: true }`), removing the less type-safe array form. Relation selections are now additive in map form.
|
|
515
|
-
- **Stricter `$and`/`$or`/`$not`/`$nor`**: Logical operators now only accept `QueryWhereMap | QueryRaw` elements
|
|
577
|
+
- **Stricter `$and`/`$or`/`$not`/`$nor`**: Logical operators now only accept `QueryWhereMap | QueryRaw` elements - bare ID values (e.g., `$or: [5]`) must use the explicit form `$or: [{ id: 5 }]`. This restores TypeScript's excess property checking inside logical clauses.
|
|
516
578
|
- **Wider JSON Array Operators**: `$elemMatch` and `$all` now accept JSON fields without requiring `as any` casts, thanks to widened fallback types for non-array field types. Removed 6 unnecessary `as any` casts from tests.
|
|
517
579
|
|
|
518
580
|
### Refactoring
|
|
@@ -525,7 +587,7 @@ date format is [yyyy-mm-dd]
|
|
|
525
587
|
- **Semantic `RawRow` Type**: Introduced `RawRow` as a reusable semantic alias for raw database result rows, replacing scattered `Record<string, unknown>` and `any` across queriers, introspection, and SQL utilities.
|
|
526
588
|
- **Typed MySQL Driver**: Replaced `any` in MySQL2 querier with proper `ResultSetHeader` type from the driver.
|
|
527
589
|
- **Smarter `$select` Validation**: Field and relation selections are now validated simultaneously, catching invalid property names at compile time.
|
|
528
|
-
- **Stricter Null Comparisons**: `null` is now only accepted in `$eq` and `$ne` operators
|
|
590
|
+
- **Stricter Null Comparisons**: `null` is now only accepted in `$eq` and `$ne` operators - invalid comparisons like `$gt: null` are caught at compile time.
|
|
529
591
|
- **Typed `defaultValue`**: Entity field defaults are now type-checked instead of accepting `any`.
|
|
530
592
|
|
|
531
593
|
### API Surface & DX
|
|
@@ -538,7 +600,7 @@ date format is [yyyy-mm-dd]
|
|
|
538
600
|
- **DRY `compareJsonPath`**: Simplified from 6 parameters to 3, removing redundant internal calls.
|
|
539
601
|
- **DRY `extractInsertResult`**: Shared utility for INSERT result ID extraction across all RETURNING-based drivers (pg, neon, maria), eliminating duplicated logic.
|
|
540
602
|
- **Eliminated Type Casts**: Replaced `Record<string, unknown>` casts with proper type guards across the dialect layer.
|
|
541
|
-
- **Typo Fix**: Renamed `buldQueryWhereAsMap`
|
|
603
|
+
- **Typo Fix**: Renamed `buldQueryWhereAsMap` -> `buildQueryWhereAsMap`.
|
|
542
604
|
|
|
543
605
|
## [3.13.0] - 2026-03-07
|
|
544
606
|
### New Features
|
|
@@ -591,8 +653,8 @@ date format is [yyyy-mm-dd]
|
|
|
591
653
|
- **raw() String Prefix Fix**: String-based `raw()` values in `$and`/`$or` are no longer incorrectly table-prefixed (e.g., `raw("kind IS NOT NULL")` previously produced `resource.kind IS NOT NULL` instead of `kind IS NOT NULL`).
|
|
592
654
|
|
|
593
655
|
### Improvements & Refactoring
|
|
594
|
-
- **DRY JSON Config**: Extracted `getBaseJsonConfig()` in each dialect
|
|
595
|
-
- **Extracted `normalizeWhereValue()`**: Deduplicated the `Array
|
|
656
|
+
- **DRY JSON Config**: Extracted `getBaseJsonConfig()` in each dialect - `$elemMatch` and dot-notation now compose from a single config source, eliminating ~20 lines of duplication.
|
|
657
|
+
- **Extracted `normalizeWhereValue()`**: Deduplicated the `Array->$in / object->passthrough / scalar->$eq` normalization used by both regular field and JSON path comparisons.
|
|
596
658
|
- **Cleaner Dot-Notation Detection**: Uses `indexOf`+`slice` instead of two `split('.')` calls for efficient dot-path parsing.
|
|
597
659
|
- **Relation Safety Guard**: `compareRelation()` now throws a descriptive `TypeError` if `rel.references` is missing, instead of a cryptic undefined crash.
|
|
598
660
|
- **TypeScript 6 Compatibility**: Fixed `QueryWhereMap` circular type reference and expanded `QueryWhereOptions.clause` union.
|
|
@@ -607,7 +669,7 @@ date format is [yyyy-mm-dd]
|
|
|
607
669
|
|
|
608
670
|
## [3.11.0] - 2026-02-21
|
|
609
671
|
### New Features
|
|
610
|
-
- **Scoped Querier**: Added `pool.withQuerier(callback)`
|
|
672
|
+
- **Scoped Querier**: Added `pool.withQuerier(callback)` - the non-transactional counterpart to `pool.transaction()`. Acquires a querier, runs the callback, and guarantees release via `try/finally`. Useful for scoping connection lifetime without transaction overhead.
|
|
611
673
|
|
|
612
674
|
```ts
|
|
613
675
|
const users = await pool.withQuerier(async (querier) => {
|
|
@@ -627,10 +689,10 @@ date format is [yyyy-mm-dd]
|
|
|
627
689
|
- **Branch coverage improved from ~88% to 90%** with targeted tests across `schemaAST`, `entityMerger`, `driftDetector`, `canonicalType`, and `tableBuilder`.
|
|
628
690
|
|
|
629
691
|
### Dependencies
|
|
630
|
-
- `@biomejs/biome` 2.3.15
|
|
631
|
-
- `rimraf` 6.1.2
|
|
632
|
-
- `mariadb` 3.4.5
|
|
633
|
-
- `mysql2` 3.17.1
|
|
692
|
+
- `@biomejs/biome` 2.3.15 -> 2.4.2
|
|
693
|
+
- `rimraf` 6.1.2 -> 6.1.3
|
|
694
|
+
- `mariadb` 3.4.5 -> 3.5.1
|
|
695
|
+
- `mysql2` 3.17.1 -> 3.17.2
|
|
634
696
|
|
|
635
697
|
## [3.9.2] - 2026-02-13
|
|
636
698
|
### Improvements & Refactoring
|
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ Full docs: **[uql-orm.dev](https://uql-orm.dev)**
|
|
|
38
38
|
| Type-safe queries with autocomplete | [Querying](https://uql-orm.dev/querying/querier) |
|
|
39
39
|
| Entity-first migrations & autoSync | [Migrations](https://uql-orm.dev/migrations) |
|
|
40
40
|
| Soft-delete, lifecycle hooks, relations | [Entities](https://uql-orm.dev/entities/basic) |
|
|
41
|
+
| Query filters, multi-tenancy & row-level security | [Filters](https://uql-orm.dev/querying/filters) · [Multi-tenancy](https://uql-orm.dev/multi-tenancy) |
|
|
41
42
|
| Aggregate queries, grouping, HAVING | [Aggregate](https://uql-orm.dev/querying/aggregate) |
|
|
42
43
|
| Semantic search & vector similarity | [Semantic Search](https://uql-orm.dev/ai-semantic-search) |
|
|
43
44
|
| Streaming, transactions, raw SQL | [Querying](https://uql-orm.dev/querying/querier) |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/browser/http/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAGnC,QAAQ,CAAC,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/browser/http/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAGnC,QAAQ,CAAC,MAAM,EAAE,MAAM;IAFzB,YACE,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,MAAM,EAIxB;CACF;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,sCAExD;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,cAAc,sCAG3E;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,cAAc,sCAG5E;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,cAAc,sCAG1E;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,sCAE3D;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,cAAc,sCAG5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/browser/http/http.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAG1B;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/browser/http/http.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,U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AAM;SAC/C,CAAC;QACF,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,MAAM,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC,CAAC,CACH;SACA,OAAO,CAAC,GAAG,EAAE;QACZ,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpQuerier.d.ts","sourceRoot":"","sources":["../../../src/browser/querier/httpQuerier.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,UAAU,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAE/G,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE1F,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC;CAC5D,CAAC;AAEF,qBAAa,WAAY,YAAW,aAAa;IAE7C,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"httpQuerier.d.ts","sourceRoot":"","sources":["../../../src/browser/querier/httpQuerier.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAA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AE,IAAI,CAAC,EAAE,cAAc,iDAG/D;IAED,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,YAAY,GAAG,cAAmB,2CAIzF;IAED,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,YAAY,GAAG,cAAmB,2CAIzF;IAED,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,UAE7B;IAED,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,CAAC,EAAE,cAAc,sCAK5F;IAED,SAAS,CAAC,YAAY,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAKxE;CACF"}
|
|
@@ -56,12 +56,12 @@ export class HttpQuerier {
|
|
|
56
56
|
}
|
|
57
57
|
deleteOneById(entity, id, opts = {}) {
|
|
58
58
|
const basePath = this.getBasePath(entity);
|
|
59
|
-
const qs = opts.
|
|
59
|
+
const qs = opts.hardDelete ? stringifyQuery({ hardDelete: opts.hardDelete }) : '';
|
|
60
60
|
return remove(`${basePath}/${id}${qs}`, this.buildOptions(opts));
|
|
61
61
|
}
|
|
62
62
|
deleteMany(entity, q, opts = {}) {
|
|
63
63
|
const basePath = this.getBasePath(entity);
|
|
64
|
-
const qs = stringifyQuery(opts.
|
|
64
|
+
const qs = stringifyQuery(opts.hardDelete ? { ...q, hardDelete: opts.hardDelete } : q);
|
|
65
65
|
return remove(`${basePath}${qs}`, this.buildOptions(opts));
|
|
66
66
|
}
|
|
67
67
|
getBasePath(entity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpQuerier.js","sourceRoot":"","sources":["../../../src/browser/querier/httpQuerier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAgD,MAAM,wBAAwB,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAiBrF,MAAM,OAAO,WAAW;IAEX;
|
|
1
|
+
{"version":3,"file":"httpQuerier.js","sourceRoot":"","sources":["../../../src/browser/querier/httpQuerier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAgD,MAAM,wBAAwB,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAiBrF,MAAM,OAAO,WAAW;IAEX,QAAQ;IACR,QAAQ;IAFnB,YACW,QAAgB,EAChB,QAAQ,GAAwB,EAAE;wBADlC,QAAQ;wBACR,QAAQ;IAChB,CAAC;IAEJ,WAAW,CACT,MAAe,EACf,EAAc,EACd,CAAe,EACf,IAAqB;QAErB,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO,GAAG,CAAgB,GAAG,QAAQ,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO,CAAI,MAAe,EAAE,CAAc,EAAE,IAAqB;QAC/D,OAAO,IAAI,CAAC,IAAI,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AAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACxE,CAAC;IAES,YAAY,CAA2B,IAAQ;QACvD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,EAAE,GAAI,IAAU,EAAE,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;IACrF,CAAC;CACF"}
|
|
@@ -2,11 +2,11 @@ import type { RequestSuccessResponse } from '../../http/contract.js';
|
|
|
2
2
|
import type { IdValue, Query, QueryOne, QueryOptions, QuerySearch, Type, UpdatePayload } from '../../type/index.js';
|
|
3
3
|
import type { RequestOptions } from './request.js';
|
|
4
4
|
/**
|
|
5
|
-
* Client-side querier
|
|
5
|
+
* Client-side querier - mirrors {@link UniversalQuerier} method names and semantics but with two structural differences:
|
|
6
6
|
* 1. Every return type is wrapped in `RequestSuccessResponse<T>` (adds `data`/`count` envelope).
|
|
7
7
|
* 2. Every method accepts an extra `opts?: RequestOptions` parameter.
|
|
8
8
|
*
|
|
9
|
-
* These differences prevent clean `extends UniversalQuerier`
|
|
9
|
+
* These differences prevent clean `extends UniversalQuerier` - TypeScript does not support
|
|
10
10
|
* higher-kinded type wrappers, so the interfaces are kept in sync by convention.
|
|
11
11
|
* @see UniversalQuerier for the server-side contract with direct return types.
|
|
12
12
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var G=[];function Z(f){for(let F of G)F(f)}function g(f){G.push(f);let F=G.length-1;return()=>{G.splice(F,1)}}class J extends Error{status;constructor(f,F){super(f);this.status=F;this.name="RequestError"}}function A(f,F){return V(f,{method:"get"},F)}function H(f,F,x){let K=JSON.stringify(F);return V(f,{method:"post",body:K},x)}function T(f,F,x){let K=JSON.stringify(F);return V(f,{method:"patch",body:K},x)}function z(f,F,x){let K=JSON.stringify(F);return V(f,{method:"put",body:K},x)}function M(f,F){return V(f,{method:"delete"},F)}function j(f,F,x){let K=JSON.stringify(F);return V(f,{method:"QUERY",body:K},x)}function V(f,F,x){if(Z({phase:"start",opts:x}),F.headers={accept:"application/json","content-type":"application/json",...x?.headers},x?.signal)F.signal=x.signal;return fetch(f,F).then((K)=>K.json().then((Q)=>{if(K.status>=200&&K.status<300)return Z({phase:"success",opts:x}),Q;let c=Q,W={message:c?.error?.message??K.statusText,code:c?.error?.code??K.status};throw Z({phase:"error",error:W,opts:x}),new J(W.message,W.code)})).finally(()=>{Z({phase:"complete",opts:x})})}function I(f){return f?Object.keys(f):[]}function k(f){let F=f.charAt(0).toLowerCase();for(let x=1;x<f.length;++x)F+=f[x]===f[x].toUpperCase()?"-"+f[x].toLowerCase():f[x];return F}var B={findMany:{method:"GET",path:""},findOne:{method:"GET",path:"/one"},count:{method:"GET",path:"/count"},findOneById:{method:"GET",path:"/:id"},insertOne:{method:"POST",path:""},insertMany:{method:"POST",path:"/many"},saveOne:{method:"PUT",path:""},saveMany:{method:"PUT",path:"/many"},updateMany:{method:"PATCH",path:""},updateOneById:{method:"PATCH",path:"/:id"},deleteOneById:{method:"DELETE",path:"/:id"},deleteMany:{method:"DELETE",path:""}},Y=I(B),h=new Map(Y.filter((f)=>B[f].method==="GET"&&B[f].path!=="/:id").map((f)=>[B[f].path,f]));function L(f){return k(f.name)}var P=["$select","$populate","$exclude","$where","$sort"],i=new Set([...P,"$skip","$limit","hardDelete","count"]);function X(f){if(!f)return"";let F=new URLSearchParams;for(let K of I(f)){let Q=f[K];if(Q===void 0)continue;F.append(K,typeof Q==="object"&&Q!==null?JSON.stringify(Q):String(Q))}let x=F.toString();return x?`?${x}`:""}class N{basePath;defaults;constructor(f,F={}){this.basePath=f;this.defaults=F}findOneById(f,F,x,K){let Q=this.getBasePath(f),$=X(x);return A(`${Q}/${F}${$}`,this.buildOptions(K))}findOne(f,F,x){return this.read(`${this.getBasePath(f)}${B.findOne.path}`,F,x)}findMany(f,F,x){let K={...F};if(x?.count)K.count=!0;return this.read(this.getBasePath(f),K,x)}findManyAndCount(f,F,x){return this.findMany(f,F,{...x,count:!0})}count(f,F,x){return this.read(`${this.getBasePath(f)}${B.count.path}`,F,x)}insertOne(f,F,x){let K=this.getBasePath(f);return H(K,F,this.buildOptions(x))}insertMany(f,F,x){let K=this.getBasePath(f);return H(`${K}${B.insertMany.path}`,F,this.buildOptions(x))}updateOneById(f,F,x,K){let Q=this.getBasePath(f);return T(`${Q}/${F}`,x,this.buildOptions(K))}updateMany(f,F,x,K){let Q=this.getBasePath(f),$=X(F);return T(`${Q}${$}`,x,this.buildOptions(K))}saveOne(f,F,x){let K=this.getBasePath(f);return z(K,F,this.buildOptions(x))}saveMany(f,F,x){let K=this.getBasePath(f);return z(`${K}${B.saveMany.path}`,F,this.buildOptions(x))}deleteOneById(f,F,x={}){let K=this.getBasePath(f),Q=x.hardDelete?X({hardDelete:x.hardDelete}):"";return M(`${K}/${F}${Q}`,this.buildOptions(x))}deleteMany(f,F,x={}){let K=this.getBasePath(f),Q=X(x.hardDelete?{...F,hardDelete:x.hardDelete}:F);return M(`${K}${Q}`,this.buildOptions(x))}getBasePath(f){return`${this.basePath}/${L(f)}`}read(f,F,x){if(this.defaults.readMethod==="QUERY")return j(f,F??{},this.buildOptions(x));return A(`${f}${X(F)}`,this.buildOptions(x))}buildOptions(f){if(!this.defaults.headers&&!f?.headers)return f;return{...f,headers:{...this.defaults.headers,...f?.headers}}}}var C={getQuerier:()=>new N("/api")};function p(f){C=f}function D(){return C}function s(){return D().getQuerier()}export{p as setQuerierPool,M as remove,j as query,z as put,H as post,T as patch,g as on,Z as notify,D as getQuerierPool,s as getQuerier,A as get,J as RequestError,N as HttpQuerier};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=68C91E4CC01154B364756E2164756E21
|
|
4
4
|
//# sourceMappingURL=uql-browser.min.js.map
|