spice-js 2.6.18 → 2.6.20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spice-js",
3
- "version": "2.6.18",
3
+ "version": "2.6.20",
4
4
  "description": "spice",
5
5
  "main": "build/index.js",
6
6
  "repository": {
@@ -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(`\`${this.type}\`.\`${sort_array[i]}\``);
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 = await this.shouldForceRefresh(
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
  }
@@ -1076,6 +1088,7 @@ export default class SpiceModel {
1076
1088
  ...this[_args],
1077
1089
  skip_cache: this[_skip_cache],
1078
1090
  }).getMulti({
1091
+ skip_hooks: true,
1079
1092
  ids: ids,
1080
1093
  });
1081
1094
  })
@@ -1133,6 +1146,7 @@ export default class SpiceModel {
1133
1146
  ...this[_args],
1134
1147
  skip_cache: this[_skip_cache],
1135
1148
  }).getMulti({
1149
+ skip_hooks: true,
1136
1150
  ids: ids,
1137
1151
  });
1138
1152
  })