@xuda.io/xuda-worker-bundle-min 1.3.1159 → 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.
- package/index.js +46 -49
- 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
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
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 (
|
|
@@ -7780,9 +7801,9 @@ func.events.validate = async function (
|
|
|
7780
7801
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
7781
7802
|
}
|
|
7782
7803
|
|
|
7783
|
-
add_event();
|
|
7804
|
+
await add_event();
|
|
7784
7805
|
};
|
|
7785
|
-
|
|
7806
|
+
const add_event = async function () {
|
|
7786
7807
|
const _event = func.common.find_item_by_key_root(
|
|
7787
7808
|
_view_obj.progEvents,
|
|
7788
7809
|
"id",
|
|
@@ -7850,7 +7871,7 @@ func.events.validate = async function (
|
|
|
7850
7871
|
}
|
|
7851
7872
|
|
|
7852
7873
|
jobs.push(
|
|
7853
|
-
func.events.add_to_queue(
|
|
7874
|
+
await func.events.add_to_queue(
|
|
7854
7875
|
SESSION_ID,
|
|
7855
7876
|
sourceP + " event",
|
|
7856
7877
|
trigger_obj.id,
|
|
@@ -7887,7 +7908,7 @@ func.events.validate = async function (
|
|
|
7887
7908
|
if (val.data.parameters) {
|
|
7888
7909
|
await set_arguments();
|
|
7889
7910
|
} else {
|
|
7890
|
-
add_event();
|
|
7911
|
+
await add_event();
|
|
7891
7912
|
}
|
|
7892
7913
|
} else {
|
|
7893
7914
|
if (val.data.condition && !expCond.result) {
|
|
@@ -8993,7 +9014,7 @@ func.events.execute = async function (
|
|
|
8993
9014
|
return;
|
|
8994
9015
|
}
|
|
8995
9016
|
|
|
8996
|
-
|
|
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 () {
|