@autofleet/sheilta 1.3.4-beta.0 → 1.3.4-beta.2

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.
@@ -5,7 +5,7 @@ export declare type FormatPayloadOptions = {
5
5
  includeRawPayload?: boolean;
6
6
  literalAttributes?: LiteralAttribute[];
7
7
  DBFormatter?: any;
8
- skipSearchTermQuery?: boolean;
8
+ skipSearchTermFormat?: boolean;
9
9
  };
10
10
  declare const formatPayload: ({ order, page, perPage, include, query, attributes, searchTerm, }: {
11
11
  order?: any[];
@@ -98,7 +98,7 @@ const formatPayload = ({ order = [], page = utils_1.PAGE_DEFAULT, perPage = util
98
98
  const formattedPerPage = formatPerPage(perPage);
99
99
  const result = formatQuery(query, associationModels);
100
100
  let { formattedQuery } = result;
101
- if (searchTerm && !(options === null || options === void 0 ? void 0 : options.skipSearchTermQuery)) {
101
+ if (searchTerm && !(options === null || options === void 0 ? void 0 : options.skipSearchTermFormat)) {
102
102
  const attributesToSend = (attributes === null || attributes === void 0 ? void 0 : attributes.length) ? attributes : Object.keys(model.rawAttributes);
103
103
  const queryWithSearchTerm = formatSearchTerm(searchTerm, attributesToSend, model.rawAttributes);
104
104
  formattedQuery = lodash_1.default.isEmpty(formattedQuery) ? queryWithSearchTerm : {
package/lib/utils.js CHANGED
@@ -10,7 +10,7 @@ exports.PAGE_DEFAULT = 1;
10
10
  exports.PER_PAGE_MAX_LIMIT = 100;
11
11
  exports.PER_PAGE_MIN_LIMIT = 1;
12
12
  exports.PAGE_MIN = 1;
13
- exports.wrapAttributeWithOperator = (attribute) => `${operators_1.OPERATOR_PREFIX}${attribute}${operators_1.OPERATOR_PREFIX}`;
13
+ exports.wrapAttributeWithOperator = attribute => `${operators_1.OPERATOR_PREFIX}${attribute}${operators_1.OPERATOR_PREFIX}`;
14
14
  exports.isAttributeByAssociation = (attributeName, associatedModels) => attributeName.includes(exports.ASSOCIATION_PREFIX)
15
15
  && associatedModels.includes(attributeName.split(exports.ASSOCIATION_PREFIX)[0]);
16
16
  exports.extractAttributeNameFromOrder = (order, associationModels) => {
@@ -26,6 +26,6 @@ exports.extractAttributeNameFromOrder = (order, associationModels) => {
26
26
  };
27
27
  exports.isOrderDesc = (order) => order.includes(exports.ORDER_PREFIX);
28
28
  exports.throwBadRequestError = (message) => {
29
- throw new errors_1.BadRequest([{ message, name: 'badRequestError' }], null);
29
+ throw new errors_1.BadRequest([{ message }], null);
30
30
  };
31
31
  exports.extractAssociatedAttributeNameFromOrder = (order) => order.split(exports.ASSOCIATION_PREFIX)[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sheilta",
3
- "version": "1.3.4-beta.0",
3
+ "version": "1.3.4-beta.2",
4
4
  "description": "manage cache",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",