@uql/core 3.6.0 → 3.7.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 +15 -1
- package/README.md +78 -85
- package/dist/browser/querier/httpQuerier.d.ts +1 -2
- package/dist/browser/querier/httpQuerier.d.ts.map +1 -1
- package/dist/browser/querier/httpQuerier.js +0 -4
- package/dist/browser/querier/httpQuerier.js.map +1 -1
- package/dist/browser/querier/index.d.ts +0 -1
- package/dist/browser/querier/index.d.ts.map +1 -1
- package/dist/browser/querier/index.js +0 -1
- package/dist/browser/querier/index.js.map +1 -1
- package/dist/browser/type/clientQuerier.d.ts +0 -2
- package/dist/browser/type/clientQuerier.d.ts.map +1 -1
- package/dist/browser/type/index.d.ts +0 -1
- package/dist/browser/type/index.d.ts.map +1 -1
- package/dist/browser/type/index.js +0 -1
- package/dist/browser/type/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/migrate/bin.d.ts +3 -1
- package/dist/migrate/bin.d.ts.map +1 -1
- package/dist/migrate/bin.js +4 -1
- package/dist/migrate/bin.js.map +1 -1
- package/dist/migrate/cli-config.d.ts +2 -10
- package/dist/migrate/cli-config.d.ts.map +1 -1
- package/dist/migrate/cli-config.js +26 -5
- package/dist/migrate/cli-config.js.map +1 -1
- package/dist/migrate/cli.d.ts.map +1 -1
- package/dist/migrate/cli.js +19 -8
- package/dist/migrate/cli.js.map +1 -1
- package/dist/migrate/index.d.ts +2 -1
- package/dist/migrate/index.d.ts.map +1 -1
- package/dist/migrate/index.js +1 -0
- package/dist/migrate/index.js.map +1 -1
- package/dist/migrate/migrator.d.ts +2 -2
- package/dist/migrate/migrator.d.ts.map +1 -1
- package/dist/migrate/migrator.js.map +1 -1
- package/dist/migrate/storage/databaseStorage.js +10 -10
- package/dist/migrate/storage/databaseStorage.js.map +1 -1
- package/dist/querier/abstractQuerier.d.ts +1 -2
- package/dist/querier/abstractQuerier.d.ts.map +1 -1
- package/dist/querier/abstractQuerier.js +0 -4
- package/dist/querier/abstractQuerier.js.map +1 -1
- package/dist/querier/abstractQuerierPool.d.ts +4 -0
- package/dist/querier/abstractQuerierPool.d.ts.map +1 -1
- package/dist/querier/abstractQuerierPool.js +7 -0
- package/dist/querier/abstractQuerierPool.js.map +1 -1
- package/dist/type/config.d.ts +13 -0
- package/dist/type/config.d.ts.map +1 -0
- package/dist/type/config.js +2 -0
- package/dist/type/config.js.map +1 -0
- package/dist/type/index.d.ts +1 -1
- package/dist/type/index.d.ts.map +1 -1
- package/dist/type/index.js +1 -1
- package/dist/type/index.js.map +1 -1
- package/dist/type/querier.d.ts +0 -2
- package/dist/type/querier.d.ts.map +1 -1
- package/dist/type/querier.js.map +1 -1
- package/dist/type/querierPool.d.ts +4 -0
- package/dist/type/querierPool.d.ts.map +1 -1
- package/dist/type/universalQuerier.d.ts +0 -7
- package/dist/type/universalQuerier.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/browser/querier/genericClientRepository.d.ts +0 -18
- package/dist/browser/querier/genericClientRepository.d.ts.map +0 -1
- package/dist/browser/querier/genericClientRepository.js +0 -39
- package/dist/browser/querier/genericClientRepository.js.map +0 -1
- package/dist/browser/type/clientRepository.d.ts +0 -14
- package/dist/browser/type/clientRepository.d.ts.map +0 -1
- package/dist/browser/type/clientRepository.js +0 -2
- package/dist/browser/type/clientRepository.js.map +0 -1
- package/dist/repository/genericRepository.d.ts +0 -21
- package/dist/repository/genericRepository.d.ts.map +0 -1
- package/dist/repository/genericRepository.js +0 -51
- package/dist/repository/genericRepository.js.map +0 -1
- package/dist/repository/index.d.ts +0 -2
- package/dist/repository/index.d.ts.map +0 -1
- package/dist/repository/index.js +0 -2
- package/dist/repository/index.js.map +0 -1
- package/dist/type/repository.d.ts +0 -113
- package/dist/type/repository.d.ts.map +0 -1
- package/dist/type/repository.js +0 -2
- package/dist/type/repository.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [3.
|
|
6
|
+
# [3.7.0](https://github.com/rogerpadilla/uql/compare/@uql/core@3.6.1...@uql/core@3.7.0) (2026-01-04)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @uql/core
|
|
9
9
|
|
|
@@ -17,6 +17,20 @@ All notable changes to this project will be documented in this file. Please add
|
|
|
17
17
|
|
|
18
18
|
date format is [yyyy-mm-dd]
|
|
19
19
|
|
|
20
|
+
## [3.7.0] - 2026-01-04
|
|
21
|
+
### Improvements
|
|
22
|
+
- **Repository Pattern Removal**: Removed the built-in Repository pattern implementation (`GenericRepository`, etc.) to simplify the framework architecture (KISS). Users should rely on the `Querier` interface or implement custom layers if needed.
|
|
23
|
+
- **Testing**: Added comprehensive tests for `HttpQuerier` and integration tests for the CLI entry point (`bin.ts`), achieving >99% code coverage.
|
|
24
|
+
|
|
25
|
+
## [3.6.1] - 2026-01-04
|
|
26
|
+
### New Features
|
|
27
|
+
- **CLI**: Added `--config` / `-c` flag to `uql-migrate` to load a custom configuration file.
|
|
28
|
+
- **CLI**: Improved error handling when loading configuration files (syntax errors are no longer swallowed).
|
|
29
|
+
|
|
30
|
+
## [3.6.0] - 2026-01-04
|
|
31
|
+
### New Features
|
|
32
|
+
- **CLI**: Added default logger, support to log slow-queries in a parameterized way, and ability to define custom loggers.
|
|
33
|
+
|
|
20
34
|
## [3.5.0] - 2026-01-03
|
|
21
35
|
### Refactor
|
|
22
36
|
- **Dialect-Aware String Defaults**: Optimized default column types for TypeScript `string` fields across all supported databases.
|
package/README.md
CHANGED
|
@@ -24,28 +24,28 @@ const users = await querier.findMany(User, {
|
|
|
24
24
|
|
|
25
25
|
## Why UQL?
|
|
26
26
|
|
|
27
|
-
| Feature
|
|
28
|
-
|
|
|
29
|
-
| **API**
|
|
30
|
-
| **Safety**
|
|
31
|
-
| **Syntax**
|
|
32
|
-
| **Efficiency** | **Sticky Connections**: Minimal overhead, human-readable SQL.
|
|
27
|
+
| Feature | **UQL** | Traditional ORMs |
|
|
28
|
+
| :------------------- | :------------------------------------------------------------------------ | :------------------------------------------------------ |
|
|
29
|
+
| **API** | **Unified & Intuitive**: Same syntax for SQL & NoSQL. | Fragmented: SQL and Mongo feel like different worlds. |
|
|
30
|
+
| **Safety** | **Deep Type-Safety**: Validates relations & operators at any depth. | Surface-level: Often loses types in complex joins. |
|
|
31
|
+
| **Syntax** | **Serializable JSON**: Pure data, perfect for APIs/Websockets. | Method-Chaining: Hard to transport over the wire. |
|
|
32
|
+
| **Efficiency** | **Sticky Connections**: Minimal overhead, human-readable SQL. | Heavy: Often generates "SQL Soup" that's hard to debug. |
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
## Features
|
|
37
37
|
|
|
38
|
-
| Feature
|
|
39
|
-
|
|
|
40
|
-
| **[Context-Aware Queries](https://uql.app/querying/relations)**
|
|
41
|
-
| **Serializable JSON**
|
|
42
|
-
| **Unified Dialects**
|
|
43
|
-
| **Naming Strategies**
|
|
44
|
-
| **Smart SQL Engine**
|
|
45
|
-
| **Thread-Safe by Design**
|
|
46
|
-
| **Declarative Transactions**
|
|
47
|
-
| **[Modern & Versatile](https://uql.app/entities/virtual-fields)** | **Pure ESM**, high-res timing, [Soft-delete](https://uql.app/entities/soft-delete), and **Vector/JSONB/JSON** support. |
|
|
48
|
-
| **Structured Logging**
|
|
38
|
+
| Feature | Description |
|
|
39
|
+
| :----------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
|
|
40
|
+
| **[Context-Aware Queries](https://uql.app/querying/relations)** | Deep type-safety for operators and [relations](https://uql.app/querying/relations) at any depth. |
|
|
41
|
+
| **Serializable JSON** | 100% valid JSON queries for easy transport over HTTP/Websockets. |
|
|
42
|
+
| **Unified Dialects** | Write once, run anywhere: PostgreSQL, MySQL, SQLite, MongoDB, and more. |
|
|
43
|
+
| **Naming Strategies** | Pluggable system to translate between TypeScript `camelCase` and database `snake_case`. |
|
|
44
|
+
| **Smart SQL Engine** | Optimized sub-queries, placeholders ($1, $2), and minimal SQL generation via `QueryContext`. |
|
|
45
|
+
| **Thread-Safe by Design** | Centralized task queue and `@Serialized()` decorator prevent race conditions. |
|
|
46
|
+
| **Declarative Transactions** | Standard `@Transactional()` and `@InjectQuerier()` decorators for NestJS/DI. |
|
|
47
|
+
| **[Modern & Versatile](https://uql.app/entities/virtual-fields)** | **Pure ESM**, high-res timing, [Soft-delete](https://uql.app/entities/soft-delete), and **Vector/JSONB/JSON** support. |
|
|
48
|
+
| **Structured Logging** | Professional-grade monitoring with slow-query detection and colored output. |
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
@@ -56,17 +56,20 @@ Install the core package and the driver for your database:
|
|
|
56
56
|
```sh
|
|
57
57
|
# Core
|
|
58
58
|
npm install @uql/core # or bun add / pnpm add
|
|
59
|
-
|
|
60
|
-
# Potential Drivers (choose only ONE!)
|
|
61
|
-
npm install pg # PostgreSQL / Neon / Cockroach / Yugabyte
|
|
62
|
-
npm install mysql2 # MySQL / TiDB / Aurora
|
|
63
|
-
npm install mariadb # MariaDB
|
|
64
|
-
npm install better-sqlite3 # SQLite
|
|
65
|
-
npm install @libsql/client # LibSQL / Turso
|
|
66
|
-
npm install mongodb # MongoDB
|
|
67
|
-
# Cloudflare D1 uses native bindings (no extra driver needed)
|
|
68
59
|
```
|
|
69
60
|
|
|
61
|
+
### Potential Drivers (choose according to your database)
|
|
62
|
+
|
|
63
|
+
| Database | Command |
|
|
64
|
+
| :--- | :--- |
|
|
65
|
+
| **PostgreSQL** (incl. Neon, Cockroach, Yugabyte) | `npm install pg` |
|
|
66
|
+
| **MySQL** (incl. TiDB, Aurora) | `npm install mysql2` |
|
|
67
|
+
| **MariaDB** | `npm install mariadb` |
|
|
68
|
+
| **SQLite** | `npm install better-sqlite3` |
|
|
69
|
+
| **LibSQL** (incl. Turso) | `npm install @libsql/client` |
|
|
70
|
+
| **MongoDB** | `npm install mongodb` |
|
|
71
|
+
| **Cloudflare D1** | _Native (no driver needed)_ |
|
|
72
|
+
|
|
70
73
|
### TypeScript Configuration
|
|
71
74
|
|
|
72
75
|
Ensure your `tsconfig.json` is configured to support decorators and metadata:
|
|
@@ -82,7 +85,7 @@ Ensure your `tsconfig.json` is configured to support decorators and metadata:
|
|
|
82
85
|
}
|
|
83
86
|
```
|
|
84
87
|
|
|
85
|
-
 
|
|
88
|
+
**Note:** `ES2020+` will work for `target` as well.
|
|
86
89
|
|
|
87
90
|
## 2. Define the Entities
|
|
88
91
|
|
|
@@ -90,12 +93,12 @@ Annotate your classes with decorators. UQL's engine uses this metadata for both
|
|
|
90
93
|
|
|
91
94
|
### Core Decorators
|
|
92
95
|
|
|
93
|
-
| Decorator
|
|
94
|
-
|
|
|
95
|
-
| `@Entity()`
|
|
96
|
-
| `@Id()`
|
|
97
|
-
| `@Field()`
|
|
98
|
-
| `@Relation()` | (OneToOne, OneToMany, ManyToOne, ManyToMany) Defines type-safe relationships.
|
|
96
|
+
| Decorator | Purpose |
|
|
97
|
+
| :-------------- | :----------------------------------------------------------------------------- |
|
|
98
|
+
| `@Entity()` | Marks a class as a database table/collection. |
|
|
99
|
+
| `@Id()` | Defines the Primary Key with support for `onInsert` generators (UUIDs, etc). |
|
|
100
|
+
| `@Field()` | Standard column with options for indexing, uniqueness, and custom comments. |
|
|
101
|
+
| `@Relation()` | (OneToOne, OneToMany, ManyToOne, ManyToMany) Defines type-safe relationships. |
|
|
99
102
|
|
|
100
103
|
```ts
|
|
101
104
|
import { v7 as uuidv7 } from 'uuid';
|
|
@@ -183,25 +186,35 @@ export class PostTag {
|
|
|
183
186
|
A pool manages connections (queriers). Initialize it once at application bootstrap (e.g., in `server.ts`).
|
|
184
187
|
|
|
185
188
|
```ts
|
|
186
|
-
// file: ./shared/orm.ts
|
|
187
189
|
import { PgQuerierPool } from '@uql/core/postgres';
|
|
188
|
-
import { SnakeCaseNamingStrategy } from '@uql/core';
|
|
190
|
+
import { SnakeCaseNamingStrategy, type Config } from '@uql/core';
|
|
191
|
+
import { User, Profile, Post } from './entities';
|
|
189
192
|
|
|
190
193
|
export const pool = new PgQuerierPool(
|
|
191
194
|
{ host: 'localhost', database: 'uql_app', max: 10 },
|
|
192
195
|
{
|
|
193
196
|
logger: true,
|
|
194
197
|
slowQueryThreshold: 200,
|
|
195
|
-
namingStrategy: new SnakeCaseNamingStrategy()
|
|
198
|
+
namingStrategy: new SnakeCaseNamingStrategy()
|
|
196
199
|
}
|
|
197
200
|
);
|
|
201
|
+
|
|
202
|
+
export default {
|
|
203
|
+
pool,
|
|
204
|
+
// entities: [User, Profile, Post], // Optional: inferred from @Entity() decorators
|
|
205
|
+
migrationsPath: './migrations',
|
|
206
|
+
} satisfies Config;
|
|
198
207
|
```
|
|
199
208
|
|
|
209
|
+
> **Pro Tip**: Reusing the same connection pool for both your application and migrations is recommended. It reduces connection overhead and ensures consistent query settings (like naming strategies).
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
200
213
|
|
|
201
214
|
|
|
202
215
|
## 4. Manipulate the Data
|
|
203
216
|
|
|
204
|
-
UQL provides
|
|
217
|
+
UQL provides a straightforward API to interact with your data. **Always ensure queriers are released back to the pool.**
|
|
205
218
|
|
|
206
219
|
```ts
|
|
207
220
|
const querier = await pool.getQuerier();
|
|
@@ -224,6 +237,7 @@ try {
|
|
|
224
237
|
```
|
|
225
238
|
|
|
226
239
|
**Generated SQL (PostgreSQL):**
|
|
240
|
+
|
|
227
241
|
```sql
|
|
228
242
|
SELECT "User"."name", "profile"."id" AS "profile_id", "profile"."bio" AS "profile_bio"
|
|
229
243
|
FROM "User"
|
|
@@ -261,6 +275,7 @@ export class Item {
|
|
|
261
275
|
UQL is one of the few ORMs with a **centralized serialization engine**. Transactions are guaranteed to be race-condition free.
|
|
262
276
|
|
|
263
277
|
#### Option A: Manual (Functional)
|
|
278
|
+
|
|
264
279
|
```ts
|
|
265
280
|
const result = await pool.transaction(async (querier) => {
|
|
266
281
|
const user = await querier.findOne(User, { $where: { email: '...' } });
|
|
@@ -269,6 +284,7 @@ const result = await pool.transaction(async (querier) => {
|
|
|
269
284
|
```
|
|
270
285
|
|
|
271
286
|
#### Option B: Declarative (Decorators)
|
|
287
|
+
|
|
272
288
|
Perfect for **NestJS** and other Dependency Injection frameworks. Use `@Transactional()` to wrap a method and `@InjectQuerier()` to access the managed connection.
|
|
273
289
|
|
|
274
290
|
```ts
|
|
@@ -285,58 +301,30 @@ export class UserService {
|
|
|
285
301
|
|
|
286
302
|
|
|
287
303
|
|
|
288
|
-
## 5. Repositories & Web Integration
|
|
289
|
-
|
|
290
|
-
### The Repository Pattern
|
|
291
|
-
|
|
292
|
-
For better abstraction, use the `GenericRepository`. It encapsulates the querier logic and provides a cleaner API for your business logic.
|
|
293
|
-
|
|
294
|
-
```ts
|
|
295
|
-
import { GenericRepository } from '@uql/core';
|
|
296
304
|
|
|
297
|
-
|
|
298
|
-
constructor() {
|
|
299
|
-
super(User, pool);
|
|
300
|
-
}
|
|
305
|
+
|
|
301
306
|
|
|
302
|
-
|
|
303
|
-
return this.findMany({ $where: { status: 'active' } });
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
```
|
|
307
|
+
## 5. Migrations & Synchronization
|
|
307
308
|
|
|
308
|
-
###
|
|
309
|
+
### 1. Unified Configuration
|
|
309
310
|
|
|
310
|
-
|
|
311
|
+
Ideally, use the same `uql.config.ts` for your application bootstrap and the CLI:
|
|
311
312
|
|
|
312
313
|
```ts
|
|
313
|
-
|
|
314
|
-
import {
|
|
314
|
+
// uql.config.ts
|
|
315
|
+
import type { Config } from '@uql/core';
|
|
315
316
|
|
|
316
|
-
const app = express();
|
|
317
|
-
app.use(querierMiddleware(pool));
|
|
318
|
-
|
|
319
|
-
app.get('/users', async (req, res) => {
|
|
320
|
-
const users = await req.querier.findMany(User);
|
|
321
|
-
res.json(users);
|
|
322
|
-
});
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
## 6. Migrations & Synchronization
|
|
328
|
-
|
|
329
|
-
### 1. Configure
|
|
330
|
-
Create a `uql.config.ts` in your project root:
|
|
331
|
-
```ts
|
|
332
317
|
export default {
|
|
333
318
|
pool: new PgQuerierPool({ /* ... */ }),
|
|
334
|
-
entities: [User, Post],
|
|
319
|
+
// entities: [User, Post], // Optional: inferred from @Entity() decorators
|
|
335
320
|
migrationsPath: './migrations',
|
|
336
|
-
};
|
|
321
|
+
} satisfies Config;
|
|
337
322
|
```
|
|
338
323
|
|
|
324
|
+
**Why?** Using a single config for both your app and the CLI is recommended for consistency. It prevents bugs where your runtime uses one naming strategy (e.g. `camelCase`) but your migrations use another (e.g. `snake_case`), or where the CLI isn't aware of all your entities. It enforces a Single Source of Truth for your database connection and schema.
|
|
325
|
+
|
|
339
326
|
### 2. Manage via CLI
|
|
327
|
+
|
|
340
328
|
```bash
|
|
341
329
|
# Generate from entities
|
|
342
330
|
npx uql-migrate generate:entities initial_schema
|
|
@@ -344,10 +332,14 @@ npx uql-migrate generate:entities initial_schema
|
|
|
344
332
|
npx uql-migrate up
|
|
345
333
|
# Rollback last migration
|
|
346
334
|
npx uql-migrate down
|
|
335
|
+
# Using a custom config path
|
|
336
|
+
npx uql-migrate up --config ./configs/uql.config.ts
|
|
347
337
|
```
|
|
348
338
|
|
|
349
339
|
### 3. AutoSync (Development)
|
|
340
|
+
|
|
350
341
|
Keep your schema in sync without manual migrations. It safely adds missing tables/columns.
|
|
342
|
+
|
|
351
343
|
```ts
|
|
352
344
|
const migrator = new Migrator(pool);
|
|
353
345
|
await migrator.autoSync({ logging: true });
|
|
@@ -361,13 +353,13 @@ UQL features a professional-grade, structured logging system designed for high v
|
|
|
361
353
|
|
|
362
354
|
### Log Levels
|
|
363
355
|
|
|
364
|
-
| Level
|
|
365
|
-
|
|
|
366
|
-
| `query`
|
|
367
|
-
| `slowQuery`
|
|
368
|
-
| `error` / `warn`
|
|
369
|
-
| `migration`
|
|
370
|
-
| `schema` / `info` | **Lifecycle**: Informative logs about ORM initialization and sync events.
|
|
356
|
+
| Level | Description |
|
|
357
|
+
| :-------------------- | :-------------------------------------------------------------------------------------- |
|
|
358
|
+
| `query` | **Standard Queries**: Beautifully formatted SQL/Command logs with execution time. |
|
|
359
|
+
| `slowQuery` | **Bottleneck Alerts**: Dedicated logging for queries exceeding your threshold. |
|
|
360
|
+
| `error` / `warn` | **System Health**: Detailed error traces and potential issue warnings. |
|
|
361
|
+
| `migration` | **Audit Trail**: Step-by-step history of schema changes. |
|
|
362
|
+
| `schema` / `info` | **Lifecycle**: Informative logs about ORM initialization and sync events. |
|
|
371
363
|
|
|
372
364
|
### Visual Feedback
|
|
373
365
|
|
|
@@ -384,10 +376,11 @@ error: Failed to connect to database: Connection timeout
|
|
|
384
376
|
|
|
385
377
|
|
|
386
378
|
Learn more about UQL at [uql.app](https://uql.app) for details on:
|
|
379
|
+
|
|
387
380
|
- [Complex Logical Operators](https://uql.app/querying/logical-operators)
|
|
388
381
|
- [Relationship Mapping (1-1, 1-M, M-M)](https://uql.app/querying/relations)
|
|
389
|
-
- [Soft Deletes & Auditing](https://uql.app/entities/soft-delete)
|
|
390
|
-
- [Database Migration & Syncing](https://uql.app/migrations)
|
|
382
|
+
- [Soft Deletes & Auditing](https://uql.app/entities/soft-delete)
|
|
383
|
+
- [Database Migration & Syncing](https://uql.app/migrations)
|
|
391
384
|
|
|
392
385
|
---
|
|
393
386
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IdValue, Query, QueryOne, QueryOptions, QuerySearch, Type } from '../../type/index.js';
|
|
2
|
-
import type { ClientQuerier,
|
|
2
|
+
import type { ClientQuerier, RequestFindOptions, RequestOptions } from '../type/index.js';
|
|
3
3
|
export declare class HttpQuerier implements ClientQuerier {
|
|
4
4
|
readonly basePath: string;
|
|
5
5
|
constructor(basePath: string);
|
|
@@ -15,7 +15,6 @@ export declare class HttpQuerier implements ClientQuerier {
|
|
|
15
15
|
}>;
|
|
16
16
|
deleteOneById<E>(entity: Type<E>, id: IdValue<E>, opts?: QueryOptions & RequestOptions): Promise<import("../type/request.js").RequestSuccessResponse<IdValue<E>>>;
|
|
17
17
|
deleteMany<E>(entity: Type<E>, q: QuerySearch<E>, opts?: QueryOptions & RequestOptions): Promise<import("../type/request.js").RequestSuccessResponse<IdValue<E>[]>>;
|
|
18
|
-
getRepository<E>(entity: Type<E>): ClientRepository<E>;
|
|
19
18
|
getBasePath<E>(entity: Type<E>): string;
|
|
20
19
|
}
|
|
21
20
|
//# sourceMappingURL=httpQuerier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpQuerier.d.ts","sourceRoot":"","sources":["../../../src/browser/querier/httpQuerier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAGrG,OAAO,KAAK,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"httpQuerier.d.ts","sourceRoot":"","sources":["../../../src/browser/querier/httpQuerier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAGrG,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG1F,qBAAa,WAAY,YAAW,aAAa;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM;gBAAhB,QAAQ,EAAE,MAAM;IAErC,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC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AE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,YAAY,GAAG,cAAmB;IAM1F,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;CAG/B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getMeta } from '../../entity/index.js';
|
|
2
2
|
import { kebabCase } from '../../util/index.js';
|
|
3
3
|
import { get, patch, post, remove } from '../http/index.js';
|
|
4
|
-
import { GenericClientRepository } from './genericClientRepository.js';
|
|
5
4
|
import { stringifyQuery } from './querier.util.js';
|
|
6
5
|
export class HttpQuerier {
|
|
7
6
|
basePath;
|
|
@@ -61,9 +60,6 @@ export class HttpQuerier {
|
|
|
61
60
|
const qs = stringifyQuery(opts.softDelete ? { ...q, softDelete: opts.softDelete } : q);
|
|
62
61
|
return remove(`${basePath}${qs}`, opts);
|
|
63
62
|
}
|
|
64
|
-
getRepository(entity) {
|
|
65
|
-
return new GenericClientRepository(entity, this);
|
|
66
|
-
}
|
|
67
63
|
getBasePath(entity) {
|
|
68
64
|
return this.basePath + '/' + kebabCase(entity.name);
|
|
69
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpQuerier.js","sourceRoot":"","sources":["../../../src/browser/querier/httpQuerier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"httpQuerier.js","sourceRoot":"","sources":["../../../src/browser/querier/httpQuerier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,E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I,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,aAAa,CAAI,MAAe,EAAE,EAAc,EAAE,OAAsC,EAAE;QACxF,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClF,OAAO,MAAM,CAAY,GAAG,QAAQ,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED,UAAU,CAAI,MAAe,EAAE,CAAiB,EAAE,OAAsC,EAAE;QACxF,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvF,OAAO,MAAM,CAAe,GAAG,QAAQ,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,WAAW,CAAI,MAAe;QAC5B,OAAO,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/querier/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/querier/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/querier/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/querier/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { IdValue, Query, QueryOne, QueryOptions, QuerySearch, Type, UniversalQuerier } from '../../type/index.js';
|
|
2
|
-
import type { ClientRepository } from './clientRepository.js';
|
|
3
2
|
import type { RequestOptions, RequestSuccessResponse } from './request.js';
|
|
4
3
|
export interface ClientQuerier extends UniversalQuerier {
|
|
5
4
|
findOneById<E>(entity: Type<E>, id: IdValue<E>, q?: QueryOne<E>, opts?: RequestOptions): Promise<RequestSuccessResponse<E>>;
|
|
@@ -12,6 +11,5 @@ export interface ClientQuerier extends UniversalQuerier {
|
|
|
12
11
|
saveOne<E>(entity: Type<E>, payload: E, opts?: RequestOptions): Promise<RequestSuccessResponse<IdValue<E>>>;
|
|
13
12
|
deleteOneById<E>(entity: Type<E>, id: IdValue<E>, opts?: QueryOptions & RequestOptions): Promise<RequestSuccessResponse<IdValue<E>>>;
|
|
14
13
|
deleteMany<E>(entity: Type<E>, qm: QuerySearch<E>, opts?: QueryOptions & RequestOptions): Promise<RequestSuccessResponse<IdValue<E>[]>>;
|
|
15
|
-
getRepository<E>(entity: Type<E>): ClientRepository<E>;
|
|
16
14
|
}
|
|
17
15
|
//# sourceMappingURL=clientQuerier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientQuerier.d.ts","sourceRoot":"","sources":["../../../src/browser/type/clientQuerier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,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EAAE,YAAY,GAAG,cAAc,GACnC,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAClD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/type/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/type/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/type/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/type/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,cAAc,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from './entity/index.js';
|
|
|
3
3
|
export * from './namingStrategy/index.js';
|
|
4
4
|
export * from './options.js';
|
|
5
5
|
export * from './querier/index.js';
|
|
6
|
-
export * from './repository/index.js';
|
|
7
6
|
export * from './type/index.js';
|
|
8
7
|
export * from './util/index.js';
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@ export * from './entity/index.js';
|
|
|
3
3
|
export * from './namingStrategy/index.js';
|
|
4
4
|
export * from './options.js';
|
|
5
5
|
export * from './querier/index.js';
|
|
6
|
-
export * from './repository/index.js';
|
|
7
6
|
export * from './type/index.js';
|
|
8
7
|
export * from './util/index.js';
|
|
9
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
package/dist/migrate/bin.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/migrate/bin.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/migrate/bin.ts"],"names":[],"mappings":";AAkBA,eAAO,MAAM,YAAY;;CAAa,CAAC"}
|
package/dist/migrate/bin.js
CHANGED
|
@@ -5,10 +5,13 @@ import { main } from './cli.js';
|
|
|
5
5
|
* Check if the current module is being run as the main script (entry point).
|
|
6
6
|
* This allows the file to be both imported as a library and executed as a standalone CLI tool.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
const isMain = import.meta.url === pathToFileURL(process.argv[1]).href;
|
|
9
|
+
if (isMain) {
|
|
9
10
|
main(process.argv.slice(2)).catch((err) => {
|
|
10
11
|
console.error(err);
|
|
11
12
|
process.exit(1);
|
|
12
13
|
});
|
|
13
14
|
}
|
|
15
|
+
// Export for testing
|
|
16
|
+
export const _scriptLogic = { isMain };
|
|
14
17
|
//# sourceMappingURL=bin.js.map
|
package/dist/migrate/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/migrate/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/migrate/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;GAGG;AACH,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAEvE,IAAI,MAAM,EAAE,CAAC;IACX,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACxC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,qBAAqB;AACrB,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
pool?: QuerierPool;
|
|
4
|
-
migrationsPath?: string;
|
|
5
|
-
tableName?: string;
|
|
6
|
-
dialect?: Dialect;
|
|
7
|
-
entities?: Type<unknown>[];
|
|
8
|
-
namingStrategy?: NamingStrategy;
|
|
9
|
-
}
|
|
10
|
-
export declare function loadConfig(): Promise<CliConfig>;
|
|
1
|
+
import type { Config } from '../type/index.js';
|
|
2
|
+
export declare function loadConfig(customPath?: string): Promise<Config>;
|
|
11
3
|
//# sourceMappingURL=cli-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-config.d.ts","sourceRoot":"","sources":["../../src/migrate/cli-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-config.d.ts","sourceRoot":"","sources":["../../src/migrate/cli-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsCrE"}
|
|
@@ -1,15 +1,36 @@
|
|
|
1
|
+
import { stat } from 'node:fs/promises';
|
|
1
2
|
import { resolve } from 'node:path';
|
|
2
3
|
import { pathToFileURL } from 'node:url';
|
|
3
|
-
export async function loadConfig() {
|
|
4
|
+
export async function loadConfig(customPath) {
|
|
5
|
+
if (customPath) {
|
|
6
|
+
const fullPath = resolve(process.cwd(), customPath);
|
|
7
|
+
const exists = await stat(fullPath)
|
|
8
|
+
.then(() => true)
|
|
9
|
+
.catch(() => false);
|
|
10
|
+
if (!exists) {
|
|
11
|
+
throw new Error(`Could not find uql configuration file at ${customPath}`);
|
|
12
|
+
}
|
|
13
|
+
const fileUrl = pathToFileURL(fullPath).href;
|
|
14
|
+
try {
|
|
15
|
+
const config = await import(fileUrl);
|
|
16
|
+
return config.default ?? config;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw new Error(`Could not load configuration file at ${customPath}: ${error.message}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
4
22
|
const configPaths = ['uql.config.ts', 'uql.config.js', 'uql.config.mjs', '.uqlrc.ts', '.uqlrc.js'];
|
|
5
23
|
for (const configPath of configPaths) {
|
|
6
24
|
const fullPath = resolve(process.cwd(), configPath);
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
const exists = await stat(fullPath)
|
|
26
|
+
.then(() => true)
|
|
27
|
+
.catch(() => false);
|
|
28
|
+
if (exists) {
|
|
29
|
+
const fileUrl = pathToFileURL(fullPath).href;
|
|
30
|
+
const config = await import(fileUrl);
|
|
10
31
|
return config.default ?? config;
|
|
11
32
|
}
|
|
12
33
|
}
|
|
13
|
-
throw new Error('Could not find uql configuration file.
|
|
34
|
+
throw new Error('Could not find uql configuration file. Create a uql.config.ts or uql.config.js file in your project root.');
|
|
14
35
|
}
|
|
15
36
|
//# sourceMappingURL=cli-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-config.js","sourceRoot":"","sources":["../../src/migrate/cli-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-config.js","sourceRoot":"","sources":["../../src/migrate/cli-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC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AAM,EAAE,CAAC;YACX,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;YAC7C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;YACrC,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;QAClC,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CACb,2GAA2G,CAC5G,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/migrate/cli.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,OAAO,EAAmB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,cAAc,iGAcnF;AAED,wBAAsB,IAAI,CAAC,IAAI,WAAwB,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/migrate/cli.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,OAAO,EAAmB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,QAA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