@e22m4u/js-repository 0.4.0 → 0.5.1

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 (88) hide show
  1. package/README.md +569 -80
  2. package/dist/cjs/index.cjs +319 -270
  3. package/package.json +1 -1
  4. package/src/adapter/adapter-loader.js +1 -1
  5. package/src/adapter/adapter-loader.spec.js +1 -1
  6. package/src/adapter/decorator/data-sanitizing-decorator.js +1 -1
  7. package/src/adapter/decorator/data-transformation-decorator.js +1 -1
  8. package/src/adapter/decorator/data-validation-decorator.js +1 -1
  9. package/src/adapter/decorator/default-values-decorator.js +1 -1
  10. package/src/adapter/decorator/fields-filtering-decorator.js +1 -1
  11. package/src/adapter/decorator/inclusion-decorator.js +1 -1
  12. package/src/adapter/decorator/property-uniqueness-decorator.js +1 -1
  13. package/src/definition/datasource/datasource-definition-validator.js +3 -3
  14. package/src/definition/datasource/datasource-definition-validator.spec.js +3 -3
  15. package/src/definition/model/model-data-sanitizer.js +2 -2
  16. package/src/definition/model/model-data-transformer.js +71 -13
  17. package/src/definition/model/model-data-transformer.spec.js +2073 -407
  18. package/src/definition/model/model-data-validator.js +125 -37
  19. package/src/definition/model/model-data-validator.spec.js +2138 -440
  20. package/src/definition/model/model-definition-utils.js +5 -5
  21. package/src/definition/model/model-definition-utils.spec.js +7 -7
  22. package/src/definition/model/model-definition-validator.js +7 -7
  23. package/src/definition/model/model-definition-validator.spec.js +10 -7
  24. package/src/definition/model/properties/properties-definition-validator.js +129 -54
  25. package/src/definition/model/properties/properties-definition-validator.spec.js +85 -25
  26. package/src/definition/model/properties/property-definition.d.ts +3 -3
  27. package/src/definition/model/properties/property-transformer/builtin/index.d.ts +0 -1
  28. package/src/definition/model/properties/property-transformer/builtin/index.js +0 -1
  29. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.d.ts +1 -1
  30. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js +1 -1
  31. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.spec.js +1 -1
  32. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.d.ts +1 -1
  33. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js +1 -1
  34. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.spec.js +1 -1
  35. package/src/definition/model/properties/property-transformer/builtin/trim-transformer.js +1 -1
  36. package/src/definition/model/properties/property-transformer/builtin/trim-transformer.spec.js +1 -1
  37. package/src/definition/model/properties/property-transformer/property-transformer-registry.js +2 -4
  38. package/src/definition/model/properties/property-transformer/property-transformer-registry.spec.js +2 -4
  39. package/src/definition/model/properties/property-transformer/property-transformer.d.ts +2 -2
  40. package/src/definition/model/properties/property-uniqueness-validator.js +4 -4
  41. package/src/definition/model/properties/property-uniqueness-validator.spec.js +4 -4
  42. package/src/definition/model/properties/property-validator/builtin/max-length-validator.d.ts +1 -1
  43. package/src/definition/model/properties/property-validator/builtin/max-length-validator.js +2 -2
  44. package/src/definition/model/properties/property-validator/builtin/max-length-validator.spec.js +2 -2
  45. package/src/definition/model/properties/property-validator/builtin/min-length-validator.d.ts +1 -1
  46. package/src/definition/model/properties/property-validator/builtin/min-length-validator.js +2 -2
  47. package/src/definition/model/properties/property-validator/builtin/min-length-validator.spec.js +2 -2
  48. package/src/definition/model/properties/property-validator/builtin/regexp-validator.d.ts +1 -1
  49. package/src/definition/model/properties/property-validator/builtin/regexp-validator.js +2 -2
  50. package/src/definition/model/properties/property-validator/builtin/regexp-validator.spec.js +2 -2
  51. package/src/definition/model/properties/property-validator/property-validator-registry.js +2 -2
  52. package/src/definition/model/properties/property-validator/property-validator-registry.spec.js +2 -2
  53. package/src/definition/model/properties/property-validator/property-validator.d.ts +2 -2
  54. package/src/definition/model/relations/relation-definition.d.ts +21 -21
  55. package/src/definition/model/relations/relations-definition-validator.js +23 -23
  56. package/src/definition/model/relations/relations-definition-validator.spec.js +24 -24
  57. package/src/errors/invalid-operator-value-error.js +1 -1
  58. package/src/errors/invalid-operator-value-error.spec.js +1 -1
  59. package/src/filter/fields-clause-tool.js +5 -5
  60. package/src/filter/fields-clause-tool.spec.js +16 -16
  61. package/src/filter/include-clause-tool.js +6 -6
  62. package/src/filter/include-clause-tool.spec.js +2 -2
  63. package/src/filter/operator-clause-tool.js +13 -13
  64. package/src/filter/operator-clause-tool.spec.js +13 -13
  65. package/src/filter/order-clause-tool.js +3 -3
  66. package/src/filter/order-clause-tool.spec.js +4 -4
  67. package/src/filter/slice-clause-tool.js +5 -5
  68. package/src/filter/slice-clause-tool.spec.js +5 -5
  69. package/src/filter/where-clause-tool.js +4 -4
  70. package/src/filter/where-clause-tool.spec.js +3 -3
  71. package/src/relations/belongs-to-resolver.js +14 -14
  72. package/src/relations/belongs-to-resolver.spec.js +14 -14
  73. package/src/relations/has-many-resolver.js +22 -22
  74. package/src/relations/has-many-resolver.spec.js +23 -23
  75. package/src/relations/has-one-resolver.js +22 -22
  76. package/src/relations/has-one-resolver.spec.js +23 -23
  77. package/src/relations/references-many-resolver.js +7 -7
  78. package/src/relations/references-many-resolver.spec.js +7 -7
  79. package/src/repository/repository-registry.js +1 -1
  80. package/src/utils/exclude-object-keys.js +1 -1
  81. package/src/utils/exclude-object-keys.spec.js +1 -1
  82. package/src/utils/model-name-to-model-key.js +1 -1
  83. package/src/utils/model-name-to-model-key.spec.js +7 -7
  84. package/src/utils/select-object-keys.js +3 -3
  85. package/src/utils/select-object-keys.spec.js +3 -3
  86. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.d.ts +0 -6
  87. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.js +0 -22
  88. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.spec.js +0 -41
@@ -319,7 +319,7 @@ var init_invalid_operator_value_error = __esm({
319
319
  constructor(operator, expected, value) {
320
320
  super(
321
321
  (0, import_js_format3.format)(
322
- "Condition of {%s: ...} should have %s, but %v given.",
322
+ "Condition of {%s: ...} should have %s, but %v was given.",
323
323
  operator,
324
324
  expected,
325
325
  value
@@ -346,18 +346,18 @@ var init_errors = __esm({
346
346
  function selectObjectKeys(obj, keys) {
347
347
  if (!obj || typeof obj !== "object" || Array.isArray(obj))
348
348
  throw new InvalidArgumentError(
349
- "The first argument of selectObjectKeys should be an Object, but %v given.",
349
+ "The first argument of selectObjectKeys should be an Object, but %v was given.",
350
350
  obj
351
351
  );
352
352
  if (!Array.isArray(keys))
353
353
  throw new InvalidArgumentError(
354
- "The second argument of selectObjectKeys should be an Array of String, but %v given.",
354
+ "The second argument of selectObjectKeys should be an Array of String, but %v was given.",
355
355
  keys
356
356
  );
357
357
  keys.forEach((key) => {
358
358
  if (typeof key !== "string")
359
359
  throw new InvalidArgumentError(
360
- "The second argument of selectObjectKeys should be an Array of String, but %v given.",
360
+ "The second argument of selectObjectKeys should be an Array of String, but %v was given.",
361
361
  key
362
362
  );
363
363
  });
@@ -380,7 +380,7 @@ var init_select_object_keys = __esm({
380
380
  function excludeObjectKeys(obj, keys) {
381
381
  if (typeof obj !== "object" || !obj || Array.isArray(obj))
382
382
  throw new InvalidArgumentError(
383
- "Cannot exclude keys from a non-Object value, %v given.",
383
+ "Cannot exclude keys from a non-Object value, %v was given.",
384
384
  obj
385
385
  );
386
386
  const result = { ...obj };
@@ -400,7 +400,7 @@ var init_exclude_object_keys = __esm({
400
400
  function modelNameToModelKey(modelName) {
401
401
  if (!modelName || typeof modelName !== "string" || /\s/.test(modelName))
402
402
  throw new InvalidArgumentError(
403
- "The model name should be a non-empty String without spaces, but %v given.",
403
+ "The model name should be a non-empty String without spaces, but %v was given.",
404
404
  modelName
405
405
  );
406
406
  return modelName.toLowerCase().replace(/[-_]/g, "");
@@ -493,17 +493,17 @@ var init_slice_clause_tool = __esm({
493
493
  slice(entities, skip = void 0, limit = void 0) {
494
494
  if (!Array.isArray(entities))
495
495
  throw new InvalidArgumentError(
496
- "The first argument of SliceClauseTool.slice should be an Array, but %v given.",
496
+ "The first argument of SliceClauseTool.slice should be an Array, but %v was given.",
497
497
  entities
498
498
  );
499
499
  if (skip != null && typeof skip !== "number")
500
500
  throw new InvalidArgumentError(
501
- 'The provided option "skip" should be a Number, but %v given.',
501
+ 'The provided option "skip" should be a Number, but %v was given.',
502
502
  skip
503
503
  );
504
504
  if (limit != null && typeof limit !== "number")
505
505
  throw new InvalidArgumentError(
506
- 'The provided option "limit" should be a Number, but %v given.',
506
+ 'The provided option "limit" should be a Number, but %v was given.',
507
507
  limit
508
508
  );
509
509
  skip = skip || 0;
@@ -519,7 +519,7 @@ var init_slice_clause_tool = __esm({
519
519
  if (skip == null) return;
520
520
  if (typeof skip !== "number")
521
521
  throw new InvalidArgumentError(
522
- 'The provided option "skip" should be a Number, but %v given.',
522
+ 'The provided option "skip" should be a Number, but %v was given.',
523
523
  skip
524
524
  );
525
525
  }
@@ -532,7 +532,7 @@ var init_slice_clause_tool = __esm({
532
532
  if (limit == null) return;
533
533
  if (typeof limit !== "number")
534
534
  throw new InvalidArgumentError(
535
- 'The provided option "limit" should be a Number, but %v given.',
535
+ 'The provided option "limit" should be a Number, but %v was given.',
536
536
  limit
537
537
  );
538
538
  }
@@ -580,7 +580,7 @@ var init_order_clause_tool = __esm({
580
580
  clause.forEach((key, index) => {
581
581
  if (!key || typeof key !== "string")
582
582
  throw new InvalidArgumentError(
583
- 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
583
+ 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v was given.',
584
584
  key
585
585
  );
586
586
  let reverse = 1;
@@ -605,7 +605,7 @@ var init_order_clause_tool = __esm({
605
605
  clause.forEach((field) => {
606
606
  if (!field || typeof field !== "string")
607
607
  throw new InvalidArgumentError(
608
- 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
608
+ 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v was given.',
609
609
  field
610
610
  );
611
611
  });
@@ -623,7 +623,7 @@ var init_order_clause_tool = __esm({
623
623
  clause.forEach((field) => {
624
624
  if (!field || typeof field !== "string")
625
625
  throw new InvalidArgumentError(
626
- 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
626
+ 'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v was given.',
627
627
  field
628
628
  );
629
629
  });
@@ -690,7 +690,7 @@ var init_operator_clause_tool = __esm({
690
690
  testAll(clause, value) {
691
691
  if (!clause || typeof clause !== "object" || Array.isArray(clause))
692
692
  throw new InvalidArgumentError(
693
- "The first argument of OperatorUtils.testAll should be an Object, but %v given.",
693
+ "The first argument of OperatorUtils.testAll should be an Object, but %v was given.",
694
694
  clause
695
695
  );
696
696
  const eqNeqTest = this.testEqNeq(clause, value);
@@ -740,7 +740,7 @@ var init_operator_clause_tool = __esm({
740
740
  testEqNeq(clause, value) {
741
741
  if (!clause || typeof clause !== "object")
742
742
  throw new InvalidArgumentError(
743
- "The first argument of OperatorUtils.testEqNeq should be an Object, but %v given.",
743
+ "The first argument of OperatorUtils.testEqNeq should be an Object, but %v was given.",
744
744
  clause
745
745
  );
746
746
  if ("eq" in clause) return this.compare(clause.eq, value) === 0;
@@ -784,7 +784,7 @@ var init_operator_clause_tool = __esm({
784
784
  testGtLt(clause, value) {
785
785
  if (!clause || typeof clause !== "object")
786
786
  throw new InvalidArgumentError(
787
- "The first argument of OperatorUtils.testGtLt should be an Object, but %v given.",
787
+ "The first argument of OperatorUtils.testGtLt should be an Object, but %v was given.",
788
788
  clause
789
789
  );
790
790
  if ("gt" in clause) return this.compare(value, clause.gt) > 0;
@@ -809,7 +809,7 @@ var init_operator_clause_tool = __esm({
809
809
  testInq(clause, value) {
810
810
  if (!clause || typeof clause !== "object")
811
811
  throw new InvalidArgumentError(
812
- "The first argument of OperatorUtils.testInq should be an Object, but %v given.",
812
+ "The first argument of OperatorUtils.testInq should be an Object, but %v was given.",
813
813
  clause
814
814
  );
815
815
  if ("inq" in clause && clause.inq !== void 0) {
@@ -843,7 +843,7 @@ var init_operator_clause_tool = __esm({
843
843
  testNin(clause, value) {
844
844
  if (!clause || typeof clause !== "object")
845
845
  throw new InvalidArgumentError(
846
- "The first argument of OperatorUtils.testNin should be an Object, but %v given.",
846
+ "The first argument of OperatorUtils.testNin should be an Object, but %v was given.",
847
847
  clause
848
848
  );
849
849
  if ("nin" in clause && clause.nin !== void 0) {
@@ -877,7 +877,7 @@ var init_operator_clause_tool = __esm({
877
877
  testBetween(clause, value) {
878
878
  if (!clause || typeof clause !== "object")
879
879
  throw new InvalidArgumentError(
880
- "The first argument of OperatorUtils.testBetween should be an Object, but %v given.",
880
+ "The first argument of OperatorUtils.testBetween should be an Object, but %v was given.",
881
881
  clause
882
882
  );
883
883
  if ("between" in clause && clause.between !== void 0) {
@@ -908,7 +908,7 @@ var init_operator_clause_tool = __esm({
908
908
  testExists(clause, value) {
909
909
  if (!clause || typeof clause !== "object")
910
910
  throw new InvalidArgumentError(
911
- "The first argument of OperatorUtils.testExists should be an Object, but %v given.",
911
+ "The first argument of OperatorUtils.testExists should be an Object, but %v was given.",
912
912
  clause
913
913
  );
914
914
  if ("exists" in clause && clause.exists !== void 0) {
@@ -939,7 +939,7 @@ var init_operator_clause_tool = __esm({
939
939
  testLike(clause, value) {
940
940
  if (!clause || typeof clause !== "object")
941
941
  throw new InvalidArgumentError(
942
- "The first argument of OperatorUtils.testLike should be an Object, but %v given.",
942
+ "The first argument of OperatorUtils.testLike should be an Object, but %v was given.",
943
943
  clause
944
944
  );
945
945
  if ("like" in clause && clause.like !== void 0) {
@@ -965,7 +965,7 @@ var init_operator_clause_tool = __esm({
965
965
  testNlike(clause, value) {
966
966
  if (!clause || typeof clause !== "object")
967
967
  throw new InvalidArgumentError(
968
- "The first argument of OperatorUtils.testNlike should be an Object, but %v given.",
968
+ "The first argument of OperatorUtils.testNlike should be an Object, but %v was given.",
969
969
  clause
970
970
  );
971
971
  if ("nlike" in clause && clause.nlike !== void 0) {
@@ -992,7 +992,7 @@ var init_operator_clause_tool = __esm({
992
992
  testIlike(clause, value) {
993
993
  if (!clause || typeof clause !== "object")
994
994
  throw new InvalidArgumentError(
995
- "The first argument of OperatorUtils.testIlike should be an Object, but %v given.",
995
+ "The first argument of OperatorUtils.testIlike should be an Object, but %v was given.",
996
996
  clause
997
997
  );
998
998
  if ("ilike" in clause && clause.ilike !== void 0) {
@@ -1019,7 +1019,7 @@ var init_operator_clause_tool = __esm({
1019
1019
  testNilike(clause, value) {
1020
1020
  if (!clause || typeof clause !== "object")
1021
1021
  throw new InvalidArgumentError(
1022
- "The first argument of OperatorUtils.testNilike should be an Object, but %v given.",
1022
+ "The first argument of OperatorUtils.testNilike should be an Object, but %v was given.",
1023
1023
  clause
1024
1024
  );
1025
1025
  if ("nilike" in clause && clause.nilike !== void 0) {
@@ -1058,7 +1058,7 @@ var init_operator_clause_tool = __esm({
1058
1058
  testRegexp(clause, value) {
1059
1059
  if (!clause || typeof clause !== "object")
1060
1060
  throw new InvalidArgumentError(
1061
- "The first argument of OperatorUtils.testRegexp should be an Object, but %v given.",
1061
+ "The first argument of OperatorUtils.testRegexp should be an Object, but %v was given.",
1062
1062
  clause
1063
1063
  );
1064
1064
  if ("regexp" in clause && clause.regexp !== void 0) {
@@ -1072,7 +1072,7 @@ var init_operator_clause_tool = __esm({
1072
1072
  const flags = clause.flags || void 0;
1073
1073
  if (flags && typeof flags !== "string")
1074
1074
  throw new InvalidArgumentError(
1075
- "RegExp flags should be a String, but %v given.",
1075
+ "RegExp flags should be a String, but %v was given.",
1076
1076
  clause.flags
1077
1077
  );
1078
1078
  if (!value || typeof value !== "string") return false;
@@ -1128,7 +1128,7 @@ var init_where_clause_tool = __esm({
1128
1128
  filter(entities, where = void 0) {
1129
1129
  if (!Array.isArray(entities))
1130
1130
  throw new InvalidArgumentError(
1131
- "The first argument of WhereClauseTool.filter should be an Array of Object, but %v given.",
1131
+ "The first argument of WhereClauseTool.filter should be an Array of Object, but %v was given.",
1132
1132
  entities
1133
1133
  );
1134
1134
  if (where == null) return entities;
@@ -1143,14 +1143,14 @@ var init_where_clause_tool = __esm({
1143
1143
  _createFilter(whereClause) {
1144
1144
  if (typeof whereClause !== "object" || Array.isArray(whereClause))
1145
1145
  throw new InvalidArgumentError(
1146
- 'The provided option "where" should be an Object, but %v given.',
1146
+ 'The provided option "where" should be an Object, but %v was given.',
1147
1147
  whereClause
1148
1148
  );
1149
1149
  const keys = Object.keys(whereClause);
1150
1150
  return (data) => {
1151
1151
  if (typeof data !== "object")
1152
1152
  throw new InvalidArgumentError(
1153
- "The first argument of WhereClauseTool.filter should be an Array of Object, but %v given.",
1153
+ "The first argument of WhereClauseTool.filter should be an Array of Object, but %v was given.",
1154
1154
  data
1155
1155
  );
1156
1156
  return keys.every((key) => {
@@ -1220,7 +1220,7 @@ var init_where_clause_tool = __esm({
1220
1220
  if (clause == null || typeof clause === "function") return;
1221
1221
  if (typeof clause !== "object" || Array.isArray(clause))
1222
1222
  throw new InvalidArgumentError(
1223
- 'The provided option "where" should be an Object, but %v given.',
1223
+ 'The provided option "where" should be an Object, but %v was given.',
1224
1224
  clause
1225
1225
  );
1226
1226
  }
@@ -1270,12 +1270,12 @@ var init_relations_definition_validator = __esm({
1270
1270
  validate(modelName, relDefs) {
1271
1271
  if (!modelName || typeof modelName !== "string")
1272
1272
  throw new InvalidArgumentError(
1273
- "The first argument of RelationsDefinitionValidator.validate should be a non-empty String, but %v given.",
1273
+ "The first argument of RelationsDefinitionValidator.validate should be a non-empty String, but %v was given.",
1274
1274
  modelName
1275
1275
  );
1276
1276
  if (!relDefs || typeof relDefs !== "object" || Array.isArray(relDefs))
1277
1277
  throw new InvalidArgumentError(
1278
- 'The provided option "relations" of the model %v should be an Object, but %v given.',
1278
+ 'The provided option "relations" of the model %v should be an Object, but %v was given.',
1279
1279
  modelName,
1280
1280
  relDefs
1281
1281
  );
@@ -1295,25 +1295,25 @@ var init_relations_definition_validator = __esm({
1295
1295
  _validateRelation(modelName, relName, relDef) {
1296
1296
  if (!modelName || typeof modelName !== "string")
1297
1297
  throw new InvalidArgumentError(
1298
- "The first argument of RelationsDefinitionValidator._validateRelation should be a non-empty String, but %v given.",
1298
+ "The first argument of RelationsDefinitionValidator._validateRelation should be a non-empty String, but %v was given.",
1299
1299
  modelName
1300
1300
  );
1301
1301
  if (!relName || typeof relName !== "string")
1302
1302
  throw new InvalidArgumentError(
1303
- "The relation name of the model %v should be a non-empty String, but %v given.",
1303
+ "The relation name of the model %v should be a non-empty String, but %v was given.",
1304
1304
  modelName,
1305
1305
  relName
1306
1306
  );
1307
1307
  if (!relDef || typeof relDef !== "object" || Array.isArray(relDef))
1308
1308
  throw new InvalidArgumentError(
1309
- "The relation %v of the model %v should be an Object, but %v given.",
1309
+ "The relation %v of the model %v should be an Object, but %v was given.",
1310
1310
  relName,
1311
1311
  modelName,
1312
1312
  relDef
1313
1313
  );
1314
1314
  if (!relDef.type || !Object.values(RelationType).includes(relDef.type))
1315
1315
  throw new InvalidArgumentError(
1316
- 'The relation %v of the model %v requires the option "type" to have one of relation types: %l, but %v given.',
1316
+ 'The relation %v of the model %v requires the option "type" to have one of relation types: %l, but %v was given.',
1317
1317
  relName,
1318
1318
  modelName,
1319
1319
  Object.values(RelationType),
@@ -1356,21 +1356,21 @@ var init_relations_definition_validator = __esm({
1356
1356
  if (relDef.polymorphic) {
1357
1357
  if (typeof relDef.polymorphic !== "boolean")
1358
1358
  throw new InvalidArgumentError(
1359
- 'The relation %v of the model %v has the type "belongsTo", so it expects the option "polymorphic" to be a Boolean, but %v given.',
1359
+ '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.',
1360
1360
  relName,
1361
1361
  modelName,
1362
1362
  relDef.polymorphic
1363
1363
  );
1364
1364
  if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
1365
1365
  throw new InvalidArgumentError(
1366
- '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 given.',
1366
+ '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.',
1367
1367
  relName,
1368
1368
  modelName,
1369
1369
  relDef.foreignKey
1370
1370
  );
1371
1371
  if (relDef.discriminator && typeof relDef.discriminator !== "string")
1372
1372
  throw new InvalidArgumentError(
1373
- '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 given.',
1373
+ '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.',
1374
1374
  relName,
1375
1375
  modelName,
1376
1376
  relDef.discriminator
@@ -1378,14 +1378,14 @@ var init_relations_definition_validator = __esm({
1378
1378
  } else {
1379
1379
  if (!relDef.model || typeof relDef.model !== "string")
1380
1380
  throw new InvalidArgumentError(
1381
- '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 given.',
1381
+ '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.',
1382
1382
  relName,
1383
1383
  modelName,
1384
1384
  relDef.model
1385
1385
  );
1386
1386
  if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
1387
1387
  throw new InvalidArgumentError(
1388
- 'The relation %v of the model %v has the type "belongsTo", so it expects the provided option "foreignKey" to be a String, but %v given.',
1388
+ '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.',
1389
1389
  relName,
1390
1390
  modelName,
1391
1391
  relDef.foreignKey
@@ -1439,7 +1439,7 @@ var init_relations_definition_validator = __esm({
1439
1439
  if (relDef.type !== RelationType.HAS_ONE) return;
1440
1440
  if (!relDef.model || typeof relDef.model !== "string")
1441
1441
  throw new InvalidArgumentError(
1442
- '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 given.',
1442
+ '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.',
1443
1443
  relName,
1444
1444
  modelName,
1445
1445
  relDef.model
@@ -1461,21 +1461,21 @@ var init_relations_definition_validator = __esm({
1461
1461
  } else if (typeof relDef.polymorphic === "boolean") {
1462
1462
  if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
1463
1463
  throw new InvalidArgumentError(
1464
- '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 given.',
1464
+ '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.',
1465
1465
  relName,
1466
1466
  modelName,
1467
1467
  relDef.foreignKey
1468
1468
  );
1469
1469
  if (!relDef.discriminator || typeof relDef.discriminator !== "string")
1470
1470
  throw new InvalidArgumentError(
1471
- '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 given.',
1471
+ '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.',
1472
1472
  relName,
1473
1473
  modelName,
1474
1474
  relDef.discriminator
1475
1475
  );
1476
1476
  } else {
1477
1477
  throw new InvalidArgumentError(
1478
- '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 given.',
1478
+ '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.',
1479
1479
  relName,
1480
1480
  modelName,
1481
1481
  relDef.polymorphic
@@ -1484,7 +1484,7 @@ var init_relations_definition_validator = __esm({
1484
1484
  } else {
1485
1485
  if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
1486
1486
  throw new InvalidArgumentError(
1487
- '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 given.',
1487
+ '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.',
1488
1488
  relName,
1489
1489
  modelName,
1490
1490
  relDef.foreignKey
@@ -1538,7 +1538,7 @@ var init_relations_definition_validator = __esm({
1538
1538
  if (relDef.type !== RelationType.HAS_MANY) return;
1539
1539
  if (!relDef.model || typeof relDef.model !== "string")
1540
1540
  throw new InvalidArgumentError(
1541
- '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 given.',
1541
+ '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.',
1542
1542
  relName,
1543
1543
  modelName,
1544
1544
  relDef.model
@@ -1560,21 +1560,21 @@ var init_relations_definition_validator = __esm({
1560
1560
  } else if (typeof relDef.polymorphic === "boolean") {
1561
1561
  if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
1562
1562
  throw new InvalidArgumentError(
1563
- '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 given.',
1563
+ '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.',
1564
1564
  relName,
1565
1565
  modelName,
1566
1566
  relDef.foreignKey
1567
1567
  );
1568
1568
  if (!relDef.discriminator || typeof relDef.discriminator !== "string")
1569
1569
  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 given.',
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.',
1571
1571
  relName,
1572
1572
  modelName,
1573
1573
  relDef.discriminator
1574
1574
  );
1575
1575
  } else {
1576
1576
  throw new InvalidArgumentError(
1577
- '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 given.',
1577
+ '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.',
1578
1578
  relName,
1579
1579
  modelName,
1580
1580
  relDef.polymorphic
@@ -1583,7 +1583,7 @@ var init_relations_definition_validator = __esm({
1583
1583
  } else {
1584
1584
  if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
1585
1585
  throw new InvalidArgumentError(
1586
- '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 given.',
1586
+ '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.',
1587
1587
  relName,
1588
1588
  modelName,
1589
1589
  relDef.foreignKey
@@ -1617,14 +1617,14 @@ var init_relations_definition_validator = __esm({
1617
1617
  if (relDef.type !== RelationType.REFERENCES_MANY) return;
1618
1618
  if (!relDef.model || typeof relDef.model !== "string")
1619
1619
  throw new InvalidArgumentError(
1620
- '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 given.',
1620
+ '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.',
1621
1621
  relName,
1622
1622
  modelName,
1623
1623
  relDef.model
1624
1624
  );
1625
1625
  if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
1626
1626
  throw new InvalidArgumentError(
1627
- 'The relation %v of the model %v has the type "referencesMany", so it expects the provided option "foreignKey" to be a String, but %v given.',
1627
+ '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.',
1628
1628
  relName,
1629
1629
  modelName,
1630
1630
  relDef.foreignKey
@@ -1700,7 +1700,7 @@ function regexpValidator(value, options, context) {
1700
1700
  if (value == null || options === false) return true;
1701
1701
  if (typeof options !== "string" && !(options instanceof RegExp))
1702
1702
  throw new InvalidArgumentError(
1703
- 'The validator %v requires the "options" argument as a String or RegExp, but %v given.',
1703
+ 'The validator %v requires the "options" argument as a String or RegExp, but %v was given.',
1704
1704
  context.validatorName,
1705
1705
  options
1706
1706
  );
@@ -1709,7 +1709,7 @@ function regexpValidator(value, options, context) {
1709
1709
  return regexp.test(value);
1710
1710
  }
1711
1711
  throw new InvalidArgumentError(
1712
- "The property validator %v requires a String value, but %v given.",
1712
+ "The property validator %v requires a String value, but %v was given.",
1713
1713
  context.validatorName,
1714
1714
  value
1715
1715
  );
@@ -1728,14 +1728,14 @@ function maxLengthValidator(value, options, context) {
1728
1728
  if (value == null || options === false) return true;
1729
1729
  if (typeof options !== "number")
1730
1730
  throw new InvalidArgumentError(
1731
- 'The validator %v requires the "options" argument as a Number, but %v given.',
1731
+ 'The validator %v requires the "options" argument as a Number, but %v was given.',
1732
1732
  context.validatorName,
1733
1733
  options
1734
1734
  );
1735
1735
  if (typeof value === "string" || Array.isArray(value))
1736
1736
  return value.length <= options;
1737
1737
  throw new InvalidArgumentError(
1738
- "The property validator %v requires a String or an Array value, but %v given.",
1738
+ "The property validator %v requires a String or an Array value, but %v was given.",
1739
1739
  context.validatorName,
1740
1740
  value
1741
1741
  );
@@ -1753,14 +1753,14 @@ function minLengthValidator(value, options, context) {
1753
1753
  if (value == null || options === false) return true;
1754
1754
  if (typeof options !== "number")
1755
1755
  throw new InvalidArgumentError(
1756
- 'The validator %v requires the "options" argument as a Number, but %v given.',
1756
+ 'The validator %v requires the "options" argument as a Number, but %v was given.',
1757
1757
  context.validatorName,
1758
1758
  options
1759
1759
  );
1760
1760
  if (typeof value === "string" || Array.isArray(value))
1761
1761
  return value.length >= options;
1762
1762
  throw new InvalidArgumentError(
1763
- "The property validator %v requires a String or an Array value, but %v given.",
1763
+ "The property validator %v requires a String or an Array value, but %v was given.",
1764
1764
  context.validatorName,
1765
1765
  value
1766
1766
  );
@@ -1814,7 +1814,7 @@ var init_property_validator_registry = __esm({
1814
1814
  addValidator(name, validator) {
1815
1815
  if (!name || typeof name !== "string")
1816
1816
  throw new InvalidArgumentError(
1817
- "A name of the property validator must be a non-empty String, but %v given.",
1817
+ "A name of the property validator must be a non-empty String, but %v was given.",
1818
1818
  name
1819
1819
  );
1820
1820
  if (name in this._validators)
@@ -1824,7 +1824,7 @@ var init_property_validator_registry = __esm({
1824
1824
  );
1825
1825
  if (typeof validator !== "function")
1826
1826
  throw new InvalidArgumentError(
1827
- "The property validator %v must be a Function, but %v given.",
1827
+ "The property validator %v must be a Function, but %v was given.",
1828
1828
  name,
1829
1829
  validator
1830
1830
  );
@@ -1882,7 +1882,7 @@ function trimTransformer(value, options, context) {
1882
1882
  if (value == null) return value;
1883
1883
  if (typeof value === "string") return value.trim();
1884
1884
  throw new InvalidArgumentError(
1885
- "The property transformer %v requires a String value, but %v given.",
1885
+ "The property transformer %v requires a String value, but %v was given.",
1886
1886
  context.transformerName,
1887
1887
  value
1888
1888
  );
@@ -1900,7 +1900,7 @@ function toLowerCaseTransformer(value, options, context) {
1900
1900
  if (value == null) return value;
1901
1901
  if (typeof value === "string") return value.toLowerCase();
1902
1902
  throw new InvalidArgumentError(
1903
- "The property transformer %v requires a String value, but %v given.",
1903
+ "The property transformer %v requires a String value, but %v was given.",
1904
1904
  context.transformerName,
1905
1905
  value
1906
1906
  );
@@ -1918,7 +1918,7 @@ function toUpperCaseTransformer(value, options, context) {
1918
1918
  if (value == null) return value;
1919
1919
  if (typeof value === "string") return value.toUpperCase();
1920
1920
  throw new InvalidArgumentError(
1921
- "The property transformer %v requires a String value, but %v given.",
1921
+ "The property transformer %v requires a String value, but %v was given.",
1922
1922
  context.transformerName,
1923
1923
  value
1924
1924
  );
@@ -1931,27 +1931,6 @@ var init_to_upper_case_transformer = __esm({
1931
1931
  }
1932
1932
  });
1933
1933
 
1934
- // src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.js
1935
- function toTitleCaseTransformer(value, options, context) {
1936
- if (value == null) return value;
1937
- if (typeof value === "string")
1938
- return value.replace(new RegExp("\\p{L}\\S*", "gu"), (text) => {
1939
- return text.charAt(0).toUpperCase() + text.substring(1).toLowerCase();
1940
- });
1941
- throw new InvalidArgumentError(
1942
- "The property transformer %v requires a String value, but %v given.",
1943
- context.transformerName,
1944
- value
1945
- );
1946
- }
1947
- var init_to_title_case_transformer = __esm({
1948
- "src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.js"() {
1949
- "use strict";
1950
- init_errors();
1951
- __name(toTitleCaseTransformer, "toTitleCaseTransformer");
1952
- }
1953
- });
1954
-
1955
1934
  // src/definition/model/properties/property-transformer/builtin/index.js
1956
1935
  var init_builtin2 = __esm({
1957
1936
  "src/definition/model/properties/property-transformer/builtin/index.js"() {
@@ -1959,7 +1938,6 @@ var init_builtin2 = __esm({
1959
1938
  init_trim_transformer();
1960
1939
  init_to_lower_case_transformer();
1961
1940
  init_to_upper_case_transformer();
1962
- init_to_title_case_transformer();
1963
1941
  }
1964
1942
  });
1965
1943
 
@@ -1972,7 +1950,6 @@ var init_property_transformer_registry = __esm({
1972
1950
  init_builtin2();
1973
1951
  init_builtin2();
1974
1952
  init_builtin2();
1975
- init_builtin2();
1976
1953
  init_errors();
1977
1954
  _PropertyTransformerRegistry = class _PropertyTransformerRegistry extends import_js_service7.Service {
1978
1955
  /**
@@ -1983,8 +1960,7 @@ var init_property_transformer_registry = __esm({
1983
1960
  _transformers = {
1984
1961
  trim: trimTransformer,
1985
1962
  toUpperCase: toUpperCaseTransformer,
1986
- toLowerCase: toLowerCaseTransformer,
1987
- toTitleCase: toTitleCaseTransformer
1963
+ toLowerCase: toLowerCaseTransformer
1988
1964
  };
1989
1965
  /**
1990
1966
  * Add transformer.
@@ -1996,7 +1972,7 @@ var init_property_transformer_registry = __esm({
1996
1972
  addTransformer(name, transformer) {
1997
1973
  if (!name || typeof name !== "string")
1998
1974
  throw new InvalidArgumentError(
1999
- "A name of the property transformer must be a non-empty String, but %v given.",
1975
+ "A name of the property transformer must be a non-empty String, but %v was given.",
2000
1976
  name
2001
1977
  );
2002
1978
  if (name in this._transformers)
@@ -2006,7 +1982,7 @@ var init_property_transformer_registry = __esm({
2006
1982
  );
2007
1983
  if (typeof transformer !== "function")
2008
1984
  throw new InvalidArgumentError(
2009
- "The property transformer %v must be a Function, but %v given.",
1985
+ "The property transformer %v must be a Function, but %v was given.",
2010
1986
  name,
2011
1987
  transformer
2012
1988
  );
@@ -2386,7 +2362,7 @@ var init_model_definition_utils = __esm({
2386
2362
  getDataTypeFromPropertyDefinition(propDef) {
2387
2363
  if ((!propDef || typeof propDef !== "object") && !Object.values(DataType).includes(propDef)) {
2388
2364
  throw new InvalidArgumentError(
2389
- 'The argument "propDef" of the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should be an Object or the DataType enum, but %v given.',
2365
+ 'The argument "propDef" of the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should be an Object or the DataType enum, but %v was given.',
2390
2366
  propDef
2391
2367
  );
2392
2368
  }
@@ -2394,7 +2370,7 @@ var init_model_definition_utils = __esm({
2394
2370
  const dataType = propDef.type;
2395
2371
  if (!Object.values(DataType).includes(dataType))
2396
2372
  throw new InvalidArgumentError(
2397
- 'The given Object to the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should have the "type" property with one of values: %l, but %v given.',
2373
+ 'The given Object to the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should have the "type" property with one of values: %l, but %v was given.',
2398
2374
  Object.values(DataType),
2399
2375
  propDef.type
2400
2376
  );
@@ -2528,7 +2504,7 @@ var init_model_definition_utils = __esm({
2528
2504
  excludeObjectKeysByRelationNames(modelName, modelData) {
2529
2505
  if (!modelData || typeof modelData !== "object" || Array.isArray(modelData))
2530
2506
  throw new InvalidArgumentError(
2531
- "The second argument of ModelDefinitionUtils.excludeObjectKeysByRelationNames should be an Object, but %v given.",
2507
+ "The second argument of ModelDefinitionUtils.excludeObjectKeysByRelationNames should be an Object, but %v was given.",
2532
2508
  modelData
2533
2509
  );
2534
2510
  const relDefs = this.getRelationsDefinitionInBaseModelHierarchy(modelName);
@@ -2545,12 +2521,12 @@ var init_model_definition_utils = __esm({
2545
2521
  getModelNameOfPropertyValueIfDefined(modelName, propertyName) {
2546
2522
  if (!modelName || typeof modelName !== "string")
2547
2523
  throw new InvalidArgumentError(
2548
- 'Parameter "modelName" of ModelDefinitionUtils.getModelNameOfPropertyValueIfDefined requires a non-empty String, but %v given.',
2524
+ 'Parameter "modelName" of ModelDefinitionUtils.getModelNameOfPropertyValueIfDefined requires a non-empty String, but %v was given.',
2549
2525
  modelName
2550
2526
  );
2551
2527
  if (!propertyName || typeof propertyName !== "string")
2552
2528
  throw new InvalidArgumentError(
2553
- 'Parameter "propertyName" of ModelDefinitionUtils.getModelNameOfPropertyValueIfDefined requires a non-empty String, but %v given.',
2529
+ 'Parameter "propertyName" of ModelDefinitionUtils.getModelNameOfPropertyValueIfDefined requires a non-empty String, but %v was given.',
2554
2530
  propertyName
2555
2531
  );
2556
2532
  const propDefs = this.getPropertiesDefinitionInBaseModelHierarchy(modelName);
@@ -2595,22 +2571,22 @@ var init_property_uniqueness_validator = __esm({
2595
2571
  async validate(countMethod, methodName, modelName, modelData, modelId = void 0) {
2596
2572
  if (typeof countMethod !== "function")
2597
2573
  throw new InvalidArgumentError(
2598
- 'The parameter "countMethod" of the PropertyUniquenessValidator must be a Function, but %v given.',
2574
+ 'The parameter "countMethod" of the PropertyUniquenessValidator must be a Function, but %v was given.',
2599
2575
  countMethod
2600
2576
  );
2601
2577
  if (!methodName || typeof methodName !== "string")
2602
2578
  throw new InvalidArgumentError(
2603
- 'The parameter "methodName" of the PropertyUniquenessValidator must be a non-empty String, but %v given.',
2579
+ 'The parameter "methodName" of the PropertyUniquenessValidator must be a non-empty String, but %v was given.',
2604
2580
  methodName
2605
2581
  );
2606
2582
  if (!modelName || typeof modelName !== "string")
2607
2583
  throw new InvalidArgumentError(
2608
- 'The parameter "modelName" of the PropertyUniquenessValidator must be a non-empty String, but %v given.',
2584
+ 'The parameter "modelName" of the PropertyUniquenessValidator must be a non-empty String, but %v was given.',
2609
2585
  modelName
2610
2586
  );
2611
2587
  if (!isPureObject(modelData))
2612
2588
  throw new InvalidArgumentError(
2613
- "The data of the model %v should be an Object, but %v given.",
2589
+ "The data of the model %v should be an Object, but %v was given.",
2614
2590
  modelName,
2615
2591
  modelData
2616
2592
  );
@@ -2764,12 +2740,12 @@ var init_properties_definition_validator = __esm({
2764
2740
  validate(modelName, propDefs) {
2765
2741
  if (!modelName || typeof modelName !== "string")
2766
2742
  throw new InvalidArgumentError(
2767
- "The first argument of PropertiesDefinitionValidator.validate should be a non-empty String, but %v given.",
2743
+ "The first argument of PropertiesDefinitionValidator.validate should be a non-empty String, but %v was given.",
2768
2744
  modelName
2769
2745
  );
2770
2746
  if (!propDefs || typeof propDefs !== "object" || Array.isArray(propDefs)) {
2771
2747
  throw new InvalidArgumentError(
2772
- 'The provided option "properties" of the model %v should be an Object, but %v given.',
2748
+ 'The provided option "properties" of the model %v should be an Object, but %v was given.',
2773
2749
  modelName,
2774
2750
  propDefs
2775
2751
  );
@@ -2794,18 +2770,18 @@ var init_properties_definition_validator = __esm({
2794
2770
  _validateProperty(modelName, propName, propDef) {
2795
2771
  if (!modelName || typeof modelName !== "string")
2796
2772
  throw new InvalidArgumentError(
2797
- "The first argument of PropertiesDefinitionValidator._validateProperty should be a non-empty String, but %v given.",
2773
+ "The first argument of PropertiesDefinitionValidator._validateProperty should be a non-empty String, but %v was given.",
2798
2774
  modelName
2799
2775
  );
2800
2776
  if (!propName || typeof propName !== "string")
2801
2777
  throw new InvalidArgumentError(
2802
- "The property name of the model %v should be a non-empty String, but %v given.",
2778
+ "The property name of the model %v should be a non-empty String, but %v was given.",
2803
2779
  modelName,
2804
2780
  propName
2805
2781
  );
2806
2782
  if (!propDef)
2807
2783
  throw new InvalidArgumentError(
2808
- "The property %v of the model %v should have a property definition, but %v given.",
2784
+ "The property %v of the model %v should have a property definition, but %v was given.",
2809
2785
  propName,
2810
2786
  modelName,
2811
2787
  propDef
@@ -2813,7 +2789,7 @@ var init_properties_definition_validator = __esm({
2813
2789
  if (typeof propDef === "string") {
2814
2790
  if (!Object.values(DataType).includes(propDef))
2815
2791
  throw new InvalidArgumentError(
2816
- "In case of a short property definition, the property %v of the model %v should have one of data types: %l, but %v given.",
2792
+ "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.",
2817
2793
  propName,
2818
2794
  modelName,
2819
2795
  Object.values(DataType),
@@ -2823,7 +2799,7 @@ var init_properties_definition_validator = __esm({
2823
2799
  }
2824
2800
  if (!propDef || typeof propDef !== "object" || Array.isArray(propDef)) {
2825
2801
  throw new InvalidArgumentError(
2826
- "In case of a full property definition, the property %v of the model %v should be an Object, but %v given.",
2802
+ "In case of a full property definition, the property %v of the model %v should be an Object, but %v was given.",
2827
2803
  propName,
2828
2804
  modelName,
2829
2805
  propDef
@@ -2831,7 +2807,7 @@ var init_properties_definition_validator = __esm({
2831
2807
  }
2832
2808
  if (!propDef.type || !Object.values(DataType).includes(propDef.type))
2833
2809
  throw new InvalidArgumentError(
2834
- 'The property %v of the model %v requires the option "type" to have one of data types: %l, but %v given.',
2810
+ 'The property %v of the model %v requires the option "type" to have one of data types: %l, but %v was given.',
2835
2811
  propName,
2836
2812
  modelName,
2837
2813
  Object.values(DataType),
@@ -2839,7 +2815,7 @@ var init_properties_definition_validator = __esm({
2839
2815
  );
2840
2816
  if (propDef.itemType && !Object.values(DataType).includes(propDef.itemType)) {
2841
2817
  throw new InvalidArgumentError(
2842
- 'The provided option "itemType" of the property %v in the model %v should have one of data types: %l, but %v given.',
2818
+ 'The provided option "itemType" of the property %v in the model %v should have one of data types: %l, but %v was given.',
2843
2819
  propName,
2844
2820
  modelName,
2845
2821
  Object.values(DataType),
@@ -2848,7 +2824,7 @@ var init_properties_definition_validator = __esm({
2848
2824
  }
2849
2825
  if (propDef.itemModel && typeof propDef.itemModel !== "string") {
2850
2826
  throw new InvalidArgumentError(
2851
- 'The provided option "itemModel" of the property %v in the model %v should be a String, but %v given.',
2827
+ 'The provided option "itemModel" of the property %v in the model %v should be a String, but %v was given.',
2852
2828
  propName,
2853
2829
  modelName,
2854
2830
  propDef.itemModel
@@ -2856,35 +2832,35 @@ var init_properties_definition_validator = __esm({
2856
2832
  }
2857
2833
  if (propDef.model && typeof propDef.model !== "string")
2858
2834
  throw new InvalidArgumentError(
2859
- 'The provided option "model" of the property %v in the model %v should be a String, but %v given.',
2835
+ 'The provided option "model" of the property %v in the model %v should be a String, but %v was given.',
2860
2836
  propName,
2861
2837
  modelName,
2862
2838
  propDef.model
2863
2839
  );
2864
2840
  if (propDef.primaryKey && typeof propDef.primaryKey !== "boolean")
2865
2841
  throw new InvalidArgumentError(
2866
- 'The provided option "primaryKey" of the property %v in the model %v should be a Boolean, but %v given.',
2842
+ 'The provided option "primaryKey" of the property %v in the model %v should be a Boolean, but %v was given.',
2867
2843
  propName,
2868
2844
  modelName,
2869
2845
  propDef.primaryKey
2870
2846
  );
2871
2847
  if (propDef.columnName && typeof propDef.columnName !== "string")
2872
2848
  throw new InvalidArgumentError(
2873
- 'The provided option "columnName" of the property %v in the model %v should be a String, but %v given.',
2849
+ 'The provided option "columnName" of the property %v in the model %v should be a String, but %v was given.',
2874
2850
  propName,
2875
2851
  modelName,
2876
2852
  propDef.columnName
2877
2853
  );
2878
2854
  if (propDef.columnType && typeof propDef.columnType !== "string")
2879
2855
  throw new InvalidArgumentError(
2880
- 'The provided option "columnType" of the property %v in the model %v should be a String, but %v given.',
2856
+ 'The provided option "columnType" of the property %v in the model %v should be a String, but %v was given.',
2881
2857
  propName,
2882
2858
  modelName,
2883
2859
  propDef.columnType
2884
2860
  );
2885
2861
  if (propDef.required && typeof propDef.required !== "boolean")
2886
2862
  throw new InvalidArgumentError(
2887
- 'The provided option "required" of the property %v in the model %v should be a Boolean, but %v given.',
2863
+ 'The provided option "required" of the property %v in the model %v should be a Boolean, but %v was given.',
2888
2864
  propName,
2889
2865
  modelName,
2890
2866
  propDef.required
@@ -2954,32 +2930,36 @@ var init_properties_definition_validator = __esm({
2954
2930
  "The property validator %v is not found.",
2955
2931
  propDef.validate
2956
2932
  );
2933
+ } else if (propDef.validate && typeof propDef.validate === "function") {
2957
2934
  } else if (Array.isArray(propDef.validate)) {
2958
- for (const validatorName of propDef.validate) {
2959
- if (typeof validatorName !== "string")
2935
+ for (const validatorOrName of propDef.validate) {
2936
+ if (validatorOrName && typeof validatorOrName === "string") {
2937
+ if (!propertyValidatorRegistry.hasValidator(validatorOrName))
2938
+ throw new InvalidArgumentError(
2939
+ "The property validator %v is not found.",
2940
+ validatorOrName
2941
+ );
2942
+ } else if (validatorOrName && typeof validatorOrName === "function") {
2943
+ } else {
2960
2944
  throw new InvalidArgumentError(
2961
- 'The provided option "validate" of the property %v in the model %v has an Array value that should have a non-empty String, but %v given.',
2945
+ 'The provided option "validate" for the property %v in the model %v has an Array value that should contain validator names or validator functions, but %v was given.',
2962
2946
  propName,
2963
2947
  modelName,
2964
- validatorName
2965
- );
2966
- if (!propertyValidatorRegistry.hasValidator(validatorName))
2967
- throw new InvalidArgumentError(
2968
- "The property validator %v is not found.",
2969
- validatorName
2948
+ validatorOrName
2970
2949
  );
2950
+ }
2971
2951
  }
2972
2952
  } else if (typeof propDef.validate === "object") {
2973
- for (const validatorName in propDef.validate) {
2953
+ Object.keys(propDef.validate).forEach((validatorName) => {
2974
2954
  if (!propertyValidatorRegistry.hasValidator(validatorName))
2975
2955
  throw new InvalidArgumentError(
2976
2956
  "The property validator %v is not found.",
2977
2957
  validatorName
2978
2958
  );
2979
- }
2959
+ });
2980
2960
  } else {
2981
2961
  throw new InvalidArgumentError(
2982
- 'The provided option "validate" of the property %v in the model %v should be a non-empty String, an Array of String or an Object, but %v given.',
2962
+ 'The provided option "validate" for the property %v in the model %v should be either a validator name, a validator function, an array of validator names or functions, or an object mapping validator names to their arguments, but %v was given.',
2983
2963
  propName,
2984
2964
  modelName,
2985
2965
  propDef.validate
@@ -2996,32 +2976,36 @@ var init_properties_definition_validator = __esm({
2996
2976
  "The property transformer %v is not found.",
2997
2977
  propDef.transform
2998
2978
  );
2979
+ } else if (propDef.transform && typeof propDef.transform === "function") {
2999
2980
  } else if (Array.isArray(propDef.transform)) {
3000
- for (const transformerName of propDef.transform) {
3001
- if (typeof transformerName !== "string")
2981
+ for (const transformerOrName of propDef.transform) {
2982
+ if (transformerOrName && typeof transformerOrName === "string") {
2983
+ if (!propertyTransformerRegistry.hasTransformer(transformerOrName))
2984
+ throw new InvalidArgumentError(
2985
+ "The property transformer %v is not found.",
2986
+ transformerOrName
2987
+ );
2988
+ } else if (transformerOrName && typeof transformerOrName === "function") {
2989
+ } else {
3002
2990
  throw new InvalidArgumentError(
3003
- 'The provided option "transform" of the property %v in the model %v has an Array value that should have a non-empty String, but %v given.',
2991
+ 'The provided option "transform" for the property %v in the model %v has an Array value that should contain transformer names or transformer functions, but %v was given.',
3004
2992
  propName,
3005
2993
  modelName,
3006
- transformerName
3007
- );
3008
- if (!propertyTransformerRegistry.hasTransformer(transformerName))
3009
- throw new InvalidArgumentError(
3010
- "The property transformer %v is not found.",
3011
- transformerName
2994
+ transformerOrName
3012
2995
  );
2996
+ }
3013
2997
  }
3014
2998
  } else if (typeof propDef.transform === "object") {
3015
- for (const transformerName in propDef.transform) {
2999
+ Object.keys(propDef.transform).forEach((transformerName) => {
3016
3000
  if (!propertyTransformerRegistry.hasTransformer(transformerName))
3017
3001
  throw new InvalidArgumentError(
3018
3002
  "The property transformer %v is not found.",
3019
3003
  transformerName
3020
3004
  );
3021
- }
3005
+ });
3022
3006
  } else {
3023
3007
  throw new InvalidArgumentError(
3024
- 'The provided option "transform" of the property %v in the model %v should be a non-empty String, an Array of String or an Object, but %v given.',
3008
+ 'The provided option "transform" for the property %v in the model %v should be either a transformer name, a transformer function, an array of transformer names or functions, or an object mapping transformer names to their arguments, but %v was given.',
3025
3009
  propName,
3026
3010
  modelName,
3027
3011
  propDef.transform
@@ -3031,7 +3015,7 @@ var init_properties_definition_validator = __esm({
3031
3015
  if (propDef.unique) {
3032
3016
  if (typeof propDef.unique !== "boolean" && !Object.values(PropertyUniqueness).includes(propDef.unique)) {
3033
3017
  throw new InvalidArgumentError(
3034
- 'The provided option "unique" of the property %v in the model %v should be a Boolean or one of values: %l, but %v given.',
3018
+ '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.',
3035
3019
  propName,
3036
3020
  modelName,
3037
3021
  Object.values(PropertyUniqueness),
@@ -3099,7 +3083,7 @@ var init_model_data_validator = __esm({
3099
3083
  validate(modelName, modelData, isPartial = false) {
3100
3084
  if (!isPureObject(modelData))
3101
3085
  throw new InvalidArgumentError(
3102
- "The data of the model %v should be an Object, but %v given.",
3086
+ "The data of the model %v should be an Object, but %v was given.",
3103
3087
  modelName,
3104
3088
  modelData
3105
3089
  );
@@ -3139,19 +3123,19 @@ var init_model_data_validator = __esm({
3139
3123
  const isRequired = typeof propDef === "string" ? false : Boolean(propDef.required);
3140
3124
  if (!isRequired) return;
3141
3125
  throw new InvalidArgumentError(
3142
- "The property %v of the model %v is required, but %v given.",
3126
+ "The property %v of the model %v is required, but %v was given.",
3143
3127
  propName,
3144
3128
  modelName,
3145
3129
  propValue
3146
3130
  );
3147
3131
  }
3132
+ this._validateValueByPropertyType(modelName, propName, propDef, propValue);
3148
3133
  this._validateValueByPropertyValidators(
3149
3134
  modelName,
3150
3135
  propName,
3151
3136
  propDef,
3152
3137
  propValue
3153
3138
  );
3154
- this._validateValueByPropertyType(modelName, propName, propDef, propValue);
3155
3139
  }
3156
3140
  /**
3157
3141
  * Validate value by property type.
@@ -3176,7 +3160,7 @@ var init_model_data_validator = __esm({
3176
3160
  expectingType = typeof propDef !== "string" ? propDef.type : propDef;
3177
3161
  }
3178
3162
  const createError = /* @__PURE__ */ __name((expected) => {
3179
- const pattern = isArrayValue ? "The array property %v of the model %v must have %s element, but %s given." : "The property %v of the model %v must have %s, but %s given.";
3163
+ const pattern = isArrayValue ? "The array property %v of the model %v must have %s element, but %s was given." : "The property %v of the model %v must have %s, but %s was given.";
3180
3164
  const ctorName = getCtorName(propValue);
3181
3165
  const givenStr = ctorName != null ? ctorName : typeof propValue;
3182
3166
  return new InvalidArgumentError(
@@ -3238,40 +3222,83 @@ var init_model_data_validator = __esm({
3238
3222
  if (typeof propDef === "string" || propDef.validate == null) return;
3239
3223
  const validateDef = propDef.validate;
3240
3224
  const validatorRegistry = this.getService(PropertyValidatorRegistry);
3241
- const createError = /* @__PURE__ */ __name((validatorName) => new InvalidArgumentError(
3242
- "The property %v of the model %v has an invalid value %v that caught by the validator %v.",
3243
- propName,
3244
- modelName,
3245
- propValue,
3246
- validatorName
3247
- ), "createError");
3248
- const validateBy = /* @__PURE__ */ __name((validatorName, validatorOptions = void 0) => {
3249
- const validator = validatorRegistry.getValidator(validatorName);
3250
- const context = { validatorName, modelName, propName };
3251
- const valid = validator(propValue, validatorOptions, context);
3252
- if (valid instanceof Promise) {
3253
- throw new InvalidArgumentError(
3254
- "Asynchronous property validators are not supported, but the property validator %v returns a Promise.",
3225
+ const createError = /* @__PURE__ */ __name((validatorName) => {
3226
+ if (validatorName) {
3227
+ return new InvalidArgumentError(
3228
+ "The property %v of the model %v has the invalid value %v that caught by the property validator %v.",
3229
+ propName,
3230
+ modelName,
3231
+ propValue,
3255
3232
  validatorName
3256
3233
  );
3234
+ } else {
3235
+ return new InvalidArgumentError(
3236
+ "The property %v of the model %v has the invalid value %v that caught by a property validator.",
3237
+ propName,
3238
+ modelName,
3239
+ propValue
3240
+ );
3241
+ }
3242
+ }, "createError");
3243
+ const validateBy = /* @__PURE__ */ __name((validatorOrName, validatorOptions = void 0) => {
3244
+ let validatorName, validatorFn;
3245
+ if (typeof validatorOrName === "string") {
3246
+ validatorName = validatorOrName;
3247
+ validatorFn = validatorRegistry.getValidator(validatorName);
3248
+ } else if (typeof validatorOrName === "function") {
3249
+ validatorName = validatorOrName.name && validatorOrName.name !== "validate" ? validatorOrName.name : void 0;
3250
+ validatorFn = validatorOrName;
3251
+ } else {
3252
+ throw new InvalidArgumentError(
3253
+ "Validator must be a non-empty String or a Function, but %v was given.",
3254
+ validatorOrName
3255
+ );
3256
+ }
3257
+ const context = { validatorName, modelName, propName };
3258
+ const valid = validatorFn(propValue, validatorOptions, context);
3259
+ if (valid instanceof Promise) {
3260
+ if (validatorName) {
3261
+ throw new InvalidArgumentError(
3262
+ "Asynchronous property validators are not supported, but the property %v of the model %v has the property validator %v that returns a Promise.",
3263
+ propName,
3264
+ modelName,
3265
+ validatorName
3266
+ );
3267
+ } else {
3268
+ throw new InvalidArgumentError(
3269
+ "Asynchronous property validators are not supported, but the property %v of the model %v has a property validator that returns a Promise.",
3270
+ propName,
3271
+ modelName
3272
+ );
3273
+ }
3257
3274
  } else if (valid !== true) {
3258
3275
  throw createError(validatorName);
3259
3276
  }
3260
3277
  }, "validateBy");
3261
3278
  if (validateDef && typeof validateDef === "string") {
3262
3279
  validateBy(validateDef);
3280
+ } else if (validateDef && typeof validateDef === "function") {
3281
+ validateBy(validateDef);
3263
3282
  } else if (Array.isArray(validateDef)) {
3264
- validateDef.forEach((validatorName) => validateBy(validatorName));
3283
+ validateDef.forEach((validatorOrName) => {
3284
+ if (!validatorOrName || typeof validatorOrName !== "string" && typeof validatorOrName !== "function") {
3285
+ throw new InvalidArgumentError(
3286
+ 'The provided option "validate" for the property %v in the model %v has an Array value that should contain validator names or validator functions, but %v was given.',
3287
+ propName,
3288
+ modelName,
3289
+ validatorOrName
3290
+ );
3291
+ }
3292
+ validateBy(validatorOrName);
3293
+ });
3265
3294
  } else if (validateDef !== null && typeof validateDef === "object") {
3266
3295
  Object.keys(validateDef).forEach((validatorName) => {
3267
- if (Object.prototype.hasOwnProperty.call(validateDef, validatorName)) {
3268
- const validatorOptions = validateDef[validatorName];
3269
- validateBy(validatorName, validatorOptions);
3270
- }
3296
+ const validatorOptions = validateDef[validatorName];
3297
+ validateBy(validatorName, validatorOptions);
3271
3298
  });
3272
3299
  } else {
3273
3300
  throw new InvalidArgumentError(
3274
- 'The provided option "validate" of the property %v in the model %v should be a non-empty String, an Array of String or an Object, but %v given.',
3301
+ 'The provided option "validate" for the property %v in the model %v should be either a validator name, a validator function, an array of validator names or functions, or an object mapping validator names to their arguments, but %v was given.',
3275
3302
  propName,
3276
3303
  modelName,
3277
3304
  validateDef
@@ -3303,12 +3330,12 @@ var init_model_data_sanitizer = __esm({
3303
3330
  sanitize(modelName, modelData) {
3304
3331
  if (!modelName || typeof modelName !== "string")
3305
3332
  throw new InvalidArgumentError(
3306
- "The first argument of ModelDataSanitizer.sanitize should be a string, but %v given.",
3333
+ "The first argument of ModelDataSanitizer.sanitize should be a string, but %v was given.",
3307
3334
  modelName
3308
3335
  );
3309
3336
  if (!modelData || typeof modelData !== "object")
3310
3337
  throw new InvalidArgumentError(
3311
- "The second argument of ModelDataSanitizer.sanitize should be an Object, but %v given.",
3338
+ "The second argument of ModelDataSanitizer.sanitize should be an Object, but %v was given.",
3312
3339
  modelData
3313
3340
  );
3314
3341
  return this.getService(
@@ -3346,7 +3373,7 @@ var init_model_data_transformer = __esm({
3346
3373
  transform(modelName, modelData, isPartial = false) {
3347
3374
  if (!isPureObject(modelData))
3348
3375
  throw new InvalidArgumentError(
3349
- "The data of the model %v should be an Object, but %v given.",
3376
+ "The data of the model %v should be an Object, but %v was given.",
3350
3377
  modelName,
3351
3378
  modelData
3352
3379
  );
@@ -3385,24 +3412,46 @@ var init_model_data_transformer = __esm({
3385
3412
  * @param {string} propName
3386
3413
  * @param {string|object} propDef
3387
3414
  * @param {*} propValue
3388
- * @returns {*}
3415
+ * @returns {*|Promise<*>}
3389
3416
  */
3390
3417
  _transformPropertyValue(modelName, propName, propDef, propValue) {
3391
3418
  if (typeof propDef === "string" || propDef.transform == null)
3392
3419
  return propValue;
3393
3420
  const transformDef = propDef.transform;
3394
3421
  const transformerRegistry = this.getService(PropertyTransformerRegistry);
3395
- const transformFn = /* @__PURE__ */ __name((value, transformerName, transformerOptions = void 0) => {
3396
- const transformer = transformerRegistry.getTransformer(transformerName);
3422
+ const transformFn = /* @__PURE__ */ __name((value, transformerOrName, transformerOptions = void 0) => {
3423
+ let transformerName, transformerFn;
3424
+ if (typeof transformerOrName === "string") {
3425
+ transformerName = transformerOrName;
3426
+ transformerFn = transformerRegistry.getTransformer(transformerName);
3427
+ } else if (typeof transformerOrName === "function") {
3428
+ transformerName = transformerOrName.name && transformerOrName.name !== "transform" ? transformerOrName.name : void 0;
3429
+ transformerFn = transformerOrName;
3430
+ } else {
3431
+ throw new InvalidArgumentError(
3432
+ "Transformer must be a non-empty String or a Function, but %v was given.",
3433
+ transformerOrName
3434
+ );
3435
+ }
3397
3436
  const context = { transformerName, modelName, propName };
3398
- return transformer(value, transformerOptions, context);
3437
+ return transformerFn(value, transformerOptions, context);
3399
3438
  }, "transformFn");
3400
3439
  if (transformDef && typeof transformDef === "string") {
3401
3440
  return transformFn(propValue, transformDef);
3441
+ } else if (transformDef && typeof transformDef === "function") {
3442
+ return transformFn(propValue, transformDef);
3402
3443
  } else if (Array.isArray(transformDef)) {
3403
- return transformDef.reduce((valueOrPromise, transformerName) => {
3444
+ return transformDef.reduce((valueOrPromise, transformerOrName) => {
3445
+ if (!transformerOrName || typeof transformerOrName !== "string" && typeof transformerOrName !== "function") {
3446
+ throw new InvalidArgumentError(
3447
+ 'The provided option "transform" for the property %v in the model %v has an Array value that should contain transformer names or transformer functions, but %v was given.',
3448
+ propName,
3449
+ modelName,
3450
+ transformerOrName
3451
+ );
3452
+ }
3404
3453
  return transformPromise(valueOrPromise, (value) => {
3405
- return transformFn(value, transformerName);
3454
+ return transformFn(value, transformerOrName);
3406
3455
  });
3407
3456
  }, propValue);
3408
3457
  } else if (transformDef !== null && typeof transformDef === "object") {
@@ -3417,7 +3466,7 @@ var init_model_data_transformer = __esm({
3417
3466
  );
3418
3467
  } else {
3419
3468
  throw new InvalidArgumentError(
3420
- 'The provided option "transform" of the property %v in the model %v should be a non-empty String, an Array of String or an Object, but %v given.',
3469
+ 'The provided option "transform" for the property %v in the model %v should be either a transformer name, a transformer function, an array of transformer names or functions, or an object mapping transformer names to their arguments, but %v was given.',
3421
3470
  propName,
3422
3471
  modelName,
3423
3472
  transformDef
@@ -3448,36 +3497,36 @@ var init_model_definition_validator = __esm({
3448
3497
  validate(modelDef) {
3449
3498
  if (!modelDef || typeof modelDef !== "object" || Array.isArray(modelDef))
3450
3499
  throw new InvalidArgumentError(
3451
- "The model definition should be an Object, but %v given.",
3500
+ "The model definition should be an Object, but %v was given.",
3452
3501
  modelDef
3453
3502
  );
3454
3503
  if (!modelDef.name || typeof modelDef.name !== "string")
3455
3504
  throw new InvalidArgumentError(
3456
- 'The model definition requires the option "name" as a non-empty String, but %v given.',
3505
+ 'The model definition requires the option "name" as a non-empty String, but %v was given.',
3457
3506
  modelDef.name
3458
3507
  );
3459
3508
  if (modelDef.datasource && typeof modelDef.datasource !== "string")
3460
3509
  throw new InvalidArgumentError(
3461
- 'The provided option "datasource" of the model %v should be a String, but %v given.',
3510
+ 'The provided option "datasource" of the model %v should be a String, but %v was given.',
3462
3511
  modelDef.name,
3463
3512
  modelDef.datasource
3464
3513
  );
3465
3514
  if (modelDef.base && typeof modelDef.base !== "string")
3466
3515
  throw new InvalidArgumentError(
3467
- 'The provided option "base" of the model %v should be a String, but %v given.',
3516
+ 'The provided option "base" of the model %v should be a String, but %v was given.',
3468
3517
  modelDef.name,
3469
3518
  modelDef.base
3470
3519
  );
3471
3520
  if (modelDef.tableName && typeof modelDef.tableName !== "string")
3472
3521
  throw new InvalidArgumentError(
3473
- 'The provided option "tableName" of the model %v should be a String, but %v given.',
3522
+ 'The provided option "tableName" of the model %v should be a String, but %v was given.',
3474
3523
  modelDef.name,
3475
3524
  modelDef.tableName
3476
3525
  );
3477
3526
  if (modelDef.properties) {
3478
3527
  if (typeof modelDef.properties !== "object" || Array.isArray(modelDef.properties)) {
3479
3528
  throw new InvalidArgumentError(
3480
- 'The provided option "properties" of the model %v should be an Object, but %v given.',
3529
+ 'The provided option "properties" of the model %v should be an Object, but %v was given.',
3481
3530
  modelDef.name,
3482
3531
  modelDef.properties
3483
3532
  );
@@ -3490,7 +3539,7 @@ var init_model_definition_validator = __esm({
3490
3539
  if (modelDef.relations) {
3491
3540
  if (typeof modelDef.relations !== "object" || Array.isArray(modelDef.relations)) {
3492
3541
  throw new InvalidArgumentError(
3493
- 'The provided option "relations" of the model %v should be an Object, but %v given.',
3542
+ 'The provided option "relations" of the model %v should be an Object, but %v was given.',
3494
3543
  modelDef.name,
3495
3544
  modelDef.relations
3496
3545
  );
@@ -3538,17 +3587,17 @@ var init_datasource_definition_validator = __esm({
3538
3587
  validate(datasourceDef) {
3539
3588
  if (!datasourceDef || typeof datasourceDef !== "object")
3540
3589
  throw new InvalidArgumentError(
3541
- "The datasource definition should be an Object, but %v given.",
3590
+ "The datasource definition should be an Object, but %v was given.",
3542
3591
  datasourceDef
3543
3592
  );
3544
3593
  if (!datasourceDef.name || typeof datasourceDef.name !== "string")
3545
3594
  throw new InvalidArgumentError(
3546
- 'The datasource definition requires the option "name" as a non-empty String, but %v given.',
3595
+ 'The datasource definition requires the option "name" as a non-empty String, but %v was given.',
3547
3596
  datasourceDef.name
3548
3597
  );
3549
3598
  if (!datasourceDef.adapter || typeof datasourceDef.adapter !== "string")
3550
3599
  throw new InvalidArgumentError(
3551
- 'The datasource %v requires the option "adapter" as a non-empty String, but %v given.',
3600
+ 'The datasource %v requires the option "adapter" as a non-empty String, but %v was given.',
3552
3601
  datasourceDef.name,
3553
3602
  datasourceDef.adapter
3554
3603
  );
@@ -3601,13 +3650,13 @@ var init_fields_clause_tool = __esm({
3601
3650
  entities.forEach((entity) => {
3602
3651
  if (!entity || typeof entity !== "object" || Array.isArray(entity))
3603
3652
  throw new InvalidArgumentError(
3604
- "The first argument of FieldsClauseTool.filter should be an Object or an Array of Object, but %v given.",
3653
+ "The first argument of FieldsClauseTool.filter should be an Object or an Array of Object, but %v was given.",
3605
3654
  entity
3606
3655
  );
3607
3656
  });
3608
3657
  if (!modelName || typeof modelName !== "string")
3609
3658
  throw new InvalidArgumentError(
3610
- "The second argument of FieldsClauseTool.filter should be a non-empty String, but %v given.",
3659
+ "The second argument of FieldsClauseTool.filter should be a non-empty String, but %v was given.",
3611
3660
  modelName
3612
3661
  );
3613
3662
  if (clause == null) return input;
@@ -3616,7 +3665,7 @@ var init_fields_clause_tool = __esm({
3616
3665
  fields.forEach((field) => {
3617
3666
  if (!field || typeof field !== "string")
3618
3667
  throw new InvalidArgumentError(
3619
- 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
3668
+ 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v was given.',
3620
3669
  field
3621
3670
  );
3622
3671
  });
@@ -3639,7 +3688,7 @@ var init_fields_clause_tool = __esm({
3639
3688
  fields.forEach((field) => {
3640
3689
  if (!field || typeof field !== "string")
3641
3690
  throw new InvalidArgumentError(
3642
- 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
3691
+ 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v was given.',
3643
3692
  field
3644
3693
  );
3645
3694
  });
@@ -3657,7 +3706,7 @@ var init_fields_clause_tool = __esm({
3657
3706
  fields.forEach((field) => {
3658
3707
  if (!field || typeof field !== "string")
3659
3708
  throw new InvalidArgumentError(
3660
- 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
3709
+ 'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v was given.',
3661
3710
  field
3662
3711
  );
3663
3712
  });
@@ -3687,7 +3736,7 @@ var init_inclusion_decorator = __esm({
3687
3736
  decorate(adapter) {
3688
3737
  if (!adapter || !(adapter instanceof Adapter))
3689
3738
  throw new InvalidArgumentError(
3690
- "The first argument of InclusionDecorator.decorate should be an Adapter instance, but %v given.",
3739
+ "The first argument of InclusionDecorator.decorate should be an Adapter instance, but %v was given.",
3691
3740
  adapter
3692
3741
  );
3693
3742
  const tool = adapter.getService(IncludeClauseTool);
@@ -3776,7 +3825,7 @@ var init_default_values_decorator = __esm({
3776
3825
  decorate(adapter) {
3777
3826
  if (!adapter || !(adapter instanceof Adapter))
3778
3827
  throw new InvalidArgumentError(
3779
- "The first argument of DefaultValuesDecorator.decorate should be an Adapter instance, but %v given.",
3828
+ "The first argument of DefaultValuesDecorator.decorate should be an Adapter instance, but %v was given.",
3780
3829
  adapter
3781
3830
  );
3782
3831
  const utils = adapter.getService(ModelDefinitionUtils);
@@ -3841,7 +3890,7 @@ var init_data_sanitizing_decorator = __esm({
3841
3890
  decorate(adapter) {
3842
3891
  if (!adapter || !(adapter instanceof Adapter))
3843
3892
  throw new InvalidArgumentError(
3844
- "The first argument of DataSanitizingDecorator.decorate should be an Adapter instance, but %v given.",
3893
+ "The first argument of DataSanitizingDecorator.decorate should be an Adapter instance, but %v was given.",
3845
3894
  adapter
3846
3895
  );
3847
3896
  const sanitizer = adapter.getService(ModelDataSanitizer);
@@ -3896,7 +3945,7 @@ var init_data_validation_decorator = __esm({
3896
3945
  decorate(adapter) {
3897
3946
  if (!adapter || !(adapter instanceof Adapter))
3898
3947
  throw new InvalidArgumentError(
3899
- "The first argument of DataValidationDecorator.decorate should be an Adapter instance, but %v given.",
3948
+ "The first argument of DataValidationDecorator.decorate should be an Adapter instance, but %v was given.",
3900
3949
  adapter
3901
3950
  );
3902
3951
  const validator = this.getService(ModelDataValidator);
@@ -3950,7 +3999,7 @@ var init_fields_filtering_decorator = __esm({
3950
3999
  decorate(adapter) {
3951
4000
  if (!adapter || !(adapter instanceof Adapter))
3952
4001
  throw new InvalidArgumentError(
3953
- "The first argument of FieldsFilteringDecorator.decorate should be an Adapter instance, but %v given.",
4002
+ "The first argument of FieldsFilteringDecorator.decorate should be an Adapter instance, but %v was given.",
3954
4003
  adapter
3955
4004
  );
3956
4005
  const tool = adapter.getService(FieldsClauseTool);
@@ -4033,7 +4082,7 @@ var init_data_transformation_decorator = __esm({
4033
4082
  decorate(adapter) {
4034
4083
  if (!adapter || !(adapter instanceof Adapter))
4035
4084
  throw new InvalidArgumentError(
4036
- "The first argument of DataTransformerDecorator.decorate should be an Adapter instance, but %v given.",
4085
+ "The first argument of DataTransformerDecorator.decorate should be an Adapter instance, but %v was given.",
4037
4086
  adapter
4038
4087
  );
4039
4088
  const transformer = this.getService(ModelDataTransformer);
@@ -4087,7 +4136,7 @@ var init_property_uniqueness_decorator = __esm({
4087
4136
  decorate(adapter) {
4088
4137
  if (!adapter || !(adapter instanceof Adapter))
4089
4138
  throw new InvalidArgumentError(
4090
- "The first argument of PropertyUniquenessDecorator.decorate should be an Adapter instance, but %v given.",
4139
+ "The first argument of PropertyUniquenessDecorator.decorate should be an Adapter instance, but %v was given.",
4091
4140
  adapter
4092
4141
  );
4093
4142
  const validator = this.getService(PropertyUniquenessValidator);
@@ -4795,7 +4844,7 @@ var init_adapter_loader = __esm({
4795
4844
  async loadByName(adapterName, settings = void 0) {
4796
4845
  if (!adapterName || typeof adapterName !== "string")
4797
4846
  throw new InvalidArgumentError(
4798
- "The adapter name should be a non-empty String, but %v given.",
4847
+ "The adapter name should be a non-empty String, but %v was given.",
4799
4848
  adapterName
4800
4849
  );
4801
4850
  let adapterCtor;
@@ -5108,7 +5157,7 @@ var init_repository_registry = __esm({
5108
5157
  setRepositoryCtor(ctor) {
5109
5158
  if (!ctor || typeof ctor !== "function" || !(ctor.prototype instanceof Repository)) {
5110
5159
  throw new InvalidArgumentError(
5111
- "The first argument of RepositoryRegistry.setRepositoryCtor must inherit from Repository class, but %v given.",
5160
+ "The first argument of RepositoryRegistry.setRepositoryCtor must inherit from Repository class, but %v was given.",
5112
5161
  ctor
5113
5162
  );
5114
5163
  }
@@ -5169,32 +5218,32 @@ var init_has_one_resolver = __esm({
5169
5218
  async includeTo(entities, sourceName, targetName, relationName, foreignKey, scope = void 0) {
5170
5219
  if (!entities || !Array.isArray(entities))
5171
5220
  throw new InvalidArgumentError(
5172
- 'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v given.',
5221
+ 'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v was given.',
5173
5222
  entities
5174
5223
  );
5175
5224
  if (!sourceName || typeof sourceName !== "string")
5176
5225
  throw new InvalidArgumentError(
5177
- 'The parameter "sourceName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
5226
+ 'The parameter "sourceName" of HasOneResolver.includeTo requires a non-empty String, but %v was given.',
5178
5227
  sourceName
5179
5228
  );
5180
5229
  if (!targetName || typeof targetName !== "string")
5181
5230
  throw new InvalidArgumentError(
5182
- 'The parameter "targetName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
5231
+ 'The parameter "targetName" of HasOneResolver.includeTo requires a non-empty String, but %v was given.',
5183
5232
  targetName
5184
5233
  );
5185
5234
  if (!relationName || typeof relationName !== "string")
5186
5235
  throw new InvalidArgumentError(
5187
- 'The parameter "relationName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
5236
+ 'The parameter "relationName" of HasOneResolver.includeTo requires a non-empty String, but %v was given.',
5188
5237
  relationName
5189
5238
  );
5190
5239
  if (!foreignKey || typeof foreignKey !== "string")
5191
5240
  throw new InvalidArgumentError(
5192
- 'The parameter "foreignKey" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
5241
+ 'The parameter "foreignKey" of HasOneResolver.includeTo requires a non-empty String, but %v was given.',
5193
5242
  foreignKey
5194
5243
  );
5195
5244
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5196
5245
  throw new InvalidArgumentError(
5197
- 'The provided parameter "scope" of HasOneResolver.includeTo should be an Object, but %v given.',
5246
+ 'The provided parameter "scope" of HasOneResolver.includeTo should be an Object, but %v was given.',
5198
5247
  scope
5199
5248
  );
5200
5249
  const sourcePkPropName = this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(
@@ -5204,7 +5253,7 @@ var init_has_one_resolver = __esm({
5204
5253
  entities.forEach((entity) => {
5205
5254
  if (!entity || typeof entity !== "object" || Array.isArray(entity))
5206
5255
  throw new InvalidArgumentError(
5207
- 'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v given.',
5256
+ 'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v was given.',
5208
5257
  entity
5209
5258
  );
5210
5259
  const sourceId = entity[sourcePkPropName];
@@ -5248,37 +5297,37 @@ var init_has_one_resolver = __esm({
5248
5297
  async includePolymorphicTo(entities, sourceName, targetName, relationName, foreignKey, discriminator, scope = void 0) {
5249
5298
  if (!entities || !Array.isArray(entities))
5250
5299
  throw new InvalidArgumentError(
5251
- 'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v given.',
5300
+ 'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5252
5301
  entities
5253
5302
  );
5254
5303
  if (!sourceName || typeof sourceName !== "string")
5255
5304
  throw new InvalidArgumentError(
5256
- 'The parameter "sourceName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5305
+ 'The parameter "sourceName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5257
5306
  sourceName
5258
5307
  );
5259
5308
  if (!targetName || typeof targetName !== "string")
5260
5309
  throw new InvalidArgumentError(
5261
- 'The parameter "targetName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5310
+ 'The parameter "targetName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5262
5311
  targetName
5263
5312
  );
5264
5313
  if (!relationName || typeof relationName !== "string")
5265
5314
  throw new InvalidArgumentError(
5266
- 'The parameter "relationName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5315
+ 'The parameter "relationName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5267
5316
  relationName
5268
5317
  );
5269
5318
  if (!foreignKey || typeof foreignKey !== "string")
5270
5319
  throw new InvalidArgumentError(
5271
- 'The parameter "foreignKey" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5320
+ 'The parameter "foreignKey" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5272
5321
  foreignKey
5273
5322
  );
5274
5323
  if (!discriminator || typeof discriminator !== "string")
5275
5324
  throw new InvalidArgumentError(
5276
- 'The parameter "discriminator" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5325
+ 'The parameter "discriminator" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5277
5326
  discriminator
5278
5327
  );
5279
5328
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5280
5329
  throw new InvalidArgumentError(
5281
- 'The provided parameter "scope" of HasOneResolver.includePolymorphicTo should be an Object, but %v given.',
5330
+ 'The provided parameter "scope" of HasOneResolver.includePolymorphicTo should be an Object, but %v was given.',
5282
5331
  scope
5283
5332
  );
5284
5333
  const sourcePkPropName = this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(
@@ -5288,7 +5337,7 @@ var init_has_one_resolver = __esm({
5288
5337
  entities.forEach((entity) => {
5289
5338
  if (!entity || typeof entity !== "object" || Array.isArray(entity))
5290
5339
  throw new InvalidArgumentError(
5291
- 'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v given.',
5340
+ 'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5292
5341
  entity
5293
5342
  );
5294
5343
  const sourceId = entity[sourcePkPropName];
@@ -5334,32 +5383,32 @@ var init_has_one_resolver = __esm({
5334
5383
  async includePolymorphicByRelationName(entities, sourceName, targetName, relationName, targetRelationName, scope = void 0) {
5335
5384
  if (!entities || !Array.isArray(entities))
5336
5385
  throw new InvalidArgumentError(
5337
- 'The parameter "entities" of HasOneResolver.includePolymorphicByRelationName requires an Array of Object, but %v given.',
5386
+ 'The parameter "entities" of HasOneResolver.includePolymorphicByRelationName requires an Array of Object, but %v was given.',
5338
5387
  entities
5339
5388
  );
5340
5389
  if (!sourceName || typeof sourceName !== "string")
5341
5390
  throw new InvalidArgumentError(
5342
- 'The parameter "sourceName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
5391
+ 'The parameter "sourceName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5343
5392
  sourceName
5344
5393
  );
5345
5394
  if (!targetName || typeof targetName !== "string")
5346
5395
  throw new InvalidArgumentError(
5347
- 'The parameter "targetName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
5396
+ 'The parameter "targetName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5348
5397
  targetName
5349
5398
  );
5350
5399
  if (!relationName || typeof relationName !== "string")
5351
5400
  throw new InvalidArgumentError(
5352
- 'The parameter "relationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
5401
+ 'The parameter "relationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5353
5402
  relationName
5354
5403
  );
5355
5404
  if (!targetRelationName || typeof targetRelationName !== "string")
5356
5405
  throw new InvalidArgumentError(
5357
- 'The parameter "targetRelationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
5406
+ 'The parameter "targetRelationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5358
5407
  targetRelationName
5359
5408
  );
5360
5409
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5361
5410
  throw new InvalidArgumentError(
5362
- 'The provided parameter "scope" of HasOneResolver.includePolymorphicByRelationName should be an Object, but %v given.',
5411
+ 'The provided parameter "scope" of HasOneResolver.includePolymorphicByRelationName should be an Object, but %v was given.',
5363
5412
  scope
5364
5413
  );
5365
5414
  const targetRelationDef = this.getService(
@@ -5367,7 +5416,7 @@ var init_has_one_resolver = __esm({
5367
5416
  ).getRelationDefinitionByName(targetName, targetRelationName);
5368
5417
  if (targetRelationDef.type !== RelationType.BELONGS_TO)
5369
5418
  throw new InvalidArgumentError(
5370
- '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 given.',
5419
+ '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.',
5371
5420
  relationName,
5372
5421
  sourceName,
5373
5422
  targetRelationName,
@@ -5424,32 +5473,32 @@ var init_has_many_resolver = __esm({
5424
5473
  async includeTo(entities, sourceName, targetName, relationName, foreignKey, scope = void 0) {
5425
5474
  if (!entities || !Array.isArray(entities))
5426
5475
  throw new InvalidArgumentError(
5427
- 'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v given.',
5476
+ 'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v was given.',
5428
5477
  entities
5429
5478
  );
5430
5479
  if (!sourceName || typeof sourceName !== "string")
5431
5480
  throw new InvalidArgumentError(
5432
- 'The parameter "sourceName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
5481
+ 'The parameter "sourceName" of HasManyResolver.includeTo requires a non-empty String, but %v was given.',
5433
5482
  sourceName
5434
5483
  );
5435
5484
  if (!targetName || typeof targetName !== "string")
5436
5485
  throw new InvalidArgumentError(
5437
- 'The parameter "targetName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
5486
+ 'The parameter "targetName" of HasManyResolver.includeTo requires a non-empty String, but %v was given.',
5438
5487
  targetName
5439
5488
  );
5440
5489
  if (!relationName || typeof relationName !== "string")
5441
5490
  throw new InvalidArgumentError(
5442
- 'The parameter "relationName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
5491
+ 'The parameter "relationName" of HasManyResolver.includeTo requires a non-empty String, but %v was given.',
5443
5492
  relationName
5444
5493
  );
5445
5494
  if (!foreignKey || typeof foreignKey !== "string")
5446
5495
  throw new InvalidArgumentError(
5447
- 'The parameter "foreignKey" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
5496
+ 'The parameter "foreignKey" of HasManyResolver.includeTo requires a non-empty String, but %v was given.',
5448
5497
  foreignKey
5449
5498
  );
5450
5499
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5451
5500
  throw new InvalidArgumentError(
5452
- 'The provided parameter "scope" of HasManyResolver.includeTo should be an Object, but %v given.',
5501
+ 'The provided parameter "scope" of HasManyResolver.includeTo should be an Object, but %v was given.',
5453
5502
  scope
5454
5503
  );
5455
5504
  const sourcePkPropName = this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(
@@ -5459,7 +5508,7 @@ var init_has_many_resolver = __esm({
5459
5508
  entities.forEach((entity) => {
5460
5509
  if (!entity || typeof entity !== "object" || Array.isArray(entity))
5461
5510
  throw new InvalidArgumentError(
5462
- 'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v given.',
5511
+ 'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v was given.',
5463
5512
  entity
5464
5513
  );
5465
5514
  const sourceId = entity[sourcePkPropName];
@@ -5508,37 +5557,37 @@ var init_has_many_resolver = __esm({
5508
5557
  async includePolymorphicTo(entities, sourceName, targetName, relationName, foreignKey, discriminator, scope = void 0) {
5509
5558
  if (!entities || !Array.isArray(entities))
5510
5559
  throw new InvalidArgumentError(
5511
- 'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v given.',
5560
+ 'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5512
5561
  entities
5513
5562
  );
5514
5563
  if (!sourceName || typeof sourceName !== "string")
5515
5564
  throw new InvalidArgumentError(
5516
- 'The parameter "sourceName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5565
+ 'The parameter "sourceName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5517
5566
  sourceName
5518
5567
  );
5519
5568
  if (!targetName || typeof targetName !== "string")
5520
5569
  throw new InvalidArgumentError(
5521
- 'The parameter "targetName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5570
+ 'The parameter "targetName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5522
5571
  targetName
5523
5572
  );
5524
5573
  if (!relationName || typeof relationName !== "string")
5525
5574
  throw new InvalidArgumentError(
5526
- 'The parameter "relationName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5575
+ 'The parameter "relationName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5527
5576
  relationName
5528
5577
  );
5529
5578
  if (!foreignKey || typeof foreignKey !== "string")
5530
5579
  throw new InvalidArgumentError(
5531
- 'The parameter "foreignKey" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5580
+ 'The parameter "foreignKey" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5532
5581
  foreignKey
5533
5582
  );
5534
5583
  if (!discriminator || typeof discriminator !== "string")
5535
5584
  throw new InvalidArgumentError(
5536
- 'The parameter "discriminator" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5585
+ 'The parameter "discriminator" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5537
5586
  discriminator
5538
5587
  );
5539
5588
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5540
5589
  throw new InvalidArgumentError(
5541
- 'The provided parameter "scope" of HasManyResolver.includePolymorphicTo should be an Object, but %v given.',
5590
+ 'The provided parameter "scope" of HasManyResolver.includePolymorphicTo should be an Object, but %v was given.',
5542
5591
  scope
5543
5592
  );
5544
5593
  const sourcePkPropName = this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(
@@ -5548,7 +5597,7 @@ var init_has_many_resolver = __esm({
5548
5597
  entities.forEach((entity) => {
5549
5598
  if (!entity || typeof entity !== "object" || Array.isArray(entity))
5550
5599
  throw new InvalidArgumentError(
5551
- 'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v given.',
5600
+ 'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5552
5601
  entity
5553
5602
  );
5554
5603
  const sourceId = entity[sourcePkPropName];
@@ -5599,32 +5648,32 @@ var init_has_many_resolver = __esm({
5599
5648
  async includePolymorphicByRelationName(entities, sourceName, targetName, relationName, targetRelationName, scope = void 0) {
5600
5649
  if (!entities || !Array.isArray(entities))
5601
5650
  throw new InvalidArgumentError(
5602
- 'The parameter "entities" of HasManyResolver.includePolymorphicByRelationName requires an Array of Object, but %v given.',
5651
+ 'The parameter "entities" of HasManyResolver.includePolymorphicByRelationName requires an Array of Object, but %v was given.',
5603
5652
  entities
5604
5653
  );
5605
5654
  if (!sourceName || typeof sourceName !== "string")
5606
5655
  throw new InvalidArgumentError(
5607
- 'The parameter "sourceName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
5656
+ 'The parameter "sourceName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5608
5657
  sourceName
5609
5658
  );
5610
5659
  if (!targetName || typeof targetName !== "string")
5611
5660
  throw new InvalidArgumentError(
5612
- 'The parameter "targetName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
5661
+ 'The parameter "targetName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5613
5662
  targetName
5614
5663
  );
5615
5664
  if (!relationName || typeof relationName !== "string")
5616
5665
  throw new InvalidArgumentError(
5617
- 'The parameter "relationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
5666
+ 'The parameter "relationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5618
5667
  relationName
5619
5668
  );
5620
5669
  if (!targetRelationName || typeof targetRelationName !== "string")
5621
5670
  throw new InvalidArgumentError(
5622
- 'The parameter "targetRelationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
5671
+ 'The parameter "targetRelationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v was given.',
5623
5672
  targetRelationName
5624
5673
  );
5625
5674
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5626
5675
  throw new InvalidArgumentError(
5627
- 'The provided parameter "scope" of HasManyResolver.includePolymorphicByRelationName should be an Object, but %v given.',
5676
+ 'The provided parameter "scope" of HasManyResolver.includePolymorphicByRelationName should be an Object, but %v was given.',
5628
5677
  scope
5629
5678
  );
5630
5679
  const targetRelationDef = this.getService(
@@ -5632,7 +5681,7 @@ var init_has_many_resolver = __esm({
5632
5681
  ).getRelationDefinitionByName(targetName, targetRelationName);
5633
5682
  if (targetRelationDef.type !== RelationType.BELONGS_TO)
5634
5683
  throw new InvalidArgumentError(
5635
- '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 given.',
5684
+ '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.',
5636
5685
  relationName,
5637
5686
  sourceName,
5638
5687
  targetRelationName,
@@ -5689,39 +5738,39 @@ var init_belongs_to_resolver = __esm({
5689
5738
  async includeTo(entities, sourceName, targetName, relationName, foreignKey = void 0, scope = void 0) {
5690
5739
  if (!entities || !Array.isArray(entities))
5691
5740
  throw new InvalidArgumentError(
5692
- 'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v given.',
5741
+ 'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v was given.',
5693
5742
  entities
5694
5743
  );
5695
5744
  if (!sourceName || typeof sourceName !== "string")
5696
5745
  throw new InvalidArgumentError(
5697
- 'The parameter "sourceName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
5746
+ 'The parameter "sourceName" of BelongsToResolver.includeTo requires a non-empty String, but %v was given.',
5698
5747
  sourceName
5699
5748
  );
5700
5749
  if (!targetName || typeof targetName !== "string")
5701
5750
  throw new InvalidArgumentError(
5702
- 'The parameter "targetName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
5751
+ 'The parameter "targetName" of BelongsToResolver.includeTo requires a non-empty String, but %v was given.',
5703
5752
  targetName
5704
5753
  );
5705
5754
  if (!relationName || typeof relationName !== "string")
5706
5755
  throw new InvalidArgumentError(
5707
- 'The parameter "relationName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
5756
+ 'The parameter "relationName" of BelongsToResolver.includeTo requires a non-empty String, but %v was given.',
5708
5757
  relationName
5709
5758
  );
5710
5759
  if (foreignKey && typeof foreignKey !== "string")
5711
5760
  throw new InvalidArgumentError(
5712
- 'The provided parameter "foreignKey" of BelongsToResolver.includeTo should be a String, but %v given.',
5761
+ 'The provided parameter "foreignKey" of BelongsToResolver.includeTo should be a String, but %v was given.',
5713
5762
  foreignKey
5714
5763
  );
5715
5764
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5716
5765
  throw new InvalidArgumentError(
5717
- 'The provided parameter "scope" of BelongsToResolver.includeTo should be an Object, but %v given.',
5766
+ 'The provided parameter "scope" of BelongsToResolver.includeTo should be an Object, but %v was given.',
5718
5767
  scope
5719
5768
  );
5720
5769
  if (foreignKey == null) foreignKey = `${relationName}Id`;
5721
5770
  const targetIds = entities.reduce((acc, entity) => {
5722
5771
  if (!entity || typeof entity !== "object" || Array.isArray(entity))
5723
5772
  throw new InvalidArgumentError(
5724
- 'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v given.',
5773
+ 'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v was given.',
5725
5774
  entity
5726
5775
  );
5727
5776
  const targetId = entity[foreignKey];
@@ -5761,32 +5810,32 @@ var init_belongs_to_resolver = __esm({
5761
5810
  async includePolymorphicTo(entities, sourceName, relationName, foreignKey = void 0, discriminator = void 0, scope = void 0) {
5762
5811
  if (!entities || !Array.isArray(entities))
5763
5812
  throw new InvalidArgumentError(
5764
- 'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v given.',
5813
+ 'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5765
5814
  entities
5766
5815
  );
5767
5816
  if (!sourceName || typeof sourceName !== "string")
5768
5817
  throw new InvalidArgumentError(
5769
- 'The parameter "sourceName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5818
+ 'The parameter "sourceName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5770
5819
  sourceName
5771
5820
  );
5772
5821
  if (!relationName || typeof relationName !== "string")
5773
5822
  throw new InvalidArgumentError(
5774
- 'The parameter "relationName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v given.',
5823
+ 'The parameter "relationName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v was given.',
5775
5824
  relationName
5776
5825
  );
5777
5826
  if (foreignKey && typeof foreignKey !== "string")
5778
5827
  throw new InvalidArgumentError(
5779
- 'The provided parameter "foreignKey" of BelongsToResolver.includePolymorphicTo should be a String, but %v given.',
5828
+ 'The provided parameter "foreignKey" of BelongsToResolver.includePolymorphicTo should be a String, but %v was given.',
5780
5829
  foreignKey
5781
5830
  );
5782
5831
  if (discriminator && typeof discriminator !== "string")
5783
5832
  throw new InvalidArgumentError(
5784
- 'The provided parameter "discriminator" of BelongsToResolver.includePolymorphicTo should be a String, but %v given.',
5833
+ 'The provided parameter "discriminator" of BelongsToResolver.includePolymorphicTo should be a String, but %v was given.',
5785
5834
  discriminator
5786
5835
  );
5787
5836
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5788
5837
  throw new InvalidArgumentError(
5789
- 'The provided parameter "scope" of BelongsToResolver.includePolymorphicTo should be an Object, but %v given.',
5838
+ 'The provided parameter "scope" of BelongsToResolver.includePolymorphicTo should be an Object, but %v was given.',
5790
5839
  scope
5791
5840
  );
5792
5841
  if (foreignKey == null) {
@@ -5801,7 +5850,7 @@ var init_belongs_to_resolver = __esm({
5801
5850
  entities.forEach((entity) => {
5802
5851
  if (!entity || typeof entity !== "object" || Array.isArray(entity))
5803
5852
  throw new InvalidArgumentError(
5804
- 'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v given.',
5853
+ 'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v was given.',
5805
5854
  entity
5806
5855
  );
5807
5856
  const targetId = entity[foreignKey];
@@ -5897,32 +5946,32 @@ var init_references_many_resolver = __esm({
5897
5946
  async includeTo(entities, sourceName, targetName, relationName, foreignKey = void 0, scope = void 0) {
5898
5947
  if (!entities || !Array.isArray(entities))
5899
5948
  throw new InvalidArgumentError(
5900
- 'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v given.',
5949
+ 'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v was given.',
5901
5950
  entities
5902
5951
  );
5903
5952
  if (!sourceName || typeof sourceName !== "string")
5904
5953
  throw new InvalidArgumentError(
5905
- 'The parameter "sourceName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
5954
+ 'The parameter "sourceName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v was given.',
5906
5955
  sourceName
5907
5956
  );
5908
5957
  if (!targetName || typeof targetName !== "string")
5909
5958
  throw new InvalidArgumentError(
5910
- 'The parameter "targetName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
5959
+ 'The parameter "targetName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v was given.',
5911
5960
  targetName
5912
5961
  );
5913
5962
  if (!relationName || typeof relationName !== "string")
5914
5963
  throw new InvalidArgumentError(
5915
- 'The parameter "relationName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
5964
+ 'The parameter "relationName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v was given.',
5916
5965
  relationName
5917
5966
  );
5918
5967
  if (foreignKey && typeof foreignKey !== "string")
5919
5968
  throw new InvalidArgumentError(
5920
- 'The provided parameter "foreignKey" of ReferencesManyResolver.includeTo should be a String, but %v given.',
5969
+ 'The provided parameter "foreignKey" of ReferencesManyResolver.includeTo should be a String, but %v was given.',
5921
5970
  foreignKey
5922
5971
  );
5923
5972
  if (scope && (typeof scope !== "object" || Array.isArray(scope)))
5924
5973
  throw new InvalidArgumentError(
5925
- 'The provided parameter "scope" of ReferencesManyResolver.includeTo should be an Object, but %v given.',
5974
+ 'The provided parameter "scope" of ReferencesManyResolver.includeTo should be an Object, but %v was given.',
5926
5975
  scope
5927
5976
  );
5928
5977
  if (foreignKey == null) {
@@ -5932,7 +5981,7 @@ var init_references_many_resolver = __esm({
5932
5981
  const targetIds = entities.reduce((acc, entity) => {
5933
5982
  if (!entity || typeof entity !== "object" || Array.isArray(entity))
5934
5983
  throw new InvalidArgumentError(
5935
- 'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v given.',
5984
+ 'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v was given.',
5936
5985
  entity
5937
5986
  );
5938
5987
  const ids = entity[foreignKey];
@@ -6173,7 +6222,7 @@ var init_include_clause_tool = __esm({
6173
6222
  if ("relation" in clause) {
6174
6223
  if (!clause.relation || typeof clause.relation !== "string")
6175
6224
  throw new InvalidArgumentError(
6176
- 'The provided option "relation" should be a non-empty String, but %v given.',
6225
+ 'The provided option "relation" should be a non-empty String, but %v was given.',
6177
6226
  clause.relation
6178
6227
  );
6179
6228
  if ("scope" in clause && clause) this.validateScopeClause(clause.scope);
@@ -6186,7 +6235,7 @@ var init_include_clause_tool = __esm({
6186
6235
  }
6187
6236
  } else {
6188
6237
  throw new InvalidArgumentError(
6189
- 'The provided option "include" should have a non-empty String, an Object or an Array, but %v given.',
6238
+ 'The provided option "include" should have a non-empty String, an Object or an Array, but %v was given.',
6190
6239
  clause
6191
6240
  );
6192
6241
  }
@@ -6200,7 +6249,7 @@ var init_include_clause_tool = __esm({
6200
6249
  if (clause == null) return;
6201
6250
  if (typeof clause !== "object" || Array.isArray(clause))
6202
6251
  throw new InvalidArgumentError(
6203
- 'The provided option "scope" should be an Object, but %v given.',
6252
+ 'The provided option "scope" should be an Object, but %v was given.',
6204
6253
  clause
6205
6254
  );
6206
6255
  if (clause.where != null) {
@@ -6252,7 +6301,7 @@ var init_include_clause_tool = __esm({
6252
6301
  if ("relation" in clause) {
6253
6302
  if (!clause.relation || typeof clause.relation !== "string")
6254
6303
  throw new InvalidArgumentError(
6255
- 'The provided option "relation" should be a non-empty String, but %v given.',
6304
+ 'The provided option "relation" should be a non-empty String, but %v was given.',
6256
6305
  clause.relation
6257
6306
  );
6258
6307
  const normalized = { relation: clause.relation };
@@ -6271,7 +6320,7 @@ var init_include_clause_tool = __esm({
6271
6320
  }
6272
6321
  } else {
6273
6322
  throw new InvalidArgumentError(
6274
- 'The provided option "include" should have a non-empty String, an Object or an Array, but %v given.',
6323
+ 'The provided option "include" should have a non-empty String, an Object or an Array, but %v was given.',
6275
6324
  clause
6276
6325
  );
6277
6326
  }
@@ -6287,7 +6336,7 @@ var init_include_clause_tool = __esm({
6287
6336
  if (clause == null) return;
6288
6337
  if (typeof clause !== "object" || Array.isArray(clause))
6289
6338
  throw new InvalidArgumentError(
6290
- 'The provided option "scope" should be an Object, but %v given.',
6339
+ 'The provided option "scope" should be an Object, but %v was given.',
6291
6340
  clause
6292
6341
  );
6293
6342
  const result = {};