@autofleet/sheilta 1.3.10-beta.1 → 1.3.10

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.
@@ -40,8 +40,6 @@ const getAttributeFromOrder = (order, options = {}) => {
40
40
  const formatOrder = ({ order, associationModels = [], }) => {
41
41
  const formattedOrders = [];
42
42
  const orderScopesMap = new Map();
43
- console.log('first order inside: ', order);
44
- console.log('associationModels inside: ', associationModels);
45
43
  order.forEach((o) => {
46
44
  if ([o, o.substring(1)].some(t => t.startsWith(CUSTOM_FIELDS_QUERY_PREFIX))) {
47
45
  if (!orderScopesMap.has(CUSTOM_FIELDS_SORT_SCOPE)) {
@@ -53,15 +51,11 @@ const formatOrder = ({ order, associationModels = [], }) => {
53
51
  ASCENDING_KEY);
54
52
  return;
55
53
  }
56
- console.log('o inside:', o);
57
54
  const formattedOrder = [utils_1.extractAttributeNameFromOrder(o, associationModels)];
58
- console.log('formattedOrder inside: ', formattedOrder);
59
55
  const isOrderDescOrder = utils_1.isOrderDesc(o);
60
- console.log('isOrderDescOrder inside: ', isOrderDescOrder);
61
56
  const isOrderAssociation = utils_1.isAttributeByAssociation(isOrderDescOrder
62
57
  ? o.split(utils_1.ORDER_PREFIX)[1]
63
58
  : o, associationModels);
64
- console.log('isOrderAssociation inside: ', isOrderAssociation);
65
59
  if (isOrderAssociation) {
66
60
  formattedOrder.push(utils_1.extractAssociatedAttributeNameFromOrder(o));
67
61
  }
@@ -85,7 +79,7 @@ const formatPerPage = perPage => perPage || utils_1.PER_PAGE_DEFAULT;
85
79
  const formatInclude = (include, associationsMap = {}) => {
86
80
  let formattedInclude = include.map((i) => {
87
81
  var _a;
88
- const includedAssociation = associationsMap[i.association || i.model];
82
+ const includedAssociation = associationsMap[typeof i === 'string' ? i : (i.association || i.model)];
89
83
  return Object.assign(Object.assign(Object.assign({}, i), { association: includedAssociation, required: i.required !== false }), (i.include && {
90
84
  include: formatInclude(i.include, (_a = includedAssociation === null || includedAssociation === void 0 ? void 0 : includedAssociation.target) === null || _a === void 0 ? void 0 : _a.associations),
91
85
  }));
@@ -137,7 +131,6 @@ const formatPayload = ({ order = [], page = utils_1.PAGE_DEFAULT, perPage = util
137
131
  order: [...order, DEFAULT_ORDER],
138
132
  associationModels,
139
133
  });
140
- console.log('formattedOrders: ', formattedOrders);
141
134
  const [filteredFormattedOrder, filteredLiteralAttributes] = getAttributeFromOrder(formattedOrders, options);
142
135
  const allAttributes = [...filteredLiteralAttributes, ...(attributes || [])];
143
136
  const formattedAttribute = (attributes === null || attributes === void 0 ? void 0 : attributes.length) ? allAttributes : { include: allAttributes };
@@ -44,7 +44,7 @@ const validateQueryPayload = (query, rawAttributes, associationModels = []) => {
44
44
  // eslint-disable-next-line array-callback-return
45
45
  Object.keys(query).map((key) => {
46
46
  const value = query[key];
47
- if (lodash_1.default.isArray(value)) {
47
+ if (Array.isArray(value)) {
48
48
  if (lodash_1.default.isObject(value[0])) {
49
49
  value.map(v => validateQueryPayload(v, rawAttributes, associationModels));
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sheilta",
3
- "version": "1.3.10-beta.1",
3
+ "version": "1.3.10",
4
4
  "description": "manage cache",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",