@xuda.io/xuda-worker-bundle-min 1.3.1160 → 1.3.1161

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 +42 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3207,28 +3207,49 @@ func.datasource.run_events_functions = async function (
3207
3207
  calling_job,
3208
3208
  NA_calling_job_ds
3209
3209
  ) {
3210
- var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
3211
- var args = _ds.args;
3212
- // var v = _ds.v;
3213
- const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
3214
- if (_view_obj.progEvents) {
3215
- for await (const [key, val] of Object.entries(_view_obj.progEvents)) {
3216
- if (
3217
- val.data.type === "user_defined" &&
3218
- val.data.event_name &&
3219
- val.data.event_name === event_id
3220
- ) {
3221
- await func.events.validate(
3222
- SESSION_ID,
3223
- "user_defined",
3224
- dataSourceSession,
3225
- val.data.event_name,
3226
- args.callingSourceP,
3227
- val.data.parameters
3228
- );
3210
+ return new Promise(async (resolve, reject) => {
3211
+ var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
3212
+ var args = _ds.args;
3213
+ // var v = _ds.v;
3214
+ const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
3215
+ let job_promises = []
3216
+ if (_view_obj.progEvents) {
3217
+ for await (const [key, val] of Object.entries(_view_obj.progEvents)) {
3218
+ if (
3219
+ val.data.type === "user_defined" &&
3220
+ val.data.event_name &&
3221
+ val.data.event_name === event_id
3222
+ ) {
3223
+ const job_num = await func.events.validate(
3224
+ SESSION_ID,
3225
+ "user_defined",
3226
+ dataSourceSession,
3227
+ val.data.event_name,
3228
+ args.callingSourceP,
3229
+ val.data.parameters
3230
+ );
3231
+ job_promises.push(new Promise((resolve, reject) => {
3232
+ const interval = setInterval(() => {
3233
+ var job_index = func.events.find_job_index(SESSION_ID, job_num);
3234
+ if (job_index == null) {
3235
+ clearInterval(interval)
3236
+ resolve(job_num);
3237
+ }
3238
+ }, 100);
3239
+ }))
3240
+ }
3229
3241
  }
3242
+
3243
+
3244
+
3230
3245
  }
3231
- }
3246
+ if (job_promises.length) {
3247
+ Promise.all(job_promises)
3248
+ }
3249
+ resolve()
3250
+
3251
+ })
3252
+
3232
3253
  };
3233
3254
 
3234
3255
  func.datasource.render_fields_form = async function (
@@ -8993,7 +9014,7 @@ func.events.execute = async function (
8993
9014
  return;
8994
9015
  }
8995
9016
 
8996
- // const output_field = await get_args_property_value("outputField");
9017
+
8997
9018
 
8998
9019
  // if (!output_field) {
8999
9020
  // func.utils.debug_report(
@@ -9010,31 +9031,7 @@ func.events.execute = async function (
9010
9031
 
9011
9032
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, api_ret, args);
9012
9033
 
9013
- // if (output_field) {
9014
- // let datasource_changes = {};
9015
9034
 
9016
- // let ret_get_value = await func.datasource.get_value(
9017
- // SESSION_ID,
9018
- // output_field,
9019
- // dsSessionP
9020
- // );
9021
- // if (ret_get_value.found) {
9022
- // let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
9023
- // if (!datasource_changes[_ds.dsSession]) {
9024
- // datasource_changes[_ds.dsSession] = {};
9025
- // }
9026
- // if (
9027
- // !datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]
9028
- // ) {
9029
- // datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
9030
- // {};
9031
- // }
9032
- // datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
9033
- // output_field
9034
- // ] = api_ret;
9035
- // await func.datasource.update(SESSION_ID, datasource_changes);
9036
- // }
9037
- // }
9038
9035
  func.events.delete_job(SESSION_ID, jobNoP);
9039
9036
  },
9040
9037
  call_system_api: async function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.1160",
3
+ "version": "1.3.1161",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {