@mikro-orm/core 7.0.0-dev.1 → 7.0.0-dev.11
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/EntityManager.d.ts +25 -16
- package/EntityManager.js +219 -209
- package/MikroORM.d.ts +7 -6
- package/MikroORM.js +33 -45
- package/cache/CacheAdapter.js +1 -2
- package/cache/FileCacheAdapter.d.ts +1 -1
- package/cache/FileCacheAdapter.js +18 -26
- package/cache/GeneratedCacheAdapter.d.ts +2 -2
- package/cache/GeneratedCacheAdapter.js +1 -5
- package/cache/MemoryCacheAdapter.d.ts +1 -1
- package/cache/MemoryCacheAdapter.js +1 -5
- package/cache/NullCacheAdapter.d.ts +1 -1
- package/cache/NullCacheAdapter.js +1 -5
- package/cache/index.d.ts +5 -5
- package/cache/index.js +5 -21
- package/connections/Connection.d.ts +7 -7
- package/connections/Connection.js +8 -12
- package/connections/index.d.ts +1 -1
- package/connections/index.js +1 -17
- package/decorators/Check.d.ts +2 -2
- package/decorators/Check.js +5 -8
- package/decorators/CreateRequestContext.d.ts +1 -1
- package/decorators/CreateRequestContext.js +13 -14
- package/decorators/Embeddable.d.ts +5 -5
- package/decorators/Embeddable.js +4 -7
- package/decorators/Embedded.d.ts +3 -3
- package/decorators/Embedded.js +10 -12
- package/decorators/Entity.d.ts +6 -6
- package/decorators/Entity.js +5 -9
- package/decorators/Enum.d.ts +3 -3
- package/decorators/Enum.js +7 -10
- package/decorators/Filter.d.ts +1 -1
- package/decorators/Filter.js +3 -6
- package/decorators/Formula.d.ts +2 -3
- package/decorators/Formula.js +7 -10
- package/decorators/Indexed.d.ts +10 -8
- package/decorators/Indexed.js +7 -11
- package/decorators/ManyToMany.d.ts +4 -4
- package/decorators/ManyToMany.js +10 -12
- package/decorators/ManyToOne.d.ts +4 -4
- package/decorators/ManyToOne.js +10 -12
- package/decorators/OneToMany.d.ts +6 -6
- package/decorators/OneToMany.js +11 -14
- package/decorators/OneToOne.d.ts +4 -4
- package/decorators/OneToOne.js +4 -7
- package/decorators/PrimaryKey.d.ts +3 -4
- package/decorators/PrimaryKey.js +10 -13
- package/decorators/Property.d.ts +6 -6
- package/decorators/Property.js +10 -12
- package/decorators/Transactional.d.ts +2 -2
- package/decorators/Transactional.js +7 -10
- package/decorators/hooks.js +23 -35
- package/decorators/index.d.ts +17 -17
- package/decorators/index.js +17 -36
- package/drivers/DatabaseDriver.d.ts +13 -12
- package/drivers/DatabaseDriver.js +60 -64
- package/drivers/IDatabaseDriver.d.ts +16 -13
- package/drivers/IDatabaseDriver.js +1 -4
- package/drivers/index.d.ts +2 -2
- package/drivers/index.js +2 -18
- package/entity/ArrayCollection.d.ts +3 -3
- package/entity/ArrayCollection.js +38 -35
- package/entity/BaseEntity.d.ts +6 -6
- package/entity/BaseEntity.js +17 -21
- package/entity/Collection.d.ts +6 -7
- package/entity/Collection.js +47 -51
- package/entity/EntityAssigner.d.ts +2 -2
- package/entity/EntityAssigner.js +58 -63
- package/entity/EntityFactory.d.ts +3 -3
- package/entity/EntityFactory.js +62 -63
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +44 -45
- package/entity/EntityIdentifier.d.ts +1 -1
- package/entity/EntityIdentifier.js +1 -5
- package/entity/EntityLoader.d.ts +5 -5
- package/entity/EntityLoader.js +106 -98
- package/entity/EntityRepository.d.ts +7 -7
- package/entity/EntityRepository.js +7 -11
- package/entity/EntityValidator.d.ts +1 -1
- package/entity/EntityValidator.js +25 -29
- package/entity/Reference.d.ts +4 -8
- package/entity/Reference.js +35 -42
- package/entity/WrappedEntity.d.ts +12 -12
- package/entity/WrappedEntity.js +23 -27
- package/entity/index.d.ts +13 -13
- package/entity/index.js +13 -29
- package/entity/utils.d.ts +1 -1
- package/entity/utils.js +9 -12
- package/entity/wrap.d.ts +1 -1
- package/entity/wrap.js +2 -6
- package/enums.d.ts +3 -3
- package/enums.js +37 -41
- package/errors.d.ts +1 -1
- package/errors.js +15 -24
- package/events/EventManager.d.ts +3 -3
- package/events/EventManager.js +8 -12
- package/events/EventSubscriber.d.ts +8 -5
- package/events/EventSubscriber.js +1 -2
- package/events/TransactionEventBroadcaster.d.ts +3 -3
- package/events/TransactionEventBroadcaster.js +1 -5
- package/events/index.d.ts +3 -3
- package/events/index.js +3 -19
- package/exceptions.js +18 -39
- package/hydration/Hydrator.d.ts +5 -5
- package/hydration/Hydrator.js +3 -6
- package/hydration/ObjectHydrator.d.ts +3 -3
- package/hydration/ObjectHydrator.js +26 -28
- package/hydration/index.d.ts +2 -2
- package/hydration/index.js +2 -18
- package/index.d.ts +21 -21
- package/index.js +21 -46
- package/logging/DefaultLogger.d.ts +1 -1
- package/logging/DefaultLogger.js +9 -13
- package/logging/Logger.d.ts +1 -1
- package/logging/Logger.js +1 -2
- package/logging/SimpleLogger.d.ts +2 -2
- package/logging/SimpleLogger.js +2 -6
- package/logging/colors.js +1 -5
- package/logging/index.d.ts +4 -4
- package/logging/index.js +4 -20
- package/metadata/EntitySchema.d.ts +14 -6
- package/metadata/EntitySchema.js +41 -45
- package/metadata/MetadataDiscovery.d.ts +7 -7
- package/metadata/MetadataDiscovery.js +181 -180
- package/metadata/MetadataProvider.d.ts +2 -2
- package/metadata/MetadataProvider.js +4 -7
- package/metadata/MetadataStorage.d.ts +2 -2
- package/metadata/MetadataStorage.js +15 -19
- package/metadata/MetadataValidator.d.ts +4 -4
- package/metadata/MetadataValidator.js +52 -55
- package/metadata/ReflectMetadataProvider.d.ts +2 -2
- package/metadata/ReflectMetadataProvider.js +8 -12
- package/metadata/index.d.ts +6 -6
- package/metadata/index.js +6 -22
- package/naming-strategy/AbstractNamingStrategy.d.ts +2 -2
- package/naming-strategy/AbstractNamingStrategy.js +4 -8
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +1 -1
- package/naming-strategy/EntityCaseNamingStrategy.js +2 -6
- package/naming-strategy/MongoNamingStrategy.d.ts +1 -1
- package/naming-strategy/MongoNamingStrategy.js +2 -6
- package/naming-strategy/NamingStrategy.d.ts +1 -1
- package/naming-strategy/NamingStrategy.js +1 -2
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +1 -1
- package/naming-strategy/UnderscoreNamingStrategy.js +2 -6
- package/naming-strategy/index.d.ts +5 -5
- package/naming-strategy/index.js +5 -21
- package/package.json +6 -15
- package/platforms/ExceptionConverter.d.ts +2 -2
- package/platforms/ExceptionConverter.js +4 -8
- package/platforms/Platform.d.ts +10 -10
- package/platforms/Platform.js +57 -61
- package/platforms/index.d.ts +2 -2
- package/platforms/index.js +2 -18
- package/serialization/EntitySerializer.d.ts +2 -2
- package/serialization/EntitySerializer.js +36 -41
- package/serialization/EntityTransformer.d.ts +1 -1
- package/serialization/EntityTransformer.js +27 -31
- package/serialization/SerializationContext.d.ts +2 -2
- package/serialization/SerializationContext.js +10 -14
- package/serialization/index.d.ts +3 -3
- package/serialization/index.js +3 -19
- package/types/ArrayType.d.ts +3 -3
- package/types/ArrayType.js +7 -11
- package/types/BigIntType.d.ts +4 -3
- package/types/BigIntType.js +6 -6
- package/types/BlobType.d.ts +3 -3
- package/types/BlobType.js +2 -8
- package/types/BooleanType.d.ts +3 -3
- package/types/BooleanType.js +2 -6
- package/types/CharacterType.d.ts +3 -3
- package/types/CharacterType.js +2 -6
- package/types/DateTimeType.d.ts +3 -3
- package/types/DateTimeType.js +2 -6
- package/types/DateType.d.ts +3 -3
- package/types/DateType.js +2 -6
- package/types/DecimalType.d.ts +3 -3
- package/types/DecimalType.js +4 -7
- package/types/DoubleType.d.ts +3 -3
- package/types/DoubleType.js +3 -6
- package/types/EnumArrayType.d.ts +4 -4
- package/types/EnumArrayType.js +5 -10
- package/types/EnumType.d.ts +3 -3
- package/types/EnumType.js +2 -6
- package/types/FloatType.d.ts +3 -3
- package/types/FloatType.js +2 -6
- package/types/IntegerType.d.ts +3 -3
- package/types/IntegerType.js +2 -6
- package/types/IntervalType.d.ts +3 -3
- package/types/IntervalType.js +2 -6
- package/types/JsonType.d.ts +3 -3
- package/types/JsonType.js +2 -6
- package/types/MediumIntType.d.ts +3 -3
- package/types/MediumIntType.js +2 -6
- package/types/SmallIntType.d.ts +3 -3
- package/types/SmallIntType.js +2 -6
- package/types/StringType.d.ts +3 -3
- package/types/StringType.js +2 -6
- package/types/TextType.d.ts +3 -3
- package/types/TextType.js +2 -6
- package/types/TimeType.d.ts +3 -3
- package/types/TimeType.js +4 -8
- package/types/TinyIntType.d.ts +3 -3
- package/types/TinyIntType.js +3 -6
- package/types/Type.d.ts +2 -2
- package/types/Type.js +5 -9
- package/types/Uint8ArrayType.d.ts +3 -3
- package/types/Uint8ArrayType.js +3 -9
- package/types/UnknownType.d.ts +3 -3
- package/types/UnknownType.js +2 -6
- package/types/UuidType.d.ts +3 -3
- package/types/UuidType.js +2 -6
- package/types/index.d.ts +25 -25
- package/types/index.js +52 -79
- package/typings.d.ts +33 -28
- package/typings.js +37 -38
- package/unit-of-work/ChangeSet.d.ts +1 -1
- package/unit-of-work/ChangeSet.js +13 -17
- package/unit-of-work/ChangeSetComputer.d.ts +8 -7
- package/unit-of-work/ChangeSetComputer.js +26 -30
- package/unit-of-work/ChangeSetPersister.d.ts +7 -6
- package/unit-of-work/ChangeSetPersister.js +51 -48
- package/unit-of-work/CommitOrderCalculator.d.ts +1 -1
- package/unit-of-work/CommitOrderCalculator.js +6 -10
- package/unit-of-work/IdentityMap.d.ts +1 -1
- package/unit-of-work/IdentityMap.js +1 -5
- package/unit-of-work/UnitOfWork.d.ts +8 -7
- package/unit-of-work/UnitOfWork.js +193 -178
- package/unit-of-work/index.d.ts +6 -6
- package/unit-of-work/index.js +6 -22
- package/utils/AbstractSchemaGenerator.d.ts +6 -6
- package/utils/AbstractSchemaGenerator.js +12 -13
- package/utils/Configuration.d.ts +26 -27
- package/utils/Configuration.js +50 -55
- package/utils/ConfigurationLoader.d.ts +9 -8
- package/utils/ConfigurationLoader.js +71 -86
- package/utils/Cursor.d.ts +6 -6
- package/utils/Cursor.js +22 -25
- package/utils/DataloaderUtils.d.ts +4 -4
- package/utils/DataloaderUtils.js +12 -16
- package/utils/EntityComparator.d.ts +2 -2
- package/utils/EntityComparator.js +109 -97
- package/utils/NullHighlighter.d.ts +1 -1
- package/utils/NullHighlighter.js +1 -5
- package/utils/QueryHelper.d.ts +3 -3
- package/utils/QueryHelper.js +47 -51
- package/utils/RawQueryFragment.d.ts +1 -1
- package/utils/RawQueryFragment.js +22 -25
- package/utils/RequestContext.d.ts +2 -2
- package/utils/RequestContext.js +3 -7
- package/utils/TransactionContext.d.ts +1 -1
- package/utils/TransactionContext.js +4 -8
- package/utils/Utils.d.ts +16 -12
- package/utils/Utils.js +96 -95
- package/utils/clone.js +8 -11
- package/utils/index.d.ts +13 -13
- package/utils/index.js +13 -29
- package/utils/resolveContextProvider.d.ts +3 -3
- package/utils/resolveContextProvider.js +9 -12
- package/utils/upsert-utils.d.ts +3 -3
- package/utils/upsert-utils.js +5 -9
- package/index.mjs +0 -199
package/decorators/hooks.js
CHANGED
|
@@ -1,59 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.BeforeCreate = BeforeCreate;
|
|
4
|
-
exports.AfterCreate = AfterCreate;
|
|
5
|
-
exports.BeforeUpdate = BeforeUpdate;
|
|
6
|
-
exports.AfterUpdate = AfterUpdate;
|
|
7
|
-
exports.BeforeUpsert = BeforeUpsert;
|
|
8
|
-
exports.AfterUpsert = AfterUpsert;
|
|
9
|
-
exports.OnInit = OnInit;
|
|
10
|
-
exports.OnLoad = OnLoad;
|
|
11
|
-
exports.BeforeDelete = BeforeDelete;
|
|
12
|
-
exports.AfterDelete = AfterDelete;
|
|
13
|
-
const metadata_1 = require("../metadata");
|
|
14
|
-
const enums_1 = require("../enums");
|
|
1
|
+
import { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
2
|
+
import { EventType } from '../enums.js';
|
|
15
3
|
function hook(type) {
|
|
16
4
|
return function (target, method) {
|
|
17
|
-
const meta =
|
|
5
|
+
const meta = MetadataStorage.getMetadataFromDecorator(target.constructor);
|
|
18
6
|
if (!meta.hooks[type]) {
|
|
19
7
|
meta.hooks[type] = [];
|
|
20
8
|
}
|
|
21
9
|
meta.hooks[type].push(method);
|
|
22
10
|
};
|
|
23
11
|
}
|
|
24
|
-
function BeforeCreate() {
|
|
25
|
-
return hook(
|
|
12
|
+
export function BeforeCreate() {
|
|
13
|
+
return hook(EventType.beforeCreate);
|
|
26
14
|
}
|
|
27
|
-
function AfterCreate() {
|
|
28
|
-
return hook(
|
|
15
|
+
export function AfterCreate() {
|
|
16
|
+
return hook(EventType.afterCreate);
|
|
29
17
|
}
|
|
30
|
-
function BeforeUpdate() {
|
|
31
|
-
return hook(
|
|
18
|
+
export function BeforeUpdate() {
|
|
19
|
+
return hook(EventType.beforeUpdate);
|
|
32
20
|
}
|
|
33
|
-
function AfterUpdate() {
|
|
34
|
-
return hook(
|
|
21
|
+
export function AfterUpdate() {
|
|
22
|
+
return hook(EventType.afterUpdate);
|
|
35
23
|
}
|
|
36
|
-
function BeforeUpsert() {
|
|
37
|
-
return hook(
|
|
24
|
+
export function BeforeUpsert() {
|
|
25
|
+
return hook(EventType.beforeUpsert);
|
|
38
26
|
}
|
|
39
|
-
function AfterUpsert() {
|
|
40
|
-
return hook(
|
|
27
|
+
export function AfterUpsert() {
|
|
28
|
+
return hook(EventType.afterUpsert);
|
|
41
29
|
}
|
|
42
|
-
function OnInit() {
|
|
43
|
-
return hook(
|
|
30
|
+
export function OnInit() {
|
|
31
|
+
return hook(EventType.onInit);
|
|
44
32
|
}
|
|
45
|
-
function OnLoad() {
|
|
46
|
-
return hook(
|
|
33
|
+
export function OnLoad() {
|
|
34
|
+
return hook(EventType.onLoad);
|
|
47
35
|
}
|
|
48
36
|
/**
|
|
49
37
|
* Called before deleting entity, but only when providing initialized entity to EM#remove()
|
|
50
38
|
*/
|
|
51
|
-
function BeforeDelete() {
|
|
52
|
-
return hook(
|
|
39
|
+
export function BeforeDelete() {
|
|
40
|
+
return hook(EventType.beforeDelete);
|
|
53
41
|
}
|
|
54
42
|
/**
|
|
55
43
|
* Called after deleting entity, but only when providing initialized entity to EM#remove()
|
|
56
44
|
*/
|
|
57
|
-
function AfterDelete() {
|
|
58
|
-
return hook(
|
|
45
|
+
export function AfterDelete() {
|
|
46
|
+
return hook(EventType.afterDelete);
|
|
59
47
|
}
|
package/decorators/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * from './PrimaryKey';
|
|
2
|
-
export * from './Entity';
|
|
3
|
-
export * from './OneToOne';
|
|
4
|
-
export * from './ManyToOne';
|
|
5
|
-
export * from './ManyToMany';
|
|
6
|
-
export { OneToMany, OneToManyOptions } from './OneToMany';
|
|
7
|
-
export * from './Property';
|
|
8
|
-
export * from './Check';
|
|
9
|
-
export * from './Enum';
|
|
10
|
-
export * from './Formula';
|
|
11
|
-
export * from './Indexed';
|
|
12
|
-
export * from './Embeddable';
|
|
13
|
-
export * from './Embedded';
|
|
14
|
-
export * from './Filter';
|
|
15
|
-
export * from './CreateRequestContext';
|
|
16
|
-
export * from './hooks';
|
|
17
|
-
export * from './Transactional';
|
|
1
|
+
export * from './PrimaryKey.js';
|
|
2
|
+
export * from './Entity.js';
|
|
3
|
+
export * from './OneToOne.js';
|
|
4
|
+
export * from './ManyToOne.js';
|
|
5
|
+
export * from './ManyToMany.js';
|
|
6
|
+
export { OneToMany, OneToManyOptions } from './OneToMany.js';
|
|
7
|
+
export * from './Property.js';
|
|
8
|
+
export * from './Check.js';
|
|
9
|
+
export * from './Enum.js';
|
|
10
|
+
export * from './Formula.js';
|
|
11
|
+
export * from './Indexed.js';
|
|
12
|
+
export * from './Embeddable.js';
|
|
13
|
+
export * from './Embedded.js';
|
|
14
|
+
export * from './Filter.js';
|
|
15
|
+
export * from './CreateRequestContext.js';
|
|
16
|
+
export * from './hooks.js';
|
|
17
|
+
export * from './Transactional.js';
|
package/decorators/index.js
CHANGED
|
@@ -1,36 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/* istanbul ignore file */
|
|
19
|
-
__exportStar(require("./PrimaryKey"), exports);
|
|
20
|
-
__exportStar(require("./Entity"), exports);
|
|
21
|
-
__exportStar(require("./OneToOne"), exports);
|
|
22
|
-
__exportStar(require("./ManyToOne"), exports);
|
|
23
|
-
__exportStar(require("./ManyToMany"), exports);
|
|
24
|
-
var OneToMany_1 = require("./OneToMany");
|
|
25
|
-
Object.defineProperty(exports, "OneToMany", { enumerable: true, get: function () { return OneToMany_1.OneToMany; } });
|
|
26
|
-
__exportStar(require("./Property"), exports);
|
|
27
|
-
__exportStar(require("./Check"), exports);
|
|
28
|
-
__exportStar(require("./Enum"), exports);
|
|
29
|
-
__exportStar(require("./Formula"), exports);
|
|
30
|
-
__exportStar(require("./Indexed"), exports);
|
|
31
|
-
__exportStar(require("./Embeddable"), exports);
|
|
32
|
-
__exportStar(require("./Embedded"), exports);
|
|
33
|
-
__exportStar(require("./Filter"), exports);
|
|
34
|
-
__exportStar(require("./CreateRequestContext"), exports);
|
|
35
|
-
__exportStar(require("./hooks"), exports);
|
|
36
|
-
__exportStar(require("./Transactional"), exports);
|
|
1
|
+
export * from './PrimaryKey.js';
|
|
2
|
+
export * from './Entity.js';
|
|
3
|
+
export * from './OneToOne.js';
|
|
4
|
+
export * from './ManyToOne.js';
|
|
5
|
+
export * from './ManyToMany.js';
|
|
6
|
+
export { OneToMany } from './OneToMany.js';
|
|
7
|
+
export * from './Property.js';
|
|
8
|
+
export * from './Check.js';
|
|
9
|
+
export * from './Enum.js';
|
|
10
|
+
export * from './Formula.js';
|
|
11
|
+
export * from './Indexed.js';
|
|
12
|
+
export * from './Embeddable.js';
|
|
13
|
+
export * from './Embedded.js';
|
|
14
|
+
export * from './Filter.js';
|
|
15
|
+
export * from './CreateRequestContext.js';
|
|
16
|
+
export * from './hooks.js';
|
|
17
|
+
export * from './Transactional.js';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { type CountOptions, type DeleteOptions, type DriverMethodOptions, EntityManagerType, type FindOneOptions, type FindOptions, type IDatabaseDriver, type LockOptions, type NativeInsertUpdateManyOptions, type NativeInsertUpdateOptions, type OrderDefinition } from './IDatabaseDriver';
|
|
2
|
-
import type { ConnectionType, Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityProperty, FilterQuery, PopulateOptions, Primary } from '../typings';
|
|
3
|
-
import type { MetadataStorage } from '../metadata';
|
|
4
|
-
import type { Connection, QueryResult, Transaction } from '../connections';
|
|
5
|
-
import { type Configuration, type ConnectionOptions
|
|
6
|
-
import {
|
|
7
|
-
import type
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
1
|
+
import { type CountOptions, type DeleteOptions, type DriverMethodOptions, EntityManagerType, type FindOneOptions, type FindOptions, type IDatabaseDriver, type LockOptions, type NativeInsertUpdateManyOptions, type NativeInsertUpdateOptions, type OrderDefinition } from './IDatabaseDriver.js';
|
|
2
|
+
import type { ConnectionType, Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityProperty, FilterQuery, PopulateOptions, Primary } from '../typings.js';
|
|
3
|
+
import type { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
4
|
+
import type { Connection, QueryResult, Transaction } from '../connections/Connection.js';
|
|
5
|
+
import { type Configuration, type ConnectionOptions } from '../utils/Configuration.js';
|
|
6
|
+
import { EntityComparator } from '../utils/EntityComparator.js';
|
|
7
|
+
import { type QueryOrder } from '../enums.js';
|
|
8
|
+
import type { Platform } from '../platforms/Platform.js';
|
|
9
|
+
import type { Collection } from '../entity/Collection.js';
|
|
10
|
+
import { EntityManager } from '../EntityManager.js';
|
|
11
|
+
import { DriverException } from '../exceptions.js';
|
|
12
|
+
import type { Logger } from '../logging/Logger.js';
|
|
12
13
|
export declare abstract class DatabaseDriver<C extends Connection> implements IDatabaseDriver<C> {
|
|
13
14
|
readonly config: Configuration;
|
|
14
15
|
protected readonly dependencies: string[];
|
|
@@ -28,7 +29,7 @@ export declare abstract class DatabaseDriver<C extends Connection> implements ID
|
|
|
28
29
|
nativeUpdateMany<T extends object>(entityName: string, where: FilterQuery<T>[], data: EntityDictionary<T>[], options?: NativeInsertUpdateManyOptions<T>): Promise<QueryResult<T>>;
|
|
29
30
|
abstract nativeDelete<T extends object>(entityName: string, where: FilterQuery<T>, options?: DeleteOptions<T>): Promise<QueryResult<T>>;
|
|
30
31
|
abstract count<T extends object, P extends string = never>(entityName: string, where: FilterQuery<T>, options?: CountOptions<T, P>): Promise<number>;
|
|
31
|
-
createEntityManager
|
|
32
|
+
createEntityManager(useContext?: boolean): this[typeof EntityManagerType];
|
|
32
33
|
findVirtual<T extends object>(entityName: string, where: FilterQuery<T>, options: FindOptions<T, any, any, any>): Promise<EntityData<T>[]>;
|
|
33
34
|
countVirtual<T extends object>(entityName: string, where: FilterQuery<T>, options: CountOptions<T, any>): Promise<number>;
|
|
34
35
|
aggregate(entityName: string, pipeline: any[]): Promise<any[]>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class DatabaseDriver {
|
|
1
|
+
import { EntityManagerType, } from './IDatabaseDriver.js';
|
|
2
|
+
import { Utils } from '../utils/Utils.js';
|
|
3
|
+
import { Cursor } from '../utils/Cursor.js';
|
|
4
|
+
import { EntityComparator } from '../utils/EntityComparator.js';
|
|
5
|
+
import { isRaw, raw } from '../utils/RawQueryFragment.js';
|
|
6
|
+
import { QueryOrderNumeric, ReferenceKind } from '../enums.js';
|
|
7
|
+
import { EntityManager } from '../EntityManager.js';
|
|
8
|
+
import { CursorError, ValidationError } from '../errors.js';
|
|
9
|
+
import { DriverException } from '../exceptions.js';
|
|
10
|
+
import { helper } from '../entity/wrap.js';
|
|
11
|
+
import { JsonType } from '../types/JsonType.js';
|
|
12
|
+
export class DatabaseDriver {
|
|
13
13
|
config;
|
|
14
14
|
dependencies;
|
|
15
|
-
[
|
|
15
|
+
[EntityManagerType];
|
|
16
16
|
connection;
|
|
17
17
|
replicas = [];
|
|
18
18
|
platform;
|
|
@@ -28,14 +28,14 @@ class DatabaseDriver {
|
|
|
28
28
|
throw new Error(`Batch updates are not supported by ${this.constructor.name} driver`);
|
|
29
29
|
}
|
|
30
30
|
createEntityManager(useContext) {
|
|
31
|
-
const EntityManagerClass = this.config.get('entityManager',
|
|
31
|
+
const EntityManagerClass = this.config.get('entityManager', EntityManager);
|
|
32
32
|
return new EntityManagerClass(this.config, this, this.metadata, useContext);
|
|
33
33
|
}
|
|
34
|
-
/*
|
|
34
|
+
/* v8 ignore next 3 */
|
|
35
35
|
async findVirtual(entityName, where, options) {
|
|
36
36
|
throw new Error(`Virtual entities are not supported by ${this.constructor.name} driver.`);
|
|
37
37
|
}
|
|
38
|
-
/*
|
|
38
|
+
/* v8 ignore next 3 */
|
|
39
39
|
async countVirtual(entityName, where, options) {
|
|
40
40
|
throw new Error(`Counting virtual entities is not supported by ${this.constructor.name} driver.`);
|
|
41
41
|
}
|
|
@@ -49,16 +49,14 @@ class DatabaseDriver {
|
|
|
49
49
|
for (const coll of collections) {
|
|
50
50
|
if (!coll.property.owner) {
|
|
51
51
|
if (coll.getSnapshot() === undefined) {
|
|
52
|
-
throw
|
|
52
|
+
throw ValidationError.cannotModifyInverseCollection(coll.owner, coll.property);
|
|
53
53
|
}
|
|
54
54
|
continue;
|
|
55
55
|
}
|
|
56
|
-
/*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
await this.nativeUpdate(coll.owner.constructor.name, (0, wrap_1.helper)(coll.owner).getPrimaryKey(), data, options);
|
|
61
|
-
}
|
|
56
|
+
/* v8 ignore next 3 */
|
|
57
|
+
const pk = coll.property.targetMeta.primaryKeys[0];
|
|
58
|
+
const data = { [coll.property.name]: coll.getIdentifiers(pk) };
|
|
59
|
+
await this.nativeUpdate(coll.owner.constructor.name, helper(coll.owner).getPrimaryKey(), data, options);
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
mapResult(result, meta, populate = []) {
|
|
@@ -81,7 +79,7 @@ class DatabaseDriver {
|
|
|
81
79
|
if (type === 'write' || this.replicas.length === 0) {
|
|
82
80
|
return this.connection;
|
|
83
81
|
}
|
|
84
|
-
const rand =
|
|
82
|
+
const rand = Utils.randomInt(0, this.replicas.length - 1);
|
|
85
83
|
return this.replicas[rand];
|
|
86
84
|
}
|
|
87
85
|
async close(force) {
|
|
@@ -93,7 +91,7 @@ class DatabaseDriver {
|
|
|
93
91
|
}
|
|
94
92
|
setMetadata(metadata) {
|
|
95
93
|
this.metadata = metadata;
|
|
96
|
-
this.comparator = new
|
|
94
|
+
this.comparator = new EntityComparator(this.metadata, this.platform);
|
|
97
95
|
this.connection.setMetadata(metadata);
|
|
98
96
|
this.connection.setPlatform(this.platform);
|
|
99
97
|
this.replicas.forEach(replica => {
|
|
@@ -111,7 +109,7 @@ class DatabaseDriver {
|
|
|
111
109
|
const { first, last, before, after, overfetch } = options;
|
|
112
110
|
const limit = first ?? last;
|
|
113
111
|
const isLast = !first && !!last;
|
|
114
|
-
const definition =
|
|
112
|
+
const definition = Cursor.getDefinition(meta, orderBy);
|
|
115
113
|
const $and = [];
|
|
116
114
|
// allow POJO as well, we care only about the correct key being present
|
|
117
115
|
const isCursor = (val, key) => {
|
|
@@ -119,15 +117,15 @@ class DatabaseDriver {
|
|
|
119
117
|
};
|
|
120
118
|
const createCursor = (val, key, inverse = false) => {
|
|
121
119
|
let def = isCursor(val, key) ? val[key] : val;
|
|
122
|
-
if (
|
|
123
|
-
def =
|
|
120
|
+
if (Utils.isPlainObject(def)) {
|
|
121
|
+
def = Cursor.for(meta, def, orderBy);
|
|
124
122
|
}
|
|
125
|
-
/*
|
|
126
|
-
const offsets = def ?
|
|
123
|
+
/* v8 ignore next */
|
|
124
|
+
const offsets = def ? Cursor.decode(def) : [];
|
|
127
125
|
if (definition.length === offsets.length) {
|
|
128
126
|
return this.createCursorCondition(definition, offsets, inverse, meta);
|
|
129
127
|
}
|
|
130
|
-
/*
|
|
128
|
+
/* v8 ignore next */
|
|
131
129
|
return {};
|
|
132
130
|
};
|
|
133
131
|
if (after) {
|
|
@@ -140,15 +138,15 @@ class DatabaseDriver {
|
|
|
140
138
|
options.limit = limit + (overfetch ? 1 : 0);
|
|
141
139
|
}
|
|
142
140
|
const createOrderBy = (prop, direction) => {
|
|
143
|
-
if (
|
|
144
|
-
const value =
|
|
141
|
+
if (Utils.isPlainObject(direction)) {
|
|
142
|
+
const value = Utils.keys(direction).reduce((o, key) => {
|
|
145
143
|
Object.assign(o, createOrderBy(key, direction[key]));
|
|
146
144
|
return o;
|
|
147
145
|
}, {});
|
|
148
146
|
return ({ [prop]: value });
|
|
149
147
|
}
|
|
150
|
-
const desc = direction ===
|
|
151
|
-
const dir =
|
|
148
|
+
const desc = direction === QueryOrderNumeric.DESC || direction.toString().toLowerCase() === 'desc';
|
|
149
|
+
const dir = Utils.xor(desc, isLast) ? 'desc' : 'asc';
|
|
152
150
|
return ({ [prop]: dir });
|
|
153
151
|
};
|
|
154
152
|
return {
|
|
@@ -156,24 +154,23 @@ class DatabaseDriver {
|
|
|
156
154
|
where: ($and.length > 1 ? { $and } : { ...$and[0] }),
|
|
157
155
|
};
|
|
158
156
|
}
|
|
159
|
-
/* istanbul ignore next */
|
|
160
157
|
createCursorCondition(definition, offsets, inverse, meta) {
|
|
161
158
|
const createCondition = (prop, direction, offset, eq = false) => {
|
|
162
159
|
if (offset === null) {
|
|
163
|
-
throw
|
|
160
|
+
throw CursorError.missingValue(meta.className, prop);
|
|
164
161
|
}
|
|
165
|
-
if (
|
|
166
|
-
const value =
|
|
167
|
-
if (
|
|
168
|
-
throw
|
|
162
|
+
if (Utils.isPlainObject(direction)) {
|
|
163
|
+
const value = Utils.keys(direction).reduce((o, key) => {
|
|
164
|
+
if (Utils.isEmpty(offset[key])) {
|
|
165
|
+
throw CursorError.missingValue(meta.className, `${prop}.${key}`);
|
|
169
166
|
}
|
|
170
167
|
Object.assign(o, createCondition(key, direction[key], offset[key], eq));
|
|
171
168
|
return o;
|
|
172
169
|
}, {});
|
|
173
170
|
return ({ [prop]: value });
|
|
174
171
|
}
|
|
175
|
-
const desc = direction ===
|
|
176
|
-
const operator =
|
|
172
|
+
const desc = direction === QueryOrderNumeric.DESC || direction.toString().toLowerCase() === 'desc';
|
|
173
|
+
const operator = Utils.xor(desc, inverse) ? '$lt' : '$gt';
|
|
177
174
|
return { [prop]: { [operator + (eq ? 'e' : '')]: offset } };
|
|
178
175
|
};
|
|
179
176
|
const [order, ...otherOrders] = definition;
|
|
@@ -222,7 +219,7 @@ class DatabaseDriver {
|
|
|
222
219
|
return;
|
|
223
220
|
}
|
|
224
221
|
if (prop.joinColumns && Array.isArray(data[k])) {
|
|
225
|
-
const copy =
|
|
222
|
+
const copy = Utils.flatten(data[k]);
|
|
226
223
|
delete data[k];
|
|
227
224
|
prop.joinColumns.forEach((joinColumn, idx) => data[joinColumn] = copy[idx]);
|
|
228
225
|
return;
|
|
@@ -232,49 +229,49 @@ class DatabaseDriver {
|
|
|
232
229
|
prop.ownColumns.forEach(joinColumn => data[joinColumn] = null);
|
|
233
230
|
return;
|
|
234
231
|
}
|
|
235
|
-
if (prop.customType && convertCustomTypes && !(prop.customType instanceof
|
|
232
|
+
if (prop.customType && convertCustomTypes && !(prop.customType instanceof JsonType && object) && !isRaw(data[k])) {
|
|
236
233
|
data[k] = prop.customType.convertToDatabaseValue(data[k], this.platform, { fromQuery: true, key: k, mode: 'query-data' });
|
|
237
234
|
}
|
|
238
|
-
if (prop.hasConvertToDatabaseValueSQL && !prop.object && !
|
|
235
|
+
if (prop.hasConvertToDatabaseValueSQL && !prop.object && !isRaw(data[k])) {
|
|
239
236
|
const quoted = this.platform.quoteValue(data[k]);
|
|
240
237
|
const sql = prop.customType.convertToDatabaseValueSQL(quoted, this.platform);
|
|
241
|
-
data[k] =
|
|
238
|
+
data[k] = raw(sql.replace(/\?/g, '\\?'));
|
|
242
239
|
}
|
|
243
240
|
if (prop.fieldNames) {
|
|
244
|
-
|
|
241
|
+
Utils.renameKey(data, k, prop.fieldNames[0]);
|
|
245
242
|
}
|
|
246
243
|
});
|
|
247
244
|
return data;
|
|
248
245
|
}
|
|
249
246
|
inlineEmbeddables(meta, data, where) {
|
|
250
|
-
/*
|
|
247
|
+
/* v8 ignore next 3 */
|
|
251
248
|
if (data == null) {
|
|
252
249
|
return;
|
|
253
250
|
}
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
251
|
+
Utils.keys(data).forEach(k => {
|
|
252
|
+
if (Utils.isOperator(k)) {
|
|
253
|
+
Utils.asArray(data[k]).forEach(payload => this.inlineEmbeddables(meta, payload, where));
|
|
257
254
|
}
|
|
258
255
|
});
|
|
259
256
|
meta.props.forEach(prop => {
|
|
260
|
-
if (prop.kind ===
|
|
257
|
+
if (prop.kind === ReferenceKind.EMBEDDED && prop.object && !where && Utils.isObject(data[prop.name])) {
|
|
261
258
|
return;
|
|
262
259
|
}
|
|
263
|
-
if (prop.kind ===
|
|
260
|
+
if (prop.kind === ReferenceKind.EMBEDDED && Utils.isObject(data[prop.name])) {
|
|
264
261
|
const props = prop.embeddedProps;
|
|
265
262
|
let unknownProp = false;
|
|
266
263
|
Object.keys(data[prop.name]).forEach(kk => {
|
|
267
264
|
// explicitly allow `$exists`, `$eq` and `$ne` operators here as they can't be misused this way
|
|
268
|
-
const operator = Object.keys(data[prop.name]).some(f =>
|
|
265
|
+
const operator = Object.keys(data[prop.name]).some(f => Utils.isOperator(f) && !['$exists', '$ne', '$eq'].includes(f));
|
|
269
266
|
if (operator) {
|
|
270
|
-
throw
|
|
267
|
+
throw ValidationError.cannotUseOperatorsInsideEmbeddables(meta.className, prop.name, data);
|
|
271
268
|
}
|
|
272
269
|
if (prop.object && where) {
|
|
273
270
|
const inline = (payload, sub, path) => {
|
|
274
|
-
if (sub.kind ===
|
|
271
|
+
if (sub.kind === ReferenceKind.EMBEDDED && Utils.isObject(payload[sub.embedded[1]])) {
|
|
275
272
|
return Object.keys(payload[sub.embedded[1]]).forEach(kkk => {
|
|
276
273
|
if (!sub.embeddedProps[kkk]) {
|
|
277
|
-
throw
|
|
274
|
+
throw ValidationError.invalidEmbeddableQuery(meta.className, kkk, sub.type);
|
|
278
275
|
}
|
|
279
276
|
inline(payload[sub.embedded[1]], sub.embeddedProps[kkk], [...path, sub.embedded[1]]);
|
|
280
277
|
});
|
|
@@ -284,7 +281,7 @@ class DatabaseDriver {
|
|
|
284
281
|
const parentPropName = kk.substring(0, kk.indexOf('.'));
|
|
285
282
|
// we might be using some native JSON operator, e.g. with mongodb's `$geoWithin` or `$exists`
|
|
286
283
|
if (props[kk]) {
|
|
287
|
-
/*
|
|
284
|
+
/* v8 ignore next */
|
|
288
285
|
inline(data[prop.name], props[kk] || props[parentPropName], [prop.name]);
|
|
289
286
|
}
|
|
290
287
|
else if (props[parentPropName]) {
|
|
@@ -298,7 +295,7 @@ class DatabaseDriver {
|
|
|
298
295
|
data[props[kk].name] = data[prop.name][props[kk].embedded[1]];
|
|
299
296
|
}
|
|
300
297
|
else {
|
|
301
|
-
throw
|
|
298
|
+
throw ValidationError.invalidEmbeddableQuery(meta.className, kk, prop.type);
|
|
302
299
|
}
|
|
303
300
|
});
|
|
304
301
|
if (!unknownProp) {
|
|
@@ -309,14 +306,14 @@ class DatabaseDriver {
|
|
|
309
306
|
}
|
|
310
307
|
getPrimaryKeyFields(entityName) {
|
|
311
308
|
const meta = this.metadata.find(entityName);
|
|
312
|
-
return meta ?
|
|
309
|
+
return meta ? Utils.flatten(meta.getPrimaryProps().map(pk => pk.fieldNames)) : [this.config.getNamingStrategy().referenceColumnName()];
|
|
313
310
|
}
|
|
314
311
|
createReplicas(cb) {
|
|
315
312
|
const replicas = this.config.get('replicas', []);
|
|
316
313
|
const ret = [];
|
|
317
314
|
const props = ['dbName', 'clientUrl', 'host', 'port', 'user', 'password', 'multipleStatements', 'pool', 'name', 'driverOptions'];
|
|
318
315
|
for (const conf of replicas) {
|
|
319
|
-
const replicaConfig =
|
|
316
|
+
const replicaConfig = Utils.copy(conf);
|
|
320
317
|
for (const prop of props) {
|
|
321
318
|
if (conf[prop]) {
|
|
322
319
|
continue;
|
|
@@ -341,7 +338,7 @@ class DatabaseDriver {
|
|
|
341
338
|
* @inheritDoc
|
|
342
339
|
*/
|
|
343
340
|
convertException(exception) {
|
|
344
|
-
if (exception instanceof
|
|
341
|
+
if (exception instanceof DriverException) {
|
|
345
342
|
return exception;
|
|
346
343
|
}
|
|
347
344
|
return this.platform.getExceptionConverter().convertException(exception);
|
|
@@ -376,4 +373,3 @@ class DatabaseDriver {
|
|
|
376
373
|
return options?.schema ?? options?.parentSchema ?? schemaName ?? this.config.getSchema();
|
|
377
374
|
}
|
|
378
375
|
}
|
|
379
|
-
exports.DatabaseDriver = DatabaseDriver;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type { ConnectionType, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, QBFilterQuery, IPrimaryKey, PopulateOptions, EntityDictionary, AutoPath, ObjectQuery, FilterObject, Populate } from '../typings';
|
|
2
|
-
import type { Connection, QueryResult, Transaction } from '../connections';
|
|
3
|
-
import type { FlushMode, LockMode, QueryOrderMap, QueryFlag, LoadStrategy, PopulateHint, PopulatePath } from '../enums';
|
|
4
|
-
import type { Platform } from '../platforms';
|
|
5
|
-
import type { MetadataStorage } from '../metadata';
|
|
6
|
-
import type { Collection } from '../entity/Collection';
|
|
7
|
-
import type { EntityManager } from '../EntityManager';
|
|
8
|
-
import type { DriverException } from '../exceptions';
|
|
9
|
-
import type { Configuration } from '../utils/Configuration';
|
|
10
|
-
import type { LoggingOptions, LogContext } from '../logging';
|
|
11
|
-
import type { RawQueryFragment } from '../utils/RawQueryFragment';
|
|
1
|
+
import type { ConnectionType, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, QBFilterQuery, IPrimaryKey, PopulateOptions, EntityDictionary, AutoPath, ObjectQuery, FilterObject, Populate } from '../typings.js';
|
|
2
|
+
import type { Connection, QueryResult, Transaction } from '../connections/Connection.js';
|
|
3
|
+
import type { FlushMode, LockMode, QueryOrderMap, QueryFlag, LoadStrategy, PopulateHint, PopulatePath } from '../enums.js';
|
|
4
|
+
import type { Platform } from '../platforms/Platform.js';
|
|
5
|
+
import type { MetadataStorage } from '../metadata/MetadataStorage.js';
|
|
6
|
+
import type { Collection } from '../entity/Collection.js';
|
|
7
|
+
import type { EntityManager } from '../EntityManager.js';
|
|
8
|
+
import type { DriverException } from '../exceptions.js';
|
|
9
|
+
import type { Configuration } from '../utils/Configuration.js';
|
|
10
|
+
import type { LoggingOptions, LogContext } from '../logging/Logger.js';
|
|
11
|
+
import type { RawQueryFragment } from '../utils/RawQueryFragment.js';
|
|
12
12
|
export declare const EntityManagerType: unique symbol;
|
|
13
13
|
export interface IDatabaseDriver<C extends Connection = Connection> {
|
|
14
14
|
[EntityManagerType]: EntityManager<this>;
|
|
15
15
|
readonly config: Configuration;
|
|
16
|
-
createEntityManager
|
|
16
|
+
createEntityManager(useContext?: boolean): this[typeof EntityManagerType];
|
|
17
17
|
connect(): Promise<C>;
|
|
18
18
|
close(force?: boolean): Promise<void>;
|
|
19
19
|
reconnect(): Promise<C>;
|
|
@@ -146,8 +146,11 @@ export interface FindOptions<Entity, Hint extends string = never, Fields extends
|
|
|
146
146
|
hintComments?: string | string[];
|
|
147
147
|
loggerContext?: LogContext;
|
|
148
148
|
logging?: LoggingOptions;
|
|
149
|
+
/** @internal used to apply filters to the auto-joined relations */
|
|
150
|
+
em?: EntityManager;
|
|
149
151
|
}
|
|
150
|
-
export interface FindByCursorOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never> extends Omit<FindOptions<T, P, F, E>, 'limit' | 'offset'> {
|
|
152
|
+
export interface FindByCursorOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never, I extends boolean = true> extends Omit<FindOptions<T, P, F, E>, 'limit' | 'offset'> {
|
|
153
|
+
includeCount?: I;
|
|
151
154
|
}
|
|
152
155
|
export interface FindOneOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never> extends Omit<FindOptions<T, P, F, E>, 'limit' | 'lockMode'> {
|
|
153
156
|
lockMode?: LockMode;
|
package/drivers/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './IDatabaseDriver';
|
|
2
|
-
export * from './DatabaseDriver';
|
|
1
|
+
export * from './IDatabaseDriver.js';
|
|
2
|
+
export * from './DatabaseDriver.js';
|
package/drivers/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./IDatabaseDriver"), exports);
|
|
18
|
-
__exportStar(require("./DatabaseDriver"), exports);
|
|
1
|
+
export * from './IDatabaseDriver.js';
|
|
2
|
+
export * from './DatabaseDriver.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inspect } from 'node:util';
|
|
2
|
-
import type { EntityDTO, EntityProperty, IPrimaryKey, Primary } from '../typings';
|
|
3
|
-
import { Reference } from './Reference';
|
|
2
|
+
import type { EntityDTO, EntityProperty, IPrimaryKey, Primary } from '../typings.js';
|
|
3
|
+
import { Reference } from './Reference.js';
|
|
4
4
|
export declare class ArrayCollection<T extends object, O extends object> {
|
|
5
5
|
readonly owner: O;
|
|
6
6
|
protected readonly items: Set<T>;
|
|
@@ -14,7 +14,7 @@ export declare class ArrayCollection<T extends object, O extends object> {
|
|
|
14
14
|
getItems(): T[];
|
|
15
15
|
toArray<TT extends T>(): EntityDTO<TT>[];
|
|
16
16
|
toJSON(): EntityDTO<T>[];
|
|
17
|
-
getIdentifiers<U extends IPrimaryKey = Primary<T> & IPrimaryKey>(field?: string): U[];
|
|
17
|
+
getIdentifiers<U extends IPrimaryKey = Primary<T> & IPrimaryKey>(field?: string | string[]): U[];
|
|
18
18
|
add(entity: T | Reference<T> | Iterable<T | Reference<T>>, ...entities: (T | Reference<T>)[]): void;
|
|
19
19
|
/**
|
|
20
20
|
* @internal
|