@hosterai/types 0.0.1
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 +115 -0
- package/dist/dtos/action.dto.d.ts +16 -0
- package/dist/dtos/action.dto.js +6 -0
- package/dist/dtos/attachment.dto.d.ts +18 -0
- package/dist/dtos/attachment.dto.js +36 -0
- package/dist/dtos/base-response.dto.d.ts +14 -0
- package/dist/dtos/base-response.dto.js +30 -0
- package/dist/dtos/company-data.dto.d.ts +22 -0
- package/dist/dtos/company-data.dto.js +6 -0
- package/dist/dtos/error-response.dto.d.ts +16 -0
- package/dist/dtos/error-response.dto.js +31 -0
- package/dist/dtos/field.dto.d.ts +48 -0
- package/dist/dtos/field.dto.js +6 -0
- package/dist/dtos/info/info-notification.dto.d.ts +5 -0
- package/dist/dtos/info/info-notification.dto.js +7 -0
- package/dist/dtos/info/info.dto.d.ts +96 -0
- package/dist/dtos/info/info.dto.js +96 -0
- package/dist/dtos/jwt.dto.d.ts +30 -0
- package/dist/dtos/jwt.dto.js +10 -0
- package/dist/dtos/multilang-text.dto.d.ts +5 -0
- package/dist/dtos/multilang-text.dto.js +27 -0
- package/dist/dtos/receiver/receiver-email.dto.d.ts +20 -0
- package/dist/dtos/receiver/receiver-email.dto.js +39 -0
- package/dist/dtos/receiver/receiver-push.dto.d.ts +15 -0
- package/dist/dtos/receiver/receiver-push.dto.js +31 -0
- package/dist/dtos/receiver/receiver-sms.dto.d.ts +11 -0
- package/dist/dtos/receiver/receiver-sms.dto.js +26 -0
- package/dist/dtos/request.dto.d.ts +20 -0
- package/dist/dtos/request.dto.js +31 -0
- package/dist/dtos/response-data.dto.d.ts +3 -0
- package/dist/dtos/response-data.dto.js +6 -0
- package/dist/dtos/sender/sender-email.dto.d.ts +25 -0
- package/dist/dtos/sender/sender-email.dto.js +46 -0
- package/dist/dtos/sender/sender-push.dto.d.ts +31 -0
- package/dist/dtos/sender/sender-push.dto.js +50 -0
- package/dist/dtos/sender/sender-sms.dto.d.ts +15 -0
- package/dist/dtos/sender/sender-sms.dto.js +30 -0
- package/dist/dtos/setup-status-response.dto.d.ts +5 -0
- package/dist/dtos/setup-status-response.dto.js +7 -0
- package/dist/dtos/success-response.dto.d.ts +6 -0
- package/dist/dtos/success-response.dto.js +20 -0
- package/dist/dtos/task-response.dto.d.ts +6 -0
- package/dist/dtos/task-response.dto.js +20 -0
- package/dist/dtos/unit.dto.d.ts +5 -0
- package/dist/dtos/unit.dto.js +6 -0
- package/dist/enums/actions.enum.d.ts +9 -0
- package/dist/enums/actions.enum.js +14 -0
- package/dist/enums/country.enum.d.ts +531 -0
- package/dist/enums/country.enum.js +535 -0
- package/dist/enums/events.enum.d.ts +169 -0
- package/dist/enums/events.enum.js +173 -0
- package/dist/enums/field-type.enum.d.ts +10 -0
- package/dist/enums/field-type.enum.js +15 -0
- package/dist/enums/language.enum.d.ts +186 -0
- package/dist/enums/language.enum.js +374 -0
- package/dist/enums/message-type.enum.d.ts +5 -0
- package/dist/enums/message-type.enum.js +9 -0
- package/dist/enums/open-method.enum.d.ts +6 -0
- package/dist/enums/open-method.enum.js +10 -0
- package/dist/enums/roles.enum.d.ts +54 -0
- package/dist/enums/roles.enum.js +58 -0
- package/dist/enums/setup-status.enum.d.ts +5 -0
- package/dist/enums/setup-status.enum.js +9 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +50 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Multi-Language DTO & Enum Generator
|
|
2
|
+
|
|
3
|
+
This project provides tools to automatically generate Data Transfer Objects (DTOs) and Enums in multiple programming languages from TypeScript definitions. This ensures consistency across different services that might be implemented in different programming languages.
|
|
4
|
+
|
|
5
|
+
## Supported Languages
|
|
6
|
+
|
|
7
|
+
| Language | Status | Generator Script |
|
|
8
|
+
|------------|-------------|------------------------|
|
|
9
|
+
| Go | ✅ Complete | `generate-golang.ts` |
|
|
10
|
+
| Python | ✅ Complete | `generate-python.ts` |
|
|
11
|
+
| C# | ✅ Complete | `generate-csharp.ts` |
|
|
12
|
+
| Java | ✅ Complete | `generate-java.ts` |
|
|
13
|
+
| PHP | ✅ Complete | `generate-php.ts` |
|
|
14
|
+
| Ruby | ✅ Complete | `generate-ruby.ts` |
|
|
15
|
+
| Rust | ✅ Complete | `generate-rust.ts` |
|
|
16
|
+
| Swift | ✅ Complete | `generate-swift.ts` |
|
|
17
|
+
| Kotlin | ✅ Complete | `generate-kotlin.ts` |
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
**Important:** Before generating code for any language, you must first generate the JSON schemas by running:
|
|
22
|
+
```bash
|
|
23
|
+
npm run generate:schemas
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Generate Code for All Supported Languages
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run generate -- all
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Generate Code for a Specific Language
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run generate -- <language>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
For example:
|
|
39
|
+
```bash
|
|
40
|
+
npm run generate -- golang
|
|
41
|
+
npm run generate -- python
|
|
42
|
+
npm run generate -- csharp
|
|
43
|
+
npm run generate -- java
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Project Structure
|
|
47
|
+
|
|
48
|
+
- `/dtos/` - TypeScript DTO definitions
|
|
49
|
+
- `/enums/` - TypeScript Enum definitions
|
|
50
|
+
- `/generated/` - Output directory for generated code
|
|
51
|
+
- `/golang/` - Generated Go code
|
|
52
|
+
- `/python/` - Generated Python code
|
|
53
|
+
- `/csharp/` - Generated C# code
|
|
54
|
+
- `/java/` - Generated Java code
|
|
55
|
+
- ... (other languages as implemented)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Core DTOs
|
|
59
|
+
|
|
60
|
+
This section describes some of the core Data Transfer Objects available in this project.
|
|
61
|
+
|
|
62
|
+
### `ActionDto`
|
|
63
|
+
|
|
64
|
+
The `ActionDto` defines the structure for an action that can be performed, typically represented as a button or link in a UI.
|
|
65
|
+
|
|
66
|
+
- `icon`: (string) The CSS class or identifier for the icon to be displayed.
|
|
67
|
+
- `label`: (string, optional) The text label for the action.
|
|
68
|
+
- `openMethod`: (string) Specifies how the action should be executed. Possible values are:
|
|
69
|
+
- `"ajax_call"`: Perform an AJAX request.
|
|
70
|
+
- `"small_iframe"`: Open in a small iframe.
|
|
71
|
+
- `"medium_iframe"`: Open in a medium-sized iframe.
|
|
72
|
+
- `"large_iframe"`: Open in a large iframe.
|
|
73
|
+
- `url`: (string) The URL or endpoint for the action.
|
|
74
|
+
|
|
75
|
+
## Implementation Details
|
|
76
|
+
|
|
77
|
+
### Go Implementation
|
|
78
|
+
|
|
79
|
+
- Uses JSON Schema as an intermediate format
|
|
80
|
+
- Converts TypeScript definitions to Go structs with proper JSON tags
|
|
81
|
+
- Handles optional fields and type conversions
|
|
82
|
+
|
|
83
|
+
### Python Implementation
|
|
84
|
+
|
|
85
|
+
- Generates Python dataclasses with type hints
|
|
86
|
+
- Handles optional fields with Union types
|
|
87
|
+
- Properly converts TypeScript types to Python equivalents
|
|
88
|
+
|
|
89
|
+
### C# Implementation
|
|
90
|
+
|
|
91
|
+
- Generates C# classes with properties
|
|
92
|
+
- Includes proper JSON attributes for serialization/deserialization
|
|
93
|
+
- Handles nullable types appropriately
|
|
94
|
+
|
|
95
|
+
### Java Implementation
|
|
96
|
+
|
|
97
|
+
- Generates Java classes with Lombok annotations to reduce boilerplate
|
|
98
|
+
- Includes Jackson annotations for JSON serialization/deserialization
|
|
99
|
+
- Handles type conversions and optionals
|
|
100
|
+
|
|
101
|
+
## Adding a New Language Generator
|
|
102
|
+
|
|
103
|
+
To implement a generator for a new language:
|
|
104
|
+
|
|
105
|
+
1. Create a new script (e.g., `generate-newlang.ts`) in the project root
|
|
106
|
+
2. Implement the translation from TypeScript to the target language
|
|
107
|
+
3. Ensure the generator follows the pattern of existing implementations
|
|
108
|
+
4. Update the language entry in the `LANGUAGES` object in `generate.ts`
|
|
109
|
+
|
|
110
|
+
## Dependencies
|
|
111
|
+
|
|
112
|
+
- `typescript-json-schema`: For generating JSON Schema from TypeScript definitions
|
|
113
|
+
- `quicktype`: For generating code from JSON Schema
|
|
114
|
+
- `fs-extra`: For file system operations
|
|
115
|
+
- `glob`: For file pattern matching
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OpenMethodEnum } from "../enums/open-method.enum";
|
|
2
|
+
export declare class ActionDto {
|
|
3
|
+
/**
|
|
4
|
+
* The icon of the action.
|
|
5
|
+
*/
|
|
6
|
+
icon: string;
|
|
7
|
+
/**
|
|
8
|
+
* The label of the action (optional).
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
openMethod: OpenMethodEnum;
|
|
12
|
+
/**
|
|
13
|
+
* The link of the action.
|
|
14
|
+
*/
|
|
15
|
+
url: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DTO for file attachments
|
|
3
|
+
* Used for sending attached files with emails
|
|
4
|
+
*/
|
|
5
|
+
export declare class AttachmentDto {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the attached file
|
|
8
|
+
*/
|
|
9
|
+
filename: string;
|
|
10
|
+
/**
|
|
11
|
+
* The content of the file in Base64 encoding
|
|
12
|
+
*/
|
|
13
|
+
content: string;
|
|
14
|
+
/**
|
|
15
|
+
* The content type of the file (MIME type)
|
|
16
|
+
*/
|
|
17
|
+
contentType?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
exports.AttachmentDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
/**
|
|
15
|
+
* DTO for file attachments
|
|
16
|
+
* Used for sending attached files with emails
|
|
17
|
+
*/
|
|
18
|
+
class AttachmentDto {
|
|
19
|
+
}
|
|
20
|
+
exports.AttachmentDto = AttachmentDto;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
23
|
+
(0, class_validator_1.IsString)(),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], AttachmentDto.prototype, "filename", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
(0, class_validator_1.IsBase64)(),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], AttachmentDto.prototype, "content", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, class_validator_1.IsOptional)(),
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AttachmentDto.prototype, "contentType", void 0);
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
exports.BaseResponse = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
/**
|
|
15
|
+
* Base response class
|
|
16
|
+
* Used as a foundation for all API responses
|
|
17
|
+
*/
|
|
18
|
+
class BaseResponse {
|
|
19
|
+
}
|
|
20
|
+
exports.BaseResponse = BaseResponse;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsNumber)(),
|
|
23
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], BaseResponse.prototype, "code", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], BaseResponse.prototype, "message", void 0);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CountryEnum } from "../enums/country.enum";
|
|
2
|
+
import { LanguageEnum } from "../enums/language.enum";
|
|
3
|
+
export declare class CompanyDataDto {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
emails: string[];
|
|
7
|
+
invoiceEmail: string;
|
|
8
|
+
privacyPolicyUrl: string;
|
|
9
|
+
defaultLanguage: LanguageEnum;
|
|
10
|
+
languages: LanguageEnum[];
|
|
11
|
+
telephone: string;
|
|
12
|
+
mobile?: string;
|
|
13
|
+
address1: string;
|
|
14
|
+
address2?: string;
|
|
15
|
+
address3?: string;
|
|
16
|
+
postcode: string;
|
|
17
|
+
city: string;
|
|
18
|
+
country: CountryEnum;
|
|
19
|
+
state?: string;
|
|
20
|
+
vat?: string;
|
|
21
|
+
taxOffice?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DTO for error response
|
|
3
|
+
* Used to return error information to the client
|
|
4
|
+
*/
|
|
5
|
+
export declare class ErrorResponseDto {
|
|
6
|
+
/**
|
|
7
|
+
* Unique error identifier
|
|
8
|
+
* Used for error reporting and tracking
|
|
9
|
+
*/
|
|
10
|
+
code: string;
|
|
11
|
+
/**
|
|
12
|
+
* Array or text with error messages
|
|
13
|
+
* May contain one or more messages describing the error
|
|
14
|
+
*/
|
|
15
|
+
errors?: string[] | string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
exports.ErrorResponseDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
/**
|
|
15
|
+
* DTO for error response
|
|
16
|
+
* Used to return error information to the client
|
|
17
|
+
*/
|
|
18
|
+
class ErrorResponseDto {
|
|
19
|
+
}
|
|
20
|
+
exports.ErrorResponseDto = ErrorResponseDto;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsString)(),
|
|
23
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], ErrorResponseDto.prototype, "code", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
(0, class_validator_1.IsArray)(),
|
|
29
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
30
|
+
__metadata("design:type", Object)
|
|
31
|
+
], ErrorResponseDto.prototype, "errors", void 0);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FieldTypeEnum } from "../enums/field-type.enum";
|
|
2
|
+
import { MultilangTextDto } from "./multilang-text.dto";
|
|
3
|
+
export declare class FieldDto {
|
|
4
|
+
/**
|
|
5
|
+
* ID of action field
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Label of action field
|
|
10
|
+
*/
|
|
11
|
+
label: MultilangTextDto[];
|
|
12
|
+
/**
|
|
13
|
+
* Value of action field
|
|
14
|
+
*/
|
|
15
|
+
value: string | number | Record<string, any>;
|
|
16
|
+
/**
|
|
17
|
+
* Type of label
|
|
18
|
+
*/
|
|
19
|
+
type: FieldTypeEnum;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates if the field is required
|
|
22
|
+
*/
|
|
23
|
+
required: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Indicates if the field is disabled
|
|
26
|
+
*/
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Indicates if the field is hidden
|
|
30
|
+
*/
|
|
31
|
+
hidden: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Regex validation pattern for the field
|
|
34
|
+
*/
|
|
35
|
+
regexValidation?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Error message for the field for supported languages
|
|
38
|
+
*/
|
|
39
|
+
regexValidationErrorMessage?: MultilangTextDto[];
|
|
40
|
+
/**
|
|
41
|
+
* Indicates if the field has remote validation
|
|
42
|
+
*/
|
|
43
|
+
remoteValidation?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Error message for the field
|
|
46
|
+
*/
|
|
47
|
+
remoteValidationErrorMessage?: MultilangTextDto[];
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InfoNotificationDto = void 0;
|
|
4
|
+
const info_dto_1 = require("./info.dto");
|
|
5
|
+
class InfoNotificationDto extends info_dto_1.InfoDto {
|
|
6
|
+
}
|
|
7
|
+
exports.InfoNotificationDto = InfoNotificationDto;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ActionsEnum } from '../../enums/actions.enum';
|
|
2
|
+
import { EventsEnum } from '../../enums/events.enum';
|
|
3
|
+
import { FieldDto } from '../field.dto';
|
|
4
|
+
import { ResponseDataDto } from '../response-data.dto';
|
|
5
|
+
import { UnitDto } from '../unit.dto';
|
|
6
|
+
import { LanguageEnum } from '../../enums/language.enum';
|
|
7
|
+
import { RolesEnum } from '../../enums/roles.enum';
|
|
8
|
+
import { ActionDto } from '../action.dto';
|
|
9
|
+
/**
|
|
10
|
+
* DTO for tabs
|
|
11
|
+
* Used for defining tabs in the user interface
|
|
12
|
+
*/
|
|
13
|
+
declare class TabDto {
|
|
14
|
+
/**
|
|
15
|
+
* The label displayed on the tab
|
|
16
|
+
*/
|
|
17
|
+
label: string;
|
|
18
|
+
/**
|
|
19
|
+
* The URL associated with the tab.
|
|
20
|
+
* The requests coming from the hoster will be signed
|
|
21
|
+
* with jwt, which will contain information about the company
|
|
22
|
+
*/
|
|
23
|
+
url: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* DTO for menu items
|
|
27
|
+
* Extends TabDto and adds icon information
|
|
28
|
+
*/
|
|
29
|
+
declare class MenuDto {
|
|
30
|
+
/**
|
|
31
|
+
* The icon to be displayed for the menu item
|
|
32
|
+
*/
|
|
33
|
+
icon: string;
|
|
34
|
+
/**
|
|
35
|
+
* The name to be displayed for the menu item
|
|
36
|
+
*/
|
|
37
|
+
label: string;
|
|
38
|
+
/**
|
|
39
|
+
* The list of tabs that will appear in the submenu and as a navigation bar above the main content
|
|
40
|
+
* In case of only one tab, there will be neither a submenu nor a navigation bar.
|
|
41
|
+
*/
|
|
42
|
+
tabs: TabDto[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* DTO for integration information
|
|
46
|
+
* Contains all information related to a service integration
|
|
47
|
+
*/
|
|
48
|
+
export declare class InfoDto {
|
|
49
|
+
/**
|
|
50
|
+
* The title of the integration
|
|
51
|
+
*/
|
|
52
|
+
title: string;
|
|
53
|
+
/**
|
|
54
|
+
* The logo of the integration (optional)
|
|
55
|
+
*/
|
|
56
|
+
logo?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Description of the integration and its services (optional)
|
|
59
|
+
*/
|
|
60
|
+
description?: string;
|
|
61
|
+
supported_languages: LanguageEnum[];
|
|
62
|
+
product_attributes?: FieldDto[];
|
|
63
|
+
item_attributes?: FieldDto[];
|
|
64
|
+
listen_events?: EventsEnum[];
|
|
65
|
+
/**
|
|
66
|
+
* The roles that need to be accepted by the company
|
|
67
|
+
*/
|
|
68
|
+
requiredRoles?: RolesEnum[];
|
|
69
|
+
unsupportedActions: ActionsEnum[];
|
|
70
|
+
adminPanel?: {
|
|
71
|
+
productTabs?: TabDto[];
|
|
72
|
+
actions?: {
|
|
73
|
+
client?: ActionDto[];
|
|
74
|
+
item?: ActionDto[];
|
|
75
|
+
};
|
|
76
|
+
menu?: MenuDto;
|
|
77
|
+
/**
|
|
78
|
+
* Option that will appear in the "Settings" section (optional)
|
|
79
|
+
*/
|
|
80
|
+
settings?: MenuDto;
|
|
81
|
+
};
|
|
82
|
+
clientPanel?: {
|
|
83
|
+
productTabs?: TabDto[];
|
|
84
|
+
actions?: {
|
|
85
|
+
item?: ActionDto[];
|
|
86
|
+
};
|
|
87
|
+
menu?: MenuDto;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* The url for the onboarding process after installation of the integration
|
|
91
|
+
*/
|
|
92
|
+
onboardingUrl?: string;
|
|
93
|
+
payPerUseUnits?: UnitDto[];
|
|
94
|
+
responseDataFieldNames?: Record<keyof ResponseDataDto, string>;
|
|
95
|
+
}
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
exports.InfoDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const language_enum_1 = require("../../enums/language.enum");
|
|
16
|
+
const roles_enum_1 = require("../../enums/roles.enum");
|
|
17
|
+
/**
|
|
18
|
+
* DTO for tabs
|
|
19
|
+
* Used for defining tabs in the user interface
|
|
20
|
+
*/
|
|
21
|
+
class TabDto {
|
|
22
|
+
}
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], TabDto.prototype, "label", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
+
(0, class_validator_1.IsUrl)(),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], TabDto.prototype, "url", void 0);
|
|
34
|
+
/**
|
|
35
|
+
* DTO for menu items
|
|
36
|
+
* Extends TabDto and adds icon information
|
|
37
|
+
*/
|
|
38
|
+
class MenuDto {
|
|
39
|
+
}
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], MenuDto.prototype, "icon", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsString)(),
|
|
47
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], MenuDto.prototype, "label", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, class_validator_1.IsArray)(),
|
|
52
|
+
(0, class_validator_1.MinLength)(1),
|
|
53
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
54
|
+
(0, class_transformer_1.Type)(() => TabDto),
|
|
55
|
+
__metadata("design:type", Array)
|
|
56
|
+
], MenuDto.prototype, "tabs", void 0);
|
|
57
|
+
/**
|
|
58
|
+
* DTO for integration information
|
|
59
|
+
* Contains all information related to a service integration
|
|
60
|
+
*/
|
|
61
|
+
class InfoDto {
|
|
62
|
+
constructor() {
|
|
63
|
+
this.unsupportedActions = [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.InfoDto = InfoDto;
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, class_validator_1.IsString)(),
|
|
69
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], InfoDto.prototype, "title", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, class_validator_1.IsString)(),
|
|
74
|
+
(0, class_validator_1.IsOptional)(),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], InfoDto.prototype, "logo", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, class_validator_1.IsString)(),
|
|
79
|
+
(0, class_validator_1.IsOptional)(),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], InfoDto.prototype, "description", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, class_validator_1.IsArray)({ each: true }),
|
|
84
|
+
(0, class_validator_1.IsEnum)(language_enum_1.LanguageEnum),
|
|
85
|
+
__metadata("design:type", Array)
|
|
86
|
+
], InfoDto.prototype, "supported_languages", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, class_validator_1.IsArray)(),
|
|
89
|
+
(0, class_validator_1.IsEnum)(roles_enum_1.RolesEnum, { each: true }),
|
|
90
|
+
__metadata("design:type", Array)
|
|
91
|
+
], InfoDto.prototype, "requiredRoles", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, class_validator_1.IsOptional)(),
|
|
94
|
+
(0, class_validator_1.IsUrl)(),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], InfoDto.prototype, "onboardingUrl", void 0);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RolesEnum } from "../enums/roles.enum";
|
|
2
|
+
/**
|
|
3
|
+
* DTO for JWT payload
|
|
4
|
+
* Used for user authentication and authorization
|
|
5
|
+
*/
|
|
6
|
+
export declare class JwtDto {
|
|
7
|
+
/**
|
|
8
|
+
* User information contained in the JWT token
|
|
9
|
+
* Includes user and company identifiers, admin rights
|
|
10
|
+
* and optional sender details
|
|
11
|
+
*/
|
|
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
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
exports.MultilangTextDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const language_enum_1 = require("../enums/language.enum");
|
|
15
|
+
class MultilangTextDto {
|
|
16
|
+
}
|
|
17
|
+
exports.MultilangTextDto = MultilangTextDto;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsEnum)(language_enum_1.LanguageEnum),
|
|
20
|
+
(0, class_validator_1.IsDefined)(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], MultilangTextDto.prototype, "language", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
(0, class_validator_1.IsDefined)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], MultilangTextDto.prototype, "text", void 0);
|