@hosterai/types 0.0.1 → 0.0.3

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.
@@ -45,4 +45,8 @@ export declare class FieldDto {
45
45
  * Error message for the field
46
46
  */
47
47
  remoteValidationErrorMessage?: MultilangTextDto[];
48
+ /**
49
+ * The item attribute is upgradeable
50
+ */
51
+ upgradeable: boolean;
48
52
  }
@@ -2,5 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FieldDto = void 0;
4
4
  class FieldDto {
5
+ constructor() {
6
+ /**
7
+ * The item attribute is upgradeable
8
+ */
9
+ this.upgradeable = false;
10
+ }
5
11
  }
6
12
  exports.FieldDto = FieldDto;
@@ -6,41 +6,8 @@ import { UnitDto } from '../unit.dto';
6
6
  import { LanguageEnum } from '../../enums/language.enum';
7
7
  import { RolesEnum } from '../../enums/roles.enum';
8
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
- }
9
+ import { TabDto } from '../tab.dto';
10
+ import { MenuDto } from '../menu.dto';
44
11
  /**
45
12
  * DTO for integration information
46
13
  * Contains all information related to a service integration
@@ -58,39 +25,117 @@ export declare class InfoDto {
58
25
  * Description of the integration and its services (optional)
59
26
  */
60
27
  description?: string;
28
+ /**
29
+ * List of supported languages for the integration.
30
+ */
61
31
  supported_languages: LanguageEnum[];
32
+ /**
33
+ * Custom attributes for products.
34
+ */
62
35
  product_attributes?: FieldDto[];
36
+ /**
37
+ * Custom attributes for items.
38
+ */
63
39
  item_attributes?: FieldDto[];
40
+ /**
41
+ * Events that the integration listens to.
42
+ */
64
43
  listen_events?: EventsEnum[];
65
44
  /**
66
- * The roles that need to be accepted by the company
67
- */
45
+ * The roles that need to be accepted by the company
46
+ */
68
47
  requiredRoles?: RolesEnum[];
69
- unsupportedActions: ActionsEnum[];
48
+ /**
49
+ * Actions that are not supported by the integration.
50
+ */
51
+ unsupportedActions?: ActionsEnum[];
52
+ /**
53
+ * Configuration for the admin panel.
54
+ * Contains all UI and action configuration for the admin interface.
55
+ */
70
56
  adminPanel?: {
71
- productTabs?: TabDto[];
72
- actions?: {
57
+ /** Tab groups for different admin panel sections in the admin panel. */
58
+ tabs?: {
59
+ /** Tabs related to products. */
60
+ product: TabDto[];
61
+ /** Tabs related to items. */
62
+ item: TabDto[];
63
+ /** Tabs related to clients. */
64
+ client: TabDto[];
65
+ /** Tabs related to users. */
66
+ user: TabDto[];
67
+ /** Tabs related to orders. */
68
+ order: TabDto[];
69
+ };
70
+ /** Additional actions available in the admin panel. */
71
+ moreActions?: {
72
+ /** Actions related to clients. */
73
73
  client?: ActionDto[];
74
+ /** Actions related to items. */
74
75
  item?: ActionDto[];
76
+ /** Actions related to invoices. */
77
+ invoice?: ActionDto[];
78
+ /** Actions related to users. */
79
+ user?: ActionDto[];
80
+ /** Actions related to orders. */
81
+ order?: ActionDto[];
75
82
  };
83
+ /** Main menu for the admin panel. Extends TabDto and adds icon information */
76
84
  menu?: MenuDto;
77
- /**
78
- * Option that will appear in the "Settings" section (optional)
79
- */
80
- settings?: MenuDto;
85
+ /** Settings menu for the admin panel. Extends TabDto and adds icon information */
86
+ settings: {
87
+ label: string;
88
+ icon: string;
89
+ descrition: string;
90
+ } & ({
91
+ url: string;
92
+ tabs?: never;
93
+ } | // If url is provided, tabs should not be present
94
+ {
95
+ url?: never;
96
+ tabs: [TabDto, ...TabDto[]];
97
+ });
81
98
  };
99
+ /**
100
+ * Configuration for the client panel.
101
+ * Contains all UI and action configuration for the client interface.
102
+ */
82
103
  clientPanel?: {
83
- productTabs?: TabDto[];
84
- actions?: {
104
+ /** Tab groups for the client panel. */
105
+ tabs?: {
106
+ /** Tabs related to items. */
107
+ item: TabDto[];
108
+ };
109
+ /** Additional actions available in the client panel. */
110
+ moreActions?: {
111
+ /** Actions related to items. */
85
112
  item?: ActionDto[];
86
113
  };
114
+ /** Main menu for the client panel.
115
+ * Each menu must have at least one TabDto.
116
+ * If there are no submenus, the label of the TabDto will be displayed in the panel.
117
+ * If there are submenus, the label of the MenuDto and the TabDtos of the MenuDto will be displayed in the panel.
118
+ * The TabDtos of the MenuDto will be the submenus of the MenuDto.
119
+ */
87
120
  menu?: MenuDto;
88
121
  };
89
122
  /**
90
123
  * The url for the onboarding process after installation of the integration
124
+ * Will be displayed either as a popup or as a side sheet containing an iframe
125
+ * with this url and the jwt in the url
91
126
  */
92
127
  onboardingUrl?: string;
128
+ /**
129
+ * Units for pay-per-use billing.
130
+ * e.g. id: ram, unitDescription: MB, intervalDescription: month
131
+ * With the above in the admin the administrator will be able to set a price for
132
+ * MB per month (the id is the unit's unique identifier)
133
+ */
93
134
  payPerUseUnits?: UnitDto[];
135
+ /**
136
+ * Here we need to specify the fields (keys) that a successful create will return
137
+ * In other words, we want to know the information that a successful create will
138
+ * return, before the create is executed
139
+ */
94
140
  responseDataFieldNames?: Record<keyof ResponseDataDto, string>;
95
141
  }
96
- export {};
@@ -1,96 +1,16 @@
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
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  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
4
  /**
58
5
  * DTO for integration information
59
6
  * Contains all information related to a service integration
60
7
  */
61
8
  class InfoDto {
62
9
  constructor() {
10
+ /**
11
+ * Actions that are not supported by the integration.
12
+ */
63
13
  this.unsupportedActions = [];
64
14
  }
65
15
  }
66
16
  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,44 @@
1
+ import { SubmenuDto } from "./tab.dto";
2
+ /**
3
+ * Base properties shared by all menu items
4
+ */
5
+ interface BaseMenuDto {
6
+ /**
7
+ * The icon to be displayed for the menu item
8
+ */
9
+ icon: string;
10
+ /**
11
+ * The name to be displayed for the menu item
12
+ */
13
+ label: string;
14
+ }
15
+ /**
16
+ * Menu item with URL (no submenu)
17
+ */
18
+ export interface MenuDtoWithUrl extends BaseMenuDto {
19
+ type: 'url';
20
+ /**
21
+ * The URL associated with the tab.
22
+ * The requests coming from the hoster will be signed
23
+ * with jwt, which will contain information about the company
24
+ */
25
+ url: string;
26
+ submenu?: never;
27
+ }
28
+ /**
29
+ * Menu item with submenu (no URL)
30
+ */
31
+ export interface MenuDtoWithSubmenu extends BaseMenuDto {
32
+ type: 'submenu';
33
+ url?: never;
34
+ /**
35
+ * The list of tabs that will appear in the submenu and as a navigation bar above the main content
36
+ * In case of only one tab, there will be neither a submenu nor a navigation bar.
37
+ */
38
+ submenu: SubmenuDto[];
39
+ }
40
+ /**
41
+ * Union type that ensures a menu item has either a URL or a submenu, but never both
42
+ */
43
+ export type MenuDto = MenuDtoWithUrl | MenuDtoWithSubmenu;
44
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * DTO for tabs
3
+ * Used for defining tabs in the user interface
4
+ */
5
+ export declare class TabDto {
6
+ /**
7
+ * The label displayed on the tab
8
+ */
9
+ label: string;
10
+ /**
11
+ * The URL associated with the tab.
12
+ * The requests coming from the hoster will be signed
13
+ * with jwt, which will contain information about the company
14
+ */
15
+ url: string;
16
+ }
17
+ export declare class SubmenuDto extends TabDto {
18
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubmenuDto = exports.TabDto = void 0;
4
+ /**
5
+ * DTO for tabs
6
+ * Used for defining tabs in the user interface
7
+ */
8
+ class TabDto {
9
+ }
10
+ exports.TabDto = TabDto;
11
+ class SubmenuDto extends TabDto {
12
+ }
13
+ exports.SubmenuDto = SubmenuDto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hosterai/types",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {