@hosterai/types 0.0.20 → 0.0.22
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 +80 -1
- package/dist/dtos/field.dto.d.ts +8 -4
- package/dist/dtos/field.dto.js +17 -7
- package/dist/dtos/notification/notification-info.dto.js +7 -3
- package/dist/enums/actions.enum.d.ts +1 -0
- package/dist/enums/actions.enum.js +1 -0
- package/dist/enums/events.enum.d.ts +4 -1
- package/dist/enums/events.enum.js +4 -1
- package/dist/openapi/schemas/components.schemas.d.ts +20 -12
- package/dist/openapi/schemas/components.schemas.js +30 -9
- package/dist/validators/field-validator.spec.js +11 -10
- package/dist/validators/product-info-validator.spec.js +18 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ This package contains the core types for the Hoster AI platform.
|
|
|
4
4
|
|
|
5
5
|
## Files
|
|
6
6
|
|
|
7
|
-
- `llm.txt`:
|
|
7
|
+
- `llm.txt`: Comprehensive documentation of all DTOs, enums, validators, decorators, and transformers in the package. This file serves as an LLM-friendly reference for AI assistants.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@hosterai/types)
|
|
10
10
|
[](https://www.npmjs.com/package/@hosterai/types)
|
|
@@ -27,6 +27,24 @@ or
|
|
|
27
27
|
yarn add @hosterai/types
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
## Peer Dependencies
|
|
31
|
+
|
|
32
|
+
This package relies on the following peer dependencies. Install them in your project:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install class-validator class-transformer class-validator-jsonschema reflect-metadata
|
|
36
|
+
# If your project already uses Express, ensure a compatible version is installed
|
|
37
|
+
npm install express
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Note:
|
|
41
|
+
|
|
42
|
+
- Import `reflect-metadata` once at the entry point of your application (e.g., `main.ts` or `index.ts`).
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import 'reflect-metadata';
|
|
46
|
+
```
|
|
47
|
+
|
|
30
48
|
## Core Concepts
|
|
31
49
|
|
|
32
50
|
### DTOs (Data Transfer Objects)
|
|
@@ -105,16 +123,77 @@ This package includes validation functions that leverage `class-validator` to en
|
|
|
105
123
|
|
|
106
124
|
**Available Validators:**
|
|
107
125
|
|
|
126
|
+
**Core Validators:**
|
|
108
127
|
- `validateActionDto`: Validates UI actions.
|
|
128
|
+
- `validateClientDataDto`: Validates client data.
|
|
109
129
|
- `validateCompanyDataDto`: Validates company data.
|
|
110
130
|
- `validateFieldDto`: Validates dynamic fields.
|
|
131
|
+
- `validateFieldOptionDto`: Validates field options.
|
|
111
132
|
- `validateJwtDto`: Validates JWT data.
|
|
112
133
|
- `validateMultilangTextDto`: Validates multilingual text objects.
|
|
134
|
+
- `validateUnitDto`: Validates billing unit data.
|
|
135
|
+
|
|
136
|
+
**Panel Validators:**
|
|
137
|
+
- `validateAdminPanelDto`: Validates admin panel configuration.
|
|
138
|
+
- `validateAdminPanelTabsDto`: Validates admin panel tabs.
|
|
139
|
+
- `validateAdminPanelMoreActionsDto`: Validates admin panel additional actions.
|
|
140
|
+
- `validateClientPanelDto`: Validates client panel configuration.
|
|
141
|
+
|
|
142
|
+
**Menu & Settings Validators:**
|
|
143
|
+
- `validateMenuWithUrlDto`: Validates menu items with direct URLs.
|
|
144
|
+
- `validateMenuWithSubmenuDto`: Validates menu items with submenus.
|
|
145
|
+
- `validateSettingsWithUrlDto`: Validates settings with URL configuration.
|
|
146
|
+
- `validateSettingsWithTabsDto`: Validates settings with tabs configuration.
|
|
147
|
+
|
|
148
|
+
**Notification Validators:**
|
|
113
149
|
- `validateNotificationRequestDto`: Validates the main notification request.
|
|
150
|
+
- `validateNotificationInfoDto`: Validates notification information.
|
|
114
151
|
- `validateEmailReceiverDto`, `validateSmsReceiverDto`, `validatePushReceiverDto`: Validators for notification receivers.
|
|
115
152
|
- `validateEmailSenderDto`, `validateSmsSenderDto`, `validatePushSenderDto`: Validators for notification senders.
|
|
153
|
+
|
|
154
|
+
**Product Validators:**
|
|
155
|
+
- `validateProductInfoDto`: Validates product information.
|
|
156
|
+
- `validateProductCreateRequestDto`: Validates product creation requests.
|
|
157
|
+
- `validateProductDeleteRequestDto`: Validates product deletion requests.
|
|
158
|
+
- `validateProductRenewRequestDto`: Validates product renewal requests.
|
|
159
|
+
- `validateProductUpgradeRequestDto`: Validates product upgrade requests.
|
|
160
|
+
- `validateProductDowngradeRequestDto`: Validates product downgrade requests.
|
|
161
|
+
- `validateProductSuspendRequestDto`: Validates product suspension requests.
|
|
162
|
+
- `validateProductUnsuspendRequestDto`: Validates product unsuspension requests.
|
|
163
|
+
- `validateProductUpgradableRequestDto`: Validates product upgradability checks.
|
|
164
|
+
- `validateProductDowngradableRequestDto`: Validates product downgradability checks.
|
|
116
165
|
- `validateProductValidateAttributesRequestDto`: Validates requests for product attribute validation.
|
|
117
166
|
|
|
167
|
+
### Custom Decorators
|
|
168
|
+
|
|
169
|
+
The package includes custom `class-validator` decorators for advanced validation scenarios:
|
|
170
|
+
|
|
171
|
+
- `@AllOrNoneProperty`: Ensures specified properties are either all present or all absent together.
|
|
172
|
+
- `@AtLeastOneNonEmptyProperty`: Ensures at least one of the specified properties is non-empty.
|
|
173
|
+
- `@IsOfAllowedTypes`: Validates if a value is one of the allowed types with additional constraints.
|
|
174
|
+
- `@IsOneOf`: Validates if a value is an instance of one of the specified classes.
|
|
175
|
+
- `@IsPlainObject`: Validates if a value is a plain object with key-value pairs.
|
|
176
|
+
- `@IsPropertyForbidden`: Ensures a specific property is not present in the object.
|
|
177
|
+
- `@IsRegex`: Validates if a string is a valid regular expression.
|
|
178
|
+
- `@MinLessOrEqualMaxProperty`: Ensures minimum values are less than or equal to maximum values.
|
|
179
|
+
- `@UniqueFieldInArray`: Ensures all objects in an array have unique values for a specified field.
|
|
180
|
+
|
|
181
|
+
### Transformers
|
|
182
|
+
|
|
183
|
+
Transformer functions for converting plain objects to typed DTOs:
|
|
184
|
+
|
|
185
|
+
- `transformMenu`: Converts plain objects to `MenuDtoWithUrl` or `MenuDtoWithSubmenu` based on the type property.
|
|
186
|
+
- `transformSettings`: Converts plain objects to `SettingsWithUrlDto` or `SettingsWithTabsDto` based on the presence of url or tabs properties.
|
|
187
|
+
|
|
188
|
+
## Generating JSON Schemas
|
|
189
|
+
|
|
190
|
+
This package can generate JSON Schemas for all DTOs using the `class-validator-jsonschema` integration. The generated schemas are used in OpenAPI and other tooling.
|
|
191
|
+
|
|
192
|
+
- Script: `npm run build:schemas`
|
|
193
|
+
- Output: `openapi/schemas/components.schemas.ts`
|
|
194
|
+
|
|
195
|
+
During packaging, schemas are built automatically via the `prepack` script. Run the command locally whenever you change DTOs or validators and want to refresh the schemas.
|
|
196
|
+
|
|
118
197
|
## Usage Example
|
|
119
198
|
|
|
120
199
|
Here is an example of how to use a DTO and its validator.
|
package/dist/dtos/field.dto.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ export declare class FieldDto {
|
|
|
28
28
|
* Type of the field
|
|
29
29
|
*/
|
|
30
30
|
type: FieldTypeEnum;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
repeatableMin?: number;
|
|
32
|
+
repeatableMax?: number;
|
|
33
33
|
/**
|
|
34
34
|
* Indicates if the field is required
|
|
35
35
|
*/
|
|
@@ -39,9 +39,13 @@ export declare class FieldDto {
|
|
|
39
39
|
*/
|
|
40
40
|
disabled: boolean;
|
|
41
41
|
/**
|
|
42
|
-
* Indicates if the field is hidden
|
|
42
|
+
* Indicates if the field is hidden in order
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
visibleInOrder: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates if the field is visible in client panel
|
|
47
|
+
*/
|
|
48
|
+
visibleInClientPanel: boolean;
|
|
45
49
|
/**
|
|
46
50
|
* Regex validation pattern for the field
|
|
47
51
|
*/
|
package/dist/dtos/field.dto.js
CHANGED
|
@@ -103,12 +103,12 @@ __decorate([
|
|
|
103
103
|
(0, class_validator_1.IsOptional)(),
|
|
104
104
|
(0, class_validator_1.IsNumber)(),
|
|
105
105
|
__metadata("design:type", Number)
|
|
106
|
-
], FieldDto.prototype, "
|
|
106
|
+
], FieldDto.prototype, "repeatableMin", void 0);
|
|
107
107
|
__decorate([
|
|
108
108
|
(0, class_validator_1.IsOptional)(),
|
|
109
109
|
(0, class_validator_1.IsNumber)(),
|
|
110
110
|
__metadata("design:type", Number)
|
|
111
|
-
], FieldDto.prototype, "
|
|
111
|
+
], FieldDto.prototype, "repeatableMax", void 0);
|
|
112
112
|
__decorate([
|
|
113
113
|
(0, class_validator_1.IsBoolean)(),
|
|
114
114
|
(0, class_validator_1.IsDefined)(),
|
|
@@ -133,12 +133,22 @@ __decorate([
|
|
|
133
133
|
(0, class_validator_1.IsBoolean)(),
|
|
134
134
|
(0, class_validator_1.IsDefined)(),
|
|
135
135
|
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
136
|
-
title: '
|
|
137
|
-
description: 'Whether the field is
|
|
136
|
+
title: 'Visible In Order',
|
|
137
|
+
description: 'Whether the field is visible in order.',
|
|
138
138
|
type: 'boolean',
|
|
139
139
|
}),
|
|
140
140
|
__metadata("design:type", Boolean)
|
|
141
|
-
], FieldDto.prototype, "
|
|
141
|
+
], FieldDto.prototype, "visibleInOrder", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, class_validator_1.IsBoolean)(),
|
|
144
|
+
(0, class_validator_1.IsDefined)(),
|
|
145
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
146
|
+
title: 'Visible In Client Panel',
|
|
147
|
+
description: 'Whether the field is visible in client panel.',
|
|
148
|
+
type: 'boolean',
|
|
149
|
+
}),
|
|
150
|
+
__metadata("design:type", Boolean)
|
|
151
|
+
], FieldDto.prototype, "visibleInClientPanel", void 0);
|
|
142
152
|
__decorate([
|
|
143
153
|
(0, class_validator_1.IsString)(),
|
|
144
154
|
(0, is_regex_validator_1.IsRegex)(),
|
|
@@ -198,6 +208,6 @@ __decorate([
|
|
|
198
208
|
__metadata("design:type", Boolean)
|
|
199
209
|
], FieldDto.prototype, "upgradable", void 0);
|
|
200
210
|
exports.FieldDto = FieldDto = __decorate([
|
|
201
|
-
(0, all_or_none_validator_1.AllOrNoneProperty)(['
|
|
202
|
-
(0, min_less_or_equal_validator_1.MinLessOrEqualMaxProperty)(['
|
|
211
|
+
(0, all_or_none_validator_1.AllOrNoneProperty)(['repeatableMin', 'repeatableMax']),
|
|
212
|
+
(0, min_less_or_equal_validator_1.MinLessOrEqualMaxProperty)(['repeatableMin', 'repeatableMax'])
|
|
203
213
|
], FieldDto);
|
|
@@ -31,7 +31,7 @@ __decorate([
|
|
|
31
31
|
description: 'Notification channel type.',
|
|
32
32
|
type: 'string',
|
|
33
33
|
enum: Object.values(notification_message_type_enum_1.NotificationMessageTypeEnum),
|
|
34
|
-
example: Object.values(notification_message_type_enum_1.NotificationMessageTypeEnum)[0]
|
|
34
|
+
example: Object.values(notification_message_type_enum_1.NotificationMessageTypeEnum)[0],
|
|
35
35
|
}),
|
|
36
36
|
__metadata("design:type", String)
|
|
37
37
|
], NotificationInfoDto.prototype, "type", void 0);
|
|
@@ -46,8 +46,12 @@ __decorate([
|
|
|
46
46
|
type: 'array',
|
|
47
47
|
items: { $ref: '#/components/schemas/UnitDto' },
|
|
48
48
|
example: [
|
|
49
|
-
{
|
|
50
|
-
|
|
49
|
+
{
|
|
50
|
+
id: 'messages',
|
|
51
|
+
unitDescription: 'Message sent',
|
|
52
|
+
intervalDescription: 'Per month',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
51
55
|
}),
|
|
52
56
|
__metadata("design:type", Array)
|
|
53
57
|
], NotificationInfoDto.prototype, "payPerUseUnits", void 0);
|
|
@@ -8,6 +8,7 @@ var ActionsEnum;
|
|
|
8
8
|
ActionsEnum["UPGRADE"] = "upgrade";
|
|
9
9
|
ActionsEnum["DOWNGRADE"] = "downgrade";
|
|
10
10
|
ActionsEnum["TRANSFER"] = "transfer";
|
|
11
|
+
ActionsEnum["TRADE"] = "trade";
|
|
11
12
|
ActionsEnum["SUSPEND"] = "suspend";
|
|
12
13
|
ActionsEnum["UNSUSPEND"] = "unsuspend";
|
|
13
14
|
ActionsEnum["DELETE"] = "delete";
|
|
@@ -103,8 +103,11 @@ export declare enum EventsEnum {
|
|
|
103
103
|
ORDER_STATUS_INPROGRESS = "order/status/in-progress",
|
|
104
104
|
ORDER_STATUS_COMPLETED = "order/status/completed",
|
|
105
105
|
ORDER_STATUS_CANCELED = "order/status/canceled",
|
|
106
|
-
|
|
106
|
+
ORDER_STATUS_PENDING = "order/status/pending",
|
|
107
|
+
ORDER_STATUS_ARCHIVED = "order/status/archived",
|
|
107
108
|
ORDER_INSUFFICIENT_BALANCE = "order/insufficient-balance",
|
|
109
|
+
ORDER_ITEM_DETACHED = "order/item-detached",
|
|
110
|
+
ORDER_INVOICE_CONTACT_CHANGED = "order/invoice-contact-changed",
|
|
108
111
|
ORDER_UPDATED = "order/updated",
|
|
109
112
|
ORDER_DELETED = "order/deleted",
|
|
110
113
|
SETTING_CREATED = "setting/created",
|
|
@@ -107,8 +107,11 @@ var EventsEnum;
|
|
|
107
107
|
EventsEnum["ORDER_STATUS_INPROGRESS"] = "order/status/in-progress";
|
|
108
108
|
EventsEnum["ORDER_STATUS_COMPLETED"] = "order/status/completed";
|
|
109
109
|
EventsEnum["ORDER_STATUS_CANCELED"] = "order/status/canceled";
|
|
110
|
-
EventsEnum["
|
|
110
|
+
EventsEnum["ORDER_STATUS_PENDING"] = "order/status/pending";
|
|
111
|
+
EventsEnum["ORDER_STATUS_ARCHIVED"] = "order/status/archived";
|
|
111
112
|
EventsEnum["ORDER_INSUFFICIENT_BALANCE"] = "order/insufficient-balance";
|
|
113
|
+
EventsEnum["ORDER_ITEM_DETACHED"] = "order/item-detached";
|
|
114
|
+
EventsEnum["ORDER_INVOICE_CONTACT_CHANGED"] = "order/invoice-contact-changed";
|
|
112
115
|
EventsEnum["ORDER_UPDATED"] = "order/updated";
|
|
113
116
|
EventsEnum["ORDER_DELETED"] = "order/deleted";
|
|
114
117
|
EventsEnum["SETTING_CREATED"] = "setting/created";
|
|
@@ -495,7 +495,7 @@ export declare const ComponentsSchemas: {
|
|
|
495
495
|
};
|
|
496
496
|
readonly supportedActions: {
|
|
497
497
|
readonly items: {
|
|
498
|
-
readonly enum: readonly ["create", "renew", "upgrade", "downgrade", "transfer", "suspend", "unsuspend", "delete"];
|
|
498
|
+
readonly enum: readonly ["create", "renew", "upgrade", "downgrade", "transfer", "trade", "suspend", "unsuspend", "delete"];
|
|
499
499
|
readonly type: "string";
|
|
500
500
|
};
|
|
501
501
|
readonly type: "array";
|
|
@@ -504,7 +504,7 @@ export declare const ComponentsSchemas: {
|
|
|
504
504
|
};
|
|
505
505
|
readonly listenEvents: {
|
|
506
506
|
readonly items: {
|
|
507
|
-
readonly enum: readonly ["user/created", "user/updated", "user/deleted", "user/banned", "user/unbanned", "user/company/access/added", "user/company/access/removed", "user/locked", "user/credit-balance/updated", "user/unlocked", "user/password/updated", "user/email/updated", "user/currency/updated", "user/invoice-contact/updated", "user/policy/updated", "user/languages/updated", "user/custom-price-policies/updated", "user/custom-addon-price-policies/updated", "user/custom-affiliate/added", "user/custom-affiliate/removed", "user/invoice-interval/updated", "user/additional-notification-email/removed", "user/additional-notification-email/added", "user/comment/added", "user/comment/removed", "user/comment/updated", "user/tags/updated", "user/setting/added", "user/setting/removed", "user/setting/updated", "user/start-selling", "user/roles/updated", "user/roles/added", "user/roles/deleted", "message/created", "message/updated", "message/deleted", "notification/sent", "policy/created", "policy/updated", "policy/deleted", "product-category/created", "product-category/updated", "product-category/deleted", "invoice-contact/created", "invoice-contact/updated", "invoice-contact/deleted", "invoice/created", "invoice/updated", "invoice/deleted", "currency/created", "currency/updated", "currency/deleted", "affiliate/created", "affiliate/updated", "affiliate/deleted", "company/created", "company/updated", "company/deleted", "organization/integration/attached", "organization/integration/detached", "tld/created", "tld/updated", "tld/deleted", "integration/created", "integration/updated", "integration/deleted", "integration/installed", "integration/uninstalled", "integration/activated", "integration/deactivated", "integration/maintenance-started", "integration/maintenance-finished", "domain-contact/created", "domain-contact/updated", "domain-contact/deleted", "domain-category/created", "domain-category/updated", "domain-category/deleted", "addon/created", "addon/updated", "addon/deleted", "transaction/created", "transaction/canceled", "transaction/failed", "transaction/subscribed", "transaction/unsubscribed", "transaction/updated", "transaction/deleted", "transaction/completed", "transaction/refunded", "template/created", "template/updated", "template/deleted", "coupon/created", "coupon/updated", "coupon/deleted", "template-integration/created", "template-integration/updated", "template-integration/deleted", "order/created", "order/status/in-progress", "order/status/completed", "order/status/canceled", "order/status/
|
|
507
|
+
readonly enum: readonly ["user/created", "user/updated", "user/deleted", "user/banned", "user/unbanned", "user/company/access/added", "user/company/access/removed", "user/locked", "user/credit-balance/updated", "user/unlocked", "user/password/updated", "user/email/updated", "user/currency/updated", "user/invoice-contact/updated", "user/policy/updated", "user/languages/updated", "user/custom-price-policies/updated", "user/custom-addon-price-policies/updated", "user/custom-affiliate/added", "user/custom-affiliate/removed", "user/invoice-interval/updated", "user/additional-notification-email/removed", "user/additional-notification-email/added", "user/comment/added", "user/comment/removed", "user/comment/updated", "user/tags/updated", "user/setting/added", "user/setting/removed", "user/setting/updated", "user/start-selling", "user/roles/updated", "user/roles/added", "user/roles/deleted", "message/created", "message/updated", "message/deleted", "notification/sent", "policy/created", "policy/updated", "policy/deleted", "product-category/created", "product-category/updated", "product-category/deleted", "invoice-contact/created", "invoice-contact/updated", "invoice-contact/deleted", "invoice/created", "invoice/updated", "invoice/deleted", "currency/created", "currency/updated", "currency/deleted", "affiliate/created", "affiliate/updated", "affiliate/deleted", "company/created", "company/updated", "company/deleted", "organization/integration/attached", "organization/integration/detached", "tld/created", "tld/updated", "tld/deleted", "integration/created", "integration/updated", "integration/deleted", "integration/installed", "integration/uninstalled", "integration/activated", "integration/deactivated", "integration/maintenance-started", "integration/maintenance-finished", "domain-contact/created", "domain-contact/updated", "domain-contact/deleted", "domain-category/created", "domain-category/updated", "domain-category/deleted", "addon/created", "addon/updated", "addon/deleted", "transaction/created", "transaction/canceled", "transaction/failed", "transaction/subscribed", "transaction/unsubscribed", "transaction/updated", "transaction/deleted", "transaction/completed", "transaction/refunded", "template/created", "template/updated", "template/deleted", "coupon/created", "coupon/updated", "coupon/deleted", "template-integration/created", "template-integration/updated", "template-integration/deleted", "order/created", "order/status/in-progress", "order/status/completed", "order/status/canceled", "order/status/pending", "order/status/archived", "order/insufficient-balance", "order/item-detached", "order/invoice-contact-changed", "order/updated", "order/deleted", "setting/created", "setting/updated", "setting/deleted", "issue/created", "issue/updated", "issue/deleted", "task/created", "task/updated", "task/deleted", "task/canceled", "task/in-progress", "task/completed", "task/percentage/updated", "product/created", "product/updated", "product/deleted", "product/auto-renew/updated", "product/enabled", "product/disabled", "product/version-created", "ip-group/created", "ip-group/updated", "ip-group/deleted", "ip/created", "ip/updated", "ip/deleted", "domain-name/created", "domain-name/updated", "domain-name/deleted", "domain-name/locked", "domain-name/unlocked", "domain-name/idshield-activated", "domain-name/idshield-deactivated", "domain-name/bundle-added", "domain-name/bundle-removed", "domain-name/registrant-updated", "domain-name/admin-updated", "domain-name/tech-updated", "domain-name/billing-updated", "domain-name/additional-updated", "item/created", "item/updated", "item/deleted", "item/renewed", "item/upgraded", "item/downgraded", "item/ip-attached", "item/ip-detached", "item/detached-from-order", "item/postponed", "item/transferred-in", "item/canceled", "item/suspended", "item/unsuspended", "item/affiliate/added", "item/bundle/attached", "item/bundle/detached", "item/activated", "item/set-inactive", "item/processed", "order/paid", "test", "dead-lettering", "core-queue"];
|
|
508
508
|
readonly type: "string";
|
|
509
509
|
};
|
|
510
510
|
readonly minItems: 1;
|
|
@@ -642,7 +642,7 @@ export declare const ComponentsSchemas: {
|
|
|
642
642
|
};
|
|
643
643
|
readonly supportedActions: {
|
|
644
644
|
readonly items: {
|
|
645
|
-
readonly enum: readonly ["create", "renew", "upgrade", "downgrade", "transfer", "suspend", "unsuspend", "delete"];
|
|
645
|
+
readonly enum: readonly ["create", "renew", "upgrade", "downgrade", "transfer", "trade", "suspend", "unsuspend", "delete"];
|
|
646
646
|
readonly type: "string";
|
|
647
647
|
};
|
|
648
648
|
readonly type: "array";
|
|
@@ -651,7 +651,7 @@ export declare const ComponentsSchemas: {
|
|
|
651
651
|
};
|
|
652
652
|
readonly listenEvents: {
|
|
653
653
|
readonly items: {
|
|
654
|
-
readonly enum: readonly ["user/created", "user/updated", "user/deleted", "user/banned", "user/unbanned", "user/company/access/added", "user/company/access/removed", "user/locked", "user/credit-balance/updated", "user/unlocked", "user/password/updated", "user/email/updated", "user/currency/updated", "user/invoice-contact/updated", "user/policy/updated", "user/languages/updated", "user/custom-price-policies/updated", "user/custom-addon-price-policies/updated", "user/custom-affiliate/added", "user/custom-affiliate/removed", "user/invoice-interval/updated", "user/additional-notification-email/removed", "user/additional-notification-email/added", "user/comment/added", "user/comment/removed", "user/comment/updated", "user/tags/updated", "user/setting/added", "user/setting/removed", "user/setting/updated", "user/start-selling", "user/roles/updated", "user/roles/added", "user/roles/deleted", "message/created", "message/updated", "message/deleted", "notification/sent", "policy/created", "policy/updated", "policy/deleted", "product-category/created", "product-category/updated", "product-category/deleted", "invoice-contact/created", "invoice-contact/updated", "invoice-contact/deleted", "invoice/created", "invoice/updated", "invoice/deleted", "currency/created", "currency/updated", "currency/deleted", "affiliate/created", "affiliate/updated", "affiliate/deleted", "company/created", "company/updated", "company/deleted", "organization/integration/attached", "organization/integration/detached", "tld/created", "tld/updated", "tld/deleted", "integration/created", "integration/updated", "integration/deleted", "integration/installed", "integration/uninstalled", "integration/activated", "integration/deactivated", "integration/maintenance-started", "integration/maintenance-finished", "domain-contact/created", "domain-contact/updated", "domain-contact/deleted", "domain-category/created", "domain-category/updated", "domain-category/deleted", "addon/created", "addon/updated", "addon/deleted", "transaction/created", "transaction/canceled", "transaction/failed", "transaction/subscribed", "transaction/unsubscribed", "transaction/updated", "transaction/deleted", "transaction/completed", "transaction/refunded", "template/created", "template/updated", "template/deleted", "coupon/created", "coupon/updated", "coupon/deleted", "template-integration/created", "template-integration/updated", "template-integration/deleted", "order/created", "order/status/in-progress", "order/status/completed", "order/status/canceled", "order/status/
|
|
654
|
+
readonly enum: readonly ["user/created", "user/updated", "user/deleted", "user/banned", "user/unbanned", "user/company/access/added", "user/company/access/removed", "user/locked", "user/credit-balance/updated", "user/unlocked", "user/password/updated", "user/email/updated", "user/currency/updated", "user/invoice-contact/updated", "user/policy/updated", "user/languages/updated", "user/custom-price-policies/updated", "user/custom-addon-price-policies/updated", "user/custom-affiliate/added", "user/custom-affiliate/removed", "user/invoice-interval/updated", "user/additional-notification-email/removed", "user/additional-notification-email/added", "user/comment/added", "user/comment/removed", "user/comment/updated", "user/tags/updated", "user/setting/added", "user/setting/removed", "user/setting/updated", "user/start-selling", "user/roles/updated", "user/roles/added", "user/roles/deleted", "message/created", "message/updated", "message/deleted", "notification/sent", "policy/created", "policy/updated", "policy/deleted", "product-category/created", "product-category/updated", "product-category/deleted", "invoice-contact/created", "invoice-contact/updated", "invoice-contact/deleted", "invoice/created", "invoice/updated", "invoice/deleted", "currency/created", "currency/updated", "currency/deleted", "affiliate/created", "affiliate/updated", "affiliate/deleted", "company/created", "company/updated", "company/deleted", "organization/integration/attached", "organization/integration/detached", "tld/created", "tld/updated", "tld/deleted", "integration/created", "integration/updated", "integration/deleted", "integration/installed", "integration/uninstalled", "integration/activated", "integration/deactivated", "integration/maintenance-started", "integration/maintenance-finished", "domain-contact/created", "domain-contact/updated", "domain-contact/deleted", "domain-category/created", "domain-category/updated", "domain-category/deleted", "addon/created", "addon/updated", "addon/deleted", "transaction/created", "transaction/canceled", "transaction/failed", "transaction/subscribed", "transaction/unsubscribed", "transaction/updated", "transaction/deleted", "transaction/completed", "transaction/refunded", "template/created", "template/updated", "template/deleted", "coupon/created", "coupon/updated", "coupon/deleted", "template-integration/created", "template-integration/updated", "template-integration/deleted", "order/created", "order/status/in-progress", "order/status/completed", "order/status/canceled", "order/status/pending", "order/status/archived", "order/insufficient-balance", "order/item-detached", "order/invoice-contact-changed", "order/updated", "order/deleted", "setting/created", "setting/updated", "setting/deleted", "issue/created", "issue/updated", "issue/deleted", "task/created", "task/updated", "task/deleted", "task/canceled", "task/in-progress", "task/completed", "task/percentage/updated", "product/created", "product/updated", "product/deleted", "product/auto-renew/updated", "product/enabled", "product/disabled", "product/version-created", "ip-group/created", "ip-group/updated", "ip-group/deleted", "ip/created", "ip/updated", "ip/deleted", "domain-name/created", "domain-name/updated", "domain-name/deleted", "domain-name/locked", "domain-name/unlocked", "domain-name/idshield-activated", "domain-name/idshield-deactivated", "domain-name/bundle-added", "domain-name/bundle-removed", "domain-name/registrant-updated", "domain-name/admin-updated", "domain-name/tech-updated", "domain-name/billing-updated", "domain-name/additional-updated", "item/created", "item/updated", "item/deleted", "item/renewed", "item/upgraded", "item/downgraded", "item/ip-attached", "item/ip-detached", "item/detached-from-order", "item/postponed", "item/transferred-in", "item/canceled", "item/suspended", "item/unsuspended", "item/affiliate/added", "item/bundle/attached", "item/bundle/detached", "item/activated", "item/set-inactive", "item/processed", "order/paid", "test", "dead-lettering", "core-queue"];
|
|
655
655
|
readonly type: "string";
|
|
656
656
|
};
|
|
657
657
|
readonly minItems: 1;
|
|
@@ -787,10 +787,10 @@ export declare const ComponentsSchemas: {
|
|
|
787
787
|
readonly title: "Field Type";
|
|
788
788
|
readonly description: "Type of the field.";
|
|
789
789
|
};
|
|
790
|
-
readonly
|
|
790
|
+
readonly repeatableMin: {
|
|
791
791
|
readonly type: "number";
|
|
792
792
|
};
|
|
793
|
-
readonly
|
|
793
|
+
readonly repeatableMax: {
|
|
794
794
|
readonly type: "number";
|
|
795
795
|
};
|
|
796
796
|
readonly required: {
|
|
@@ -809,13 +809,21 @@ export declare const ComponentsSchemas: {
|
|
|
809
809
|
readonly title: "Disabled";
|
|
810
810
|
readonly description: "Whether the field is disabled.";
|
|
811
811
|
};
|
|
812
|
-
readonly
|
|
812
|
+
readonly visibleInOrder: {
|
|
813
813
|
readonly not: {
|
|
814
814
|
readonly type: "null";
|
|
815
815
|
};
|
|
816
816
|
readonly type: "boolean";
|
|
817
|
-
readonly title: "
|
|
818
|
-
readonly description: "Whether the field is
|
|
817
|
+
readonly title: "Visible In Order";
|
|
818
|
+
readonly description: "Whether the field is visible in order.";
|
|
819
|
+
};
|
|
820
|
+
readonly visibleInClientPanel: {
|
|
821
|
+
readonly not: {
|
|
822
|
+
readonly type: "null";
|
|
823
|
+
};
|
|
824
|
+
readonly type: "boolean";
|
|
825
|
+
readonly title: "Visible In Client Panel";
|
|
826
|
+
readonly description: "Whether the field is visible in client panel.";
|
|
819
827
|
};
|
|
820
828
|
readonly regexValidation: {
|
|
821
829
|
readonly type: "string";
|
|
@@ -854,7 +862,7 @@ export declare const ComponentsSchemas: {
|
|
|
854
862
|
};
|
|
855
863
|
};
|
|
856
864
|
readonly type: "object";
|
|
857
|
-
readonly required: readonly ["id", "label", "value", "type", "required", "disabled", "
|
|
865
|
+
readonly required: readonly ["id", "label", "value", "type", "required", "disabled", "visibleInOrder", "visibleInClientPanel", "upgradable"];
|
|
858
866
|
};
|
|
859
867
|
readonly ProductInfoDto: {
|
|
860
868
|
readonly properties: {
|
|
@@ -938,7 +946,7 @@ export declare const ComponentsSchemas: {
|
|
|
938
946
|
};
|
|
939
947
|
readonly supportedActions: {
|
|
940
948
|
readonly items: {
|
|
941
|
-
readonly enum: readonly ["create", "renew", "upgrade", "downgrade", "transfer", "suspend", "unsuspend", "delete"];
|
|
949
|
+
readonly enum: readonly ["create", "renew", "upgrade", "downgrade", "transfer", "trade", "suspend", "unsuspend", "delete"];
|
|
942
950
|
readonly type: "string";
|
|
943
951
|
};
|
|
944
952
|
readonly type: "array";
|
|
@@ -947,7 +955,7 @@ export declare const ComponentsSchemas: {
|
|
|
947
955
|
};
|
|
948
956
|
readonly listenEvents: {
|
|
949
957
|
readonly items: {
|
|
950
|
-
readonly enum: readonly ["user/created", "user/updated", "user/deleted", "user/banned", "user/unbanned", "user/company/access/added", "user/company/access/removed", "user/locked", "user/credit-balance/updated", "user/unlocked", "user/password/updated", "user/email/updated", "user/currency/updated", "user/invoice-contact/updated", "user/policy/updated", "user/languages/updated", "user/custom-price-policies/updated", "user/custom-addon-price-policies/updated", "user/custom-affiliate/added", "user/custom-affiliate/removed", "user/invoice-interval/updated", "user/additional-notification-email/removed", "user/additional-notification-email/added", "user/comment/added", "user/comment/removed", "user/comment/updated", "user/tags/updated", "user/setting/added", "user/setting/removed", "user/setting/updated", "user/start-selling", "user/roles/updated", "user/roles/added", "user/roles/deleted", "message/created", "message/updated", "message/deleted", "notification/sent", "policy/created", "policy/updated", "policy/deleted", "product-category/created", "product-category/updated", "product-category/deleted", "invoice-contact/created", "invoice-contact/updated", "invoice-contact/deleted", "invoice/created", "invoice/updated", "invoice/deleted", "currency/created", "currency/updated", "currency/deleted", "affiliate/created", "affiliate/updated", "affiliate/deleted", "company/created", "company/updated", "company/deleted", "organization/integration/attached", "organization/integration/detached", "tld/created", "tld/updated", "tld/deleted", "integration/created", "integration/updated", "integration/deleted", "integration/installed", "integration/uninstalled", "integration/activated", "integration/deactivated", "integration/maintenance-started", "integration/maintenance-finished", "domain-contact/created", "domain-contact/updated", "domain-contact/deleted", "domain-category/created", "domain-category/updated", "domain-category/deleted", "addon/created", "addon/updated", "addon/deleted", "transaction/created", "transaction/canceled", "transaction/failed", "transaction/subscribed", "transaction/unsubscribed", "transaction/updated", "transaction/deleted", "transaction/completed", "transaction/refunded", "template/created", "template/updated", "template/deleted", "coupon/created", "coupon/updated", "coupon/deleted", "template-integration/created", "template-integration/updated", "template-integration/deleted", "order/created", "order/status/in-progress", "order/status/completed", "order/status/canceled", "order/status/
|
|
958
|
+
readonly enum: readonly ["user/created", "user/updated", "user/deleted", "user/banned", "user/unbanned", "user/company/access/added", "user/company/access/removed", "user/locked", "user/credit-balance/updated", "user/unlocked", "user/password/updated", "user/email/updated", "user/currency/updated", "user/invoice-contact/updated", "user/policy/updated", "user/languages/updated", "user/custom-price-policies/updated", "user/custom-addon-price-policies/updated", "user/custom-affiliate/added", "user/custom-affiliate/removed", "user/invoice-interval/updated", "user/additional-notification-email/removed", "user/additional-notification-email/added", "user/comment/added", "user/comment/removed", "user/comment/updated", "user/tags/updated", "user/setting/added", "user/setting/removed", "user/setting/updated", "user/start-selling", "user/roles/updated", "user/roles/added", "user/roles/deleted", "message/created", "message/updated", "message/deleted", "notification/sent", "policy/created", "policy/updated", "policy/deleted", "product-category/created", "product-category/updated", "product-category/deleted", "invoice-contact/created", "invoice-contact/updated", "invoice-contact/deleted", "invoice/created", "invoice/updated", "invoice/deleted", "currency/created", "currency/updated", "currency/deleted", "affiliate/created", "affiliate/updated", "affiliate/deleted", "company/created", "company/updated", "company/deleted", "organization/integration/attached", "organization/integration/detached", "tld/created", "tld/updated", "tld/deleted", "integration/created", "integration/updated", "integration/deleted", "integration/installed", "integration/uninstalled", "integration/activated", "integration/deactivated", "integration/maintenance-started", "integration/maintenance-finished", "domain-contact/created", "domain-contact/updated", "domain-contact/deleted", "domain-category/created", "domain-category/updated", "domain-category/deleted", "addon/created", "addon/updated", "addon/deleted", "transaction/created", "transaction/canceled", "transaction/failed", "transaction/subscribed", "transaction/unsubscribed", "transaction/updated", "transaction/deleted", "transaction/completed", "transaction/refunded", "template/created", "template/updated", "template/deleted", "coupon/created", "coupon/updated", "coupon/deleted", "template-integration/created", "template-integration/updated", "template-integration/deleted", "order/created", "order/status/in-progress", "order/status/completed", "order/status/canceled", "order/status/pending", "order/status/archived", "order/insufficient-balance", "order/item-detached", "order/invoice-contact-changed", "order/updated", "order/deleted", "setting/created", "setting/updated", "setting/deleted", "issue/created", "issue/updated", "issue/deleted", "task/created", "task/updated", "task/deleted", "task/canceled", "task/in-progress", "task/completed", "task/percentage/updated", "product/created", "product/updated", "product/deleted", "product/auto-renew/updated", "product/enabled", "product/disabled", "product/version-created", "ip-group/created", "ip-group/updated", "ip-group/deleted", "ip/created", "ip/updated", "ip/deleted", "domain-name/created", "domain-name/updated", "domain-name/deleted", "domain-name/locked", "domain-name/unlocked", "domain-name/idshield-activated", "domain-name/idshield-deactivated", "domain-name/bundle-added", "domain-name/bundle-removed", "domain-name/registrant-updated", "domain-name/admin-updated", "domain-name/tech-updated", "domain-name/billing-updated", "domain-name/additional-updated", "item/created", "item/updated", "item/deleted", "item/renewed", "item/upgraded", "item/downgraded", "item/ip-attached", "item/ip-detached", "item/detached-from-order", "item/postponed", "item/transferred-in", "item/canceled", "item/suspended", "item/unsuspended", "item/affiliate/added", "item/bundle/attached", "item/bundle/detached", "item/activated", "item/set-inactive", "item/processed", "order/paid", "test", "dead-lettering", "core-queue"];
|
|
951
959
|
readonly type: "string";
|
|
952
960
|
};
|
|
953
961
|
readonly minItems: 1;
|
|
@@ -747,6 +747,7 @@ exports.ComponentsSchemas = {
|
|
|
747
747
|
"upgrade",
|
|
748
748
|
"downgrade",
|
|
749
749
|
"transfer",
|
|
750
|
+
"trade",
|
|
750
751
|
"suspend",
|
|
751
752
|
"unsuspend",
|
|
752
753
|
"delete"
|
|
@@ -864,8 +865,11 @@ exports.ComponentsSchemas = {
|
|
|
864
865
|
"order/status/in-progress",
|
|
865
866
|
"order/status/completed",
|
|
866
867
|
"order/status/canceled",
|
|
867
|
-
"order/status/
|
|
868
|
+
"order/status/pending",
|
|
869
|
+
"order/status/archived",
|
|
868
870
|
"order/insufficient-balance",
|
|
871
|
+
"order/item-detached",
|
|
872
|
+
"order/invoice-contact-changed",
|
|
869
873
|
"order/updated",
|
|
870
874
|
"order/deleted",
|
|
871
875
|
"setting/created",
|
|
@@ -1329,6 +1333,7 @@ exports.ComponentsSchemas = {
|
|
|
1329
1333
|
"upgrade",
|
|
1330
1334
|
"downgrade",
|
|
1331
1335
|
"transfer",
|
|
1336
|
+
"trade",
|
|
1332
1337
|
"suspend",
|
|
1333
1338
|
"unsuspend",
|
|
1334
1339
|
"delete"
|
|
@@ -1446,8 +1451,11 @@ exports.ComponentsSchemas = {
|
|
|
1446
1451
|
"order/status/in-progress",
|
|
1447
1452
|
"order/status/completed",
|
|
1448
1453
|
"order/status/canceled",
|
|
1449
|
-
"order/status/
|
|
1454
|
+
"order/status/pending",
|
|
1455
|
+
"order/status/archived",
|
|
1450
1456
|
"order/insufficient-balance",
|
|
1457
|
+
"order/item-detached",
|
|
1458
|
+
"order/invoice-contact-changed",
|
|
1451
1459
|
"order/updated",
|
|
1452
1460
|
"order/deleted",
|
|
1453
1461
|
"setting/created",
|
|
@@ -1912,10 +1920,10 @@ exports.ComponentsSchemas = {
|
|
|
1912
1920
|
"title": "Field Type",
|
|
1913
1921
|
"description": "Type of the field."
|
|
1914
1922
|
},
|
|
1915
|
-
"
|
|
1923
|
+
"repeatableMin": {
|
|
1916
1924
|
"type": "number"
|
|
1917
1925
|
},
|
|
1918
|
-
"
|
|
1926
|
+
"repeatableMax": {
|
|
1919
1927
|
"type": "number"
|
|
1920
1928
|
},
|
|
1921
1929
|
"required": {
|
|
@@ -1934,13 +1942,21 @@ exports.ComponentsSchemas = {
|
|
|
1934
1942
|
"title": "Disabled",
|
|
1935
1943
|
"description": "Whether the field is disabled."
|
|
1936
1944
|
},
|
|
1937
|
-
"
|
|
1945
|
+
"visibleInOrder": {
|
|
1938
1946
|
"not": {
|
|
1939
1947
|
"type": "null"
|
|
1940
1948
|
},
|
|
1941
1949
|
"type": "boolean",
|
|
1942
|
-
"title": "
|
|
1943
|
-
"description": "Whether the field is
|
|
1950
|
+
"title": "Visible In Order",
|
|
1951
|
+
"description": "Whether the field is visible in order."
|
|
1952
|
+
},
|
|
1953
|
+
"visibleInClientPanel": {
|
|
1954
|
+
"not": {
|
|
1955
|
+
"type": "null"
|
|
1956
|
+
},
|
|
1957
|
+
"type": "boolean",
|
|
1958
|
+
"title": "Visible In Client Panel",
|
|
1959
|
+
"description": "Whether the field is visible in client panel."
|
|
1944
1960
|
},
|
|
1945
1961
|
"regexValidation": {
|
|
1946
1962
|
"type": "string",
|
|
@@ -1986,7 +2002,8 @@ exports.ComponentsSchemas = {
|
|
|
1986
2002
|
"type",
|
|
1987
2003
|
"required",
|
|
1988
2004
|
"disabled",
|
|
1989
|
-
"
|
|
2005
|
+
"visibleInOrder",
|
|
2006
|
+
"visibleInClientPanel",
|
|
1990
2007
|
"upgradable"
|
|
1991
2008
|
]
|
|
1992
2009
|
},
|
|
@@ -2267,6 +2284,7 @@ exports.ComponentsSchemas = {
|
|
|
2267
2284
|
"upgrade",
|
|
2268
2285
|
"downgrade",
|
|
2269
2286
|
"transfer",
|
|
2287
|
+
"trade",
|
|
2270
2288
|
"suspend",
|
|
2271
2289
|
"unsuspend",
|
|
2272
2290
|
"delete"
|
|
@@ -2384,8 +2402,11 @@ exports.ComponentsSchemas = {
|
|
|
2384
2402
|
"order/status/in-progress",
|
|
2385
2403
|
"order/status/completed",
|
|
2386
2404
|
"order/status/canceled",
|
|
2387
|
-
"order/status/
|
|
2405
|
+
"order/status/pending",
|
|
2406
|
+
"order/status/archived",
|
|
2388
2407
|
"order/insufficient-balance",
|
|
2408
|
+
"order/item-detached",
|
|
2409
|
+
"order/invoice-contact-changed",
|
|
2389
2410
|
"order/updated",
|
|
2390
2411
|
"order/deleted",
|
|
2391
2412
|
"setting/created",
|
|
@@ -11,7 +11,8 @@ const baseValidDto = {
|
|
|
11
11
|
type: field_type_enum_1.FieldTypeEnum.TEXT_BOX,
|
|
12
12
|
required: true,
|
|
13
13
|
disabled: false,
|
|
14
|
-
|
|
14
|
+
visibleInOrder: false,
|
|
15
|
+
visibleInClientPanel: false,
|
|
15
16
|
upgradable: false,
|
|
16
17
|
};
|
|
17
18
|
describe('FieldDto Validator', () => {
|
|
@@ -31,7 +32,7 @@ describe('FieldDto Validator', () => {
|
|
|
31
32
|
describe('Missing required fields', () => {
|
|
32
33
|
it('should return errors for all missing required fields (except upgradable)', () => {
|
|
33
34
|
const errors = (0, field_validator_1.validateFieldDto)({});
|
|
34
|
-
const requiredProps = ['id', 'label', 'value', 'type', 'required', 'disabled', '
|
|
35
|
+
const requiredProps = ['id', 'label', 'value', 'type', 'required', 'disabled', 'visibleInOrder', 'visibleInClientPanel'];
|
|
35
36
|
for (const prop of requiredProps) {
|
|
36
37
|
expect(errors.some(e => e.property === prop)).toBe(true);
|
|
37
38
|
}
|
|
@@ -74,26 +75,26 @@ describe('FieldDto Validator', () => {
|
|
|
74
75
|
});
|
|
75
76
|
});
|
|
76
77
|
describe('Repeatable constraints (AllOrNone and Min<=Max)', () => {
|
|
77
|
-
it('should fail when only
|
|
78
|
-
const dto = { ...baseValidDto,
|
|
78
|
+
it('should fail when only repeatableMin is present', () => {
|
|
79
|
+
const dto = { ...baseValidDto, repeatableMin: 1 };
|
|
79
80
|
const errors = (0, field_validator_1.validateFieldDto)(dto);
|
|
80
81
|
expect(errors.length).toBeGreaterThan(0);
|
|
81
82
|
// Class-level error; ensure at least one constraint exists
|
|
82
83
|
expect(errors.some(e => e.constraints && (e.constraints['AllOrNone'] || Object.values(e.constraints).some(msg => msg.includes('All of'))))).toBe(true);
|
|
83
84
|
});
|
|
84
|
-
it('should fail when only
|
|
85
|
-
const dto = { ...baseValidDto,
|
|
85
|
+
it('should fail when only repeatableMax is present', () => {
|
|
86
|
+
const dto = { ...baseValidDto, repeatableMax: 2 };
|
|
86
87
|
const errors = (0, field_validator_1.validateFieldDto)(dto);
|
|
87
88
|
expect(errors.length).toBeGreaterThan(0);
|
|
88
89
|
expect(errors.some(e => e.constraints && (e.constraints['AllOrNone'] || Object.values(e.constraints).some(msg => msg.includes('All of'))))).toBe(true);
|
|
89
90
|
});
|
|
90
|
-
it('should pass when both present and
|
|
91
|
-
const dto = { ...baseValidDto,
|
|
91
|
+
it('should pass when both present and repeatableMin <= repeatableMax', () => {
|
|
92
|
+
const dto = { ...baseValidDto, repeatableMin: 1, repeatableMax: 2 };
|
|
92
93
|
const errors = (0, field_validator_1.validateFieldDto)(dto);
|
|
93
94
|
expect(errors).toHaveLength(0);
|
|
94
95
|
});
|
|
95
|
-
it('should fail when both present and
|
|
96
|
-
const dto = { ...baseValidDto,
|
|
96
|
+
it('should fail when both present and repeatableMin > repeatableMax', () => {
|
|
97
|
+
const dto = { ...baseValidDto, repeatableMin: 3, repeatableMax: 2 };
|
|
97
98
|
const errors = (0, field_validator_1.validateFieldDto)(dto);
|
|
98
99
|
expect(errors.length).toBeGreaterThan(0);
|
|
99
100
|
expect(errors.some(e => e.constraints && (e.constraints['MinLessOrEqualMax'] || Object.values(e.constraints).some(msg => msg.includes('must be less than or equal'))))).toBe(true);
|
|
@@ -14,7 +14,8 @@ describe('ProductInfoDto Validator', () => {
|
|
|
14
14
|
type: field_type_enum_1.FieldTypeEnum.TEXT_BOX,
|
|
15
15
|
required: false,
|
|
16
16
|
disabled: false,
|
|
17
|
-
|
|
17
|
+
visibleInOrder: false,
|
|
18
|
+
visibleInClientPanel: true,
|
|
18
19
|
upgradable: false
|
|
19
20
|
};
|
|
20
21
|
const invalidField = {
|
|
@@ -170,7 +171,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
170
171
|
});
|
|
171
172
|
});
|
|
172
173
|
describe('FieldDto class-level constraints inside ProductInfoDto', () => {
|
|
173
|
-
it('fails when a FieldDto has only
|
|
174
|
+
it('fails when a FieldDto has only repeatableMin (AllOrNone)', () => {
|
|
174
175
|
const fieldWithOnlyMin = {
|
|
175
176
|
id: 'f1',
|
|
176
177
|
label: [{ language: language_enum_1.LanguageEnum.EN, text: 'label' }],
|
|
@@ -178,9 +179,10 @@ describe('ProductInfoDto Validator', () => {
|
|
|
178
179
|
type: field_type_enum_1.FieldTypeEnum.TEXT_BOX,
|
|
179
180
|
required: false,
|
|
180
181
|
disabled: false,
|
|
181
|
-
|
|
182
|
+
visibleInOrder: false,
|
|
183
|
+
visibleInClientPanel: true,
|
|
182
184
|
upgradable: false,
|
|
183
|
-
|
|
185
|
+
repeatableMin: 1,
|
|
184
186
|
};
|
|
185
187
|
const dto = {
|
|
186
188
|
title: 'Test',
|
|
@@ -191,7 +193,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
191
193
|
const errors = (0, product_info_validator_1.validateProductInfoDto)(dto);
|
|
192
194
|
expect(errors.length).toBeGreaterThan(0);
|
|
193
195
|
});
|
|
194
|
-
it('fails when a FieldDto has only
|
|
196
|
+
it('fails when a FieldDto has only repeatableMax (AllOrNone)', () => {
|
|
195
197
|
const fieldWithOnlyMax = {
|
|
196
198
|
id: 'f2',
|
|
197
199
|
label: [{ language: language_enum_1.LanguageEnum.EN, text: 'label' }],
|
|
@@ -199,9 +201,10 @@ describe('ProductInfoDto Validator', () => {
|
|
|
199
201
|
type: field_type_enum_1.FieldTypeEnum.TEXT_BOX,
|
|
200
202
|
required: false,
|
|
201
203
|
disabled: false,
|
|
202
|
-
|
|
204
|
+
visibleInOrder: false,
|
|
205
|
+
visibleInClientPanel: true,
|
|
203
206
|
upgradable: false,
|
|
204
|
-
|
|
207
|
+
repeatableMax: 2,
|
|
205
208
|
};
|
|
206
209
|
const dto = {
|
|
207
210
|
title: 'Test',
|
|
@@ -220,10 +223,11 @@ describe('ProductInfoDto Validator', () => {
|
|
|
220
223
|
type: field_type_enum_1.FieldTypeEnum.TEXT_BOX,
|
|
221
224
|
required: false,
|
|
222
225
|
disabled: false,
|
|
223
|
-
|
|
226
|
+
visibleInOrder: false,
|
|
227
|
+
visibleInClientPanel: true,
|
|
224
228
|
upgradable: false,
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
repeatableMin: 1,
|
|
230
|
+
repeatableMax: 2,
|
|
227
231
|
};
|
|
228
232
|
const dto = {
|
|
229
233
|
title: 'Test',
|
|
@@ -241,10 +245,11 @@ describe('ProductInfoDto Validator', () => {
|
|
|
241
245
|
type: field_type_enum_1.FieldTypeEnum.TEXT_BOX,
|
|
242
246
|
required: false,
|
|
243
247
|
disabled: false,
|
|
244
|
-
|
|
248
|
+
visibleInOrder: false,
|
|
249
|
+
visibleInClientPanel: true,
|
|
245
250
|
upgradable: false,
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
repeatableMin: 5,
|
|
252
|
+
repeatableMax: 2,
|
|
248
253
|
};
|
|
249
254
|
const dto = {
|
|
250
255
|
title: 'Test',
|