@xuda.io/xuda-worker-bundle-min 1.3.695 → 1.3.697
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 +105 -24
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1048,6 +1048,40 @@ func.api.call_project_api = async function (prog_id, params) {
|
|
|
1048
1048
|
|
|
1049
1049
|
return await api_utils.call_project_api(prog_id, params, null);
|
|
1050
1050
|
};
|
|
1051
|
+
func.api.call_system_api = async function (api_method, payload) {
|
|
1052
|
+
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
1053
|
+
const api_utils = await func.common.get_module(
|
|
1054
|
+
SESSION_ID,
|
|
1055
|
+
"xuda-api-library.mjs",
|
|
1056
|
+
{
|
|
1057
|
+
func,
|
|
1058
|
+
glb,
|
|
1059
|
+
SESSION_OBJ,
|
|
1060
|
+
SESSION_ID,
|
|
1061
|
+
APP_OBJ,
|
|
1062
|
+
dsSession: Object.keys(SESSION_OBJ[SESSION_ID].DS_GLB).length - 1,
|
|
1063
|
+
}
|
|
1064
|
+
);
|
|
1065
|
+
|
|
1066
|
+
return await api_utils.call_system_api(api_method, payload, null);
|
|
1067
|
+
};
|
|
1068
|
+
func.api.call_external_api = async function (method, url, payload) {
|
|
1069
|
+
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
1070
|
+
const api_utils = await func.common.get_module(
|
|
1071
|
+
SESSION_ID,
|
|
1072
|
+
"xuda-api-library.mjs",
|
|
1073
|
+
{
|
|
1074
|
+
func,
|
|
1075
|
+
glb,
|
|
1076
|
+
SESSION_OBJ,
|
|
1077
|
+
SESSION_ID,
|
|
1078
|
+
APP_OBJ,
|
|
1079
|
+
dsSession: Object.keys(SESSION_OBJ[SESSION_ID].DS_GLB).length - 1,
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
|
|
1083
|
+
return await api_utils.call_external_api(method, url, payload, null);
|
|
1084
|
+
};
|
|
1051
1085
|
glb.rpi_request_queue_num = 0;
|
|
1052
1086
|
func.common.perform_rpi_request = async function (
|
|
1053
1087
|
SESSION_ID,
|
|
@@ -8740,16 +8774,16 @@ func.events.execute = async function (
|
|
|
8740
8774
|
|
|
8741
8775
|
const payload = await get_args_property_value("payload");
|
|
8742
8776
|
|
|
8743
|
-
if (!payload) {
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
}
|
|
8777
|
+
// if (!payload) {
|
|
8778
|
+
// func.utils.debug_report(
|
|
8779
|
+
// SESSION_ID,
|
|
8780
|
+
// "func.events.execute",
|
|
8781
|
+
// `${elementP} >${triggerP} >${functionP} > payload not defined`,
|
|
8782
|
+
// "E"
|
|
8783
|
+
// );
|
|
8784
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
8785
|
+
// return;
|
|
8786
|
+
// }
|
|
8753
8787
|
|
|
8754
8788
|
const output_field = await get_args_property_value("outputField");
|
|
8755
8789
|
|
|
@@ -8806,32 +8840,83 @@ func.events.execute = async function (
|
|
|
8806
8840
|
return;
|
|
8807
8841
|
}
|
|
8808
8842
|
|
|
8809
|
-
const
|
|
8843
|
+
const url = await get_args_property_value("url");
|
|
8810
8844
|
|
|
8811
|
-
if (!
|
|
8845
|
+
if (!url) {
|
|
8812
8846
|
func.utils.debug_report(
|
|
8813
8847
|
SESSION_ID,
|
|
8814
8848
|
"func.events.execute",
|
|
8815
|
-
`${elementP} >${triggerP} >${functionP} >
|
|
8849
|
+
`${elementP} >${triggerP} >${functionP} > url not defined`,
|
|
8816
8850
|
"E"
|
|
8817
8851
|
);
|
|
8818
8852
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
8819
8853
|
return;
|
|
8820
8854
|
}
|
|
8821
8855
|
|
|
8822
|
-
const
|
|
8856
|
+
const payload_arr = await get_args_property_value("payload");
|
|
8823
8857
|
|
|
8824
|
-
|
|
8858
|
+
const report_conversion_error = function (res, typeP, valP) {
|
|
8859
|
+
var msg = `${elementP} >${triggerP} >${functionP} > error converting from ${valP} to ${typeP}`;
|
|
8860
|
+
if (error) {
|
|
8861
|
+
return func.utils.debug_report(SESSION_ID, msg, "", "W");
|
|
8862
|
+
}
|
|
8825
8863
|
func.utils.debug_report(
|
|
8826
8864
|
SESSION_ID,
|
|
8827
|
-
"
|
|
8828
|
-
|
|
8865
|
+
msg + " " + _.capitalize(source) + prog_info,
|
|
8866
|
+
"",
|
|
8829
8867
|
"E"
|
|
8830
8868
|
);
|
|
8831
|
-
|
|
8832
|
-
|
|
8869
|
+
};
|
|
8870
|
+
const report_conversion_warn = function (res) {
|
|
8871
|
+
var msg = `${elementP} >${triggerP} >${functionP} > type mismatch auto conversion from value ${valP} to ${typeP}`;
|
|
8872
|
+
func.utils.debug_report(
|
|
8873
|
+
SESSION_ID,
|
|
8874
|
+
msg + " " + _.capitalize(source) + prog_info,
|
|
8875
|
+
"",
|
|
8876
|
+
"W"
|
|
8877
|
+
);
|
|
8878
|
+
};
|
|
8879
|
+
// var ret = valP;
|
|
8880
|
+
if (error) {
|
|
8881
|
+
return report_conversion_error();
|
|
8833
8882
|
}
|
|
8834
8883
|
|
|
8884
|
+
const module = await func.common.get_module(
|
|
8885
|
+
SESSION_ID,
|
|
8886
|
+
"xuda-get-cast-util-module.mjs"
|
|
8887
|
+
);
|
|
8888
|
+
// return module.cast(
|
|
8889
|
+
// typeP,
|
|
8890
|
+
// valP,
|
|
8891
|
+
// report_conversion_error,
|
|
8892
|
+
// report_conversion_warn
|
|
8893
|
+
// );
|
|
8894
|
+
|
|
8895
|
+
var payload = _.reduce(
|
|
8896
|
+
payload_arr,
|
|
8897
|
+
(ret, val, key) => {
|
|
8898
|
+
ret[val.key] = module.cast(
|
|
8899
|
+
val.type,
|
|
8900
|
+
val.val,
|
|
8901
|
+
report_conversion_error,
|
|
8902
|
+
report_conversion_warn
|
|
8903
|
+
);
|
|
8904
|
+
|
|
8905
|
+
return ret;
|
|
8906
|
+
},
|
|
8907
|
+
{}
|
|
8908
|
+
);
|
|
8909
|
+
// if (!payload) {
|
|
8910
|
+
// func.utils.debug_report(
|
|
8911
|
+
// SESSION_ID,
|
|
8912
|
+
// "func.events.execute",
|
|
8913
|
+
// `${elementP} >${triggerP} >${functionP} > payload not defined`,
|
|
8914
|
+
// "E"
|
|
8915
|
+
// );
|
|
8916
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
8917
|
+
// return;
|
|
8918
|
+
// }
|
|
8919
|
+
|
|
8835
8920
|
const output_field = await get_args_property_value("outputField");
|
|
8836
8921
|
|
|
8837
8922
|
// if (!output_field) {
|
|
@@ -8845,11 +8930,7 @@ func.events.execute = async function (
|
|
|
8845
8930
|
// return;
|
|
8846
8931
|
// }
|
|
8847
8932
|
|
|
8848
|
-
const api_ret = await func.api.call_external_api(
|
|
8849
|
-
method,
|
|
8850
|
-
api_url,
|
|
8851
|
-
payload
|
|
8852
|
-
);
|
|
8933
|
+
const api_ret = await func.api.call_external_api(method, url, payload);
|
|
8853
8934
|
if (output_field) {
|
|
8854
8935
|
let datasource_changes = {};
|
|
8855
8936
|
|