@offenedatenmodellierung/data-modelling-sdk 2.0.3 → 2.0.5
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/data_modelling_wasm.d.ts +139 -2
- package/data_modelling_wasm.js +248 -11
- package/data_modelling_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/data_modelling_wasm.d.ts
CHANGED
|
@@ -603,6 +603,42 @@ export function export_odcs_yaml_to_markdown(odcs_yaml: string): string;
|
|
|
603
603
|
*/
|
|
604
604
|
export function export_odcs_yaml_to_pdf(odcs_yaml: string, branding_json?: string | null): string;
|
|
605
605
|
|
|
606
|
+
/**
|
|
607
|
+
* Export an ODCSContract JSON to ODCS YAML format (v2 API).
|
|
608
|
+
*
|
|
609
|
+
* This is the preferred v2 API that directly serializes an ODCSContract struct,
|
|
610
|
+
* preserving all metadata and nested structures without reconstruction.
|
|
611
|
+
*
|
|
612
|
+
* Unlike `export_to_odcs_yaml` which takes a workspace and reconstructs the ODCS
|
|
613
|
+
* structure, this function directly serializes the provided contract.
|
|
614
|
+
*
|
|
615
|
+
* # Arguments
|
|
616
|
+
*
|
|
617
|
+
* * `contract_json` - JSON string containing ODCSContract object
|
|
618
|
+
*
|
|
619
|
+
* # Returns
|
|
620
|
+
*
|
|
621
|
+
* ODCS YAML format string, or JsValue error
|
|
622
|
+
*
|
|
623
|
+
* # Example
|
|
624
|
+
*
|
|
625
|
+
* ```javascript
|
|
626
|
+
* const contract = {
|
|
627
|
+
* apiVersion: "v3.1.0",
|
|
628
|
+
* kind: "DataContract",
|
|
629
|
+
* name: "My Contract",
|
|
630
|
+
* schema: [{
|
|
631
|
+
* name: "users",
|
|
632
|
+
* properties: [
|
|
633
|
+
* { name: "id", logicalType: "integer", primaryKey: true }
|
|
634
|
+
* ]
|
|
635
|
+
* }]
|
|
636
|
+
* };
|
|
637
|
+
* const yaml = export_odcs_yaml_v2(JSON.stringify(contract));
|
|
638
|
+
* ```
|
|
639
|
+
*/
|
|
640
|
+
export function export_odcs_yaml_v2(contract_json: string): string;
|
|
641
|
+
|
|
606
642
|
/**
|
|
607
643
|
* Export an ODPS Data Product to Markdown format.
|
|
608
644
|
*
|
|
@@ -1103,6 +1139,41 @@ export function load_model(db_name: string, store_name: string, workspace_path:
|
|
|
1103
1139
|
*/
|
|
1104
1140
|
export function migrate_dataflow_to_domain(dataflow_yaml: string, domain_name?: string | null): string;
|
|
1105
1141
|
|
|
1142
|
+
/**
|
|
1143
|
+
* Convert an ODCSContract to TableData format for UI rendering (v2 API).
|
|
1144
|
+
*
|
|
1145
|
+
* This function converts an ODCSContract to TableData format, which includes
|
|
1146
|
+
* all the metadata needed for UI rendering (similar to ImportResult.tables).
|
|
1147
|
+
*
|
|
1148
|
+
* # Arguments
|
|
1149
|
+
*
|
|
1150
|
+
* * `contract_json` - JSON string containing ODCSContract object
|
|
1151
|
+
*
|
|
1152
|
+
* # Returns
|
|
1153
|
+
*
|
|
1154
|
+
* JSON string containing array of TableData objects, or JsValue error
|
|
1155
|
+
*/
|
|
1156
|
+
export function odcs_contract_to_table_data(contract_json: string): string;
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Convert an ODCSContract to Table/Column format (v2 API).
|
|
1160
|
+
*
|
|
1161
|
+
* This function converts an ODCSContract to the traditional Table/Column
|
|
1162
|
+
* format used by the v1 API. Useful for interoperability with existing code.
|
|
1163
|
+
*
|
|
1164
|
+
* Note: This conversion may lose some metadata that doesn't fit in Table/Column.
|
|
1165
|
+
* For lossless round-trip, use `parse_odcs_yaml_v2` and `export_odcs_yaml_v2`.
|
|
1166
|
+
*
|
|
1167
|
+
* # Arguments
|
|
1168
|
+
*
|
|
1169
|
+
* * `contract_json` - JSON string containing ODCSContract object
|
|
1170
|
+
*
|
|
1171
|
+
* # Returns
|
|
1172
|
+
*
|
|
1173
|
+
* JSON string containing array of Table objects, or JsValue error
|
|
1174
|
+
*/
|
|
1175
|
+
export function odcs_contract_to_tables(contract_json: string): string;
|
|
1176
|
+
|
|
1106
1177
|
/**
|
|
1107
1178
|
* Parse a decisions index YAML file and return a structured representation.
|
|
1108
1179
|
*
|
|
@@ -1200,6 +1271,48 @@ export function parse_odcl_yaml(yaml_content: string): string;
|
|
|
1200
1271
|
*/
|
|
1201
1272
|
export function parse_odcs_yaml(yaml_content: string): string;
|
|
1202
1273
|
|
|
1274
|
+
/**
|
|
1275
|
+
* Parse ODCS YAML content and return an ODCSContract JSON representation (v2 API).
|
|
1276
|
+
*
|
|
1277
|
+
* This is the preferred v2 API that returns the native ODCSContract structure,
|
|
1278
|
+
* preserving all ODCS metadata, nested properties, and multi-table support.
|
|
1279
|
+
*
|
|
1280
|
+
* Unlike `parse_odcs_yaml` which flattens to Table/Column types, this function
|
|
1281
|
+
* returns the full ODCSContract with:
|
|
1282
|
+
* - All contract-level fields (apiVersion, domain, team, etc.)
|
|
1283
|
+
* - Multiple schema objects (tables) preserved
|
|
1284
|
+
* - Nested properties (OBJECT/ARRAY types) preserved hierarchically
|
|
1285
|
+
* - All custom properties at each level
|
|
1286
|
+
*
|
|
1287
|
+
* # Arguments
|
|
1288
|
+
*
|
|
1289
|
+
* * `yaml_content` - ODCS YAML content as a string
|
|
1290
|
+
*
|
|
1291
|
+
* # Returns
|
|
1292
|
+
*
|
|
1293
|
+
* JSON string containing ODCSContract object, or JsValue error
|
|
1294
|
+
*
|
|
1295
|
+
* # Example Response
|
|
1296
|
+
*
|
|
1297
|
+
* ```json
|
|
1298
|
+
* {
|
|
1299
|
+
* "apiVersion": "v3.1.0",
|
|
1300
|
+
* "kind": "DataContract",
|
|
1301
|
+
* "name": "My Contract",
|
|
1302
|
+
* "schema": [
|
|
1303
|
+
* {
|
|
1304
|
+
* "name": "users",
|
|
1305
|
+
* "properties": [
|
|
1306
|
+
* { "name": "id", "logicalType": "integer", "primaryKey": true },
|
|
1307
|
+
* { "name": "address", "logicalType": "object", "properties": [...] }
|
|
1308
|
+
* ]
|
|
1309
|
+
* }
|
|
1310
|
+
* ]
|
|
1311
|
+
* }
|
|
1312
|
+
* ```
|
|
1313
|
+
*/
|
|
1314
|
+
export function parse_odcs_yaml_v2(yaml_content: string): string;
|
|
1315
|
+
|
|
1203
1316
|
/**
|
|
1204
1317
|
* Parse a tag string into a Tag enum.
|
|
1205
1318
|
*
|
|
@@ -1339,6 +1452,25 @@ export function search_knowledge_articles(articles_json: string, query: string):
|
|
|
1339
1452
|
*/
|
|
1340
1453
|
export function serialize_tag(tag_json: string): string;
|
|
1341
1454
|
|
|
1455
|
+
/**
|
|
1456
|
+
* Convert Tables to an ODCSContract (v2 API).
|
|
1457
|
+
*
|
|
1458
|
+
* This function converts traditional Table/Column format to an ODCSContract.
|
|
1459
|
+
* Useful for migrating existing code to the v2 API.
|
|
1460
|
+
*
|
|
1461
|
+
* Note: The resulting contract will have default values for fields that
|
|
1462
|
+
* don't exist in Table/Column format.
|
|
1463
|
+
*
|
|
1464
|
+
* # Arguments
|
|
1465
|
+
*
|
|
1466
|
+
* * `tables_json` - JSON string containing array of Table objects
|
|
1467
|
+
*
|
|
1468
|
+
* # Returns
|
|
1469
|
+
*
|
|
1470
|
+
* JSON string containing ODCSContract object, or JsValue error
|
|
1471
|
+
*/
|
|
1472
|
+
export function tables_to_odcs_contract(tables_json: string): string;
|
|
1473
|
+
|
|
1342
1474
|
/**
|
|
1343
1475
|
* Update domain config with new view positions.
|
|
1344
1476
|
*
|
|
@@ -1504,6 +1636,7 @@ export interface InitOutput {
|
|
|
1504
1636
|
readonly export_markdown_to_pdf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
1505
1637
|
readonly export_odcs_yaml_to_markdown: (a: number, b: number) => [number, number, number, number];
|
|
1506
1638
|
readonly export_odcs_yaml_to_pdf: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
1639
|
+
readonly export_odcs_yaml_v2: (a: number, b: number) => [number, number, number, number];
|
|
1507
1640
|
readonly export_odps_to_markdown: (a: number, b: number) => [number, number, number, number];
|
|
1508
1641
|
readonly export_odps_to_pdf: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
1509
1642
|
readonly export_odps_yaml_to_markdown: (a: number, b: number) => [number, number, number, number];
|
|
@@ -1541,6 +1674,8 @@ export interface InitOutput {
|
|
|
1541
1674
|
readonly is_odcl_format: (a: number, b: number) => number;
|
|
1542
1675
|
readonly load_model: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
1543
1676
|
readonly migrate_dataflow_to_domain: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
1677
|
+
readonly odcs_contract_to_table_data: (a: number, b: number) => [number, number, number, number];
|
|
1678
|
+
readonly odcs_contract_to_tables: (a: number, b: number) => [number, number, number, number];
|
|
1544
1679
|
readonly parse_decision_index_yaml: (a: number, b: number) => [number, number, number, number];
|
|
1545
1680
|
readonly parse_decision_yaml: (a: number, b: number) => [number, number, number, number];
|
|
1546
1681
|
readonly parse_domain_config_yaml: (a: number, b: number) => [number, number, number, number];
|
|
@@ -1548,6 +1683,7 @@ export interface InitOutput {
|
|
|
1548
1683
|
readonly parse_knowledge_yaml: (a: number, b: number) => [number, number, number, number];
|
|
1549
1684
|
readonly parse_odcl_yaml: (a: number, b: number) => [number, number, number, number];
|
|
1550
1685
|
readonly parse_odcs_yaml: (a: number, b: number) => [number, number, number, number];
|
|
1686
|
+
readonly parse_odcs_yaml_v2: (a: number, b: number) => [number, number, number, number];
|
|
1551
1687
|
readonly parse_tag: (a: number, b: number) => [number, number, number, number];
|
|
1552
1688
|
readonly parse_workspace_yaml: (a: number, b: number) => [number, number, number, number];
|
|
1553
1689
|
readonly remove_domain_from_workspace: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
@@ -1558,6 +1694,7 @@ export interface InitOutput {
|
|
|
1558
1694
|
readonly save_model: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
1559
1695
|
readonly search_knowledge_articles: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
1560
1696
|
readonly serialize_tag: (a: number, b: number) => [number, number, number, number];
|
|
1697
|
+
readonly tables_to_odcs_contract: (a: number, b: number) => [number, number, number, number];
|
|
1561
1698
|
readonly update_domain_view_positions: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
1562
1699
|
readonly validate_column_name: (a: number, b: number) => [number, number, number, number];
|
|
1563
1700
|
readonly validate_data_type: (a: number, b: number) => [number, number, number, number];
|
|
@@ -1567,10 +1704,10 @@ export interface InitOutput {
|
|
|
1567
1704
|
readonly validate_pattern_exclusivity: (a: number, b: number) => [number, number, number, number];
|
|
1568
1705
|
readonly validate_table_name: (a: number, b: number) => [number, number, number, number];
|
|
1569
1706
|
readonly validate_uuid: (a: number, b: number) => [number, number, number, number];
|
|
1570
|
-
readonly wasm_bindgen__convert__closures________invoke__hed2faeb3ab5b0e39: (a: number, b: number, c: any) => void;
|
|
1571
|
-
readonly wasm_bindgen__closure__destroy__h6cea484f8d09c363: (a: number, b: number) => void;
|
|
1572
1707
|
readonly wasm_bindgen__convert__closures_____invoke__h3aa4f50d9cb64e36: (a: number, b: number, c: any) => void;
|
|
1573
1708
|
readonly wasm_bindgen__closure__destroy__he59d4bc392497fcb: (a: number, b: number) => void;
|
|
1709
|
+
readonly wasm_bindgen__convert__closures________invoke__hf1e66acfb4f5ea29: (a: number, b: number, c: any) => void;
|
|
1710
|
+
readonly wasm_bindgen__closure__destroy__hb559389f482bae0b: (a: number, b: number) => void;
|
|
1574
1711
|
readonly wasm_bindgen__convert__closures_____invoke__h7a1f4b234d01e50d: (a: number, b: number, c: any, d: any) => void;
|
|
1575
1712
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
1576
1713
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
package/data_modelling_wasm.js
CHANGED
|
@@ -214,14 +214,14 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
214
214
|
|
|
215
215
|
let WASM_VECTOR_LEN = 0;
|
|
216
216
|
|
|
217
|
-
function wasm_bindgen__convert__closures________invoke__hed2faeb3ab5b0e39(arg0, arg1, arg2) {
|
|
218
|
-
wasm.wasm_bindgen__convert__closures________invoke__hed2faeb3ab5b0e39(arg0, arg1, arg2);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
217
|
function wasm_bindgen__convert__closures_____invoke__h3aa4f50d9cb64e36(arg0, arg1, arg2) {
|
|
222
218
|
wasm.wasm_bindgen__convert__closures_____invoke__h3aa4f50d9cb64e36(arg0, arg1, arg2);
|
|
223
219
|
}
|
|
224
220
|
|
|
221
|
+
function wasm_bindgen__convert__closures________invoke__hf1e66acfb4f5ea29(arg0, arg1, arg2) {
|
|
222
|
+
wasm.wasm_bindgen__convert__closures________invoke__hf1e66acfb4f5ea29(arg0, arg1, arg2);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
225
|
function wasm_bindgen__convert__closures_____invoke__h7a1f4b234d01e50d(arg0, arg1, arg2, arg3) {
|
|
226
226
|
wasm.wasm_bindgen__convert__closures_____invoke__h7a1f4b234d01e50d(arg0, arg1, arg2, arg3);
|
|
227
227
|
}
|
|
@@ -1831,6 +1831,63 @@ export function export_odcs_yaml_to_pdf(odcs_yaml, branding_json) {
|
|
|
1831
1831
|
}
|
|
1832
1832
|
}
|
|
1833
1833
|
|
|
1834
|
+
/**
|
|
1835
|
+
* Export an ODCSContract JSON to ODCS YAML format (v2 API).
|
|
1836
|
+
*
|
|
1837
|
+
* This is the preferred v2 API that directly serializes an ODCSContract struct,
|
|
1838
|
+
* preserving all metadata and nested structures without reconstruction.
|
|
1839
|
+
*
|
|
1840
|
+
* Unlike `export_to_odcs_yaml` which takes a workspace and reconstructs the ODCS
|
|
1841
|
+
* structure, this function directly serializes the provided contract.
|
|
1842
|
+
*
|
|
1843
|
+
* # Arguments
|
|
1844
|
+
*
|
|
1845
|
+
* * `contract_json` - JSON string containing ODCSContract object
|
|
1846
|
+
*
|
|
1847
|
+
* # Returns
|
|
1848
|
+
*
|
|
1849
|
+
* ODCS YAML format string, or JsValue error
|
|
1850
|
+
*
|
|
1851
|
+
* # Example
|
|
1852
|
+
*
|
|
1853
|
+
* ```javascript
|
|
1854
|
+
* const contract = {
|
|
1855
|
+
* apiVersion: "v3.1.0",
|
|
1856
|
+
* kind: "DataContract",
|
|
1857
|
+
* name: "My Contract",
|
|
1858
|
+
* schema: [{
|
|
1859
|
+
* name: "users",
|
|
1860
|
+
* properties: [
|
|
1861
|
+
* { name: "id", logicalType: "integer", primaryKey: true }
|
|
1862
|
+
* ]
|
|
1863
|
+
* }]
|
|
1864
|
+
* };
|
|
1865
|
+
* const yaml = export_odcs_yaml_v2(JSON.stringify(contract));
|
|
1866
|
+
* ```
|
|
1867
|
+
* @param {string} contract_json
|
|
1868
|
+
* @returns {string}
|
|
1869
|
+
*/
|
|
1870
|
+
export function export_odcs_yaml_v2(contract_json) {
|
|
1871
|
+
let deferred3_0;
|
|
1872
|
+
let deferred3_1;
|
|
1873
|
+
try {
|
|
1874
|
+
const ptr0 = passStringToWasm0(contract_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1875
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1876
|
+
const ret = wasm.export_odcs_yaml_v2(ptr0, len0);
|
|
1877
|
+
var ptr2 = ret[0];
|
|
1878
|
+
var len2 = ret[1];
|
|
1879
|
+
if (ret[3]) {
|
|
1880
|
+
ptr2 = 0; len2 = 0;
|
|
1881
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1882
|
+
}
|
|
1883
|
+
deferred3_0 = ptr2;
|
|
1884
|
+
deferred3_1 = len2;
|
|
1885
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1886
|
+
} finally {
|
|
1887
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1834
1891
|
/**
|
|
1835
1892
|
* Export an ODPS Data Product to Markdown format.
|
|
1836
1893
|
*
|
|
@@ -3131,6 +3188,83 @@ export function migrate_dataflow_to_domain(dataflow_yaml, domain_name) {
|
|
|
3131
3188
|
}
|
|
3132
3189
|
}
|
|
3133
3190
|
|
|
3191
|
+
/**
|
|
3192
|
+
* Convert an ODCSContract to TableData format for UI rendering (v2 API).
|
|
3193
|
+
*
|
|
3194
|
+
* This function converts an ODCSContract to TableData format, which includes
|
|
3195
|
+
* all the metadata needed for UI rendering (similar to ImportResult.tables).
|
|
3196
|
+
*
|
|
3197
|
+
* # Arguments
|
|
3198
|
+
*
|
|
3199
|
+
* * `contract_json` - JSON string containing ODCSContract object
|
|
3200
|
+
*
|
|
3201
|
+
* # Returns
|
|
3202
|
+
*
|
|
3203
|
+
* JSON string containing array of TableData objects, or JsValue error
|
|
3204
|
+
* @param {string} contract_json
|
|
3205
|
+
* @returns {string}
|
|
3206
|
+
*/
|
|
3207
|
+
export function odcs_contract_to_table_data(contract_json) {
|
|
3208
|
+
let deferred3_0;
|
|
3209
|
+
let deferred3_1;
|
|
3210
|
+
try {
|
|
3211
|
+
const ptr0 = passStringToWasm0(contract_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3212
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3213
|
+
const ret = wasm.odcs_contract_to_table_data(ptr0, len0);
|
|
3214
|
+
var ptr2 = ret[0];
|
|
3215
|
+
var len2 = ret[1];
|
|
3216
|
+
if (ret[3]) {
|
|
3217
|
+
ptr2 = 0; len2 = 0;
|
|
3218
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3219
|
+
}
|
|
3220
|
+
deferred3_0 = ptr2;
|
|
3221
|
+
deferred3_1 = len2;
|
|
3222
|
+
return getStringFromWasm0(ptr2, len2);
|
|
3223
|
+
} finally {
|
|
3224
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
/**
|
|
3229
|
+
* Convert an ODCSContract to Table/Column format (v2 API).
|
|
3230
|
+
*
|
|
3231
|
+
* This function converts an ODCSContract to the traditional Table/Column
|
|
3232
|
+
* format used by the v1 API. Useful for interoperability with existing code.
|
|
3233
|
+
*
|
|
3234
|
+
* Note: This conversion may lose some metadata that doesn't fit in Table/Column.
|
|
3235
|
+
* For lossless round-trip, use `parse_odcs_yaml_v2` and `export_odcs_yaml_v2`.
|
|
3236
|
+
*
|
|
3237
|
+
* # Arguments
|
|
3238
|
+
*
|
|
3239
|
+
* * `contract_json` - JSON string containing ODCSContract object
|
|
3240
|
+
*
|
|
3241
|
+
* # Returns
|
|
3242
|
+
*
|
|
3243
|
+
* JSON string containing array of Table objects, or JsValue error
|
|
3244
|
+
* @param {string} contract_json
|
|
3245
|
+
* @returns {string}
|
|
3246
|
+
*/
|
|
3247
|
+
export function odcs_contract_to_tables(contract_json) {
|
|
3248
|
+
let deferred3_0;
|
|
3249
|
+
let deferred3_1;
|
|
3250
|
+
try {
|
|
3251
|
+
const ptr0 = passStringToWasm0(contract_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3253
|
+
const ret = wasm.odcs_contract_to_tables(ptr0, len0);
|
|
3254
|
+
var ptr2 = ret[0];
|
|
3255
|
+
var len2 = ret[1];
|
|
3256
|
+
if (ret[3]) {
|
|
3257
|
+
ptr2 = 0; len2 = 0;
|
|
3258
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3259
|
+
}
|
|
3260
|
+
deferred3_0 = ptr2;
|
|
3261
|
+
deferred3_1 = len2;
|
|
3262
|
+
return getStringFromWasm0(ptr2, len2);
|
|
3263
|
+
} finally {
|
|
3264
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3134
3268
|
/**
|
|
3135
3269
|
* Parse a decisions index YAML file and return a structured representation.
|
|
3136
3270
|
*
|
|
@@ -3375,6 +3509,69 @@ export function parse_odcs_yaml(yaml_content) {
|
|
|
3375
3509
|
}
|
|
3376
3510
|
}
|
|
3377
3511
|
|
|
3512
|
+
/**
|
|
3513
|
+
* Parse ODCS YAML content and return an ODCSContract JSON representation (v2 API).
|
|
3514
|
+
*
|
|
3515
|
+
* This is the preferred v2 API that returns the native ODCSContract structure,
|
|
3516
|
+
* preserving all ODCS metadata, nested properties, and multi-table support.
|
|
3517
|
+
*
|
|
3518
|
+
* Unlike `parse_odcs_yaml` which flattens to Table/Column types, this function
|
|
3519
|
+
* returns the full ODCSContract with:
|
|
3520
|
+
* - All contract-level fields (apiVersion, domain, team, etc.)
|
|
3521
|
+
* - Multiple schema objects (tables) preserved
|
|
3522
|
+
* - Nested properties (OBJECT/ARRAY types) preserved hierarchically
|
|
3523
|
+
* - All custom properties at each level
|
|
3524
|
+
*
|
|
3525
|
+
* # Arguments
|
|
3526
|
+
*
|
|
3527
|
+
* * `yaml_content` - ODCS YAML content as a string
|
|
3528
|
+
*
|
|
3529
|
+
* # Returns
|
|
3530
|
+
*
|
|
3531
|
+
* JSON string containing ODCSContract object, or JsValue error
|
|
3532
|
+
*
|
|
3533
|
+
* # Example Response
|
|
3534
|
+
*
|
|
3535
|
+
* ```json
|
|
3536
|
+
* {
|
|
3537
|
+
* "apiVersion": "v3.1.0",
|
|
3538
|
+
* "kind": "DataContract",
|
|
3539
|
+
* "name": "My Contract",
|
|
3540
|
+
* "schema": [
|
|
3541
|
+
* {
|
|
3542
|
+
* "name": "users",
|
|
3543
|
+
* "properties": [
|
|
3544
|
+
* { "name": "id", "logicalType": "integer", "primaryKey": true },
|
|
3545
|
+
* { "name": "address", "logicalType": "object", "properties": [...] }
|
|
3546
|
+
* ]
|
|
3547
|
+
* }
|
|
3548
|
+
* ]
|
|
3549
|
+
* }
|
|
3550
|
+
* ```
|
|
3551
|
+
* @param {string} yaml_content
|
|
3552
|
+
* @returns {string}
|
|
3553
|
+
*/
|
|
3554
|
+
export function parse_odcs_yaml_v2(yaml_content) {
|
|
3555
|
+
let deferred3_0;
|
|
3556
|
+
let deferred3_1;
|
|
3557
|
+
try {
|
|
3558
|
+
const ptr0 = passStringToWasm0(yaml_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3559
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3560
|
+
const ret = wasm.parse_odcs_yaml_v2(ptr0, len0);
|
|
3561
|
+
var ptr2 = ret[0];
|
|
3562
|
+
var len2 = ret[1];
|
|
3563
|
+
if (ret[3]) {
|
|
3564
|
+
ptr2 = 0; len2 = 0;
|
|
3565
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3566
|
+
}
|
|
3567
|
+
deferred3_0 = ptr2;
|
|
3568
|
+
deferred3_1 = len2;
|
|
3569
|
+
return getStringFromWasm0(ptr2, len2);
|
|
3570
|
+
} finally {
|
|
3571
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3378
3575
|
/**
|
|
3379
3576
|
* Parse a tag string into a Tag enum.
|
|
3380
3577
|
*
|
|
@@ -3725,6 +3922,46 @@ export function serialize_tag(tag_json) {
|
|
|
3725
3922
|
}
|
|
3726
3923
|
}
|
|
3727
3924
|
|
|
3925
|
+
/**
|
|
3926
|
+
* Convert Tables to an ODCSContract (v2 API).
|
|
3927
|
+
*
|
|
3928
|
+
* This function converts traditional Table/Column format to an ODCSContract.
|
|
3929
|
+
* Useful for migrating existing code to the v2 API.
|
|
3930
|
+
*
|
|
3931
|
+
* Note: The resulting contract will have default values for fields that
|
|
3932
|
+
* don't exist in Table/Column format.
|
|
3933
|
+
*
|
|
3934
|
+
* # Arguments
|
|
3935
|
+
*
|
|
3936
|
+
* * `tables_json` - JSON string containing array of Table objects
|
|
3937
|
+
*
|
|
3938
|
+
* # Returns
|
|
3939
|
+
*
|
|
3940
|
+
* JSON string containing ODCSContract object, or JsValue error
|
|
3941
|
+
* @param {string} tables_json
|
|
3942
|
+
* @returns {string}
|
|
3943
|
+
*/
|
|
3944
|
+
export function tables_to_odcs_contract(tables_json) {
|
|
3945
|
+
let deferred3_0;
|
|
3946
|
+
let deferred3_1;
|
|
3947
|
+
try {
|
|
3948
|
+
const ptr0 = passStringToWasm0(tables_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3949
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3950
|
+
const ret = wasm.tables_to_odcs_contract(ptr0, len0);
|
|
3951
|
+
var ptr2 = ret[0];
|
|
3952
|
+
var len2 = ret[1];
|
|
3953
|
+
if (ret[3]) {
|
|
3954
|
+
ptr2 = 0; len2 = 0;
|
|
3955
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3956
|
+
}
|
|
3957
|
+
deferred3_0 = ptr2;
|
|
3958
|
+
deferred3_1 = len2;
|
|
3959
|
+
return getStringFromWasm0(ptr2, len2);
|
|
3960
|
+
} finally {
|
|
3961
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
|
|
3728
3965
|
/**
|
|
3729
3966
|
* Update domain config with new view positions.
|
|
3730
3967
|
*
|
|
@@ -4285,21 +4522,21 @@ function __wbg_get_imports() {
|
|
|
4285
4522
|
const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
|
|
4286
4523
|
return ret;
|
|
4287
4524
|
}, arguments) };
|
|
4525
|
+
imports.wbg.__wbindgen_cast_21040fd34b87e597 = function(arg0, arg1) {
|
|
4526
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 709, function: Function { arguments: [Ref(NamedExternref("IDBVersionChangeEvent"))], shim_idx: 710, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4527
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hb559389f482bae0b, wasm_bindgen__convert__closures________invoke__hf1e66acfb4f5ea29);
|
|
4528
|
+
return ret;
|
|
4529
|
+
};
|
|
4288
4530
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
4289
4531
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
4290
4532
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
4291
4533
|
return ret;
|
|
4292
4534
|
};
|
|
4293
|
-
imports.wbg.
|
|
4294
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
4535
|
+
imports.wbg.__wbindgen_cast_f4f75333789432ab = function(arg0, arg1) {
|
|
4536
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 783, function: Function { arguments: [Externref], shim_idx: 784, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4295
4537
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he59d4bc392497fcb, wasm_bindgen__convert__closures_____invoke__h3aa4f50d9cb64e36);
|
|
4296
4538
|
return ret;
|
|
4297
4539
|
};
|
|
4298
|
-
imports.wbg.__wbindgen_cast_e5248776a143f57b = function(arg0, arg1) {
|
|
4299
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 693, function: Function { arguments: [Ref(NamedExternref("IDBVersionChangeEvent"))], shim_idx: 694, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4300
|
-
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h6cea484f8d09c363, wasm_bindgen__convert__closures________invoke__hed2faeb3ab5b0e39);
|
|
4301
|
-
return ret;
|
|
4302
|
-
};
|
|
4303
4540
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
4304
4541
|
const table = wasm.__wbindgen_externrefs;
|
|
4305
4542
|
const offset = table.grow(4);
|
|
Binary file
|