@hosterai/types 0.0.29 → 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/dist/dtos/invoice/requests/base-invoice-request.dto.d.ts +1 -1
- package/dist/dtos/invoice/requests/base-invoice-request.dto.js +1 -1
- package/dist/dtos/product/product-info.dto.d.ts +2 -2
- package/dist/dtos/product/product-info.dto.js +2 -2
- package/dist/dtos/product/product-item-data.dto.d.ts +2 -2
- package/dist/dtos/product/product-item-data.dto.js +2 -2
- package/dist/enums/item-actions.enum.d.ts +10 -10
- package/dist/enums/item-actions.enum.js +13 -14
- package/dist/openapi/schemas/components.schemas.d.ts +1 -1
- package/dist/openapi/schemas/components.schemas.js +9 -9
- package/dist/validators/notification-info-validator.spec.js +5 -5
- package/dist/validators/product-info-validator.spec.js +13 -13
- package/dist/validators/product-item-data-validator.spec.js +3 -3
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ export declare abstract class BaseInvoiceRequestDto {
|
|
|
15
15
|
/**
|
|
16
16
|
* Invoice contact data (without invoiceContactId)
|
|
17
17
|
*/
|
|
18
|
-
invoiceContact:
|
|
18
|
+
invoiceContact: InvoiceContactData;
|
|
19
19
|
currency: CurrencyEnum;
|
|
20
20
|
/** Line items included in the invoice */
|
|
21
21
|
items: InvoiceItemDataDto[];
|
|
@@ -47,7 +47,7 @@ __decorate([
|
|
|
47
47
|
description: 'Invoice contact data (without invoiceContactId).',
|
|
48
48
|
$ref: '#/components/schemas/InvoiceContactData',
|
|
49
49
|
}),
|
|
50
|
-
__metadata("design:type",
|
|
50
|
+
__metadata("design:type", invoice_contact_data_dto_1.InvoiceContactData)
|
|
51
51
|
], BaseInvoiceRequestDto.prototype, "invoiceContact", void 0);
|
|
52
52
|
__decorate([
|
|
53
53
|
(0, class_validator_1.IsDefined)(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AttributeFieldDto } from '../attribute-field.dto';
|
|
2
2
|
import { InfoDto } from '../info.dto';
|
|
3
3
|
import { UnitDto } from '../unit.dto';
|
|
4
|
-
import {
|
|
4
|
+
import { ProductActionsEnum } from '../../enums/item-actions.enum';
|
|
5
5
|
/**
|
|
6
6
|
* DTO for notification information.
|
|
7
7
|
* Extends the base InfoDto to include the notification message type.
|
|
@@ -31,5 +31,5 @@ export declare class ProductInfoDto extends InfoDto {
|
|
|
31
31
|
/**
|
|
32
32
|
* A list of actions that are supported by this integration.
|
|
33
33
|
*/
|
|
34
|
-
supportedActions:
|
|
34
|
+
supportedActions: ProductActionsEnum[];
|
|
35
35
|
}
|
|
@@ -99,12 +99,12 @@ __decorate([
|
|
|
99
99
|
__decorate([
|
|
100
100
|
(0, class_validator_1.IsNotEmpty)(),
|
|
101
101
|
(0, class_validator_1.IsArray)(),
|
|
102
|
-
(0, class_validator_1.IsEnum)(item_actions_enum_1.
|
|
102
|
+
(0, class_validator_1.IsEnum)(item_actions_enum_1.ProductActionsEnum, { each: true }),
|
|
103
103
|
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
104
104
|
title: 'Supported Actions',
|
|
105
105
|
description: 'Actions supported by this integration.',
|
|
106
106
|
type: 'array',
|
|
107
|
-
items: { type: 'string', enum: Object.values(item_actions_enum_1.
|
|
107
|
+
items: { type: 'string', enum: Object.values(item_actions_enum_1.ProductActionsEnum) },
|
|
108
108
|
}),
|
|
109
109
|
__metadata("design:type", Array)
|
|
110
110
|
], ProductInfoDto.prototype, "supportedActions", void 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProductActionsEnum } from '../../enums/item-actions.enum';
|
|
2
2
|
import { ItemDataDto } from '../item-data.dto';
|
|
3
3
|
/**
|
|
4
4
|
* Product item data sent to product integrations.
|
|
@@ -6,5 +6,5 @@ import { ItemDataDto } from '../item-data.dto';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class ProductItemDataDto extends ItemDataDto {
|
|
8
8
|
/** Product-specific action type for this item */
|
|
9
|
-
action?:
|
|
9
|
+
action?: ProductActionsEnum;
|
|
10
10
|
}
|
|
@@ -23,12 +23,12 @@ class ProductItemDataDto extends item_data_dto_1.ItemDataDto {
|
|
|
23
23
|
exports.ProductItemDataDto = ProductItemDataDto;
|
|
24
24
|
__decorate([
|
|
25
25
|
(0, class_validator_1.IsOptional)(),
|
|
26
|
-
(0, class_validator_1.IsEnum)(item_actions_enum_1.
|
|
26
|
+
(0, class_validator_1.IsEnum)(item_actions_enum_1.ProductActionsEnum),
|
|
27
27
|
(0, class_validator_jsonschema_1.JSONSchema)({
|
|
28
28
|
title: 'Action',
|
|
29
29
|
description: 'Product-specific action type for this item.',
|
|
30
30
|
type: 'string',
|
|
31
|
-
enum: Object.values(item_actions_enum_1.
|
|
31
|
+
enum: Object.values(item_actions_enum_1.ProductActionsEnum),
|
|
32
32
|
}),
|
|
33
33
|
__metadata("design:type", String)
|
|
34
34
|
], ProductItemDataDto.prototype, "action", void 0);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare enum
|
|
2
|
-
CREATE = "
|
|
3
|
-
RENEW = "
|
|
4
|
-
UPGRADE = "
|
|
5
|
-
DOWNGRADE = "
|
|
6
|
-
TRANSFER = "
|
|
7
|
-
TRADE = "
|
|
8
|
-
SUSPEND = "
|
|
9
|
-
UNSUSPEND = "
|
|
10
|
-
DELETE = "
|
|
1
|
+
export declare enum ProductActionsEnum {
|
|
2
|
+
CREATE = "CREATE",
|
|
3
|
+
RENEW = "RENEW",
|
|
4
|
+
UPGRADE = "UPGRADE",
|
|
5
|
+
DOWNGRADE = "DOWNGRADE",
|
|
6
|
+
TRANSFER = "TRANSFER",
|
|
7
|
+
TRADE = "TRADE",
|
|
8
|
+
SUSPEND = "SUSPEND",
|
|
9
|
+
UNSUSPEND = "UNSUSPEND",
|
|
10
|
+
DELETE = "DELETE"
|
|
11
11
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})(ProductItemActionsEnum || (exports.ProductItemActionsEnum = ProductItemActionsEnum = {}));
|
|
3
|
+
exports.ProductActionsEnum = void 0;
|
|
4
|
+
var ProductActionsEnum;
|
|
5
|
+
(function (ProductActionsEnum) {
|
|
6
|
+
ProductActionsEnum["CREATE"] = "CREATE";
|
|
7
|
+
ProductActionsEnum["RENEW"] = "RENEW";
|
|
8
|
+
ProductActionsEnum["UPGRADE"] = "UPGRADE";
|
|
9
|
+
ProductActionsEnum["DOWNGRADE"] = "DOWNGRADE";
|
|
10
|
+
ProductActionsEnum["TRANSFER"] = "TRANSFER";
|
|
11
|
+
ProductActionsEnum["TRADE"] = "TRADE";
|
|
12
|
+
ProductActionsEnum["SUSPEND"] = "SUSPEND";
|
|
13
|
+
ProductActionsEnum["UNSUSPEND"] = "UNSUSPEND";
|
|
14
|
+
ProductActionsEnum["DELETE"] = "DELETE";
|
|
15
|
+
})(ProductActionsEnum || (exports.ProductActionsEnum = ProductActionsEnum = {}));
|
|
@@ -934,7 +934,7 @@ export declare const ComponentsSchemas: {
|
|
|
934
934
|
};
|
|
935
935
|
readonly supportedActions: {
|
|
936
936
|
readonly items: {
|
|
937
|
-
readonly enum: readonly ["
|
|
937
|
+
readonly enum: readonly ["CREATE", "RENEW", "UPGRADE", "DOWNGRADE", "TRANSFER", "TRADE", "SUSPEND", "UNSUSPEND", "DELETE"];
|
|
938
938
|
readonly type: "string";
|
|
939
939
|
};
|
|
940
940
|
readonly type: "array";
|
|
@@ -2337,15 +2337,15 @@ exports.ComponentsSchemas = {
|
|
|
2337
2337
|
"supportedActions": {
|
|
2338
2338
|
"items": {
|
|
2339
2339
|
"enum": [
|
|
2340
|
-
"
|
|
2341
|
-
"
|
|
2342
|
-
"
|
|
2343
|
-
"
|
|
2344
|
-
"
|
|
2345
|
-
"
|
|
2346
|
-
"
|
|
2347
|
-
"
|
|
2348
|
-
"
|
|
2340
|
+
"CREATE",
|
|
2341
|
+
"RENEW",
|
|
2342
|
+
"UPGRADE",
|
|
2343
|
+
"DOWNGRADE",
|
|
2344
|
+
"TRANSFER",
|
|
2345
|
+
"TRADE",
|
|
2346
|
+
"SUSPEND",
|
|
2347
|
+
"UNSUSPEND",
|
|
2348
|
+
"DELETE"
|
|
2349
2349
|
],
|
|
2350
2350
|
"type": "string"
|
|
2351
2351
|
},
|
|
@@ -17,7 +17,7 @@ describe('NotificationInfoDto Validator', () => {
|
|
|
17
17
|
dto: {
|
|
18
18
|
type: notification_message_type_enum_1.NotificationMessageTypeEnum.EMAIL,
|
|
19
19
|
title: 'Valid Title',
|
|
20
|
-
supportedActions: [item_actions_enum_1.
|
|
20
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
21
21
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
22
22
|
payPerUseUnits: [validUnit],
|
|
23
23
|
},
|
|
@@ -27,7 +27,7 @@ describe('NotificationInfoDto Validator', () => {
|
|
|
27
27
|
description: 'should return error for missing type',
|
|
28
28
|
dto: {
|
|
29
29
|
title: 'Valid Title',
|
|
30
|
-
supportedActions: [item_actions_enum_1.
|
|
30
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
31
31
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
32
32
|
payPerUseUnits: [validUnit],
|
|
33
33
|
},
|
|
@@ -38,7 +38,7 @@ describe('NotificationInfoDto Validator', () => {
|
|
|
38
38
|
dto: {
|
|
39
39
|
type: notification_message_type_enum_1.NotificationMessageTypeEnum.EMAIL,
|
|
40
40
|
title: 'Valid Title',
|
|
41
|
-
supportedActions: [item_actions_enum_1.
|
|
41
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
42
42
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
43
43
|
payPerUseUnits: [
|
|
44
44
|
{ id: '', unitDescription: '', intervalDescription: '' },
|
|
@@ -58,7 +58,7 @@ describe('NotificationInfoDto Validator', () => {
|
|
|
58
58
|
description: 'should return ValidationError for missing title',
|
|
59
59
|
dto: {
|
|
60
60
|
type: notification_message_type_enum_1.NotificationMessageTypeEnum.EMAIL,
|
|
61
|
-
supportedActions: [item_actions_enum_1.
|
|
61
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
62
62
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
63
63
|
payPerUseUnits: [validUnit],
|
|
64
64
|
},
|
|
@@ -69,7 +69,7 @@ describe('NotificationInfoDto Validator', () => {
|
|
|
69
69
|
dto: {
|
|
70
70
|
type: notification_message_type_enum_1.NotificationMessageTypeEnum.EMAIL,
|
|
71
71
|
title: 'Valid Title',
|
|
72
|
-
supportedActions: [item_actions_enum_1.
|
|
72
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
73
73
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
74
74
|
payPerUseUnits: [
|
|
75
75
|
{ id: '', unitDescription: '', intervalDescription: '' },
|
|
@@ -30,7 +30,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
30
30
|
description: 'should return no errors for valid DTO',
|
|
31
31
|
dto: {
|
|
32
32
|
title: 'Test',
|
|
33
|
-
supportedActions: [item_actions_enum_1.
|
|
33
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
34
34
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
35
35
|
productAttributes: [field],
|
|
36
36
|
itemAttributes: [field],
|
|
@@ -41,7 +41,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
41
41
|
description: 'should return error for invalid required and hidden',
|
|
42
42
|
dto: {
|
|
43
43
|
title: 'Test',
|
|
44
|
-
supportedActions: [item_actions_enum_1.
|
|
44
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
45
45
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
46
46
|
itemAttributes: [invalidField],
|
|
47
47
|
},
|
|
@@ -51,7 +51,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
51
51
|
description: 'should return error for invalid title',
|
|
52
52
|
dto: {
|
|
53
53
|
title: '',
|
|
54
|
-
supportedActions: [item_actions_enum_1.
|
|
54
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
55
55
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
56
56
|
productAttributes: [field],
|
|
57
57
|
itemAttributes: [field],
|
|
@@ -73,7 +73,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
73
73
|
description: 'should return error for unsupported language',
|
|
74
74
|
dto: {
|
|
75
75
|
title: 'Test',
|
|
76
|
-
supportedActions: [item_actions_enum_1.
|
|
76
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
77
77
|
supportedLanguages: [],
|
|
78
78
|
productAttributes: [field],
|
|
79
79
|
itemAttributes: [field],
|
|
@@ -84,7 +84,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
84
84
|
description: 'should return no errors for valid DTO with adminPanel and clientPanel',
|
|
85
85
|
dto: {
|
|
86
86
|
title: 'Test',
|
|
87
|
-
supportedActions: [item_actions_enum_1.
|
|
87
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
88
88
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
89
89
|
productAttributes: [field],
|
|
90
90
|
itemAttributes: [field],
|
|
@@ -103,7 +103,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
103
103
|
description: 'should return error for invalid DTO with adminPanel and clientPanel',
|
|
104
104
|
dto: {
|
|
105
105
|
title: '',
|
|
106
|
-
supportedActions: [item_actions_enum_1.
|
|
106
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
107
107
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
108
108
|
productAttributes: [field],
|
|
109
109
|
itemAttributes: [field],
|
|
@@ -120,7 +120,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
120
120
|
description: 'should return no errors for valid DTO with payPerUseUnits',
|
|
121
121
|
dto: {
|
|
122
122
|
title: 'Test',
|
|
123
|
-
supportedActions: [item_actions_enum_1.
|
|
123
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
124
124
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
125
125
|
productAttributes: [field],
|
|
126
126
|
itemAttributes: [field],
|
|
@@ -134,7 +134,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
134
134
|
description: 'should return error for invalid DTO with payPerUseUnits',
|
|
135
135
|
dto: {
|
|
136
136
|
title: 'Test',
|
|
137
|
-
supportedActions: [item_actions_enum_1.
|
|
137
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
138
138
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
139
139
|
productAttributes: [field],
|
|
140
140
|
itemAttributes: [field],
|
|
@@ -155,7 +155,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
155
155
|
{
|
|
156
156
|
description: 'should return ValidationError for missing title',
|
|
157
157
|
dto: {
|
|
158
|
-
supportedActions: [item_actions_enum_1.
|
|
158
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
159
159
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
160
160
|
productAttributes: [field],
|
|
161
161
|
itemAttributes: [field],
|
|
@@ -198,7 +198,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
198
198
|
};
|
|
199
199
|
const dto = {
|
|
200
200
|
title: 'Test',
|
|
201
|
-
supportedActions: [item_actions_enum_1.
|
|
201
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
202
202
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
203
203
|
productAttributes: [fieldWithOnlyMin],
|
|
204
204
|
};
|
|
@@ -219,7 +219,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
219
219
|
};
|
|
220
220
|
const dto = {
|
|
221
221
|
title: 'Test',
|
|
222
|
-
supportedActions: [item_actions_enum_1.
|
|
222
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
223
223
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
224
224
|
itemAttributes: [fieldWithOnlyMax],
|
|
225
225
|
};
|
|
@@ -238,7 +238,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
238
238
|
};
|
|
239
239
|
const dto = {
|
|
240
240
|
title: 'Test',
|
|
241
|
-
supportedActions: [item_actions_enum_1.
|
|
241
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
242
242
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
243
243
|
productAttributes: [fieldOk],
|
|
244
244
|
};
|
|
@@ -259,7 +259,7 @@ describe('ProductInfoDto Validator', () => {
|
|
|
259
259
|
};
|
|
260
260
|
const dto = {
|
|
261
261
|
title: 'Test',
|
|
262
|
-
supportedActions: [item_actions_enum_1.
|
|
262
|
+
supportedActions: [item_actions_enum_1.ProductActionsEnum.CREATE],
|
|
263
263
|
supportedLanguages: [language_enum_1.LanguageEnum.ENGLISH],
|
|
264
264
|
itemAttributes: [fieldBad],
|
|
265
265
|
};
|
|
@@ -18,10 +18,10 @@ describe('ProductItemDataDto Validator', () => {
|
|
|
18
18
|
expect((0, product_item_data_validator_1.validateProductItemDataDto)(baseValidDto)).toHaveLength(0);
|
|
19
19
|
});
|
|
20
20
|
it('should return no errors with a valid action', () => {
|
|
21
|
-
const dto = { ...baseValidDto, action: item_actions_enum_1.
|
|
21
|
+
const dto = { ...baseValidDto, action: item_actions_enum_1.ProductActionsEnum.CREATE };
|
|
22
22
|
expect((0, product_item_data_validator_1.validateProductItemDataDto)(dto)).toHaveLength(0);
|
|
23
23
|
});
|
|
24
|
-
it.each(Object.values(item_actions_enum_1.
|
|
24
|
+
it.each(Object.values(item_actions_enum_1.ProductActionsEnum))('should accept action %s', (action) => {
|
|
25
25
|
const dto = { ...baseValidDto, action };
|
|
26
26
|
expect((0, product_item_data_validator_1.validateProductItemDataDto)(dto)).toHaveLength(0);
|
|
27
27
|
});
|
|
@@ -31,7 +31,7 @@ describe('ProductItemDataDto Validator', () => {
|
|
|
31
31
|
itemId: 'item-456',
|
|
32
32
|
price: 9.99,
|
|
33
33
|
discountPrice: 7.99,
|
|
34
|
-
action: item_actions_enum_1.
|
|
34
|
+
action: item_actions_enum_1.ProductActionsEnum.RENEW,
|
|
35
35
|
};
|
|
36
36
|
expect((0, product_item_data_validator_1.validateProductItemDataDto)(dto)).toHaveLength(0);
|
|
37
37
|
});
|