@hosterai/types 0.0.31 → 0.0.33

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.
Files changed (33) hide show
  1. package/README.md +1 -6
  2. package/dist/decorators/unique-field-in-array-validator.spec.js +0 -14
  3. package/dist/decorators/unique-field-in-array.validator.js +4 -18
  4. package/dist/dtos/addon-field.dto.d.ts +2 -6
  5. package/dist/dtos/addon-field.dto.js +2 -25
  6. package/dist/dtos/attribute-field.dto.d.ts +6 -18
  7. package/dist/dtos/attribute-field.dto.js +2 -18
  8. package/dist/dtos/field.dto.d.ts +64 -5
  9. package/dist/dtos/field.dto.js +186 -0
  10. package/dist/dtos/info.dto.d.ts +2 -2
  11. package/dist/dtos/info.dto.js +5 -2
  12. package/dist/dtos/product/product-info.dto.js +2 -2
  13. package/dist/dtos/responses/validate-attributes-response.dto.d.ts +4 -4
  14. package/dist/dtos/responses/validate-attributes-response.dto.js +6 -2
  15. package/dist/enums/field-type.enum.d.ts +7 -20
  16. package/dist/enums/field-type.enum.js +7 -19
  17. package/dist/enums/roles.enum.d.ts +1 -0
  18. package/dist/enums/roles.enum.js +1 -0
  19. package/dist/index.d.ts +0 -29
  20. package/dist/index.js +0 -29
  21. package/dist/openapi/schemas/components.schemas.d.ts +238 -1171
  22. package/dist/openapi/schemas/components.schemas.js +636 -1944
  23. package/dist/validators/addon-field-validator.d.ts +1 -4
  24. package/dist/validators/addon-field-validator.js +3 -22
  25. package/dist/validators/addon-field-validator.spec.js +21 -15
  26. package/dist/validators/attribute-field-validator.d.ts +0 -4
  27. package/dist/validators/attribute-field-validator.js +0 -16
  28. package/dist/validators/attribute-field-validator.spec.js +20 -30
  29. package/dist/validators/field-validator.d.ts +4 -2
  30. package/dist/validators/field-validator.js +10 -4
  31. package/dist/validators/field-validator.spec.js +79 -16
  32. package/dist/validators/product-info-validator.spec.js +108 -42
  33. package/package.json +1 -1
package/README.md CHANGED
@@ -165,7 +165,6 @@ This package includes validation functions that leverage `class-validator` to en
165
165
  **Available Validators:**
166
166
 
167
167
  **Core Validators:**
168
-
169
168
  - `validateActionDto`: Validates UI actions.
170
169
  - `validateClientDataDto`: Validates client data.
171
170
  - `validateCompanyDataDto`: Validates company data.
@@ -184,28 +183,24 @@ This package includes validation functions that leverage `class-validator` to en
184
183
  - `validateInfoDto`: Validates integration info.
185
184
 
186
185
  **Panel Validators:**
187
-
188
186
  - `validateAdminPanelDto`: Validates admin panel configuration.
189
187
  - `validateAdminPanelTabsDto`: Validates admin panel tabs.
190
188
  - `validateAdminPanelMoreActionsDto`: Validates admin panel additional actions.
191
189
  - `validateClientPanelDto`: Validates client panel configuration.
192
190
 
193
191
  **Menu & Settings Validators:**
194
-
195
192
  - `validateMenuWithUrlDto`: Validates menu items with direct URLs.
196
193
  - `validateMenuWithSubmenuDto`: Validates menu items with submenus.
197
194
  - `validateSettingsWithUrlDto`: Validates settings with URL configuration.
198
195
  - `validateSettingsWithTabsDto`: Validates settings with tabs configuration.
199
196
 
200
197
  **Notification Validators:**
201
-
202
198
  - `validateNotificationRequestDto`: Validates the main notification request.
203
199
  - `validateNotificationInfoDto`: Validates notification information.
204
200
  - `validateEmailReceiverDto`, `validateSmsReceiverDto`, `validatePushReceiverDto`: Validators for notification receivers.
205
201
  - `validateEmailSenderDto`, `validateSmsSenderDto`, `validatePushSenderDto`: Validators for notification senders.
206
202
 
207
203
  **Invoice Validators:**
208
-
209
204
  - `validateInvoiceInfoDto`: Validates invoice integration info.
210
205
  - `validateInvoiceContactDataDto`: Validates invoice contact data.
211
206
  - `validateInvoiceItemDataDto`: Validates invoice item data.
@@ -213,7 +208,6 @@ This package includes validation functions that leverage `class-validator` to en
213
208
  - `validateTransactionDataDto`: Validates transaction data.
214
209
 
215
210
  **Product Validators:**
216
-
217
211
  - `validateProductInfoDto`: Validates product information.
218
212
  - `validateProductCreateRequestDto`: Validates product creation requests.
219
213
  - `validateProductDeleteRequestDto`: Validates product deletion requests.
@@ -226,6 +220,7 @@ This package includes validation functions that leverage `class-validator` to en
226
220
  - `validateProductDowngradableRequestDto`: Validates product downgradability checks.
227
221
  - `validateValidateAttributesRequestDto`: Validates attribute validation requests.
228
222
 
223
+
229
224
  ### Custom Decorators
230
225
 
231
226
  The package includes custom `class-validator` decorators for advanced validation scenarios:
@@ -36,18 +36,4 @@ describe('UniqueFieldInArray', () => {
36
36
  const errors = (0, class_validator_1.validateSync)(dto);
37
37
  expect(errors.length).toBe(0);
38
38
  });
39
- it('should support dotted paths for nested fields', () => {
40
- class NestedDto {
41
- }
42
- __decorate([
43
- (0, unique_field_in_array_validator_1.UniqueFieldInArray)('nested.id'),
44
- __metadata("design:type", Array)
45
- ], NestedDto.prototype, "items", void 0);
46
- const ok = new NestedDto();
47
- ok.items = [{ nested: { id: 1 } }, { nested: { id: 2 } }];
48
- expect((0, class_validator_1.validateSync)(ok).length).toBe(0);
49
- const bad = new NestedDto();
50
- bad.items = [{ nested: { id: 1 } }, { nested: { id: 1 } }];
51
- expect((0, class_validator_1.validateSync)(bad).length).toBeGreaterThan(0);
52
- });
53
39
  });
@@ -9,32 +9,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.UniqueFieldInArrayConstraint = void 0;
10
10
  exports.UniqueFieldInArray = UniqueFieldInArray;
11
11
  const class_validator_1 = require("class-validator");
12
- /**
13
- * Walk a dotted path (`'a.b.c'`) into an object. Returns undefined if any segment is missing
14
- * or if a non-object is encountered before the leaf.
15
- */
16
- function readPath(obj, path) {
17
- let current = obj;
18
- for (const segment of path.split('.')) {
19
- if (current === null || typeof current !== 'object')
20
- return undefined;
21
- current = current[segment];
22
- }
23
- return current;
24
- }
25
12
  let UniqueFieldInArrayConstraint = class UniqueFieldInArrayConstraint {
26
13
  validate(value, args) {
27
14
  if (!Array.isArray(value))
28
15
  return true; // Let @IsArray handle wrong type
29
- const path = args.constraints[0];
16
+ const field = args.constraints[0];
30
17
  const seen = new Set();
31
18
  for (const obj of value) {
32
- const fieldValue = readPath(obj, path);
33
- if (fieldValue !== undefined) {
34
- if (seen.has(fieldValue)) {
19
+ if (obj && typeof obj === 'object' && obj[field] !== undefined) {
20
+ if (seen.has(obj[field])) {
35
21
  return false;
36
22
  }
37
- seen.add(fieldValue);
23
+ seen.add(obj[field]);
38
24
  }
39
25
  }
40
26
  return true;
@@ -1,11 +1,7 @@
1
- import { AnyFieldDto } from './fields/any-field.dto';
1
+ import { FieldDto } from './field.dto';
2
2
  /**
3
3
  * Fields defined by the seller for a product, requested during checkout setup.
4
4
  * These fields contain information relevant only to the seller, not to the integration.
5
- *
6
- * Wraps a concrete field DTO under the nested `field` property — validate the
7
- * union separately (see `validateAddonFieldDto`).
8
5
  */
9
- export declare class AddonFieldDto {
10
- field: AnyFieldDto;
6
+ export declare class AddonFieldDto extends FieldDto {
11
7
  }
@@ -1,34 +1,11 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.AddonFieldDto = void 0;
13
- const class_validator_1 = require("class-validator");
14
- const class_validator_jsonschema_1 = require("class-validator-jsonschema");
4
+ const field_dto_1 = require("./field.dto");
15
5
  /**
16
6
  * Fields defined by the seller for a product, requested during checkout setup.
17
7
  * These fields contain information relevant only to the seller, not to the integration.
18
- *
19
- * Wraps a concrete field DTO under the nested `field` property — validate the
20
- * union separately (see `validateAddonFieldDto`).
21
8
  */
22
- class AddonFieldDto {
9
+ class AddonFieldDto extends field_dto_1.FieldDto {
23
10
  }
24
11
  exports.AddonFieldDto = AddonFieldDto;
25
- __decorate([
26
- (0, class_validator_1.IsObject)(),
27
- (0, class_validator_1.IsDefined)(),
28
- (0, class_validator_jsonschema_1.JSONSchema)({
29
- title: 'Field',
30
- description: 'The concrete field DTO (discriminated by its `type` literal).',
31
- $ref: '#/components/schemas/AnyFieldDto',
32
- }),
33
- __metadata("design:type", Object)
34
- ], AddonFieldDto.prototype, "field", void 0);
@@ -1,31 +1,19 @@
1
- import { AnyFieldDto } from './fields/any-field.dto';
2
- /**
3
- * Wraps a concrete field DTO with product-attribute-specific options.
4
- *
5
- * The underlying field lives under the nested `field` property — its concrete
6
- * class is discriminated by `field.type` and must be validated separately
7
- * (see `validateAttributeFieldDto`).
8
- */
9
- export declare class AttributeFieldDto {
1
+ import { FieldDto } from './field.dto';
2
+ export declare class AttributeFieldDto extends FieldDto {
10
3
  /**
11
- * The concrete field DTO (one of `AnyFieldDto`). Validated separately by
12
- * the dispatcher in `validateAttributeFieldDto` since it is a discriminated union.
13
- */
14
- field: AnyFieldDto;
15
- /**
16
- * Indicates if the field is visible in orders.
4
+ * Indicates if the field is visible in orders
17
5
  */
18
6
  visibleInOrder?: boolean;
19
7
  /**
20
- * Indicates if the field is visible in client panel.
8
+ * Indicates if the field is visible in client panel
21
9
  */
22
10
  visibleInClientPanel?: boolean;
23
11
  /**
24
- * Minimum repeats for repeatable fields.
12
+ * Minimum repeats for repeatable fields
25
13
  */
26
14
  repeatableMin?: number;
27
15
  /**
28
- * Maximum repeats for repeatable fields.
16
+ * Maximum repeats for repeatable fields
29
17
  */
30
18
  repeatableMax?: number;
31
19
  }
@@ -12,28 +12,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AttributeFieldDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const class_validator_jsonschema_1 = require("class-validator-jsonschema");
15
+ const field_dto_1 = require("./field.dto");
15
16
  const all_or_none_validator_1 = require("../decorators/all-or-none.validator");
16
17
  const min_less_or_equal_validator_1 = require("../decorators/min-less-or-equal.validator");
17
- /**
18
- * Wraps a concrete field DTO with product-attribute-specific options.
19
- *
20
- * The underlying field lives under the nested `field` property — its concrete
21
- * class is discriminated by `field.type` and must be validated separately
22
- * (see `validateAttributeFieldDto`).
23
- */
24
- let AttributeFieldDto = class AttributeFieldDto {
18
+ let AttributeFieldDto = class AttributeFieldDto extends field_dto_1.FieldDto {
25
19
  };
26
20
  exports.AttributeFieldDto = AttributeFieldDto;
27
- __decorate([
28
- (0, class_validator_1.IsObject)(),
29
- (0, class_validator_1.IsDefined)(),
30
- (0, class_validator_jsonschema_1.JSONSchema)({
31
- title: 'Field',
32
- description: 'The concrete field DTO (discriminated by its `type` literal).',
33
- $ref: '#/components/schemas/AnyFieldDto',
34
- }),
35
- __metadata("design:type", Object)
36
- ], AttributeFieldDto.prototype, "field", void 0);
37
21
  __decorate([
38
22
  (0, class_validator_1.IsBoolean)(),
39
23
  (0, class_validator_1.IsOptional)(),
@@ -1,7 +1,66 @@
1
- import { AnyFieldDto } from './fields/any-field.dto';
1
+ import { FieldTypeEnum } from '../enums/field-type.enum';
2
+ import { MultilangTextDto } from './multilang-text.dto';
3
+ import { FieldOptionDto } from './field-option.dto';
2
4
  /**
3
- * @deprecated Use a concrete field DTO (`TextFieldDto`, `NumberFieldDto`, ...)
4
- * or the `AnyFieldDto` union directly. This alias is kept for one release while
5
- * downstream consumers migrate (hoster-ai/api issue #449).
5
+ * Data Transfer Object for a form field.
6
+ * This class defines the structure and properties of a single field
7
+ * that can be used in a user interface form.
6
8
  */
7
- export type FieldDto = AnyFieldDto;
9
+ export declare class FieldDto {
10
+ /**
11
+ * ID of action field
12
+ */
13
+ id: string;
14
+ /**
15
+ * Label of action field
16
+ */
17
+ label: MultilangTextDto[];
18
+ /**
19
+ * Value of the field.
20
+ *
21
+ * String is when it is input, text area
22
+ * Number is when it is number
23
+ * FieldOptionDto is when it is checkbox
24
+ * FieldOptionDto[] is when it is radioboxes or select
25
+ */
26
+ value: string | number | FieldOptionDto | FieldOptionDto[];
27
+ /**
28
+ * Type of the field
29
+ */
30
+ type: FieldTypeEnum;
31
+ /**
32
+ * Indicates if the field is required
33
+ */
34
+ required?: boolean;
35
+ /**
36
+ * Indicates if the field is disabled
37
+ */
38
+ disabled?: boolean;
39
+ /**
40
+ * Indicates if the field is hidden
41
+ */
42
+ hidden?: boolean;
43
+ /**
44
+ * Regex validation pattern for the field
45
+ */
46
+ regexValidation?: string;
47
+ /**
48
+ * Error message for the field for supported languages
49
+ */
50
+ regexValidationErrorMessage?: MultilangTextDto[];
51
+ /**
52
+ * Whether remote validation should be triggered
53
+ */
54
+ triggersRemoteValidation?: boolean;
55
+ /**
56
+ * Remote validation error message for supported languages
57
+ */
58
+ remoteValidationErrorMessage?: MultilangTextDto[];
59
+ /**
60
+ * The item attribute is upgradable
61
+ * If the user has the permission to upgrade the item from his panel
62
+ * TODO: Let's see if this approach is the best way for the user to upgrade their item
63
+ */
64
+ upgradable?: boolean;
65
+ downgradable?: boolean;
66
+ }
@@ -1,2 +1,188 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FieldDto = void 0;
13
+ const is_of_allowed_types_validator_1 = require("../decorators/is-of-allowed-types.validator");
14
+ const class_validator_1 = require("class-validator");
15
+ const class_transformer_1 = require("class-transformer");
16
+ const field_type_enum_1 = require("../enums/field-type.enum");
17
+ const multilang_text_dto_1 = require("./multilang-text.dto");
18
+ const field_option_dto_1 = require("./field-option.dto");
19
+ const is_regex_validator_1 = require("../decorators/is-regex.validator");
20
+ const class_validator_jsonschema_1 = require("class-validator-jsonschema");
21
+ /**
22
+ * Data Transfer Object for a form field.
23
+ * This class defines the structure and properties of a single field
24
+ * that can be used in a user interface form.
25
+ */
26
+ class FieldDto {
27
+ constructor() {
28
+ /**
29
+ * The item attribute is upgradable
30
+ * If the user has the permission to upgrade the item from his panel
31
+ * TODO: Let's see if this approach is the best way for the user to upgrade their item
32
+ */
33
+ this.upgradable = false;
34
+ this.downgradable = false;
35
+ }
36
+ }
37
+ exports.FieldDto = FieldDto;
38
+ __decorate([
39
+ (0, class_validator_1.IsString)(),
40
+ (0, class_validator_1.IsDefined)(),
41
+ (0, class_validator_jsonschema_1.JSONSchema)({
42
+ title: 'ID',
43
+ description: 'Unique identifier for the field.',
44
+ type: 'string',
45
+ }),
46
+ __metadata("design:type", String)
47
+ ], FieldDto.prototype, "id", void 0);
48
+ __decorate([
49
+ (0, class_validator_1.ValidateNested)({ each: true }),
50
+ (0, class_transformer_1.Type)(() => multilang_text_dto_1.MultilangTextDto),
51
+ (0, class_validator_1.IsArray)(),
52
+ (0, class_validator_1.ArrayMinSize)(1),
53
+ (0, class_validator_jsonschema_1.JSONSchema)({
54
+ title: 'Label',
55
+ description: 'Multilingual label for the field.',
56
+ type: 'array',
57
+ items: { $ref: '#/components/schemas/MultilangTextDto' },
58
+ }),
59
+ __metadata("design:type", Array)
60
+ ], FieldDto.prototype, "label", void 0);
61
+ __decorate([
62
+ (0, class_validator_1.IsDefined)(),
63
+ (0, is_of_allowed_types_validator_1.IsOfAllowedTypes)(['string', 'number', 'object', 'array'], {
64
+ objectClass: field_option_dto_1.FieldOptionDto,
65
+ arrayElementClass: field_option_dto_1.FieldOptionDto,
66
+ require: true,
67
+ objectNotEmpty: true,
68
+ arrayNotEmpty: true,
69
+ }),
70
+ (0, class_validator_jsonschema_1.JSONSchema)({
71
+ title: 'Value',
72
+ description: 'Value of the field. String/Number, or FieldOptionDto/FieldOptionDto[] depending on type.',
73
+ oneOf: [
74
+ { title: 'String', type: 'string' },
75
+ { title: 'Number', type: 'number' },
76
+ { title: 'Option', $ref: '#/components/schemas/FieldOptionDto' },
77
+ {
78
+ title: 'Options Array',
79
+ type: 'array',
80
+ items: { $ref: '#/components/schemas/FieldOptionDto' },
81
+ },
82
+ ],
83
+ }),
84
+ __metadata("design:type", Object)
85
+ ], FieldDto.prototype, "value", void 0);
86
+ __decorate([
87
+ (0, class_validator_1.IsEnum)(field_type_enum_1.FieldTypeEnum),
88
+ (0, class_validator_1.IsDefined)(),
89
+ (0, class_validator_jsonschema_1.JSONSchema)({
90
+ title: 'Field Type',
91
+ description: 'Type of the field.',
92
+ type: 'string',
93
+ enum: Object.values(field_type_enum_1.FieldTypeEnum),
94
+ }),
95
+ __metadata("design:type", String)
96
+ ], FieldDto.prototype, "type", void 0);
97
+ __decorate([
98
+ (0, class_validator_1.IsBoolean)(),
99
+ (0, class_validator_1.IsDefined)(),
100
+ (0, class_validator_jsonschema_1.JSONSchema)({
101
+ title: 'Required',
102
+ description: 'Whether the field is required.',
103
+ type: 'boolean',
104
+ }),
105
+ __metadata("design:type", Boolean)
106
+ ], FieldDto.prototype, "required", void 0);
107
+ __decorate([
108
+ (0, class_validator_1.IsBoolean)(),
109
+ (0, class_validator_1.IsDefined)(),
110
+ (0, class_validator_jsonschema_1.JSONSchema)({
111
+ title: 'Disabled',
112
+ description: 'Whether the field is disabled.',
113
+ type: 'boolean',
114
+ }),
115
+ __metadata("design:type", Boolean)
116
+ ], FieldDto.prototype, "disabled", void 0);
117
+ __decorate([
118
+ (0, class_validator_1.IsBoolean)(),
119
+ (0, class_validator_1.IsOptional)(),
120
+ __metadata("design:type", Boolean)
121
+ ], FieldDto.prototype, "hidden", void 0);
122
+ __decorate([
123
+ (0, class_validator_1.IsString)(),
124
+ (0, is_regex_validator_1.IsRegex)(),
125
+ (0, class_validator_1.IsOptional)(),
126
+ (0, class_validator_jsonschema_1.JSONSchema)({
127
+ title: 'Regex Validation',
128
+ description: 'Optional regex to validate input.',
129
+ type: 'string',
130
+ example: '^[A-Za-z0-9_-]+$',
131
+ }),
132
+ __metadata("design:type", String)
133
+ ], FieldDto.prototype, "regexValidation", void 0);
134
+ __decorate([
135
+ (0, class_validator_1.ValidateIf)((o) => !!o.regexValidation),
136
+ (0, class_validator_1.ValidateNested)({ each: true }),
137
+ (0, class_transformer_1.Type)(() => multilang_text_dto_1.MultilangTextDto),
138
+ (0, class_validator_1.IsArray)(),
139
+ (0, class_validator_1.ArrayMinSize)(1),
140
+ (0, class_validator_1.IsOptional)(),
141
+ (0, class_validator_jsonschema_1.JSONSchema)({
142
+ title: 'Regex Validation Error Message',
143
+ description: 'Localized error message shown when regex validation fails.',
144
+ type: 'array',
145
+ items: { $ref: '#/components/schemas/MultilangTextDto' },
146
+ }),
147
+ __metadata("design:type", Array)
148
+ ], FieldDto.prototype, "regexValidationErrorMessage", void 0);
149
+ __decorate([
150
+ (0, class_validator_1.IsBoolean)(),
151
+ (0, class_validator_1.IsOptional)(),
152
+ __metadata("design:type", Boolean)
153
+ ], FieldDto.prototype, "triggersRemoteValidation", void 0);
154
+ __decorate([
155
+ (0, class_validator_1.ValidateIf)((o) => !!o.triggersRemoteValidation),
156
+ (0, class_validator_1.ValidateNested)({ each: true }),
157
+ (0, class_transformer_1.Type)(() => multilang_text_dto_1.MultilangTextDto),
158
+ (0, class_validator_1.IsArray)(),
159
+ (0, class_validator_1.ArrayMinSize)(1),
160
+ (0, class_validator_1.IsOptional)(),
161
+ (0, class_validator_jsonschema_1.JSONSchema)({
162
+ title: 'Remote Validation Error Message',
163
+ description: 'Localized error message shown when remote validation fails.',
164
+ type: 'array',
165
+ items: { $ref: '#/components/schemas/MultilangTextDto' },
166
+ }),
167
+ __metadata("design:type", Array)
168
+ ], FieldDto.prototype, "remoteValidationErrorMessage", void 0);
169
+ __decorate([
170
+ (0, class_validator_1.IsBoolean)(),
171
+ (0, class_validator_1.IsOptional)(),
172
+ (0, class_validator_jsonschema_1.JSONSchema)({
173
+ title: 'Upgradable',
174
+ description: 'Whether the item attribute is upgradable by the user.',
175
+ type: 'boolean',
176
+ }),
177
+ __metadata("design:type", Boolean)
178
+ ], FieldDto.prototype, "upgradable", void 0);
179
+ __decorate([
180
+ (0, class_validator_1.IsBoolean)(),
181
+ (0, class_validator_1.IsOptional)(),
182
+ (0, class_validator_jsonschema_1.JSONSchema)({
183
+ title: 'Downgradable',
184
+ description: 'Whether the item attribute is downgradable by the user.',
185
+ type: 'boolean',
186
+ }),
187
+ __metadata("design:type", Boolean)
188
+ ], FieldDto.prototype, "downgradable", void 0);
@@ -3,7 +3,7 @@ import { LanguageEnum } from '../enums/language.enum';
3
3
  import { RolesEnum } from '../enums/roles.enum';
4
4
  import { AdminPanelDto } from './admin-panel.dto';
5
5
  import { ClientPanelDto } from './client-panel.dto';
6
- import { AnyFieldDto } from './fields/any-field.dto';
6
+ import { FieldDto } from './field.dto';
7
7
  /**
8
8
  * DTO for integration information.
9
9
  * This is a central DTO that contains all the necessary information
@@ -54,5 +54,5 @@ export declare class InfoDto {
54
54
  * This URL will be displayed in a popup or side sheet with a JWT for authentication.
55
55
  */
56
56
  onboardingUrl?: string;
57
- setupAttributes?: AnyFieldDto[];
57
+ setupAttributes?: FieldDto[];
58
58
  }
@@ -21,6 +21,7 @@ const class_transformer_1 = require("class-transformer");
21
21
  const admin_panel_dto_1 = require("./admin-panel.dto");
22
22
  const client_panel_dto_1 = require("./client-panel.dto");
23
23
  const class_validator_jsonschema_1 = require("class-validator-jsonschema");
24
+ const field_dto_1 = require("./field.dto");
24
25
  const unique_field_in_array_validator_1 = require("../decorators/unique-field-in-array.validator");
25
26
  /**
26
27
  * DTO for integration information.
@@ -143,12 +144,14 @@ __decorate([
143
144
  (0, class_validator_1.IsOptional)(),
144
145
  (0, class_validator_1.IsArray)(),
145
146
  (0, class_validator_1.ArrayMinSize)(1),
147
+ (0, class_validator_1.ValidateNested)({ each: true }),
148
+ (0, class_transformer_1.Type)(() => field_dto_1.FieldDto),
146
149
  (0, unique_field_in_array_validator_1.UniqueFieldInArray)('id'),
147
150
  (0, class_validator_jsonschema_1.JSONSchema)({
148
151
  title: 'Setup Attributes',
149
- description: 'Configurable attributes that are used in the setup process. Each item is a concrete field DTO discriminated by its `type` literal.',
152
+ description: 'Configurable attributes that are used in the setup process.',
150
153
  type: 'array',
151
- items: { $ref: '#/components/schemas/AnyFieldDto' },
154
+ items: { $ref: '#/components/schemas/FieldDto' },
152
155
  }),
153
156
  __metadata("design:type", Array)
154
157
  ], InfoDto.prototype, "setupAttributes", void 0);
@@ -39,7 +39,7 @@ __decorate([
39
39
  (0, class_validator_1.ArrayMinSize)(1),
40
40
  (0, class_validator_1.ValidateNested)({ each: true }),
41
41
  (0, class_transformer_1.Type)(() => attribute_field_dto_1.AttributeFieldDto),
42
- (0, unique_field_in_array_validator_1.UniqueFieldInArray)('field.id'),
42
+ (0, unique_field_in_array_validator_1.UniqueFieldInArray)('id'),
43
43
  (0, class_validator_jsonschema_1.JSONSchema)({
44
44
  title: 'Product Attributes',
45
45
  description: 'Configurable attributes that apply at the product level.',
@@ -54,7 +54,7 @@ __decorate([
54
54
  (0, class_validator_1.ArrayMinSize)(1),
55
55
  (0, class_validator_1.ValidateNested)({ each: true }),
56
56
  (0, class_transformer_1.Type)(() => attribute_field_dto_1.AttributeFieldDto),
57
- (0, unique_field_in_array_validator_1.UniqueFieldInArray)('field.id'),
57
+ (0, unique_field_in_array_validator_1.UniqueFieldInArray)('id'),
58
58
  (0, class_validator_jsonschema_1.JSONSchema)({
59
59
  title: 'Item Attributes',
60
60
  description: 'Configurable attributes that apply at the item level.',
@@ -1,13 +1,13 @@
1
1
  import { BaseResponse } from '../base-response.dto';
2
- import { AnyFieldDto } from '../fields/any-field.dto';
2
+ import { FieldDto } from '../field.dto';
3
3
  /**
4
4
  * Represents the response from validating product attributes.
5
5
  * Contains the list of attributes that have been validated.
6
6
  */
7
7
  export declare class ValidateAttributesResponseDto extends BaseResponse {
8
8
  /**
9
- * An array of concrete field DTOs (discriminated by `type`) representing the
10
- * validated attributes.
9
+ * An array of field DTOs representing the validated attributes.
10
+ * Each `FieldDto` contains details about a single attribute.
11
11
  */
12
- validatedAttributes: AnyFieldDto[];
12
+ validatedAttributes: FieldDto[];
13
13
  }
@@ -10,9 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ValidateAttributesResponseDto = void 0;
13
+ const class_transformer_1 = require("class-transformer");
13
14
  const class_validator_1 = require("class-validator");
14
15
  const class_validator_jsonschema_1 = require("class-validator-jsonschema");
15
16
  const base_response_dto_1 = require("../base-response.dto");
17
+ const field_dto_1 = require("../field.dto");
16
18
  /**
17
19
  * Represents the response from validating product attributes.
18
20
  * Contains the list of attributes that have been validated.
@@ -22,11 +24,13 @@ class ValidateAttributesResponseDto extends base_response_dto_1.BaseResponse {
22
24
  exports.ValidateAttributesResponseDto = ValidateAttributesResponseDto;
23
25
  __decorate([
24
26
  (0, class_validator_1.IsArray)(),
27
+ (0, class_validator_1.ValidateNested)({ each: true }),
28
+ (0, class_transformer_1.Type)(() => field_dto_1.FieldDto),
25
29
  (0, class_validator_jsonschema_1.JSONSchema)({
26
30
  title: 'Validated Attributes',
27
- description: 'Array of concrete field DTOs (each discriminated by its `type` literal).',
31
+ description: 'An array of field DTOs representing the validated attributes.',
28
32
  type: 'array',
29
- items: { $ref: '#/components/schemas/AnyFieldDto' },
33
+ items: { $ref: '#/components/schemas/FieldDto' },
30
34
  }),
31
35
  __metadata("design:type", Array)
32
36
  ], ValidateAttributesResponseDto.prototype, "validatedAttributes", void 0);
@@ -1,23 +1,10 @@
1
- /**
2
- * @deprecated The mega `FieldDto` was split into one concrete DTO per field type.
3
- * New code should use the string-literal `type` discriminator on each concrete DTO
4
- * (e.g. `TextFieldDto`, `NumberFieldDto`) rather than referencing this enum.
5
- *
6
- * Kept for one release for backward compatibility; will be removed once consumer
7
- * migration (hoster-ai/api issue #449) lands.
8
- */
9
1
  export declare enum FieldTypeEnum {
10
- BOOLEAN = "BOOLEAN",
11
- TEXT = "TEXT",
12
- TEXTAREA = "TEXTAREA",
13
- NUMBER = "NUMBER",
14
- PHONE = "PHONE",
15
- EMAIL = "EMAIL",
16
- URL = "URL",
17
- COUNTRIES = "COUNTRIES",
18
- CURRENCY = "CURRENCY",
19
- DATE = "DATE",
20
- PASSWORD = "PASSWORD",
2
+ TEXT_BOX = "TEXT_BOX",
3
+ TEXT_AREA = "TEXT_AREA",
21
4
  SELECT = "SELECT",
22
- MULTI_SELECT = "MULTI_SELECT"
5
+ MULTI_SELECT = "MULTI_SELECT",
6
+ DESCRIPTION = "DESCRIPTION",
7
+ RADIO_BOX = "RADIO_BOX",
8
+ CHECKBOX = "CHECKBOX",
9
+ SLIDER = "SLIDER"
23
10
  }