@xuda.io/xuda-worker-bundle-min 1.3.1102 → 1.3.1103

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.
Files changed (2) hide show
  1. package/index.js +76 -68
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2671,7 +2671,7 @@ func.datasource.execute = async function (
2671
2671
  );
2672
2672
  }
2673
2673
  }
2674
- console.log("batch", _ds)
2674
+ await func.datasource.set_outputField(SESSION_ID, dataSourceSession, _ds?.v?.raw_data?.rows);
2675
2675
  break;
2676
2676
  }
2677
2677
 
@@ -4154,6 +4154,8 @@ func.datasource.callback = function (
4154
4154
  }
4155
4155
  delete _ds.old_dataSource;
4156
4156
 
4157
+
4158
+
4157
4159
  return {
4158
4160
  SESSION_ID,
4159
4161
  dsSessionP,
@@ -5095,21 +5097,12 @@ func.datasource.update_changes_for_out_parameter = async function (
5095
5097
  }
5096
5098
  };
5097
5099
 
5098
- func.datasource.set_outputField = async function (SESSION_ID, elementP, triggerP, functionP, dsSessionP, result) {
5100
+ func.datasource.set_outputField = async function (SESSION_ID, dsSessionP, result) {
5099
5101
  var _session = SESSION_OBJ[SESSION_ID];
5102
+ let _ds = _session.DS_GLB[dsSessionP];
5100
5103
 
5101
- const output_field = await get_args_property_value("outputField");
5102
-
5103
- // if (!output_field) {
5104
- // func.utils.debug_report(
5105
- // SESSION_ID,
5106
- // "func.events.execute",
5107
- // `${elementP} >${triggerP} >${functionP} > Output field not defined`,
5108
- // "W"
5109
- // );
5110
-
5111
- // }
5112
5104
 
5105
+ const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSessionP, _ds.args, "outputField")
5113
5106
 
5114
5107
 
5115
5108
  if (output_field) {
@@ -5139,6 +5132,23 @@ func.datasource.set_outputField = async function (SESSION_ID, elementP, triggerP
5139
5132
  }
5140
5133
 
5141
5134
  }
5135
+
5136
+ func.datasource.get_args_property_value = async function (SESSION_ID, dsSession, args, prop_name) {
5137
+ let _prop = args?.calling_trigger_prop?.data?.name;
5138
+ let _value = _prop[prop_name];
5139
+ if (_prop?.[`xu-exp:${prop_name}`]) {
5140
+ _value = (
5141
+ await func.expression.get(
5142
+ SESSION_ID,
5143
+ _prop[`xu-exp:${prop_name}`],
5144
+ dsSession,
5145
+ `${prop_name} expression`
5146
+ )
5147
+ ).result;
5148
+ }
5149
+
5150
+ return _value;
5151
+ };
5142
5152
  func.utils = {};
5143
5153
 
5144
5154
  func.utils.debug = {};
@@ -5464,9 +5474,9 @@ func.utils.job_worker = function (session_id) {
5464
5474
  if (
5465
5475
  !_session.WORKER_OBJ.jobs[_session.WORKER_OBJ.stat] ||
5466
5476
  _session.WORKER_OBJ.jobs[_session.WORKER_OBJ.stat].typeP ===
5467
- "system_interval" ||
5477
+ "system_interval" ||
5468
5478
  _session.WORKER_OBJ.jobs[_session.WORKER_OBJ.stat].typeP ===
5469
- "system event"
5479
+ "system event"
5470
5480
  ) {
5471
5481
  return;
5472
5482
  }
@@ -5832,10 +5842,10 @@ func.utils.ws_worker.functions = {
5832
5842
  if (show_log)
5833
5843
  console.log(
5834
5844
  "DATASOURCE EXECUTION DONE " +
5835
- ret.dsSessionP +
5836
- " " +
5837
- _session.DS_GLB[ret.dsSessionP]?.tree_obj?.menuName ||
5838
- "" + " SESSION_ID: " + SESSION_ID,
5845
+ ret.dsSessionP +
5846
+ " " +
5847
+ _session.DS_GLB[ret.dsSessionP]?.tree_obj?.menuName ||
5848
+ "" + " SESSION_ID: " + SESSION_ID,
5839
5849
  APP_OBJ[_session.app_id].app_name
5840
5850
  );
5841
5851
  var obj = func.utils.clean_returned_datasource(SESSION_ID, ret.dsSessionP);
@@ -5916,9 +5926,9 @@ func.utils.ws_worker.functions = {
5916
5926
  if (show_log)
5917
5927
  console.log(
5918
5928
  "DATASOURCE RETURN TO DATASOURCE " +
5919
- params.dssession +
5920
- " SESSION_ID: " +
5921
- SESSION_ID,
5929
+ params.dssession +
5930
+ " SESSION_ID: " +
5931
+ SESSION_ID,
5922
5932
  APP_OBJ[_session.app_id].app_name
5923
5933
  );
5924
5934
  _session.DS_GLB[params.dssession].v.onscreen_events_active =
@@ -5931,9 +5941,9 @@ func.utils.ws_worker.functions = {
5931
5941
  if (show_log)
5932
5942
  console.log(
5933
5943
  "DATASOURCE RETURN TO DATASOURCE DONE " +
5934
- DS +
5935
- " SESSION_ID: " +
5936
- SESSION_ID,
5944
+ DS +
5945
+ " SESSION_ID: " +
5946
+ SESSION_ID,
5937
5947
  APP_OBJ[_session.app_id].app_name
5938
5948
  );
5939
5949
  var obj = func.utils.clean_returned_datasource(SESSION_ID, DS);
@@ -5961,9 +5971,9 @@ func.utils.ws_worker.functions = {
5961
5971
  if (show_log)
5962
5972
  console.log(
5963
5973
  "UPDATE CHANGE EVENT DONE TO DATASOURCE " +
5964
- params.dssession +
5965
- " SESSION_ID: " +
5966
- SESSION_ID,
5974
+ params.dssession +
5975
+ " SESSION_ID: " +
5976
+ SESSION_ID,
5967
5977
  APP_OBJ[_session.app_id].app_name
5968
5978
  );
5969
5979
  ds.eventChangesResults_done = true;
@@ -5975,9 +5985,9 @@ func.utils.ws_worker.functions = {
5975
5985
  if (show_log)
5976
5986
  console.log(
5977
5987
  "RETURN FROM DB_QUERY " +
5978
- params.dssession +
5979
- " SESSION_ID: " +
5980
- SESSION_ID,
5988
+ params.dssession +
5989
+ " SESSION_ID: " +
5990
+ SESSION_ID,
5981
5991
  APP_OBJ[_session.app_id].app_name
5982
5992
  );
5983
5993
  debugger;
@@ -5994,9 +6004,9 @@ func.utils.ws_worker.functions = {
5994
6004
  if (show_log)
5995
6005
  console.log(
5996
6006
  "RETURN FROM SAVE_DATA " +
5997
- params.dssession +
5998
- " SESSION_ID: " +
5999
- SESSION_ID,
6007
+ params.dssession +
6008
+ " SESSION_ID: " +
6009
+ SESSION_ID,
6000
6010
  APP_OBJ[_session.app_id].app_name
6001
6011
  );
6002
6012
  func.utils.get_callback_queue(SESSION_ID, params.callback_id)();
@@ -6098,7 +6108,7 @@ func.utils.ws_worker.functions = {
6098
6108
  const couch = await __.rpi.get_app_couch(req.body.app_id);
6099
6109
  const session_doc = await couch.get(req.body.app_token);
6100
6110
  ret.session_stat = session_doc.stat;
6101
- } catch (error) {}
6111
+ } catch (error) { }
6102
6112
  }
6103
6113
  } catch (error) {
6104
6114
  debugger;
@@ -6220,8 +6230,7 @@ func.utils.replace_studio_drive_url = function (SESSION_ID, val) {
6220
6230
  try {
6221
6231
  return val.replaceAll(
6222
6232
  `https://xuda.io/studio-drive/${APP_OBJ[_session.app_id].app_replicate}`,
6223
- `https://${_session.domain}/studio-drive/${
6224
- APP_OBJ[_session.app_id].app_replicate
6233
+ `https://${_session.domain}/studio-drive/${APP_OBJ[_session.app_id].app_replicate
6225
6234
  }`
6226
6235
  );
6227
6236
  } catch (err) {
@@ -6236,9 +6245,8 @@ func.utils.get_drive_url = function (SESSION_ID, val, wrap) {
6236
6245
  function replaceFiletoURL(fileString) {
6237
6246
  const _app = APP_OBJ[_session.app_id];
6238
6247
 
6239
- let url = `https://${_session.domain}/workspace-drive/${
6240
- _app.is_deployment ? _app.app_datacenter_id : _app.app_id_reference
6241
- }/`;
6248
+ let url = `https://${_session.domain}/workspace-drive/${_app.is_deployment ? _app.app_datacenter_id : _app.app_id_reference
6249
+ }/`;
6242
6250
 
6243
6251
  let FILE_REPLACE_URL = `${url}${val}`;
6244
6252
 
@@ -6247,9 +6255,8 @@ func.utils.get_drive_url = function (SESSION_ID, val, wrap) {
6247
6255
  FILE_REPLACE_URL += `?app_token=${_session.app_token}`;
6248
6256
  }
6249
6257
 
6250
- let match = `drv_${
6251
- _app.app_replicate || _session.app_id
6252
- }_[0-9a-f\\-]+\\.[a-zA-Z0-9]+`;
6258
+ let match = `drv_${_app.app_replicate || _session.app_id
6259
+ }_[0-9a-f\\-]+\\.[a-zA-Z0-9]+`;
6253
6260
 
6254
6261
  let pat = new RegExp(match, "g");
6255
6262
  let URLString = fileString.replace(pat, function (match, idx) {
@@ -6628,8 +6635,8 @@ func.utils.alerts.execute = function (
6628
6635
  alert_type === "success"
6629
6636
  ? "log"
6630
6637
  : alert_type === "warning"
6631
- ? "warn"
6632
- : alert_type
6638
+ ? "warn"
6639
+ : alert_type
6633
6640
  ](alert_type, title, message);
6634
6641
  ALERT_IS_ACTIVE = false;
6635
6642
  break;
@@ -7525,6 +7532,7 @@ func.utils.set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (SESSION_ID, docP) {
7525
7532
  };
7526
7533
  await func.datasource.update(SESSION_ID, datasource_changes);
7527
7534
  };
7535
+
7528
7536
  func.events = {};
7529
7537
  func.events.validate = async function (
7530
7538
  SESSION_ID,
@@ -8122,22 +8130,22 @@ func.events.execute = async function (
8122
8130
 
8123
8131
  return _prog_id;
8124
8132
  };
8125
- const get_args_property_value = async function (prop_name) {
8126
- let _prop = args?.calling_trigger_prop?.data?.name;
8127
- let _value = _prop[prop_name];
8128
- if (_prop?.[`xu-exp:${prop_name}`]) {
8129
- _value = (
8130
- await func.expression.get(
8131
- SESSION_ID,
8132
- _prop[`xu-exp:${prop_name}`],
8133
- dsSession,
8134
- `${prop_name} expression`
8135
- )
8136
- ).result;
8137
- }
8133
+ // const get_args_property_value = async function (prop_name) {
8134
+ // let _prop = args?.calling_trigger_prop?.data?.name;
8135
+ // let _value = _prop[prop_name];
8136
+ // if (_prop?.[`xu-exp:${prop_name}`]) {
8137
+ // _value = (
8138
+ // await func.expression.get(
8139
+ // SESSION_ID,
8140
+ // _prop[`xu-exp:${prop_name}`],
8141
+ // dsSession,
8142
+ // `${prop_name} expression`
8143
+ // )
8144
+ // ).result;
8145
+ // }
8138
8146
 
8139
- return _value;
8140
- };
8147
+ // return _value;
8148
+ // };
8141
8149
 
8142
8150
 
8143
8151
  var args = {
@@ -8854,7 +8862,7 @@ func.events.execute = async function (
8854
8862
 
8855
8863
  const api_ret = await func.api.call_project_api(_prog_id, params_obj);
8856
8864
 
8857
- await func.datasource.set_outputField(SESSION_ID, elementP, triggerP, functionP, dsSessionP, api_ret);
8865
+ await func.datasource.set_outputField(SESSION_ID, dsSessionP, api_ret);
8858
8866
 
8859
8867
  // if (output_field) {
8860
8868
  // let datasource_changes = {};
@@ -8884,7 +8892,7 @@ func.events.execute = async function (
8884
8892
  func.events.delete_job(SESSION_ID, jobNoP);
8885
8893
  },
8886
8894
  call_system_api: async function () {
8887
- const api_method = await get_args_property_value("api_method");
8895
+ const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "api_method");
8888
8896
 
8889
8897
  if (!api_method) {
8890
8898
  func.utils.debug_report(
@@ -8897,7 +8905,7 @@ func.events.execute = async function (
8897
8905
  return;
8898
8906
  }
8899
8907
  let payload = {};
8900
- const _payload = await get_args_property_value("payload");
8908
+ const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "payload");
8901
8909
  if (_payload) {
8902
8910
  const get_payload_property_value = async function (prop_name) {
8903
8911
  let _prop = _payload;
@@ -8935,7 +8943,7 @@ func.events.execute = async function (
8935
8943
  // return;
8936
8944
  // }
8937
8945
 
8938
- const output_field = await get_args_property_value("outputField");
8946
+ const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "outputField");
8939
8947
 
8940
8948
  // if (!output_field) {
8941
8949
  // func.utils.debug_report(
@@ -8977,7 +8985,7 @@ func.events.execute = async function (
8977
8985
  func.events.delete_job(SESSION_ID, jobNoP);
8978
8986
  },
8979
8987
  call_external_api: async function () {
8980
- const method = await get_args_property_value("method");
8988
+ const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "method");
8981
8989
 
8982
8990
  if (!method) {
8983
8991
  func.utils.debug_report(
@@ -8990,7 +8998,7 @@ func.events.execute = async function (
8990
8998
  return;
8991
8999
  }
8992
9000
 
8993
- const url = await get_args_property_value("url");
9001
+ const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "url");
8994
9002
 
8995
9003
  if (!url) {
8996
9004
  func.utils.debug_report(
@@ -9003,7 +9011,7 @@ func.events.execute = async function (
9003
9011
  return;
9004
9012
  }
9005
9013
 
9006
- const payload_arr = await get_args_property_value("payload");
9014
+ const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "payload");
9007
9015
 
9008
9016
  const report_conversion_error = function (res, typeP, valP) {
9009
9017
  var msg = `${elementP} >${triggerP} >${functionP} > error converting from ${valP} to ${typeP}`;
@@ -9067,7 +9075,7 @@ func.events.execute = async function (
9067
9075
  // return;
9068
9076
  // }
9069
9077
 
9070
- const output_field = await get_args_property_value("outputField");
9078
+ const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "outputField");
9071
9079
 
9072
9080
  // if (!output_field) {
9073
9081
  // func.utils.debug_report(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.1102",
3
+ "version": "1.3.1103",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {