mdmodels-core 0.2.5 → 0.2.6

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.
@@ -156,6 +156,22 @@ export enum Templates {
156
156
  */
157
157
  Mermaid = 20,
158
158
  }
159
+ export interface PositionRange {
160
+ start: number;
161
+ end: number;
162
+ }
163
+
164
+ export interface Position {
165
+ line: number;
166
+ column: PositionRange;
167
+ offset: PositionRange;
168
+ }
169
+
170
+ /**
171
+ * Represents an XML type, either an attribute or an element.
172
+ */
173
+ export type XMLType = { Attribute: { is_attr: boolean; name: string } } | { Element: { is_attr: boolean; name: string } } | { Wrapped: { is_attr: boolean; name: string; wrapped: string[] | undefined } };
174
+
159
175
  /**
160
176
  * A raw key-value representation of an attribute option.
161
177
  *
@@ -189,108 +205,58 @@ export interface RawOption {
189
205
  */
190
206
  export type AttrOption = { Example: string } | { MinimumValue: number } | { MaximumValue: number } | { MinItems: number } | { MaxItems: number } | { MinLength: number } | { MaxLength: number } | { Pattern: string } | { Unique: boolean } | { MultipleOf: number } | { ExclusiveMinimum: number } | { ExclusiveMaximum: number } | { PrimaryKey: boolean } | { ReadOnly: boolean } | { Recommended: boolean } | { Other: { key: string; value: string } };
191
207
 
192
- export type DataType = { Boolean: boolean } | { Integer: number } | { Float: number } | { String: string };
193
-
194
208
  /**
195
- * Represents an attribute with various properties and options.
209
+ * Represents an enumeration with a name and mappings.
196
210
  */
197
- export interface Attribute {
211
+ export interface Enumeration {
198
212
  /**
199
- * The name of the attribute.
213
+ * Name of the enumeration.
200
214
  */
201
215
  name: string;
202
216
  /**
203
- * Indicates if the attribute is an array.
204
- */
205
- multiple: boolean;
206
- /**
207
- * Is an identifier or not
208
- */
209
- is_id: boolean;
210
- /**
211
- * Data types associated with the attribute.
217
+ * Mappings associated with the enumeration.
212
218
  */
213
- dtypes: string[];
219
+ mappings: Map<string, string>;
214
220
  /**
215
- * Documentation string for the attribute.
221
+ * Documentation string for the enumeration.
216
222
  */
217
223
  docstring: string;
218
224
  /**
219
- * List of additional options for the attribute.
220
- */
221
- options: AttrOption[];
222
- /**
223
- * Term associated with the attribute, if any.
225
+ * The line number of the enumeration
224
226
  */
225
- term: string | undefined;
227
+ position: Position | undefined;
228
+ }
229
+
230
+ /**
231
+ * Represents an object with a name, attributes, docstring, and an optional term.
232
+ */
233
+ export interface Object {
226
234
  /**
227
- * Indicates if the attribute is required.
235
+ * Name of the object.
228
236
  */
229
- required: boolean;
237
+ name: string;
230
238
  /**
231
- * Default value for the attribute.
239
+ * List of attributes associated with the object.
232
240
  */
233
- default?: DataType;
241
+ attributes: Attribute[];
234
242
  /**
235
- * XML type information for the attribute.
243
+ * Documentation string for the object.
236
244
  */
237
- xml?: XMLType;
245
+ docstring: string;
238
246
  /**
239
- * Is an enumeration or not
247
+ * Optional term associated with the object.
240
248
  */
241
- is_enum: boolean;
249
+ term?: string;
242
250
  /**
243
- * The line number of the attribute
251
+ * Other objects that this object gets mixed in with.
244
252
  */
245
- position: Position | undefined;
253
+ mixins?: string[];
246
254
  /**
247
- * The prefix of the attribute, if it is an import
255
+ * The line number of the object
248
256
  */
249
- import_prefix?: string;
250
- }
251
-
252
- /**
253
- * Validator for checking the integrity of a data model.
254
- */
255
- export interface Validator {
256
- is_valid: boolean;
257
- errors: ValidationError[];
258
- }
259
-
260
- /**
261
- * Enum representing the type of validation error.
262
- */
263
- export type ErrorType = "NameError" | "TypeError" | "DuplicateError" | "GlobalError" | "XMLError" | "ObjectError";
264
-
265
- /**
266
- * Represents a validation error in the data model.
267
- */
268
- export interface ValidationError {
269
- message: string;
270
- object: string | undefined;
271
- attribute: string | undefined;
272
- location: string;
273
- solution: string | undefined;
274
- error_type: ErrorType;
275
- positions: Position[];
276
- }
277
-
278
- export interface PositionRange {
279
- start: number;
280
- end: number;
281
- }
282
-
283
- export interface Position {
284
- line: number;
285
- column: PositionRange;
286
- offset: PositionRange;
257
+ position?: Position;
287
258
  }
288
259
 
289
- /**
290
- * Represents an XML type, either an attribute or an element.
291
- */
292
- export type XMLType = { Attribute: { is_attr: boolean; name: string } } | { Element: { is_attr: boolean; name: string } } | { Wrapped: { is_attr: boolean; name: string; wrapped: string[] | undefined } };
293
-
294
260
  /**
295
261
  * Represents different types of model imports.
296
262
  *
@@ -336,62 +302,96 @@ export interface FrontMatter {
336
302
  "allow-empty"?: boolean;
337
303
  }
338
304
 
305
+ export interface DataModel {
306
+ name?: string;
307
+ objects: Object[];
308
+ enums: Enumeration[];
309
+ config?: FrontMatter;
310
+ }
311
+
312
+ export type DataType = { Boolean: boolean } | { Integer: number } | { Float: number } | { String: string };
313
+
339
314
  /**
340
- * Represents an enumeration with a name and mappings.
315
+ * Represents an attribute with various properties and options.
341
316
  */
342
- export interface Enumeration {
317
+ export interface Attribute {
343
318
  /**
344
- * Name of the enumeration.
319
+ * The name of the attribute.
345
320
  */
346
321
  name: string;
347
322
  /**
348
- * Mappings associated with the enumeration.
323
+ * Indicates if the attribute is an array.
349
324
  */
350
- mappings: Map<string, string>;
325
+ multiple: boolean;
351
326
  /**
352
- * Documentation string for the enumeration.
327
+ * Is an identifier or not
328
+ */
329
+ is_id: boolean;
330
+ /**
331
+ * Data types associated with the attribute.
332
+ */
333
+ dtypes: string[];
334
+ /**
335
+ * Documentation string for the attribute.
353
336
  */
354
337
  docstring: string;
355
338
  /**
356
- * The line number of the enumeration
339
+ * List of additional options for the attribute.
357
340
  */
358
- position: Position | undefined;
359
- }
360
-
361
- /**
362
- * Represents an object with a name, attributes, docstring, and an optional term.
363
- */
364
- export interface Object {
341
+ options: AttrOption[];
365
342
  /**
366
- * Name of the object.
343
+ * Term associated with the attribute, if any.
367
344
  */
368
- name: string;
345
+ term: string | undefined;
369
346
  /**
370
- * List of attributes associated with the object.
347
+ * Indicates if the attribute is required.
371
348
  */
372
- attributes: Attribute[];
349
+ required: boolean;
373
350
  /**
374
- * Documentation string for the object.
351
+ * Default value for the attribute.
375
352
  */
376
- docstring: string;
353
+ default?: DataType;
377
354
  /**
378
- * Optional term associated with the object.
355
+ * XML type information for the attribute.
379
356
  */
380
- term?: string;
357
+ xml?: XMLType;
381
358
  /**
382
- * Other objects that this object gets mixed in with.
359
+ * Is an enumeration or not
383
360
  */
384
- mixins?: string[];
361
+ is_enum: boolean;
385
362
  /**
386
- * The line number of the object
363
+ * The line number of the attribute
387
364
  */
388
- position?: Position;
365
+ position: Position | undefined;
366
+ /**
367
+ * The prefix of the attribute, if it is an import
368
+ */
369
+ import_prefix?: string;
389
370
  }
390
371
 
391
- export interface DataModel {
392
- name?: string;
393
- objects: Object[];
394
- enums: Enumeration[];
395
- config?: FrontMatter;
372
+ /**
373
+ * Validator for checking the integrity of a data model.
374
+ */
375
+ export interface Validator {
376
+ is_valid: boolean;
377
+ errors: ValidationError[];
378
+ }
379
+
380
+ /**
381
+ * Enum representing the type of validation error.
382
+ */
383
+ export type ErrorType = "NameError" | "TypeError" | "DuplicateError" | "GlobalError" | "XMLError" | "ObjectError";
384
+
385
+ /**
386
+ * Represents a validation error in the data model.
387
+ */
388
+ export interface ValidationError {
389
+ message: string;
390
+ object: string | undefined;
391
+ attribute: string | undefined;
392
+ location: string;
393
+ solution: string | undefined;
394
+ error_type: ErrorType;
395
+ positions: Position[];
396
396
  }
397
397
 
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Jan Range <jan.range@simtech.uni-stuttgart.de>"
6
6
  ],
7
7
  "description": "A tool to generate models, code and schemas from markdown files",
8
- "version": "0.2.5",
8
+ "version": "0.2.6",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",