@hosterai/types 0.0.18 → 0.0.20
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/dist/decorators/all-or-none-validator.spec.d.ts +1 -0
- package/dist/decorators/all-or-none-validator.spec.js +91 -0
- package/dist/decorators/all-or-none.validator.d.ts +2 -0
- package/dist/decorators/all-or-none.validator.js +71 -0
- package/dist/decorators/min-less-or-equal-validator.spec.d.ts +1 -0
- package/dist/decorators/min-less-or-equal-validator.spec.js +60 -0
- package/dist/decorators/min-less-or-equal.validator.d.ts +2 -0
- package/dist/decorators/min-less-or-equal.validator.js +58 -0
- package/dist/dtos/action.dto.js +21 -0
- package/dist/dtos/admin-panel.dto.js +91 -0
- package/dist/dtos/client-panel.dto.js +30 -0
- package/dist/dtos/field-option.dto.js +16 -0
- package/dist/dtos/field.dto.d.ts +2 -0
- package/dist/dtos/field.dto.js +94 -16
- package/dist/dtos/info.dto.js +62 -0
- package/dist/dtos/menu.dto.d.ts +2 -2
- package/dist/dtos/menu.dto.js +35 -2
- package/dist/dtos/notification/notification-info.dto.js +17 -0
- package/dist/dtos/product/product-info.dto.js +27 -0
- package/dist/dtos/product/requests/product-downgradeable-request.dto.d.ts +18 -0
- package/dist/dtos/product/requests/product-downgradeable-request.dto.js +37 -0
- package/dist/dtos/product/requests/product-upgradeable-request.dto.d.ts +18 -0
- package/dist/dtos/product/requests/product-upgradeable-request.dto.js +37 -0
- package/dist/dtos/product/responses/product-downgradeable-response.dto.d.ts +22 -0
- package/dist/dtos/product/responses/product-downgradeable-response.dto.js +11 -0
- package/dist/dtos/product/responses/product-upgradeable-response.dto.d.ts +22 -0
- package/dist/dtos/product/responses/product-upgradeable-response.dto.js +11 -0
- package/dist/dtos/settings.dto.js +22 -0
- package/dist/dtos/tab.dto.js +12 -0
- package/dist/dtos/unit.dto.js +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/openapi/schemas/components.schemas.d.ts +991 -0
- package/dist/openapi/schemas/components.schemas.js +2552 -0
- package/dist/validators/field-validator.spec.js +26 -0
- package/dist/validators/product-downgradeable-request-validator.d.ts +8 -0
- package/dist/validators/product-downgradeable-request-validator.js +17 -0
- package/dist/validators/product-info-validator.spec.js +87 -0
- package/dist/validators/product-upgradeable-request-validator.d.ts +8 -0
- package/dist/validators/product-upgradeable-request-validator.js +17 -0
- package/package.json +4 -1
- package/dist/dtos/info/info-notification.dto.d.ts +0 -5
- package/dist/dtos/info/info-notification.dto.js +0 -7
- package/dist/dtos/info/info.dto.d.ts +0 -196
- package/dist/dtos/info/info.dto.js +0 -278
- package/dist/dtos/notification/notification-request.dto.d.ts +0 -20
- package/dist/dtos/notification/notification-request.dto.js +0 -31
- package/dist/dtos/receiver/receiver-email.dto.d.ts +0 -20
- package/dist/dtos/receiver/receiver-email.dto.js +0 -39
- package/dist/dtos/receiver/receiver-push.dto.d.ts +0 -15
- package/dist/dtos/receiver/receiver-push.dto.js +0 -31
- package/dist/dtos/receiver/receiver-sms.dto.d.ts +0 -11
- package/dist/dtos/receiver/receiver-sms.dto.js +0 -26
- package/dist/dtos/request.dto.d.ts +0 -20
- package/dist/dtos/request.dto.js +0 -31
- package/dist/dtos/sender/sender-email.dto.d.ts +0 -25
- package/dist/dtos/sender/sender-email.dto.js +0 -46
- package/dist/dtos/sender/sender-push.dto.d.ts +0 -31
- package/dist/dtos/sender/sender-push.dto.js +0 -50
- package/dist/dtos/sender/sender-sms.dto.d.ts +0 -15
- package/dist/dtos/sender/sender-sms.dto.js +0 -30
- package/dist/enums/message-type.enum.d.ts +0 -5
- package/dist/enums/message-type.enum.js +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
require("reflect-metadata");
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const all_or_none_validator_1 = require("./all-or-none.validator");
|
|
15
|
+
// Pairs
|
|
16
|
+
let PairDto = class PairDto {
|
|
17
|
+
constructor(data) { Object.assign(this, data); }
|
|
18
|
+
};
|
|
19
|
+
PairDto = __decorate([
|
|
20
|
+
(0, all_or_none_validator_1.AllOrNoneProperty)(['a', 'b']),
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
22
|
+
], PairDto);
|
|
23
|
+
// Multiple pairs
|
|
24
|
+
let MultiPairDto = class MultiPairDto {
|
|
25
|
+
constructor(data) { Object.assign(this, data); }
|
|
26
|
+
};
|
|
27
|
+
MultiPairDto = __decorate([
|
|
28
|
+
(0, all_or_none_validator_1.AllOrNoneProperty)([
|
|
29
|
+
['a', 'b'],
|
|
30
|
+
['c', 'd'],
|
|
31
|
+
]),
|
|
32
|
+
__metadata("design:paramtypes", [Object])
|
|
33
|
+
], MultiPairDto);
|
|
34
|
+
// Group of 3+
|
|
35
|
+
let GroupDto = class GroupDto {
|
|
36
|
+
constructor(data) { Object.assign(this, data); }
|
|
37
|
+
};
|
|
38
|
+
GroupDto = __decorate([
|
|
39
|
+
(0, all_or_none_validator_1.AllOrNoneProperty)(['x', 'y', 'z']),
|
|
40
|
+
__metadata("design:paramtypes", [Object])
|
|
41
|
+
], GroupDto);
|
|
42
|
+
describe('AllOrNoneProperty', () => {
|
|
43
|
+
// Single pair
|
|
44
|
+
it('passes when both pair fields are absent', async () => {
|
|
45
|
+
const dto = new PairDto({});
|
|
46
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
47
|
+
expect(errors.length).toBe(0);
|
|
48
|
+
});
|
|
49
|
+
it('fails when one of pair fields is present and the other is absent', async () => {
|
|
50
|
+
const dto = new PairDto({ a: 1 });
|
|
51
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
52
|
+
expect(errors.length).toBeGreaterThan(0);
|
|
53
|
+
});
|
|
54
|
+
it('passes when both pair fields are present', async () => {
|
|
55
|
+
const dto = new PairDto({ a: 1, b: 2 });
|
|
56
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
57
|
+
expect(errors.length).toBe(0);
|
|
58
|
+
});
|
|
59
|
+
// Multiple pairs
|
|
60
|
+
it('passes when all pairs are absent', async () => {
|
|
61
|
+
const dto = new MultiPairDto({});
|
|
62
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
63
|
+
expect(errors.length).toBe(0);
|
|
64
|
+
});
|
|
65
|
+
it('passes when all pairs are present', async () => {
|
|
66
|
+
const dto = new MultiPairDto({ a: 1, b: 2, c: 3, d: 4 });
|
|
67
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
68
|
+
expect(errors.length).toBe(0);
|
|
69
|
+
});
|
|
70
|
+
it('fails when one pair violates the rule', async () => {
|
|
71
|
+
const dto = new MultiPairDto({ a: 1, b: 2, c: 3 });
|
|
72
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
73
|
+
expect(errors.length).toBeGreaterThan(0);
|
|
74
|
+
});
|
|
75
|
+
// 3+ group
|
|
76
|
+
it('passes when all group fields are absent', async () => {
|
|
77
|
+
const dto = new GroupDto({});
|
|
78
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
79
|
+
expect(errors.length).toBe(0);
|
|
80
|
+
});
|
|
81
|
+
it('fails when only a subset of group fields are present', async () => {
|
|
82
|
+
const dto = new GroupDto({ x: 1 });
|
|
83
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
84
|
+
expect(errors.length).toBeGreaterThan(0);
|
|
85
|
+
});
|
|
86
|
+
it('passes when all group fields are present', async () => {
|
|
87
|
+
const dto = new GroupDto({ x: 1, y: 2, z: 3 });
|
|
88
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
89
|
+
expect(errors.length).toBe(0);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AllOrNoneProperty = AllOrNoneProperty;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
let AllOrNoneConstraint = class AllOrNoneConstraint {
|
|
12
|
+
validate(_, args) {
|
|
13
|
+
const object = args.object;
|
|
14
|
+
const input = args.constraints[0];
|
|
15
|
+
// Normalize to an array of groups, each group being string[] (length >= 2 preferred)
|
|
16
|
+
let groups = [];
|
|
17
|
+
if (Array.isArray(input)) {
|
|
18
|
+
if (input.length > 0 && typeof input[0] === 'string') {
|
|
19
|
+
// Single group given as string[] (could be pair or more than 2)
|
|
20
|
+
groups = [input];
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// Array of groups (pairs or larger)
|
|
24
|
+
groups = input.map((g) => g);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const has = (k) => object[k] !== undefined && object[k] !== null;
|
|
28
|
+
return groups.every((group) => {
|
|
29
|
+
if (!Array.isArray(group) || group.length < 2)
|
|
30
|
+
return true; // Ignore invalid/misconfigured groups
|
|
31
|
+
const statuses = group.map((k) => has(k));
|
|
32
|
+
const allPresent = statuses.every(Boolean);
|
|
33
|
+
const allAbsent = statuses.every((v) => !v);
|
|
34
|
+
return allPresent || allAbsent;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
defaultMessage(args) {
|
|
38
|
+
const input = args.constraints[0];
|
|
39
|
+
let groups = [];
|
|
40
|
+
if (Array.isArray(input)) {
|
|
41
|
+
if (input.length > 0 && typeof input[0] === 'string') {
|
|
42
|
+
groups = [input];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
groups = input.map((g) => g);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (groups.length === 1) {
|
|
49
|
+
const g = groups[0];
|
|
50
|
+
const list = g.join(', ');
|
|
51
|
+
return `All of (${list}) must be provided together or omitted together`;
|
|
52
|
+
}
|
|
53
|
+
const list = groups.map((g) => `(${g.join('/')})`).join(', ');
|
|
54
|
+
return `Each group must be provided together or omitted together: ${list}`;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
AllOrNoneConstraint = __decorate([
|
|
58
|
+
(0, class_validator_1.ValidatorConstraint)({ name: 'AllOrNone', async: false })
|
|
59
|
+
], AllOrNoneConstraint);
|
|
60
|
+
function AllOrNoneProperty(keysOrGroups, validationOptions) {
|
|
61
|
+
return function (constructor) {
|
|
62
|
+
(0, class_validator_1.registerDecorator)({
|
|
63
|
+
name: 'AllOrNone',
|
|
64
|
+
target: constructor,
|
|
65
|
+
propertyName: '',
|
|
66
|
+
options: validationOptions,
|
|
67
|
+
constraints: [keysOrGroups],
|
|
68
|
+
validator: AllOrNoneConstraint,
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
require("reflect-metadata");
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const min_less_or_equal_validator_1 = require("./min-less-or-equal.validator");
|
|
15
|
+
let MinMaxDto = class MinMaxDto {
|
|
16
|
+
constructor(data) { Object.assign(this, data); }
|
|
17
|
+
};
|
|
18
|
+
MinMaxDto = __decorate([
|
|
19
|
+
(0, min_less_or_equal_validator_1.MinLessOrEqualMaxProperty)(['min', 'max']),
|
|
20
|
+
__metadata("design:paramtypes", [Object])
|
|
21
|
+
], MinMaxDto);
|
|
22
|
+
let MultiMinMaxDto = class MultiMinMaxDto {
|
|
23
|
+
constructor(data) { Object.assign(this, data); }
|
|
24
|
+
};
|
|
25
|
+
MultiMinMaxDto = __decorate([
|
|
26
|
+
(0, min_less_or_equal_validator_1.MinLessOrEqualMaxProperty)([
|
|
27
|
+
['min1', 'max1'],
|
|
28
|
+
['min2', 'max2'],
|
|
29
|
+
]),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], MultiMinMaxDto);
|
|
32
|
+
describe('MinLessOrEqualMaxProperty', () => {
|
|
33
|
+
it('passes when one or both are absent', async () => {
|
|
34
|
+
const dto1 = new MinMaxDto({});
|
|
35
|
+
const dto2 = new MinMaxDto({ min: 1 });
|
|
36
|
+
const dto3 = new MinMaxDto({ max: 2 });
|
|
37
|
+
expect((await (0, class_validator_1.validate)(dto1)).length).toBe(0);
|
|
38
|
+
expect((await (0, class_validator_1.validate)(dto2)).length).toBe(0);
|
|
39
|
+
expect((await (0, class_validator_1.validate)(dto3)).length).toBe(0);
|
|
40
|
+
});
|
|
41
|
+
it('passes when min <= max', async () => {
|
|
42
|
+
const dto = new MinMaxDto({ min: 1, max: 1 });
|
|
43
|
+
const dto2 = new MinMaxDto({ min: 1, max: 2 });
|
|
44
|
+
expect((await (0, class_validator_1.validate)(dto)).length).toBe(0);
|
|
45
|
+
expect((await (0, class_validator_1.validate)(dto2)).length).toBe(0);
|
|
46
|
+
});
|
|
47
|
+
it('fails when min > max', async () => {
|
|
48
|
+
const dto = new MinMaxDto({ min: 3, max: 2 });
|
|
49
|
+
const errors = await (0, class_validator_1.validate)(dto);
|
|
50
|
+
expect(errors.length).toBeGreaterThan(0);
|
|
51
|
+
});
|
|
52
|
+
it('handles multiple pairs correctly', async () => {
|
|
53
|
+
const ok = new MultiMinMaxDto({ min1: 1, max1: 2, min2: 3, max2: 3 });
|
|
54
|
+
const errorsOk = await (0, class_validator_1.validate)(ok);
|
|
55
|
+
expect(errorsOk.length).toBe(0);
|
|
56
|
+
const bad = new MultiMinMaxDto({ min1: 1, max1: 0, min2: 3, max2: 3 });
|
|
57
|
+
const errorsBad = await (0, class_validator_1.validate)(bad);
|
|
58
|
+
expect(errorsBad.length).toBeGreaterThan(0);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MinLessOrEqualMaxProperty = MinLessOrEqualMaxProperty;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
let MinLessOrEqualMaxConstraint = class MinLessOrEqualMaxConstraint {
|
|
12
|
+
validate(_, args) {
|
|
13
|
+
const object = args.object;
|
|
14
|
+
const input = args.constraints[0];
|
|
15
|
+
const pairs = Array.isArray(input) && typeof input[0] === 'string'
|
|
16
|
+
? [input]
|
|
17
|
+
: input;
|
|
18
|
+
return pairs.every(([minKey, maxKey]) => {
|
|
19
|
+
const minVal = object[minKey];
|
|
20
|
+
const maxVal = object[maxKey];
|
|
21
|
+
// If one or both are missing, do not fail here; let AllOrNone or other validators handle presence
|
|
22
|
+
if (minVal === undefined || minVal === null)
|
|
23
|
+
return true;
|
|
24
|
+
if (maxVal === undefined || maxVal === null)
|
|
25
|
+
return true;
|
|
26
|
+
if (typeof minVal !== 'number' || typeof maxVal !== 'number')
|
|
27
|
+
return true; // Type guards handled elsewhere
|
|
28
|
+
return minVal <= maxVal;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
defaultMessage(args) {
|
|
32
|
+
const input = args.constraints[0];
|
|
33
|
+
const pairs = Array.isArray(input) && typeof input[0] === 'string'
|
|
34
|
+
? [input]
|
|
35
|
+
: input;
|
|
36
|
+
if (pairs.length === 1) {
|
|
37
|
+
const [minKey, maxKey] = pairs[0];
|
|
38
|
+
return `${minKey} must be less than or equal to ${maxKey}`;
|
|
39
|
+
}
|
|
40
|
+
const list = pairs.map(([a, b]) => `${a}<=${b}`).join(', ');
|
|
41
|
+
return `The following constraints must hold: ${list}`;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
MinLessOrEqualMaxConstraint = __decorate([
|
|
45
|
+
(0, class_validator_1.ValidatorConstraint)({ name: 'MinLessOrEqualMax', async: false })
|
|
46
|
+
], MinLessOrEqualMaxConstraint);
|
|
47
|
+
function MinLessOrEqualMaxProperty(keysOrPairs, validationOptions) {
|
|
48
|
+
return function (constructor) {
|
|
49
|
+
(0, class_validator_1.registerDecorator)({
|
|
50
|
+
name: 'MinLessOrEqualMax',
|
|
51
|
+
target: constructor,
|
|
52
|
+
propertyName: '',
|
|
53
|
+
options: validationOptions,
|
|
54
|
+
constraints: [keysOrPairs],
|
|
55
|
+
validator: MinLessOrEqualMaxConstraint,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
}
|
package/dist/dtos/action.dto.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ActionDto = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
14
|
const open_method_enum_1 = require("../enums/open-method.enum");
|
|
15
|
+
const class_validator_jsonschema_1 = require("class-validator-jsonschema");
|
|
15
16
|
/**
|
|
16
17
|
* Defines the structure for a UI action.
|
|
17
18
|
* @example
|
|
@@ -28,20 +29,40 @@ exports.ActionDto = ActionDto;
|
|
|
28
29
|
__decorate([
|
|
29
30
|
(0, class_validator_1.IsString)(),
|
|
30
31
|
(0, class_validator_1.IsNotEmpty)(),
|
|
32
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
33
|
+
title: 'Icon',
|
|
34
|
+
description: 'Name of the icon to display for the action.',
|
|
35
|
+
type: 'string'
|
|
36
|
+
}),
|
|
31
37
|
__metadata("design:type", String)
|
|
32
38
|
], ActionDto.prototype, "icon", void 0);
|
|
33
39
|
__decorate([
|
|
34
40
|
(0, class_validator_1.IsString)(),
|
|
35
41
|
(0, class_validator_1.IsOptional)(),
|
|
42
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
43
|
+
title: 'Label',
|
|
44
|
+
description: 'Text label for the action.',
|
|
45
|
+
type: 'string'
|
|
46
|
+
}),
|
|
36
47
|
__metadata("design:type", String)
|
|
37
48
|
], ActionDto.prototype, "label", void 0);
|
|
38
49
|
__decorate([
|
|
39
50
|
(0, class_validator_1.IsEnum)(open_method_enum_1.OpenMethodEnum),
|
|
40
51
|
(0, class_validator_1.IsNotEmpty)(),
|
|
52
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
53
|
+
title: 'Open Method',
|
|
54
|
+
description: 'Method by which the action\'s URL should be opened.',
|
|
55
|
+
enum: Object.values(open_method_enum_1.OpenMethodEnum)
|
|
56
|
+
}),
|
|
41
57
|
__metadata("design:type", String)
|
|
42
58
|
], ActionDto.prototype, "openMethod", void 0);
|
|
43
59
|
__decorate([
|
|
44
60
|
(0, class_validator_1.IsUrl)({ protocols: ['https'], require_protocol: true }),
|
|
45
61
|
(0, class_validator_1.IsNotEmpty)(),
|
|
62
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
63
|
+
title: 'URL',
|
|
64
|
+
description: 'URL to navigate to when the action is triggered.',
|
|
65
|
+
type: 'string'
|
|
66
|
+
}),
|
|
46
67
|
__metadata("design:type", String)
|
|
47
68
|
], ActionDto.prototype, "url", void 0);
|
|
@@ -20,6 +20,7 @@ const settings_transformer_1 = require("../transformers/settings.transformer");
|
|
|
20
20
|
const menu_transformer_1 = require("../transformers/menu.transformer");
|
|
21
21
|
const is_one_of_validator_1 = require("../decorators/is-one-of.validator");
|
|
22
22
|
const at_least_one_non_empty_validator_1 = require("../decorators/at-least-one-non-empty.validator");
|
|
23
|
+
const class_validator_jsonschema_1 = require("class-validator-jsonschema");
|
|
23
24
|
let AdminPanelTabsDto = class AdminPanelTabsDto {
|
|
24
25
|
};
|
|
25
26
|
exports.AdminPanelTabsDto = AdminPanelTabsDto;
|
|
@@ -29,6 +30,12 @@ __decorate([
|
|
|
29
30
|
(0, class_validator_1.IsOptional)(),
|
|
30
31
|
(0, class_validator_1.IsArray)(),
|
|
31
32
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
33
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
34
|
+
title: 'Product Tabs',
|
|
35
|
+
description: 'Tabs shown on the product detail page in Admin panel.',
|
|
36
|
+
type: 'array',
|
|
37
|
+
items: { $ref: '#/components/schemas/TabDto' }
|
|
38
|
+
}),
|
|
32
39
|
__metadata("design:type", Array)
|
|
33
40
|
], AdminPanelTabsDto.prototype, "product", void 0);
|
|
34
41
|
__decorate([
|
|
@@ -37,6 +44,12 @@ __decorate([
|
|
|
37
44
|
(0, class_validator_1.IsOptional)(),
|
|
38
45
|
(0, class_validator_1.IsArray)(),
|
|
39
46
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
47
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
48
|
+
title: 'Item Tabs',
|
|
49
|
+
description: 'Tabs shown on the item detail page in Admin panel.',
|
|
50
|
+
type: 'array',
|
|
51
|
+
items: { $ref: '#/components/schemas/TabDto' }
|
|
52
|
+
}),
|
|
40
53
|
__metadata("design:type", Array)
|
|
41
54
|
], AdminPanelTabsDto.prototype, "item", void 0);
|
|
42
55
|
__decorate([
|
|
@@ -45,6 +58,12 @@ __decorate([
|
|
|
45
58
|
(0, class_validator_1.IsOptional)(),
|
|
46
59
|
(0, class_validator_1.IsArray)(),
|
|
47
60
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
61
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
62
|
+
title: 'Client Tabs',
|
|
63
|
+
description: 'Tabs shown on the client profile page in Admin panel.',
|
|
64
|
+
type: 'array',
|
|
65
|
+
items: { $ref: '#/components/schemas/TabDto' }
|
|
66
|
+
}),
|
|
48
67
|
__metadata("design:type", Array)
|
|
49
68
|
], AdminPanelTabsDto.prototype, "client", void 0);
|
|
50
69
|
__decorate([
|
|
@@ -53,6 +72,12 @@ __decorate([
|
|
|
53
72
|
(0, class_validator_1.IsOptional)(),
|
|
54
73
|
(0, class_validator_1.IsArray)(),
|
|
55
74
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
75
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
76
|
+
title: 'User Tabs',
|
|
77
|
+
description: 'Tabs shown on the user page in Admin panel.',
|
|
78
|
+
type: 'array',
|
|
79
|
+
items: { $ref: '#/components/schemas/TabDto' }
|
|
80
|
+
}),
|
|
56
81
|
__metadata("design:type", Array)
|
|
57
82
|
], AdminPanelTabsDto.prototype, "user", void 0);
|
|
58
83
|
__decorate([
|
|
@@ -61,6 +86,12 @@ __decorate([
|
|
|
61
86
|
(0, class_validator_1.IsOptional)(),
|
|
62
87
|
(0, class_validator_1.IsArray)(),
|
|
63
88
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
89
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
90
|
+
title: 'Order Tabs',
|
|
91
|
+
description: 'Tabs shown on the order page in Admin panel.',
|
|
92
|
+
type: 'array',
|
|
93
|
+
items: { $ref: '#/components/schemas/TabDto' }
|
|
94
|
+
}),
|
|
64
95
|
__metadata("design:type", Array)
|
|
65
96
|
], AdminPanelTabsDto.prototype, "order", void 0);
|
|
66
97
|
exports.AdminPanelTabsDto = AdminPanelTabsDto = __decorate([
|
|
@@ -75,6 +106,12 @@ __decorate([
|
|
|
75
106
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
76
107
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
77
108
|
(0, class_transformer_1.Type)(() => action_dto_1.ActionDto),
|
|
109
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
110
|
+
title: 'Client Actions',
|
|
111
|
+
description: 'Additional actions available on the client page.',
|
|
112
|
+
type: 'array',
|
|
113
|
+
items: { $ref: '#/components/schemas/ActionDto' }
|
|
114
|
+
}),
|
|
78
115
|
__metadata("design:type", Array)
|
|
79
116
|
], AdminPanelMoreActionsDto.prototype, "client", void 0);
|
|
80
117
|
__decorate([
|
|
@@ -83,6 +120,12 @@ __decorate([
|
|
|
83
120
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
84
121
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
85
122
|
(0, class_transformer_1.Type)(() => action_dto_1.ActionDto),
|
|
123
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
124
|
+
title: 'Item Actions',
|
|
125
|
+
description: 'Additional actions available on the item page.',
|
|
126
|
+
type: 'array',
|
|
127
|
+
items: { $ref: '#/components/schemas/ActionDto' }
|
|
128
|
+
}),
|
|
86
129
|
__metadata("design:type", Array)
|
|
87
130
|
], AdminPanelMoreActionsDto.prototype, "item", void 0);
|
|
88
131
|
__decorate([
|
|
@@ -91,6 +134,12 @@ __decorate([
|
|
|
91
134
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
92
135
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
93
136
|
(0, class_transformer_1.Type)(() => action_dto_1.ActionDto),
|
|
137
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
138
|
+
title: 'Invoice Actions',
|
|
139
|
+
description: 'Additional actions available on the invoice page.',
|
|
140
|
+
type: 'array',
|
|
141
|
+
items: { $ref: '#/components/schemas/ActionDto' }
|
|
142
|
+
}),
|
|
94
143
|
__metadata("design:type", Array)
|
|
95
144
|
], AdminPanelMoreActionsDto.prototype, "invoice", void 0);
|
|
96
145
|
__decorate([
|
|
@@ -99,6 +148,12 @@ __decorate([
|
|
|
99
148
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
100
149
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
101
150
|
(0, class_transformer_1.Type)(() => action_dto_1.ActionDto),
|
|
151
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
152
|
+
title: 'User Actions',
|
|
153
|
+
description: 'Additional actions available on the user page.',
|
|
154
|
+
type: 'array',
|
|
155
|
+
items: { $ref: '#/components/schemas/ActionDto' }
|
|
156
|
+
}),
|
|
102
157
|
__metadata("design:type", Array)
|
|
103
158
|
], AdminPanelMoreActionsDto.prototype, "user", void 0);
|
|
104
159
|
__decorate([
|
|
@@ -107,6 +162,12 @@ __decorate([
|
|
|
107
162
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
108
163
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
109
164
|
(0, class_transformer_1.Type)(() => action_dto_1.ActionDto),
|
|
165
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
166
|
+
title: 'Order Actions',
|
|
167
|
+
description: 'Additional actions available on the order page.',
|
|
168
|
+
type: 'array',
|
|
169
|
+
items: { $ref: '#/components/schemas/ActionDto' }
|
|
170
|
+
}),
|
|
110
171
|
__metadata("design:type", Array)
|
|
111
172
|
], AdminPanelMoreActionsDto.prototype, "order", void 0);
|
|
112
173
|
exports.AdminPanelMoreActionsDto = AdminPanelMoreActionsDto = __decorate([
|
|
@@ -119,12 +180,24 @@ __decorate([
|
|
|
119
180
|
(0, class_validator_1.IsOptional)(),
|
|
120
181
|
(0, class_validator_1.ValidateNested)(),
|
|
121
182
|
(0, class_transformer_1.Type)(() => AdminPanelTabsDto),
|
|
183
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
184
|
+
title: 'Tabs',
|
|
185
|
+
description: 'Tab structure for Admin panel sections.',
|
|
186
|
+
type: 'object',
|
|
187
|
+
properties: { tabs: { $ref: '#/components/schemas/AdminPanelTabsDto' } }
|
|
188
|
+
}),
|
|
122
189
|
__metadata("design:type", AdminPanelTabsDto)
|
|
123
190
|
], AdminPanelDto.prototype, "tabs", void 0);
|
|
124
191
|
__decorate([
|
|
125
192
|
(0, class_validator_1.IsOptional)(),
|
|
126
193
|
(0, class_validator_1.ValidateNested)(),
|
|
127
194
|
(0, class_transformer_1.Type)(() => AdminPanelMoreActionsDto),
|
|
195
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
196
|
+
title: 'More Actions',
|
|
197
|
+
description: 'Additional actions in Admin panel sections.',
|
|
198
|
+
type: 'object',
|
|
199
|
+
properties: { moreActions: { $ref: '#/components/schemas/AdminPanelMoreActionsDto' } }
|
|
200
|
+
}),
|
|
128
201
|
__metadata("design:type", AdminPanelMoreActionsDto)
|
|
129
202
|
], AdminPanelDto.prototype, "moreActions", void 0);
|
|
130
203
|
__decorate([
|
|
@@ -134,6 +207,15 @@ __decorate([
|
|
|
134
207
|
(0, is_one_of_validator_1.IsOneOf)([menu_dto_1.MenuDtoWithUrl, menu_dto_1.MenuDtoWithSubmenu], {
|
|
135
208
|
message: 'menu must be MenuDtoWithUrl or MenuDtoWithSubmenu',
|
|
136
209
|
}),
|
|
210
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
211
|
+
title: 'Menu',
|
|
212
|
+
description: 'Admin panel main menu (URL or submenu variant).',
|
|
213
|
+
type: 'object',
|
|
214
|
+
oneOf: [
|
|
215
|
+
{ $ref: '#/components/schemas/MenuDtoWithSubmenu' },
|
|
216
|
+
{ $ref: '#/components/schemas/MenuDtoWithUrl' }
|
|
217
|
+
]
|
|
218
|
+
}),
|
|
137
219
|
__metadata("design:type", Object)
|
|
138
220
|
], AdminPanelDto.prototype, "menu", void 0);
|
|
139
221
|
__decorate([
|
|
@@ -143,6 +225,15 @@ __decorate([
|
|
|
143
225
|
(0, is_one_of_validator_1.IsOneOf)([settings_dto_1.SettingsWithUrlDto, settings_dto_1.SettingsWithTabsDto], {
|
|
144
226
|
message: 'settings must be SettingsWithUrlDto or SettingsWithTabsDto',
|
|
145
227
|
}),
|
|
228
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
229
|
+
title: 'Settings',
|
|
230
|
+
description: 'Admin panel settings page configuration.',
|
|
231
|
+
type: 'object',
|
|
232
|
+
oneOf: [
|
|
233
|
+
{ $ref: '#/components/schemas/SettingsWithUrlDto' },
|
|
234
|
+
{ $ref: '#/components/schemas/SettingsWithTabsDto' }
|
|
235
|
+
]
|
|
236
|
+
}),
|
|
146
237
|
__metadata("design:type", Object)
|
|
147
238
|
], AdminPanelDto.prototype, "settings", void 0);
|
|
148
239
|
exports.AdminPanelDto = AdminPanelDto = __decorate([
|
|
@@ -18,6 +18,7 @@ const tab_dto_1 = require("./tab.dto");
|
|
|
18
18
|
const menu_transformer_1 = require("../transformers/menu.transformer");
|
|
19
19
|
const is_one_of_validator_1 = require("../decorators/is-one-of.validator");
|
|
20
20
|
const at_least_one_non_empty_validator_1 = require("../decorators/at-least-one-non-empty.validator");
|
|
21
|
+
const class_validator_jsonschema_1 = require("class-validator-jsonschema");
|
|
21
22
|
let ClientPanelTabsDto = class ClientPanelTabsDto {
|
|
22
23
|
};
|
|
23
24
|
exports.ClientPanelTabsDto = ClientPanelTabsDto;
|
|
@@ -27,6 +28,12 @@ __decorate([
|
|
|
27
28
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
28
29
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
29
30
|
(0, class_transformer_1.Type)(() => tab_dto_1.TabDto),
|
|
31
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
32
|
+
title: 'Item Tabs',
|
|
33
|
+
description: 'Tabs shown on the item page in Client panel.',
|
|
34
|
+
type: 'array',
|
|
35
|
+
items: { $ref: '#/components/schemas/TabDto' }
|
|
36
|
+
}),
|
|
30
37
|
__metadata("design:type", Array)
|
|
31
38
|
], ClientPanelTabsDto.prototype, "item", void 0);
|
|
32
39
|
exports.ClientPanelTabsDto = ClientPanelTabsDto = __decorate([
|
|
@@ -41,6 +48,12 @@ __decorate([
|
|
|
41
48
|
(0, class_validator_1.ArrayMinSize)(1),
|
|
42
49
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
43
50
|
(0, class_transformer_1.Type)(() => action_dto_1.ActionDto),
|
|
51
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
52
|
+
title: 'Item Actions',
|
|
53
|
+
description: 'Additional actions available on the item page in Client panel.',
|
|
54
|
+
type: 'array',
|
|
55
|
+
items: { $ref: '#/components/schemas/ActionDto' }
|
|
56
|
+
}),
|
|
44
57
|
__metadata("design:type", Array)
|
|
45
58
|
], ClientPanelMoreActionsDto.prototype, "item", void 0);
|
|
46
59
|
exports.ClientPanelMoreActionsDto = ClientPanelMoreActionsDto = __decorate([
|
|
@@ -53,12 +66,24 @@ __decorate([
|
|
|
53
66
|
(0, class_validator_1.IsOptional)(),
|
|
54
67
|
(0, class_validator_1.ValidateNested)(),
|
|
55
68
|
(0, class_transformer_1.Type)(() => ClientPanelTabsDto),
|
|
69
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
70
|
+
title: 'Tabs',
|
|
71
|
+
description: 'Tab structure for Client panel.',
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: { tabs: { $ref: '#/components/schemas/ClientPanelTabsDto' } }
|
|
74
|
+
}),
|
|
56
75
|
__metadata("design:type", ClientPanelTabsDto)
|
|
57
76
|
], ClientPanelDto.prototype, "tabs", void 0);
|
|
58
77
|
__decorate([
|
|
59
78
|
(0, class_validator_1.IsOptional)(),
|
|
60
79
|
(0, class_validator_1.ValidateNested)(),
|
|
61
80
|
(0, class_transformer_1.Type)(() => ClientPanelMoreActionsDto),
|
|
81
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
82
|
+
title: 'More Actions',
|
|
83
|
+
description: 'Additional actions in Client panel.',
|
|
84
|
+
type: 'object',
|
|
85
|
+
properties: { moreActions: { $ref: '#/components/schemas/ClientPanelMoreActionsDto' } }
|
|
86
|
+
}),
|
|
62
87
|
__metadata("design:type", ClientPanelMoreActionsDto)
|
|
63
88
|
], ClientPanelDto.prototype, "moreActions", void 0);
|
|
64
89
|
__decorate([
|
|
@@ -68,6 +93,11 @@ __decorate([
|
|
|
68
93
|
(0, is_one_of_validator_1.IsOneOf)([menu_dto_1.MenuDtoWithSubmenu, menu_dto_1.MenuDtoWithUrl], {
|
|
69
94
|
message: 'menu must be either a MenuDtoWithUrl or MenuDtoWithSubmenu',
|
|
70
95
|
}),
|
|
96
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
97
|
+
title: 'Menu',
|
|
98
|
+
description: 'Client panel main menu (URL or submenu variant).',
|
|
99
|
+
oneOf: [{ $ref: '#/components/schemas/MenuDtoWithSubmenu' }, { $ref: '#/components/schemas/MenuDtoWithUrl' }],
|
|
100
|
+
}),
|
|
71
101
|
__metadata("design:type", Object)
|
|
72
102
|
], ClientPanelDto.prototype, "menu", void 0);
|
|
73
103
|
exports.ClientPanelDto = ClientPanelDto = __decorate([
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.FieldOptionDto = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_validator_jsonschema_1 = require("class-validator-jsonschema");
|
|
14
15
|
/**
|
|
15
16
|
* Data Transfer Object for field options.
|
|
16
17
|
* This class defines the structure and properties of a field option
|
|
@@ -28,15 +29,30 @@ exports.FieldOptionDto = FieldOptionDto;
|
|
|
28
29
|
__decorate([
|
|
29
30
|
(0, class_validator_1.IsString)(),
|
|
30
31
|
(0, class_validator_1.IsDefined)(),
|
|
32
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
33
|
+
title: 'Key',
|
|
34
|
+
description: 'Internal key for the option.',
|
|
35
|
+
type: 'string'
|
|
36
|
+
}),
|
|
31
37
|
__metadata("design:type", String)
|
|
32
38
|
], FieldOptionDto.prototype, "key", void 0);
|
|
33
39
|
__decorate([
|
|
34
40
|
(0, class_validator_1.IsString)(),
|
|
35
41
|
(0, class_validator_1.IsDefined)(),
|
|
42
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
43
|
+
title: 'Value',
|
|
44
|
+
description: 'Display value for the option.',
|
|
45
|
+
type: 'string'
|
|
46
|
+
}),
|
|
36
47
|
__metadata("design:type", String)
|
|
37
48
|
], FieldOptionDto.prototype, "value", void 0);
|
|
38
49
|
__decorate([
|
|
39
50
|
(0, class_validator_1.IsBoolean)(),
|
|
40
51
|
(0, class_validator_1.IsOptional)(),
|
|
52
|
+
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
53
|
+
title: 'Disabled',
|
|
54
|
+
description: 'Whether the option is disabled.',
|
|
55
|
+
type: 'boolean'
|
|
56
|
+
}),
|
|
41
57
|
__metadata("design:type", Boolean)
|
|
42
58
|
], FieldOptionDto.prototype, "disabled", void 0);
|