@xuda.io/xuda-worker-bundle-min 1.3.277 → 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 +35 -0
  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 = {};
@@ -4331,6 +4333,39 @@ func.datasource.get_pre_init_fields = function (
4331
4333
  var ret = [];
4332
4334
  return; // inactive 021617
4333
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
+ };
4334
4369
  func.utils = {};
4335
4370
 
4336
4371
  func.utils.debug = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.277",
3
+ "version": "1.3.278",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {