spice-js 2.6.18 → 2.6.19
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 +16 -4
package/package.json
CHANGED
package/src/models/SpiceModel.js
CHANGED
|
@@ -847,6 +847,15 @@ export default class SpiceModel {
|
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
|
|
850
|
+
function formatSortComponent(sortComponent) {
|
|
851
|
+
// Split the string by spaces to get individual parts
|
|
852
|
+
const parts = sortComponent.split(" ");
|
|
853
|
+
// Assuming the first part is the column name, add backticks around it
|
|
854
|
+
parts[0] = `\`${parts[0]}\``;
|
|
855
|
+
// Rejoin the parts back into a string and return
|
|
856
|
+
return parts.join(" ");
|
|
857
|
+
}
|
|
858
|
+
|
|
850
859
|
if (hasSQLInjection(query)) {
|
|
851
860
|
return [];
|
|
852
861
|
}
|
|
@@ -865,7 +874,9 @@ export default class SpiceModel {
|
|
|
865
874
|
let new_sort_array = [];
|
|
866
875
|
for (let i = 0; i < sort_array.length; i++) {
|
|
867
876
|
if (!sort_array[i].includes(".")) {
|
|
868
|
-
new_sort_array.push(
|
|
877
|
+
new_sort_array.push(
|
|
878
|
+
`\`${this.type}\`.${formatSortComponent(sort_array[i])}`
|
|
879
|
+
);
|
|
869
880
|
} else {
|
|
870
881
|
new_sort_array.push(sort_array[i]);
|
|
871
882
|
}
|
|
@@ -944,9 +955,8 @@ export default class SpiceModel {
|
|
|
944
955
|
this.type
|
|
945
956
|
).get(key);
|
|
946
957
|
results = cached_results?.value;
|
|
947
|
-
let shouleForceRefresh =
|
|
948
|
-
cached_results
|
|
949
|
-
);
|
|
958
|
+
let shouleForceRefresh =
|
|
959
|
+
await this.shouldForceRefresh(cached_results);
|
|
950
960
|
if (cached_results?.value == undefined || shouleForceRefresh) {
|
|
951
961
|
results = await this.database.search(
|
|
952
962
|
this.type,
|
|
@@ -990,6 +1000,8 @@ export default class SpiceModel {
|
|
|
990
1000
|
await this.propsToBeRemoved(results.data)
|
|
991
1001
|
);
|
|
992
1002
|
}
|
|
1003
|
+
if (this.type == "resourcedetail");
|
|
1004
|
+
|
|
993
1005
|
if (args.skip_hooks != true) {
|
|
994
1006
|
await this.run_hook(results.data, "list", "after");
|
|
995
1007
|
}
|