@nhtio/lucid-resourceful 0.1.0-master-c2c013d9 → 0.1.0-master-71781cfd

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.mjs CHANGED
@@ -10,13 +10,13 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
12
  var _a, _hookHandlers, _cleanupHandlers, _state, _handlersToIgnore, _skipAllHooks, _Runner_instances, filter_fn, exec_fn, _b, _hooks, _c, _d;
13
- import { I as isObject$1, J as isResourcefulModel, K as DateTime, F as consumeString, u as prepareString, y as consumeBinary, m as prepareBinary, D as consumeNumber, s as prepareNumber, C as consumeInteger, r as prepareInteger, x as consumeBigint, l as prepareBigint, G as consumeUnsignedint, v as prepareUnsignedint, z as consumeBoolean, n as prepareBoolean, E as consumeObject, t as prepareObject, w as consumeArray, p as prepareArray } from "./decorator_utils-BUuBwQYK.js";
14
- import { j as joi } from "./index-DDaZ2qr2.js";
13
+ import { I as isObject$1, J as isResourcefulModel, K as CRUDOperationsEnum, L as operationCRUDToACL, M as ACLOperationsEnum, N as isFunction, O as prepareFields, P as isString$1, Q as DateTime, F as consumeString, u as prepareString, y as consumeBinary, m as prepareBinary, D as consumeNumber, s as prepareNumber, C as consumeInteger, r as prepareInteger, x as consumeBigint, l as prepareBigint, G as consumeUnsignedint, v as prepareUnsignedint, z as consumeBoolean, n as prepareBoolean, E as consumeObject, t as prepareObject, w as consumeArray, p as prepareArray } from "./decorator_utils-YSb1EGJ6.js";
14
+ import { joi as Q_ } from "./joi.mjs";
15
15
  import { parse as parse$2, SyntaxError as SyntaxError$1 } from "liqe";
16
16
  import { d as E_LUCENE_SYNTAX_EXCEPTION, e as E_LUCENE_UNEXPECTED_EXCEPTION, f as E_LUCENE_INVALID_TYPE, g as E_INVALID_RESOURCEFUL_MIXIN_OPTIONS, h as E_MISSING_PRIMARY_KEY_EXCEPTION, i as E_FORBIDDEN, j as E_INVALID_COLUMN_ACCESS, k as E_INVALID_RESOUREFUL_INDEX_REQUEST_EXCEPTION, l as E_RECORD_NOT_FOUND_EXCEPTION, m as E_INVALID_PAYLOAD_EXCEPTION, n as E_FORBIDDEN_PAYLOAD_EXCEPTION, o as createError, p as Exception, q as getDefaultExportFromCjs, r as commonjsGlobal, s as index_default, t as defineStaticProperty, u as lodash, v as E_INVALID_RESOURCEFUL_DECORATOR_OPTIONS } from "./errors-B1rr67uM.js";
17
17
  import { w } from "./errors-B1rr67uM.js";
18
- import { R as ResourcefulArrayType, a as ResourcefulObjectType, b as ResourcefulBooleanType, c as ResourcefulUnsignedIntegerType, d as ResourcefulBigintType, e as ResourcefulIntegerType, f as ResourcefulNumberType, g as ResourcefulBinaryType, h as ResourcefulDateTimeType, i as ResourcefulDateType, j as ResourcefulStringType } from "./definitions-B66EPk0H.js";
19
- import { k } from "./definitions-B66EPk0H.js";
18
+ import { R as ResourcefulArrayType, a as ResourcefulObjectType, b as ResourcefulBooleanType, c as ResourcefulUnsignedIntegerType, d as ResourcefulBigintType, e as ResourcefulIntegerType, f as ResourcefulNumberType, g as ResourcefulBinaryType, h as ResourcefulDateTimeType, i as ResourcefulDateType, j as ResourcefulStringType } from "./definitions-B88XBTUF.js";
19
+ import { k } from "./definitions-B88XBTUF.js";
20
20
  import require$$0, { debuglog } from "util";
21
21
  import "node:path";
22
22
  import "node:url";
@@ -589,43 +589,6 @@ 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
594
  if (isString$1(definition.serializeAs)) {
@@ -635,31 +598,31 @@ const getFieldKey = (key, definition) => {
635
598
  };
636
599
  function withResourceful(options = {}) {
637
600
  return (superclass) => {
638
- const optionsSchema = joi.object({
639
- name: joi.string().default(superclass.name),
640
- readRequiredForWrite: joi.boolean().default(false),
641
- accessControlFilters: joi.object({
642
- list: joi.array().items(joi.function()).default([]),
643
- create: joi.array().items(joi.function()).default([]),
644
- read: joi.array().items(joi.function()).default([]),
645
- update: joi.array().items(joi.function()).default([]),
646
- delete: joi.array().items(joi.function()).default([])
601
+ const optionsSchema = Q_.object({
602
+ name: Q_.string().default(superclass.name),
603
+ readRequiredForWrite: Q_.boolean().default(false),
604
+ accessControlFilters: Q_.object({
605
+ list: Q_.array().items(Q_.function()).default([]),
606
+ create: Q_.array().items(Q_.function()).default([]),
607
+ read: Q_.array().items(Q_.function()).default([]),
608
+ update: Q_.array().items(Q_.function()).default([]),
609
+ delete: Q_.array().items(Q_.function()).default([])
647
610
  }).default({}),
648
- onACLError: joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
649
- onValidationScopeError: joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
650
- queryScopeCallbacks: joi.object({
651
- list: joi.array().items(joi.function()).default([]),
652
- access: joi.array().items(joi.function()).default([])
611
+ onACLError: Q_.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
612
+ onValidationScopeError: Q_.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
613
+ queryScopeCallbacks: Q_.object({
614
+ list: Q_.array().items(Q_.function()).default([]),
615
+ access: Q_.array().items(Q_.function()).default([])
653
616
  }).default({}),
654
- description: joi.string().optional(),
655
- externalDocs: joi.object({
656
- description: joi.string().optional(),
657
- url: joi.string().uri().required()
617
+ description: Q_.string().optional(),
618
+ externalDocs: Q_.object({
619
+ description: Q_.string().optional(),
620
+ url: Q_.string().uri().required()
658
621
  }).optional(),
659
- example: joi.string().optional(),
660
- advanced: joi.object({
661
- propertyEvaluationConcurrency: joi.number().integer().min(1).default(10),
662
- aclEvaluationConcurrency: joi.number().integer().min(1).default(2)
622
+ example: Q_.string().optional(),
623
+ advanced: Q_.object({
624
+ propertyEvaluationConcurrency: Q_.number().integer().min(1).default(10),
625
+ aclEvaluationConcurrency: Q_.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: joi.forbidden(),
766
+ validator: Q_.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 joi.any().forbidden();
781
+ return Q_.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 joi.any().forbidden();
803
+ return Q_.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 joi.any().forbidden();
812
+ return Q_.any().forbidden();
850
813
  }
851
814
  nullable = nullable || "boolean" === typeof datatype.nullable && datatype.nullable;
852
815
  switch (true) {
853
816
  case datatype instanceof ResourcefulStringType: {
854
817
  const d = datatype;
855
- const r = joi.string().min(d.minLength).max(d.maxLength);
818
+ const r = Q_.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 ResourcefulDateType: {
868
- const r = joi.date().iso();
831
+ const r = Q_.date().iso();
869
832
  if (nullable) {
870
833
  r.allow(null);
871
834
  }
872
835
  return r;
873
836
  }
874
837
  case datatype instanceof ResourcefulDateTimeType: {
875
- const r = joi.date().iso();
838
+ const r = Q_.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 ResourcefulBinaryType: {
882
845
  const d = datatype;
883
- const r = joi.string();
846
+ const r = Q_.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 ResourcefulNumberType: {
896
859
  const d = datatype;
897
- const r = joi.number();
860
+ const r = Q_.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 ResourcefulIntegerType: {
915
878
  const d = datatype;
916
- const r = joi.number();
879
+ const r = Q_.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 ResourcefulBigintType: {
934
897
  const d = datatype;
935
- const r = joi.bigint();
898
+ const r = Q_.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 ResourcefulUnsignedIntegerType: {
953
916
  const d = datatype;
954
- const r = joi.number().unsafe();
917
+ const r = Q_.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 ResourcefulBooleanType: {
972
- const r = joi.boolean();
935
+ const r = Q_.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 = joi.alternatives().try(...alternatives);
955
+ propValidator = Q_.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), joi.any());
965
+ propValidator = schemas.reduce((acc, schema) => acc.concat(schema), Q_.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 = joi.alternatives().try(...alternatives);
975
+ propValidator = Q_.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 = joi.any().not(...notSchemas);
985
+ propValidator = Q_.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 = joi.object(objectSchema);
999
+ const r = Q_.object(objectSchema);
1037
1000
  if (nullable) {
1038
1001
  r.allow(null);
1039
1002
  }
@@ -1046,7 +1009,7 @@ function withResourceful(options = {}) {
1046
1009
  if (isObject$1(d.additionalProperties)) {
1047
1010
  const additionalPropertiesType = d.additionalProperties;
1048
1011
  r.pattern(
1049
- joi.string(),
1012
+ Q_.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 ResourcefulArrayType: {
1063
1026
  const d = datatype;
1064
- const r = joi.array();
1027
+ const r = Q_.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 = joi.alternatives().try(...alternatives);
1041
+ itemValidator = Q_.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), joi.any());
1051
+ itemValidator = schemas.reduce((acc, schema) => acc.concat(schema), Q_.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 = joi.alternatives().try(...alternatives);
1061
+ itemValidator = Q_.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 = joi.any().not(...notSchemas);
1071
+ itemValidator = Q_.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 joi.any().forbidden();
1093
+ return Q_.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
  }
@@ -1480,7 +1443,7 @@ 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) {
@@ -1502,11 +1465,11 @@ function withResourceful(options = {}) {
1502
1465
  if (possibleFields.length === 0) {
1503
1466
  throw new E_INVALID_COLUMN_ACCESS("No fields available for access");
1504
1467
  }
1505
- const schema = joi.object({
1506
- filter: joi.string().allow("").required(),
1507
- page: joi.number().integer().min(1).required(),
1508
- perPage: joi.number().integer().min(1).max(100).required(),
1509
- fields: joi.array().items(joi.string().valid(...possibleFields)).required()
1468
+ const schema = Q_.object({
1469
+ filter: Q_.string().allow("").required(),
1470
+ page: Q_.number().integer().min(1).required(),
1471
+ perPage: Q_.number().integer().min(1).max(100).required(),
1472
+ fields: Q_.array().items(Q_.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]);
@@ -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 = createError('Invalid value for "%s". %s', "E_INVALID_DATE_COLUMN_VALUE", 500);
1863
1883
  const E_MISSING_MODEL_ATTRIBUTE = 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 = createError("Cannot mutate delete model instance", "E_MODEL_DELETED", 500);
@@ -2793,7 +2813,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
2793
2813
  var ys = arrObjKeys(obj, inspect2);
2794
2814
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
2795
2815
  var protoTag = obj instanceof Object ? "" : "null prototype";
2796
- var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
2816
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
2797
2817
  var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
2798
2818
  var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
2799
2819
  if (ys.length === 0) {
@@ -2818,25 +2838,25 @@ function canTrustToString(obj) {
2818
2838
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
2819
2839
  }
2820
2840
  function isArray$3(obj) {
2821
- return toStr(obj) === "[object Array]" && canTrustToString(obj);
2841
+ return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
2822
2842
  }
2823
2843
  function isDate(obj) {
2824
- return toStr(obj) === "[object Date]" && canTrustToString(obj);
2844
+ return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
2825
2845
  }
2826
2846
  function isRegExp$1(obj) {
2827
- return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
2847
+ return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
2828
2848
  }
2829
2849
  function isError(obj) {
2830
- return toStr(obj) === "[object Error]" && canTrustToString(obj);
2850
+ return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
2831
2851
  }
2832
2852
  function isString(obj) {
2833
- return toStr(obj) === "[object String]" && canTrustToString(obj);
2853
+ return toStr$1(obj) === "[object String]" && canTrustToString(obj);
2834
2854
  }
2835
2855
  function isNumber(obj) {
2836
- return toStr(obj) === "[object Number]" && canTrustToString(obj);
2856
+ return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
2837
2857
  }
2838
2858
  function isBoolean(obj) {
2839
- return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
2859
+ return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
2840
2860
  }
2841
2861
  function isSymbol(obj) {
2842
2862
  if (hasShammedSymbols) {
@@ -2872,7 +2892,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
2872
2892
  function has$3(obj, key) {
2873
2893
  return hasOwn$1.call(obj, key);
2874
2894
  }
2875
- function toStr(obj) {
2895
+ function toStr$1(obj) {
2876
2896
  return objectToString.call(obj);
2877
2897
  }
2878
2898
  function nameOf(f) {
@@ -3181,7 +3201,7 @@ var syntax = SyntaxError;
3181
3201
  var uri = URIError;
3182
3202
  var abs$1 = Math.abs;
3183
3203
  var floor$1 = Math.floor;
3184
- var max$1 = Math.max;
3204
+ var max$2 = Math.max;
3185
3205
  var min$1 = Math.min;
3186
3206
  var pow$1 = Math.pow;
3187
3207
  var round$1 = Math.round;
@@ -3310,99 +3330,78 @@ function requireObject_getPrototypeOf() {
3310
3330
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
3311
3331
  return Object_getPrototypeOf;
3312
3332
  }
3313
- var implementation;
3314
- var hasRequiredImplementation;
3315
- function requireImplementation() {
3316
- if (hasRequiredImplementation) return implementation;
3317
- hasRequiredImplementation = 1;
3318
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
3319
- var toStr2 = Object.prototype.toString;
3320
- var max2 = Math.max;
3321
- var funcType = "[object Function]";
3322
- var concatty = function concatty2(a2, b) {
3323
- var arr = [];
3324
- for (var i = 0; i < a2.length; i += 1) {
3325
- arr[i] = a2[i];
3326
- }
3327
- for (var j = 0; j < b.length; j += 1) {
3328
- arr[j + a2.length] = b[j];
3329
- }
3330
- return arr;
3331
- };
3332
- var slicy = function slicy2(arrLike, offset) {
3333
- var arr = [];
3334
- for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
3335
- arr[j] = arrLike[i];
3336
- }
3337
- return arr;
3338
- };
3339
- var joiny = function(arr, joiner) {
3340
- var str = "";
3341
- for (var i = 0; i < arr.length; i += 1) {
3342
- str += arr[i];
3343
- if (i + 1 < arr.length) {
3344
- str += joiner;
3345
- }
3333
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
3334
+ var toStr = Object.prototype.toString;
3335
+ var max$1 = Math.max;
3336
+ var funcType = "[object Function]";
3337
+ var concatty = function concatty2(a2, b) {
3338
+ var arr = [];
3339
+ for (var i = 0; i < a2.length; i += 1) {
3340
+ arr[i] = a2[i];
3341
+ }
3342
+ for (var j = 0; j < b.length; j += 1) {
3343
+ arr[j + a2.length] = b[j];
3344
+ }
3345
+ return arr;
3346
+ };
3347
+ var slicy = function slicy2(arrLike, offset) {
3348
+ var arr = [];
3349
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
3350
+ arr[j] = arrLike[i];
3351
+ }
3352
+ return arr;
3353
+ };
3354
+ var joiny = function(arr, joiner) {
3355
+ var str = "";
3356
+ for (var i = 0; i < arr.length; i += 1) {
3357
+ str += arr[i];
3358
+ if (i + 1 < arr.length) {
3359
+ str += joiner;
3346
3360
  }
3347
- return str;
3348
- };
3349
- implementation = function bind2(that) {
3350
- var target = this;
3351
- if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
3352
- throw new TypeError(ERROR_MESSAGE + target);
3353
- }
3354
- var args = slicy(arguments, 1);
3355
- var bound;
3356
- var binder = function() {
3357
- if (this instanceof bound) {
3358
- var result = target.apply(
3359
- this,
3360
- concatty(args, arguments)
3361
- );
3362
- if (Object(result) === result) {
3363
- return result;
3364
- }
3365
- return this;
3366
- }
3367
- return target.apply(
3368
- that,
3361
+ }
3362
+ return str;
3363
+ };
3364
+ var implementation$1 = function bind(that) {
3365
+ var target = this;
3366
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
3367
+ throw new TypeError(ERROR_MESSAGE + target);
3368
+ }
3369
+ var args = slicy(arguments, 1);
3370
+ var bound;
3371
+ var binder = function() {
3372
+ if (this instanceof bound) {
3373
+ var result = target.apply(
3374
+ this,
3369
3375
  concatty(args, arguments)
3370
3376
  );
3371
- };
3372
- var boundLength = max2(0, target.length - args.length);
3373
- var boundArgs = [];
3374
- for (var i = 0; i < boundLength; i++) {
3375
- boundArgs[i] = "$" + i;
3376
- }
3377
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
3378
- if (target.prototype) {
3379
- var Empty = function Empty2() {
3380
- };
3381
- Empty.prototype = target.prototype;
3382
- bound.prototype = new Empty();
3383
- Empty.prototype = null;
3377
+ if (Object(result) === result) {
3378
+ return result;
3379
+ }
3380
+ return this;
3384
3381
  }
3385
- return bound;
3382
+ return target.apply(
3383
+ that,
3384
+ concatty(args, arguments)
3385
+ );
3386
3386
  };
3387
- return implementation;
3388
- }
3389
- var functionBind;
3390
- var hasRequiredFunctionBind;
3391
- function requireFunctionBind() {
3392
- if (hasRequiredFunctionBind) return functionBind;
3393
- hasRequiredFunctionBind = 1;
3394
- var implementation2 = requireImplementation();
3395
- functionBind = Function.prototype.bind || implementation2;
3396
- return functionBind;
3397
- }
3398
- var functionCall;
3399
- var hasRequiredFunctionCall;
3400
- function requireFunctionCall() {
3401
- if (hasRequiredFunctionCall) return functionCall;
3402
- hasRequiredFunctionCall = 1;
3403
- functionCall = Function.prototype.call;
3404
- return functionCall;
3405
- }
3387
+ var boundLength = max$1(0, target.length - args.length);
3388
+ var boundArgs = [];
3389
+ for (var i = 0; i < boundLength; i++) {
3390
+ boundArgs[i] = "$" + i;
3391
+ }
3392
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
3393
+ if (target.prototype) {
3394
+ var Empty = function Empty2() {
3395
+ };
3396
+ Empty.prototype = target.prototype;
3397
+ bound.prototype = new Empty();
3398
+ Empty.prototype = null;
3399
+ }
3400
+ return bound;
3401
+ };
3402
+ var implementation = implementation$1;
3403
+ var functionBind = Function.prototype.bind || implementation;
3404
+ var functionCall = Function.prototype.call;
3406
3405
  var functionApply;
3407
3406
  var hasRequiredFunctionApply;
3408
3407
  function requireFunctionApply() {
@@ -3412,14 +3411,14 @@ function requireFunctionApply() {
3412
3411
  return functionApply;
3413
3412
  }
3414
3413
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
3415
- var bind$2 = requireFunctionBind();
3414
+ var bind$2 = functionBind;
3416
3415
  var $apply$1 = requireFunctionApply();
3417
- var $call$2 = requireFunctionCall();
3416
+ var $call$2 = functionCall;
3418
3417
  var $reflectApply = reflectApply;
3419
3418
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
3420
- var bind$1 = requireFunctionBind();
3419
+ var bind$1 = functionBind;
3421
3420
  var $TypeError$4 = type;
3422
- var $call$1 = requireFunctionCall();
3421
+ var $call$1 = functionCall;
3423
3422
  var $actualApply = actualApply;
3424
3423
  var callBindApplyHelpers = function callBindBasic(args) {
3425
3424
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -3485,8 +3484,8 @@ function requireHasown() {
3485
3484
  hasRequiredHasown = 1;
3486
3485
  var call = Function.prototype.call;
3487
3486
  var $hasOwn = Object.prototype.hasOwnProperty;
3488
- var bind2 = requireFunctionBind();
3489
- hasown = bind2.call(call, $hasOwn);
3487
+ var bind3 = functionBind;
3488
+ hasown = bind3.call(call, $hasOwn);
3490
3489
  return hasown;
3491
3490
  }
3492
3491
  var undefined$1;
@@ -3500,7 +3499,7 @@ var $TypeError$3 = type;
3500
3499
  var $URIError = uri;
3501
3500
  var abs = abs$1;
3502
3501
  var floor = floor$1;
3503
- var max = max$1;
3502
+ var max = max$2;
3504
3503
  var min = min$1;
3505
3504
  var pow = pow$1;
3506
3505
  var round = round$1;
@@ -3534,7 +3533,7 @@ var getProto = requireGetProto();
3534
3533
  var $ObjectGPO = requireObject_getPrototypeOf();
3535
3534
  var $ReflectGPO = requireReflect_getPrototypeOf();
3536
3535
  var $apply = requireFunctionApply();
3537
- var $call = requireFunctionCall();
3536
+ var $call = functionCall;
3538
3537
  var needsEval = {};
3539
3538
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
3540
3539
  var INTRINSICS = {
@@ -3705,13 +3704,13 @@ var LEGACY_ALIASES = {
3705
3704
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
3706
3705
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
3707
3706
  };
3708
- var bind = requireFunctionBind();
3707
+ var bind2 = functionBind;
3709
3708
  var hasOwn = requireHasown();
3710
- var $concat = bind.call($call, Array.prototype.concat);
3711
- var $spliceApply = bind.call($apply, Array.prototype.splice);
3712
- var $replace = bind.call($call, String.prototype.replace);
3713
- var $strSlice = bind.call($call, String.prototype.slice);
3714
- var $exec = bind.call($call, RegExp.prototype.exec);
3709
+ var $concat = bind2.call($call, Array.prototype.concat);
3710
+ var $spliceApply = bind2.call($apply, Array.prototype.splice);
3711
+ var $replace = bind2.call($call, String.prototype.replace);
3712
+ var $strSlice = bind2.call($call, String.prototype.slice);
3713
+ var $exec = bind2.call($call, RegExp.prototype.exec);
3715
3714
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
3716
3715
  var reEscapeChar = /\\(\\)?/g;
3717
3716
  var stringToPath = function stringToPath2(string) {
@@ -11787,25 +11786,25 @@ const validateNormalizeAndCastDecoratorOptions = (fieldName, decoratorName, sche
11787
11786
  }
11788
11787
  return value;
11789
11788
  };
11790
- const resourcefulPropertyDefinitionSchema = joi.object({
11791
- propertyKey: joi.string().default(""),
11792
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
11793
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
11794
- nullable: joi.boolean().default(false),
11795
- description: joi.string().optional(),
11796
- default: joi.any().optional(),
11797
- externalDocs: joi.object({
11798
- description: joi.string().optional(),
11799
- url: joi.string().uri().required()
11789
+ const resourcefulPropertyDefinitionSchema = Q_.object({
11790
+ propertyKey: Q_.string().default(""),
11791
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11792
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11793
+ nullable: Q_.boolean().default(false),
11794
+ description: Q_.string().optional(),
11795
+ default: Q_.any().optional(),
11796
+ externalDocs: Q_.object({
11797
+ description: Q_.string().optional(),
11798
+ url: Q_.string().uri().required()
11800
11799
  }).optional(),
11801
- example: joi.string().optional(),
11802
- deprecated: joi.boolean().default(false)
11800
+ example: Q_.string().optional(),
11801
+ deprecated: Q_.boolean().default(false)
11803
11802
  });
11804
11803
  const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
11805
11804
  return [
11806
- joi.object().instance(Ctor),
11807
- joi.function().instance(Ctor),
11808
- joi.custom((value, helpers) => {
11805
+ Q_.object().instance(Ctor),
11806
+ Q_.function().instance(Ctor),
11807
+ Q_.custom((value, helpers) => {
11809
11808
  if (isObject$1(value) && value.constructor.name === CtorName) {
11810
11809
  return value;
11811
11810
  }
@@ -11813,7 +11812,7 @@ const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
11813
11812
  })
11814
11813
  ];
11815
11814
  };
11816
- const resourcefulDataTypeSchema = joi.alternatives(
11815
+ const resourcefulDataTypeSchema = Q_.alternatives(
11817
11816
  ...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType"),
11818
11817
  ...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType"),
11819
11818
  ...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType"),
@@ -11832,95 +11831,95 @@ const resourcefulDataTypeSchema = joi.alternatives(
11832
11831
  const localResourcefulPropertyDefinitionSchema = resourcefulPropertyDefinitionSchema.keys({
11833
11832
  type: resourcefulDataTypeSchema.required()
11834
11833
  });
11835
- const resourcefulColumnOptionsSchema = joi.object({
11834
+ const resourcefulColumnOptionsSchema = Q_.object({
11836
11835
  // Lucid ColumnOptions (partial)
11837
- columnName: joi.string().optional(),
11838
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
11839
- serialize: joi.function().optional(),
11840
- consume: joi.function().optional(),
11841
- prepare: joi.function().optional(),
11842
- meta: joi.object().optional(),
11843
- isPrimary: joi.boolean().default(false),
11844
- hasDefaultValue: joi.boolean().default(false),
11836
+ columnName: Q_.string().optional(),
11837
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
11838
+ serialize: Q_.function().optional(),
11839
+ consume: Q_.function().optional(),
11840
+ prepare: Q_.function().optional(),
11841
+ meta: Q_.object().optional(),
11842
+ isPrimary: Q_.boolean().default(false),
11843
+ hasDefaultValue: Q_.boolean().default(false),
11845
11844
  // Resourceful options
11846
- propertyKey: joi.string().default(""),
11847
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
11848
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
11849
- nullable: joi.boolean().default(false),
11850
- description: joi.string().optional(),
11851
- default: joi.any().optional(),
11852
- externalDocs: joi.object({
11853
- description: joi.string().optional(),
11854
- url: joi.string().uri().required()
11845
+ propertyKey: Q_.string().default(""),
11846
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11847
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11848
+ nullable: Q_.boolean().default(false),
11849
+ description: Q_.string().optional(),
11850
+ default: Q_.any().optional(),
11851
+ externalDocs: Q_.object({
11852
+ description: Q_.string().optional(),
11853
+ url: Q_.string().uri().required()
11855
11854
  }).optional(),
11856
- example: joi.string().optional(),
11857
- deprecated: joi.boolean().default(false),
11855
+ example: Q_.string().optional(),
11856
+ deprecated: Q_.boolean().default(false),
11858
11857
  type: resourcefulDataTypeSchema.required()
11859
11858
  });
11860
- const dataTypeColumnOptionsSchema = joi.object({
11859
+ const dataTypeColumnOptionsSchema = Q_.object({
11861
11860
  // Lucid ColumnOptions (partial) - excluding 'prepare' and 'consume'
11862
- columnName: joi.string().optional(),
11863
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
11864
- serialize: joi.function().optional(),
11865
- meta: joi.object().optional(),
11866
- isPrimary: joi.boolean().default(false),
11867
- hasDefaultValue: joi.boolean().default(false),
11861
+ columnName: Q_.string().optional(),
11862
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
11863
+ serialize: Q_.function().optional(),
11864
+ meta: Q_.object().optional(),
11865
+ isPrimary: Q_.boolean().default(false),
11866
+ hasDefaultValue: Q_.boolean().default(false),
11868
11867
  // Resourceful options
11869
- propertyKey: joi.string().default(""),
11870
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
11871
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
11872
- nullable: joi.boolean().default(false),
11873
- description: joi.string().optional(),
11874
- default: joi.any().optional(),
11875
- externalDocs: joi.object({
11876
- description: joi.string().optional(),
11877
- url: joi.string().uri().required()
11868
+ propertyKey: Q_.string().default(""),
11869
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11870
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11871
+ nullable: Q_.boolean().default(false),
11872
+ description: Q_.string().optional(),
11873
+ default: Q_.any().optional(),
11874
+ externalDocs: Q_.object({
11875
+ description: Q_.string().optional(),
11876
+ url: Q_.string().uri().required()
11878
11877
  }).optional(),
11879
- example: joi.string().optional(),
11880
- deprecated: joi.boolean().default(false),
11878
+ example: Q_.string().optional(),
11879
+ deprecated: Q_.boolean().default(false),
11881
11880
  type: resourcefulDataTypeSchema.optional()
11882
11881
  });
11883
11882
  const baseDateColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11884
- autoCreate: joi.boolean().default(false),
11885
- autoUpdate: joi.boolean().default(false)
11883
+ autoCreate: Q_.boolean().default(false),
11884
+ autoUpdate: Q_.boolean().default(false)
11886
11885
  });
11887
11886
  const stringColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11888
- type: joi.alternatives(
11887
+ type: Q_.alternatives(
11889
11888
  ...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType")
11890
11889
  ).default(() => new ResourcefulStringType())
11891
11890
  });
11892
11891
  const dateColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
11893
- type: joi.alternatives(
11892
+ type: Q_.alternatives(
11894
11893
  ...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType")
11895
11894
  ).default(() => new ResourcefulDateType())
11896
11895
  });
11897
11896
  const dateTimeColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
11898
- type: joi.alternatives(
11897
+ type: Q_.alternatives(
11899
11898
  ...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType")
11900
11899
  ).default(() => new ResourcefulDateTimeType())
11901
11900
  });
11902
11901
  const binaryColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11903
- type: joi.alternatives(
11902
+ type: Q_.alternatives(
11904
11903
  ...joiInstanceCheckerAlternativesFactory(ResourcefulBinaryType, "ResourcefulBinaryType")
11905
11904
  ).default(() => new ResourcefulBinaryType())
11906
11905
  });
11907
11906
  const numberColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11908
- type: joi.alternatives(
11907
+ type: Q_.alternatives(
11909
11908
  ...joiInstanceCheckerAlternativesFactory(ResourcefulNumberType, "ResourcefulNumberType")
11910
11909
  ).default(() => new ResourcefulNumberType())
11911
11910
  });
11912
11911
  const integerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11913
- type: joi.alternatives(
11912
+ type: Q_.alternatives(
11914
11913
  ...joiInstanceCheckerAlternativesFactory(ResourcefulIntegerType, "ResourcefulIntegerType")
11915
11914
  ).default(() => new ResourcefulIntegerType())
11916
11915
  });
11917
11916
  const bigintColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11918
- type: joi.alternatives(
11917
+ type: Q_.alternatives(
11919
11918
  ...joiInstanceCheckerAlternativesFactory(ResourcefulBigintType, "ResourcefulBigintType")
11920
11919
  ).default(() => new ResourcefulBigintType())
11921
11920
  });
11922
11921
  const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11923
- type: joi.alternatives(
11922
+ type: Q_.alternatives(
11924
11923
  ...joiInstanceCheckerAlternativesFactory(
11925
11924
  ResourcefulUnsignedIntegerType,
11926
11925
  "ResourcefulUnsignedIntegerType"
@@ -11928,148 +11927,148 @@ const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11928
11927
  ).default(() => new ResourcefulUnsignedIntegerType())
11929
11928
  });
11930
11929
  const booleanColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11931
- type: joi.alternatives(
11930
+ type: Q_.alternatives(
11932
11931
  ...joiInstanceCheckerAlternativesFactory(ResourcefulBooleanType, "ResourcefulBooleanType")
11933
11932
  ).default(() => new ResourcefulBooleanType())
11934
11933
  });
11935
- const objectColumnOptionsSchema = joi.object({
11934
+ const objectColumnOptionsSchema = Q_.object({
11936
11935
  // Lucid ColumnOptions (full)
11937
- columnName: joi.string().optional(),
11938
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
11939
- serialize: joi.function().optional(),
11940
- consume: joi.function().optional(),
11941
- prepare: joi.function().optional(),
11942
- meta: joi.object().optional(),
11943
- isPrimary: joi.boolean().default(false),
11944
- hasDefaultValue: joi.boolean().default(false),
11936
+ columnName: Q_.string().optional(),
11937
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
11938
+ serialize: Q_.function().optional(),
11939
+ consume: Q_.function().optional(),
11940
+ prepare: Q_.function().optional(),
11941
+ meta: Q_.object().optional(),
11942
+ isPrimary: Q_.boolean().default(false),
11943
+ hasDefaultValue: Q_.boolean().default(false),
11945
11944
  // Resourceful options
11946
- propertyKey: joi.string().default(""),
11947
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
11948
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
11949
- nullable: joi.boolean().default(false),
11950
- description: joi.string().optional(),
11951
- default: joi.any().optional(),
11952
- externalDocs: joi.object({
11953
- description: joi.string().optional(),
11954
- url: joi.string().uri().required()
11945
+ propertyKey: Q_.string().default(""),
11946
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11947
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11948
+ nullable: Q_.boolean().default(false),
11949
+ description: Q_.string().optional(),
11950
+ default: Q_.any().optional(),
11951
+ externalDocs: Q_.object({
11952
+ description: Q_.string().optional(),
11953
+ url: Q_.string().uri().required()
11955
11954
  }).optional(),
11956
- example: joi.string().optional(),
11957
- deprecated: joi.boolean().default(false),
11958
- type: joi.alternatives(
11955
+ example: Q_.string().optional(),
11956
+ deprecated: Q_.boolean().default(false),
11957
+ type: Q_.alternatives(
11959
11958
  ...joiInstanceCheckerAlternativesFactory(ResourcefulObjectType, "ResourcefulObjectType")
11960
11959
  ).default(() => new ResourcefulObjectType())
11961
11960
  });
11962
- const arrayColumnOptionsSchema = joi.object({
11961
+ const arrayColumnOptionsSchema = Q_.object({
11963
11962
  // Lucid ColumnOptions (full)
11964
- columnName: joi.string().optional(),
11965
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
11966
- serialize: joi.function().optional(),
11967
- consume: joi.function().optional(),
11968
- prepare: joi.function().optional(),
11969
- meta: joi.object().optional(),
11970
- isPrimary: joi.boolean().default(false),
11971
- hasDefaultValue: joi.boolean().default(false),
11963
+ columnName: Q_.string().optional(),
11964
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
11965
+ serialize: Q_.function().optional(),
11966
+ consume: Q_.function().optional(),
11967
+ prepare: Q_.function().optional(),
11968
+ meta: Q_.object().optional(),
11969
+ isPrimary: Q_.boolean().default(false),
11970
+ hasDefaultValue: Q_.boolean().default(false),
11972
11971
  // Resourceful options
11973
- propertyKey: joi.string().default(""),
11974
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
11975
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
11976
- nullable: joi.boolean().default(false),
11977
- description: joi.string().optional(),
11978
- default: joi.any().optional(),
11979
- externalDocs: joi.object({
11980
- description: joi.string().optional(),
11981
- url: joi.string().uri().required()
11972
+ propertyKey: Q_.string().default(""),
11973
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11974
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11975
+ nullable: Q_.boolean().default(false),
11976
+ description: Q_.string().optional(),
11977
+ default: Q_.any().optional(),
11978
+ externalDocs: Q_.object({
11979
+ description: Q_.string().optional(),
11980
+ url: Q_.string().uri().required()
11982
11981
  }).optional(),
11983
- example: joi.string().optional(),
11984
- deprecated: joi.boolean().default(false),
11985
- type: joi.alternatives(
11982
+ example: Q_.string().optional(),
11983
+ deprecated: Q_.boolean().default(false),
11984
+ type: Q_.alternatives(
11986
11985
  ...joiInstanceCheckerAlternativesFactory(ResourcefulArrayType, "ResourcefulArrayType")
11987
11986
  ).default(() => new ResourcefulArrayType())
11988
11987
  });
11989
11988
  localResourcefulPropertyDefinitionSchema.append({
11990
- writable: joi.boolean().default(false)
11989
+ writable: Q_.boolean().default(false)
11991
11990
  });
11992
- const resourcefulComputedOptionsSchema = joi.object({
11991
+ const resourcefulComputedOptionsSchema = Q_.object({
11993
11992
  // Lucid ComputedOptions (partial)
11994
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
11995
- serialize: joi.function().optional(),
11996
- meta: joi.object().optional(),
11993
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
11994
+ serialize: Q_.function().optional(),
11995
+ meta: Q_.object().optional(),
11997
11996
  // Resourceful options
11998
- propertyKey: joi.string().default(""),
11999
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
12000
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
12001
- nullable: joi.boolean().default(false),
12002
- description: joi.string().optional(),
12003
- default: joi.any().optional(),
12004
- externalDocs: joi.object({
12005
- description: joi.string().optional(),
12006
- url: joi.string().uri().required()
11997
+ propertyKey: Q_.string().default(""),
11998
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
11999
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12000
+ nullable: Q_.boolean().default(false),
12001
+ description: Q_.string().optional(),
12002
+ default: Q_.any().optional(),
12003
+ externalDocs: Q_.object({
12004
+ description: Q_.string().optional(),
12005
+ url: Q_.string().uri().required()
12007
12006
  }).optional(),
12008
- example: joi.string().optional(),
12009
- deprecated: joi.boolean().default(false),
12007
+ example: Q_.string().optional(),
12008
+ deprecated: Q_.boolean().default(false),
12010
12009
  type: resourcefulDataTypeSchema.required()
12011
12010
  });
12012
- const dataTypeComputedOptionsSchema = joi.object({
12011
+ const dataTypeComputedOptionsSchema = Q_.object({
12013
12012
  // Lucid ComputedOptions (partial) - excluding 'prepare' and 'consume'
12014
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
12015
- serialize: joi.function().optional(),
12016
- meta: joi.object().optional(),
12013
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
12014
+ serialize: Q_.function().optional(),
12015
+ meta: Q_.object().optional(),
12017
12016
  // Resourceful options
12018
- propertyKey: joi.string().default(""),
12019
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
12020
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
12021
- nullable: joi.boolean().default(false),
12022
- description: joi.string().optional(),
12023
- default: joi.any().optional(),
12024
- externalDocs: joi.object({
12025
- description: joi.string().optional(),
12026
- url: joi.string().uri().required()
12017
+ propertyKey: Q_.string().default(""),
12018
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12019
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12020
+ nullable: Q_.boolean().default(false),
12021
+ description: Q_.string().optional(),
12022
+ default: Q_.any().optional(),
12023
+ externalDocs: Q_.object({
12024
+ description: Q_.string().optional(),
12025
+ url: Q_.string().uri().required()
12027
12026
  }).optional(),
12028
- example: joi.string().optional(),
12029
- deprecated: joi.boolean().default(false),
12027
+ example: Q_.string().optional(),
12028
+ deprecated: Q_.boolean().default(false),
12030
12029
  type: resourcefulDataTypeSchema.optional()
12031
12030
  });
12032
12031
  const baseDateComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12033
- autoCreate: joi.boolean().default(false),
12034
- autoUpdate: joi.boolean().default(false)
12032
+ autoCreate: Q_.boolean().default(false),
12033
+ autoUpdate: Q_.boolean().default(false)
12035
12034
  });
12036
12035
  const stringComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12037
- type: joi.alternatives(
12036
+ type: Q_.alternatives(
12038
12037
  ...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType")
12039
12038
  ).default(() => new ResourcefulStringType())
12040
12039
  });
12041
12040
  const dateComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
12042
- type: joi.alternatives(
12041
+ type: Q_.alternatives(
12043
12042
  ...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType")
12044
12043
  ).default(() => new ResourcefulDateType())
12045
12044
  });
12046
12045
  const dateTimeComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
12047
- type: joi.alternatives(
12046
+ type: Q_.alternatives(
12048
12047
  ...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType")
12049
12048
  ).default(() => new ResourcefulDateTimeType())
12050
12049
  });
12051
12050
  const binaryComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12052
- type: joi.alternatives(
12051
+ type: Q_.alternatives(
12053
12052
  ...joiInstanceCheckerAlternativesFactory(ResourcefulBinaryType, "ResourcefulBinaryType")
12054
12053
  ).default(() => new ResourcefulBinaryType())
12055
12054
  });
12056
12055
  const numberComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12057
- type: joi.alternatives(
12056
+ type: Q_.alternatives(
12058
12057
  ...joiInstanceCheckerAlternativesFactory(ResourcefulNumberType, "ResourcefulNumberType")
12059
12058
  ).default(() => new ResourcefulNumberType())
12060
12059
  });
12061
12060
  const integerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12062
- type: joi.alternatives(
12061
+ type: Q_.alternatives(
12063
12062
  ...joiInstanceCheckerAlternativesFactory(ResourcefulIntegerType, "ResourcefulIntegerType")
12064
12063
  ).default(() => new ResourcefulIntegerType())
12065
12064
  });
12066
12065
  const bigintComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12067
- type: joi.alternatives(
12066
+ type: Q_.alternatives(
12068
12067
  ...joiInstanceCheckerAlternativesFactory(ResourcefulBigintType, "ResourcefulBigintType")
12069
12068
  ).default(() => new ResourcefulBigintType())
12070
12069
  });
12071
12070
  const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12072
- type: joi.alternatives(
12071
+ type: Q_.alternatives(
12073
12072
  ...joiInstanceCheckerAlternativesFactory(
12074
12073
  ResourcefulUnsignedIntegerType,
12075
12074
  "ResourcefulUnsignedIntegerType"
@@ -12077,99 +12076,99 @@ const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys(
12077
12076
  ).default(() => new ResourcefulUnsignedIntegerType())
12078
12077
  });
12079
12078
  const booleanComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12080
- type: joi.alternatives(
12079
+ type: Q_.alternatives(
12081
12080
  ...joiInstanceCheckerAlternativesFactory(ResourcefulBooleanType, "ResourcefulBooleanType")
12082
12081
  ).default(() => new ResourcefulBooleanType())
12083
12082
  });
12084
- const objectComputedOptionsSchema = joi.object({
12083
+ const objectComputedOptionsSchema = Q_.object({
12085
12084
  // Lucid ComputedOptions (full)
12086
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
12087
- serialize: joi.function().optional(),
12088
- meta: joi.object().optional(),
12085
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
12086
+ serialize: Q_.function().optional(),
12087
+ meta: Q_.object().optional(),
12089
12088
  // Resourceful options
12090
- propertyKey: joi.string().default(""),
12091
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
12092
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
12093
- nullable: joi.boolean().default(false),
12094
- description: joi.string().optional(),
12095
- default: joi.any().optional(),
12096
- externalDocs: joi.object({
12097
- description: joi.string().optional(),
12098
- url: joi.string().uri().required()
12089
+ propertyKey: Q_.string().default(""),
12090
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12091
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12092
+ nullable: Q_.boolean().default(false),
12093
+ description: Q_.string().optional(),
12094
+ default: Q_.any().optional(),
12095
+ externalDocs: Q_.object({
12096
+ description: Q_.string().optional(),
12097
+ url: Q_.string().uri().required()
12099
12098
  }).optional(),
12100
- example: joi.string().optional(),
12101
- deprecated: joi.boolean().default(false),
12102
- type: joi.alternatives(
12099
+ example: Q_.string().optional(),
12100
+ deprecated: Q_.boolean().default(false),
12101
+ type: Q_.alternatives(
12103
12102
  ...joiInstanceCheckerAlternativesFactory(ResourcefulObjectType, "ResourcefulObjectType")
12104
12103
  ).default(() => new ResourcefulObjectType())
12105
12104
  });
12106
- const arrayComputedOptionsSchema = joi.object({
12105
+ const arrayComputedOptionsSchema = Q_.object({
12107
12106
  // Lucid ComputedOptions (full)
12108
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
12109
- serialize: joi.function().optional(),
12110
- meta: joi.object().optional(),
12107
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
12108
+ serialize: Q_.function().optional(),
12109
+ meta: Q_.object().optional(),
12111
12110
  // Resourceful options
12112
- propertyKey: joi.string().default(""),
12113
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
12114
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
12115
- nullable: joi.boolean().default(false),
12116
- description: joi.string().optional(),
12117
- default: joi.any().optional(),
12118
- externalDocs: joi.object({
12119
- description: joi.string().optional(),
12120
- url: joi.string().uri().required()
12111
+ propertyKey: Q_.string().default(""),
12112
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12113
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12114
+ nullable: Q_.boolean().default(false),
12115
+ description: Q_.string().optional(),
12116
+ default: Q_.any().optional(),
12117
+ externalDocs: Q_.object({
12118
+ description: Q_.string().optional(),
12119
+ url: Q_.string().uri().required()
12121
12120
  }).optional(),
12122
- example: joi.string().optional(),
12123
- deprecated: joi.boolean().default(false),
12124
- type: joi.alternatives(
12121
+ example: Q_.string().optional(),
12122
+ deprecated: Q_.boolean().default(false),
12123
+ type: Q_.alternatives(
12125
12124
  ...joiInstanceCheckerAlternativesFactory(ResourcefulArrayType, "ResourcefulArrayType")
12126
12125
  ).default(() => new ResourcefulArrayType())
12127
12126
  });
12128
- const resourcefulRelationshipOptionsSchema = joi.object({
12127
+ const resourcefulRelationshipOptionsSchema = Q_.object({
12129
12128
  // Resourceful options
12130
- propertyKey: joi.string().default(""),
12131
- readAccessControlFilters: joi.array().items(joi.function()).default([]),
12132
- writeAccessControlFilters: joi.array().items(joi.function()).default([]),
12133
- nullable: joi.boolean().default(false),
12134
- description: joi.string().optional(),
12135
- default: joi.any().optional(),
12136
- externalDocs: joi.object({
12137
- description: joi.string().optional(),
12138
- url: joi.string().uri().required()
12129
+ propertyKey: Q_.string().default(""),
12130
+ readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12131
+ writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
12132
+ nullable: Q_.boolean().default(false),
12133
+ description: Q_.string().optional(),
12134
+ default: Q_.any().optional(),
12135
+ externalDocs: Q_.object({
12136
+ description: Q_.string().optional(),
12137
+ url: Q_.string().uri().required()
12139
12138
  }).optional(),
12140
- example: joi.string().optional(),
12141
- deprecated: joi.boolean().default(false)
12139
+ example: Q_.string().optional(),
12140
+ deprecated: Q_.boolean().default(false)
12142
12141
  });
12143
12142
  const relationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12144
12143
  // Lucid RelationOptions
12145
- localKey: joi.string().optional(),
12146
- foreignKey: joi.string().optional(),
12147
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
12148
- onQuery: joi.function().optional(),
12149
- relatedModel: joi.function()
12144
+ localKey: Q_.string().optional(),
12145
+ foreignKey: Q_.string().optional(),
12146
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
12147
+ onQuery: Q_.function().optional(),
12148
+ relatedModel: Q_.function()
12150
12149
  });
12151
12150
  const manyToManyRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12152
12151
  // Lucid ManyToManyRelationOptions
12153
- localKey: joi.string().optional(),
12154
- relatedKey: joi.string().optional(),
12155
- pivotForeignKey: joi.string().optional(),
12156
- pivotRelatedForeignKey: joi.string().optional(),
12157
- pivotTable: joi.string().optional(),
12158
- pivotTimestamps: joi.boolean().optional(),
12159
- pivotColumns: joi.array().items(joi.string()).optional(),
12160
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
12161
- onQuery: joi.function().optional(),
12162
- relatedModel: joi.function()
12152
+ localKey: Q_.string().optional(),
12153
+ relatedKey: Q_.string().optional(),
12154
+ pivotForeignKey: Q_.string().optional(),
12155
+ pivotRelatedForeignKey: Q_.string().optional(),
12156
+ pivotTable: Q_.string().optional(),
12157
+ pivotTimestamps: Q_.boolean().optional(),
12158
+ pivotColumns: Q_.array().items(Q_.string()).optional(),
12159
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
12160
+ onQuery: Q_.function().optional(),
12161
+ relatedModel: Q_.function()
12163
12162
  });
12164
12163
  const hasManyThroughRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12165
12164
  // Lucid HasManyThroughRelationOptions (ThroughRelationOptions without throughModel)
12166
- localKey: joi.string().optional(),
12167
- foreignKey: joi.string().optional(),
12168
- throughLocalKey: joi.string().optional(),
12169
- throughForeignKey: joi.string().optional(),
12170
- serializeAs: joi.alternatives().try(joi.string(), joi.valid(null)).optional(),
12171
- onQuery: joi.function().optional(),
12172
- relatedModel: joi.function()
12165
+ localKey: Q_.string().optional(),
12166
+ foreignKey: Q_.string().optional(),
12167
+ throughLocalKey: Q_.string().optional(),
12168
+ throughForeignKey: Q_.string().optional(),
12169
+ serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
12170
+ onQuery: Q_.function().optional(),
12171
+ relatedModel: Q_.function()
12173
12172
  });
12174
12173
  const extractLucidOptionsForLucidDecorator = (options, keys, overrides) => {
12175
12174
  const extracted = {};
@@ -12261,16 +12260,37 @@ const handleResourcefulColumn = (config) => {
12261
12260
  propertyKey,
12262
12261
  decoratorOption,
12263
12262
  decoratorOptionsValidationSchema,
12264
- overrides,
12265
- lucidDecoratorFunction
12263
+ overrides = {},
12264
+ lucidDecoratorFunction,
12265
+ defaultPrepare,
12266
+ defaultConsume
12266
12267
  } = config;
12267
12268
  const opts = validateNormalizeAndCastDecoratorOptions(propertyKey, decoratorName, decoratorOptionsValidationSchema, {
12268
12269
  ...decoratorOption,
12269
12270
  propertyKey
12270
12271
  });
12272
+ const customPrepare = opts.prepare;
12273
+ const customConsume = opts.consume;
12274
+ const nullable = opts.nullable || false;
12275
+ const chainedPrepare = PrepareConsumeChainBuilder.chainPrepare(
12276
+ propertyKey,
12277
+ nullable,
12278
+ defaultPrepare,
12279
+ customPrepare
12280
+ );
12281
+ const chainedConsume = PrepareConsumeChainBuilder.chainConsume(
12282
+ propertyKey,
12283
+ nullable,
12284
+ defaultConsume,
12285
+ customConsume
12286
+ );
12271
12287
  const lucidOptions = extractLucidOptionsForLucidColumnDecorator(
12272
12288
  opts,
12273
- overrides
12289
+ {
12290
+ ...overrides,
12291
+ ...chainedPrepare && { prepare: chainedPrepare },
12292
+ ...chainedConsume && { consume: chainedConsume }
12293
+ }
12274
12294
  );
12275
12295
  lucidDecoratorFunction(lucidOptions)(target, propertyKey);
12276
12296
  const map = ensureOwnResourcefulMap(target, "$resourcefulColumns");
@@ -12318,10 +12338,8 @@ resourcefulColumn.string = function(options = {}) {
12318
12338
  decoratorOption: options,
12319
12339
  decoratorOptionsValidationSchema,
12320
12340
  lucidDecoratorFunction: column,
12321
- overrides: {
12322
- prepare: (value) => prepareString(propertyKey, value, options.nullable),
12323
- consume: (value) => consumeString(propertyKey, value, options.nullable)
12324
- }
12341
+ defaultPrepare: prepareString,
12342
+ defaultConsume: consumeString
12325
12343
  });
12326
12344
  };
12327
12345
  };
@@ -12364,10 +12382,8 @@ resourcefulColumn.binary = function(options = {}) {
12364
12382
  decoratorOption: options,
12365
12383
  decoratorOptionsValidationSchema,
12366
12384
  lucidDecoratorFunction: column,
12367
- overrides: {
12368
- prepare: (value) => prepareBinary(propertyKey, value, options.nullable),
12369
- consume: (value) => consumeBinary(propertyKey, value, options.nullable)
12370
- }
12385
+ defaultPrepare: prepareBinary,
12386
+ defaultConsume: consumeBinary
12371
12387
  });
12372
12388
  };
12373
12389
  };
@@ -12382,10 +12398,8 @@ resourcefulColumn.number = function(options = {}) {
12382
12398
  decoratorOption: options,
12383
12399
  decoratorOptionsValidationSchema,
12384
12400
  lucidDecoratorFunction: column,
12385
- overrides: {
12386
- prepare: (value) => prepareNumber(propertyKey, value, options.nullable),
12387
- consume: (value) => consumeNumber(propertyKey, value, options.nullable)
12388
- }
12401
+ defaultPrepare: prepareNumber,
12402
+ defaultConsume: consumeNumber
12389
12403
  });
12390
12404
  };
12391
12405
  };
@@ -12400,10 +12414,8 @@ resourcefulColumn.integer = function(options = {}) {
12400
12414
  decoratorOption: options,
12401
12415
  decoratorOptionsValidationSchema,
12402
12416
  lucidDecoratorFunction: column,
12403
- overrides: {
12404
- prepare: (value) => prepareInteger(propertyKey, value, options.nullable),
12405
- consume: (value) => consumeInteger(propertyKey, value, options.nullable)
12406
- }
12417
+ defaultPrepare: prepareInteger,
12418
+ defaultConsume: consumeInteger
12407
12419
  });
12408
12420
  };
12409
12421
  };
@@ -12418,10 +12430,8 @@ resourcefulColumn.bigint = function(options = {}) {
12418
12430
  decoratorOption: options,
12419
12431
  decoratorOptionsValidationSchema,
12420
12432
  lucidDecoratorFunction: column,
12421
- overrides: {
12422
- prepare: (value) => prepareBigint(propertyKey, value, options.nullable),
12423
- consume: (value) => consumeBigint(propertyKey, value, options.nullable)
12424
- }
12433
+ defaultPrepare: prepareBigint,
12434
+ defaultConsume: consumeBigint
12425
12435
  });
12426
12436
  };
12427
12437
  };
@@ -12436,10 +12446,8 @@ resourcefulColumn.unsignedint = function(options = {}) {
12436
12446
  decoratorOption: options,
12437
12447
  decoratorOptionsValidationSchema,
12438
12448
  lucidDecoratorFunction: column,
12439
- overrides: {
12440
- prepare: (value) => prepareUnsignedint(propertyKey, value, options.nullable),
12441
- consume: (value) => consumeUnsignedint(propertyKey, value, options.nullable)
12442
- }
12449
+ defaultPrepare: prepareUnsignedint,
12450
+ defaultConsume: consumeUnsignedint
12443
12451
  });
12444
12452
  };
12445
12453
  };
@@ -12454,10 +12462,8 @@ resourcefulColumn.boolean = function(options = {}) {
12454
12462
  decoratorOption: options,
12455
12463
  decoratorOptionsValidationSchema,
12456
12464
  lucidDecoratorFunction: column,
12457
- overrides: {
12458
- prepare: (value) => prepareBoolean(propertyKey, value, options.nullable),
12459
- consume: (value) => consumeBoolean(propertyKey, value, options.nullable)
12460
- }
12465
+ defaultPrepare: prepareBoolean,
12466
+ defaultConsume: consumeBoolean
12461
12467
  });
12462
12468
  };
12463
12469
  };
@@ -12472,10 +12478,8 @@ resourcefulColumn.object = function(options = {}) {
12472
12478
  decoratorOption: options,
12473
12479
  decoratorOptionsValidationSchema,
12474
12480
  lucidDecoratorFunction: column,
12475
- overrides: {
12476
- prepare: (value) => prepareObject(propertyKey, value, options.nullable),
12477
- consume: (value) => consumeObject(propertyKey, value, options.nullable)
12478
- }
12481
+ defaultPrepare: prepareObject,
12482
+ defaultConsume: consumeObject
12479
12483
  });
12480
12484
  };
12481
12485
  };
@@ -12490,10 +12494,8 @@ resourcefulColumn.array = function(options = {}) {
12490
12494
  decoratorOption: options,
12491
12495
  decoratorOptionsValidationSchema,
12492
12496
  lucidDecoratorFunction: column,
12493
- overrides: {
12494
- prepare: (value) => prepareArray(propertyKey, value, options.nullable),
12495
- consume: (value) => consumeArray(propertyKey, value, options.nullable)
12496
- }
12497
+ defaultPrepare: prepareArray,
12498
+ defaultConsume: consumeArray
12497
12499
  });
12498
12500
  };
12499
12501
  };
@@ -12721,7 +12723,7 @@ function resourcefulHasManyThrough(model, options = {}) {
12721
12723
  map.set(propertyKey, opts);
12722
12724
  };
12723
12725
  }
12724
- const version = "0.1.0-master-c2c013d9";
12726
+ const version = "0.1.0-master-71781cfd";
12725
12727
  export {
12726
12728
  k as definitions,
12727
12729
  w as errors,