aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/xtext/xtextServiceResults.ts
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/xtext/xtextServiceResults.ts')
-rw-r--r--subprojects/frontend/src/xtext/xtextServiceResults.ts70
1 files changed, 70 insertions, 0 deletions
diff --git a/subprojects/frontend/src/xtext/xtextServiceResults.ts b/subprojects/frontend/src/xtext/xtextServiceResults.ts
index d3b467ad..e473bd48 100644
--- a/subprojects/frontend/src/xtext/xtextServiceResults.ts
+++ b/subprojects/frontend/src/xtext/xtextServiceResults.ts
@@ -125,3 +125,73 @@ export const FormattingResult = DocumentStateResult.extend({
125}); 125});
126 126
127export type FormattingResult = z.infer<typeof FormattingResult>; 127export type FormattingResult = z.infer<typeof FormattingResult>;
128
129export const ModelGenerationStartedResult = z.object({
130 uuid: z.string().nonempty(),
131});
132
133export type ModelGenerationStartedResult = z.infer<
134 typeof ModelGenerationStartedResult
135>;
136
137export const NodeMetadata = z.object({
138 name: z.string(),
139 simpleName: z.string(),
140 kind: z.enum(['IMPLICIT', 'INDIVIDUAL', 'NEW']),
141});
142
143export type NodeMetadata = z.infer<typeof NodeMetadata>;
144
145export const RelationMetadata = z.object({
146 name: z.string(),
147 simpleName: z.string(),
148 arity: z.number().nonnegative(),
149 detail: z.union([
150 z.object({ type: z.literal('class'), abstractClass: z.boolean() }),
151 z.object({ type: z.literal('reference'), containment: z.boolean() }),
152 z.object({
153 type: z.literal('opposite'),
154 container: z.boolean(),
155 opposite: z.string(),
156 }),
157 z.object({ type: z.literal('predicate'), error: z.boolean() }),
158 z.object({ type: z.literal('builtin') }),
159 ]),
160});
161
162export type RelationMetadata = z.infer<typeof RelationMetadata>;
163
164export const SemanticsSuccessResult = z.object({
165 nodes: NodeMetadata.array(),
166 relations: RelationMetadata.array(),
167 partialInterpretation: z.record(
168 z.string(),
169 z.union([z.number(), z.string()]).array().array(),
170 ),
171});
172
173export type SemanticsSuccessResult = z.infer<typeof SemanticsSuccessResult>;
174
175export const SemanticsResult = z.union([
176 z.object({ error: z.string() }),
177 z.object({ issues: Issue.array() }),
178 SemanticsSuccessResult,
179]);
180
181export type SemanticsResult = z.infer<typeof SemanticsResult>;
182
183export const ModelGenerationResult = z.union([
184 z.object({
185 uuid: z.string().nonempty(),
186 status: z.string(),
187 }),
188 z.object({
189 uuid: z.string().nonempty(),
190 error: z.string(),
191 }),
192 SemanticsSuccessResult.extend({
193 uuid: z.string().nonempty(),
194 }),
195]);
196
197export type ModelGenerationResult = z.infer<typeof ModelGenerationResult>;