uql-orm 0.8.2 → 0.9.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 +27 -0
- package/README.md +32 -5
- package/dist/browser/{mongoSchemaGenerator-8aUNHkiE.js → mongoSchemaGenerator-BT2_u1wI.js} +14 -6
- package/dist/browser/mongoSchemaGenerator-BT2_u1wI.js.map +1 -0
- package/dist/browser/uql-browser.min.js +33 -17
- package/dist/browser/uql-browser.min.js.map +1 -1
- package/dist/dialect/abstractSqlDialect.d.ts +6 -5
- package/dist/dialect/abstractSqlDialect.d.ts.map +1 -1
- package/dist/dialect/abstractSqlDialect.js +26 -57
- package/dist/dialect/abstractSqlDialect.js.map +1 -1
- package/dist/entity/metadata/definition.d.ts.map +1 -1
- package/dist/entity/metadata/definition.js.map +1 -1
- package/dist/express/query.util.d.ts.map +1 -1
- package/dist/express/query.util.js +7 -9
- package/dist/express/query.util.js.map +1 -1
- package/dist/migrate/builder/splitSqlStatements.d.ts +14 -5
- package/dist/migrate/builder/splitSqlStatements.d.ts.map +1 -1
- package/dist/migrate/builder/splitSqlStatements.js +39 -9
- package/dist/migrate/builder/splitSqlStatements.js.map +1 -1
- package/dist/mongo/mongoDialect.d.ts +5 -5
- package/dist/mongo/mongoDialect.d.ts.map +1 -1
- package/dist/mongo/mongoDialect.js +13 -5
- package/dist/mongo/mongoDialect.js.map +1 -1
- package/dist/mongo/mongodbQuerier.d.ts +1 -0
- package/dist/mongo/mongodbQuerier.d.ts.map +1 -1
- package/dist/mongo/mongodbQuerier.js +21 -9
- package/dist/mongo/mongodbQuerier.js.map +1 -1
- package/dist/querier/abstractQuerier.d.ts +17 -3
- package/dist/querier/abstractQuerier.d.ts.map +1 -1
- package/dist/querier/abstractQuerier.js +78 -42
- package/dist/querier/abstractQuerier.js.map +1 -1
- package/dist/querier/abstractSqlQuerier.d.ts.map +1 -1
- package/dist/querier/abstractSqlQuerier.js +7 -2
- package/dist/querier/abstractSqlQuerier.js.map +1 -1
- package/dist/type/query.d.ts +22 -9
- package/dist/type/query.d.ts.map +1 -1
- package/dist/type/query.js.map +1 -1
- package/dist/util/dialect.util.d.ts +2 -3
- package/dist/util/dialect.util.d.ts.map +1 -1
- package/dist/util/dialect.util.js +21 -17
- package/dist/util/dialect.util.js.map +1 -1
- 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/relationQuery.util.d.ts +25 -0
- package/dist/util/relationQuery.util.d.ts.map +1 -0
- package/dist/util/relationQuery.util.js +101 -0
- package/dist/util/relationQuery.util.js.map +1 -0
- package/package.json +5 -5
- package/dist/browser/mongoSchemaGenerator-8aUNHkiE.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ 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.8.4] - 2026-04-11
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- Added first-class `$populate` (relations) and `$exclude` (subtractive scalar projection), while keeping backward compatibility for legacy relation keys in `$select`.
|
|
12
|
+
|
|
13
|
+
### Breaking Changes (Public util surface)
|
|
14
|
+
|
|
15
|
+
- Removed support for specifying relations in `$select`; use `$populate` instead.
|
|
16
|
+
|
|
17
|
+
### Improvements
|
|
18
|
+
|
|
19
|
+
- Populate-only relation loading now works consistently in SQL dialects.
|
|
20
|
+
- Relation keys in `$select` now emit a deduplicated deprecation warning (use `$populate`).
|
|
21
|
+
- `$select` and `$exclude` conflicts are validated recursively, including nested relation queries.
|
|
22
|
+
- `findManyStream` now rejects unsupported relation loading early: **MongoDB** throws if any relation is requested in `$select` / `$populate` (streams use `find` only). **SQL** throws if **to-many** relations are requested (they are filled only after `findMany`, not while streaming).
|
|
23
|
+
|
|
24
|
+
### Documentation
|
|
25
|
+
|
|
26
|
+
- README and docs site clarify projection keys (`$select` / `$exclude` / `$populate`) and streaming behavior across SQL vs MongoDB.
|
|
27
|
+
|
|
28
|
+
## [0.8.3] - 2026-04-04
|
|
29
|
+
|
|
30
|
+
### Improvements
|
|
31
|
+
|
|
32
|
+
- **Robust SQL Statement Splitting**: Refactored the `splitSqlStatements` utility with a high-performance, declarative Master-Regex scanner. This production-grade implementation correctly handles complex SQL syntax across all supported dialects, including nested string literals, escaped quotes (`''`, `\'`), double-quoted identifiers, MySQL backticks, and PostgreSQL dollar-quoting (`$$` and `$tag$`). It also correctly preserves semicolons within single-line (`--`) and multi-line (`/* ... */`) comments while ensuring $O(n)$ performance and full backward compatibility. Covered with full test suite.
|
|
33
|
+
|
|
7
34
|
## [0.8.2] - 2026-04-04
|
|
8
35
|
|
|
9
36
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
10
|
const results = await querier.findMany(User, {
|
|
11
|
-
$select: { name: true
|
|
11
|
+
$select: { name: true },
|
|
12
|
+
$populate: { profile: { $select: { picture: true } } },
|
|
12
13
|
$where: { name: { $istartsWith: 'a' }, posts: { tags: { name: 'typescript' } } },
|
|
13
14
|
$sort: { createdAt: 'desc' },
|
|
14
15
|
$limit: 10,
|
|
@@ -346,10 +347,8 @@ UQL provides a straightforward API to interact with your data. **Always ensure q
|
|
|
346
347
|
const querier = await pool.getQuerier();
|
|
347
348
|
try {
|
|
348
349
|
const results = await querier.findMany(User, {
|
|
349
|
-
$select: {
|
|
350
|
-
|
|
351
|
-
profile: { $select: { bio: true }, $required: true }, // INNER JOIN
|
|
352
|
-
},
|
|
350
|
+
$select: { name: true },
|
|
351
|
+
$populate: { profile: { $select: { bio: true }, $required: true } }, // INNER JOIN
|
|
353
352
|
$where: {
|
|
354
353
|
status: 'active',
|
|
355
354
|
name: { $istartsWith: 'a' },
|
|
@@ -371,6 +370,34 @@ WHERE "User"."status" = 'active' AND "User"."name" ILIKE 'a%'
|
|
|
371
370
|
LIMIT 10 OFFSET 0
|
|
372
371
|
```
|
|
373
372
|
|
|
373
|
+
### Projection & Relation Loading
|
|
374
|
+
|
|
375
|
+
Use these query keys with clear separation of concerns:
|
|
376
|
+
|
|
377
|
+
- `$select`: scalar field whitelist (projection)
|
|
378
|
+
- `$exclude`: scalar field subtraction from default eager set
|
|
379
|
+
- `$populate`: relation loading (including nested relation query options)
|
|
380
|
+
|
|
381
|
+
`$select` and `$exclude` are mutually exclusive when `$select` includes positive scalar keys.
|
|
382
|
+
|
|
383
|
+
```ts
|
|
384
|
+
const rows = await querier.findMany(User, {
|
|
385
|
+
$exclude: { password: true },
|
|
386
|
+
$populate: { profile: { $select: { picture: true } } },
|
|
387
|
+
});
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
> **Migration note:** selecting relations inside `$select` is still supported for backward compatibility, but deprecated. Move relations to `$populate`.
|
|
391
|
+
|
|
392
|
+
### Streaming (`findManyStream`) and relations
|
|
393
|
+
|
|
394
|
+
`findManyStream` is optimized for **scalar** reads and a stable memory footprint. Relation loading differs by backend:
|
|
395
|
+
|
|
396
|
+
- **SQL:** Joinable relations (e.g. many-to-one, one-to-one) are still included in the streamed `SELECT` / joins. **To-many** collections are not filled on the stream path (that uses extra queries in `findMany`); requesting them in `$select` / `$populate` throws a `TypeError` with a short explanation.
|
|
397
|
+
- **MongoDB:** Streams use a plain `find` cursor, so **any** relation keys in `$select` or `$populate` throw a `TypeError`. Use `findMany` for relation loading (aggregation + fill).
|
|
398
|
+
|
|
399
|
+
See [Cursor Streaming](https://uql-orm.dev/querying/streaming) on the docs site for details.
|
|
400
|
+
|
|
374
401
|
### Advanced Query Patterns
|
|
375
402
|
|
|
376
403
|
### Modern Indexing: Semantic Search
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getMeta } from '../entity/index.js';
|
|
2
2
|
import { ObjectId } from 'mongodb';
|
|
3
|
-
import { buildQueryWhereAsMap, buildSortMap, hasKeys,
|
|
3
|
+
import { buildQueryWhereAsMap, normalizeScalarFieldSelection, buildSortMap, hasKeys, getRelationRequestSummary, getKeys, fillOnFields, filterFieldKeys, parseGroupMap, isVectorSearch } from '../util/index.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Merge dialect capability defaults with optional overrides from {@link DialectOptions.driverCapabilities}.
|
|
@@ -217,8 +217,16 @@ class MongoDialect extends AbstractDialect {
|
|
|
217
217
|
}
|
|
218
218
|
return result;
|
|
219
219
|
}
|
|
220
|
-
select(entity, select) {
|
|
221
|
-
|
|
220
|
+
select(entity, select, exclude) {
|
|
221
|
+
const meta = getMeta(entity);
|
|
222
|
+
if (!select && !exclude) {
|
|
223
|
+
return {};
|
|
224
|
+
}
|
|
225
|
+
const selectedFields = normalizeScalarFieldSelection(meta, select, exclude);
|
|
226
|
+
return selectedFields.reduce((acc, key)=>{
|
|
227
|
+
acc[key] = 1;
|
|
228
|
+
return acc;
|
|
229
|
+
}, {});
|
|
222
230
|
}
|
|
223
231
|
sort(entity, sort) {
|
|
224
232
|
const raw = buildSortMap(sort);
|
|
@@ -228,7 +236,7 @@ class MongoDialect extends AbstractDialect {
|
|
|
228
236
|
}
|
|
229
237
|
return normalized;
|
|
230
238
|
}
|
|
231
|
-
aggregationPipeline(entity, q) {
|
|
239
|
+
aggregationPipeline(entity, q, relationSummary) {
|
|
232
240
|
const meta = getMeta(entity);
|
|
233
241
|
const where = this.where(entity, q.$where);
|
|
234
242
|
const sort = this.sort(entity, q.$sort);
|
|
@@ -243,7 +251,7 @@ class MongoDialect extends AbstractDialect {
|
|
|
243
251
|
if (hasKeys(firstPipelineEntry)) {
|
|
244
252
|
pipeline.push(firstPipelineEntry);
|
|
245
253
|
}
|
|
246
|
-
const relKeys =
|
|
254
|
+
const relKeys = (relationSummary ?? getRelationRequestSummary(meta, q.$populate)).joinableKeys;
|
|
247
255
|
for (const relKey of relKeys){
|
|
248
256
|
const relOpts = meta.relations[relKey];
|
|
249
257
|
if (!relOpts) continue;
|
|
@@ -724,4 +732,4 @@ class MongoSchemaGenerator extends AbstractDialect {
|
|
|
724
732
|
}
|
|
725
733
|
|
|
726
734
|
export { MongoSchemaGenerator };
|
|
727
|
-
//# sourceMappingURL=mongoSchemaGenerator-
|
|
735
|
+
//# sourceMappingURL=mongoSchemaGenerator-BT2_u1wI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongoSchemaGenerator-BT2_u1wI.js","sources":["../../src/dialect/abstractDialect.ts","../../src/mongo/mongoDialect.ts","../../src/migrate/generator/mongoSchemaGenerator.ts"],"sourcesContent":["import type { DialectFeatures, DialectName, EntityMeta, FieldOptions, NamingStrategy, Type } from '../type/index.js';\n\n/**\n * Options for initializing a dialect.\n */\nexport interface DialectOptions {\n readonly namingStrategy?: NamingStrategy;\n readonly driverCapabilities?: Partial<DialectFeatures>;\n}\n\n/**\n * Merge dialect capability defaults with optional overrides from {@link DialectOptions.driverCapabilities}.\n */\nexport function mergeDialectFeatures(defaults: DialectFeatures, patch?: Partial<DialectFeatures>): DialectFeatures {\n return patch ? { ...defaults, ...patch } : defaults;\n}\n\n/**\n * Base abstract class for all database dialects (SQL and NoSQL).\n */\nexport abstract class AbstractDialect {\n abstract readonly dialectName: DialectName;\n\n abstract readonly insertIdStrategy: 'first' | 'last';\n readonly namingStrategy: NamingStrategy | undefined;\n readonly features: DialectFeatures;\n\n constructor(\n featureDefaults: DialectFeatures,\n protected readonly options: DialectOptions = {},\n ) {\n this.namingStrategy = options.namingStrategy;\n this.features = mergeDialectFeatures(featureDefaults, options.driverCapabilities);\n }\n\n /**\n * Resolve the table name for an entity, applying naming strategy if necessary.\n */\n resolveTableName<E>(entity: Type<E>, meta: EntityMeta<E>): string {\n const name = meta.name ?? entity.name;\n if (name !== entity.name || !this.namingStrategy) {\n return name;\n }\n return this.namingStrategy.tableName(name);\n }\n\n /**\n * Resolve the column/field name for a property, applying naming strategy if necessary.\n */\n resolveColumnName(key: string, field: FieldOptions | undefined): string {\n if (!field || field.name !== key || !this.namingStrategy) {\n return field?.name ?? key;\n }\n return this.namingStrategy.columnName(field.name);\n }\n}\n","import { type Document, type Filter, ObjectId, type Sort } from 'mongodb';\nimport type { DialectOptions } from '../dialect/abstractDialect.js';\nimport { AbstractDialect } from '../dialect/abstractDialect.js';\nimport { getMeta } from '../entity/index.js';\nimport type { IndexType } from '../schema/types.js';\nimport type {\n DialectFeatures,\n EntityMeta,\n FieldValue,\n Query,\n QueryAggregate,\n QueryExclude,\n QueryOptions,\n QuerySelect,\n QuerySortMap,\n QueryVectorSearch,\n QueryWhere,\n RelationKey,\n Type,\n} from '../type/index.js';\nimport {\n buildQueryWhereAsMap,\n buildSortMap,\n type CallbackKey,\n fillOnFields,\n filterFieldKeys,\n getKeys,\n getRelationRequestSummary,\n hasKeys,\n isVectorSearch,\n normalizeScalarFieldSelection,\n parseGroupMap,\n type RelationRequestSummary,\n} from '../util/index.js';\n\nexport class MongoDialect extends AbstractDialect {\n /** Default {@link DialectFeatures} for MongoDB; shared by {@link MongoSchemaGenerator}. */\n static readonly defaultDialectFeatures: DialectFeatures = {\n explicitJsonCast: false,\n nativeArrays: false,\n supportsJsonb: false,\n returning: false,\n ifNotExists: false,\n indexIfNotExists: false,\n dropTableCascade: false,\n renameColumn: false,\n foreignKeyAlter: false,\n columnComment: false,\n vectorIndexStyle: 'create',\n vectorSupportsLength: false,\n supportsTimestamptz: false,\n defaultStringAsText: false,\n };\n\n readonly dialectName = 'mongodb';\n\n override readonly insertIdStrategy = 'last';\n\n constructor(options: DialectOptions = {}) {\n super(MongoDialect.defaultDialectFeatures, options);\n }\n\n private static readonly ID_KEY = '_id';\n private static readonly VECTOR_INDEX_TYPES = new Set<IndexType>(['vectorSearch', 'hnsw', 'ivfflat', 'vector']);\n\n private static readonly AGGREGATE_OP_MAP: Record<string, string> = {\n $count: '$sum',\n $sum: '$sum',\n $avg: '$avg',\n $min: '$min',\n $max: '$max',\n };\n\n public where<E extends Document>(\n entity: Type<E>,\n where: QueryWhere<E> = {},\n { softDelete }: QueryOptions = {},\n ): Filter<E> {\n const meta = getMeta(entity);\n const whereMap = buildQueryWhereAsMap(meta, where);\n\n if (meta.softDelete && (softDelete || softDelete === undefined) && !whereMap[meta.softDelete]) {\n const field = meta.fields[meta.softDelete];\n (whereMap as Record<string, unknown>)[this.resolveColumnName(meta.softDelete, field!)] = null;\n }\n\n const filter: Record<string, unknown> = {};\n for (const [rawKey, rawVal] of Object.entries(whereMap)) {\n let key = rawKey;\n let val: unknown = rawVal;\n if (key === '$and' || key === '$or') {\n filter[key] = (val as QueryWhere<E>[]).map((filterIt) => this.where(entity, filterIt));\n } else {\n const field = meta.fields[key];\n if (key === MongoDialect.ID_KEY || key === meta.id) {\n key = MongoDialect.ID_KEY;\n val = this.getIdValue(val as IdValue);\n } else if (field) {\n key = this.resolveColumnName(key, field);\n }\n if (\n val &&\n typeof val === 'object' &&\n !Array.isArray(val) &&\n this.hasOperatorKeys(val as Record<string, unknown>)\n ) {\n val = this.transformOperators(val as Record<string, unknown>);\n } else if (Array.isArray(val)) {\n val = { $in: val };\n }\n filter[key] = val;\n }\n }\n return filter as Filter<E>;\n }\n\n /**\n * Check if an object has operator keys (keys starting with $).\n */\n private hasOperatorKeys(obj: Record<string, unknown>): boolean {\n return Object.keys(obj).some((key) => key.startsWith('$'));\n }\n\n protected mapTableNameRow(row: { table_name: string }): string {\n return row.table_name;\n }\n\n /** String operators → { pattern: (v) => regex, caseInsensitive } */\n private static readonly REGEX_OP_MAP: Record<string, { wrap: (v: unknown) => string; ci: boolean }> = {\n $startsWith: { wrap: (v) => `^${v}`, ci: false },\n $istartsWith: { wrap: (v) => `^${v}`, ci: true },\n $endsWith: { wrap: (v) => `${v}$`, ci: false },\n $iendsWith: { wrap: (v) => `${v}$`, ci: true },\n $includes: { wrap: (v) => String(v), ci: false },\n $iincludes: { wrap: (v) => String(v), ci: true },\n $like: { wrap: (v) => String(v).replace(/%/g, '.*').replace(/_/g, '.'), ci: false },\n $ilike: { wrap: (v) => String(v).replace(/%/g, '.*').replace(/_/g, '.'), ci: true },\n };\n\n /** MongoDB native operators — pass through as-is. */\n private static readonly NATIVE_OPS = new Set([\n '$all',\n '$size',\n '$elemMatch',\n '$eq',\n '$ne',\n '$lt',\n '$lte',\n '$gt',\n '$gte',\n '$in',\n '$nin',\n '$regex',\n '$not',\n ]);\n\n /**\n * Transform UQL operators to MongoDB operators.\n */\n private transformOperators(ops: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [op, val] of Object.entries(ops)) {\n // Native MongoDB operators — pass through directly\n if (MongoDialect.NATIVE_OPS.has(op)) {\n result[op] = val;\n continue;\n }\n // String/pattern → regex operators (8 variants including $like/$ilike)\n const regexEntry = MongoDialect.REGEX_OP_MAP[op];\n if (regexEntry) {\n result['$regex'] = regexEntry.wrap(val);\n if (regexEntry.ci) result['$options'] = 'i';\n continue;\n }\n // Structural transforms\n switch (op) {\n case '$between': {\n const [min, max] = val as [unknown, unknown];\n result['$gte'] = min;\n result['$lte'] = max;\n break;\n }\n case '$isNull':\n result[val ? '$eq' : '$ne'] = null;\n break;\n case '$isNotNull':\n result[val ? '$ne' : '$eq'] = null;\n break;\n case '$text':\n result['$text'] = { $search: val };\n break;\n default:\n result[op] = val;\n break;\n }\n }\n return result;\n }\n\n public select<E extends Document>(\n entity: Type<E>,\n select?: QuerySelect<E>,\n exclude?: QueryExclude<E>,\n ): Record<string, 1> {\n const meta = getMeta(entity);\n if (!select && !exclude) {\n return {};\n }\n const selectedFields = normalizeScalarFieldSelection(meta, select, exclude);\n return selectedFields.reduce<Record<string, 1>>((acc, key) => {\n acc[key] = 1;\n return acc;\n }, {});\n }\n\n public sort<E extends Document>(entity: Type<E>, sort?: QuerySortMap<E>): Sort {\n const raw = buildSortMap(sort);\n const normalized: Record<string, 1 | -1> = {};\n for (const [key, dir] of Object.entries(raw)) {\n normalized[key] = dir === 'desc' || dir === -1 ? -1 : 1;\n }\n return normalized as Sort;\n }\n\n public aggregationPipeline<E extends Document>(\n entity: Type<E>,\n q: Query<E>,\n relationSummary?: RelationRequestSummary<E>,\n ): MongoAggregationPipelineEntry<E>[] {\n const meta = getMeta(entity);\n const where = this.where(entity, q.$where);\n const sort = this.sort(entity, q.$sort);\n const firstPipelineEntry: MongoAggregationPipelineEntry<E> = {};\n\n if (hasKeys(where)) {\n firstPipelineEntry.$match = where;\n }\n if (hasKeys(sort)) {\n firstPipelineEntry.$sort = sort;\n }\n\n const pipeline: MongoAggregationPipelineEntry<E>[] = [];\n\n if (hasKeys(firstPipelineEntry)) {\n pipeline.push(firstPipelineEntry);\n }\n\n const relKeys = (relationSummary ?? getRelationRequestSummary(meta, q.$populate)).joinableKeys;\n\n for (const relKey of relKeys) {\n const relOpts = meta.relations[relKey];\n if (!relOpts) continue;\n\n if (relOpts.cardinality === '1m' || relOpts.cardinality === 'mm') {\n // '1m' and 'mm' should be resolved in a higher layer because they will need multiple queries\n continue;\n }\n\n const relEntity = relOpts.entity!();\n const relMeta = getMeta(relEntity);\n\n if (relOpts.cardinality === 'm1') {\n const localField = meta.fields[relOpts.references![0].local];\n pipeline.push({\n $lookup: {\n from: this.resolveTableName(relEntity, relMeta),\n localField: this.resolveColumnName(relOpts.references![0].local, localField!),\n foreignField: '_id',\n as: relKey,\n },\n });\n } else {\n const foreignField = relMeta.fields[relOpts.references![0].foreign];\n const foreignFieldName = this.resolveColumnName(relOpts.references![0].foreign, foreignField!);\n const referenceWhere = this.where(relEntity, where);\n const referenceSort = this.sort(relEntity, q.$sort);\n const _id = MongoDialect.ID_KEY;\n const referencePipelineEntry: MongoAggregationPipelineEntry<FieldValue<E>> = {\n $match: { [foreignFieldName]: referenceWhere[_id] },\n };\n if (hasKeys(referenceSort)) {\n referencePipelineEntry.$sort = referenceSort;\n }\n pipeline.push({\n $lookup: {\n from: this.resolveTableName(relEntity, relMeta),\n pipeline: [referencePipelineEntry],\n as: relKey,\n },\n });\n }\n\n pipeline.push({ $unwind: { path: `$${relKey}`, preserveNullAndEmptyArrays: true } });\n }\n\n return pipeline;\n }\n\n public normalizeIds<E extends Document>(meta: EntityMeta<E>, docs: E[] | undefined): E[] | undefined {\n return docs?.map((doc) => this.normalizeId(meta, doc)) as E[] | undefined;\n }\n\n public normalizeId<E extends Document>(meta: EntityMeta<E>, doc: E | undefined): E | undefined {\n if (!doc) {\n return doc;\n }\n\n const res = doc as unknown as Record<string, unknown>;\n const _id = MongoDialect.ID_KEY;\n\n if (res[_id]) {\n res[meta.id as string] = res[_id];\n if (meta.id !== _id) {\n delete res[_id];\n }\n }\n\n for (const key of getKeys(meta.fields)) {\n const field = meta.fields[key];\n const dbName = this.resolveColumnName(key, field!);\n if (dbName !== key && res[dbName] !== undefined) {\n res[key] = res[dbName];\n delete res[dbName];\n }\n }\n\n const relKeys = getKeys(meta.relations).filter((key) => res[key]) as RelationKey<E>[];\n\n for (const relKey of relKeys) {\n const relOpts = meta.relations[relKey];\n if (!relOpts) continue;\n const relMeta = getMeta(relOpts.entity!());\n res[relKey] = Array.isArray(res[relKey])\n ? this.normalizeIds(relMeta, res[relKey] as Document[])\n : this.normalizeId(relMeta, res[relKey] as Document);\n }\n\n return res as unknown as E;\n }\n\n public getIdValue<T extends IdValue>(value: T): T {\n if (value instanceof ObjectId) {\n return value;\n }\n try {\n return new ObjectId(value) as T;\n } catch (e) {\n return value;\n }\n }\n\n public getPersistable<E extends Document>(meta: EntityMeta<E>, payload: E, callbackKey: CallbackKey): Partial<E> {\n return this.getPersistables(meta, payload, callbackKey)[0];\n }\n\n public getPersistables<E extends Document>(\n meta: EntityMeta<E>,\n payload: E | E[],\n callbackKey: CallbackKey,\n ): Partial<E>[] {\n const payloads = fillOnFields(meta, payload, callbackKey);\n const persistableKeys = filterFieldKeys(meta, payloads[0], callbackKey);\n return payloads.map((it) =>\n persistableKeys.reduce<Partial<E>>(\n (acc, key) => {\n const field = meta.fields[key];\n (acc as Record<string, unknown>)[this.resolveColumnName(key, field!)] = it[key];\n return acc;\n },\n {} as Partial<E>,\n ),\n );\n }\n\n /**\n * Build MongoDB aggregation pipeline stages from a QueryAggregate.\n */\n public buildAggregateStages<E extends Document>(entity: Type<E>, q: QueryAggregate<E>): Record<string, unknown>[] {\n const pipeline: Record<string, unknown>[] = [];\n\n // $match stage (WHERE equivalent — before grouping)\n if (q.$where) {\n const filter = this.where(entity, q.$where);\n if (hasKeys(filter)) {\n pipeline.push({ $match: filter });\n }\n }\n\n // $group stage\n const groupId: Record<string, string> = {};\n const groupAccumulators: Record<string, Record<string, unknown>> = {};\n\n for (const entry of parseGroupMap(q.$group)) {\n if (entry.kind === 'key') {\n groupId[entry.alias] = `$${entry.alias}`;\n } else {\n const mongoOp = MongoDialect.AGGREGATE_OP_MAP[entry.op];\n groupAccumulators[entry.alias] = entry.op === '$count' ? { [mongoOp]: 1 } : { [mongoOp]: `$${entry.fieldRef}` };\n }\n }\n\n pipeline.push({ $group: { _id: hasKeys(groupId) ? groupId : null, ...groupAccumulators } });\n\n // Project stage — rename _id fields back to their original names\n if (hasKeys(groupId)) {\n const project: Record<string, unknown> = { _id: 0 };\n for (const alias of Object.keys(groupId)) {\n project[alias] = `$_id.${alias}`;\n }\n for (const alias of Object.keys(groupAccumulators)) {\n project[alias] = 1;\n }\n pipeline.push({ $project: project });\n }\n\n // $match stage for HAVING (post-group filtering)\n if (q.$having) {\n const havingFilter = this.buildHavingFilter(q.$having);\n if (hasKeys(havingFilter)) {\n pipeline.push({ $match: havingFilter });\n }\n }\n\n // $sort stage\n if (q.$sort) {\n const sort = this.sort(entity, q.$sort);\n if (hasKeys(sort)) {\n pipeline.push({ $sort: sort });\n }\n }\n\n // $skip and $limit stages\n if (q.$skip !== undefined) {\n pipeline.push({ $skip: q.$skip });\n }\n if (q.$limit !== undefined) {\n pipeline.push({ $limit: q.$limit });\n }\n\n return pipeline;\n }\n\n private buildHavingFilter(having: Record<string, unknown>): Record<string, unknown> {\n const filter: Record<string, unknown> = {};\n for (const [alias, condition] of Object.entries(having)) {\n if (condition === undefined) continue;\n if (typeof condition === 'number') {\n filter[alias] = condition;\n } else if (typeof condition === 'object' && condition !== null) {\n filter[alias] = this.transformOperators(condition as Record<string, unknown>);\n }\n }\n return filter;\n }\n\n /**\n * Separate vector sort entries from regular sort entries.\n * Returns `undefined` if no vector sort is present.\n */\n extractVectorSort<E extends Document>(sort: QuerySortMap<E> | undefined): ExtractedVectorSort<E> | undefined {\n if (!sort) return undefined;\n const raw = buildSortMap(sort);\n let vectorKey: string | undefined;\n let vectorSearch: QueryVectorSearch | undefined;\n const regularSort = {} as QuerySortMap<E>;\n\n for (const [key, value] of Object.entries(raw)) {\n if (isVectorSearch(value)) {\n vectorKey = key;\n vectorSearch = value;\n } else {\n (regularSort as Record<string, unknown>)[key] = value;\n }\n }\n\n if (!vectorKey || !vectorSearch) return undefined;\n\n return { vectorKey, vectorSearch, regularSort };\n }\n\n /**\n * Build a `$vectorSearch` aggregation pipeline stage.\n * Merges `$where` into `$vectorSearch.filter` for optimal pre-filtering.\n */\n buildVectorSearchStage<E extends Document>(\n entity: Type<E>,\n meta: EntityMeta<E>,\n key: string,\n search: QueryVectorSearch,\n where: QueryWhere<E> | undefined,\n limit: number,\n ): Record<string, unknown> {\n const field = meta.fields[key];\n if (!field) {\n throw new TypeError(`Field '${key}' not found in entity '${meta.name}'`);\n }\n const colName = this.resolveColumnName(key, field);\n\n // Resolve index name from @Index metadata, or fall back to convention\n const indexMeta = meta.indexes?.find(\n (idx) => idx.columns.includes(key) && MongoDialect.VECTOR_INDEX_TYPES.has(idx.type!),\n );\n const indexName = indexMeta?.name ?? `${colName}_index`;\n\n const stage: Record<string, unknown> = {\n index: indexName,\n path: colName,\n queryVector: [...search.$vector],\n numCandidates: limit * 10,\n limit,\n };\n\n // Pre-filter: merge $where into $vectorSearch.filter\n if (where) {\n const filter = this.where(entity, where);\n if (hasKeys(filter)) {\n stage['filter'] = filter;\n }\n }\n\n return { $vectorSearch: stage };\n }\n}\n\nexport type MongoAggregationPipelineEntry<E extends Document> = {\n $lookup?: MongoAggregationLookup<E>;\n $match?: Filter<E> | Record<string, unknown>;\n $sort?: Sort;\n $unwind?: MongoAggregationUnwind;\n $group?: Record<string, unknown>;\n $project?: Record<string, unknown>;\n $skip?: number;\n $limit?: number;\n};\n\ntype MongoAggregationLookup<E extends Document> = {\n readonly from?: string;\n readonly foreignField?: string;\n readonly localField?: string;\n readonly pipeline?: MongoAggregationPipelineEntry<FieldValue<E>>[];\n readonly as?: RelationKey<E>;\n};\n\ntype MongoAggregationUnwind = {\n readonly path?: string;\n readonly preserveNullAndEmptyArrays?: boolean;\n};\n\ntype IdValue = string | ObjectId;\n\nexport type ExtractedVectorSort<E> = {\n readonly vectorKey: string;\n readonly vectorSearch: QueryVectorSearch;\n readonly regularSort: QuerySortMap<E>;\n};\n","import { AbstractDialect } from '../../dialect/abstractDialect.js';\nimport { getMeta } from '../../entity/index.js';\nimport { MongoDialect } from '../../mongo/mongoDialect.js';\nimport type { ForeignKeyAction, IndexNode, TableNode } from '../../schema/types.js';\nimport type {\n DialectName,\n FieldOptions,\n IndexSchema,\n NamingStrategy,\n SchemaDiff,\n SchemaGenerator,\n Type,\n} from '../../type/index.js';\nimport { getKeys } from '../../util/index.js';\nimport type { TableDefinition } from '../builder/types.js';\n\nexport class MongoSchemaGenerator extends AbstractDialect implements SchemaGenerator {\n readonly dialectName = 'mongodb' satisfies DialectName;\n\n constructor(\n namingStrategy?: NamingStrategy,\n protected readonly defaultForeignKeyAction?: ForeignKeyAction,\n ) {\n super(MongoDialect.defaultDialectFeatures, { namingStrategy });\n }\n\n override readonly insertIdStrategy: 'first' | 'last' = 'last';\n\n generateCreateTable<E>(entity: Type<E>, _options?: { ifNotExists?: boolean }): string[] {\n const meta = getMeta(entity);\n const collectionName = this.resolveTableName(entity, meta);\n const indexes: IndexSchema[] = [];\n\n for (const key of getKeys(meta.fields)) {\n const field = meta.fields[key];\n if (field?.index) {\n const columnName = this.resolveColumnName(key, field);\n const indexName = typeof field.index === 'string' ? field.index : `idx_${collectionName}_${columnName}`;\n indexes.push({\n name: indexName,\n columns: [columnName],\n unique: !!field.unique,\n });\n }\n }\n\n return [JSON.stringify({ action: 'createCollection', name: collectionName, indexes })];\n }\n\n generateDropTable<E>(entity: Type<E>): string {\n const meta = getMeta(entity);\n const collectionName = this.resolveTableName(entity, meta);\n return JSON.stringify({ action: 'dropCollection', name: collectionName });\n }\n\n generateAlterTable(diff: SchemaDiff): string[] {\n const statements: string[] = [];\n if (diff.indexesToAdd?.length) {\n for (const index of diff.indexesToAdd) {\n statements.push(this.generateCreateIndex(diff.tableName, index));\n }\n }\n return statements;\n }\n\n generateAlterTableDown(diff: SchemaDiff): string[] {\n const statements: string[] = [];\n if (diff.indexesToAdd?.length) {\n for (const index of diff.indexesToAdd) {\n statements.push(this.generateDropIndex(diff.tableName, index.name));\n }\n }\n return statements;\n }\n\n generateCreateIndex(tableName: string, index: IndexSchema): string {\n const key: Record<string, number> = {};\n for (const col of index.columns) {\n key[col] = 1;\n }\n return JSON.stringify({\n action: 'createIndex',\n collection: tableName,\n name: index.name,\n key,\n options: { unique: index.unique, name: index.name },\n });\n }\n\n generateDropIndex(tableName: string, indexName: string): string {\n return JSON.stringify({\n action: 'dropIndex',\n collection: tableName,\n name: indexName,\n });\n }\n\n getSqlType(fieldOptions: FieldOptions, fieldType?: unknown): string {\n return '';\n }\n\n getBooleanType(): string {\n return '';\n }\n\n generateColumnDefinitions(): string[] {\n return [];\n }\n\n generateColumnDefinition(): string {\n return '';\n }\n\n generateColumnDefinitionFromSchema(): string {\n return '';\n }\n\n generateTableConstraints(): string[] {\n return [];\n }\n\n generateAlterColumnStatements(): string[] {\n return [];\n }\n\n getTableOptions(): string {\n return '';\n }\n\n generateColumnComment(): string {\n return '';\n }\n\n formatDefaultValue(): string {\n return '';\n }\n\n generateCreateTableFromNode(table: TableNode, _options?: { ifNotExists?: boolean }): string[] {\n return [JSON.stringify({ action: 'createCollection', name: table.name })];\n }\n\n generateCreateIndexFromNode(index: IndexNode): string {\n const key: Record<string, number> = {};\n for (const col of index.columns) {\n key[col.name] = 1;\n }\n return JSON.stringify({\n action: 'createIndex',\n collection: index.table.name,\n name: index.name,\n key,\n options: { unique: index.unique, name: index.name },\n });\n }\n\n generateDropTableFromNode(table: TableNode): string {\n return JSON.stringify({ action: 'dropCollection', name: table.name });\n }\n\n generateCreateTableFromDefinition(table: TableDefinition, _options?: { ifNotExists?: boolean }): string[] {\n return [JSON.stringify({ action: 'createCollection', name: table.name })];\n }\n\n generateDropTableSql(tableName: string): string {\n return JSON.stringify({ action: 'dropCollection', name: tableName });\n }\n\n generateRenameTableSql(oldName: string, newName: string): string {\n return JSON.stringify({ action: 'renameCollection', from: oldName, to: newName });\n }\n\n generateAddColumnSql(): string {\n return '';\n }\n\n generateDropColumnSql(): string {\n return '';\n }\n\n generateRenameColumnSql(): string {\n return '';\n }\n\n generateAlterColumnSql(): string {\n return '';\n }\n\n generateCreateIndexSql(tableName: string, index: IndexSchema): string {\n return this.generateCreateIndex(tableName, index);\n }\n\n generateDropIndexSql(tableName: string, indexName: string): string {\n return this.generateDropIndex(tableName, indexName);\n }\n\n generateAddForeignKeySql(): string {\n return '';\n }\n\n generateDropForeignKeySql(): string {\n return '';\n }\n\n diffSchema<E>(entity: Type<E>, currentTable: TableNode | undefined): SchemaDiff | undefined {\n const meta = getMeta(entity);\n const collectionName = this.resolveTableName(entity, meta);\n\n if (!currentTable) {\n return { tableName: collectionName, type: 'create' };\n }\n\n const indexesToAdd: IndexSchema[] = [];\n const existingIndexes = new Set(currentTable.indexes?.map((i) => i.name) ?? []);\n\n for (const key of getKeys(meta.fields)) {\n const field = meta.fields[key];\n if (field?.index) {\n const columnName = this.resolveColumnName(key, field);\n const indexName = typeof field.index === 'string' ? field.index : `idx_${collectionName}_${columnName}`;\n if (!existingIndexes.has(indexName)) {\n indexesToAdd.push({\n name: indexName,\n columns: [columnName],\n unique: !!field.unique,\n });\n }\n }\n }\n\n if (indexesToAdd.length === 0) {\n return undefined;\n }\n\n return {\n tableName: collectionName,\n type: 'alter',\n indexesToAdd,\n };\n }\n}\n"],"names":["mergeDialectFeatures","defaults","patch","AbstractDialect","featureDefaults","options","namingStrategy","features","driverCapabilities","resolveTableName","entity","meta","name","tableName","resolveColumnName","key","field","columnName","MongoDialect","defaultDialectFeatures","explicitJsonCast","nativeArrays","supportsJsonb","returning","ifNotExists","indexIfNotExists","dropTableCascade","renameColumn","foreignKeyAlter","columnComment","vectorIndexStyle","vectorSupportsLength","supportsTimestamptz","defaultStringAsText","dialectName","insertIdStrategy","ID_KEY","VECTOR_INDEX_TYPES","Set","AGGREGATE_OP_MAP","$count","$sum","$avg","$min","$max","where","softDelete","getMeta","whereMap","buildQueryWhereAsMap","undefined","fields","filter","rawKey","rawVal","Object","entries","val","map","filterIt","id","getIdValue","Array","isArray","hasOperatorKeys","transformOperators","$in","obj","keys","some","startsWith","mapTableNameRow","row","table_name","REGEX_OP_MAP","$startsWith","wrap","v","ci","$istartsWith","$endsWith","$iendsWith","$includes","String","$iincludes","$like","replace","$ilike","NATIVE_OPS","ops","result","op","has","regexEntry","min","max","$search","select","exclude","selectedFields","normalizeScalarFieldSelection","reduce","acc","sort","raw","buildSortMap","normalized","dir","aggregationPipeline","q","relationSummary","$where","$sort","firstPipelineEntry","hasKeys","$match","pipeline","push","relKeys","getRelationRequestSummary","$populate","joinableKeys","relKey","relOpts","relations","cardinality","relEntity","relMeta","localField","references","local","$lookup","from","foreignField","as","foreign","foreignFieldName","referenceWhere","referenceSort","_id","referencePipelineEntry","$unwind","path","preserveNullAndEmptyArrays","normalizeIds","docs","doc","normalizeId","res","getKeys","dbName","value","ObjectId","e","getPersistable","payload","callbackKey","getPersistables","payloads","fillOnFields","persistableKeys","filterFieldKeys","it","buildAggregateStages","groupId","groupAccumulators","entry","parseGroupMap","$group","kind","alias","mongoOp","fieldRef","project","$project","$having","havingFilter","buildHavingFilter","$skip","$limit","having","condition","extractVectorSort","vectorKey","vectorSearch","regularSort","isVectorSearch","buildVectorSearchStage","search","limit","TypeError","colName","indexMeta","indexes","find","idx","columns","includes","type","indexName","stage","index","queryVector","$vector","numCandidates","$vectorSearch","MongoSchemaGenerator","defaultForeignKeyAction","generateCreateTable","_options","collectionName","unique","JSON","stringify","action","generateDropTable","generateAlterTable","diff","statements","indexesToAdd","length","generateCreateIndex","generateAlterTableDown","generateDropIndex","col","collection","getSqlType","fieldOptions","fieldType","getBooleanType","generateColumnDefinitions","generateColumnDefinition","generateColumnDefinitionFromSchema","generateTableConstraints","generateAlterColumnStatements","getTableOptions","generateColumnComment","formatDefaultValue","generateCreateTableFromNode","table","generateCreateIndexFromNode","generateDropTableFromNode","generateCreateTableFromDefinition","generateDropTableSql","generateRenameTableSql","oldName","newName","to","generateAddColumnSql","generateDropColumnSql","generateRenameColumnSql","generateAlterColumnSql","generateCreateIndexSql","generateDropIndexSql","generateAddForeignKeySql","generateDropForeignKeySql","diffSchema","currentTable","existingIndexes","i"],"mappings":";;;;AAUA;;AAEC,IACM,SAASA,oBAAAA,CAAqBC,QAAyB,EAAEC,KAAgC,EAAA;AAC9F,IAAA,OAAOA,KAAAA,GAAQ;AAAE,QAAA,GAAGD,QAAQ;AAAE,QAAA,GAAGC;KAAM,GAAID,QAAAA;AAC7C;AAEA;;AAEC,IACM,MAAeE,eAAAA,CAAAA;AAOpB,IAAA,WAAA,CACEC,eAAgC,EACbC,OAAAA,GAA0B,EAAE,CAC/C;aADmBA,OAAAA,GAAAA,OAAAA;AAEnB,QAAA,IAAI,CAACC,cAAc,GAAGD,OAAAA,CAAQC,cAAc;AAC5C,QAAA,IAAI,CAACC,QAAQ,GAAGP,oBAAAA,CAAqBI,eAAAA,EAAiBC,QAAQG,kBAAkB,CAAA;AAClF,IAAA;AAEA;;AAEC,MACDC,gBAAAA,CAAoBC,MAAe,EAAEC,IAAmB,EAAU;AAChE,QAAA,MAAMC,IAAAA,GAAOD,IAAAA,CAAKC,IAAI,IAAIF,O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AAAA,CAAMmM;AAClB,qBAAA,CAAA;AACF,gBAAA;AACF,YAAA;AACF,QAAA;QAEA,IAAIQ,YAAAA,CAAaC,MAAM,KAAK,CAAA,EAAG;YAC7B,OAAO1K,SAAAA;AACT,QAAA;QAEA,OAAO;YACLrC,SAAAA,EAAWqM,cAAAA;YACXZ,IAAAA,EAAM,OAAA;AACNqB,YAAAA;AACF,SAAA;AACF,IAAA;AACF;;;;"}
|
|
@@ -101,10 +101,10 @@ _dec = Id(), _dec1 = Field({
|
|
|
101
101
|
this.updatedAt = _init_updatedAt(this);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
let _Company;
|
|
105
104
|
_dec7 = Entity(), _dec8 = Field(), _dec9 = Field(), _dec10 = Field({
|
|
106
105
|
type: 'jsonb'
|
|
107
106
|
});
|
|
107
|
+
let _Company;
|
|
108
108
|
class Company extends (_BaseEntity = BaseEntity) {
|
|
109
109
|
static{
|
|
110
110
|
({ e: [_init_name, _init_description, _init_kind, _initProto1], c: [_Company, _initClass] } = _apply_decs_2203_r(this, [
|
|
@@ -134,12 +134,12 @@ class Company extends (_BaseEntity = BaseEntity) {
|
|
|
134
134
|
super(...args), this.name = (_initProto1(this), _init_name(this)), this.description = _init_description(this), this.kind = _init_kind(this);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
let _Profile;
|
|
138
137
|
_dec11 = Entity({
|
|
139
138
|
name: 'user_profile'
|
|
140
139
|
}), _dec12 = Id(), _dec13 = Field({
|
|
141
140
|
name: 'image'
|
|
142
141
|
});
|
|
142
|
+
let _Profile;
|
|
143
143
|
class Profile extends (_BaseEntity1 = BaseEntity) {
|
|
144
144
|
static{
|
|
145
145
|
({ e: [_init_pk, _init_picture, _initProto2], c: [_Profile, _initClass1] } = _apply_decs_2203_r(this, [
|
|
@@ -164,7 +164,6 @@ class Profile extends (_BaseEntity1 = BaseEntity) {
|
|
|
164
164
|
super(...args), this.pk = (_initProto2(this), _init_pk(this)), this.picture = _init_picture(this);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
let _User;
|
|
168
167
|
_dec14 = Entity(), _dec15 = Field(), _dec16 = Field({
|
|
169
168
|
updatable: false
|
|
170
169
|
}), _dec17 = Field({
|
|
@@ -177,6 +176,7 @@ _dec14 = Entity(), _dec15 = Field(), _dec16 = Field({
|
|
|
177
176
|
entity: ()=>_User,
|
|
178
177
|
mappedBy: 'creator'
|
|
179
178
|
});
|
|
179
|
+
let _User;
|
|
180
180
|
class User extends (_BaseEntity2 = BaseEntity) {
|
|
181
181
|
static{
|
|
182
182
|
({ e: [_init_name1, _init_email, _init_password, _init_profile, _init_users, _initProto3], c: [_User, _initClass2] } = _apply_decs_2203_r(this, [
|
|
@@ -216,10 +216,10 @@ class User extends (_BaseEntity2 = BaseEntity) {
|
|
|
216
216
|
super(...args), this.name = (_initProto3(this), _init_name1(this)), this.email = _init_email(this), this.password = _init_password(this), this.profile = _init_profile(this), this.users = _init_users(this);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
let _UserWithNonUpdatableId;
|
|
220
219
|
_dec20 = Entity(), _dec21 = Id({
|
|
221
220
|
updatable: false
|
|
222
221
|
}), _dec22 = Field();
|
|
222
|
+
let _UserWithNonUpdatableId;
|
|
223
223
|
class UserWithNonUpdatableId {
|
|
224
224
|
static{
|
|
225
225
|
({ e: [_init_id1, _init_name2, _initProto4], c: [_UserWithNonUpdatableId, _initClass3] } = _apply_decs_2203_r(this, [
|
|
@@ -245,10 +245,10 @@ class UserWithNonUpdatableId {
|
|
|
245
245
|
this.name = _init_name2(this);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
let _LedgerAccount;
|
|
249
248
|
_dec23 = Entity(), _dec24 = Field(), _dec25 = Field(), _dec26 = Field({
|
|
250
249
|
references: ()=>_LedgerAccount
|
|
251
250
|
}), _dec27 = ManyToOne();
|
|
251
|
+
let _LedgerAccount;
|
|
252
252
|
class LedgerAccount extends (_BaseEntity3 = BaseEntity) {
|
|
253
253
|
static{
|
|
254
254
|
({ e: [_init_name3, _init_description1, _init_parentLedgerId, _init_parentLedger, _initProto5], c: [_LedgerAccount, _initClass4] } = _apply_decs_2203_r(this, [
|
|
@@ -283,10 +283,10 @@ class LedgerAccount extends (_BaseEntity3 = BaseEntity) {
|
|
|
283
283
|
super(...args), this.name = (_initProto5(this), _init_name3(this)), this.description = _init_description1(this), this.parentLedgerId = _init_parentLedgerId(this), this.parentLedger = _init_parentLedger(this);
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
let _TaxCategory;
|
|
287
286
|
_dec28 = Entity(), _dec29 = Id({
|
|
288
287
|
onInsert: randomUUID
|
|
289
288
|
}), _dec30 = Field(), _dec31 = Field();
|
|
289
|
+
let _TaxCategory;
|
|
290
290
|
class TaxCategory extends (_BaseEntity4 = BaseEntity) {
|
|
291
291
|
static{
|
|
292
292
|
({ e: [_init_pk1, _init_name4, _init_description2, _initProto6], c: [_TaxCategory, _initClass5] } = _apply_decs_2203_r(this, [
|
|
@@ -316,10 +316,10 @@ class TaxCategory extends (_BaseEntity4 = BaseEntity) {
|
|
|
316
316
|
super(...args), this.pk = (_initProto6(this), _init_pk1(this)), this.name = _init_name4(this), this.description = _init_description2(this);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
let _Tax;
|
|
320
319
|
_dec32 = Entity(), _dec33 = Field(), _dec34 = Field(), _dec35 = Field({
|
|
321
320
|
references: ()=>_TaxCategory
|
|
322
321
|
}), _dec36 = ManyToOne(), _dec37 = Field();
|
|
322
|
+
let _Tax;
|
|
323
323
|
class Tax extends (_BaseEntity5 = BaseEntity) {
|
|
324
324
|
static{
|
|
325
325
|
({ e: [_init_name5, _init_percentage, _init_categoryId, _init_category, _init_description3, _initProto7], c: [_Tax, _initClass6] } = _apply_decs_2203_r(this, [
|
|
@@ -359,7 +359,6 @@ class Tax extends (_BaseEntity5 = BaseEntity) {
|
|
|
359
359
|
super(...args), this.name = (_initProto7(this), _init_name5(this)), this.percentage = _init_percentage(this), this.categoryId = _init_categoryId(this), this.category = _init_category(this), this.description = _init_description3(this);
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
let _MeasureUnitCategory;
|
|
363
362
|
_dec38 = Entity({
|
|
364
363
|
softDelete: true
|
|
365
364
|
}), _dec39 = Field(), _dec40 = OneToMany({
|
|
@@ -368,6 +367,7 @@ _dec38 = Entity({
|
|
|
368
367
|
}), _dec41 = Field({
|
|
369
368
|
onDelete: Date.now
|
|
370
369
|
});
|
|
370
|
+
let _MeasureUnitCategory;
|
|
371
371
|
class MeasureUnitCategory extends (_BaseEntity6 = BaseEntity) {
|
|
372
372
|
static{
|
|
373
373
|
({ e: [_init_name6, _init_measureUnits, _init_deletedAt, _initProto8], c: [_MeasureUnitCategory, _initClass7] } = _apply_decs_2203_r(this, [
|
|
@@ -397,7 +397,6 @@ class MeasureUnitCategory extends (_BaseEntity6 = BaseEntity) {
|
|
|
397
397
|
super(...args), this.name = (_initProto8(this), _init_name6(this)), this.measureUnits = _init_measureUnits(this), this.deletedAt = _init_deletedAt(this);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
let _MeasureUnit;
|
|
401
400
|
_dec42 = Entity({
|
|
402
401
|
softDelete: true
|
|
403
402
|
}), _dec43 = Field(), _dec44 = Field({
|
|
@@ -407,6 +406,7 @@ _dec42 = Entity({
|
|
|
407
406
|
}), _dec46 = Field({
|
|
408
407
|
onDelete: Date.now
|
|
409
408
|
});
|
|
409
|
+
let _MeasureUnit;
|
|
410
410
|
class MeasureUnit extends (_BaseEntity7 = BaseEntity) {
|
|
411
411
|
static{
|
|
412
412
|
({ e: [_init_name7, _init_categoryId1, _init_category1, _init_deletedAt1, _initProto9], c: [_MeasureUnit, _initClass8] } = _apply_decs_2203_r(this, [
|
|
@@ -441,8 +441,8 @@ class MeasureUnit extends (_BaseEntity7 = BaseEntity) {
|
|
|
441
441
|
super(...args), this.name = (_initProto9(this), _init_name7(this)), this.categoryId = _init_categoryId1(this), this.category = _init_category1(this), this.deletedAt = _init_deletedAt1(this);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
let _Storehouse;
|
|
445
444
|
_dec47 = Entity(), _dec48 = Field(), _dec49 = Field(), _dec50 = Field();
|
|
445
|
+
let _Storehouse;
|
|
446
446
|
class Storehouse extends (_BaseEntity8 = BaseEntity) {
|
|
447
447
|
static{
|
|
448
448
|
({ e: [_init_name8, _init_address, _init_description4, _initProto10], c: [_Storehouse, _initClass9] } = _apply_decs_2203_r(this, [
|
|
@@ -472,7 +472,6 @@ class Storehouse extends (_BaseEntity8 = BaseEntity) {
|
|
|
472
472
|
super(...args), this.name = (_initProto10(this), _init_name8(this)), this.address = _init_address(this), this.description = _init_description4(this);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
let _Item;
|
|
476
475
|
_dec51 = Entity(), _dec52 = Field(), _dec53 = Field(), _dec54 = Field(), _dec55 = Field({
|
|
477
476
|
references: ()=>_LedgerAccount
|
|
478
477
|
}), _dec56 = ManyToOne(), _dec57 = Field({
|
|
@@ -505,6 +504,7 @@ _dec51 = Entity(), _dec52 = Field(), _dec53 = Field(), _dec54 = Field(), _dec55
|
|
|
505
504
|
ctx.append(')');
|
|
506
505
|
})
|
|
507
506
|
});
|
|
507
|
+
let _Item;
|
|
508
508
|
class Item extends (_BaseEntity9 = BaseEntity) {
|
|
509
509
|
static{
|
|
510
510
|
({ e: [_init_name9, _init_description5, _init_code, _init_buyLedgerAccountId, _init_buyLedgerAccount, _init_saleLedgerAccountId, _init_saleLedgerAccount, _init_taxId, _init_tax, _init_measureUnitId, _init_measureUnit, _init_salePrice, _init_inventoryable, _init_tags, _init_tagsCount, _initProto11], c: [_Item, _initClass10] } = _apply_decs_2203_r(this, [
|
|
@@ -594,7 +594,6 @@ class Item extends (_BaseEntity9 = BaseEntity) {
|
|
|
594
594
|
super(...args), this.name = (_initProto11(this), _init_name9(this)), this.description = _init_description5(this), this.code = _init_code(this), this.buyLedgerAccountId = _init_buyLedgerAccountId(this), this.buyLedgerAccount = _init_buyLedgerAccount(this), this.saleLedgerAccountId = _init_saleLedgerAccountId(this), this.saleLedgerAccount = _init_saleLedgerAccount(this), this.taxId = _init_taxId(this), this.tax = _init_tax(this), this.measureUnitId = _init_measureUnitId(this), this.measureUnit = _init_measureUnit(this), this.salePrice = _init_salePrice(this), this.inventoryable = _init_inventoryable(this), this.tags = _init_tags(this), this.tagsCount = _init_tagsCount(this);
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
let _Tag;
|
|
598
597
|
_dec67 = Entity(), _dec68 = Field(), _dec69 = ManyToMany({
|
|
599
598
|
entity: ()=>_Item,
|
|
600
599
|
mappedBy: (item)=>item.tags
|
|
@@ -613,6 +612,7 @@ _dec67 = Entity(), _dec68 = Field(), _dec69 = ManyToMany({
|
|
|
613
612
|
ctx.append(')');
|
|
614
613
|
})
|
|
615
614
|
});
|
|
615
|
+
let _Tag;
|
|
616
616
|
class Tag extends (_BaseEntity10 = BaseEntity) {
|
|
617
617
|
static{
|
|
618
618
|
({ e: [_init_name10, _init_items, _init_itemsCount, _initProto12], c: [_Tag, _initClass11] } = _apply_decs_2203_r(this, [
|
|
@@ -642,12 +642,12 @@ class Tag extends (_BaseEntity10 = BaseEntity) {
|
|
|
642
642
|
super(...args), this.name = (_initProto12(this), _init_name10(this)), this.items = _init_items(this), this.itemsCount = _init_itemsCount(this);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
let _ItemTag;
|
|
646
645
|
_dec71 = Entity(), _dec72 = Id(), _dec73 = Field({
|
|
647
646
|
references: ()=>_Item
|
|
648
647
|
}), _dec74 = Field({
|
|
649
648
|
references: ()=>_Tag
|
|
650
649
|
});
|
|
650
|
+
let _ItemTag;
|
|
651
651
|
class ItemTag {
|
|
652
652
|
static{
|
|
653
653
|
({ e: [_init_id2, _init_itemId, _init_tagId, _initProto13], c: [_ItemTag, _initClass12] } = _apply_decs_2203_r(this, [
|
|
@@ -679,12 +679,12 @@ class ItemTag {
|
|
|
679
679
|
this.tagId = _init_tagId(this);
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
|
-
let _InventoryAdjustment;
|
|
683
682
|
_dec75 = Entity(), _dec76 = OneToMany({
|
|
684
683
|
entity: ()=>_ItemAdjustment,
|
|
685
684
|
mappedBy: (rel)=>rel.inventoryAdjustment,
|
|
686
685
|
cascade: true
|
|
687
686
|
}), _dec77 = Field(), _dec78 = Field();
|
|
687
|
+
let _InventoryAdjustment;
|
|
688
688
|
class InventoryAdjustment extends (_BaseEntity11 = BaseEntity) {
|
|
689
689
|
static{
|
|
690
690
|
({ e: [_init_itemAdjustments, _init_date, _init_description6, _initProto14], c: [_InventoryAdjustment, _initClass13] } = _apply_decs_2203_r(this, [
|
|
@@ -714,7 +714,6 @@ class InventoryAdjustment extends (_BaseEntity11 = BaseEntity) {
|
|
|
714
714
|
super(...args), this.itemAdjustments = (_initProto14(this), _init_itemAdjustments(this)), this.date = _init_date(this), this.description = _init_description6(this);
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
-
let _ItemAdjustment;
|
|
718
717
|
_dec79 = Entity(), _dec80 = Field({
|
|
719
718
|
references: ()=>_Item
|
|
720
719
|
}), _dec81 = ManyToOne(), _dec82 = Field(), _dec83 = Field(), _dec84 = Field({
|
|
@@ -722,6 +721,7 @@ _dec79 = Entity(), _dec80 = Field({
|
|
|
722
721
|
}), _dec85 = ManyToOne(), _dec86 = Field({
|
|
723
722
|
references: ()=>_InventoryAdjustment
|
|
724
723
|
}), _dec87 = ManyToOne();
|
|
724
|
+
let _ItemAdjustment;
|
|
725
725
|
class ItemAdjustment extends (_BaseEntity12 = BaseEntity) {
|
|
726
726
|
static{
|
|
727
727
|
({ e: [_init_itemId1, _init_item, _init_number, _init_buyPrice, _init_storehouseId, _init_storehouse, _init_inventoryAdjustmentId, _init_inventoryAdjustment, _initProto15], c: [_ItemAdjustment, _initClass14] } = _apply_decs_2203_r(this, [
|
|
@@ -776,11 +776,11 @@ class ItemAdjustment extends (_BaseEntity12 = BaseEntity) {
|
|
|
776
776
|
super(...args), this.itemId = (_initProto15(this), _init_itemId1(this)), this.item = _init_item(this), this.number = _init_number(this), this.buyPrice = _init_buyPrice(this), this.storehouseId = _init_storehouseId(this), this.storehouse = _init_storehouse(this), this.inventoryAdjustmentId = _init_inventoryAdjustmentId(this), this.inventoryAdjustment = _init_inventoryAdjustment(this);
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
let _VectorItem;
|
|
780
779
|
_dec88 = Entity(), _dec89 = Id(), _dec90 = Field(), _dec91 = Field({
|
|
781
780
|
type: 'vector',
|
|
782
781
|
dimensions: 3
|
|
783
782
|
});
|
|
783
|
+
let _VectorItem;
|
|
784
784
|
class VectorItem {
|
|
785
785
|
static{
|
|
786
786
|
({ e: [_init_id3, _init_name11, _init_vec, _initProto16], c: [_VectorItem, _initClass15] } = _apply_decs_2203_r(this, [
|
|
@@ -3935,7 +3935,7 @@ function withFixtures(fn, options) {
|
|
|
3935
3935
|
const usedFixtures = [];
|
|
3936
3936
|
const usedProps = getUsedProps(fn);
|
|
3937
3937
|
for (const fixture of registrations.values()){
|
|
3938
|
-
if (fixture
|
|
3938
|
+
if (isAutoFixture(fixture, options) || usedProps.has(fixture.name)) {
|
|
3939
3939
|
usedFixtures.push(fixture);
|
|
3940
3940
|
}
|
|
3941
3941
|
}
|
|
@@ -3995,6 +3995,16 @@ function withFixtures(fn, options) {
|
|
|
3995
3995
|
return fn(context);
|
|
3996
3996
|
};
|
|
3997
3997
|
}
|
|
3998
|
+
function isAutoFixture(fixture, options) {
|
|
3999
|
+
if (!fixture.auto) {
|
|
4000
|
+
return false;
|
|
4001
|
+
}
|
|
4002
|
+
// suite hook doesn't automatically trigger unused test-scoped fixtures.
|
|
4003
|
+
if (options?.suiteHook && fixture.scope === "test") {
|
|
4004
|
+
return false;
|
|
4005
|
+
}
|
|
4006
|
+
return true;
|
|
4007
|
+
}
|
|
3998
4008
|
function isFixtureFunction(value) {
|
|
3999
4009
|
return typeof value === "function";
|
|
4000
4010
|
}
|
|
@@ -5578,10 +5588,16 @@ function encodeUint8Array(bytes) {
|
|
|
5578
5588
|
if (attachment.body && attachment.path) {
|
|
5579
5589
|
throw new TypeError(`Test attachment requires only one of "body" or "path" to be set. Both are specified.`);
|
|
5580
5590
|
}
|
|
5591
|
+
if (attachment.path && attachment.bodyEncoding) {
|
|
5592
|
+
throw new TypeError(`Test attachment with "path" should not have "bodyEncoding" specified.`);
|
|
5593
|
+
}
|
|
5581
5594
|
// convert to a string so it's easier to serialise
|
|
5582
5595
|
if (attachment.body instanceof Uint8Array) {
|
|
5583
5596
|
attachment.body = encodeUint8Array(attachment.body);
|
|
5584
5597
|
}
|
|
5598
|
+
if (attachment.body != null) {
|
|
5599
|
+
attachment.bodyEncoding ??= "base64";
|
|
5600
|
+
}
|
|
5585
5601
|
}
|
|
5586
5602
|
|
|
5587
5603
|
function createSpec(spec) {
|