uql-orm 0.12.0 → 0.14.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.
- package/CHANGELOG.md +133 -48
- 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 +9 -0
- package/dist/context/context.browser.d.ts.map +1 -0
- package/dist/context/context.browser.js +33 -0
- package/dist/context/context.browser.js.map +1 -0
- package/dist/context/context.d.ts +29 -0
- package/dist/context/context.d.ts.map +1 -0
- package/dist/context/context.js +38 -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 +23 -23
- 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 +40 -7
- 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 -19
- 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 +28 -28
- 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 +3 -3
- package/dist/querier/abstractQuerierPool.d.ts.map +1 -1
- package/dist/querier/abstractQuerierPool.js +5 -3
- 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 +10 -6
- 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 +14 -3
- package/dist/type/querierPool.d.ts.map +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 +25 -4
- package/dist/util/dialect.util.d.ts.map +1 -1
- package/dist/util/dialect.util.js +76 -1
- 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,18 +4,103 @@ 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.1] - 2026-07-09
|
|
8
|
+
|
|
9
|
+
Context ergonomics for event-driven apps (background pipelines, queue consumers, webhooks) - shaped by adopting the multi-tenancy filters in a real multimedia app.
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- **`captureContext()`** - carry the ambient context across event boundaries. `AsyncLocalStorage` does not propagate into emitter callbacks, timers, or queued work, so capture it once and replay it where the callback fires:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const scoped = captureContext(); // e.g. when a session/queue item is created inside a scoped request
|
|
17
|
+
emitter.on('chunk', (chunk) => scoped(() => saveChunk(chunk))); // runs with the captured context
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- **Context per unit of work** - `pool.withQuerier(callback, { context })` and `pool.transaction(callback, { context })` run one unit of work under the given context. Same mechanism as `withContext`, picked by scope: `withContext` scopes a span (a request, a whole job); `{ context }` scopes a single pool call - flat and explicit for pipeline code that knows its tenant locally:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
await pool.withQuerier((q) => q.findMany(Invoice, {}), { context: { tenantId } });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- **Trusted cross-tenant work with security filters** - a filter condition may now return `{}` to mean "resolved: no restriction", so maintenance jobs that must span all tenants (startup recovery, cleanup sweeps) can run under an explicit system context. A missing context still fails closed, and previously a `{}` condition generated broken SQL:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
condition: (ctx) => (ctx?.system ? {} : ctx?.tenantId != null ? { companyId: ctx.tenantId } : undefined),
|
|
30
|
+
|
|
31
|
+
await withContext({ system: true }, () => recoverStaleJobs()); // spans every tenant, deliberately
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- **Auto-fill the tenant column on insert** (documented pattern, works out of the box): `@Field({ onInsert: () => getContext()?.tenantId })` fills the field from the ambient context when the payload does not provide it - explicit values still win.
|
|
35
|
+
|
|
36
|
+
## [0.14.0] - 2026-07-08
|
|
37
|
+
|
|
38
|
+
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.
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
- **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:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
@Filter('active', { condition: { status: 'active' }, default: false })
|
|
46
|
+
@Entity()
|
|
47
|
+
class Task {}
|
|
48
|
+
|
|
49
|
+
querier.findMany(Task, {}, { filters: { active: true } }); // on for this call
|
|
50
|
+
querier.findMany(Task, {}, { filters: false }); // all filters off
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- **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`:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
@Filter('tenant', {
|
|
57
|
+
// no tenant in context -> the query throws instead of running unscoped
|
|
58
|
+
condition: (ctx) => (ctx?.tenantId != null ? { companyId: ctx.tenantId } : undefined),
|
|
59
|
+
security: true,
|
|
60
|
+
})
|
|
61
|
+
@Entity()
|
|
62
|
+
class Invoice {}
|
|
63
|
+
|
|
64
|
+
await withContext({ tenantId }, () => querier.findMany(Invoice, {}));
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Set the context once at the HTTP boundary and every request is scoped automatically:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
createRequestHandler({ getContext: (req) => ({ tenantId: req.user.tenantId }) });
|
|
71
|
+
// NestJS: UqlModule.forRoot({ pool, getContext: (req) => ({ tenantId: req.user.tenantId }) })
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- **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.
|
|
75
|
+
|
|
76
|
+
- **NestJS `forRootAsync`** - build the pool from injected providers such as `ConfigService`.
|
|
77
|
+
|
|
78
|
+
### Breaking Changes
|
|
79
|
+
|
|
80
|
+
- **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`):
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
await querier.deleteOneById(User, id); // soft delete
|
|
84
|
+
await querier.deleteOneById(User, id, { hardDelete: true }); // permanent
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Bug Fixes
|
|
88
|
+
|
|
89
|
+
- Soft-delete now works on **subclasses** that inherit the soft-delete field from a base entity.
|
|
90
|
+
- A cascading delete no longer throws when a related entity isn't soft-deletable - it's removed instead; MongoDB delete behavior now matches SQL.
|
|
91
|
+
|
|
7
92
|
## [0.12.0] - 2026-07-06
|
|
8
93
|
|
|
9
94
|
### Breaking Changes
|
|
10
95
|
|
|
11
|
-
- **`softDelete` moves from `@Entity` to `@Field`.** Mark the field itself
|
|
96
|
+
- **`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.
|
|
12
97
|
|
|
13
98
|
## [0.11.0] - 2026-07-06
|
|
14
99
|
|
|
15
100
|
### Breaking Changes
|
|
16
101
|
|
|
17
|
-
- **`softDelete` is configured by field name instead of `boolean`**: use `@Entity({ softDelete: 'deletedAt' })`
|
|
18
|
-
- **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)
|
|
102
|
+
- **`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()`.
|
|
103
|
+
- **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.
|
|
19
104
|
|
|
20
105
|
### Features
|
|
21
106
|
|
|
@@ -26,7 +111,7 @@ date format is [yyyy-mm-dd]
|
|
|
26
111
|
### Bug Fixes
|
|
27
112
|
|
|
28
113
|
- **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.
|
|
29
|
-
- **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`
|
|
114
|
+
- **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.
|
|
30
115
|
|
|
31
116
|
## [0.10.1] - 2026-07-03
|
|
32
117
|
|
|
@@ -36,7 +121,7 @@ date format is [yyyy-mm-dd]
|
|
|
36
121
|
|
|
37
122
|
### Bug Fixes
|
|
38
123
|
|
|
39
|
-
- **`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
|
|
124
|
+
- **`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.
|
|
40
125
|
|
|
41
126
|
## [0.10.0] - 2026-07-02
|
|
42
127
|
|
|
@@ -76,7 +161,7 @@ date format is [yyyy-mm-dd]
|
|
|
76
161
|
### Bug Fixes
|
|
77
162
|
|
|
78
163
|
- **`$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.
|
|
79
|
-
- **`$select` / `$exclude` overlap resolved**: Both are now structurally identical map types (`{ [K in FieldKey<E>]?: BooleanLike }`)
|
|
164
|
+
- **`$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.
|
|
80
165
|
- **`$exclude` JSDoc**: Updated comment from "array of field names" to map syntax `{ name: true }`.
|
|
81
166
|
|
|
82
167
|
### Security
|
|
@@ -103,7 +188,7 @@ date format is [yyyy-mm-dd]
|
|
|
103
188
|
### Dependencies
|
|
104
189
|
|
|
105
190
|
- Updated dev and prod dependencies.
|
|
106
|
-
- Docker images bumped: MySQL `9.6`
|
|
191
|
+
- Docker images bumped: MySQL `9.6` -> `9.7`, MariaDB `12.3-rc` -> `12.3` (now stable).
|
|
107
192
|
|
|
108
193
|
## [0.8.5] - 2026-05-24
|
|
109
194
|
|
|
@@ -147,13 +232,13 @@ date format is [yyyy-mm-dd]
|
|
|
147
232
|
|
|
148
233
|
### Bug Fixes
|
|
149
234
|
|
|
150
|
-
- **[#86](https://github.com/rogerpadilla/uql/issues/86)
|
|
235
|
+
- **[#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.
|
|
151
236
|
|
|
152
|
-
- **[#87](https://github.com/rogerpadilla/uql/issues/87)
|
|
237
|
+
- **[#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.
|
|
153
238
|
|
|
154
239
|
### Breaking Changes
|
|
155
240
|
|
|
156
|
-
- **`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[]`**
|
|
241
|
+
- **`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.
|
|
157
242
|
|
|
158
243
|
## [0.8.0] - 2026-04-03
|
|
159
244
|
|
|
@@ -163,7 +248,7 @@ date format is [yyyy-mm-dd]
|
|
|
163
248
|
|
|
164
249
|
### Breaking Changes (Internal API)
|
|
165
250
|
|
|
166
|
-
- **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**
|
|
251
|
+
- **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.
|
|
167
252
|
|
|
168
253
|
## [0.7.10] - 2026-04-02
|
|
169
254
|
|
|
@@ -184,13 +269,13 @@ date format is [yyyy-mm-dd]
|
|
|
184
269
|
## [0.7.7] - 2026-03-31
|
|
185
270
|
|
|
186
271
|
### Breaking Changes (Internal API)
|
|
187
|
-
- **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
|
|
272
|
+
- **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.
|
|
188
273
|
- **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.
|
|
189
274
|
|
|
190
275
|
### Improvements
|
|
191
276
|
|
|
192
277
|
- **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.
|
|
193
|
-
- **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
|
|
278
|
+
- **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.
|
|
194
279
|
- **Migrations CLI**: Exported **`assertCliConfig`** (`uql-orm/migrate`) validates the default-exported config shape before commands run.
|
|
195
280
|
- **Escaping**: Inlined **`escapeAnsiSqlLiteral`** for Postgres/SQLite literal escaping; dropped **`sqlstring-sqlite`** from those code paths. Prefer bound parameters for user input in production.
|
|
196
281
|
- **Types and tests**: `Config.pool` is typed as `QuerierPool<Querier, AbstractDialect>`. **`createMockQuerierPool`** is available from `uql-orm/test`.
|
|
@@ -238,7 +323,7 @@ date format is [yyyy-mm-dd]
|
|
|
238
323
|
- **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.
|
|
239
324
|
|
|
240
325
|
### Breaking Changes
|
|
241
|
-
- **`$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
|
|
326
|
+
- **`$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.
|
|
242
327
|
|
|
243
328
|
### Security
|
|
244
329
|
- **SQL Injection Prevention for JSON**: Hardened JSON-path operators across all SQL dialects with strict identifier and key escaping.
|
|
@@ -277,14 +362,14 @@ date format is [yyyy-mm-dd]
|
|
|
277
362
|
- **CockroachDB Support**: Added first-class support for `cockroachdb` dialect, leveraging its PostgreSQL wire-compatibility. Includes native `upsert` support and seamlessly mapped driver execution.
|
|
278
363
|
|
|
279
364
|
### Testing
|
|
280
|
-
- **Vector search integration tests**: Added 7 end-to-end tests for `findMany` with `$sort: { $vector }` against a real Postgres+pgvector database
|
|
365
|
+
- **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.
|
|
281
366
|
- Docker Postgres image switched to `pgvector/pgvector:pg18` for pgvector extension support.
|
|
282
367
|
- Test DDL generator now handles `vector`, `halfvec`, and `sparsevec` column types.
|
|
283
368
|
|
|
284
369
|
## [0.4.4] - 2026-03-14
|
|
285
370
|
### Dependencies
|
|
286
|
-
- **Vite 7
|
|
287
|
-
- **TypeScript 5.9
|
|
371
|
+
- **Vite 7 -> 8**: Upgraded to Vite 8 (powered by Rolldown), replacing the `vite-tsconfig-paths` plugin with Vite's built-in `resolve.tsconfigPaths` option.
|
|
372
|
+
- **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`.
|
|
288
373
|
- Removed `vite-tsconfig-paths` (replaced by built-in Vite 8 feature).
|
|
289
374
|
|
|
290
375
|
## [0.4.1] - 2026-03-13
|
|
@@ -293,7 +378,7 @@ date format is [yyyy-mm-dd]
|
|
|
293
378
|
|
|
294
379
|
## [0.4.0] - 2026-03-13
|
|
295
380
|
### New Features
|
|
296
|
-
- **`findManyStream()`
|
|
381
|
+
- **`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.
|
|
297
382
|
```ts
|
|
298
383
|
for await (const user of querier.findManyStream(User, { $where: { active: true } })) {
|
|
299
384
|
process.stdout.write(user.name + '\n');
|
|
@@ -301,11 +386,11 @@ date format is [yyyy-mm-dd]
|
|
|
301
386
|
```
|
|
302
387
|
Supports both the classic `(Entity, query)` and `$entity`-field dual-API patterns.
|
|
303
388
|
- **Native Streaming for All Major Drivers**: Each driver now uses its optimal streaming API instead of falling back to `internalAll()`:
|
|
304
|
-
- **SQLite** (`better-sqlite3`): `.iterate()`
|
|
305
|
-
- **MongoDB**: `FindCursor` async iterable
|
|
306
|
-
- **MariaDB**: `queryStream()`
|
|
307
|
-
- **PostgreSQL**: `pg-query-stream`
|
|
308
|
-
- **MySQL2**: `Connection.query().stream()`
|
|
389
|
+
- **SQLite** (`better-sqlite3`): `.iterate()` - sync, zero-copy row iteration.
|
|
390
|
+
- **MongoDB**: `FindCursor` async iterable - native driver cursor with `buildFindCursor` helper (extracted from `findMany` for DRY reuse).
|
|
391
|
+
- **MariaDB**: `queryStream()` - first-class streaming API since v3.0, with backpressure.
|
|
392
|
+
- **PostgreSQL**: `pg-query-stream` - server-side cursors via optional peer dependency.
|
|
393
|
+
- **MySQL2**: `Connection.query().stream()` - Readable stream from non-promise connection.
|
|
309
394
|
- **LibSQL / D1 / Neon**: Graceful fallback to `internalAll()` (HTTP-based, no streaming API).
|
|
310
395
|
|
|
311
396
|
### Breaking Changes
|
|
@@ -320,7 +405,7 @@ date format is [yyyy-mm-dd]
|
|
|
320
405
|
|
|
321
406
|
## [0.3.2] - 2026-03-12
|
|
322
407
|
### Improvements
|
|
323
|
-
- **Upsert `created` Flag**: added `created?: boolean` to `QueryUpdateResult`
|
|
408
|
+
- **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.
|
|
324
409
|
|
|
325
410
|
### Bug Fixes
|
|
326
411
|
- **MongoDB `upsertOne`**: Fixed `firstId` always being `undefined` on insert by switching from `returnDocument: 'before'` to `returnDocument: 'after'`.
|
|
@@ -330,7 +415,7 @@ date format is [yyyy-mm-dd]
|
|
|
330
415
|
|
|
331
416
|
## [0.3.1] - 2026-03-12
|
|
332
417
|
### New Features
|
|
333
|
-
- **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
|
|
418
|
+
- **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' })`.
|
|
334
419
|
|
|
335
420
|
## [0.3.0] - 2026-03-12
|
|
336
421
|
### New Features
|
|
@@ -352,7 +437,7 @@ date format is [yyyy-mm-dd]
|
|
|
352
437
|
|
|
353
438
|
## [0.2.7] - 2026-03-11
|
|
354
439
|
### New Features
|
|
355
|
-
- **More `$size` Comparison Operators**: `$size` now accepts comparison operator objects in addition to exact numbers
|
|
440
|
+
- **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`.
|
|
356
441
|
- **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`.
|
|
357
442
|
|
|
358
443
|
### Test Coverage
|
|
@@ -360,7 +445,7 @@ date format is [yyyy-mm-dd]
|
|
|
360
445
|
|
|
361
446
|
## [0.2.6] - 2026-03-11
|
|
362
447
|
### Documentation
|
|
363
|
-
- **README
|
|
448
|
+
- **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.
|
|
364
449
|
|
|
365
450
|
## [0.2.5] - 2026-03-11
|
|
366
451
|
### Branding
|
|
@@ -378,7 +463,7 @@ date format is [yyyy-mm-dd]
|
|
|
378
463
|
- **Aggregate Queries guide**: Added dedicated [aggregate documentation page](https://uql-orm.dev/querying/aggregate) covering `$group`, `$having`, `$where` vs `$having`, sorting/pagination, and `$distinct`.
|
|
379
464
|
- **README**: Added Aggregate Queries to features table, new §4 subsection with code examples and generated SQL, and "Learn more" link.
|
|
380
465
|
- **Querier methods table**: Added `aggregate()` to the website's querier reference.
|
|
381
|
-
- **Simplified tsconfig**: Removed `module`/`target` from recommended config
|
|
466
|
+
- **Simplified tsconfig**: Removed `module`/`target` from recommended config - only decorator flags are UQL-specific. Added Pure ESM note.
|
|
382
467
|
|
|
383
468
|
## [0.2.2] - 2026-03-09
|
|
384
469
|
### New Features
|
|
@@ -390,8 +475,8 @@ date format is [yyyy-mm-dd]
|
|
|
390
475
|
$sort: { total: -1 },
|
|
391
476
|
});
|
|
392
477
|
```
|
|
393
|
-
- **SQL**: Generates `SELECT
|
|
394
|
-
- **MongoDB**: Generates a full aggregation pipeline (`$match
|
|
478
|
+
- **SQL**: Generates `SELECT ... GROUP BY ... HAVING ... ORDER BY` with proper escaping and parameterization.
|
|
479
|
+
- **MongoDB**: Generates a full aggregation pipeline (`$match -> $group -> $project -> $match -> $sort -> $skip -> $limit`).
|
|
395
480
|
- **`$distinct` support**: Added `$distinct` option to `Query<E>` for `SELECT DISTINCT` queries.
|
|
396
481
|
|
|
397
482
|
### Bug Fixes
|
|
@@ -407,8 +492,8 @@ date format is [yyyy-mm-dd]
|
|
|
407
492
|
- **`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.
|
|
408
493
|
- **`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).
|
|
409
494
|
- **`buildAggregateStages` complexity reduction**: Extracted `buildHavingFilter()` helper from the MongoDB aggregation pipeline builder, bringing cognitive complexity under the linter threshold.
|
|
410
|
-
- **`deleteMany` DRY**: Eliminated duplicated `emitHook
|
|
411
|
-
- **`directionMap` deduplication**: Extracted the `asc/desc
|
|
495
|
+
- **`deleteMany` DRY**: Eliminated duplicated `emitHook -> internalDeleteMany -> deleteRelations` logic by reusing the `resolveEntityAndQuery()` pattern.
|
|
496
|
+
- **`directionMap` deduplication**: Extracted the `asc/desc -> 1/-1` mapping into a static `SORT_DIRECTION_MAP` constant shared by `sort()` and `aggregateSort()`.
|
|
412
497
|
- **`parseGroupMap` shared utility**: Eliminated `$group` parsing duplication between SQL and MongoDB dialects with a single generator function in `dialect.util.ts`.
|
|
413
498
|
- **`transformOperators` compaction**: Replaced verbose `if/else if` chains with a static `MONGO_COMPARISON_OP_MAP` lookup, and absorbed `$like`/`$ilike` into `REGEX_OP_MAP`.
|
|
414
499
|
- **`putChildrenInParents` simplification**: Simplified child-grouping loop using explicit initialization pattern.
|
|
@@ -452,14 +537,14 @@ date format is [yyyy-mm-dd]
|
|
|
452
537
|
- **Typed `raw()` Return**: `raw()` now returns `QueryRaw` instead of `any`, enabling IDE autocompletion and compile-time validation.
|
|
453
538
|
|
|
454
539
|
### Bug Fixes
|
|
455
|
-
- **Fixed `IsolationLevel` Typo**: Corrected `'repeteable read'`
|
|
540
|
+
- **Fixed `IsolationLevel` Typo**: Corrected `'repeteable read'` -> `'repeatable read'` in the `IsolationLevel` type.
|
|
456
541
|
|
|
457
542
|
### Security
|
|
458
543
|
- **`raw()` Safety Documentation**: Added JSDoc warning that `raw()` bypasses SQL parameterization, with guidance to use `$where` operators for user-supplied data.
|
|
459
544
|
|
|
460
545
|
## [0.1.4] - 2026-03-08
|
|
461
546
|
### Bug Fixes
|
|
462
|
-
- **Fixed Virtual Field Alias in Relations**: `getRawValue` was missing a dot separator in prefixed aliases and had a stale dot
|
|
547
|
+
- **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.
|
|
463
548
|
|
|
464
549
|
## [0.1.3] - 2026-03-08
|
|
465
550
|
### Code Quality
|
|
@@ -475,10 +560,10 @@ date format is [yyyy-mm-dd]
|
|
|
475
560
|
|
|
476
561
|
## [0.1.0] - 2026-03-08
|
|
477
562
|
### Package Rename
|
|
478
|
-
- **Renamed `@uql/core`
|
|
479
|
-
- **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
|
|
563
|
+
- **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`).
|
|
564
|
+
- **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.
|
|
480
565
|
- **New Homepage**: [uql-orm.dev](https://uql-orm.dev)
|
|
481
|
-
- **Migration**: Update your imports from `@uql/core`
|
|
566
|
+
- **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`).
|
|
482
567
|
|
|
483
568
|
## [3.15.0] - 2026-03-07
|
|
484
569
|
### New Features
|
|
@@ -509,7 +594,7 @@ date format is [yyyy-mm-dd]
|
|
|
509
594
|
|
|
510
595
|
### Architecture
|
|
511
596
|
- **Renamed Internal Methods**: `insertMany`/`updateMany` in `AbstractSqlQuerier` and `MongodbQuerier` are now `internalInsertMany`/`internalUpdateMany` (protected). Public `insertMany`/`updateMany` in `AbstractQuerier` wrap them with hook emission.
|
|
512
|
-
- **New Utility**: `runHooks()` in `util/hook.util.ts`
|
|
597
|
+
- **New Utility**: `runHooks()` in `util/hook.util.ts` - lightweight hook invocation engine using `entity.prototype[method].call(payload, ctx)`.
|
|
513
598
|
- **Hook Inheritance**: Entity hooks are inherited from parent classes (parent hooks execute first).
|
|
514
599
|
|
|
515
600
|
### Test Coverage
|
|
@@ -518,7 +603,7 @@ date format is [yyyy-mm-dd]
|
|
|
518
603
|
## [3.14.0] - 2026-03-07
|
|
519
604
|
### Type Safety
|
|
520
605
|
- **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.
|
|
521
|
-
- **Stricter `$and`/`$or`/`$not`/`$nor`**: Logical operators now only accept `QueryWhereMap | QueryRaw` elements
|
|
606
|
+
- **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.
|
|
522
607
|
- **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.
|
|
523
608
|
|
|
524
609
|
### Refactoring
|
|
@@ -531,7 +616,7 @@ date format is [yyyy-mm-dd]
|
|
|
531
616
|
- **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.
|
|
532
617
|
- **Typed MySQL Driver**: Replaced `any` in MySQL2 querier with proper `ResultSetHeader` type from the driver.
|
|
533
618
|
- **Smarter `$select` Validation**: Field and relation selections are now validated simultaneously, catching invalid property names at compile time.
|
|
534
|
-
- **Stricter Null Comparisons**: `null` is now only accepted in `$eq` and `$ne` operators
|
|
619
|
+
- **Stricter Null Comparisons**: `null` is now only accepted in `$eq` and `$ne` operators - invalid comparisons like `$gt: null` are caught at compile time.
|
|
535
620
|
- **Typed `defaultValue`**: Entity field defaults are now type-checked instead of accepting `any`.
|
|
536
621
|
|
|
537
622
|
### API Surface & DX
|
|
@@ -544,7 +629,7 @@ date format is [yyyy-mm-dd]
|
|
|
544
629
|
- **DRY `compareJsonPath`**: Simplified from 6 parameters to 3, removing redundant internal calls.
|
|
545
630
|
- **DRY `extractInsertResult`**: Shared utility for INSERT result ID extraction across all RETURNING-based drivers (pg, neon, maria), eliminating duplicated logic.
|
|
546
631
|
- **Eliminated Type Casts**: Replaced `Record<string, unknown>` casts with proper type guards across the dialect layer.
|
|
547
|
-
- **Typo Fix**: Renamed `buldQueryWhereAsMap`
|
|
632
|
+
- **Typo Fix**: Renamed `buldQueryWhereAsMap` -> `buildQueryWhereAsMap`.
|
|
548
633
|
|
|
549
634
|
## [3.13.0] - 2026-03-07
|
|
550
635
|
### New Features
|
|
@@ -597,8 +682,8 @@ date format is [yyyy-mm-dd]
|
|
|
597
682
|
- **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`).
|
|
598
683
|
|
|
599
684
|
### Improvements & Refactoring
|
|
600
|
-
- **DRY JSON Config**: Extracted `getBaseJsonConfig()` in each dialect
|
|
601
|
-
- **Extracted `normalizeWhereValue()`**: Deduplicated the `Array
|
|
685
|
+
- **DRY JSON Config**: Extracted `getBaseJsonConfig()` in each dialect - `$elemMatch` and dot-notation now compose from a single config source, eliminating ~20 lines of duplication.
|
|
686
|
+
- **Extracted `normalizeWhereValue()`**: Deduplicated the `Array->$in / object->passthrough / scalar->$eq` normalization used by both regular field and JSON path comparisons.
|
|
602
687
|
- **Cleaner Dot-Notation Detection**: Uses `indexOf`+`slice` instead of two `split('.')` calls for efficient dot-path parsing.
|
|
603
688
|
- **Relation Safety Guard**: `compareRelation()` now throws a descriptive `TypeError` if `rel.references` is missing, instead of a cryptic undefined crash.
|
|
604
689
|
- **TypeScript 6 Compatibility**: Fixed `QueryWhereMap` circular type reference and expanded `QueryWhereOptions.clause` union.
|
|
@@ -613,7 +698,7 @@ date format is [yyyy-mm-dd]
|
|
|
613
698
|
|
|
614
699
|
## [3.11.0] - 2026-02-21
|
|
615
700
|
### New Features
|
|
616
|
-
- **Scoped Querier**: Added `pool.withQuerier(callback)`
|
|
701
|
+
- **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.
|
|
617
702
|
|
|
618
703
|
```ts
|
|
619
704
|
const users = await pool.withQuerier(async (querier) => {
|
|
@@ -633,10 +718,10 @@ date format is [yyyy-mm-dd]
|
|
|
633
718
|
- **Branch coverage improved from ~88% to 90%** with targeted tests across `schemaAST`, `entityMerger`, `driftDetector`, `canonicalType`, and `tableBuilder`.
|
|
634
719
|
|
|
635
720
|
### Dependencies
|
|
636
|
-
- `@biomejs/biome` 2.3.15
|
|
637
|
-
- `rimraf` 6.1.2
|
|
638
|
-
- `mariadb` 3.4.5
|
|
639
|
-
- `mysql2` 3.17.1
|
|
721
|
+
- `@biomejs/biome` 2.3.15 -> 2.4.2
|
|
722
|
+
- `rimraf` 6.1.2 -> 6.1.3
|
|
723
|
+
- `mariadb` 3.4.5 -> 3.5.1
|
|
724
|
+
- `mysql2` 3.17.1 -> 3.17.2
|
|
640
725
|
|
|
641
726
|
## [3.9.2] - 2026-02-13
|
|
642
727
|
### 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;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E,cAAc,+CAG5D;IAED,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,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,I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EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,GAAG,CAAI,GAAG,IAAI,GAAG,cAAc,CAAC,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
|