@e22m4u/js-repository 0.0.35 → 0.0.37

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e22m4u/js-repository",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "Абстракция для работы с базами данных для Node.js",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -14,7 +14,7 @@ export class InvalidOperatorValueError extends Error {
14
14
  constructor(operator, expected, value) {
15
15
  super(
16
16
  format(
17
- 'Condition of {%s: ...} should have %s, %v given.',
17
+ 'Condition of {%s: ...} should have %s, but %v given.',
18
18
  operator,
19
19
  expected,
20
20
  value,
@@ -5,7 +5,7 @@ describe('InvalidOperatorValueError', function () {
5
5
  it('sets specific message', function () {
6
6
  const error = new InvalidOperatorValueError('exists', 'a boolean', '');
7
7
  const message =
8
- 'Condition of {exists: ...} should have a boolean, "" given.';
8
+ 'Condition of {exists: ...} should have a boolean, but "" given.';
9
9
  expect(error.message).to.be.eq(message);
10
10
  });
11
11
  });
@@ -1,5 +1,3 @@
1
- import {ModelData} from '../types.js';
2
-
3
1
  /**
4
2
  * Filter clause.
5
3
  */
@@ -45,20 +43,9 @@ export declare type ItemFilterClause = Pick<FilterClause, 'fields' | 'include'>;
45
43
  * ```
46
44
  */
47
45
  export declare type WhereClause =
48
- | PredicateClause
49
- | PropertiesClause
50
- | AndClause
51
- | OrClause;
52
-
53
- /**
54
- * Predicate clause.
55
- *
56
- * @example
57
- * ```ts
58
- * (value) => value.featured === true;
59
- * ```
60
- */
61
- export type PredicateClause = (value: ModelData) => boolean;
46
+ & PropertiesClause
47
+ & AndClause
48
+ & OrClause;
62
49
 
63
50
  /**
64
51
  * Properties clause.
@@ -56,7 +56,6 @@ export class WhereClauseTool extends Service {
56
56
  * @returns {Function}
57
57
  */
58
58
  _createFilter(whereClause) {
59
- if (typeof whereClause === 'function') return whereClause;
60
59
  if (typeof whereClause !== 'object' || Array.isArray(whereClause))
61
60
  throw new InvalidArgumentError(
62
61
  'The provided option "where" should be an Object, but %v given.',
@@ -272,12 +272,6 @@ describe('WhereClauseTool', function () {
272
272
  expect(result[0]).to.be.eql(OBJECTS[2]);
273
273
  expect(result[1]).to.be.eql(OBJECTS[3]);
274
274
  });
275
-
276
- it('uses the given function to filter values', function () {
277
- const result = S.filter(OBJECTS, v => v.nickname === 'Flower');
278
- expect(result).to.have.length(1);
279
- expect(result[0]).to.be.eql(OBJECTS[1]);
280
- });
281
275
  });
282
276
 
283
277
  describe('validateWhereClause', function () {