@mikro-orm/core 7.0.0-dev.1 → 7.0.0-dev.100
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 +96 -58
- package/EntityManager.js +465 -395
- package/MikroORM.d.ts +45 -35
- package/MikroORM.js +109 -160
- package/README.md +3 -2
- package/cache/CacheAdapter.js +1 -2
- package/cache/FileCacheAdapter.d.ts +2 -2
- package/cache/FileCacheAdapter.js +20 -27
- package/cache/GeneratedCacheAdapter.d.ts +2 -3
- package/cache/GeneratedCacheAdapter.js +1 -7
- 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 +4 -5
- package/cache/index.js +4 -21
- package/connections/Connection.d.ts +22 -14
- package/connections/Connection.js +27 -23
- package/connections/index.d.ts +1 -1
- package/connections/index.js +1 -17
- package/drivers/DatabaseDriver.d.ts +25 -15
- package/drivers/DatabaseDriver.js +77 -64
- package/drivers/IDatabaseDriver.d.ts +40 -16
- package/drivers/IDatabaseDriver.js +1 -4
- package/drivers/index.d.ts +2 -2
- package/drivers/index.js +2 -18
- package/entity/BaseEntity.d.ts +6 -7
- package/entity/BaseEntity.js +16 -23
- package/entity/Collection.d.ts +98 -34
- package/entity/Collection.js +466 -131
- package/entity/EntityAssigner.d.ts +3 -3
- package/entity/EntityAssigner.js +67 -64
- package/entity/EntityFactory.d.ts +10 -3
- package/entity/EntityFactory.js +112 -91
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +66 -53
- package/entity/EntityIdentifier.d.ts +1 -1
- package/entity/EntityIdentifier.js +1 -5
- package/entity/EntityLoader.d.ts +8 -7
- package/entity/EntityLoader.js +161 -128
- package/entity/EntityRepository.d.ts +8 -8
- package/entity/EntityRepository.js +7 -11
- package/entity/Reference.d.ts +10 -13
- package/entity/Reference.js +64 -46
- package/entity/WrappedEntity.d.ts +12 -17
- package/entity/WrappedEntity.js +22 -31
- package/entity/defineEntity.d.ts +568 -0
- package/entity/defineEntity.js +529 -0
- package/entity/index.d.ts +14 -13
- package/entity/index.js +14 -29
- package/entity/utils.d.ts +8 -1
- package/entity/utils.js +22 -13
- package/entity/validators.d.ts +11 -0
- package/entity/validators.js +65 -0
- package/entity/wrap.d.ts +1 -1
- package/entity/wrap.js +2 -6
- package/enums.d.ts +24 -9
- package/enums.js +50 -41
- package/errors.d.ts +11 -3
- package/errors.js +42 -32
- package/events/EventManager.d.ts +5 -4
- package/events/EventManager.js +26 -22
- 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 +2 -6
- package/hydration/ObjectHydrator.d.ts +7 -7
- package/hydration/ObjectHydrator.js +58 -50
- package/hydration/index.d.ts +2 -2
- package/hydration/index.js +2 -18
- package/index.d.ts +21 -21
- package/index.js +20 -46
- package/logging/DefaultLogger.d.ts +2 -2
- package/logging/DefaultLogger.js +10 -13
- package/logging/Logger.d.ts +1 -1
- package/logging/Logger.js +1 -2
- package/logging/SimpleLogger.d.ts +3 -3
- package/logging/SimpleLogger.js +2 -6
- package/logging/colors.js +1 -5
- package/logging/index.d.ts +5 -4
- package/logging/index.js +5 -20
- package/logging/inspect.d.ts +2 -0
- package/logging/inspect.js +16 -0
- package/metadata/EntitySchema.d.ts +14 -10
- package/metadata/EntitySchema.js +78 -64
- package/metadata/MetadataDiscovery.d.ts +11 -14
- package/metadata/MetadataDiscovery.js +278 -317
- package/metadata/MetadataProvider.d.ts +13 -4
- package/metadata/MetadataProvider.js +47 -8
- package/metadata/MetadataStorage.d.ts +2 -7
- package/metadata/MetadataStorage.js +19 -35
- package/metadata/MetadataValidator.d.ts +3 -10
- package/metadata/MetadataValidator.js +51 -64
- package/metadata/discover-entities.d.ts +5 -0
- package/metadata/discover-entities.js +40 -0
- package/metadata/index.d.ts +6 -6
- package/metadata/index.js +6 -22
- package/metadata/types.d.ts +480 -0
- package/metadata/types.js +1 -0
- package/naming-strategy/AbstractNamingStrategy.d.ts +7 -3
- package/naming-strategy/AbstractNamingStrategy.js +11 -9
- 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 +12 -2
- 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/not-supported.d.ts +2 -0
- package/not-supported.js +4 -0
- package/package.json +19 -20
- package/platforms/ExceptionConverter.d.ts +2 -2
- package/platforms/ExceptionConverter.js +4 -8
- package/platforms/Platform.d.ts +15 -22
- package/platforms/Platform.js +58 -88
- package/platforms/index.d.ts +2 -2
- package/platforms/index.js +2 -18
- package/serialization/EntitySerializer.d.ts +4 -2
- package/serialization/EntitySerializer.js +64 -51
- package/serialization/EntityTransformer.d.ts +1 -1
- package/serialization/EntityTransformer.js +48 -42
- package/serialization/SerializationContext.d.ts +2 -2
- package/serialization/SerializationContext.js +24 -25
- package/serialization/index.d.ts +3 -3
- package/serialization/index.js +3 -19
- package/types/ArrayType.d.ts +3 -3
- package/types/ArrayType.js +6 -11
- package/types/BigIntType.d.ts +12 -9
- package/types/BigIntType.js +6 -6
- package/types/BlobType.d.ts +3 -4
- package/types/BlobType.js +2 -11
- package/types/BooleanType.d.ts +5 -4
- package/types/BooleanType.js +5 -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 +9 -7
- package/types/DecimalType.js +5 -8
- package/types/DoubleType.d.ts +3 -3
- package/types/DoubleType.js +4 -7
- package/types/EnumArrayType.d.ts +4 -4
- package/types/EnumArrayType.js +4 -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 +4 -4
- package/types/JsonType.js +9 -8
- 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 +4 -6
- package/types/Type.js +6 -10
- package/types/Uint8ArrayType.d.ts +3 -4
- package/types/Uint8ArrayType.js +3 -12
- 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 +134 -93
- package/typings.js +67 -65
- package/unit-of-work/ChangeSet.d.ts +1 -4
- package/unit-of-work/ChangeSet.js +13 -17
- package/unit-of-work/ChangeSetComputer.d.ts +8 -9
- package/unit-of-work/ChangeSetComputer.js +36 -38
- package/unit-of-work/ChangeSetPersister.d.ts +11 -9
- package/unit-of-work/ChangeSetPersister.js +100 -65
- 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 +16 -8
- package/unit-of-work/UnitOfWork.js +266 -209
- package/unit-of-work/index.d.ts +6 -6
- package/unit-of-work/index.js +6 -22
- package/utils/AbstractSchemaGenerator.d.ts +11 -11
- package/utils/AbstractSchemaGenerator.js +21 -20
- package/utils/Configuration.d.ts +774 -224
- package/utils/Configuration.js +166 -216
- package/utils/ConfigurationLoader.d.ts +1 -53
- package/utils/ConfigurationLoader.js +1 -367
- package/utils/Cursor.d.ts +6 -9
- package/utils/Cursor.js +25 -25
- package/utils/DataloaderUtils.d.ts +18 -8
- package/utils/DataloaderUtils.js +63 -21
- package/utils/EntityComparator.d.ts +9 -5
- package/utils/EntityComparator.js +155 -108
- package/utils/NullHighlighter.d.ts +1 -1
- package/utils/NullHighlighter.js +1 -5
- package/utils/QueryHelper.d.ts +12 -4
- package/utils/QueryHelper.js +110 -53
- package/utils/RawQueryFragment.d.ts +37 -14
- package/utils/RawQueryFragment.js +50 -33
- 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/TransactionManager.d.ts +65 -0
- package/utils/TransactionManager.js +223 -0
- package/utils/Utils.d.ts +16 -100
- package/utils/Utils.js +114 -332
- package/utils/clone.js +7 -11
- package/utils/env-vars.d.ts +3 -0
- package/utils/env-vars.js +87 -0
- package/utils/fs-utils.d.ts +12 -0
- package/utils/fs-utils.js +97 -0
- package/utils/index.d.ts +14 -13
- package/utils/index.js +14 -29
- package/utils/upsert-utils.d.ts +8 -3
- package/utils/upsert-utils.js +57 -10
- package/decorators/Check.d.ts +0 -3
- package/decorators/Check.js +0 -16
- package/decorators/CreateRequestContext.d.ts +0 -3
- package/decorators/CreateRequestContext.js +0 -33
- package/decorators/Embeddable.d.ts +0 -8
- package/decorators/Embeddable.js +0 -14
- package/decorators/Embedded.d.ts +0 -18
- package/decorators/Embedded.js +0 -20
- package/decorators/Entity.d.ts +0 -18
- package/decorators/Entity.js +0 -16
- package/decorators/Enum.d.ts +0 -9
- package/decorators/Enum.js +0 -19
- package/decorators/Filter.d.ts +0 -2
- package/decorators/Filter.js +0 -11
- package/decorators/Formula.d.ts +0 -5
- package/decorators/Formula.js +0 -18
- package/decorators/Indexed.d.ts +0 -17
- package/decorators/Indexed.js +0 -24
- package/decorators/ManyToMany.d.ts +0 -40
- package/decorators/ManyToMany.js +0 -16
- package/decorators/ManyToOne.d.ts +0 -30
- package/decorators/ManyToOne.js +0 -16
- package/decorators/OneToMany.d.ts +0 -28
- package/decorators/OneToMany.js +0 -20
- package/decorators/OneToOne.d.ts +0 -24
- package/decorators/OneToOne.js +0 -10
- package/decorators/PrimaryKey.d.ts +0 -9
- package/decorators/PrimaryKey.js +0 -23
- package/decorators/Property.d.ts +0 -250
- package/decorators/Property.js +0 -34
- package/decorators/Transactional.d.ts +0 -13
- package/decorators/Transactional.js +0 -31
- package/decorators/hooks.d.ts +0 -16
- package/decorators/hooks.js +0 -59
- package/decorators/index.d.ts +0 -17
- package/decorators/index.js +0 -36
- package/entity/ArrayCollection.d.ts +0 -116
- package/entity/ArrayCollection.js +0 -399
- package/entity/EntityValidator.d.ts +0 -19
- package/entity/EntityValidator.js +0 -154
- package/index.mjs +0 -199
- package/metadata/ReflectMetadataProvider.d.ts +0 -8
- package/metadata/ReflectMetadataProvider.js +0 -48
- package/utils/resolveContextProvider.d.ts +0 -10
- package/utils/resolveContextProvider.js +0 -31
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const enums_1 = require("../enums");
|
|
8
|
-
const Reference_1 = require("../entity/Reference");
|
|
9
|
-
const SerializationContext_1 = require("./SerializationContext");
|
|
10
|
-
const RawQueryFragment_1 = require("../utils/RawQueryFragment");
|
|
1
|
+
import { helper } from '../entity/wrap.js';
|
|
2
|
+
import { Utils } from '../utils/Utils.js';
|
|
3
|
+
import { ReferenceKind } from '../enums.js';
|
|
4
|
+
import { Reference } from '../entity/Reference.js';
|
|
5
|
+
import { SerializationContext } from './SerializationContext.js';
|
|
6
|
+
import { isRaw } from '../utils/RawQueryFragment.js';
|
|
11
7
|
function isVisible(meta, propName, options) {
|
|
12
8
|
const prop = meta.properties[propName];
|
|
13
9
|
if (options.groups && prop?.groups) {
|
|
@@ -19,8 +15,8 @@ function isVisible(meta, propName, options) {
|
|
|
19
15
|
if (options.exclude?.find(item => item === propName)) {
|
|
20
16
|
return false;
|
|
21
17
|
}
|
|
22
|
-
const visible = prop && !prop.hidden;
|
|
23
|
-
const prefixed = prop && !prop.primary && propName.startsWith('_'); // ignore prefixed properties, if it's not a PK
|
|
18
|
+
const visible = prop && !(prop.hidden && !options.includeHidden);
|
|
19
|
+
const prefixed = prop && !prop.primary && !prop.accessor && propName.startsWith('_'); // ignore prefixed properties, if it's not a PK
|
|
24
20
|
return visible && !prefixed;
|
|
25
21
|
}
|
|
26
22
|
function isPopulated(propName, options) {
|
|
@@ -32,26 +28,44 @@ function isPopulated(propName, options) {
|
|
|
32
28
|
}
|
|
33
29
|
return false;
|
|
34
30
|
}
|
|
35
|
-
class EntitySerializer {
|
|
31
|
+
export class EntitySerializer {
|
|
36
32
|
static serialize(entity, options = {}) {
|
|
37
|
-
const wrapped =
|
|
33
|
+
const wrapped = helper(entity);
|
|
38
34
|
const meta = wrapped.__meta;
|
|
39
35
|
let contextCreated = false;
|
|
40
36
|
if (!wrapped.__serializationContext.root) {
|
|
41
|
-
const root = new
|
|
42
|
-
|
|
43
|
-
options.populate = (options.populate ?
|
|
37
|
+
const root = new SerializationContext(wrapped.__config);
|
|
38
|
+
SerializationContext.propagate(root, entity, (meta, prop) => meta.properties[prop]?.kind !== ReferenceKind.SCALAR);
|
|
39
|
+
options.populate = (options.populate ? Utils.asArray(options.populate) : options.populate);
|
|
44
40
|
contextCreated = true;
|
|
45
41
|
}
|
|
46
42
|
const root = wrapped.__serializationContext.root;
|
|
47
43
|
const ret = {};
|
|
48
|
-
const
|
|
49
|
-
|
|
44
|
+
const props = new Set();
|
|
45
|
+
if (meta.serializedPrimaryKey && !meta.compositePK) {
|
|
46
|
+
props.add(meta.serializedPrimaryKey);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
meta.primaryKeys.forEach(pk => props.add(pk));
|
|
50
|
+
}
|
|
51
|
+
if (wrapped.isInitialized() || !wrapped.hasPrimaryKey()) {
|
|
52
|
+
const entityKeys = new Set(Object.keys(entity));
|
|
53
|
+
for (const prop of meta.props) {
|
|
54
|
+
if (entityKeys.has(prop.name) || (prop.getter && prop.accessor === prop.name)) {
|
|
55
|
+
props.add(prop.name);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const key of entityKeys) {
|
|
59
|
+
if (!meta.properties[key]) {
|
|
60
|
+
props.add(key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
50
64
|
const visited = root.visited.has(entity);
|
|
51
65
|
if (!visited) {
|
|
52
66
|
root.visited.add(entity);
|
|
53
67
|
}
|
|
54
|
-
for (const prop of
|
|
68
|
+
for (const prop of props) {
|
|
55
69
|
if (!isVisible(meta, prop, options)) {
|
|
56
70
|
continue;
|
|
57
71
|
}
|
|
@@ -63,15 +77,15 @@ class EntitySerializer {
|
|
|
63
77
|
if (!cycle) {
|
|
64
78
|
root.leave(meta.className, prop);
|
|
65
79
|
}
|
|
66
|
-
if (options.skipNull &&
|
|
67
|
-
|
|
80
|
+
if (options.skipNull && Utils.isPlainObject(val)) {
|
|
81
|
+
Utils.dropUndefinedProperties(val, null);
|
|
68
82
|
}
|
|
69
|
-
if (
|
|
83
|
+
if (isRaw(val)) {
|
|
70
84
|
throw new Error(`Trying to serialize raw SQL fragment: '${val.sql}'`);
|
|
71
85
|
}
|
|
72
86
|
const visible = typeof val !== 'undefined' && !(val === null && options.skipNull);
|
|
73
87
|
if (visible) {
|
|
74
|
-
ret[this.propertyName(meta, prop
|
|
88
|
+
ret[this.propertyName(meta, prop)] = val;
|
|
75
89
|
}
|
|
76
90
|
}
|
|
77
91
|
if (contextCreated) {
|
|
@@ -85,33 +99,33 @@ class EntitySerializer {
|
|
|
85
99
|
if (prop.getterName != null) {
|
|
86
100
|
const visible = entity[prop.getterName] instanceof Function && isVisible(meta, prop.name, options);
|
|
87
101
|
if (visible) {
|
|
88
|
-
ret[this.propertyName(meta, prop.name
|
|
102
|
+
ret[this.propertyName(meta, prop.name)] = this.processProperty(prop.getterName, entity, options);
|
|
89
103
|
}
|
|
90
104
|
}
|
|
91
105
|
else {
|
|
92
106
|
// decorated getters
|
|
93
107
|
const visible = typeof entity[prop.name] !== 'undefined' && isVisible(meta, prop.name, options);
|
|
94
108
|
if (visible) {
|
|
95
|
-
ret[this.propertyName(meta, prop.name
|
|
109
|
+
ret[this.propertyName(meta, prop.name)] = this.processProperty(prop.name, entity, options);
|
|
96
110
|
}
|
|
97
111
|
}
|
|
98
112
|
}
|
|
99
113
|
return ret;
|
|
100
114
|
}
|
|
101
|
-
static propertyName(meta, prop
|
|
102
|
-
/*
|
|
115
|
+
static propertyName(meta, prop) {
|
|
116
|
+
/* v8 ignore next */
|
|
103
117
|
if (meta.properties[prop]?.serializedName) {
|
|
104
118
|
return meta.properties[prop].serializedName;
|
|
105
119
|
}
|
|
106
|
-
if (meta.properties[prop]?.primary &&
|
|
107
|
-
return
|
|
120
|
+
if (meta.properties[prop]?.primary && meta.serializedPrimaryKey) {
|
|
121
|
+
return meta.serializedPrimaryKey;
|
|
108
122
|
}
|
|
109
123
|
return prop;
|
|
110
124
|
}
|
|
111
125
|
static processProperty(prop, entity, options) {
|
|
112
126
|
const parts = prop.split('.');
|
|
113
127
|
prop = parts[0];
|
|
114
|
-
const wrapped =
|
|
128
|
+
const wrapped = helper(entity);
|
|
115
129
|
const property = wrapped.__meta.properties[prop] ?? { name: prop };
|
|
116
130
|
const serializer = property?.serializer;
|
|
117
131
|
const value = entity[prop];
|
|
@@ -123,26 +137,26 @@ class EntitySerializer {
|
|
|
123
137
|
}
|
|
124
138
|
return returnValue;
|
|
125
139
|
}
|
|
126
|
-
/*
|
|
140
|
+
/* v8 ignore next */
|
|
127
141
|
if (!options.ignoreSerializers && serializer) {
|
|
128
142
|
return serializer(value);
|
|
129
143
|
}
|
|
130
|
-
if (
|
|
144
|
+
if (Utils.isCollection(value)) {
|
|
131
145
|
return this.processCollection(property, entity, options);
|
|
132
146
|
}
|
|
133
|
-
if (
|
|
147
|
+
if (Utils.isEntity(value, true)) {
|
|
134
148
|
return this.processEntity(property, entity, wrapped.__platform, options);
|
|
135
149
|
}
|
|
136
|
-
if (
|
|
150
|
+
if (Utils.isScalarReference(value)) {
|
|
137
151
|
return value.unwrap();
|
|
138
152
|
}
|
|
139
|
-
/*
|
|
140
|
-
if (property?.kind ===
|
|
153
|
+
/* v8 ignore next */
|
|
154
|
+
if (property?.kind === ReferenceKind.EMBEDDED) {
|
|
141
155
|
if (Array.isArray(value)) {
|
|
142
|
-
return value.map(item =>
|
|
156
|
+
return value.map(item => helper(item).toJSON());
|
|
143
157
|
}
|
|
144
|
-
if (
|
|
145
|
-
return
|
|
158
|
+
if (Utils.isObject(value)) {
|
|
159
|
+
return helper(value).toJSON();
|
|
146
160
|
}
|
|
147
161
|
}
|
|
148
162
|
const customType = property?.customType;
|
|
@@ -154,13 +168,13 @@ class EntitySerializer {
|
|
|
154
168
|
static extractChildOptions(options, prop) {
|
|
155
169
|
return {
|
|
156
170
|
...options,
|
|
157
|
-
populate: Array.isArray(options.populate) ?
|
|
158
|
-
exclude: Array.isArray(options.exclude) ?
|
|
171
|
+
populate: Array.isArray(options.populate) ? Utils.extractChildElements(options.populate, prop, '*') : options.populate,
|
|
172
|
+
exclude: Array.isArray(options.exclude) ? Utils.extractChildElements(options.exclude, prop) : options.exclude,
|
|
159
173
|
};
|
|
160
174
|
}
|
|
161
175
|
static processEntity(prop, entity, platform, options) {
|
|
162
|
-
const child =
|
|
163
|
-
const wrapped =
|
|
176
|
+
const child = Reference.unwrapReference(entity[prop.name]);
|
|
177
|
+
const wrapped = helper(child);
|
|
164
178
|
const populated = isPopulated(prop.name, options) && wrapped.isInitialized();
|
|
165
179
|
const expand = populated || !wrapped.__managed;
|
|
166
180
|
const meta = wrapped.__meta;
|
|
@@ -174,10 +188,10 @@ class EntitySerializer {
|
|
|
174
188
|
pk = prop.customType.toJSON(pk, wrapped.__platform);
|
|
175
189
|
}
|
|
176
190
|
if (options.forceObject || wrapped.__config.get('serialization').forceObject) {
|
|
177
|
-
return
|
|
191
|
+
return Utils.primaryKeyToObject(meta, pk, visible);
|
|
178
192
|
}
|
|
179
|
-
if (
|
|
180
|
-
const pruned =
|
|
193
|
+
if (Utils.isPlainObject(pk)) {
|
|
194
|
+
const pruned = Utils.primaryKeyToObject(meta, pk, visible);
|
|
181
195
|
if (visible.length === 1) {
|
|
182
196
|
return platform.normalizePrimaryKey(pruned[visible[0]]);
|
|
183
197
|
}
|
|
@@ -192,7 +206,7 @@ class EntitySerializer {
|
|
|
192
206
|
}
|
|
193
207
|
return col.getItems(false).map(item => {
|
|
194
208
|
const populated = isPopulated(prop.name, options);
|
|
195
|
-
const wrapped =
|
|
209
|
+
const wrapped = helper(item);
|
|
196
210
|
if (populated || !wrapped.__managed) {
|
|
197
211
|
return this.serialize(item, this.extractChildOptions(options, prop.name));
|
|
198
212
|
}
|
|
@@ -201,13 +215,12 @@ class EntitySerializer {
|
|
|
201
215
|
pk = prop.customType.toJSON(pk, wrapped.__platform);
|
|
202
216
|
}
|
|
203
217
|
if (options.forceObject || wrapped.__config.get('serialization').forceObject) {
|
|
204
|
-
return
|
|
218
|
+
return Utils.primaryKeyToObject(wrapped.__meta, pk);
|
|
205
219
|
}
|
|
206
220
|
return pk;
|
|
207
221
|
});
|
|
208
222
|
}
|
|
209
223
|
}
|
|
210
|
-
exports.EntitySerializer = EntitySerializer;
|
|
211
224
|
/**
|
|
212
225
|
* Converts entity instance to POJO, converting the `Collection`s to arrays and unwrapping the `Reference` wrapper, while respecting the serialization options.
|
|
213
226
|
* This method accepts either a single entity or an array of entities, and returns the corresponding POJO or an array of POJO.
|
|
@@ -220,7 +233,7 @@ exports.EntitySerializer = EntitySerializer;
|
|
|
220
233
|
* const dto2 = wrap(user).serialize({ exclude: ['id', 'email'], forceObject: true });
|
|
221
234
|
* ```
|
|
222
235
|
*/
|
|
223
|
-
function serialize(entities, options) {
|
|
236
|
+
export function serialize(entities, options) {
|
|
224
237
|
if (Array.isArray(entities)) {
|
|
225
238
|
return entities.map(e => EntitySerializer.serialize(e, options));
|
|
226
239
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntityDTO, EntityKey } from '../typings';
|
|
1
|
+
import type { EntityDTO, EntityKey } from '../typings.js';
|
|
2
2
|
export declare class EntityTransformer {
|
|
3
3
|
static toObject<Entity extends object, Ignored extends EntityKey<Entity> = never>(entity: Entity, ignoreFields?: Ignored[], raw?: boolean): Omit<EntityDTO<Entity>, Ignored>;
|
|
4
4
|
private static propertyName;
|
|
@@ -1,51 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const enums_1 = require("../enums");
|
|
7
|
-
const SerializationContext_1 = require("./SerializationContext");
|
|
8
|
-
const RawQueryFragment_1 = require("../utils/RawQueryFragment");
|
|
1
|
+
import { helper, wrap } from '../entity/wrap.js';
|
|
2
|
+
import { Utils } from '../utils/Utils.js';
|
|
3
|
+
import { ReferenceKind } from '../enums.js';
|
|
4
|
+
import { SerializationContext } from './SerializationContext.js';
|
|
5
|
+
import { isRaw } from '../utils/RawQueryFragment.js';
|
|
9
6
|
function isVisible(meta, propName, ignoreFields = []) {
|
|
10
7
|
const prop = meta.properties[propName];
|
|
11
8
|
const visible = prop && !prop.hidden;
|
|
12
|
-
const prefixed = prop && !prop.primary && propName.startsWith('_'); // ignore prefixed properties, if it's not a PK
|
|
9
|
+
const prefixed = prop && !prop.primary && !prop.accessor && propName.startsWith('_'); // ignore prefixed properties, if it's not a PK
|
|
13
10
|
return visible && !prefixed && !ignoreFields.includes(propName);
|
|
14
11
|
}
|
|
15
|
-
class EntityTransformer {
|
|
12
|
+
export class EntityTransformer {
|
|
16
13
|
static toObject(entity, ignoreFields = [], raw = false) {
|
|
17
14
|
if (!Array.isArray(ignoreFields)) {
|
|
18
15
|
ignoreFields = [];
|
|
19
16
|
}
|
|
20
|
-
const wrapped =
|
|
17
|
+
const wrapped = helper(entity);
|
|
21
18
|
let contextCreated = false;
|
|
22
19
|
if (!wrapped) {
|
|
23
20
|
return entity;
|
|
24
21
|
}
|
|
25
22
|
if (!wrapped.__serializationContext.root) {
|
|
26
|
-
const root = new
|
|
27
|
-
|
|
23
|
+
const root = new SerializationContext(wrapped.__config, wrapped.__serializationContext.populate, wrapped.__serializationContext.fields, wrapped.__serializationContext.exclude);
|
|
24
|
+
SerializationContext.propagate(root, entity, isVisible);
|
|
28
25
|
contextCreated = true;
|
|
29
26
|
}
|
|
30
27
|
const root = wrapped.__serializationContext.root;
|
|
31
28
|
const meta = wrapped.__meta;
|
|
32
29
|
const ret = {};
|
|
33
|
-
const
|
|
30
|
+
const props = new Set();
|
|
34
31
|
if (meta.serializedPrimaryKey && !meta.compositePK) {
|
|
35
|
-
|
|
32
|
+
props.add(meta.serializedPrimaryKey);
|
|
36
33
|
}
|
|
37
34
|
else {
|
|
38
|
-
meta.primaryKeys.forEach(pk =>
|
|
35
|
+
meta.primaryKeys.forEach(pk => props.add(pk));
|
|
39
36
|
}
|
|
40
37
|
if (wrapped.isInitialized() || !wrapped.hasPrimaryKey()) {
|
|
41
|
-
|
|
38
|
+
const entityKeys = new Set(Object.keys(entity));
|
|
39
|
+
for (const prop of meta.props) {
|
|
40
|
+
if (entityKeys.has(prop.name) || (prop.getter && prop.accessor === prop.name)) {
|
|
41
|
+
props.add(prop.name);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const key of entityKeys) {
|
|
45
|
+
if (!meta.properties[key]) {
|
|
46
|
+
props.add(key);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
42
49
|
}
|
|
43
50
|
const visited = root.visited.has(entity);
|
|
44
51
|
const includePrimaryKeys = wrapped.__config.get('serialization').includePrimaryKeys;
|
|
45
52
|
if (!visited) {
|
|
46
53
|
root.visited.add(entity);
|
|
47
54
|
}
|
|
48
|
-
for (const prop of
|
|
55
|
+
for (const prop of props) {
|
|
49
56
|
const visible = raw ? meta.properties[prop] : isVisible(meta, prop, ignoreFields);
|
|
50
57
|
if (!visible) {
|
|
51
58
|
continue;
|
|
@@ -64,13 +71,13 @@ class EntityTransformer {
|
|
|
64
71
|
if (!cycle) {
|
|
65
72
|
root.leave(meta.className, prop);
|
|
66
73
|
}
|
|
67
|
-
if (
|
|
74
|
+
if (isRaw(val)) {
|
|
68
75
|
throw new Error(`Trying to serialize raw SQL fragment: '${val.sql}'`);
|
|
69
76
|
}
|
|
70
77
|
if (typeof val === 'undefined') {
|
|
71
78
|
continue;
|
|
72
79
|
}
|
|
73
|
-
ret[this.propertyName(meta, prop,
|
|
80
|
+
ret[this.propertyName(meta, prop, raw)] = val;
|
|
74
81
|
}
|
|
75
82
|
if (!wrapped.isInitialized() && wrapped.hasPrimaryKey()) {
|
|
76
83
|
return ret;
|
|
@@ -81,7 +88,7 @@ class EntityTransformer {
|
|
|
81
88
|
const visible = !prop.hidden && entity[prop.getterName] instanceof Function;
|
|
82
89
|
const populated = root.isMarkedAsPopulated(meta.className, prop.name);
|
|
83
90
|
if (visible) {
|
|
84
|
-
ret[this.propertyName(meta, prop.name,
|
|
91
|
+
ret[this.propertyName(meta, prop.name, raw)] = this.processProperty(prop.getterName, entity, raw, populated);
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
else {
|
|
@@ -89,7 +96,7 @@ class EntityTransformer {
|
|
|
89
96
|
const visible = !prop.hidden && typeof entity[prop.name] !== 'undefined';
|
|
90
97
|
const populated = root.isMarkedAsPopulated(meta.className, prop.name);
|
|
91
98
|
if (visible) {
|
|
92
|
-
ret[this.propertyName(meta, prop.name,
|
|
99
|
+
ret[this.propertyName(meta, prop.name, raw)] = this.processProperty(prop.name, entity, raw, populated);
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
}
|
|
@@ -98,20 +105,20 @@ class EntityTransformer {
|
|
|
98
105
|
}
|
|
99
106
|
return ret;
|
|
100
107
|
}
|
|
101
|
-
static propertyName(meta, prop,
|
|
108
|
+
static propertyName(meta, prop, raw) {
|
|
102
109
|
if (raw) {
|
|
103
110
|
return prop;
|
|
104
111
|
}
|
|
105
112
|
if (meta.properties[prop].serializedName) {
|
|
106
113
|
return meta.properties[prop].serializedName;
|
|
107
114
|
}
|
|
108
|
-
if (meta.properties[prop].primary &&
|
|
109
|
-
return
|
|
115
|
+
if (meta.properties[prop].primary && meta.serializedPrimaryKey) {
|
|
116
|
+
return meta.serializedPrimaryKey;
|
|
110
117
|
}
|
|
111
118
|
return prop;
|
|
112
119
|
}
|
|
113
120
|
static processProperty(prop, entity, raw, populated) {
|
|
114
|
-
const wrapped =
|
|
121
|
+
const wrapped = helper(entity);
|
|
115
122
|
const property = wrapped.__meta.properties[prop] ?? { name: prop };
|
|
116
123
|
const serializer = property?.serializer;
|
|
117
124
|
const value = entity[prop];
|
|
@@ -126,23 +133,23 @@ class EntityTransformer {
|
|
|
126
133
|
if (serializer && !raw) {
|
|
127
134
|
return serializer(value);
|
|
128
135
|
}
|
|
129
|
-
if (
|
|
136
|
+
if (Utils.isCollection(value)) {
|
|
130
137
|
return EntityTransformer.processCollection(property, entity, raw, populated);
|
|
131
138
|
}
|
|
132
|
-
if (
|
|
139
|
+
if (Utils.isEntity(value, true)) {
|
|
133
140
|
return EntityTransformer.processEntity(property, entity, wrapped.__platform, raw, populated);
|
|
134
141
|
}
|
|
135
|
-
if (
|
|
142
|
+
if (Utils.isScalarReference(value)) {
|
|
136
143
|
return value.unwrap();
|
|
137
144
|
}
|
|
138
|
-
if (property.kind ===
|
|
145
|
+
if (property.kind === ReferenceKind.EMBEDDED) {
|
|
139
146
|
if (Array.isArray(value)) {
|
|
140
147
|
return value.map(item => {
|
|
141
|
-
const wrapped = item &&
|
|
148
|
+
const wrapped = item && helper(item);
|
|
142
149
|
return wrapped ? wrapped.toJSON() : item;
|
|
143
150
|
});
|
|
144
151
|
}
|
|
145
|
-
const wrapped = value &&
|
|
152
|
+
const wrapped = value && helper(value);
|
|
146
153
|
return wrapped ? wrapped.toJSON() : value;
|
|
147
154
|
}
|
|
148
155
|
const customType = property?.customType;
|
|
@@ -156,7 +163,7 @@ class EntityTransformer {
|
|
|
156
163
|
}
|
|
157
164
|
static processEntity(prop, entity, platform, raw, populated) {
|
|
158
165
|
const child = entity[prop.name];
|
|
159
|
-
const wrapped =
|
|
166
|
+
const wrapped = helper(child);
|
|
160
167
|
const meta = wrapped.__meta;
|
|
161
168
|
const visible = meta.primaryKeys.filter(prop => isVisible(meta, prop));
|
|
162
169
|
if (raw && wrapped.isInitialized() && child !== entity) {
|
|
@@ -172,17 +179,17 @@ class EntityTransformer {
|
|
|
172
179
|
return !wrapped.__managed;
|
|
173
180
|
}
|
|
174
181
|
if (wrapped.isInitialized() && isPopulated() && child !== entity) {
|
|
175
|
-
return
|
|
182
|
+
return wrap(child).toJSON();
|
|
176
183
|
}
|
|
177
184
|
let pk = wrapped.getPrimaryKey();
|
|
178
185
|
if (prop.customType) {
|
|
179
186
|
pk = prop.customType.toJSON(pk, wrapped.__platform);
|
|
180
187
|
}
|
|
181
188
|
if (wrapped.__config.get('serialization').forceObject) {
|
|
182
|
-
return
|
|
189
|
+
return Utils.primaryKeyToObject(meta, pk, visible);
|
|
183
190
|
}
|
|
184
|
-
if (
|
|
185
|
-
const pruned =
|
|
191
|
+
if (Utils.isPlainObject(pk)) {
|
|
192
|
+
const pruned = Utils.primaryKeyToObject(meta, pk, visible);
|
|
186
193
|
if (visible.length === 1) {
|
|
187
194
|
return platform.normalizePrimaryKey(pruned[visible[0]]);
|
|
188
195
|
}
|
|
@@ -193,22 +200,22 @@ class EntityTransformer {
|
|
|
193
200
|
static processCollection(prop, entity, raw, populated) {
|
|
194
201
|
const col = entity[prop.name];
|
|
195
202
|
if (raw && col.isInitialized(true)) {
|
|
196
|
-
return col.map(item =>
|
|
203
|
+
return col.map(item => helper(item).toPOJO());
|
|
197
204
|
}
|
|
198
205
|
if (col.shouldPopulate(populated)) {
|
|
199
206
|
return col.toArray();
|
|
200
207
|
}
|
|
201
208
|
if (col.isInitialized()) {
|
|
202
|
-
const wrapped =
|
|
209
|
+
const wrapped = helper(entity);
|
|
203
210
|
const forceObject = wrapped.__config.get('serialization').forceObject;
|
|
204
211
|
return col.map(item => {
|
|
205
|
-
const wrapped =
|
|
212
|
+
const wrapped = helper(item);
|
|
206
213
|
const pk = wrapped.getPrimaryKey();
|
|
207
214
|
if (prop.customType) {
|
|
208
215
|
return prop.customType.toJSON(pk, wrapped.__platform);
|
|
209
216
|
}
|
|
210
217
|
if (forceObject) {
|
|
211
|
-
return
|
|
218
|
+
return Utils.primaryKeyToObject(wrapped.__meta, pk);
|
|
212
219
|
}
|
|
213
220
|
return pk;
|
|
214
221
|
});
|
|
@@ -216,4 +223,3 @@ class EntityTransformer {
|
|
|
216
223
|
return undefined;
|
|
217
224
|
}
|
|
218
225
|
}
|
|
219
|
-
exports.EntityTransformer = EntityTransformer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AnyEntity, EntityMetadata, PopulateOptions } from '../typings';
|
|
2
|
-
import type { Configuration } from '../utils/Configuration';
|
|
1
|
+
import type { AnyEntity, EntityMetadata, PopulateOptions } from '../typings.js';
|
|
2
|
+
import type { Configuration } from '../utils/Configuration.js';
|
|
3
3
|
/**
|
|
4
4
|
* Helper that allows to keep track of where we are currently at when serializing complex entity graph with cycles.
|
|
5
5
|
* Before we process a property, we call `visit` that checks if it is not a cycle path (but allows to pass cycles that
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SerializationContext = void 0;
|
|
4
|
-
const Utils_1 = require("../utils/Utils");
|
|
5
|
-
const wrap_1 = require("../entity/wrap");
|
|
1
|
+
import { Utils } from '../utils/Utils.js';
|
|
2
|
+
import { helper } from '../entity/wrap.js';
|
|
6
3
|
/**
|
|
7
4
|
* Helper that allows to keep track of where we are currently at when serializing complex entity graph with cycles.
|
|
8
5
|
* Before we process a property, we call `visit` that checks if it is not a cycle path (but allows to pass cycles that
|
|
9
6
|
* are defined in populate hint). If not, we proceed and call `leave` afterwards.
|
|
10
7
|
*/
|
|
11
|
-
class SerializationContext {
|
|
8
|
+
export class SerializationContext {
|
|
12
9
|
config;
|
|
13
10
|
populate;
|
|
14
11
|
fields;
|
|
@@ -39,14 +36,14 @@ class SerializationContext {
|
|
|
39
36
|
}
|
|
40
37
|
leave(entityName, prop) {
|
|
41
38
|
const last = this.path.pop();
|
|
42
|
-
/*
|
|
43
|
-
if (
|
|
39
|
+
/* v8 ignore next */
|
|
40
|
+
if (last?.[0] !== entityName || last[1] !== prop) {
|
|
44
41
|
throw new Error(`Trying to leave wrong property: ${entityName}.${prop} instead of ${last?.join('.')}`);
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
close() {
|
|
48
45
|
for (const entity of this.entities) {
|
|
49
|
-
delete
|
|
46
|
+
delete helper(entity).__serializationContext.root;
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
/**
|
|
@@ -54,19 +51,19 @@ class SerializationContext {
|
|
|
54
51
|
*/
|
|
55
52
|
static propagate(root, entity, isVisible) {
|
|
56
53
|
root.register(entity);
|
|
57
|
-
const meta =
|
|
54
|
+
const meta = helper(entity).__meta;
|
|
58
55
|
for (const key of Object.keys(entity)) {
|
|
59
56
|
if (!isVisible(meta, key)) {
|
|
60
57
|
continue;
|
|
61
58
|
}
|
|
62
59
|
const target = entity[key];
|
|
63
|
-
if (
|
|
60
|
+
if (Utils.isEntity(target, true)) {
|
|
64
61
|
if (!target.__helper.__serializationContext.root) {
|
|
65
62
|
this.propagate(root, target, isVisible);
|
|
66
63
|
}
|
|
67
64
|
continue;
|
|
68
65
|
}
|
|
69
|
-
if (
|
|
66
|
+
if (Utils.isCollection(target)) {
|
|
70
67
|
for (const item of target.getItems(false)) {
|
|
71
68
|
if (!item.__helper.__serializationContext.root) {
|
|
72
69
|
this.propagate(root, item, isVisible);
|
|
@@ -76,18 +73,21 @@ class SerializationContext {
|
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
isMarkedAsPopulated(entityName, prop) {
|
|
79
|
-
let populate = this.populate;
|
|
76
|
+
let populate = this.populate ?? [];
|
|
80
77
|
for (const segment of this.path) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
const hints = populate.filter(p => p.field === segment[1]);
|
|
79
|
+
if (hints.length > 0) {
|
|
80
|
+
const childHints = [];
|
|
81
|
+
for (const hint of hints) {
|
|
82
|
+
// we need to check for cycles here too, as we could fall into endless loops for bidirectional relations
|
|
83
|
+
if (hint.all) {
|
|
84
|
+
return !this.path.find(([cls, item]) => entityName === cls && prop === item);
|
|
85
|
+
}
|
|
86
|
+
if (hint.children) {
|
|
87
|
+
childHints.push(...hint.children);
|
|
88
|
+
}
|
|
89
89
|
}
|
|
90
|
-
populate =
|
|
90
|
+
populate = childHints;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
return !!populate?.some(p => p.field === prop);
|
|
@@ -98,7 +98,7 @@ class SerializationContext {
|
|
|
98
98
|
}
|
|
99
99
|
let fields = [...this.fields];
|
|
100
100
|
for (const segment of this.path) {
|
|
101
|
-
/*
|
|
101
|
+
/* v8 ignore next */
|
|
102
102
|
if (fields.length === 0) {
|
|
103
103
|
return true;
|
|
104
104
|
}
|
|
@@ -109,8 +109,7 @@ class SerializationContext {
|
|
|
109
109
|
return fields.some(p => p === prop || p === '*');
|
|
110
110
|
}
|
|
111
111
|
register(entity) {
|
|
112
|
-
|
|
112
|
+
helper(entity).__serializationContext.root = this;
|
|
113
113
|
this.entities.add(entity);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
exports.SerializationContext = SerializationContext;
|
package/serialization/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './EntityTransformer';
|
|
2
|
-
export * from './EntitySerializer';
|
|
3
|
-
export * from './SerializationContext';
|
|
1
|
+
export * from './EntityTransformer.js';
|
|
2
|
+
export * from './EntitySerializer.js';
|
|
3
|
+
export * from './SerializationContext.js';
|
package/serialization/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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("./EntityTransformer"), exports);
|
|
18
|
-
__exportStar(require("./EntitySerializer"), exports);
|
|
19
|
-
__exportStar(require("./SerializationContext"), exports);
|
|
1
|
+
export * from './EntityTransformer.js';
|
|
2
|
+
export * from './EntitySerializer.js';
|
|
3
|
+
export * from './SerializationContext.js';
|
package/types/ArrayType.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { EntityProperty } from '../typings';
|
|
3
|
-
import type { Platform } from '../platforms';
|
|
1
|
+
import { type TransformContext, Type } from './Type.js';
|
|
2
|
+
import type { EntityProperty } from '../typings.js';
|
|
3
|
+
import type { Platform } from '../platforms/Platform.js';
|
|
4
4
|
export declare class ArrayType<T = string> extends Type<T[] | null, string | null> {
|
|
5
5
|
private readonly toJsValue;
|
|
6
6
|
private readonly toDbValue;
|