@nhtio/lucid-resourceful 1.20250718.1 → 1.20250724.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -12,11 +12,11 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
12
12
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
13
13
  var _a, _hookHandlers, _cleanupHandlers, _state, _handlersToIgnore, _skipAllHooks, _Runner_instances, filter_fn, exec_fn, _b, _hooks, _c, _d;
14
14
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
15
- const decorator_utils = require("./decorator_utils-1yWqd_Gg.cjs");
16
- const index = require("./index-Cv6KC1rC.cjs");
15
+ const decorator_utils = require("./decorator_utils-U_rZo8tv.cjs");
16
+ const joi = require("./joi.cjs");
17
17
  const liqe = require("liqe");
18
18
  const errors = require("./errors-D8jb9VxY.cjs");
19
- const definitions = require("./definitions-BrN-oCRI.cjs");
19
+ const definitions = require("./definitions-DgI468dW.cjs");
20
20
  const require$$0 = require("util");
21
21
  require("node:path");
22
22
  require("node:url");
@@ -74,7 +74,7 @@ async function pMap(iterable, mapper, {
74
74
  return;
75
75
  }
76
76
  const nextItem = await iterator.next();
77
- const index2 = currentIndex;
77
+ const index = currentIndex;
78
78
  currentIndex++;
79
79
  if (nextItem.done) {
80
80
  isIterableDone = true;
@@ -89,8 +89,8 @@ async function pMap(iterable, mapper, {
89
89
  return;
90
90
  }
91
91
  const pureResult = [];
92
- for (const [index3, value] of result.entries()) {
93
- if (skippedIndexesMap.get(index3) === pMapSkip) {
92
+ for (const [index2, value] of result.entries()) {
93
+ if (skippedIndexesMap.get(index2) === pMapSkip) {
94
94
  continue;
95
95
  }
96
96
  pureResult.push(value);
@@ -106,11 +106,11 @@ async function pMap(iterable, mapper, {
106
106
  if (isResolved) {
107
107
  return;
108
108
  }
109
- const value = await mapper(element, index2);
109
+ const value = await mapper(element, index);
110
110
  if (value === pMapSkip) {
111
- skippedIndexesMap.set(index2, value);
111
+ skippedIndexesMap.set(index, value);
112
112
  }
113
- result[index2] = value;
113
+ result[index] = value;
114
114
  resolvingCount--;
115
115
  await next();
116
116
  } catch (error) {
@@ -129,7 +129,7 @@ async function pMap(iterable, mapper, {
129
129
  })();
130
130
  };
131
131
  (async () => {
132
- for (let index2 = 0; index2 < concurrency; index2++) {
132
+ for (let index = 0; index < concurrency; index++) {
133
133
  try {
134
134
  await next();
135
135
  } catch (error) {
@@ -589,77 +589,40 @@ class l {
589
589
  ) : this.e[s] = []), this;
590
590
  }
591
591
  }
592
- var CRUDOperationsEnum = /* @__PURE__ */ ((CRUDOperationsEnum2) => {
593
- CRUDOperationsEnum2["CREATE"] = "create";
594
- CRUDOperationsEnum2["READ"] = "read";
595
- CRUDOperationsEnum2["LIST"] = "list";
596
- CRUDOperationsEnum2["UPDATE"] = "update";
597
- CRUDOperationsEnum2["DELETE"] = "delete";
598
- return CRUDOperationsEnum2;
599
- })(CRUDOperationsEnum || {});
600
- var ACLOperationsEnum = /* @__PURE__ */ ((ACLOperationsEnum2) => {
601
- ACLOperationsEnum2["WRITE"] = "write";
602
- ACLOperationsEnum2["READ"] = "read";
603
- return ACLOperationsEnum2;
604
- })(ACLOperationsEnum || {});
605
- const operationCRUDToACL = (operation) => {
606
- if (operation === CRUDOperationsEnum.READ || operation === CRUDOperationsEnum.LIST) {
607
- return ACLOperationsEnum.READ;
608
- }
609
- if (operation === CRUDOperationsEnum.CREATE || operation === CRUDOperationsEnum.UPDATE || operation === CRUDOperationsEnum.DELETE) {
610
- return ACLOperationsEnum.WRITE;
611
- }
612
- };
613
- const isString$1 = (value) => {
614
- return typeof value === "string";
615
- };
616
- const isFunction = (value) => {
617
- return typeof value === "function";
618
- };
619
- const prepareFields = (fields, primaryKey) => {
620
- const defaultValue = [primaryKey];
621
- if (Array.isArray(fields)) {
622
- return fields.length ? fields : defaultValue;
623
- }
624
- if (isString$1(fields)) {
625
- return fields.length ? [fields] : defaultValue;
626
- }
627
- return defaultValue;
628
- };
629
592
  const ResourcefulErrorHandlerMethod = ["bubble", "pass", "fail"];
630
593
  const getFieldKey = (key, definition) => {
631
- if (isString$1(definition.serializeAs)) {
594
+ if (decorator_utils.isString(definition.serializeAs)) {
632
595
  return definition.serializeAs;
633
596
  }
634
597
  return key;
635
598
  };
636
599
  function withResourceful(options = {}) {
637
600
  return (superclass) => {
638
- const optionsSchema = index.joi.object({
639
- name: index.joi.string().default(superclass.name),
640
- readRequiredForWrite: index.joi.boolean().default(false),
641
- accessControlFilters: index.joi.object({
642
- list: index.joi.array().items(index.joi.function()).default([]),
643
- create: index.joi.array().items(index.joi.function()).default([]),
644
- read: index.joi.array().items(index.joi.function()).default([]),
645
- update: index.joi.array().items(index.joi.function()).default([]),
646
- delete: index.joi.array().items(index.joi.function()).default([])
601
+ const optionsSchema = joi.joi.object({
602
+ name: joi.joi.string().default(superclass.name),
603
+ readRequiredForWrite: joi.joi.boolean().default(false),
604
+ accessControlFilters: joi.joi.object({
605
+ list: joi.joi.array().items(joi.joi.function()).default([]),
606
+ create: joi.joi.array().items(joi.joi.function()).default([]),
607
+ read: joi.joi.array().items(joi.joi.function()).default([]),
608
+ update: joi.joi.array().items(joi.joi.function()).default([]),
609
+ delete: joi.joi.array().items(joi.joi.function()).default([])
647
610
  }).default({}),
648
- onACLError: index.joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
649
- onValidationScopeError: index.joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
650
- queryScopeCallbacks: index.joi.object({
651
- list: index.joi.array().items(index.joi.function()).default([]),
652
- access: index.joi.array().items(index.joi.function()).default([])
611
+ onACLError: joi.joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
612
+ onValidationScopeError: joi.joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
613
+ queryScopeCallbacks: joi.joi.object({
614
+ list: joi.joi.array().items(joi.joi.function()).default([]),
615
+ access: joi.joi.array().items(joi.joi.function()).default([])
653
616
  }).default({}),
654
- description: index.joi.string().optional(),
655
- externalDocs: index.joi.object({
656
- description: index.joi.string().optional(),
657
- url: index.joi.string().uri().required()
617
+ description: joi.joi.string().optional(),
618
+ externalDocs: joi.joi.object({
619
+ description: joi.joi.string().optional(),
620
+ url: joi.joi.string().uri().required()
658
621
  }).optional(),
659
- example: index.joi.string().optional(),
660
- advanced: index.joi.object({
661
- propertyEvaluationConcurrency: index.joi.number().integer().min(1).default(10),
662
- aclEvaluationConcurrency: index.joi.number().integer().min(1).default(2)
622
+ example: joi.joi.string().optional(),
623
+ advanced: joi.joi.object({
624
+ propertyEvaluationConcurrency: joi.joi.number().integer().min(1).default(10),
625
+ aclEvaluationConcurrency: joi.joi.number().integer().min(1).default(2)
663
626
  }).default({
664
627
  propertyEvaluationConcurrency: 10,
665
628
  aclEvaluationConcurrency: 2
@@ -800,7 +763,7 @@ function withResourceful(options = {}) {
800
763
  "relationship"
801
764
  ),
802
765
  kind: "relationship",
803
- validator: index.joi.forbidden(),
766
+ validator: joi.joi.forbidden(),
804
767
  relatedModel: relationshipDefinition.relatedModel
805
768
  };
806
769
  if (!resourcefulModelRelationshipMetaSchema.canRead && !resourcefulModelRelationshipMetaSchema.canWrite)
@@ -815,7 +778,7 @@ function withResourceful(options = {}) {
815
778
  }
816
779
  static $getPropertyValidator(ctx, app, key, datatype, nullable, validationScopes, kind, writable = false) {
817
780
  if ("relationship" === kind || "computedAccessor" === kind && !writable) {
818
- return index.joi.any().forbidden();
781
+ return joi.joi.any().forbidden();
819
782
  }
820
783
  const baseValidator = this.$getPropertyBaseValidator(datatype, nullable, kind, writable);
821
784
  if (Array.isArray(validationScopes) && validationScopes.length > 0) {
@@ -837,7 +800,7 @@ function withResourceful(options = {}) {
837
800
  case "pass":
838
801
  break;
839
802
  case "fail":
840
- return index.joi.any().forbidden();
803
+ return joi.joi.any().forbidden();
841
804
  }
842
805
  }
843
806
  });
@@ -846,13 +809,13 @@ function withResourceful(options = {}) {
846
809
  }
847
810
  static $getPropertyBaseValidator(datatype, nullable, kind, writable = false) {
848
811
  if ("relationship" === kind || "computedAccessor" === kind && !writable) {
849
- return index.joi.any().forbidden();
812
+ return joi.joi.any().forbidden();
850
813
  }
851
814
  nullable = nullable || "boolean" === typeof datatype.nullable && datatype.nullable;
852
815
  switch (true) {
853
816
  case datatype instanceof definitions.ResourcefulStringType: {
854
817
  const d = datatype;
855
- const r = index.joi.string().min(d.minLength).max(d.maxLength);
818
+ const r = joi.joi.string().min(d.minLength).max(d.maxLength);
856
819
  if (d.pattern) {
857
820
  r.pattern(new RegExp(d.pattern));
858
821
  }
@@ -865,14 +828,14 @@ function withResourceful(options = {}) {
865
828
  return r;
866
829
  }
867
830
  case datatype instanceof definitions.ResourcefulDateType: {
868
- const r = index.joi.date().iso();
831
+ const r = joi.joi.date().iso();
869
832
  if (nullable) {
870
833
  r.allow(null);
871
834
  }
872
835
  return r;
873
836
  }
874
837
  case datatype instanceof definitions.ResourcefulDateTimeType: {
875
- const r = index.joi.date().iso();
838
+ const r = joi.joi.date().iso();
876
839
  if (nullable) {
877
840
  r.allow(null);
878
841
  }
@@ -880,7 +843,7 @@ function withResourceful(options = {}) {
880
843
  }
881
844
  case datatype instanceof definitions.ResourcefulBinaryType: {
882
845
  const d = datatype;
883
- const r = index.joi.string();
846
+ const r = joi.joi.string();
884
847
  if (nullable) {
885
848
  r.allow(null);
886
849
  }
@@ -894,7 +857,7 @@ function withResourceful(options = {}) {
894
857
  }
895
858
  case datatype instanceof definitions.ResourcefulNumberType: {
896
859
  const d = datatype;
897
- const r = index.joi.number();
860
+ const r = joi.joi.number();
898
861
  if (nullable) {
899
862
  r.allow(null);
900
863
  }
@@ -913,7 +876,7 @@ function withResourceful(options = {}) {
913
876
  }
914
877
  case datatype instanceof definitions.ResourcefulIntegerType: {
915
878
  const d = datatype;
916
- const r = index.joi.number();
879
+ const r = joi.joi.number();
917
880
  if (nullable) {
918
881
  r.allow(null);
919
882
  }
@@ -932,7 +895,7 @@ function withResourceful(options = {}) {
932
895
  }
933
896
  case datatype instanceof definitions.ResourcefulBigintType: {
934
897
  const d = datatype;
935
- const r = index.joi.bigint();
898
+ const r = joi.joi.bigint();
936
899
  if (nullable) {
937
900
  r.allow(null);
938
901
  }
@@ -951,7 +914,7 @@ function withResourceful(options = {}) {
951
914
  }
952
915
  case datatype instanceof definitions.ResourcefulUnsignedIntegerType: {
953
916
  const d = datatype;
954
- const r = index.joi.number().unsafe();
917
+ const r = joi.joi.number().unsafe();
955
918
  if (nullable) {
956
919
  r.allow(null);
957
920
  }
@@ -969,7 +932,7 @@ function withResourceful(options = {}) {
969
932
  return r;
970
933
  }
971
934
  case datatype instanceof definitions.ResourcefulBooleanType: {
972
- const r = index.joi.boolean();
935
+ const r = joi.joi.boolean();
973
936
  if (nullable) {
974
937
  r.allow(null);
975
938
  }
@@ -989,7 +952,7 @@ function withResourceful(options = {}) {
989
952
  !(item.readOnly || false)
990
953
  )
991
954
  );
992
- propValidator = index.joi.alternatives().try(...alternatives);
955
+ propValidator = joi.joi.alternatives().try(...alternatives);
993
956
  } else if ("allOf" in propDef) {
994
957
  const schemas = propDef.allOf.map(
995
958
  (item) => this.$getPropertyBaseValidator(
@@ -999,7 +962,7 @@ function withResourceful(options = {}) {
999
962
  !(item.readOnly || false)
1000
963
  )
1001
964
  );
1002
- propValidator = schemas.reduce((acc, schema) => acc.concat(schema), index.joi.any());
965
+ propValidator = schemas.reduce((acc, schema) => acc.concat(schema), joi.joi.any());
1003
966
  } else if ("anyOf" in propDef) {
1004
967
  const alternatives = propDef.anyOf.map(
1005
968
  (item) => this.$getPropertyBaseValidator(
@@ -1009,7 +972,7 @@ function withResourceful(options = {}) {
1009
972
  !(item.readOnly || false)
1010
973
  )
1011
974
  );
1012
- propValidator = index.joi.alternatives().try(...alternatives);
975
+ propValidator = joi.joi.alternatives().try(...alternatives);
1013
976
  } else if ("not" in propDef) {
1014
977
  const notSchemas = propDef.not.map(
1015
978
  (item) => this.$getPropertyBaseValidator(
@@ -1019,7 +982,7 @@ function withResourceful(options = {}) {
1019
982
  !(item.readOnly || false)
1020
983
  )
1021
984
  );
1022
- propValidator = index.joi.any().not(...notSchemas);
985
+ propValidator = joi.joi.any().not(...notSchemas);
1023
986
  } else {
1024
987
  propValidator = this.$getPropertyBaseValidator(
1025
988
  propDef,
@@ -1033,7 +996,7 @@ function withResourceful(options = {}) {
1033
996
  }
1034
997
  objectSchema[propKey] = propValidator;
1035
998
  });
1036
- const r = index.joi.object(objectSchema);
999
+ const r = joi.joi.object(objectSchema);
1037
1000
  if (nullable) {
1038
1001
  r.allow(null);
1039
1002
  }
@@ -1046,7 +1009,7 @@ function withResourceful(options = {}) {
1046
1009
  if (decorator_utils.isObject(d.additionalProperties)) {
1047
1010
  const additionalPropertiesType = d.additionalProperties;
1048
1011
  r.pattern(
1049
- index.joi.string(),
1012
+ joi.joi.string(),
1050
1013
  this.$getPropertyBaseValidator(
1051
1014
  additionalPropertiesType,
1052
1015
  additionalPropertiesType.nullable || false,
@@ -1061,7 +1024,7 @@ function withResourceful(options = {}) {
1061
1024
  }
1062
1025
  case datatype instanceof definitions.ResourcefulArrayType: {
1063
1026
  const d = datatype;
1064
- const r = index.joi.array();
1027
+ const r = joi.joi.array();
1065
1028
  if (nullable) {
1066
1029
  r.allow(null);
1067
1030
  }
@@ -1075,7 +1038,7 @@ function withResourceful(options = {}) {
1075
1038
  !(item.readOnly || false)
1076
1039
  )
1077
1040
  );
1078
- itemValidator = index.joi.alternatives().try(...alternatives);
1041
+ itemValidator = joi.joi.alternatives().try(...alternatives);
1079
1042
  } else if ("allOf" in d.items) {
1080
1043
  const schemas = d.items.allOf.map(
1081
1044
  (item) => this.$getPropertyBaseValidator(
@@ -1085,7 +1048,7 @@ function withResourceful(options = {}) {
1085
1048
  !(item.readOnly || false)
1086
1049
  )
1087
1050
  );
1088
- itemValidator = schemas.reduce((acc, schema) => acc.concat(schema), index.joi.any());
1051
+ itemValidator = schemas.reduce((acc, schema) => acc.concat(schema), joi.joi.any());
1089
1052
  } else if ("anyOf" in d.items) {
1090
1053
  const alternatives = d.items.anyOf.map(
1091
1054
  (item) => this.$getPropertyBaseValidator(
@@ -1095,7 +1058,7 @@ function withResourceful(options = {}) {
1095
1058
  !(item.readOnly || false)
1096
1059
  )
1097
1060
  );
1098
- itemValidator = index.joi.alternatives().try(...alternatives);
1061
+ itemValidator = joi.joi.alternatives().try(...alternatives);
1099
1062
  } else if ("not" in d.items) {
1100
1063
  const notSchemas = d.items.not.map(
1101
1064
  (item) => this.$getPropertyBaseValidator(
@@ -1105,7 +1068,7 @@ function withResourceful(options = {}) {
1105
1068
  !(item.readOnly || false)
1106
1069
  )
1107
1070
  );
1108
- itemValidator = index.joi.any().not(...notSchemas);
1071
+ itemValidator = joi.joi.any().not(...notSchemas);
1109
1072
  } else {
1110
1073
  itemValidator = this.$getPropertyBaseValidator(
1111
1074
  d.items,
@@ -1127,7 +1090,7 @@ function withResourceful(options = {}) {
1127
1090
  return r;
1128
1091
  }
1129
1092
  default:
1130
- return index.joi.any().forbidden();
1093
+ return joi.joi.any().forbidden();
1131
1094
  }
1132
1095
  }
1133
1096
  static async $getPropertyCanReadWrite(ctx, app, key, lucidDefinition, readAclFilters = [], writeAclFilters = [], kind, writable = false) {
@@ -1229,7 +1192,6 @@ function withResourceful(options = {}) {
1229
1192
  }
1230
1193
  static $resourcefulModelColumnMetaToOpenApiSchema(propertyKey, propertyMeta) {
1231
1194
  const ret = stripUndefinedValuesFromObject({
1232
- type: propertyMeta.definition.type,
1233
1195
  items: propertyMeta.definition.items,
1234
1196
  title: getFieldKey(propertyKey, propertyMeta.lucidDefinitions) || propertyKey,
1235
1197
  description: propertyMeta.definition.description,
@@ -1260,13 +1222,13 @@ function withResourceful(options = {}) {
1260
1222
  readOnly: propertyMeta.canRead && !propertyMeta.canWrite,
1261
1223
  writeOnly: !propertyMeta.canRead && propertyMeta.canWrite,
1262
1224
  externalDocs: propertyMeta.definition.externalDocs,
1263
- example: propertyMeta.definition.example
1225
+ example: propertyMeta.definition.example,
1226
+ ...propertyMeta.definition.type
1264
1227
  });
1265
1228
  return ret;
1266
1229
  }
1267
1230
  static $resourcefulModelComputedAccessorMetaToOpenApiSchema(propertyKey, propertyMeta) {
1268
1231
  const ret = stripUndefinedValuesFromObject({
1269
- type: propertyMeta.definition.type,
1270
1232
  items: propertyMeta.definition.items,
1271
1233
  title: getFieldKey(propertyKey, propertyMeta.lucidDefinitions) || propertyKey,
1272
1234
  description: propertyMeta.definition.description,
@@ -1297,7 +1259,8 @@ function withResourceful(options = {}) {
1297
1259
  readOnly: propertyMeta.canRead && !propertyMeta.canWrite,
1298
1260
  writeOnly: !propertyMeta.canRead && propertyMeta.canWrite,
1299
1261
  externalDocs: propertyMeta.definition.externalDocs,
1300
- example: propertyMeta.definition.example
1262
+ example: propertyMeta.definition.example,
1263
+ ...propertyMeta.definition.type
1301
1264
  });
1302
1265
  return ret;
1303
1266
  }
@@ -1332,11 +1295,11 @@ function withResourceful(options = {}) {
1332
1295
  };
1333
1296
  }
1334
1297
  }
1335
- if (operation === CRUDOperationsEnum.DELETE) {
1298
+ if (operation === decorator_utils.CRUDOperationsEnum.DELETE) {
1336
1299
  return { isForbidden: false, allowedFieldsMap, allowedColumnsMap };
1337
1300
  }
1338
1301
  const columnsOptions = this.$resourcefulColumns.values();
1339
- const aclOperation = operationCRUDToACL(operation);
1302
+ const aclOperation = decorator_utils.operationCRUDToACL(operation);
1340
1303
  const addColumnOptionToAllowedFieldsMap = (propertyKey) => {
1341
1304
  const serializedName = this.$keys.attributesToSerialized.resolve(propertyKey);
1342
1305
  const columnName = this.$keys.serializedToColumns.resolve(serializedName);
@@ -1348,7 +1311,7 @@ function withResourceful(options = {}) {
1348
1311
  }
1349
1312
  };
1350
1313
  for (const columnOptions of columnsOptions) {
1351
- const propertyACLFilters = aclOperation === ACLOperationsEnum.READ ? columnOptions.readAccessControlFilters : columnOptions.writeAccessControlFilters;
1314
+ const propertyACLFilters = aclOperation === decorator_utils.ACLOperationsEnum.READ ? columnOptions.readAccessControlFilters : columnOptions.writeAccessControlFilters;
1352
1315
  if (!propertyACLFilters) {
1353
1316
  addColumnOptionToAllowedFieldsMap(columnOptions.propertyKey);
1354
1317
  continue;
@@ -1451,7 +1414,7 @@ function withResourceful(options = {}) {
1451
1414
  if (!opts) {
1452
1415
  continue;
1453
1416
  }
1454
- const preparedValue = isFunction(opts.consume) ? opts.consume(value, attribute, this) : value;
1417
+ const preparedValue = decorator_utils.isFunction(opts.consume) ? opts.consume(value, attribute, this) : value;
1455
1418
  result[serializable] = preparedValue;
1456
1419
  }
1457
1420
  return result;
@@ -1480,20 +1443,20 @@ function withResourceful(options = {}) {
1480
1443
  static $resourcefulGetQueryBuilder() {
1481
1444
  return this.$adapter.modelConstructorClient(this).query().from(this.table);
1482
1445
  }
1483
- static async $onResourcefulIndex(filter, page, perPage, fields, ctx, app, hooks = []) {
1446
+ static async $onResourcefulIndex(filter, page, perPage, fields, sort, ctx, app, hooks = []) {
1484
1447
  var _a2;
1485
1448
  const primaryKey = this.$getPrivateKeyAttribute();
1486
1449
  if (!primaryKey) {
1487
1450
  throw new errors.E_MISSING_PRIMARY_KEY_EXCEPTION(this.$resourcefulName);
1488
1451
  }
1489
- if (!isString$1(filter)) {
1452
+ if (!decorator_utils.isString(filter)) {
1490
1453
  filter = "";
1491
1454
  }
1492
- fields = prepareFields(fields, primaryKey);
1455
+ fields = decorator_utils.prepareFields(fields, primaryKey);
1493
1456
  const { isForbidden, allowedFieldsMap, message } = await this.$resourcefulCheckAccess({
1494
1457
  ctx,
1495
1458
  app,
1496
- operation: CRUDOperationsEnum.LIST
1459
+ operation: decorator_utils.CRUDOperationsEnum.LIST
1497
1460
  });
1498
1461
  if (isForbidden) {
1499
1462
  throw new errors.E_FORBIDDEN(message);
@@ -1502,11 +1465,11 @@ function withResourceful(options = {}) {
1502
1465
  if (possibleFields.length === 0) {
1503
1466
  throw new errors.E_INVALID_COLUMN_ACCESS("No fields available for access");
1504
1467
  }
1505
- const schema = index.joi.object({
1506
- filter: index.joi.string().allow("").required(),
1507
- page: index.joi.number().integer().min(1).required(),
1508
- perPage: index.joi.number().integer().min(1).max(100).required(),
1509
- fields: index.joi.array().items(index.joi.string().valid(...possibleFields)).required()
1468
+ const schema = joi.joi.object({
1469
+ filter: joi.joi.string().allow("").required(),
1470
+ page: joi.joi.number().integer().min(1).required(),
1471
+ perPage: joi.joi.number().integer().min(1).max(100).required(),
1472
+ fields: joi.joi.array().items(joi.joi.string().valid(...possibleFields)).required()
1510
1473
  });
1511
1474
  const { error: methodValidationError, value: validatedMethodOptions } = schema.validate(
1512
1475
  {
@@ -1541,6 +1504,13 @@ function withResourceful(options = {}) {
1541
1504
  const recordsQuery = query.clone();
1542
1505
  countQuery.count("*", "total");
1543
1506
  recordsQuery.select(columnsToSelect).forPage(validatedMethodOptions.page, validatedMethodOptions.perPage);
1507
+ if (Array.isArray(sort) && sort.length > 0) {
1508
+ sort.forEach(([field, direction]) => {
1509
+ if (allowedFieldsMap.has(field)) {
1510
+ recordsQuery.orderBy(field, direction);
1511
+ }
1512
+ });
1513
+ }
1544
1514
  const countQueryQuery = countQuery.toQuery();
1545
1515
  const recordsQueryQuery = recordsQuery.toQuery();
1546
1516
  const [countResults, rawRecords] = await Promise.all([countQuery, recordsQuery]);
@@ -1601,7 +1571,7 @@ function withResourceful(options = {}) {
1601
1571
  ctx,
1602
1572
  app,
1603
1573
  instance: record,
1604
- operation: CRUDOperationsEnum.READ
1574
+ operation: decorator_utils.CRUDOperationsEnum.READ
1605
1575
  });
1606
1576
  if (isForbidden) {
1607
1577
  throw new errors.E_FORBIDDEN(message);
@@ -1657,7 +1627,7 @@ function withResourceful(options = {}) {
1657
1627
  const { isForbidden, allowedFieldsMap, message } = await this.$resourcefulCheckAccess({
1658
1628
  ctx,
1659
1629
  app,
1660
- operation: CRUDOperationsEnum.CREATE
1630
+ operation: decorator_utils.CRUDOperationsEnum.CREATE
1661
1631
  });
1662
1632
  if (isForbidden) {
1663
1633
  throw new errors.E_FORBIDDEN(message);
@@ -1734,7 +1704,7 @@ function withResourceful(options = {}) {
1734
1704
  ctx,
1735
1705
  app,
1736
1706
  instance: record,
1737
- operation: CRUDOperationsEnum.UPDATE
1707
+ operation: decorator_utils.CRUDOperationsEnum.UPDATE
1738
1708
  });
1739
1709
  if (isForbidden) {
1740
1710
  throw new errors.E_FORBIDDEN(message);
@@ -1797,7 +1767,7 @@ function withResourceful(options = {}) {
1797
1767
  ctx,
1798
1768
  app,
1799
1769
  instance: record,
1800
- operation: CRUDOperationsEnum.DELETE
1770
+ operation: decorator_utils.CRUDOperationsEnum.DELETE
1801
1771
  });
1802
1772
  if (isForbidden) {
1803
1773
  throw new errors.E_FORBIDDEN(message);
@@ -1859,6 +1829,56 @@ function withResourceful(options = {}) {
1859
1829
  return ResourcefulModel;
1860
1830
  };
1861
1831
  }
1832
+ class PrepareConsumeChainBuilder {
1833
+ /**
1834
+ * Creates a chained prepare function that calls default first, then custom.
1835
+ *
1836
+ * @param propertyKey - The property name for error context
1837
+ * @param nullable - Whether the field accepts null values
1838
+ * @param defaultPrepare - The default prepare function from decorator
1839
+ * @param customPrepare - The custom prepare function from options
1840
+ * @returns A chained prepare function or undefined if no functions provided
1841
+ */
1842
+ static chainPrepare(propertyKey, nullable, defaultPrepare, customPrepare) {
1843
+ if (!defaultPrepare && !customPrepare) {
1844
+ return void 0;
1845
+ }
1846
+ if (!defaultPrepare && customPrepare) {
1847
+ return customPrepare;
1848
+ }
1849
+ if (defaultPrepare && !customPrepare) {
1850
+ return (value) => defaultPrepare(propertyKey, value, nullable);
1851
+ }
1852
+ return (value) => {
1853
+ const defaultResult = defaultPrepare(propertyKey, value, nullable);
1854
+ return customPrepare(defaultResult);
1855
+ };
1856
+ }
1857
+ /**
1858
+ * Creates a chained consume function that calls custom first, then default.
1859
+ *
1860
+ * @param propertyKey - The property name for error context
1861
+ * @param nullable - Whether the field accepts null values
1862
+ * @param defaultConsume - The default consume function from decorator
1863
+ * @param customConsume - The custom consume function from options
1864
+ * @returns A chained consume function or undefined if no functions provided
1865
+ */
1866
+ static chainConsume(propertyKey, nullable, defaultConsume, customConsume) {
1867
+ if (!defaultConsume && !customConsume) {
1868
+ return void 0;
1869
+ }
1870
+ if (!defaultConsume && customConsume) {
1871
+ return customConsume;
1872
+ }
1873
+ if (defaultConsume && !customConsume) {
1874
+ return (value) => defaultConsume(propertyKey, value, nullable);
1875
+ }
1876
+ return (value) => {
1877
+ const customResult = customConsume(value);
1878
+ return defaultConsume(propertyKey, customResult, nullable);
1879
+ };
1880
+ }
1881
+ }
1862
1882
  const E_INVALID_DATE_COLUMN_VALUE = errors.createError('Invalid value for "%s". %s', "E_INVALID_DATE_COLUMN_VALUE", 500);
1863
1883
  const E_MISSING_MODEL_ATTRIBUTE = errors.createError('Relation "%s" expects "%s" to exist on "%s" model, but is missing. Did you forget to define the column?', "E_MISSING_MODEL_ATTRIBUTE", 500);
1864
1884
  const E_MODEL_DELETED = errors.createError("Cannot mutate delete model instance", "E_MODEL_DELETED", 500);
@@ -4594,12 +4614,12 @@ var parseObject = function(chain, val, options, valuesParsed) {
4594
4614
  obj = options.plainObjects ? { __proto__: null } : {};
4595
4615
  var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
4596
4616
  var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
4597
- var index2 = parseInt(decodedRoot, 10);
4617
+ var index = parseInt(decodedRoot, 10);
4598
4618
  if (!options.parseArrays && decodedRoot === "") {
4599
4619
  obj = { 0: leaf };
4600
- } else if (!isNaN(index2) && root !== decodedRoot && String(index2) === decodedRoot && index2 >= 0 && (options.parseArrays && index2 <= options.arrayLimit)) {
4620
+ } else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) {
4601
4621
  obj = [];
4602
- obj[index2] = leaf;
4622
+ obj[index] = leaf;
4603
4623
  } else if (decodedRoot !== "__proto__") {
4604
4624
  obj[decodedRoot] = leaf;
4605
4625
  }
@@ -9641,9 +9661,9 @@ class ManyToManyQueryClient {
9641
9661
  one.$trx = trx;
9642
9662
  await one.save();
9643
9663
  }
9644
- const relatedForeignKeyValues = related.reduce((result, one, index2) => {
9664
+ const relatedForeignKeyValues = related.reduce((result, one, index) => {
9645
9665
  const [, relatedForeignKeyValue] = this.relation.getPivotRelatedPair(one);
9646
- result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index2]) || {};
9666
+ result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index]) || {};
9647
9667
  return result;
9648
9668
  }, {});
9649
9669
  if (performSync) {
@@ -9681,9 +9701,9 @@ class ManyToManyQueryClient {
9681
9701
  this.parent.$trx = trx;
9682
9702
  await this.parent.save();
9683
9703
  const related = await this.relation.relatedModel().createMany(values, { client: trx, ...options });
9684
- const relatedForeignKeyValues = related.reduce((result, one, index2) => {
9704
+ const relatedForeignKeyValues = related.reduce((result, one, index) => {
9685
9705
  const [, relatedForeignKeyValue] = this.relation.getPivotRelatedPair(one);
9686
- result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index2]) || {};
9706
+ result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index]) || {};
9687
9707
  return result;
9688
9708
  }, {});
9689
9709
  await this.attach(relatedForeignKeyValues, trx);
@@ -11787,25 +11807,25 @@ const validateNormalizeAndCastDecoratorOptions = (fieldName, decoratorName, sche
11787
11807
  }
11788
11808
  return value;
11789
11809
  };
11790
- const resourcefulPropertyDefinitionSchema = index.joi.object({
11791
- propertyKey: index.joi.string().default(""),
11792
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11793
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11794
- nullable: index.joi.boolean().default(false),
11795
- description: index.joi.string().optional(),
11796
- default: index.joi.any().optional(),
11797
- externalDocs: index.joi.object({
11798
- description: index.joi.string().optional(),
11799
- url: index.joi.string().uri().required()
11810
+ const resourcefulPropertyDefinitionSchema = joi.joi.object({
11811
+ propertyKey: joi.joi.string().default(""),
11812
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11813
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11814
+ nullable: joi.joi.boolean().default(false),
11815
+ description: joi.joi.string().optional(),
11816
+ default: joi.joi.any().optional(),
11817
+ externalDocs: joi.joi.object({
11818
+ description: joi.joi.string().optional(),
11819
+ url: joi.joi.string().uri().required()
11800
11820
  }).optional(),
11801
- example: index.joi.string().optional(),
11802
- deprecated: index.joi.boolean().default(false)
11821
+ example: joi.joi.string().optional(),
11822
+ deprecated: joi.joi.boolean().default(false)
11803
11823
  });
11804
11824
  const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
11805
11825
  return [
11806
- index.joi.object().instance(Ctor),
11807
- index.joi.function().instance(Ctor),
11808
- index.joi.custom((value, helpers) => {
11826
+ joi.joi.object().instance(Ctor),
11827
+ joi.joi.function().instance(Ctor),
11828
+ joi.joi.custom((value, helpers) => {
11809
11829
  if (decorator_utils.isObject(value) && value.constructor.name === CtorName) {
11810
11830
  return value;
11811
11831
  }
@@ -11813,7 +11833,7 @@ const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
11813
11833
  })
11814
11834
  ];
11815
11835
  };
11816
- const resourcefulDataTypeSchema = index.joi.alternatives(
11836
+ const resourcefulDataTypeSchema = joi.joi.alternatives(
11817
11837
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType"),
11818
11838
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType"),
11819
11839
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType"),
@@ -11832,95 +11852,95 @@ const resourcefulDataTypeSchema = index.joi.alternatives(
11832
11852
  const localResourcefulPropertyDefinitionSchema = resourcefulPropertyDefinitionSchema.keys({
11833
11853
  type: resourcefulDataTypeSchema.required()
11834
11854
  });
11835
- const resourcefulColumnOptionsSchema = index.joi.object({
11855
+ const resourcefulColumnOptionsSchema = joi.joi.object({
11836
11856
  // Lucid ColumnOptions (partial)
11837
- columnName: index.joi.string().optional(),
11838
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11839
- serialize: index.joi.function().optional(),
11840
- consume: index.joi.function().optional(),
11841
- prepare: index.joi.function().optional(),
11842
- meta: index.joi.object().optional(),
11843
- isPrimary: index.joi.boolean().default(false),
11844
- hasDefaultValue: index.joi.boolean().default(false),
11857
+ columnName: joi.joi.string().optional(),
11858
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
11859
+ serialize: joi.joi.function().optional(),
11860
+ consume: joi.joi.function().optional(),
11861
+ prepare: joi.joi.function().optional(),
11862
+ meta: joi.joi.object().optional(),
11863
+ isPrimary: joi.joi.boolean().default(false),
11864
+ hasDefaultValue: joi.joi.boolean().default(false),
11845
11865
  // Resourceful options
11846
- propertyKey: index.joi.string().default(""),
11847
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11848
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11849
- nullable: index.joi.boolean().default(false),
11850
- description: index.joi.string().optional(),
11851
- default: index.joi.any().optional(),
11852
- externalDocs: index.joi.object({
11853
- description: index.joi.string().optional(),
11854
- url: index.joi.string().uri().required()
11866
+ propertyKey: joi.joi.string().default(""),
11867
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11868
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11869
+ nullable: joi.joi.boolean().default(false),
11870
+ description: joi.joi.string().optional(),
11871
+ default: joi.joi.any().optional(),
11872
+ externalDocs: joi.joi.object({
11873
+ description: joi.joi.string().optional(),
11874
+ url: joi.joi.string().uri().required()
11855
11875
  }).optional(),
11856
- example: index.joi.string().optional(),
11857
- deprecated: index.joi.boolean().default(false),
11876
+ example: joi.joi.string().optional(),
11877
+ deprecated: joi.joi.boolean().default(false),
11858
11878
  type: resourcefulDataTypeSchema.required()
11859
11879
  });
11860
- const dataTypeColumnOptionsSchema = index.joi.object({
11880
+ const dataTypeColumnOptionsSchema = joi.joi.object({
11861
11881
  // Lucid ColumnOptions (partial) - excluding 'prepare' and 'consume'
11862
- columnName: index.joi.string().optional(),
11863
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11864
- serialize: index.joi.function().optional(),
11865
- meta: index.joi.object().optional(),
11866
- isPrimary: index.joi.boolean().default(false),
11867
- hasDefaultValue: index.joi.boolean().default(false),
11882
+ columnName: joi.joi.string().optional(),
11883
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
11884
+ serialize: joi.joi.function().optional(),
11885
+ meta: joi.joi.object().optional(),
11886
+ isPrimary: joi.joi.boolean().default(false),
11887
+ hasDefaultValue: joi.joi.boolean().default(false),
11868
11888
  // Resourceful options
11869
- propertyKey: index.joi.string().default(""),
11870
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11871
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11872
- nullable: index.joi.boolean().default(false),
11873
- description: index.joi.string().optional(),
11874
- default: index.joi.any().optional(),
11875
- externalDocs: index.joi.object({
11876
- description: index.joi.string().optional(),
11877
- url: index.joi.string().uri().required()
11889
+ propertyKey: joi.joi.string().default(""),
11890
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11891
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11892
+ nullable: joi.joi.boolean().default(false),
11893
+ description: joi.joi.string().optional(),
11894
+ default: joi.joi.any().optional(),
11895
+ externalDocs: joi.joi.object({
11896
+ description: joi.joi.string().optional(),
11897
+ url: joi.joi.string().uri().required()
11878
11898
  }).optional(),
11879
- example: index.joi.string().optional(),
11880
- deprecated: index.joi.boolean().default(false),
11899
+ example: joi.joi.string().optional(),
11900
+ deprecated: joi.joi.boolean().default(false),
11881
11901
  type: resourcefulDataTypeSchema.optional()
11882
11902
  });
11883
11903
  const baseDateColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11884
- autoCreate: index.joi.boolean().default(false),
11885
- autoUpdate: index.joi.boolean().default(false)
11904
+ autoCreate: joi.joi.boolean().default(false),
11905
+ autoUpdate: joi.joi.boolean().default(false)
11886
11906
  });
11887
11907
  const stringColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11888
- type: index.joi.alternatives(
11908
+ type: joi.joi.alternatives(
11889
11909
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType")
11890
11910
  ).default(() => new definitions.ResourcefulStringType())
11891
11911
  });
11892
11912
  const dateColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
11893
- type: index.joi.alternatives(
11913
+ type: joi.joi.alternatives(
11894
11914
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType")
11895
11915
  ).default(() => new definitions.ResourcefulDateType())
11896
11916
  });
11897
11917
  const dateTimeColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
11898
- type: index.joi.alternatives(
11918
+ type: joi.joi.alternatives(
11899
11919
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType")
11900
11920
  ).default(() => new definitions.ResourcefulDateTimeType())
11901
11921
  });
11902
11922
  const binaryColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11903
- type: index.joi.alternatives(
11923
+ type: joi.joi.alternatives(
11904
11924
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBinaryType, "ResourcefulBinaryType")
11905
11925
  ).default(() => new definitions.ResourcefulBinaryType())
11906
11926
  });
11907
11927
  const numberColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11908
- type: index.joi.alternatives(
11928
+ type: joi.joi.alternatives(
11909
11929
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulNumberType, "ResourcefulNumberType")
11910
11930
  ).default(() => new definitions.ResourcefulNumberType())
11911
11931
  });
11912
11932
  const integerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11913
- type: index.joi.alternatives(
11933
+ type: joi.joi.alternatives(
11914
11934
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulIntegerType, "ResourcefulIntegerType")
11915
11935
  ).default(() => new definitions.ResourcefulIntegerType())
11916
11936
  });
11917
11937
  const bigintColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11918
- type: index.joi.alternatives(
11938
+ type: joi.joi.alternatives(
11919
11939
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBigintType, "ResourcefulBigintType")
11920
11940
  ).default(() => new definitions.ResourcefulBigintType())
11921
11941
  });
11922
11942
  const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11923
- type: index.joi.alternatives(
11943
+ type: joi.joi.alternatives(
11924
11944
  ...joiInstanceCheckerAlternativesFactory(
11925
11945
  definitions.ResourcefulUnsignedIntegerType,
11926
11946
  "ResourcefulUnsignedIntegerType"
@@ -11928,148 +11948,148 @@ const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11928
11948
  ).default(() => new definitions.ResourcefulUnsignedIntegerType())
11929
11949
  });
11930
11950
  const booleanColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11931
- type: index.joi.alternatives(
11951
+ type: joi.joi.alternatives(
11932
11952
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBooleanType, "ResourcefulBooleanType")
11933
11953
  ).default(() => new definitions.ResourcefulBooleanType())
11934
11954
  });
11935
- const objectColumnOptionsSchema = index.joi.object({
11955
+ const objectColumnOptionsSchema = joi.joi.object({
11936
11956
  // Lucid ColumnOptions (full)
11937
- columnName: index.joi.string().optional(),
11938
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11939
- serialize: index.joi.function().optional(),
11940
- consume: index.joi.function().optional(),
11941
- prepare: index.joi.function().optional(),
11942
- meta: index.joi.object().optional(),
11943
- isPrimary: index.joi.boolean().default(false),
11944
- hasDefaultValue: index.joi.boolean().default(false),
11957
+ columnName: joi.joi.string().optional(),
11958
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
11959
+ serialize: joi.joi.function().optional(),
11960
+ consume: joi.joi.function().optional(),
11961
+ prepare: joi.joi.function().optional(),
11962
+ meta: joi.joi.object().optional(),
11963
+ isPrimary: joi.joi.boolean().default(false),
11964
+ hasDefaultValue: joi.joi.boolean().default(false),
11945
11965
  // Resourceful options
11946
- propertyKey: index.joi.string().default(""),
11947
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11948
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11949
- nullable: index.joi.boolean().default(false),
11950
- description: index.joi.string().optional(),
11951
- default: index.joi.any().optional(),
11952
- externalDocs: index.joi.object({
11953
- description: index.joi.string().optional(),
11954
- url: index.joi.string().uri().required()
11966
+ propertyKey: joi.joi.string().default(""),
11967
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11968
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11969
+ nullable: joi.joi.boolean().default(false),
11970
+ description: joi.joi.string().optional(),
11971
+ default: joi.joi.any().optional(),
11972
+ externalDocs: joi.joi.object({
11973
+ description: joi.joi.string().optional(),
11974
+ url: joi.joi.string().uri().required()
11955
11975
  }).optional(),
11956
- example: index.joi.string().optional(),
11957
- deprecated: index.joi.boolean().default(false),
11958
- type: index.joi.alternatives(
11976
+ example: joi.joi.string().optional(),
11977
+ deprecated: joi.joi.boolean().default(false),
11978
+ type: joi.joi.alternatives(
11959
11979
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulObjectType, "ResourcefulObjectType")
11960
11980
  ).default(() => new definitions.ResourcefulObjectType())
11961
11981
  });
11962
- const arrayColumnOptionsSchema = index.joi.object({
11982
+ const arrayColumnOptionsSchema = joi.joi.object({
11963
11983
  // Lucid ColumnOptions (full)
11964
- columnName: index.joi.string().optional(),
11965
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11966
- serialize: index.joi.function().optional(),
11967
- consume: index.joi.function().optional(),
11968
- prepare: index.joi.function().optional(),
11969
- meta: index.joi.object().optional(),
11970
- isPrimary: index.joi.boolean().default(false),
11971
- hasDefaultValue: index.joi.boolean().default(false),
11984
+ columnName: joi.joi.string().optional(),
11985
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
11986
+ serialize: joi.joi.function().optional(),
11987
+ consume: joi.joi.function().optional(),
11988
+ prepare: joi.joi.function().optional(),
11989
+ meta: joi.joi.object().optional(),
11990
+ isPrimary: joi.joi.boolean().default(false),
11991
+ hasDefaultValue: joi.joi.boolean().default(false),
11972
11992
  // Resourceful options
11973
- propertyKey: index.joi.string().default(""),
11974
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11975
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11976
- nullable: index.joi.boolean().default(false),
11977
- description: index.joi.string().optional(),
11978
- default: index.joi.any().optional(),
11979
- externalDocs: index.joi.object({
11980
- description: index.joi.string().optional(),
11981
- url: index.joi.string().uri().required()
11993
+ propertyKey: joi.joi.string().default(""),
11994
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11995
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11996
+ nullable: joi.joi.boolean().default(false),
11997
+ description: joi.joi.string().optional(),
11998
+ default: joi.joi.any().optional(),
11999
+ externalDocs: joi.joi.object({
12000
+ description: joi.joi.string().optional(),
12001
+ url: joi.joi.string().uri().required()
11982
12002
  }).optional(),
11983
- example: index.joi.string().optional(),
11984
- deprecated: index.joi.boolean().default(false),
11985
- type: index.joi.alternatives(
12003
+ example: joi.joi.string().optional(),
12004
+ deprecated: joi.joi.boolean().default(false),
12005
+ type: joi.joi.alternatives(
11986
12006
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulArrayType, "ResourcefulArrayType")
11987
12007
  ).default(() => new definitions.ResourcefulArrayType())
11988
12008
  });
11989
12009
  localResourcefulPropertyDefinitionSchema.append({
11990
- writable: index.joi.boolean().default(false)
12010
+ writable: joi.joi.boolean().default(false)
11991
12011
  });
11992
- const resourcefulComputedOptionsSchema = index.joi.object({
12012
+ const resourcefulComputedOptionsSchema = joi.joi.object({
11993
12013
  // Lucid ComputedOptions (partial)
11994
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11995
- serialize: index.joi.function().optional(),
11996
- meta: index.joi.object().optional(),
12014
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12015
+ serialize: joi.joi.function().optional(),
12016
+ meta: joi.joi.object().optional(),
11997
12017
  // Resourceful options
11998
- propertyKey: index.joi.string().default(""),
11999
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12000
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12001
- nullable: index.joi.boolean().default(false),
12002
- description: index.joi.string().optional(),
12003
- default: index.joi.any().optional(),
12004
- externalDocs: index.joi.object({
12005
- description: index.joi.string().optional(),
12006
- url: index.joi.string().uri().required()
12018
+ propertyKey: joi.joi.string().default(""),
12019
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12020
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12021
+ nullable: joi.joi.boolean().default(false),
12022
+ description: joi.joi.string().optional(),
12023
+ default: joi.joi.any().optional(),
12024
+ externalDocs: joi.joi.object({
12025
+ description: joi.joi.string().optional(),
12026
+ url: joi.joi.string().uri().required()
12007
12027
  }).optional(),
12008
- example: index.joi.string().optional(),
12009
- deprecated: index.joi.boolean().default(false),
12028
+ example: joi.joi.string().optional(),
12029
+ deprecated: joi.joi.boolean().default(false),
12010
12030
  type: resourcefulDataTypeSchema.required()
12011
12031
  });
12012
- const dataTypeComputedOptionsSchema = index.joi.object({
12032
+ const dataTypeComputedOptionsSchema = joi.joi.object({
12013
12033
  // Lucid ComputedOptions (partial) - excluding 'prepare' and 'consume'
12014
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12015
- serialize: index.joi.function().optional(),
12016
- meta: index.joi.object().optional(),
12034
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12035
+ serialize: joi.joi.function().optional(),
12036
+ meta: joi.joi.object().optional(),
12017
12037
  // Resourceful options
12018
- propertyKey: index.joi.string().default(""),
12019
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12020
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12021
- nullable: index.joi.boolean().default(false),
12022
- description: index.joi.string().optional(),
12023
- default: index.joi.any().optional(),
12024
- externalDocs: index.joi.object({
12025
- description: index.joi.string().optional(),
12026
- url: index.joi.string().uri().required()
12038
+ propertyKey: joi.joi.string().default(""),
12039
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12040
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12041
+ nullable: joi.joi.boolean().default(false),
12042
+ description: joi.joi.string().optional(),
12043
+ default: joi.joi.any().optional(),
12044
+ externalDocs: joi.joi.object({
12045
+ description: joi.joi.string().optional(),
12046
+ url: joi.joi.string().uri().required()
12027
12047
  }).optional(),
12028
- example: index.joi.string().optional(),
12029
- deprecated: index.joi.boolean().default(false),
12048
+ example: joi.joi.string().optional(),
12049
+ deprecated: joi.joi.boolean().default(false),
12030
12050
  type: resourcefulDataTypeSchema.optional()
12031
12051
  });
12032
12052
  const baseDateComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12033
- autoCreate: index.joi.boolean().default(false),
12034
- autoUpdate: index.joi.boolean().default(false)
12053
+ autoCreate: joi.joi.boolean().default(false),
12054
+ autoUpdate: joi.joi.boolean().default(false)
12035
12055
  });
12036
12056
  const stringComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12037
- type: index.joi.alternatives(
12057
+ type: joi.joi.alternatives(
12038
12058
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType")
12039
12059
  ).default(() => new definitions.ResourcefulStringType())
12040
12060
  });
12041
12061
  const dateComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
12042
- type: index.joi.alternatives(
12062
+ type: joi.joi.alternatives(
12043
12063
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType")
12044
12064
  ).default(() => new definitions.ResourcefulDateType())
12045
12065
  });
12046
12066
  const dateTimeComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
12047
- type: index.joi.alternatives(
12067
+ type: joi.joi.alternatives(
12048
12068
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType")
12049
12069
  ).default(() => new definitions.ResourcefulDateTimeType())
12050
12070
  });
12051
12071
  const binaryComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12052
- type: index.joi.alternatives(
12072
+ type: joi.joi.alternatives(
12053
12073
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBinaryType, "ResourcefulBinaryType")
12054
12074
  ).default(() => new definitions.ResourcefulBinaryType())
12055
12075
  });
12056
12076
  const numberComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12057
- type: index.joi.alternatives(
12077
+ type: joi.joi.alternatives(
12058
12078
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulNumberType, "ResourcefulNumberType")
12059
12079
  ).default(() => new definitions.ResourcefulNumberType())
12060
12080
  });
12061
12081
  const integerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12062
- type: index.joi.alternatives(
12082
+ type: joi.joi.alternatives(
12063
12083
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulIntegerType, "ResourcefulIntegerType")
12064
12084
  ).default(() => new definitions.ResourcefulIntegerType())
12065
12085
  });
12066
12086
  const bigintComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12067
- type: index.joi.alternatives(
12087
+ type: joi.joi.alternatives(
12068
12088
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBigintType, "ResourcefulBigintType")
12069
12089
  ).default(() => new definitions.ResourcefulBigintType())
12070
12090
  });
12071
12091
  const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12072
- type: index.joi.alternatives(
12092
+ type: joi.joi.alternatives(
12073
12093
  ...joiInstanceCheckerAlternativesFactory(
12074
12094
  definitions.ResourcefulUnsignedIntegerType,
12075
12095
  "ResourcefulUnsignedIntegerType"
@@ -12077,99 +12097,99 @@ const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys(
12077
12097
  ).default(() => new definitions.ResourcefulUnsignedIntegerType())
12078
12098
  });
12079
12099
  const booleanComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12080
- type: index.joi.alternatives(
12100
+ type: joi.joi.alternatives(
12081
12101
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBooleanType, "ResourcefulBooleanType")
12082
12102
  ).default(() => new definitions.ResourcefulBooleanType())
12083
12103
  });
12084
- const objectComputedOptionsSchema = index.joi.object({
12104
+ const objectComputedOptionsSchema = joi.joi.object({
12085
12105
  // Lucid ComputedOptions (full)
12086
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12087
- serialize: index.joi.function().optional(),
12088
- meta: index.joi.object().optional(),
12106
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12107
+ serialize: joi.joi.function().optional(),
12108
+ meta: joi.joi.object().optional(),
12089
12109
  // Resourceful options
12090
- propertyKey: index.joi.string().default(""),
12091
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12092
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12093
- nullable: index.joi.boolean().default(false),
12094
- description: index.joi.string().optional(),
12095
- default: index.joi.any().optional(),
12096
- externalDocs: index.joi.object({
12097
- description: index.joi.string().optional(),
12098
- url: index.joi.string().uri().required()
12110
+ propertyKey: joi.joi.string().default(""),
12111
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12112
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12113
+ nullable: joi.joi.boolean().default(false),
12114
+ description: joi.joi.string().optional(),
12115
+ default: joi.joi.any().optional(),
12116
+ externalDocs: joi.joi.object({
12117
+ description: joi.joi.string().optional(),
12118
+ url: joi.joi.string().uri().required()
12099
12119
  }).optional(),
12100
- example: index.joi.string().optional(),
12101
- deprecated: index.joi.boolean().default(false),
12102
- type: index.joi.alternatives(
12120
+ example: joi.joi.string().optional(),
12121
+ deprecated: joi.joi.boolean().default(false),
12122
+ type: joi.joi.alternatives(
12103
12123
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulObjectType, "ResourcefulObjectType")
12104
12124
  ).default(() => new definitions.ResourcefulObjectType())
12105
12125
  });
12106
- const arrayComputedOptionsSchema = index.joi.object({
12126
+ const arrayComputedOptionsSchema = joi.joi.object({
12107
12127
  // Lucid ComputedOptions (full)
12108
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12109
- serialize: index.joi.function().optional(),
12110
- meta: index.joi.object().optional(),
12128
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12129
+ serialize: joi.joi.function().optional(),
12130
+ meta: joi.joi.object().optional(),
12111
12131
  // Resourceful options
12112
- propertyKey: index.joi.string().default(""),
12113
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12114
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12115
- nullable: index.joi.boolean().default(false),
12116
- description: index.joi.string().optional(),
12117
- default: index.joi.any().optional(),
12118
- externalDocs: index.joi.object({
12119
- description: index.joi.string().optional(),
12120
- url: index.joi.string().uri().required()
12132
+ propertyKey: joi.joi.string().default(""),
12133
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12134
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12135
+ nullable: joi.joi.boolean().default(false),
12136
+ description: joi.joi.string().optional(),
12137
+ default: joi.joi.any().optional(),
12138
+ externalDocs: joi.joi.object({
12139
+ description: joi.joi.string().optional(),
12140
+ url: joi.joi.string().uri().required()
12121
12141
  }).optional(),
12122
- example: index.joi.string().optional(),
12123
- deprecated: index.joi.boolean().default(false),
12124
- type: index.joi.alternatives(
12142
+ example: joi.joi.string().optional(),
12143
+ deprecated: joi.joi.boolean().default(false),
12144
+ type: joi.joi.alternatives(
12125
12145
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulArrayType, "ResourcefulArrayType")
12126
12146
  ).default(() => new definitions.ResourcefulArrayType())
12127
12147
  });
12128
- const resourcefulRelationshipOptionsSchema = index.joi.object({
12148
+ const resourcefulRelationshipOptionsSchema = joi.joi.object({
12129
12149
  // Resourceful options
12130
- propertyKey: index.joi.string().default(""),
12131
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12132
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12133
- nullable: index.joi.boolean().default(false),
12134
- description: index.joi.string().optional(),
12135
- default: index.joi.any().optional(),
12136
- externalDocs: index.joi.object({
12137
- description: index.joi.string().optional(),
12138
- url: index.joi.string().uri().required()
12150
+ propertyKey: joi.joi.string().default(""),
12151
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12152
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12153
+ nullable: joi.joi.boolean().default(false),
12154
+ description: joi.joi.string().optional(),
12155
+ default: joi.joi.any().optional(),
12156
+ externalDocs: joi.joi.object({
12157
+ description: joi.joi.string().optional(),
12158
+ url: joi.joi.string().uri().required()
12139
12159
  }).optional(),
12140
- example: index.joi.string().optional(),
12141
- deprecated: index.joi.boolean().default(false)
12160
+ example: joi.joi.string().optional(),
12161
+ deprecated: joi.joi.boolean().default(false)
12142
12162
  });
12143
12163
  const relationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12144
12164
  // Lucid RelationOptions
12145
- localKey: index.joi.string().optional(),
12146
- foreignKey: index.joi.string().optional(),
12147
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12148
- onQuery: index.joi.function().optional(),
12149
- relatedModel: index.joi.function()
12165
+ localKey: joi.joi.string().optional(),
12166
+ foreignKey: joi.joi.string().optional(),
12167
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12168
+ onQuery: joi.joi.function().optional(),
12169
+ relatedModel: joi.joi.function()
12150
12170
  });
12151
12171
  const manyToManyRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12152
12172
  // Lucid ManyToManyRelationOptions
12153
- localKey: index.joi.string().optional(),
12154
- relatedKey: index.joi.string().optional(),
12155
- pivotForeignKey: index.joi.string().optional(),
12156
- pivotRelatedForeignKey: index.joi.string().optional(),
12157
- pivotTable: index.joi.string().optional(),
12158
- pivotTimestamps: index.joi.boolean().optional(),
12159
- pivotColumns: index.joi.array().items(index.joi.string()).optional(),
12160
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12161
- onQuery: index.joi.function().optional(),
12162
- relatedModel: index.joi.function()
12173
+ localKey: joi.joi.string().optional(),
12174
+ relatedKey: joi.joi.string().optional(),
12175
+ pivotForeignKey: joi.joi.string().optional(),
12176
+ pivotRelatedForeignKey: joi.joi.string().optional(),
12177
+ pivotTable: joi.joi.string().optional(),
12178
+ pivotTimestamps: joi.joi.boolean().optional(),
12179
+ pivotColumns: joi.joi.array().items(joi.joi.string()).optional(),
12180
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12181
+ onQuery: joi.joi.function().optional(),
12182
+ relatedModel: joi.joi.function()
12163
12183
  });
12164
12184
  const hasManyThroughRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12165
12185
  // Lucid HasManyThroughRelationOptions (ThroughRelationOptions without throughModel)
12166
- localKey: index.joi.string().optional(),
12167
- foreignKey: index.joi.string().optional(),
12168
- throughLocalKey: index.joi.string().optional(),
12169
- throughForeignKey: index.joi.string().optional(),
12170
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12171
- onQuery: index.joi.function().optional(),
12172
- relatedModel: index.joi.function()
12186
+ localKey: joi.joi.string().optional(),
12187
+ foreignKey: joi.joi.string().optional(),
12188
+ throughLocalKey: joi.joi.string().optional(),
12189
+ throughForeignKey: joi.joi.string().optional(),
12190
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12191
+ onQuery: joi.joi.function().optional(),
12192
+ relatedModel: joi.joi.function()
12173
12193
  });
12174
12194
  const extractLucidOptionsForLucidDecorator = (options, keys, overrides) => {
12175
12195
  const extracted = {};
@@ -12261,16 +12281,37 @@ const handleResourcefulColumn = (config) => {
12261
12281
  propertyKey,
12262
12282
  decoratorOption,
12263
12283
  decoratorOptionsValidationSchema,
12264
- overrides,
12265
- lucidDecoratorFunction
12284
+ overrides = {},
12285
+ lucidDecoratorFunction,
12286
+ defaultPrepare,
12287
+ defaultConsume
12266
12288
  } = config;
12267
12289
  const opts = validateNormalizeAndCastDecoratorOptions(propertyKey, decoratorName, decoratorOptionsValidationSchema, {
12268
12290
  ...decoratorOption,
12269
12291
  propertyKey
12270
12292
  });
12293
+ const customPrepare = opts.prepare;
12294
+ const customConsume = opts.consume;
12295
+ const nullable = opts.nullable || false;
12296
+ const chainedPrepare = PrepareConsumeChainBuilder.chainPrepare(
12297
+ propertyKey,
12298
+ nullable,
12299
+ defaultPrepare,
12300
+ customPrepare
12301
+ );
12302
+ const chainedConsume = PrepareConsumeChainBuilder.chainConsume(
12303
+ propertyKey,
12304
+ nullable,
12305
+ defaultConsume,
12306
+ customConsume
12307
+ );
12271
12308
  const lucidOptions = extractLucidOptionsForLucidColumnDecorator(
12272
12309
  opts,
12273
- overrides
12310
+ {
12311
+ ...overrides,
12312
+ ...chainedPrepare && { prepare: chainedPrepare },
12313
+ ...chainedConsume && { consume: chainedConsume }
12314
+ }
12274
12315
  );
12275
12316
  lucidDecoratorFunction(lucidOptions)(target, propertyKey);
12276
12317
  const map = ensureOwnResourcefulMap(target, "$resourcefulColumns");
@@ -12318,10 +12359,8 @@ resourcefulColumn.string = function(options = {}) {
12318
12359
  decoratorOption: options,
12319
12360
  decoratorOptionsValidationSchema,
12320
12361
  lucidDecoratorFunction: column,
12321
- overrides: {
12322
- prepare: (value) => decorator_utils.prepareString(propertyKey, value, options.nullable),
12323
- consume: (value) => decorator_utils.consumeString(propertyKey, value, options.nullable)
12324
- }
12362
+ defaultPrepare: decorator_utils.prepareString,
12363
+ defaultConsume: decorator_utils.consumeString
12325
12364
  });
12326
12365
  };
12327
12366
  };
@@ -12364,10 +12403,8 @@ resourcefulColumn.binary = function(options = {}) {
12364
12403
  decoratorOption: options,
12365
12404
  decoratorOptionsValidationSchema,
12366
12405
  lucidDecoratorFunction: column,
12367
- overrides: {
12368
- prepare: (value) => decorator_utils.prepareBinary(propertyKey, value, options.nullable),
12369
- consume: (value) => decorator_utils.consumeBinary(propertyKey, value, options.nullable)
12370
- }
12406
+ defaultPrepare: decorator_utils.prepareBinary,
12407
+ defaultConsume: decorator_utils.consumeBinary
12371
12408
  });
12372
12409
  };
12373
12410
  };
@@ -12382,10 +12419,8 @@ resourcefulColumn.number = function(options = {}) {
12382
12419
  decoratorOption: options,
12383
12420
  decoratorOptionsValidationSchema,
12384
12421
  lucidDecoratorFunction: column,
12385
- overrides: {
12386
- prepare: (value) => decorator_utils.prepareNumber(propertyKey, value, options.nullable),
12387
- consume: (value) => decorator_utils.consumeNumber(propertyKey, value, options.nullable)
12388
- }
12422
+ defaultPrepare: decorator_utils.prepareNumber,
12423
+ defaultConsume: decorator_utils.consumeNumber
12389
12424
  });
12390
12425
  };
12391
12426
  };
@@ -12400,10 +12435,8 @@ resourcefulColumn.integer = function(options = {}) {
12400
12435
  decoratorOption: options,
12401
12436
  decoratorOptionsValidationSchema,
12402
12437
  lucidDecoratorFunction: column,
12403
- overrides: {
12404
- prepare: (value) => decorator_utils.prepareInteger(propertyKey, value, options.nullable),
12405
- consume: (value) => decorator_utils.consumeInteger(propertyKey, value, options.nullable)
12406
- }
12438
+ defaultPrepare: decorator_utils.prepareInteger,
12439
+ defaultConsume: decorator_utils.consumeInteger
12407
12440
  });
12408
12441
  };
12409
12442
  };
@@ -12418,10 +12451,8 @@ resourcefulColumn.bigint = function(options = {}) {
12418
12451
  decoratorOption: options,
12419
12452
  decoratorOptionsValidationSchema,
12420
12453
  lucidDecoratorFunction: column,
12421
- overrides: {
12422
- prepare: (value) => decorator_utils.prepareBigint(propertyKey, value, options.nullable),
12423
- consume: (value) => decorator_utils.consumeBigint(propertyKey, value, options.nullable)
12424
- }
12454
+ defaultPrepare: decorator_utils.prepareBigint,
12455
+ defaultConsume: decorator_utils.consumeBigint
12425
12456
  });
12426
12457
  };
12427
12458
  };
@@ -12436,10 +12467,8 @@ resourcefulColumn.unsignedint = function(options = {}) {
12436
12467
  decoratorOption: options,
12437
12468
  decoratorOptionsValidationSchema,
12438
12469
  lucidDecoratorFunction: column,
12439
- overrides: {
12440
- prepare: (value) => decorator_utils.prepareUnsignedint(propertyKey, value, options.nullable),
12441
- consume: (value) => decorator_utils.consumeUnsignedint(propertyKey, value, options.nullable)
12442
- }
12470
+ defaultPrepare: decorator_utils.prepareUnsignedint,
12471
+ defaultConsume: decorator_utils.consumeUnsignedint
12443
12472
  });
12444
12473
  };
12445
12474
  };
@@ -12454,10 +12483,8 @@ resourcefulColumn.boolean = function(options = {}) {
12454
12483
  decoratorOption: options,
12455
12484
  decoratorOptionsValidationSchema,
12456
12485
  lucidDecoratorFunction: column,
12457
- overrides: {
12458
- prepare: (value) => decorator_utils.prepareBoolean(propertyKey, value, options.nullable),
12459
- consume: (value) => decorator_utils.consumeBoolean(propertyKey, value, options.nullable)
12460
- }
12486
+ defaultPrepare: decorator_utils.prepareBoolean,
12487
+ defaultConsume: decorator_utils.consumeBoolean
12461
12488
  });
12462
12489
  };
12463
12490
  };
@@ -12472,10 +12499,8 @@ resourcefulColumn.object = function(options = {}) {
12472
12499
  decoratorOption: options,
12473
12500
  decoratorOptionsValidationSchema,
12474
12501
  lucidDecoratorFunction: column,
12475
- overrides: {
12476
- prepare: (value) => decorator_utils.prepareObject(propertyKey, value, options.nullable),
12477
- consume: (value) => decorator_utils.consumeObject(propertyKey, value, options.nullable)
12478
- }
12502
+ defaultPrepare: decorator_utils.prepareObject,
12503
+ defaultConsume: decorator_utils.consumeObject
12479
12504
  });
12480
12505
  };
12481
12506
  };
@@ -12490,10 +12515,8 @@ resourcefulColumn.array = function(options = {}) {
12490
12515
  decoratorOption: options,
12491
12516
  decoratorOptionsValidationSchema,
12492
12517
  lucidDecoratorFunction: column,
12493
- overrides: {
12494
- prepare: (value) => decorator_utils.prepareArray(propertyKey, value, options.nullable),
12495
- consume: (value) => decorator_utils.consumeArray(propertyKey, value, options.nullable)
12496
- }
12518
+ defaultPrepare: decorator_utils.prepareArray,
12519
+ defaultConsume: decorator_utils.consumeArray
12497
12520
  });
12498
12521
  };
12499
12522
  };
@@ -12721,7 +12744,7 @@ function resourcefulHasManyThrough(model, options = {}) {
12721
12744
  map.set(propertyKey, opts);
12722
12745
  };
12723
12746
  }
12724
- const version = "1.20250718.1";
12747
+ const version = "1.20250724.0";
12725
12748
  exports.errors = errors.errors;
12726
12749
  exports.definitions = definitions.definitions;
12727
12750
  exports.resourcefulBelongsTo = resourcefulBelongsTo;