-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathtypes.ts
More file actions
235 lines (213 loc) · 5.78 KB
/
types.ts
File metadata and controls
235 lines (213 loc) · 5.78 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
import type { Editor } from 'mem-fs-editor';
export const SupportedPageTypes: { [id: string]: string } = {
'sap.fe.templates.ListReport': 'ListReport',
'sap.fe.templates.ObjectPage': 'ObjectPage',
'sap.fe.core.fpm': 'FPM'
};
export type FEV4OPAPageConfig = {
appID: string;
appPath: string;
template: string;
componentID: string;
entitySet?: string;
contextPath?: string;
targetKey: string;
isStartup: boolean;
};
export type FEV4OPAConfig = {
appID: string;
appPath: string;
pages: FEV4OPAPageConfig[];
opaJourneyFileName: string;
htmlTarget: string;
hideFilterBar: boolean;
filterBarItems?: string[];
};
export type JourneyParams = {
startPages: string[];
startLR: string | undefined;
navigatedOP: string | undefined;
hideFilterBar: boolean;
};
export type FEV4ManifestTarget = {
type?: string;
name?: string;
id?: string;
options?: {
settings?: {
entitySet?: string;
contextPath?: string;
hideFilterBar?: boolean;
navigation?: {
[id: string]: {
detail?: {
route?: string;
};
};
};
};
};
};
/**
* General validation error thrown if app config options contain invalid combinations
*/
export class ValidationError extends Error {
/**
* ValidationError constructor.
*
* @param message - the error message
*/
constructor(message: string) {
super(`Validation error: ${message}`);
this.name = this.constructor.name;
}
}
/**
* Configuration interface for generating freestyle OPA test files
*/
export interface FFOPAConfig {
appId: string;
applicationTitle?: string;
applicationDescription?: string;
enableTypeScript?: boolean;
viewName?: string;
ui5Version?: string;
ui5Theme?: string;
}
export type ObjectPageNavigationParents = {
parentLRName?: string;
parentOPName?: string;
parentOPTableSection?: string;
};
export type SectionFormField = {
property: string;
};
export type BodySubSectionFeatureData = {
id: string;
navigationProperty?: string;
isTable: boolean;
custom: boolean;
order: number;
fields: SectionFormField[];
tableColumns: Record<string, Record<string, string | number | boolean>>;
};
export type BodySectionFeatureData = {
id: string;
navigationProperty?: string;
isTable: boolean;
custom: boolean;
order: number;
fields: SectionFormField[];
tableColumns: Record<string, Record<string, string | number | boolean>>;
subSections: BodySubSectionFeatureData[];
};
export type ObjectPageFeatures = {
name?: string;
navigationParents?: ObjectPageNavigationParents;
headerTitle?: string;
headerDescription?: string;
headerSections?: HeaderSectionFeatureData[];
bodySections?: BodySectionFeatureData[];
};
export type ListReportFeatures = {
name?: string;
createButton?: {
enabled?: boolean | string;
visible?: boolean;
dynamicPath?: string;
};
deleteButton?: {
enabled?: boolean | string;
visible: boolean;
dynamicPath?: string;
};
filterBarItems?: string[];
tableColumns?: Record<string, Record<string, string | number | boolean>>;
toolBarActions?: ActionButtonState[];
};
export interface ActionButtonState {
label: string;
action: string;
visible: boolean;
/**
* Indicates whether the action button is enabled.
* - true: Button is enabled and can be invoked
* - false: Button is disabled
* - 'dynamic': The state is controlled by a dynamic path annotation (e.g., Core.OperationAvailable)
*/
enabled: boolean | 'dynamic';
/**
* If the enabled state is dynamic, this contains the path to the control property.
* For example: "_it/__OperationControl/deductDiscount"
*/
dynamicPath?: string;
/**
* The invocation grouping type if specified (e.g., "Isolated", "ChangeSet").
*/
invocationGrouping?: string;
}
export type FPMFeatures = {
name?: string;
filterBarItems?: string[];
tableColumns?: Record<string, Record<string, string | number | boolean>>;
};
export type AppFeatures = {
listReport?: ListReportFeatures;
objectPages?: ObjectPageFeatures[];
fpm?: FPMFeatures;
};
export type WriteContext = {
config: FEV4OPAConfig;
rootV4TemplateDirPath: string;
testOutDirPath: string;
editor: Editor;
journeyParams: JourneyParams;
};
export type FormField = {
fieldGroupQualifier?: string;
field?: string;
targetAnnotation?: string;
};
export type HeaderSectionFeatureData = {
facetId?: string;
title?: string;
custom?: boolean;
collection?: boolean;
microChart?: boolean;
form?: boolean;
stashed?: boolean | string;
fields?: FormField[];
};
export interface ButtonState {
visible: boolean;
/**
* - true: Button is enabled and can be clicked
* - false: Button is disabled
* - 'dynamic': The state is controlled by a dynamic path annotation (e.g., Path="__EntityControl/Deletable")
*/
enabled: boolean | 'dynamic';
dynamicPath?: string;
}
export interface ButtonVisibilityResult {
/**
* State of the Create button based on Capabilities.InsertRestrictions annotation.
*/
create: ButtonState;
/**
* State of the Delete button based on Capabilities.DeleteRestrictions annotation.
*/
delete: ButtonState;
}
/**
* Result interface for action button checks.
*/
export interface ActionButtonsResult {
/**
* List of action buttons found in the UI.LineItem annotation.
*/
actions: ActionButtonState[];
/**
* The entity type name that these actions belong to.
*/
entityType: string;
}