spice-js 2.6.2 → 2.6.3

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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spice-js",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "description": "spice",
5
5
  "main": "build/index.js",
6
6
  "repository": {