mdmodels-core 0.2.0 → 0.2.2
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 +129 -104
- 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,67 +78,109 @@ export enum Templates {
|
|
|
78
78
|
Graphql = 16,
|
|
79
79
|
Golang = 17,
|
|
80
80
|
Linkml = 18,
|
|
81
|
+
Julia = 19,
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
|
-
*
|
|
84
|
+
* A raw key-value representation of an attribute option.
|
|
85
|
+
*
|
|
86
|
+
* This struct provides a simple string-based representation of options,
|
|
87
|
+
* which is useful for serialization/deserialization and when working
|
|
88
|
+
* with untyped data.
|
|
84
89
|
*/
|
|
85
|
-
export interface
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
export interface RawOption {
|
|
91
|
+
/**
|
|
92
|
+
* The key/name of the option
|
|
93
|
+
*/
|
|
94
|
+
key: string;
|
|
95
|
+
/**
|
|
96
|
+
* The string value of the option
|
|
97
|
+
*/
|
|
98
|
+
value: string;
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
/**
|
|
91
|
-
*
|
|
102
|
+
* Represents an option for an attribute in a data model.
|
|
103
|
+
*
|
|
104
|
+
* This enum provides a strongly-typed representation of various attribute options
|
|
105
|
+
* that can be used to configure and constrain attributes in a data model.
|
|
106
|
+
*
|
|
107
|
+
* The options are grouped into several categories:
|
|
108
|
+
* - JSON Schema validation options (e.g., minimum/maximum values, length constraints)
|
|
109
|
+
* - SQL database options (e.g., primary key)
|
|
110
|
+
* - LinkML specific options (e.g., readonly, recommended)
|
|
111
|
+
* - Custom options via the `Other` variant
|
|
112
|
+
*
|
|
92
113
|
*/
|
|
93
|
-
export type
|
|
114
|
+
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 } };
|
|
94
115
|
|
|
95
116
|
/**
|
|
96
|
-
* Represents
|
|
117
|
+
* Represents an enumeration with a name and mappings.
|
|
97
118
|
*/
|
|
98
|
-
export interface
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
offset: PositionRange;
|
|
119
|
+
export interface Enumeration {
|
|
120
|
+
/**
|
|
121
|
+
* Name of the enumeration.
|
|
122
|
+
*/
|
|
123
|
+
name: string;
|
|
124
|
+
/**
|
|
125
|
+
* Mappings associated with the enumeration.
|
|
126
|
+
*/
|
|
127
|
+
mappings: Map<string, string>;
|
|
128
|
+
/**
|
|
129
|
+
* Documentation string for the enumeration.
|
|
130
|
+
*/
|
|
131
|
+
docstring: string;
|
|
132
|
+
/**
|
|
133
|
+
* The line number of the enumeration
|
|
134
|
+
*/
|
|
135
|
+
position: Position | undefined;
|
|
116
136
|
}
|
|
117
137
|
|
|
118
138
|
/**
|
|
119
|
-
* Represents
|
|
139
|
+
* Represents an object with a name, attributes, docstring, and an optional term.
|
|
120
140
|
*/
|
|
121
|
-
export interface
|
|
141
|
+
export interface Object {
|
|
122
142
|
/**
|
|
123
|
-
*
|
|
143
|
+
* Name of the object.
|
|
124
144
|
*/
|
|
125
|
-
|
|
145
|
+
name: string;
|
|
126
146
|
/**
|
|
127
|
-
*
|
|
147
|
+
* List of attributes associated with the object.
|
|
128
148
|
*/
|
|
129
|
-
|
|
149
|
+
attributes: Attribute[];
|
|
130
150
|
/**
|
|
131
|
-
*
|
|
151
|
+
* Documentation string for the object.
|
|
132
152
|
*/
|
|
133
|
-
|
|
153
|
+
docstring: string;
|
|
134
154
|
/**
|
|
135
|
-
*
|
|
155
|
+
* Optional term associated with the object.
|
|
136
156
|
*/
|
|
137
|
-
|
|
157
|
+
term?: string;
|
|
138
158
|
/**
|
|
139
|
-
*
|
|
159
|
+
* Parent object of the object.
|
|
140
160
|
*/
|
|
141
|
-
|
|
161
|
+
parent?: string;
|
|
162
|
+
/**
|
|
163
|
+
* The line number of the object
|
|
164
|
+
*/
|
|
165
|
+
position?: Position;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface PositionRange {
|
|
169
|
+
start: number;
|
|
170
|
+
end: number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface Position {
|
|
174
|
+
line: number;
|
|
175
|
+
column: PositionRange;
|
|
176
|
+
offset: PositionRange;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface DataModel {
|
|
180
|
+
name?: string;
|
|
181
|
+
objects: Object[];
|
|
182
|
+
enums: Enumeration[];
|
|
183
|
+
config?: FrontMatter;
|
|
142
184
|
}
|
|
143
185
|
|
|
144
186
|
export type DataType = { Boolean: boolean } | { Integer: number } | { Float: number } | { String: string };
|
|
@@ -195,102 +237,85 @@ export interface Attribute {
|
|
|
195
237
|
* The line number of the attribute
|
|
196
238
|
*/
|
|
197
239
|
position: Position | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* The prefix of the attribute, if it is an import
|
|
242
|
+
*/
|
|
243
|
+
import_prefix?: string;
|
|
198
244
|
}
|
|
199
245
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
config?: FrontMatter;
|
|
205
|
-
}
|
|
246
|
+
/**
|
|
247
|
+
* Represents an XML type, either an attribute or an element.
|
|
248
|
+
*/
|
|
249
|
+
export type XMLType = { Attribute: { is_attr: boolean; name: string } } | { Element: { is_attr: boolean; name: string } } | { Wrapped: { is_attr: boolean; name: string; wrapped: string[] | undefined } };
|
|
206
250
|
|
|
207
251
|
/**
|
|
208
|
-
* Represents
|
|
252
|
+
* Represents different types of model imports.
|
|
253
|
+
*
|
|
254
|
+
* Can be either a remote URL or a local file path.
|
|
209
255
|
*/
|
|
210
|
-
export
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
* Mappings associated with the enumeration.
|
|
217
|
-
*/
|
|
218
|
-
mappings: Map<string, string>;
|
|
256
|
+
export type ImportType = { Remote: string } | { Local: string };
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Represents the front matter data of a markdown file.
|
|
260
|
+
*/
|
|
261
|
+
export interface FrontMatter {
|
|
219
262
|
/**
|
|
220
|
-
*
|
|
263
|
+
* Identifier field of the model.
|
|
221
264
|
*/
|
|
222
|
-
|
|
265
|
+
id: string | undefined;
|
|
223
266
|
/**
|
|
224
|
-
*
|
|
267
|
+
* A boolean field with a default value, renamed from `id-field`.
|
|
225
268
|
*/
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Represents an object with a name, attributes, docstring, and an optional term.
|
|
231
|
-
*/
|
|
232
|
-
export interface Object {
|
|
269
|
+
"id-field"?: boolean;
|
|
233
270
|
/**
|
|
234
|
-
*
|
|
271
|
+
* Optional hashmap of prefixes.
|
|
235
272
|
*/
|
|
236
|
-
|
|
273
|
+
prefixes: Map<string, string> | undefined;
|
|
237
274
|
/**
|
|
238
|
-
*
|
|
275
|
+
* Optional namespace map.
|
|
239
276
|
*/
|
|
240
|
-
|
|
277
|
+
nsmap: Map<string, string> | undefined;
|
|
241
278
|
/**
|
|
242
|
-
*
|
|
279
|
+
* A string field with a default value representing the repository URL.
|
|
243
280
|
*/
|
|
244
|
-
|
|
281
|
+
repo?: string;
|
|
245
282
|
/**
|
|
246
|
-
*
|
|
283
|
+
* A string field with a default value representing the prefix.
|
|
247
284
|
*/
|
|
248
|
-
|
|
285
|
+
prefix?: string;
|
|
249
286
|
/**
|
|
250
|
-
*
|
|
287
|
+
* Import remote or local models.
|
|
251
288
|
*/
|
|
252
|
-
|
|
289
|
+
imports?: Map<string, ImportType>;
|
|
253
290
|
/**
|
|
254
|
-
*
|
|
291
|
+
* Allow empty models.
|
|
255
292
|
*/
|
|
256
|
-
|
|
293
|
+
"allow-empty"?: boolean;
|
|
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