@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
@@ -242,7 +242,7 @@ var init_invalid_operator_value_error = __esm({
242
242
  constructor(operator, expected, value) {
243
243
  super(
244
244
  (0, import_js_format3.format)(
245
- "Condition of {%s: ...} should have %s, but %v was given.",
245
+ "Condition of {%s: ...} must have %s, but %v was given.",
246
246
  operator,
247
247
  expected,
248
248
  value
@@ -267,7 +267,7 @@ var init_errors = __esm({
267
267
  function likeToRegexp(pattern, isCaseInsensitive = false) {
268
268
  if (typeof pattern !== "string") {
269
269
  throw new InvalidArgumentError(
270
- "The first argument of `likeToRegexp` should be a String, but %v was given.",
270
+ 'Parameter "pattern" must be a String, but %v was given.',
271
271
  pattern
272
272
  );
273
273
  }
@@ -362,20 +362,21 @@ var init_get_value_by_path = __esm({
362
362
  function selectObjectKeys(obj, keys) {
363
363
  if (!obj || typeof obj !== "object" || Array.isArray(obj)) {
364
364
  throw new InvalidArgumentError(
365
- "The first argument of selectObjectKeys should be an Object, but %v was given.",
365
+ 'Parameter "obj" must be an Object, but %v was given.',
366
366
  obj
367
367
  );
368
368
  }
369
369
  if (!Array.isArray(keys)) {
370
370
  throw new InvalidArgumentError(
371
- "The second argument of selectObjectKeys should be an Array of String, but %v was given.",
371
+ 'Parameter "keys" must be an Array, but %v was given.',
372
372
  keys
373
373
  );
374
374
  }
375
- keys.forEach((key) => {
375
+ keys.forEach((key, index) => {
376
376
  if (typeof key !== "string") {
377
377
  throw new InvalidArgumentError(
378
- "The second argument of selectObjectKeys should be an Array of String, but %v was given.",
378
+ 'Element %d of the parameter "keys" must be a String, but %v was given.',
379
+ index,
379
380
  key
380
381
  );
381
382
  }
@@ -399,9 +400,9 @@ var init_select_object_keys = __esm({
399
400
 
400
401
  // src/utils/exclude-object-keys.js
401
402
  function excludeObjectKeys(obj, keys) {
402
- if (typeof obj !== "object" || !obj || Array.isArray(obj)) {
403
+ if (!obj || typeof obj !== "object" || Array.isArray(obj)) {
403
404
  throw new InvalidArgumentError(
404
- "Cannot exclude keys from a non-Object value, %v was given.",
405
+ 'Parameter "obj" must be an Object, but %v was given.',
405
406
  obj
406
407
  );
407
408
  }
@@ -422,7 +423,7 @@ var init_exclude_object_keys = __esm({
422
423
  function modelNameToModelKey(modelName) {
423
424
  if (!modelName || typeof modelName !== "string" || /\s/.test(modelName)) {
424
425
  throw new InvalidArgumentError(
425
- "The model name should be a non-empty String without spaces, but %v was given.",
426
+ "Model name must be a non-empty String without spaces, but %v was given.",
426
427
  modelName
427
428
  );
428
429
  }
@@ -477,19 +478,19 @@ var init_slice_clause_tool = __esm({
477
478
  slice(entities, skip = void 0, limit = void 0) {
478
479
  if (!Array.isArray(entities)) {
479
480
  throw new InvalidArgumentError(
480
- "The first argument of SliceClauseTool.slice should be an Array, but %v was given.",
481
+ 'Parameter "entities" must be an Array, but %v was given.',
481
482
  entities
482
483
  );
483
484
  }
484
485
  if (skip != null && typeof skip !== "number") {
485
486
  throw new InvalidArgumentError(
486
- 'The provided option "skip" should be a Number, but %v was given.',
487
+ 'Option "skip" must be a Number, but %v was given.',
487
488
  skip
488
489
  );
489
490
  }
490
491
  if (limit != null && typeof limit !== "number") {
491
492
  throw new InvalidArgumentError(
492
- 'The provided option "limit" should be a Number, but %v was given.',
493
+ 'Option "limit" must be a Number, but %v was given.',
493
494
  limit
494
495
  );
495
496
  }
@@ -508,7 +509,7 @@ var init_slice_clause_tool = __esm({
508
509
  }
509
510
  if (typeof skip !== "number") {
510
511
  throw new InvalidArgumentError(
511
- 'The provided option "skip" should be a Number, but %v was given.',
512
+ 'Option "skip" must be a Number, but %v was given.',
512
513
  skip
513
514
  );
514
515
  }
@@ -524,7 +525,7 @@ var init_slice_clause_tool = __esm({
524
525
  }
525
526
  if (typeof limit !== "number") {
526
527
  throw new InvalidArgumentError(
527
- 'The provided option "limit" should be a Number, but %v was given.',
528
+ 'Option "limit" must be a Number, but %v was given.',
528
529
  limit
529
530
  );
530
531
  }
@@ -567,32 +568,45 @@ var init_order_clause_tool = __esm({
567
568
  * @param {string|string[]|undefined} clause
568
569
  */
569
570
  sort(entities, clause) {
571
+ if (!Array.isArray(entities)) {
572
+ throw new InvalidArgumentError(
573
+ 'Parameter "entities" must be an Array, but %v was given.',
574
+ entities
575
+ );
576
+ }
570
577
  if (clause == null) {
571
578
  return;
572
579
  }
573
- if (Array.isArray(clause) === false) {
574
- clause = [clause];
580
+ const isArrayClause = Array.isArray(clause);
581
+ if (!clause || typeof clause !== "string" && !isArrayClause) {
582
+ throw new InvalidArgumentError(
583
+ 'Option "order" must be a non-empty String or an Array of non-empty String, but %v was given.',
584
+ clause
585
+ );
575
586
  }
576
- if (!clause.length) {
587
+ if (!isArrayClause) {
588
+ clause = [clause];
589
+ } else if (!clause.length) {
577
590
  return;
578
591
  }
579
592
  const mapping = [];
580
- clause.forEach((key, index) => {
581
- if (!key || typeof key !== "string") {
593
+ clause.forEach((element, index) => {
594
+ if (!element || typeof element !== "string") {
582
595
  throw new InvalidArgumentError(
583
- 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v was given.',
584
- key
596
+ 'Element %d of the option "order" must be a non-empty String, but %v was given.',
597
+ index,
598
+ element
585
599
  );
586
600
  }
587
601
  let reverse = 1;
588
- const matches = key.match(/\s+(A|DE)SC$/i);
602
+ const matches = element.match(/\s+(A|DE)SC$/i);
589
603
  if (matches) {
590
- key = key.replace(/\s+(A|DE)SC/i, "");
604
+ element = element.replace(/\s+(A|DE)SC/i, "");
591
605
  if (matches[1].toLowerCase() === "de") {
592
606
  reverse = -1;
593
607
  }
594
608
  }
595
- mapping[index] = { key, reverse };
609
+ mapping[index] = { key: element, reverse };
596
610
  });
597
611
  entities.sort(compareFn.bind(mapping));
598
612
  }
@@ -605,17 +619,22 @@ var init_order_clause_tool = __esm({
605
619
  if (clause == null) {
606
620
  return;
607
621
  }
608
- if (Array.isArray(clause) === false) {
609
- clause = [clause];
622
+ const isArrayClause = Array.isArray(clause);
623
+ if (!clause || typeof clause !== "string" && !isArrayClause) {
624
+ throw new InvalidArgumentError(
625
+ 'Option "order" must be a non-empty String or an Array of non-empty String, but %v was given.',
626
+ clause
627
+ );
610
628
  }
611
- if (!clause.length) {
629
+ if (!isArrayClause || !clause.length) {
612
630
  return;
613
631
  }
614
- clause.forEach((field) => {
615
- if (!field || typeof field !== "string") {
632
+ clause.forEach((element, index) => {
633
+ if (!element || typeof element !== "string") {
616
634
  throw new InvalidArgumentError(
617
- 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v was given.',
618
- field
635
+ 'Element %d of the option "order" must be a non-empty String, but %v was given.',
636
+ index,
637
+ element
619
638
  );
620
639
  }
621
640
  });
@@ -630,17 +649,24 @@ var init_order_clause_tool = __esm({
630
649
  if (clause == null) {
631
650
  return;
632
651
  }
633
- if (Array.isArray(clause) === false) {
634
- clause = [clause];
652
+ const isArrayClause = Array.isArray(clause);
653
+ if (!clause || typeof clause !== "string" && !isArrayClause) {
654
+ throw new InvalidArgumentError(
655
+ 'Option "order" must be a non-empty String or an Array of non-empty String, but %v was given.',
656
+ clause
657
+ );
635
658
  }
636
- if (!clause.length) {
659
+ if (!isArrayClause) {
660
+ return [clause];
661
+ } else if (!clause.length) {
637
662
  return;
638
663
  }
639
- clause.forEach((field) => {
640
- if (!field || typeof field !== "string") {
664
+ clause.forEach((element, index) => {
665
+ if (!element || typeof element !== "string") {
641
666
  throw new InvalidArgumentError(
642
- 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v was given.',
643
- field
667
+ 'Element %d of the option "order" must be a non-empty String, but %v was given.',
668
+ index,
669
+ element
644
670
  );
645
671
  }
646
672
  });
@@ -714,7 +740,7 @@ var init_operator_clause_tool = __esm({
714
740
  testAll(clause, value) {
715
741
  if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
716
742
  throw new InvalidArgumentError(
717
- "The first argument of OperatorUtils.testAll should be an Object, but %v was given.",
743
+ 'Parameter "clause" must be an Object, but %v was given.',
718
744
  clause
719
745
  );
720
746
  }
@@ -772,9 +798,9 @@ var init_operator_clause_tool = __esm({
772
798
  * @returns {boolean|undefined}
773
799
  */
774
800
  testEqNeq(clause, value) {
775
- if (!clause || typeof clause !== "object") {
801
+ if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
776
802
  throw new InvalidArgumentError(
777
- "The first argument of OperatorUtils.testEqNeq should be an Object, but %v was given.",
803
+ 'Parameter "clause" must be an Object, but %v was given.',
778
804
  clause
779
805
  );
780
806
  }
@@ -821,9 +847,9 @@ var init_operator_clause_tool = __esm({
821
847
  * @returns {boolean|undefined}
822
848
  */
823
849
  testGtLt(clause, value) {
824
- if (!clause || typeof clause !== "object") {
850
+ if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
825
851
  throw new InvalidArgumentError(
826
- "The first argument of OperatorUtils.testGtLt should be an Object, but %v was given.",
852
+ 'Parameter "clause" must be an Object, but %v was given.',
827
853
  clause
828
854
  );
829
855
  }
@@ -855,9 +881,9 @@ var init_operator_clause_tool = __esm({
855
881
  * @returns {boolean|undefined}
856
882
  */
857
883
  testInq(clause, value) {
858
- if (!clause || typeof clause !== "object") {
884
+ if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
859
885
  throw new InvalidArgumentError(
860
- "The first argument of OperatorUtils.testInq should be an Object, but %v was given.",
886
+ 'Parameter "clause" must be an Object, but %v was given.',
861
887
  clause
862
888
  );
863
889
  }
@@ -892,9 +918,9 @@ var init_operator_clause_tool = __esm({
892
918
  * @returns {boolean|undefined}
893
919
  */
894
920
  testNin(clause, value) {
895
- if (!clause || typeof clause !== "object") {
921
+ if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
896
922
  throw new InvalidArgumentError(
897
- "The first argument of OperatorUtils.testNin should be an Object, but %v was given.",
923
+ 'Parameter "clause" must be an Object, but %v was given.',
898
924
  clause
899
925
  );
900
926
  }
@@ -926,9 +952,9 @@ var init_operator_clause_tool = __esm({
926
952
  * @returns {boolean|undefined}
927
953
  */
928
954
  testBetween(clause, value) {
929
- if (!clause || typeof clause !== "object") {
955
+ if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
930
956
  throw new InvalidArgumentError(
931
- "The first argument of OperatorUtils.testBetween should be an Object, but %v was given.",
957
+ 'Parameter "clause" must be an Object, but %v was given.',
932
958
  clause
933
959
  );
934
960
  }
@@ -958,9 +984,9 @@ var init_operator_clause_tool = __esm({
958
984
  * @returns {boolean|undefined}
959
985
  */
960
986
  testExists(clause, value) {
961
- if (!clause || typeof clause !== "object") {
987
+ if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
962
988
  throw new InvalidArgumentError(
963
- "The first argument of OperatorUtils.testExists should be an Object, but %v was given.",
989
+ 'Parameter "clause" must be an Object, but %v was given.',
964
990
  clause
965
991
  );
966
992
  }
@@ -992,7 +1018,7 @@ var init_operator_clause_tool = __esm({
992
1018
  testLike(clause, value) {
993
1019
  if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
994
1020
  throw new InvalidArgumentError(
995
- "The first argument of OperatorUtils.testLike should be an Object, but %v was given.",
1021
+ 'Parameter "clause" must be an Object, but %v was given.',
996
1022
  clause
997
1023
  );
998
1024
  }
@@ -1020,7 +1046,7 @@ var init_operator_clause_tool = __esm({
1020
1046
  testNlike(clause, value) {
1021
1047
  if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
1022
1048
  throw new InvalidArgumentError(
1023
- "The first argument of OperatorUtils.testNlike should be an Object, but %v was given.",
1049
+ 'Parameter "clause" must be an Object, but %v was given.',
1024
1050
  clause
1025
1051
  );
1026
1052
  }
@@ -1048,7 +1074,7 @@ var init_operator_clause_tool = __esm({
1048
1074
  testIlike(clause, value) {
1049
1075
  if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
1050
1076
  throw new InvalidArgumentError(
1051
- "The first argument of OperatorUtils.testIlike should be an Object, but %v was given.",
1077
+ 'Parameter "clause" must be an Object, but %v was given.',
1052
1078
  clause
1053
1079
  );
1054
1080
  }
@@ -1076,7 +1102,7 @@ var init_operator_clause_tool = __esm({
1076
1102
  testNilike(clause, value) {
1077
1103
  if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
1078
1104
  throw new InvalidArgumentError(
1079
- "The first argument of OperatorUtils.testNilike should be an Object, but %v was given.",
1105
+ 'Parameter "clause" must be an Object, but %v was given.',
1080
1106
  clause
1081
1107
  );
1082
1108
  }
@@ -1114,9 +1140,9 @@ var init_operator_clause_tool = __esm({
1114
1140
  * @returns {boolean|undefined}
1115
1141
  */
1116
1142
  testRegexp(clause, value) {
1117
- if (!clause || typeof clause !== "object") {
1143
+ if (!clause || typeof clause !== "object" || Array.isArray(clause)) {
1118
1144
  throw new InvalidArgumentError(
1119
- "The first argument of OperatorUtils.testRegexp should be an Object, but %v was given.",
1145
+ 'Parameter "clause" must be an Object, but %v was given.',
1120
1146
  clause
1121
1147
  );
1122
1148
  }
@@ -1131,7 +1157,7 @@ var init_operator_clause_tool = __esm({
1131
1157
  const flags = clause.flags || void 0;
1132
1158
  if (flags && typeof flags !== "string") {
1133
1159
  throw new InvalidArgumentError(
1134
- "RegExp flags should be a String, but %v was given.",
1160
+ "RegExp flags must be a String, but %v was given.",
1135
1161
  clause.flags
1136
1162
  );
1137
1163
  }
@@ -1191,7 +1217,7 @@ var init_where_clause_tool = __esm({
1191
1217
  filter(entities, where = void 0) {
1192
1218
  if (!Array.isArray(entities)) {
1193
1219
  throw new InvalidArgumentError(
1194
- "The first argument of WhereClauseTool.filter should be an Array of Object, but %v was given.",
1220
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
1195
1221
  entities
1196
1222
  );
1197
1223
  }
@@ -1207,17 +1233,18 @@ var init_where_clause_tool = __esm({
1207
1233
  * @returns {Function}
1208
1234
  */
1209
1235
  _createFilter(whereClause) {
1210
- if (typeof whereClause !== "object" || Array.isArray(whereClause)) {
1236
+ if (!whereClause || typeof whereClause !== "object" || Array.isArray(whereClause)) {
1211
1237
  throw new InvalidArgumentError(
1212
- 'The provided option "where" should be an Object, but %v was given.',
1238
+ 'Option "where" must be an Object, but %v was given.',
1213
1239
  whereClause
1214
1240
  );
1215
1241
  }
1216
1242
  const keys = Object.keys(whereClause);
1217
- return (data) => {
1218
- if (typeof data !== "object") {
1243
+ return (data, index) => {
1244
+ if (!data || typeof data !== "object" || Array.isArray(data)) {
1219
1245
  throw new InvalidArgumentError(
1220
- "The first argument of WhereClauseTool.filter should be an Array of Object, but %v was given.",
1246
+ "Entity at index %d must be an Object, but %v was given.",
1247
+ index,
1221
1248
  data
1222
1249
  );
1223
1250
  }
@@ -1225,12 +1252,16 @@ var init_where_clause_tool = __esm({
1225
1252
  if (key === "and" && key in whereClause) {
1226
1253
  const andClause = whereClause[key];
1227
1254
  if (Array.isArray(andClause)) {
1228
- return andClause.every((clause) => this._createFilter(clause)(data));
1255
+ return andClause.every(
1256
+ (clause) => this._createFilter(clause)(data, index)
1257
+ );
1229
1258
  }
1230
1259
  } else if (key === "or" && key in whereClause) {
1231
1260
  const orClause = whereClause[key];
1232
1261
  if (Array.isArray(orClause)) {
1233
- return orClause.some((clause) => this._createFilter(clause)(data));
1262
+ return orClause.some(
1263
+ (clause) => this._createFilter(clause)(data, index)
1264
+ );
1234
1265
  }
1235
1266
  }
1236
1267
  const value = getValueByPath(data, key);
@@ -1298,7 +1329,7 @@ var init_where_clause_tool = __esm({
1298
1329
  }
1299
1330
  if (typeof clause !== "object" || Array.isArray(clause)) {
1300
1331
  throw new InvalidArgumentError(
1301
- 'The provided option "where" should be an Object, but %v was given.',
1332
+ 'Option "where" must be an Object, but %v was given.',
1302
1333
  clause
1303
1334
  );
1304
1335
  }
@@ -1349,13 +1380,13 @@ var init_relations_definition_validator = __esm({
1349
1380
  validate(modelName, relDefs) {
1350
1381
  if (!modelName || typeof modelName !== "string") {
1351
1382
  throw new InvalidArgumentError(
1352
- "The first argument of RelationsDefinitionValidator.validate should be a non-empty String, but %v was given.",
1383
+ 'Parameter "modelName" must be a non-empty String, but %v was given.',
1353
1384
  modelName
1354
1385
  );
1355
1386
  }
1356
1387
  if (!relDefs || typeof relDefs !== "object" || Array.isArray(relDefs)) {
1357
1388
  throw new InvalidArgumentError(
1358
- 'The provided option "relations" of the model %v should be an Object, but %v was given.',
1389
+ 'Option "relations" of the model %v must be an Object, but %v was given.',
1359
1390
  modelName,
1360
1391
  relDefs
1361
1392
  );
@@ -1376,20 +1407,20 @@ var init_relations_definition_validator = __esm({
1376
1407
  _validateRelation(modelName, relName, relDef) {
1377
1408
  if (!modelName || typeof modelName !== "string") {
1378
1409
  throw new InvalidArgumentError(
1379
- "The first argument of RelationsDefinitionValidator._validateRelation should be a non-empty String, but %v was given.",
1410
+ 'Parameter "modelName" must be a non-empty String, but %v was given.',
1380
1411
  modelName
1381
1412
  );
1382
1413
  }
1383
1414
  if (!relName || typeof relName !== "string") {
1384
1415
  throw new InvalidArgumentError(
1385
- "The relation name of the model %v should be a non-empty String, but %v was given.",
1416
+ "Relation name of the model %v must be a non-empty String, but %v was given.",
1386
1417
  modelName,
1387
1418
  relName
1388
1419
  );
1389
1420
  }
1390
1421
  if (!relDef || typeof relDef !== "object" || Array.isArray(relDef)) {
1391
1422
  throw new InvalidArgumentError(
1392
- "The relation %v of the model %v should be an Object, but %v was given.",
1423
+ "Relation %v of the model %v must be an Object, but %v was given.",
1393
1424
  relName,
1394
1425
  modelName,
1395
1426
  relDef
@@ -1397,7 +1428,7 @@ var init_relations_definition_validator = __esm({
1397
1428
  }
1398
1429
  if (!relDef.type || !Object.values(RelationType).includes(relDef.type)) {
1399
1430
  throw new InvalidArgumentError(
1400
- 'The relation %v of the model %v requires the option "type" to have one of relation types: %l, but %v was given.',
1431
+ 'Relation %v of the model %v requires the option "type" to have one of relation types: %l, but %v was given.',
1401
1432
  relName,
1402
1433
  modelName,
1403
1434
  Object.values(RelationType),
@@ -1443,7 +1474,7 @@ var init_relations_definition_validator = __esm({
1443
1474
  if (relDef.polymorphic) {
1444
1475
  if (typeof relDef.polymorphic !== "boolean") {
1445
1476
  throw new InvalidArgumentError(
1446
- 'The relation %v of the model %v has the type "belongsTo", so it expects the option "polymorphic" to be a Boolean, but %v was given.',
1477
+ 'Relation %v of the model %v has the type "belongsTo", so it expects the option "polymorphic" to be a Boolean, but %v was given.',
1447
1478
  relName,
1448
1479
  modelName,
1449
1480
  relDef.polymorphic
@@ -1451,7 +1482,7 @@ var init_relations_definition_validator = __esm({
1451
1482
  }
1452
1483
  if (relDef.foreignKey && typeof relDef.foreignKey !== "string") {
1453
1484
  throw new InvalidArgumentError(
1454
- 'The relation %v of the model %v is a polymorphic "belongsTo" relation, so it expects the provided option "foreignKey" to be a String, but %v was given.',
1485
+ 'Relation %v of the model %v is a polymorphic "belongsTo" relation, so it expects the provided option "foreignKey" to be a String, but %v was given.',
1455
1486
  relName,
1456
1487
  modelName,
1457
1488
  relDef.foreignKey
@@ -1459,7 +1490,7 @@ var init_relations_definition_validator = __esm({
1459
1490
  }
1460
1491
  if (relDef.discriminator && typeof relDef.discriminator !== "string") {
1461
1492
  throw new InvalidArgumentError(
1462
- 'The relation %v of the model %v is a polymorphic "belongsTo" relation, so it expects the provided option "discriminator" to be a String, but %v was given.',
1493
+ 'Relation %v of the model %v is a polymorphic "belongsTo" relation, so it expects the provided option "discriminator" to be a String, but %v was given.',
1463
1494
  relName,
1464
1495
  modelName,
1465
1496
  relDef.discriminator
@@ -1468,7 +1499,7 @@ var init_relations_definition_validator = __esm({
1468
1499
  } else {
1469
1500
  if (!relDef.model || typeof relDef.model !== "string") {
1470
1501
  throw new InvalidArgumentError(
1471
- 'The relation %v of the model %v has the type "belongsTo", so it requires the option "model" to be a non-empty String, but %v was given.',
1502
+ 'Relation %v of the model %v has the type "belongsTo", so it requires the option "model" to be a non-empty String, but %v was given.',
1472
1503
  relName,
1473
1504
  modelName,
1474
1505
  relDef.model
@@ -1476,7 +1507,7 @@ var init_relations_definition_validator = __esm({
1476
1507
  }
1477
1508
  if (relDef.foreignKey && typeof relDef.foreignKey !== "string") {
1478
1509
  throw new InvalidArgumentError(
1479
- 'The relation %v of the model %v has the type "belongsTo", so it expects the provided option "foreignKey" to be a String, but %v was given.',
1510
+ 'Relation %v of the model %v has the type "belongsTo", so it expects the provided option "foreignKey" to be a String, but %v was given.',
1480
1511
  relName,
1481
1512
  modelName,
1482
1513
  relDef.foreignKey
@@ -1484,7 +1515,7 @@ var init_relations_definition_validator = __esm({
1484
1515
  }
1485
1516
  if (relDef.discriminator) {
1486
1517
  throw new InvalidArgumentError(
1487
- 'The relation %v of the model %v is a non-polymorphic "belongsTo" relation, so it should not have the option "discriminator" to be provided.',
1518
+ 'Relation %v of the model %v is a non-polymorphic "belongsTo" relation, so it must not have the option "discriminator" to be provided.',
1488
1519
  relName,
1489
1520
  modelName
1490
1521
  );
@@ -1534,7 +1565,7 @@ var init_relations_definition_validator = __esm({
1534
1565
  }
1535
1566
  if (!relDef.model || typeof relDef.model !== "string") {
1536
1567
  throw new InvalidArgumentError(
1537
- 'The relation %v of the model %v has the type "hasOne", so it requires the option "model" to be a non-empty String, but %v was given.',
1568
+ 'Relation %v of the model %v has the type "hasOne", so it requires the option "model" to be a non-empty String, but %v was given.',
1538
1569
  relName,
1539
1570
  modelName,
1540
1571
  relDef.model
@@ -1544,14 +1575,14 @@ var init_relations_definition_validator = __esm({
1544
1575
  if (typeof relDef.polymorphic === "string") {
1545
1576
  if (relDef.foreignKey) {
1546
1577
  throw new InvalidArgumentError(
1547
- 'The relation %v of the model %v has the option "polymorphic" with a String value, so it should not have the option "foreignKey" to be provided.',
1578
+ 'Relation %v of the model %v has the option "polymorphic" with a String value, so it must not have the option "foreignKey" to be provided.',
1548
1579
  relName,
1549
1580
  modelName
1550
1581
  );
1551
1582
  }
1552
1583
  if (relDef.discriminator) {
1553
1584
  throw new InvalidArgumentError(
1554
- 'The relation %v of the model %v has the option "polymorphic" with a String value, so it should not have the option "discriminator" to be provided.',
1585
+ 'Relation %v of the model %v has the option "polymorphic" with a String value, so it must not have the option "discriminator" to be provided.',
1555
1586
  relName,
1556
1587
  modelName
1557
1588
  );
@@ -1559,7 +1590,7 @@ var init_relations_definition_validator = __esm({
1559
1590
  } else if (typeof relDef.polymorphic === "boolean") {
1560
1591
  if (!relDef.foreignKey || typeof relDef.foreignKey !== "string") {
1561
1592
  throw new InvalidArgumentError(
1562
- 'The relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "foreignKey" to be a non-empty String, but %v was given.',
1593
+ 'Relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "foreignKey" to be a non-empty String, but %v was given.',
1563
1594
  relName,
1564
1595
  modelName,
1565
1596
  relDef.foreignKey
@@ -1567,7 +1598,7 @@ var init_relations_definition_validator = __esm({
1567
1598
  }
1568
1599
  if (!relDef.discriminator || typeof relDef.discriminator !== "string") {
1569
1600
  throw new InvalidArgumentError(
1570
- 'The relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "discriminator" to be a non-empty String, but %v was given.',
1601
+ 'Relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "discriminator" to be a non-empty String, but %v was given.',
1571
1602
  relName,
1572
1603
  modelName,
1573
1604
  relDef.discriminator
@@ -1575,7 +1606,7 @@ var init_relations_definition_validator = __esm({
1575
1606
  }
1576
1607
  } else {
1577
1608
  throw new InvalidArgumentError(
1578
- 'The relation %v of the model %v has the type "hasOne", so it expects the provided option "polymorphic" to be a String or a Boolean, but %v was given.',
1609
+ 'Relation %v of the model %v has the type "hasOne", so it expects the provided option "polymorphic" to be a String or a Boolean, but %v was given.',
1579
1610
  relName,
1580
1611
  modelName,
1581
1612
  relDef.polymorphic
@@ -1584,7 +1615,7 @@ var init_relations_definition_validator = __esm({
1584
1615
  } else {
1585
1616
  if (!relDef.foreignKey || typeof relDef.foreignKey !== "string") {
1586
1617
  throw new InvalidArgumentError(
1587
- 'The relation %v of the model %v has the type "hasOne", so it requires the option "foreignKey" to be a non-empty String, but %v was given.',
1618
+ 'Relation %v of the model %v has the type "hasOne", so it requires the option "foreignKey" to be a non-empty String, but %v was given.',
1588
1619
  relName,
1589
1620
  modelName,
1590
1621
  relDef.foreignKey
@@ -1592,7 +1623,7 @@ var init_relations_definition_validator = __esm({
1592
1623
  }
1593
1624
  if (relDef.discriminator) {
1594
1625
  throw new InvalidArgumentError(
1595
- 'The relation %v of the model %v is a non-polymorphic "hasOne" relation, so it should not have the option "discriminator" to be provided.',
1626
+ 'Relation %v of the model %v is a non-polymorphic "hasOne" relation, so it must not have the option "discriminator" to be provided.',
1596
1627
  relName,
1597
1628
  modelName
1598
1629
  );
@@ -1642,7 +1673,7 @@ var init_relations_definition_validator = __esm({
1642
1673
  }
1643
1674
  if (!relDef.model || typeof relDef.model !== "string") {
1644
1675
  throw new InvalidArgumentError(
1645
- 'The relation %v of the model %v has the type "hasMany", so it requires the option "model" to be a non-empty String, but %v was given.',
1676
+ 'Relation %v of the model %v has the type "hasMany", so it requires the option "model" to be a non-empty String, but %v was given.',
1646
1677
  relName,
1647
1678
  modelName,
1648
1679
  relDef.model
@@ -1652,14 +1683,14 @@ var init_relations_definition_validator = __esm({
1652
1683
  if (typeof relDef.polymorphic === "string") {
1653
1684
  if (relDef.foreignKey) {
1654
1685
  throw new InvalidArgumentError(
1655
- 'The relation %v of the model %v has the option "polymorphic" with a String value, so it should not have the option "foreignKey" to be provided.',
1686
+ 'Relation %v of the model %v has the option "polymorphic" with a String value, so it must not have the option "foreignKey" to be provided.',
1656
1687
  relName,
1657
1688
  modelName
1658
1689
  );
1659
1690
  }
1660
1691
  if (relDef.discriminator) {
1661
1692
  throw new InvalidArgumentError(
1662
- 'The relation %v of the model %v has the option "polymorphic" with a String value, so it should not have the option "discriminator" to be provided.',
1693
+ 'Relation %v of the model %v has the option "polymorphic" with a String value, so it must not have the option "discriminator" to be provided.',
1663
1694
  relName,
1664
1695
  modelName
1665
1696
  );
@@ -1667,7 +1698,7 @@ var init_relations_definition_validator = __esm({
1667
1698
  } else if (typeof relDef.polymorphic === "boolean") {
1668
1699
  if (!relDef.foreignKey || typeof relDef.foreignKey !== "string") {
1669
1700
  throw new InvalidArgumentError(
1670
- 'The relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "foreignKey" to be a non-empty String, but %v was given.',
1701
+ 'Relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "foreignKey" to be a non-empty String, but %v was given.',
1671
1702
  relName,
1672
1703
  modelName,
1673
1704
  relDef.foreignKey
@@ -1675,7 +1706,7 @@ var init_relations_definition_validator = __esm({
1675
1706
  }
1676
1707
  if (!relDef.discriminator || typeof relDef.discriminator !== "string") {
1677
1708
  throw new InvalidArgumentError(
1678
- 'The relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "discriminator" to be a non-empty String, but %v was given.',
1709
+ 'Relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "discriminator" to be a non-empty String, but %v was given.',
1679
1710
  relName,
1680
1711
  modelName,
1681
1712
  relDef.discriminator
@@ -1683,7 +1714,7 @@ var init_relations_definition_validator = __esm({
1683
1714
  }
1684
1715
  } else {
1685
1716
  throw new InvalidArgumentError(
1686
- 'The relation %v of the model %v has the type "hasMany", so it expects the provided option "polymorphic" to be a String or a Boolean, but %v was given.',
1717
+ 'Relation %v of the model %v has the type "hasMany", so it expects the provided option "polymorphic" to be a String or a Boolean, but %v was given.',
1687
1718
  relName,
1688
1719
  modelName,
1689
1720
  relDef.polymorphic
@@ -1692,7 +1723,7 @@ var init_relations_definition_validator = __esm({
1692
1723
  } else {
1693
1724
  if (!relDef.foreignKey || typeof relDef.foreignKey !== "string") {
1694
1725
  throw new InvalidArgumentError(
1695
- 'The relation %v of the model %v has the type "hasMany", so it requires the option "foreignKey" to be a non-empty String, but %v was given.',
1726
+ 'Relation %v of the model %v has the type "hasMany", so it requires the option "foreignKey" to be a non-empty String, but %v was given.',
1696
1727
  relName,
1697
1728
  modelName,
1698
1729
  relDef.foreignKey
@@ -1700,7 +1731,7 @@ var init_relations_definition_validator = __esm({
1700
1731
  }
1701
1732
  if (relDef.discriminator) {
1702
1733
  throw new InvalidArgumentError(
1703
- 'The relation %v of the model %v is a non-polymorphic "hasMany" relation, so it should not have the option "discriminator" to be provided.',
1734
+ 'Relation %v of the model %v is a non-polymorphic "hasMany" relation, so it must not have the option "discriminator" to be provided.',
1704
1735
  relName,
1705
1736
  modelName
1706
1737
  );
@@ -1730,7 +1761,7 @@ var init_relations_definition_validator = __esm({
1730
1761
  }
1731
1762
  if (!relDef.model || typeof relDef.model !== "string") {
1732
1763
  throw new InvalidArgumentError(
1733
- 'The relation %v of the model %v has the type "referencesMany", so it requires the option "model" to be a non-empty String, but %v was given.',
1764
+ 'Relation %v of the model %v has the type "referencesMany", so it requires the option "model" to be a non-empty String, but %v was given.',
1734
1765
  relName,
1735
1766
  modelName,
1736
1767
  relDef.model
@@ -1738,7 +1769,7 @@ var init_relations_definition_validator = __esm({
1738
1769
  }
1739
1770
  if (relDef.foreignKey && typeof relDef.foreignKey !== "string") {
1740
1771
  throw new InvalidArgumentError(
1741
- 'The relation %v of the model %v has the type "referencesMany", so it expects the provided option "foreignKey" to be a String, but %v was given.',
1772
+ 'Relation %v of the model %v has the type "referencesMany", so it expects the provided option "foreignKey" to be a String, but %v was given.',
1742
1773
  relName,
1743
1774
  modelName,
1744
1775
  relDef.foreignKey
@@ -1746,7 +1777,7 @@ var init_relations_definition_validator = __esm({
1746
1777
  }
1747
1778
  if (relDef.discriminator) {
1748
1779
  throw new InvalidArgumentError(
1749
- 'The relation %v of the model %v has the type "referencesMany", so it should not have the option "discriminator" to be provided.',
1780
+ 'Relation %v of the model %v has the type "referencesMany", so it must not have the option "discriminator" to be provided.',
1750
1781
  relName,
1751
1782
  modelName
1752
1783
  );
@@ -1837,10 +1868,7 @@ var init_definition_registry = __esm({
1837
1868
  this.getService(DatasourceDefinitionValidator).validate(datasourceDef);
1838
1869
  const name = datasourceDef.name;
1839
1870
  if (name in this._datasources) {
1840
- throw new InvalidArgumentError(
1841
- "The datasource %v is already defined.",
1842
- name
1843
- );
1871
+ throw new InvalidArgumentError("Datasource %v is already defined.", name);
1844
1872
  }
1845
1873
  this._datasources[name] = datasourceDef;
1846
1874
  }
@@ -1862,7 +1890,7 @@ var init_definition_registry = __esm({
1862
1890
  getDatasource(name) {
1863
1891
  const datasourceDef = this._datasources[name];
1864
1892
  if (!datasourceDef) {
1865
- throw new InvalidArgumentError("The datasource %v is not defined.", name);
1893
+ throw new InvalidArgumentError("Datasource %v is not defined.", name);
1866
1894
  }
1867
1895
  return datasourceDef;
1868
1896
  }
@@ -1876,7 +1904,7 @@ var init_definition_registry = __esm({
1876
1904
  const modelKey = modelNameToModelKey(modelDef.name);
1877
1905
  if (modelKey in this._models) {
1878
1906
  throw new InvalidArgumentError(
1879
- "The model %v is already defined.",
1907
+ "Model %v is already defined.",
1880
1908
  modelDef.name
1881
1909
  );
1882
1910
  }
@@ -1902,7 +1930,7 @@ var init_definition_registry = __esm({
1902
1930
  const modelKey = modelNameToModelKey(name);
1903
1931
  const modelDef = this._models[modelKey];
1904
1932
  if (!modelDef) {
1905
- throw new InvalidArgumentError("The model %v is not defined.", name);
1933
+ throw new InvalidArgumentError("Model %v is not defined.", name);
1906
1934
  }
1907
1935
  return modelDef;
1908
1936
  }
@@ -1943,7 +1971,7 @@ var init_model_definition_utils = __esm({
1943
1971
  );
1944
1972
  if (isDefaultPrimaryKeyAlreadyInUse) {
1945
1973
  throw new InvalidArgumentError(
1946
- 'The property name %v of the model %v is defined as a regular property. In this case, a primary key should be defined explicitly. Do use the option "primaryKey" to specify the primary key.',
1974
+ 'Property name %v of the model %v is defined as a regular property. In this case, a primary key must be defined explicitly. Do use the option "primaryKey" to specify the primary key.',
1947
1975
  DEFAULT_PRIMARY_KEY_PROPERTY_NAME,
1948
1976
  modelName
1949
1977
  );
@@ -1995,7 +2023,7 @@ var init_model_definition_utils = __esm({
1995
2023
  const propDef = propDefs[propertyName];
1996
2024
  if (!propDef) {
1997
2025
  throw new InvalidArgumentError(
1998
- "The model %v does not have the property %v.",
2026
+ "Model %v does not have the property %v.",
1999
2027
  modelName,
2000
2028
  propertyName
2001
2029
  );
@@ -2017,7 +2045,7 @@ var init_model_definition_utils = __esm({
2017
2045
  const propDef = propDefs[propertyName];
2018
2046
  if (!propDef) {
2019
2047
  throw new InvalidArgumentError(
2020
- "The model %v does not have the property %v.",
2048
+ "Model %v does not have the property %v.",
2021
2049
  modelName,
2022
2050
  propertyName
2023
2051
  );
@@ -2137,7 +2165,7 @@ var init_model_definition_utils = __esm({
2137
2165
  return DataType.ANY;
2138
2166
  }
2139
2167
  throw new InvalidArgumentError(
2140
- "The model %v does not have the property %v.",
2168
+ "Model %v does not have the property %v.",
2141
2169
  modelName,
2142
2170
  propertyName
2143
2171
  );
@@ -2156,7 +2184,7 @@ var init_model_definition_utils = __esm({
2156
2184
  getDataTypeFromPropertyDefinition(propDef) {
2157
2185
  if ((!propDef || typeof propDef !== "object") && !Object.values(DataType).includes(propDef)) {
2158
2186
  throw new InvalidArgumentError(
2159
- 'The argument "propDef" of the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should be an Object or the DataType enum, but %v was given.',
2187
+ 'Parameter "propDef" must be an Object or a DataType, but %v was given.',
2160
2188
  propDef
2161
2189
  );
2162
2190
  }
@@ -2166,7 +2194,7 @@ var init_model_definition_utils = __esm({
2166
2194
  const dataType = propDef.type;
2167
2195
  if (!Object.values(DataType).includes(dataType)) {
2168
2196
  throw new InvalidArgumentError(
2169
- 'The given Object to the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should have the "type" property with one of values: %l, but %v was given.',
2197
+ 'Option "type" must be one of values: %l, but %v was given.',
2170
2198
  Object.values(DataType),
2171
2199
  propDef.type
2172
2200
  );
@@ -2217,7 +2245,7 @@ var init_model_definition_utils = __esm({
2217
2245
  const recursion = /* @__PURE__ */ __name((currModelName, prevModelName = void 0) => {
2218
2246
  if (currModelName === prevModelName) {
2219
2247
  throw new InvalidArgumentError(
2220
- "The model %v has a circular inheritance.",
2248
+ "Model %v has a circular inheritance.",
2221
2249
  currModelName
2222
2250
  );
2223
2251
  }
@@ -2257,7 +2285,7 @@ var init_model_definition_utils = __esm({
2257
2285
  const recursion = /* @__PURE__ */ __name((currModelName, prevModelName = void 0) => {
2258
2286
  if (currModelName === prevModelName) {
2259
2287
  throw new InvalidArgumentError(
2260
- "The model %v has a circular inheritance.",
2288
+ "Model %v has a circular inheritance.",
2261
2289
  currModelName
2262
2290
  );
2263
2291
  }
@@ -2290,7 +2318,7 @@ var init_model_definition_utils = __esm({
2290
2318
  }
2291
2319
  if (!foundDef) {
2292
2320
  throw new InvalidArgumentError(
2293
- "The model %v does not have relation name %v.",
2321
+ "Model %v does not have relation name %v.",
2294
2322
  modelName,
2295
2323
  relationName
2296
2324
  );
@@ -2307,7 +2335,7 @@ var init_model_definition_utils = __esm({
2307
2335
  excludeObjectKeysByRelationNames(modelName, modelData) {
2308
2336
  if (!modelData || typeof modelData !== "object" || Array.isArray(modelData)) {
2309
2337
  throw new InvalidArgumentError(
2310
- "The second argument of ModelDefinitionUtils.excludeObjectKeysByRelationNames should be an Object, but %v was given.",
2338
+ 'Parameter "modelData" must be an Object, but %v was given.',
2311
2339
  modelData
2312
2340
  );
2313
2341
  }
@@ -2383,7 +2411,7 @@ var init_required_property_validator = __esm({
2383
2411
  }
2384
2412
  if (!modelData || typeof modelData !== "object" || Array.isArray(modelData)) {
2385
2413
  throw new InvalidArgumentError(
2386
- "Data of the model %v should be an Object, but %v was given.",
2414
+ "Data of the model %v must be an Object, but %v was given.",
2387
2415
  modelName,
2388
2416
  modelData
2389
2417
  );
@@ -2454,25 +2482,25 @@ var init_property_uniqueness_validator = __esm({
2454
2482
  async validate(countMethod, methodName, modelName, modelData, modelId = void 0) {
2455
2483
  if (typeof countMethod !== "function") {
2456
2484
  throw new InvalidArgumentError(
2457
- 'The parameter "countMethod" of the PropertyUniquenessValidator must be a Function, but %v was given.',
2485
+ 'Parameter "countMethod" must be a Function, but %v was given.',
2458
2486
  countMethod
2459
2487
  );
2460
2488
  }
2461
2489
  if (!methodName || typeof methodName !== "string") {
2462
2490
  throw new InvalidArgumentError(
2463
- 'The parameter "methodName" of the PropertyUniquenessValidator must be a non-empty String, but %v was given.',
2491
+ 'Parameter "methodName" must be a non-empty String, but %v was given.',
2464
2492
  methodName
2465
2493
  );
2466
2494
  }
2467
2495
  if (!modelName || typeof modelName !== "string") {
2468
2496
  throw new InvalidArgumentError(
2469
- 'The parameter "modelName" of the PropertyUniquenessValidator must be a non-empty String, but %v was given.',
2497
+ 'Parameter "modelName" must be a non-empty String, but %v was given.',
2470
2498
  modelName
2471
2499
  );
2472
2500
  }
2473
2501
  if (!isPlainObject(modelData)) {
2474
2502
  throw new InvalidArgumentError(
2475
- "The data of the model %v should be an Object, but %v was given.",
2503
+ "Data of the model %v must be an Object, but %v was given.",
2476
2504
  modelName,
2477
2505
  modelData
2478
2506
  );
@@ -2486,7 +2514,7 @@ var init_property_uniqueness_validator = __esm({
2486
2514
  modelName
2487
2515
  );
2488
2516
  const createError = /* @__PURE__ */ __name((propName, propValue) => new InvalidArgumentError(
2489
- "An existing document of the model %v already has the property %v with the value %v and should be unique.",
2517
+ "Existing document of the model %v already has the property %v with the value %v and must be unique.",
2490
2518
  modelName,
2491
2519
  propName,
2492
2520
  propValue
@@ -2549,7 +2577,7 @@ var init_property_uniqueness_validator = __esm({
2549
2577
  }
2550
2578
  } else {
2551
2579
  throw new InvalidArgumentError(
2552
- "The PropertyUniquenessValidator does not support the adapter method %v.",
2580
+ "Adapter method %v is not supported.",
2553
2581
  methodName
2554
2582
  );
2555
2583
  }
@@ -2586,7 +2614,7 @@ var init_primary_keys_definition_validator = __esm({
2586
2614
  const isDefaultPrimaryKeyAlreadyInUse = Object.keys(propDefs).includes(DEFAULT_PRIMARY_KEY_PROPERTY_NAME);
2587
2615
  if (isDefaultPrimaryKeyAlreadyInUse) {
2588
2616
  throw new InvalidArgumentError(
2589
- 'The property name %v of the model %v is defined as a regular property. In this case, a primary key should be defined explicitly. Do use the option "primaryKey" to specify the primary key.',
2617
+ 'Property name %v of the model %v is defined as a regular property. In this case, a primary key must be defined explicitly. Do use the option "primaryKey" to specify the primary key.',
2590
2618
  DEFAULT_PRIMARY_KEY_PROPERTY_NAME,
2591
2619
  modelName
2592
2620
  );
@@ -2595,7 +2623,7 @@ var init_primary_keys_definition_validator = __esm({
2595
2623
  }
2596
2624
  if (propNames.length > 1) {
2597
2625
  throw new InvalidArgumentError(
2598
- "The model definition %v should not have multiple primary keys, but %v keys given.",
2626
+ "Model definition %v must not have multiple primary keys, but %v keys were given.",
2599
2627
  modelName,
2600
2628
  propNames.length
2601
2629
  );
@@ -2638,13 +2666,13 @@ var init_properties_definition_validator = __esm({
2638
2666
  validate(modelName, propDefs) {
2639
2667
  if (!modelName || typeof modelName !== "string") {
2640
2668
  throw new InvalidArgumentError(
2641
- "The first argument of PropertiesDefinitionValidator.validate should be a non-empty String, but %v was given.",
2669
+ 'Parameter "modelName" must be a non-empty String, but %v was given.',
2642
2670
  modelName
2643
2671
  );
2644
2672
  }
2645
2673
  if (!propDefs || typeof propDefs !== "object" || Array.isArray(propDefs)) {
2646
2674
  throw new InvalidArgumentError(
2647
- 'The provided option "properties" of the model %v should be an Object, but %v was given.',
2675
+ 'Option "properties" of the model %v must be an Object, but %v was given.',
2648
2676
  modelName,
2649
2677
  propDefs
2650
2678
  );
@@ -2669,20 +2697,20 @@ var init_properties_definition_validator = __esm({
2669
2697
  _validateProperty(modelName, propName, propDef) {
2670
2698
  if (!modelName || typeof modelName !== "string") {
2671
2699
  throw new InvalidArgumentError(
2672
- "The first argument of PropertiesDefinitionValidator._validateProperty should be a non-empty String, but %v was given.",
2700
+ 'Parameter "modelName" must be a non-empty String, but %v was given.',
2673
2701
  modelName
2674
2702
  );
2675
2703
  }
2676
2704
  if (!propName || typeof propName !== "string") {
2677
2705
  throw new InvalidArgumentError(
2678
- "The property name of the model %v should be a non-empty String, but %v was given.",
2706
+ "Property name of the model %v must be a non-empty String, but %v was given.",
2679
2707
  modelName,
2680
2708
  propName
2681
2709
  );
2682
2710
  }
2683
2711
  if (!propDef) {
2684
2712
  throw new InvalidArgumentError(
2685
- "The property %v of the model %v should have a property definition, but %v was given.",
2713
+ "Property %v of the model %v must have a property definition, but %v was given.",
2686
2714
  propName,
2687
2715
  modelName,
2688
2716
  propDef
@@ -2691,7 +2719,7 @@ var init_properties_definition_validator = __esm({
2691
2719
  if (typeof propDef === "string") {
2692
2720
  if (!Object.values(DataType).includes(propDef)) {
2693
2721
  throw new InvalidArgumentError(
2694
- "In case of a short property definition, the property %v of the model %v should have one of data types: %l, but %v was given.",
2722
+ "In case of a short property definition, the property %v of the model %v must have one of data types: %l, but %v was given.",
2695
2723
  propName,
2696
2724
  modelName,
2697
2725
  Object.values(DataType),
@@ -2702,7 +2730,7 @@ var init_properties_definition_validator = __esm({
2702
2730
  }
2703
2731
  if (!propDef || typeof propDef !== "object" || Array.isArray(propDef)) {
2704
2732
  throw new InvalidArgumentError(
2705
- "In case of a full property definition, the property %v of the model %v should be an Object, but %v was given.",
2733
+ "In case of a full property definition, the property %v of the model %v must be an Object, but %v was given.",
2706
2734
  propName,
2707
2735
  modelName,
2708
2736
  propDef
@@ -2710,7 +2738,7 @@ var init_properties_definition_validator = __esm({
2710
2738
  }
2711
2739
  if (!propDef.type || !Object.values(DataType).includes(propDef.type)) {
2712
2740
  throw new InvalidArgumentError(
2713
- 'The property %v of the model %v requires the option "type" to have one of data types: %l, but %v was given.',
2741
+ 'Property %v of the model %v requires the option "type" to have one of data types: %l, but %v was given.',
2714
2742
  propName,
2715
2743
  modelName,
2716
2744
  Object.values(DataType),
@@ -2719,7 +2747,7 @@ var init_properties_definition_validator = __esm({
2719
2747
  }
2720
2748
  if (propDef.itemType && !Object.values(DataType).includes(propDef.itemType)) {
2721
2749
  throw new InvalidArgumentError(
2722
- 'The provided option "itemType" of the property %v in the model %v should have one of data types: %l, but %v was given.',
2750
+ 'Option "itemType" of the property %v in the model %v should have one of data types: %l, but %v was given.',
2723
2751
  propName,
2724
2752
  modelName,
2725
2753
  Object.values(DataType),
@@ -2728,7 +2756,7 @@ var init_properties_definition_validator = __esm({
2728
2756
  }
2729
2757
  if (propDef.itemModel && typeof propDef.itemModel !== "string") {
2730
2758
  throw new InvalidArgumentError(
2731
- 'The provided option "itemModel" of the property %v in the model %v should be a String, but %v was given.',
2759
+ 'Option "itemModel" of the property %v in the model %v must be a String, but %v was given.',
2732
2760
  propName,
2733
2761
  modelName,
2734
2762
  propDef.itemModel
@@ -2736,7 +2764,7 @@ var init_properties_definition_validator = __esm({
2736
2764
  }
2737
2765
  if (propDef.model && typeof propDef.model !== "string") {
2738
2766
  throw new InvalidArgumentError(
2739
- 'The provided option "model" of the property %v in the model %v should be a String, but %v was given.',
2767
+ 'Option "model" of the property %v in the model %v must be a String, but %v was given.',
2740
2768
  propName,
2741
2769
  modelName,
2742
2770
  propDef.model
@@ -2744,7 +2772,7 @@ var init_properties_definition_validator = __esm({
2744
2772
  }
2745
2773
  if (propDef.primaryKey && typeof propDef.primaryKey !== "boolean") {
2746
2774
  throw new InvalidArgumentError(
2747
- 'The provided option "primaryKey" of the property %v in the model %v should be a Boolean, but %v was given.',
2775
+ 'Option "primaryKey" of the property %v in the model %v must be a Boolean, but %v was given.',
2748
2776
  propName,
2749
2777
  modelName,
2750
2778
  propDef.primaryKey
@@ -2752,7 +2780,7 @@ var init_properties_definition_validator = __esm({
2752
2780
  }
2753
2781
  if (propDef.columnName && typeof propDef.columnName !== "string") {
2754
2782
  throw new InvalidArgumentError(
2755
- 'The provided option "columnName" of the property %v in the model %v should be a String, but %v was given.',
2783
+ 'Option "columnName" of the property %v in the model %v must be a String, but %v was given.',
2756
2784
  propName,
2757
2785
  modelName,
2758
2786
  propDef.columnName
@@ -2760,7 +2788,7 @@ var init_properties_definition_validator = __esm({
2760
2788
  }
2761
2789
  if (propDef.columnType && typeof propDef.columnType !== "string") {
2762
2790
  throw new InvalidArgumentError(
2763
- 'The provided option "columnType" of the property %v in the model %v should be a String, but %v was given.',
2791
+ 'Option "columnType" of the property %v in the model %v must be a String, but %v was given.',
2764
2792
  propName,
2765
2793
  modelName,
2766
2794
  propDef.columnType
@@ -2768,7 +2796,7 @@ var init_properties_definition_validator = __esm({
2768
2796
  }
2769
2797
  if (propDef.required && typeof propDef.required !== "boolean") {
2770
2798
  throw new InvalidArgumentError(
2771
- 'The provided option "required" of the property %v in the model %v should be a Boolean, but %v was given.',
2799
+ 'Option "required" of the property %v in the model %v must be a Boolean, but %v was given.',
2772
2800
  propName,
2773
2801
  modelName,
2774
2802
  propDef.required
@@ -2776,28 +2804,28 @@ var init_properties_definition_validator = __esm({
2776
2804
  }
2777
2805
  if (propDef.required && propDef.default !== void 0) {
2778
2806
  throw new InvalidArgumentError(
2779
- 'The property %v of the model %v is a required property, so it should not have the option "default" to be provided.',
2807
+ 'Property %v of the model %v is a required property, so it must not have the option "default" to be provided.',
2780
2808
  propName,
2781
2809
  modelName
2782
2810
  );
2783
2811
  }
2784
2812
  if (propDef.primaryKey && propDef.required) {
2785
2813
  throw new InvalidArgumentError(
2786
- 'The property %v of the model %v is a primary key, so it should not have the option "required" to be provided.',
2814
+ 'Property %v of the model %v is a primary key, so it must not have the option "required" to be provided.',
2787
2815
  propName,
2788
2816
  modelName
2789
2817
  );
2790
2818
  }
2791
2819
  if (propDef.primaryKey && propDef.default !== void 0) {
2792
2820
  throw new InvalidArgumentError(
2793
- 'The property %v of the model %v is a primary key, so it should not have the option "default" to be provided.',
2821
+ 'Property %v of the model %v is a primary key, so it must not have the option "default" to be provided.',
2794
2822
  propName,
2795
2823
  modelName
2796
2824
  );
2797
2825
  }
2798
2826
  if (propDef.itemType && propDef.type !== DataType.ARRAY) {
2799
2827
  throw new InvalidArgumentError(
2800
- 'The property %v of the model %v has a non-array type, so it should not have the option "itemType" to be provided.',
2828
+ 'Property %v of the model %v has a non-array type, so it must not have the option "itemType" to be provided.',
2801
2829
  propName,
2802
2830
  modelName,
2803
2831
  propDef.type
@@ -2805,7 +2833,7 @@ var init_properties_definition_validator = __esm({
2805
2833
  }
2806
2834
  if (propDef.itemModel && propDef.type !== DataType.ARRAY) {
2807
2835
  throw new InvalidArgumentError(
2808
- 'The option "itemModel" is not supported for %s property type, so the property %v of the model %v should not have the option "itemModel" to be provided.',
2836
+ 'Option "itemModel" is not supported for %s property type, so the property %v of the model %v must not have the option "itemModel" to be provided.',
2809
2837
  capitalize(propDef.type),
2810
2838
  propName,
2811
2839
  modelName
@@ -2814,14 +2842,14 @@ var init_properties_definition_validator = __esm({
2814
2842
  if (propDef.itemModel && propDef.itemType !== DataType.OBJECT) {
2815
2843
  if (propDef.itemType) {
2816
2844
  throw new InvalidArgumentError(
2817
- 'The provided option "itemModel" requires the option "itemType" to be explicitly set to Object, but the property %v of the model %v has specified item type as %s.',
2845
+ 'Option "itemModel" requires the option "itemType" to be explicitly set to Object, but the property %v of the model %v has specified item type as %s.',
2818
2846
  propName,
2819
2847
  modelName,
2820
2848
  capitalize(propDef.itemType)
2821
2849
  );
2822
2850
  } else {
2823
2851
  throw new InvalidArgumentError(
2824
- 'The provided option "itemModel" requires the option "itemType" to be explicitly set to Object, but the property %v of the model %v does not have specified item type.',
2852
+ 'Option "itemModel" requires the option "itemType" to be explicitly set to Object, but the property %v of the model %v does not have specified item type.',
2825
2853
  propName,
2826
2854
  modelName
2827
2855
  );
@@ -2829,7 +2857,7 @@ var init_properties_definition_validator = __esm({
2829
2857
  }
2830
2858
  if (propDef.model && propDef.type !== DataType.OBJECT) {
2831
2859
  throw new InvalidArgumentError(
2832
- 'The option "model" is not supported for %s property type, so the property %v of the model %v should not have the option "model" to be provided.',
2860
+ 'Option "model" is not supported for %s property type, so the property %v of the model %v must not have the option "model" to be provided.',
2833
2861
  capitalize(propDef.type),
2834
2862
  propName,
2835
2863
  modelName
@@ -2838,7 +2866,7 @@ var init_properties_definition_validator = __esm({
2838
2866
  if (propDef.unique) {
2839
2867
  if (typeof propDef.unique !== "boolean" && !Object.values(PropertyUniqueness).includes(propDef.unique)) {
2840
2868
  throw new InvalidArgumentError(
2841
- 'The provided option "unique" of the property %v in the model %v should be a Boolean or one of values: %l, but %v was given.',
2869
+ 'Option "unique" of the property %v in the model %v must be a Boolean or one of values: %l, but %v was given.',
2842
2870
  propName,
2843
2871
  modelName,
2844
2872
  Object.values(PropertyUniqueness),
@@ -2848,7 +2876,7 @@ var init_properties_definition_validator = __esm({
2848
2876
  }
2849
2877
  if (propDef.unique && propDef.primaryKey) {
2850
2878
  throw new InvalidArgumentError(
2851
- 'The property %v of the model %v is a primary key, so it should not have the option "unique" to be provided.',
2879
+ 'Property %v of the model %v is a primary key, so it must not have the option "unique" to be provided.',
2852
2880
  propName,
2853
2881
  modelName
2854
2882
  );
@@ -2901,13 +2929,13 @@ var init_model_data_sanitizer = __esm({
2901
2929
  sanitize(modelName, modelData) {
2902
2930
  if (!modelName || typeof modelName !== "string") {
2903
2931
  throw new InvalidArgumentError(
2904
- "The first argument of ModelDataSanitizer.sanitize should be a string, but %v was given.",
2932
+ 'Parameter "modelName" must be a String, but %v was given.',
2905
2933
  modelName
2906
2934
  );
2907
2935
  }
2908
2936
  if (!modelData || typeof modelData !== "object") {
2909
2937
  throw new InvalidArgumentError(
2910
- "The second argument of ModelDataSanitizer.sanitize should be an Object, but %v was given.",
2938
+ 'Parameter "modelData" must be an Object, but %v was given.',
2911
2939
  modelData
2912
2940
  );
2913
2941
  }
@@ -2940,33 +2968,33 @@ var init_model_definition_validator = __esm({
2940
2968
  validate(modelDef) {
2941
2969
  if (!modelDef || typeof modelDef !== "object" || Array.isArray(modelDef)) {
2942
2970
  throw new InvalidArgumentError(
2943
- "The model definition should be an Object, but %v was given.",
2971
+ "Model definition must be an Object, but %v was given.",
2944
2972
  modelDef
2945
2973
  );
2946
2974
  }
2947
2975
  if (!modelDef.name || typeof modelDef.name !== "string") {
2948
2976
  throw new InvalidArgumentError(
2949
- 'The model definition requires the option "name" as a non-empty String, but %v was given.',
2977
+ 'Model definition requires the option "name" as a non-empty String, but %v was given.',
2950
2978
  modelDef.name
2951
2979
  );
2952
2980
  }
2953
2981
  if (modelDef.datasource && typeof modelDef.datasource !== "string") {
2954
2982
  throw new InvalidArgumentError(
2955
- 'The provided option "datasource" of the model %v should be a String, but %v was given.',
2983
+ 'Option "datasource" of the model %v must be a String, but %v was given.',
2956
2984
  modelDef.name,
2957
2985
  modelDef.datasource
2958
2986
  );
2959
2987
  }
2960
2988
  if (modelDef.base && typeof modelDef.base !== "string") {
2961
2989
  throw new InvalidArgumentError(
2962
- 'The provided option "base" of the model %v should be a String, but %v was given.',
2990
+ 'Option "base" of the model %v must be a String, but %v was given.',
2963
2991
  modelDef.name,
2964
2992
  modelDef.base
2965
2993
  );
2966
2994
  }
2967
2995
  if (modelDef.tableName && typeof modelDef.tableName !== "string") {
2968
2996
  throw new InvalidArgumentError(
2969
- 'The provided option "tableName" of the model %v should be a String, but %v was given.',
2997
+ 'Option "tableName" of the model %v must be a String, but %v was given.',
2970
2998
  modelDef.name,
2971
2999
  modelDef.tableName
2972
3000
  );
@@ -2974,7 +3002,7 @@ var init_model_definition_validator = __esm({
2974
3002
  if (modelDef.properties) {
2975
3003
  if (typeof modelDef.properties !== "object" || Array.isArray(modelDef.properties)) {
2976
3004
  throw new InvalidArgumentError(
2977
- 'The provided option "properties" of the model %v should be an Object, but %v was given.',
3005
+ 'Option "properties" of the model %v must be an Object, but %v was given.',
2978
3006
  modelDef.name,
2979
3007
  modelDef.properties
2980
3008
  );
@@ -2987,7 +3015,7 @@ var init_model_definition_validator = __esm({
2987
3015
  if (modelDef.relations) {
2988
3016
  if (typeof modelDef.relations !== "object" || Array.isArray(modelDef.relations)) {
2989
3017
  throw new InvalidArgumentError(
2990
- 'The provided option "relations" of the model %v should be an Object, but %v was given.',
3018
+ 'Option "relations" of the model %v must be an Object, but %v was given.',
2991
3019
  modelDef.name,
2992
3020
  modelDef.relations
2993
3021
  );
@@ -3034,19 +3062,19 @@ var init_datasource_definition_validator = __esm({
3034
3062
  validate(datasourceDef) {
3035
3063
  if (!datasourceDef || typeof datasourceDef !== "object") {
3036
3064
  throw new InvalidArgumentError(
3037
- "The datasource definition should be an Object, but %v was given.",
3065
+ "Datasource definition must be an Object, but %v was given.",
3038
3066
  datasourceDef
3039
3067
  );
3040
3068
  }
3041
3069
  if (!datasourceDef.name || typeof datasourceDef.name !== "string") {
3042
3070
  throw new InvalidArgumentError(
3043
- 'The datasource definition requires the option "name" as a non-empty String, but %v was given.',
3071
+ 'Datasource definition requires the option "name" as a non-empty String, but %v was given.',
3044
3072
  datasourceDef.name
3045
3073
  );
3046
3074
  }
3047
3075
  if (!datasourceDef.adapter || typeof datasourceDef.adapter !== "string") {
3048
3076
  throw new InvalidArgumentError(
3049
- 'The datasource %v requires the option "adapter" as a non-empty String, but %v was given.',
3077
+ 'Datasource %v requires the option "adapter" as a non-empty String, but %v was given.',
3050
3078
  datasourceDef.name,
3051
3079
  datasourceDef.adapter
3052
3080
  );
@@ -3096,45 +3124,64 @@ var init_fields_clause_tool = __esm({
3096
3124
  * @returns {object|object[]}
3097
3125
  */
3098
3126
  filter(input, modelName, clause) {
3099
- const isArray = Array.isArray(input);
3100
- let entities = isArray ? input : [input];
3101
- entities.forEach((entity) => {
3102
- if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
3103
- throw new InvalidArgumentError(
3104
- "The first argument of FieldsClauseTool.filter should be an Object or an Array of Object, but %v was given.",
3105
- entity
3106
- );
3107
- }
3108
- });
3127
+ if (!input || typeof input !== "object") {
3128
+ throw new InvalidArgumentError(
3129
+ 'Parameter "input" must be an Object or an Array of Object, but %v was given.',
3130
+ input
3131
+ );
3132
+ }
3133
+ const isArrayInput = Array.isArray(input);
3134
+ if (isArrayInput) {
3135
+ input.forEach((entity, index) => {
3136
+ if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
3137
+ throw new InvalidArgumentError(
3138
+ 'Element %d of the parameter "input" must be an Object, but %v was given.',
3139
+ index,
3140
+ entity
3141
+ );
3142
+ }
3143
+ });
3144
+ }
3109
3145
  if (!modelName || typeof modelName !== "string") {
3110
3146
  throw new InvalidArgumentError(
3111
- "The second argument of FieldsClauseTool.filter should be a non-empty String, but %v was given.",
3147
+ 'Parameter "modelName" must be a non-empty String, but %v was given.',
3112
3148
  modelName
3113
3149
  );
3114
3150
  }
3115
3151
  if (clause == null) {
3116
3152
  return input;
3117
3153
  }
3118
- const fields = Array.isArray(clause) ? clause.slice() : [clause];
3119
- if (!fields.length) {
3120
- return input;
3154
+ const isArrayClause = Array.isArray(clause);
3155
+ if (!clause || typeof clause !== "string" && !isArrayClause) {
3156
+ throw new InvalidArgumentError(
3157
+ 'Option "fields" must be a non-empty String or an Array of non-empty String, but %v was given.',
3158
+ clause
3159
+ );
3121
3160
  }
3122
- fields.forEach((field) => {
3123
- if (!field || typeof field !== "string") {
3124
- throw new InvalidArgumentError(
3125
- 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v was given.',
3126
- field
3127
- );
3161
+ if (isArrayClause) {
3162
+ if (!clause.length) {
3163
+ return input;
3128
3164
  }
3129
- });
3165
+ clause.forEach((field, index) => {
3166
+ if (!field || typeof field !== "string") {
3167
+ throw new InvalidArgumentError(
3168
+ 'Element %d of the option "fields" must be a non-empty String, but %v was given.',
3169
+ index,
3170
+ field
3171
+ );
3172
+ }
3173
+ });
3174
+ }
3175
+ const fields = isArrayClause ? clause.slice() : [clause];
3130
3176
  const pkPropName = this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(
3131
3177
  modelName
3132
3178
  );
3133
3179
  if (fields.indexOf(pkPropName) === -1) {
3134
3180
  fields.push(pkPropName);
3135
3181
  }
3182
+ let entities = isArrayInput ? input : [input];
3136
3183
  entities = entities.map((entity) => selectObjectKeys(entity, fields));
3137
- return isArray ? entities : entities[0];
3184
+ return isArrayInput ? entities : entities[0];
3138
3185
  }
3139
3186
  /**
3140
3187
  * Validate fields clause.
@@ -3145,18 +3192,24 @@ var init_fields_clause_tool = __esm({
3145
3192
  if (clause == null) {
3146
3193
  return;
3147
3194
  }
3148
- const fields = Array.isArray(clause) ? clause : [clause];
3149
- if (!fields.length) {
3150
- return;
3195
+ const isArray = Array.isArray(clause);
3196
+ if (!clause || typeof clause !== "string" && !isArray) {
3197
+ throw new InvalidArgumentError(
3198
+ 'Option "fields" must be a non-empty String or an Array of non-empty String, but %v was given.',
3199
+ clause
3200
+ );
3201
+ }
3202
+ if (isArray && clause.length > 0) {
3203
+ clause.forEach((field, index) => {
3204
+ if (!field || typeof field !== "string") {
3205
+ throw new InvalidArgumentError(
3206
+ 'Element %d of the option "fields" must be a non-empty String, but %v was given.',
3207
+ index,
3208
+ field
3209
+ );
3210
+ }
3211
+ });
3151
3212
  }
3152
- fields.forEach((field) => {
3153
- if (!field || typeof field !== "string") {
3154
- throw new InvalidArgumentError(
3155
- 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v was given.',
3156
- field
3157
- );
3158
- }
3159
- });
3160
3213
  }
3161
3214
  /**
3162
3215
  * Normalize fields clause.
@@ -3168,19 +3221,28 @@ var init_fields_clause_tool = __esm({
3168
3221
  if (clause == null) {
3169
3222
  return;
3170
3223
  }
3171
- const fields = Array.isArray(clause) ? clause : [clause];
3172
- if (!fields.length) {
3173
- return;
3224
+ const isArray = Array.isArray(clause);
3225
+ if (!clause || typeof clause !== "string" && !isArray) {
3226
+ throw new InvalidArgumentError(
3227
+ 'Option "fields" must be a non-empty String or an Array of non-empty String, but %v was given.',
3228
+ clause
3229
+ );
3174
3230
  }
3175
- fields.forEach((field) => {
3176
- if (!field || typeof field !== "string") {
3177
- throw new InvalidArgumentError(
3178
- 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v was given.',
3179
- field
3180
- );
3231
+ if (isArray) {
3232
+ if (!clause.length) {
3233
+ return;
3181
3234
  }
3182
- });
3183
- return fields;
3235
+ clause.forEach((field, index) => {
3236
+ if (!field || typeof field !== "string") {
3237
+ throw new InvalidArgumentError(
3238
+ 'Element %d of the option "fields" must be a non-empty String, but %v was given.',
3239
+ index,
3240
+ field
3241
+ );
3242
+ }
3243
+ });
3244
+ }
3245
+ return isArray ? clause : [clause];
3184
3246
  }
3185
3247
  };
3186
3248
  }
@@ -3207,7 +3269,7 @@ var init_inclusion_decorator = __esm({
3207
3269
  decorate(adapter) {
3208
3270
  if (!adapter || !(adapter instanceof Adapter)) {
3209
3271
  throw new InvalidArgumentError(
3210
- "The first argument of InclusionDecorator.decorate should be an Adapter instance, but %v was given.",
3272
+ 'Parameter "adapter" must be an instance of Adapter, but %v was given.',
3211
3273
  adapter
3212
3274
  );
3213
3275
  }
@@ -3304,7 +3366,7 @@ var init_default_values_decorator = __esm({
3304
3366
  decorate(adapter) {
3305
3367
  if (!adapter || !(adapter instanceof Adapter)) {
3306
3368
  throw new InvalidArgumentError(
3307
- "The first argument of DefaultValuesDecorator.decorate should be an Adapter instance, but %v was given.",
3369
+ 'Parameter "adapter" must be an instance of Adapter, but %v was given.',
3308
3370
  adapter
3309
3371
  );
3310
3372
  }
@@ -3371,7 +3433,7 @@ var init_data_sanitizing_decorator = __esm({
3371
3433
  decorate(adapter) {
3372
3434
  if (!adapter || !(adapter instanceof Adapter)) {
3373
3435
  throw new InvalidArgumentError(
3374
- "The first argument of DataSanitizingDecorator.decorate should be an Adapter instance, but %v was given.",
3436
+ 'Parameter "adapter" must be an instance of Adapter, but %v was given.',
3375
3437
  adapter
3376
3438
  );
3377
3439
  }
@@ -3428,7 +3490,7 @@ var init_fields_filtering_decorator = __esm({
3428
3490
  decorate(adapter) {
3429
3491
  if (!adapter || !(adapter instanceof Adapter)) {
3430
3492
  throw new InvalidArgumentError(
3431
- "The first argument of FieldsFilteringDecorator.decorate should be an Adapter instance, but %v was given.",
3493
+ 'Parameter "adapter" must be an instance of Adapter, but %v was given.',
3432
3494
  adapter
3433
3495
  );
3434
3496
  }
@@ -3519,7 +3581,7 @@ var init_required_property_decorator = __esm({
3519
3581
  decorate(adapter) {
3520
3582
  if (!adapter || !(adapter instanceof Adapter)) {
3521
3583
  throw new InvalidArgumentError(
3522
- "The first argument of RequiredPropertyDecorator.decorate should be an Adapter instance, but %v was given.",
3584
+ 'Parameter "adapter" must be an instance of Adapter, but %v was given.',
3523
3585
  adapter
3524
3586
  );
3525
3587
  }
@@ -3575,7 +3637,7 @@ var init_property_uniqueness_decorator = __esm({
3575
3637
  decorate(adapter) {
3576
3638
  if (!adapter || !(adapter instanceof Adapter)) {
3577
3639
  throw new InvalidArgumentError(
3578
- "The first argument of PropertyUniquenessDecorator.decorate should be an Adapter instance, but %v was given.",
3640
+ 'Parameter "adapter" must be an instance of Adapter, but %v was given.',
3579
3641
  adapter
3580
3642
  );
3581
3643
  }
@@ -3909,7 +3971,7 @@ var init_memory_adapter = __esm({
3909
3971
  const propType = modelUtils.getDataTypeByPropertyName(modelName, propName);
3910
3972
  if (propType !== DataType.ANY && propType !== DataType.NUMBER) {
3911
3973
  throw new InvalidArgumentError(
3912
- "The memory adapter able to generate only Number identifiers, but the primary key %v of the model %v is defined as %s. Do provide your own value for the %v property, or change the type in the primary key definition to a Number that will be generated automatically.",
3974
+ "Memory adapter is able to generate only Number identifiers, but the primary key %v of the model %v is defined as %s. Do provide your own value for the %v property, or change the type in the primary key definition to a Number that will be generated automatically.",
3913
3975
  propName,
3914
3976
  modelName,
3915
3977
  capitalize(propType),
@@ -3964,7 +4026,7 @@ var init_memory_adapter = __esm({
3964
4026
  const table = this._getTableOrCreate(modelName);
3965
4027
  if (table.has(idValue)) {
3966
4028
  throw new InvalidArgumentError(
3967
- "The value %v of the primary key %v already exists in the model %v.",
4029
+ "Value %v of the primary key %v already exists in the model %v.",
3968
4030
  idValue,
3969
4031
  pkPropName,
3970
4032
  modelName
@@ -3998,7 +4060,7 @@ var init_memory_adapter = __esm({
3998
4060
  );
3999
4061
  if (!isExists) {
4000
4062
  throw new InvalidArgumentError(
4001
- "The value %v of the primary key %v does not exist in the model %v.",
4063
+ "Value %v of the primary key %v does not exist in the model %v.",
4002
4064
  id,
4003
4065
  pkPropName,
4004
4066
  modelName
@@ -4101,7 +4163,7 @@ var init_memory_adapter = __esm({
4101
4163
  );
4102
4164
  if (existingTableData == null) {
4103
4165
  throw new InvalidArgumentError(
4104
- "The value %v of the primary key %v does not exist in the model %v.",
4166
+ "Value %v of the primary key %v does not exist in the model %v.",
4105
4167
  id,
4106
4168
  pkPropName,
4107
4169
  modelName
@@ -4174,7 +4236,7 @@ var init_memory_adapter = __esm({
4174
4236
  );
4175
4237
  if (!tableData) {
4176
4238
  throw new InvalidArgumentError(
4177
- "The value %v of the primary key %v does not exist in the model %v.",
4239
+ "Value %v of the primary key %v does not exist in the model %v.",
4178
4240
  id,
4179
4241
  pkPropName,
4180
4242
  modelName
@@ -4311,7 +4373,7 @@ var init_adapter_loader = __esm({
4311
4373
  async loadByName(adapterName, settings = void 0) {
4312
4374
  if (!adapterName || typeof adapterName !== "string") {
4313
4375
  throw new InvalidArgumentError(
4314
- "The adapter name should be a non-empty String, but %v was given.",
4376
+ "Adapter name must be a non-empty String, but %v was given.",
4315
4377
  adapterName
4316
4378
  );
4317
4379
  }
@@ -4329,10 +4391,7 @@ var init_adapter_loader = __esm({
4329
4391
  }
4330
4392
  }
4331
4393
  if (!adapterCtor) {
4332
- throw new InvalidArgumentError(
4333
- "The adapter %v is not found.",
4334
- adapterName
4335
- );
4394
+ throw new InvalidArgumentError("Adapter %v is not found.", adapterName);
4336
4395
  }
4337
4396
  return new adapterCtor(this.container, settings);
4338
4397
  }
@@ -4449,7 +4508,7 @@ var init_repository = __esm({
4449
4508
  const datasourceName = modelDef.datasource;
4450
4509
  if (!datasourceName) {
4451
4510
  throw new InvalidArgumentError(
4452
- "The model %v does not have a specified datasource.",
4511
+ "Model %v does not have a specified datasource.",
4453
4512
  modelName
4454
4513
  );
4455
4514
  }
@@ -4632,7 +4691,7 @@ var init_repository_registry = __esm({
4632
4691
  setRepositoryCtor(ctor) {
4633
4692
  if (!ctor || typeof ctor !== "function" || !(ctor.prototype instanceof Repository)) {
4634
4693
  throw new InvalidArgumentError(
4635
- "The first argument of RepositoryRegistry.setRepositoryCtor must inherit from Repository class, but %v was given.",
4694
+ 'Parameter "ctor" must inherit from Repository class, but %v was given.',
4636
4695
  ctor
4637
4696
  );
4638
4697
  }
@@ -4695,37 +4754,37 @@ var init_has_one_resolver = __esm({
4695
4754
  async includeTo(entities, sourceName, targetName, relationName, foreignKey, scope = void 0) {
4696
4755
  if (!entities || !Array.isArray(entities)) {
4697
4756
  throw new InvalidArgumentError(
4698
- 'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v was given.',
4757
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
4699
4758
  entities
4700
4759
  );
4701
4760
  }
4702
4761
  if (!sourceName || typeof sourceName !== "string") {
4703
4762
  throw new InvalidArgumentError(
4704
- 'The parameter "sourceName" of HasOneResolver.includeTo requires a non-empty String, but %v was given.',
4763
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
4705
4764
  sourceName
4706
4765
  );
4707
4766
  }
4708
4767
  if (!targetName || typeof targetName !== "string") {
4709
4768
  throw new InvalidArgumentError(
4710
- 'The parameter "targetName" of HasOneResolver.includeTo requires a non-empty String, but %v was given.',
4769
+ 'Parameter "targetName" must be a non-empty String, but %v was given.',
4711
4770
  targetName
4712
4771
  );
4713
4772
  }
4714
4773
  if (!relationName || typeof relationName !== "string") {
4715
4774
  throw new InvalidArgumentError(
4716
- 'The parameter "relationName" of HasOneResolver.includeTo requires a non-empty String, but %v was given.',
4775
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
4717
4776
  relationName
4718
4777
  );
4719
4778
  }
4720
4779
  if (!foreignKey || typeof foreignKey !== "string") {
4721
4780
  throw new InvalidArgumentError(
4722
- 'The parameter "foreignKey" of HasOneResolver.includeTo requires a non-empty String, but %v was given.',
4781
+ 'Parameter "foreignKey" must be a non-empty String, but %v was given.',
4723
4782
  foreignKey
4724
4783
  );
4725
4784
  }
4726
4785
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
4727
4786
  throw new InvalidArgumentError(
4728
- 'The provided parameter "scope" of HasOneResolver.includeTo should be an Object, but %v was given.',
4787
+ 'Parameter "scope" must be an Object, but %v was given.',
4729
4788
  scope
4730
4789
  );
4731
4790
  }
@@ -4736,7 +4795,7 @@ var init_has_one_resolver = __esm({
4736
4795
  entities.forEach((entity) => {
4737
4796
  if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
4738
4797
  throw new InvalidArgumentError(
4739
- 'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v was given.',
4798
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
4740
4799
  entity
4741
4800
  );
4742
4801
  }
@@ -4785,43 +4844,43 @@ var init_has_one_resolver = __esm({
4785
4844
  async includePolymorphicTo(entities, sourceName, targetName, relationName, foreignKey, discriminator, scope = void 0) {
4786
4845
  if (!entities || !Array.isArray(entities)) {
4787
4846
  throw new InvalidArgumentError(
4788
- 'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
4847
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
4789
4848
  entities
4790
4849
  );
4791
4850
  }
4792
4851
  if (!sourceName || typeof sourceName !== "string") {
4793
4852
  throw new InvalidArgumentError(
4794
- 'The parameter "sourceName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
4853
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
4795
4854
  sourceName
4796
4855
  );
4797
4856
  }
4798
4857
  if (!targetName || typeof targetName !== "string") {
4799
4858
  throw new InvalidArgumentError(
4800
- 'The parameter "targetName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
4859
+ 'Parameter "targetName" must be a non-empty String, but %v was given.',
4801
4860
  targetName
4802
4861
  );
4803
4862
  }
4804
4863
  if (!relationName || typeof relationName !== "string") {
4805
4864
  throw new InvalidArgumentError(
4806
- 'The parameter "relationName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
4865
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
4807
4866
  relationName
4808
4867
  );
4809
4868
  }
4810
4869
  if (!foreignKey || typeof foreignKey !== "string") {
4811
4870
  throw new InvalidArgumentError(
4812
- 'The parameter "foreignKey" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
4871
+ 'Parameter "foreignKey" must be a non-empty String, but %v was given.',
4813
4872
  foreignKey
4814
4873
  );
4815
4874
  }
4816
4875
  if (!discriminator || typeof discriminator !== "string") {
4817
4876
  throw new InvalidArgumentError(
4818
- 'The parameter "discriminator" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
4877
+ 'Parameter "discriminator" must be a non-empty String, but %v was given.',
4819
4878
  discriminator
4820
4879
  );
4821
4880
  }
4822
4881
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
4823
4882
  throw new InvalidArgumentError(
4824
- 'The provided parameter "scope" of HasOneResolver.includePolymorphicTo should be an Object, but %v was given.',
4883
+ 'Parameter "scope" must be an Object, but %v was given.',
4825
4884
  scope
4826
4885
  );
4827
4886
  }
@@ -4832,7 +4891,7 @@ var init_has_one_resolver = __esm({
4832
4891
  entities.forEach((entity) => {
4833
4892
  if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
4834
4893
  throw new InvalidArgumentError(
4835
- 'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
4894
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
4836
4895
  entity
4837
4896
  );
4838
4897
  }
@@ -4883,37 +4942,37 @@ var init_has_one_resolver = __esm({
4883
4942
  async includePolymorphicByRelationName(entities, sourceName, targetName, relationName, targetRelationName, scope = void 0) {
4884
4943
  if (!entities || !Array.isArray(entities)) {
4885
4944
  throw new InvalidArgumentError(
4886
- 'The parameter "entities" of HasOneResolver.includePolymorphicByRelationName requires an Array of Object, but %v was given.',
4945
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
4887
4946
  entities
4888
4947
  );
4889
4948
  }
4890
4949
  if (!sourceName || typeof sourceName !== "string") {
4891
4950
  throw new InvalidArgumentError(
4892
- 'The parameter "sourceName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
4951
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
4893
4952
  sourceName
4894
4953
  );
4895
4954
  }
4896
4955
  if (!targetName || typeof targetName !== "string") {
4897
4956
  throw new InvalidArgumentError(
4898
- 'The parameter "targetName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
4957
+ 'Parameter "targetName" must be a non-empty String, but %v was given.',
4899
4958
  targetName
4900
4959
  );
4901
4960
  }
4902
4961
  if (!relationName || typeof relationName !== "string") {
4903
4962
  throw new InvalidArgumentError(
4904
- 'The parameter "relationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
4963
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
4905
4964
  relationName
4906
4965
  );
4907
4966
  }
4908
4967
  if (!targetRelationName || typeof targetRelationName !== "string") {
4909
4968
  throw new InvalidArgumentError(
4910
- 'The parameter "targetRelationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
4969
+ 'Parameter "targetRelationName" must be a non-empty String, but %v was given.',
4911
4970
  targetRelationName
4912
4971
  );
4913
4972
  }
4914
4973
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
4915
4974
  throw new InvalidArgumentError(
4916
- 'The provided parameter "scope" of HasOneResolver.includePolymorphicByRelationName should be an Object, but %v was given.',
4975
+ 'Parameter "scope" must be an Object, but %v was given.',
4917
4976
  scope
4918
4977
  );
4919
4978
  }
@@ -4922,7 +4981,7 @@ var init_has_one_resolver = __esm({
4922
4981
  ).getRelationDefinitionByName(targetName, targetRelationName);
4923
4982
  if (targetRelationDef.type !== RelationType.BELONGS_TO) {
4924
4983
  throw new InvalidArgumentError(
4925
- 'The relation %v of the model %v is a polymorphic "hasOne" relation, so it requires the target relation %v to be a polymorphic "belongsTo", but %v type was given.',
4984
+ 'Relation %v of the model %v is a polymorphic "hasOne" relation, so it requires the target relation %v to be a polymorphic "belongsTo", but %v type was given.',
4926
4985
  relationName,
4927
4986
  sourceName,
4928
4987
  targetRelationName,
@@ -4931,7 +4990,7 @@ var init_has_one_resolver = __esm({
4931
4990
  }
4932
4991
  if (!targetRelationDef.polymorphic) {
4933
4992
  throw new InvalidArgumentError(
4934
- 'The relation %v of the model %v is a polymorphic "hasOne" relation, so it requires the target relation %v to be a polymorphic too.',
4993
+ 'Relation %v of the model %v is a polymorphic "hasOne" relation, so it requires the target relation %v to be a polymorphic too.',
4935
4994
  relationName,
4936
4995
  sourceName,
4937
4996
  targetRelationName
@@ -4981,37 +5040,37 @@ var init_has_many_resolver = __esm({
4981
5040
  async includeTo(entities, sourceName, targetName, relationName, foreignKey, scope = void 0) {
4982
5041
  if (!entities || !Array.isArray(entities)) {
4983
5042
  throw new InvalidArgumentError(
4984
- 'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v was given.',
5043
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
4985
5044
  entities
4986
5045
  );
4987
5046
  }
4988
5047
  if (!sourceName || typeof sourceName !== "string") {
4989
5048
  throw new InvalidArgumentError(
4990
- 'The parameter "sourceName" of HasManyResolver.includeTo requires a non-empty String, but %v was given.',
5049
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
4991
5050
  sourceName
4992
5051
  );
4993
5052
  }
4994
5053
  if (!targetName || typeof targetName !== "string") {
4995
5054
  throw new InvalidArgumentError(
4996
- 'The parameter "targetName" of HasManyResolver.includeTo requires a non-empty String, but %v was given.',
5055
+ 'Parameter "targetName" must be a non-empty String, but %v was given.',
4997
5056
  targetName
4998
5057
  );
4999
5058
  }
5000
5059
  if (!relationName || typeof relationName !== "string") {
5001
5060
  throw new InvalidArgumentError(
5002
- 'The parameter "relationName" of HasManyResolver.includeTo requires a non-empty String, but %v was given.',
5061
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
5003
5062
  relationName
5004
5063
  );
5005
5064
  }
5006
5065
  if (!foreignKey || typeof foreignKey !== "string") {
5007
5066
  throw new InvalidArgumentError(
5008
- 'The parameter "foreignKey" of HasManyResolver.includeTo requires a non-empty String, but %v was given.',
5067
+ 'Parameter "foreignKey" must be a non-empty String, but %v was given.',
5009
5068
  foreignKey
5010
5069
  );
5011
5070
  }
5012
5071
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
5013
5072
  throw new InvalidArgumentError(
5014
- 'The provided parameter "scope" of HasManyResolver.includeTo should be an Object, but %v was given.',
5073
+ 'Parameter "scope" must be an Object, but %v was given.',
5015
5074
  scope
5016
5075
  );
5017
5076
  }
@@ -5022,7 +5081,7 @@ var init_has_many_resolver = __esm({
5022
5081
  entities.forEach((entity) => {
5023
5082
  if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
5024
5083
  throw new InvalidArgumentError(
5025
- 'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v was given.',
5084
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5026
5085
  entity
5027
5086
  );
5028
5087
  }
@@ -5072,43 +5131,43 @@ var init_has_many_resolver = __esm({
5072
5131
  async includePolymorphicTo(entities, sourceName, targetName, relationName, foreignKey, discriminator, scope = void 0) {
5073
5132
  if (!entities || !Array.isArray(entities)) {
5074
5133
  throw new InvalidArgumentError(
5075
- 'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5134
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5076
5135
  entities
5077
5136
  );
5078
5137
  }
5079
5138
  if (!sourceName || typeof sourceName !== "string") {
5080
5139
  throw new InvalidArgumentError(
5081
- 'The parameter "sourceName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5140
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
5082
5141
  sourceName
5083
5142
  );
5084
5143
  }
5085
5144
  if (!targetName || typeof targetName !== "string") {
5086
5145
  throw new InvalidArgumentError(
5087
- 'The parameter "targetName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5146
+ 'Parameter "targetName" must be a non-empty String, but %v was given.',
5088
5147
  targetName
5089
5148
  );
5090
5149
  }
5091
5150
  if (!relationName || typeof relationName !== "string") {
5092
5151
  throw new InvalidArgumentError(
5093
- 'The parameter "relationName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5152
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
5094
5153
  relationName
5095
5154
  );
5096
5155
  }
5097
5156
  if (!foreignKey || typeof foreignKey !== "string") {
5098
5157
  throw new InvalidArgumentError(
5099
- 'The parameter "foreignKey" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5158
+ 'Parameter "foreignKey" must be a non-empty String, but %v was given.',
5100
5159
  foreignKey
5101
5160
  );
5102
5161
  }
5103
5162
  if (!discriminator || typeof discriminator !== "string") {
5104
5163
  throw new InvalidArgumentError(
5105
- 'The parameter "discriminator" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5164
+ 'Parameter "discriminator" must be a non-empty String, but %v was given.',
5106
5165
  discriminator
5107
5166
  );
5108
5167
  }
5109
5168
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
5110
5169
  throw new InvalidArgumentError(
5111
- 'The provided parameter "scope" of HasManyResolver.includePolymorphicTo should be an Object, but %v was given.',
5170
+ 'Parameter "scope" must be an Object, but %v was given.',
5112
5171
  scope
5113
5172
  );
5114
5173
  }
@@ -5119,7 +5178,7 @@ var init_has_many_resolver = __esm({
5119
5178
  entities.forEach((entity) => {
5120
5179
  if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
5121
5180
  throw new InvalidArgumentError(
5122
- 'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5181
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5123
5182
  entity
5124
5183
  );
5125
5184
  }
@@ -5171,37 +5230,37 @@ var init_has_many_resolver = __esm({
5171
5230
  async includePolymorphicByRelationName(entities, sourceName, targetName, relationName, targetRelationName, scope = void 0) {
5172
5231
  if (!entities || !Array.isArray(entities)) {
5173
5232
  throw new InvalidArgumentError(
5174
- 'The parameter "entities" of HasManyResolver.includePolymorphicByRelationName requires an Array of Object, but %v was given.',
5233
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5175
5234
  entities
5176
5235
  );
5177
5236
  }
5178
5237
  if (!sourceName || typeof sourceName !== "string") {
5179
5238
  throw new InvalidArgumentError(
5180
- 'The parameter "sourceName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5239
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
5181
5240
  sourceName
5182
5241
  );
5183
5242
  }
5184
5243
  if (!targetName || typeof targetName !== "string") {
5185
5244
  throw new InvalidArgumentError(
5186
- 'The parameter "targetName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5245
+ 'Parameter "targetName" must be a non-empty String, but %v was given.',
5187
5246
  targetName
5188
5247
  );
5189
5248
  }
5190
5249
  if (!relationName || typeof relationName !== "string") {
5191
5250
  throw new InvalidArgumentError(
5192
- 'The parameter "relationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5251
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
5193
5252
  relationName
5194
5253
  );
5195
5254
  }
5196
5255
  if (!targetRelationName || typeof targetRelationName !== "string") {
5197
5256
  throw new InvalidArgumentError(
5198
- 'The parameter "targetRelationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5257
+ 'Parameter "targetRelationName" must be a non-empty String, but %v was given.',
5199
5258
  targetRelationName
5200
5259
  );
5201
5260
  }
5202
5261
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
5203
5262
  throw new InvalidArgumentError(
5204
- 'The provided parameter "scope" of HasManyResolver.includePolymorphicByRelationName should be an Object, but %v was given.',
5263
+ 'Parameter "scope" must be an Object, but %v was given.',
5205
5264
  scope
5206
5265
  );
5207
5266
  }
@@ -5210,7 +5269,7 @@ var init_has_many_resolver = __esm({
5210
5269
  ).getRelationDefinitionByName(targetName, targetRelationName);
5211
5270
  if (targetRelationDef.type !== RelationType.BELONGS_TO) {
5212
5271
  throw new InvalidArgumentError(
5213
- 'The relation %v of the model %v is a polymorphic "hasMany" relation, so it requires the target relation %v to be a polymorphic "belongsTo", but %v type was given.',
5272
+ 'Relation %v of the model %v is a polymorphic "hasMany" relation, so it requires the target relation %v to be a polymorphic "belongsTo", but %v type was given.',
5214
5273
  relationName,
5215
5274
  sourceName,
5216
5275
  targetRelationName,
@@ -5219,7 +5278,7 @@ var init_has_many_resolver = __esm({
5219
5278
  }
5220
5279
  if (!targetRelationDef.polymorphic) {
5221
5280
  throw new InvalidArgumentError(
5222
- 'The relation %v of the model %v is a polymorphic "hasMany" relation, so it requires the target relation %v to be a polymorphic too.',
5281
+ 'Relation %v of the model %v is a polymorphic "hasMany" relation, so it requires the target relation %v to be a polymorphic too.',
5223
5282
  relationName,
5224
5283
  sourceName,
5225
5284
  targetRelationName
@@ -5269,37 +5328,37 @@ var init_belongs_to_resolver = __esm({
5269
5328
  async includeTo(entities, sourceName, targetName, relationName, foreignKey = void 0, scope = void 0) {
5270
5329
  if (!entities || !Array.isArray(entities)) {
5271
5330
  throw new InvalidArgumentError(
5272
- 'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v was given.',
5331
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5273
5332
  entities
5274
5333
  );
5275
5334
  }
5276
5335
  if (!sourceName || typeof sourceName !== "string") {
5277
5336
  throw new InvalidArgumentError(
5278
- 'The parameter "sourceName" of BelongsToResolver.includeTo requires a non-empty String, but %v was given.',
5337
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
5279
5338
  sourceName
5280
5339
  );
5281
5340
  }
5282
5341
  if (!targetName || typeof targetName !== "string") {
5283
5342
  throw new InvalidArgumentError(
5284
- 'The parameter "targetName" of BelongsToResolver.includeTo requires a non-empty String, but %v was given.',
5343
+ 'Parameter "targetName" must be a non-empty String, but %v was given.',
5285
5344
  targetName
5286
5345
  );
5287
5346
  }
5288
5347
  if (!relationName || typeof relationName !== "string") {
5289
5348
  throw new InvalidArgumentError(
5290
- 'The parameter "relationName" of BelongsToResolver.includeTo requires a non-empty String, but %v was given.',
5349
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
5291
5350
  relationName
5292
5351
  );
5293
5352
  }
5294
5353
  if (foreignKey && typeof foreignKey !== "string") {
5295
5354
  throw new InvalidArgumentError(
5296
- 'The provided parameter "foreignKey" of BelongsToResolver.includeTo should be a String, but %v was given.',
5355
+ 'Parameter "foreignKey" must be a String, but %v was given.',
5297
5356
  foreignKey
5298
5357
  );
5299
5358
  }
5300
5359
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
5301
5360
  throw new InvalidArgumentError(
5302
- 'The provided parameter "scope" of BelongsToResolver.includeTo should be an Object, but %v was given.',
5361
+ 'Parameter "scope" must be an Object, but %v was given.',
5303
5362
  scope
5304
5363
  );
5305
5364
  }
@@ -5309,7 +5368,7 @@ var init_belongs_to_resolver = __esm({
5309
5368
  const targetIds = entities.reduce((acc, entity) => {
5310
5369
  if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
5311
5370
  throw new InvalidArgumentError(
5312
- 'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v was given.',
5371
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5313
5372
  entity
5314
5373
  );
5315
5374
  }
@@ -5352,37 +5411,37 @@ var init_belongs_to_resolver = __esm({
5352
5411
  async includePolymorphicTo(entities, sourceName, relationName, foreignKey = void 0, discriminator = void 0, scope = void 0) {
5353
5412
  if (!entities || !Array.isArray(entities)) {
5354
5413
  throw new InvalidArgumentError(
5355
- 'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5414
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5356
5415
  entities
5357
5416
  );
5358
5417
  }
5359
5418
  if (!sourceName || typeof sourceName !== "string") {
5360
5419
  throw new InvalidArgumentError(
5361
- 'The parameter "sourceName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5420
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
5362
5421
  sourceName
5363
5422
  );
5364
5423
  }
5365
5424
  if (!relationName || typeof relationName !== "string") {
5366
5425
  throw new InvalidArgumentError(
5367
- 'The parameter "relationName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5426
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
5368
5427
  relationName
5369
5428
  );
5370
5429
  }
5371
5430
  if (foreignKey && typeof foreignKey !== "string") {
5372
5431
  throw new InvalidArgumentError(
5373
- 'The provided parameter "foreignKey" of BelongsToResolver.includePolymorphicTo should be a String, but %v was given.',
5432
+ 'Parameter "foreignKey" must be a String, but %v was given.',
5374
5433
  foreignKey
5375
5434
  );
5376
5435
  }
5377
5436
  if (discriminator && typeof discriminator !== "string") {
5378
5437
  throw new InvalidArgumentError(
5379
- 'The provided parameter "discriminator" of BelongsToResolver.includePolymorphicTo should be a String, but %v was given.',
5438
+ 'Parameter "discriminator" must be a String, but %v was given.',
5380
5439
  discriminator
5381
5440
  );
5382
5441
  }
5383
5442
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
5384
5443
  throw new InvalidArgumentError(
5385
- 'The provided parameter "scope" of BelongsToResolver.includePolymorphicTo should be an Object, but %v was given.',
5444
+ 'Parameter "scope" must be an Object, but %v was given.',
5386
5445
  scope
5387
5446
  );
5388
5447
  }
@@ -5398,7 +5457,7 @@ var init_belongs_to_resolver = __esm({
5398
5457
  entities.forEach((entity) => {
5399
5458
  if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
5400
5459
  throw new InvalidArgumentError(
5401
- 'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5460
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5402
5461
  entity
5403
5462
  );
5404
5463
  }
@@ -5424,7 +5483,7 @@ var init_belongs_to_resolver = __esm({
5424
5483
  targetRepository = this.getService(RepositoryRegistry).getRepository(targetName);
5425
5484
  } catch (error) {
5426
5485
  if (error instanceof InvalidArgumentError) {
5427
- if (error.message === `The model "${targetName}" is not defined.` || error.message === `The model "${targetName}" does not have a specified datasource.`) {
5486
+ if (error.message === `Model "${targetName}" is not defined.` || error.message === `Model "${targetName}" does not have a specified datasource.`) {
5428
5487
  return;
5429
5488
  }
5430
5489
  } else {
@@ -5499,37 +5558,37 @@ var init_references_many_resolver = __esm({
5499
5558
  async includeTo(entities, sourceName, targetName, relationName, foreignKey = void 0, scope = void 0) {
5500
5559
  if (!entities || !Array.isArray(entities)) {
5501
5560
  throw new InvalidArgumentError(
5502
- 'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v was given.',
5561
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5503
5562
  entities
5504
5563
  );
5505
5564
  }
5506
5565
  if (!sourceName || typeof sourceName !== "string") {
5507
5566
  throw new InvalidArgumentError(
5508
- 'The parameter "sourceName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v was given.',
5567
+ 'Parameter "sourceName" must be a non-empty String, but %v was given.',
5509
5568
  sourceName
5510
5569
  );
5511
5570
  }
5512
5571
  if (!targetName || typeof targetName !== "string") {
5513
5572
  throw new InvalidArgumentError(
5514
- 'The parameter "targetName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v was given.',
5573
+ 'Parameter "targetName" must be a non-empty String, but %v was given.',
5515
5574
  targetName
5516
5575
  );
5517
5576
  }
5518
5577
  if (!relationName || typeof relationName !== "string") {
5519
5578
  throw new InvalidArgumentError(
5520
- 'The parameter "relationName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v was given.',
5579
+ 'Parameter "relationName" must be a non-empty String, but %v was given.',
5521
5580
  relationName
5522
5581
  );
5523
5582
  }
5524
5583
  if (foreignKey && typeof foreignKey !== "string") {
5525
5584
  throw new InvalidArgumentError(
5526
- 'The provided parameter "foreignKey" of ReferencesManyResolver.includeTo should be a String, but %v was given.',
5585
+ 'Parameter "foreignKey" must be a String, but %v was given.',
5527
5586
  foreignKey
5528
5587
  );
5529
5588
  }
5530
5589
  if (scope && (typeof scope !== "object" || Array.isArray(scope))) {
5531
5590
  throw new InvalidArgumentError(
5532
- 'The provided parameter "scope" of ReferencesManyResolver.includeTo should be an Object, but %v was given.',
5591
+ 'Parameter "scope" must be an Object, but %v was given.',
5533
5592
  scope
5534
5593
  );
5535
5594
  }
@@ -5540,7 +5599,7 @@ var init_references_many_resolver = __esm({
5540
5599
  const targetIds = entities.reduce((acc, entity) => {
5541
5600
  if (!entity || typeof entity !== "object" || Array.isArray(entity)) {
5542
5601
  throw new InvalidArgumentError(
5543
- 'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v was given.',
5602
+ 'Parameter "entities" must be an Array of Object, but %v was given.',
5544
5603
  entity
5545
5604
  );
5546
5605
  }
@@ -5745,7 +5804,7 @@ var init_include_clause_tool = __esm({
5745
5804
  break;
5746
5805
  default:
5747
5806
  throw new InvalidArgumentError(
5748
- "The relation type %v does not have an inclusion resolver.",
5807
+ "Relation type %v does not have an inclusion resolver.",
5749
5808
  relDef.type
5750
5809
  );
5751
5810
  }
@@ -5779,7 +5838,7 @@ var init_include_clause_tool = __esm({
5779
5838
  );
5780
5839
  if (duplicateNames.length) {
5781
5840
  throw new InvalidArgumentError(
5782
- 'The provided option "include" has duplicates of %v.',
5841
+ 'Option "include" has duplicates of %v.',
5783
5842
  duplicateNames[0]
5784
5843
  );
5785
5844
  }
@@ -5787,7 +5846,7 @@ var init_include_clause_tool = __esm({
5787
5846
  if ("relation" in clause) {
5788
5847
  if (!clause.relation || typeof clause.relation !== "string") {
5789
5848
  throw new InvalidArgumentError(
5790
- 'The provided option "relation" should be a non-empty String, but %v was given.',
5849
+ 'Option "relation" must be a non-empty String, but %v was given.',
5791
5850
  clause.relation
5792
5851
  );
5793
5852
  }
@@ -5805,7 +5864,7 @@ var init_include_clause_tool = __esm({
5805
5864
  }
5806
5865
  } else {
5807
5866
  throw new InvalidArgumentError(
5808
- 'The provided option "include" should have a non-empty String, an Object or an Array, but %v was given.',
5867
+ 'Option "include" must have a non-empty String, an Object or an Array, but %v was given.',
5809
5868
  clause
5810
5869
  );
5811
5870
  }
@@ -5821,7 +5880,7 @@ var init_include_clause_tool = __esm({
5821
5880
  }
5822
5881
  if (typeof clause !== "object" || Array.isArray(clause)) {
5823
5882
  throw new InvalidArgumentError(
5824
- 'The provided option "scope" should be an Object, but %v was given.',
5883
+ 'Option "scope" must be an Object, but %v was given.',
5825
5884
  clause
5826
5885
  );
5827
5886
  }
@@ -5867,7 +5926,7 @@ var init_include_clause_tool = __esm({
5867
5926
  );
5868
5927
  if (duplicateNames.length) {
5869
5928
  throw new InvalidArgumentError(
5870
- 'The provided option "include" has duplicates of %v.',
5929
+ 'Option "include" has duplicates of %v.',
5871
5930
  duplicateNames[0]
5872
5931
  );
5873
5932
  }
@@ -5875,7 +5934,7 @@ var init_include_clause_tool = __esm({
5875
5934
  if ("relation" in clause) {
5876
5935
  if (!clause.relation || typeof clause.relation !== "string") {
5877
5936
  throw new InvalidArgumentError(
5878
- 'The provided option "relation" should be a non-empty String, but %v was given.',
5937
+ 'Option "relation" must be a non-empty String, but %v was given.',
5879
5938
  clause.relation
5880
5939
  );
5881
5940
  }
@@ -5901,7 +5960,7 @@ var init_include_clause_tool = __esm({
5901
5960
  }
5902
5961
  } else {
5903
5962
  throw new InvalidArgumentError(
5904
- 'The provided option "include" should have a non-empty String, an Object or an Array, but %v was given.',
5963
+ 'Option "include" must have a non-empty String, an Object or an Array, but %v was given.',
5905
5964
  clause
5906
5965
  );
5907
5966
  }
@@ -5919,7 +5978,7 @@ var init_include_clause_tool = __esm({
5919
5978
  }
5920
5979
  if (typeof clause !== "object" || Array.isArray(clause)) {
5921
5980
  throw new InvalidArgumentError(
5922
- 'The provided option "scope" should be an Object, but %v was given.',
5981
+ 'Option "scope" must be an Object, but %v was given.',
5923
5982
  clause
5924
5983
  );
5925
5984
  }