@xuda.io/runtime-bundle 1.0.1429 → 1.0.1431
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/js/xuda-runtime-bundle.js +125 -11
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +125 -11
- package/js/xuda-runtime-slim.min.es.js +125 -11
- package/js/xuda-runtime-slim.min.js +2 -2
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +44 -0
- package/js/xuda-worker-bundle.js +44 -0
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -6387,6 +6387,38 @@ func.datasource.get_viewFields_for_update_function = function (SESSION_ID, calli
|
|
|
6387
6387
|
return viewFields;
|
|
6388
6388
|
};
|
|
6389
6389
|
func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, rowIdP, org_dsSessionP) {
|
|
6390
|
+
const normalize_field_id = function (field_id) {
|
|
6391
|
+
if (typeof field_id === 'string') {
|
|
6392
|
+
return field_id;
|
|
6393
|
+
}
|
|
6394
|
+
if (typeof field_id?.field_id === 'string') {
|
|
6395
|
+
return field_id.field_id;
|
|
6396
|
+
}
|
|
6397
|
+
if (typeof field_id?.id === 'string') {
|
|
6398
|
+
return field_id.id;
|
|
6399
|
+
}
|
|
6400
|
+
if (typeof field_id === 'number' || typeof field_id === 'boolean' || typeof field_id === 'bigint') {
|
|
6401
|
+
return field_id.toString();
|
|
6402
|
+
}
|
|
6403
|
+
const coerced = field_id?.toString?.();
|
|
6404
|
+
if (typeof coerced === 'string' && coerced && coerced !== '[object Object]') {
|
|
6405
|
+
return coerced;
|
|
6406
|
+
}
|
|
6407
|
+
return null;
|
|
6408
|
+
};
|
|
6409
|
+
const return_missing_value = function (field_id, currentRecordId = null) {
|
|
6410
|
+
return {
|
|
6411
|
+
ret: {
|
|
6412
|
+
value: undefined,
|
|
6413
|
+
type: 'string',
|
|
6414
|
+
prop: null,
|
|
6415
|
+
},
|
|
6416
|
+
dsSessionP,
|
|
6417
|
+
fieldIdP: field_id,
|
|
6418
|
+
currentRecordId,
|
|
6419
|
+
found: false,
|
|
6420
|
+
};
|
|
6421
|
+
};
|
|
6390
6422
|
const return_value = async (field_id, value) => {
|
|
6391
6423
|
const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSessionP);
|
|
6392
6424
|
let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
@@ -6515,9 +6547,21 @@ func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, ro
|
|
|
6515
6547
|
// let prev_ds = dsSessionP - 1;
|
|
6516
6548
|
return await func.datasource.get_value(SESSION_ID, fieldIdP, dsSessionP - 1, rowIdP, org_dsSessionP);
|
|
6517
6549
|
}
|
|
6550
|
+
const normalized_missing_field = normalize_field_id(fieldIdP);
|
|
6551
|
+
if (normalized_missing_field === null) {
|
|
6552
|
+
return return_missing_value(fieldIdP);
|
|
6553
|
+
}
|
|
6554
|
+
fieldIdP = normalized_missing_field;
|
|
6518
6555
|
return await return_value(fieldIdP);
|
|
6519
6556
|
} //console.error("error: datasource not exist: " + dsSessionP);
|
|
6520
6557
|
|
|
6558
|
+
const normalized_field_id = normalize_field_id(fieldIdP);
|
|
6559
|
+
if (normalized_field_id === null) {
|
|
6560
|
+
func.utils.debug_report(SESSION_ID, 'Datasource get value', `Invalid field id type: ${typeof fieldIdP}`, 'W');
|
|
6561
|
+
return return_missing_value(fieldIdP, _ds.currentRecordId);
|
|
6562
|
+
}
|
|
6563
|
+
fieldIdP = normalized_field_id;
|
|
6564
|
+
|
|
6521
6565
|
let recordId = rowIdP;
|
|
6522
6566
|
if (!recordId) {
|
|
6523
6567
|
recordId = _ds.currentRecordId;
|
|
@@ -17775,7 +17819,7 @@ func.runtime.render.handle_xu_bind = async function (options) {
|
|
|
17775
17819
|
};
|
|
17776
17820
|
func.runtime.render.apply_xu_class = async function (options) {
|
|
17777
17821
|
try {
|
|
17778
|
-
const classes_obj = typeof options.val.value === 'string' ?
|
|
17822
|
+
const classes_obj = typeof options.val.value === 'string' ? JSON5.parse(options.val.value) : Object.assign({}, {}, options.val.value);
|
|
17779
17823
|
const xuData = func.runtime.ui.get_data(options.$elm)?.xuData;
|
|
17780
17824
|
const class_names = Object.keys(classes_obj);
|
|
17781
17825
|
|
|
@@ -17805,7 +17849,18 @@ func.runtime.render.apply_xu_class = async function (options) {
|
|
|
17805
17849
|
xuData.debug_info.attribute_stat['xu-class'] = func.runtime.ui.get_first_node(options.$elm)?.className || func.runtime.ui.get_attr(options.$elm, 'class');
|
|
17806
17850
|
return {};
|
|
17807
17851
|
} catch (e) {
|
|
17808
|
-
|
|
17852
|
+
await func.runtime.render.report_xu_runtime_error(
|
|
17853
|
+
{
|
|
17854
|
+
...options,
|
|
17855
|
+
xu_func: 'xu-class',
|
|
17856
|
+
val: {
|
|
17857
|
+
key: 'xu-class',
|
|
17858
|
+
value: options?.val?.value,
|
|
17859
|
+
},
|
|
17860
|
+
},
|
|
17861
|
+
e,
|
|
17862
|
+
'xu-class has invalid object syntax',
|
|
17863
|
+
);
|
|
17809
17864
|
return { abort: true };
|
|
17810
17865
|
}
|
|
17811
17866
|
};
|
|
@@ -18486,14 +18541,43 @@ func.runtime.widgets = func.runtime.widgets || {};
|
|
|
18486
18541
|
// Browser-only common xu handler factories live here so registry composition can stay small.
|
|
18487
18542
|
|
|
18488
18543
|
func.runtime.render.build_base_xu_handlers = function (options, _ds) {
|
|
18544
|
+
const parse_object_value = function (attr_name, val, shape = 'object') {
|
|
18545
|
+
let parsed_value = val?.value;
|
|
18546
|
+
if (typeof parsed_value === 'string') {
|
|
18547
|
+
try {
|
|
18548
|
+
parsed_value = JSON5.parse(parsed_value);
|
|
18549
|
+
} catch (error) {
|
|
18550
|
+
throw func.runtime.render.build_xu_runtime_error(
|
|
18551
|
+
{ ...options, xu_func: attr_name, val: { key: attr_name, value: val?.value } },
|
|
18552
|
+
error,
|
|
18553
|
+
`${attr_name} has invalid ${shape} syntax`,
|
|
18554
|
+
);
|
|
18555
|
+
}
|
|
18556
|
+
}
|
|
18557
|
+
|
|
18558
|
+
const valid =
|
|
18559
|
+
shape === 'array'
|
|
18560
|
+
? Array.isArray(parsed_value)
|
|
18561
|
+
: typeof parsed_value === 'object' && parsed_value !== null && !Array.isArray(parsed_value);
|
|
18562
|
+
|
|
18563
|
+
if (!valid) {
|
|
18564
|
+
throw func.runtime.render.build_xu_runtime_error(
|
|
18565
|
+
{ ...options, xu_func: attr_name, val: { key: attr_name, value: val?.value } },
|
|
18566
|
+
null,
|
|
18567
|
+
`${attr_name} expects a ${shape} value`,
|
|
18568
|
+
);
|
|
18569
|
+
}
|
|
18570
|
+
|
|
18571
|
+
return parsed_value;
|
|
18572
|
+
};
|
|
18489
18573
|
return {
|
|
18490
18574
|
'xu-attrs': async function ($elm, val) {
|
|
18491
18575
|
if (!val.value) return {};
|
|
18492
|
-
|
|
18493
|
-
const attr_keys = Object.keys(
|
|
18576
|
+
const attrs_obj = parse_object_value('xu-attrs', val, 'object');
|
|
18577
|
+
const attr_keys = Object.keys(attrs_obj);
|
|
18494
18578
|
for (let index = 0; index < attr_keys.length; index++) {
|
|
18495
18579
|
const attr_key = attr_keys[index];
|
|
18496
|
-
options.nodeP.attributes[attr_key] =
|
|
18580
|
+
options.nodeP.attributes[attr_key] = attrs_obj[attr_key];
|
|
18497
18581
|
}
|
|
18498
18582
|
return {};
|
|
18499
18583
|
},
|
|
@@ -18613,7 +18697,7 @@ func.runtime.render.build_base_xu_handlers = function (options, _ds) {
|
|
|
18613
18697
|
return {};
|
|
18614
18698
|
},
|
|
18615
18699
|
'xu-cdn': async function ($elm, val) {
|
|
18616
|
-
const resources_obj = val
|
|
18700
|
+
const resources_obj = parse_object_value('xu-cdn', val, 'object');
|
|
18617
18701
|
const resource_keys = Object.keys(resources_obj);
|
|
18618
18702
|
for (let index = 0; index < resource_keys.length; index++) {
|
|
18619
18703
|
const resource = resources_obj[resource_keys[index]];
|
|
@@ -18622,7 +18706,7 @@ func.runtime.render.build_base_xu_handlers = function (options, _ds) {
|
|
|
18622
18706
|
return {};
|
|
18623
18707
|
},
|
|
18624
18708
|
'xu-ui-plugin': async function ($elm, val) {
|
|
18625
|
-
const plugins_obj = val
|
|
18709
|
+
const plugins_obj = parse_object_value('xu-ui-plugin', val, 'object');
|
|
18626
18710
|
const plugin_names = Object.keys(plugins_obj);
|
|
18627
18711
|
for (let index = 0; index < plugin_names.length; index++) {
|
|
18628
18712
|
const plugin_name = plugin_names[index];
|
|
@@ -18633,14 +18717,14 @@ func.runtime.render.build_base_xu_handlers = function (options, _ds) {
|
|
|
18633
18717
|
},
|
|
18634
18718
|
'xu-store': async function ($elm, val) {
|
|
18635
18719
|
try {
|
|
18636
|
-
const fields_obj =
|
|
18720
|
+
const fields_obj = parse_object_value('xu-store', val, 'object');
|
|
18637
18721
|
const field_ids = Object.keys(fields_obj);
|
|
18638
18722
|
for (let index = 0; index < field_ids.length; index++) {
|
|
18639
18723
|
const field_id = field_ids[index];
|
|
18640
18724
|
func.datasource.add_dynamic_field_to_ds(options.SESSION_ID, options.paramsP.dsSessionP, field_id, fields_obj[field_id]);
|
|
18641
18725
|
}
|
|
18642
18726
|
} catch (err) {
|
|
18643
|
-
|
|
18727
|
+
throw err;
|
|
18644
18728
|
}
|
|
18645
18729
|
return {};
|
|
18646
18730
|
},
|
|
@@ -18763,6 +18847,36 @@ func.runtime.render = func.runtime.render || {};
|
|
|
18763
18847
|
func.runtime.widgets = func.runtime.widgets || {};
|
|
18764
18848
|
|
|
18765
18849
|
// Browser-only xu-attribute dispatch lives here so the attribute phase engine can stay focused.
|
|
18850
|
+
func.runtime.render.build_xu_runtime_error = function (options, error, fallback_message) {
|
|
18851
|
+
const raw_message = error?.message || error || fallback_message || 'Unknown runtime error';
|
|
18852
|
+
const err = error instanceof Error ? error : new Error(raw_message);
|
|
18853
|
+
err.xu_func = options?.xu_func;
|
|
18854
|
+
err.node_tag = options?.nodeP?.tagName;
|
|
18855
|
+
err.raw_value = options?.val?.value;
|
|
18856
|
+
err.ui_id = func.runtime?.ui?.get_attr ? func.runtime.ui.get_attr(options?.$elm, 'xu-ui-id') : null;
|
|
18857
|
+
return err;
|
|
18858
|
+
};
|
|
18859
|
+
func.runtime.render.report_xu_runtime_error = async function (options, error, fallback_message) {
|
|
18860
|
+
const err = func.runtime.render.build_xu_runtime_error(options, error, fallback_message);
|
|
18861
|
+
const attr_name = options?.val?.key || options?.xu_func || 'xu-*';
|
|
18862
|
+
const tag_name = options?.nodeP?.tagName || 'unknown';
|
|
18863
|
+
const raw_value = typeof err.raw_value === 'string' ? err.raw_value : JSON.stringify(err.raw_value);
|
|
18864
|
+
const message = [`${attr_name} failed on <${tag_name}>`, err.message];
|
|
18865
|
+
|
|
18866
|
+
if (raw_value) {
|
|
18867
|
+
message.push(`Value: ${raw_value}`);
|
|
18868
|
+
}
|
|
18869
|
+
|
|
18870
|
+
if (err.ui_id) {
|
|
18871
|
+
message.push(`xu-ui-id: ${err.ui_id}`);
|
|
18872
|
+
}
|
|
18873
|
+
|
|
18874
|
+
console.error('XUDA RUNTIME', message.join(' | '), err);
|
|
18875
|
+
if (func.utils?.debug_report) {
|
|
18876
|
+
await func.utils.debug_report(options?.SESSION_ID, 'Slim runtime', message.join(' | '), 'E', err);
|
|
18877
|
+
}
|
|
18878
|
+
return {};
|
|
18879
|
+
};
|
|
18766
18880
|
func.runtime.render.execute_xu_function = async function (options) {
|
|
18767
18881
|
if (options.is_skeleton) return;
|
|
18768
18882
|
|
|
@@ -18794,13 +18908,13 @@ func.runtime.render.execute_xu_function = async function (options) {
|
|
|
18794
18908
|
|
|
18795
18909
|
try {
|
|
18796
18910
|
if (!common_fx[options.xu_func]) {
|
|
18797
|
-
|
|
18911
|
+
await func.runtime.render.report_xu_runtime_error(options, null, `Unknown xu directive: ${options.xu_func}`);
|
|
18798
18912
|
return {};
|
|
18799
18913
|
}
|
|
18800
18914
|
|
|
18801
18915
|
return await common_fx[options.xu_func](options.$elm, options.val);
|
|
18802
18916
|
} catch (error) {
|
|
18803
|
-
|
|
18917
|
+
return await func.runtime.render.report_xu_runtime_error(options, error);
|
|
18804
18918
|
}
|
|
18805
18919
|
};
|
|
18806
18920
|
func.events = {};
|
|
@@ -6313,6 +6313,38 @@ func.datasource.get_viewFields_for_update_function = function (SESSION_ID, calli
|
|
|
6313
6313
|
return viewFields;
|
|
6314
6314
|
};
|
|
6315
6315
|
func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, rowIdP, org_dsSessionP) {
|
|
6316
|
+
const normalize_field_id = function (field_id) {
|
|
6317
|
+
if (typeof field_id === 'string') {
|
|
6318
|
+
return field_id;
|
|
6319
|
+
}
|
|
6320
|
+
if (typeof field_id?.field_id === 'string') {
|
|
6321
|
+
return field_id.field_id;
|
|
6322
|
+
}
|
|
6323
|
+
if (typeof field_id?.id === 'string') {
|
|
6324
|
+
return field_id.id;
|
|
6325
|
+
}
|
|
6326
|
+
if (typeof field_id === 'number' || typeof field_id === 'boolean' || typeof field_id === 'bigint') {
|
|
6327
|
+
return field_id.toString();
|
|
6328
|
+
}
|
|
6329
|
+
const coerced = field_id?.toString?.();
|
|
6330
|
+
if (typeof coerced === 'string' && coerced && coerced !== '[object Object]') {
|
|
6331
|
+
return coerced;
|
|
6332
|
+
}
|
|
6333
|
+
return null;
|
|
6334
|
+
};
|
|
6335
|
+
const return_missing_value = function (field_id, currentRecordId = null) {
|
|
6336
|
+
return {
|
|
6337
|
+
ret: {
|
|
6338
|
+
value: undefined,
|
|
6339
|
+
type: 'string',
|
|
6340
|
+
prop: null,
|
|
6341
|
+
},
|
|
6342
|
+
dsSessionP,
|
|
6343
|
+
fieldIdP: field_id,
|
|
6344
|
+
currentRecordId,
|
|
6345
|
+
found: false,
|
|
6346
|
+
};
|
|
6347
|
+
};
|
|
6316
6348
|
const return_value = async (field_id, value) => {
|
|
6317
6349
|
const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSessionP);
|
|
6318
6350
|
let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
@@ -6441,9 +6473,21 @@ func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, ro
|
|
|
6441
6473
|
// let prev_ds = dsSessionP - 1;
|
|
6442
6474
|
return await func.datasource.get_value(SESSION_ID, fieldIdP, dsSessionP - 1, rowIdP, org_dsSessionP);
|
|
6443
6475
|
}
|
|
6476
|
+
const normalized_missing_field = normalize_field_id(fieldIdP);
|
|
6477
|
+
if (normalized_missing_field === null) {
|
|
6478
|
+
return return_missing_value(fieldIdP);
|
|
6479
|
+
}
|
|
6480
|
+
fieldIdP = normalized_missing_field;
|
|
6444
6481
|
return await return_value(fieldIdP);
|
|
6445
6482
|
} //console.error("error: datasource not exist: " + dsSessionP);
|
|
6446
6483
|
|
|
6484
|
+
const normalized_field_id = normalize_field_id(fieldIdP);
|
|
6485
|
+
if (normalized_field_id === null) {
|
|
6486
|
+
func.utils.debug_report(SESSION_ID, 'Datasource get value', `Invalid field id type: ${typeof fieldIdP}`, 'W');
|
|
6487
|
+
return return_missing_value(fieldIdP, _ds.currentRecordId);
|
|
6488
|
+
}
|
|
6489
|
+
fieldIdP = normalized_field_id;
|
|
6490
|
+
|
|
6447
6491
|
let recordId = rowIdP;
|
|
6448
6492
|
if (!recordId) {
|
|
6449
6493
|
recordId = _ds.currentRecordId;
|
|
@@ -17701,7 +17745,7 @@ func.runtime.render.handle_xu_bind = async function (options) {
|
|
|
17701
17745
|
};
|
|
17702
17746
|
func.runtime.render.apply_xu_class = async function (options) {
|
|
17703
17747
|
try {
|
|
17704
|
-
const classes_obj = typeof options.val.value === 'string' ?
|
|
17748
|
+
const classes_obj = typeof options.val.value === 'string' ? JSON5.parse(options.val.value) : Object.assign({}, {}, options.val.value);
|
|
17705
17749
|
const xuData = func.runtime.ui.get_data(options.$elm)?.xuData;
|
|
17706
17750
|
const class_names = Object.keys(classes_obj);
|
|
17707
17751
|
|
|
@@ -17731,7 +17775,18 @@ func.runtime.render.apply_xu_class = async function (options) {
|
|
|
17731
17775
|
xuData.debug_info.attribute_stat['xu-class'] = func.runtime.ui.get_first_node(options.$elm)?.className || func.runtime.ui.get_attr(options.$elm, 'class');
|
|
17732
17776
|
return {};
|
|
17733
17777
|
} catch (e) {
|
|
17734
|
-
|
|
17778
|
+
await func.runtime.render.report_xu_runtime_error(
|
|
17779
|
+
{
|
|
17780
|
+
...options,
|
|
17781
|
+
xu_func: 'xu-class',
|
|
17782
|
+
val: {
|
|
17783
|
+
key: 'xu-class',
|
|
17784
|
+
value: options?.val?.value,
|
|
17785
|
+
},
|
|
17786
|
+
},
|
|
17787
|
+
e,
|
|
17788
|
+
'xu-class has invalid object syntax',
|
|
17789
|
+
);
|
|
17735
17790
|
return { abort: true };
|
|
17736
17791
|
}
|
|
17737
17792
|
};
|
|
@@ -18412,14 +18467,43 @@ func.runtime.widgets = func.runtime.widgets || {};
|
|
|
18412
18467
|
// Browser-only common xu handler factories live here so registry composition can stay small.
|
|
18413
18468
|
|
|
18414
18469
|
func.runtime.render.build_base_xu_handlers = function (options, _ds) {
|
|
18470
|
+
const parse_object_value = function (attr_name, val, shape = 'object') {
|
|
18471
|
+
let parsed_value = val?.value;
|
|
18472
|
+
if (typeof parsed_value === 'string') {
|
|
18473
|
+
try {
|
|
18474
|
+
parsed_value = JSON5.parse(parsed_value);
|
|
18475
|
+
} catch (error) {
|
|
18476
|
+
throw func.runtime.render.build_xu_runtime_error(
|
|
18477
|
+
{ ...options, xu_func: attr_name, val: { key: attr_name, value: val?.value } },
|
|
18478
|
+
error,
|
|
18479
|
+
`${attr_name} has invalid ${shape} syntax`,
|
|
18480
|
+
);
|
|
18481
|
+
}
|
|
18482
|
+
}
|
|
18483
|
+
|
|
18484
|
+
const valid =
|
|
18485
|
+
shape === 'array'
|
|
18486
|
+
? Array.isArray(parsed_value)
|
|
18487
|
+
: typeof parsed_value === 'object' && parsed_value !== null && !Array.isArray(parsed_value);
|
|
18488
|
+
|
|
18489
|
+
if (!valid) {
|
|
18490
|
+
throw func.runtime.render.build_xu_runtime_error(
|
|
18491
|
+
{ ...options, xu_func: attr_name, val: { key: attr_name, value: val?.value } },
|
|
18492
|
+
null,
|
|
18493
|
+
`${attr_name} expects a ${shape} value`,
|
|
18494
|
+
);
|
|
18495
|
+
}
|
|
18496
|
+
|
|
18497
|
+
return parsed_value;
|
|
18498
|
+
};
|
|
18415
18499
|
return {
|
|
18416
18500
|
'xu-attrs': async function ($elm, val) {
|
|
18417
18501
|
if (!val.value) return {};
|
|
18418
|
-
|
|
18419
|
-
const attr_keys = Object.keys(
|
|
18502
|
+
const attrs_obj = parse_object_value('xu-attrs', val, 'object');
|
|
18503
|
+
const attr_keys = Object.keys(attrs_obj);
|
|
18420
18504
|
for (let index = 0; index < attr_keys.length; index++) {
|
|
18421
18505
|
const attr_key = attr_keys[index];
|
|
18422
|
-
options.nodeP.attributes[attr_key] =
|
|
18506
|
+
options.nodeP.attributes[attr_key] = attrs_obj[attr_key];
|
|
18423
18507
|
}
|
|
18424
18508
|
return {};
|
|
18425
18509
|
},
|
|
@@ -18539,7 +18623,7 @@ func.runtime.render.build_base_xu_handlers = function (options, _ds) {
|
|
|
18539
18623
|
return {};
|
|
18540
18624
|
},
|
|
18541
18625
|
'xu-cdn': async function ($elm, val) {
|
|
18542
|
-
const resources_obj = val
|
|
18626
|
+
const resources_obj = parse_object_value('xu-cdn', val, 'object');
|
|
18543
18627
|
const resource_keys = Object.keys(resources_obj);
|
|
18544
18628
|
for (let index = 0; index < resource_keys.length; index++) {
|
|
18545
18629
|
const resource = resources_obj[resource_keys[index]];
|
|
@@ -18548,7 +18632,7 @@ func.runtime.render.build_base_xu_handlers = function (options, _ds) {
|
|
|
18548
18632
|
return {};
|
|
18549
18633
|
},
|
|
18550
18634
|
'xu-ui-plugin': async function ($elm, val) {
|
|
18551
|
-
const plugins_obj = val
|
|
18635
|
+
const plugins_obj = parse_object_value('xu-ui-plugin', val, 'object');
|
|
18552
18636
|
const plugin_names = Object.keys(plugins_obj);
|
|
18553
18637
|
for (let index = 0; index < plugin_names.length; index++) {
|
|
18554
18638
|
const plugin_name = plugin_names[index];
|
|
@@ -18559,14 +18643,14 @@ func.runtime.render.build_base_xu_handlers = function (options, _ds) {
|
|
|
18559
18643
|
},
|
|
18560
18644
|
'xu-store': async function ($elm, val) {
|
|
18561
18645
|
try {
|
|
18562
|
-
const fields_obj =
|
|
18646
|
+
const fields_obj = parse_object_value('xu-store', val, 'object');
|
|
18563
18647
|
const field_ids = Object.keys(fields_obj);
|
|
18564
18648
|
for (let index = 0; index < field_ids.length; index++) {
|
|
18565
18649
|
const field_id = field_ids[index];
|
|
18566
18650
|
func.datasource.add_dynamic_field_to_ds(options.SESSION_ID, options.paramsP.dsSessionP, field_id, fields_obj[field_id]);
|
|
18567
18651
|
}
|
|
18568
18652
|
} catch (err) {
|
|
18569
|
-
|
|
18653
|
+
throw err;
|
|
18570
18654
|
}
|
|
18571
18655
|
return {};
|
|
18572
18656
|
},
|
|
@@ -18689,6 +18773,36 @@ func.runtime.render = func.runtime.render || {};
|
|
|
18689
18773
|
func.runtime.widgets = func.runtime.widgets || {};
|
|
18690
18774
|
|
|
18691
18775
|
// Browser-only xu-attribute dispatch lives here so the attribute phase engine can stay focused.
|
|
18776
|
+
func.runtime.render.build_xu_runtime_error = function (options, error, fallback_message) {
|
|
18777
|
+
const raw_message = error?.message || error || fallback_message || 'Unknown runtime error';
|
|
18778
|
+
const err = error instanceof Error ? error : new Error(raw_message);
|
|
18779
|
+
err.xu_func = options?.xu_func;
|
|
18780
|
+
err.node_tag = options?.nodeP?.tagName;
|
|
18781
|
+
err.raw_value = options?.val?.value;
|
|
18782
|
+
err.ui_id = func.runtime?.ui?.get_attr ? func.runtime.ui.get_attr(options?.$elm, 'xu-ui-id') : null;
|
|
18783
|
+
return err;
|
|
18784
|
+
};
|
|
18785
|
+
func.runtime.render.report_xu_runtime_error = async function (options, error, fallback_message) {
|
|
18786
|
+
const err = func.runtime.render.build_xu_runtime_error(options, error, fallback_message);
|
|
18787
|
+
const attr_name = options?.val?.key || options?.xu_func || 'xu-*';
|
|
18788
|
+
const tag_name = options?.nodeP?.tagName || 'unknown';
|
|
18789
|
+
const raw_value = typeof err.raw_value === 'string' ? err.raw_value : JSON.stringify(err.raw_value);
|
|
18790
|
+
const message = [`${attr_name} failed on <${tag_name}>`, err.message];
|
|
18791
|
+
|
|
18792
|
+
if (raw_value) {
|
|
18793
|
+
message.push(`Value: ${raw_value}`);
|
|
18794
|
+
}
|
|
18795
|
+
|
|
18796
|
+
if (err.ui_id) {
|
|
18797
|
+
message.push(`xu-ui-id: ${err.ui_id}`);
|
|
18798
|
+
}
|
|
18799
|
+
|
|
18800
|
+
console.error('XUDA RUNTIME', message.join(' | '), err);
|
|
18801
|
+
if (func.utils?.debug_report) {
|
|
18802
|
+
await func.utils.debug_report(options?.SESSION_ID, 'Slim runtime', message.join(' | '), 'E', err);
|
|
18803
|
+
}
|
|
18804
|
+
return {};
|
|
18805
|
+
};
|
|
18692
18806
|
func.runtime.render.execute_xu_function = async function (options) {
|
|
18693
18807
|
if (options.is_skeleton) return;
|
|
18694
18808
|
|
|
@@ -18720,13 +18834,13 @@ func.runtime.render.execute_xu_function = async function (options) {
|
|
|
18720
18834
|
|
|
18721
18835
|
try {
|
|
18722
18836
|
if (!common_fx[options.xu_func]) {
|
|
18723
|
-
|
|
18837
|
+
await func.runtime.render.report_xu_runtime_error(options, null, `Unknown xu directive: ${options.xu_func}`);
|
|
18724
18838
|
return {};
|
|
18725
18839
|
}
|
|
18726
18840
|
|
|
18727
18841
|
return await common_fx[options.xu_func](options.$elm, options.val);
|
|
18728
18842
|
} catch (error) {
|
|
18729
|
-
|
|
18843
|
+
return await func.runtime.render.report_xu_runtime_error(options, error);
|
|
18730
18844
|
}
|
|
18731
18845
|
};
|
|
18732
18846
|
func.UI.screen = {};
|