@nhtio/lucid-resourceful 1.20250718.2 → 1.20250724.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -13,10 +13,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
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
15
  const decorator_utils = require("./decorator_utils-U_rZo8tv.cjs");
16
- const index = require("./index-Cv6KC1rC.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) {
@@ -598,31 +598,31 @@ const getFieldKey = (key, definition) => {
598
598
  };
599
599
  function withResourceful(options = {}) {
600
600
  return (superclass) => {
601
- const optionsSchema = index.joi.object({
602
- name: index.joi.string().default(superclass.name),
603
- readRequiredForWrite: index.joi.boolean().default(false),
604
- accessControlFilters: index.joi.object({
605
- list: index.joi.array().items(index.joi.function()).default([]),
606
- create: index.joi.array().items(index.joi.function()).default([]),
607
- read: index.joi.array().items(index.joi.function()).default([]),
608
- update: index.joi.array().items(index.joi.function()).default([]),
609
- 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([])
610
610
  }).default({}),
611
- onACLError: index.joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
612
- onValidationScopeError: index.joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
613
- queryScopeCallbacks: index.joi.object({
614
- list: index.joi.array().items(index.joi.function()).default([]),
615
- 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([])
616
616
  }).default({}),
617
- description: index.joi.string().optional(),
618
- externalDocs: index.joi.object({
619
- description: index.joi.string().optional(),
620
- 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()
621
621
  }).optional(),
622
- example: index.joi.string().optional(),
623
- advanced: index.joi.object({
624
- propertyEvaluationConcurrency: index.joi.number().integer().min(1).default(10),
625
- 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)
626
626
  }).default({
627
627
  propertyEvaluationConcurrency: 10,
628
628
  aclEvaluationConcurrency: 2
@@ -763,7 +763,7 @@ function withResourceful(options = {}) {
763
763
  "relationship"
764
764
  ),
765
765
  kind: "relationship",
766
- validator: index.joi.forbidden(),
766
+ validator: joi.joi.forbidden(),
767
767
  relatedModel: relationshipDefinition.relatedModel
768
768
  };
769
769
  if (!resourcefulModelRelationshipMetaSchema.canRead && !resourcefulModelRelationshipMetaSchema.canWrite)
@@ -778,7 +778,7 @@ function withResourceful(options = {}) {
778
778
  }
779
779
  static $getPropertyValidator(ctx, app, key, datatype, nullable, validationScopes, kind, writable = false) {
780
780
  if ("relationship" === kind || "computedAccessor" === kind && !writable) {
781
- return index.joi.any().forbidden();
781
+ return joi.joi.any().forbidden();
782
782
  }
783
783
  const baseValidator = this.$getPropertyBaseValidator(datatype, nullable, kind, writable);
784
784
  if (Array.isArray(validationScopes) && validationScopes.length > 0) {
@@ -800,7 +800,7 @@ function withResourceful(options = {}) {
800
800
  case "pass":
801
801
  break;
802
802
  case "fail":
803
- return index.joi.any().forbidden();
803
+ return joi.joi.any().forbidden();
804
804
  }
805
805
  }
806
806
  });
@@ -809,13 +809,13 @@ function withResourceful(options = {}) {
809
809
  }
810
810
  static $getPropertyBaseValidator(datatype, nullable, kind, writable = false) {
811
811
  if ("relationship" === kind || "computedAccessor" === kind && !writable) {
812
- return index.joi.any().forbidden();
812
+ return joi.joi.any().forbidden();
813
813
  }
814
814
  nullable = nullable || "boolean" === typeof datatype.nullable && datatype.nullable;
815
815
  switch (true) {
816
816
  case datatype instanceof definitions.ResourcefulStringType: {
817
817
  const d = datatype;
818
- const r = index.joi.string().min(d.minLength).max(d.maxLength);
818
+ const r = joi.joi.string().min(d.minLength).max(d.maxLength);
819
819
  if (d.pattern) {
820
820
  r.pattern(new RegExp(d.pattern));
821
821
  }
@@ -828,14 +828,14 @@ function withResourceful(options = {}) {
828
828
  return r;
829
829
  }
830
830
  case datatype instanceof definitions.ResourcefulDateType: {
831
- const r = index.joi.date().iso();
831
+ const r = joi.joi.date().iso();
832
832
  if (nullable) {
833
833
  r.allow(null);
834
834
  }
835
835
  return r;
836
836
  }
837
837
  case datatype instanceof definitions.ResourcefulDateTimeType: {
838
- const r = index.joi.date().iso();
838
+ const r = joi.joi.date().iso();
839
839
  if (nullable) {
840
840
  r.allow(null);
841
841
  }
@@ -843,7 +843,7 @@ function withResourceful(options = {}) {
843
843
  }
844
844
  case datatype instanceof definitions.ResourcefulBinaryType: {
845
845
  const d = datatype;
846
- const r = index.joi.string();
846
+ const r = joi.joi.string();
847
847
  if (nullable) {
848
848
  r.allow(null);
849
849
  }
@@ -857,7 +857,7 @@ function withResourceful(options = {}) {
857
857
  }
858
858
  case datatype instanceof definitions.ResourcefulNumberType: {
859
859
  const d = datatype;
860
- const r = index.joi.number();
860
+ const r = joi.joi.number();
861
861
  if (nullable) {
862
862
  r.allow(null);
863
863
  }
@@ -876,7 +876,7 @@ function withResourceful(options = {}) {
876
876
  }
877
877
  case datatype instanceof definitions.ResourcefulIntegerType: {
878
878
  const d = datatype;
879
- const r = index.joi.number();
879
+ const r = joi.joi.number();
880
880
  if (nullable) {
881
881
  r.allow(null);
882
882
  }
@@ -895,7 +895,7 @@ function withResourceful(options = {}) {
895
895
  }
896
896
  case datatype instanceof definitions.ResourcefulBigintType: {
897
897
  const d = datatype;
898
- const r = index.joi.bigint();
898
+ const r = joi.joi.bigint();
899
899
  if (nullable) {
900
900
  r.allow(null);
901
901
  }
@@ -914,7 +914,7 @@ function withResourceful(options = {}) {
914
914
  }
915
915
  case datatype instanceof definitions.ResourcefulUnsignedIntegerType: {
916
916
  const d = datatype;
917
- const r = index.joi.number().unsafe();
917
+ const r = joi.joi.number().unsafe();
918
918
  if (nullable) {
919
919
  r.allow(null);
920
920
  }
@@ -932,7 +932,7 @@ function withResourceful(options = {}) {
932
932
  return r;
933
933
  }
934
934
  case datatype instanceof definitions.ResourcefulBooleanType: {
935
- const r = index.joi.boolean();
935
+ const r = joi.joi.boolean();
936
936
  if (nullable) {
937
937
  r.allow(null);
938
938
  }
@@ -952,7 +952,7 @@ function withResourceful(options = {}) {
952
952
  !(item.readOnly || false)
953
953
  )
954
954
  );
955
- propValidator = index.joi.alternatives().try(...alternatives);
955
+ propValidator = joi.joi.alternatives().try(...alternatives);
956
956
  } else if ("allOf" in propDef) {
957
957
  const schemas = propDef.allOf.map(
958
958
  (item) => this.$getPropertyBaseValidator(
@@ -962,7 +962,7 @@ function withResourceful(options = {}) {
962
962
  !(item.readOnly || false)
963
963
  )
964
964
  );
965
- propValidator = schemas.reduce((acc, schema) => acc.concat(schema), index.joi.any());
965
+ propValidator = schemas.reduce((acc, schema) => acc.concat(schema), joi.joi.any());
966
966
  } else if ("anyOf" in propDef) {
967
967
  const alternatives = propDef.anyOf.map(
968
968
  (item) => this.$getPropertyBaseValidator(
@@ -972,7 +972,7 @@ function withResourceful(options = {}) {
972
972
  !(item.readOnly || false)
973
973
  )
974
974
  );
975
- propValidator = index.joi.alternatives().try(...alternatives);
975
+ propValidator = joi.joi.alternatives().try(...alternatives);
976
976
  } else if ("not" in propDef) {
977
977
  const notSchemas = propDef.not.map(
978
978
  (item) => this.$getPropertyBaseValidator(
@@ -982,7 +982,7 @@ function withResourceful(options = {}) {
982
982
  !(item.readOnly || false)
983
983
  )
984
984
  );
985
- propValidator = index.joi.any().not(...notSchemas);
985
+ propValidator = joi.joi.any().not(...notSchemas);
986
986
  } else {
987
987
  propValidator = this.$getPropertyBaseValidator(
988
988
  propDef,
@@ -996,7 +996,7 @@ function withResourceful(options = {}) {
996
996
  }
997
997
  objectSchema[propKey] = propValidator;
998
998
  });
999
- const r = index.joi.object(objectSchema);
999
+ const r = joi.joi.object(objectSchema);
1000
1000
  if (nullable) {
1001
1001
  r.allow(null);
1002
1002
  }
@@ -1009,7 +1009,7 @@ function withResourceful(options = {}) {
1009
1009
  if (decorator_utils.isObject(d.additionalProperties)) {
1010
1010
  const additionalPropertiesType = d.additionalProperties;
1011
1011
  r.pattern(
1012
- index.joi.string(),
1012
+ joi.joi.string(),
1013
1013
  this.$getPropertyBaseValidator(
1014
1014
  additionalPropertiesType,
1015
1015
  additionalPropertiesType.nullable || false,
@@ -1024,7 +1024,7 @@ function withResourceful(options = {}) {
1024
1024
  }
1025
1025
  case datatype instanceof definitions.ResourcefulArrayType: {
1026
1026
  const d = datatype;
1027
- const r = index.joi.array();
1027
+ const r = joi.joi.array();
1028
1028
  if (nullable) {
1029
1029
  r.allow(null);
1030
1030
  }
@@ -1038,7 +1038,7 @@ function withResourceful(options = {}) {
1038
1038
  !(item.readOnly || false)
1039
1039
  )
1040
1040
  );
1041
- itemValidator = index.joi.alternatives().try(...alternatives);
1041
+ itemValidator = joi.joi.alternatives().try(...alternatives);
1042
1042
  } else if ("allOf" in d.items) {
1043
1043
  const schemas = d.items.allOf.map(
1044
1044
  (item) => this.$getPropertyBaseValidator(
@@ -1048,7 +1048,7 @@ function withResourceful(options = {}) {
1048
1048
  !(item.readOnly || false)
1049
1049
  )
1050
1050
  );
1051
- itemValidator = schemas.reduce((acc, schema) => acc.concat(schema), index.joi.any());
1051
+ itemValidator = schemas.reduce((acc, schema) => acc.concat(schema), joi.joi.any());
1052
1052
  } else if ("anyOf" in d.items) {
1053
1053
  const alternatives = d.items.anyOf.map(
1054
1054
  (item) => this.$getPropertyBaseValidator(
@@ -1058,7 +1058,7 @@ function withResourceful(options = {}) {
1058
1058
  !(item.readOnly || false)
1059
1059
  )
1060
1060
  );
1061
- itemValidator = index.joi.alternatives().try(...alternatives);
1061
+ itemValidator = joi.joi.alternatives().try(...alternatives);
1062
1062
  } else if ("not" in d.items) {
1063
1063
  const notSchemas = d.items.not.map(
1064
1064
  (item) => this.$getPropertyBaseValidator(
@@ -1068,7 +1068,7 @@ function withResourceful(options = {}) {
1068
1068
  !(item.readOnly || false)
1069
1069
  )
1070
1070
  );
1071
- itemValidator = index.joi.any().not(...notSchemas);
1071
+ itemValidator = joi.joi.any().not(...notSchemas);
1072
1072
  } else {
1073
1073
  itemValidator = this.$getPropertyBaseValidator(
1074
1074
  d.items,
@@ -1090,7 +1090,7 @@ function withResourceful(options = {}) {
1090
1090
  return r;
1091
1091
  }
1092
1092
  default:
1093
- return index.joi.any().forbidden();
1093
+ return joi.joi.any().forbidden();
1094
1094
  }
1095
1095
  }
1096
1096
  static async $getPropertyCanReadWrite(ctx, app, key, lucidDefinition, readAclFilters = [], writeAclFilters = [], kind, writable = false) {
@@ -1147,6 +1147,13 @@ function withResourceful(options = {}) {
1147
1147
  };
1148
1148
  Object.entries(resourcefulModelMetaSchema.properties).forEach(
1149
1149
  ([propertyKey, propertyMeta]) => {
1150
+ const resolvedColumnName = getFieldKey(
1151
+ propertyKey,
1152
+ propertyMeta.lucidDefinitions
1153
+ );
1154
+ if (null === resolvedColumnName) {
1155
+ return;
1156
+ }
1150
1157
  switch (propertyMeta.kind) {
1151
1158
  case "column": {
1152
1159
  ret.properties[propertyKey] = this.$resourcefulModelColumnMetaToOpenApiSchema(
@@ -1192,7 +1199,6 @@ function withResourceful(options = {}) {
1192
1199
  }
1193
1200
  static $resourcefulModelColumnMetaToOpenApiSchema(propertyKey, propertyMeta) {
1194
1201
  const ret = stripUndefinedValuesFromObject({
1195
- type: propertyMeta.definition.type,
1196
1202
  items: propertyMeta.definition.items,
1197
1203
  title: getFieldKey(propertyKey, propertyMeta.lucidDefinitions) || propertyKey,
1198
1204
  description: propertyMeta.definition.description,
@@ -1223,13 +1229,13 @@ function withResourceful(options = {}) {
1223
1229
  readOnly: propertyMeta.canRead && !propertyMeta.canWrite,
1224
1230
  writeOnly: !propertyMeta.canRead && propertyMeta.canWrite,
1225
1231
  externalDocs: propertyMeta.definition.externalDocs,
1226
- example: propertyMeta.definition.example
1232
+ example: propertyMeta.definition.example,
1233
+ ...propertyMeta.definition.type
1227
1234
  });
1228
1235
  return ret;
1229
1236
  }
1230
1237
  static $resourcefulModelComputedAccessorMetaToOpenApiSchema(propertyKey, propertyMeta) {
1231
1238
  const ret = stripUndefinedValuesFromObject({
1232
- type: propertyMeta.definition.type,
1233
1239
  items: propertyMeta.definition.items,
1234
1240
  title: getFieldKey(propertyKey, propertyMeta.lucidDefinitions) || propertyKey,
1235
1241
  description: propertyMeta.definition.description,
@@ -1260,7 +1266,8 @@ function withResourceful(options = {}) {
1260
1266
  readOnly: propertyMeta.canRead && !propertyMeta.canWrite,
1261
1267
  writeOnly: !propertyMeta.canRead && propertyMeta.canWrite,
1262
1268
  externalDocs: propertyMeta.definition.externalDocs,
1263
- example: propertyMeta.definition.example
1269
+ example: propertyMeta.definition.example,
1270
+ ...propertyMeta.definition.type
1264
1271
  });
1265
1272
  return ret;
1266
1273
  }
@@ -1443,7 +1450,7 @@ function withResourceful(options = {}) {
1443
1450
  static $resourcefulGetQueryBuilder() {
1444
1451
  return this.$adapter.modelConstructorClient(this).query().from(this.table);
1445
1452
  }
1446
- static async $onResourcefulIndex(filter, page, perPage, fields, ctx, app, hooks = []) {
1453
+ static async $onResourcefulIndex(filter, page, perPage, fields, sort, ctx, app, hooks = []) {
1447
1454
  var _a2;
1448
1455
  const primaryKey = this.$getPrivateKeyAttribute();
1449
1456
  if (!primaryKey) {
@@ -1465,11 +1472,11 @@ function withResourceful(options = {}) {
1465
1472
  if (possibleFields.length === 0) {
1466
1473
  throw new errors.E_INVALID_COLUMN_ACCESS("No fields available for access");
1467
1474
  }
1468
- const schema = index.joi.object({
1469
- filter: index.joi.string().allow("").required(),
1470
- page: index.joi.number().integer().min(1).required(),
1471
- perPage: index.joi.number().integer().min(1).max(100).required(),
1472
- fields: index.joi.array().items(index.joi.string().valid(...possibleFields)).required()
1475
+ const schema = joi.joi.object({
1476
+ filter: joi.joi.string().allow("").required(),
1477
+ page: joi.joi.number().integer().min(1).required(),
1478
+ perPage: joi.joi.number().integer().min(1).max(100).required(),
1479
+ fields: joi.joi.array().items(joi.joi.string().valid(...possibleFields)).required()
1473
1480
  });
1474
1481
  const { error: methodValidationError, value: validatedMethodOptions } = schema.validate(
1475
1482
  {
@@ -1499,11 +1506,18 @@ function withResourceful(options = {}) {
1499
1506
  ]) {
1500
1507
  await scopeCallback(ctx, app, query);
1501
1508
  }
1502
- const columnsToSelect = validatedMethodOptions.fields.filter((field) => allowedFieldsMap.has(field)).map((field) => this.$keys.serializedToColumns.get(field));
1509
+ const columnsToSelect = validatedMethodOptions.fields.filter((field) => allowedFieldsMap.has(field)).map((field) => this.$keys.serializedToColumns.get(field)).filter((column2) => !!column2);
1503
1510
  const countQuery = query.clone();
1504
1511
  const recordsQuery = query.clone();
1505
1512
  countQuery.count("*", "total");
1506
1513
  recordsQuery.select(columnsToSelect).forPage(validatedMethodOptions.page, validatedMethodOptions.perPage);
1514
+ if (Array.isArray(sort) && sort.length > 0) {
1515
+ sort.forEach(([field, direction]) => {
1516
+ if (allowedFieldsMap.has(field)) {
1517
+ recordsQuery.orderBy(field, direction);
1518
+ }
1519
+ });
1520
+ }
1507
1521
  const countQueryQuery = countQuery.toQuery();
1508
1522
  const recordsQueryQuery = recordsQuery.toQuery();
1509
1523
  const [countResults, rawRecords] = await Promise.all([countQuery, recordsQuery]);
@@ -4607,12 +4621,12 @@ var parseObject = function(chain, val, options, valuesParsed) {
4607
4621
  obj = options.plainObjects ? { __proto__: null } : {};
4608
4622
  var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
4609
4623
  var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
4610
- var index2 = parseInt(decodedRoot, 10);
4624
+ var index = parseInt(decodedRoot, 10);
4611
4625
  if (!options.parseArrays && decodedRoot === "") {
4612
4626
  obj = { 0: leaf };
4613
- } else if (!isNaN(index2) && root !== decodedRoot && String(index2) === decodedRoot && index2 >= 0 && (options.parseArrays && index2 <= options.arrayLimit)) {
4627
+ } else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) {
4614
4628
  obj = [];
4615
- obj[index2] = leaf;
4629
+ obj[index] = leaf;
4616
4630
  } else if (decodedRoot !== "__proto__") {
4617
4631
  obj[decodedRoot] = leaf;
4618
4632
  }
@@ -9654,9 +9668,9 @@ class ManyToManyQueryClient {
9654
9668
  one.$trx = trx;
9655
9669
  await one.save();
9656
9670
  }
9657
- const relatedForeignKeyValues = related.reduce((result, one, index2) => {
9671
+ const relatedForeignKeyValues = related.reduce((result, one, index) => {
9658
9672
  const [, relatedForeignKeyValue] = this.relation.getPivotRelatedPair(one);
9659
- result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index2]) || {};
9673
+ result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index]) || {};
9660
9674
  return result;
9661
9675
  }, {});
9662
9676
  if (performSync) {
@@ -9694,9 +9708,9 @@ class ManyToManyQueryClient {
9694
9708
  this.parent.$trx = trx;
9695
9709
  await this.parent.save();
9696
9710
  const related = await this.relation.relatedModel().createMany(values, { client: trx, ...options });
9697
- const relatedForeignKeyValues = related.reduce((result, one, index2) => {
9711
+ const relatedForeignKeyValues = related.reduce((result, one, index) => {
9698
9712
  const [, relatedForeignKeyValue] = this.relation.getPivotRelatedPair(one);
9699
- result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index2]) || {};
9713
+ result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index]) || {};
9700
9714
  return result;
9701
9715
  }, {});
9702
9716
  await this.attach(relatedForeignKeyValues, trx);
@@ -11800,25 +11814,25 @@ const validateNormalizeAndCastDecoratorOptions = (fieldName, decoratorName, sche
11800
11814
  }
11801
11815
  return value;
11802
11816
  };
11803
- const resourcefulPropertyDefinitionSchema = index.joi.object({
11804
- propertyKey: index.joi.string().default(""),
11805
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11806
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11807
- nullable: index.joi.boolean().default(false),
11808
- description: index.joi.string().optional(),
11809
- default: index.joi.any().optional(),
11810
- externalDocs: index.joi.object({
11811
- description: index.joi.string().optional(),
11812
- url: index.joi.string().uri().required()
11817
+ const resourcefulPropertyDefinitionSchema = joi.joi.object({
11818
+ propertyKey: joi.joi.string().default(""),
11819
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11820
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11821
+ nullable: joi.joi.boolean().default(false),
11822
+ description: joi.joi.string().optional(),
11823
+ default: joi.joi.any().optional(),
11824
+ externalDocs: joi.joi.object({
11825
+ description: joi.joi.string().optional(),
11826
+ url: joi.joi.string().uri().required()
11813
11827
  }).optional(),
11814
- example: index.joi.string().optional(),
11815
- deprecated: index.joi.boolean().default(false)
11828
+ example: joi.joi.string().optional(),
11829
+ deprecated: joi.joi.boolean().default(false)
11816
11830
  });
11817
11831
  const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
11818
11832
  return [
11819
- index.joi.object().instance(Ctor),
11820
- index.joi.function().instance(Ctor),
11821
- index.joi.custom((value, helpers) => {
11833
+ joi.joi.object().instance(Ctor),
11834
+ joi.joi.function().instance(Ctor),
11835
+ joi.joi.custom((value, helpers) => {
11822
11836
  if (decorator_utils.isObject(value) && value.constructor.name === CtorName) {
11823
11837
  return value;
11824
11838
  }
@@ -11826,7 +11840,7 @@ const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
11826
11840
  })
11827
11841
  ];
11828
11842
  };
11829
- const resourcefulDataTypeSchema = index.joi.alternatives(
11843
+ const resourcefulDataTypeSchema = joi.joi.alternatives(
11830
11844
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType"),
11831
11845
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType"),
11832
11846
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType"),
@@ -11845,95 +11859,95 @@ const resourcefulDataTypeSchema = index.joi.alternatives(
11845
11859
  const localResourcefulPropertyDefinitionSchema = resourcefulPropertyDefinitionSchema.keys({
11846
11860
  type: resourcefulDataTypeSchema.required()
11847
11861
  });
11848
- const resourcefulColumnOptionsSchema = index.joi.object({
11862
+ const resourcefulColumnOptionsSchema = joi.joi.object({
11849
11863
  // Lucid ColumnOptions (partial)
11850
- columnName: index.joi.string().optional(),
11851
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11852
- serialize: index.joi.function().optional(),
11853
- consume: index.joi.function().optional(),
11854
- prepare: index.joi.function().optional(),
11855
- meta: index.joi.object().optional(),
11856
- isPrimary: index.joi.boolean().default(false),
11857
- hasDefaultValue: index.joi.boolean().default(false),
11864
+ columnName: joi.joi.string().optional(),
11865
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
11866
+ serialize: joi.joi.function().optional(),
11867
+ consume: joi.joi.function().optional(),
11868
+ prepare: joi.joi.function().optional(),
11869
+ meta: joi.joi.object().optional(),
11870
+ isPrimary: joi.joi.boolean().default(false),
11871
+ hasDefaultValue: joi.joi.boolean().default(false),
11858
11872
  // Resourceful options
11859
- propertyKey: index.joi.string().default(""),
11860
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11861
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11862
- nullable: index.joi.boolean().default(false),
11863
- description: index.joi.string().optional(),
11864
- default: index.joi.any().optional(),
11865
- externalDocs: index.joi.object({
11866
- description: index.joi.string().optional(),
11867
- url: index.joi.string().uri().required()
11873
+ propertyKey: joi.joi.string().default(""),
11874
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11875
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11876
+ nullable: joi.joi.boolean().default(false),
11877
+ description: joi.joi.string().optional(),
11878
+ default: joi.joi.any().optional(),
11879
+ externalDocs: joi.joi.object({
11880
+ description: joi.joi.string().optional(),
11881
+ url: joi.joi.string().uri().required()
11868
11882
  }).optional(),
11869
- example: index.joi.string().optional(),
11870
- deprecated: index.joi.boolean().default(false),
11883
+ example: joi.joi.string().optional(),
11884
+ deprecated: joi.joi.boolean().default(false),
11871
11885
  type: resourcefulDataTypeSchema.required()
11872
11886
  });
11873
- const dataTypeColumnOptionsSchema = index.joi.object({
11887
+ const dataTypeColumnOptionsSchema = joi.joi.object({
11874
11888
  // Lucid ColumnOptions (partial) - excluding 'prepare' and 'consume'
11875
- columnName: index.joi.string().optional(),
11876
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11877
- serialize: index.joi.function().optional(),
11878
- meta: index.joi.object().optional(),
11879
- isPrimary: index.joi.boolean().default(false),
11880
- hasDefaultValue: index.joi.boolean().default(false),
11889
+ columnName: joi.joi.string().optional(),
11890
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
11891
+ serialize: joi.joi.function().optional(),
11892
+ meta: joi.joi.object().optional(),
11893
+ isPrimary: joi.joi.boolean().default(false),
11894
+ hasDefaultValue: joi.joi.boolean().default(false),
11881
11895
  // Resourceful options
11882
- propertyKey: index.joi.string().default(""),
11883
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11884
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11885
- nullable: index.joi.boolean().default(false),
11886
- description: index.joi.string().optional(),
11887
- default: index.joi.any().optional(),
11888
- externalDocs: index.joi.object({
11889
- description: index.joi.string().optional(),
11890
- url: index.joi.string().uri().required()
11896
+ propertyKey: joi.joi.string().default(""),
11897
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11898
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11899
+ nullable: joi.joi.boolean().default(false),
11900
+ description: joi.joi.string().optional(),
11901
+ default: joi.joi.any().optional(),
11902
+ externalDocs: joi.joi.object({
11903
+ description: joi.joi.string().optional(),
11904
+ url: joi.joi.string().uri().required()
11891
11905
  }).optional(),
11892
- example: index.joi.string().optional(),
11893
- deprecated: index.joi.boolean().default(false),
11906
+ example: joi.joi.string().optional(),
11907
+ deprecated: joi.joi.boolean().default(false),
11894
11908
  type: resourcefulDataTypeSchema.optional()
11895
11909
  });
11896
11910
  const baseDateColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11897
- autoCreate: index.joi.boolean().default(false),
11898
- autoUpdate: index.joi.boolean().default(false)
11911
+ autoCreate: joi.joi.boolean().default(false),
11912
+ autoUpdate: joi.joi.boolean().default(false)
11899
11913
  });
11900
11914
  const stringColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11901
- type: index.joi.alternatives(
11915
+ type: joi.joi.alternatives(
11902
11916
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType")
11903
11917
  ).default(() => new definitions.ResourcefulStringType())
11904
11918
  });
11905
11919
  const dateColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
11906
- type: index.joi.alternatives(
11920
+ type: joi.joi.alternatives(
11907
11921
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType")
11908
11922
  ).default(() => new definitions.ResourcefulDateType())
11909
11923
  });
11910
11924
  const dateTimeColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
11911
- type: index.joi.alternatives(
11925
+ type: joi.joi.alternatives(
11912
11926
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType")
11913
11927
  ).default(() => new definitions.ResourcefulDateTimeType())
11914
11928
  });
11915
11929
  const binaryColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11916
- type: index.joi.alternatives(
11930
+ type: joi.joi.alternatives(
11917
11931
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBinaryType, "ResourcefulBinaryType")
11918
11932
  ).default(() => new definitions.ResourcefulBinaryType())
11919
11933
  });
11920
11934
  const numberColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11921
- type: index.joi.alternatives(
11935
+ type: joi.joi.alternatives(
11922
11936
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulNumberType, "ResourcefulNumberType")
11923
11937
  ).default(() => new definitions.ResourcefulNumberType())
11924
11938
  });
11925
11939
  const integerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11926
- type: index.joi.alternatives(
11940
+ type: joi.joi.alternatives(
11927
11941
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulIntegerType, "ResourcefulIntegerType")
11928
11942
  ).default(() => new definitions.ResourcefulIntegerType())
11929
11943
  });
11930
11944
  const bigintColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11931
- type: index.joi.alternatives(
11945
+ type: joi.joi.alternatives(
11932
11946
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBigintType, "ResourcefulBigintType")
11933
11947
  ).default(() => new definitions.ResourcefulBigintType())
11934
11948
  });
11935
11949
  const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11936
- type: index.joi.alternatives(
11950
+ type: joi.joi.alternatives(
11937
11951
  ...joiInstanceCheckerAlternativesFactory(
11938
11952
  definitions.ResourcefulUnsignedIntegerType,
11939
11953
  "ResourcefulUnsignedIntegerType"
@@ -11941,148 +11955,148 @@ const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11941
11955
  ).default(() => new definitions.ResourcefulUnsignedIntegerType())
11942
11956
  });
11943
11957
  const booleanColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
11944
- type: index.joi.alternatives(
11958
+ type: joi.joi.alternatives(
11945
11959
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBooleanType, "ResourcefulBooleanType")
11946
11960
  ).default(() => new definitions.ResourcefulBooleanType())
11947
11961
  });
11948
- const objectColumnOptionsSchema = index.joi.object({
11962
+ const objectColumnOptionsSchema = joi.joi.object({
11949
11963
  // Lucid ColumnOptions (full)
11950
- columnName: index.joi.string().optional(),
11951
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11952
- serialize: index.joi.function().optional(),
11953
- consume: index.joi.function().optional(),
11954
- prepare: index.joi.function().optional(),
11955
- meta: index.joi.object().optional(),
11956
- isPrimary: index.joi.boolean().default(false),
11957
- hasDefaultValue: index.joi.boolean().default(false),
11964
+ columnName: joi.joi.string().optional(),
11965
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
11966
+ serialize: joi.joi.function().optional(),
11967
+ consume: joi.joi.function().optional(),
11968
+ prepare: joi.joi.function().optional(),
11969
+ meta: joi.joi.object().optional(),
11970
+ isPrimary: joi.joi.boolean().default(false),
11971
+ hasDefaultValue: joi.joi.boolean().default(false),
11958
11972
  // Resourceful options
11959
- propertyKey: index.joi.string().default(""),
11960
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11961
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11962
- nullable: index.joi.boolean().default(false),
11963
- description: index.joi.string().optional(),
11964
- default: index.joi.any().optional(),
11965
- externalDocs: index.joi.object({
11966
- description: index.joi.string().optional(),
11967
- url: index.joi.string().uri().required()
11973
+ propertyKey: joi.joi.string().default(""),
11974
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11975
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
11976
+ nullable: joi.joi.boolean().default(false),
11977
+ description: joi.joi.string().optional(),
11978
+ default: joi.joi.any().optional(),
11979
+ externalDocs: joi.joi.object({
11980
+ description: joi.joi.string().optional(),
11981
+ url: joi.joi.string().uri().required()
11968
11982
  }).optional(),
11969
- example: index.joi.string().optional(),
11970
- deprecated: index.joi.boolean().default(false),
11971
- type: index.joi.alternatives(
11983
+ example: joi.joi.string().optional(),
11984
+ deprecated: joi.joi.boolean().default(false),
11985
+ type: joi.joi.alternatives(
11972
11986
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulObjectType, "ResourcefulObjectType")
11973
11987
  ).default(() => new definitions.ResourcefulObjectType())
11974
11988
  });
11975
- const arrayColumnOptionsSchema = index.joi.object({
11989
+ const arrayColumnOptionsSchema = joi.joi.object({
11976
11990
  // Lucid ColumnOptions (full)
11977
- columnName: index.joi.string().optional(),
11978
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
11979
- serialize: index.joi.function().optional(),
11980
- consume: index.joi.function().optional(),
11981
- prepare: index.joi.function().optional(),
11982
- meta: index.joi.object().optional(),
11983
- isPrimary: index.joi.boolean().default(false),
11984
- hasDefaultValue: index.joi.boolean().default(false),
11991
+ columnName: joi.joi.string().optional(),
11992
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
11993
+ serialize: joi.joi.function().optional(),
11994
+ consume: joi.joi.function().optional(),
11995
+ prepare: joi.joi.function().optional(),
11996
+ meta: joi.joi.object().optional(),
11997
+ isPrimary: joi.joi.boolean().default(false),
11998
+ hasDefaultValue: joi.joi.boolean().default(false),
11985
11999
  // Resourceful options
11986
- propertyKey: index.joi.string().default(""),
11987
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11988
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
11989
- nullable: index.joi.boolean().default(false),
11990
- description: index.joi.string().optional(),
11991
- default: index.joi.any().optional(),
11992
- externalDocs: index.joi.object({
11993
- description: index.joi.string().optional(),
11994
- url: index.joi.string().uri().required()
12000
+ propertyKey: joi.joi.string().default(""),
12001
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12002
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12003
+ nullable: joi.joi.boolean().default(false),
12004
+ description: joi.joi.string().optional(),
12005
+ default: joi.joi.any().optional(),
12006
+ externalDocs: joi.joi.object({
12007
+ description: joi.joi.string().optional(),
12008
+ url: joi.joi.string().uri().required()
11995
12009
  }).optional(),
11996
- example: index.joi.string().optional(),
11997
- deprecated: index.joi.boolean().default(false),
11998
- type: index.joi.alternatives(
12010
+ example: joi.joi.string().optional(),
12011
+ deprecated: joi.joi.boolean().default(false),
12012
+ type: joi.joi.alternatives(
11999
12013
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulArrayType, "ResourcefulArrayType")
12000
12014
  ).default(() => new definitions.ResourcefulArrayType())
12001
12015
  });
12002
12016
  localResourcefulPropertyDefinitionSchema.append({
12003
- writable: index.joi.boolean().default(false)
12017
+ writable: joi.joi.boolean().default(false)
12004
12018
  });
12005
- const resourcefulComputedOptionsSchema = index.joi.object({
12019
+ const resourcefulComputedOptionsSchema = joi.joi.object({
12006
12020
  // Lucid ComputedOptions (partial)
12007
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12008
- serialize: index.joi.function().optional(),
12009
- meta: index.joi.object().optional(),
12021
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12022
+ serialize: joi.joi.function().optional(),
12023
+ meta: joi.joi.object().optional(),
12010
12024
  // Resourceful options
12011
- propertyKey: index.joi.string().default(""),
12012
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12013
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12014
- nullable: index.joi.boolean().default(false),
12015
- description: index.joi.string().optional(),
12016
- default: index.joi.any().optional(),
12017
- externalDocs: index.joi.object({
12018
- description: index.joi.string().optional(),
12019
- url: index.joi.string().uri().required()
12025
+ propertyKey: joi.joi.string().default(""),
12026
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12027
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12028
+ nullable: joi.joi.boolean().default(false),
12029
+ description: joi.joi.string().optional(),
12030
+ default: joi.joi.any().optional(),
12031
+ externalDocs: joi.joi.object({
12032
+ description: joi.joi.string().optional(),
12033
+ url: joi.joi.string().uri().required()
12020
12034
  }).optional(),
12021
- example: index.joi.string().optional(),
12022
- deprecated: index.joi.boolean().default(false),
12035
+ example: joi.joi.string().optional(),
12036
+ deprecated: joi.joi.boolean().default(false),
12023
12037
  type: resourcefulDataTypeSchema.required()
12024
12038
  });
12025
- const dataTypeComputedOptionsSchema = index.joi.object({
12039
+ const dataTypeComputedOptionsSchema = joi.joi.object({
12026
12040
  // Lucid ComputedOptions (partial) - excluding 'prepare' and 'consume'
12027
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12028
- serialize: index.joi.function().optional(),
12029
- meta: index.joi.object().optional(),
12041
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12042
+ serialize: joi.joi.function().optional(),
12043
+ meta: joi.joi.object().optional(),
12030
12044
  // Resourceful options
12031
- propertyKey: index.joi.string().default(""),
12032
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12033
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12034
- nullable: index.joi.boolean().default(false),
12035
- description: index.joi.string().optional(),
12036
- default: index.joi.any().optional(),
12037
- externalDocs: index.joi.object({
12038
- description: index.joi.string().optional(),
12039
- url: index.joi.string().uri().required()
12045
+ propertyKey: joi.joi.string().default(""),
12046
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12047
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12048
+ nullable: joi.joi.boolean().default(false),
12049
+ description: joi.joi.string().optional(),
12050
+ default: joi.joi.any().optional(),
12051
+ externalDocs: joi.joi.object({
12052
+ description: joi.joi.string().optional(),
12053
+ url: joi.joi.string().uri().required()
12040
12054
  }).optional(),
12041
- example: index.joi.string().optional(),
12042
- deprecated: index.joi.boolean().default(false),
12055
+ example: joi.joi.string().optional(),
12056
+ deprecated: joi.joi.boolean().default(false),
12043
12057
  type: resourcefulDataTypeSchema.optional()
12044
12058
  });
12045
12059
  const baseDateComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12046
- autoCreate: index.joi.boolean().default(false),
12047
- autoUpdate: index.joi.boolean().default(false)
12060
+ autoCreate: joi.joi.boolean().default(false),
12061
+ autoUpdate: joi.joi.boolean().default(false)
12048
12062
  });
12049
12063
  const stringComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12050
- type: index.joi.alternatives(
12064
+ type: joi.joi.alternatives(
12051
12065
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType")
12052
12066
  ).default(() => new definitions.ResourcefulStringType())
12053
12067
  });
12054
12068
  const dateComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
12055
- type: index.joi.alternatives(
12069
+ type: joi.joi.alternatives(
12056
12070
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType")
12057
12071
  ).default(() => new definitions.ResourcefulDateType())
12058
12072
  });
12059
12073
  const dateTimeComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
12060
- type: index.joi.alternatives(
12074
+ type: joi.joi.alternatives(
12061
12075
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType")
12062
12076
  ).default(() => new definitions.ResourcefulDateTimeType())
12063
12077
  });
12064
12078
  const binaryComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12065
- type: index.joi.alternatives(
12079
+ type: joi.joi.alternatives(
12066
12080
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBinaryType, "ResourcefulBinaryType")
12067
12081
  ).default(() => new definitions.ResourcefulBinaryType())
12068
12082
  });
12069
12083
  const numberComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12070
- type: index.joi.alternatives(
12084
+ type: joi.joi.alternatives(
12071
12085
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulNumberType, "ResourcefulNumberType")
12072
12086
  ).default(() => new definitions.ResourcefulNumberType())
12073
12087
  });
12074
12088
  const integerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12075
- type: index.joi.alternatives(
12089
+ type: joi.joi.alternatives(
12076
12090
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulIntegerType, "ResourcefulIntegerType")
12077
12091
  ).default(() => new definitions.ResourcefulIntegerType())
12078
12092
  });
12079
12093
  const bigintComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12080
- type: index.joi.alternatives(
12094
+ type: joi.joi.alternatives(
12081
12095
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBigintType, "ResourcefulBigintType")
12082
12096
  ).default(() => new definitions.ResourcefulBigintType())
12083
12097
  });
12084
12098
  const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12085
- type: index.joi.alternatives(
12099
+ type: joi.joi.alternatives(
12086
12100
  ...joiInstanceCheckerAlternativesFactory(
12087
12101
  definitions.ResourcefulUnsignedIntegerType,
12088
12102
  "ResourcefulUnsignedIntegerType"
@@ -12090,99 +12104,99 @@ const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys(
12090
12104
  ).default(() => new definitions.ResourcefulUnsignedIntegerType())
12091
12105
  });
12092
12106
  const booleanComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
12093
- type: index.joi.alternatives(
12107
+ type: joi.joi.alternatives(
12094
12108
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBooleanType, "ResourcefulBooleanType")
12095
12109
  ).default(() => new definitions.ResourcefulBooleanType())
12096
12110
  });
12097
- const objectComputedOptionsSchema = index.joi.object({
12111
+ const objectComputedOptionsSchema = joi.joi.object({
12098
12112
  // Lucid ComputedOptions (full)
12099
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12100
- serialize: index.joi.function().optional(),
12101
- meta: index.joi.object().optional(),
12113
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12114
+ serialize: joi.joi.function().optional(),
12115
+ meta: joi.joi.object().optional(),
12102
12116
  // Resourceful options
12103
- propertyKey: index.joi.string().default(""),
12104
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12105
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12106
- nullable: index.joi.boolean().default(false),
12107
- description: index.joi.string().optional(),
12108
- default: index.joi.any().optional(),
12109
- externalDocs: index.joi.object({
12110
- description: index.joi.string().optional(),
12111
- url: index.joi.string().uri().required()
12117
+ propertyKey: joi.joi.string().default(""),
12118
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12119
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12120
+ nullable: joi.joi.boolean().default(false),
12121
+ description: joi.joi.string().optional(),
12122
+ default: joi.joi.any().optional(),
12123
+ externalDocs: joi.joi.object({
12124
+ description: joi.joi.string().optional(),
12125
+ url: joi.joi.string().uri().required()
12112
12126
  }).optional(),
12113
- example: index.joi.string().optional(),
12114
- deprecated: index.joi.boolean().default(false),
12115
- type: index.joi.alternatives(
12127
+ example: joi.joi.string().optional(),
12128
+ deprecated: joi.joi.boolean().default(false),
12129
+ type: joi.joi.alternatives(
12116
12130
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulObjectType, "ResourcefulObjectType")
12117
12131
  ).default(() => new definitions.ResourcefulObjectType())
12118
12132
  });
12119
- const arrayComputedOptionsSchema = index.joi.object({
12133
+ const arrayComputedOptionsSchema = joi.joi.object({
12120
12134
  // Lucid ComputedOptions (full)
12121
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12122
- serialize: index.joi.function().optional(),
12123
- meta: index.joi.object().optional(),
12135
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12136
+ serialize: joi.joi.function().optional(),
12137
+ meta: joi.joi.object().optional(),
12124
12138
  // Resourceful options
12125
- propertyKey: index.joi.string().default(""),
12126
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12127
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12128
- nullable: index.joi.boolean().default(false),
12129
- description: index.joi.string().optional(),
12130
- default: index.joi.any().optional(),
12131
- externalDocs: index.joi.object({
12132
- description: index.joi.string().optional(),
12133
- url: index.joi.string().uri().required()
12139
+ propertyKey: joi.joi.string().default(""),
12140
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12141
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12142
+ nullable: joi.joi.boolean().default(false),
12143
+ description: joi.joi.string().optional(),
12144
+ default: joi.joi.any().optional(),
12145
+ externalDocs: joi.joi.object({
12146
+ description: joi.joi.string().optional(),
12147
+ url: joi.joi.string().uri().required()
12134
12148
  }).optional(),
12135
- example: index.joi.string().optional(),
12136
- deprecated: index.joi.boolean().default(false),
12137
- type: index.joi.alternatives(
12149
+ example: joi.joi.string().optional(),
12150
+ deprecated: joi.joi.boolean().default(false),
12151
+ type: joi.joi.alternatives(
12138
12152
  ...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulArrayType, "ResourcefulArrayType")
12139
12153
  ).default(() => new definitions.ResourcefulArrayType())
12140
12154
  });
12141
- const resourcefulRelationshipOptionsSchema = index.joi.object({
12155
+ const resourcefulRelationshipOptionsSchema = joi.joi.object({
12142
12156
  // Resourceful options
12143
- propertyKey: index.joi.string().default(""),
12144
- readAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12145
- writeAccessControlFilters: index.joi.array().items(index.joi.function()).default([]),
12146
- nullable: index.joi.boolean().default(false),
12147
- description: index.joi.string().optional(),
12148
- default: index.joi.any().optional(),
12149
- externalDocs: index.joi.object({
12150
- description: index.joi.string().optional(),
12151
- url: index.joi.string().uri().required()
12157
+ propertyKey: joi.joi.string().default(""),
12158
+ readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12159
+ writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
12160
+ nullable: joi.joi.boolean().default(false),
12161
+ description: joi.joi.string().optional(),
12162
+ default: joi.joi.any().optional(),
12163
+ externalDocs: joi.joi.object({
12164
+ description: joi.joi.string().optional(),
12165
+ url: joi.joi.string().uri().required()
12152
12166
  }).optional(),
12153
- example: index.joi.string().optional(),
12154
- deprecated: index.joi.boolean().default(false)
12167
+ example: joi.joi.string().optional(),
12168
+ deprecated: joi.joi.boolean().default(false)
12155
12169
  });
12156
12170
  const relationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12157
12171
  // Lucid RelationOptions
12158
- localKey: index.joi.string().optional(),
12159
- foreignKey: 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()
12172
+ localKey: joi.joi.string().optional(),
12173
+ foreignKey: joi.joi.string().optional(),
12174
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12175
+ onQuery: joi.joi.function().optional(),
12176
+ relatedModel: joi.joi.function()
12163
12177
  });
12164
12178
  const manyToManyRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12165
12179
  // Lucid ManyToManyRelationOptions
12166
- localKey: index.joi.string().optional(),
12167
- relatedKey: index.joi.string().optional(),
12168
- pivotForeignKey: index.joi.string().optional(),
12169
- pivotRelatedForeignKey: index.joi.string().optional(),
12170
- pivotTable: index.joi.string().optional(),
12171
- pivotTimestamps: index.joi.boolean().optional(),
12172
- pivotColumns: index.joi.array().items(index.joi.string()).optional(),
12173
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12174
- onQuery: index.joi.function().optional(),
12175
- relatedModel: index.joi.function()
12180
+ localKey: joi.joi.string().optional(),
12181
+ relatedKey: joi.joi.string().optional(),
12182
+ pivotForeignKey: joi.joi.string().optional(),
12183
+ pivotRelatedForeignKey: joi.joi.string().optional(),
12184
+ pivotTable: joi.joi.string().optional(),
12185
+ pivotTimestamps: joi.joi.boolean().optional(),
12186
+ pivotColumns: joi.joi.array().items(joi.joi.string()).optional(),
12187
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12188
+ onQuery: joi.joi.function().optional(),
12189
+ relatedModel: joi.joi.function()
12176
12190
  });
12177
12191
  const hasManyThroughRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
12178
12192
  // Lucid HasManyThroughRelationOptions (ThroughRelationOptions without throughModel)
12179
- localKey: index.joi.string().optional(),
12180
- foreignKey: index.joi.string().optional(),
12181
- throughLocalKey: index.joi.string().optional(),
12182
- throughForeignKey: index.joi.string().optional(),
12183
- serializeAs: index.joi.alternatives().try(index.joi.string(), index.joi.valid(null)).optional(),
12184
- onQuery: index.joi.function().optional(),
12185
- relatedModel: index.joi.function()
12193
+ localKey: joi.joi.string().optional(),
12194
+ foreignKey: joi.joi.string().optional(),
12195
+ throughLocalKey: joi.joi.string().optional(),
12196
+ throughForeignKey: joi.joi.string().optional(),
12197
+ serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
12198
+ onQuery: joi.joi.function().optional(),
12199
+ relatedModel: joi.joi.function()
12186
12200
  });
12187
12201
  const extractLucidOptionsForLucidDecorator = (options, keys, overrides) => {
12188
12202
  const extracted = {};
@@ -12737,7 +12751,7 @@ function resourcefulHasManyThrough(model, options = {}) {
12737
12751
  map.set(propertyKey, opts);
12738
12752
  };
12739
12753
  }
12740
- const version = "1.20250718.2";
12754
+ const version = "1.20250724.1";
12741
12755
  exports.errors = errors.errors;
12742
12756
  exports.definitions = definitions.definitions;
12743
12757
  exports.resourcefulBelongsTo = resourcefulBelongsTo;