@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
package/types/Type.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { inspect } from 'util';
|
|
3
|
+
import type { Platform } from '../platforms';
|
|
4
|
+
import type { Constructor, EntityMetadata, EntityProperty } from '../typings';
|
|
5
|
+
export interface TransformContext {
|
|
6
|
+
fromQuery?: boolean;
|
|
7
|
+
key?: string;
|
|
8
|
+
mode?: 'hydration' | 'query' | 'query-data' | 'discovery' | 'serialization';
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class Type<JSType = string, DBType = JSType> {
|
|
11
|
+
private static readonly types;
|
|
12
|
+
platform?: Platform;
|
|
13
|
+
meta?: EntityMetadata;
|
|
14
|
+
prop?: EntityProperty;
|
|
15
|
+
/**
|
|
16
|
+
* Converts a value from its JS representation to its database representation of this type.
|
|
17
|
+
*/
|
|
18
|
+
convertToDatabaseValue(value: JSType, platform: Platform, context?: TransformContext): DBType;
|
|
19
|
+
/**
|
|
20
|
+
* Converts a value from its database representation to its JS representation of this type.
|
|
21
|
+
*/
|
|
22
|
+
convertToJSValue(value: DBType, platform: Platform): JSType;
|
|
23
|
+
/**
|
|
24
|
+
* Converts a value from its JS representation to its database representation of this type.
|
|
25
|
+
*/
|
|
26
|
+
convertToDatabaseValueSQL?(key: string, platform: Platform): string;
|
|
27
|
+
/**
|
|
28
|
+
* Modifies the SQL expression (identifier, parameter) to convert to a JS value.
|
|
29
|
+
*/
|
|
30
|
+
convertToJSValueSQL?(key: string, platform: Platform): string;
|
|
31
|
+
/**
|
|
32
|
+
* How should the raw database values be compared? Used in `EntityComparator`.
|
|
33
|
+
* Possible values: string | number | boolean | date | any | buffer | array
|
|
34
|
+
*/
|
|
35
|
+
compareAsType(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Allows to override the internal comparison logic.
|
|
38
|
+
*/
|
|
39
|
+
compareValues?(a: DBType, b: DBType): boolean;
|
|
40
|
+
get runtimeType(): string;
|
|
41
|
+
get name(): string;
|
|
42
|
+
/**
|
|
43
|
+
* When a value is hydrated, we convert it back to the database value to ensure comparability,
|
|
44
|
+
* as often the raw database response is not the same as the `convertToDatabaseValue` result.
|
|
45
|
+
* This allows to disable the additional conversion in case you know it is not needed.
|
|
46
|
+
*/
|
|
47
|
+
ensureComparable<T extends object>(meta: EntityMetadata<T>, prop: EntityProperty<T>): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Converts a value from its JS representation to its serialized JSON form of this type.
|
|
50
|
+
* By default uses the runtime value.
|
|
51
|
+
*/
|
|
52
|
+
toJSON(value: JSType, platform: Platform): JSType | DBType;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the SQL declaration snippet for a field of this type.
|
|
55
|
+
*/
|
|
56
|
+
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
57
|
+
static getType<JSType, DBType = JSType>(cls: Constructor<Type<JSType, DBType>>): Type<JSType, DBType>;
|
|
58
|
+
/**
|
|
59
|
+
* Checks whether the argument is instance of `Type`.
|
|
60
|
+
*/
|
|
61
|
+
static isMappedType(data: any): data is Type<any>;
|
|
62
|
+
/** @ignore */
|
|
63
|
+
[inspect.custom](depth: number): string;
|
|
64
|
+
}
|
package/types/Type.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Type = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
5
|
+
class Type {
|
|
6
|
+
static types = new Map();
|
|
7
|
+
platform;
|
|
8
|
+
meta;
|
|
9
|
+
prop;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a value from its JS representation to its database representation of this type.
|
|
12
|
+
*/
|
|
13
|
+
convertToDatabaseValue(value, platform, context) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Converts a value from its database representation to its JS representation of this type.
|
|
18
|
+
*/
|
|
19
|
+
convertToJSValue(value, platform) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* How should the raw database values be compared? Used in `EntityComparator`.
|
|
24
|
+
* Possible values: string | number | boolean | date | any | buffer | array
|
|
25
|
+
*/
|
|
26
|
+
compareAsType() {
|
|
27
|
+
return 'any';
|
|
28
|
+
}
|
|
29
|
+
get runtimeType() {
|
|
30
|
+
const compareType = this.compareAsType();
|
|
31
|
+
return compareType === 'any' ? 'string' : compareType;
|
|
32
|
+
}
|
|
33
|
+
get name() {
|
|
34
|
+
return this.constructor.name;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* When a value is hydrated, we convert it back to the database value to ensure comparability,
|
|
38
|
+
* as often the raw database response is not the same as the `convertToDatabaseValue` result.
|
|
39
|
+
* This allows to disable the additional conversion in case you know it is not needed.
|
|
40
|
+
*/
|
|
41
|
+
ensureComparable(meta, prop) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Converts a value from its JS representation to its serialized JSON form of this type.
|
|
46
|
+
* By default uses the runtime value.
|
|
47
|
+
*/
|
|
48
|
+
toJSON(value, platform) {
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets the SQL declaration snippet for a field of this type.
|
|
53
|
+
*/
|
|
54
|
+
getColumnType(prop, platform) {
|
|
55
|
+
return prop.columnTypes?.[0] ?? platform.getTextTypeDeclarationSQL(prop);
|
|
56
|
+
}
|
|
57
|
+
static getType(cls) {
|
|
58
|
+
const key = cls.name;
|
|
59
|
+
if (!Type.types.has(key)) {
|
|
60
|
+
Type.types.set(key, new cls());
|
|
61
|
+
}
|
|
62
|
+
return Type.types.get(key);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Checks whether the argument is instance of `Type`.
|
|
66
|
+
*/
|
|
67
|
+
static isMappedType(data) {
|
|
68
|
+
return !!data?.__mappedType;
|
|
69
|
+
}
|
|
70
|
+
/** @ignore */
|
|
71
|
+
[util_1.inspect.custom](depth) {
|
|
72
|
+
const object = { ...this };
|
|
73
|
+
const hidden = ['prop', 'platform', 'meta'];
|
|
74
|
+
hidden.forEach(k => delete object[k]);
|
|
75
|
+
const ret = (0, util_1.inspect)(object, { depth });
|
|
76
|
+
const name = this.constructor.name;
|
|
77
|
+
/* istanbul ignore next */
|
|
78
|
+
return ret === '[Object]' ? `[${name}]` : name + ' ' + ret;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.Type = Type;
|
|
82
|
+
Object.defineProperties(Type.prototype, {
|
|
83
|
+
__mappedType: { value: true, enumerable: false, writable: false },
|
|
84
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Type } from './Type';
|
|
3
|
+
import type { Platform } from '../platforms';
|
|
4
|
+
import type { EntityProperty } from '../typings';
|
|
5
|
+
export declare class Uint8ArrayType extends Type<Uint8Array | null> {
|
|
6
|
+
convertToDatabaseValue(value: Uint8Array): Buffer;
|
|
7
|
+
convertToJSValue(value: Buffer): Uint8Array | null;
|
|
8
|
+
compareAsType(): string;
|
|
9
|
+
ensureComparable(): boolean;
|
|
10
|
+
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Uint8ArrayType = void 0;
|
|
4
|
+
const Type_1 = require("./Type");
|
|
5
|
+
class Uint8ArrayType extends Type_1.Type {
|
|
6
|
+
convertToDatabaseValue(value) {
|
|
7
|
+
if (!value) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
return Buffer.from(value);
|
|
11
|
+
}
|
|
12
|
+
convertToJSValue(value) {
|
|
13
|
+
if (!value) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
/* istanbul ignore else */
|
|
17
|
+
if (value instanceof Buffer) {
|
|
18
|
+
return new Uint8Array(value);
|
|
19
|
+
}
|
|
20
|
+
/* istanbul ignore else */
|
|
21
|
+
if (value.buffer instanceof Buffer) {
|
|
22
|
+
return new Uint8Array(value.buffer);
|
|
23
|
+
}
|
|
24
|
+
/* istanbul ignore next */
|
|
25
|
+
return new Uint8Array(Buffer.from(value));
|
|
26
|
+
}
|
|
27
|
+
compareAsType() {
|
|
28
|
+
return 'Buffer';
|
|
29
|
+
}
|
|
30
|
+
ensureComparable() {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
getColumnType(prop, platform) {
|
|
34
|
+
return platform.getBlobDeclarationSQL();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Uint8ArrayType = Uint8ArrayType;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StringType } from './StringType';
|
|
2
|
+
import type { EntityProperty } from '../typings';
|
|
3
|
+
import type { Platform } from '../platforms/Platform';
|
|
4
|
+
export declare class UnknownType extends StringType {
|
|
5
|
+
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
6
|
+
compareAsType(): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnknownType = void 0;
|
|
4
|
+
const StringType_1 = require("./StringType");
|
|
5
|
+
class UnknownType extends StringType_1.StringType {
|
|
6
|
+
getColumnType(prop, platform) {
|
|
7
|
+
return prop.columnTypes?.[0] ?? platform.getVarcharTypeDeclarationSQL(prop);
|
|
8
|
+
}
|
|
9
|
+
compareAsType() {
|
|
10
|
+
return 'unknown';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.UnknownType = UnknownType;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Type } from './Type';
|
|
2
|
+
import type { Platform } from '../platforms';
|
|
3
|
+
import type { EntityProperty } from '../typings';
|
|
4
|
+
export declare class UuidType extends Type<string | null | undefined> {
|
|
5
|
+
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
6
|
+
compareAsType(): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UuidType = void 0;
|
|
4
|
+
const Type_1 = require("./Type");
|
|
5
|
+
class UuidType extends Type_1.Type {
|
|
6
|
+
getColumnType(prop, platform) {
|
|
7
|
+
return platform.getUuidTypeDeclarationSQL(prop);
|
|
8
|
+
}
|
|
9
|
+
compareAsType() {
|
|
10
|
+
return 'string';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.UuidType = UuidType;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Type, TransformContext } from './Type';
|
|
2
|
+
import { DateType } from './DateType';
|
|
3
|
+
import { TimeType } from './TimeType';
|
|
4
|
+
import { DateTimeType } from './DateTimeType';
|
|
5
|
+
import { BigIntType } from './BigIntType';
|
|
6
|
+
import { BlobType } from './BlobType';
|
|
7
|
+
import { Uint8ArrayType } from './Uint8ArrayType';
|
|
8
|
+
import { ArrayType } from './ArrayType';
|
|
9
|
+
import { EnumArrayType } from './EnumArrayType';
|
|
10
|
+
import { EnumType } from './EnumType';
|
|
11
|
+
import { JsonType } from './JsonType';
|
|
12
|
+
import { IntegerType } from './IntegerType';
|
|
13
|
+
import { SmallIntType } from './SmallIntType';
|
|
14
|
+
import { TinyIntType } from './TinyIntType';
|
|
15
|
+
import { MediumIntType } from './MediumIntType';
|
|
16
|
+
import { FloatType } from './FloatType';
|
|
17
|
+
import { DoubleType } from './DoubleType';
|
|
18
|
+
import { BooleanType } from './BooleanType';
|
|
19
|
+
import { DecimalType } from './DecimalType';
|
|
20
|
+
import { StringType } from './StringType';
|
|
21
|
+
import { UuidType } from './UuidType';
|
|
22
|
+
import { TextType } from './TextType';
|
|
23
|
+
import { IntervalType } from './IntervalType';
|
|
24
|
+
import { UnknownType } from './UnknownType';
|
|
25
|
+
export { Type, DateType, TimeType, DateTimeType, BigIntType, BlobType, Uint8ArrayType, ArrayType, EnumArrayType, EnumType, JsonType, IntegerType, SmallIntType, TinyIntType, MediumIntType, FloatType, DoubleType, BooleanType, DecimalType, StringType, UuidType, TextType, UnknownType, TransformContext, IntervalType, };
|
|
26
|
+
export declare const types: {
|
|
27
|
+
date: typeof DateType;
|
|
28
|
+
time: typeof TimeType;
|
|
29
|
+
datetime: typeof DateTimeType;
|
|
30
|
+
bigint: typeof BigIntType;
|
|
31
|
+
blob: typeof BlobType;
|
|
32
|
+
uint8array: typeof Uint8ArrayType;
|
|
33
|
+
array: typeof ArrayType;
|
|
34
|
+
enumArray: typeof EnumArrayType;
|
|
35
|
+
enum: typeof EnumType;
|
|
36
|
+
json: typeof JsonType;
|
|
37
|
+
integer: typeof IntegerType;
|
|
38
|
+
smallint: typeof SmallIntType;
|
|
39
|
+
tinyint: typeof TinyIntType;
|
|
40
|
+
mediumint: typeof MediumIntType;
|
|
41
|
+
float: typeof FloatType;
|
|
42
|
+
double: typeof DoubleType;
|
|
43
|
+
boolean: typeof BooleanType;
|
|
44
|
+
decimal: typeof DecimalType;
|
|
45
|
+
string: typeof StringType;
|
|
46
|
+
uuid: typeof UuidType;
|
|
47
|
+
text: typeof TextType;
|
|
48
|
+
interval: typeof IntervalType;
|
|
49
|
+
unknown: typeof UnknownType;
|
|
50
|
+
};
|
|
51
|
+
export declare const t: {
|
|
52
|
+
date: typeof DateType;
|
|
53
|
+
time: typeof TimeType;
|
|
54
|
+
datetime: typeof DateTimeType;
|
|
55
|
+
bigint: typeof BigIntType;
|
|
56
|
+
blob: typeof BlobType;
|
|
57
|
+
uint8array: typeof Uint8ArrayType;
|
|
58
|
+
array: typeof ArrayType;
|
|
59
|
+
enumArray: typeof EnumArrayType;
|
|
60
|
+
enum: typeof EnumType;
|
|
61
|
+
json: typeof JsonType;
|
|
62
|
+
integer: typeof IntegerType;
|
|
63
|
+
smallint: typeof SmallIntType;
|
|
64
|
+
tinyint: typeof TinyIntType;
|
|
65
|
+
mediumint: typeof MediumIntType;
|
|
66
|
+
float: typeof FloatType;
|
|
67
|
+
double: typeof DoubleType;
|
|
68
|
+
boolean: typeof BooleanType;
|
|
69
|
+
decimal: typeof DecimalType;
|
|
70
|
+
string: typeof StringType;
|
|
71
|
+
uuid: typeof UuidType;
|
|
72
|
+
text: typeof TextType;
|
|
73
|
+
interval: typeof IntervalType;
|
|
74
|
+
unknown: typeof UnknownType;
|
|
75
|
+
};
|
package/types/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.t = exports.types = exports.IntervalType = exports.UnknownType = exports.TextType = exports.UuidType = exports.StringType = exports.DecimalType = exports.BooleanType = exports.DoubleType = exports.FloatType = exports.MediumIntType = exports.TinyIntType = exports.SmallIntType = exports.IntegerType = exports.JsonType = exports.EnumType = exports.EnumArrayType = exports.ArrayType = exports.Uint8ArrayType = exports.BlobType = exports.BigIntType = exports.DateTimeType = exports.TimeType = exports.DateType = exports.Type = void 0;
|
|
4
|
+
const Type_1 = require("./Type");
|
|
5
|
+
Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return Type_1.Type; } });
|
|
6
|
+
const DateType_1 = require("./DateType");
|
|
7
|
+
Object.defineProperty(exports, "DateType", { enumerable: true, get: function () { return DateType_1.DateType; } });
|
|
8
|
+
const TimeType_1 = require("./TimeType");
|
|
9
|
+
Object.defineProperty(exports, "TimeType", { enumerable: true, get: function () { return TimeType_1.TimeType; } });
|
|
10
|
+
const DateTimeType_1 = require("./DateTimeType");
|
|
11
|
+
Object.defineProperty(exports, "DateTimeType", { enumerable: true, get: function () { return DateTimeType_1.DateTimeType; } });
|
|
12
|
+
const BigIntType_1 = require("./BigIntType");
|
|
13
|
+
Object.defineProperty(exports, "BigIntType", { enumerable: true, get: function () { return BigIntType_1.BigIntType; } });
|
|
14
|
+
const BlobType_1 = require("./BlobType");
|
|
15
|
+
Object.defineProperty(exports, "BlobType", { enumerable: true, get: function () { return BlobType_1.BlobType; } });
|
|
16
|
+
const Uint8ArrayType_1 = require("./Uint8ArrayType");
|
|
17
|
+
Object.defineProperty(exports, "Uint8ArrayType", { enumerable: true, get: function () { return Uint8ArrayType_1.Uint8ArrayType; } });
|
|
18
|
+
const ArrayType_1 = require("./ArrayType");
|
|
19
|
+
Object.defineProperty(exports, "ArrayType", { enumerable: true, get: function () { return ArrayType_1.ArrayType; } });
|
|
20
|
+
const EnumArrayType_1 = require("./EnumArrayType");
|
|
21
|
+
Object.defineProperty(exports, "EnumArrayType", { enumerable: true, get: function () { return EnumArrayType_1.EnumArrayType; } });
|
|
22
|
+
const EnumType_1 = require("./EnumType");
|
|
23
|
+
Object.defineProperty(exports, "EnumType", { enumerable: true, get: function () { return EnumType_1.EnumType; } });
|
|
24
|
+
const JsonType_1 = require("./JsonType");
|
|
25
|
+
Object.defineProperty(exports, "JsonType", { enumerable: true, get: function () { return JsonType_1.JsonType; } });
|
|
26
|
+
const IntegerType_1 = require("./IntegerType");
|
|
27
|
+
Object.defineProperty(exports, "IntegerType", { enumerable: true, get: function () { return IntegerType_1.IntegerType; } });
|
|
28
|
+
const SmallIntType_1 = require("./SmallIntType");
|
|
29
|
+
Object.defineProperty(exports, "SmallIntType", { enumerable: true, get: function () { return SmallIntType_1.SmallIntType; } });
|
|
30
|
+
const TinyIntType_1 = require("./TinyIntType");
|
|
31
|
+
Object.defineProperty(exports, "TinyIntType", { enumerable: true, get: function () { return TinyIntType_1.TinyIntType; } });
|
|
32
|
+
const MediumIntType_1 = require("./MediumIntType");
|
|
33
|
+
Object.defineProperty(exports, "MediumIntType", { enumerable: true, get: function () { return MediumIntType_1.MediumIntType; } });
|
|
34
|
+
const FloatType_1 = require("./FloatType");
|
|
35
|
+
Object.defineProperty(exports, "FloatType", { enumerable: true, get: function () { return FloatType_1.FloatType; } });
|
|
36
|
+
const DoubleType_1 = require("./DoubleType");
|
|
37
|
+
Object.defineProperty(exports, "DoubleType", { enumerable: true, get: function () { return DoubleType_1.DoubleType; } });
|
|
38
|
+
const BooleanType_1 = require("./BooleanType");
|
|
39
|
+
Object.defineProperty(exports, "BooleanType", { enumerable: true, get: function () { return BooleanType_1.BooleanType; } });
|
|
40
|
+
const DecimalType_1 = require("./DecimalType");
|
|
41
|
+
Object.defineProperty(exports, "DecimalType", { enumerable: true, get: function () { return DecimalType_1.DecimalType; } });
|
|
42
|
+
const StringType_1 = require("./StringType");
|
|
43
|
+
Object.defineProperty(exports, "StringType", { enumerable: true, get: function () { return StringType_1.StringType; } });
|
|
44
|
+
const UuidType_1 = require("./UuidType");
|
|
45
|
+
Object.defineProperty(exports, "UuidType", { enumerable: true, get: function () { return UuidType_1.UuidType; } });
|
|
46
|
+
const TextType_1 = require("./TextType");
|
|
47
|
+
Object.defineProperty(exports, "TextType", { enumerable: true, get: function () { return TextType_1.TextType; } });
|
|
48
|
+
const IntervalType_1 = require("./IntervalType");
|
|
49
|
+
Object.defineProperty(exports, "IntervalType", { enumerable: true, get: function () { return IntervalType_1.IntervalType; } });
|
|
50
|
+
const UnknownType_1 = require("./UnknownType");
|
|
51
|
+
Object.defineProperty(exports, "UnknownType", { enumerable: true, get: function () { return UnknownType_1.UnknownType; } });
|
|
52
|
+
exports.types = {
|
|
53
|
+
date: DateType_1.DateType,
|
|
54
|
+
time: TimeType_1.TimeType,
|
|
55
|
+
datetime: DateTimeType_1.DateTimeType,
|
|
56
|
+
bigint: BigIntType_1.BigIntType,
|
|
57
|
+
blob: BlobType_1.BlobType,
|
|
58
|
+
uint8array: Uint8ArrayType_1.Uint8ArrayType,
|
|
59
|
+
array: ArrayType_1.ArrayType,
|
|
60
|
+
enumArray: EnumArrayType_1.EnumArrayType,
|
|
61
|
+
enum: EnumType_1.EnumType,
|
|
62
|
+
json: JsonType_1.JsonType,
|
|
63
|
+
integer: IntegerType_1.IntegerType,
|
|
64
|
+
smallint: SmallIntType_1.SmallIntType,
|
|
65
|
+
tinyint: TinyIntType_1.TinyIntType,
|
|
66
|
+
mediumint: MediumIntType_1.MediumIntType,
|
|
67
|
+
float: FloatType_1.FloatType,
|
|
68
|
+
double: DoubleType_1.DoubleType,
|
|
69
|
+
boolean: BooleanType_1.BooleanType,
|
|
70
|
+
decimal: DecimalType_1.DecimalType,
|
|
71
|
+
string: StringType_1.StringType,
|
|
72
|
+
uuid: UuidType_1.UuidType,
|
|
73
|
+
text: TextType_1.TextType,
|
|
74
|
+
interval: IntervalType_1.IntervalType,
|
|
75
|
+
unknown: UnknownType_1.UnknownType,
|
|
76
|
+
};
|
|
77
|
+
exports.t = exports.types;
|