@mikro-orm/sql 7.0.2-dev.8 → 7.0.2
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/AbstractSqlConnection.d.ts +95 -47
- package/AbstractSqlConnection.js +240 -232
- package/AbstractSqlDriver.d.ts +412 -155
- package/AbstractSqlDriver.js +2062 -1937
- package/AbstractSqlPlatform.d.ts +84 -73
- package/AbstractSqlPlatform.js +163 -158
- package/PivotCollectionPersister.d.ts +33 -15
- package/PivotCollectionPersister.js +158 -160
- package/README.md +128 -294
- package/SqlEntityManager.d.ts +68 -20
- package/SqlEntityManager.js +54 -37
- package/SqlEntityRepository.d.ts +15 -14
- package/SqlEntityRepository.js +24 -23
- package/dialects/mssql/MsSqlNativeQueryBuilder.d.ts +12 -12
- package/dialects/mssql/MsSqlNativeQueryBuilder.js +192 -194
- package/dialects/mysql/BaseMySqlPlatform.d.ts +64 -45
- package/dialects/mysql/BaseMySqlPlatform.js +134 -131
- package/dialects/mysql/MySqlExceptionConverter.d.ts +6 -6
- package/dialects/mysql/MySqlExceptionConverter.js +91 -77
- package/dialects/mysql/MySqlNativeQueryBuilder.d.ts +3 -3
- package/dialects/mysql/MySqlNativeQueryBuilder.js +66 -69
- package/dialects/mysql/MySqlSchemaHelper.d.ts +39 -39
- package/dialects/mysql/MySqlSchemaHelper.js +327 -319
- package/dialects/oracledb/OracleDialect.d.ts +81 -52
- package/dialects/oracledb/OracleDialect.js +155 -149
- package/dialects/oracledb/OracleNativeQueryBuilder.d.ts +12 -12
- package/dialects/oracledb/OracleNativeQueryBuilder.js +232 -236
- package/dialects/postgresql/BasePostgreSqlPlatform.d.ts +108 -105
- package/dialects/postgresql/BasePostgreSqlPlatform.js +351 -350
- package/dialects/postgresql/FullTextType.d.ts +10 -6
- package/dialects/postgresql/FullTextType.js +51 -51
- package/dialects/postgresql/PostgreSqlExceptionConverter.d.ts +5 -5
- package/dialects/postgresql/PostgreSqlExceptionConverter.js +55 -43
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.d.ts +1 -1
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.js +4 -4
- package/dialects/postgresql/PostgreSqlSchemaHelper.d.ts +102 -82
- package/dialects/postgresql/PostgreSqlSchemaHelper.js +711 -683
- package/dialects/sqlite/BaseSqliteConnection.d.ts +3 -5
- package/dialects/sqlite/BaseSqliteConnection.js +21 -19
- package/dialects/sqlite/NodeSqliteDialect.d.ts +1 -1
- package/dialects/sqlite/NodeSqliteDialect.js +23 -23
- package/dialects/sqlite/SqliteDriver.d.ts +1 -1
- package/dialects/sqlite/SqliteDriver.js +3 -3
- package/dialects/sqlite/SqliteExceptionConverter.d.ts +6 -6
- package/dialects/sqlite/SqliteExceptionConverter.js +67 -51
- package/dialects/sqlite/SqliteNativeQueryBuilder.d.ts +2 -2
- package/dialects/sqlite/SqliteNativeQueryBuilder.js +7 -7
- package/dialects/sqlite/SqlitePlatform.d.ts +63 -72
- package/dialects/sqlite/SqlitePlatform.js +139 -139
- package/dialects/sqlite/SqliteSchemaHelper.d.ts +70 -60
- package/dialects/sqlite/SqliteSchemaHelper.js +533 -520
- package/package.json +4 -4
- package/plugin/index.d.ts +44 -35
- package/plugin/index.js +44 -36
- package/plugin/transformer.d.ts +117 -94
- package/plugin/transformer.js +890 -881
- package/query/ArrayCriteriaNode.d.ts +4 -4
- package/query/ArrayCriteriaNode.js +18 -18
- package/query/CriteriaNode.d.ts +35 -25
- package/query/CriteriaNode.js +133 -123
- package/query/CriteriaNodeFactory.d.ts +49 -6
- package/query/CriteriaNodeFactory.js +97 -94
- package/query/NativeQueryBuilder.d.ts +120 -117
- package/query/NativeQueryBuilder.js +484 -480
- package/query/ObjectCriteriaNode.d.ts +12 -12
- package/query/ObjectCriteriaNode.js +298 -282
- package/query/QueryBuilder.d.ts +1546 -904
- package/query/QueryBuilder.js +2270 -2145
- package/query/QueryBuilderHelper.d.ts +153 -72
- package/query/QueryBuilderHelper.js +1079 -1028
- package/query/ScalarCriteriaNode.d.ts +3 -3
- package/query/ScalarCriteriaNode.js +53 -46
- package/query/enums.d.ts +16 -14
- package/query/enums.js +16 -14
- package/query/raw.d.ts +16 -6
- package/query/raw.js +10 -10
- package/schema/DatabaseSchema.d.ts +73 -50
- package/schema/DatabaseSchema.js +331 -307
- package/schema/DatabaseTable.d.ts +96 -73
- package/schema/DatabaseTable.js +1012 -927
- package/schema/SchemaComparator.d.ts +58 -54
- package/schema/SchemaComparator.js +745 -719
- package/schema/SchemaHelper.d.ts +110 -80
- package/schema/SchemaHelper.js +676 -645
- package/schema/SqlSchemaGenerator.d.ts +79 -58
- package/schema/SqlSchemaGenerator.js +536 -501
- package/typings.d.ts +380 -266
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.0.2
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"copy": "node ../../scripts/copy.mjs"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"kysely": "0.28.
|
|
50
|
+
"kysely": "0.28.12"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@mikro-orm/core": "^7.0.
|
|
53
|
+
"@mikro-orm/core": "^7.0.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.0.2
|
|
56
|
+
"@mikro-orm/core": "7.0.2"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|
package/plugin/index.d.ts
CHANGED
|
@@ -1,40 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type KyselyPlugin,
|
|
3
|
+
type PluginTransformQueryArgs,
|
|
4
|
+
type PluginTransformResultArgs,
|
|
5
|
+
type QueryResult,
|
|
6
|
+
type RootOperationNode,
|
|
7
|
+
type UnknownRow,
|
|
8
|
+
} from 'kysely';
|
|
2
9
|
import type { SqlEntityManager } from '../SqlEntityManager.js';
|
|
10
|
+
/** Configuration options for the MikroKyselyPlugin. */
|
|
3
11
|
export interface MikroKyselyPluginOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Use database table names ('table') or entity names ('entity') in queries.
|
|
14
|
+
*
|
|
15
|
+
* @default 'table'
|
|
16
|
+
*/
|
|
17
|
+
tableNamingStrategy?: 'table' | 'entity';
|
|
18
|
+
/**
|
|
19
|
+
* Use database column names ('column') or property names ('property') in queries.
|
|
20
|
+
*
|
|
21
|
+
* @default 'column'
|
|
22
|
+
*/
|
|
23
|
+
columnNamingStrategy?: 'column' | 'property';
|
|
24
|
+
/**
|
|
25
|
+
* Automatically process entity `onCreate` hooks in INSERT queries.
|
|
26
|
+
*
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
processOnCreateHooks?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Automatically process entity `onUpdate` hooks in UPDATE queries.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
processOnUpdateHooks?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Convert JavaScript values to database-compatible values (e.g., Date to timestamp, custom types).
|
|
38
|
+
*
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
convertValues?: boolean;
|
|
34
42
|
}
|
|
43
|
+
/** Kysely plugin that transforms queries and results to use MikroORM entity/property naming conventions. */
|
|
35
44
|
export declare class MikroKyselyPlugin implements KyselyPlugin {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
#private;
|
|
46
|
+
constructor(em: SqlEntityManager, options?: MikroKyselyPluginOptions);
|
|
47
|
+
transformQuery(args: PluginTransformQueryArgs): RootOperationNode;
|
|
48
|
+
transformResult(args: PluginTransformResultArgs): Promise<QueryResult<UnknownRow>>;
|
|
40
49
|
}
|
package/plugin/index.js
CHANGED
|
@@ -1,42 +1,50 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
SelectQueryNode as SelectQueryNodeClass,
|
|
3
|
+
InsertQueryNode as InsertQueryNodeClass,
|
|
4
|
+
UpdateQueryNode as UpdateQueryNodeClass,
|
|
5
|
+
DeleteQueryNode as DeleteQueryNodeClass,
|
|
6
|
+
} from 'kysely';
|
|
2
7
|
import { MikroTransformer } from './transformer.js';
|
|
8
|
+
/** Kysely plugin that transforms queries and results to use MikroORM entity/property naming conventions. */
|
|
3
9
|
export class MikroKyselyPlugin {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
static #queryNodeCache = new WeakMap();
|
|
11
|
+
#transformer;
|
|
12
|
+
#options;
|
|
13
|
+
constructor(em, options = {}) {
|
|
14
|
+
this.#options = options;
|
|
15
|
+
this.#transformer = new MikroTransformer(em, options);
|
|
16
|
+
}
|
|
17
|
+
transformQuery(args) {
|
|
18
|
+
this.#transformer.reset();
|
|
19
|
+
const result = this.#transformer.transformNode(args.node, args.queryId);
|
|
20
|
+
// Cache the entity map if it is one we can process (for use in transformResult)
|
|
21
|
+
if (
|
|
22
|
+
SelectQueryNodeClass.is(args.node) ||
|
|
23
|
+
InsertQueryNodeClass.is(args.node) ||
|
|
24
|
+
UpdateQueryNodeClass.is(args.node) ||
|
|
25
|
+
DeleteQueryNodeClass.is(args.node)
|
|
26
|
+
) {
|
|
27
|
+
// clone the entityMap because the transformer's internal map will be cleared and reused by the next query
|
|
28
|
+
const entityMap = new Map(this.#transformer.getOutputEntityMap());
|
|
29
|
+
MikroKyselyPlugin.#queryNodeCache.set(args.queryId, { entityMap });
|
|
10
30
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
UpdateQueryNodeClass.is(args.node) ||
|
|
18
|
-
DeleteQueryNodeClass.is(args.node)) {
|
|
19
|
-
// clone the entityMap because the transformer's internal map will be cleared and reused by the next query
|
|
20
|
-
const entityMap = new Map(this.#transformer.getOutputEntityMap());
|
|
21
|
-
MikroKyselyPlugin.#queryNodeCache.set(args.queryId, { entityMap });
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
async transformResult(args) {
|
|
34
|
+
// Only transform results if columnNamingStrategy is 'property' or convertValues is true
|
|
35
|
+
if (this.#options.columnNamingStrategy !== 'property' && !this.#options.convertValues) {
|
|
36
|
+
return args.result;
|
|
24
37
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
// Retrieve the cached query node and metadata
|
|
31
|
-
const cache = MikroKyselyPlugin.#queryNodeCache.get(args.queryId);
|
|
32
|
-
if (!cache) {
|
|
33
|
-
return args.result;
|
|
34
|
-
}
|
|
35
|
-
// Transform the result rows using the transformer
|
|
36
|
-
const transformedRows = this.#transformer.transformResult(args.result.rows ?? [], cache.entityMap);
|
|
37
|
-
return {
|
|
38
|
-
...args.result,
|
|
39
|
-
rows: transformedRows ?? [],
|
|
40
|
-
};
|
|
38
|
+
// Retrieve the cached query node and metadata
|
|
39
|
+
const cache = MikroKyselyPlugin.#queryNodeCache.get(args.queryId);
|
|
40
|
+
if (!cache) {
|
|
41
|
+
return args.result;
|
|
41
42
|
}
|
|
43
|
+
// Transform the result rows using the transformer
|
|
44
|
+
const transformedRows = this.#transformer.transformResult(args.result.rows ?? [], cache.entityMap);
|
|
45
|
+
return {
|
|
46
|
+
...args.result,
|
|
47
|
+
rows: transformedRows ?? [],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
42
50
|
}
|
package/plugin/transformer.d.ts
CHANGED
|
@@ -1,99 +1,122 @@
|
|
|
1
1
|
import { type EntityMetadata, type EntityProperty } from '@mikro-orm/core';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type CommonTableExpressionNameNode,
|
|
4
|
+
type DeleteQueryNode,
|
|
5
|
+
type IdentifierNode,
|
|
6
|
+
type InsertQueryNode,
|
|
7
|
+
type JoinNode,
|
|
8
|
+
type MergeQueryNode,
|
|
9
|
+
type QueryId,
|
|
10
|
+
type SelectQueryNode,
|
|
11
|
+
type UpdateQueryNode,
|
|
12
|
+
type WithNode,
|
|
13
|
+
ColumnNode,
|
|
14
|
+
OperationNodeTransformer,
|
|
15
|
+
TableNode,
|
|
16
|
+
} from 'kysely';
|
|
3
17
|
import type { MikroKyselyPluginOptions } from './index.js';
|
|
4
18
|
import type { SqlEntityManager } from '../SqlEntityManager.js';
|
|
5
19
|
export declare class MikroTransformer extends OperationNodeTransformer {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
20
|
+
#private;
|
|
21
|
+
constructor(em: SqlEntityManager, options?: MikroKyselyPluginOptions);
|
|
22
|
+
reset(): void;
|
|
23
|
+
getOutputEntityMap(): Map<string, EntityMetadata>;
|
|
24
|
+
/** @internal */
|
|
25
|
+
getContextStack(): Map<string, EntityMetadata | undefined>[];
|
|
26
|
+
/** @internal */
|
|
27
|
+
getSubqueryAliasMap(): Map<string, EntityMetadata | undefined>;
|
|
28
|
+
transformSelectQuery(node: SelectQueryNode, queryId: QueryId): SelectQueryNode;
|
|
29
|
+
transformInsertQuery(node: InsertQueryNode, queryId?: QueryId): InsertQueryNode;
|
|
30
|
+
transformUpdateQuery(node: UpdateQueryNode, queryId?: QueryId): UpdateQueryNode;
|
|
31
|
+
transformDeleteQuery(node: DeleteQueryNode, queryId?: QueryId): DeleteQueryNode;
|
|
32
|
+
transformMergeQuery(node: MergeQueryNode, queryId?: QueryId): MergeQueryNode;
|
|
33
|
+
transformIdentifier(node: IdentifierNode, queryId: QueryId): IdentifierNode;
|
|
34
|
+
/**
|
|
35
|
+
* Find owner entity metadata for the current identifier in the context stack.
|
|
36
|
+
* Supports both aliased and non-aliased table references.
|
|
37
|
+
* Searches up the context stack to support correlated subqueries.
|
|
38
|
+
* Also checks subquery/CTE aliases to resolve to their source tables.
|
|
39
|
+
*/
|
|
40
|
+
findOwnerEntityInContext(): EntityMetadata | undefined;
|
|
41
|
+
processOnCreateHooks(node: InsertQueryNode, meta: EntityMetadata): InsertQueryNode;
|
|
42
|
+
processOnUpdateHooks(node: UpdateQueryNode, meta: EntityMetadata): UpdateQueryNode;
|
|
43
|
+
processInsertValues(node: InsertQueryNode, meta: EntityMetadata): InsertQueryNode;
|
|
44
|
+
processUpdateValues(node: UpdateQueryNode, meta: EntityMetadata): UpdateQueryNode;
|
|
45
|
+
mapColumnsToProperties(columns: readonly ColumnNode[], meta: EntityMetadata): (EntityProperty | undefined)[];
|
|
46
|
+
normalizeColumnName(identifier: IdentifierNode): string;
|
|
47
|
+
findProperty(meta: EntityMetadata | undefined, columnName?: string): EntityProperty | undefined;
|
|
48
|
+
shouldConvertValues(): boolean;
|
|
49
|
+
prepareInputValue(prop: EntityProperty | undefined, value: unknown, enabled: boolean): unknown;
|
|
50
|
+
/**
|
|
51
|
+
* Look up a table name/alias in the context stack.
|
|
52
|
+
* Searches from current scope (top of stack) to parent scopes (bottom).
|
|
53
|
+
* This supports correlated subqueries and references to outer query tables.
|
|
54
|
+
*/
|
|
55
|
+
lookupInContextStack(tableNameOrAlias: string): EntityMetadata | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Process WITH node (CTE definitions)
|
|
58
|
+
*/
|
|
59
|
+
processWithNode(withNode: WithNode, context: Map<string, EntityMetadata | undefined>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Extract CTE name from CommonTableExpressionNameNode
|
|
62
|
+
*/
|
|
63
|
+
getCTEName(nameNode: CommonTableExpressionNameNode): string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Process a FROM item (can be TableNode or AliasNode)
|
|
66
|
+
*/
|
|
67
|
+
processFromItem(
|
|
68
|
+
from: any, // OperationNode type - can be TableNode, AliasNode, or SelectQueryNode
|
|
69
|
+
context: Map<string, EntityMetadata | undefined>,
|
|
70
|
+
): void;
|
|
71
|
+
/**
|
|
72
|
+
* Process a JOIN node
|
|
73
|
+
*/
|
|
74
|
+
processJoinNode(join: JoinNode, context: Map<string, EntityMetadata | undefined>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Extract the primary source table from a SELECT query
|
|
77
|
+
* This helps resolve columns from subqueries to their original entity tables
|
|
78
|
+
*/
|
|
79
|
+
extractSourceTableFromSelectQuery(selectQuery: SelectQueryNode): EntityMetadata | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Extract alias name from an alias node
|
|
82
|
+
*/
|
|
83
|
+
extractAliasName(alias: any): string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Extract table name from a TableNode
|
|
86
|
+
*/
|
|
87
|
+
getTableName(node: TableNode | undefined): string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Find entity metadata by table name or entity name
|
|
90
|
+
*/
|
|
91
|
+
findEntityMetadata(name: string): EntityMetadata | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Transform result rows by mapping database column names to property names
|
|
94
|
+
* This is called for SELECT queries when columnNamingStrategy is 'property'
|
|
95
|
+
*/
|
|
96
|
+
transformResult(
|
|
97
|
+
rows: Record<string, any>[] | undefined,
|
|
98
|
+
entityMap: Map<string, EntityMetadata>,
|
|
99
|
+
): Record<string, any>[] | undefined;
|
|
100
|
+
buildGlobalFieldMap(entityMap: Map<string, EntityMetadata>): Record<string, EntityProperty>;
|
|
101
|
+
buildGlobalRelationFieldMap(entityMap: Map<string, EntityMetadata>): Record<string, string>;
|
|
102
|
+
/**
|
|
103
|
+
* Build a mapping from database field names to property objects
|
|
104
|
+
* Format: { 'field_name': EntityProperty }
|
|
105
|
+
*/
|
|
106
|
+
buildFieldToPropertyMap(meta: EntityMetadata, alias?: string): Record<string, EntityProperty>;
|
|
107
|
+
/**
|
|
108
|
+
* Build a mapping for relation fields
|
|
109
|
+
* For ManyToOne relations, we need to map from the foreign key field to the relation property
|
|
110
|
+
* Format: { 'foreign_key_field': 'relationPropertyName' }
|
|
111
|
+
*/
|
|
112
|
+
buildRelationFieldMap(meta: EntityMetadata, alias?: string): Record<string, string>;
|
|
113
|
+
/**
|
|
114
|
+
* Transform a single row by mapping column names to property names
|
|
115
|
+
*/
|
|
116
|
+
transformRow(
|
|
117
|
+
row: Record<string, any>,
|
|
118
|
+
fieldToPropertyMap: Record<string, EntityProperty>,
|
|
119
|
+
relationFieldMap: Record<string, string>,
|
|
120
|
+
): Record<string, any>;
|
|
121
|
+
prepareOutputValue(prop: EntityProperty | undefined, value: unknown): unknown;
|
|
99
122
|
}
|