@xuda.io/xuda-worker-bundle-min 1.3.843 → 1.3.844

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 +57 -66
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2285,6 +2285,10 @@ func.datasource.execute = async function (
2285
2285
  }
2286
2286
  };
2287
2287
 
2288
+ if (!_ds.v.raw_data) {
2289
+ _ds.v.raw_data = { rows: [] };
2290
+ }
2291
+
2288
2292
  switch (prog_obj.progDataSource?.dataSourceType) {
2289
2293
  case "table":
2290
2294
  _ds._dataSourceTableId = prog_obj.progDataSource?.dataSourceTableId; // get file id
@@ -2347,7 +2351,9 @@ func.datasource.execute = async function (
2347
2351
  filterModelUserSql: _ds.progDataSource.filterModelUserSql,
2348
2352
  };
2349
2353
 
2350
- _ds.data_feed = await func.db.get_query(
2354
+ _ds.data_feed = [];
2355
+
2356
+ _ds.v.raw_data = await func.db.get_query(
2351
2357
  SESSION_ID,
2352
2358
  _ds._dataSourceTableId,
2353
2359
  _ds.v.couchView,
@@ -2393,19 +2399,22 @@ func.datasource.execute = async function (
2393
2399
  data = [];
2394
2400
  }
2395
2401
 
2396
- let _KEY = 0;
2397
- for (const _VAL of data) {
2398
- _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
2399
- _KEY++;
2400
- }
2401
- // if (!_ds.v.raw_data) {
2402
- // _ds.v.raw_data = { rows: [] };
2403
- // }
2404
2402
  // let _KEY = 0;
2405
2403
  // for (const _VAL of data) {
2406
- // _ds.v.raw_data.rows[_KEY] = { id: _KEY, value: { _KEY, _VAL } };
2404
+ // _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
2407
2405
  // _KEY++;
2408
2406
  // }
2407
+
2408
+ _ds.rows_found = data?.length || 0;
2409
+
2410
+ // if (!_ds.v.raw_data) {
2411
+ // _ds.v.raw_data = { rows: [] };
2412
+ // }
2413
+ let _KEY = 0;
2414
+ for (const _VAL of data) {
2415
+ _ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
2416
+ _KEY++;
2417
+ }
2409
2418
  break;
2410
2419
  }
2411
2420
 
@@ -2415,16 +2424,17 @@ func.datasource.execute = async function (
2415
2424
  data = {};
2416
2425
  }
2417
2426
 
2418
- for (let [_KEY, _VAL] of Object.keys(data)) {
2419
- _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
2420
- }
2427
+ // for (let [_KEY, _VAL] of Object.keys(data)) {
2428
+ // _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
2429
+ // }
2430
+ _ds.rows_found = Object.keys(data)?.length || 0;
2421
2431
  // if (!_ds.v.raw_data) {
2422
2432
  // _ds.v.raw_data = { rows: [] };
2423
2433
  // }
2424
2434
 
2425
- // for (let [_KEY, _VAL] of Object.keys(data)) {
2426
- // _ds.v.raw_data.rows[_KEY] = { id: _KEY, value: { _KEY, _VAL } };
2427
- // }
2435
+ for (let [_KEY, _VAL] of Object.keys(data)) {
2436
+ _ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
2437
+ }
2428
2438
 
2429
2439
  break;
2430
2440
  }
@@ -2435,16 +2445,6 @@ func.datasource.execute = async function (
2435
2445
  data = "";
2436
2446
  }
2437
2447
 
2438
- if (!_ds.v.raw_data) {
2439
- _ds.v.raw_data = { rows: [] };
2440
- }
2441
-
2442
- let _KEY = 0;
2443
- let arr = data.split(",");
2444
- for (const _VAL of arr) {
2445
- _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
2446
- _KEY++;
2447
- }
2448
2448
  // if (!_ds.v.raw_data) {
2449
2449
  // _ds.v.raw_data = { rows: [] };
2450
2450
  // }
@@ -2452,10 +2452,21 @@ func.datasource.execute = async function (
2452
2452
  // let _KEY = 0;
2453
2453
  // let arr = data.split(",");
2454
2454
  // for (const _VAL of arr) {
2455
- // _ds.v.raw_data.rows[_KEY] = { id: _KEY, value: { _KEY, _VAL } };
2455
+ // _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
2456
2456
  // _KEY++;
2457
2457
  // }
2458
+ // _ds.rows_found = arr?.length || 0;
2459
+ // if (!_ds.v.raw_data) {
2460
+ // _ds.v.raw_data = { rows: [] };
2461
+ // }
2458
2462
 
2463
+ let _KEY = 0;
2464
+ let arr = data.split(",");
2465
+ for (const _VAL of arr) {
2466
+ _ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
2467
+ _KEY++;
2468
+ }
2469
+ _ds.rows_found = arr?.length || 0;
2459
2470
  break;
2460
2471
 
2461
2472
  default:
@@ -2556,7 +2567,7 @@ func.datasource.execute = async function (
2556
2567
  if (has_datasource && Number(key) >= _ds.v.batch_loops) break;
2557
2568
 
2558
2569
  if (!has_datasource) {
2559
- val.value = _ds?.data_feed?.rows?.[key] || { _ROWID: key };
2570
+ val = _ds?.data_feed?.rows?.[key] || { _ROWID: key };
2560
2571
  }
2561
2572
 
2562
2573
  if (await get_before_record_count()) {
@@ -2597,9 +2608,7 @@ func.datasource.execute = async function (
2597
2608
  ret = await db_adapter_module.process_view_dataset(
2598
2609
  SESSION_ID,
2599
2610
  dataSourceSession,
2600
- _ds.v,
2601
2611
  _ds
2602
- // json1
2603
2612
  );
2604
2613
 
2605
2614
  if (await get_after_record_count()) {
@@ -2711,7 +2720,7 @@ func.datasource.execute = async function (
2711
2720
  _ds.rows_processed = 0;
2712
2721
  _ds.viewRangeExp_rows_deleted = 0;
2713
2722
 
2714
- let rows = _ds?.data_feed?.rows?.length;
2723
+ let rows = _ds?.raw_data?.rows?.length;
2715
2724
 
2716
2725
  _ds.data_feed.rows_changed = [];
2717
2726
  _ds.data_feed.rows_deleted = [];
@@ -2728,7 +2737,7 @@ func.datasource.execute = async function (
2728
2737
  await func.datasource.render_fields_form(
2729
2738
  SESSION_ID,
2730
2739
  dataSourceSession,
2731
- { _ROWID: "newRecord" }
2740
+ { id: "newRecord" }
2732
2741
  );
2733
2742
  }
2734
2743
 
@@ -2765,7 +2774,7 @@ func.datasource.execute = async function (
2765
2774
  break;
2766
2775
  }
2767
2776
 
2768
- _ds.firstRecordId = _ds.data_feed.rows[0]._ROWID;
2777
+ _ds.firstRecordId = _ds.raw_data.rows[0].id;
2769
2778
 
2770
2779
  const finish_form = async function () {
2771
2780
  // check if locatedRecordId exist in SESSION_OBJ[SESSION_ID].DS_GLB
@@ -2788,7 +2797,7 @@ func.datasource.execute = async function (
2788
2797
  _ds.currentRecordId = _ds.finalRecordId;
2789
2798
  };
2790
2799
 
2791
- for await (const [key, val] of Object.entries(_ds.data_feed.rows)) {
2800
+ for await (const [key, val] of Object.entries(_ds.raw_data.rows)) {
2792
2801
  if (await get_before_record_count()) {
2793
2802
  await func.datasource.execute_view_events(
2794
2803
  SESSION_ID,
@@ -2801,12 +2810,7 @@ func.datasource.execute = async function (
2801
2810
  SESSION_ID,
2802
2811
  dataSourceSession,
2803
2812
  key,
2804
- null,
2805
- null,
2806
- null,
2807
- _ds.pre_init_fields,
2808
- val,
2809
- db_adapter_module
2813
+ val.value
2810
2814
  );
2811
2815
 
2812
2816
  if (await get_after_record_count()) {
@@ -3081,15 +3085,15 @@ func.datasource.render_fields_form = async function (
3081
3085
 
3082
3086
  let row_idx;
3083
3087
  try {
3084
- row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
3088
+ row_idx = func.common.find_ROWID_idx(_ds, data.id);
3085
3089
  // data_arr[row_idx] = [{ _ROWID: "newRecord" }];
3086
3090
  } catch (error) {
3087
3091
  // if (data._ROWID === "newRecord") {
3088
3092
  // _ds.data_feed.rows[glb.newRecord] = { _ROWID: data._ROWID };
3089
3093
  // } else {
3090
- _ds.data_feed.rows.push({ _ROWID: data._ROWID });
3094
+ _ds.data_feed.rows.push({ _ROWID: data.id });
3091
3095
  // }
3092
- row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
3096
+ row_idx = func.common.find_ROWID_idx(_ds, data.id);
3093
3097
  }
3094
3098
 
3095
3099
  _ds.dataset_alias = {};
@@ -3119,7 +3123,7 @@ func.datasource.render_fields_form = async function (
3119
3123
  case "_ROWDOC": {
3120
3124
  _ds.data_feed.rows[row_idx][fieldId] = await get_value(
3121
3125
  fieldId,
3122
- data
3126
+ data.value
3123
3127
  );
3124
3128
 
3125
3129
  continue;
@@ -3157,7 +3161,7 @@ func.datasource.render_fields_form = async function (
3157
3161
  }
3158
3162
  _ds.data_feed.rows[row_idx][fieldId] = await get_value(
3159
3163
  fieldId,
3160
- data[fieldId]
3164
+ data.value[fieldId]
3161
3165
  );
3162
3166
  }
3163
3167
  } catch (err) {
@@ -3170,44 +3174,31 @@ func.datasource.run_rows_form = async function (
3170
3174
  SESSION_ID,
3171
3175
  dataSourceSession,
3172
3176
  rowIdxP,
3173
- NA_onDemandP,
3174
- NA_callbackP,
3175
- NA_oninit_triggers_to_runP,
3176
- pre_init_fieldsP,
3177
- data,
3178
- db_adapter_module
3177
+ data
3179
3178
  ) {
3180
3179
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
3181
3180
  if (!_ds) return;
3182
3181
  // var v = _ds.v;
3183
3182
 
3184
3183
  var val = _ds.data_feed.rows[rowIdxP];
3185
-
3184
+ let _ROWID = val.id;
3186
3185
  var idx;
3187
3186
 
3188
3187
  try {
3189
3188
  if (typeof val !== "undefined") {
3190
3189
  idx = rowIdxP;
3191
3190
  } else {
3192
- val = _ds.data_feed.rows.push({ _ROWID: "newRecord" });
3193
- idx = func.common.find_ROWID_idx(_ds, "newRecord");
3191
+ _ROWID = "newRecord";
3192
+ val = _ds.data_feed.rows.push({ _ROWID });
3193
+ idx = func.common.find_ROWID_idx(_ds, _ROWID);
3194
3194
  }
3195
3195
  } catch (e) {
3196
3196
  console.error(e);
3197
3197
  }
3198
3198
 
3199
- _ds.currentRecordId = val._ROWID; // set temporary to allow expression decoder work
3199
+ _ds.currentRecordId = _ROWID; // set temporary to allow expression decoder work
3200
3200
 
3201
- await func.datasource.render_fields_form(
3202
- SESSION_ID,
3203
- dataSourceSession,
3204
- data
3205
- // null,
3206
- // true,
3207
- // idx,
3208
- // true,
3209
- // pre_init_fieldsP
3210
- );
3201
+ await func.datasource.render_fields_form(SESSION_ID, dataSourceSession, data);
3211
3202
  const init_count = await func.datasource.get_field_init_count(
3212
3203
  SESSION_ID,
3213
3204
  dataSourceSession,
@@ -5193,7 +5184,7 @@ func.utils.clean_returned_datasource = function (SESSION_ID, DS) {
5193
5184
  // }
5194
5185
  delete obj.pre_init_fields;
5195
5186
  delete obj.oninit_triggers_to_run;
5196
- // delete obj.raw_data;
5187
+ delete obj.raw_data;
5197
5188
 
5198
5189
  delete obj.debug;
5199
5190
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.843",
3
+ "version": "1.3.844",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {