@hosterai/types 0.0.28 → 0.0.30
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 +5 -1
- package/dist/decorators/all-or-none-validator.spec.js +9 -3
- package/dist/decorators/at-least-one-non-empty-validator.spec.js +1 -1
- package/dist/decorators/at-least-one-non-empty.validator.js +2 -2
- package/dist/decorators/is-of-allowed-types-validator.spec.js +10 -8
- package/dist/decorators/is-of-allowed-types.validator.js +4 -2
- package/dist/decorators/is-one-of.validator.d.ts +2 -2
- package/dist/decorators/is-one-of.validator.js +1 -1
- package/dist/decorators/is-plain-object.validator.d.ts +1 -1
- package/dist/decorators/is-plain-object.validator.js +3 -1
- package/dist/decorators/is-property-forbidden-validator.spec.js +12 -4
- package/dist/decorators/is-property-forbidden.validator.d.ts +1 -1
- package/dist/decorators/is-regex.validator.d.ts +1 -1
- package/dist/decorators/min-less-or-equal-validator.spec.js +6 -2
- package/dist/dtos/action.dto.js +5 -5
- package/dist/dtos/addon-field.dto.d.ts +1 -1
- package/dist/dtos/admin-panel.dto.js +16 -18
- package/dist/dtos/attribute-field.dto.d.ts +1 -1
- package/dist/dtos/client-panel.dto.d.ts +3 -3
- package/dist/dtos/client-panel.dto.js +11 -10
- package/dist/dtos/company-data.dto.d.ts +4 -0
- package/dist/dtos/company-data.dto.js +19 -8
- package/dist/dtos/error-response.dto.js +1 -4
- package/dist/dtos/field-option.dto.js +3 -3
- package/dist/dtos/info.dto.js +10 -10
- package/dist/dtos/invoice/invoice-info.dto.d.ts +3 -3
- package/dist/dtos/invoice/invoice-info.dto.js +1 -1
- package/dist/dtos/invoice/invoice-item-data.dto.d.ts +2 -2
- package/dist/dtos/invoice/requests/base-invoice-request.dto.d.ts +30 -0
- package/dist/dtos/invoice/requests/base-invoice-request.dto.js +108 -0
- package/dist/dtos/invoice/requests/credit-note-request.dto.d.ts +2 -2
- package/dist/dtos/invoice/requests/credit-note-request.dto.js +2 -2
- package/dist/dtos/invoice/requests/invoice-request.dto.d.ts +2 -2
- package/dist/dtos/invoice/requests/invoice-request.dto.js +2 -2
- package/dist/dtos/invoice/requests/proforma-invoice-request.dto.d.ts +2 -19
- package/dist/dtos/invoice/requests/proforma-invoice-request.dto.js +2 -95
- package/dist/dtos/invoice/responses/credit-note-response.dto.d.ts +1 -1
- package/dist/dtos/invoice/responses/invoice-response.dto.d.ts +1 -1
- package/dist/dtos/invoice/responses/tax-details-response.dto.js +1 -1
- package/dist/dtos/invoice-contact-data.dto.d.ts +2 -2
- package/dist/dtos/invoice-contact-data.dto.js +5 -5
- package/dist/dtos/menu.dto.js +8 -4
- package/dist/dtos/notification/responses/notification-send-response.dto.d.ts +1 -1
- package/dist/dtos/notification/sender/sender-sms.dto.js +1 -1
- package/dist/dtos/product/product-info.dto.d.ts +2 -2
- package/dist/dtos/product/product-info.dto.js +12 -6
- package/dist/dtos/product/product-item-data.dto.d.ts +3 -3
- package/dist/dtos/product/product-item-data.dto.js +2 -2
- package/dist/dtos/product/requests/product-create-request.dto.js +1 -1
- package/dist/dtos/product/requests/product-delete-request.dto.js +3 -3
- package/dist/dtos/product/requests/product-downgradable-request.dto.js +1 -1
- package/dist/dtos/product/requests/product-downgrade-request.dto.js +1 -1
- package/dist/dtos/product/requests/product-renew-request.dto.js +1 -1
- package/dist/dtos/product/requests/product-suspend-request.dto.js +1 -1
- package/dist/dtos/product/requests/product-unsuspend-request.dto.js +1 -1
- package/dist/dtos/product/requests/product-upgradable-request.dto.js +1 -1
- package/dist/dtos/product/requests/product-upgrade-request.dto.js +1 -1
- package/dist/dtos/product/responses/product-info-response.dto.js +1 -1
- package/dist/dtos/responses/validate-attributes-response.dto.d.ts +2 -2
- package/dist/dtos/tab.dto.js +2 -2
- package/dist/dtos/tax-manager/tax-details-request.dto.d.ts +31 -0
- package/dist/dtos/tax-manager/tax-details-request.dto.js +84 -0
- package/dist/dtos/unit.dto.js +3 -3
- package/dist/enums/country.enum.d.ts +1 -1
- package/dist/enums/country.enum.js +312 -78
- package/dist/enums/currency.enum.d.ts +43 -0
- package/dist/enums/currency.enum.js +47 -0
- package/dist/enums/item-actions.enum.d.ts +10 -10
- package/dist/enums/item-actions.enum.js +13 -14
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/openapi/schemas/components.schemas.d.ts +1 -31
- package/dist/openapi/schemas/components.schemas.js +19 -49
- package/dist/validators/action-validator.spec.js +3 -3
- package/dist/validators/addon-field-validator.spec.js +10 -3
- package/dist/validators/admin-panel-more-actions-validator.spec.js +12 -8
- package/dist/validators/admin-panel-more-actions.validator.d.ts +1 -1
- package/dist/validators/admin-panel-tabs-validator.spec.js +74 -10
- package/dist/validators/admin-panel-tabs.validator.d.ts +1 -1
- package/dist/validators/admin-panel-validator.spec.js +164 -32
- package/dist/validators/attachment-validator.spec.js +8 -8
- package/dist/validators/attribute-field-validator.spec.js +18 -7
- package/dist/validators/client-panel-validator.spec.js +57 -9
- package/dist/validators/country-validator.spec.js +7 -7
- package/dist/validators/field-validator.spec.js +35 -10
- package/dist/validators/info-validator.spec.js +10 -10
- package/dist/validators/invoice-contact-data-validator.spec.js +18 -10
- package/dist/validators/invoice-info-validator.spec.js +14 -10
- package/dist/validators/invoice-item-data-validator.spec.js +4 -4
- package/dist/validators/item-data-validator.spec.js +17 -9
- package/dist/validators/menu-with-submenu-validator.spec.js +13 -11
- package/dist/validators/menu-with-url-validator.spec.js +15 -5
- package/dist/validators/notification-info-validator.spec.js +28 -20
- package/dist/validators/product-info-validator.spec.js +59 -45
- package/dist/validators/product-info.validator.d.ts +1 -1
- package/dist/validators/product-item-data-validator.spec.js +15 -7
- package/dist/validators/sender-sms-validator.spec.js +5 -2
- package/dist/validators/settings-with-tabs-validator.spec.js +176 -12
- package/dist/validators/settings-with-url-validator.spec.js +89 -11
- package/dist/validators/tab-validator.spec.js +7 -7
- package/dist/validators/tin-validation-details-validator.spec.js +8 -8
- package/dist/validators/transaction-data-validator.spec.js +13 -8
- package/dist/validators/unit-validator.spec.js +13 -4
- package/package.json +1 -1
|
@@ -15,35 +15,35 @@ describe('TabDto Validator', () => {
|
|
|
15
15
|
describe('Missing required fields', () => {
|
|
16
16
|
it('should return errors when all fields are missing', () => {
|
|
17
17
|
const errors = (0, tab_validator_1.validateTabDto)({});
|
|
18
|
-
expect(errors.some(e => e.property === 'label')).toBe(true);
|
|
19
|
-
expect(errors.some(e => e.property === 'url')).toBe(true);
|
|
18
|
+
expect(errors.some((e) => e.property === 'label')).toBe(true);
|
|
19
|
+
expect(errors.some((e) => e.property === 'url')).toBe(true);
|
|
20
20
|
});
|
|
21
21
|
it('should return error when label is missing', () => {
|
|
22
22
|
const dto = { url: 'https://example.com/settings' };
|
|
23
23
|
const errors = (0, tab_validator_1.validateTabDto)(dto);
|
|
24
|
-
expect(errors.some(e => e.property === 'label')).toBe(true);
|
|
24
|
+
expect(errors.some((e) => e.property === 'label')).toBe(true);
|
|
25
25
|
});
|
|
26
26
|
it('should return error when url is missing', () => {
|
|
27
27
|
const dto = { label: 'Settings' };
|
|
28
28
|
const errors = (0, tab_validator_1.validateTabDto)(dto);
|
|
29
|
-
expect(errors.some(e => e.property === 'url')).toBe(true);
|
|
29
|
+
expect(errors.some((e) => e.property === 'url')).toBe(true);
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
describe('Invalid field values', () => {
|
|
33
33
|
it('should return error for empty label', () => {
|
|
34
34
|
const dto = { ...baseValidDto, label: '' };
|
|
35
35
|
const errors = (0, tab_validator_1.validateTabDto)(dto);
|
|
36
|
-
expect(errors.some(e => e.property === 'label')).toBe(true);
|
|
36
|
+
expect(errors.some((e) => e.property === 'label')).toBe(true);
|
|
37
37
|
});
|
|
38
38
|
it('should return error for non-https URL', () => {
|
|
39
39
|
const dto = { ...baseValidDto, url: 'http://example.com/settings' };
|
|
40
40
|
const errors = (0, tab_validator_1.validateTabDto)(dto);
|
|
41
|
-
expect(errors.some(e => e.property === 'url')).toBe(true);
|
|
41
|
+
expect(errors.some((e) => e.property === 'url')).toBe(true);
|
|
42
42
|
});
|
|
43
43
|
it('should return error for invalid URL', () => {
|
|
44
44
|
const dto = { ...baseValidDto, url: 'not-a-url' };
|
|
45
45
|
const errors = (0, tab_validator_1.validateTabDto)(dto);
|
|
46
|
-
expect(errors.some(e => e.property === 'url')).toBe(true);
|
|
46
|
+
expect(errors.some((e) => e.property === 'url')).toBe(true);
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
});
|
|
@@ -33,45 +33,45 @@ describe('TINValidationDetails Validator', () => {
|
|
|
33
33
|
const errors = (0, tin_validation_details_validator_1.validateTINValidationDetailsDto)({});
|
|
34
34
|
const requiredProps = ['address1', 'postcode', 'city', 'country'];
|
|
35
35
|
for (const prop of requiredProps) {
|
|
36
|
-
expect(errors.some(e => e.property === prop)).toBe(true);
|
|
36
|
+
expect(errors.some((e) => e.property === prop)).toBe(true);
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
it('should return error when address1 is missing', () => {
|
|
40
40
|
const { address1, ...dto } = baseValidDto;
|
|
41
41
|
const errors = (0, tin_validation_details_validator_1.validateTINValidationDetailsDto)(dto);
|
|
42
|
-
expect(errors.some(e => e.property === 'address1')).toBe(true);
|
|
42
|
+
expect(errors.some((e) => e.property === 'address1')).toBe(true);
|
|
43
43
|
});
|
|
44
44
|
it('should return error when country is missing', () => {
|
|
45
45
|
const { country, ...dto } = baseValidDto;
|
|
46
46
|
const errors = (0, tin_validation_details_validator_1.validateTINValidationDetailsDto)(dto);
|
|
47
|
-
expect(errors.some(e => e.property === 'country')).toBe(true);
|
|
47
|
+
expect(errors.some((e) => e.property === 'country')).toBe(true);
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
50
|
describe('Invalid field values', () => {
|
|
51
51
|
it('should return error for invalid country code', () => {
|
|
52
52
|
const dto = { ...baseValidDto, country: 'INVALID' };
|
|
53
53
|
const errors = (0, tin_validation_details_validator_1.validateTINValidationDetailsDto)(dto);
|
|
54
|
-
expect(errors.some(e => e.property === 'country')).toBe(true);
|
|
54
|
+
expect(errors.some((e) => e.property === 'country')).toBe(true);
|
|
55
55
|
});
|
|
56
56
|
it('should return error for postcode exceeding max length', () => {
|
|
57
57
|
const dto = { ...baseValidDto, postcode: '1'.repeat(17) };
|
|
58
58
|
const errors = (0, tin_validation_details_validator_1.validateTINValidationDetailsDto)(dto);
|
|
59
|
-
expect(errors.some(e => e.property === 'postcode')).toBe(true);
|
|
59
|
+
expect(errors.some((e) => e.property === 'postcode')).toBe(true);
|
|
60
60
|
});
|
|
61
61
|
it('should return error for city exceeding max length', () => {
|
|
62
62
|
const dto = { ...baseValidDto, city: 'a'.repeat(251) };
|
|
63
63
|
const errors = (0, tin_validation_details_validator_1.validateTINValidationDetailsDto)(dto);
|
|
64
|
-
expect(errors.some(e => e.property === 'city')).toBe(true);
|
|
64
|
+
expect(errors.some((e) => e.property === 'city')).toBe(true);
|
|
65
65
|
});
|
|
66
66
|
it('should return error for companyName exceeding max length', () => {
|
|
67
67
|
const dto = { ...baseValidDto, companyName: 'a'.repeat(251) };
|
|
68
68
|
const errors = (0, tin_validation_details_validator_1.validateTINValidationDetailsDto)(dto);
|
|
69
|
-
expect(errors.some(e => e.property === 'companyName')).toBe(true);
|
|
69
|
+
expect(errors.some((e) => e.property === 'companyName')).toBe(true);
|
|
70
70
|
});
|
|
71
71
|
it('should return error for tin exceeding max length', () => {
|
|
72
72
|
const dto = { ...baseValidDto, tin: 'X'.repeat(21) };
|
|
73
73
|
const errors = (0, tin_validation_details_validator_1.validateTINValidationDetailsDto)(dto);
|
|
74
|
-
expect(errors.some(e => e.property === 'tin')).toBe(true);
|
|
74
|
+
expect(errors.some((e) => e.property === 'tin')).toBe(true);
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
});
|
|
@@ -21,42 +21,47 @@ describe('TransactionData Validator', () => {
|
|
|
21
21
|
describe('Missing required fields', () => {
|
|
22
22
|
it('should return errors when all fields are missing', () => {
|
|
23
23
|
const errors = (0, transaction_data_validator_1.validateTransactionDataDto)({});
|
|
24
|
-
const requiredProps = [
|
|
24
|
+
const requiredProps = [
|
|
25
|
+
'transactionId',
|
|
26
|
+
'amount',
|
|
27
|
+
'paymentMethod',
|
|
28
|
+
'date',
|
|
29
|
+
];
|
|
25
30
|
for (const prop of requiredProps) {
|
|
26
|
-
expect(errors.some(e => e.property === prop)).toBe(true);
|
|
31
|
+
expect(errors.some((e) => e.property === prop)).toBe(true);
|
|
27
32
|
}
|
|
28
33
|
});
|
|
29
34
|
it('should return error when transactionId is missing', () => {
|
|
30
35
|
const { transactionId, ...dto } = baseValidDto;
|
|
31
36
|
const errors = (0, transaction_data_validator_1.validateTransactionDataDto)(dto);
|
|
32
|
-
expect(errors.some(e => e.property === 'transactionId')).toBe(true);
|
|
37
|
+
expect(errors.some((e) => e.property === 'transactionId')).toBe(true);
|
|
33
38
|
});
|
|
34
39
|
it('should return error when amount is missing', () => {
|
|
35
40
|
const { amount, ...dto } = baseValidDto;
|
|
36
41
|
const errors = (0, transaction_data_validator_1.validateTransactionDataDto)(dto);
|
|
37
|
-
expect(errors.some(e => e.property === 'amount')).toBe(true);
|
|
42
|
+
expect(errors.some((e) => e.property === 'amount')).toBe(true);
|
|
38
43
|
});
|
|
39
44
|
});
|
|
40
45
|
describe('Invalid field values', () => {
|
|
41
46
|
it('should return error for empty transactionId', () => {
|
|
42
47
|
const dto = { ...baseValidDto, transactionId: '' };
|
|
43
48
|
const errors = (0, transaction_data_validator_1.validateTransactionDataDto)(dto);
|
|
44
|
-
expect(errors.some(e => e.property === 'transactionId')).toBe(true);
|
|
49
|
+
expect(errors.some((e) => e.property === 'transactionId')).toBe(true);
|
|
45
50
|
});
|
|
46
51
|
it('should return error for non-number amount', () => {
|
|
47
52
|
const dto = { ...baseValidDto, amount: 'free' };
|
|
48
53
|
const errors = (0, transaction_data_validator_1.validateTransactionDataDto)(dto);
|
|
49
|
-
expect(errors.some(e => e.property === 'amount')).toBe(true);
|
|
54
|
+
expect(errors.some((e) => e.property === 'amount')).toBe(true);
|
|
50
55
|
});
|
|
51
56
|
it('should return error for empty paymentMethod', () => {
|
|
52
57
|
const dto = { ...baseValidDto, paymentMethod: '' };
|
|
53
58
|
const errors = (0, transaction_data_validator_1.validateTransactionDataDto)(dto);
|
|
54
|
-
expect(errors.some(e => e.property === 'paymentMethod')).toBe(true);
|
|
59
|
+
expect(errors.some((e) => e.property === 'paymentMethod')).toBe(true);
|
|
55
60
|
});
|
|
56
61
|
it('should return error for invalid date', () => {
|
|
57
62
|
const dto = { ...baseValidDto, date: 'not-a-date' };
|
|
58
63
|
const errors = (0, transaction_data_validator_1.validateTransactionDataDto)(dto);
|
|
59
|
-
expect(errors.some(e => e.property === 'date')).toBe(true);
|
|
64
|
+
expect(errors.some((e) => e.property === 'date')).toBe(true);
|
|
60
65
|
});
|
|
61
66
|
});
|
|
62
67
|
});
|
|
@@ -16,12 +16,21 @@ describe('UnitDto Validator', () => {
|
|
|
16
16
|
[{ ...validDto, unitDescription: undefined }, 'unitDescription'],
|
|
17
17
|
[{ ...validDto, intervalDescription: undefined }, 'intervalDescription'],
|
|
18
18
|
[{ unitDescription: 'MB', intervalDescription: 'month' }, 'id'],
|
|
19
|
-
[
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
[
|
|
20
|
+
{ id: 6979466666, unitDescription: 'MB', intervalDescription: 'month' },
|
|
21
|
+
'id',
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
{ id: 'ram', unitDescription: 123, intervalDescription: 'month' },
|
|
25
|
+
'unitDescription',
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
{ id: 'ram', unitDescription: 'MB', intervalDescription: 123 },
|
|
29
|
+
'intervalDescription',
|
|
30
|
+
],
|
|
22
31
|
])('should return error for invalid %s', (dto, expectedErrorProp) => {
|
|
23
32
|
const errors = (0, unit_validator_1.validateUnitDto)(dto);
|
|
24
33
|
expect(errors.length).toBeGreaterThan(0);
|
|
25
|
-
expect(errors.some(e => e.property === expectedErrorProp)).toBe(true);
|
|
34
|
+
expect(errors.some((e) => e.property === expectedErrorProp)).toBe(true);
|
|
26
35
|
});
|
|
27
36
|
});
|