@hosterai/types 0.0.10 → 0.0.12
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/LICENSE +21 -0
- package/README.md +156 -46
- package/dist/dtos/action.dto.d.ts +1 -1
- package/dist/dtos/action.dto.js +28 -0
- package/dist/dtos/attachment.dto.d.ts +1 -1
- package/dist/dtos/attachment.dto.js +1 -1
- package/dist/dtos/company-data.dto.d.ts +2 -2
- package/dist/dtos/company-data.dto.js +94 -0
- package/dist/dtos/error-response.dto.d.ts +1 -1
- package/dist/dtos/error-response.dto.js +1 -1
- package/dist/dtos/field.dto.d.ts +3 -3
- package/dist/dtos/field.dto.js +70 -0
- package/dist/dtos/info.dto.d.ts +2 -3
- package/dist/dtos/jwt.dto.d.ts +21 -19
- package/dist/dtos/jwt.dto.js +40 -0
- package/dist/dtos/menu.dto.d.ts +1 -1
- package/dist/dtos/multilang-text.dto.d.ts +1 -1
- package/dist/dtos/notification/notification-info.dto.d.ts +2 -2
- package/dist/dtos/notification/notification-request.dto.d.ts +2 -2
- package/dist/dtos/response-data.dto.d.ts +1 -1
- package/dist/dtos/setup-status-response.dto.d.ts +2 -2
- package/dist/enums/country.enum.js +3 -3
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/validators/action-validator.d.ts +8 -0
- package/dist/validators/action-validator.js +17 -0
- package/dist/validators/company-data-validator.d.ts +8 -0
- package/dist/validators/company-data-validator.js +17 -0
- package/dist/validators/field-validator.d.ts +8 -0
- package/dist/validators/field-validator.js +17 -0
- package/dist/validators/jwt-validator.d.ts +8 -0
- package/dist/validators/jwt-validator.js +17 -0
- package/dist/validators/multilang-text-validator.d.ts +8 -0
- package/dist/validators/multilang-text-validator.js +17 -0
- package/dist/validators/receiver-email-validator.d.ts +8 -0
- package/dist/validators/receiver-email-validator.js +17 -0
- package/dist/validators/receiver-push-validator.d.ts +8 -0
- package/dist/validators/receiver-push-validator.js +17 -0
- package/dist/validators/receiver-sms-validator.d.ts +8 -0
- package/dist/validators/receiver-sms-validator.js +17 -0
- package/dist/validators/sender-email-validator.d.ts +8 -0
- package/dist/validators/sender-email-validator.js +17 -0
- package/dist/validators/sender-push-validator.d.ts +8 -0
- package/dist/validators/sender-push-validator.js +17 -0
- package/dist/validators/sender-sms-validator.d.ts +8 -0
- package/dist/validators/sender-sms-validator.js +17 -0
- package/package.json +20 -5
- 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/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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 HosterAI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,72 +1,182 @@
|
|
|
1
1
|
# @hosterai/types
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@hosterai/types)
|
|
4
|
+
[](https://www.npmjs.com/package/@hosterai/types)
|
|
5
|
+
[](https://github.com/HosterAI/types/actions/workflows/ci.yml)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
This package contains the core data transfer objects (DTOs), enumerations (ENUMs), and validators used across the HosterAI platform. It ensures type safety and consistent data structures between different services and applications.
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
- `/enums/` - TypeScript Enum definitions
|
|
9
|
-
- `/validators/` - Programmatic validators for DTOs
|
|
10
|
+
## Installation
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
To install the package, use your preferred package manager:
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
```bash
|
|
15
|
+
npm install @hosterai/types
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
yarn add @hosterai/types
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Core Concepts
|
|
25
|
+
|
|
26
|
+
### DTOs (Data Transfer Objects)
|
|
27
|
+
|
|
28
|
+
DTOs define the shape of data that is exchanged between different parts of the system, such as API requests and responses. They are plain classes decorated with `class-validator` decorators to enable robust validation.
|
|
29
|
+
|
|
30
|
+
**Available DTOs:**
|
|
31
|
+
|
|
32
|
+
- `action.dto.ts`: Defines the structure for a UI action.
|
|
33
|
+
- `attachment.dto.ts`: Represents a file attachment.
|
|
34
|
+
- `base-response.dto.ts`: A base structure for API responses.
|
|
35
|
+
- `client-data.dto.ts`: Defines the data structure for a client.
|
|
36
|
+
- `company-data.dto.ts`: Holds all the relevant data for a company.
|
|
37
|
+
- `error-response.dto.ts`: Defines the structure for error responses.
|
|
38
|
+
- `field.dto.ts`: Represents a generic field for forms or dynamic data.
|
|
39
|
+
- `info.dto.ts`: Contains all necessary information for a service integration.
|
|
40
|
+
- `jwt.dto.ts`: DTOs related to JSON Web Tokens.
|
|
41
|
+
- `menu.dto.ts`: Defines the structure for menu items.
|
|
42
|
+
- `multilang-text.dto.ts`: A DTO for handling text in multiple languages.
|
|
43
|
+
- `response-data.dto.ts`: A generic wrapper for response data.
|
|
44
|
+
- `setup-status-response.dto.ts`: DTO for returning the setup status.
|
|
45
|
+
- `success-response.dto.ts`: Defines the structure for successful API responses.
|
|
46
|
+
- `tab.dto.ts`: Represents a tab in a user interface.
|
|
47
|
+
- `submenu.dto.ts`: Represents a submenu item.
|
|
48
|
+
- `task-response.dto.ts`: DTO for responses related to background tasks.
|
|
49
|
+
- `unit.dto.ts`: Represents a unit for pay-per-use billing.
|
|
50
|
+
|
|
51
|
+
**Notification DTOs:**
|
|
52
|
+
|
|
53
|
+
- `notification/notification-info.dto.ts`: Contains detailed information about a notification.
|
|
54
|
+
- `notification/notification-send-request.dto.ts`: The primary DTO for requesting a new notification.
|
|
55
|
+
- `notification/receiver/receiver-email.dto.ts`: Defines the receiver for an email notification.
|
|
56
|
+
- `notification/receiver/receiver-push.dto.ts`: Defines the receiver for a push notification.
|
|
57
|
+
- `notification/receiver/receiver-sms.dto.ts`: Defines the receiver for an SMS notification.
|
|
58
|
+
- `notification/sender/sender-email.dto.ts`: Defines the sender for an email notification.
|
|
59
|
+
- `notification/sender/sender-push.dto.ts`: Defines the sender for a push notification.
|
|
60
|
+
- `notification/sender/sender-sms.dto.ts`: Defines the sender for an SMS notification.
|
|
61
|
+
|
|
62
|
+
**Product DTOs:**
|
|
63
|
+
|
|
64
|
+
- `product/product-info.dto.ts`: Contains detailed information about a product.
|
|
65
|
+
- `product/product-item-data.dto.ts`: Represents the data of a specific product item.
|
|
66
|
+
- `product/requests/*`: DTOs for product-related requests (create, delete, upgrade, etc.).
|
|
67
|
+
- `product/responses/*`: DTOs for product-related responses.
|
|
14
68
|
|
|
15
|
-
###
|
|
69
|
+
### Enums
|
|
16
70
|
|
|
17
|
-
|
|
71
|
+
Enums provide a set of named constants for common types, preventing errors with magic strings.
|
|
18
72
|
|
|
19
|
-
|
|
20
|
-
- `label`: (string, optional) The text label for the action.
|
|
21
|
-
- `openMethod`: (string) Specifies how the action should be executed. Possible values are:
|
|
22
|
-
- `"ajax_call"`: Perform an AJAX request.
|
|
23
|
-
- `"small_iframe"`: Open in a small iframe.
|
|
24
|
-
- `"medium_iframe"`: Open in a medium-sized iframe.
|
|
25
|
-
- `"large_iframe"`: Open in a large iframe.
|
|
26
|
-
- `url`: (string) The URL or endpoint for the action.
|
|
73
|
+
**Key Enums:**
|
|
27
74
|
|
|
75
|
+
- `ActionsEnum`: Defines possible actions.
|
|
76
|
+
- `CountryEnum`: A list of all countries.
|
|
77
|
+
- `DurationEnum`: Defines billing durations (e.g., `MONTHLY`, `YEARLY`).
|
|
78
|
+
- `EventsEnum`: Defines triggerable events.
|
|
79
|
+
- `FieldTypeEnum`: Defines types of fields.
|
|
80
|
+
- `LanguageEnum`: A list of supported languages.
|
|
81
|
+
- `NotificationMessageTypeEnum`: Defines the type of notification (e.g., `EMAIL`, `SMS`).
|
|
82
|
+
- `OpenMethodEnum`: Defines how an action's URL should be opened.
|
|
83
|
+
- `ResponseStatusEnum`: Defines the status of a response (e.g., `COMPLETED`, `FAILED`).
|
|
84
|
+
- `RolesEnum`: Defines user roles.
|
|
85
|
+
- `SetupStatusEnum`: Defines the status of a setup process.
|
|
28
86
|
|
|
29
|
-
|
|
87
|
+
### Interfaces
|
|
30
88
|
|
|
31
|
-
- `
|
|
32
|
-
- `class-validator`: For DTO validation using decorators
|
|
33
|
-
- `class-transformer`: For transforming plain objects to class instances
|
|
89
|
+
- `product/product.interface.ts`: Defines the contract for a product module.
|
|
34
90
|
|
|
35
|
-
|
|
91
|
+
### Validators
|
|
36
92
|
|
|
37
|
-
This
|
|
93
|
+
This package includes validation functions that leverage `class-validator` to ensure that incoming data conforms to the DTO definitions.
|
|
38
94
|
|
|
39
|
-
|
|
95
|
+
**Available Validators:**
|
|
40
96
|
|
|
41
|
-
|
|
97
|
+
- `validateActionDto`: Validates UI actions.
|
|
98
|
+
- `validateCompanyDataDto`: Validates company data.
|
|
99
|
+
- `validateFieldDto`: Validates dynamic fields.
|
|
100
|
+
- `validateJwtDto`: Validates JWT data.
|
|
101
|
+
- `validateMultilangTextDto`: Validates multilingual text objects.
|
|
102
|
+
- `validateNotificationRequestDto`: Validates the main notification request.
|
|
103
|
+
- `validateEmailReceiverDto`, `validateSmsReceiverDto`, `validatePushReceiverDto`: Validators for notification receivers.
|
|
104
|
+
- `validateEmailSenderDto`, `validateSmsSenderDto`, `validatePushSenderDto`: Validators for notification senders.
|
|
105
|
+
|
|
106
|
+
## Usage Example
|
|
107
|
+
|
|
108
|
+
Here is an example of how to use a DTO and its validator.
|
|
109
|
+
|
|
110
|
+
First, import the necessary DTO, Enum, and validator function:
|
|
42
111
|
|
|
43
112
|
```typescript
|
|
44
|
-
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
113
|
+
import {
|
|
114
|
+
ProductCreateRequestDto,
|
|
115
|
+
ClientDataDto,
|
|
116
|
+
ProductItemDataDto,
|
|
117
|
+
DurationEnum,
|
|
118
|
+
validateProductCreateRequestDto, // Assuming a validator exists
|
|
119
|
+
} from '@hosterai/types';
|
|
120
|
+
|
|
121
|
+
// 1. Create a request object
|
|
122
|
+
const request: ProductCreateRequestDto = {
|
|
123
|
+
clientData: {
|
|
124
|
+
// ... client data
|
|
125
|
+
},
|
|
126
|
+
itemData: {
|
|
127
|
+
itemId: 'item-123',
|
|
128
|
+
productAttributes: {
|
|
129
|
+
// ... product attributes
|
|
130
|
+
},
|
|
131
|
+
itemAttributes: {
|
|
132
|
+
// ... item attributes
|
|
133
|
+
},
|
|
134
|
+
duration: DurationEnum.MONTHLY,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// 2. Validate the object
|
|
139
|
+
// const errors = validateProductCreateRequestDto(request);
|
|
140
|
+
|
|
141
|
+
// 3. Check for errors
|
|
142
|
+
// if (errors.length > 0) {
|
|
143
|
+
// console.error('Validation failed:', errors);
|
|
144
|
+
// } else {
|
|
145
|
+
// console.log('Validation successful!');
|
|
146
|
+
// }
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Building from Source
|
|
150
|
+
|
|
151
|
+
To build the package from the source code, clone the repository and run the following commands:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npm install
|
|
155
|
+
npm run build
|
|
59
156
|
```
|
|
60
157
|
|
|
61
|
-
|
|
62
|
-
- `notificationId` is present and is a string
|
|
63
|
-
- `sender` is present and is an object
|
|
64
|
-
- `receiver` is present and is an object
|
|
158
|
+
This will compile the TypeScript source files into JavaScript in the `dist` directory.
|
|
65
159
|
|
|
66
|
-
|
|
160
|
+
## Running Tests
|
|
67
161
|
|
|
68
|
-
To run the
|
|
162
|
+
To run the test suite, use the following command:
|
|
69
163
|
|
|
70
164
|
```bash
|
|
71
165
|
npm test
|
|
72
166
|
```
|
|
167
|
+
|
|
168
|
+
## Publishing to npm
|
|
169
|
+
|
|
170
|
+
This package is automatically published to npm upon the creation of a new release in GitHub.
|
|
171
|
+
|
|
172
|
+
The process is as follows:
|
|
173
|
+
|
|
174
|
+
1. Ensure the `version` in `package.json` is updated.
|
|
175
|
+
2. Commit and push all changes to the `main` branch.
|
|
176
|
+
3. Create a new release on GitHub. The tag for the release must match the version in `package.json` (e.g., `v1.2.3`).
|
|
177
|
+
|
|
178
|
+
This will trigger the `publish` workflow, which builds, tests, and publishes the package to the npm registry.
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
package/dist/dtos/action.dto.js
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
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 });
|
|
3
12
|
exports.ActionDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const open_method_enum_1 = require("../enums/open-method.enum");
|
|
4
15
|
class ActionDto {
|
|
5
16
|
}
|
|
6
17
|
exports.ActionDto = ActionDto;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], ActionDto.prototype, "icon", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsString)(),
|
|
24
|
+
(0, class_validator_1.IsOptional)(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], ActionDto.prototype, "label", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, class_validator_1.IsEnum)(open_method_enum_1.OpenMethodEnum),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], ActionDto.prototype, "openMethod", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsUrl)(),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], ActionDto.prototype, "url", void 0);
|
|
@@ -27,7 +27,7 @@ __decorate([
|
|
|
27
27
|
(0, class_validator_1.IsNotEmpty)(),
|
|
28
28
|
(0, class_validator_1.IsString)(),
|
|
29
29
|
(0, class_validator_1.IsBase64)(),
|
|
30
|
-
__metadata("design:type",
|
|
30
|
+
__metadata("design:type", Buffer)
|
|
31
31
|
], AttachmentDto.prototype, "content", void 0);
|
|
32
32
|
__decorate([
|
|
33
33
|
(0, class_validator_1.IsOptional)(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CountryEnum } from
|
|
2
|
-
import { LanguageEnum } from
|
|
1
|
+
import { CountryEnum } from '../enums/country.enum';
|
|
2
|
+
import { LanguageEnum } from '../enums/language.enum';
|
|
3
3
|
export declare class CompanyDataDto {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
@@ -1,6 +1,100 @@
|
|
|
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 });
|
|
3
12
|
exports.CompanyDataDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const country_enum_1 = require("../enums/country.enum");
|
|
15
|
+
const language_enum_1 = require("../enums/language.enum");
|
|
4
16
|
class CompanyDataDto {
|
|
5
17
|
}
|
|
6
18
|
exports.CompanyDataDto = CompanyDataDto;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, class_validator_1.IsString)(),
|
|
21
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], CompanyDataDto.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], CompanyDataDto.prototype, "name", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_validator_1.IsEmail)({}, { each: true }),
|
|
31
|
+
(0, class_validator_1.IsArray)(),
|
|
32
|
+
__metadata("design:type", Array)
|
|
33
|
+
], CompanyDataDto.prototype, "emails", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, class_validator_1.IsEmail)(),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], CompanyDataDto.prototype, "invoiceEmail", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, class_validator_1.IsUrl)(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], CompanyDataDto.prototype, "privacyPolicyUrl", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsEnum)(language_enum_1.LanguageEnum),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], CompanyDataDto.prototype, "defaultLanguage", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_validator_1.IsEnum)(language_enum_1.LanguageEnum, { each: true }),
|
|
48
|
+
(0, class_validator_1.IsArray)(),
|
|
49
|
+
__metadata("design:type", Array)
|
|
50
|
+
], CompanyDataDto.prototype, "languages", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, class_validator_1.IsString)(),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], CompanyDataDto.prototype, "telephone", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_validator_1.IsString)(),
|
|
57
|
+
(0, class_validator_1.IsOptional)(),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], CompanyDataDto.prototype, "mobile", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, class_validator_1.IsString)(),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], CompanyDataDto.prototype, "address1", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
(0, class_validator_1.IsOptional)(),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], CompanyDataDto.prototype, "address2", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, class_validator_1.IsString)(),
|
|
71
|
+
(0, class_validator_1.IsOptional)(),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], CompanyDataDto.prototype, "address3", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, class_validator_1.IsString)(),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], CompanyDataDto.prototype, "postcode", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, class_validator_1.IsString)(),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], CompanyDataDto.prototype, "city", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, class_validator_1.IsEnum)(country_enum_1.CountryEnum),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], CompanyDataDto.prototype, "country", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, class_validator_1.IsString)(),
|
|
88
|
+
(0, class_validator_1.IsOptional)(),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], CompanyDataDto.prototype, "state", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, class_validator_1.IsString)(),
|
|
93
|
+
(0, class_validator_1.IsOptional)(),
|
|
94
|
+
__metadata("design:type", String)
|
|
95
|
+
], CompanyDataDto.prototype, "vat", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, class_validator_1.IsString)(),
|
|
98
|
+
(0, class_validator_1.IsOptional)(),
|
|
99
|
+
__metadata("design:type", String)
|
|
100
|
+
], CompanyDataDto.prototype, "taxOffice", void 0);
|
|
@@ -21,7 +21,7 @@ exports.ErrorResponseDto = ErrorResponseDto;
|
|
|
21
21
|
__decorate([
|
|
22
22
|
(0, class_validator_1.IsString)(),
|
|
23
23
|
(0, class_validator_1.IsNotEmpty)(),
|
|
24
|
-
__metadata("design:type",
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
25
|
], ErrorResponseDto.prototype, "code", void 0);
|
|
26
26
|
__decorate([
|
|
27
27
|
(0, class_validator_1.IsOptional)(),
|
package/dist/dtos/field.dto.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldTypeEnum } from
|
|
2
|
-
import { MultilangTextDto } from
|
|
1
|
+
import { FieldTypeEnum } from '../enums/field-type.enum';
|
|
2
|
+
import { MultilangTextDto } from './multilang-text.dto';
|
|
3
3
|
export declare class FieldDto {
|
|
4
4
|
/**
|
|
5
5
|
* ID of action field
|
|
@@ -12,7 +12,7 @@ export declare class FieldDto {
|
|
|
12
12
|
/**
|
|
13
13
|
* Value of action field
|
|
14
14
|
*/
|
|
15
|
-
value: string | number | Record<string,
|
|
15
|
+
value: string | number | Record<string, unknown>;
|
|
16
16
|
/**
|
|
17
17
|
* Type of label
|
|
18
18
|
*/
|
package/dist/dtos/field.dto.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
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 });
|
|
3
12
|
exports.FieldDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const field_type_enum_1 = require("../enums/field-type.enum");
|
|
16
|
+
const multilang_text_dto_1 = require("./multilang-text.dto");
|
|
4
17
|
class FieldDto {
|
|
5
18
|
constructor() {
|
|
6
19
|
/**
|
|
@@ -10,3 +23,60 @@ class FieldDto {
|
|
|
10
23
|
}
|
|
11
24
|
}
|
|
12
25
|
exports.FieldDto = FieldDto;
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], FieldDto.prototype, "id", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
32
|
+
(0, class_transformer_1.Type)(() => multilang_text_dto_1.MultilangTextDto),
|
|
33
|
+
(0, class_validator_1.IsArray)(),
|
|
34
|
+
(0, class_validator_1.ArrayMinSize)(1),
|
|
35
|
+
__metadata("design:type", Array)
|
|
36
|
+
], FieldDto.prototype, "label", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsDefined)(),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], FieldDto.prototype, "value", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, class_validator_1.IsEnum)(field_type_enum_1.FieldTypeEnum),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], FieldDto.prototype, "type", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsBoolean)(),
|
|
47
|
+
__metadata("design:type", Boolean)
|
|
48
|
+
], FieldDto.prototype, "required", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.IsBoolean)(),
|
|
51
|
+
__metadata("design:type", Boolean)
|
|
52
|
+
], FieldDto.prototype, "disabled", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, class_validator_1.IsBoolean)(),
|
|
55
|
+
__metadata("design:type", Boolean)
|
|
56
|
+
], FieldDto.prototype, "hidden", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, class_validator_1.IsString)(),
|
|
59
|
+
(0, class_validator_1.IsOptional)(),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], FieldDto.prototype, "regexValidation", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
64
|
+
(0, class_transformer_1.Type)(() => multilang_text_dto_1.MultilangTextDto),
|
|
65
|
+
(0, class_validator_1.IsOptional)(),
|
|
66
|
+
__metadata("design:type", Array)
|
|
67
|
+
], FieldDto.prototype, "regexValidationErrorMessage", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_validator_1.IsBoolean)(),
|
|
70
|
+
(0, class_validator_1.IsOptional)(),
|
|
71
|
+
__metadata("design:type", Boolean)
|
|
72
|
+
], FieldDto.prototype, "remoteValidation", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
75
|
+
(0, class_transformer_1.Type)(() => multilang_text_dto_1.MultilangTextDto),
|
|
76
|
+
(0, class_validator_1.IsOptional)(),
|
|
77
|
+
__metadata("design:type", Array)
|
|
78
|
+
], FieldDto.prototype, "remoteValidationErrorMessage", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, class_validator_1.IsBoolean)(),
|
|
81
|
+
__metadata("design:type", Boolean)
|
|
82
|
+
], FieldDto.prototype, "upgradeable", void 0);
|
package/dist/dtos/info.dto.d.ts
CHANGED
|
@@ -85,12 +85,11 @@ export declare class InfoDto {
|
|
|
85
85
|
settings?: {
|
|
86
86
|
label: string;
|
|
87
87
|
icon: string;
|
|
88
|
-
|
|
88
|
+
description: string;
|
|
89
89
|
} & ({
|
|
90
90
|
url: string;
|
|
91
91
|
tabs?: never;
|
|
92
|
-
} |
|
|
93
|
-
{
|
|
92
|
+
} | {
|
|
94
93
|
url?: never;
|
|
95
94
|
tabs: [TabDto, ...TabDto[]];
|
|
96
95
|
});
|
package/dist/dtos/jwt.dto.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import { RolesEnum } from
|
|
1
|
+
import { RolesEnum } from '../enums/roles.enum';
|
|
2
|
+
declare class JwtPayloadDto {
|
|
3
|
+
/**
|
|
4
|
+
* Integration identifier
|
|
5
|
+
*/
|
|
6
|
+
integrationId: string;
|
|
7
|
+
/**
|
|
8
|
+
* Unique user identifier that triggers the API call (only the /send method will not contain userId).
|
|
9
|
+
*/
|
|
10
|
+
userId?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Unique company identifier
|
|
13
|
+
*/
|
|
14
|
+
companyId: string;
|
|
15
|
+
/**
|
|
16
|
+
* The roles accepted by the company for this integration
|
|
17
|
+
*/
|
|
18
|
+
acceptedRoles: RolesEnum[];
|
|
19
|
+
}
|
|
2
20
|
/**
|
|
3
21
|
* DTO for JWT payload
|
|
4
22
|
* Used for user authentication and authorization
|
|
@@ -9,22 +27,6 @@ export declare class JwtDto {
|
|
|
9
27
|
* Includes user and company identifiers, admin rights
|
|
10
28
|
* and optional sender details
|
|
11
29
|
*/
|
|
12
|
-
jwt:
|
|
13
|
-
/**
|
|
14
|
-
* Integration identifier
|
|
15
|
-
*/
|
|
16
|
-
integrationId: string;
|
|
17
|
-
/**
|
|
18
|
-
* Unique user identifier that triggers the API call (only the /send method will not contain userId).
|
|
19
|
-
*/
|
|
20
|
-
userId?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Unique company identifier
|
|
23
|
-
*/
|
|
24
|
-
companyId: string;
|
|
25
|
-
/**
|
|
26
|
-
* The roles accepted by the company for this integration
|
|
27
|
-
*/
|
|
28
|
-
acceptedRoles: RolesEnum[];
|
|
29
|
-
};
|
|
30
|
+
jwt: JwtPayloadDto;
|
|
30
31
|
}
|
|
32
|
+
export {};
|
package/dist/dtos/jwt.dto.js
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
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 });
|
|
3
12
|
exports.JwtDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const roles_enum_1 = require("../enums/roles.enum");
|
|
16
|
+
class JwtPayloadDto {
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], JwtPayloadDto.prototype, "integrationId", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
(0, class_validator_1.IsOptional)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], JwtPayloadDto.prototype, "userId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], JwtPayloadDto.prototype, "companyId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_validator_1.IsArray)(),
|
|
35
|
+
(0, class_validator_1.IsEnum)(roles_enum_1.RolesEnum, { each: true }),
|
|
36
|
+
__metadata("design:type", Array)
|
|
37
|
+
], JwtPayloadDto.prototype, "acceptedRoles", void 0);
|
|
4
38
|
/**
|
|
5
39
|
* DTO for JWT payload
|
|
6
40
|
* Used for user authentication and authorization
|
|
@@ -8,3 +42,9 @@ exports.JwtDto = void 0;
|
|
|
8
42
|
class JwtDto {
|
|
9
43
|
}
|
|
10
44
|
exports.JwtDto = JwtDto;
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.ValidateNested)(),
|
|
47
|
+
(0, class_transformer_1.Type)(() => JwtPayloadDto),
|
|
48
|
+
(0, class_validator_1.IsDefined)(),
|
|
49
|
+
__metadata("design:type", JwtPayloadDto)
|
|
50
|
+
], JwtDto.prototype, "jwt", void 0);
|
package/dist/dtos/menu.dto.d.ts
CHANGED