@xuda.io/xuda-worker-bundle-min 1.3.695 → 1.3.696
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 +71 -24
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8740,16 +8740,16 @@ func.events.execute = async function (
|
|
|
8740
8740
|
|
|
8741
8741
|
const payload = await get_args_property_value("payload");
|
|
8742
8742
|
|
|
8743
|
-
if (!payload) {
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
}
|
|
8743
|
+
// if (!payload) {
|
|
8744
|
+
// func.utils.debug_report(
|
|
8745
|
+
// SESSION_ID,
|
|
8746
|
+
// "func.events.execute",
|
|
8747
|
+
// `${elementP} >${triggerP} >${functionP} > payload not defined`,
|
|
8748
|
+
// "E"
|
|
8749
|
+
// );
|
|
8750
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
8751
|
+
// return;
|
|
8752
|
+
// }
|
|
8753
8753
|
|
|
8754
8754
|
const output_field = await get_args_property_value("outputField");
|
|
8755
8755
|
|
|
@@ -8806,32 +8806,83 @@ func.events.execute = async function (
|
|
|
8806
8806
|
return;
|
|
8807
8807
|
}
|
|
8808
8808
|
|
|
8809
|
-
const
|
|
8809
|
+
const url = await get_args_property_value("url");
|
|
8810
8810
|
|
|
8811
|
-
if (!
|
|
8811
|
+
if (!url) {
|
|
8812
8812
|
func.utils.debug_report(
|
|
8813
8813
|
SESSION_ID,
|
|
8814
8814
|
"func.events.execute",
|
|
8815
|
-
`${elementP} >${triggerP} >${functionP} >
|
|
8815
|
+
`${elementP} >${triggerP} >${functionP} > url not defined`,
|
|
8816
8816
|
"E"
|
|
8817
8817
|
);
|
|
8818
8818
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
8819
8819
|
return;
|
|
8820
8820
|
}
|
|
8821
8821
|
|
|
8822
|
-
const
|
|
8822
|
+
const payload_arr = await get_args_property_value("payload");
|
|
8823
8823
|
|
|
8824
|
-
|
|
8824
|
+
const report_conversion_error = function (res, typeP, valP) {
|
|
8825
|
+
var msg = `${elementP} >${triggerP} >${functionP} > error converting from ${valP} to ${typeP}`;
|
|
8826
|
+
if (error) {
|
|
8827
|
+
return func.utils.debug_report(SESSION_ID, msg, "", "W");
|
|
8828
|
+
}
|
|
8825
8829
|
func.utils.debug_report(
|
|
8826
8830
|
SESSION_ID,
|
|
8827
|
-
"
|
|
8828
|
-
|
|
8831
|
+
msg + " " + _.capitalize(source) + prog_info,
|
|
8832
|
+
"",
|
|
8829
8833
|
"E"
|
|
8830
8834
|
);
|
|
8831
|
-
|
|
8832
|
-
|
|
8835
|
+
};
|
|
8836
|
+
const report_conversion_warn = function (res) {
|
|
8837
|
+
var msg = `${elementP} >${triggerP} >${functionP} > type mismatch auto conversion from value ${valP} to ${typeP}`;
|
|
8838
|
+
func.utils.debug_report(
|
|
8839
|
+
SESSION_ID,
|
|
8840
|
+
msg + " " + _.capitalize(source) + prog_info,
|
|
8841
|
+
"",
|
|
8842
|
+
"W"
|
|
8843
|
+
);
|
|
8844
|
+
};
|
|
8845
|
+
// var ret = valP;
|
|
8846
|
+
if (error) {
|
|
8847
|
+
return report_conversion_error();
|
|
8833
8848
|
}
|
|
8834
8849
|
|
|
8850
|
+
const module = await func.common.get_module(
|
|
8851
|
+
SESSION_ID,
|
|
8852
|
+
"xuda-get-cast-util-module.mjs"
|
|
8853
|
+
);
|
|
8854
|
+
// return module.cast(
|
|
8855
|
+
// typeP,
|
|
8856
|
+
// valP,
|
|
8857
|
+
// report_conversion_error,
|
|
8858
|
+
// report_conversion_warn
|
|
8859
|
+
// );
|
|
8860
|
+
|
|
8861
|
+
var payload = _.reduce(
|
|
8862
|
+
payload_arr,
|
|
8863
|
+
(ret, val, key) => {
|
|
8864
|
+
ret[val.key] = module.cast(
|
|
8865
|
+
val.type,
|
|
8866
|
+
val.val,
|
|
8867
|
+
report_conversion_error,
|
|
8868
|
+
report_conversion_warn
|
|
8869
|
+
);
|
|
8870
|
+
|
|
8871
|
+
return ret;
|
|
8872
|
+
},
|
|
8873
|
+
{}
|
|
8874
|
+
);
|
|
8875
|
+
// if (!payload) {
|
|
8876
|
+
// func.utils.debug_report(
|
|
8877
|
+
// SESSION_ID,
|
|
8878
|
+
// "func.events.execute",
|
|
8879
|
+
// `${elementP} >${triggerP} >${functionP} > payload not defined`,
|
|
8880
|
+
// "E"
|
|
8881
|
+
// );
|
|
8882
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
8883
|
+
// return;
|
|
8884
|
+
// }
|
|
8885
|
+
|
|
8835
8886
|
const output_field = await get_args_property_value("outputField");
|
|
8836
8887
|
|
|
8837
8888
|
// if (!output_field) {
|
|
@@ -8845,11 +8896,7 @@ func.events.execute = async function (
|
|
|
8845
8896
|
// return;
|
|
8846
8897
|
// }
|
|
8847
8898
|
|
|
8848
|
-
const api_ret = await func.api.call_external_api(
|
|
8849
|
-
method,
|
|
8850
|
-
api_url,
|
|
8851
|
-
payload
|
|
8852
|
-
);
|
|
8899
|
+
const api_ret = await func.api.call_external_api(method, url, payload);
|
|
8853
8900
|
if (output_field) {
|
|
8854
8901
|
let datasource_changes = {};
|
|
8855
8902
|
|