metal-orm 1.0.14 → 1.0.16
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/README.md +69 -67
- package/dist/decorators/index.cjs +1983 -224
- package/dist/decorators/index.cjs.map +1 -1
- package/dist/decorators/index.d.cts +6 -6
- package/dist/decorators/index.d.ts +6 -6
- package/dist/decorators/index.js +1982 -224
- package/dist/decorators/index.js.map +1 -1
- package/dist/index.cjs +5284 -3751
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +524 -169
- package/dist/index.d.ts +524 -169
- package/dist/index.js +5197 -3736
- package/dist/index.js.map +1 -1
- package/dist/{select-CCp1oz9p.d.cts → select-BKZrMRCQ.d.cts} +555 -94
- package/dist/{select-CCp1oz9p.d.ts → select-BKZrMRCQ.d.ts} +555 -94
- package/package.json +1 -1
- package/src/codegen/naming-strategy.ts +64 -0
- package/src/codegen/typescript.ts +19 -21
- package/src/core/ast/adapters.ts +21 -0
- package/src/core/ast/aggregate-functions.ts +13 -13
- package/src/core/ast/builders.ts +56 -43
- package/src/core/ast/expression-builders.ts +34 -34
- package/src/core/ast/expression-nodes.ts +18 -16
- package/src/core/ast/expression-visitor.ts +122 -69
- package/src/core/ast/expression.ts +6 -4
- package/src/core/ast/join-metadata.ts +15 -0
- package/src/core/ast/join-node.ts +22 -20
- package/src/core/ast/join.ts +5 -5
- package/src/core/ast/query.ts +52 -88
- package/src/core/ast/types.ts +20 -0
- package/src/core/ast/window-functions.ts +55 -55
- package/src/core/ddl/dialects/base-schema-dialect.ts +20 -6
- package/src/core/ddl/dialects/mssql-schema-dialect.ts +32 -8
- package/src/core/ddl/dialects/mysql-schema-dialect.ts +21 -10
- package/src/core/ddl/dialects/postgres-schema-dialect.ts +52 -7
- package/src/core/ddl/dialects/sqlite-schema-dialect.ts +23 -9
- package/src/core/ddl/introspect/catalogs/index.ts +1 -0
- package/src/core/ddl/introspect/catalogs/postgres.ts +143 -0
- package/src/core/ddl/introspect/context.ts +9 -0
- package/src/core/ddl/introspect/functions/postgres.ts +26 -0
- package/src/core/ddl/introspect/mssql.ts +149 -149
- package/src/core/ddl/introspect/mysql.ts +99 -99
- package/src/core/ddl/introspect/postgres.ts +245 -154
- package/src/core/ddl/introspect/registry.ts +26 -0
- package/src/core/ddl/introspect/run-select.ts +25 -0
- package/src/core/ddl/introspect/sqlite.ts +7 -7
- package/src/core/ddl/introspect/types.ts +23 -19
- package/src/core/ddl/introspect/utils.ts +1 -1
- package/src/core/ddl/naming-strategy.ts +10 -0
- package/src/core/ddl/schema-dialect.ts +41 -0
- package/src/core/ddl/schema-diff.ts +211 -179
- package/src/core/ddl/schema-generator.ts +17 -90
- package/src/core/ddl/schema-introspect.ts +25 -32
- package/src/core/ddl/schema-plan-executor.ts +17 -0
- package/src/core/ddl/schema-types.ts +46 -39
- package/src/core/ddl/sql-writing.ts +170 -0
- package/src/core/dialect/abstract.ts +172 -126
- package/src/core/dialect/base/cte-compiler.ts +33 -0
- package/src/core/dialect/base/function-table-formatter.ts +132 -0
- package/src/core/dialect/base/groupby-compiler.ts +21 -0
- package/src/core/dialect/base/join-compiler.ts +26 -0
- package/src/core/dialect/base/orderby-compiler.ts +21 -0
- package/src/core/dialect/base/pagination-strategy.ts +32 -0
- package/src/core/dialect/base/returning-strategy.ts +56 -0
- package/src/core/dialect/base/sql-dialect.ts +181 -204
- package/src/core/dialect/dialect-factory.ts +91 -0
- package/src/core/dialect/mssql/functions.ts +101 -0
- package/src/core/dialect/mssql/index.ts +128 -126
- package/src/core/dialect/mysql/functions.ts +101 -0
- package/src/core/dialect/mysql/index.ts +20 -18
- package/src/core/dialect/postgres/functions.ts +95 -0
- package/src/core/dialect/postgres/index.ts +30 -28
- package/src/core/dialect/sqlite/functions.ts +115 -0
- package/src/core/dialect/sqlite/index.ts +30 -28
- package/src/core/driver/database-driver.ts +11 -0
- package/src/core/driver/mssql-driver.ts +20 -0
- package/src/core/driver/mysql-driver.ts +20 -0
- package/src/core/driver/postgres-driver.ts +20 -0
- package/src/core/driver/sqlite-driver.ts +20 -0
- package/src/core/execution/db-executor.ts +63 -0
- package/src/core/execution/executors/mssql-executor.ts +39 -0
- package/src/core/execution/executors/mysql-executor.ts +47 -0
- package/src/core/execution/executors/postgres-executor.ts +32 -0
- package/src/core/execution/executors/sqlite-executor.ts +31 -0
- package/src/core/functions/datetime.ts +132 -0
- package/src/core/functions/numeric.ts +179 -0
- package/src/core/functions/standard-strategy.ts +47 -0
- package/src/core/functions/text.ts +147 -0
- package/src/core/functions/types.ts +18 -0
- package/src/core/hydration/types.ts +57 -0
- package/src/decorators/bootstrap.ts +10 -0
- package/src/decorators/column.ts +13 -4
- package/src/decorators/relations.ts +15 -0
- package/src/index.ts +37 -19
- package/src/orm/entity-context.ts +30 -0
- package/src/orm/entity-meta.ts +2 -2
- package/src/orm/entity-metadata.ts +8 -6
- package/src/orm/entity.ts +72 -41
- package/src/orm/execute.ts +42 -25
- package/src/orm/execution-context.ts +12 -0
- package/src/orm/hydration-context.ts +14 -0
- package/src/orm/hydration.ts +25 -17
- package/src/orm/identity-map.ts +4 -0
- package/src/orm/interceptor-pipeline.ts +29 -0
- package/src/orm/lazy-batch.ts +50 -6
- package/src/orm/orm-session.ts +234 -0
- package/src/orm/orm.ts +58 -0
- package/src/orm/query-logger.ts +1 -1
- package/src/orm/relation-change-processor.ts +48 -3
- package/src/orm/relations/belongs-to.ts +45 -44
- package/src/orm/relations/has-many.ts +44 -43
- package/src/orm/relations/has-one.ts +140 -0
- package/src/orm/relations/many-to-many.ts +46 -45
- package/src/orm/transaction-runner.ts +1 -1
- package/src/orm/unit-of-work.ts +66 -61
- package/src/query-builder/delete.ts +22 -5
- package/src/query-builder/hydration-manager.ts +2 -1
- package/src/query-builder/hydration-planner.ts +8 -7
- package/src/query-builder/insert.ts +22 -5
- package/src/query-builder/relation-conditions.ts +9 -8
- package/src/query-builder/relation-service.ts +3 -2
- package/src/query-builder/select.ts +575 -64
- package/src/query-builder/update.ts +22 -5
- package/src/schema/column.ts +246 -246
- package/src/schema/relation.ts +35 -1
- package/src/schema/table.ts +28 -28
- package/src/schema/types.ts +41 -31
- package/src/orm/db-executor.ts +0 -11
- package/src/orm/orm-context.ts +0 -159
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as TableHooks, a1 as ColumnType, h as ColumnDef, aN as EntityOrTableTargetResolver, a8 as CascadeMode, i as TableDef, aO as EntityConstructor, V as SelectQueryBuilder } from '../select-BKZrMRCQ.cjs';
|
|
2
2
|
|
|
3
3
|
interface EntityOptions {
|
|
4
4
|
tableName?: string;
|
|
@@ -16,10 +16,6 @@ type ColumnInput = ColumnOptions | ColumnDef;
|
|
|
16
16
|
declare function Column(definition: ColumnInput): PropertyDecorator;
|
|
17
17
|
declare function PrimaryKey(definition: ColumnInput): PropertyDecorator;
|
|
18
18
|
|
|
19
|
-
type EntityConstructor = new (...args: any[]) => any;
|
|
20
|
-
type EntityOrTableTarget = EntityConstructor | TableDef;
|
|
21
|
-
type EntityOrTableTargetResolver = EntityOrTableTarget | (() => EntityOrTableTarget);
|
|
22
|
-
|
|
23
19
|
interface BaseRelationOptions {
|
|
24
20
|
target: EntityOrTableTargetResolver;
|
|
25
21
|
cascade?: CascadeMode;
|
|
@@ -28,6 +24,9 @@ interface BaseRelationOptions {
|
|
|
28
24
|
interface HasManyOptions extends BaseRelationOptions {
|
|
29
25
|
foreignKey: string;
|
|
30
26
|
}
|
|
27
|
+
interface HasOneOptions extends BaseRelationOptions {
|
|
28
|
+
foreignKey: string;
|
|
29
|
+
}
|
|
31
30
|
interface BelongsToOptions extends BaseRelationOptions {
|
|
32
31
|
foreignKey: string;
|
|
33
32
|
}
|
|
@@ -43,6 +42,7 @@ interface BelongsToManyOptions {
|
|
|
43
42
|
cascade?: CascadeMode;
|
|
44
43
|
}
|
|
45
44
|
declare function HasMany(options: HasManyOptions): PropertyDecorator;
|
|
45
|
+
declare function HasOne(options: HasOneOptions): PropertyDecorator;
|
|
46
46
|
declare function BelongsTo(options: BelongsToOptions): PropertyDecorator;
|
|
47
47
|
declare function BelongsToMany(options: BelongsToManyOptions): PropertyDecorator;
|
|
48
48
|
|
|
@@ -50,4 +50,4 @@ declare const bootstrapEntities: () => TableDef[];
|
|
|
50
50
|
declare const getTableDefFromEntity: (ctor: EntityConstructor) => TableDef | undefined;
|
|
51
51
|
declare const selectFromEntity: <TTable extends TableDef>(ctor: EntityConstructor) => SelectQueryBuilder<any, TTable>;
|
|
52
52
|
|
|
53
|
-
export { BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToOptions, Column, type ColumnInput, type ColumnOptions, Entity, type EntityOptions, HasMany, type HasManyOptions, PrimaryKey, bootstrapEntities, getTableDefFromEntity, selectFromEntity };
|
|
53
|
+
export { BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToOptions, Column, type ColumnInput, type ColumnOptions, Entity, type EntityOptions, HasMany, type HasManyOptions, HasOne, type HasOneOptions, PrimaryKey, bootstrapEntities, getTableDefFromEntity, selectFromEntity };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as TableHooks, a1 as ColumnType, h as ColumnDef, aN as EntityOrTableTargetResolver, a8 as CascadeMode, i as TableDef, aO as EntityConstructor, V as SelectQueryBuilder } from '../select-BKZrMRCQ.js';
|
|
2
2
|
|
|
3
3
|
interface EntityOptions {
|
|
4
4
|
tableName?: string;
|
|
@@ -16,10 +16,6 @@ type ColumnInput = ColumnOptions | ColumnDef;
|
|
|
16
16
|
declare function Column(definition: ColumnInput): PropertyDecorator;
|
|
17
17
|
declare function PrimaryKey(definition: ColumnInput): PropertyDecorator;
|
|
18
18
|
|
|
19
|
-
type EntityConstructor = new (...args: any[]) => any;
|
|
20
|
-
type EntityOrTableTarget = EntityConstructor | TableDef;
|
|
21
|
-
type EntityOrTableTargetResolver = EntityOrTableTarget | (() => EntityOrTableTarget);
|
|
22
|
-
|
|
23
19
|
interface BaseRelationOptions {
|
|
24
20
|
target: EntityOrTableTargetResolver;
|
|
25
21
|
cascade?: CascadeMode;
|
|
@@ -28,6 +24,9 @@ interface BaseRelationOptions {
|
|
|
28
24
|
interface HasManyOptions extends BaseRelationOptions {
|
|
29
25
|
foreignKey: string;
|
|
30
26
|
}
|
|
27
|
+
interface HasOneOptions extends BaseRelationOptions {
|
|
28
|
+
foreignKey: string;
|
|
29
|
+
}
|
|
31
30
|
interface BelongsToOptions extends BaseRelationOptions {
|
|
32
31
|
foreignKey: string;
|
|
33
32
|
}
|
|
@@ -43,6 +42,7 @@ interface BelongsToManyOptions {
|
|
|
43
42
|
cascade?: CascadeMode;
|
|
44
43
|
}
|
|
45
44
|
declare function HasMany(options: HasManyOptions): PropertyDecorator;
|
|
45
|
+
declare function HasOne(options: HasOneOptions): PropertyDecorator;
|
|
46
46
|
declare function BelongsTo(options: BelongsToOptions): PropertyDecorator;
|
|
47
47
|
declare function BelongsToMany(options: BelongsToManyOptions): PropertyDecorator;
|
|
48
48
|
|
|
@@ -50,4 +50,4 @@ declare const bootstrapEntities: () => TableDef[];
|
|
|
50
50
|
declare const getTableDefFromEntity: (ctor: EntityConstructor) => TableDef | undefined;
|
|
51
51
|
declare const selectFromEntity: <TTable extends TableDef>(ctor: EntityConstructor) => SelectQueryBuilder<any, TTable>;
|
|
52
52
|
|
|
53
|
-
export { BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToOptions, Column, type ColumnInput, type ColumnOptions, Entity, type EntityOptions, HasMany, type HasManyOptions, PrimaryKey, bootstrapEntities, getTableDefFromEntity, selectFromEntity };
|
|
53
|
+
export { BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToOptions, Column, type ColumnInput, type ColumnOptions, Entity, type EntityOptions, HasMany, type HasManyOptions, HasOne, type HasOneOptions, PrimaryKey, bootstrapEntities, getTableDefFromEntity, selectFromEntity };
|