@xuda.io/runtime-bundle 1.0.1429 → 1.0.1430
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 +44 -0
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +44 -0
- package/js/xuda-runtime-slim.min.es.js +44 -0
- package/js/xuda-runtime-slim.min.js +1 -1
- 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;
|
|
@@ -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;
|