mdmodels-core 0.2.5 → 0.2.7

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.
@@ -157,97 +157,9 @@ export enum Templates {
157
157
  Mermaid = 20,
158
158
  }
159
159
  /**
160
- * A raw key-value representation of an attribute option.
161
- *
162
- * This struct provides a simple string-based representation of options,
163
- * which is useful for serialization/deserialization and when working
164
- * with untyped data.
165
- */
166
- export interface RawOption {
167
- /**
168
- * The key/name of the option
169
- */
170
- key: string;
171
- /**
172
- * The string value of the option
173
- */
174
- value: string;
175
- }
176
-
177
- /**
178
- * Represents an option for an attribute in a data model.
179
- *
180
- * This enum provides a strongly-typed representation of various attribute options
181
- * that can be used to configure and constrain attributes in a data model.
182
- *
183
- * The options are grouped into several categories:
184
- * - JSON Schema validation options (e.g., minimum/maximum values, length constraints)
185
- * - SQL database options (e.g., primary key)
186
- * - LinkML specific options (e.g., readonly, recommended)
187
- * - Custom options via the `Other` variant
188
- *
189
- */
190
- 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
-
192
- export type DataType = { Boolean: boolean } | { Integer: number } | { Float: number } | { String: string };
193
-
194
- /**
195
- * Represents an attribute with various properties and options.
160
+ * Represents an XML type, either an attribute or an element.
196
161
  */
197
- export interface Attribute {
198
- /**
199
- * The name of the attribute.
200
- */
201
- name: string;
202
- /**
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.
212
- */
213
- dtypes: string[];
214
- /**
215
- * Documentation string for the attribute.
216
- */
217
- docstring: string;
218
- /**
219
- * List of additional options for the attribute.
220
- */
221
- options: AttrOption[];
222
- /**
223
- * Term associated with the attribute, if any.
224
- */
225
- term: string | undefined;
226
- /**
227
- * Indicates if the attribute is required.
228
- */
229
- required: boolean;
230
- /**
231
- * Default value for the attribute.
232
- */
233
- default?: DataType;
234
- /**
235
- * XML type information for the attribute.
236
- */
237
- xml?: XMLType;
238
- /**
239
- * Is an enumeration or not
240
- */
241
- is_enum: boolean;
242
- /**
243
- * The line number of the attribute
244
- */
245
- position: Position | undefined;
246
- /**
247
- * The prefix of the attribute, if it is an import
248
- */
249
- import_prefix?: string;
250
- }
162
+ export type XMLType = { Attribute: { is_attr: boolean; name: string } } | { Element: { is_attr: boolean; name: string } } | { Wrapped: { is_attr: boolean; name: string; wrapped: string[] | undefined } };
251
163
 
252
164
  /**
253
165
  * Validator for checking the integrity of a data model.
@@ -275,6 +187,13 @@ export interface ValidationError {
275
187
  positions: Position[];
276
188
  }
277
189
 
190
+ export interface DataModel {
191
+ name?: string;
192
+ objects: Object[];
193
+ enums: Enumeration[];
194
+ config?: FrontMatter;
195
+ }
196
+
278
197
  export interface PositionRange {
279
198
  start: number;
280
199
  end: number;
@@ -286,11 +205,6 @@ export interface Position {
286
205
  offset: PositionRange;
287
206
  }
288
207
 
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
208
  /**
295
209
  * Represents different types of model imports.
296
210
  *
@@ -336,6 +250,39 @@ export interface FrontMatter {
336
250
  "allow-empty"?: boolean;
337
251
  }
338
252
 
253
+ /**
254
+ * A raw key-value representation of an attribute option.
255
+ *
256
+ * This struct provides a simple string-based representation of options,
257
+ * which is useful for serialization/deserialization and when working
258
+ * with untyped data.
259
+ */
260
+ export interface RawOption {
261
+ /**
262
+ * The key/name of the option
263
+ */
264
+ key: string;
265
+ /**
266
+ * The string value of the option
267
+ */
268
+ value: string;
269
+ }
270
+
271
+ /**
272
+ * Represents an option for an attribute in a data model.
273
+ *
274
+ * This enum provides a strongly-typed representation of various attribute options
275
+ * that can be used to configure and constrain attributes in a data model.
276
+ *
277
+ * The options are grouped into several categories:
278
+ * - JSON Schema validation options (e.g., minimum/maximum values, length constraints)
279
+ * - SQL database options (e.g., primary key)
280
+ * - LinkML specific options (e.g., readonly, recommended)
281
+ * - Custom options via the `Other` variant
282
+ *
283
+ */
284
+ 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 } };
285
+
339
286
  /**
340
287
  * Represents an enumeration with a name and mappings.
341
288
  */
@@ -388,10 +335,63 @@ export interface Object {
388
335
  position?: Position;
389
336
  }
390
337
 
391
- export interface DataModel {
392
- name?: string;
393
- objects: Object[];
394
- enums: Enumeration[];
395
- config?: FrontMatter;
338
+ export type DataType = { Boolean: boolean } | { Integer: number } | { Float: number } | { String: string };
339
+
340
+ /**
341
+ * Represents an attribute with various properties and options.
342
+ */
343
+ export interface Attribute {
344
+ /**
345
+ * The name of the attribute.
346
+ */
347
+ name: string;
348
+ /**
349
+ * Indicates if the attribute is an array.
350
+ */
351
+ multiple: boolean;
352
+ /**
353
+ * Is an identifier or not
354
+ */
355
+ is_id: boolean;
356
+ /**
357
+ * Data types associated with the attribute.
358
+ */
359
+ dtypes: string[];
360
+ /**
361
+ * Documentation string for the attribute.
362
+ */
363
+ docstring: string;
364
+ /**
365
+ * List of additional options for the attribute.
366
+ */
367
+ options: AttrOption[];
368
+ /**
369
+ * Term associated with the attribute, if any.
370
+ */
371
+ term: string | undefined;
372
+ /**
373
+ * Indicates if the attribute is required.
374
+ */
375
+ required: boolean;
376
+ /**
377
+ * Default value for the attribute.
378
+ */
379
+ default?: DataType;
380
+ /**
381
+ * XML type information for the attribute.
382
+ */
383
+ xml?: XMLType;
384
+ /**
385
+ * Is an enumeration or not
386
+ */
387
+ is_enum: boolean;
388
+ /**
389
+ * The line number of the attribute
390
+ */
391
+ position: Position | undefined;
392
+ /**
393
+ * The prefix of the attribute, if it is an import
394
+ */
395
+ import_prefix?: string;
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.7",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",