spice-js 2.6.1 → 2.6.2
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/models/SpiceModel.js +12 -1
package/package.json
CHANGED
package/src/models/SpiceModel.js
CHANGED
|
@@ -679,6 +679,16 @@ export default class SpiceModel {
|
|
|
679
679
|
}
|
|
680
680
|
|
|
681
681
|
async list(args) {
|
|
682
|
+
function filterResultsByColumns(data, columns) {
|
|
683
|
+
if (columns && columns != "") {
|
|
684
|
+
columns = columns.replace(/`/g, "");
|
|
685
|
+
columns = columns.replace(/meta\(\)\.id/g, "id");
|
|
686
|
+
let columnList = columns.split(","); // Convert comma-separated string to array
|
|
687
|
+
columnList.push("_permissions"); // Always include _permissions
|
|
688
|
+
return _.map(data, (entry) => _.pick(entry, columnList));
|
|
689
|
+
}
|
|
690
|
+
return data;
|
|
691
|
+
}
|
|
682
692
|
try {
|
|
683
693
|
if (!args) {
|
|
684
694
|
args = {};
|
|
@@ -832,7 +842,8 @@ export default class SpiceModel {
|
|
|
832
842
|
} catch (e) {
|
|
833
843
|
console.log(e);
|
|
834
844
|
}
|
|
835
|
-
|
|
845
|
+
results.data = filterResultsByColumns(results.data, args.columns);
|
|
846
|
+
//console.log("Trimmed Results", trimmed_results);
|
|
836
847
|
return results;
|
|
837
848
|
} catch (e) {
|
|
838
849
|
console.log(e.stack);
|