@xuda.io/xuda-worker-bundle-min 1.3.90 → 1.3.92
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 +79 -48
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -828,7 +828,7 @@ func.api.invoke_event = async function (event_id) {
|
|
|
828
828
|
|
|
829
829
|
return await api_utils.invoke_event(event_id);
|
|
830
830
|
};
|
|
831
|
-
func.api.call_api_program = async function (prog_id, params
|
|
831
|
+
func.api.call_api_program = async function (prog_id, params) {
|
|
832
832
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
833
833
|
const api_utils = await func.common.get_module(
|
|
834
834
|
SESSION_ID,
|
|
@@ -844,7 +844,7 @@ func.api.call_api_program = async function (prog_id, params, opts) {
|
|
|
844
844
|
dsSession: Object.keys(SESSION_OBJ[SESSION_ID].DS_GLB).length - 1,
|
|
845
845
|
});
|
|
846
846
|
|
|
847
|
-
return await api_utils.call_api_program(prog_id, params, null
|
|
847
|
+
return await api_utils.call_api_program(prog_id, params, null);
|
|
848
848
|
};
|
|
849
849
|
glb.DEBUG_INFO_OBJ = {};
|
|
850
850
|
// var CONNECTION_ATTEMPTS = 0;
|
|
@@ -7366,6 +7366,39 @@ func.events.execute = async function (
|
|
|
7366
7366
|
}
|
|
7367
7367
|
return params_obj;
|
|
7368
7368
|
};
|
|
7369
|
+
|
|
7370
|
+
const get_prog_id = async function () {
|
|
7371
|
+
let _prop = args?.calling_trigger_prop?.data?.name?.properties;
|
|
7372
|
+
let _prog_id = args.prog_id;
|
|
7373
|
+
if (_prop?.["xu-exp:prog"]) {
|
|
7374
|
+
_prog_id = (
|
|
7375
|
+
await func.expression.get(
|
|
7376
|
+
SESSION_ID,
|
|
7377
|
+
_prop["xu-exp:prog"],
|
|
7378
|
+
dsSession,
|
|
7379
|
+
"prog_id expression"
|
|
7380
|
+
)
|
|
7381
|
+
).result;
|
|
7382
|
+
}
|
|
7383
|
+
|
|
7384
|
+
return _prog_id;
|
|
7385
|
+
};
|
|
7386
|
+
const get_args_property_value = async function (prop_name) {
|
|
7387
|
+
let _prop = args?.calling_trigger_prop?.data?.name?.properties;
|
|
7388
|
+
let _value = _prop[prop_name];
|
|
7389
|
+
if (_prop?.[`xu-exp:${prop_name}`]) {
|
|
7390
|
+
_value = (
|
|
7391
|
+
await func.expression.get(
|
|
7392
|
+
SESSION_ID,
|
|
7393
|
+
_prop[`xu-exp:${prop_name}`],
|
|
7394
|
+
dsSession,
|
|
7395
|
+
`${prop_name} expression`
|
|
7396
|
+
)
|
|
7397
|
+
).result;
|
|
7398
|
+
}
|
|
7399
|
+
|
|
7400
|
+
return _value;
|
|
7401
|
+
};
|
|
7369
7402
|
var args = {
|
|
7370
7403
|
prog_id: refIdP?.prog,
|
|
7371
7404
|
screenIdP: refIdP?.prog,
|
|
@@ -7948,17 +7981,10 @@ func.events.execute = async function (
|
|
|
7948
7981
|
);
|
|
7949
7982
|
let _field_id = ret_field_id.result;
|
|
7950
7983
|
let _value = ret_value.result;
|
|
7951
|
-
|
|
7984
|
+
|
|
7952
7985
|
updates.push({ _field_id, _value });
|
|
7953
7986
|
}
|
|
7954
7987
|
|
|
7955
|
-
// const drill_datasource = async function (ds_number) {
|
|
7956
|
-
// if (!_session.DS_GLB[ds_number]) {
|
|
7957
|
-
// return;
|
|
7958
|
-
// }
|
|
7959
|
-
// const _ds = _session.DS_GLB[ds_number];
|
|
7960
|
-
// };
|
|
7961
|
-
|
|
7962
7988
|
let datasource_changes = {};
|
|
7963
7989
|
for await (const change of updates) {
|
|
7964
7990
|
let ret_get_value = await func.datasource.get_value(
|
|
@@ -7980,34 +8006,9 @@ func.events.execute = async function (
|
|
|
7980
8006
|
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
|
|
7981
8007
|
change._field_id
|
|
7982
8008
|
] = change._value;
|
|
7983
|
-
// break;
|
|
7984
8009
|
}
|
|
7985
8010
|
}
|
|
7986
|
-
|
|
7987
|
-
// for await (const [key, val] of Object.entries(
|
|
7988
|
-
// Object.assign([], _session.DS_GLB).reverse()
|
|
7989
|
-
// )) {
|
|
7990
|
-
// let ret_get_value = await func.datasource.get_value(
|
|
7991
|
-
// SESSION_ID,
|
|
7992
|
-
// change._field_id,
|
|
7993
|
-
// val.dsSession
|
|
7994
|
-
// );
|
|
7995
|
-
// if (ret_get_value.found) {
|
|
7996
|
-
// ret = ret_get_value;
|
|
7997
|
-
// let _ds = _session.DS_GLB[ret.dsSessionP];
|
|
7998
|
-
// if (!datasource_changes[_ds.dsSession]) {
|
|
7999
|
-
// datasource_changes[_ds.dsSession] = {};
|
|
8000
|
-
// }
|
|
8001
|
-
// if (!datasource_changes[_ds.dsSession][ret.currentRecordId]) {
|
|
8002
|
-
// datasource_changes[_ds.dsSession][ret.currentRecordId] = {};
|
|
8003
|
-
// }
|
|
8004
|
-
// datasource_changes[_ds.dsSession][ret.currentRecordId][
|
|
8005
|
-
// change._field_id
|
|
8006
|
-
// ] = change._value;
|
|
8007
|
-
// break;
|
|
8008
|
-
// }
|
|
8009
|
-
// }
|
|
8010
|
-
// }
|
|
8011
|
+
|
|
8011
8012
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
8012
8013
|
if (jobNoP) func.events.delete_job(SESSION_ID, jobNoP);
|
|
8013
8014
|
// return changes;
|
|
@@ -8044,21 +8045,22 @@ func.events.execute = async function (
|
|
|
8044
8045
|
if (jobNoP) func.events.delete_job(SESSION_ID, jobNoP);
|
|
8045
8046
|
},
|
|
8046
8047
|
call_api: async function () {
|
|
8047
|
-
// console.log(args);
|
|
8048
|
-
// debugger;
|
|
8049
8048
|
const params_obj = await get_params_obj();
|
|
8049
|
+
let _prog_id = await get_prog_id();
|
|
8050
8050
|
|
|
8051
|
-
if (!
|
|
8051
|
+
if (!_prog_id) {
|
|
8052
8052
|
func.utils.debug_report(
|
|
8053
8053
|
SESSION_ID,
|
|
8054
8054
|
"func.events.execute",
|
|
8055
8055
|
elementP + ">" + triggerP + ">" + functionP + ">" + "program missing",
|
|
8056
8056
|
"E"
|
|
8057
8057
|
);
|
|
8058
|
+
func.events.delete_job(SESSION_ID, jobNoP);
|
|
8059
|
+
return;
|
|
8058
8060
|
}
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8061
|
+
|
|
8062
|
+
let output_field = await get_args_property_value("outputField");
|
|
8063
|
+
|
|
8062
8064
|
if (!output_field) {
|
|
8063
8065
|
func.utils.debug_report(
|
|
8064
8066
|
SESSION_ID,
|
|
@@ -8072,14 +8074,43 @@ func.events.execute = async function (
|
|
|
8072
8074
|
"Output field missing",
|
|
8073
8075
|
"E"
|
|
8074
8076
|
);
|
|
8075
|
-
|
|
8077
|
+
func.events.delete_job(SESSION_ID, jobNoP);
|
|
8076
8078
|
return;
|
|
8077
8079
|
}
|
|
8078
|
-
|
|
8079
|
-
const
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8080
|
+
|
|
8081
|
+
const api_ret = await func.api.call_api_program(_prog_id, params_obj);
|
|
8082
|
+
// {
|
|
8083
|
+
// dsSession: dsSessionP,
|
|
8084
|
+
// }
|
|
8085
|
+
// await func.api.set_field_value(output_field, ret);
|
|
8086
|
+
// const datasource_changes = {
|
|
8087
|
+
// [dsSessionP]: {
|
|
8088
|
+
// [ret_get_value.currentRecordId]: { [field_id]: value },
|
|
8089
|
+
// },
|
|
8090
|
+
// };
|
|
8091
|
+
// return await func.datasource.update(_this.SESSION_ID, datasource_changes);
|
|
8092
|
+
|
|
8093
|
+
let datasource_changes = {};
|
|
8094
|
+
|
|
8095
|
+
let ret_get_value = await func.datasource.get_value(
|
|
8096
|
+
SESSION_ID,
|
|
8097
|
+
output_field,
|
|
8098
|
+
dsSessionP
|
|
8099
|
+
);
|
|
8100
|
+
if (ret_get_value.found) {
|
|
8101
|
+
let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
|
|
8102
|
+
if (!datasource_changes[_ds.dsSession]) {
|
|
8103
|
+
datasource_changes[_ds.dsSession] = {};
|
|
8104
|
+
}
|
|
8105
|
+
if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
|
|
8106
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
|
|
8107
|
+
}
|
|
8108
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
|
|
8109
|
+
output_field
|
|
8110
|
+
] = api_ret;
|
|
8111
|
+
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
8112
|
+
}
|
|
8113
|
+
|
|
8083
8114
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
8084
8115
|
},
|
|
8085
8116
|
};
|