@xuda.io/xuda-worker-bundle-min 1.3.1081 → 1.3.1083

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 +39 -27
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2206,10 +2206,21 @@ func.datasource.execute = async function (
2206
2206
  prog_obj.scriptData.value,
2207
2207
  dataSourceSession,
2208
2208
  "api_rendered_output",
2209
- null
2209
+ null, null, null, null, null, null, null, null, null, tree_obj.apiOutput
2210
2210
  );
2211
+
2212
+ let output_result = exp.result
2213
+ if (tree_obj.apiOutput === "json") {
2214
+ // iterate object to fix expressions
2215
+ for await ([key, val] of Object.entries(output_result)) {
2216
+ output_result[key] = (await func.expression.get(
2217
+ SESSION_ID,
2218
+ val,
2219
+ dataSourceSession, "object_property")).result
2220
+ }
2221
+ }
2211
2222
  _ds.api_rendered_output +=
2212
- exp.result + (tree_obj.apiOutput === "json" ? "," : "");
2223
+ output_result + (tree_obj.apiOutput === "json" ? "," : "");
2213
2224
  } else {
2214
2225
  _ds.api_rendered_output = ""; //empty
2215
2226
  }
@@ -2294,8 +2305,8 @@ func.datasource.execute = async function (
2294
2305
  SESSION_ID,
2295
2306
  "Data source",
2296
2307
  err.message +
2297
- " https://" +
2298
- prog_obj.progDataSource.dataSourceDataUrl,
2308
+ " https://" +
2309
+ prog_obj.progDataSource.dataSourceDataUrl,
2299
2310
  "E"
2300
2311
  );
2301
2312
  return null;
@@ -3848,7 +3859,7 @@ func.datasource.del = function (SESSION_ID, dsP) {
3848
3859
 
3849
3860
  const perform_delete = async function () {
3850
3861
  var response = {
3851
- success: function (jsonP, ajaxP) {},
3862
+ success: function (jsonP, ajaxP) { },
3852
3863
  error: function (status) {
3853
3864
  console.error("error datasource:" + status);
3854
3865
  },
@@ -3914,8 +3925,8 @@ func.datasource.del = function (SESSION_ID, dsP) {
3914
3925
  if (SESSION_OBJ[SESSION_ID].DS_GLB[dsP]) {
3915
3926
  delete SCREEN_BLOCKER_OBJ[
3916
3927
  SESSION_OBJ[SESSION_ID].DS_GLB[dsP].screenId +
3917
- "_" +
3918
- SESSION_OBJ[SESSION_ID].DS_GLB[dsP].callingScreenId
3928
+ "_" +
3929
+ SESSION_OBJ[SESSION_ID].DS_GLB[dsP].callingScreenId
3919
3930
  ];
3920
3931
 
3921
3932
  delete_pending_jobs();
@@ -4576,7 +4587,7 @@ func.datasource.get_value = async function (
4576
4587
  _ds.data_feed.rows[row_idx][_field_id]
4577
4588
  );
4578
4589
  }
4579
- } catch (error) {}
4590
+ } catch (error) { }
4580
4591
 
4581
4592
  if (typeof _ds?.dynamic_fields?.[_field_id] !== "undefined") {
4582
4593
  return await return_dynamic_value(_field_id, _ds.dynamic_fields[_field_id]);
@@ -9227,7 +9238,8 @@ func.expression.get = async function (
9227
9238
  debug_infoP,
9228
9239
  iterate_info,
9229
9240
  js_script_callback,
9230
- jobNo
9241
+ jobNo,
9242
+ api_output_type
9231
9243
  ) {
9232
9244
  class xu_class {
9233
9245
  async get() {
@@ -9520,24 +9532,24 @@ func.expression.get = async function (
9520
9532
  exp_exist = true;
9521
9533
  }
9522
9534
  res[key] = val.value;
9523
- if (
9524
- !["DbQuery", "alert", "exp", "api_rendered_output"].includes(
9525
- sourceP
9526
- ) &&
9527
- ["string", "date"].includes(val.type) &&
9528
- var_Arr.length > 1
9529
- ) {
9530
- res[key] = "`" + val.value + "`";
9531
- }
9532
- // new Dec 18 2024 for Ishai
9533
- if (
9534
- ["api_rendered_output"].includes(sourceP) &&
9535
- ["string", "date"].includes(val.type) &&
9536
- var_Arr.length > 1
9537
- ) {
9538
- res[key] = `"` + val.value + `"`;
9539
- }
9540
9535
 
9536
+ if (var_Arr.length > 1) { // complex input
9537
+ if (
9538
+ !["DbQuery", "alert", "exp", "api_rendered_output"].includes(
9539
+ sourceP
9540
+ ) &&
9541
+ ["string", "date"].includes(val.type)
9542
+ ) {
9543
+ res[key] = "`" + val.value + "`";
9544
+ }
9545
+ // new Dec 18 2024 for Ishai // json,html,xml,text,css
9546
+ if (
9547
+ ["api_rendered_output"].includes(sourceP) && ["json"].includes(api_output_type) &&
9548
+ ["string", "date"].includes(val.type)
9549
+ ) {
9550
+ res[key] = `"` + val.value + `"`;
9551
+ }
9552
+ }
9541
9553
  if (val.fieldId && val.value && typeof val.value === "string") {
9542
9554
  if (
9543
9555
  ["query", "condition", "range", "sort", "locate"].includes(
@@ -9566,7 +9578,7 @@ func.expression.get = async function (
9566
9578
  if (typeof val.value === "object" && var_Arr.length > 1) {
9567
9579
  if (
9568
9580
  !Array.isArray(val.value) &&
9569
- !var_Arr[key + 1].value?.includes(".")
9581
+ !var_Arr[key + 1].value?.includes(".") && !["api_rendered_output"].includes(sourceP)
9570
9582
  ) {
9571
9583
  // prevent cast on single value expression
9572
9584
  res[key] = "(" + JSON.stringify(val.value) + ")";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.1081",
3
+ "version": "1.3.1083",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {