spice-js 2.6.2 → 2.6.4
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/models/SpiceModel.js +16 -0
- package/package.json +1 -1
- package/src/bootstrap/cache.js +1 -1
|
@@ -759,6 +759,20 @@ class SpiceModel {
|
|
|
759
759
|
var _this10 = this;
|
|
760
760
|
|
|
761
761
|
return _asyncToGenerator(function* () {
|
|
762
|
+
function filterResultsByColumns(data, columns) {
|
|
763
|
+
if (columns && columns != "") {
|
|
764
|
+
columns = columns.replace(/`/g, "");
|
|
765
|
+
columns = columns.replace(/meta\(\)\.id/g, "id");
|
|
766
|
+
var columnList = columns.split(","); // Convert comma-separated string to array
|
|
767
|
+
|
|
768
|
+
columnList.push("_permissions"); // Always include _permissions
|
|
769
|
+
|
|
770
|
+
return _.map(data, entry => _.pick(entry, columnList));
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
return data;
|
|
774
|
+
}
|
|
775
|
+
|
|
762
776
|
try {
|
|
763
777
|
if (!args) {
|
|
764
778
|
args = {};
|
|
@@ -868,6 +882,8 @@ class SpiceModel {
|
|
|
868
882
|
console.log(e);
|
|
869
883
|
}
|
|
870
884
|
|
|
885
|
+
results.data = filterResultsByColumns(results.data, args.columns); //console.log("Trimmed Results", trimmed_results);
|
|
886
|
+
|
|
871
887
|
return results;
|
|
872
888
|
} catch (e) {
|
|
873
889
|
console.log(e.stack);
|
package/package.json
CHANGED
package/src/bootstrap/cache.js
CHANGED
|
@@ -8,7 +8,7 @@ async function connect() {
|
|
|
8
8
|
spice.cache_providers[key] = new spice.config.cache.providers[key](
|
|
9
9
|
spice.config.cache.drivers[key] || {}
|
|
10
10
|
);
|
|
11
|
-
|
|
11
|
+
spice.cache_providers[key].initialize();
|
|
12
12
|
}
|
|
13
13
|
} catch (e) {
|
|
14
14
|
console.log(e.stack);
|