@itrocks/lazy-loading 0.0.8 → 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.
@@ -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 type = property.type;
77
- if (!type)
76
+ const propertyType = property.type;
77
+ if (!propertyType)
78
78
  continue;
79
- if ((type instanceof property_type_1.CollectionType) && (0, class_type_1.isAnyType)(type.elementType)) {
80
- properties.push(defineCollectionProperty(type, property.name, BuiltClass));
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;
@@ -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 type = property.type;
74
- if (!type)
73
+ const propertyType = property.type;
74
+ if (!propertyType)
75
75
  continue;
76
- if ((type instanceof CollectionType) && isAnyType(type.elementType)) {
77
- properties.push(defineCollectionProperty(type, property.name, BuiltClass));
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
@@ -13,7 +13,7 @@
13
13
  "description": "Integrates lazy loading for objects and collections in TypeScript classes",
14
14
  "devDependencies": {
15
15
  "@types/node": "^22.10",
16
- "typescript": "^5.6"
16
+ "typescript": "~5.8"
17
17
  },
18
18
  "engines": {
19
19
  "node": ">=18"
@@ -54,5 +54,5 @@
54
54
  "build:esm": "tsc -p tsconfig.esm.json && node esm/esm"
55
55
  },
56
56
  "types": "./esm/lazy-loading.d.ts",
57
- "version": "0.0.8"
57
+ "version": "0.0.10"
58
58
  }