-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodels.ts
More file actions
172 lines (155 loc) · 3.88 KB
/
models.ts
File metadata and controls
172 lines (155 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import type { CSSProperties } from "react";
import type { EnsembleAction, EnsembleActionHookResult } from "./actions";
import type { EnsembleConfigYAML } from "./dto";
/**
* Models
*
* Higher order objects than DTOs that have been marshalled/decorated
* with additional properties
*/
export interface EnsembleScreenModel {
id: string;
name?: string;
inputs?: string[];
body: EnsembleWidget;
path?: string;
onLoad?: EnsembleAction;
header?: EnsembleHeaderModel;
footer?: EnsembleFooterModel;
menu?: EnsembleMenuModel;
apis?: EnsembleAPIModel[];
global?: string;
styles?: { [key: string]: unknown };
importedScripts?: string;
customWidgets?: CustomWidgetModel[];
sockets?: EnsembleSocketModel[];
events?: EnsembleCustomEventModel[];
readonly isRoot?: boolean;
}
export type EnsembleEntryPoint = EnsembleScreenModel | EnsembleMenuModel;
export interface EnsembleAppModel {
id: string;
menu?: EnsembleMenuModel;
screens: EnsembleScreenModel[];
customWidgets: CustomWidgetModel[];
home: EnsembleEntryPoint;
themes: { [key: string]: EnsembleThemeModel };
scripts: EnsembleScriptModel[];
config?: EnsembleConfigYAML;
languages?: EnsembleLanguageModel[];
fonts?: EnsembleFontModel[];
}
export interface EnsembleMenuModel {
id?: string;
type: EnsembleMenuModelType;
items: {
label: string;
icon?: string;
page: string;
screen?: EnsembleScreenModel;
selected: boolean;
}[];
header?: EnsembleWidget;
footer?: EnsembleWidget;
styles: { [key: string]: unknown };
}
export enum EnsembleMenuModelType {
SideBar = "SideBar",
Drawer = "Drawer",
}
export interface EnsembleAPIModel {
name: string;
inputs?: string[];
uri?: string;
url?: string;
method: "GET" | "POST" | "PUT" | "PATCH";
headers?: { [key: string]: string | number | boolean };
cacheExpirySeconds?: number;
body?: string | object;
onResponse?: EnsembleAction;
onError?: EnsembleAction;
onResponseAction?: EnsembleActionHookResult;
onErrorAction?: EnsembleActionHookResult;
mockResponse?: EnsembleMockResponse | string;
}
export interface EnsembleMockResponse {
statusCode: number;
body: object | string;
headers?: { [key: string]: string };
reasonPhrase?: string;
}
export interface EnsembleCustomEventModel {
name: string;
data?: { [key: string]: unknown };
}
export interface EnsembleSocketModel {
name: string;
uri: string;
onSuccess?: EnsembleAction;
onReceive?: EnsembleAction;
onDisconnect?: EnsembleAction;
}
export interface EnsembleWidget {
name: string;
properties: { [key: string]: unknown };
key?: string;
}
export interface EnsembleHeaderModel {
title: string | EnsembleWidget;
styles?: {
backgroundColor?: string;
centerTitle?: boolean;
titleBarHeight?: string | number;
color?: string;
[key: string]: unknown;
};
}
export interface EnsembleFooterModel {
children: EnsembleWidget[];
styles?: {
backgroundColor?: string;
height?: string | number;
width?: string | number;
[key: string]: unknown;
};
}
export interface CustomWidgetModel {
name: string;
inputs: string[];
onLoad?: EnsembleAction;
body: EnsembleWidget;
apis?: EnsembleAPIModel[];
events?: EnsembleCustomEventModel[];
}
export interface EnsembleThemeModel {
name: string;
Tokens?: {
Colors?: {
primary?: string;
} & { [key: string]: string };
Spacing?: { [key: string]: string };
Animation?: { [key: string]: string };
Typography?: {
fontFamily?: string;
} & { [key: string]: string };
};
Styles?: { [key: string]: CSSProperties };
}
export interface EnsembleScriptModel {
name: string;
body: string;
}
export interface EnsembleLanguageModel {
name: string;
nativeName: string;
languageCode: string;
resources: { [key: string]: unknown };
}
export interface EnsembleFontModel {
family: string;
url: string;
options: {
weight: string;
style: string;
};
}