@yandjin-mikro-orm/core 6.1.4-rc-sti-changes-1
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 +553 -0
- package/EntityManager.js +1736 -0
- package/LICENSE +21 -0
- package/MikroORM.d.ts +102 -0
- package/MikroORM.js +258 -0
- package/README.md +383 -0
- package/cache/CacheAdapter.d.ts +40 -0
- package/cache/CacheAdapter.js +2 -0
- package/cache/FileCacheAdapter.d.ts +31 -0
- package/cache/FileCacheAdapter.js +90 -0
- package/cache/GeneratedCacheAdapter.d.ts +25 -0
- package/cache/GeneratedCacheAdapter.js +38 -0
- package/cache/MemoryCacheAdapter.d.ts +24 -0
- package/cache/MemoryCacheAdapter.js +44 -0
- package/cache/NullCacheAdapter.d.ts +19 -0
- package/cache/NullCacheAdapter.js +30 -0
- package/cache/index.d.ts +5 -0
- package/cache/index.js +21 -0
- package/connections/Connection.d.ts +85 -0
- package/connections/Connection.js +128 -0
- package/connections/index.d.ts +1 -0
- package/connections/index.js +17 -0
- package/decorators/Check.d.ts +3 -0
- package/decorators/Check.js +17 -0
- package/decorators/CreateRequestContext.d.ts +2 -0
- package/decorators/CreateRequestContext.js +31 -0
- package/decorators/Embeddable.d.ts +8 -0
- package/decorators/Embeddable.js +15 -0
- package/decorators/Embedded.d.ts +13 -0
- package/decorators/Embedded.js +21 -0
- package/decorators/EnsureRequestContext.d.ts +2 -0
- package/decorators/EnsureRequestContext.js +26 -0
- package/decorators/Entity.d.ts +18 -0
- package/decorators/Entity.js +17 -0
- package/decorators/Enum.d.ts +9 -0
- package/decorators/Enum.js +20 -0
- package/decorators/Filter.d.ts +2 -0
- package/decorators/Filter.js +12 -0
- package/decorators/Formula.d.ts +5 -0
- package/decorators/Formula.js +19 -0
- package/decorators/Indexed.d.ts +12 -0
- package/decorators/Indexed.js +25 -0
- package/decorators/ManyToMany.d.ts +21 -0
- package/decorators/ManyToMany.js +17 -0
- package/decorators/ManyToOne.d.ts +15 -0
- package/decorators/ManyToOne.js +17 -0
- package/decorators/OneToMany.d.ts +18 -0
- package/decorators/OneToMany.js +21 -0
- package/decorators/OneToOne.d.ts +12 -0
- package/decorators/OneToOne.js +11 -0
- package/decorators/PrimaryKey.d.ts +8 -0
- package/decorators/PrimaryKey.js +24 -0
- package/decorators/Property.d.ts +218 -0
- package/decorators/Property.js +35 -0
- package/decorators/Subscriber.d.ts +1 -0
- package/decorators/Subscriber.js +2 -0
- package/decorators/hooks.d.ts +16 -0
- package/decorators/hooks.js +60 -0
- package/decorators/index.d.ts +17 -0
- package/decorators/index.js +36 -0
- package/drivers/DatabaseDriver.d.ts +72 -0
- package/drivers/DatabaseDriver.js +358 -0
- package/drivers/IDatabaseDriver.d.ts +193 -0
- package/drivers/IDatabaseDriver.js +4 -0
- package/drivers/index.d.ts +2 -0
- package/drivers/index.js +18 -0
- package/entity/ArrayCollection.d.ts +113 -0
- package/entity/ArrayCollection.js +386 -0
- package/entity/BaseEntity.d.ts +22 -0
- package/entity/BaseEntity.js +47 -0
- package/entity/Collection.d.ts +104 -0
- package/entity/Collection.js +373 -0
- package/entity/EntityAssigner.d.ts +28 -0
- package/entity/EntityAssigner.js +226 -0
- package/entity/EntityFactory.d.ts +41 -0
- package/entity/EntityFactory.js +302 -0
- package/entity/EntityHelper.d.ts +29 -0
- package/entity/EntityHelper.js +250 -0
- package/entity/EntityIdentifier.d.ts +10 -0
- package/entity/EntityIdentifier.js +19 -0
- package/entity/EntityLoader.d.ts +65 -0
- package/entity/EntityLoader.js +579 -0
- package/entity/EntityRepository.d.ts +161 -0
- package/entity/EntityRepository.js +207 -0
- package/entity/EntityValidator.d.ts +19 -0
- package/entity/EntityValidator.js +152 -0
- package/entity/Reference.d.ts +89 -0
- package/entity/Reference.js +242 -0
- package/entity/WrappedEntity.d.ts +67 -0
- package/entity/WrappedEntity.js +146 -0
- package/entity/index.d.ts +13 -0
- package/entity/index.js +29 -0
- package/entity/wrap.d.ts +15 -0
- package/entity/wrap.js +26 -0
- package/enums.d.ts +160 -0
- package/enums.js +169 -0
- package/errors.d.ts +65 -0
- package/errors.js +222 -0
- package/events/EventManager.d.ts +17 -0
- package/events/EventManager.js +77 -0
- package/events/EventSubscriber.d.ts +39 -0
- package/events/EventSubscriber.js +2 -0
- package/events/TransactionEventBroadcaster.d.ts +11 -0
- package/events/TransactionEventBroadcaster.js +17 -0
- package/events/index.d.ts +3 -0
- package/events/index.js +19 -0
- package/exceptions.d.ts +104 -0
- package/exceptions.js +130 -0
- package/hydration/Hydrator.d.ts +23 -0
- package/hydration/Hydrator.js +51 -0
- package/hydration/ObjectHydrator.d.ts +24 -0
- package/hydration/ObjectHydrator.js +332 -0
- package/hydration/index.d.ts +2 -0
- package/hydration/index.js +18 -0
- package/index.d.ts +25 -0
- package/index.js +50 -0
- package/index.mjs +192 -0
- package/logging/DefaultLogger.d.ts +32 -0
- package/logging/DefaultLogger.js +90 -0
- package/logging/Logger.d.ts +56 -0
- package/logging/Logger.js +2 -0
- package/logging/SimpleLogger.d.ts +17 -0
- package/logging/SimpleLogger.js +31 -0
- package/logging/colors.d.ts +9 -0
- package/logging/colors.js +20 -0
- package/logging/index.d.ts +4 -0
- package/logging/index.js +20 -0
- package/metadata/EntitySchema.d.ts +74 -0
- package/metadata/EntitySchema.js +293 -0
- package/metadata/MetadataDiscovery.d.ts +71 -0
- package/metadata/MetadataDiscovery.js +1244 -0
- package/metadata/MetadataProvider.d.ts +11 -0
- package/metadata/MetadataProvider.js +23 -0
- package/metadata/MetadataStorage.d.ts +22 -0
- package/metadata/MetadataStorage.js +87 -0
- package/metadata/MetadataValidator.d.ts +24 -0
- package/metadata/MetadataValidator.js +213 -0
- package/metadata/ReflectMetadataProvider.d.ts +8 -0
- package/metadata/ReflectMetadataProvider.js +48 -0
- package/metadata/index.d.ts +6 -0
- package/metadata/index.js +22 -0
- package/naming-strategy/AbstractNamingStrategy.d.ts +18 -0
- package/naming-strategy/AbstractNamingStrategy.js +48 -0
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +12 -0
- package/naming-strategy/EntityCaseNamingStrategy.js +32 -0
- package/naming-strategy/MongoNamingStrategy.d.ts +9 -0
- package/naming-strategy/MongoNamingStrategy.js +25 -0
- package/naming-strategy/NamingStrategy.d.ts +52 -0
- package/naming-strategy/NamingStrategy.js +2 -0
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +10 -0
- package/naming-strategy/UnderscoreNamingStrategy.js +28 -0
- package/naming-strategy/index.d.ts +5 -0
- package/naming-strategy/index.js +21 -0
- package/package.json +70 -0
- package/platforms/ExceptionConverter.d.ts +5 -0
- package/platforms/ExceptionConverter.js +11 -0
- package/platforms/Platform.d.ts +201 -0
- package/platforms/Platform.js +452 -0
- package/platforms/index.d.ts +2 -0
- package/platforms/index.js +18 -0
- package/serialization/EntitySerializer.d.ts +34 -0
- package/serialization/EntitySerializer.js +206 -0
- package/serialization/EntityTransformer.d.ts +8 -0
- package/serialization/EntityTransformer.js +192 -0
- package/serialization/SerializationContext.d.ts +30 -0
- package/serialization/SerializationContext.js +111 -0
- package/serialization/index.d.ts +3 -0
- package/serialization/index.js +19 -0
- package/types/ArrayType.d.ts +13 -0
- package/types/ArrayType.js +47 -0
- package/types/BigIntType.d.ts +16 -0
- package/types/BigIntType.js +45 -0
- package/types/BlobType.d.ts +10 -0
- package/types/BlobType.js +27 -0
- package/types/BooleanType.d.ts +8 -0
- package/types/BooleanType.js +16 -0
- package/types/DateTimeType.d.ts +8 -0
- package/types/DateTimeType.js +16 -0
- package/types/DateType.d.ts +8 -0
- package/types/DateType.js +16 -0
- package/types/DecimalType.d.ts +11 -0
- package/types/DecimalType.js +22 -0
- package/types/DoubleType.d.ts +11 -0
- package/types/DoubleType.js +22 -0
- package/types/EnumArrayType.d.ts +9 -0
- package/types/EnumArrayType.js +32 -0
- package/types/EnumType.d.ts +8 -0
- package/types/EnumType.js +16 -0
- package/types/FloatType.d.ts +8 -0
- package/types/FloatType.js +16 -0
- package/types/IntegerType.d.ts +8 -0
- package/types/IntegerType.js +16 -0
- package/types/IntervalType.d.ts +8 -0
- package/types/IntervalType.js +16 -0
- package/types/JsonType.d.ts +13 -0
- package/types/JsonType.js +34 -0
- package/types/MediumIntType.d.ts +6 -0
- package/types/MediumIntType.js +10 -0
- package/types/SmallIntType.d.ts +8 -0
- package/types/SmallIntType.js +16 -0
- package/types/StringType.d.ts +8 -0
- package/types/StringType.js +16 -0
- package/types/TextType.d.ts +8 -0
- package/types/TextType.js +16 -0
- package/types/TimeType.d.ts +9 -0
- package/types/TimeType.js +23 -0
- package/types/TinyIntType.d.ts +8 -0
- package/types/TinyIntType.js +16 -0
- package/types/Type.d.ts +64 -0
- package/types/Type.js +84 -0
- package/types/Uint8ArrayType.d.ts +11 -0
- package/types/Uint8ArrayType.js +37 -0
- package/types/UnknownType.d.ts +7 -0
- package/types/UnknownType.js +13 -0
- package/types/UuidType.d.ts +7 -0
- package/types/UuidType.js +13 -0
- package/types/index.d.ts +75 -0
- package/types/index.js +77 -0
- package/typings.d.ts +767 -0
- package/typings.js +198 -0
- package/unit-of-work/ChangeSet.d.ts +34 -0
- package/unit-of-work/ChangeSet.js +62 -0
- package/unit-of-work/ChangeSetComputer.d.ts +26 -0
- package/unit-of-work/ChangeSetComputer.js +153 -0
- package/unit-of-work/ChangeSetPersister.d.ts +50 -0
- package/unit-of-work/ChangeSetPersister.js +361 -0
- package/unit-of-work/CommitOrderCalculator.d.ts +62 -0
- package/unit-of-work/CommitOrderCalculator.js +113 -0
- package/unit-of-work/IdentityMap.d.ts +17 -0
- package/unit-of-work/IdentityMap.js +84 -0
- package/unit-of-work/UnitOfWork.d.ts +124 -0
- package/unit-of-work/UnitOfWork.js +1013 -0
- package/unit-of-work/index.d.ts +6 -0
- package/unit-of-work/index.js +22 -0
- package/utils/AbstractSchemaGenerator.d.ts +38 -0
- package/utils/AbstractSchemaGenerator.js +101 -0
- package/utils/Configuration.d.ts +390 -0
- package/utils/Configuration.js +357 -0
- package/utils/ConfigurationLoader.d.ts +29 -0
- package/utils/ConfigurationLoader.js +282 -0
- package/utils/Cursor.d.ts +77 -0
- package/utils/Cursor.js +169 -0
- package/utils/DataloaderUtils.d.ts +43 -0
- package/utils/DataloaderUtils.js +194 -0
- package/utils/EntityComparator.d.ts +73 -0
- package/utils/EntityComparator.js +568 -0
- package/utils/NullHighlighter.d.ts +4 -0
- package/utils/NullHighlighter.js +9 -0
- package/utils/QueryHelper.d.ts +28 -0
- package/utils/QueryHelper.js +228 -0
- package/utils/RawQueryFragment.d.ts +96 -0
- package/utils/RawQueryFragment.js +188 -0
- package/utils/RequestContext.d.ts +34 -0
- package/utils/RequestContext.js +54 -0
- package/utils/TransactionContext.d.ts +19 -0
- package/utils/TransactionContext.js +34 -0
- package/utils/Utils.d.ts +274 -0
- package/utils/Utils.js +1073 -0
- package/utils/clone.d.ts +6 -0
- package/utils/clone.js +127 -0
- package/utils/index.d.ts +13 -0
- package/utils/index.js +29 -0
- package/utils/upsert-utils.d.ts +6 -0
- package/utils/upsert-utils.js +33 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface NamingStrategy {
|
|
2
|
+
/**
|
|
3
|
+
* Return a name of the class based on its file name
|
|
4
|
+
*/
|
|
5
|
+
getClassName(file: string, separator?: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Return a table name for an entity class
|
|
8
|
+
*/
|
|
9
|
+
classToTableName(entityName: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Return a migration name. This name should allow ordering.
|
|
12
|
+
*/
|
|
13
|
+
classToMigrationName(timestamp: string, customMigrationName?: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Return a column name for a property
|
|
16
|
+
*/
|
|
17
|
+
propertyToColumnName(propertyName: string, object?: boolean): string;
|
|
18
|
+
/**
|
|
19
|
+
* Return a name of the entity class based on database table name (used in `EntityGenerator`).
|
|
20
|
+
* Default implementation ignores the schema name.
|
|
21
|
+
*/
|
|
22
|
+
getEntityName(tableName: string, schemaName?: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Return a property for a column name (used in `EntityGenerator`).
|
|
25
|
+
*/
|
|
26
|
+
columnNameToProperty(columnName: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Return the default reference column name
|
|
29
|
+
*/
|
|
30
|
+
referenceColumnName(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Return a join column name for a property
|
|
33
|
+
*/
|
|
34
|
+
joinColumnName(propertyName: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Return a join table name
|
|
37
|
+
*/
|
|
38
|
+
joinTableName(sourceEntity: string, targetEntity: string, propertyName: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Return the foreign key column name for the given parameters
|
|
41
|
+
*/
|
|
42
|
+
joinKeyColumnName(entityName: string, referencedColumnName?: string, composite?: boolean): string;
|
|
43
|
+
/**
|
|
44
|
+
* Returns key/constraint name for given type. Some drivers might not support all the types (e.g. mysql and sqlite enforce the PK name).
|
|
45
|
+
*/
|
|
46
|
+
indexName(tableName: string, columns: string[], type: 'primary' | 'foreign' | 'unique' | 'index' | 'sequence' | 'check'): string;
|
|
47
|
+
/**
|
|
48
|
+
* Returns alias name for given entity. The alias needs to be unique across the query, which is by default
|
|
49
|
+
* ensured via appended index parameter. It is optional to use it as long as you ensure it will be unique.
|
|
50
|
+
*/
|
|
51
|
+
aliasName(entityName: string, index: number): string;
|
|
52
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractNamingStrategy } from './AbstractNamingStrategy';
|
|
2
|
+
export declare class UnderscoreNamingStrategy extends AbstractNamingStrategy {
|
|
3
|
+
classToTableName(entityName: string): string;
|
|
4
|
+
joinColumnName(propertyName: string): string;
|
|
5
|
+
joinKeyColumnName(entityName: string, referencedColumnName?: string): string;
|
|
6
|
+
joinTableName(sourceEntity: string, targetEntity: string, propertyName: string): string;
|
|
7
|
+
propertyToColumnName(propertyName: string, object?: boolean): string;
|
|
8
|
+
referenceColumnName(): string;
|
|
9
|
+
private underscore;
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnderscoreNamingStrategy = void 0;
|
|
4
|
+
const AbstractNamingStrategy_1 = require("./AbstractNamingStrategy");
|
|
5
|
+
class UnderscoreNamingStrategy extends AbstractNamingStrategy_1.AbstractNamingStrategy {
|
|
6
|
+
classToTableName(entityName) {
|
|
7
|
+
return this.underscore(entityName);
|
|
8
|
+
}
|
|
9
|
+
joinColumnName(propertyName) {
|
|
10
|
+
return this.underscore(propertyName) + '_' + this.referenceColumnName();
|
|
11
|
+
}
|
|
12
|
+
joinKeyColumnName(entityName, referencedColumnName) {
|
|
13
|
+
return this.classToTableName(entityName) + '_' + (referencedColumnName || this.referenceColumnName());
|
|
14
|
+
}
|
|
15
|
+
joinTableName(sourceEntity, targetEntity, propertyName) {
|
|
16
|
+
return this.classToTableName(sourceEntity) + '_' + this.classToTableName(propertyName);
|
|
17
|
+
}
|
|
18
|
+
propertyToColumnName(propertyName, object) {
|
|
19
|
+
return this.underscore(propertyName);
|
|
20
|
+
}
|
|
21
|
+
referenceColumnName() {
|
|
22
|
+
return 'id';
|
|
23
|
+
}
|
|
24
|
+
underscore(name) {
|
|
25
|
+
return name.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.UnderscoreNamingStrategy = UnderscoreNamingStrategy;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
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("./NamingStrategy"), exports);
|
|
18
|
+
__exportStar(require("./AbstractNamingStrategy"), exports);
|
|
19
|
+
__exportStar(require("./MongoNamingStrategy"), exports);
|
|
20
|
+
__exportStar(require("./UnderscoreNamingStrategy"), exports);
|
|
21
|
+
__exportStar(require("./EntityCaseNamingStrategy"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yandjin-mikro-orm/core",
|
|
3
|
+
"version": "6.1.4-rc-sti-changes-1",
|
|
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
|
+
"main": "index.js",
|
|
6
|
+
"module": "index.mjs",
|
|
7
|
+
"typings": "index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"default": "./index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"require": "./index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
|
|
21
|
+
},
|
|
22
|
+
"funding": "https://github.com/sponsors/b4nan",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"orm",
|
|
25
|
+
"mongo",
|
|
26
|
+
"mongodb",
|
|
27
|
+
"mysql",
|
|
28
|
+
"mariadb",
|
|
29
|
+
"postgresql",
|
|
30
|
+
"sqlite",
|
|
31
|
+
"sqlite3",
|
|
32
|
+
"ts",
|
|
33
|
+
"typescript",
|
|
34
|
+
"js",
|
|
35
|
+
"javascript",
|
|
36
|
+
"entity",
|
|
37
|
+
"ddd",
|
|
38
|
+
"mikro-orm",
|
|
39
|
+
"unit-of-work",
|
|
40
|
+
"data-mapper",
|
|
41
|
+
"identity-map"
|
|
42
|
+
],
|
|
43
|
+
"author": "Martin Adámek",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/mikro-orm/mikro-orm/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://mikro-orm.io",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">= 18.12.0"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "yarn clean && yarn compile && yarn copy && yarn run -T gen-esm-wrapper index.js index.mjs",
|
|
54
|
+
"clean": "yarn run -T rimraf ./dist",
|
|
55
|
+
"compile": "yarn run -T tsc -p tsconfig.build.json",
|
|
56
|
+
"copy": "node ../../scripts/copy.mjs"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"dataloader": "2.2.2",
|
|
63
|
+
"dotenv": "16.4.4",
|
|
64
|
+
"esprima": "4.0.1",
|
|
65
|
+
"fs-extra": "11.2.0",
|
|
66
|
+
"globby": "11.1.0",
|
|
67
|
+
"reflect-metadata": "0.2.2",
|
|
68
|
+
"yandjin-mikro-orm": "6.1.4-rc-sti-changes-1"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExceptionConverter = void 0;
|
|
4
|
+
const exceptions_1 = require("../exceptions");
|
|
5
|
+
class ExceptionConverter {
|
|
6
|
+
/* istanbul ignore next */
|
|
7
|
+
convertException(exception) {
|
|
8
|
+
return new exceptions_1.DriverException(exception);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ExceptionConverter = ExceptionConverter;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { EntityRepository } from '../entity';
|
|
2
|
+
import { type NamingStrategy } from '../naming-strategy';
|
|
3
|
+
import type { Constructor, EntityProperty, IPrimaryKey, ISchemaGenerator, PopulateOptions, Primary, EntityMetadata, SimpleColumnMeta } from '../typings';
|
|
4
|
+
import { ExceptionConverter } from './ExceptionConverter';
|
|
5
|
+
import type { EntityManager } from '../EntityManager';
|
|
6
|
+
import type { Configuration } from '../utils/Configuration';
|
|
7
|
+
import type { IDatabaseDriver } from '../drivers/IDatabaseDriver';
|
|
8
|
+
import { Type } from '../types';
|
|
9
|
+
import type { MikroORM } from '../MikroORM';
|
|
10
|
+
import type { TransformContext } from '../types/Type';
|
|
11
|
+
export declare const JsonProperty: unique symbol;
|
|
12
|
+
export declare abstract class Platform {
|
|
13
|
+
protected readonly exceptionConverter: ExceptionConverter;
|
|
14
|
+
protected config: Configuration;
|
|
15
|
+
protected namingStrategy: NamingStrategy;
|
|
16
|
+
protected timezone?: string;
|
|
17
|
+
usesPivotTable(): boolean;
|
|
18
|
+
supportsTransactions(): boolean;
|
|
19
|
+
usesImplicitTransactions(): boolean;
|
|
20
|
+
getNamingStrategy(): {
|
|
21
|
+
new (): NamingStrategy;
|
|
22
|
+
};
|
|
23
|
+
usesReturningStatement(): boolean;
|
|
24
|
+
usesCascadeStatement(): boolean;
|
|
25
|
+
/** for postgres native enums */
|
|
26
|
+
supportsNativeEnums(): boolean;
|
|
27
|
+
getSchemaHelper(): unknown;
|
|
28
|
+
indexForeignKeys(): boolean;
|
|
29
|
+
allowsMultiInsert(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether or not the driver supports retuning list of created PKs back when multi-inserting
|
|
32
|
+
*/
|
|
33
|
+
usesBatchInserts(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether or not the driver supports updating many records at once
|
|
36
|
+
*/
|
|
37
|
+
usesBatchUpdates(): boolean;
|
|
38
|
+
usesDefaultKeyword(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Normalizes primary key wrapper to scalar value (e.g. mongodb's ObjectId to string)
|
|
41
|
+
*/
|
|
42
|
+
normalizePrimaryKey<T extends number | string = number | string>(data: Primary<T> | IPrimaryKey): T;
|
|
43
|
+
/**
|
|
44
|
+
* Converts scalar primary key representation to native driver wrapper (e.g. string to mongodb's ObjectId)
|
|
45
|
+
*/
|
|
46
|
+
denormalizePrimaryKey(data: IPrimaryKey): IPrimaryKey;
|
|
47
|
+
/**
|
|
48
|
+
* Used when serializing via toObject and toJSON methods, allows to use different PK field name (like `id` instead of `_id`)
|
|
49
|
+
*/
|
|
50
|
+
getSerializedPrimaryKeyField(field: string): string;
|
|
51
|
+
usesDifferentSerializedPrimaryKey(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the SQL specific for the platform to get the current timestamp
|
|
54
|
+
*/
|
|
55
|
+
getCurrentTimestampSQL(length?: number): string;
|
|
56
|
+
getDateTimeTypeDeclarationSQL(column?: {
|
|
57
|
+
length?: number;
|
|
58
|
+
}): string;
|
|
59
|
+
getDefaultDateTimeLength(): number;
|
|
60
|
+
getDateTypeDeclarationSQL(length?: number): string;
|
|
61
|
+
getTimeTypeDeclarationSQL(length?: number): string;
|
|
62
|
+
getRegExpOperator(val?: unknown, flags?: string): string;
|
|
63
|
+
getRegExpValue(val: RegExp): {
|
|
64
|
+
$re: string;
|
|
65
|
+
$flags?: string;
|
|
66
|
+
};
|
|
67
|
+
isAllowedTopLevelOperator(operator: string): boolean;
|
|
68
|
+
quoteVersionValue(value: Date | number, prop: EntityProperty): Date | string | number;
|
|
69
|
+
getDefaultVersionLength(): number;
|
|
70
|
+
allowsComparingTuples(): boolean;
|
|
71
|
+
allowsUniqueBatchUpdates(): boolean;
|
|
72
|
+
isBigIntProperty(prop: EntityProperty): boolean;
|
|
73
|
+
isRaw(value: any): boolean;
|
|
74
|
+
getDefaultSchemaName(): string | undefined;
|
|
75
|
+
getBooleanTypeDeclarationSQL(): string;
|
|
76
|
+
getIntegerTypeDeclarationSQL(column: {
|
|
77
|
+
length?: number;
|
|
78
|
+
unsigned?: boolean;
|
|
79
|
+
autoincrement?: boolean;
|
|
80
|
+
}): string;
|
|
81
|
+
getSmallIntTypeDeclarationSQL(column: {
|
|
82
|
+
length?: number;
|
|
83
|
+
unsigned?: boolean;
|
|
84
|
+
autoincrement?: boolean;
|
|
85
|
+
}): string;
|
|
86
|
+
getMediumIntTypeDeclarationSQL(column: {
|
|
87
|
+
length?: number;
|
|
88
|
+
unsigned?: boolean;
|
|
89
|
+
autoincrement?: boolean;
|
|
90
|
+
}): string;
|
|
91
|
+
getTinyIntTypeDeclarationSQL(column: {
|
|
92
|
+
length?: number;
|
|
93
|
+
unsigned?: boolean;
|
|
94
|
+
autoincrement?: boolean;
|
|
95
|
+
}): string;
|
|
96
|
+
getBigIntTypeDeclarationSQL(column: {
|
|
97
|
+
length?: number;
|
|
98
|
+
unsigned?: boolean;
|
|
99
|
+
autoincrement?: boolean;
|
|
100
|
+
}): string;
|
|
101
|
+
getVarcharTypeDeclarationSQL(column: {
|
|
102
|
+
length?: number;
|
|
103
|
+
}): string;
|
|
104
|
+
getIntervalTypeDeclarationSQL(column: {
|
|
105
|
+
length?: number;
|
|
106
|
+
}): string;
|
|
107
|
+
getTextTypeDeclarationSQL(_column: {
|
|
108
|
+
length?: number;
|
|
109
|
+
}): string;
|
|
110
|
+
getEnumTypeDeclarationSQL(column: {
|
|
111
|
+
items?: unknown[];
|
|
112
|
+
fieldNames: string[];
|
|
113
|
+
length?: number;
|
|
114
|
+
unsigned?: boolean;
|
|
115
|
+
autoincrement?: boolean;
|
|
116
|
+
}): string;
|
|
117
|
+
getFloatDeclarationSQL(): string;
|
|
118
|
+
getDoubleDeclarationSQL(): string;
|
|
119
|
+
getDecimalTypeDeclarationSQL(column: {
|
|
120
|
+
precision?: number;
|
|
121
|
+
scale?: number;
|
|
122
|
+
}): string;
|
|
123
|
+
getUuidTypeDeclarationSQL(column: {
|
|
124
|
+
length?: number;
|
|
125
|
+
}): string;
|
|
126
|
+
extractSimpleType(type: string): string;
|
|
127
|
+
getMappedType(type: string): Type<unknown>;
|
|
128
|
+
getDefaultMappedType(type: string): Type<unknown>;
|
|
129
|
+
supportsMultipleStatements(): boolean;
|
|
130
|
+
getArrayDeclarationSQL(): string;
|
|
131
|
+
marshallArray(values: string[]): string;
|
|
132
|
+
unmarshallArray(value: string): string[];
|
|
133
|
+
getBlobDeclarationSQL(): string;
|
|
134
|
+
getJsonDeclarationSQL(): string;
|
|
135
|
+
getSearchJsonPropertySQL(path: string, type: string, aliased: boolean): string;
|
|
136
|
+
getSearchJsonPropertyKey(path: string[], type: string, aliased: boolean, value?: unknown): string;
|
|
137
|
+
getJsonIndexDefinition(index: {
|
|
138
|
+
columnNames: string[];
|
|
139
|
+
}): string[];
|
|
140
|
+
getFullTextWhereClause(prop: EntityProperty): string;
|
|
141
|
+
supportsCreatingFullTextIndex(): boolean;
|
|
142
|
+
getFullTextIndexExpression(indexName: string, schemaName: string | undefined, tableName: string, columns: SimpleColumnMeta[]): string;
|
|
143
|
+
convertsJsonAutomatically(): boolean;
|
|
144
|
+
convertJsonToDatabaseValue(value: unknown, context?: TransformContext): unknown;
|
|
145
|
+
convertJsonToJSValue(value: unknown): unknown;
|
|
146
|
+
convertIntervalToJSValue(value: string): unknown;
|
|
147
|
+
convertIntervalToDatabaseValue(value: unknown): unknown;
|
|
148
|
+
parseDate(value: string | number): Date;
|
|
149
|
+
getRepositoryClass<T extends object>(): Constructor<EntityRepository<T>>;
|
|
150
|
+
getDefaultCharset(): string;
|
|
151
|
+
getExceptionConverter(): ExceptionConverter;
|
|
152
|
+
/**
|
|
153
|
+
* Allows to register extensions of the driver automatically (e.g. `SchemaGenerator` extension in SQL drivers).
|
|
154
|
+
*/
|
|
155
|
+
lookupExtensions(orm: MikroORM): void;
|
|
156
|
+
getSchemaGenerator(driver: IDatabaseDriver, em?: EntityManager): ISchemaGenerator;
|
|
157
|
+
processDateProperty(value: unknown): string | number | Date;
|
|
158
|
+
quoteIdentifier(id: string, quote?: string): string;
|
|
159
|
+
quoteValue(value: any): string;
|
|
160
|
+
formatQuery(sql: string, params: readonly any[]): string;
|
|
161
|
+
cloneEmbeddable<T>(data: T): T;
|
|
162
|
+
setConfig(config: Configuration): void;
|
|
163
|
+
getConfig(): Configuration;
|
|
164
|
+
getTimezone(): string | undefined;
|
|
165
|
+
isNumericColumn(mappedType: Type<unknown>): boolean;
|
|
166
|
+
supportsUnsigned(): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Returns the default name of index for the given columns
|
|
169
|
+
*/
|
|
170
|
+
getIndexName(tableName: string, columns: string[], type: 'index' | 'unique' | 'foreign' | 'primary' | 'sequence'): string;
|
|
171
|
+
getDefaultPrimaryName(tableName: string, columns: string[]): string;
|
|
172
|
+
supportsCustomPrimaryKeyNames(): boolean;
|
|
173
|
+
isPopulated<T>(key: string, populate: PopulateOptions<T>[] | boolean): boolean;
|
|
174
|
+
shouldHaveColumn<T>(prop: EntityProperty<T>, populate: PopulateOptions<T>[] | boolean, exclude?: string[], includeFormulas?: boolean): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Currently not supported due to how knex does complex sqlite diffing (always based on current schema)
|
|
177
|
+
*/
|
|
178
|
+
supportsDownMigrations(): boolean;
|
|
179
|
+
validateMetadata(meta: EntityMetadata): void;
|
|
180
|
+
/**
|
|
181
|
+
* Generates a custom order by statement given a set of in order values, eg.
|
|
182
|
+
* ORDER BY (CASE WHEN priority = 'low' THEN 1 WHEN priority = 'medium' THEN 2 ELSE NULL END)
|
|
183
|
+
*/
|
|
184
|
+
generateCustomOrder(escapedColumn: string, values: unknown[]): void;
|
|
185
|
+
/**
|
|
186
|
+
* @internal
|
|
187
|
+
*/
|
|
188
|
+
castColumn(prop?: {
|
|
189
|
+
columnTypes?: string[];
|
|
190
|
+
}): string;
|
|
191
|
+
/**
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
castJsonValue(prop?: {
|
|
195
|
+
columnTypes?: string[];
|
|
196
|
+
}): string;
|
|
197
|
+
/**
|
|
198
|
+
* @internal
|
|
199
|
+
*/
|
|
200
|
+
clone(): this;
|
|
201
|
+
}
|