@xuda.io/runtime-bundle 1.0.929 → 1.0.931

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.
@@ -2346,9 +2346,9 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
2346
2346
  }
2347
2347
  if (_session.worker_type === 'Debug') {
2348
2348
  if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
2349
- ret = await get_ret(func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, `${_conf.xuda_home}root/dist/runtime/js/modules/` + module));
2349
+ ret = await get_ret(func.utils.get_resource_filename(['live_preview', 'miniapp'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, `${_conf.xuda_home}root/dist/runtime/js/modules/` + module));
2350
2350
  } else {
2351
- ret = await get_ret(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/modules/' + module)));
2351
+ ret = await get_ret(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'miniapp'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/modules/' + module)));
2352
2352
  }
2353
2353
 
2354
2354
  return ret;
@@ -2359,9 +2359,9 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
2359
2359
  };
2360
2360
 
2361
2361
  if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
2362
- ret = await get_ret(func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, `${_conf.xuda_home}root/dist/runtime/js/modules/` + rep()));
2362
+ ret = await get_ret(func.utils.get_resource_filename(['live_preview', 'miniapp'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, `${_conf.xuda_home}root/dist/runtime/js/modules/` + rep()));
2363
2363
  } else {
2364
- ret = await get_ret(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/modules/' + rep())));
2364
+ ret = await get_ret(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'miniapp'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/modules/' + rep())));
2365
2365
  }
2366
2366
 
2367
2367
  return ret;
@@ -2942,7 +2942,7 @@ func.datasource.create = async function (
2942
2942
 
2943
2943
  var run_at = _prog_obj?.properties?.runAt;
2944
2944
 
2945
- if (!['live_preview', 'cms'].includes(_session.engine_mode)) {
2945
+ if (!['live_preview', 'miniapp'].includes(_session.engine_mode)) {
2946
2946
  if (_session.opt.app_computing_mode === 'main') {
2947
2947
  run_at = 'client';
2948
2948
  }
@@ -3118,7 +3118,7 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
3118
3118
 
3119
3119
  if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
3120
3120
  _ds.in_parameters[val.data.parameter].value = parameters_obj_inP[val.data.parameter];
3121
- } else if (['live_preview', 'cms'].includes(_session.engine_mode)) {
3121
+ } else if (['live_preview', 'miniapp'].includes(_session.engine_mode)) {
3122
3122
  _ds.in_parameters[val.data.parameter].value = _session?.url_params?.[val.data.parameter];
3123
3123
  }
3124
3124
 
@@ -3140,7 +3140,7 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
3140
3140
  _ds.data_system['SYS_GLOBAL_STR_SESSION_ID'] = SESSION_ID;
3141
3141
  _ds.data_system['SYS_GLOBAL_STR_LOGIN_USER_ID'] = _session.USR_OBJ._id;
3142
3142
 
3143
- if (!['live_preview', 'cms'].includes(_session.engine_mode) && PROJECT_OBJ[_session.app_id].info) {
3143
+ if (!['live_preview', 'miniapp'].includes(_session.engine_mode) && PROJECT_OBJ[_session.app_id].info) {
3144
3144
  _ds.data_system['SYS_GLOBAL_OBJ_APP_INFO'] = {
3145
3145
  build: PROJECT_OBJ[_session.app_id].info.build_id,
3146
3146
  author: PROJECT_OBJ[_session.app_id].info.author,
@@ -3409,18 +3409,9 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
3409
3409
  _ds.v.batch_loops = await get_limit();
3410
3410
  return false;
3411
3411
  }
3412
- // _ds.v.batch_loops =
3413
- // (await get_limit()) <= _ds.data_feed?.rows?.length
3414
- // ? await get_limit()
3415
- // : _ds?.data_feed?.rows?.length;
3416
3412
 
3417
3413
  _ds.v.batch_loops = (await get_limit()) <= _ds.v.raw_data?.rows?.length ? await get_limit() : _ds.v.raw_data?.rows?.length;
3418
3414
  return true;
3419
- // _ds.v.batch_loops =
3420
- // (await get_limit()) <= _ds.v?.raw_data?.rows?.length
3421
- // ? await get_limit()
3422
- // : _ds.v?.raw_data?.rows?.length;
3423
- // return true;
3424
3415
  };
3425
3416
 
3426
3417
  const render_api_output = async function () {
@@ -3792,16 +3783,6 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
3792
3783
  return func.utils.debug_report(SESSION_ID, 'Data source', 'Datasource DB Table must be defined for Set Data operation', 'E');
3793
3784
  }
3794
3785
 
3795
- // const get_data_from_data_feed = function () {
3796
- // const rows = _ds?.data_feed?.rows || [];
3797
- // return rows.map((item) => ({
3798
- // id: item._ROWID,
3799
- // value: {
3800
- // ...item.value,
3801
- // },
3802
- // }));
3803
- // };
3804
-
3805
3786
  const find_ROWID_idx_from_raw_data_arr = function (rowId) {
3806
3787
  if (!_raw_data_rows) {
3807
3788
  throw new Error('_raw_data_rows not found');
@@ -3816,21 +3797,20 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
3816
3797
 
3817
3798
  if (tree_obj.crudMode === 'U') {
3818
3799
  _ds.set_mode = 'U';
3819
- // _raw_data_rows = get_data_from_data_feed(); // _ds?.raw_data?.rows || [];
3800
+
3820
3801
  _raw_data_rows = _ds?.v.raw_data?.rows || [];
3821
3802
  }
3822
3803
 
3823
3804
  if (tree_obj.crudMode === 'D') {
3824
3805
  _ds.set_mode = 'D';
3825
- // _raw_data_rows = get_data_from_data_feed(); // _ds.raw_data?.rows || [];
3806
+
3826
3807
  _raw_data_rows = _ds?.v.raw_data?.rows || [];
3827
3808
  }
3828
3809
 
3829
3810
  // initiated with Update but no rows found
3830
- // if (tree_obj.crudMode === 'U' && tree_obj.allowCreate && !_ds?.data_feed?.rows?.length) {
3811
+
3831
3812
  if (tree_obj.crudMode === 'U' && tree_obj.allowCreate && !_raw_data_rows?.length) {
3832
3813
  _ds.set_mode = 'C';
3833
- // _raw_data_rows[glb.newRecord] = [{ _ROWID: "newRecord" }];
3834
3814
 
3835
3815
  try {
3836
3816
  const row_idx = find_ROWID_idx_from_raw_data_arr('newRecord');
@@ -3842,7 +3822,7 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
3842
3822
 
3843
3823
  if (tree_obj.crudMode === 'C') {
3844
3824
  _ds.set_mode = 'C';
3845
- // _raw_data_rows[glb.newRecord] = [{ _ROWID: "newRecord" }];
3825
+
3846
3826
  try {
3847
3827
  const row_idx = find_ROWID_idx_from_raw_data_arr('newRecord');
3848
3828
  _raw_data_rows[row_idx] = [{ id: 'newRecord', value: {} }];
@@ -3875,7 +3855,7 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
3875
3855
  if (dbMsgP) _ds.currentRecordId = dbMsgP.id;
3876
3856
  }
3877
3857
  }
3878
- // ret = await callback_datasource();
3858
+
3879
3859
  await func.datasource.set_outputField(SESSION_ID, dataSourceSession, _ds?.v?.raw_data?.rows, _ds.args);
3880
3860
  break;
3881
3861
  }
@@ -3897,25 +3877,6 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
3897
3877
  }
3898
3878
 
3899
3879
  const row_not_found = async function () {
3900
- // if (!prog_obj.progDataSource?.dataSourceType || (tree_obj.rwMode === 'U' && tree_obj.allowCreate)) {
3901
- // _ds.currentRecordId = 'newRecord';
3902
- // _ds.set_mode = 'C';
3903
- // _ds.record_not_found = true;
3904
-
3905
- // try {
3906
- // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
3907
- // } catch (error) {
3908
- // await func.datasource.render_fields_form(SESSION_ID, dataSourceSession, { id: 'newRecord', value: {} });
3909
- // }
3910
-
3911
- // var count = await func.datasource.get_field_init_count(SESSION_ID, dataSourceSession, 'newRecord', false);
3912
- // if (
3913
- // count > 0 // was: && !args.dataSourceNoP
3914
- // ) {
3915
- // await func.datasource.execute_field_init_events(SESSION_ID, dataSourceSession, 'form', 'newRecord');
3916
- // }
3917
- // }
3918
-
3919
3880
  if (!prog_obj.progDataSource?.dataSourceType || prog_obj.properties.renderType === 'form' || (tree_obj.rwMode === 'U' && tree_obj.allowCreate)) {
3920
3881
  _ds.currentRecordId = 'newRecord';
3921
3882
  if (tree_obj.rwMode === 'U' && tree_obj.allowCreate) {
@@ -3969,15 +3930,6 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
3969
3930
  await func.datasource.execute_view_events(SESSION_ID, dataSourceSession, 'before_record');
3970
3931
  }
3971
3932
 
3972
- // await func.datasource.run_rows_form(
3973
- // SESSION_ID,
3974
- // dataSourceSession,
3975
- // idx,
3976
- // raw_data_row
3977
- // );
3978
-
3979
- ///////////////////////
3980
-
3981
3933
  _ds.currentRecordId = raw_data_row.id; // set temporary to allow expression decoder work
3982
3934
 
3983
3935
  await func.datasource.render_fields_form(SESSION_ID, dataSourceSession, raw_data_row);
@@ -3992,8 +3944,6 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
3992
3944
  console.error(err);
3993
3945
  }
3994
3946
 
3995
- /////////////////////
3996
-
3997
3947
  if (await get_after_record_count()) {
3998
3948
  await func.datasource.execute_view_events(SESSION_ID, dataSourceSession, 'after_record');
3999
3949
  }
@@ -4309,10 +4259,10 @@ func.datasource.get_field_init_count = async function (SESSION_ID, dataSourceSes
4309
4259
  for await (const field_obj of _view_obj.progFields) {
4310
4260
  var fieldId = field_obj.data.field_id;
4311
4261
 
4312
- if (!field_obj?.triggers?.length) {
4262
+ if (!field_obj?.workflow?.length) {
4313
4263
  continue;
4314
4264
  }
4315
- for await (const trigger_obj of field_obj.triggers) {
4265
+ for await (const trigger_obj of field_obj.workflow) {
4316
4266
  if (oninit_triggers_to_runP && !oninit_triggers_to_runP?.includes(trigger_obj.id)) {
4317
4267
  continue;
4318
4268
  }
@@ -4403,8 +4353,8 @@ func.datasource.get_view_events_count = async function (SESSION_ID, dataSourceSe
4403
4353
  }
4404
4354
  }
4405
4355
 
4406
- if (_.isEmpty(event_obj.triggers)) continue;
4407
- for (const trigger_obj of event_obj.triggers) {
4356
+ if (_.isEmpty(event_obj.workflow)) continue;
4357
+ for (const trigger_obj of event_obj.workflow) {
4408
4358
  if (trigger_obj.data.enabled) {
4409
4359
  var expression;
4410
4360
  if (trigger_obj.props.condition) expression = trigger_obj.props.condition;
@@ -5630,7 +5580,7 @@ func.datasource.get_field_init_triggers_to_run = function (SESSION_ID, dataSourc
5630
5580
  if (!_ds) return;
5631
5581
 
5632
5582
  return []; // inactive 021617
5633
- }; // inactive temporary, design to execute init triggers when querying large datasets
5583
+ }; // inactive temporary, design to execute init workflow when querying large datasets
5634
5584
  func.datasource.get_pre_init_fields = function (SESSION_ID, dsSessionP, viewRangeExpP, viewSortExpP, viewGroupByExpP, viewLocateExpP) {
5635
5585
  var ret = [];
5636
5586
  return; // inactive 021617
@@ -6205,7 +6155,7 @@ func.utils.ws_worker.functions = {
6205
6155
  APP_OBJ[data.app_id] = data.APP_OBJ;
6206
6156
  PROJECT_OBJ[data.app_id] = data.PROJECT_OBJ;
6207
6157
 
6208
- if (['live_preview', 'cms'].includes(data.SESSION_INFO.engine_mode)) {
6158
+ if (['live_preview', 'miniapp'].includes(data.SESSION_INFO.engine_mode)) {
6209
6159
  DOCS_OBJ[data.app_id] = data.DOCS_OBJ;
6210
6160
  } else if (typeof IS_DOCKER === 'undefined' && typeof IS_PROCESS_SERVER === 'undefined') {
6211
6161
  if (!DOCS_OBJ[data.app_id]) {
@@ -10475,7 +10425,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10475
10425
 
10476
10426
  if (val.handler === 'custom') {
10477
10427
  // do BL
10478
- for await (const [key2, val2] of Object.entries(val.event)) {
10428
+ for await (const [key2, val2] of Object.entries(val.workflow)) {
10479
10429
  // var cond = val2.data.enabled;
10480
10430
  // if (val2.data.enabled && val2.props.condition) {
10481
10431
  // expCond = await func.expression.get(SESSION_ID, val2.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid); // execute expression
@@ -11224,7 +11174,7 @@ func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP
11224
11174
  for await (const event_obj of _prog.progEvents) {
11225
11175
  if (event_obj.data.type !== typeP) continue;
11226
11176
 
11227
- if (_.isEmpty(event_obj.triggers)) continue;
11177
+ if (_.isEmpty(event_obj.workflow)) continue;
11228
11178
 
11229
11179
  if (event_obj.data.condition) {
11230
11180
  let res = await func.expression.get(SESSION_ID, event_obj.data.condition, paramsP.dsSessionP, 'condition', paramsP.rowIdP, null, null, null, null, event_obj);
@@ -11233,7 +11183,7 @@ func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP
11233
11183
  }
11234
11184
  }
11235
11185
 
11236
- for await (const trigger_obj of event_obj.triggers) {
11186
+ for await (const trigger_obj of event_obj.workflow) {
11237
11187
  var expression = undefined;
11238
11188
  var cond = undefined;
11239
11189
  if (!trigger_obj.data.enabled) {
@@ -13005,12 +12955,12 @@ func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventId
13005
12955
  };
13006
12956
  const add_event = async function () {
13007
12957
  const _event = func.common.find_item_by_key_root(_view_obj.progEvents, 'id', val.id);
13008
- if (_event.triggers) {
12958
+ if (_event.workflow) {
13009
12959
  // check if event property exist
13010
12960
 
13011
- if (!_event.triggers || _.isEmpty(_event.triggers)) return;
12961
+ if (!_event.workflow || _.isEmpty(_event.workflow)) return;
13012
12962
  // check events has rows
13013
- for (const trigger_obj of _event.triggers) {
12963
+ for (const trigger_obj of _event.workflow) {
13014
12964
  //run events rows
13015
12965
  if (!trigger_obj.data.action) continue;
13016
12966
  if (!trigger_obj.data.enabled) continue;
@@ -13722,9 +13672,9 @@ func.events.execute = async function (
13722
13672
  const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
13723
13673
  if (callingSourceP === 'grid' || callingSourceP === 'form') {
13724
13674
  let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', field_elm);
13725
- var event_name = _field_obj?.triggers?.[eventIdP].name.event;
13675
+ var event_name = _field_obj?.workflow?.[eventIdP].name.event;
13726
13676
 
13727
- if (_field_obj?.triggers?.[eventIdP].name?.properties['xu-exp:event']) {
13677
+ if (_field_obj?.workflow?.[eventIdP].name?.properties['xu-exp:event']) {
13728
13678
  event_name = (await func.expression.get(SESSION_ID, props[`xu-exp:event`], dsSession, 'event_name expression')).result;
13729
13679
  }
13730
13680
 
@@ -14379,7 +14329,7 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
14379
14329
  }
14380
14330
  if (typeof retP.value !== 'undefined') {
14381
14331
  var_Arr[key].type = retP.type;
14382
- var_Arr[key].value = typeof retP.value === 'string' && !retP.value.includes('<svg xmlns=') && retP.value.indexOf('\\') === -1 ? retP.value.replaceAll('"', '\\"') : retP.value; // new Apr 6 2025 fixing "\"how much?\""
14332
+ var_Arr[key].value = typeof retP.value === 'string' && !retP.value.includes('<svg xmlns=') && retP.value.indexOf('\\') === -1 && source !== 'UI Attr EXP' ? retP.value.replaceAll('"', '\\"') : retP.value; // new Apr 6 2025 fixing "\"how much?\"" // new Jul 29 25 to fix quil extra "\" " source!=="UI Attr EXP"
14383
14333
  if ((val.value.indexOf('[') > -1) | (val.value.indexOf('.') > -1)) {
14384
14334
  //get values from array '@var==="sss" && @var_B==="sss" && @obj.property===5 && @objA["value"]===123 | @objB["value"].property===1234'
14385
14335
  var data = retP.prop;
@@ -15739,7 +15689,7 @@ function xuda(...args) {
15739
15689
  val = window.location.host;
15740
15690
  break;
15741
15691
  case 'engine_mode':
15742
- val = 'cms'; //was 'run'
15692
+ val = 'miniapp'; //was 'run'
15743
15693
  break;
15744
15694
  case 'app_id':
15745
15695
  val = 'unknown';
@@ -16522,7 +16472,7 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
16522
16472
  ver = APP_OBJ[_session.app_id].app_version;
16523
16473
  }
16524
16474
 
16525
- var build_id = ['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session.opt.app_build_id;
16475
+ var build_id = ['live_preview', 'miniapp'].includes(_session.engine_mode) ? '' : _session.opt.app_build_id;
16526
16476
  if (typeof XUDA_BUILD_ID !== 'undefined') {
16527
16477
  build_id = XUDA_BUILD_ID;
16528
16478
  }
@@ -16629,7 +16579,7 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
16629
16579
  return URL.createObjectURL(new Blob([content], { type: 'text/javascript' }));
16630
16580
  }
16631
16581
  const _session = SESSION_OBJ[SESSION_ID];
16632
- let blob = getWorkerURL(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/xuda_worker.js')));
16582
+ let blob = getWorkerURL(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'miniapp'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/xuda_worker.js')));
16633
16583
  WEB_WORKER[SESSION_ID][worker_id] = {
16634
16584
  worker: new Worker(blob, {
16635
16585
  name: worker_name,