mdmodels-core 0.2.8 → 0.2.10
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/mdmodels-core.d.ts +143 -143
- package/mdmodels-core_bg.js +78 -78
- package/mdmodels-core_bg.wasm +0 -0
- package/package.json +1 -1
package/mdmodels-core.d.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Converts the given markdown content into a specified template format.
|
|
5
5
|
*
|
|
6
6
|
* # Arguments
|
|
7
7
|
*
|
|
8
|
-
* * `
|
|
8
|
+
* * `markdown_content` - A string slice that holds the markdown content to be converted.
|
|
9
|
+
* * `template` - The template format to convert the markdown content into.
|
|
9
10
|
*
|
|
10
11
|
* # Returns
|
|
11
12
|
*
|
|
12
|
-
* A `
|
|
13
|
+
* A `Result` which is:
|
|
14
|
+
* - `Ok(String)` if the conversion is successful.
|
|
15
|
+
* - `Err(JsValue)` if there is an error during parsing or conversion.
|
|
13
16
|
*/
|
|
14
|
-
export function
|
|
17
|
+
export function convert_to(markdown_content: string, template: Templates): string;
|
|
15
18
|
/**
|
|
16
|
-
*
|
|
19
|
+
* Validates the given markdown content and returns the validation result as a `Validator`.
|
|
17
20
|
*
|
|
18
21
|
* # Arguments
|
|
19
22
|
*
|
|
20
|
-
* * `markdown_content` - A string slice that holds the markdown content to be
|
|
21
|
-
* * `root` - The root object to use for the schema.
|
|
22
|
-
* * `openai` - Whether to remove options from the schema properties. OpenAI does not support options.
|
|
23
|
+
* * `markdown_content` - A string slice that holds the markdown content to be validated.
|
|
23
24
|
*
|
|
24
25
|
* # Returns
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
* - `Ok(JsValue)` if the conversion is successful.
|
|
28
|
-
* - `Err(JsValue)` if there is an error during parsing or conversion.
|
|
27
|
+
* Either an empty `Validator` or an error `Validator`.
|
|
29
28
|
*/
|
|
30
|
-
export function
|
|
29
|
+
export function validate(markdown_content: string): Validator;
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
31
|
+
* Parses the given markdown content into a `DataModel` and returns it as a `JsValue`.
|
|
33
32
|
*
|
|
34
33
|
* # Arguments
|
|
35
34
|
*
|
|
36
|
-
* * `markdown_content` - A string slice that holds the markdown content to be
|
|
35
|
+
* * `markdown_content` - A string slice that holds the markdown content to be parsed.
|
|
37
36
|
*
|
|
38
37
|
* # Returns
|
|
39
38
|
*
|
|
40
|
-
*
|
|
39
|
+
* A `DataModel` or an error `JsError`.
|
|
41
40
|
*/
|
|
42
|
-
export function
|
|
41
|
+
export function parse_model(markdown_content: string): DataModel;
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
43
|
+
* Returns the JSON schema for the given markdown content.
|
|
45
44
|
*
|
|
46
45
|
* # Arguments
|
|
47
46
|
*
|
|
48
47
|
* * `markdown_content` - A string slice that holds the markdown content to be converted.
|
|
49
|
-
* * `
|
|
48
|
+
* * `root` - The root object to use for the schema.
|
|
49
|
+
* * `openai` - Whether to remove options from the schema properties. OpenAI does not support options.
|
|
50
50
|
*
|
|
51
51
|
* # Returns
|
|
52
52
|
*
|
|
53
53
|
* A `Result` which is:
|
|
54
|
-
* - `Ok(
|
|
54
|
+
* - `Ok(JsValue)` if the conversion is successful.
|
|
55
55
|
* - `Err(JsValue)` if there is an error during parsing or conversion.
|
|
56
56
|
*/
|
|
57
|
-
export function
|
|
57
|
+
export function json_schema(markdown_content: string, root: string | undefined, openai: boolean): string;
|
|
58
58
|
/**
|
|
59
|
-
* Parses the given
|
|
59
|
+
* Parses the given JSON schema string into a `DataModel`.
|
|
60
60
|
*
|
|
61
61
|
* # Arguments
|
|
62
62
|
*
|
|
63
|
-
* * `
|
|
63
|
+
* * `json_schema` - A string slice that holds the JSON schema to be parsed.
|
|
64
64
|
*
|
|
65
65
|
* # Returns
|
|
66
66
|
*
|
|
67
|
-
* A `
|
|
67
|
+
* A `String` or an error `JsError`.
|
|
68
68
|
*/
|
|
69
|
-
export function
|
|
69
|
+
export function from_json_schema(json_schema: any): string;
|
|
70
70
|
/**
|
|
71
71
|
* Enumeration of available templates.
|
|
72
72
|
*/
|
|
@@ -164,93 +164,6 @@ export enum Templates {
|
|
|
164
164
|
*/
|
|
165
165
|
Mermaid = 22,
|
|
166
166
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Represents an XML type, either an attribute or an element.
|
|
169
|
-
*/
|
|
170
|
-
export type XMLType = { Attribute: { is_attr: boolean; name: string } } | { Element: { is_attr: boolean; name: string } } | { Wrapped: { is_attr: boolean; name: string; wrapped: string[] | undefined } };
|
|
171
|
-
|
|
172
|
-
export interface PositionRange {
|
|
173
|
-
start: number;
|
|
174
|
-
end: number;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export interface Position {
|
|
178
|
-
line: number;
|
|
179
|
-
column: PositionRange;
|
|
180
|
-
offset: PositionRange;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Validator for checking the integrity of a data model.
|
|
185
|
-
*/
|
|
186
|
-
export interface Validator {
|
|
187
|
-
is_valid: boolean;
|
|
188
|
-
errors: ValidationError[];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Represents a validation error in the data model.
|
|
193
|
-
*/
|
|
194
|
-
export interface ValidationError {
|
|
195
|
-
message: string;
|
|
196
|
-
object: string | undefined;
|
|
197
|
-
attribute: string | undefined;
|
|
198
|
-
location: string;
|
|
199
|
-
solution: string | undefined;
|
|
200
|
-
error_type: ErrorType;
|
|
201
|
-
positions: Position[];
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Enum representing the type of validation error.
|
|
206
|
-
*/
|
|
207
|
-
export type ErrorType = "NameError" | "TypeError" | "DuplicateError" | "GlobalError" | "XMLError" | "ObjectError";
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Represents the front matter data of a markdown file.
|
|
211
|
-
*/
|
|
212
|
-
export interface FrontMatter {
|
|
213
|
-
/**
|
|
214
|
-
* Identifier field of the model.
|
|
215
|
-
*/
|
|
216
|
-
id: string | undefined;
|
|
217
|
-
/**
|
|
218
|
-
* A boolean field with a default value, renamed from `id-field`.
|
|
219
|
-
*/
|
|
220
|
-
"id-field"?: boolean;
|
|
221
|
-
/**
|
|
222
|
-
* Optional hashmap of prefixes.
|
|
223
|
-
*/
|
|
224
|
-
prefixes: Map<string, string> | undefined;
|
|
225
|
-
/**
|
|
226
|
-
* Optional namespace map.
|
|
227
|
-
*/
|
|
228
|
-
nsmap: Map<string, string> | undefined;
|
|
229
|
-
/**
|
|
230
|
-
* A string field with a default value representing the repository URL.
|
|
231
|
-
*/
|
|
232
|
-
repo?: string;
|
|
233
|
-
/**
|
|
234
|
-
* A string field with a default value representing the prefix.
|
|
235
|
-
*/
|
|
236
|
-
prefix?: string;
|
|
237
|
-
/**
|
|
238
|
-
* Import remote or local models.
|
|
239
|
-
*/
|
|
240
|
-
imports?: Map<string, ImportType>;
|
|
241
|
-
/**
|
|
242
|
-
* Allow empty models.
|
|
243
|
-
*/
|
|
244
|
-
"allow-empty"?: boolean;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Represents different types of model imports.
|
|
249
|
-
*
|
|
250
|
-
* Can be either a remote URL or a local file path.
|
|
251
|
-
*/
|
|
252
|
-
export type ImportType = { Remote: string } | { Local: string };
|
|
253
|
-
|
|
254
167
|
/**
|
|
255
168
|
* Represents an attribute with various properties and options.
|
|
256
169
|
*/
|
|
@@ -312,45 +225,31 @@ export interface Attribute {
|
|
|
312
225
|
export type DataType = { Boolean: boolean } | { Integer: number } | { Float: number } | { String: string };
|
|
313
226
|
|
|
314
227
|
/**
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* This struct provides a simple string-based representation of options,
|
|
318
|
-
* which is useful for serialization/deserialization and when working
|
|
319
|
-
* with untyped data.
|
|
228
|
+
* Validator for checking the integrity of a data model.
|
|
320
229
|
*/
|
|
321
|
-
export interface
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
*/
|
|
325
|
-
key: string;
|
|
326
|
-
/**
|
|
327
|
-
* The string value of the option
|
|
328
|
-
*/
|
|
329
|
-
value: string;
|
|
230
|
+
export interface Validator {
|
|
231
|
+
is_valid: boolean;
|
|
232
|
+
errors: ValidationError[];
|
|
330
233
|
}
|
|
331
234
|
|
|
332
235
|
/**
|
|
333
|
-
* Represents
|
|
334
|
-
*
|
|
335
|
-
* This enum provides a strongly-typed representation of various attribute options
|
|
336
|
-
* that can be used to configure and constrain attributes in a data model.
|
|
337
|
-
*
|
|
338
|
-
* The options are grouped into several categories:
|
|
339
|
-
* - JSON Schema validation options (e.g., minimum/maximum values, length constraints)
|
|
340
|
-
* - SQL database options (e.g., primary key)
|
|
341
|
-
* - LinkML specific options (e.g., readonly, recommended)
|
|
342
|
-
* - Custom options via the `Other` variant
|
|
343
|
-
*
|
|
236
|
+
* Represents a validation error in the data model.
|
|
344
237
|
*/
|
|
345
|
-
export
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
238
|
+
export interface ValidationError {
|
|
239
|
+
message: string;
|
|
240
|
+
object: string | undefined;
|
|
241
|
+
attribute: string | undefined;
|
|
242
|
+
location: string;
|
|
243
|
+
solution: string | undefined;
|
|
244
|
+
error_type: ErrorType;
|
|
245
|
+
positions: Position[];
|
|
352
246
|
}
|
|
353
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Enum representing the type of validation error.
|
|
250
|
+
*/
|
|
251
|
+
export type ErrorType = "NameError" | "TypeError" | "DuplicateError" | "GlobalError" | "XMLError" | "ObjectError";
|
|
252
|
+
|
|
354
253
|
/**
|
|
355
254
|
* Represents an enumeration with a name and mappings.
|
|
356
255
|
*/
|
|
@@ -403,3 +302,104 @@ export interface Object {
|
|
|
403
302
|
position?: Position;
|
|
404
303
|
}
|
|
405
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Represents an option for an attribute in a data model.
|
|
307
|
+
*
|
|
308
|
+
* This enum provides a strongly-typed representation of various attribute options
|
|
309
|
+
* that can be used to configure and constrain attributes in a data model.
|
|
310
|
+
*
|
|
311
|
+
* The options are grouped into several categories:
|
|
312
|
+
* - JSON Schema validation options (e.g., minimum/maximum values, length constraints)
|
|
313
|
+
* - SQL database options (e.g., primary key)
|
|
314
|
+
* - LinkML specific options (e.g., readonly, recommended)
|
|
315
|
+
* - Custom options via the `Other` variant
|
|
316
|
+
*
|
|
317
|
+
*/
|
|
318
|
+
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 } };
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* A raw key-value representation of an attribute option.
|
|
322
|
+
*
|
|
323
|
+
* This struct provides a simple string-based representation of options,
|
|
324
|
+
* which is useful for serialization/deserialization and when working
|
|
325
|
+
* with untyped data.
|
|
326
|
+
*/
|
|
327
|
+
export interface RawOption {
|
|
328
|
+
/**
|
|
329
|
+
* The key/name of the option
|
|
330
|
+
*/
|
|
331
|
+
key: string;
|
|
332
|
+
/**
|
|
333
|
+
* The string value of the option
|
|
334
|
+
*/
|
|
335
|
+
value: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Represents an XML type, either an attribute or an element.
|
|
340
|
+
*/
|
|
341
|
+
export type XMLType = { Attribute: { is_attr: boolean; name: string } } | { Element: { is_attr: boolean; name: string } } | { Wrapped: { is_attr: boolean; name: string; wrapped: string[] | undefined } };
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Represents the front matter data of a markdown file.
|
|
345
|
+
*/
|
|
346
|
+
export interface FrontMatter {
|
|
347
|
+
/**
|
|
348
|
+
* Identifier field of the model.
|
|
349
|
+
*/
|
|
350
|
+
id: string | undefined;
|
|
351
|
+
/**
|
|
352
|
+
* A boolean field with a default value, renamed from `id-field`.
|
|
353
|
+
*/
|
|
354
|
+
"id-field"?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Optional hashmap of prefixes.
|
|
357
|
+
*/
|
|
358
|
+
prefixes: Map<string, string> | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* Optional namespace map.
|
|
361
|
+
*/
|
|
362
|
+
nsmap: Map<string, string> | undefined;
|
|
363
|
+
/**
|
|
364
|
+
* A string field with a default value representing the repository URL.
|
|
365
|
+
*/
|
|
366
|
+
repo?: string;
|
|
367
|
+
/**
|
|
368
|
+
* A string field with a default value representing the prefix.
|
|
369
|
+
*/
|
|
370
|
+
prefix?: string;
|
|
371
|
+
/**
|
|
372
|
+
* Import remote or local models.
|
|
373
|
+
*/
|
|
374
|
+
imports?: Map<string, ImportType>;
|
|
375
|
+
/**
|
|
376
|
+
* Allow empty models.
|
|
377
|
+
*/
|
|
378
|
+
"allow-empty"?: boolean;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Represents different types of model imports.
|
|
383
|
+
*
|
|
384
|
+
* Can be either a remote URL or a local file path.
|
|
385
|
+
*/
|
|
386
|
+
export type ImportType = { Remote: string } | { Local: string };
|
|
387
|
+
|
|
388
|
+
export interface Position {
|
|
389
|
+
line: number;
|
|
390
|
+
column: PositionRange;
|
|
391
|
+
offset: PositionRange;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface PositionRange {
|
|
395
|
+
start: number;
|
|
396
|
+
end: number;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export interface DataModel {
|
|
400
|
+
name?: string;
|
|
401
|
+
objects: Object[];
|
|
402
|
+
enums: Enumeration[];
|
|
403
|
+
config?: FrontMatter;
|
|
404
|
+
}
|
|
405
|
+
|
package/mdmodels-core_bg.js
CHANGED
|
@@ -181,76 +181,40 @@ function takeFromExternrefTable0(idx) {
|
|
|
181
181
|
return value;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* # Arguments
|
|
187
|
-
*
|
|
188
|
-
* * `json_schema` - A string slice that holds the JSON schema to be parsed.
|
|
189
|
-
*
|
|
190
|
-
* # Returns
|
|
191
|
-
*
|
|
192
|
-
* A `String` or an error `JsError`.
|
|
193
|
-
* @param {any} json_schema
|
|
194
|
-
* @returns {string}
|
|
195
|
-
*/
|
|
196
|
-
export function from_json_schema(json_schema) {
|
|
197
|
-
let deferred2_0;
|
|
198
|
-
let deferred2_1;
|
|
199
|
-
try {
|
|
200
|
-
const ret = wasm.from_json_schema(json_schema);
|
|
201
|
-
var ptr1 = ret[0];
|
|
202
|
-
var len1 = ret[1];
|
|
203
|
-
if (ret[3]) {
|
|
204
|
-
ptr1 = 0; len1 = 0;
|
|
205
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
206
|
-
}
|
|
207
|
-
deferred2_0 = ptr1;
|
|
208
|
-
deferred2_1 = len1;
|
|
209
|
-
return getStringFromWasm0(ptr1, len1);
|
|
210
|
-
} finally {
|
|
211
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Returns the JSON schema for the given markdown content.
|
|
184
|
+
* Converts the given markdown content into a specified template format.
|
|
217
185
|
*
|
|
218
186
|
* # Arguments
|
|
219
187
|
*
|
|
220
188
|
* * `markdown_content` - A string slice that holds the markdown content to be converted.
|
|
221
|
-
* * `
|
|
222
|
-
* * `openai` - Whether to remove options from the schema properties. OpenAI does not support options.
|
|
189
|
+
* * `template` - The template format to convert the markdown content into.
|
|
223
190
|
*
|
|
224
191
|
* # Returns
|
|
225
192
|
*
|
|
226
193
|
* A `Result` which is:
|
|
227
|
-
* - `Ok(
|
|
194
|
+
* - `Ok(String)` if the conversion is successful.
|
|
228
195
|
* - `Err(JsValue)` if there is an error during parsing or conversion.
|
|
229
196
|
* @param {string} markdown_content
|
|
230
|
-
* @param {
|
|
231
|
-
* @param {boolean} openai
|
|
197
|
+
* @param {Templates} template
|
|
232
198
|
* @returns {string}
|
|
233
199
|
*/
|
|
234
|
-
export function
|
|
235
|
-
let
|
|
236
|
-
let
|
|
200
|
+
export function convert_to(markdown_content, template) {
|
|
201
|
+
let deferred3_0;
|
|
202
|
+
let deferred3_1;
|
|
237
203
|
try {
|
|
238
204
|
const ptr0 = passStringToWasm0(markdown_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
239
205
|
const len0 = WASM_VECTOR_LEN;
|
|
240
|
-
|
|
241
|
-
var
|
|
242
|
-
|
|
243
|
-
var ptr3 = ret[0];
|
|
244
|
-
var len3 = ret[1];
|
|
206
|
+
const ret = wasm.convert_to(ptr0, len0, template);
|
|
207
|
+
var ptr2 = ret[0];
|
|
208
|
+
var len2 = ret[1];
|
|
245
209
|
if (ret[3]) {
|
|
246
|
-
|
|
210
|
+
ptr2 = 0; len2 = 0;
|
|
247
211
|
throw takeFromExternrefTable0(ret[2]);
|
|
248
212
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
return getStringFromWasm0(
|
|
213
|
+
deferred3_0 = ptr2;
|
|
214
|
+
deferred3_1 = len2;
|
|
215
|
+
return getStringFromWasm0(ptr2, len2);
|
|
252
216
|
} finally {
|
|
253
|
-
wasm.__wbindgen_free(
|
|
217
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
254
218
|
}
|
|
255
219
|
}
|
|
256
220
|
|
|
@@ -275,64 +239,100 @@ export function validate(markdown_content) {
|
|
|
275
239
|
}
|
|
276
240
|
|
|
277
241
|
/**
|
|
278
|
-
*
|
|
242
|
+
* Parses the given markdown content into a `DataModel` and returns it as a `JsValue`.
|
|
243
|
+
*
|
|
244
|
+
* # Arguments
|
|
245
|
+
*
|
|
246
|
+
* * `markdown_content` - A string slice that holds the markdown content to be parsed.
|
|
247
|
+
*
|
|
248
|
+
* # Returns
|
|
249
|
+
*
|
|
250
|
+
* A `DataModel` or an error `JsError`.
|
|
251
|
+
* @param {string} markdown_content
|
|
252
|
+
* @returns {DataModel}
|
|
253
|
+
*/
|
|
254
|
+
export function parse_model(markdown_content) {
|
|
255
|
+
const ptr0 = passStringToWasm0(markdown_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
256
|
+
const len0 = WASM_VECTOR_LEN;
|
|
257
|
+
const ret = wasm.parse_model(ptr0, len0);
|
|
258
|
+
if (ret[2]) {
|
|
259
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
260
|
+
}
|
|
261
|
+
return takeFromExternrefTable0(ret[0]);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Returns the JSON schema for the given markdown content.
|
|
279
266
|
*
|
|
280
267
|
* # Arguments
|
|
281
268
|
*
|
|
282
269
|
* * `markdown_content` - A string slice that holds the markdown content to be converted.
|
|
283
|
-
* * `
|
|
270
|
+
* * `root` - The root object to use for the schema.
|
|
271
|
+
* * `openai` - Whether to remove options from the schema properties. OpenAI does not support options.
|
|
284
272
|
*
|
|
285
273
|
* # Returns
|
|
286
274
|
*
|
|
287
275
|
* A `Result` which is:
|
|
288
|
-
* - `Ok(
|
|
276
|
+
* - `Ok(JsValue)` if the conversion is successful.
|
|
289
277
|
* - `Err(JsValue)` if there is an error during parsing or conversion.
|
|
290
278
|
* @param {string} markdown_content
|
|
291
|
-
* @param {
|
|
279
|
+
* @param {string | undefined} root
|
|
280
|
+
* @param {boolean} openai
|
|
292
281
|
* @returns {string}
|
|
293
282
|
*/
|
|
294
|
-
export function
|
|
295
|
-
let
|
|
296
|
-
let
|
|
283
|
+
export function json_schema(markdown_content, root, openai) {
|
|
284
|
+
let deferred4_0;
|
|
285
|
+
let deferred4_1;
|
|
297
286
|
try {
|
|
298
287
|
const ptr0 = passStringToWasm0(markdown_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
299
288
|
const len0 = WASM_VECTOR_LEN;
|
|
300
|
-
|
|
301
|
-
var
|
|
302
|
-
|
|
289
|
+
var ptr1 = isLikeNone(root) ? 0 : passStringToWasm0(root, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
290
|
+
var len1 = WASM_VECTOR_LEN;
|
|
291
|
+
const ret = wasm.json_schema(ptr0, len0, ptr1, len1, openai);
|
|
292
|
+
var ptr3 = ret[0];
|
|
293
|
+
var len3 = ret[1];
|
|
303
294
|
if (ret[3]) {
|
|
304
|
-
|
|
295
|
+
ptr3 = 0; len3 = 0;
|
|
305
296
|
throw takeFromExternrefTable0(ret[2]);
|
|
306
297
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
return getStringFromWasm0(
|
|
298
|
+
deferred4_0 = ptr3;
|
|
299
|
+
deferred4_1 = len3;
|
|
300
|
+
return getStringFromWasm0(ptr3, len3);
|
|
310
301
|
} finally {
|
|
311
|
-
wasm.__wbindgen_free(
|
|
302
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
312
303
|
}
|
|
313
304
|
}
|
|
314
305
|
|
|
315
306
|
/**
|
|
316
|
-
* Parses the given
|
|
307
|
+
* Parses the given JSON schema string into a `DataModel`.
|
|
317
308
|
*
|
|
318
309
|
* # Arguments
|
|
319
310
|
*
|
|
320
|
-
* * `
|
|
311
|
+
* * `json_schema` - A string slice that holds the JSON schema to be parsed.
|
|
321
312
|
*
|
|
322
313
|
* # Returns
|
|
323
314
|
*
|
|
324
|
-
* A `
|
|
325
|
-
* @param {
|
|
326
|
-
* @returns {
|
|
315
|
+
* A `String` or an error `JsError`.
|
|
316
|
+
* @param {any} json_schema
|
|
317
|
+
* @returns {string}
|
|
327
318
|
*/
|
|
328
|
-
export function
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
319
|
+
export function from_json_schema(json_schema) {
|
|
320
|
+
let deferred2_0;
|
|
321
|
+
let deferred2_1;
|
|
322
|
+
try {
|
|
323
|
+
const ret = wasm.from_json_schema(json_schema);
|
|
324
|
+
var ptr1 = ret[0];
|
|
325
|
+
var len1 = ret[1];
|
|
326
|
+
if (ret[3]) {
|
|
327
|
+
ptr1 = 0; len1 = 0;
|
|
328
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
329
|
+
}
|
|
330
|
+
deferred2_0 = ptr1;
|
|
331
|
+
deferred2_1 = len1;
|
|
332
|
+
return getStringFromWasm0(ptr1, len1);
|
|
333
|
+
} finally {
|
|
334
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
334
335
|
}
|
|
335
|
-
return takeFromExternrefTable0(ret[0]);
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
/**
|
package/mdmodels-core_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED