@itrocks/lazy-loading 0.0.7 → 0.0.9
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 +4 -4
- package/esm/lazy-loading.js +4 -4
- package/package.json +2 -2
package/cjs/lazy-loading.js
CHANGED
|
@@ -15,13 +15,13 @@ function defineCollectionProperty(type, property, builtClass) {
|
|
|
15
15
|
enumerable: true,
|
|
16
16
|
async get() {
|
|
17
17
|
const elementType = type.elementType;
|
|
18
|
-
const ids = this[property + '
|
|
18
|
+
const ids = this[property + 'Ids'];
|
|
19
19
|
return this[property] = ids
|
|
20
20
|
? await (0, storage_1.dataSource)().readMultiple(elementType, ids)
|
|
21
21
|
: await (0, storage_1.dataSource)().readCollection(this, property, elementType);
|
|
22
22
|
},
|
|
23
23
|
set(value) {
|
|
24
|
-
delete this[property + '
|
|
24
|
+
delete this[property + 'Ids'];
|
|
25
25
|
Object.defineProperty(this, property, { configurable: true, enumerable: true, value, writable: true });
|
|
26
26
|
Reflect.defineMetadata(exports.PROTECT_GET, false, this, property);
|
|
27
27
|
}
|
|
@@ -35,11 +35,11 @@ function defineObjectProperty(type, property, builtClass) {
|
|
|
35
35
|
configurable: true,
|
|
36
36
|
enumerable: true,
|
|
37
37
|
async get() {
|
|
38
|
-
const id = this[property + '
|
|
38
|
+
const id = this[property + 'Id'];
|
|
39
39
|
return this[property] = id ? await (0, storage_1.dataSource)().read(type, id) : undefined;
|
|
40
40
|
},
|
|
41
41
|
set(value) {
|
|
42
|
-
delete this[property + '
|
|
42
|
+
delete this[property + 'Id'];
|
|
43
43
|
Object.defineProperty(this, property, { configurable: true, enumerable: true, value, writable: true });
|
|
44
44
|
Reflect.defineMetadata(exports.PROTECT_GET, false, this, property);
|
|
45
45
|
}
|
package/esm/lazy-loading.js
CHANGED
|
@@ -12,13 +12,13 @@ function defineCollectionProperty(type, property, builtClass) {
|
|
|
12
12
|
enumerable: true,
|
|
13
13
|
async get() {
|
|
14
14
|
const elementType = type.elementType;
|
|
15
|
-
const ids = this[property + '
|
|
15
|
+
const ids = this[property + 'Ids'];
|
|
16
16
|
return this[property] = ids
|
|
17
17
|
? await dataSource().readMultiple(elementType, ids)
|
|
18
18
|
: await dataSource().readCollection(this, property, elementType);
|
|
19
19
|
},
|
|
20
20
|
set(value) {
|
|
21
|
-
delete this[property + '
|
|
21
|
+
delete this[property + 'Ids'];
|
|
22
22
|
Object.defineProperty(this, property, { configurable: true, enumerable: true, value, writable: true });
|
|
23
23
|
Reflect.defineMetadata(PROTECT_GET, false, this, property);
|
|
24
24
|
}
|
|
@@ -32,11 +32,11 @@ function defineObjectProperty(type, property, builtClass) {
|
|
|
32
32
|
configurable: true,
|
|
33
33
|
enumerable: true,
|
|
34
34
|
async get() {
|
|
35
|
-
const id = this[property + '
|
|
35
|
+
const id = this[property + 'Id'];
|
|
36
36
|
return this[property] = id ? await dataSource().read(type, id) : undefined;
|
|
37
37
|
},
|
|
38
38
|
set(value) {
|
|
39
|
-
delete this[property + '
|
|
39
|
+
delete this[property + 'Id'];
|
|
40
40
|
Object.defineProperty(this, property, { configurable: true, enumerable: true, value, writable: true });
|
|
41
41
|
Reflect.defineMetadata(PROTECT_GET, false, this, property);
|
|
42
42
|
}
|
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": "
|
|
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.
|
|
57
|
+
"version": "0.0.9"
|
|
58
58
|
}
|