@platecms/delta-validation 0.1.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/README.md +155 -0
- package/package.json +29 -0
- package/src/index.d.ts +26 -0
- package/src/index.js +30 -0
- package/src/index.js.map +1 -0
- package/src/lib/content-validation-error.serializer.d.ts +7 -0
- package/src/lib/content-validation-error.serializer.js +30 -0
- package/src/lib/content-validation-error.serializer.js.map +1 -0
- package/src/lib/errors/content-validation-error-detail.d.ts +6 -0
- package/src/lib/errors/content-validation-error-detail.js +19 -0
- package/src/lib/errors/content-validation-error-detail.js.map +1 -0
- package/src/lib/errors/content-validation-error.d.ts +9 -0
- package/src/lib/errors/content-validation-error.js +24 -0
- package/src/lib/errors/content-validation-error.js.map +1 -0
- package/src/lib/errors/validation-error-detail.d.ts +4 -0
- package/src/lib/errors/validation-error-detail.js +10 -0
- package/src/lib/errors/validation-error-detail.js.map +1 -0
- package/src/lib/errors/validation-error.d.ts +9 -0
- package/src/lib/errors/validation-error.js +36 -0
- package/src/lib/errors/validation-error.js.map +1 -0
- package/src/lib/helpers/deserialize-validation-rule.d.ts +2 -0
- package/src/lib/helpers/deserialize-validation-rule.js +42 -0
- package/src/lib/helpers/deserialize-validation-rule.js.map +1 -0
- package/src/lib/invalid-content-validation-error.error.d.ts +5 -0
- package/src/lib/invalid-content-validation-error.error.js +14 -0
- package/src/lib/invalid-content-validation-error.error.js.map +1 -0
- package/src/lib/invalid-content-validation-validate-args.error.d.ts +2 -0
- package/src/lib/invalid-content-validation-validate-args.error.js +7 -0
- package/src/lib/invalid-content-validation-validate-args.error.js.map +1 -0
- package/src/lib/invalid-content-validation.error.d.ts +2 -0
- package/src/lib/invalid-content-validation.error.js +7 -0
- package/src/lib/invalid-content-validation.error.js.map +1 -0
- package/src/lib/types/content-item.model.d.ts +7 -0
- package/src/lib/types/content-item.model.js +11 -0
- package/src/lib/types/content-item.model.js.map +1 -0
- package/src/lib/types/content-type.model.d.ts +6 -0
- package/src/lib/types/content-type.model.js +11 -0
- package/src/lib/types/content-type.model.js.map +1 -0
- package/src/lib/types/existing-content-validation-rules-settings.type.d.ts +10 -0
- package/src/lib/types/existing-content-validation-rules-settings.type.js +3 -0
- package/src/lib/types/existing-content-validation-rules-settings.type.js.map +1 -0
- package/src/lib/types/existing-content-validation-rules.type.d.ts +9 -0
- package/src/lib/types/existing-content-validation-rules.type.js +3 -0
- package/src/lib/types/existing-content-validation-rules.type.js.map +1 -0
- package/src/lib/types/rule-instance.interface.d.ts +3 -0
- package/src/lib/types/rule-instance.interface.js +3 -0
- package/src/lib/types/rule-instance.interface.js.map +1 -0
- package/src/lib/types/rule-types.enum.d.ts +10 -0
- package/src/lib/types/rule-types.enum.js +15 -0
- package/src/lib/types/rule-types.enum.js.map +1 -0
- package/src/lib/types/unknown-validation-error-target.interface.d.ts +5 -0
- package/src/lib/types/unknown-validation-error-target.interface.js +3 -0
- package/src/lib/types/unknown-validation-error-target.interface.js.map +1 -0
- package/src/lib/validation-rules/allowed-values.validation-rule.d.ts +12 -0
- package/src/lib/validation-rules/allowed-values.validation-rule.js +35 -0
- package/src/lib/validation-rules/allowed-values.validation-rule.js.map +1 -0
- package/src/lib/validation-rules/base.validation-rule.d.ts +13 -0
- package/src/lib/validation-rules/base.validation-rule.js +14 -0
- package/src/lib/validation-rules/base.validation-rule.js.map +1 -0
- package/src/lib/validation-rules/count.validation-rule.d.ts +15 -0
- package/src/lib/validation-rules/count.validation-rule.js +35 -0
- package/src/lib/validation-rules/count.validation-rule.js.map +1 -0
- package/src/lib/validation-rules/date-between.validation-rule.d.ts +15 -0
- package/src/lib/validation-rules/date-between.validation-rule.js +35 -0
- package/src/lib/validation-rules/date-between.validation-rule.js.map +1 -0
- package/src/lib/validation-rules/decimal-count.validation-rule.d.ts +12 -0
- package/src/lib/validation-rules/decimal-count.validation-rule.js +33 -0
- package/src/lib/validation-rules/decimal-count.validation-rule.js.map +1 -0
- package/src/lib/validation-rules/number-between.validation-rule.d.ts +15 -0
- package/src/lib/validation-rules/number-between.validation-rule.js +35 -0
- package/src/lib/validation-rules/number-between.validation-rule.js.map +1 -0
- package/src/lib/validation-rules/relatable-content-types.validation-rule.d.ts +13 -0
- package/src/lib/validation-rules/relatable-content-types.validation-rule.js +37 -0
- package/src/lib/validation-rules/relatable-content-types.validation-rule.js.map +1 -0
- package/src/lib/validation-rules/string-format.validation-rule.d.ts +13 -0
- package/src/lib/validation-rules/string-format.validation-rule.js +30 -0
- package/src/lib/validation-rules/string-format.validation-rule.js.map +1 -0
- package/src/lib/validation-rules/validation-rule-function.factory.d.ts +4 -0
- package/src/lib/validation-rules/validation-rule-function.factory.js +9 -0
- package/src/lib/validation-rules/validation-rule-function.factory.js.map +1 -0
- package/src/lib/validation-rules/value-type.validation-rule.d.ts +13 -0
- package/src/lib/validation-rules/value-type.validation-rule.js +53 -0
- package/src/lib/validation-rules/value-type.validation-rule.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# validation
|
|
2
|
+
|
|
3
|
+
This package also provides common types, interfaces and classes for Content Validation.
|
|
4
|
+
|
|
5
|
+
* [Problem](#problem)
|
|
6
|
+
* [Available validation rules](#available-validation-rules)
|
|
7
|
+
* [Error Formatting](#error-formatting)
|
|
8
|
+
* [Error messages](#error-messages)
|
|
9
|
+
* [Open question/limits](#open-questionlimits)
|
|
10
|
+
|
|
11
|
+
# Problem
|
|
12
|
+
|
|
13
|
+
The content that users will provide should be constrained by the Content Model (Content Types and Content Fields). To
|
|
14
|
+
this end, we set up a structure of content Validation Rules. These validation rules specify constraints on Content
|
|
15
|
+
Values or Content Items with respect to a specific Content Field. These validation rules direct what kind of Content
|
|
16
|
+
Values can be provided for Content Items of specific Content Types.
|
|
17
|
+
The execution of these validation rules is done both in frontend and backend to optimise the user experience.
|
|
18
|
+
|
|
19
|
+
> Some validations are also used in frontend to determine the “type” of a content field, and act as “configurations” as
|
|
20
|
+
> well. These are for example `Count`, which can specify whether a `ContentField` is an array field or just a singular
|
|
21
|
+
> field. `ValueType` specifies what type of inputs should be present in the interface (e.g. a `text-area`, a date picker
|
|
22
|
+
> or a related Content Item selector).
|
|
23
|
+
|
|
24
|
+
# Available validation rules
|
|
25
|
+
|
|
26
|
+
| **Validation Rule name** | **Explanation** | **Applicability** | _**Example**_ |
|
|
27
|
+
|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
|
|
28
|
+
| Count | Specifies that a Content Item should have at least x and at most y Content Values for a Content Field | All Content Fields | _“Author” Content Items should have exactly 1 (aka min 1, max 1) Content Value for the Content Field “First name”._ |
|
|
29
|
+
| ValueType | Specifies that a Content Item can only have Content Values of a specific type (such as String, Number, Date or Content Item) for a Content Field | All Content Fields | _“Author” Content Items should have Content Values of type String for the Content Field “First name”_ |
|
|
30
|
+
| StringFormat | Content Value should follow a specific format (Regex) | Content Fields where ValueType is constrained to String | _Content Field “email” should only have strings (Content Values) that are actually an email address._ |
|
|
31
|
+
| RelatableContentTypes | Content Value should be a Content Item of a specific Content Type(s) | Content Fields where ValueType is constrained to Content Item | _The Content Field “author” of a “Recipe” Content Item, should only have Content Items (as Content Value) of the Content Type “Author”_ |
|
|
32
|
+
| AllowedValues | Content Value should be one of a predefined set of values | All Content Fields | _The Content Field “married” should only have Content Values that either are “yes” or “no”._ |
|
|
33
|
+
| NumberBetween | Content Value (number) should be between a min and max value | Content Fields where ValueType is constrained to Number | The Content Field “weight” should be at least 0 |
|
|
34
|
+
| DecimalCount | Content Value (number) should have a min and max amount of decimals | Content Fields where ValueType is constrained to Number | The Content Field “weight” should have exactly 0 decimals (ie it is an Integer) |
|
|
35
|
+
| DateBetween | Same as NumberBetween | Content Fields where ValueType is constrained to Date | |
|
|
36
|
+
|
|
37
|
+
# Error Formatting
|
|
38
|
+
|
|
39
|
+
The validation errors are returned from the API in a specific format. Since GraphQL does not provide explicitly typed
|
|
40
|
+
error messages, the API returns “untyped” error messages. To this end we defined a specific schema in which validation
|
|
41
|
+
errors are communicated. The exact formatting can be deduced from the core package:
|
|
42
|
+
https://bitbucket.org/startmetplate/utils-core/src/master/?search_id=c7245c92-5b81-40ed-8cdd-cccdba9499c8
|
|
43
|
+
(TODO: Generated JSON schema from this).
|
|
44
|
+
|
|
45
|
+
Some example showing the basic structure of content validation errors:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
// Input request (Create ContentItem)
|
|
49
|
+
request = {
|
|
50
|
+
contentItem: {
|
|
51
|
+
contentType: "prn-content-type",
|
|
52
|
+
contentValues: [
|
|
53
|
+
{
|
|
54
|
+
contentField: "prn-content-field-1",
|
|
55
|
+
primitiveValue: "Nils"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
contentField: "prn-content-field-1",
|
|
59
|
+
primitiveValue: "David"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
contentField: "prn-content-field-2",
|
|
63
|
+
primitiveValue: "Möller"
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
// Validation Error
|
|
72
|
+
{
|
|
73
|
+
errors: [
|
|
74
|
+
{
|
|
75
|
+
target: {
|
|
76
|
+
// ... full input
|
|
77
|
+
},
|
|
78
|
+
property: "contentValues",
|
|
79
|
+
children: [
|
|
80
|
+
{
|
|
81
|
+
target: {
|
|
82
|
+
contentField: {
|
|
83
|
+
prn: "prn-content-field-2",
|
|
84
|
+
},
|
|
85
|
+
primitiveValue: "Möller",
|
|
86
|
+
},
|
|
87
|
+
property: "primitiveValue",
|
|
88
|
+
details: [
|
|
89
|
+
{
|
|
90
|
+
message: "Text should contain an email address",
|
|
91
|
+
contentField: {
|
|
92
|
+
prn: "prn-content-field-2",
|
|
93
|
+
},
|
|
94
|
+
validationRule: {
|
|
95
|
+
ruleType: "textFormat",
|
|
96
|
+
prn: "prn-validation-rule-123",
|
|
97
|
+
settings: {
|
|
98
|
+
regex: /[[SOME_EMAIL_REGEX]]/,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
target: {
|
|
108
|
+
// ... full input
|
|
109
|
+
},
|
|
110
|
+
property: "contentValues",
|
|
111
|
+
// "We have too little ContentValues for ContentField 1"
|
|
112
|
+
details: [
|
|
113
|
+
{
|
|
114
|
+
message: "Provide at least 3 first names",
|
|
115
|
+
contentField: {
|
|
116
|
+
prn: "prn-content-field-1",
|
|
117
|
+
},
|
|
118
|
+
validationRule: {
|
|
119
|
+
ruleType: "count",
|
|
120
|
+
prn: "prn-validation-rule",
|
|
121
|
+
settings: {
|
|
122
|
+
min: 3,
|
|
123
|
+
max: 100,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
children: [],
|
|
129
|
+
},
|
|
130
|
+
// ... and other errors
|
|
131
|
+
];
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
# Error messages
|
|
136
|
+
|
|
137
|
+
Each Validation Rule contains a validate method that can generate a ValidationErrorDetail (shown in the example above in
|
|
138
|
+
the details section) when it fails and is applicable. These messages provide the user with feedback what went wrong
|
|
139
|
+
during the validation.
|
|
140
|
+
|
|
141
|
+
There are 2 locations where Content Validation can be triggered:
|
|
142
|
+
|
|
143
|
+
1. When creating/updating a Content Value.
|
|
144
|
+
In this case, we just validate the Content Value with the validations for the related Content Field (so not the other
|
|
145
|
+
Content Values of the Content Item)
|
|
146
|
+
2. When creating a Content Item.
|
|
147
|
+
|
|
148
|
+
# Open question/limits
|
|
149
|
+
|
|
150
|
+
- What if I add a validation (or content field) with existing content items?
|
|
151
|
+
- How to deal with partial content, that should no be validated yet? Maybe temporarily add a “skipValidation” input for
|
|
152
|
+
create/update mutation.
|
|
153
|
+
- We could maybe implement the validation not as validation on a single ContentItem + ContentValue, but on any generic
|
|
154
|
+
graph of ContentItems and Contentvalues. We need to think about how to represent this in JSON response? , maybe later.
|
|
155
|
+
- No custom/templatable messages on ValidationRules for now.
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@platecms/delta-validation",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "This package contains the validation system for Plate.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://bitbucket.org/startmetplate/delta.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://bitbucket.org/startmetplate/delta/src/dev/packages/validation",
|
|
14
|
+
"main": "./src/index.js",
|
|
15
|
+
"types": "./src/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"src/**/*"
|
|
18
|
+
],
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@platecms/delta-cast": "*",
|
|
21
|
+
"@platecms/delta-plate-resource-notation": "*",
|
|
22
|
+
"@platecms/delta-types": "*",
|
|
23
|
+
"class-transformer": "0.5.1",
|
|
24
|
+
"class-validator": "0.14.1",
|
|
25
|
+
"reflect-metadata": "0.2.2",
|
|
26
|
+
"tslib": "2.8.1"
|
|
27
|
+
},
|
|
28
|
+
"type": "commonjs"
|
|
29
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./lib/validation-rules/base.validation-rule";
|
|
2
|
+
export * from "./lib/errors/validation-error-detail";
|
|
3
|
+
export * from "./lib/validation-rules/count.validation-rule";
|
|
4
|
+
export * from "./lib/helpers/deserialize-validation-rule";
|
|
5
|
+
export * from "./lib/validation-rules/number-between.validation-rule";
|
|
6
|
+
export * from "./lib/types/existing-content-validation-rules-settings.type";
|
|
7
|
+
export * from "./lib/types/content-item.model";
|
|
8
|
+
export * from "./lib/errors/content-validation-error";
|
|
9
|
+
export * from "./lib/types/unknown-validation-error-target.interface";
|
|
10
|
+
export * from "./lib/validation-rules/allowed-values.validation-rule";
|
|
11
|
+
export * from "./lib/validation-rules/decimal-count.validation-rule";
|
|
12
|
+
export * from "./lib/errors/content-validation-error-detail";
|
|
13
|
+
export * from "./lib/validation-rules/date-between.validation-rule";
|
|
14
|
+
export * from "./lib/validation-rules/value-type.validation-rule";
|
|
15
|
+
export * from "./lib/types/content-type.model";
|
|
16
|
+
export * from "./lib/types/rule-types.enum";
|
|
17
|
+
export * from "./lib/validation-rules/string-format.validation-rule";
|
|
18
|
+
export * from "./lib/types/existing-content-validation-rules.type";
|
|
19
|
+
export * from "./lib/errors/validation-error";
|
|
20
|
+
export * from "./lib/types/rule-instance.interface";
|
|
21
|
+
export * from "./lib/validation-rules/validation-rule-function.factory";
|
|
22
|
+
export * from "./lib/validation-rules/relatable-content-types.validation-rule";
|
|
23
|
+
export * from "./lib/invalid-content-validation.error";
|
|
24
|
+
export * from "./lib/content-validation-error.serializer";
|
|
25
|
+
export * from "./lib/invalid-content-validation-error.error";
|
|
26
|
+
export * from "./lib/invalid-content-validation-validate-args.error";
|
package/src/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/validation-rules/base.validation-rule"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/errors/validation-error-detail"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/validation-rules/count.validation-rule"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/helpers/deserialize-validation-rule"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/validation-rules/number-between.validation-rule"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./lib/types/existing-content-validation-rules-settings.type"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./lib/types/content-item.model"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./lib/errors/content-validation-error"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./lib/types/unknown-validation-error-target.interface"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./lib/validation-rules/allowed-values.validation-rule"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./lib/validation-rules/decimal-count.validation-rule"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./lib/errors/content-validation-error-detail"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./lib/validation-rules/date-between.validation-rule"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./lib/validation-rules/value-type.validation-rule"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./lib/types/content-type.model"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./lib/types/rule-types.enum"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./lib/validation-rules/string-format.validation-rule"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./lib/types/existing-content-validation-rules.type"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./lib/errors/validation-error"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./lib/types/rule-instance.interface"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./lib/validation-rules/validation-rule-function.factory"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./lib/validation-rules/relatable-content-types.validation-rule"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./lib/invalid-content-validation.error"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./lib/content-validation-error.serializer"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./lib/invalid-content-validation-error.error"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./lib/invalid-content-validation-validate-args.error"), exports);
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/validation/src/index.ts"],"names":[],"mappings":";;;AAAA,sFAA4D;AAC5D,+EAAqD;AACrD,uFAA6D;AAC7D,oFAA0D;AAC1D,gGAAsE;AACtE,sGAA4E;AAC5E,yEAA+C;AAC/C,gFAAsD;AACtD,gGAAsE;AACtE,gGAAsE;AACtE,+FAAqE;AACrE,uFAA6D;AAC7D,8FAAoE;AACpE,4FAAkE;AAClE,yEAA+C;AAC/C,sEAA4C;AAC5C,+FAAqE;AACrE,6FAAmE;AACnE,wEAA8C;AAC9C,8EAAoD;AACpD,kGAAwE;AACxE,yGAA+E;AAC/E,iFAAuD;AACvD,oFAA0D;AAC1D,uFAA6D;AAC7D,+FAAqE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UnknownValidationErrorTarget } from "./types/unknown-validation-error-target.interface";
|
|
2
|
+
import { ContentValidationError } from "./errors/content-validation-error";
|
|
3
|
+
export declare class ContentValidationErrorSerializer {
|
|
4
|
+
serialize(contentValidationErrors: ContentValidationError<unknown>[]): unknown[];
|
|
5
|
+
deserialize<TTarget = UnknownValidationErrorTarget>(inputContentValidationErrors: unknown[]): Promise<ContentValidationError<TTarget>[]>;
|
|
6
|
+
private validateErrors;
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentValidationErrorSerializer = void 0;
|
|
4
|
+
const class_transformer_1 = require("class-transformer");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const content_validation_error_1 = require("./errors/content-validation-error");
|
|
7
|
+
const invalid_content_validation_error_error_1 = require("./invalid-content-validation-error.error");
|
|
8
|
+
class ContentValidationErrorSerializer {
|
|
9
|
+
serialize(contentValidationErrors) {
|
|
10
|
+
return contentValidationErrors.map((contentValidationError) => (0, class_transformer_1.instanceToPlain)(contentValidationError));
|
|
11
|
+
}
|
|
12
|
+
async deserialize(inputContentValidationErrors) {
|
|
13
|
+
const contentValidationErrors = (0, class_transformer_1.plainToInstance)((content_validation_error_1.ContentValidationError), inputContentValidationErrors);
|
|
14
|
+
const validationErrors = await this.validateErrors(contentValidationErrors);
|
|
15
|
+
if (validationErrors.length > 0) {
|
|
16
|
+
throw new invalid_content_validation_error_error_1.InvalidContentValidationErrorError("The input errors are not correct ContentValidationErrorDetail objects.", validationErrors);
|
|
17
|
+
}
|
|
18
|
+
return contentValidationErrors;
|
|
19
|
+
}
|
|
20
|
+
async validateErrors(contentValidationErrors) {
|
|
21
|
+
const validationErrors = [];
|
|
22
|
+
for (const contentValidationError of contentValidationErrors) {
|
|
23
|
+
const errors = await (0, class_validator_1.validate)(contentValidationError);
|
|
24
|
+
validationErrors.push(...errors);
|
|
25
|
+
}
|
|
26
|
+
return validationErrors;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ContentValidationErrorSerializer = ContentValidationErrorSerializer;
|
|
30
|
+
//# sourceMappingURL=content-validation-error.serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-validation-error.serializer.js","sourceRoot":"","sources":["../../../../../../packages/validation/src/lib/content-validation-error.serializer.ts"],"names":[],"mappings":";;;AAAA,yDAAqE;AACrE,qDAA4D;AAE5D,gFAA2E;AAC3E,qGAA8F;AAE9F,MAAa,gCAAgC;IAIpC,SAAS,CAAC,uBAA0D;QACzE,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC,sBAAsB,EAAE,EAAE,CAAC,IAAA,mCAAe,EAAC,sBAAsB,CAAC,CAAC,CAAC;IAC1G,CAAC;IAOM,KAAK,CAAC,WAAW,CACtB,4BAAuC;QAEvC,MAAM,uBAAuB,GAAsC,IAAA,mCAAe,EAChF,CAAA,iDAA+B,CAAA,EAC/B,4BAA4B,CAC7B,CAAC;QAEF,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAU,uBAAuB,CAAC,CAAC;QAErF,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,2EAAkC,CAC1C,wEAAwE,EACxE,gBAAgB,CACjB,CAAC;QACJ,CAAC;QAED,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAEO,KAAK,CAAC,cAAc,CAC1B,uBAA0D;QAE1D,MAAM,gBAAgB,GAAG,EAAE,CAAC;QAE5B,KAAK,MAAM,sBAAsB,IAAI,uBAAuB,EAAE,CAAC;YAC7D,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAQ,EAAC,sBAAsB,CAAC,CAAC;YAEtD,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AA9CD,4EA8CC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ValidationErrorDetail } from "./validation-error-detail";
|
|
2
|
+
import { RuleInstance } from "../types/rule-instance.interface";
|
|
3
|
+
export declare class ContentValidationErrorDetail<TRuleInstance extends RuleInstance<unknown>> extends ValidationErrorDetail {
|
|
4
|
+
readonly validationRule: TRuleInstance;
|
|
5
|
+
constructor(message: string, validationRule: TRuleInstance);
|
|
6
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentValidationErrorDetail = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_transformer_1 = require("class-transformer");
|
|
6
|
+
const validation_error_detail_1 = require("./validation-error-detail");
|
|
7
|
+
const deserialize_validation_rule_1 = require("../helpers/deserialize-validation-rule");
|
|
8
|
+
class ContentValidationErrorDetail extends validation_error_detail_1.ValidationErrorDetail {
|
|
9
|
+
constructor(message, validationRule) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.validationRule = validationRule;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ContentValidationErrorDetail = ContentValidationErrorDetail;
|
|
15
|
+
tslib_1.__decorate([
|
|
16
|
+
(0, class_transformer_1.Transform)((validationRule) => (0, deserialize_validation_rule_1.deserializeValidationRule)(validationRule)),
|
|
17
|
+
tslib_1.__metadata("design:type", Object)
|
|
18
|
+
], ContentValidationErrorDetail.prototype, "validationRule", void 0);
|
|
19
|
+
//# sourceMappingURL=content-validation-error-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-validation-error-detail.js","sourceRoot":"","sources":["../../../../../../../packages/validation/src/lib/errors/content-validation-error-detail.ts"],"names":[],"mappings":";;;;AAAA,yDAA8C;AAC9C,uEAAkE;AAClE,wFAAmF;AAGnF,MAAa,4BAA0E,SAAQ,+CAAqB;IAIlH,YAAmB,OAAe,EAAE,cAA6B;QAC/D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;CACF;AARD,oEAQC;AANiB;IADf,IAAA,6BAAS,EAAC,CAAC,cAAuB,EAAE,EAAE,CAAC,IAAA,uDAAyB,EAAC,cAAc,CAAC,CAAC;;oEACpC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContentValidationErrorDetail } from "./content-validation-error-detail";
|
|
2
|
+
import { UnknownValidationErrorTarget } from "../types/unknown-validation-error-target.interface";
|
|
3
|
+
import { ValidationError } from "./validation-error";
|
|
4
|
+
import { RuleInstance } from "../types/rule-instance.interface";
|
|
5
|
+
export declare class ContentValidationError<TTarget = UnknownValidationErrorTarget, TRuleInstance extends RuleInstance<unknown> = RuleInstance<unknown>> extends ValidationError<TTarget> {
|
|
6
|
+
readonly details: ContentValidationErrorDetail<TRuleInstance>[];
|
|
7
|
+
readonly children: ContentValidationError[];
|
|
8
|
+
constructor(target: TTarget, property: string, details: ContentValidationErrorDetail<TRuleInstance>[], children: ContentValidationError[]);
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentValidationError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_transformer_1 = require("class-transformer");
|
|
6
|
+
const content_validation_error_detail_1 = require("./content-validation-error-detail");
|
|
7
|
+
const validation_error_1 = require("./validation-error");
|
|
8
|
+
class ContentValidationError extends validation_error_1.ValidationError {
|
|
9
|
+
constructor(target, property, details, children) {
|
|
10
|
+
super(target, property, details, children);
|
|
11
|
+
this.details = details;
|
|
12
|
+
this.children = children;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ContentValidationError = ContentValidationError;
|
|
16
|
+
tslib_1.__decorate([
|
|
17
|
+
(0, class_transformer_1.Type)(() => content_validation_error_detail_1.ContentValidationErrorDetail),
|
|
18
|
+
tslib_1.__metadata("design:type", Array)
|
|
19
|
+
], ContentValidationError.prototype, "details", void 0);
|
|
20
|
+
tslib_1.__decorate([
|
|
21
|
+
(0, class_transformer_1.Type)(() => ContentValidationError),
|
|
22
|
+
tslib_1.__metadata("design:type", Array)
|
|
23
|
+
], ContentValidationError.prototype, "children", void 0);
|
|
24
|
+
//# sourceMappingURL=content-validation-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-validation-error.js","sourceRoot":"","sources":["../../../../../../../packages/validation/src/lib/errors/content-validation-error.ts"],"names":[],"mappings":";;;;AAAA,yDAAyC;AACzC,uFAAiF;AAEjF,yDAAqD;AAGrD,MAAa,sBAGX,SAAQ,kCAAwB;IAOhC,YACE,MAAe,EACf,QAAgB,EAChB,OAAsD,EACtD,QAAkC;QAElC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AApBD,wDAoBC;AAf0B;IADxB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,8DAA4B,CAAC;;uDACuC;AAGvD;IADxB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;;wDACyB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationErrorDetail = void 0;
|
|
4
|
+
class ValidationErrorDetail {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
this.message = message;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.ValidationErrorDetail = ValidationErrorDetail;
|
|
10
|
+
//# sourceMappingURL=validation-error-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-error-detail.js","sourceRoot":"","sources":["../../../../../../../packages/validation/src/lib/errors/validation-error-detail.ts"],"names":[],"mappings":";;;AAAA,MAAa,qBAAqB;IAGhC,YAAmB,OAAe;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAND,sDAMC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValidationErrorDetail } from "./validation-error-detail";
|
|
2
|
+
import { UnknownValidationErrorTarget } from "../types/unknown-validation-error-target.interface";
|
|
3
|
+
export declare class ValidationError<TTarget = UnknownValidationErrorTarget> extends Error {
|
|
4
|
+
readonly details: ValidationErrorDetail[];
|
|
5
|
+
readonly children: ValidationError[];
|
|
6
|
+
readonly target: TTarget;
|
|
7
|
+
readonly property: string;
|
|
8
|
+
constructor(target: TTarget, property: string, details: ValidationErrorDetail[], children: ValidationError[]);
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_transformer_1 = require("class-transformer");
|
|
6
|
+
const validation_error_detail_1 = require("./validation-error-detail");
|
|
7
|
+
const class_validator_1 = require("class-validator");
|
|
8
|
+
class ValidationError extends Error {
|
|
9
|
+
constructor(target, property, details, children) {
|
|
10
|
+
super();
|
|
11
|
+
this.target = target;
|
|
12
|
+
this.property = property;
|
|
13
|
+
this.details = details;
|
|
14
|
+
this.children = children;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ValidationError = ValidationError;
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, class_validator_1.IsDefined)(),
|
|
20
|
+
(0, class_transformer_1.Type)(() => validation_error_detail_1.ValidationErrorDetail),
|
|
21
|
+
tslib_1.__metadata("design:type", Array)
|
|
22
|
+
], ValidationError.prototype, "details", void 0);
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, class_validator_1.IsDefined)(),
|
|
25
|
+
(0, class_transformer_1.Type)(() => ValidationError),
|
|
26
|
+
tslib_1.__metadata("design:type", Array)
|
|
27
|
+
], ValidationError.prototype, "children", void 0);
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, class_validator_1.IsDefined)(),
|
|
30
|
+
tslib_1.__metadata("design:type", Object)
|
|
31
|
+
], ValidationError.prototype, "target", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, class_validator_1.IsDefined)(),
|
|
34
|
+
tslib_1.__metadata("design:type", String)
|
|
35
|
+
], ValidationError.prototype, "property", void 0);
|
|
36
|
+
//# sourceMappingURL=validation-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-error.js","sourceRoot":"","sources":["../../../../../../../packages/validation/src/lib/errors/validation-error.ts"],"names":[],"mappings":";;;;AAAA,yDAAyC;AACzC,uEAAkE;AAElE,qDAA4C;AAE5C,MAAa,eAAwD,SAAQ,KAAK;IAehF,YAAmB,MAAe,EAAE,QAAgB,EAAE,OAAgC,EAAE,QAA2B;QACjH,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAtBD,0CAsBC;AAnBiB;IAFf,IAAA,2BAAS,GAAE;IACX,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,+CAAqB,CAAC;;gDACe;AAIjC;IAFf,IAAA,2BAAS,GAAE;IACX,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,eAAe,CAAC;;iDACgB;AAG5B;IADf,IAAA,2BAAS,GAAE;;+CACoB;AAGhB;IADf,IAAA,2BAAS,GAAE;;iDACqB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeValidationRule = deserializeValidationRule;
|
|
4
|
+
const allowed_values_validation_rule_1 = require("../validation-rules/allowed-values.validation-rule");
|
|
5
|
+
const count_validation_rule_1 = require("../validation-rules/count.validation-rule");
|
|
6
|
+
const date_between_validation_rule_1 = require("../validation-rules/date-between.validation-rule");
|
|
7
|
+
const decimal_count_validation_rule_1 = require("../validation-rules/decimal-count.validation-rule");
|
|
8
|
+
const number_between_validation_rule_1 = require("../validation-rules/number-between.validation-rule");
|
|
9
|
+
const relatable_content_types_validation_rule_1 = require("../validation-rules/relatable-content-types.validation-rule");
|
|
10
|
+
const string_format_validation_rule_1 = require("../validation-rules/string-format.validation-rule");
|
|
11
|
+
const value_type_validation_rule_1 = require("../validation-rules/value-type.validation-rule");
|
|
12
|
+
const rule_types_enum_1 = require("../types/rule-types.enum");
|
|
13
|
+
function deserializeValidationRule(input) {
|
|
14
|
+
if (typeof input !== "object" || input == null) {
|
|
15
|
+
throw new Error(`The input is not an object or is null. Input: '${JSON.stringify(input)}'`);
|
|
16
|
+
}
|
|
17
|
+
if (input["value"] == null) {
|
|
18
|
+
throw new Error(`The input does not contain a 'value' property. Input: '${JSON.stringify(input)}'`);
|
|
19
|
+
}
|
|
20
|
+
const rawValidationRule = input["value"];
|
|
21
|
+
switch (rawValidationRule.ruleType) {
|
|
22
|
+
case rule_types_enum_1.RuleType.ALLOWED_VALUES:
|
|
23
|
+
return new allowed_values_validation_rule_1.AllowedValuesValidationRule(rawValidationRule.prn, rawValidationRule.settings);
|
|
24
|
+
case rule_types_enum_1.RuleType.COUNT:
|
|
25
|
+
return new count_validation_rule_1.CountValidationRule(rawValidationRule.prn, rawValidationRule.settings);
|
|
26
|
+
case rule_types_enum_1.RuleType.DATE_BETWEEN:
|
|
27
|
+
return new date_between_validation_rule_1.DateBetweenValidationRule(rawValidationRule.prn, rawValidationRule.settings);
|
|
28
|
+
case rule_types_enum_1.RuleType.DECIMAL_COUNT:
|
|
29
|
+
return new decimal_count_validation_rule_1.DecimalCountValidationRule(rawValidationRule.prn, rawValidationRule.settings);
|
|
30
|
+
case rule_types_enum_1.RuleType.NUMBER_BETWEEN:
|
|
31
|
+
return new number_between_validation_rule_1.NumberBetweenValidationRule(rawValidationRule.prn, rawValidationRule.settings);
|
|
32
|
+
case rule_types_enum_1.RuleType.RELATABLE_CONTENT_TYPES:
|
|
33
|
+
return new relatable_content_types_validation_rule_1.RelatableContentTypesValidationRule(rawValidationRule.prn, rawValidationRule.settings);
|
|
34
|
+
case rule_types_enum_1.RuleType.STRING_FORMAT:
|
|
35
|
+
return new string_format_validation_rule_1.StringFormatValidationRule(rawValidationRule.prn, rawValidationRule.settings);
|
|
36
|
+
case rule_types_enum_1.RuleType.VALUE_TYPE:
|
|
37
|
+
return new value_type_validation_rule_1.ValueTypeValidationRule(rawValidationRule.prn, rawValidationRule.settings);
|
|
38
|
+
default:
|
|
39
|
+
throw new Error(`Unknown validation rule type: ${rawValidationRule.ruleType}. Rule: ${JSON.stringify(rawValidationRule)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=deserialize-validation-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deserialize-validation-rule.js","sourceRoot":"","sources":["../../../../../../../packages/validation/src/lib/helpers/deserialize-validation-rule.ts"],"names":[],"mappings":";;AAoCA,8DAyDC;AA5FD,uGAG4D;AAC5D,qFAA6G;AAC7G,mGAG0D;AAC1D,qGAG2D;AAC3D,uGAG4D;AAC5D,yHAGqE;AACrE,qGAG2D;AAC3D,+FAGwD;AACxD,8DAAoD;AAMpD,SAAgB,yBAAyB,CAAC,KAAc;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,kDAAkD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9F,CAAC;IAED,IAAI,KAAK,CAAC,OAAuB,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,0DAA0D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtG,CAAC;IAGD,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAuB,CAAmC,CAAC;IAE3F,QAAQ,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QACnC,KAAK,0BAAQ,CAAC,cAAc;YAC1B,OAAO,IAAI,4DAA2B,CACpC,iBAAiB,CAAC,GAAG,EACrB,iBAAiB,CAAC,QAA+C,CAClE,CAAC;QACJ,KAAK,0BAAQ,CAAC,KAAK;YACjB,OAAO,IAAI,2CAAmB,CAAC,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,CAAC,QAAuC,CAAC,CAAC;QACnH,KAAK,0BAAQ,CAAC,YAAY;YACxB,OAAO,IAAI,wDAAyB,CAClC,iBAAiB,CAAC,GAAG,EACrB,iBAAiB,CAAC,QAA6C,CAChE,CAAC;QACJ,KAAK,0BAAQ,CAAC,aAAa;YACzB,OAAO,IAAI,0DAA0B,CACnC,iBAAiB,CAAC,GAAG,EACrB,iBAAiB,CAAC,QAA8C,CACjE,CAAC;QACJ,KAAK,0BAAQ,CAAC,cAAc;YAC1B,OAAO,IAAI,4DAA2B,CACpC,iBAAiB,CAAC,GAAG,EACrB,iBAAiB,CAAC,QAA+C,CAClE,CAAC;QACJ,KAAK,0BAAQ,CAAC,uBAAuB;YACnC,OAAO,IAAI,6EAAmC,CAC5C,iBAAiB,CAAC,GAAG,EACrB,iBAAiB,CAAC,QAA4D,CAC/E,CAAC;QACJ,KAAK,0BAAQ,CAAC,aAAa;YACzB,OAAO,IAAI,0DAA0B,CACnC,iBAAiB,CAAC,GAAG,EACrB,iBAAiB,CAAC,QAA8C,CACjE,CAAC;QACJ,KAAK,0BAAQ,CAAC,UAAU;YACtB,OAAO,IAAI,oDAAuB,CAChC,iBAAiB,CAAC,GAAG,EACrB,iBAAiB,CAAC,QAA2C,CAC9D,CAAC;QACJ;YACE,MAAM,IAAI,KAAK,CACb,iCACE,iBAAiB,CAAC,QACpB,WAAW,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAC/C,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidContentValidationErrorError = void 0;
|
|
4
|
+
class InvalidContentValidationErrorError extends Error {
|
|
5
|
+
constructor(message, validationErrors) {
|
|
6
|
+
const errorsMessage = validationErrors
|
|
7
|
+
.map((error, index) => `\n ${index + 1}. ${JSON.stringify(error, null, 2)}`)
|
|
8
|
+
.join("");
|
|
9
|
+
super(`${message}\nValidation errors:${errorsMessage}`);
|
|
10
|
+
this.validationErrors = validationErrors;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.InvalidContentValidationErrorError = InvalidContentValidationErrorError;
|
|
14
|
+
//# sourceMappingURL=invalid-content-validation-error.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-content-validation-error.error.js","sourceRoot":"","sources":["../../../../../../packages/validation/src/lib/invalid-content-validation-error.error.ts"],"names":[],"mappings":";;;AAKA,MAAa,kCAAmC,SAAQ,KAAK;IAG3D,YAAmB,OAAe,EAAE,gBAAmC;QACrE,MAAM,aAAa,GAAG,gBAAgB;aACnC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC5E,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,KAAK,CAAC,GAAG,OAAO,uBAAuB,aAAa,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;CACF;AAXD,gFAWC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidContentValidationValidateArgsError = void 0;
|
|
4
|
+
class InvalidContentValidationValidateArgsError extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.InvalidContentValidationValidateArgsError = InvalidContentValidationValidateArgsError;
|
|
7
|
+
//# sourceMappingURL=invalid-content-validation-validate-args.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-content-validation-validate-args.error.js","sourceRoot":"","sources":["../../../../../../packages/validation/src/lib/invalid-content-validation-validate-args.error.ts"],"names":[],"mappings":";;;AAAA,MAAa,yCAA0C,SAAQ,KAAK;CAAG;AAAvE,8FAAuE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidContentValidationError = void 0;
|
|
4
|
+
class InvalidContentValidationError extends Error {
|
|
5
|
+
}
|
|
6
|
+
exports.InvalidContentValidationError = InvalidContentValidationError;
|
|
7
|
+
//# sourceMappingURL=invalid-content-validation.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-content-validation.error.js","sourceRoot":"","sources":["../../../../../../packages/validation/src/lib/invalid-content-validation.error.ts"],"names":[],"mappings":";;;AAAA,MAAa,6BAA8B,SAAQ,KAAK;CAAG;AAA3D,sEAA2D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ContentType } from "./content-type.model";
|
|
2
|
+
import { PRN } from "@platecms/delta-plate-resource-notation";
|
|
3
|
+
export declare class ContentItem {
|
|
4
|
+
readonly prn: PRN;
|
|
5
|
+
readonly contentType?: ContentType;
|
|
6
|
+
constructor(prn: PRN, contentType?: ContentType);
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentItem = void 0;
|
|
4
|
+
class ContentItem {
|
|
5
|
+
constructor(prn, contentType) {
|
|
6
|
+
this.prn = prn;
|
|
7
|
+
this.contentType = contentType;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ContentItem = ContentItem;
|
|
11
|
+
//# sourceMappingURL=content-item.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-item.model.js","sourceRoot":"","sources":["../../../../../../../packages/validation/src/lib/types/content-item.model.ts"],"names":[],"mappings":";;;AAGA,MAAa,WAAW;IAKtB,YAAmB,GAAQ,EAAE,WAAyB;QACpD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AATD,kCASC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentType = void 0;
|
|
4
|
+
class ContentType {
|
|
5
|
+
constructor(prn, name) {
|
|
6
|
+
this.prn = prn;
|
|
7
|
+
this.name = name;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ContentType = ContentType;
|
|
11
|
+
//# sourceMappingURL=content-type.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-type.model.js","sourceRoot":"","sources":["../../../../../../../packages/validation/src/lib/types/content-type.model.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IAKtB,YAAmB,GAAQ,EAAE,IAAY;QACvC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AATD,kCASC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AllowedValuesValidationRuleSettings } from "../validation-rules/allowed-values.validation-rule";
|
|
2
|
+
import { CountValidationRuleSettings } from "../validation-rules/count.validation-rule";
|
|
3
|
+
import { DateBetweenValidationRuleSettings } from "../validation-rules/date-between.validation-rule";
|
|
4
|
+
import { DecimalCountValidationRuleSettings } from "../validation-rules/decimal-count.validation-rule";
|
|
5
|
+
import { NumberBetweenValidationRuleSettings } from "../validation-rules/number-between.validation-rule";
|
|
6
|
+
import { RelatableContentTypesValidationRuleSettings } from "../validation-rules/relatable-content-types.validation-rule";
|
|
7
|
+
import { StringFormatValidationRuleSettings } from "../validation-rules/string-format.validation-rule";
|
|
8
|
+
import { ValueTypeValidationRuleSettings } from "../validation-rules/value-type.validation-rule";
|
|
9
|
+
import { PRN } from "@platecms/delta-plate-resource-notation";
|
|
10
|
+
export type ExistingContentValidationRulesSettings = AllowedValuesValidationRuleSettings | CountValidationRuleSettings | DateBetweenValidationRuleSettings | DecimalCountValidationRuleSettings | NumberBetweenValidationRuleSettings | RelatableContentTypesValidationRuleSettings<PRN> | StringFormatValidationRuleSettings | ValueTypeValidationRuleSettings;
|