@nhtio/lucid-resourceful 1.20250718.2 → 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/{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 +296 -289
- package/index.cjs.map +1 -1
- package/index.mjs +283 -276
- 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/joi/index.d.ts +3 -65
- package/private/mixin.d.ts +4 -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
|
@@ -11,12 +11,12 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
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
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 {
|
|
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";
|
|
@@ -598,31 +598,31 @@ const getFieldKey = (key, definition) => {
|
|
|
598
598
|
};
|
|
599
599
|
function withResourceful(options = {}) {
|
|
600
600
|
return (superclass) => {
|
|
601
|
-
const optionsSchema =
|
|
602
|
-
name:
|
|
603
|
-
readRequiredForWrite:
|
|
604
|
-
accessControlFilters:
|
|
605
|
-
list:
|
|
606
|
-
create:
|
|
607
|
-
read:
|
|
608
|
-
update:
|
|
609
|
-
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([])
|
|
610
610
|
}).default({}),
|
|
611
|
-
onACLError:
|
|
612
|
-
onValidationScopeError:
|
|
613
|
-
queryScopeCallbacks:
|
|
614
|
-
list:
|
|
615
|
-
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([])
|
|
616
616
|
}).default({}),
|
|
617
|
-
description:
|
|
618
|
-
externalDocs:
|
|
619
|
-
description:
|
|
620
|
-
url:
|
|
617
|
+
description: Q_.string().optional(),
|
|
618
|
+
externalDocs: Q_.object({
|
|
619
|
+
description: Q_.string().optional(),
|
|
620
|
+
url: Q_.string().uri().required()
|
|
621
621
|
}).optional(),
|
|
622
|
-
example:
|
|
623
|
-
advanced:
|
|
624
|
-
propertyEvaluationConcurrency:
|
|
625
|
-
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)
|
|
626
626
|
}).default({
|
|
627
627
|
propertyEvaluationConcurrency: 10,
|
|
628
628
|
aclEvaluationConcurrency: 2
|
|
@@ -763,7 +763,7 @@ function withResourceful(options = {}) {
|
|
|
763
763
|
"relationship"
|
|
764
764
|
),
|
|
765
765
|
kind: "relationship",
|
|
766
|
-
validator:
|
|
766
|
+
validator: Q_.forbidden(),
|
|
767
767
|
relatedModel: relationshipDefinition.relatedModel
|
|
768
768
|
};
|
|
769
769
|
if (!resourcefulModelRelationshipMetaSchema.canRead && !resourcefulModelRelationshipMetaSchema.canWrite)
|
|
@@ -778,7 +778,7 @@ function withResourceful(options = {}) {
|
|
|
778
778
|
}
|
|
779
779
|
static $getPropertyValidator(ctx, app, key, datatype, nullable, validationScopes, kind, writable = false) {
|
|
780
780
|
if ("relationship" === kind || "computedAccessor" === kind && !writable) {
|
|
781
|
-
return
|
|
781
|
+
return Q_.any().forbidden();
|
|
782
782
|
}
|
|
783
783
|
const baseValidator = this.$getPropertyBaseValidator(datatype, nullable, kind, writable);
|
|
784
784
|
if (Array.isArray(validationScopes) && validationScopes.length > 0) {
|
|
@@ -800,7 +800,7 @@ function withResourceful(options = {}) {
|
|
|
800
800
|
case "pass":
|
|
801
801
|
break;
|
|
802
802
|
case "fail":
|
|
803
|
-
return
|
|
803
|
+
return Q_.any().forbidden();
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
806
|
});
|
|
@@ -809,13 +809,13 @@ function withResourceful(options = {}) {
|
|
|
809
809
|
}
|
|
810
810
|
static $getPropertyBaseValidator(datatype, nullable, kind, writable = false) {
|
|
811
811
|
if ("relationship" === kind || "computedAccessor" === kind && !writable) {
|
|
812
|
-
return
|
|
812
|
+
return Q_.any().forbidden();
|
|
813
813
|
}
|
|
814
814
|
nullable = nullable || "boolean" === typeof datatype.nullable && datatype.nullable;
|
|
815
815
|
switch (true) {
|
|
816
816
|
case datatype instanceof ResourcefulStringType: {
|
|
817
817
|
const d = datatype;
|
|
818
|
-
const r =
|
|
818
|
+
const r = Q_.string().min(d.minLength).max(d.maxLength);
|
|
819
819
|
if (d.pattern) {
|
|
820
820
|
r.pattern(new RegExp(d.pattern));
|
|
821
821
|
}
|
|
@@ -828,14 +828,14 @@ function withResourceful(options = {}) {
|
|
|
828
828
|
return r;
|
|
829
829
|
}
|
|
830
830
|
case datatype instanceof ResourcefulDateType: {
|
|
831
|
-
const r =
|
|
831
|
+
const r = Q_.date().iso();
|
|
832
832
|
if (nullable) {
|
|
833
833
|
r.allow(null);
|
|
834
834
|
}
|
|
835
835
|
return r;
|
|
836
836
|
}
|
|
837
837
|
case datatype instanceof ResourcefulDateTimeType: {
|
|
838
|
-
const r =
|
|
838
|
+
const r = Q_.date().iso();
|
|
839
839
|
if (nullable) {
|
|
840
840
|
r.allow(null);
|
|
841
841
|
}
|
|
@@ -843,7 +843,7 @@ function withResourceful(options = {}) {
|
|
|
843
843
|
}
|
|
844
844
|
case datatype instanceof ResourcefulBinaryType: {
|
|
845
845
|
const d = datatype;
|
|
846
|
-
const r =
|
|
846
|
+
const r = Q_.string();
|
|
847
847
|
if (nullable) {
|
|
848
848
|
r.allow(null);
|
|
849
849
|
}
|
|
@@ -857,7 +857,7 @@ function withResourceful(options = {}) {
|
|
|
857
857
|
}
|
|
858
858
|
case datatype instanceof ResourcefulNumberType: {
|
|
859
859
|
const d = datatype;
|
|
860
|
-
const r =
|
|
860
|
+
const r = Q_.number();
|
|
861
861
|
if (nullable) {
|
|
862
862
|
r.allow(null);
|
|
863
863
|
}
|
|
@@ -876,7 +876,7 @@ function withResourceful(options = {}) {
|
|
|
876
876
|
}
|
|
877
877
|
case datatype instanceof ResourcefulIntegerType: {
|
|
878
878
|
const d = datatype;
|
|
879
|
-
const r =
|
|
879
|
+
const r = Q_.number();
|
|
880
880
|
if (nullable) {
|
|
881
881
|
r.allow(null);
|
|
882
882
|
}
|
|
@@ -895,7 +895,7 @@ function withResourceful(options = {}) {
|
|
|
895
895
|
}
|
|
896
896
|
case datatype instanceof ResourcefulBigintType: {
|
|
897
897
|
const d = datatype;
|
|
898
|
-
const r =
|
|
898
|
+
const r = Q_.bigint();
|
|
899
899
|
if (nullable) {
|
|
900
900
|
r.allow(null);
|
|
901
901
|
}
|
|
@@ -914,7 +914,7 @@ function withResourceful(options = {}) {
|
|
|
914
914
|
}
|
|
915
915
|
case datatype instanceof ResourcefulUnsignedIntegerType: {
|
|
916
916
|
const d = datatype;
|
|
917
|
-
const r =
|
|
917
|
+
const r = Q_.number().unsafe();
|
|
918
918
|
if (nullable) {
|
|
919
919
|
r.allow(null);
|
|
920
920
|
}
|
|
@@ -932,7 +932,7 @@ function withResourceful(options = {}) {
|
|
|
932
932
|
return r;
|
|
933
933
|
}
|
|
934
934
|
case datatype instanceof ResourcefulBooleanType: {
|
|
935
|
-
const r =
|
|
935
|
+
const r = Q_.boolean();
|
|
936
936
|
if (nullable) {
|
|
937
937
|
r.allow(null);
|
|
938
938
|
}
|
|
@@ -952,7 +952,7 @@ function withResourceful(options = {}) {
|
|
|
952
952
|
!(item.readOnly || false)
|
|
953
953
|
)
|
|
954
954
|
);
|
|
955
|
-
propValidator =
|
|
955
|
+
propValidator = Q_.alternatives().try(...alternatives);
|
|
956
956
|
} else if ("allOf" in propDef) {
|
|
957
957
|
const schemas = propDef.allOf.map(
|
|
958
958
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -962,7 +962,7 @@ function withResourceful(options = {}) {
|
|
|
962
962
|
!(item.readOnly || false)
|
|
963
963
|
)
|
|
964
964
|
);
|
|
965
|
-
propValidator = schemas.reduce((acc, schema) => acc.concat(schema),
|
|
965
|
+
propValidator = schemas.reduce((acc, schema) => acc.concat(schema), Q_.any());
|
|
966
966
|
} else if ("anyOf" in propDef) {
|
|
967
967
|
const alternatives = propDef.anyOf.map(
|
|
968
968
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -972,7 +972,7 @@ function withResourceful(options = {}) {
|
|
|
972
972
|
!(item.readOnly || false)
|
|
973
973
|
)
|
|
974
974
|
);
|
|
975
|
-
propValidator =
|
|
975
|
+
propValidator = Q_.alternatives().try(...alternatives);
|
|
976
976
|
} else if ("not" in propDef) {
|
|
977
977
|
const notSchemas = propDef.not.map(
|
|
978
978
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -982,7 +982,7 @@ function withResourceful(options = {}) {
|
|
|
982
982
|
!(item.readOnly || false)
|
|
983
983
|
)
|
|
984
984
|
);
|
|
985
|
-
propValidator =
|
|
985
|
+
propValidator = Q_.any().not(...notSchemas);
|
|
986
986
|
} else {
|
|
987
987
|
propValidator = this.$getPropertyBaseValidator(
|
|
988
988
|
propDef,
|
|
@@ -996,7 +996,7 @@ function withResourceful(options = {}) {
|
|
|
996
996
|
}
|
|
997
997
|
objectSchema[propKey] = propValidator;
|
|
998
998
|
});
|
|
999
|
-
const r =
|
|
999
|
+
const r = Q_.object(objectSchema);
|
|
1000
1000
|
if (nullable) {
|
|
1001
1001
|
r.allow(null);
|
|
1002
1002
|
}
|
|
@@ -1009,7 +1009,7 @@ function withResourceful(options = {}) {
|
|
|
1009
1009
|
if (isObject$1(d.additionalProperties)) {
|
|
1010
1010
|
const additionalPropertiesType = d.additionalProperties;
|
|
1011
1011
|
r.pattern(
|
|
1012
|
-
|
|
1012
|
+
Q_.string(),
|
|
1013
1013
|
this.$getPropertyBaseValidator(
|
|
1014
1014
|
additionalPropertiesType,
|
|
1015
1015
|
additionalPropertiesType.nullable || false,
|
|
@@ -1024,7 +1024,7 @@ function withResourceful(options = {}) {
|
|
|
1024
1024
|
}
|
|
1025
1025
|
case datatype instanceof ResourcefulArrayType: {
|
|
1026
1026
|
const d = datatype;
|
|
1027
|
-
const r =
|
|
1027
|
+
const r = Q_.array();
|
|
1028
1028
|
if (nullable) {
|
|
1029
1029
|
r.allow(null);
|
|
1030
1030
|
}
|
|
@@ -1038,7 +1038,7 @@ function withResourceful(options = {}) {
|
|
|
1038
1038
|
!(item.readOnly || false)
|
|
1039
1039
|
)
|
|
1040
1040
|
);
|
|
1041
|
-
itemValidator =
|
|
1041
|
+
itemValidator = Q_.alternatives().try(...alternatives);
|
|
1042
1042
|
} else if ("allOf" in d.items) {
|
|
1043
1043
|
const schemas = d.items.allOf.map(
|
|
1044
1044
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -1048,7 +1048,7 @@ function withResourceful(options = {}) {
|
|
|
1048
1048
|
!(item.readOnly || false)
|
|
1049
1049
|
)
|
|
1050
1050
|
);
|
|
1051
|
-
itemValidator = schemas.reduce((acc, schema) => acc.concat(schema),
|
|
1051
|
+
itemValidator = schemas.reduce((acc, schema) => acc.concat(schema), Q_.any());
|
|
1052
1052
|
} else if ("anyOf" in d.items) {
|
|
1053
1053
|
const alternatives = d.items.anyOf.map(
|
|
1054
1054
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -1058,7 +1058,7 @@ function withResourceful(options = {}) {
|
|
|
1058
1058
|
!(item.readOnly || false)
|
|
1059
1059
|
)
|
|
1060
1060
|
);
|
|
1061
|
-
itemValidator =
|
|
1061
|
+
itemValidator = Q_.alternatives().try(...alternatives);
|
|
1062
1062
|
} else if ("not" in d.items) {
|
|
1063
1063
|
const notSchemas = d.items.not.map(
|
|
1064
1064
|
(item) => this.$getPropertyBaseValidator(
|
|
@@ -1068,7 +1068,7 @@ function withResourceful(options = {}) {
|
|
|
1068
1068
|
!(item.readOnly || false)
|
|
1069
1069
|
)
|
|
1070
1070
|
);
|
|
1071
|
-
itemValidator =
|
|
1071
|
+
itemValidator = Q_.any().not(...notSchemas);
|
|
1072
1072
|
} else {
|
|
1073
1073
|
itemValidator = this.$getPropertyBaseValidator(
|
|
1074
1074
|
d.items,
|
|
@@ -1090,7 +1090,7 @@ function withResourceful(options = {}) {
|
|
|
1090
1090
|
return r;
|
|
1091
1091
|
}
|
|
1092
1092
|
default:
|
|
1093
|
-
return
|
|
1093
|
+
return Q_.any().forbidden();
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
1096
|
static async $getPropertyCanReadWrite(ctx, app, key, lucidDefinition, readAclFilters = [], writeAclFilters = [], kind, writable = false) {
|
|
@@ -1192,7 +1192,6 @@ function withResourceful(options = {}) {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
static $resourcefulModelColumnMetaToOpenApiSchema(propertyKey, propertyMeta) {
|
|
1194
1194
|
const ret = stripUndefinedValuesFromObject({
|
|
1195
|
-
type: propertyMeta.definition.type,
|
|
1196
1195
|
items: propertyMeta.definition.items,
|
|
1197
1196
|
title: getFieldKey(propertyKey, propertyMeta.lucidDefinitions) || propertyKey,
|
|
1198
1197
|
description: propertyMeta.definition.description,
|
|
@@ -1223,13 +1222,13 @@ function withResourceful(options = {}) {
|
|
|
1223
1222
|
readOnly: propertyMeta.canRead && !propertyMeta.canWrite,
|
|
1224
1223
|
writeOnly: !propertyMeta.canRead && propertyMeta.canWrite,
|
|
1225
1224
|
externalDocs: propertyMeta.definition.externalDocs,
|
|
1226
|
-
example: propertyMeta.definition.example
|
|
1225
|
+
example: propertyMeta.definition.example,
|
|
1226
|
+
...propertyMeta.definition.type
|
|
1227
1227
|
});
|
|
1228
1228
|
return ret;
|
|
1229
1229
|
}
|
|
1230
1230
|
static $resourcefulModelComputedAccessorMetaToOpenApiSchema(propertyKey, propertyMeta) {
|
|
1231
1231
|
const ret = stripUndefinedValuesFromObject({
|
|
1232
|
-
type: propertyMeta.definition.type,
|
|
1233
1232
|
items: propertyMeta.definition.items,
|
|
1234
1233
|
title: getFieldKey(propertyKey, propertyMeta.lucidDefinitions) || propertyKey,
|
|
1235
1234
|
description: propertyMeta.definition.description,
|
|
@@ -1260,7 +1259,8 @@ function withResourceful(options = {}) {
|
|
|
1260
1259
|
readOnly: propertyMeta.canRead && !propertyMeta.canWrite,
|
|
1261
1260
|
writeOnly: !propertyMeta.canRead && propertyMeta.canWrite,
|
|
1262
1261
|
externalDocs: propertyMeta.definition.externalDocs,
|
|
1263
|
-
example: propertyMeta.definition.example
|
|
1262
|
+
example: propertyMeta.definition.example,
|
|
1263
|
+
...propertyMeta.definition.type
|
|
1264
1264
|
});
|
|
1265
1265
|
return ret;
|
|
1266
1266
|
}
|
|
@@ -1443,7 +1443,7 @@ function withResourceful(options = {}) {
|
|
|
1443
1443
|
static $resourcefulGetQueryBuilder() {
|
|
1444
1444
|
return this.$adapter.modelConstructorClient(this).query().from(this.table);
|
|
1445
1445
|
}
|
|
1446
|
-
static async $onResourcefulIndex(filter, page, perPage, fields, ctx, app, hooks = []) {
|
|
1446
|
+
static async $onResourcefulIndex(filter, page, perPage, fields, sort, ctx, app, hooks = []) {
|
|
1447
1447
|
var _a2;
|
|
1448
1448
|
const primaryKey = this.$getPrivateKeyAttribute();
|
|
1449
1449
|
if (!primaryKey) {
|
|
@@ -1465,11 +1465,11 @@ function withResourceful(options = {}) {
|
|
|
1465
1465
|
if (possibleFields.length === 0) {
|
|
1466
1466
|
throw new E_INVALID_COLUMN_ACCESS("No fields available for access");
|
|
1467
1467
|
}
|
|
1468
|
-
const schema =
|
|
1469
|
-
filter:
|
|
1470
|
-
page:
|
|
1471
|
-
perPage:
|
|
1472
|
-
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()
|
|
1473
1473
|
});
|
|
1474
1474
|
const { error: methodValidationError, value: validatedMethodOptions } = schema.validate(
|
|
1475
1475
|
{
|
|
@@ -1504,6 +1504,13 @@ function withResourceful(options = {}) {
|
|
|
1504
1504
|
const recordsQuery = query.clone();
|
|
1505
1505
|
countQuery.count("*", "total");
|
|
1506
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
|
+
}
|
|
1507
1514
|
const countQueryQuery = countQuery.toQuery();
|
|
1508
1515
|
const recordsQueryQuery = recordsQuery.toQuery();
|
|
1509
1516
|
const [countResults, rawRecords] = await Promise.all([countQuery, recordsQuery]);
|
|
@@ -11800,25 +11807,25 @@ const validateNormalizeAndCastDecoratorOptions = (fieldName, decoratorName, sche
|
|
|
11800
11807
|
}
|
|
11801
11808
|
return value;
|
|
11802
11809
|
};
|
|
11803
|
-
const resourcefulPropertyDefinitionSchema =
|
|
11804
|
-
propertyKey:
|
|
11805
|
-
readAccessControlFilters:
|
|
11806
|
-
writeAccessControlFilters:
|
|
11807
|
-
nullable:
|
|
11808
|
-
description:
|
|
11809
|
-
default:
|
|
11810
|
-
externalDocs:
|
|
11811
|
-
description:
|
|
11812
|
-
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()
|
|
11813
11820
|
}).optional(),
|
|
11814
|
-
example:
|
|
11815
|
-
deprecated:
|
|
11821
|
+
example: Q_.string().optional(),
|
|
11822
|
+
deprecated: Q_.boolean().default(false)
|
|
11816
11823
|
});
|
|
11817
11824
|
const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
|
|
11818
11825
|
return [
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
11826
|
+
Q_.object().instance(Ctor),
|
|
11827
|
+
Q_.function().instance(Ctor),
|
|
11828
|
+
Q_.custom((value, helpers) => {
|
|
11822
11829
|
if (isObject$1(value) && value.constructor.name === CtorName) {
|
|
11823
11830
|
return value;
|
|
11824
11831
|
}
|
|
@@ -11826,7 +11833,7 @@ const joiInstanceCheckerAlternativesFactory = (Ctor, CtorName) => {
|
|
|
11826
11833
|
})
|
|
11827
11834
|
];
|
|
11828
11835
|
};
|
|
11829
|
-
const resourcefulDataTypeSchema =
|
|
11836
|
+
const resourcefulDataTypeSchema = Q_.alternatives(
|
|
11830
11837
|
...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType"),
|
|
11831
11838
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType"),
|
|
11832
11839
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType"),
|
|
@@ -11845,95 +11852,95 @@ const resourcefulDataTypeSchema = joi.alternatives(
|
|
|
11845
11852
|
const localResourcefulPropertyDefinitionSchema = resourcefulPropertyDefinitionSchema.keys({
|
|
11846
11853
|
type: resourcefulDataTypeSchema.required()
|
|
11847
11854
|
});
|
|
11848
|
-
const resourcefulColumnOptionsSchema =
|
|
11855
|
+
const resourcefulColumnOptionsSchema = Q_.object({
|
|
11849
11856
|
// Lucid ColumnOptions (partial)
|
|
11850
|
-
columnName:
|
|
11851
|
-
serializeAs:
|
|
11852
|
-
serialize:
|
|
11853
|
-
consume:
|
|
11854
|
-
prepare:
|
|
11855
|
-
meta:
|
|
11856
|
-
isPrimary:
|
|
11857
|
-
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),
|
|
11858
11865
|
// Resourceful options
|
|
11859
|
-
propertyKey:
|
|
11860
|
-
readAccessControlFilters:
|
|
11861
|
-
writeAccessControlFilters:
|
|
11862
|
-
nullable:
|
|
11863
|
-
description:
|
|
11864
|
-
default:
|
|
11865
|
-
externalDocs:
|
|
11866
|
-
description:
|
|
11867
|
-
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()
|
|
11868
11875
|
}).optional(),
|
|
11869
|
-
example:
|
|
11870
|
-
deprecated:
|
|
11876
|
+
example: Q_.string().optional(),
|
|
11877
|
+
deprecated: Q_.boolean().default(false),
|
|
11871
11878
|
type: resourcefulDataTypeSchema.required()
|
|
11872
11879
|
});
|
|
11873
|
-
const dataTypeColumnOptionsSchema =
|
|
11880
|
+
const dataTypeColumnOptionsSchema = Q_.object({
|
|
11874
11881
|
// Lucid ColumnOptions (partial) - excluding 'prepare' and 'consume'
|
|
11875
|
-
columnName:
|
|
11876
|
-
serializeAs:
|
|
11877
|
-
serialize:
|
|
11878
|
-
meta:
|
|
11879
|
-
isPrimary:
|
|
11880
|
-
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),
|
|
11881
11888
|
// Resourceful options
|
|
11882
|
-
propertyKey:
|
|
11883
|
-
readAccessControlFilters:
|
|
11884
|
-
writeAccessControlFilters:
|
|
11885
|
-
nullable:
|
|
11886
|
-
description:
|
|
11887
|
-
default:
|
|
11888
|
-
externalDocs:
|
|
11889
|
-
description:
|
|
11890
|
-
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()
|
|
11891
11898
|
}).optional(),
|
|
11892
|
-
example:
|
|
11893
|
-
deprecated:
|
|
11899
|
+
example: Q_.string().optional(),
|
|
11900
|
+
deprecated: Q_.boolean().default(false),
|
|
11894
11901
|
type: resourcefulDataTypeSchema.optional()
|
|
11895
11902
|
});
|
|
11896
11903
|
const baseDateColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11897
|
-
autoCreate:
|
|
11898
|
-
autoUpdate:
|
|
11904
|
+
autoCreate: Q_.boolean().default(false),
|
|
11905
|
+
autoUpdate: Q_.boolean().default(false)
|
|
11899
11906
|
});
|
|
11900
11907
|
const stringColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11901
|
-
type:
|
|
11908
|
+
type: Q_.alternatives(
|
|
11902
11909
|
...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType")
|
|
11903
11910
|
).default(() => new ResourcefulStringType())
|
|
11904
11911
|
});
|
|
11905
11912
|
const dateColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
|
|
11906
|
-
type:
|
|
11913
|
+
type: Q_.alternatives(
|
|
11907
11914
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType")
|
|
11908
11915
|
).default(() => new ResourcefulDateType())
|
|
11909
11916
|
});
|
|
11910
11917
|
const dateTimeColumnOptionsSchema = baseDateColumnOptionsSchema.keys({
|
|
11911
|
-
type:
|
|
11918
|
+
type: Q_.alternatives(
|
|
11912
11919
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType")
|
|
11913
11920
|
).default(() => new ResourcefulDateTimeType())
|
|
11914
11921
|
});
|
|
11915
11922
|
const binaryColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11916
|
-
type:
|
|
11923
|
+
type: Q_.alternatives(
|
|
11917
11924
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBinaryType, "ResourcefulBinaryType")
|
|
11918
11925
|
).default(() => new ResourcefulBinaryType())
|
|
11919
11926
|
});
|
|
11920
11927
|
const numberColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11921
|
-
type:
|
|
11928
|
+
type: Q_.alternatives(
|
|
11922
11929
|
...joiInstanceCheckerAlternativesFactory(ResourcefulNumberType, "ResourcefulNumberType")
|
|
11923
11930
|
).default(() => new ResourcefulNumberType())
|
|
11924
11931
|
});
|
|
11925
11932
|
const integerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11926
|
-
type:
|
|
11933
|
+
type: Q_.alternatives(
|
|
11927
11934
|
...joiInstanceCheckerAlternativesFactory(ResourcefulIntegerType, "ResourcefulIntegerType")
|
|
11928
11935
|
).default(() => new ResourcefulIntegerType())
|
|
11929
11936
|
});
|
|
11930
11937
|
const bigintColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11931
|
-
type:
|
|
11938
|
+
type: Q_.alternatives(
|
|
11932
11939
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBigintType, "ResourcefulBigintType")
|
|
11933
11940
|
).default(() => new ResourcefulBigintType())
|
|
11934
11941
|
});
|
|
11935
11942
|
const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11936
|
-
type:
|
|
11943
|
+
type: Q_.alternatives(
|
|
11937
11944
|
...joiInstanceCheckerAlternativesFactory(
|
|
11938
11945
|
ResourcefulUnsignedIntegerType,
|
|
11939
11946
|
"ResourcefulUnsignedIntegerType"
|
|
@@ -11941,148 +11948,148 @@ const unsignedIntegerColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
|
11941
11948
|
).default(() => new ResourcefulUnsignedIntegerType())
|
|
11942
11949
|
});
|
|
11943
11950
|
const booleanColumnOptionsSchema = dataTypeColumnOptionsSchema.keys({
|
|
11944
|
-
type:
|
|
11951
|
+
type: Q_.alternatives(
|
|
11945
11952
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBooleanType, "ResourcefulBooleanType")
|
|
11946
11953
|
).default(() => new ResourcefulBooleanType())
|
|
11947
11954
|
});
|
|
11948
|
-
const objectColumnOptionsSchema =
|
|
11955
|
+
const objectColumnOptionsSchema = Q_.object({
|
|
11949
11956
|
// Lucid ColumnOptions (full)
|
|
11950
|
-
columnName:
|
|
11951
|
-
serializeAs:
|
|
11952
|
-
serialize:
|
|
11953
|
-
consume:
|
|
11954
|
-
prepare:
|
|
11955
|
-
meta:
|
|
11956
|
-
isPrimary:
|
|
11957
|
-
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),
|
|
11958
11965
|
// Resourceful options
|
|
11959
|
-
propertyKey:
|
|
11960
|
-
readAccessControlFilters:
|
|
11961
|
-
writeAccessControlFilters:
|
|
11962
|
-
nullable:
|
|
11963
|
-
description:
|
|
11964
|
-
default:
|
|
11965
|
-
externalDocs:
|
|
11966
|
-
description:
|
|
11967
|
-
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()
|
|
11968
11975
|
}).optional(),
|
|
11969
|
-
example:
|
|
11970
|
-
deprecated:
|
|
11971
|
-
type:
|
|
11976
|
+
example: Q_.string().optional(),
|
|
11977
|
+
deprecated: Q_.boolean().default(false),
|
|
11978
|
+
type: Q_.alternatives(
|
|
11972
11979
|
...joiInstanceCheckerAlternativesFactory(ResourcefulObjectType, "ResourcefulObjectType")
|
|
11973
11980
|
).default(() => new ResourcefulObjectType())
|
|
11974
11981
|
});
|
|
11975
|
-
const arrayColumnOptionsSchema =
|
|
11982
|
+
const arrayColumnOptionsSchema = Q_.object({
|
|
11976
11983
|
// Lucid ColumnOptions (full)
|
|
11977
|
-
columnName:
|
|
11978
|
-
serializeAs:
|
|
11979
|
-
serialize:
|
|
11980
|
-
consume:
|
|
11981
|
-
prepare:
|
|
11982
|
-
meta:
|
|
11983
|
-
isPrimary:
|
|
11984
|
-
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),
|
|
11985
11992
|
// Resourceful options
|
|
11986
|
-
propertyKey:
|
|
11987
|
-
readAccessControlFilters:
|
|
11988
|
-
writeAccessControlFilters:
|
|
11989
|
-
nullable:
|
|
11990
|
-
description:
|
|
11991
|
-
default:
|
|
11992
|
-
externalDocs:
|
|
11993
|
-
description:
|
|
11994
|
-
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()
|
|
11995
12002
|
}).optional(),
|
|
11996
|
-
example:
|
|
11997
|
-
deprecated:
|
|
11998
|
-
type:
|
|
12003
|
+
example: Q_.string().optional(),
|
|
12004
|
+
deprecated: Q_.boolean().default(false),
|
|
12005
|
+
type: Q_.alternatives(
|
|
11999
12006
|
...joiInstanceCheckerAlternativesFactory(ResourcefulArrayType, "ResourcefulArrayType")
|
|
12000
12007
|
).default(() => new ResourcefulArrayType())
|
|
12001
12008
|
});
|
|
12002
12009
|
localResourcefulPropertyDefinitionSchema.append({
|
|
12003
|
-
writable:
|
|
12010
|
+
writable: Q_.boolean().default(false)
|
|
12004
12011
|
});
|
|
12005
|
-
const resourcefulComputedOptionsSchema =
|
|
12012
|
+
const resourcefulComputedOptionsSchema = Q_.object({
|
|
12006
12013
|
// Lucid ComputedOptions (partial)
|
|
12007
|
-
serializeAs:
|
|
12008
|
-
serialize:
|
|
12009
|
-
meta:
|
|
12014
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12015
|
+
serialize: Q_.function().optional(),
|
|
12016
|
+
meta: Q_.object().optional(),
|
|
12010
12017
|
// Resourceful options
|
|
12011
|
-
propertyKey:
|
|
12012
|
-
readAccessControlFilters:
|
|
12013
|
-
writeAccessControlFilters:
|
|
12014
|
-
nullable:
|
|
12015
|
-
description:
|
|
12016
|
-
default:
|
|
12017
|
-
externalDocs:
|
|
12018
|
-
description:
|
|
12019
|
-
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()
|
|
12020
12027
|
}).optional(),
|
|
12021
|
-
example:
|
|
12022
|
-
deprecated:
|
|
12028
|
+
example: Q_.string().optional(),
|
|
12029
|
+
deprecated: Q_.boolean().default(false),
|
|
12023
12030
|
type: resourcefulDataTypeSchema.required()
|
|
12024
12031
|
});
|
|
12025
|
-
const dataTypeComputedOptionsSchema =
|
|
12032
|
+
const dataTypeComputedOptionsSchema = Q_.object({
|
|
12026
12033
|
// Lucid ComputedOptions (partial) - excluding 'prepare' and 'consume'
|
|
12027
|
-
serializeAs:
|
|
12028
|
-
serialize:
|
|
12029
|
-
meta:
|
|
12034
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12035
|
+
serialize: Q_.function().optional(),
|
|
12036
|
+
meta: Q_.object().optional(),
|
|
12030
12037
|
// Resourceful options
|
|
12031
|
-
propertyKey:
|
|
12032
|
-
readAccessControlFilters:
|
|
12033
|
-
writeAccessControlFilters:
|
|
12034
|
-
nullable:
|
|
12035
|
-
description:
|
|
12036
|
-
default:
|
|
12037
|
-
externalDocs:
|
|
12038
|
-
description:
|
|
12039
|
-
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()
|
|
12040
12047
|
}).optional(),
|
|
12041
|
-
example:
|
|
12042
|
-
deprecated:
|
|
12048
|
+
example: Q_.string().optional(),
|
|
12049
|
+
deprecated: Q_.boolean().default(false),
|
|
12043
12050
|
type: resourcefulDataTypeSchema.optional()
|
|
12044
12051
|
});
|
|
12045
12052
|
const baseDateComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12046
|
-
autoCreate:
|
|
12047
|
-
autoUpdate:
|
|
12053
|
+
autoCreate: Q_.boolean().default(false),
|
|
12054
|
+
autoUpdate: Q_.boolean().default(false)
|
|
12048
12055
|
});
|
|
12049
12056
|
const stringComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12050
|
-
type:
|
|
12057
|
+
type: Q_.alternatives(
|
|
12051
12058
|
...joiInstanceCheckerAlternativesFactory(ResourcefulStringType, "ResourcefulStringType")
|
|
12052
12059
|
).default(() => new ResourcefulStringType())
|
|
12053
12060
|
});
|
|
12054
12061
|
const dateComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
|
|
12055
|
-
type:
|
|
12062
|
+
type: Q_.alternatives(
|
|
12056
12063
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateType, "ResourcefulDateType")
|
|
12057
12064
|
).default(() => new ResourcefulDateType())
|
|
12058
12065
|
});
|
|
12059
12066
|
const dateTimeComputedOptionsSchema = baseDateComputedOptionsSchema.keys({
|
|
12060
|
-
type:
|
|
12067
|
+
type: Q_.alternatives(
|
|
12061
12068
|
...joiInstanceCheckerAlternativesFactory(ResourcefulDateTimeType, "ResourcefulDateTimeType")
|
|
12062
12069
|
).default(() => new ResourcefulDateTimeType())
|
|
12063
12070
|
});
|
|
12064
12071
|
const binaryComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12065
|
-
type:
|
|
12072
|
+
type: Q_.alternatives(
|
|
12066
12073
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBinaryType, "ResourcefulBinaryType")
|
|
12067
12074
|
).default(() => new ResourcefulBinaryType())
|
|
12068
12075
|
});
|
|
12069
12076
|
const numberComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12070
|
-
type:
|
|
12077
|
+
type: Q_.alternatives(
|
|
12071
12078
|
...joiInstanceCheckerAlternativesFactory(ResourcefulNumberType, "ResourcefulNumberType")
|
|
12072
12079
|
).default(() => new ResourcefulNumberType())
|
|
12073
12080
|
});
|
|
12074
12081
|
const integerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12075
|
-
type:
|
|
12082
|
+
type: Q_.alternatives(
|
|
12076
12083
|
...joiInstanceCheckerAlternativesFactory(ResourcefulIntegerType, "ResourcefulIntegerType")
|
|
12077
12084
|
).default(() => new ResourcefulIntegerType())
|
|
12078
12085
|
});
|
|
12079
12086
|
const bigintComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12080
|
-
type:
|
|
12087
|
+
type: Q_.alternatives(
|
|
12081
12088
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBigintType, "ResourcefulBigintType")
|
|
12082
12089
|
).default(() => new ResourcefulBigintType())
|
|
12083
12090
|
});
|
|
12084
12091
|
const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12085
|
-
type:
|
|
12092
|
+
type: Q_.alternatives(
|
|
12086
12093
|
...joiInstanceCheckerAlternativesFactory(
|
|
12087
12094
|
ResourcefulUnsignedIntegerType,
|
|
12088
12095
|
"ResourcefulUnsignedIntegerType"
|
|
@@ -12090,99 +12097,99 @@ const unsignedIntegerComputedOptionsSchema = dataTypeComputedOptionsSchema.keys(
|
|
|
12090
12097
|
).default(() => new ResourcefulUnsignedIntegerType())
|
|
12091
12098
|
});
|
|
12092
12099
|
const booleanComputedOptionsSchema = dataTypeComputedOptionsSchema.keys({
|
|
12093
|
-
type:
|
|
12100
|
+
type: Q_.alternatives(
|
|
12094
12101
|
...joiInstanceCheckerAlternativesFactory(ResourcefulBooleanType, "ResourcefulBooleanType")
|
|
12095
12102
|
).default(() => new ResourcefulBooleanType())
|
|
12096
12103
|
});
|
|
12097
|
-
const objectComputedOptionsSchema =
|
|
12104
|
+
const objectComputedOptionsSchema = Q_.object({
|
|
12098
12105
|
// Lucid ComputedOptions (full)
|
|
12099
|
-
serializeAs:
|
|
12100
|
-
serialize:
|
|
12101
|
-
meta:
|
|
12106
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12107
|
+
serialize: Q_.function().optional(),
|
|
12108
|
+
meta: Q_.object().optional(),
|
|
12102
12109
|
// Resourceful options
|
|
12103
|
-
propertyKey:
|
|
12104
|
-
readAccessControlFilters:
|
|
12105
|
-
writeAccessControlFilters:
|
|
12106
|
-
nullable:
|
|
12107
|
-
description:
|
|
12108
|
-
default:
|
|
12109
|
-
externalDocs:
|
|
12110
|
-
description:
|
|
12111
|
-
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()
|
|
12112
12119
|
}).optional(),
|
|
12113
|
-
example:
|
|
12114
|
-
deprecated:
|
|
12115
|
-
type:
|
|
12120
|
+
example: Q_.string().optional(),
|
|
12121
|
+
deprecated: Q_.boolean().default(false),
|
|
12122
|
+
type: Q_.alternatives(
|
|
12116
12123
|
...joiInstanceCheckerAlternativesFactory(ResourcefulObjectType, "ResourcefulObjectType")
|
|
12117
12124
|
).default(() => new ResourcefulObjectType())
|
|
12118
12125
|
});
|
|
12119
|
-
const arrayComputedOptionsSchema =
|
|
12126
|
+
const arrayComputedOptionsSchema = Q_.object({
|
|
12120
12127
|
// Lucid ComputedOptions (full)
|
|
12121
|
-
serializeAs:
|
|
12122
|
-
serialize:
|
|
12123
|
-
meta:
|
|
12128
|
+
serializeAs: Q_.alternatives().try(Q_.string(), Q_.valid(null)).optional(),
|
|
12129
|
+
serialize: Q_.function().optional(),
|
|
12130
|
+
meta: Q_.object().optional(),
|
|
12124
12131
|
// Resourceful options
|
|
12125
|
-
propertyKey:
|
|
12126
|
-
readAccessControlFilters:
|
|
12127
|
-
writeAccessControlFilters:
|
|
12128
|
-
nullable:
|
|
12129
|
-
description:
|
|
12130
|
-
default:
|
|
12131
|
-
externalDocs:
|
|
12132
|
-
description:
|
|
12133
|
-
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()
|
|
12134
12141
|
}).optional(),
|
|
12135
|
-
example:
|
|
12136
|
-
deprecated:
|
|
12137
|
-
type:
|
|
12142
|
+
example: Q_.string().optional(),
|
|
12143
|
+
deprecated: Q_.boolean().default(false),
|
|
12144
|
+
type: Q_.alternatives(
|
|
12138
12145
|
...joiInstanceCheckerAlternativesFactory(ResourcefulArrayType, "ResourcefulArrayType")
|
|
12139
12146
|
).default(() => new ResourcefulArrayType())
|
|
12140
12147
|
});
|
|
12141
|
-
const resourcefulRelationshipOptionsSchema =
|
|
12148
|
+
const resourcefulRelationshipOptionsSchema = Q_.object({
|
|
12142
12149
|
// Resourceful options
|
|
12143
|
-
propertyKey:
|
|
12144
|
-
readAccessControlFilters:
|
|
12145
|
-
writeAccessControlFilters:
|
|
12146
|
-
nullable:
|
|
12147
|
-
description:
|
|
12148
|
-
default:
|
|
12149
|
-
externalDocs:
|
|
12150
|
-
description:
|
|
12151
|
-
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()
|
|
12152
12159
|
}).optional(),
|
|
12153
|
-
example:
|
|
12154
|
-
deprecated:
|
|
12160
|
+
example: Q_.string().optional(),
|
|
12161
|
+
deprecated: Q_.boolean().default(false)
|
|
12155
12162
|
});
|
|
12156
12163
|
const relationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12157
12164
|
// Lucid RelationOptions
|
|
12158
|
-
localKey:
|
|
12159
|
-
foreignKey:
|
|
12160
|
-
serializeAs:
|
|
12161
|
-
onQuery:
|
|
12162
|
-
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()
|
|
12163
12170
|
});
|
|
12164
12171
|
const manyToManyRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12165
12172
|
// Lucid ManyToManyRelationOptions
|
|
12166
|
-
localKey:
|
|
12167
|
-
relatedKey:
|
|
12168
|
-
pivotForeignKey:
|
|
12169
|
-
pivotRelatedForeignKey:
|
|
12170
|
-
pivotTable:
|
|
12171
|
-
pivotTimestamps:
|
|
12172
|
-
pivotColumns:
|
|
12173
|
-
serializeAs:
|
|
12174
|
-
onQuery:
|
|
12175
|
-
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()
|
|
12176
12183
|
});
|
|
12177
12184
|
const hasManyThroughRelationOptionsSchema = resourcefulRelationshipOptionsSchema.keys({
|
|
12178
12185
|
// Lucid HasManyThroughRelationOptions (ThroughRelationOptions without throughModel)
|
|
12179
|
-
localKey:
|
|
12180
|
-
foreignKey:
|
|
12181
|
-
throughLocalKey:
|
|
12182
|
-
throughForeignKey:
|
|
12183
|
-
serializeAs:
|
|
12184
|
-
onQuery:
|
|
12185
|
-
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()
|
|
12186
12193
|
});
|
|
12187
12194
|
const extractLucidOptionsForLucidDecorator = (options, keys, overrides) => {
|
|
12188
12195
|
const extracted = {};
|
|
@@ -12737,7 +12744,7 @@ function resourcefulHasManyThrough(model, options = {}) {
|
|
|
12737
12744
|
map.set(propertyKey, opts);
|
|
12738
12745
|
};
|
|
12739
12746
|
}
|
|
12740
|
-
const version = "1.
|
|
12747
|
+
const version = "1.20250724.0";
|
|
12741
12748
|
export {
|
|
12742
12749
|
k as definitions,
|
|
12743
12750
|
w as errors,
|