@nhtio/lucid-resourceful 0.1.0-master-c2c013d9 → 0.1.0-master-71781cfd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{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 +492 -490
- package/index.cjs.map +1 -1
- package/index.mjs +467 -465
- 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.cjs
CHANGED
|
@@ -12,11 +12,11 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
12
12
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
13
13
|
var _a, _hookHandlers, _cleanupHandlers, _state, _handlersToIgnore, _skipAllHooks, _Runner_instances, filter_fn, exec_fn, _b, _hooks, _c, _d;
|
|
14
14
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
15
|
-
const decorator_utils = require("./decorator_utils-
|
|
16
|
-
const
|
|
15
|
+
const decorator_utils = require("./decorator_utils-U_rZo8tv.cjs");
|
|
16
|
+
const joi = require("./joi.cjs");
|
|
17
17
|
const liqe = require("liqe");
|
|
18
18
|
const errors = require("./errors-D8jb9VxY.cjs");
|
|
19
|
-
const definitions = require("./definitions-
|
|
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
|
|
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 [
|
|
93
|
-
if (skippedIndexesMap.get(
|
|
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,
|
|
109
|
+
const value = await mapper(element, index);
|
|
110
110
|
if (value === pMapSkip) {
|
|
111
|
-
skippedIndexesMap.set(
|
|
111
|
+
skippedIndexesMap.set(index, value);
|
|
112
112
|
}
|
|
113
|
-
result[
|
|
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
|
|
132
|
+
for (let index = 0; index < concurrency; index++) {
|
|
133
133
|
try {
|
|
134
134
|
await next();
|
|
135
135
|
} catch (error) {
|
|
@@ -589,77 +589,40 @@ class l {
|
|
|
589
589
|
) : this.e[s] = []), this;
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
var CRUDOperationsEnum = /* @__PURE__ */ ((CRUDOperationsEnum2) => {
|
|
593
|
-
CRUDOperationsEnum2["CREATE"] = "create";
|
|
594
|
-
CRUDOperationsEnum2["READ"] = "read";
|
|
595
|
-
CRUDOperationsEnum2["LIST"] = "list";
|
|
596
|
-
CRUDOperationsEnum2["UPDATE"] = "update";
|
|
597
|
-
CRUDOperationsEnum2["DELETE"] = "delete";
|
|
598
|
-
return CRUDOperationsEnum2;
|
|
599
|
-
})(CRUDOperationsEnum || {});
|
|
600
|
-
var ACLOperationsEnum = /* @__PURE__ */ ((ACLOperationsEnum2) => {
|
|
601
|
-
ACLOperationsEnum2["WRITE"] = "write";
|
|
602
|
-
ACLOperationsEnum2["READ"] = "read";
|
|
603
|
-
return ACLOperationsEnum2;
|
|
604
|
-
})(ACLOperationsEnum || {});
|
|
605
|
-
const operationCRUDToACL = (operation) => {
|
|
606
|
-
if (operation === CRUDOperationsEnum.READ || operation === CRUDOperationsEnum.LIST) {
|
|
607
|
-
return ACLOperationsEnum.READ;
|
|
608
|
-
}
|
|
609
|
-
if (operation === CRUDOperationsEnum.CREATE || operation === CRUDOperationsEnum.UPDATE || operation === CRUDOperationsEnum.DELETE) {
|
|
610
|
-
return ACLOperationsEnum.WRITE;
|
|
611
|
-
}
|
|
612
|
-
};
|
|
613
|
-
const isString$1 = (value) => {
|
|
614
|
-
return typeof value === "string";
|
|
615
|
-
};
|
|
616
|
-
const isFunction = (value) => {
|
|
617
|
-
return typeof value === "function";
|
|
618
|
-
};
|
|
619
|
-
const prepareFields = (fields, primaryKey) => {
|
|
620
|
-
const defaultValue = [primaryKey];
|
|
621
|
-
if (Array.isArray(fields)) {
|
|
622
|
-
return fields.length ? fields : defaultValue;
|
|
623
|
-
}
|
|
624
|
-
if (isString$1(fields)) {
|
|
625
|
-
return fields.length ? [fields] : defaultValue;
|
|
626
|
-
}
|
|
627
|
-
return defaultValue;
|
|
628
|
-
};
|
|
629
592
|
const ResourcefulErrorHandlerMethod = ["bubble", "pass", "fail"];
|
|
630
593
|
const getFieldKey = (key, definition) => {
|
|
631
|
-
if (isString
|
|
594
|
+
if (decorator_utils.isString(definition.serializeAs)) {
|
|
632
595
|
return definition.serializeAs;
|
|
633
596
|
}
|
|
634
597
|
return key;
|
|
635
598
|
};
|
|
636
599
|
function withResourceful(options = {}) {
|
|
637
600
|
return (superclass) => {
|
|
638
|
-
const optionsSchema =
|
|
639
|
-
name:
|
|
640
|
-
readRequiredForWrite:
|
|
641
|
-
accessControlFilters:
|
|
642
|
-
list:
|
|
643
|
-
create:
|
|
644
|
-
read:
|
|
645
|
-
update:
|
|
646
|
-
delete:
|
|
601
|
+
const optionsSchema = joi.joi.object({
|
|
602
|
+
name: joi.joi.string().default(superclass.name),
|
|
603
|
+
readRequiredForWrite: joi.joi.boolean().default(false),
|
|
604
|
+
accessControlFilters: joi.joi.object({
|
|
605
|
+
list: joi.joi.array().items(joi.joi.function()).default([]),
|
|
606
|
+
create: joi.joi.array().items(joi.joi.function()).default([]),
|
|
607
|
+
read: joi.joi.array().items(joi.joi.function()).default([]),
|
|
608
|
+
update: joi.joi.array().items(joi.joi.function()).default([]),
|
|
609
|
+
delete: joi.joi.array().items(joi.joi.function()).default([])
|
|
647
610
|
}).default({}),
|
|
648
|
-
onACLError:
|
|
649
|
-
onValidationScopeError:
|
|
650
|
-
queryScopeCallbacks:
|
|
651
|
-
list:
|
|
652
|
-
access:
|
|
611
|
+
onACLError: joi.joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
|
|
612
|
+
onValidationScopeError: joi.joi.string().valid(...ResourcefulErrorHandlerMethod).default("throw"),
|
|
613
|
+
queryScopeCallbacks: joi.joi.object({
|
|
614
|
+
list: joi.joi.array().items(joi.joi.function()).default([]),
|
|
615
|
+
access: joi.joi.array().items(joi.joi.function()).default([])
|
|
653
616
|
}).default({}),
|
|
654
|
-
description:
|
|
655
|
-
externalDocs:
|
|
656
|
-
description:
|
|
657
|
-
url:
|
|
617
|
+
description: joi.joi.string().optional(),
|
|
618
|
+
externalDocs: joi.joi.object({
|
|
619
|
+
description: joi.joi.string().optional(),
|
|
620
|
+
url: joi.joi.string().uri().required()
|
|
658
621
|
}).optional(),
|
|
659
|
-
example:
|
|
660
|
-
advanced:
|
|
661
|
-
propertyEvaluationConcurrency:
|
|
662
|
-
aclEvaluationConcurrency:
|
|
622
|
+
example: joi.joi.string().optional(),
|
|
623
|
+
advanced: joi.joi.object({
|
|
624
|
+
propertyEvaluationConcurrency: joi.joi.number().integer().min(1).default(10),
|
|
625
|
+
aclEvaluationConcurrency: joi.joi.number().integer().min(1).default(2)
|
|
663
626
|
}).default({
|
|
664
627
|
propertyEvaluationConcurrency: 10,
|
|
665
628
|
aclEvaluationConcurrency: 2
|
|
@@ -800,7 +763,7 @@ function withResourceful(options = {}) {
|
|
|
800
763
|
"relationship"
|
|
801
764
|
),
|
|
802
765
|
kind: "relationship",
|
|
803
|
-
validator:
|
|
766
|
+
validator: joi.joi.forbidden(),
|
|
804
767
|
relatedModel: relationshipDefinition.relatedModel
|
|
805
768
|
};
|
|
806
769
|
if (!resourcefulModelRelationshipMetaSchema.canRead && !resourcefulModelRelationshipMetaSchema.canWrite)
|
|
@@ -815,7 +778,7 @@ function withResourceful(options = {}) {
|
|
|
815
778
|
}
|
|
816
779
|
static $getPropertyValidator(ctx, app, key, datatype, nullable, validationScopes, kind, writable = false) {
|
|
817
780
|
if ("relationship" === kind || "computedAccessor" === kind && !writable) {
|
|
818
|
-
return
|
|
781
|
+
return joi.joi.any().forbidden();
|
|
819
782
|
}
|
|
820
783
|
const baseValidator = this.$getPropertyBaseValidator(datatype, nullable, kind, writable);
|
|
821
784
|
if (Array.isArray(validationScopes) && validationScopes.length > 0) {
|
|
@@ -837,7 +800,7 @@ function withResourceful(options = {}) {
|
|
|
837
800
|
case "pass":
|
|
838
801
|
break;
|
|
839
802
|
case "fail":
|
|
840
|
-
return
|
|
803
|
+
return joi.joi.any().forbidden();
|
|
841
804
|
}
|
|
842
805
|
}
|
|
843
806
|
});
|
|
@@ -846,13 +809,13 @@ function withResourceful(options = {}) {
|
|
|
846
809
|
}
|
|
847
810
|
static $getPropertyBaseValidator(datatype, nullable, kind, writable = false) {
|
|
848
811
|
if ("relationship" === kind || "computedAccessor" === kind && !writable) {
|
|
849
|
-
return
|
|
812
|
+
return joi.joi.any().forbidden();
|
|
850
813
|
}
|
|
851
814
|
nullable = nullable || "boolean" === typeof datatype.nullable && datatype.nullable;
|
|
852
815
|
switch (true) {
|
|
853
816
|
case datatype instanceof definitions.ResourcefulStringType: {
|
|
854
817
|
const d = datatype;
|
|
855
|
-
const r =
|
|
818
|
+
const r = joi.joi.string().min(d.minLength).max(d.maxLength);
|
|
856
819
|
if (d.pattern) {
|
|
857
820
|
r.pattern(new RegExp(d.pattern));
|
|
858
821
|
}
|
|
@@ -865,14 +828,14 @@ function withResourceful(options = {}) {
|
|
|
865
828
|
return r;
|
|
866
829
|
}
|
|
867
830
|
case datatype instanceof definitions.ResourcefulDateType: {
|
|
868
|
-
const r =
|
|
831
|
+
const r = joi.joi.date().iso();
|
|
869
832
|
if (nullable) {
|
|
870
833
|
r.allow(null);
|
|
871
834
|
}
|
|
872
835
|
return r;
|
|
873
836
|
}
|
|
874
837
|
case datatype instanceof definitions.ResourcefulDateTimeType: {
|
|
875
|
-
const r =
|
|
838
|
+
const r = joi.joi.date().iso();
|
|
876
839
|
if (nullable) {
|
|
877
840
|
r.allow(null);
|
|
878
841
|
}
|
|
@@ -880,7 +843,7 @@ function withResourceful(options = {}) {
|
|
|
880
843
|
}
|
|
881
844
|
case datatype instanceof definitions.ResourcefulBinaryType: {
|
|
882
845
|
const d = datatype;
|
|
883
|
-
const r =
|
|
846
|
+
const r = joi.joi.string();
|
|
884
847
|
if (nullable) {
|
|
885
848
|
r.allow(null);
|
|
886
849
|
}
|
|
@@ -894,7 +857,7 @@ function withResourceful(options = {}) {
|
|
|
894
857
|
}
|
|
895
858
|
case datatype instanceof definitions.ResourcefulNumberType: {
|
|
896
859
|
const d = datatype;
|
|
897
|
-
const r =
|
|
860
|
+
const r = joi.joi.number();
|
|
898
861
|
if (nullable) {
|
|
899
862
|
r.allow(null);
|
|
900
863
|
}
|
|
@@ -913,7 +876,7 @@ function withResourceful(options = {}) {
|
|
|
913
876
|
}
|
|
914
877
|
case datatype instanceof definitions.ResourcefulIntegerType: {
|
|
915
878
|
const d = datatype;
|
|
916
|
-
const r =
|
|
879
|
+
const r = joi.joi.number();
|
|
917
880
|
if (nullable) {
|
|
918
881
|
r.allow(null);
|
|
919
882
|
}
|
|
@@ -932,7 +895,7 @@ function withResourceful(options = {}) {
|
|
|
932
895
|
}
|
|
933
896
|
case datatype instanceof definitions.ResourcefulBigintType: {
|
|
934
897
|
const d = datatype;
|
|
935
|
-
const r =
|
|
898
|
+
const r = joi.joi.bigint();
|
|
936
899
|
if (nullable) {
|
|
937
900
|
r.allow(null);
|
|
938
901
|
}
|
|
@@ -951,7 +914,7 @@ function withResourceful(options = {}) {
|
|
|
951
914
|
}
|
|
952
915
|
case datatype instanceof definitions.ResourcefulUnsignedIntegerType: {
|
|
953
916
|
const d = datatype;
|
|
954
|
-
const r =
|
|
917
|
+
const r = joi.joi.number().unsafe();
|
|
955
918
|
if (nullable) {
|
|
956
919
|
r.allow(null);
|
|
957
920
|
}
|
|
@@ -969,7 +932,7 @@ function withResourceful(options = {}) {
|
|
|
969
932
|
return r;
|
|
970
933
|
}
|
|
971
934
|
case datatype instanceof definitions.ResourcefulBooleanType: {
|
|
972
|
-
const r =
|
|
935
|
+
const r = joi.joi.boolean();
|
|
973
936
|
if (nullable) {
|
|
974
937
|
r.allow(null);
|
|
975
938
|
}
|
|
@@ -989,7 +952,7 @@ function withResourceful(options = {}) {
|
|
|
989
952
|
!(item.readOnly || false)
|
|
990
953
|
)
|
|
991
954
|
);
|
|
992
|
-
propValidator =
|
|
955
|
+
propValidator = joi.joi.alternatives().try(...alternatives);
|
|
993
956
|
} else if ("allOf" in propDef) {
|
|
994
957
|
const schemas = propDef.allOf.map(
|
|
995
958
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -999,7 +962,7 @@ function withResourceful(options = {}) {
|
|
|
999
962
|
!(item.readOnly || false)
|
|
1000
963
|
)
|
|
1001
964
|
);
|
|
1002
|
-
propValidator = schemas.reduce((acc, schema) => acc.concat(schema),
|
|
965
|
+
propValidator = schemas.reduce((acc, schema) => acc.concat(schema), joi.joi.any());
|
|
1003
966
|
} else if ("anyOf" in propDef) {
|
|
1004
967
|
const alternatives = propDef.anyOf.map(
|
|
1005
968
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -1009,7 +972,7 @@ function withResourceful(options = {}) {
|
|
|
1009
972
|
!(item.readOnly || false)
|
|
1010
973
|
)
|
|
1011
974
|
);
|
|
1012
|
-
propValidator =
|
|
975
|
+
propValidator = joi.joi.alternatives().try(...alternatives);
|
|
1013
976
|
} else if ("not" in propDef) {
|
|
1014
977
|
const notSchemas = propDef.not.map(
|
|
1015
978
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -1019,7 +982,7 @@ function withResourceful(options = {}) {
|
|
|
1019
982
|
!(item.readOnly || false)
|
|
1020
983
|
)
|
|
1021
984
|
);
|
|
1022
|
-
propValidator =
|
|
985
|
+
propValidator = joi.joi.any().not(...notSchemas);
|
|
1023
986
|
} else {
|
|
1024
987
|
propValidator = this.$getPropertyBaseValidator(
|
|
1025
988
|
propDef,
|
|
@@ -1033,7 +996,7 @@ function withResourceful(options = {}) {
|
|
|
1033
996
|
}
|
|
1034
997
|
objectSchema[propKey] = propValidator;
|
|
1035
998
|
});
|
|
1036
|
-
const r =
|
|
999
|
+
const r = joi.joi.object(objectSchema);
|
|
1037
1000
|
if (nullable) {
|
|
1038
1001
|
r.allow(null);
|
|
1039
1002
|
}
|
|
@@ -1046,7 +1009,7 @@ function withResourceful(options = {}) {
|
|
|
1046
1009
|
if (decorator_utils.isObject(d.additionalProperties)) {
|
|
1047
1010
|
const additionalPropertiesType = d.additionalProperties;
|
|
1048
1011
|
r.pattern(
|
|
1049
|
-
|
|
1012
|
+
joi.joi.string(),
|
|
1050
1013
|
this.$getPropertyBaseValidator(
|
|
1051
1014
|
additionalPropertiesType,
|
|
1052
1015
|
additionalPropertiesType.nullable || false,
|
|
@@ -1061,7 +1024,7 @@ function withResourceful(options = {}) {
|
|
|
1061
1024
|
}
|
|
1062
1025
|
case datatype instanceof definitions.ResourcefulArrayType: {
|
|
1063
1026
|
const d = datatype;
|
|
1064
|
-
const r =
|
|
1027
|
+
const r = joi.joi.array();
|
|
1065
1028
|
if (nullable) {
|
|
1066
1029
|
r.allow(null);
|
|
1067
1030
|
}
|
|
@@ -1075,7 +1038,7 @@ function withResourceful(options = {}) {
|
|
|
1075
1038
|
!(item.readOnly || false)
|
|
1076
1039
|
)
|
|
1077
1040
|
);
|
|
1078
|
-
itemValidator =
|
|
1041
|
+
itemValidator = joi.joi.alternatives().try(...alternatives);
|
|
1079
1042
|
} else if ("allOf" in d.items) {
|
|
1080
1043
|
const schemas = d.items.allOf.map(
|
|
1081
1044
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -1085,7 +1048,7 @@ function withResourceful(options = {}) {
|
|
|
1085
1048
|
!(item.readOnly || false)
|
|
1086
1049
|
)
|
|
1087
1050
|
);
|
|
1088
|
-
itemValidator = schemas.reduce((acc, schema) => acc.concat(schema),
|
|
1051
|
+
itemValidator = schemas.reduce((acc, schema) => acc.concat(schema), joi.joi.any());
|
|
1089
1052
|
} else if ("anyOf" in d.items) {
|
|
1090
1053
|
const alternatives = d.items.anyOf.map(
|
|
1091
1054
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -1095,7 +1058,7 @@ function withResourceful(options = {}) {
|
|
|
1095
1058
|
!(item.readOnly || false)
|
|
1096
1059
|
)
|
|
1097
1060
|
);
|
|
1098
|
-
itemValidator =
|
|
1061
|
+
itemValidator = joi.joi.alternatives().try(...alternatives);
|
|
1099
1062
|
} else if ("not" in d.items) {
|
|
1100
1063
|
const notSchemas = d.items.not.map(
|
|
1101
1064
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -1105,7 +1068,7 @@ function withResourceful(options = {}) {
|
|
|
1105
1068
|
!(item.readOnly || false)
|
|
1106
1069
|
)
|
|
1107
1070
|
);
|
|
1108
|
-
itemValidator =
|
|
1071
|
+
itemValidator = joi.joi.any().not(...notSchemas);
|
|
1109
1072
|
} else {
|
|
1110
1073
|
itemValidator = this.$getPropertyBaseValidator(
|
|
1111
1074
|
d.items,
|
|
@@ -1127,7 +1090,7 @@ function withResourceful(options = {}) {
|
|
|
1127
1090
|
return r;
|
|
1128
1091
|
}
|
|
1129
1092
|
default:
|
|
1130
|
-
return
|
|
1093
|
+
return joi.joi.any().forbidden();
|
|
1131
1094
|
}
|
|
1132
1095
|
}
|
|
1133
1096
|
static async $getPropertyCanReadWrite(ctx, app, key, lucidDefinition, readAclFilters = [], writeAclFilters = [], kind, writable = false) {
|
|
@@ -1229,7 +1192,6 @@ function withResourceful(options = {}) {
|
|
|
1229
1192
|
}
|
|
1230
1193
|
static $resourcefulModelColumnMetaToOpenApiSchema(propertyKey, propertyMeta) {
|
|
1231
1194
|
const ret = stripUndefinedValuesFromObject({
|
|
1232
|
-
type: propertyMeta.definition.type,
|
|
1233
1195
|
items: propertyMeta.definition.items,
|
|
1234
1196
|
title: getFieldKey(propertyKey, propertyMeta.lucidDefinitions) || propertyKey,
|
|
1235
1197
|
description: propertyMeta.definition.description,
|
|
@@ -1260,13 +1222,13 @@ function withResourceful(options = {}) {
|
|
|
1260
1222
|
readOnly: propertyMeta.canRead && !propertyMeta.canWrite,
|
|
1261
1223
|
writeOnly: !propertyMeta.canRead && propertyMeta.canWrite,
|
|
1262
1224
|
externalDocs: propertyMeta.definition.externalDocs,
|
|
1263
|
-
example: propertyMeta.definition.example
|
|
1225
|
+
example: propertyMeta.definition.example,
|
|
1226
|
+
...propertyMeta.definition.type
|
|
1264
1227
|
});
|
|
1265
1228
|
return ret;
|
|
1266
1229
|
}
|
|
1267
1230
|
static $resourcefulModelComputedAccessorMetaToOpenApiSchema(propertyKey, propertyMeta) {
|
|
1268
1231
|
const ret = stripUndefinedValuesFromObject({
|
|
1269
|
-
type: propertyMeta.definition.type,
|
|
1270
1232
|
items: propertyMeta.definition.items,
|
|
1271
1233
|
title: getFieldKey(propertyKey, propertyMeta.lucidDefinitions) || propertyKey,
|
|
1272
1234
|
description: propertyMeta.definition.description,
|
|
@@ -1297,7 +1259,8 @@ function withResourceful(options = {}) {
|
|
|
1297
1259
|
readOnly: propertyMeta.canRead && !propertyMeta.canWrite,
|
|
1298
1260
|
writeOnly: !propertyMeta.canRead && propertyMeta.canWrite,
|
|
1299
1261
|
externalDocs: propertyMeta.definition.externalDocs,
|
|
1300
|
-
example: propertyMeta.definition.example
|
|
1262
|
+
example: propertyMeta.definition.example,
|
|
1263
|
+
...propertyMeta.definition.type
|
|
1301
1264
|
});
|
|
1302
1265
|
return ret;
|
|
1303
1266
|
}
|
|
@@ -1332,11 +1295,11 @@ function withResourceful(options = {}) {
|
|
|
1332
1295
|
};
|
|
1333
1296
|
}
|
|
1334
1297
|
}
|
|
1335
|
-
if (operation === CRUDOperationsEnum.DELETE) {
|
|
1298
|
+
if (operation === decorator_utils.CRUDOperationsEnum.DELETE) {
|
|
1336
1299
|
return { isForbidden: false, allowedFieldsMap, allowedColumnsMap };
|
|
1337
1300
|
}
|
|
1338
1301
|
const columnsOptions = this.$resourcefulColumns.values();
|
|
1339
|
-
const aclOperation = operationCRUDToACL(operation);
|
|
1302
|
+
const aclOperation = decorator_utils.operationCRUDToACL(operation);
|
|
1340
1303
|
const addColumnOptionToAllowedFieldsMap = (propertyKey) => {
|
|
1341
1304
|
const serializedName = this.$keys.attributesToSerialized.resolve(propertyKey);
|
|
1342
1305
|
const columnName = this.$keys.serializedToColumns.resolve(serializedName);
|
|
@@ -1348,7 +1311,7 @@ function withResourceful(options = {}) {
|
|
|
1348
1311
|
}
|
|
1349
1312
|
};
|
|
1350
1313
|
for (const columnOptions of columnsOptions) {
|
|
1351
|
-
const propertyACLFilters = aclOperation === ACLOperationsEnum.READ ? columnOptions.readAccessControlFilters : columnOptions.writeAccessControlFilters;
|
|
1314
|
+
const propertyACLFilters = aclOperation === decorator_utils.ACLOperationsEnum.READ ? columnOptions.readAccessControlFilters : columnOptions.writeAccessControlFilters;
|
|
1352
1315
|
if (!propertyACLFilters) {
|
|
1353
1316
|
addColumnOptionToAllowedFieldsMap(columnOptions.propertyKey);
|
|
1354
1317
|
continue;
|
|
@@ -1451,7 +1414,7 @@ function withResourceful(options = {}) {
|
|
|
1451
1414
|
if (!opts) {
|
|
1452
1415
|
continue;
|
|
1453
1416
|
}
|
|
1454
|
-
const preparedValue = isFunction(opts.consume) ? opts.consume(value, attribute, this) : value;
|
|
1417
|
+
const preparedValue = decorator_utils.isFunction(opts.consume) ? opts.consume(value, attribute, this) : value;
|
|
1455
1418
|
result[serializable] = preparedValue;
|
|
1456
1419
|
}
|
|
1457
1420
|
return result;
|
|
@@ -1480,20 +1443,20 @@ function withResourceful(options = {}) {
|
|
|
1480
1443
|
static $resourcefulGetQueryBuilder() {
|
|
1481
1444
|
return this.$adapter.modelConstructorClient(this).query().from(this.table);
|
|
1482
1445
|
}
|
|
1483
|
-
static async $onResourcefulIndex(filter, page, perPage, fields, ctx, app, hooks = []) {
|
|
1446
|
+
static async $onResourcefulIndex(filter, page, perPage, fields, sort, ctx, app, hooks = []) {
|
|
1484
1447
|
var _a2;
|
|
1485
1448
|
const primaryKey = this.$getPrivateKeyAttribute();
|
|
1486
1449
|
if (!primaryKey) {
|
|
1487
1450
|
throw new errors.E_MISSING_PRIMARY_KEY_EXCEPTION(this.$resourcefulName);
|
|
1488
1451
|
}
|
|
1489
|
-
if (!isString
|
|
1452
|
+
if (!decorator_utils.isString(filter)) {
|
|
1490
1453
|
filter = "";
|
|
1491
1454
|
}
|
|
1492
|
-
fields = prepareFields(fields, primaryKey);
|
|
1455
|
+
fields = decorator_utils.prepareFields(fields, primaryKey);
|
|
1493
1456
|
const { isForbidden, allowedFieldsMap, message } = await this.$resourcefulCheckAccess({
|
|
1494
1457
|
ctx,
|
|
1495
1458
|
app,
|
|
1496
|
-
operation: CRUDOperationsEnum.LIST
|
|
1459
|
+
operation: decorator_utils.CRUDOperationsEnum.LIST
|
|
1497
1460
|
});
|
|
1498
1461
|
if (isForbidden) {
|
|
1499
1462
|
throw new errors.E_FORBIDDEN(message);
|
|
@@ -1502,11 +1465,11 @@ function withResourceful(options = {}) {
|
|
|
1502
1465
|
if (possibleFields.length === 0) {
|
|
1503
1466
|
throw new errors.E_INVALID_COLUMN_ACCESS("No fields available for access");
|
|
1504
1467
|
}
|
|
1505
|
-
const schema =
|
|
1506
|
-
filter:
|
|
1507
|
-
page:
|
|
1508
|
-
perPage:
|
|
1509
|
-
fields:
|
|
1468
|
+
const schema = joi.joi.object({
|
|
1469
|
+
filter: joi.joi.string().allow("").required(),
|
|
1470
|
+
page: joi.joi.number().integer().min(1).required(),
|
|
1471
|
+
perPage: joi.joi.number().integer().min(1).max(100).required(),
|
|
1472
|
+
fields: joi.joi.array().items(joi.joi.string().valid(...possibleFields)).required()
|
|
1510
1473
|
});
|
|
1511
1474
|
const { error: methodValidationError, value: validatedMethodOptions } = schema.validate(
|
|
1512
1475
|
{
|
|
@@ -1541,6 +1504,13 @@ function withResourceful(options = {}) {
|
|
|
1541
1504
|
const recordsQuery = query.clone();
|
|
1542
1505
|
countQuery.count("*", "total");
|
|
1543
1506
|
recordsQuery.select(columnsToSelect).forPage(validatedMethodOptions.page, validatedMethodOptions.perPage);
|
|
1507
|
+
if (Array.isArray(sort) && sort.length > 0) {
|
|
1508
|
+
sort.forEach(([field, direction]) => {
|
|
1509
|
+
if (allowedFieldsMap.has(field)) {
|
|
1510
|
+
recordsQuery.orderBy(field, direction);
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1544
1514
|
const countQueryQuery = countQuery.toQuery();
|
|
1545
1515
|
const recordsQueryQuery = recordsQuery.toQuery();
|
|
1546
1516
|
const [countResults, rawRecords] = await Promise.all([countQuery, recordsQuery]);
|
|
@@ -1601,7 +1571,7 @@ function withResourceful(options = {}) {
|
|
|
1601
1571
|
ctx,
|
|
1602
1572
|
app,
|
|
1603
1573
|
instance: record,
|
|
1604
|
-
operation: CRUDOperationsEnum.READ
|
|
1574
|
+
operation: decorator_utils.CRUDOperationsEnum.READ
|
|
1605
1575
|
});
|
|
1606
1576
|
if (isForbidden) {
|
|
1607
1577
|
throw new errors.E_FORBIDDEN(message);
|
|
@@ -1657,7 +1627,7 @@ function withResourceful(options = {}) {
|
|
|
1657
1627
|
const { isForbidden, allowedFieldsMap, message } = await this.$resourcefulCheckAccess({
|
|
1658
1628
|
ctx,
|
|
1659
1629
|
app,
|
|
1660
|
-
operation: CRUDOperationsEnum.CREATE
|
|
1630
|
+
operation: decorator_utils.CRUDOperationsEnum.CREATE
|
|
1661
1631
|
});
|
|
1662
1632
|
if (isForbidden) {
|
|
1663
1633
|
throw new errors.E_FORBIDDEN(message);
|
|
@@ -1734,7 +1704,7 @@ function withResourceful(options = {}) {
|
|
|
1734
1704
|
ctx,
|
|
1735
1705
|
app,
|
|
1736
1706
|
instance: record,
|
|
1737
|
-
operation: CRUDOperationsEnum.UPDATE
|
|
1707
|
+
operation: decorator_utils.CRUDOperationsEnum.UPDATE
|
|
1738
1708
|
});
|
|
1739
1709
|
if (isForbidden) {
|
|
1740
1710
|
throw new errors.E_FORBIDDEN(message);
|
|
@@ -1797,7 +1767,7 @@ function withResourceful(options = {}) {
|
|
|
1797
1767
|
ctx,
|
|
1798
1768
|
app,
|
|
1799
1769
|
instance: record,
|
|
1800
|
-
operation: CRUDOperationsEnum.DELETE
|
|
1770
|
+
operation: decorator_utils.CRUDOperationsEnum.DELETE
|
|
1801
1771
|
});
|
|
1802
1772
|
if (isForbidden) {
|
|
1803
1773
|
throw new errors.E_FORBIDDEN(message);
|
|
@@ -1859,6 +1829,56 @@ function withResourceful(options = {}) {
|
|
|
1859
1829
|
return ResourcefulModel;
|
|
1860
1830
|
};
|
|
1861
1831
|
}
|
|
1832
|
+
class PrepareConsumeChainBuilder {
|
|
1833
|
+
/**
|
|
1834
|
+
* Creates a chained prepare function that calls default first, then custom.
|
|
1835
|
+
*
|
|
1836
|
+
* @param propertyKey - The property name for error context
|
|
1837
|
+
* @param nullable - Whether the field accepts null values
|
|
1838
|
+
* @param defaultPrepare - The default prepare function from decorator
|
|
1839
|
+
* @param customPrepare - The custom prepare function from options
|
|
1840
|
+
* @returns A chained prepare function or undefined if no functions provided
|
|
1841
|
+
*/
|
|
1842
|
+
static chainPrepare(propertyKey, nullable, defaultPrepare, customPrepare) {
|
|
1843
|
+
if (!defaultPrepare && !customPrepare) {
|
|
1844
|
+
return void 0;
|
|
1845
|
+
}
|
|
1846
|
+
if (!defaultPrepare && customPrepare) {
|
|
1847
|
+
return customPrepare;
|
|
1848
|
+
}
|
|
1849
|
+
if (defaultPrepare && !customPrepare) {
|
|
1850
|
+
return (value) => defaultPrepare(propertyKey, value, nullable);
|
|
1851
|
+
}
|
|
1852
|
+
return (value) => {
|
|
1853
|
+
const defaultResult = defaultPrepare(propertyKey, value, nullable);
|
|
1854
|
+
return customPrepare(defaultResult);
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Creates a chained consume function that calls custom first, then default.
|
|
1859
|
+
*
|
|
1860
|
+
* @param propertyKey - The property name for error context
|
|
1861
|
+
* @param nullable - Whether the field accepts null values
|
|
1862
|
+
* @param defaultConsume - The default consume function from decorator
|
|
1863
|
+
* @param customConsume - The custom consume function from options
|
|
1864
|
+
* @returns A chained consume function or undefined if no functions provided
|
|
1865
|
+
*/
|
|
1866
|
+
static chainConsume(propertyKey, nullable, defaultConsume, customConsume) {
|
|
1867
|
+
if (!defaultConsume && !customConsume) {
|
|
1868
|
+
return void 0;
|
|
1869
|
+
}
|
|
1870
|
+
if (!defaultConsume && customConsume) {
|
|
1871
|
+
return customConsume;
|
|
1872
|
+
}
|
|
1873
|
+
if (defaultConsume && !customConsume) {
|
|
1874
|
+
return (value) => defaultConsume(propertyKey, value, nullable);
|
|
1875
|
+
}
|
|
1876
|
+
return (value) => {
|
|
1877
|
+
const customResult = customConsume(value);
|
|
1878
|
+
return defaultConsume(propertyKey, customResult, nullable);
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1862
1882
|
const E_INVALID_DATE_COLUMN_VALUE = errors.createError('Invalid value for "%s". %s', "E_INVALID_DATE_COLUMN_VALUE", 500);
|
|
1863
1883
|
const E_MISSING_MODEL_ATTRIBUTE = errors.createError('Relation "%s" expects "%s" to exist on "%s" model, but is missing. Did you forget to define the column?', "E_MISSING_MODEL_ATTRIBUTE", 500);
|
|
1864
1884
|
const E_MODEL_DELETED = errors.createError("Cannot mutate delete model instance", "E_MODEL_DELETED", 500);
|
|
@@ -2793,7 +2813,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
|
2793
2813
|
var ys = arrObjKeys(obj, inspect2);
|
|
2794
2814
|
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
2795
2815
|
var protoTag = obj instanceof Object ? "" : "null prototype";
|
|
2796
|
-
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
|
|
2816
|
+
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
|
|
2797
2817
|
var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
|
|
2798
2818
|
var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
|
|
2799
2819
|
if (ys.length === 0) {
|
|
@@ -2818,25 +2838,25 @@ function canTrustToString(obj) {
|
|
|
2818
2838
|
return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
|
|
2819
2839
|
}
|
|
2820
2840
|
function isArray$3(obj) {
|
|
2821
|
-
return toStr(obj) === "[object Array]" && canTrustToString(obj);
|
|
2841
|
+
return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
|
|
2822
2842
|
}
|
|
2823
2843
|
function isDate(obj) {
|
|
2824
|
-
return toStr(obj) === "[object Date]" && canTrustToString(obj);
|
|
2844
|
+
return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
|
|
2825
2845
|
}
|
|
2826
2846
|
function isRegExp$1(obj) {
|
|
2827
|
-
return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
|
|
2847
|
+
return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
|
|
2828
2848
|
}
|
|
2829
2849
|
function isError(obj) {
|
|
2830
|
-
return toStr(obj) === "[object Error]" && canTrustToString(obj);
|
|
2850
|
+
return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
|
|
2831
2851
|
}
|
|
2832
2852
|
function isString(obj) {
|
|
2833
|
-
return toStr(obj) === "[object String]" && canTrustToString(obj);
|
|
2853
|
+
return toStr$1(obj) === "[object String]" && canTrustToString(obj);
|
|
2834
2854
|
}
|
|
2835
2855
|
function isNumber(obj) {
|
|
2836
|
-
return toStr(obj) === "[object Number]" && canTrustToString(obj);
|
|
2856
|
+
return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
|
|
2837
2857
|
}
|
|
2838
2858
|
function isBoolean(obj) {
|
|
2839
|
-
return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
|
|
2859
|
+
return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
|
|
2840
2860
|
}
|
|
2841
2861
|
function isSymbol(obj) {
|
|
2842
2862
|
if (hasShammedSymbols) {
|
|
@@ -2872,7 +2892,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
|
|
|
2872
2892
|
function has$3(obj, key) {
|
|
2873
2893
|
return hasOwn$1.call(obj, key);
|
|
2874
2894
|
}
|
|
2875
|
-
function toStr(obj) {
|
|
2895
|
+
function toStr$1(obj) {
|
|
2876
2896
|
return objectToString.call(obj);
|
|
2877
2897
|
}
|
|
2878
2898
|
function nameOf(f) {
|
|
@@ -3181,7 +3201,7 @@ var syntax = SyntaxError;
|
|
|
3181
3201
|
var uri = URIError;
|
|
3182
3202
|
var abs$1 = Math.abs;
|
|
3183
3203
|
var floor$1 = Math.floor;
|
|
3184
|
-
var max$
|
|
3204
|
+
var max$2 = Math.max;
|
|
3185
3205
|
var min$1 = Math.min;
|
|
3186
3206
|
var pow$1 = Math.pow;
|
|
3187
3207
|
var round$1 = Math.round;
|
|
@@ -3310,99 +3330,78 @@ function requireObject_getPrototypeOf() {
|
|
|
3310
3330
|
Object_getPrototypeOf = $Object2.getPrototypeOf || null;
|
|
3311
3331
|
return Object_getPrototypeOf;
|
|
3312
3332
|
}
|
|
3313
|
-
var
|
|
3314
|
-
var
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
var
|
|
3319
|
-
var
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
var
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
}
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
var str = "";
|
|
3341
|
-
for (var i = 0; i < arr.length; i += 1) {
|
|
3342
|
-
str += arr[i];
|
|
3343
|
-
if (i + 1 < arr.length) {
|
|
3344
|
-
str += joiner;
|
|
3345
|
-
}
|
|
3333
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
3334
|
+
var toStr = Object.prototype.toString;
|
|
3335
|
+
var max$1 = Math.max;
|
|
3336
|
+
var funcType = "[object Function]";
|
|
3337
|
+
var concatty = function concatty2(a2, b) {
|
|
3338
|
+
var arr = [];
|
|
3339
|
+
for (var i = 0; i < a2.length; i += 1) {
|
|
3340
|
+
arr[i] = a2[i];
|
|
3341
|
+
}
|
|
3342
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
3343
|
+
arr[j + a2.length] = b[j];
|
|
3344
|
+
}
|
|
3345
|
+
return arr;
|
|
3346
|
+
};
|
|
3347
|
+
var slicy = function slicy2(arrLike, offset) {
|
|
3348
|
+
var arr = [];
|
|
3349
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
3350
|
+
arr[j] = arrLike[i];
|
|
3351
|
+
}
|
|
3352
|
+
return arr;
|
|
3353
|
+
};
|
|
3354
|
+
var joiny = function(arr, joiner) {
|
|
3355
|
+
var str = "";
|
|
3356
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
3357
|
+
str += arr[i];
|
|
3358
|
+
if (i + 1 < arr.length) {
|
|
3359
|
+
str += joiner;
|
|
3346
3360
|
}
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
);
|
|
3362
|
-
if (Object(result) === result) {
|
|
3363
|
-
return result;
|
|
3364
|
-
}
|
|
3365
|
-
return this;
|
|
3366
|
-
}
|
|
3367
|
-
return target.apply(
|
|
3368
|
-
that,
|
|
3361
|
+
}
|
|
3362
|
+
return str;
|
|
3363
|
+
};
|
|
3364
|
+
var implementation$1 = function bind(that) {
|
|
3365
|
+
var target = this;
|
|
3366
|
+
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
|
|
3367
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
3368
|
+
}
|
|
3369
|
+
var args = slicy(arguments, 1);
|
|
3370
|
+
var bound;
|
|
3371
|
+
var binder = function() {
|
|
3372
|
+
if (this instanceof bound) {
|
|
3373
|
+
var result = target.apply(
|
|
3374
|
+
this,
|
|
3369
3375
|
concatty(args, arguments)
|
|
3370
3376
|
);
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
boundArgs[i] = "$" + i;
|
|
3376
|
-
}
|
|
3377
|
-
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
3378
|
-
if (target.prototype) {
|
|
3379
|
-
var Empty = function Empty2() {
|
|
3380
|
-
};
|
|
3381
|
-
Empty.prototype = target.prototype;
|
|
3382
|
-
bound.prototype = new Empty();
|
|
3383
|
-
Empty.prototype = null;
|
|
3377
|
+
if (Object(result) === result) {
|
|
3378
|
+
return result;
|
|
3379
|
+
}
|
|
3380
|
+
return this;
|
|
3384
3381
|
}
|
|
3385
|
-
return
|
|
3382
|
+
return target.apply(
|
|
3383
|
+
that,
|
|
3384
|
+
concatty(args, arguments)
|
|
3385
|
+
);
|
|
3386
3386
|
};
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
var
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
}
|
|
3387
|
+
var boundLength = max$1(0, target.length - args.length);
|
|
3388
|
+
var boundArgs = [];
|
|
3389
|
+
for (var i = 0; i < boundLength; i++) {
|
|
3390
|
+
boundArgs[i] = "$" + i;
|
|
3391
|
+
}
|
|
3392
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
3393
|
+
if (target.prototype) {
|
|
3394
|
+
var Empty = function Empty2() {
|
|
3395
|
+
};
|
|
3396
|
+
Empty.prototype = target.prototype;
|
|
3397
|
+
bound.prototype = new Empty();
|
|
3398
|
+
Empty.prototype = null;
|
|
3399
|
+
}
|
|
3400
|
+
return bound;
|
|
3401
|
+
};
|
|
3402
|
+
var implementation = implementation$1;
|
|
3403
|
+
var functionBind = Function.prototype.bind || implementation;
|
|
3404
|
+
var functionCall = Function.prototype.call;
|
|
3406
3405
|
var functionApply;
|
|
3407
3406
|
var hasRequiredFunctionApply;
|
|
3408
3407
|
function requireFunctionApply() {
|
|
@@ -3412,14 +3411,14 @@ function requireFunctionApply() {
|
|
|
3412
3411
|
return functionApply;
|
|
3413
3412
|
}
|
|
3414
3413
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
3415
|
-
var bind$2 =
|
|
3414
|
+
var bind$2 = functionBind;
|
|
3416
3415
|
var $apply$1 = requireFunctionApply();
|
|
3417
|
-
var $call$2 =
|
|
3416
|
+
var $call$2 = functionCall;
|
|
3418
3417
|
var $reflectApply = reflectApply;
|
|
3419
3418
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
3420
|
-
var bind$1 =
|
|
3419
|
+
var bind$1 = functionBind;
|
|
3421
3420
|
var $TypeError$4 = type;
|
|
3422
|
-
var $call$1 =
|
|
3421
|
+
var $call$1 = functionCall;
|
|
3423
3422
|
var $actualApply = actualApply;
|
|
3424
3423
|
var callBindApplyHelpers = function callBindBasic(args) {
|
|
3425
3424
|
if (args.length < 1 || typeof args[0] !== "function") {
|
|
@@ -3485,8 +3484,8 @@ function requireHasown() {
|
|
|
3485
3484
|
hasRequiredHasown = 1;
|
|
3486
3485
|
var call = Function.prototype.call;
|
|
3487
3486
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
3488
|
-
var
|
|
3489
|
-
hasown =
|
|
3487
|
+
var bind3 = functionBind;
|
|
3488
|
+
hasown = bind3.call(call, $hasOwn);
|
|
3490
3489
|
return hasown;
|
|
3491
3490
|
}
|
|
3492
3491
|
var undefined$1;
|
|
@@ -3500,7 +3499,7 @@ var $TypeError$3 = type;
|
|
|
3500
3499
|
var $URIError = uri;
|
|
3501
3500
|
var abs = abs$1;
|
|
3502
3501
|
var floor = floor$1;
|
|
3503
|
-
var max = max$
|
|
3502
|
+
var max = max$2;
|
|
3504
3503
|
var min = min$1;
|
|
3505
3504
|
var pow = pow$1;
|
|
3506
3505
|
var round = round$1;
|
|
@@ -3534,7 +3533,7 @@ var getProto = requireGetProto();
|
|
|
3534
3533
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
3535
3534
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
3536
3535
|
var $apply = requireFunctionApply();
|
|
3537
|
-
var $call =
|
|
3536
|
+
var $call = functionCall;
|
|
3538
3537
|
var needsEval = {};
|
|
3539
3538
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
3540
3539
|
var INTRINSICS = {
|
|
@@ -3705,13 +3704,13 @@ var LEGACY_ALIASES = {
|
|
|
3705
3704
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
3706
3705
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
3707
3706
|
};
|
|
3708
|
-
var
|
|
3707
|
+
var bind2 = functionBind;
|
|
3709
3708
|
var hasOwn = requireHasown();
|
|
3710
|
-
var $concat =
|
|
3711
|
-
var $spliceApply =
|
|
3712
|
-
var $replace =
|
|
3713
|
-
var $strSlice =
|
|
3714
|
-
var $exec =
|
|
3709
|
+
var $concat = bind2.call($call, Array.prototype.concat);
|
|
3710
|
+
var $spliceApply = bind2.call($apply, Array.prototype.splice);
|
|
3711
|
+
var $replace = bind2.call($call, String.prototype.replace);
|
|
3712
|
+
var $strSlice = bind2.call($call, String.prototype.slice);
|
|
3713
|
+
var $exec = bind2.call($call, RegExp.prototype.exec);
|
|
3715
3714
|
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
3716
3715
|
var reEscapeChar = /\\(\\)?/g;
|
|
3717
3716
|
var stringToPath = function stringToPath2(string) {
|
|
@@ -4594,12 +4593,12 @@ var parseObject = function(chain, val, options, valuesParsed) {
|
|
|
4594
4593
|
obj = options.plainObjects ? { __proto__: null } : {};
|
|
4595
4594
|
var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
|
|
4596
4595
|
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
|
|
4597
|
-
var
|
|
4596
|
+
var index = parseInt(decodedRoot, 10);
|
|
4598
4597
|
if (!options.parseArrays && decodedRoot === "") {
|
|
4599
4598
|
obj = { 0: leaf };
|
|
4600
|
-
} else if (!isNaN(
|
|
4599
|
+
} else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) {
|
|
4601
4600
|
obj = [];
|
|
4602
|
-
obj[
|
|
4601
|
+
obj[index] = leaf;
|
|
4603
4602
|
} else if (decodedRoot !== "__proto__") {
|
|
4604
4603
|
obj[decodedRoot] = leaf;
|
|
4605
4604
|
}
|
|
@@ -9641,9 +9640,9 @@ class ManyToManyQueryClient {
|
|
|
9641
9640
|
one.$trx = trx;
|
|
9642
9641
|
await one.save();
|
|
9643
9642
|
}
|
|
9644
|
-
const relatedForeignKeyValues = related.reduce((result, one,
|
|
9643
|
+
const relatedForeignKeyValues = related.reduce((result, one, index) => {
|
|
9645
9644
|
const [, relatedForeignKeyValue] = this.relation.getPivotRelatedPair(one);
|
|
9646
|
-
result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[
|
|
9645
|
+
result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index]) || {};
|
|
9647
9646
|
return result;
|
|
9648
9647
|
}, {});
|
|
9649
9648
|
if (performSync) {
|
|
@@ -9681,9 +9680,9 @@ class ManyToManyQueryClient {
|
|
|
9681
9680
|
this.parent.$trx = trx;
|
|
9682
9681
|
await this.parent.save();
|
|
9683
9682
|
const related = await this.relation.relatedModel().createMany(values, { client: trx, ...options });
|
|
9684
|
-
const relatedForeignKeyValues = related.reduce((result, one,
|
|
9683
|
+
const relatedForeignKeyValues = related.reduce((result, one, index) => {
|
|
9685
9684
|
const [, relatedForeignKeyValue] = this.relation.getPivotRelatedPair(one);
|
|
9686
|
-
result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[
|
|
9685
|
+
result[relatedForeignKeyValue] = (pivotAttributes == null ? void 0 : pivotAttributes[index]) || {};
|
|
9687
9686
|
return result;
|
|
9688
9687
|
}, {});
|
|
9689
9688
|
await this.attach(relatedForeignKeyValues, trx);
|
|
@@ -11787,25 +11786,25 @@ const validateNormalizeAndCastDecoratorOptions = (fieldName, decoratorName, sche
|
|
|
11787
11786
|
}
|
|
11788
11787
|
return value;
|
|
11789
11788
|
};
|
|
11790
|
-
const resourcefulPropertyDefinitionSchema =
|
|
11791
|
-
propertyKey:
|
|
11792
|
-
readAccessControlFilters:
|
|
11793
|
-
writeAccessControlFilters:
|
|
11794
|
-
nullable:
|
|
11795
|
-
description:
|
|
11796
|
-
default:
|
|
11797
|
-
externalDocs:
|
|
11798
|
-
description:
|
|
11799
|
-
url:
|
|
11789
|
+
const resourcefulPropertyDefinitionSchema = joi.joi.object({
|
|
11790
|
+
propertyKey: joi.joi.string().default(""),
|
|
11791
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11792
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11793
|
+
nullable: joi.joi.boolean().default(false),
|
|
11794
|
+
description: joi.joi.string().optional(),
|
|
11795
|
+
default: joi.joi.any().optional(),
|
|
11796
|
+
externalDocs: joi.joi.object({
|
|
11797
|
+
description: joi.joi.string().optional(),
|
|
11798
|
+
url: joi.joi.string().uri().required()
|
|
11800
11799
|
}).optional(),
|
|
11801
|
-
example:
|
|
11802
|
-
deprecated:
|
|
11800
|
+
example: joi.joi.string().optional(),
|
|
11801
|
+
deprecated: joi.joi.boolean().default(false)
|
|
11803
11802
|
});
|
|
11804
11803
|
const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
|
|
11805
11804
|
return [
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11805
|
+
joi.joi.object().instance(Ctor),
|
|
11806
|
+
joi.joi.function().instance(Ctor),
|
|
11807
|
+
joi.joi.custom((value, helpers) => {
|
|
11809
11808
|
if (decorator_utils.isObject(value) && value.constructor.name === CtorName) {
|
|
11810
11809
|
return value;
|
|
11811
11810
|
}
|
|
@@ -11813,7 +11812,7 @@ const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
|
|
|
11813
11812
|
})
|
|
11814
11813
|
];
|
|
11815
11814
|
};
|
|
11816
|
-
const resourcefulDataTypeSchema =
|
|
11815
|
+
const resourcefulDataTypeSchema = joi.joi.alternatives(
|
|
11817
11816
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType"),
|
|
11818
11817
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType"),
|
|
11819
11818
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType"),
|
|
@@ -11832,95 +11831,95 @@ const resourcefulDataTypeSchema = index.joi.alternatives(
|
|
|
11832
11831
|
const localResourcefulPropertyDefinitionSchema = resourcefulPropertyDefinitionSchema.keys({
|
|
11833
11832
|
type: resourcefulDataTypeSchema.required()
|
|
11834
11833
|
});
|
|
11835
|
-
const resourcefulColumnOptionsSchema =
|
|
11834
|
+
const resourcefulColumnOptionsSchema = joi.joi.object({
|
|
11836
11835
|
// Lucid ColumnOptions (partial)
|
|
11837
|
-
columnName:
|
|
11838
|
-
serializeAs:
|
|
11839
|
-
serialize:
|
|
11840
|
-
consume:
|
|
11841
|
-
prepare:
|
|
11842
|
-
meta:
|
|
11843
|
-
isPrimary:
|
|
11844
|
-
hasDefaultValue:
|
|
11836
|
+
columnName: joi.joi.string().optional(),
|
|
11837
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
11838
|
+
serialize: joi.joi.function().optional(),
|
|
11839
|
+
consume: joi.joi.function().optional(),
|
|
11840
|
+
prepare: joi.joi.function().optional(),
|
|
11841
|
+
meta: joi.joi.object().optional(),
|
|
11842
|
+
isPrimary: joi.joi.boolean().default(false),
|
|
11843
|
+
hasDefaultValue: joi.joi.boolean().default(false),
|
|
11845
11844
|
// Resourceful options
|
|
11846
|
-
propertyKey:
|
|
11847
|
-
readAccessControlFilters:
|
|
11848
|
-
writeAccessControlFilters:
|
|
11849
|
-
nullable:
|
|
11850
|
-
description:
|
|
11851
|
-
default:
|
|
11852
|
-
externalDocs:
|
|
11853
|
-
description:
|
|
11854
|
-
url:
|
|
11845
|
+
propertyKey: joi.joi.string().default(""),
|
|
11846
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11847
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11848
|
+
nullable: joi.joi.boolean().default(false),
|
|
11849
|
+
description: joi.joi.string().optional(),
|
|
11850
|
+
default: joi.joi.any().optional(),
|
|
11851
|
+
externalDocs: joi.joi.object({
|
|
11852
|
+
description: joi.joi.string().optional(),
|
|
11853
|
+
url: joi.joi.string().uri().required()
|
|
11855
11854
|
}).optional(),
|
|
11856
|
-
example:
|
|
11857
|
-
deprecated:
|
|
11855
|
+
example: joi.joi.string().optional(),
|
|
11856
|
+
deprecated: joi.joi.boolean().default(false),
|
|
11858
11857
|
type: resourcefulDataTypeSchema.required()
|
|
11859
11858
|
});
|
|
11860
|
-
const dataTypeColumnOptionsSchema =
|
|
11859
|
+
const dataTypeColumnOptionsSchema = joi.joi.object({
|
|
11861
11860
|
// Lucid ColumnOptions (partial) - excluding 'prepare' and 'consume'
|
|
11862
|
-
columnName:
|
|
11863
|
-
serializeAs:
|
|
11864
|
-
serialize:
|
|
11865
|
-
meta:
|
|
11866
|
-
isPrimary:
|
|
11867
|
-
hasDefaultValue:
|
|
11861
|
+
columnName: joi.joi.string().optional(),
|
|
11862
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
11863
|
+
serialize: joi.joi.function().optional(),
|
|
11864
|
+
meta: joi.joi.object().optional(),
|
|
11865
|
+
isPrimary: joi.joi.boolean().default(false),
|
|
11866
|
+
hasDefaultValue: joi.joi.boolean().default(false),
|
|
11868
11867
|
// Resourceful options
|
|
11869
|
-
propertyKey:
|
|
11870
|
-
readAccessControlFilters:
|
|
11871
|
-
writeAccessControlFilters:
|
|
11872
|
-
nullable:
|
|
11873
|
-
description:
|
|
11874
|
-
default:
|
|
11875
|
-
externalDocs:
|
|
11876
|
-
description:
|
|
11877
|
-
url:
|
|
11868
|
+
propertyKey: joi.joi.string().default(""),
|
|
11869
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11870
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11871
|
+
nullable: joi.joi.boolean().default(false),
|
|
11872
|
+
description: joi.joi.string().optional(),
|
|
11873
|
+
default: joi.joi.any().optional(),
|
|
11874
|
+
externalDocs: joi.joi.object({
|
|
11875
|
+
description: joi.joi.string().optional(),
|
|
11876
|
+
url: joi.joi.string().uri().required()
|
|
11878
11877
|
}).optional(),
|
|
11879
|
-
example:
|
|
11880
|
-
deprecated:
|
|
11878
|
+
example: joi.joi.string().optional(),
|
|
11879
|
+
deprecated: joi.joi.boolean().default(false),
|
|
11881
11880
|
type: resourcefulDataTypeSchema.optional()
|
|
11882
11881
|
});
|
|
11883
11882
|
const baseDateColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11884
|
-
autoCreate:
|
|
11885
|
-
autoUpdate:
|
|
11883
|
+
autoCreate: joi.joi.boolean().default(false),
|
|
11884
|
+
autoUpdate: joi.joi.boolean().default(false)
|
|
11886
11885
|
});
|
|
11887
11886
|
const stringColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11888
|
-
type:
|
|
11887
|
+
type: joi.joi.alternatives(
|
|
11889
11888
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType")
|
|
11890
11889
|
).default(() => new definitions.ResourcefulStringType())
|
|
11891
11890
|
});
|
|
11892
11891
|
const dateColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
|
|
11893
|
-
type:
|
|
11892
|
+
type: joi.joi.alternatives(
|
|
11894
11893
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType")
|
|
11895
11894
|
).default(() => new definitions.ResourcefulDateType())
|
|
11896
11895
|
});
|
|
11897
11896
|
const dateTimeColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
|
|
11898
|
-
type:
|
|
11897
|
+
type: joi.joi.alternatives(
|
|
11899
11898
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType")
|
|
11900
11899
|
).default(() => new definitions.ResourcefulDateTimeType())
|
|
11901
11900
|
});
|
|
11902
11901
|
const binaryColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11903
|
-
type:
|
|
11902
|
+
type: joi.joi.alternatives(
|
|
11904
11903
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBinaryType, "ResourcefulBinaryType")
|
|
11905
11904
|
).default(() => new definitions.ResourcefulBinaryType())
|
|
11906
11905
|
});
|
|
11907
11906
|
const numberColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11908
|
-
type:
|
|
11907
|
+
type: joi.joi.alternatives(
|
|
11909
11908
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulNumberType, "ResourcefulNumberType")
|
|
11910
11909
|
).default(() => new definitions.ResourcefulNumberType())
|
|
11911
11910
|
});
|
|
11912
11911
|
const integerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11913
|
-
type:
|
|
11912
|
+
type: joi.joi.alternatives(
|
|
11914
11913
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulIntegerType, "ResourcefulIntegerType")
|
|
11915
11914
|
).default(() => new definitions.ResourcefulIntegerType())
|
|
11916
11915
|
});
|
|
11917
11916
|
const bigintColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11918
|
-
type:
|
|
11917
|
+
type: joi.joi.alternatives(
|
|
11919
11918
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBigintType, "ResourcefulBigintType")
|
|
11920
11919
|
).default(() => new definitions.ResourcefulBigintType())
|
|
11921
11920
|
});
|
|
11922
11921
|
const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11923
|
-
type:
|
|
11922
|
+
type: joi.joi.alternatives(
|
|
11924
11923
|
...joiInstanceCheckerAlternativesFactory(
|
|
11925
11924
|
definitions.ResourcefulUnsignedIntegerType,
|
|
11926
11925
|
"ResourcefulUnsignedIntegerType"
|
|
@@ -11928,148 +11927,148 @@ const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
|
11928
11927
|
).default(() => new definitions.ResourcefulUnsignedIntegerType())
|
|
11929
11928
|
});
|
|
11930
11929
|
const booleanColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11931
|
-
type:
|
|
11930
|
+
type: joi.joi.alternatives(
|
|
11932
11931
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBooleanType, "ResourcefulBooleanType")
|
|
11933
11932
|
).default(() => new definitions.ResourcefulBooleanType())
|
|
11934
11933
|
});
|
|
11935
|
-
const objectColumnOptionsSchema =
|
|
11934
|
+
const objectColumnOptionsSchema = joi.joi.object({
|
|
11936
11935
|
// Lucid ColumnOptions (full)
|
|
11937
|
-
columnName:
|
|
11938
|
-
serializeAs:
|
|
11939
|
-
serialize:
|
|
11940
|
-
consume:
|
|
11941
|
-
prepare:
|
|
11942
|
-
meta:
|
|
11943
|
-
isPrimary:
|
|
11944
|
-
hasDefaultValue:
|
|
11936
|
+
columnName: joi.joi.string().optional(),
|
|
11937
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
11938
|
+
serialize: joi.joi.function().optional(),
|
|
11939
|
+
consume: joi.joi.function().optional(),
|
|
11940
|
+
prepare: joi.joi.function().optional(),
|
|
11941
|
+
meta: joi.joi.object().optional(),
|
|
11942
|
+
isPrimary: joi.joi.boolean().default(false),
|
|
11943
|
+
hasDefaultValue: joi.joi.boolean().default(false),
|
|
11945
11944
|
// Resourceful options
|
|
11946
|
-
propertyKey:
|
|
11947
|
-
readAccessControlFilters:
|
|
11948
|
-
writeAccessControlFilters:
|
|
11949
|
-
nullable:
|
|
11950
|
-
description:
|
|
11951
|
-
default:
|
|
11952
|
-
externalDocs:
|
|
11953
|
-
description:
|
|
11954
|
-
url:
|
|
11945
|
+
propertyKey: joi.joi.string().default(""),
|
|
11946
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11947
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11948
|
+
nullable: joi.joi.boolean().default(false),
|
|
11949
|
+
description: joi.joi.string().optional(),
|
|
11950
|
+
default: joi.joi.any().optional(),
|
|
11951
|
+
externalDocs: joi.joi.object({
|
|
11952
|
+
description: joi.joi.string().optional(),
|
|
11953
|
+
url: joi.joi.string().uri().required()
|
|
11955
11954
|
}).optional(),
|
|
11956
|
-
example:
|
|
11957
|
-
deprecated:
|
|
11958
|
-
type:
|
|
11955
|
+
example: joi.joi.string().optional(),
|
|
11956
|
+
deprecated: joi.joi.boolean().default(false),
|
|
11957
|
+
type: joi.joi.alternatives(
|
|
11959
11958
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulObjectType, "ResourcefulObjectType")
|
|
11960
11959
|
).default(() => new definitions.ResourcefulObjectType())
|
|
11961
11960
|
});
|
|
11962
|
-
const arrayColumnOptionsSchema =
|
|
11961
|
+
const arrayColumnOptionsSchema = joi.joi.object({
|
|
11963
11962
|
// Lucid ColumnOptions (full)
|
|
11964
|
-
columnName:
|
|
11965
|
-
serializeAs:
|
|
11966
|
-
serialize:
|
|
11967
|
-
consume:
|
|
11968
|
-
prepare:
|
|
11969
|
-
meta:
|
|
11970
|
-
isPrimary:
|
|
11971
|
-
hasDefaultValue:
|
|
11963
|
+
columnName: joi.joi.string().optional(),
|
|
11964
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
11965
|
+
serialize: joi.joi.function().optional(),
|
|
11966
|
+
consume: joi.joi.function().optional(),
|
|
11967
|
+
prepare: joi.joi.function().optional(),
|
|
11968
|
+
meta: joi.joi.object().optional(),
|
|
11969
|
+
isPrimary: joi.joi.boolean().default(false),
|
|
11970
|
+
hasDefaultValue: joi.joi.boolean().default(false),
|
|
11972
11971
|
// Resourceful options
|
|
11973
|
-
propertyKey:
|
|
11974
|
-
readAccessControlFilters:
|
|
11975
|
-
writeAccessControlFilters:
|
|
11976
|
-
nullable:
|
|
11977
|
-
description:
|
|
11978
|
-
default:
|
|
11979
|
-
externalDocs:
|
|
11980
|
-
description:
|
|
11981
|
-
url:
|
|
11972
|
+
propertyKey: joi.joi.string().default(""),
|
|
11973
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11974
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11975
|
+
nullable: joi.joi.boolean().default(false),
|
|
11976
|
+
description: joi.joi.string().optional(),
|
|
11977
|
+
default: joi.joi.any().optional(),
|
|
11978
|
+
externalDocs: joi.joi.object({
|
|
11979
|
+
description: joi.joi.string().optional(),
|
|
11980
|
+
url: joi.joi.string().uri().required()
|
|
11982
11981
|
}).optional(),
|
|
11983
|
-
example:
|
|
11984
|
-
deprecated:
|
|
11985
|
-
type:
|
|
11982
|
+
example: joi.joi.string().optional(),
|
|
11983
|
+
deprecated: joi.joi.boolean().default(false),
|
|
11984
|
+
type: joi.joi.alternatives(
|
|
11986
11985
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulArrayType, "ResourcefulArrayType")
|
|
11987
11986
|
).default(() => new definitions.ResourcefulArrayType())
|
|
11988
11987
|
});
|
|
11989
11988
|
localResourcefulPropertyDefinitionSchema.append({
|
|
11990
|
-
writable:
|
|
11989
|
+
writable: joi.joi.boolean().default(false)
|
|
11991
11990
|
});
|
|
11992
|
-
const resourcefulComputedOptionsSchema =
|
|
11991
|
+
const resourcefulComputedOptionsSchema = joi.joi.object({
|
|
11993
11992
|
// Lucid ComputedOptions (partial)
|
|
11994
|
-
serializeAs:
|
|
11995
|
-
serialize:
|
|
11996
|
-
meta:
|
|
11993
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
11994
|
+
serialize: joi.joi.function().optional(),
|
|
11995
|
+
meta: joi.joi.object().optional(),
|
|
11997
11996
|
// Resourceful options
|
|
11998
|
-
propertyKey:
|
|
11999
|
-
readAccessControlFilters:
|
|
12000
|
-
writeAccessControlFilters:
|
|
12001
|
-
nullable:
|
|
12002
|
-
description:
|
|
12003
|
-
default:
|
|
12004
|
-
externalDocs:
|
|
12005
|
-
description:
|
|
12006
|
-
url:
|
|
11997
|
+
propertyKey: joi.joi.string().default(""),
|
|
11998
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
11999
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12000
|
+
nullable: joi.joi.boolean().default(false),
|
|
12001
|
+
description: joi.joi.string().optional(),
|
|
12002
|
+
default: joi.joi.any().optional(),
|
|
12003
|
+
externalDocs: joi.joi.object({
|
|
12004
|
+
description: joi.joi.string().optional(),
|
|
12005
|
+
url: joi.joi.string().uri().required()
|
|
12007
12006
|
}).optional(),
|
|
12008
|
-
example:
|
|
12009
|
-
deprecated:
|
|
12007
|
+
example: joi.joi.string().optional(),
|
|
12008
|
+
deprecated: joi.joi.boolean().default(false),
|
|
12010
12009
|
type: resourcefulDataTypeSchema.required()
|
|
12011
12010
|
});
|
|
12012
|
-
const dataTypeComputedOptionsSchema =
|
|
12011
|
+
const dataTypeComputedOptionsSchema = joi.joi.object({
|
|
12013
12012
|
// Lucid ComputedOptions (partial) - excluding 'prepare' and 'consume'
|
|
12014
|
-
serializeAs:
|
|
12015
|
-
serialize:
|
|
12016
|
-
meta:
|
|
12013
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
12014
|
+
serialize: joi.joi.function().optional(),
|
|
12015
|
+
meta: joi.joi.object().optional(),
|
|
12017
12016
|
// Resourceful options
|
|
12018
|
-
propertyKey:
|
|
12019
|
-
readAccessControlFilters:
|
|
12020
|
-
writeAccessControlFilters:
|
|
12021
|
-
nullable:
|
|
12022
|
-
description:
|
|
12023
|
-
default:
|
|
12024
|
-
externalDocs:
|
|
12025
|
-
description:
|
|
12026
|
-
url:
|
|
12017
|
+
propertyKey: joi.joi.string().default(""),
|
|
12018
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12019
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12020
|
+
nullable: joi.joi.boolean().default(false),
|
|
12021
|
+
description: joi.joi.string().optional(),
|
|
12022
|
+
default: joi.joi.any().optional(),
|
|
12023
|
+
externalDocs: joi.joi.object({
|
|
12024
|
+
description: joi.joi.string().optional(),
|
|
12025
|
+
url: joi.joi.string().uri().required()
|
|
12027
12026
|
}).optional(),
|
|
12028
|
-
example:
|
|
12029
|
-
deprecated:
|
|
12027
|
+
example: joi.joi.string().optional(),
|
|
12028
|
+
deprecated: joi.joi.boolean().default(false),
|
|
12030
12029
|
type: resourcefulDataTypeSchema.optional()
|
|
12031
12030
|
});
|
|
12032
12031
|
const baseDateComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12033
|
-
autoCreate:
|
|
12034
|
-
autoUpdate:
|
|
12032
|
+
autoCreate: joi.joi.boolean().default(false),
|
|
12033
|
+
autoUpdate: joi.joi.boolean().default(false)
|
|
12035
12034
|
});
|
|
12036
12035
|
const stringComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12037
|
-
type:
|
|
12036
|
+
type: joi.joi.alternatives(
|
|
12038
12037
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulStringType, "ResourcefulStringType")
|
|
12039
12038
|
).default(() => new definitions.ResourcefulStringType())
|
|
12040
12039
|
});
|
|
12041
12040
|
const dateComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
|
|
12042
|
-
type:
|
|
12041
|
+
type: joi.joi.alternatives(
|
|
12043
12042
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateType, "ResourcefulDateType")
|
|
12044
12043
|
).default(() => new definitions.ResourcefulDateType())
|
|
12045
12044
|
});
|
|
12046
12045
|
const dateTimeComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
|
|
12047
|
-
type:
|
|
12046
|
+
type: joi.joi.alternatives(
|
|
12048
12047
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulDateTimeType, "ResourcefulDateTimeType")
|
|
12049
12048
|
).default(() => new definitions.ResourcefulDateTimeType())
|
|
12050
12049
|
});
|
|
12051
12050
|
const binaryComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12052
|
-
type:
|
|
12051
|
+
type: joi.joi.alternatives(
|
|
12053
12052
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBinaryType, "ResourcefulBinaryType")
|
|
12054
12053
|
).default(() => new definitions.ResourcefulBinaryType())
|
|
12055
12054
|
});
|
|
12056
12055
|
const numberComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12057
|
-
type:
|
|
12056
|
+
type: joi.joi.alternatives(
|
|
12058
12057
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulNumberType, "ResourcefulNumberType")
|
|
12059
12058
|
).default(() => new definitions.ResourcefulNumberType())
|
|
12060
12059
|
});
|
|
12061
12060
|
const integerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12062
|
-
type:
|
|
12061
|
+
type: joi.joi.alternatives(
|
|
12063
12062
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulIntegerType, "ResourcefulIntegerType")
|
|
12064
12063
|
).default(() => new definitions.ResourcefulIntegerType())
|
|
12065
12064
|
});
|
|
12066
12065
|
const bigintComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12067
|
-
type:
|
|
12066
|
+
type: joi.joi.alternatives(
|
|
12068
12067
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBigintType, "ResourcefulBigintType")
|
|
12069
12068
|
).default(() => new definitions.ResourcefulBigintType())
|
|
12070
12069
|
});
|
|
12071
12070
|
const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12072
|
-
type:
|
|
12071
|
+
type: joi.joi.alternatives(
|
|
12073
12072
|
...joiInstanceCheckerAlternativesFactory(
|
|
12074
12073
|
definitions.ResourcefulUnsignedIntegerType,
|
|
12075
12074
|
"ResourcefulUnsignedIntegerType"
|
|
@@ -12077,99 +12076,99 @@ const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys(
|
|
|
12077
12076
|
).default(() => new definitions.ResourcefulUnsignedIntegerType())
|
|
12078
12077
|
});
|
|
12079
12078
|
const booleanComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12080
|
-
type:
|
|
12079
|
+
type: joi.joi.alternatives(
|
|
12081
12080
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulBooleanType, "ResourcefulBooleanType")
|
|
12082
12081
|
).default(() => new definitions.ResourcefulBooleanType())
|
|
12083
12082
|
});
|
|
12084
|
-
const objectComputedOptionsSchema =
|
|
12083
|
+
const objectComputedOptionsSchema = joi.joi.object({
|
|
12085
12084
|
// Lucid ComputedOptions (full)
|
|
12086
|
-
serializeAs:
|
|
12087
|
-
serialize:
|
|
12088
|
-
meta:
|
|
12085
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
12086
|
+
serialize: joi.joi.function().optional(),
|
|
12087
|
+
meta: joi.joi.object().optional(),
|
|
12089
12088
|
// Resourceful options
|
|
12090
|
-
propertyKey:
|
|
12091
|
-
readAccessControlFilters:
|
|
12092
|
-
writeAccessControlFilters:
|
|
12093
|
-
nullable:
|
|
12094
|
-
description:
|
|
12095
|
-
default:
|
|
12096
|
-
externalDocs:
|
|
12097
|
-
description:
|
|
12098
|
-
url:
|
|
12089
|
+
propertyKey: joi.joi.string().default(""),
|
|
12090
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12091
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12092
|
+
nullable: joi.joi.boolean().default(false),
|
|
12093
|
+
description: joi.joi.string().optional(),
|
|
12094
|
+
default: joi.joi.any().optional(),
|
|
12095
|
+
externalDocs: joi.joi.object({
|
|
12096
|
+
description: joi.joi.string().optional(),
|
|
12097
|
+
url: joi.joi.string().uri().required()
|
|
12099
12098
|
}).optional(),
|
|
12100
|
-
example:
|
|
12101
|
-
deprecated:
|
|
12102
|
-
type:
|
|
12099
|
+
example: joi.joi.string().optional(),
|
|
12100
|
+
deprecated: joi.joi.boolean().default(false),
|
|
12101
|
+
type: joi.joi.alternatives(
|
|
12103
12102
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulObjectType, "ResourcefulObjectType")
|
|
12104
12103
|
).default(() => new definitions.ResourcefulObjectType())
|
|
12105
12104
|
});
|
|
12106
|
-
const arrayComputedOptionsSchema =
|
|
12105
|
+
const arrayComputedOptionsSchema = joi.joi.object({
|
|
12107
12106
|
// Lucid ComputedOptions (full)
|
|
12108
|
-
serializeAs:
|
|
12109
|
-
serialize:
|
|
12110
|
-
meta:
|
|
12107
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
12108
|
+
serialize: joi.joi.function().optional(),
|
|
12109
|
+
meta: joi.joi.object().optional(),
|
|
12111
12110
|
// Resourceful options
|
|
12112
|
-
propertyKey:
|
|
12113
|
-
readAccessControlFilters:
|
|
12114
|
-
writeAccessControlFilters:
|
|
12115
|
-
nullable:
|
|
12116
|
-
description:
|
|
12117
|
-
default:
|
|
12118
|
-
externalDocs:
|
|
12119
|
-
description:
|
|
12120
|
-
url:
|
|
12111
|
+
propertyKey: joi.joi.string().default(""),
|
|
12112
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12113
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12114
|
+
nullable: joi.joi.boolean().default(false),
|
|
12115
|
+
description: joi.joi.string().optional(),
|
|
12116
|
+
default: joi.joi.any().optional(),
|
|
12117
|
+
externalDocs: joi.joi.object({
|
|
12118
|
+
description: joi.joi.string().optional(),
|
|
12119
|
+
url: joi.joi.string().uri().required()
|
|
12121
12120
|
}).optional(),
|
|
12122
|
-
example:
|
|
12123
|
-
deprecated:
|
|
12124
|
-
type:
|
|
12121
|
+
example: joi.joi.string().optional(),
|
|
12122
|
+
deprecated: joi.joi.boolean().default(false),
|
|
12123
|
+
type: joi.joi.alternatives(
|
|
12125
12124
|
...joiInstanceCheckerAlternativesFactory(definitions.ResourcefulArrayType, "ResourcefulArrayType")
|
|
12126
12125
|
).default(() => new definitions.ResourcefulArrayType())
|
|
12127
12126
|
});
|
|
12128
|
-
const resourcefulRelationshipOptionsSchema =
|
|
12127
|
+
const resourcefulRelationshipOptionsSchema = joi.joi.object({
|
|
12129
12128
|
// Resourceful options
|
|
12130
|
-
propertyKey:
|
|
12131
|
-
readAccessControlFilters:
|
|
12132
|
-
writeAccessControlFilters:
|
|
12133
|
-
nullable:
|
|
12134
|
-
description:
|
|
12135
|
-
default:
|
|
12136
|
-
externalDocs:
|
|
12137
|
-
description:
|
|
12138
|
-
url:
|
|
12129
|
+
propertyKey: joi.joi.string().default(""),
|
|
12130
|
+
readAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12131
|
+
writeAccessControlFilters: joi.joi.array().items(joi.joi.function()).default([]),
|
|
12132
|
+
nullable: joi.joi.boolean().default(false),
|
|
12133
|
+
description: joi.joi.string().optional(),
|
|
12134
|
+
default: joi.joi.any().optional(),
|
|
12135
|
+
externalDocs: joi.joi.object({
|
|
12136
|
+
description: joi.joi.string().optional(),
|
|
12137
|
+
url: joi.joi.string().uri().required()
|
|
12139
12138
|
}).optional(),
|
|
12140
|
-
example:
|
|
12141
|
-
deprecated:
|
|
12139
|
+
example: joi.joi.string().optional(),
|
|
12140
|
+
deprecated: joi.joi.boolean().default(false)
|
|
12142
12141
|
});
|
|
12143
12142
|
const relationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12144
12143
|
// Lucid RelationOptions
|
|
12145
|
-
localKey:
|
|
12146
|
-
foreignKey:
|
|
12147
|
-
serializeAs:
|
|
12148
|
-
onQuery:
|
|
12149
|
-
relatedModel:
|
|
12144
|
+
localKey: joi.joi.string().optional(),
|
|
12145
|
+
foreignKey: joi.joi.string().optional(),
|
|
12146
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
12147
|
+
onQuery: joi.joi.function().optional(),
|
|
12148
|
+
relatedModel: joi.joi.function()
|
|
12150
12149
|
});
|
|
12151
12150
|
const manyToManyRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12152
12151
|
// Lucid ManyToManyRelationOptions
|
|
12153
|
-
localKey:
|
|
12154
|
-
relatedKey:
|
|
12155
|
-
pivotForeignKey:
|
|
12156
|
-
pivotRelatedForeignKey:
|
|
12157
|
-
pivotTable:
|
|
12158
|
-
pivotTimestamps:
|
|
12159
|
-
pivotColumns:
|
|
12160
|
-
serializeAs:
|
|
12161
|
-
onQuery:
|
|
12162
|
-
relatedModel:
|
|
12152
|
+
localKey: joi.joi.string().optional(),
|
|
12153
|
+
relatedKey: joi.joi.string().optional(),
|
|
12154
|
+
pivotForeignKey: joi.joi.string().optional(),
|
|
12155
|
+
pivotRelatedForeignKey: joi.joi.string().optional(),
|
|
12156
|
+
pivotTable: joi.joi.string().optional(),
|
|
12157
|
+
pivotTimestamps: joi.joi.boolean().optional(),
|
|
12158
|
+
pivotColumns: joi.joi.array().items(joi.joi.string()).optional(),
|
|
12159
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
12160
|
+
onQuery: joi.joi.function().optional(),
|
|
12161
|
+
relatedModel: joi.joi.function()
|
|
12163
12162
|
});
|
|
12164
12163
|
const hasManyThroughRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12165
12164
|
// Lucid HasManyThroughRelationOptions (ThroughRelationOptions without throughModel)
|
|
12166
|
-
localKey:
|
|
12167
|
-
foreignKey:
|
|
12168
|
-
throughLocalKey:
|
|
12169
|
-
throughForeignKey:
|
|
12170
|
-
serializeAs:
|
|
12171
|
-
onQuery:
|
|
12172
|
-
relatedModel:
|
|
12165
|
+
localKey: joi.joi.string().optional(),
|
|
12166
|
+
foreignKey: joi.joi.string().optional(),
|
|
12167
|
+
throughLocalKey: joi.joi.string().optional(),
|
|
12168
|
+
throughForeignKey: joi.joi.string().optional(),
|
|
12169
|
+
serializeAs: joi.joi.alternatives().try(joi.joi.string(), joi.joi.valid(null)).optional(),
|
|
12170
|
+
onQuery: joi.joi.function().optional(),
|
|
12171
|
+
relatedModel: joi.joi.function()
|
|
12173
12172
|
});
|
|
12174
12173
|
const extractLucidOptionsForLucidDecorator = (options, keys, overrides) => {
|
|
12175
12174
|
const extracted = {};
|
|
@@ -12261,16 +12260,37 @@ const handleResourcefulColumn = (config) => {
|
|
|
12261
12260
|
propertyKey,
|
|
12262
12261
|
decoratorOption,
|
|
12263
12262
|
decoratorOptionsValidationSchema,
|
|
12264
|
-
overrides,
|
|
12265
|
-
lucidDecoratorFunction
|
|
12263
|
+
overrides = {},
|
|
12264
|
+
lucidDecoratorFunction,
|
|
12265
|
+
defaultPrepare,
|
|
12266
|
+
defaultConsume
|
|
12266
12267
|
} = config;
|
|
12267
12268
|
const opts = validateNormalizeAndCastDecoratorOptions(propertyKey, decoratorName, decoratorOptionsValidationSchema, {
|
|
12268
12269
|
...decoratorOption,
|
|
12269
12270
|
propertyKey
|
|
12270
12271
|
});
|
|
12272
|
+
const customPrepare = opts.prepare;
|
|
12273
|
+
const customConsume = opts.consume;
|
|
12274
|
+
const nullable = opts.nullable || false;
|
|
12275
|
+
const chainedPrepare = PrepareConsumeChainBuilder.chainPrepare(
|
|
12276
|
+
propertyKey,
|
|
12277
|
+
nullable,
|
|
12278
|
+
defaultPrepare,
|
|
12279
|
+
customPrepare
|
|
12280
|
+
);
|
|
12281
|
+
const chainedConsume = PrepareConsumeChainBuilder.chainConsume(
|
|
12282
|
+
propertyKey,
|
|
12283
|
+
nullable,
|
|
12284
|
+
defaultConsume,
|
|
12285
|
+
customConsume
|
|
12286
|
+
);
|
|
12271
12287
|
const lucidOptions = extractLucidOptionsForLucidColumnDecorator(
|
|
12272
12288
|
opts,
|
|
12273
|
-
|
|
12289
|
+
{
|
|
12290
|
+
...overrides,
|
|
12291
|
+
...chainedPrepare && { prepare: chainedPrepare },
|
|
12292
|
+
...chainedConsume && { consume: chainedConsume }
|
|
12293
|
+
}
|
|
12274
12294
|
);
|
|
12275
12295
|
lucidDecoratorFunction(lucidOptions)(target, propertyKey);
|
|
12276
12296
|
const map = ensureOwnResourcefulMap(target, "$resourcefulColumns");
|
|
@@ -12318,10 +12338,8 @@ resourcefulColumn.string = function(options = {}) {
|
|
|
12318
12338
|
decoratorOption: options,
|
|
12319
12339
|
decoratorOptionsValidationSchema,
|
|
12320
12340
|
lucidDecoratorFunction: column,
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
consume: (value) => decorator_utils.consumeString(propertyKey, value, options.nullable)
|
|
12324
|
-
}
|
|
12341
|
+
defaultPrepare: decorator_utils.prepareString,
|
|
12342
|
+
defaultConsume: decorator_utils.consumeString
|
|
12325
12343
|
});
|
|
12326
12344
|
};
|
|
12327
12345
|
};
|
|
@@ -12364,10 +12382,8 @@ resourcefulColumn.binary = function(options = {}) {
|
|
|
12364
12382
|
decoratorOption: options,
|
|
12365
12383
|
decoratorOptionsValidationSchema,
|
|
12366
12384
|
lucidDecoratorFunction: column,
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
consume: (value) => decorator_utils.consumeBinary(propertyKey, value, options.nullable)
|
|
12370
|
-
}
|
|
12385
|
+
defaultPrepare: decorator_utils.prepareBinary,
|
|
12386
|
+
defaultConsume: decorator_utils.consumeBinary
|
|
12371
12387
|
});
|
|
12372
12388
|
};
|
|
12373
12389
|
};
|
|
@@ -12382,10 +12398,8 @@ resourcefulColumn.number = function(options = {}) {
|
|
|
12382
12398
|
decoratorOption: options,
|
|
12383
12399
|
decoratorOptionsValidationSchema,
|
|
12384
12400
|
lucidDecoratorFunction: column,
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
consume: (value) => decorator_utils.consumeNumber(propertyKey, value, options.nullable)
|
|
12388
|
-
}
|
|
12401
|
+
defaultPrepare: decorator_utils.prepareNumber,
|
|
12402
|
+
defaultConsume: decorator_utils.consumeNumber
|
|
12389
12403
|
});
|
|
12390
12404
|
};
|
|
12391
12405
|
};
|
|
@@ -12400,10 +12414,8 @@ resourcefulColumn.integer = function(options = {}) {
|
|
|
12400
12414
|
decoratorOption: options,
|
|
12401
12415
|
decoratorOptionsValidationSchema,
|
|
12402
12416
|
lucidDecoratorFunction: column,
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
consume: (value) => decorator_utils.consumeInteger(propertyKey, value, options.nullable)
|
|
12406
|
-
}
|
|
12417
|
+
defaultPrepare: decorator_utils.prepareInteger,
|
|
12418
|
+
defaultConsume: decorator_utils.consumeInteger
|
|
12407
12419
|
});
|
|
12408
12420
|
};
|
|
12409
12421
|
};
|
|
@@ -12418,10 +12430,8 @@ resourcefulColumn.bigint = function(options = {}) {
|
|
|
12418
12430
|
decoratorOption: options,
|
|
12419
12431
|
decoratorOptionsValidationSchema,
|
|
12420
12432
|
lucidDecoratorFunction: column,
|
|
12421
|
-
|
|
12422
|
-
|
|
12423
|
-
consume: (value) => decorator_utils.consumeBigint(propertyKey, value, options.nullable)
|
|
12424
|
-
}
|
|
12433
|
+
defaultPrepare: decorator_utils.prepareBigint,
|
|
12434
|
+
defaultConsume: decorator_utils.consumeBigint
|
|
12425
12435
|
});
|
|
12426
12436
|
};
|
|
12427
12437
|
};
|
|
@@ -12436,10 +12446,8 @@ resourcefulColumn.unsignedint = function(options = {}) {
|
|
|
12436
12446
|
decoratorOption: options,
|
|
12437
12447
|
decoratorOptionsValidationSchema,
|
|
12438
12448
|
lucidDecoratorFunction: column,
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
consume: (value) => decorator_utils.consumeUnsignedint(propertyKey, value, options.nullable)
|
|
12442
|
-
}
|
|
12449
|
+
defaultPrepare: decorator_utils.prepareUnsignedint,
|
|
12450
|
+
defaultConsume: decorator_utils.consumeUnsignedint
|
|
12443
12451
|
});
|
|
12444
12452
|
};
|
|
12445
12453
|
};
|
|
@@ -12454,10 +12462,8 @@ resourcefulColumn.boolean = function(options = {}) {
|
|
|
12454
12462
|
decoratorOption: options,
|
|
12455
12463
|
decoratorOptionsValidationSchema,
|
|
12456
12464
|
lucidDecoratorFunction: column,
|
|
12457
|
-
|
|
12458
|
-
|
|
12459
|
-
consume: (value) => decorator_utils.consumeBoolean(propertyKey, value, options.nullable)
|
|
12460
|
-
}
|
|
12465
|
+
defaultPrepare: decorator_utils.prepareBoolean,
|
|
12466
|
+
defaultConsume: decorator_utils.consumeBoolean
|
|
12461
12467
|
});
|
|
12462
12468
|
};
|
|
12463
12469
|
};
|
|
@@ -12472,10 +12478,8 @@ resourcefulColumn.object = function(options = {}) {
|
|
|
12472
12478
|
decoratorOption: options,
|
|
12473
12479
|
decoratorOptionsValidationSchema,
|
|
12474
12480
|
lucidDecoratorFunction: column,
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
consume: (value) => decorator_utils.consumeObject(propertyKey, value, options.nullable)
|
|
12478
|
-
}
|
|
12481
|
+
defaultPrepare: decorator_utils.prepareObject,
|
|
12482
|
+
defaultConsume: decorator_utils.consumeObject
|
|
12479
12483
|
});
|
|
12480
12484
|
};
|
|
12481
12485
|
};
|
|
@@ -12490,10 +12494,8 @@ resourcefulColumn.array = function(options = {}) {
|
|
|
12490
12494
|
decoratorOption: options,
|
|
12491
12495
|
decoratorOptionsValidationSchema,
|
|
12492
12496
|
lucidDecoratorFunction: column,
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
consume: (value) => decorator_utils.consumeArray(propertyKey, value, options.nullable)
|
|
12496
|
-
}
|
|
12497
|
+
defaultPrepare: decorator_utils.prepareArray,
|
|
12498
|
+
defaultConsume: decorator_utils.consumeArray
|
|
12497
12499
|
});
|
|
12498
12500
|
};
|
|
12499
12501
|
};
|
|
@@ -12721,7 +12723,7 @@ function resourcefulHasManyThrough(model, options = {}) {
|
|
|
12721
12723
|
map.set(propertyKey, opts);
|
|
12722
12724
|
};
|
|
12723
12725
|
}
|
|
12724
|
-
const version = "0.1.0-master-
|
|
12726
|
+
const version = "0.1.0-master-71781cfd";
|
|
12725
12727
|
exports.errors = errors.errors;
|
|
12726
12728
|
exports.definitions = definitions.definitions;
|
|
12727
12729
|
exports.resourcefulBelongsTo = resourcefulBelongsTo;
|