@xuda.io/xuda-worker-bundle-min 1.3.1186 → 1.3.1188

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 +66 -21
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3215,8 +3215,15 @@ func.datasource.run_events_functions = async function (
3215
3215
  dataSourceSession,
3216
3216
  event_id,
3217
3217
  calling_job,
3218
- async_event
3218
+ async_event,
3219
+ event_parameters
3219
3220
  ) {
3221
+
3222
+ if (typeof dataSourceSession === "undefined" || dataSourceSession === null) {
3223
+ console.warn(`Event ${event_id} not exist or not found`)
3224
+ return
3225
+ }
3226
+
3220
3227
  // return new Promise(async (resolve, reject) => {
3221
3228
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
3222
3229
  var args = _ds.args;
@@ -3236,7 +3243,7 @@ func.datasource.run_events_functions = async function (
3236
3243
  dataSourceSession,
3237
3244
  val.data.event_name,
3238
3245
  args.callingSourceP,
3239
- val.data.parameters
3246
+ event_parameters// val.data.parameters
3240
3247
  );
3241
3248
 
3242
3249
  if (calling_job || async_event) continue
@@ -3262,20 +3269,7 @@ func.datasource.run_events_functions = async function (
3262
3269
  if (job_promises.length) {
3263
3270
  await Promise.all(job_promises)
3264
3271
  }
3265
- // console.log(job_promises)
3266
- // resolve()
3267
-
3268
- // if (job_promises.length) {
3269
- // Promise.all(job_promises)
3270
- // .then((e) => {
3271
- // resolve()
3272
- // });
3273
-
3274
- // } else {
3275
- // resolve()
3276
- // }
3277
3272
 
3278
- // })
3279
3273
 
3280
3274
  };
3281
3275
 
@@ -4119,8 +4113,6 @@ func.datasource.update = async function (
4119
4113
  ).system_globals;
4120
4114
  }
4121
4115
 
4122
-
4123
-
4124
4116
  const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
4125
4117
 
4126
4118
  // iterate child ds
@@ -8096,6 +8088,38 @@ func.events.validate = async function (
8096
8088
  const set_arguments = async function () {
8097
8089
  var args = argumentsP || {};
8098
8090
 
8091
+ // for await (let [key, fieldId] of Object.entries(
8092
+ // val.data.parameters
8093
+ // )) {
8094
+ // const field_info = func.common.find_item_by_key(
8095
+ // _view_obj.progFields,
8096
+ // "field_id",
8097
+ // fieldId
8098
+ // );
8099
+
8100
+ // var value = await func.common.get_cast_val(
8101
+ // SESSION_ID,
8102
+ // "events",
8103
+ // fieldId,
8104
+ // field_info.props.fieldType,
8105
+ // args[fieldId]
8106
+ // );
8107
+
8108
+ // const ret = await func.datasource.get_value(
8109
+ // SESSION_ID,
8110
+ // fieldId,
8111
+ // dsSessionP,
8112
+ // _ds.currentRecordId
8113
+ // );
8114
+
8115
+ // const datasource_changes = {
8116
+ // [ret.dsSessionP]: {
8117
+ // [ret.currentRecordId]: { [fieldId]: value },
8118
+ // },
8119
+ // };
8120
+ // await func.datasource.update(SESSION_ID, datasource_changes);
8121
+ // }
8122
+
8099
8123
  for await (let [key, fieldId] of Object.entries(
8100
8124
  val.data.parameters
8101
8125
  )) {
@@ -8105,14 +8129,33 @@ func.events.validate = async function (
8105
8129
  fieldId
8106
8130
  );
8107
8131
 
8108
- var value = await func.common.get_cast_val(
8132
+ if (field_info?.data?.type !== "virtual") {
8133
+ console.warn("parameter field must be virtual, update ignored");
8134
+ continue;
8135
+ }
8136
+
8137
+ if (!args[fieldId]) continue
8138
+
8139
+
8140
+
8141
+ let value = await func.common.get_cast_val(
8109
8142
  SESSION_ID,
8110
8143
  "events",
8111
8144
  fieldId,
8112
8145
  field_info.props.fieldType,
8113
- args[fieldId]
8146
+ args[fieldId].value
8114
8147
  );
8115
8148
 
8149
+ if (!_.isEmpty(args[fieldId].fx)) {
8150
+ const fx_ret = await func.expression.get(
8151
+ SESSION_ID,
8152
+ args[fieldId].fx,
8153
+ dsSessionP,
8154
+ "update"
8155
+ )
8156
+ value = fx_ret.result;
8157
+ }
8158
+ // find the target field in the program dataset
8116
8159
  const ret = await func.datasource.get_value(
8117
8160
  SESSION_ID,
8118
8161
  fieldId,
@@ -9063,7 +9106,8 @@ func.events.execute = async function (
9063
9106
  dsP,
9064
9107
  event_name,
9065
9108
  jobNoP,
9066
- null
9109
+ null,
9110
+ calling_trigger_prop?.data?.name?.parameters || {}
9067
9111
  );
9068
9112
  }
9069
9113
  // done_execution(event_name);
@@ -9093,7 +9137,8 @@ func.events.execute = async function (
9093
9137
  dsP,
9094
9138
  event_name,
9095
9139
  jobNoP,
9096
- calling_trigger_prop?.props?.async
9140
+ calling_trigger_prop?.props?.async,
9141
+ calling_trigger_prop?.data?.name?.parameters || {}
9097
9142
  );
9098
9143
  // done_execution(event_name);
9099
9144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.1186",
3
+ "version": "1.3.1188",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {