@xuda.io/xuda-worker-bundle-min 1.3.276 → 1.3.278

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 -23
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -28,6 +28,8 @@ glb.PROTECTED_VARS = [
28
28
  "_ROW_NO",
29
29
  "_ROW_ID",
30
30
  "_ROW_DOC",
31
+ "_KEY",
32
+ "_VAL",
31
33
  ];
32
34
 
33
35
  func.common = {};
@@ -1924,7 +1926,6 @@ func.datasource.execute = async function (
1924
1926
  break;
1925
1927
 
1926
1928
  case "array": {
1927
- debugger;
1928
1929
  let data = await get_data_from_source();
1929
1930
  console.log("data", data);
1930
1931
  if (!_ds.v.raw_data) {
@@ -4332,6 +4333,39 @@ func.datasource.get_pre_init_fields = function (
4332
4333
  var ret = [];
4333
4334
  return; // inactive 021617
4334
4335
  }; // temporary inactive, init preformed on the first round
4336
+
4337
+ func.datasource.add_dynamic_field_to_dataset = function (
4338
+ SESSION_ID,
4339
+ dsSessionP,
4340
+ key,
4341
+ val
4342
+ ) {
4343
+ var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];
4344
+ if (!_ds.dynamic_fields) {
4345
+ _ds.dynamic_fields = [];
4346
+ }
4347
+
4348
+ // todo: check duplicates
4349
+ if (_ds.dynamic_fields.some((e) => e.data.field_id === key)) return;
4350
+
4351
+ const toType = function (obj) {
4352
+ return {}.toString
4353
+ .call(obj)
4354
+ .match(/\s([a-zA-Z]+)/)[1]
4355
+ .toLowerCase();
4356
+ };
4357
+
4358
+ _ds.dynamic_fields.push({
4359
+ id: Date.now(),
4360
+ data: {
4361
+ type: "virtual",
4362
+ field_id: key,
4363
+ },
4364
+ props: {
4365
+ fieldType: val ? toType(val) : "string",
4366
+ },
4367
+ });
4368
+ };
4335
4369
  func.utils = {};
4336
4370
 
4337
4371
  func.utils.debug = {};
@@ -5949,33 +5983,33 @@ func.utils.alerts.invoke = async function (
5949
5983
  } else {
5950
5984
  console.error(message);
5951
5985
  }
5952
- } else {
5953
- // if (typeof IS_PROCESS_SERVER !== "undefined") return;
5954
- func.utils.post_back_to_client(SESSION_ID, "alert", _session.worker_id, [
5955
- SESSION_ID,
5956
- alert_type,
5957
- alertDisplay,
5958
- message,
5959
- ]);
5960
- }
5961
-
5962
- if (sys_alerts_obj[paramsP]) {
5963
- var str = paramsP + " " + title + " " + message;
5964
- if (sys_alerts_obj[paramsP].alert_type === "error") {
5965
- console.error(str);
5966
- } else if (sys_alerts_obj[paramsP].alert_type === "warning") {
5967
- console.warn(str);
5968
- } else {
5969
- console.log(str);
5970
- }
5986
+ return;
5987
+ }
5988
+
5989
+ // if (typeof IS_PROCESS_SERVER !== "undefined") return;
5990
+ return func.utils.post_back_to_client(
5991
+ SESSION_ID,
5992
+ "alert",
5993
+ _session.worker_id,
5994
+ [SESSION_ID, alert_type, alertDisplay, message]
5995
+ );
5996
+ }
5997
+
5998
+ if (sys_alerts_obj[paramsP]) {
5999
+ var str = paramsP + " " + title + " " + message;
6000
+ if (sys_alerts_obj[paramsP].alert_type === "error") {
6001
+ console.error(str);
6002
+ } else if (sys_alerts_obj[paramsP].alert_type === "warning") {
6003
+ console.warn(str);
5971
6004
  } else {
5972
6005
  console.log(str);
5973
6006
  }
5974
- ALERT_IS_ACTIVE = false;
5975
-
5976
- return;
6007
+ } else {
6008
+ console.log(str);
5977
6009
  }
5978
6010
 
6011
+ ALERT_IS_ACTIVE = false;
6012
+
5979
6013
  func.utils.alerts.execute(
5980
6014
  SESSION_ID,
5981
6015
  alert_type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.276",
3
+ "version": "1.3.278",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {