@autofleet/sheilta 1.4.0-beta.3 → 1.4.0

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.
@@ -56,7 +56,7 @@ exports.generateFilterReplacements = (conditions) => {
56
56
  replacements[valueKey] = typeof value === 'string' ? value : value.value;
57
57
  });
58
58
  }
59
- else if (typeof condition === 'string') {
59
+ else if (typeof condition === 'string' || typeof condition === 'number') {
60
60
  const conditionKey = utils_1.generateRandomString();
61
61
  replacements[conditionKey] = condition;
62
62
  }
package/lib/utils.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateRandomString = exports.extractAssociatedAttributeNameFromOrder = exports.throwBadRequestError = exports.isOrderDesc = exports.extractAttributeNameFromOrder = exports.isAttributeByAssociation = exports.wrapAttributeWithOperator = exports.PAGE_MIN = exports.PER_PAGE_MIN_LIMIT = exports.PER_PAGE_MAX_LIMIT = exports.PAGE_DEFAULT = exports.PER_PAGE_DEFAULT = exports.ASSOCIATION_PREFIX = exports.ORDER_PREFIX = void 0;
4
- const node_crypto_1 = require("node:crypto");
5
4
  const errors_1 = require("@autofleet/errors");
6
5
  const operators_1 = require("./operators");
6
+ const randomInt = max => Math.floor(Math.random() * Math.floor(max));
7
7
  exports.ORDER_PREFIX = '-';
8
8
  exports.ASSOCIATION_PREFIX = '.';
9
9
  exports.PER_PAGE_DEFAULT = 20;
@@ -32,5 +32,5 @@ exports.throwBadRequestError = (message) => {
32
32
  exports.extractAssociatedAttributeNameFromOrder = (order) => order.split(exports.ASSOCIATION_PREFIX)[1];
33
33
  exports.generateRandomString = (length = 5) => {
34
34
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
35
- return Array.from({ length }, () => characters.charAt(node_crypto_1.randomInt(characters.length))).join('');
35
+ return Array.from({ length }, () => characters.charAt(randomInt(characters.length))).join('');
36
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sheilta",
3
- "version": "1.4.0-beta.3",
3
+ "version": "1.4.0",
4
4
  "description": "manage cache",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",