@e22m4u/js-repository 0.8.7 → 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 (65) hide show
  1. package/dist/cjs/index.cjs +359 -300
  2. package/package.json +3 -3
  3. package/src/adapter/adapter-loader.js +2 -5
  4. package/src/adapter/adapter-loader.spec.js +2 -2
  5. package/src/adapter/adapter-registry.spec.js +2 -2
  6. package/src/adapter/builtin/memory-adapter.js +5 -5
  7. package/src/adapter/builtin/memory-adapter.spec.js +12 -12
  8. package/src/adapter/decorator/data-sanitizing-decorator.js +1 -2
  9. package/src/adapter/decorator/default-values-decorator.js +1 -2
  10. package/src/adapter/decorator/fields-filtering-decorator.js +1 -2
  11. package/src/adapter/decorator/inclusion-decorator.js +1 -2
  12. package/src/adapter/decorator/property-uniqueness-decorator.js +1 -2
  13. package/src/adapter/decorator/required-property-decorator.js +1 -2
  14. package/src/database-schema.spec.js +3 -5
  15. package/src/definition/datasource/datasource-definition-validator.js +3 -3
  16. package/src/definition/datasource/datasource-definition-validator.spec.js +3 -6
  17. package/src/definition/definition-registry.js +4 -7
  18. package/src/definition/definition-registry.spec.js +4 -6
  19. package/src/definition/model/model-data-sanitizer.js +2 -4
  20. package/src/definition/model/model-definition-utils.js +12 -14
  21. package/src/definition/model/model-definition-utils.spec.js +12 -21
  22. package/src/definition/model/model-definition-validator.js +12 -12
  23. package/src/definition/model/model-definition-validator.spec.js +12 -15
  24. package/src/definition/model/properties/primary-keys-definition-validator.js +4 -4
  25. package/src/definition/model/properties/primary-keys-definition-validator.spec.js +8 -8
  26. package/src/definition/model/properties/properties-definition-validator.js +42 -43
  27. package/src/definition/model/properties/properties-definition-validator.spec.js +45 -45
  28. package/src/definition/model/properties/property-uniqueness-validator.js +7 -11
  29. package/src/definition/model/properties/property-uniqueness-validator.spec.js +57 -60
  30. package/src/definition/model/properties/required-property-validator.js +1 -1
  31. package/src/definition/model/properties/required-property-validator.spec.js +1 -1
  32. package/src/definition/model/relations/relations-definition-validator.js +40 -42
  33. package/src/definition/model/relations/relations-definition-validator.spec.js +44 -45
  34. package/src/errors/invalid-operator-value-error.js +1 -1
  35. package/src/errors/invalid-operator-value-error.spec.js +1 -1
  36. package/src/filter/fields-clause-tool.js +95 -53
  37. package/src/filter/fields-clause-tool.spec.js +210 -387
  38. package/src/filter/include-clause-tool.js +9 -9
  39. package/src/filter/include-clause-tool.spec.js +4 -4
  40. package/src/filter/operator-clause-tool.js +20 -32
  41. package/src/filter/operator-clause-tool.spec.js +25 -49
  42. package/src/filter/order-clause-tool.js +55 -27
  43. package/src/filter/order-clause-tool.spec.js +151 -90
  44. package/src/filter/slice-clause-tool.js +5 -6
  45. package/src/filter/slice-clause-tool.spec.js +8 -24
  46. package/src/filter/where-clause-tool.js +18 -11
  47. package/src/filter/where-clause-tool.spec.js +27 -17
  48. package/src/relations/belongs-to-resolver.js +18 -30
  49. package/src/relations/belongs-to-resolver.spec.js +21 -44
  50. package/src/relations/has-many-resolver.js +28 -44
  51. package/src/relations/has-many-resolver.spec.js +44 -68
  52. package/src/relations/has-one-resolver.js +28 -44
  53. package/src/relations/has-one-resolver.spec.js +44 -68
  54. package/src/relations/references-many-resolver.js +8 -14
  55. package/src/relations/references-many-resolver.spec.js +12 -24
  56. package/src/repository/repository-registry.js +2 -2
  57. package/src/repository/repository.js +1 -1
  58. package/src/utils/exclude-object-keys.js +2 -2
  59. package/src/utils/exclude-object-keys.spec.js +2 -2
  60. package/src/utils/like-to-regexp.js +1 -2
  61. package/src/utils/like-to-regexp.spec.js +5 -5
  62. package/src/utils/model-name-to-model-key.js +1 -1
  63. package/src/utils/model-name-to-model-key.spec.js +7 -7
  64. package/src/utils/select-object-keys.js +6 -7
  65. package/src/utils/select-object-keys.spec.js +3 -6
@@ -44,8 +44,8 @@ describe('ModelDefinitionUtils', function () {
44
44
  const throwable = () => mdu.getPrimaryKeyAsPropertyName('model');
45
45
  expect(throwable).to.throw(
46
46
  format(
47
- 'The property name %v of the model "model" is defined as a regular property. ' +
48
- 'In this case, a primary key should be defined explicitly. ' +
47
+ 'Property name %v of the model "model" is defined as a regular property. ' +
48
+ 'In this case, a primary key must be defined explicitly. ' +
49
49
  'Do use the option "primaryKey" to specify the primary key.',
50
50
  DEF_PK,
51
51
  ),
@@ -179,8 +179,8 @@ describe('ModelDefinitionUtils', function () {
179
179
  const throwable = () => mdu.getPrimaryKeyAsColumnName('model');
180
180
  expect(throwable).to.throw(
181
181
  format(
182
- 'The property name %v of the model "model" is defined as a regular property. ' +
183
- 'In this case, a primary key should be defined explicitly. ' +
182
+ 'Property name %v of the model "model" is defined as a regular property. ' +
183
+ 'In this case, a primary key must be defined explicitly. ' +
184
184
  'Do use the option "primaryKey" to specify the primary key.',
185
185
  DEF_PK,
186
186
  ),
@@ -1222,8 +1222,8 @@ describe('ModelDefinitionUtils', function () {
1222
1222
  const throwable = v => () => mdu.getDataTypeFromPropertyDefinition(v);
1223
1223
  const error = v =>
1224
1224
  format(
1225
- 'The argument "propDef" of the ModelDefinitionUtils.getDataTypeFromPropertyDefinition ' +
1226
- 'should be an Object or the DataType enum, but %s was given.',
1225
+ 'Parameter "propDef" must be an Object or a DataType, ' +
1226
+ 'but %s was given.',
1227
1227
  v,
1228
1228
  );
1229
1229
  expect(throwable('str')).to.throw(error('"str"'));
@@ -1245,8 +1245,7 @@ describe('ModelDefinitionUtils', function () {
1245
1245
  mdu.getDataTypeFromPropertyDefinition({type: v});
1246
1246
  const error = v =>
1247
1247
  format(
1248
- 'The given Object to the ModelDefinitionUtils.getDataTypeFromPropertyDefinition ' +
1249
- 'should have the "type" property with one of values: %l, but %s was given.',
1248
+ 'Option "type" must be one of values: %l, but %s was given.',
1250
1249
  Object.values(DataType),
1251
1250
  v,
1252
1251
  );
@@ -1562,9 +1561,7 @@ describe('ModelDefinitionUtils', function () {
1562
1561
  dbs
1563
1562
  .getService(ModelDefinitionUtils)
1564
1563
  .getPropertiesDefinitionInBaseModelHierarchy('model');
1565
- expect(throwable).to.throw(
1566
- 'The model "model" has a circular inheritance.',
1567
- );
1564
+ expect(throwable).to.throw('Model "model" has a circular inheritance.');
1568
1565
  });
1569
1566
 
1570
1567
  it('places a primary key definition at the start of the result', function () {
@@ -1782,9 +1779,7 @@ describe('ModelDefinitionUtils', function () {
1782
1779
  dbs
1783
1780
  .getService(ModelDefinitionUtils)
1784
1781
  .getRelationsDefinitionInBaseModelHierarchy('model');
1785
- expect(throwable).to.throw(
1786
- 'The model "model" has a circular inheritance.',
1787
- );
1782
+ expect(throwable).to.throw('Model "model" has a circular inheritance.');
1788
1783
  });
1789
1784
  });
1790
1785
 
@@ -1795,7 +1790,7 @@ describe('ModelDefinitionUtils', function () {
1795
1790
  dbs
1796
1791
  .getService(ModelDefinitionUtils)
1797
1792
  .getRelationDefinitionByName('model', 'myRelation');
1798
- expect(throwable).to.throw('The model "model" is not defined.');
1793
+ expect(throwable).to.throw('Model "model" is not defined.');
1799
1794
  });
1800
1795
 
1801
1796
  it('throws an error if a given relation is not found', function () {
@@ -1808,7 +1803,7 @@ describe('ModelDefinitionUtils', function () {
1808
1803
  .getService(ModelDefinitionUtils)
1809
1804
  .getRelationDefinitionByName('model', 'myRelation');
1810
1805
  expect(throwable).to.throw(
1811
- 'The model "model" does not have relation name "myRelation".',
1806
+ 'Model "model" does not have relation name "myRelation".',
1812
1807
  );
1813
1808
  });
1814
1809
 
@@ -1924,11 +1919,7 @@ describe('ModelDefinitionUtils', function () {
1924
1919
  .getService(ModelDefinitionUtils)
1925
1920
  .excludeObjectKeysByRelationNames('model', v);
1926
1921
  const error = v =>
1927
- format(
1928
- 'The second argument of ModelDefinitionUtils.excludeObjectKeysByRelationNames ' +
1929
- 'should be an Object, but %s was given.',
1930
- v,
1931
- );
1922
+ format('Parameter "modelData" must be an Object, but %s was given.', v);
1932
1923
  expect(throwable('')).to.throw(error('""'));
1933
1924
  expect(throwable('str')).to.throw(error('"str"'));
1934
1925
  expect(throwable(10)).to.throw(error('10'));
@@ -15,37 +15,37 @@ export class ModelDefinitionValidator extends Service {
15
15
  validate(modelDef) {
16
16
  if (!modelDef || typeof modelDef !== 'object' || Array.isArray(modelDef)) {
17
17
  throw new InvalidArgumentError(
18
- 'The model definition should be an Object, but %v was given.',
18
+ 'Model definition must be an Object, but %v was given.',
19
19
  modelDef,
20
20
  );
21
21
  }
22
22
  if (!modelDef.name || typeof modelDef.name !== 'string') {
23
23
  throw new InvalidArgumentError(
24
- 'The model definition requires the option "name" ' +
24
+ 'Model definition requires the option "name" ' +
25
25
  'as a non-empty String, but %v was given.',
26
26
  modelDef.name,
27
27
  );
28
28
  }
29
29
  if (modelDef.datasource && typeof modelDef.datasource !== 'string') {
30
30
  throw new InvalidArgumentError(
31
- 'The provided option "datasource" of the model %v ' +
32
- 'should be a String, but %v was given.',
31
+ 'Option "datasource" of the model %v ' +
32
+ 'must be a String, but %v was given.',
33
33
  modelDef.name,
34
34
  modelDef.datasource,
35
35
  );
36
36
  }
37
37
  if (modelDef.base && typeof modelDef.base !== 'string') {
38
38
  throw new InvalidArgumentError(
39
- 'The provided option "base" of the model %v ' +
40
- 'should be a String, but %v was given.',
39
+ 'Option "base" of the model %v ' +
40
+ 'must be a String, but %v was given.',
41
41
  modelDef.name,
42
42
  modelDef.base,
43
43
  );
44
44
  }
45
45
  if (modelDef.tableName && typeof modelDef.tableName !== 'string') {
46
46
  throw new InvalidArgumentError(
47
- 'The provided option "tableName" of the model %v ' +
48
- 'should be a String, but %v was given.',
47
+ 'Option "tableName" of the model %v ' +
48
+ 'must be a String, but %v was given.',
49
49
  modelDef.name,
50
50
  modelDef.tableName,
51
51
  );
@@ -56,8 +56,8 @@ export class ModelDefinitionValidator extends Service {
56
56
  Array.isArray(modelDef.properties)
57
57
  ) {
58
58
  throw new InvalidArgumentError(
59
- 'The provided option "properties" of the model %v ' +
60
- 'should be an Object, but %v was given.',
59
+ 'Option "properties" of the model %v ' +
60
+ 'must be an Object, but %v was given.',
61
61
  modelDef.name,
62
62
  modelDef.properties,
63
63
  );
@@ -73,8 +73,8 @@ export class ModelDefinitionValidator extends Service {
73
73
  Array.isArray(modelDef.relations)
74
74
  ) {
75
75
  throw new InvalidArgumentError(
76
- 'The provided option "relations" of the model %v ' +
77
- 'should be an Object, but %v was given.',
76
+ 'Option "relations" of the model %v ' +
77
+ 'must be an Object, but %v was given.',
78
78
  modelDef.name,
79
79
  modelDef.relations,
80
80
  );
@@ -17,10 +17,7 @@ describe('ModelDefinitionValidator', function () {
17
17
  it('requires the given definition to be an object', function () {
18
18
  const validate = v => () => S.validate(v);
19
19
  const error = v =>
20
- format(
21
- 'The model definition should be an Object, but %s was given.',
22
- v,
23
- );
20
+ format('Model definition must be an Object, but %s was given.', v);
24
21
  expect(validate('str')).to.throw(error('"str"'));
25
22
  expect(validate(10)).to.throw(error('10'));
26
23
  expect(validate(true)).to.throw(error('true'));
@@ -35,7 +32,7 @@ describe('ModelDefinitionValidator', function () {
35
32
  const validate = v => () => S.validate({name: v});
36
33
  const error = v =>
37
34
  format(
38
- 'The model definition requires the option "name" ' +
35
+ 'Model definition requires the option "name" ' +
39
36
  'as a non-empty String, but %s was given.',
40
37
  v,
41
38
  );
@@ -54,8 +51,8 @@ describe('ModelDefinitionValidator', function () {
54
51
  const validate = v => () => S.validate({name: 'model', datasource: v});
55
52
  const error = v =>
56
53
  format(
57
- 'The provided option "datasource" of the model "model" ' +
58
- 'should be a String, but %s was given.',
54
+ 'Option "datasource" of the model "model" ' +
55
+ 'must be a String, but %s was given.',
59
56
  v,
60
57
  );
61
58
  expect(validate(10)).to.throw(error('10'));
@@ -69,8 +66,8 @@ describe('ModelDefinitionValidator', function () {
69
66
  const validate = v => () => S.validate({name: 'model', base: v});
70
67
  const error = v =>
71
68
  format(
72
- 'The provided option "base" of the model "model" ' +
73
- 'should be a String, but %s was given.',
69
+ 'Option "base" of the model "model" ' +
70
+ 'must be a String, but %s was given.',
74
71
  v,
75
72
  );
76
73
  expect(validate(10)).to.throw(error('10'));
@@ -84,8 +81,8 @@ describe('ModelDefinitionValidator', function () {
84
81
  const validate = v => () => S.validate({name: 'model', tableName: v});
85
82
  const error = v =>
86
83
  format(
87
- 'The provided option "tableName" of the model "model" ' +
88
- 'should be a String, but %s was given.',
84
+ 'Option "tableName" of the model "model" ' +
85
+ 'must be a String, but %s was given.',
89
86
  v,
90
87
  );
91
88
  expect(validate(10)).to.throw(error('10'));
@@ -99,8 +96,8 @@ describe('ModelDefinitionValidator', function () {
99
96
  const validate = v => () => S.validate({name: 'model', properties: v});
100
97
  const error = v =>
101
98
  format(
102
- 'The provided option "properties" of the model "model" ' +
103
- 'should be an Object, but %s was given.',
99
+ 'Option "properties" of the model "model" ' +
100
+ 'must be an Object, but %s was given.',
104
101
  v,
105
102
  );
106
103
  expect(validate('str')).to.throw(error('"str"'));
@@ -114,8 +111,8 @@ describe('ModelDefinitionValidator', function () {
114
111
  const validate = v => () => S.validate({name: 'model', relations: v});
115
112
  const error = v =>
116
113
  format(
117
- 'The provided option "relations" of the model "model" ' +
118
- 'should be an Object, but %s was given.',
114
+ 'Option "relations" of the model "model" ' +
115
+ 'must be an Object, but %s was given.',
119
116
  v,
120
117
  );
121
118
  expect(validate('str')).to.throw(error('"str"'));
@@ -22,8 +22,8 @@ export class PrimaryKeysDefinitionValidator extends Service {
22
22
  Object.keys(propDefs).includes(DEF_PK);
23
23
  if (isDefaultPrimaryKeyAlreadyInUse) {
24
24
  throw new InvalidArgumentError(
25
- 'The property name %v of the model %v is defined as a regular property. ' +
26
- 'In this case, a primary key should be defined explicitly. ' +
25
+ 'Property name %v of the model %v is defined as a regular property. ' +
26
+ 'In this case, a primary key must be defined explicitly. ' +
27
27
  'Do use the option "primaryKey" to specify the primary key.',
28
28
  DEF_PK,
29
29
  modelName,
@@ -33,8 +33,8 @@ export class PrimaryKeysDefinitionValidator extends Service {
33
33
  }
34
34
  if (propNames.length > 1) {
35
35
  throw new InvalidArgumentError(
36
- 'The model definition %v should not have ' +
37
- 'multiple primary keys, but %v keys given.',
36
+ 'Model definition %v must not have multiple primary keys, ' +
37
+ 'but %v keys were given.',
38
38
  modelName,
39
39
  propNames.length,
40
40
  );
@@ -41,8 +41,8 @@ describe('PrimaryKeysDefinitionValidator', function () {
41
41
  },
42
42
  });
43
43
  expect(throwable).to.throw(
44
- 'The model definition "model" should not have ' +
45
- 'multiple primary keys, but 2 keys given.',
44
+ 'Model definition "model" must not have multiple primary keys, ' +
45
+ 'but 2 keys were given.',
46
46
  );
47
47
  });
48
48
 
@@ -53,8 +53,8 @@ describe('PrimaryKeysDefinitionValidator', function () {
53
53
  });
54
54
  expect(throwable).to.throw(
55
55
  format(
56
- 'The property name %v of the model "model" is defined as a regular property. ' +
57
- 'In this case, a primary key should be defined explicitly. ' +
56
+ 'Property name %v of the model "model" is defined as a regular property. ' +
57
+ 'In this case, a primary key must be defined explicitly. ' +
58
58
  'Do use the option "primaryKey" to specify the primary key.',
59
59
  DEF_PK,
60
60
  ),
@@ -70,8 +70,8 @@ describe('PrimaryKeysDefinitionValidator', function () {
70
70
  });
71
71
  expect(throwable).to.throw(
72
72
  format(
73
- 'The property name %v of the model "model" is defined as a regular property. ' +
74
- 'In this case, a primary key should be defined explicitly. ' +
73
+ 'Property name %v of the model "model" is defined as a regular property. ' +
74
+ 'In this case, a primary key must be defined explicitly. ' +
75
75
  'Do use the option "primaryKey" to specify the primary key.',
76
76
  DEF_PK,
77
77
  ),
@@ -88,8 +88,8 @@ describe('PrimaryKeysDefinitionValidator', function () {
88
88
  });
89
89
  expect(throwable).to.throw(
90
90
  format(
91
- 'The property name %v of the model "model" is defined as a regular property. ' +
92
- 'In this case, a primary key should be defined explicitly. ' +
91
+ 'Property name %v of the model "model" is defined as a regular property. ' +
92
+ 'In this case, a primary key must be defined explicitly. ' +
93
93
  'Do use the option "primaryKey" to specify the primary key.',
94
94
  DEF_PK,
95
95
  ),
@@ -18,15 +18,14 @@ export class PropertiesDefinitionValidator extends Service {
18
18
  validate(modelName, propDefs) {
19
19
  if (!modelName || typeof modelName !== 'string') {
20
20
  throw new InvalidArgumentError(
21
- 'The first argument of PropertiesDefinitionValidator.validate ' +
22
- 'should be a non-empty String, but %v was given.',
21
+ 'Parameter "modelName" must be a non-empty String, but %v was given.',
23
22
  modelName,
24
23
  );
25
24
  }
26
25
  if (!propDefs || typeof propDefs !== 'object' || Array.isArray(propDefs)) {
27
26
  throw new InvalidArgumentError(
28
- 'The provided option "properties" of the model %v ' +
29
- 'should be an Object, but %v was given.',
27
+ 'Option "properties" of the model %v ' +
28
+ 'must be an Object, but %v was given.',
30
29
  modelName,
31
30
  propDefs,
32
31
  );
@@ -52,14 +51,13 @@ export class PropertiesDefinitionValidator extends Service {
52
51
  _validateProperty(modelName, propName, propDef) {
53
52
  if (!modelName || typeof modelName !== 'string') {
54
53
  throw new InvalidArgumentError(
55
- 'The first argument of PropertiesDefinitionValidator._validateProperty ' +
56
- 'should be a non-empty String, but %v was given.',
54
+ 'Parameter "modelName" must be a non-empty String, but %v was given.',
57
55
  modelName,
58
56
  );
59
57
  }
60
58
  if (!propName || typeof propName !== 'string') {
61
59
  throw new InvalidArgumentError(
62
- 'The property name of the model %v should be ' +
60
+ 'Property name of the model %v must be ' +
63
61
  'a non-empty String, but %v was given.',
64
62
  modelName,
65
63
  propName,
@@ -67,8 +65,8 @@ export class PropertiesDefinitionValidator extends Service {
67
65
  }
68
66
  if (!propDef) {
69
67
  throw new InvalidArgumentError(
70
- 'The property %v of the model %v should have ' +
71
- 'a property definition, but %v was given.',
68
+ 'Property %v of the model %v must have a property definition, ' +
69
+ 'but %v was given.',
72
70
  propName,
73
71
  modelName,
74
72
  propDef,
@@ -78,7 +76,8 @@ export class PropertiesDefinitionValidator extends Service {
78
76
  if (!Object.values(Type).includes(propDef)) {
79
77
  throw new InvalidArgumentError(
80
78
  'In case of a short property definition, the property %v ' +
81
- 'of the model %v should have one of data types: %l, but %v was given.',
79
+ 'of the model %v must have one of data types: %l, ' +
80
+ 'but %v was given.',
82
81
  propName,
83
82
  modelName,
84
83
  Object.values(Type),
@@ -90,7 +89,7 @@ export class PropertiesDefinitionValidator extends Service {
90
89
  if (!propDef || typeof propDef !== 'object' || Array.isArray(propDef)) {
91
90
  throw new InvalidArgumentError(
92
91
  'In case of a full property definition, the property %v ' +
93
- 'of the model %v should be an Object, but %v was given.',
92
+ 'of the model %v must be an Object, but %v was given.',
94
93
  propName,
95
94
  modelName,
96
95
  propDef,
@@ -98,7 +97,7 @@ export class PropertiesDefinitionValidator extends Service {
98
97
  }
99
98
  if (!propDef.type || !Object.values(Type).includes(propDef.type)) {
100
99
  throw new InvalidArgumentError(
101
- 'The property %v of the model %v requires the option "type" ' +
100
+ 'Property %v of the model %v requires the option "type" ' +
102
101
  'to have one of data types: %l, but %v was given.',
103
102
  propName,
104
103
  modelName,
@@ -108,7 +107,7 @@ export class PropertiesDefinitionValidator extends Service {
108
107
  }
109
108
  if (propDef.itemType && !Object.values(Type).includes(propDef.itemType)) {
110
109
  throw new InvalidArgumentError(
111
- 'The provided option "itemType" of the property %v in the model %v ' +
110
+ 'Option "itemType" of the property %v in the model %v ' +
112
111
  'should have one of data types: %l, but %v was given.',
113
112
  propName,
114
113
  modelName,
@@ -118,8 +117,8 @@ export class PropertiesDefinitionValidator extends Service {
118
117
  }
119
118
  if (propDef.itemModel && typeof propDef.itemModel !== 'string') {
120
119
  throw new InvalidArgumentError(
121
- 'The provided option "itemModel" of the property %v in the model %v ' +
122
- 'should be a String, but %v was given.',
120
+ 'Option "itemModel" of the property %v in the model %v ' +
121
+ 'must be a String, but %v was given.',
123
122
  propName,
124
123
  modelName,
125
124
  propDef.itemModel,
@@ -127,8 +126,8 @@ export class PropertiesDefinitionValidator extends Service {
127
126
  }
128
127
  if (propDef.model && typeof propDef.model !== 'string') {
129
128
  throw new InvalidArgumentError(
130
- 'The provided option "model" of the property %v in the model %v ' +
131
- 'should be a String, but %v was given.',
129
+ 'Option "model" of the property %v in the model %v ' +
130
+ 'must be a String, but %v was given.',
132
131
  propName,
133
132
  modelName,
134
133
  propDef.model,
@@ -136,8 +135,8 @@ export class PropertiesDefinitionValidator extends Service {
136
135
  }
137
136
  if (propDef.primaryKey && typeof propDef.primaryKey !== 'boolean') {
138
137
  throw new InvalidArgumentError(
139
- 'The provided option "primaryKey" of the property %v in the model %v ' +
140
- 'should be a Boolean, but %v was given.',
138
+ 'Option "primaryKey" of the property %v in the model %v ' +
139
+ 'must be a Boolean, but %v was given.',
141
140
  propName,
142
141
  modelName,
143
142
  propDef.primaryKey,
@@ -145,8 +144,8 @@ export class PropertiesDefinitionValidator extends Service {
145
144
  }
146
145
  if (propDef.columnName && typeof propDef.columnName !== 'string') {
147
146
  throw new InvalidArgumentError(
148
- 'The provided option "columnName" of the property %v in the model %v ' +
149
- 'should be a String, but %v was given.',
147
+ 'Option "columnName" of the property %v in the model %v ' +
148
+ 'must be a String, but %v was given.',
150
149
  propName,
151
150
  modelName,
152
151
  propDef.columnName,
@@ -154,8 +153,8 @@ export class PropertiesDefinitionValidator extends Service {
154
153
  }
155
154
  if (propDef.columnType && typeof propDef.columnType !== 'string') {
156
155
  throw new InvalidArgumentError(
157
- 'The provided option "columnType" of the property %v in the model %v ' +
158
- 'should be a String, but %v was given.',
156
+ 'Option "columnType" of the property %v in the model %v ' +
157
+ 'must be a String, but %v was given.',
159
158
  propName,
160
159
  modelName,
161
160
  propDef.columnType,
@@ -163,8 +162,8 @@ export class PropertiesDefinitionValidator extends Service {
163
162
  }
164
163
  if (propDef.required && typeof propDef.required !== 'boolean') {
165
164
  throw new InvalidArgumentError(
166
- 'The provided option "required" of the property %v in the model %v ' +
167
- 'should be a Boolean, but %v was given.',
165
+ 'Option "required" of the property %v in the model %v ' +
166
+ 'must be a Boolean, but %v was given.',
168
167
  propName,
169
168
  modelName,
170
169
  propDef.required,
@@ -172,32 +171,32 @@ export class PropertiesDefinitionValidator extends Service {
172
171
  }
173
172
  if (propDef.required && propDef.default !== undefined) {
174
173
  throw new InvalidArgumentError(
175
- 'The property %v of the model %v is a required property, ' +
176
- 'so it should not have the option "default" to be provided.',
174
+ 'Property %v of the model %v is a required property, ' +
175
+ 'so it must not have the option "default" to be provided.',
177
176
  propName,
178
177
  modelName,
179
178
  );
180
179
  }
181
180
  if (propDef.primaryKey && propDef.required) {
182
181
  throw new InvalidArgumentError(
183
- 'The property %v of the model %v is a primary key, ' +
184
- 'so it should not have the option "required" to be provided.',
182
+ 'Property %v of the model %v is a primary key, ' +
183
+ 'so it must not have the option "required" to be provided.',
185
184
  propName,
186
185
  modelName,
187
186
  );
188
187
  }
189
188
  if (propDef.primaryKey && propDef.default !== undefined) {
190
189
  throw new InvalidArgumentError(
191
- 'The property %v of the model %v is a primary key, ' +
192
- 'so it should not have the option "default" to be provided.',
190
+ 'Property %v of the model %v is a primary key, ' +
191
+ 'so it must not have the option "default" to be provided.',
193
192
  propName,
194
193
  modelName,
195
194
  );
196
195
  }
197
196
  if (propDef.itemType && propDef.type !== Type.ARRAY) {
198
197
  throw new InvalidArgumentError(
199
- 'The property %v of the model %v has a non-array type, ' +
200
- 'so it should not have the option "itemType" to be provided.',
198
+ 'Property %v of the model %v has a non-array type, ' +
199
+ 'so it must not have the option "itemType" to be provided.',
201
200
  propName,
202
201
  modelName,
203
202
  propDef.type,
@@ -205,8 +204,8 @@ export class PropertiesDefinitionValidator extends Service {
205
204
  }
206
205
  if (propDef.itemModel && propDef.type !== Type.ARRAY) {
207
206
  throw new InvalidArgumentError(
208
- 'The option "itemModel" is not supported for %s property type, ' +
209
- 'so the property %v of the model %v should not have ' +
207
+ 'Option "itemModel" is not supported for %s property type, ' +
208
+ 'so the property %v of the model %v must not have ' +
210
209
  'the option "itemModel" to be provided.',
211
210
  capitalize(propDef.type),
212
211
  propName,
@@ -216,7 +215,7 @@ export class PropertiesDefinitionValidator extends Service {
216
215
  if (propDef.itemModel && propDef.itemType !== Type.OBJECT) {
217
216
  if (propDef.itemType) {
218
217
  throw new InvalidArgumentError(
219
- 'The provided option "itemModel" requires the option "itemType" ' +
218
+ 'Option "itemModel" requires the option "itemType" ' +
220
219
  'to be explicitly set to Object, but the property %v of ' +
221
220
  'the model %v has specified item type as %s.',
222
221
  propName,
@@ -225,7 +224,7 @@ export class PropertiesDefinitionValidator extends Service {
225
224
  );
226
225
  } else {
227
226
  throw new InvalidArgumentError(
228
- 'The provided option "itemModel" requires the option "itemType" ' +
227
+ 'Option "itemModel" requires the option "itemType" ' +
229
228
  'to be explicitly set to Object, but the property %v of ' +
230
229
  'the model %v does not have specified item type.',
231
230
  propName,
@@ -235,8 +234,8 @@ export class PropertiesDefinitionValidator extends Service {
235
234
  }
236
235
  if (propDef.model && propDef.type !== Type.OBJECT) {
237
236
  throw new InvalidArgumentError(
238
- 'The option "model" is not supported for %s property type, ' +
239
- 'so the property %v of the model %v should not have ' +
237
+ 'Option "model" is not supported for %s property type, ' +
238
+ 'so the property %v of the model %v must not have ' +
240
239
  'the option "model" to be provided.',
241
240
  capitalize(propDef.type),
242
241
  propName,
@@ -249,8 +248,8 @@ export class PropertiesDefinitionValidator extends Service {
249
248
  !Object.values(PropertyUniqueness).includes(propDef.unique)
250
249
  ) {
251
250
  throw new InvalidArgumentError(
252
- 'The provided option "unique" of the property %v in the model %v ' +
253
- 'should be a Boolean or one of values: %l, but %v was given.',
251
+ 'Option "unique" of the property %v in the model %v ' +
252
+ 'must be a Boolean or one of values: %l, but %v was given.',
254
253
  propName,
255
254
  modelName,
256
255
  Object.values(PropertyUniqueness),
@@ -260,8 +259,8 @@ export class PropertiesDefinitionValidator extends Service {
260
259
  }
261
260
  if (propDef.unique && propDef.primaryKey) {
262
261
  throw new InvalidArgumentError(
263
- 'The property %v of the model %v is a primary key, ' +
264
- 'so it should not have the option "unique" to be provided.',
262
+ 'Property %v of the model %v is a primary key, ' +
263
+ 'so it must not have the option "unique" to be provided.',
265
264
  propName,
266
265
  modelName,
267
266
  );