spice-js 2.6.10 → 2.6.12
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/build/bootstrap/cache.js +13 -7
- package/build/models/SpiceModel.js +20 -2
- package/package.json +1 -1
- package/src/models/SpiceModel.js +12 -1
package/build/bootstrap/cache.js
CHANGED
|
@@ -11,16 +11,22 @@ function connect() {
|
|
|
11
11
|
function _connect() {
|
|
12
12
|
_connect = _asyncToGenerator(function* () {
|
|
13
13
|
try {
|
|
14
|
+
var _spice$config, _spice$config$cache;
|
|
15
|
+
|
|
14
16
|
spice.cache_providers = {};
|
|
15
17
|
spice.monitor = new Map();
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
if ((_spice$config = spice.config) == null ? void 0 : (_spice$config$cache = _spice$config.cache) == null ? void 0 : _spice$config$cache.providers) {
|
|
20
|
+
for (var key of Object.keys(((_spice$config$cache2 = spice.config.cache) == null ? void 0 : _spice$config$cache2.providers) || {})) {
|
|
21
|
+
var _spice$config$cache2;
|
|
22
|
+
|
|
23
|
+
spice.cache_providers[key] = new spice.config.cache.providers[key](spice.config.cache.drivers[key] || {});
|
|
24
|
+
spice.cache_providers[key].initialize().then(() => {
|
|
25
|
+
console.log("Redis initialized successfully");
|
|
26
|
+
}).catch(err => {
|
|
27
|
+
console.error("Error initializing Redis:", err);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
24
30
|
}
|
|
25
31
|
} catch (e) {
|
|
26
32
|
console.log(e.stack);
|
|
@@ -212,8 +212,14 @@ class SpiceModel {
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
if (_this[_ctx]) {
|
|
215
|
-
var
|
|
216
|
-
|
|
215
|
+
var _this$_ctx, _this$_ctx$state;
|
|
216
|
+
|
|
217
|
+
if ((_this$_ctx = _this[_ctx]) == null ? void 0 : (_this$_ctx$state = _this$_ctx.state) == null ? void 0 : _this$_ctx$state.process_fields) {
|
|
218
|
+
var returned = yield new _this[_ctx].state.process_fields().process(_this[_ctx], data, _this.type);
|
|
219
|
+
return returned;
|
|
220
|
+
} else {
|
|
221
|
+
return data;
|
|
222
|
+
}
|
|
217
223
|
}
|
|
218
224
|
|
|
219
225
|
return [];
|
|
@@ -561,6 +567,7 @@ class SpiceModel {
|
|
|
561
567
|
}
|
|
562
568
|
}
|
|
563
569
|
} catch (e) {
|
|
570
|
+
console.log(e.message, e);
|
|
564
571
|
throw e;
|
|
565
572
|
}
|
|
566
573
|
})();
|
|
@@ -839,12 +846,23 @@ class SpiceModel {
|
|
|
839
846
|
return data;
|
|
840
847
|
}
|
|
841
848
|
|
|
849
|
+
function prepColumns(columns) {
|
|
850
|
+
if (columns && columns != "") {
|
|
851
|
+
var columnList = columns.split(","); // Convert comma-separated string to array
|
|
852
|
+
|
|
853
|
+
return _.join(_.map(columnList, column => "`" + column + "`"), ",");
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
return columns;
|
|
857
|
+
}
|
|
858
|
+
|
|
842
859
|
try {
|
|
843
860
|
if (!args) {
|
|
844
861
|
args = {};
|
|
845
862
|
}
|
|
846
863
|
|
|
847
864
|
var query = "";
|
|
865
|
+
args.columns = prepColumns(args.columns);
|
|
848
866
|
|
|
849
867
|
if (args.is_full_text && args.is_full_text === "true" || args.is_custom_query && args.is_custom_query === "true") {
|
|
850
868
|
query = args.query;
|
package/package.json
CHANGED
package/src/models/SpiceModel.js
CHANGED
|
@@ -748,13 +748,24 @@ export default class SpiceModel {
|
|
|
748
748
|
}
|
|
749
749
|
return data;
|
|
750
750
|
}
|
|
751
|
+
|
|
752
|
+
function prepColumns(columns) {
|
|
753
|
+
if (columns && columns != "") {
|
|
754
|
+
let columnList = columns.split(","); // Convert comma-separated string to array
|
|
755
|
+
return _.join(
|
|
756
|
+
_.map(columnList, (column) => `\`${column}\``),
|
|
757
|
+
","
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
return columns;
|
|
761
|
+
}
|
|
751
762
|
try {
|
|
752
763
|
if (!args) {
|
|
753
764
|
args = {};
|
|
754
765
|
}
|
|
755
766
|
|
|
756
767
|
let query = "";
|
|
757
|
-
|
|
768
|
+
args.columns = prepColumns(args.columns);
|
|
758
769
|
if (
|
|
759
770
|
(args.is_full_text && args.is_full_text === "true") ||
|
|
760
771
|
(args.is_custom_query && args.is_custom_query === "true")
|