@autofleet/sheilta 1.3.11-beta.5 → 1.3.11

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.
@@ -13,15 +13,9 @@ const ASCENDING_KEY = 'ASC';
13
13
  const CUSTOM_FIELDS_QUERY_PREFIX = 'customFields.';
14
14
  const { CUSTOM_FIELDS_FILTER_SCOPE, CUSTOM_FIELDS_SORT_SCOPE } = common_types_1.customFields;
15
15
  const parseCustomFieldScopeQueryValue = (value) => {
16
- if (['string', 'number'].includes(typeof value)) {
16
+ if (['string', 'number'].includes(typeof value) || Array.isArray(value)) {
17
17
  return value;
18
18
  }
19
- if (Array.isArray(value)) {
20
- return [{
21
- operator: operators_1.OPERATORS_TO_SQL.$in,
22
- value
23
- }];
24
- }
25
19
  return Object.entries(value).map(([operator, conditionValue]) => ({
26
20
  operator: operators_1.OPERATORS_TO_SQL[operator],
27
21
  value: conditionValue,
@@ -96,9 +90,7 @@ const formatInclude = (include, associationsMap = {}) => {
96
90
  const formatQuery = (query, associationModels) => {
97
91
  const formattedQuery = {};
98
92
  const formattedScopeMap = new Map();
99
- console.log('query', query);
100
93
  Object.entries(query).forEach(([queryItemKey, queryItemValue]) => {
101
- console.log({ queryItemKey, queryItemValue });
102
94
  if (queryItemKey.startsWith(CUSTOM_FIELDS_QUERY_PREFIX)) {
103
95
  if (!formattedScopeMap.has(CUSTOM_FIELDS_FILTER_SCOPE)) {
104
96
  formattedScopeMap.set(CUSTOM_FIELDS_FILTER_SCOPE, {});
@@ -119,7 +111,6 @@ const formatQuery = (query, associationModels) => {
119
111
  }
120
112
  return { method: [scopeName, scopeValue] };
121
113
  });
122
- console.log({ formattedQuery, formattedScopes });
123
114
  return {
124
115
  formattedQuery,
125
116
  formattedScopes,
@@ -159,7 +150,6 @@ const formatPayload = ({ order = [], page = utils_1.PAGE_DEFAULT, perPage = util
159
150
  ],
160
151
  };
161
152
  }
162
- console.log({ formattedQuery, filteredFormattedOrder, formattedPage, formattedPerPage, formattedInclude, queryScopes, orderScopes, formattedAttribute });
163
153
  return Object.assign({ query: formattedQuery, order: filteredFormattedOrder, page: formattedPage, perPage: formattedPerPage, include: formattedInclude, scopes: [...queryScopes, ...orderScopes] }, (formattedAttribute && { attributes: formattedAttribute }));
164
154
  };
165
155
  exports.default = formatPayload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sheilta",
3
- "version": "1.3.11-beta.5",
3
+ "version": "1.3.11",
4
4
  "description": "manage cache",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -47,8 +47,7 @@
47
47
  "@autofleet/common-types": "^1.7.42",
48
48
  "@autofleet/errors": "^1.0.10",
49
49
  "joi": "^17.9.2",
50
- "lodash": "^4.17.21",
51
- "npm-watch": "^0.13.0"
50
+ "lodash": "^4.17.21"
52
51
  },
53
52
  "devDependencies": {
54
53
  "@types/jest": "^24.9.0",
@@ -61,7 +60,8 @@
61
60
  "jest": "^25.1.0",
62
61
  "ts-jest": "^25.0.0",
63
62
  "typescript": "^3.9.5",
64
- "typescript-eslint": "0.0.1-alpha.0"
63
+ "typescript-eslint": "0.0.1-alpha.0",
64
+ "npm-watch": "^0.13.0"
65
65
  },
66
66
  "files": [
67
67
  "lib/**/*"