@xuda.io/xuda-worker-bundle-min 1.3.1187 → 1.3.1189

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 +60 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3215,7 +3215,8 @@ 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
  ) {
3220
3221
 
3221
3222
  if (typeof dataSourceSession === "undefined" || dataSourceSession === null) {
@@ -3242,7 +3243,7 @@ func.datasource.run_events_functions = async function (
3242
3243
  dataSourceSession,
3243
3244
  val.data.event_name,
3244
3245
  args.callingSourceP,
3245
- val.data.parameters
3246
+ event_parameters// val.data.parameters
3246
3247
  );
3247
3248
 
3248
3249
  if (calling_job || async_event) continue
@@ -8087,6 +8088,38 @@ func.events.validate = async function (
8087
8088
  const set_arguments = async function () {
8088
8089
  var args = argumentsP || {};
8089
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
+
8090
8123
  for await (let [key, fieldId] of Object.entries(
8091
8124
  val.data.parameters
8092
8125
  )) {
@@ -8096,14 +8129,33 @@ func.events.validate = async function (
8096
8129
  fieldId
8097
8130
  );
8098
8131
 
8099
- 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(
8100
8142
  SESSION_ID,
8101
8143
  "events",
8102
8144
  fieldId,
8103
8145
  field_info.props.fieldType,
8104
- args[fieldId]
8146
+ args[fieldId].value
8105
8147
  );
8106
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
8107
8159
  const ret = await func.datasource.get_value(
8108
8160
  SESSION_ID,
8109
8161
  fieldId,
@@ -9054,7 +9106,8 @@ func.events.execute = async function (
9054
9106
  dsP,
9055
9107
  event_name,
9056
9108
  jobNoP,
9057
- null
9109
+ null,
9110
+ calling_trigger_prop?.data?.name?.parameters || {}
9058
9111
  );
9059
9112
  }
9060
9113
  // done_execution(event_name);
@@ -9084,7 +9137,8 @@ func.events.execute = async function (
9084
9137
  dsP,
9085
9138
  event_name,
9086
9139
  jobNoP,
9087
- calling_trigger_prop?.props?.async
9140
+ calling_trigger_prop?.props?.async,
9141
+ calling_trigger_prop?.data?.name?.parameters || {}
9088
9142
  );
9089
9143
  // done_execution(event_name);
9090
9144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.1187",
3
+ "version": "1.3.1189",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {