@itrocks/lazy-loading 0.0.9 → 0.0.10
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/cjs/lazy-loading.js +7 -7
- package/esm/lazy-loading.js +7 -7
- package/package.json +1 -1
package/cjs/lazy-loading.js
CHANGED
|
@@ -14,7 +14,7 @@ function defineCollectionProperty(type, property, builtClass) {
|
|
|
14
14
|
configurable: true,
|
|
15
15
|
enumerable: true,
|
|
16
16
|
async get() {
|
|
17
|
-
const elementType = type.elementType;
|
|
17
|
+
const elementType = type.elementType.type;
|
|
18
18
|
const ids = this[property + 'Ids'];
|
|
19
19
|
return this[property] = ids
|
|
20
20
|
? await (0, storage_1.dataSource)().readMultiple(elementType, ids)
|
|
@@ -73,14 +73,14 @@ function initClass(classType) {
|
|
|
73
73
|
}
|
|
74
74
|
})();
|
|
75
75
|
for (const property of new reflect_1.ReflectClass(classType).properties) {
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
76
|
+
const propertyType = property.type;
|
|
77
|
+
if (!propertyType)
|
|
78
78
|
continue;
|
|
79
|
-
if ((
|
|
80
|
-
properties.push(defineCollectionProperty(
|
|
79
|
+
if ((propertyType instanceof property_type_1.CollectionType) && (0, class_type_1.isAnyType)(propertyType.elementType.type)) {
|
|
80
|
+
properties.push(defineCollectionProperty(propertyType, property.name, BuiltClass));
|
|
81
81
|
}
|
|
82
|
-
else if ((0, class_type_1.isAnyType)(type)) {
|
|
83
|
-
properties.push(defineObjectProperty(type, property.name, BuiltClass));
|
|
82
|
+
else if ((0, class_type_1.isAnyType)(propertyType?.type)) {
|
|
83
|
+
properties.push(defineObjectProperty(propertyType.type, property.name, BuiltClass));
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
return properties.length ? BuiltClass : undefined;
|
package/esm/lazy-loading.js
CHANGED
|
@@ -11,7 +11,7 @@ function defineCollectionProperty(type, property, builtClass) {
|
|
|
11
11
|
configurable: true,
|
|
12
12
|
enumerable: true,
|
|
13
13
|
async get() {
|
|
14
|
-
const elementType = type.elementType;
|
|
14
|
+
const elementType = type.elementType.type;
|
|
15
15
|
const ids = this[property + 'Ids'];
|
|
16
16
|
return this[property] = ids
|
|
17
17
|
? await dataSource().readMultiple(elementType, ids)
|
|
@@ -70,14 +70,14 @@ export function initClass(classType) {
|
|
|
70
70
|
}
|
|
71
71
|
})();
|
|
72
72
|
for (const property of new ReflectClass(classType).properties) {
|
|
73
|
-
const
|
|
74
|
-
if (!
|
|
73
|
+
const propertyType = property.type;
|
|
74
|
+
if (!propertyType)
|
|
75
75
|
continue;
|
|
76
|
-
if ((
|
|
77
|
-
properties.push(defineCollectionProperty(
|
|
76
|
+
if ((propertyType instanceof CollectionType) && isAnyType(propertyType.elementType.type)) {
|
|
77
|
+
properties.push(defineCollectionProperty(propertyType, property.name, BuiltClass));
|
|
78
78
|
}
|
|
79
|
-
else if (isAnyType(type)) {
|
|
80
|
-
properties.push(defineObjectProperty(type, property.name, BuiltClass));
|
|
79
|
+
else if (isAnyType(propertyType?.type)) {
|
|
80
|
+
properties.push(defineObjectProperty(propertyType.type, property.name, BuiltClass));
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
return properties.length ? BuiltClass : undefined;
|
package/package.json
CHANGED