-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathapi.d.ts
227 lines (200 loc) · 5.62 KB
/
api.d.ts
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
import {
DEFAULT_UI5_FRAMEWORK,
OPEN_FRAMEWORK,
} from "@ui5-language-assistant/constant";
export type UI5Framework = typeof DEFAULT_UI5_FRAMEWORK | typeof OPEN_FRAMEWORK;
export interface UI5SemanticModel {
version?: string;
framework?: UI5Framework;
includedLibraries: string[];
classes: Record<string, UI5Class>;
enums: Record<string, UI5Enum>;
namespaces: Record<string, UI5Namespace>;
interfaces: Record<string, UI5Interface>;
// - only 10 of these in whole OpenUI (1.60) api.jsons
// Likely Not Relevant for XML.Views
typedefs: Record<string, UI5Typedef>;
// Likely Not Relevant for XML.Views
functions: Record<string, UI5Function>;
// to indicate if the minUI5 version is undefined, old or wrong in manifest, fallback to default
isFallback?: boolean;
isIncorrectVersion?: boolean;
}
export interface UI5Meta {
library: string;
description: string | undefined;
since: string | undefined;
deprecatedInfo: UI5DeprecatedInfo | undefined;
experimentalInfo: UI5ExperimentalInfo | undefined;
visibility: UI5Visibility;
}
export interface BaseUI5Node extends UI5Meta {
name: string;
kind: string;
// Note: top level Namespaces has an undefined parent
// This cannot be defined on UI5Namespace because it inherits this property
parent: BaseUI5Node | undefined;
}
export interface UI5Class extends BaseUI5Node {
kind: "UI5Class";
abstract: boolean;
extends: UI5Class | undefined;
implements: UI5Interface[];
ctor: UI5Constructor | undefined;
// Likely Not Relevant for XML.Views
methods: UI5Method[];
properties: UI5Prop[];
// Likely Not Relevant for XML.Views
fields: UI5Prop[];
aggregations: UI5Aggregation[];
associations: UI5Association[];
events: UI5Event[];
defaultAggregation: UI5Aggregation | undefined;
returnTypes?: (UI5Class | UI5Interface)[];
}
export interface UI5Enum extends BaseUI5Node {
kind: "UI5Enum";
fields: UI5EnumValue[];
}
export interface UI5EnumValue extends BaseUI5Node {
kind: "UI5EnumValue";
}
export interface UI5Namespace extends BaseUI5Node {
kind: "UI5Namespace";
// Likely Not Relevant for XML.Views
fields: UI5Field[];
// Likely Not Relevant for XML.Views
methods: UI5Method[];
events: UI5Event[];
namespaces: Record<string, UI5Namespace>;
classes: Record<string, UI5Class>;
// TODO: maybe we need all children here nested for string literal auto complete ("a.b.c...")
}
// Likely Not Relevant for XML.Views
export interface UI5Typedef extends BaseUI5Node {
kind: "UI5Typedef";
properties: UI5TypedefProp[];
}
export interface UI5ConstructorParameters extends UI5TypedefProp {
parameterProperties: UI5ConstructorParameters[];
}
// Likely Not Relevant for XML.Views
export interface UI5Constructor extends BaseUI5Node {
kind: "UI5Constructor";
name: "";
parameters: UI5ConstructorParameters[];
// TODO: TBD: Ignoring this type's content at this time.
}
// Likely Not Relevant for XML.Views
export interface UI5Method extends BaseUI5Node {
kind: "UI5Method";
// TODO: TBD: Ignoring this type's content at this time.
}
export interface UI5Any {
kind: "UI5Any";
name: "any";
}
// Likely Not Relevant for XML.Views
export interface UI5Function extends BaseUI5Node {
kind: "UI5Function";
// TODO: TBD: Ignoring this type's content at this time.
}
export interface UI5Prop extends BaseUI5Node {
kind: "UI5Prop";
type: UI5Type | undefined;
default: unknown; // This should be of the property's type
metadata?: propertyMetadata;
}
export interface UI5TypedefProp {
kind: "UI5TypedefProp";
name: string;
type: UI5Type | undefined;
optional?: boolean;
visibility?: string;
description?: string;
}
export interface FEPropertyMetadata {
expectedAnnotations: string[];
expectedTypes: string[];
}
export type propertyMetadata = FEPropertyMetadata;
export interface UI5Field extends BaseUI5Node {
kind: "UI5Field";
type: UI5Type | undefined;
}
export interface UI5Aggregation extends BaseUI5Node {
kind: "UI5Aggregation";
type: UI5Type | undefined;
cardinality: UI5Cardinality;
altTypes: UI5Type[];
}
export interface UI5Association extends BaseUI5Node {
kind: "UI5Association";
type: UI5Type | undefined;
cardinality: UI5Cardinality;
}
export interface UI5Event extends BaseUI5Node {
kind: "UI5Event";
// Details on parameter type are Likely Not Relevant for XML.Views
}
export interface UI5Interface extends BaseUI5Node {
kind: "UI5Interface";
// Likely Not Relevant for XML.Views
methods: UI5Method[];
events: UI5Event[];
// I could not locate any UI5 Interfaces with fields/properties...
}
export type UI5Visibility =
| "restricted"
| "protected"
| "public"
| "private"
| "hidden";
export type UI5Cardinality = "0..1" | "0..n";
export interface UI5DeprecatedInfo {
isDeprecated: boolean;
since: string | undefined;
text: string | undefined;
}
export interface UI5ExperimentalInfo {
isExperimental: boolean;
since: string | undefined;
text: string | undefined;
}
export interface ArrayType {
kind: "ArrayType";
type: UI5Type | undefined;
}
export interface UnionType {
kind: "UnionType";
types: UI5Type[];
}
export interface PrimitiveType {
kind: "PrimitiveType";
name: PrimitiveTypeName;
}
export interface UnresolvedType {
kind: "UnresolvedType";
name: string | string[];
}
export type UI5Type =
| UI5Class
| UI5Interface
| UI5Enum
| UI5Namespace
| UI5Typedef
| ArrayType
| PrimitiveType
| UnionType
| UI5Any
| UnresolvedType;
// TODO Should we keep int and float in addition to number? Should we keep both object and map?
export type PrimitiveTypeName =
| "String"
| "Boolean"
| "Number"
| "Integer"
| "Float"
| "Object"
| "Map"
| "Function";