@maioradv/nestjs-core 2.3.3 → 2.3.4
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.
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
export declare const IsMetafieldClause: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
2
2
|
export declare const IsTranslationClause: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
3
|
-
declare const METADATA_OPERATORS: readonly ["equals", "not", "gt", "gte", "lt", "lte", "string_contains", "string_starts_with", "string_ends_with", "array_contains"];
|
|
4
|
-
export type MetadataOperator = typeof METADATA_OPERATORS[number];
|
|
5
|
-
export type MetadataFilter = {
|
|
6
|
-
path: string[];
|
|
7
|
-
operator: MetadataOperator;
|
|
8
|
-
value: null | string | boolean | number;
|
|
9
|
-
};
|
|
10
3
|
export declare const IsMetadataClause: () => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
11
|
-
export {};
|
|
@@ -5,6 +5,7 @@ const common_1 = require("@nestjs/common");
|
|
|
5
5
|
const swagger_1 = require("@nestjs/swagger");
|
|
6
6
|
const class_transformer_1 = require("class-transformer");
|
|
7
7
|
const class_validator_1 = require("class-validator");
|
|
8
|
+
const types_1 = require("@maioradv/types");
|
|
8
9
|
const IsMetafieldClause = () => {
|
|
9
10
|
return (0, common_1.applyDecorators)((0, swagger_1.ApiPropertyOptional)({
|
|
10
11
|
type: String,
|
|
@@ -48,19 +49,7 @@ const parseValue = (raw) => {
|
|
|
48
49
|
return num;
|
|
49
50
|
return trimmed;
|
|
50
51
|
};
|
|
51
|
-
const
|
|
52
|
-
'equals',
|
|
53
|
-
'not',
|
|
54
|
-
'gt',
|
|
55
|
-
'gte',
|
|
56
|
-
'lt',
|
|
57
|
-
'lte',
|
|
58
|
-
'string_contains',
|
|
59
|
-
'string_starts_with',
|
|
60
|
-
'string_ends_with',
|
|
61
|
-
'array_contains'
|
|
62
|
-
];
|
|
63
|
-
const allowedOperators = new Set(METADATA_OPERATORS);
|
|
52
|
+
const allowedOperators = new Set(types_1.MetadataOperators);
|
|
64
53
|
const getMetadataClauseErrors = (item, index, property) => {
|
|
65
54
|
if (!item)
|
|
66
55
|
return [`${property}[${index}] is invalid`];
|
|
@@ -70,7 +59,7 @@ const getMetadataClauseErrors = (item, index, property) => {
|
|
|
70
59
|
if (!hasPath)
|
|
71
60
|
errors.push(`${property}[${index}].path must not be empty`);
|
|
72
61
|
if (!allowedOperators.has(item.operator)) {
|
|
73
|
-
errors.push(`${property}[${index}].operator must be one of: ${
|
|
62
|
+
errors.push(`${property}[${index}].operator must be one of: ${types_1.MetadataOperators.join(', ')}`);
|
|
74
63
|
}
|
|
75
64
|
if (!hasValue)
|
|
76
65
|
errors.push(`${property}[${index}].value must not be empty`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maioradv/nestjs-core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "NestJS helpers by MaiorADV",
|
|
5
5
|
"repository": "https://github.com/maioradv/nestjs-core.git",
|
|
6
6
|
"author": "Maior ADV Srl",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@aws-sdk/client-s3": "^3",
|
|
21
21
|
"@maioradv/accounts-lib": "^1.5.5",
|
|
22
22
|
"@maioradv/notifications-lib": "^1.0.8",
|
|
23
|
+
"@maioradv/types": "^0.0.7",
|
|
23
24
|
"@nestjs/cache-manager": "^3",
|
|
24
25
|
"@nestjs/common": "^11",
|
|
25
26
|
"@nestjs/config": "^4",
|