mdmodels-core 0.2.0 → 0.2.1
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.
- package/README.md +1 -0
- package/mdmodels-core.d.ts +92 -67
- package/mdmodels-core_bg.js +2 -1
- package/mdmodels-core_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ The following templates are available:
|
|
|
87
87
|
- `typescript-zod`: TypeScript Zod schema definitions
|
|
88
88
|
- `rust`: Rust struct definitions with serde support
|
|
89
89
|
- `golang`: Go struct definitions
|
|
90
|
+
- `julia`: Julia struct definitions
|
|
90
91
|
- `protobuf`: Protocol Buffer schema definition
|
|
91
92
|
- `graphql`: GraphQL schema definition
|
|
92
93
|
- `xml-schema`: XML schema definition
|
package/mdmodels-core.d.ts
CHANGED
|
@@ -78,47 +78,23 @@ export enum Templates {
|
|
|
78
78
|
Graphql = 16,
|
|
79
79
|
Golang = 17,
|
|
80
80
|
Linkml = 18,
|
|
81
|
+
Julia = 19,
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
|
-
*
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
is_valid: boolean;
|
|
87
|
-
errors: ValidationError[];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Enum representing the type of validation error.
|
|
92
|
-
*/
|
|
93
|
-
export type ErrorType = "NameError" | "TypeError" | "DuplicateError" | "GlobalError";
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Represents a validation error in the data model.
|
|
84
|
+
* Represents different types of model imports.
|
|
85
|
+
*
|
|
86
|
+
* Can be either a remote URL or a local file path.
|
|
97
87
|
*/
|
|
98
|
-
export
|
|
99
|
-
message: string;
|
|
100
|
-
object: string | undefined;
|
|
101
|
-
attribute: string | undefined;
|
|
102
|
-
location: string;
|
|
103
|
-
error_type: ErrorType;
|
|
104
|
-
positions: Position[];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface PositionRange {
|
|
108
|
-
start: number;
|
|
109
|
-
end: number;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface Position {
|
|
113
|
-
line: number;
|
|
114
|
-
column: PositionRange;
|
|
115
|
-
offset: PositionRange;
|
|
116
|
-
}
|
|
88
|
+
export type ImportType = { Remote: string } | { Local: string };
|
|
117
89
|
|
|
118
90
|
/**
|
|
119
91
|
* Represents the front matter data of a markdown file.
|
|
120
92
|
*/
|
|
121
93
|
export interface FrontMatter {
|
|
94
|
+
/**
|
|
95
|
+
* Identifier field of the model.
|
|
96
|
+
*/
|
|
97
|
+
id: string | undefined;
|
|
122
98
|
/**
|
|
123
99
|
* A boolean field with a default value, renamed from `id-field`.
|
|
124
100
|
*/
|
|
@@ -139,6 +115,21 @@ export interface FrontMatter {
|
|
|
139
115
|
* A string field with a default value representing the prefix.
|
|
140
116
|
*/
|
|
141
117
|
prefix?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Import remote or local models.
|
|
120
|
+
*/
|
|
121
|
+
imports?: Map<string, ImportType>;
|
|
122
|
+
/**
|
|
123
|
+
* Allow empty models.
|
|
124
|
+
*/
|
|
125
|
+
"allow-empty"?: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface DataModel {
|
|
129
|
+
name?: string;
|
|
130
|
+
objects: Object[];
|
|
131
|
+
enums: Enumeration[];
|
|
132
|
+
config?: FrontMatter;
|
|
142
133
|
}
|
|
143
134
|
|
|
144
135
|
export type DataType = { Boolean: boolean } | { Integer: number } | { Float: number } | { String: string };
|
|
@@ -195,15 +186,61 @@ export interface Attribute {
|
|
|
195
186
|
* The line number of the attribute
|
|
196
187
|
*/
|
|
197
188
|
position: Position | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* The prefix of the attribute, if it is an import
|
|
191
|
+
*/
|
|
192
|
+
import_prefix?: string;
|
|
198
193
|
}
|
|
199
194
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Represents an XML type, either an attribute or an element.
|
|
197
|
+
*/
|
|
198
|
+
export type XMLType = { Attribute: { is_attr: boolean; name: string } } | { Element: { is_attr: boolean; name: string } } | { Wrapped: { is_attr: boolean; name: string; wrapped: string[] | undefined } };
|
|
199
|
+
|
|
200
|
+
export interface PositionRange {
|
|
201
|
+
start: number;
|
|
202
|
+
end: number;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface Position {
|
|
206
|
+
line: number;
|
|
207
|
+
column: PositionRange;
|
|
208
|
+
offset: PositionRange;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* A raw key-value representation of an attribute option.
|
|
213
|
+
*
|
|
214
|
+
* This struct provides a simple string-based representation of options,
|
|
215
|
+
* which is useful for serialization/deserialization and when working
|
|
216
|
+
* with untyped data.
|
|
217
|
+
*/
|
|
218
|
+
export interface RawOption {
|
|
219
|
+
/**
|
|
220
|
+
* The key/name of the option
|
|
221
|
+
*/
|
|
222
|
+
key: string;
|
|
223
|
+
/**
|
|
224
|
+
* The string value of the option
|
|
225
|
+
*/
|
|
226
|
+
value: string;
|
|
205
227
|
}
|
|
206
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Represents an option for an attribute in a data model.
|
|
231
|
+
*
|
|
232
|
+
* This enum provides a strongly-typed representation of various attribute options
|
|
233
|
+
* that can be used to configure and constrain attributes in a data model.
|
|
234
|
+
*
|
|
235
|
+
* The options are grouped into several categories:
|
|
236
|
+
* - JSON Schema validation options (e.g., minimum/maximum values, length constraints)
|
|
237
|
+
* - SQL database options (e.g., primary key)
|
|
238
|
+
* - LinkML specific options (e.g., readonly, recommended)
|
|
239
|
+
* - Custom options via the `Other` variant
|
|
240
|
+
*
|
|
241
|
+
*/
|
|
242
|
+
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 } };
|
|
243
|
+
|
|
207
244
|
/**
|
|
208
245
|
* Represents an enumeration with a name and mappings.
|
|
209
246
|
*/
|
|
@@ -257,40 +294,28 @@ export interface Object {
|
|
|
257
294
|
}
|
|
258
295
|
|
|
259
296
|
/**
|
|
260
|
-
*
|
|
297
|
+
* Validator for checking the integrity of a data model.
|
|
261
298
|
*/
|
|
262
|
-
export
|
|
299
|
+
export interface Validator {
|
|
300
|
+
is_valid: boolean;
|
|
301
|
+
errors: ValidationError[];
|
|
302
|
+
}
|
|
263
303
|
|
|
264
304
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* This struct provides a simple string-based representation of options,
|
|
268
|
-
* which is useful for serialization/deserialization and when working
|
|
269
|
-
* with untyped data.
|
|
305
|
+
* Enum representing the type of validation error.
|
|
270
306
|
*/
|
|
271
|
-
export
|
|
272
|
-
/**
|
|
273
|
-
* The key/name of the option
|
|
274
|
-
*/
|
|
275
|
-
key: string;
|
|
276
|
-
/**
|
|
277
|
-
* The string value of the option
|
|
278
|
-
*/
|
|
279
|
-
value: string;
|
|
280
|
-
}
|
|
307
|
+
export type ErrorType = "NameError" | "TypeError" | "DuplicateError" | "GlobalError" | "XMLError" | "ObjectError";
|
|
281
308
|
|
|
282
309
|
/**
|
|
283
|
-
* Represents
|
|
284
|
-
*
|
|
285
|
-
* This enum provides a strongly-typed representation of various attribute options
|
|
286
|
-
* that can be used to configure and constrain attributes in a data model.
|
|
287
|
-
*
|
|
288
|
-
* The options are grouped into several categories:
|
|
289
|
-
* - JSON Schema validation options (e.g., minimum/maximum values, length constraints)
|
|
290
|
-
* - SQL database options (e.g., primary key)
|
|
291
|
-
* - LinkML specific options (e.g., readonly, recommended)
|
|
292
|
-
* - Custom options via the `Other` variant
|
|
293
|
-
*
|
|
310
|
+
* Represents a validation error in the data model.
|
|
294
311
|
*/
|
|
295
|
-
export
|
|
312
|
+
export interface ValidationError {
|
|
313
|
+
message: string;
|
|
314
|
+
object: string | undefined;
|
|
315
|
+
attribute: string | undefined;
|
|
316
|
+
location: string;
|
|
317
|
+
solution: string | undefined;
|
|
318
|
+
error_type: ErrorType;
|
|
319
|
+
positions: Position[];
|
|
320
|
+
}
|
|
296
321
|
|
package/mdmodels-core_bg.js
CHANGED
|
@@ -224,7 +224,7 @@ export function validate(markdown_content) {
|
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* Enumeration of available templates.
|
|
227
|
-
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18}
|
|
227
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19}
|
|
228
228
|
*/
|
|
229
229
|
export const Templates = Object.freeze({
|
|
230
230
|
XmlSchema: 0, "0": "XmlSchema",
|
|
@@ -246,6 +246,7 @@ export const Templates = Object.freeze({
|
|
|
246
246
|
Graphql: 16, "16": "Graphql",
|
|
247
247
|
Golang: 17, "17": "Golang",
|
|
248
248
|
Linkml: 18, "18": "Linkml",
|
|
249
|
+
Julia: 19, "19": "Julia",
|
|
249
250
|
});
|
|
250
251
|
|
|
251
252
|
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
package/mdmodels-core_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED