@e22m4u/js-repository 0.8.6 → 0.8.8

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.
Files changed (66) hide show
  1. package/build-cjs.js +1 -1
  2. package/dist/cjs/index.cjs +560 -491
  3. package/package.json +8 -8
  4. package/src/adapter/adapter-loader.js +2 -5
  5. package/src/adapter/adapter-loader.spec.js +2 -2
  6. package/src/adapter/adapter-registry.spec.js +2 -2
  7. package/src/adapter/builtin/memory-adapter.js +5 -5
  8. package/src/adapter/builtin/memory-adapter.spec.js +12 -12
  9. package/src/adapter/decorator/data-sanitizing-decorator.js +1 -2
  10. package/src/adapter/decorator/default-values-decorator.js +1 -2
  11. package/src/adapter/decorator/fields-filtering-decorator.js +1 -2
  12. package/src/adapter/decorator/inclusion-decorator.js +1 -2
  13. package/src/adapter/decorator/property-uniqueness-decorator.js +1 -2
  14. package/src/adapter/decorator/required-property-decorator.js +1 -2
  15. package/src/database-schema.spec.js +3 -5
  16. package/src/definition/datasource/datasource-definition-validator.js +3 -3
  17. package/src/definition/datasource/datasource-definition-validator.spec.js +3 -6
  18. package/src/definition/definition-registry.js +4 -7
  19. package/src/definition/definition-registry.spec.js +4 -6
  20. package/src/definition/model/model-data-sanitizer.js +2 -4
  21. package/src/definition/model/model-definition-utils.js +12 -14
  22. package/src/definition/model/model-definition-utils.spec.js +12 -21
  23. package/src/definition/model/model-definition-validator.js +12 -12
  24. package/src/definition/model/model-definition-validator.spec.js +12 -15
  25. package/src/definition/model/properties/primary-keys-definition-validator.js +4 -4
  26. package/src/definition/model/properties/primary-keys-definition-validator.spec.js +8 -8
  27. package/src/definition/model/properties/properties-definition-validator.js +42 -43
  28. package/src/definition/model/properties/properties-definition-validator.spec.js +45 -45
  29. package/src/definition/model/properties/property-uniqueness-validator.js +7 -11
  30. package/src/definition/model/properties/property-uniqueness-validator.spec.js +57 -60
  31. package/src/definition/model/properties/required-property-validator.js +1 -1
  32. package/src/definition/model/properties/required-property-validator.spec.js +1 -1
  33. package/src/definition/model/relations/relations-definition-validator.js +40 -42
  34. package/src/definition/model/relations/relations-definition-validator.spec.js +44 -45
  35. package/src/errors/invalid-operator-value-error.js +1 -1
  36. package/src/errors/invalid-operator-value-error.spec.js +1 -1
  37. package/src/filter/fields-clause-tool.js +95 -53
  38. package/src/filter/fields-clause-tool.spec.js +210 -387
  39. package/src/filter/include-clause-tool.js +9 -9
  40. package/src/filter/include-clause-tool.spec.js +4 -4
  41. package/src/filter/operator-clause-tool.js +20 -32
  42. package/src/filter/operator-clause-tool.spec.js +25 -49
  43. package/src/filter/order-clause-tool.js +55 -27
  44. package/src/filter/order-clause-tool.spec.js +151 -90
  45. package/src/filter/slice-clause-tool.js +5 -6
  46. package/src/filter/slice-clause-tool.spec.js +8 -24
  47. package/src/filter/where-clause-tool.js +18 -11
  48. package/src/filter/where-clause-tool.spec.js +27 -17
  49. package/src/relations/belongs-to-resolver.js +18 -30
  50. package/src/relations/belongs-to-resolver.spec.js +21 -44
  51. package/src/relations/has-many-resolver.js +28 -44
  52. package/src/relations/has-many-resolver.spec.js +44 -68
  53. package/src/relations/has-one-resolver.js +28 -44
  54. package/src/relations/has-one-resolver.spec.js +44 -68
  55. package/src/relations/references-many-resolver.js +8 -14
  56. package/src/relations/references-many-resolver.spec.js +12 -24
  57. package/src/repository/repository-registry.js +2 -2
  58. package/src/repository/repository.js +1 -1
  59. package/src/utils/exclude-object-keys.js +2 -2
  60. package/src/utils/exclude-object-keys.spec.js +2 -2
  61. package/src/utils/like-to-regexp.js +1 -2
  62. package/src/utils/like-to-regexp.spec.js +5 -5
  63. package/src/utils/model-name-to-model-key.js +1 -1
  64. package/src/utils/model-name-to-model-key.spec.js +7 -7
  65. package/src/utils/select-object-keys.js +6 -7
  66. package/src/utils/select-object-keys.spec.js +3 -6
@@ -10,23 +10,22 @@ import {InvalidArgumentError} from '../errors/index.js';
10
10
  export function selectObjectKeys(obj, keys) {
11
11
  if (!obj || typeof obj !== 'object' || Array.isArray(obj)) {
12
12
  throw new InvalidArgumentError(
13
- 'The first argument of selectObjectKeys ' +
14
- 'should be an Object, but %v was given.',
13
+ 'Parameter "obj" must be an Object, but %v was given.',
15
14
  obj,
16
15
  );
17
16
  }
18
17
  if (!Array.isArray(keys)) {
19
18
  throw new InvalidArgumentError(
20
- 'The second argument of selectObjectKeys ' +
21
- 'should be an Array of String, but %v was given.',
19
+ 'Parameter "keys" must be an Array, but %v was given.',
22
20
  keys,
23
21
  );
24
22
  }
25
- keys.forEach(key => {
23
+ keys.forEach((key, index) => {
26
24
  if (typeof key !== 'string') {
27
25
  throw new InvalidArgumentError(
28
- 'The second argument of selectObjectKeys ' +
29
- 'should be an Array of String, but %v was given.',
26
+ 'Element %d of the parameter "keys" must be a String, ' +
27
+ 'but %v was given.',
28
+ index,
30
29
  key,
31
30
  );
32
31
  }
@@ -17,24 +17,21 @@ describe('selectObjectKeys', function () {
17
17
  it('throws an error if a given value is not an Object', function () {
18
18
  const throwable = () => selectObjectKeys(10, ['key']);
19
19
  expect(throwable).to.throw(
20
- 'The first argument of selectObjectKeys ' +
21
- 'should be an Object, but 10 was given.',
20
+ 'Parameter "obj" must be an Object, but 10 was given.',
22
21
  );
23
22
  });
24
23
 
25
24
  it('throws an error if a given keys is not an Array', function () {
26
25
  const throwable = () => selectObjectKeys({});
27
26
  expect(throwable).to.throw(
28
- 'The second argument of selectObjectKeys ' +
29
- 'should be an Array of String, but undefined was given.',
27
+ 'Parameter "keys" must be an Array, but undefined was given.',
30
28
  );
31
29
  });
32
30
 
33
31
  it('throws an error if a given keys is not an String', function () {
34
32
  const throwable = () => selectObjectKeys({}, [10]);
35
33
  expect(throwable).to.throw(
36
- 'The second argument of selectObjectKeys ' +
37
- 'should be an Array of String, but 10 was given.',
34
+ 'Element 0 of the parameter "keys" must be a String, but 10 was given.',
38
35
  );
39
36
  });
40
37
  });