@autofleet/sheilta 1.4.0-beta.2 → 1.4.0-beta.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.
@@ -48,6 +48,7 @@ exports.generateFilterReplacements = (conditions) => {
48
48
  const replacements = {};
49
49
  Object.entries(conditions).forEach(([key, condition]) => {
50
50
  const replacementKey = utils_1.generateRandomString();
51
+ // eslint-disable-next-line prefer-destructuring
51
52
  replacements[replacementKey] = key.split(CUSTOM_FIELDS_QUERY_PREFIX)[1];
52
53
  if (Array.isArray(condition)) {
53
54
  condition.forEach((value) => {
@@ -74,12 +75,17 @@ exports.generateFilterReplacements = (conditions) => {
74
75
  */
75
76
  exports.generateOrderReplacements = (order) => {
76
77
  const replacementMap = {};
77
- order.forEach((item) => {
78
- const itemKey = item.startsWith(CUSTOM_FIELDS_QUERY_PREFIX)
79
- ? item.split(CUSTOM_FIELDS_QUERY_PREFIX)[1]
80
- : item.substring(1).split(CUSTOM_FIELDS_QUERY_PREFIX)[1];
81
- const randomValue = utils_1.generateRandomString();
82
- replacementMap[itemKey] = randomValue;
78
+ order.forEach((o) => {
79
+ if (o.startsWith(CUSTOM_FIELDS_QUERY_PREFIX)) {
80
+ const rand = utils_1.generateRandomString();
81
+ // eslint-disable-next-line prefer-destructuring
82
+ replacementMap[rand] = o.split(CUSTOM_FIELDS_QUERY_PREFIX)[1];
83
+ }
84
+ else if (o.substring(1).startsWith(CUSTOM_FIELDS_QUERY_PREFIX)) {
85
+ const rand = utils_1.generateRandomString();
86
+ // eslint-disable-next-line prefer-destructuring
87
+ replacementMap[rand] = o.substring(1).split(CUSTOM_FIELDS_QUERY_PREFIX)[1];
88
+ }
83
89
  });
84
90
  return replacementMap;
85
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sheilta",
3
- "version": "1.4.0-beta.2",
3
+ "version": "1.4.0-beta.3",
4
4
  "description": "manage cache",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",