spice-js 2.6.9 → 2.6.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/package.json +1 -1
- package/src/bootstrap/cache.js +14 -12
- package/src/models/SpiceModel.js +11 -6
package/package.json
CHANGED
package/src/bootstrap/cache.js
CHANGED
|
@@ -4,18 +4,20 @@ async function connect() {
|
|
|
4
4
|
try {
|
|
5
5
|
spice.cache_providers = {};
|
|
6
6
|
spice.monitor = new Map();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
spice.config.cache.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
if (spice.config?.cache?.providers) {
|
|
8
|
+
for (let key of Object.keys(spice.config.cache?.providers || {})) {
|
|
9
|
+
spice.cache_providers[key] = new spice.config.cache.providers[key](
|
|
10
|
+
spice.config.cache.drivers[key] || {}
|
|
11
|
+
);
|
|
12
|
+
spice.cache_providers[key]
|
|
13
|
+
.initialize()
|
|
14
|
+
.then(() => {
|
|
15
|
+
console.log("Redis initialized successfully");
|
|
16
|
+
})
|
|
17
|
+
.catch((err) => {
|
|
18
|
+
console.error("Error initializing Redis:", err);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
19
21
|
}
|
|
20
22
|
} catch (e) {
|
|
21
23
|
console.log(e.stack);
|
package/src/models/SpiceModel.js
CHANGED
|
@@ -188,12 +188,16 @@ export default class SpiceModel {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
if (this[_ctx]) {
|
|
191
|
-
|
|
192
|
-
this[_ctx]
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
if (this[_ctx]?.state?.process_fields) {
|
|
192
|
+
let returned = await new this[_ctx].state.process_fields().process(
|
|
193
|
+
this[_ctx],
|
|
194
|
+
data,
|
|
195
|
+
this.type
|
|
196
|
+
);
|
|
197
|
+
return returned;
|
|
198
|
+
} else {
|
|
199
|
+
return data;
|
|
200
|
+
}
|
|
197
201
|
}
|
|
198
202
|
return [];
|
|
199
203
|
}
|
|
@@ -484,6 +488,7 @@ export default class SpiceModel {
|
|
|
484
488
|
}
|
|
485
489
|
}
|
|
486
490
|
} catch (e) {
|
|
491
|
+
console.log(e.message, e);
|
|
487
492
|
throw e;
|
|
488
493
|
}
|
|
489
494
|
}
|