@xuda.io/xuda-worker-bundle 1.3.2674 → 1.3.2675
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/index.js +44 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5288,6 +5288,38 @@ func.datasource.get_viewFields_for_update_function = function (SESSION_ID, calli
|
|
|
5288
5288
|
return viewFields;
|
|
5289
5289
|
};
|
|
5290
5290
|
func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, rowIdP, org_dsSessionP) {
|
|
5291
|
+
const normalize_field_id = function (field_id) {
|
|
5292
|
+
if (typeof field_id === 'string') {
|
|
5293
|
+
return field_id;
|
|
5294
|
+
}
|
|
5295
|
+
if (typeof field_id?.field_id === 'string') {
|
|
5296
|
+
return field_id.field_id;
|
|
5297
|
+
}
|
|
5298
|
+
if (typeof field_id?.id === 'string') {
|
|
5299
|
+
return field_id.id;
|
|
5300
|
+
}
|
|
5301
|
+
if (typeof field_id === 'number' || typeof field_id === 'boolean' || typeof field_id === 'bigint') {
|
|
5302
|
+
return field_id.toString();
|
|
5303
|
+
}
|
|
5304
|
+
const coerced = field_id?.toString?.();
|
|
5305
|
+
if (typeof coerced === 'string' && coerced && coerced !== '[object Object]') {
|
|
5306
|
+
return coerced;
|
|
5307
|
+
}
|
|
5308
|
+
return null;
|
|
5309
|
+
};
|
|
5310
|
+
const return_missing_value = function (field_id, currentRecordId = null) {
|
|
5311
|
+
return {
|
|
5312
|
+
ret: {
|
|
5313
|
+
value: undefined,
|
|
5314
|
+
type: 'string',
|
|
5315
|
+
prop: null,
|
|
5316
|
+
},
|
|
5317
|
+
dsSessionP,
|
|
5318
|
+
fieldIdP: field_id,
|
|
5319
|
+
currentRecordId,
|
|
5320
|
+
found: false,
|
|
5321
|
+
};
|
|
5322
|
+
};
|
|
5291
5323
|
const return_value = async (field_id, value) => {
|
|
5292
5324
|
const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSessionP);
|
|
5293
5325
|
let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
@@ -5416,9 +5448,21 @@ func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, ro
|
|
|
5416
5448
|
// let prev_ds = dsSessionP - 1;
|
|
5417
5449
|
return await func.datasource.get_value(SESSION_ID, fieldIdP, dsSessionP - 1, rowIdP, org_dsSessionP);
|
|
5418
5450
|
}
|
|
5451
|
+
const normalized_missing_field = normalize_field_id(fieldIdP);
|
|
5452
|
+
if (normalized_missing_field === null) {
|
|
5453
|
+
return return_missing_value(fieldIdP);
|
|
5454
|
+
}
|
|
5455
|
+
fieldIdP = normalized_missing_field;
|
|
5419
5456
|
return await return_value(fieldIdP);
|
|
5420
5457
|
} //console.error("error: datasource not exist: " + dsSessionP);
|
|
5421
5458
|
|
|
5459
|
+
const normalized_field_id = normalize_field_id(fieldIdP);
|
|
5460
|
+
if (normalized_field_id === null) {
|
|
5461
|
+
func.utils.debug_report(SESSION_ID, 'Datasource get value', `Invalid field id type: ${typeof fieldIdP}`, 'W');
|
|
5462
|
+
return return_missing_value(fieldIdP, _ds.currentRecordId);
|
|
5463
|
+
}
|
|
5464
|
+
fieldIdP = normalized_field_id;
|
|
5465
|
+
|
|
5422
5466
|
let recordId = rowIdP;
|
|
5423
5467
|
if (!recordId) {
|
|
5424
5468
|
recordId = _ds.currentRecordId;
|