@nhtio/lucid-resourceful 1.20250718.1 → 1.20250724.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{decorator_utils-1yWqd_Gg.cjs → decorator_utils-U_rZo8tv.cjs} +47 -3
- package/decorator_utils-U_rZo8tv.cjs.map +1 -0
- package/{decorator_utils-BUuBwQYK.js → decorator_utils-YSb1EGJ6.js} +50 -4
- package/decorator_utils-YSb1EGJ6.js.map +1 -0
- package/{definitions-B66EPk0H.js → definitions-B88XBTUF.js} +119 -119
- package/{definitions-B66EPk0H.js.map → definitions-B88XBTUF.js.map} +1 -1
- package/{definitions-BrN-oCRI.cjs → definitions-DgI468dW.cjs} +119 -119
- package/{definitions-BrN-oCRI.cjs.map → definitions-DgI468dW.cjs.map} +1 -1
- package/definitions.cjs +1 -1
- package/definitions.mjs +1 -1
- package/index.cjs +401 -378
- package/index.cjs.map +1 -1
- package/index.mjs +376 -353
- package/index.mjs.map +1 -1
- package/joi.cjs +12389 -2
- package/joi.cjs.map +1 -1
- package/joi.mjs +12391 -2
- package/joi.mjs.map +1 -1
- package/package.json +1 -1
- package/private/decorators.d.ts +1 -1
- package/private/joi/index.d.ts +3 -65
- package/private/mixin.d.ts +4 -1
- package/private/prepare_consume_chain_builder.d.ts +36 -0
- package/private/types.d.ts +3 -0
- package/utils.cjs +1 -1
- package/utils.mjs +2 -2
- package/decorator_utils-1yWqd_Gg.cjs.map +0 -1
- package/decorator_utils-BUuBwQYK.js.map +0 -1
- package/index-Cv6KC1rC.cjs +0 -670
- package/index-Cv6KC1rC.cjs.map +0 -1
- package/index-DDaZ2qr2.js +0 -671
- package/index-DDaZ2qr2.js.map +0 -1
- package/private/joi/bigint.d.ts +0 -85
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-
|
|
14
|
-
import {
|
|
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-
|
|
19
|
-
import { k } from "./definitions-
|
|
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 =
|
|
639
|
-
name:
|
|
640
|
-
readRequiredForWrite:
|
|
641
|
-
accessControlFilters:
|
|
642
|
-
list:
|
|
643
|
-
create:
|
|
644
|
-
read:
|
|
645
|
-
update:
|
|
646
|
-
delete:
|
|
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:
|
|
649
|
-
onValidationScopeError:
|
|
650
|
-
queryScopeCallbacks:
|
|
651
|
-
list:
|
|
652
|
-
access:
|
|
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:
|
|
655
|
-
externalDocs:
|
|
656
|
-
description:
|
|
657
|
-
url:
|
|
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:
|
|
660
|
-
advanced:
|
|
661
|
-
propertyEvaluationConcurrency:
|
|
662
|
-
aclEvaluationConcurrency:
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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),
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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),
|
|
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 =
|
|
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 =
|
|
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
|
|
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 =
|
|
1506
|
-
filter:
|
|
1507
|
-
page:
|
|
1508
|
-
perPage:
|
|
1509
|
-
fields:
|
|
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);
|
|
@@ -11787,25 +11807,25 @@ const validateNormalizeAndCastDecoratorOptions = (fieldName, decoratorName, sche
|
|
|
11787
11807
|
}
|
|
11788
11808
|
return value;
|
|
11789
11809
|
};
|
|
11790
|
-
const resourcefulPropertyDefinitionSchema =
|
|
11791
|
-
propertyKey:
|
|
11792
|
-
readAccessControlFilters:
|
|
11793
|
-
writeAccessControlFilters:
|
|
11794
|
-
nullable:
|
|
11795
|
-
description:
|
|
11796
|
-
default:
|
|
11797
|
-
externalDocs:
|
|
11798
|
-
description:
|
|
11799
|
-
url:
|
|
11810
|
+
const resourcefulPropertyDefinitionSchema = Q_.object({
|
|
11811
|
+
propertyKey: Q_.string().default(""),
|
|
11812
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11813
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11814
|
+
nullable: Q_.boolean().default(false),
|
|
11815
|
+
description: Q_.string().optional(),
|
|
11816
|
+
default: Q_.any().optional(),
|
|
11817
|
+
externalDocs: Q_.object({
|
|
11818
|
+
description: Q_.string().optional(),
|
|
11819
|
+
url: Q_.string().uri().required()
|
|
11800
11820
|
}).optional(),
|
|
11801
|
-
example:
|
|
11802
|
-
deprecated:
|
|
11821
|
+
example: Q_.string().optional(),
|
|
11822
|
+
deprecated: Q_.boolean().default(false)
|
|
11803
11823
|
});
|
|
11804
11824
|
const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
|
|
11805
11825
|
return [
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11826
|
+
Q_.object().instance(Ctor),
|
|
11827
|
+
Q_.function().instance(Ctor),
|
|
11828
|
+
Q_.custom((value, helpers) => {
|
|
11809
11829
|
if (isObject$1(value) && value.constructor.name === CtorName) {
|
|
11810
11830
|
return value;
|
|
11811
11831
|
}
|
|
@@ -11813,7 +11833,7 @@ const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
|
|
|
11813
11833
|
})
|
|
11814
11834
|
];
|
|
11815
11835
|
};
|
|
11816
|
-
const resourcefulDataTypeSchema =
|
|
11836
|
+
const resourcefulDataTypeSchema = Q_.alternatives(
|
|
11817
11837
|
...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType"),
|
|
11818
11838
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType"),
|
|
11819
11839
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType"),
|
|
@@ -11832,95 +11852,95 @@ const resourcefulDataTypeSchema = joi.alternatives(
|
|
|
11832
11852
|
const localResourcefulPropertyDefinitionSchema = resourcefulPropertyDefinitionSchema.keys({
|
|
11833
11853
|
type: resourcefulDataTypeSchema.required()
|
|
11834
11854
|
});
|
|
11835
|
-
const resourcefulColumnOptionsSchema =
|
|
11855
|
+
const resourcefulColumnOptionsSchema = Q_.object({
|
|
11836
11856
|
// Lucid ColumnOptions (partial)
|
|
11837
|
-
columnName:
|
|
11838
|
-
serializeAs:
|
|
11839
|
-
serialize:
|
|
11840
|
-
consume:
|
|
11841
|
-
prepare:
|
|
11842
|
-
meta:
|
|
11843
|
-
isPrimary:
|
|
11844
|
-
hasDefaultValue:
|
|
11857
|
+
columnName: Q_.string().optional(),
|
|
11858
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
11859
|
+
serialize: Q_.function().optional(),
|
|
11860
|
+
consume: Q_.function().optional(),
|
|
11861
|
+
prepare: Q_.function().optional(),
|
|
11862
|
+
meta: Q_.object().optional(),
|
|
11863
|
+
isPrimary: Q_.boolean().default(false),
|
|
11864
|
+
hasDefaultValue: Q_.boolean().default(false),
|
|
11845
11865
|
// Resourceful options
|
|
11846
|
-
propertyKey:
|
|
11847
|
-
readAccessControlFilters:
|
|
11848
|
-
writeAccessControlFilters:
|
|
11849
|
-
nullable:
|
|
11850
|
-
description:
|
|
11851
|
-
default:
|
|
11852
|
-
externalDocs:
|
|
11853
|
-
description:
|
|
11854
|
-
url:
|
|
11866
|
+
propertyKey: Q_.string().default(""),
|
|
11867
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11868
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11869
|
+
nullable: Q_.boolean().default(false),
|
|
11870
|
+
description: Q_.string().optional(),
|
|
11871
|
+
default: Q_.any().optional(),
|
|
11872
|
+
externalDocs: Q_.object({
|
|
11873
|
+
description: Q_.string().optional(),
|
|
11874
|
+
url: Q_.string().uri().required()
|
|
11855
11875
|
}).optional(),
|
|
11856
|
-
example:
|
|
11857
|
-
deprecated:
|
|
11876
|
+
example: Q_.string().optional(),
|
|
11877
|
+
deprecated: Q_.boolean().default(false),
|
|
11858
11878
|
type: resourcefulDataTypeSchema.required()
|
|
11859
11879
|
});
|
|
11860
|
-
const dataTypeColumnOptionsSchema =
|
|
11880
|
+
const dataTypeColumnOptionsSchema = Q_.object({
|
|
11861
11881
|
// Lucid ColumnOptions (partial) - excluding 'prepare' and 'consume'
|
|
11862
|
-
columnName:
|
|
11863
|
-
serializeAs:
|
|
11864
|
-
serialize:
|
|
11865
|
-
meta:
|
|
11866
|
-
isPrimary:
|
|
11867
|
-
hasDefaultValue:
|
|
11882
|
+
columnName: Q_.string().optional(),
|
|
11883
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
11884
|
+
serialize: Q_.function().optional(),
|
|
11885
|
+
meta: Q_.object().optional(),
|
|
11886
|
+
isPrimary: Q_.boolean().default(false),
|
|
11887
|
+
hasDefaultValue: Q_.boolean().default(false),
|
|
11868
11888
|
// Resourceful options
|
|
11869
|
-
propertyKey:
|
|
11870
|
-
readAccessControlFilters:
|
|
11871
|
-
writeAccessControlFilters:
|
|
11872
|
-
nullable:
|
|
11873
|
-
description:
|
|
11874
|
-
default:
|
|
11875
|
-
externalDocs:
|
|
11876
|
-
description:
|
|
11877
|
-
url:
|
|
11889
|
+
propertyKey: Q_.string().default(""),
|
|
11890
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11891
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11892
|
+
nullable: Q_.boolean().default(false),
|
|
11893
|
+
description: Q_.string().optional(),
|
|
11894
|
+
default: Q_.any().optional(),
|
|
11895
|
+
externalDocs: Q_.object({
|
|
11896
|
+
description: Q_.string().optional(),
|
|
11897
|
+
url: Q_.string().uri().required()
|
|
11878
11898
|
}).optional(),
|
|
11879
|
-
example:
|
|
11880
|
-
deprecated:
|
|
11899
|
+
example: Q_.string().optional(),
|
|
11900
|
+
deprecated: Q_.boolean().default(false),
|
|
11881
11901
|
type: resourcefulDataTypeSchema.optional()
|
|
11882
11902
|
});
|
|
11883
11903
|
const baseDateColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11884
|
-
autoCreate:
|
|
11885
|
-
autoUpdate:
|
|
11904
|
+
autoCreate: Q_.boolean().default(false),
|
|
11905
|
+
autoUpdate: Q_.boolean().default(false)
|
|
11886
11906
|
});
|
|
11887
11907
|
const stringColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11888
|
-
type:
|
|
11908
|
+
type: Q_.alternatives(
|
|
11889
11909
|
...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType")
|
|
11890
11910
|
).default(() => new ResourcefulStringType())
|
|
11891
11911
|
});
|
|
11892
11912
|
const dateColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
|
|
11893
|
-
type:
|
|
11913
|
+
type: Q_.alternatives(
|
|
11894
11914
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType")
|
|
11895
11915
|
).default(() => new ResourcefulDateType())
|
|
11896
11916
|
});
|
|
11897
11917
|
const dateTimeColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
|
|
11898
|
-
type:
|
|
11918
|
+
type: Q_.alternatives(
|
|
11899
11919
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType")
|
|
11900
11920
|
).default(() => new ResourcefulDateTimeType())
|
|
11901
11921
|
});
|
|
11902
11922
|
const binaryColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11903
|
-
type:
|
|
11923
|
+
type: Q_.alternatives(
|
|
11904
11924
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBinaryType, "ResourcefulBinaryType")
|
|
11905
11925
|
).default(() => new ResourcefulBinaryType())
|
|
11906
11926
|
});
|
|
11907
11927
|
const numberColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11908
|
-
type:
|
|
11928
|
+
type: Q_.alternatives(
|
|
11909
11929
|
...joiInstanceCheckerAlternativesFactory(ResourcefulNumberType, "ResourcefulNumberType")
|
|
11910
11930
|
).default(() => new ResourcefulNumberType())
|
|
11911
11931
|
});
|
|
11912
11932
|
const integerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11913
|
-
type:
|
|
11933
|
+
type: Q_.alternatives(
|
|
11914
11934
|
...joiInstanceCheckerAlternativesFactory(ResourcefulIntegerType, "ResourcefulIntegerType")
|
|
11915
11935
|
).default(() => new ResourcefulIntegerType())
|
|
11916
11936
|
});
|
|
11917
11937
|
const bigintColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11918
|
-
type:
|
|
11938
|
+
type: Q_.alternatives(
|
|
11919
11939
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBigintType, "ResourcefulBigintType")
|
|
11920
11940
|
).default(() => new ResourcefulBigintType())
|
|
11921
11941
|
});
|
|
11922
11942
|
const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11923
|
-
type:
|
|
11943
|
+
type: Q_.alternatives(
|
|
11924
11944
|
...joiInstanceCheckerAlternativesFactory(
|
|
11925
11945
|
ResourcefulUnsignedIntegerType,
|
|
11926
11946
|
"ResourcefulUnsignedIntegerType"
|
|
@@ -11928,148 +11948,148 @@ const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
|
11928
11948
|
).default(() => new ResourcefulUnsignedIntegerType())
|
|
11929
11949
|
});
|
|
11930
11950
|
const booleanColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11931
|
-
type:
|
|
11951
|
+
type: Q_.alternatives(
|
|
11932
11952
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBooleanType, "ResourcefulBooleanType")
|
|
11933
11953
|
).default(() => new ResourcefulBooleanType())
|
|
11934
11954
|
});
|
|
11935
|
-
const objectColumnOptionsSchema =
|
|
11955
|
+
const objectColumnOptionsSchema = Q_.object({
|
|
11936
11956
|
// Lucid ColumnOptions (full)
|
|
11937
|
-
columnName:
|
|
11938
|
-
serializeAs:
|
|
11939
|
-
serialize:
|
|
11940
|
-
consume:
|
|
11941
|
-
prepare:
|
|
11942
|
-
meta:
|
|
11943
|
-
isPrimary:
|
|
11944
|
-
hasDefaultValue:
|
|
11957
|
+
columnName: Q_.string().optional(),
|
|
11958
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
11959
|
+
serialize: Q_.function().optional(),
|
|
11960
|
+
consume: Q_.function().optional(),
|
|
11961
|
+
prepare: Q_.function().optional(),
|
|
11962
|
+
meta: Q_.object().optional(),
|
|
11963
|
+
isPrimary: Q_.boolean().default(false),
|
|
11964
|
+
hasDefaultValue: Q_.boolean().default(false),
|
|
11945
11965
|
// Resourceful options
|
|
11946
|
-
propertyKey:
|
|
11947
|
-
readAccessControlFilters:
|
|
11948
|
-
writeAccessControlFilters:
|
|
11949
|
-
nullable:
|
|
11950
|
-
description:
|
|
11951
|
-
default:
|
|
11952
|
-
externalDocs:
|
|
11953
|
-
description:
|
|
11954
|
-
url:
|
|
11966
|
+
propertyKey: Q_.string().default(""),
|
|
11967
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11968
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11969
|
+
nullable: Q_.boolean().default(false),
|
|
11970
|
+
description: Q_.string().optional(),
|
|
11971
|
+
default: Q_.any().optional(),
|
|
11972
|
+
externalDocs: Q_.object({
|
|
11973
|
+
description: Q_.string().optional(),
|
|
11974
|
+
url: Q_.string().uri().required()
|
|
11955
11975
|
}).optional(),
|
|
11956
|
-
example:
|
|
11957
|
-
deprecated:
|
|
11958
|
-
type:
|
|
11976
|
+
example: Q_.string().optional(),
|
|
11977
|
+
deprecated: Q_.boolean().default(false),
|
|
11978
|
+
type: Q_.alternatives(
|
|
11959
11979
|
...joiInstanceCheckerAlternativesFactory(ResourcefulObjectType, "ResourcefulObjectType")
|
|
11960
11980
|
).default(() => new ResourcefulObjectType())
|
|
11961
11981
|
});
|
|
11962
|
-
const arrayColumnOptionsSchema =
|
|
11982
|
+
const arrayColumnOptionsSchema = Q_.object({
|
|
11963
11983
|
// Lucid ColumnOptions (full)
|
|
11964
|
-
columnName:
|
|
11965
|
-
serializeAs:
|
|
11966
|
-
serialize:
|
|
11967
|
-
consume:
|
|
11968
|
-
prepare:
|
|
11969
|
-
meta:
|
|
11970
|
-
isPrimary:
|
|
11971
|
-
hasDefaultValue:
|
|
11984
|
+
columnName: Q_.string().optional(),
|
|
11985
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
11986
|
+
serialize: Q_.function().optional(),
|
|
11987
|
+
consume: Q_.function().optional(),
|
|
11988
|
+
prepare: Q_.function().optional(),
|
|
11989
|
+
meta: Q_.object().optional(),
|
|
11990
|
+
isPrimary: Q_.boolean().default(false),
|
|
11991
|
+
hasDefaultValue: Q_.boolean().default(false),
|
|
11972
11992
|
// Resourceful options
|
|
11973
|
-
propertyKey:
|
|
11974
|
-
readAccessControlFilters:
|
|
11975
|
-
writeAccessControlFilters:
|
|
11976
|
-
nullable:
|
|
11977
|
-
description:
|
|
11978
|
-
default:
|
|
11979
|
-
externalDocs:
|
|
11980
|
-
description:
|
|
11981
|
-
url:
|
|
11993
|
+
propertyKey: Q_.string().default(""),
|
|
11994
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11995
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
11996
|
+
nullable: Q_.boolean().default(false),
|
|
11997
|
+
description: Q_.string().optional(),
|
|
11998
|
+
default: Q_.any().optional(),
|
|
11999
|
+
externalDocs: Q_.object({
|
|
12000
|
+
description: Q_.string().optional(),
|
|
12001
|
+
url: Q_.string().uri().required()
|
|
11982
12002
|
}).optional(),
|
|
11983
|
-
example:
|
|
11984
|
-
deprecated:
|
|
11985
|
-
type:
|
|
12003
|
+
example: Q_.string().optional(),
|
|
12004
|
+
deprecated: Q_.boolean().default(false),
|
|
12005
|
+
type: Q_.alternatives(
|
|
11986
12006
|
...joiInstanceCheckerAlternativesFactory(ResourcefulArrayType, "ResourcefulArrayType")
|
|
11987
12007
|
).default(() => new ResourcefulArrayType())
|
|
11988
12008
|
});
|
|
11989
12009
|
localResourcefulPropertyDefinitionSchema.append({
|
|
11990
|
-
writable:
|
|
12010
|
+
writable: Q_.boolean().default(false)
|
|
11991
12011
|
});
|
|
11992
|
-
const resourcefulComputedOptionsSchema =
|
|
12012
|
+
const resourcefulComputedOptionsSchema = Q_.object({
|
|
11993
12013
|
// Lucid ComputedOptions (partial)
|
|
11994
|
-
serializeAs:
|
|
11995
|
-
serialize:
|
|
11996
|
-
meta:
|
|
12014
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12015
|
+
serialize: Q_.function().optional(),
|
|
12016
|
+
meta: Q_.object().optional(),
|
|
11997
12017
|
// Resourceful options
|
|
11998
|
-
propertyKey:
|
|
11999
|
-
readAccessControlFilters:
|
|
12000
|
-
writeAccessControlFilters:
|
|
12001
|
-
nullable:
|
|
12002
|
-
description:
|
|
12003
|
-
default:
|
|
12004
|
-
externalDocs:
|
|
12005
|
-
description:
|
|
12006
|
-
url:
|
|
12018
|
+
propertyKey: Q_.string().default(""),
|
|
12019
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12020
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12021
|
+
nullable: Q_.boolean().default(false),
|
|
12022
|
+
description: Q_.string().optional(),
|
|
12023
|
+
default: Q_.any().optional(),
|
|
12024
|
+
externalDocs: Q_.object({
|
|
12025
|
+
description: Q_.string().optional(),
|
|
12026
|
+
url: Q_.string().uri().required()
|
|
12007
12027
|
}).optional(),
|
|
12008
|
-
example:
|
|
12009
|
-
deprecated:
|
|
12028
|
+
example: Q_.string().optional(),
|
|
12029
|
+
deprecated: Q_.boolean().default(false),
|
|
12010
12030
|
type: resourcefulDataTypeSchema.required()
|
|
12011
12031
|
});
|
|
12012
|
-
const dataTypeComputedOptionsSchema =
|
|
12032
|
+
const dataTypeComputedOptionsSchema = Q_.object({
|
|
12013
12033
|
// Lucid ComputedOptions (partial) - excluding 'prepare' and 'consume'
|
|
12014
|
-
serializeAs:
|
|
12015
|
-
serialize:
|
|
12016
|
-
meta:
|
|
12034
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12035
|
+
serialize: Q_.function().optional(),
|
|
12036
|
+
meta: Q_.object().optional(),
|
|
12017
12037
|
// Resourceful options
|
|
12018
|
-
propertyKey:
|
|
12019
|
-
readAccessControlFilters:
|
|
12020
|
-
writeAccessControlFilters:
|
|
12021
|
-
nullable:
|
|
12022
|
-
description:
|
|
12023
|
-
default:
|
|
12024
|
-
externalDocs:
|
|
12025
|
-
description:
|
|
12026
|
-
url:
|
|
12038
|
+
propertyKey: Q_.string().default(""),
|
|
12039
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12040
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12041
|
+
nullable: Q_.boolean().default(false),
|
|
12042
|
+
description: Q_.string().optional(),
|
|
12043
|
+
default: Q_.any().optional(),
|
|
12044
|
+
externalDocs: Q_.object({
|
|
12045
|
+
description: Q_.string().optional(),
|
|
12046
|
+
url: Q_.string().uri().required()
|
|
12027
12047
|
}).optional(),
|
|
12028
|
-
example:
|
|
12029
|
-
deprecated:
|
|
12048
|
+
example: Q_.string().optional(),
|
|
12049
|
+
deprecated: Q_.boolean().default(false),
|
|
12030
12050
|
type: resourcefulDataTypeSchema.optional()
|
|
12031
12051
|
});
|
|
12032
12052
|
const baseDateComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12033
|
-
autoCreate:
|
|
12034
|
-
autoUpdate:
|
|
12053
|
+
autoCreate: Q_.boolean().default(false),
|
|
12054
|
+
autoUpdate: Q_.boolean().default(false)
|
|
12035
12055
|
});
|
|
12036
12056
|
const stringComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12037
|
-
type:
|
|
12057
|
+
type: Q_.alternatives(
|
|
12038
12058
|
...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType")
|
|
12039
12059
|
).default(() => new ResourcefulStringType())
|
|
12040
12060
|
});
|
|
12041
12061
|
const dateComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
|
|
12042
|
-
type:
|
|
12062
|
+
type: Q_.alternatives(
|
|
12043
12063
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType")
|
|
12044
12064
|
).default(() => new ResourcefulDateType())
|
|
12045
12065
|
});
|
|
12046
12066
|
const dateTimeComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
|
|
12047
|
-
type:
|
|
12067
|
+
type: Q_.alternatives(
|
|
12048
12068
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType")
|
|
12049
12069
|
).default(() => new ResourcefulDateTimeType())
|
|
12050
12070
|
});
|
|
12051
12071
|
const binaryComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12052
|
-
type:
|
|
12072
|
+
type: Q_.alternatives(
|
|
12053
12073
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBinaryType, "ResourcefulBinaryType")
|
|
12054
12074
|
).default(() => new ResourcefulBinaryType())
|
|
12055
12075
|
});
|
|
12056
12076
|
const numberComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12057
|
-
type:
|
|
12077
|
+
type: Q_.alternatives(
|
|
12058
12078
|
...joiInstanceCheckerAlternativesFactory(ResourcefulNumberType, "ResourcefulNumberType")
|
|
12059
12079
|
).default(() => new ResourcefulNumberType())
|
|
12060
12080
|
});
|
|
12061
12081
|
const integerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12062
|
-
type:
|
|
12082
|
+
type: Q_.alternatives(
|
|
12063
12083
|
...joiInstanceCheckerAlternativesFactory(ResourcefulIntegerType, "ResourcefulIntegerType")
|
|
12064
12084
|
).default(() => new ResourcefulIntegerType())
|
|
12065
12085
|
});
|
|
12066
12086
|
const bigintComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12067
|
-
type:
|
|
12087
|
+
type: Q_.alternatives(
|
|
12068
12088
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBigintType, "ResourcefulBigintType")
|
|
12069
12089
|
).default(() => new ResourcefulBigintType())
|
|
12070
12090
|
});
|
|
12071
12091
|
const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12072
|
-
type:
|
|
12092
|
+
type: Q_.alternatives(
|
|
12073
12093
|
...joiInstanceCheckerAlternativesFactory(
|
|
12074
12094
|
ResourcefulUnsignedIntegerType,
|
|
12075
12095
|
"ResourcefulUnsignedIntegerType"
|
|
@@ -12077,99 +12097,99 @@ const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys(
|
|
|
12077
12097
|
).default(() => new ResourcefulUnsignedIntegerType())
|
|
12078
12098
|
});
|
|
12079
12099
|
const booleanComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12080
|
-
type:
|
|
12100
|
+
type: Q_.alternatives(
|
|
12081
12101
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBooleanType, "ResourcefulBooleanType")
|
|
12082
12102
|
).default(() => new ResourcefulBooleanType())
|
|
12083
12103
|
});
|
|
12084
|
-
const objectComputedOptionsSchema =
|
|
12104
|
+
const objectComputedOptionsSchema = Q_.object({
|
|
12085
12105
|
// Lucid ComputedOptions (full)
|
|
12086
|
-
serializeAs:
|
|
12087
|
-
serialize:
|
|
12088
|
-
meta:
|
|
12106
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12107
|
+
serialize: Q_.function().optional(),
|
|
12108
|
+
meta: Q_.object().optional(),
|
|
12089
12109
|
// Resourceful options
|
|
12090
|
-
propertyKey:
|
|
12091
|
-
readAccessControlFilters:
|
|
12092
|
-
writeAccessControlFilters:
|
|
12093
|
-
nullable:
|
|
12094
|
-
description:
|
|
12095
|
-
default:
|
|
12096
|
-
externalDocs:
|
|
12097
|
-
description:
|
|
12098
|
-
url:
|
|
12110
|
+
propertyKey: Q_.string().default(""),
|
|
12111
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12112
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12113
|
+
nullable: Q_.boolean().default(false),
|
|
12114
|
+
description: Q_.string().optional(),
|
|
12115
|
+
default: Q_.any().optional(),
|
|
12116
|
+
externalDocs: Q_.object({
|
|
12117
|
+
description: Q_.string().optional(),
|
|
12118
|
+
url: Q_.string().uri().required()
|
|
12099
12119
|
}).optional(),
|
|
12100
|
-
example:
|
|
12101
|
-
deprecated:
|
|
12102
|
-
type:
|
|
12120
|
+
example: Q_.string().optional(),
|
|
12121
|
+
deprecated: Q_.boolean().default(false),
|
|
12122
|
+
type: Q_.alternatives(
|
|
12103
12123
|
...joiInstanceCheckerAlternativesFactory(ResourcefulObjectType, "ResourcefulObjectType")
|
|
12104
12124
|
).default(() => new ResourcefulObjectType())
|
|
12105
12125
|
});
|
|
12106
|
-
const arrayComputedOptionsSchema =
|
|
12126
|
+
const arrayComputedOptionsSchema = Q_.object({
|
|
12107
12127
|
// Lucid ComputedOptions (full)
|
|
12108
|
-
serializeAs:
|
|
12109
|
-
serialize:
|
|
12110
|
-
meta:
|
|
12128
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12129
|
+
serialize: Q_.function().optional(),
|
|
12130
|
+
meta: Q_.object().optional(),
|
|
12111
12131
|
// Resourceful options
|
|
12112
|
-
propertyKey:
|
|
12113
|
-
readAccessControlFilters:
|
|
12114
|
-
writeAccessControlFilters:
|
|
12115
|
-
nullable:
|
|
12116
|
-
description:
|
|
12117
|
-
default:
|
|
12118
|
-
externalDocs:
|
|
12119
|
-
description:
|
|
12120
|
-
url:
|
|
12132
|
+
propertyKey: Q_.string().default(""),
|
|
12133
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12134
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12135
|
+
nullable: Q_.boolean().default(false),
|
|
12136
|
+
description: Q_.string().optional(),
|
|
12137
|
+
default: Q_.any().optional(),
|
|
12138
|
+
externalDocs: Q_.object({
|
|
12139
|
+
description: Q_.string().optional(),
|
|
12140
|
+
url: Q_.string().uri().required()
|
|
12121
12141
|
}).optional(),
|
|
12122
|
-
example:
|
|
12123
|
-
deprecated:
|
|
12124
|
-
type:
|
|
12142
|
+
example: Q_.string().optional(),
|
|
12143
|
+
deprecated: Q_.boolean().default(false),
|
|
12144
|
+
type: Q_.alternatives(
|
|
12125
12145
|
...joiInstanceCheckerAlternativesFactory(ResourcefulArrayType, "ResourcefulArrayType")
|
|
12126
12146
|
).default(() => new ResourcefulArrayType())
|
|
12127
12147
|
});
|
|
12128
|
-
const resourcefulRelationshipOptionsSchema =
|
|
12148
|
+
const resourcefulRelationshipOptionsSchema = Q_.object({
|
|
12129
12149
|
// Resourceful options
|
|
12130
|
-
propertyKey:
|
|
12131
|
-
readAccessControlFilters:
|
|
12132
|
-
writeAccessControlFilters:
|
|
12133
|
-
nullable:
|
|
12134
|
-
description:
|
|
12135
|
-
default:
|
|
12136
|
-
externalDocs:
|
|
12137
|
-
description:
|
|
12138
|
-
url:
|
|
12150
|
+
propertyKey: Q_.string().default(""),
|
|
12151
|
+
readAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12152
|
+
writeAccessControlFilters: Q_.array().items(Q_.function()).default([]),
|
|
12153
|
+
nullable: Q_.boolean().default(false),
|
|
12154
|
+
description: Q_.string().optional(),
|
|
12155
|
+
default: Q_.any().optional(),
|
|
12156
|
+
externalDocs: Q_.object({
|
|
12157
|
+
description: Q_.string().optional(),
|
|
12158
|
+
url: Q_.string().uri().required()
|
|
12139
12159
|
}).optional(),
|
|
12140
|
-
example:
|
|
12141
|
-
deprecated:
|
|
12160
|
+
example: Q_.string().optional(),
|
|
12161
|
+
deprecated: Q_.boolean().default(false)
|
|
12142
12162
|
});
|
|
12143
12163
|
const relationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12144
12164
|
// Lucid RelationOptions
|
|
12145
|
-
localKey:
|
|
12146
|
-
foreignKey:
|
|
12147
|
-
serializeAs:
|
|
12148
|
-
onQuery:
|
|
12149
|
-
relatedModel:
|
|
12165
|
+
localKey: Q_.string().optional(),
|
|
12166
|
+
foreignKey: Q_.string().optional(),
|
|
12167
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12168
|
+
onQuery: Q_.function().optional(),
|
|
12169
|
+
relatedModel: Q_.function()
|
|
12150
12170
|
});
|
|
12151
12171
|
const manyToManyRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12152
12172
|
// Lucid ManyToManyRelationOptions
|
|
12153
|
-
localKey:
|
|
12154
|
-
relatedKey:
|
|
12155
|
-
pivotForeignKey:
|
|
12156
|
-
pivotRelatedForeignKey:
|
|
12157
|
-
pivotTable:
|
|
12158
|
-
pivotTimestamps:
|
|
12159
|
-
pivotColumns:
|
|
12160
|
-
serializeAs:
|
|
12161
|
-
onQuery:
|
|
12162
|
-
relatedModel:
|
|
12173
|
+
localKey: Q_.string().optional(),
|
|
12174
|
+
relatedKey: Q_.string().optional(),
|
|
12175
|
+
pivotForeignKey: Q_.string().optional(),
|
|
12176
|
+
pivotRelatedForeignKey: Q_.string().optional(),
|
|
12177
|
+
pivotTable: Q_.string().optional(),
|
|
12178
|
+
pivotTimestamps: Q_.boolean().optional(),
|
|
12179
|
+
pivotColumns: Q_.array().items(Q_.string()).optional(),
|
|
12180
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12181
|
+
onQuery: Q_.function().optional(),
|
|
12182
|
+
relatedModel: Q_.function()
|
|
12163
12183
|
});
|
|
12164
12184
|
const hasManyThroughRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12165
12185
|
// Lucid HasManyThroughRelationOptions (ThroughRelationOptions without throughModel)
|
|
12166
|
-
localKey:
|
|
12167
|
-
foreignKey:
|
|
12168
|
-
throughLocalKey:
|
|
12169
|
-
throughForeignKey:
|
|
12170
|
-
serializeAs:
|
|
12171
|
-
onQuery:
|
|
12172
|
-
relatedModel:
|
|
12186
|
+
localKey: Q_.string().optional(),
|
|
12187
|
+
foreignKey: Q_.string().optional(),
|
|
12188
|
+
throughLocalKey: Q_.string().optional(),
|
|
12189
|
+
throughForeignKey: Q_.string().optional(),
|
|
12190
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12191
|
+
onQuery: Q_.function().optional(),
|
|
12192
|
+
relatedModel: Q_.function()
|
|
12173
12193
|
});
|
|
12174
12194
|
const extractLucidOptionsForLucidDecorator = (options, keys, overrides) => {
|
|
12175
12195
|
const extracted = {};
|
|
@@ -12261,16 +12281,37 @@ const handleResourcefulColumn = (config) => {
|
|
|
12261
12281
|
propertyKey,
|
|
12262
12282
|
decoratorOption,
|
|
12263
12283
|
decoratorOptionsValidationSchema,
|
|
12264
|
-
overrides,
|
|
12265
|
-
lucidDecoratorFunction
|
|
12284
|
+
overrides = {},
|
|
12285
|
+
lucidDecoratorFunction,
|
|
12286
|
+
defaultPrepare,
|
|
12287
|
+
defaultConsume
|
|
12266
12288
|
} = config;
|
|
12267
12289
|
const opts = validateNormalizeAndCastDecoratorOptions(propertyKey, decoratorName, decoratorOptionsValidationSchema, {
|
|
12268
12290
|
...decoratorOption,
|
|
12269
12291
|
propertyKey
|
|
12270
12292
|
});
|
|
12293
|
+
const customPrepare = opts.prepare;
|
|
12294
|
+
const customConsume = opts.consume;
|
|
12295
|
+
const nullable = opts.nullable || false;
|
|
12296
|
+
const chainedPrepare = PrepareConsumeChainBuilder.chainPrepare(
|
|
12297
|
+
propertyKey,
|
|
12298
|
+
nullable,
|
|
12299
|
+
defaultPrepare,
|
|
12300
|
+
customPrepare
|
|
12301
|
+
);
|
|
12302
|
+
const chainedConsume = PrepareConsumeChainBuilder.chainConsume(
|
|
12303
|
+
propertyKey,
|
|
12304
|
+
nullable,
|
|
12305
|
+
defaultConsume,
|
|
12306
|
+
customConsume
|
|
12307
|
+
);
|
|
12271
12308
|
const lucidOptions = extractLucidOptionsForLucidColumnDecorator(
|
|
12272
12309
|
opts,
|
|
12273
|
-
|
|
12310
|
+
{
|
|
12311
|
+
...overrides,
|
|
12312
|
+
...chainedPrepare && { prepare: chainedPrepare },
|
|
12313
|
+
...chainedConsume && { consume: chainedConsume }
|
|
12314
|
+
}
|
|
12274
12315
|
);
|
|
12275
12316
|
lucidDecoratorFunction(lucidOptions)(target, propertyKey);
|
|
12276
12317
|
const map = ensureOwnResourcefulMap(target, "$resourcefulColumns");
|
|
@@ -12318,10 +12359,8 @@ resourcefulColumn.string = function(options = {}) {
|
|
|
12318
12359
|
decoratorOption: options,
|
|
12319
12360
|
decoratorOptionsValidationSchema,
|
|
12320
12361
|
lucidDecoratorFunction: column,
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
consume: (value) => consumeString(propertyKey, value, options.nullable)
|
|
12324
|
-
}
|
|
12362
|
+
defaultPrepare: prepareString,
|
|
12363
|
+
defaultConsume: consumeString
|
|
12325
12364
|
});
|
|
12326
12365
|
};
|
|
12327
12366
|
};
|
|
@@ -12364,10 +12403,8 @@ resourcefulColumn.binary = function(options = {}) {
|
|
|
12364
12403
|
decoratorOption: options,
|
|
12365
12404
|
decoratorOptionsValidationSchema,
|
|
12366
12405
|
lucidDecoratorFunction: column,
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
consume: (value) => consumeBinary(propertyKey, value, options.nullable)
|
|
12370
|
-
}
|
|
12406
|
+
defaultPrepare: prepareBinary,
|
|
12407
|
+
defaultConsume: consumeBinary
|
|
12371
12408
|
});
|
|
12372
12409
|
};
|
|
12373
12410
|
};
|
|
@@ -12382,10 +12419,8 @@ resourcefulColumn.number = function(options = {}) {
|
|
|
12382
12419
|
decoratorOption: options,
|
|
12383
12420
|
decoratorOptionsValidationSchema,
|
|
12384
12421
|
lucidDecoratorFunction: column,
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
consume: (value) => consumeNumber(propertyKey, value, options.nullable)
|
|
12388
|
-
}
|
|
12422
|
+
defaultPrepare: prepareNumber,
|
|
12423
|
+
defaultConsume: consumeNumber
|
|
12389
12424
|
});
|
|
12390
12425
|
};
|
|
12391
12426
|
};
|
|
@@ -12400,10 +12435,8 @@ resourcefulColumn.integer = function(options = {}) {
|
|
|
12400
12435
|
decoratorOption: options,
|
|
12401
12436
|
decoratorOptionsValidationSchema,
|
|
12402
12437
|
lucidDecoratorFunction: column,
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
consume: (value) => consumeInteger(propertyKey, value, options.nullable)
|
|
12406
|
-
}
|
|
12438
|
+
defaultPrepare: prepareInteger,
|
|
12439
|
+
defaultConsume: consumeInteger
|
|
12407
12440
|
});
|
|
12408
12441
|
};
|
|
12409
12442
|
};
|
|
@@ -12418,10 +12451,8 @@ resourcefulColumn.bigint = function(options = {}) {
|
|
|
12418
12451
|
decoratorOption: options,
|
|
12419
12452
|
decoratorOptionsValidationSchema,
|
|
12420
12453
|
lucidDecoratorFunction: column,
|
|
12421
|
-
|
|
12422
|
-
|
|
12423
|
-
consume: (value) => consumeBigint(propertyKey, value, options.nullable)
|
|
12424
|
-
}
|
|
12454
|
+
defaultPrepare: prepareBigint,
|
|
12455
|
+
defaultConsume: consumeBigint
|
|
12425
12456
|
});
|
|
12426
12457
|
};
|
|
12427
12458
|
};
|
|
@@ -12436,10 +12467,8 @@ resourcefulColumn.unsignedint = function(options = {}) {
|
|
|
12436
12467
|
decoratorOption: options,
|
|
12437
12468
|
decoratorOptionsValidationSchema,
|
|
12438
12469
|
lucidDecoratorFunction: column,
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
consume: (value) => consumeUnsignedint(propertyKey, value, options.nullable)
|
|
12442
|
-
}
|
|
12470
|
+
defaultPrepare: prepareUnsignedint,
|
|
12471
|
+
defaultConsume: consumeUnsignedint
|
|
12443
12472
|
});
|
|
12444
12473
|
};
|
|
12445
12474
|
};
|
|
@@ -12454,10 +12483,8 @@ resourcefulColumn.boolean = function(options = {}) {
|
|
|
12454
12483
|
decoratorOption: options,
|
|
12455
12484
|
decoratorOptionsValidationSchema,
|
|
12456
12485
|
lucidDecoratorFunction: column,
|
|
12457
|
-
|
|
12458
|
-
|
|
12459
|
-
consume: (value) => consumeBoolean(propertyKey, value, options.nullable)
|
|
12460
|
-
}
|
|
12486
|
+
defaultPrepare: prepareBoolean,
|
|
12487
|
+
defaultConsume: consumeBoolean
|
|
12461
12488
|
});
|
|
12462
12489
|
};
|
|
12463
12490
|
};
|
|
@@ -12472,10 +12499,8 @@ resourcefulColumn.object = function(options = {}) {
|
|
|
12472
12499
|
decoratorOption: options,
|
|
12473
12500
|
decoratorOptionsValidationSchema,
|
|
12474
12501
|
lucidDecoratorFunction: column,
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
consume: (value) => consumeObject(propertyKey, value, options.nullable)
|
|
12478
|
-
}
|
|
12502
|
+
defaultPrepare: prepareObject,
|
|
12503
|
+
defaultConsume: consumeObject
|
|
12479
12504
|
});
|
|
12480
12505
|
};
|
|
12481
12506
|
};
|
|
@@ -12490,10 +12515,8 @@ resourcefulColumn.array = function(options = {}) {
|
|
|
12490
12515
|
decoratorOption: options,
|
|
12491
12516
|
decoratorOptionsValidationSchema,
|
|
12492
12517
|
lucidDecoratorFunction: column,
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
consume: (value) => consumeArray(propertyKey, value, options.nullable)
|
|
12496
|
-
}
|
|
12518
|
+
defaultPrepare: prepareArray,
|
|
12519
|
+
defaultConsume: consumeArray
|
|
12497
12520
|
});
|
|
12498
12521
|
};
|
|
12499
12522
|
};
|
|
@@ -12721,7 +12744,7 @@ function resourcefulHasManyThrough(model, options = {}) {
|
|
|
12721
12744
|
map.set(propertyKey, opts);
|
|
12722
12745
|
};
|
|
12723
12746
|
}
|
|
12724
|
-
const version = "1.
|
|
12747
|
+
const version = "1.20250724.0";
|
|
12725
12748
|
export {
|
|
12726
12749
|
k as definitions,
|
|
12727
12750
|
w as errors,
|