@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.
@@ -40128,6 +40128,38 @@ func.datasource.get_viewFields_for_update_function = function (SESSION_ID, calli
40128
40128
  return viewFields;
40129
40129
  };
40130
40130
  func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, rowIdP, org_dsSessionP) {
40131
+ const normalize_field_id = function (field_id) {
40132
+ if (typeof field_id === 'string') {
40133
+ return field_id;
40134
+ }
40135
+ if (typeof field_id?.field_id === 'string') {
40136
+ return field_id.field_id;
40137
+ }
40138
+ if (typeof field_id?.id === 'string') {
40139
+ return field_id.id;
40140
+ }
40141
+ if (typeof field_id === 'number' || typeof field_id === 'boolean' || typeof field_id === 'bigint') {
40142
+ return field_id.toString();
40143
+ }
40144
+ const coerced = field_id?.toString?.();
40145
+ if (typeof coerced === 'string' && coerced && coerced !== '[object Object]') {
40146
+ return coerced;
40147
+ }
40148
+ return null;
40149
+ };
40150
+ const return_missing_value = function (field_id, currentRecordId = null) {
40151
+ return {
40152
+ ret: {
40153
+ value: undefined,
40154
+ type: 'string',
40155
+ prop: null,
40156
+ },
40157
+ dsSessionP,
40158
+ fieldIdP: field_id,
40159
+ currentRecordId,
40160
+ found: false,
40161
+ };
40162
+ };
40131
40163
  const return_value = async (field_id, value) => {
40132
40164
  const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSessionP);
40133
40165
  let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
@@ -40256,9 +40288,21 @@ func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, ro
40256
40288
  // let prev_ds = dsSessionP - 1;
40257
40289
  return await func.datasource.get_value(SESSION_ID, fieldIdP, dsSessionP - 1, rowIdP, org_dsSessionP);
40258
40290
  }
40291
+ const normalized_missing_field = normalize_field_id(fieldIdP);
40292
+ if (normalized_missing_field === null) {
40293
+ return return_missing_value(fieldIdP);
40294
+ }
40295
+ fieldIdP = normalized_missing_field;
40259
40296
  return await return_value(fieldIdP);
40260
40297
  } //console.error("error: datasource not exist: " + dsSessionP);
40261
40298
 
40299
+ const normalized_field_id = normalize_field_id(fieldIdP);
40300
+ if (normalized_field_id === null) {
40301
+ func.utils.debug_report(SESSION_ID, 'Datasource get value', `Invalid field id type: ${typeof fieldIdP}`, 'W');
40302
+ return return_missing_value(fieldIdP, _ds.currentRecordId);
40303
+ }
40304
+ fieldIdP = normalized_field_id;
40305
+
40262
40306
  let recordId = rowIdP;
40263
40307
  if (!recordId) {
40264
40308
  recordId = _ds.currentRecordId;