@xuda.io/runtime-bundle 1.0.1414 → 1.0.1415

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 (46) hide show
  1. package/js/modules/xuda-actions-module.esm.js +10 -10
  2. package/js/modules/xuda-actions-module.esm.min.js +1 -1
  3. package/js/modules/xuda-api-library.min.mjs +1 -1
  4. package/js/modules/xuda-api-library.mjs +1 -1
  5. package/js/modules/xuda-datasource-db-adapter-module.min.mjs +1 -1
  6. package/js/modules/xuda-datasource-db-adapter-module.mjs +4 -4
  7. package/js/modules/xuda-db-adapter-module.min.mjs +1 -1
  8. package/js/modules/xuda-db-adapter-module.mjs +9 -9
  9. package/js/modules/xuda-debug-utils-module.min.mjs +1 -1
  10. package/js/modules/xuda-debug-utils-module.mjs +6 -6
  11. package/js/modules/xuda-event-ui-elements-module.esm.js +6 -6
  12. package/js/modules/xuda-event-ui-elements-module.esm.min.js +1 -1
  13. package/js/modules/xuda-get-cast-util-module.min.mjs +1 -1
  14. package/js/modules/xuda-get-cast-util-module.mjs +5 -10
  15. package/js/modules/xuda-get-support-module.esm.js +15 -12
  16. package/js/modules/xuda-get-support-module.esm.min.js +1 -1
  17. package/js/modules/xuda-input-musk-utils-module.min.mjs +1 -1
  18. package/js/modules/xuda-input-musk-utils-module.mjs +22 -35
  19. package/js/modules/xuda-live-preview-module.esm.js +36 -31
  20. package/js/modules/xuda-live-preview-module.esm.min.js +1 -1
  21. package/js/modules/xuda-peer-actions-module.esm.js +5 -5
  22. package/js/modules/xuda-peer-actions-module.esm.min.js +1 -1
  23. package/js/modules/xuda-progs-loader-module.min.mjs +1 -1
  24. package/js/modules/xuda-progs-loader-module.mjs +8 -7
  25. package/js/modules/xuda-project-loader-module.esm.js +17 -12
  26. package/js/modules/xuda-project-loader-module.esm.min.js +1 -1
  27. package/js/modules/xuda-studio-checker.min.mjs +1 -1
  28. package/js/modules/xuda-studio-checker.mjs +79 -80
  29. package/js/xuda-runtime-bundle.js +1562 -1170
  30. package/js/xuda-runtime-bundle.min.js +5 -5
  31. package/js/xuda-runtime-mini-bundle.js +22 -52
  32. package/js/xuda-runtime-mini-bundle.min.js +1 -1
  33. package/js/xuda-runtime-slim.js +1562 -1095
  34. package/js/xuda-runtime-slim.min.es.js +1563 -1171
  35. package/js/xuda-runtime-slim.min.js +4 -4
  36. package/js/xuda-runtime-vendor.js +1 -212
  37. package/js/xuda-runtime-vendor.min.js +2 -2
  38. package/js/xuda-server-bundle.min.mjs +2 -2
  39. package/js/xuda-server-bundle.mjs +730 -155
  40. package/js/xuda-worker-bundle.js +730 -155
  41. package/js/xuda-worker-bundle.min.js +2 -2
  42. package/js/xuda_common-bundle.js +221 -26
  43. package/js/xuda_common-bundle.min.js +1 -1
  44. package/js/xuda_worker.js +0 -6
  45. package/js/xuda_worker.min.js +1 -1
  46. package/package.json +1 -1
@@ -5,6 +5,49 @@ if (typeof IS_DOCKER === 'undefined' || typeof IS_PROCESS_SERVER === 'undefined'
5
5
  var DOCS_OBJ = {};
6
6
  }
7
7
 
8
+ // Minimal jQuery shim for plugins that still reference $
9
+ if (typeof $ === 'undefined' && typeof document !== 'undefined') {
10
+ var $ = function (selector) {
11
+ var nodes = typeof selector === 'string'
12
+ ? Array.from(document.querySelectorAll(selector))
13
+ : selector?.nodeType ? [selector] : (selector?.length ? Array.from(selector) : []);
14
+ var obj = {
15
+ 0: nodes[0], length: nodes.length,
16
+ toArray: function () { return nodes.slice(); },
17
+ find: function (s) { var r = []; for (var i = 0; i < nodes.length; i++) { r.push.apply(r, Array.from(nodes[i].querySelectorAll(s))); } return $(r); },
18
+ each: function (fn) { for (var i = 0; i < nodes.length; i++) { fn.call(nodes[i], i, nodes[i]); } return obj; },
19
+ on: function (ev, fn) { for (var i = 0; i < nodes.length; i++) nodes[i].addEventListener(ev, fn); return obj; },
20
+ off: function (ev, fn) { for (var i = 0; i < nodes.length; i++) nodes[i].removeEventListener(ev, fn); return obj; },
21
+ addClass: function (c) { for (var i = 0; i < nodes.length; i++) nodes[i].classList?.add(c); return obj; },
22
+ removeClass: function (c) { for (var i = 0; i < nodes.length; i++) nodes[i].classList?.remove(c); return obj; },
23
+ hasClass: function (c) { return nodes[0]?.classList?.contains(c) || false; },
24
+ attr: function (k, v) { if (typeof v === 'undefined') return nodes[0]?.getAttribute(k); for (var i = 0; i < nodes.length; i++) nodes[i].setAttribute(k, v); return obj; },
25
+ css: function (k, v) { for (var i = 0; i < nodes.length; i++) nodes[i].style[k] = v; return obj; },
26
+ data: function () { return nodes[0]?.__xuData || (nodes[0] ? (nodes[0].__xuData = {}) : {}); },
27
+ val: function (v) { if (typeof v === 'undefined') return nodes[0]?.value; for (var i = 0; i < nodes.length; i++) nodes[i].value = v; return obj; },
28
+ html: function (v) { if (typeof v === 'undefined') return nodes[0]?.innerHTML; for (var i = 0; i < nodes.length; i++) nodes[i].innerHTML = v; return obj; },
29
+ text: function (v) { if (typeof v === 'undefined') return nodes[0]?.textContent; for (var i = 0; i < nodes.length; i++) nodes[i].textContent = v; return obj; },
30
+ show: function () { for (var i = 0; i < nodes.length; i++) nodes[i].style.display = ''; return obj; },
31
+ hide: function () { for (var i = 0; i < nodes.length; i++) nodes[i].style.display = 'none'; return obj; },
32
+ remove: function () { for (var i = 0; i < nodes.length; i++) nodes[i].remove?.(); return obj; },
33
+ empty: function () { for (var i = 0; i < nodes.length; i++) nodes[i].innerHTML = ''; return obj; },
34
+ append: function (c) { var n = c?.nodeType ? c : c?.[0]; if (n && nodes[0]) nodes[0].appendChild(n); return obj; },
35
+ parent: function () { return $(nodes[0]?.parentElement ? [nodes[0].parentElement] : []); },
36
+ children: function () { return $(nodes[0] ? Array.from(nodes[0].children) : []); },
37
+ trigger: function (ev, d) { for (var i = 0; i < nodes.length; i++) nodes[i].dispatchEvent(new CustomEvent(ev, { detail: d })); return obj; },
38
+ is: function (s) { return nodes[0]?.matches?.(s) || false; },
39
+ prop: function (k, v) { if (typeof v === 'undefined') return nodes[0]?.[k]; for (var i = 0; i < nodes.length; i++) nodes[i][k] = v; return obj; },
40
+ unbind: function () { return obj; },
41
+ clone: function () { return $(nodes[0]?.cloneNode(true) ? [nodes[0].cloneNode(true)] : []); },
42
+ };
43
+ obj[Symbol.iterator] = function () { var i = 0; return { next: function () { return i < nodes.length ? { value: nodes[i++], done: false } : { done: true }; } }; };
44
+ return obj;
45
+ };
46
+ $.each = function (o, fn) { if (Array.isArray(o)) { for (var i = 0; i < o.length; i++) fn(i, o[i]); } else { Object.keys(o || {}).forEach(function (k) { fn(k, o[k]); }); } };
47
+ $.cookie = function () { return null; };
48
+ var jQuery = $;
49
+ }
50
+
8
51
  var glb = {};
9
52
  var func = {};
10
53
  func.UI = {};
@@ -21,6 +64,51 @@ func.runtime.ui = {};
21
64
  func.runtime.widgets = {};
22
65
  glb.IS_STUDIO = null;
23
66
 
67
+ // Lodash replacement utilities
68
+ var xu_isEmpty = function (val) {
69
+ if (val == null) return true;
70
+ if (typeof val === 'boolean' || typeof val === 'number') return !val;
71
+ if (typeof val === 'string' || Array.isArray(val)) return val.length === 0;
72
+ if (val instanceof Map || val instanceof Set) return val.size === 0;
73
+ return Object.keys(val).length === 0;
74
+ };
75
+
76
+ var xu_isEqual = function (a, b) {
77
+ if (a === b) return true;
78
+ if (a == null || b == null) return a === b;
79
+ if (typeof a !== typeof b) return false;
80
+ if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
81
+ if (typeof a !== 'object') return false;
82
+ var keysA = Object.keys(a);
83
+ var keysB = Object.keys(b);
84
+ if (keysA.length !== keysB.length) return false;
85
+ for (var i = 0; i < keysA.length; i++) {
86
+ if (!Object.prototype.hasOwnProperty.call(b, keysA[i]) || !xu_isEqual(a[keysA[i]], b[keysA[i]])) return false;
87
+ }
88
+ return true;
89
+ };
90
+
91
+ var xu_get = function (obj, path, defaultVal) {
92
+ var keys = typeof path === 'string' ? path.split('.') : path;
93
+ var result = obj;
94
+ for (var i = 0; i < keys.length; i++) {
95
+ if (result == null) return defaultVal;
96
+ result = result[keys[i]];
97
+ }
98
+ return result === undefined ? defaultVal : result;
99
+ };
100
+
101
+ var xu_set = function (obj, path, value) {
102
+ var keys = typeof path === 'string' ? path.split('.') : path;
103
+ var current = obj;
104
+ for (var i = 0; i < keys.length - 1; i++) {
105
+ if (current[keys[i]] == null) current[keys[i]] = {};
106
+ current = current[keys[i]];
107
+ }
108
+ current[keys[keys.length - 1]] = value;
109
+ return obj;
110
+ };
111
+
24
112
  var PROJECT_OBJ = {};
25
113
 
26
114
  var APP_OBJ = {};
@@ -185,6 +273,105 @@ func.runtime.platform = {
185
273
  return true;
186
274
  },
187
275
  };
276
+
277
+ // ── Platform-agnostic event bus ──
278
+ // Works in browser, worker, and Node environments.
279
+ // In browser, bridge DOM events into this bus so core code never touches $(document) directly.
280
+ func.runtime.platform._event_bus = {};
281
+ func.runtime.platform.on = function (name, handler) {
282
+ if (!func.runtime.platform._event_bus[name]) {
283
+ func.runtime.platform._event_bus[name] = [];
284
+ }
285
+ func.runtime.platform._event_bus[name].push(handler);
286
+ };
287
+ func.runtime.platform.off = function (name, handler) {
288
+ const handlers = func.runtime.platform._event_bus[name];
289
+ if (!handlers) return;
290
+ if (!handler) {
291
+ delete func.runtime.platform._event_bus[name];
292
+ return;
293
+ }
294
+ const index = handlers.indexOf(handler);
295
+ if (index !== -1) {
296
+ handlers.splice(index, 1);
297
+ }
298
+ };
299
+ func.runtime.platform._emitting = {};
300
+ func.runtime.platform.emit = function (name, data) {
301
+ // re-entrancy guard: prevent infinite loops when DOM bridge triggers the same event
302
+ if (func.runtime.platform._emitting[name]) return;
303
+ func.runtime.platform._emitting[name] = true;
304
+ try {
305
+ const handlers = func.runtime.platform._event_bus[name];
306
+ if (handlers) {
307
+ for (let i = 0; i < handlers.length; i++) {
308
+ handlers[i](data);
309
+ }
310
+ }
311
+ // also fire on DOM if in browser (for backward compatibility with custom event listeners)
312
+ if (func.runtime.platform.has_document()) {
313
+ document.dispatchEvent(new CustomEvent(name, { detail: Array.isArray(data) ? data : [data] }));
314
+ }
315
+ } finally {
316
+ func.runtime.platform._emitting[name] = false;
317
+ }
318
+ };
319
+
320
+ // ── Platform helpers for DOM-independent resource loading ──
321
+ func.runtime.platform.load_script = function (url, type, callback) {
322
+ if (typeof document !== 'undefined') {
323
+ const script = document.createElement('script');
324
+ script.src = url;
325
+ if (type) script.type = type;
326
+ script.onload = callback;
327
+ document.head.appendChild(script);
328
+ } else if (callback) {
329
+ callback();
330
+ }
331
+ };
332
+ func.runtime.platform.load_css = function (href) {
333
+ if (typeof document === 'undefined') return;
334
+ try {
335
+ if (document.querySelector('link[href="' + href + '"]')) return;
336
+ } catch (err) {
337
+ return;
338
+ }
339
+ const link = document.createElement('link');
340
+ link.rel = 'stylesheet';
341
+ link.type = 'text/css';
342
+ link.href = href;
343
+ document.head.insertBefore(link, document.head.firstChild);
344
+ };
345
+ func.runtime.platform.remove_js_css = function (filename, filetype) {
346
+ if (typeof document === 'undefined') return;
347
+ const tagName = filetype === 'js' ? 'script' : filetype === 'css' ? 'link' : 'none';
348
+ const attr = filetype === 'js' ? 'src' : filetype === 'css' ? 'href' : 'none';
349
+ const elements = document.getElementsByTagName(tagName);
350
+ for (let i = elements.length - 1; i >= 0; i--) {
351
+ if (elements[i] && elements[i].getAttribute(attr) != null && elements[i].getAttribute(attr).indexOf(filename) !== -1) {
352
+ elements[i].parentNode.removeChild(elements[i]);
353
+ }
354
+ }
355
+ };
356
+ func.runtime.platform.inject_css = function (cssText) {
357
+ if (typeof document === 'undefined' || !cssText) return;
358
+ const style = document.createElement('style');
359
+ style.type = 'text/css';
360
+ style.textContent = cssText;
361
+ document.head.appendChild(style);
362
+ };
363
+ func.runtime.platform.set_title = function (title) {
364
+ if (typeof document !== 'undefined') {
365
+ document.title = title;
366
+ }
367
+ };
368
+ func.runtime.platform.set_cursor = function (element, cursor) {
369
+ const node = func.runtime.ui?.get_first_node ? func.runtime.ui.get_first_node(element) : element;
370
+ if (node?.style) {
371
+ node.style.cursor = cursor;
372
+ }
373
+ };
374
+
188
375
  func.runtime.env = {
189
376
  get_url_params: function () {
190
377
  const search = func.runtime.platform.get_url_search();
@@ -623,7 +810,7 @@ func.runtime.bind.get_field_type = function (field_prop) {
623
810
  };
624
811
  func.runtime.bind.toggle_array_value = function (arr_value_before_cast, value_from_getter) {
625
812
  if (arr_value_before_cast.includes(value_from_getter)) {
626
- return arr_value_before_cast.filter((item) => !_.isEqual(item, value_from_getter));
813
+ return arr_value_before_cast.filter((item) => !xu_isEqual(item, value_from_getter));
627
814
  }
628
815
  arr_value_before_cast.push(value_from_getter);
629
816
  return arr_value_before_cast;
@@ -645,7 +832,7 @@ func.runtime.bind.get_source_value = function (_ds, bind_field_id, is_dynamic_fi
645
832
  };
646
833
  func.runtime.bind.format_display_value = function ($elm, field_prop, bind_field_id, expression_value, value, input_field_type) {
647
834
  const field_type = func.runtime.bind.get_field_type(field_prop);
648
- const elm_value = $elm.attr('value');
835
+ const elm_value = func.runtime.ui.get_attr($elm, 'value');
649
836
 
650
837
  if (field_type === 'array' && input_field_type === 'checkbox' && elm_value) {
651
838
  return value.includes(elm_value);
@@ -671,7 +858,7 @@ func.runtime.bind.update_reference_source_array = async function (options) {
671
858
 
672
859
  const arr_idx = Number(options.iterate_info._key);
673
860
  const dataset_arr = await func.datasource.get_value(options.SESSION_ID, reference_source_obj.fieldIdP, options.dsSessionP, reference_source_obj.currentRecordId);
674
- let new_arr = _.cloneDeep(dataset_arr.ret.value);
861
+ let new_arr = klona.klona(dataset_arr.ret.value);
675
862
 
676
863
  if (field_type === 'object' && options.val_is_reference_field) {
677
864
  let obj_item = new_arr[arr_idx];
@@ -683,15 +870,15 @@ func.runtime.bind.update_reference_source_array = async function (options) {
683
870
  }
684
871
 
685
872
  let datasource_changes = func.runtime.bind.build_datasource_changes(options.dsSessionP, options.currentRecordId, reference_source_obj.fieldIdP, new_arr);
686
- await func.datasource.update(options.SESSION_ID, datasource_changes, null, true);
873
+ await func.datasource.update(options.SESSION_ID, datasource_changes);
687
874
  return true;
688
875
  };
689
876
  func.runtime.resources.load_cdn = async function (SESSION_ID, resource) {
690
877
  let normalized_resource = resource;
691
- if (!_.isObject(normalized_resource) && _.isString(normalized_resource)) {
878
+ if (!(typeof normalized_resource === 'object' && normalized_resource !== null) && typeof normalized_resource === 'string') {
692
879
  normalized_resource = { src: normalized_resource, type: 'js' };
693
880
  }
694
- if (!_.isObject(normalized_resource)) {
881
+ if (!(typeof normalized_resource === 'object' && normalized_resource !== null)) {
695
882
  throw new Error('cdn resource in wrong format');
696
883
  }
697
884
 
@@ -737,7 +924,7 @@ func.runtime.resources.load_plugin_runtime_css = async function (SESSION_ID, plu
737
924
  return true;
738
925
  };
739
926
  func.runtime.resources.resolve_plugin_properties = async function (SESSION_ID, dsSessionP, attributes, properties) {
740
- let resolved_properties = _.cloneDeep(properties);
927
+ let resolved_properties = klona.klona(properties);
741
928
  for await (let [prop_name, prop_val] of Object.entries(resolved_properties || {})) {
742
929
  prop_val.value = attributes?.[prop_name];
743
930
  if (attributes?.[`xu-exp:${prop_name}`]) {
@@ -763,7 +950,7 @@ func.runtime.resources.run_ui_plugin = async function (SESSION_ID, paramsP, $elm
763
950
  const plugin_runtime_src = await func.runtime.resources.get_plugin_module_url(SESSION_ID, plugin_name, plugin, 'runtime.mjs');
764
951
  const plugin_runtime_resources = await import(plugin_runtime_src);
765
952
 
766
- if (plugin_runtime_resources.cdn && _.isArray(plugin_runtime_resources.cdn)) {
953
+ if (plugin_runtime_resources.cdn && Array.isArray(plugin_runtime_resources.cdn)) {
767
954
  for await (const resource of plugin_runtime_resources.cdn) {
768
955
  await func.runtime.resources.load_cdn(SESSION_ID, resource);
769
956
  }
@@ -895,12 +1082,12 @@ func.runtime.widgets.build_params = function (context, $containerP, plugin_setup
895
1082
  };
896
1083
  };
897
1084
  func.common.find_item_by_key = function (arr, key, val) {
898
- return _.find(arr, function (e) {
1085
+ return arr.find(function (e) {
899
1086
  return e.data[key] === val;
900
1087
  });
901
1088
  };
902
1089
  func.common.find_item_by_key_root = function (arr, key, val) {
903
- return _.find(arr, function (e) {
1090
+ return arr.find(function (e) {
904
1091
  return e[key] === val;
905
1092
  });
906
1093
  };
@@ -1160,7 +1347,7 @@ func.common.db = async function (SESSION_ID, serviceP, dataP, opt = {}, dsSessio
1160
1347
  }
1161
1348
 
1162
1349
  await db.get(row_id);
1163
- let _data = _.cloneDeep(dataP);
1350
+ let _data = klona.klona(dataP);
1164
1351
  _data.ids = [row_id];
1165
1352
  return await func.db.pouch['dbs_delete'](SESSION_ID, _data);
1166
1353
  } catch (err) {
@@ -1249,7 +1436,7 @@ func.common.db = async function (SESSION_ID, serviceP, dataP, opt = {}, dsSessio
1249
1436
 
1250
1437
  const get_white_spaced_data = function (data) {
1251
1438
  var e = {};
1252
- _.forEach(data, function (val, key) {
1439
+ for (const [key, val] of Object.entries(data)) {
1253
1440
  if (!val) {
1254
1441
  if (typeof val === 'boolean') {
1255
1442
  e[key] = 'false';
@@ -1263,7 +1450,7 @@ func.common.db = async function (SESSION_ID, serviceP, dataP, opt = {}, dsSessio
1263
1450
  e[key] = val;
1264
1451
  }
1265
1452
  }
1266
- });
1453
+ }
1267
1454
 
1268
1455
  if (data.fields && !data.fields.length) {
1269
1456
  e.fields = '';
@@ -1512,14 +1699,14 @@ var UI_FRAMEWORK_PLUGIN = {};
1512
1699
  func.common.get_cast_val = async function (SESSION_ID, source, attributeP, typeP, valP, errorP) {
1513
1700
  const report_conversion_error = function (res) {
1514
1701
  if (errorP) {
1515
- return func.utils.debug_report(SESSION_ID, _.capitalize(source), errorP, 'W');
1702
+ return func.utils.debug_report(SESSION_ID, source.charAt(0).toUpperCase() + source.slice(1).toLowerCase(), errorP, 'W');
1516
1703
  }
1517
1704
  var msg = `error converting ${attributeP} from ${valP} to ${typeP}`;
1518
- func.utils.debug_report(SESSION_ID, _.capitalize(source), msg, 'E');
1705
+ func.utils.debug_report(SESSION_ID, source.charAt(0).toUpperCase() + source.slice(1).toLowerCase(), msg, 'E');
1519
1706
  };
1520
1707
  const report_conversion_warn = function (msg) {
1521
1708
  var msg = `type mismatch auto conversion made to ${attributeP} from value ${valP} to ${typeP}`;
1522
- func.utils.debug_report(SESSION_ID, _.capitalize(source), msg, 'W');
1709
+ func.utils.debug_report(SESSION_ID, source.charAt(0).toUpperCase() + source.slice(1).toLowerCase(), msg, 'W');
1523
1710
  };
1524
1711
  const module = await func.common.get_module(SESSION_ID, `xuda-get-cast-util-module.mjs`);
1525
1712
  return module.cast(typeP, valP, report_conversion_error, report_conversion_warn);
@@ -1537,11 +1724,17 @@ var WEBSOCKET_PROCESS_PID = null;
1537
1724
  glb.worker_queue_num = 0;
1538
1725
  glb.websocket_queue_num = 0;
1539
1726
 
1727
+ func.common._import_cache = func.common._import_cache || {};
1728
+
1540
1729
  func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
1541
1730
  let ret;
1542
1731
 
1543
1732
  const get_ret = async function (src) {
1544
- const module_ret = await import(src);
1733
+ // Cache the import() result to avoid repeated dynamic imports
1734
+ if (!func.common._import_cache[src]) {
1735
+ func.common._import_cache[src] = await import(src);
1736
+ }
1737
+ const module_ret = func.common._import_cache[src];
1545
1738
  var params = get_params();
1546
1739
 
1547
1740
  const ret = module_ret.XudaModule ? new module_ret.XudaModule(params) : await invoke_init_module(module_ret, params);
@@ -1558,7 +1751,6 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
1558
1751
  PROJECT_OBJ,
1559
1752
  DOCS_OBJ,
1560
1753
  SESSION_OBJ,
1561
- _,
1562
1754
  ...paramsP,
1563
1755
  };
1564
1756
  if (typeof IS_PROCESS_SERVER !== 'undefined') params.IS_PROCESS_SERVER = IS_PROCESS_SERVER;
@@ -1592,7 +1784,7 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
1592
1784
  }
1593
1785
 
1594
1786
  const rep = function () {
1595
- return _.endsWith(module, '.js') ? module.replace('.js', '.min.js') : module.replace('.mjs', '.min.mjs');
1787
+ return module.endsWith('.js') ? module.replace('.js', '.min.js') : module.replace('.mjs', '.min.mjs');
1596
1788
  };
1597
1789
 
1598
1790
  if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
@@ -1750,7 +1942,7 @@ func.api.watch = function (path, cb, opt = {}) {
1750
1942
  _session.watchers[path] = { ...opt, handler: cb };
1751
1943
 
1752
1944
  if (opt.immediate) {
1753
- const value = _.get(SESSION_OBJ[SESSION_ID].DS_GLB[0], path);
1945
+ const value = xu_get(SESSION_OBJ[SESSION_ID].DS_GLB[0], path);
1754
1946
  cb({ path, newValue: value, oldValue: value, timestamp: Date.now(), opt });
1755
1947
 
1756
1948
  if (opt.once) {
@@ -1902,10 +2094,12 @@ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data
1902
2094
  } else {
1903
2095
  if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED) {
1904
2096
  RUNTIME_SERVER_WEBSOCKET.emit('message', obj);
1905
- $('body').on('get_ws_data_response_' + glb.websocket_queue_num, (e, data) => {
2097
+ const _ws_event = 'get_ws_data_response_' + glb.websocket_queue_num;
2098
+ const _ws_handler = function (data) {
1906
2099
  resolve(data.data);
1907
- $('body').off('get_ws_data_response_' + data.e.websocket_queue_num);
1908
- });
2100
+ func.runtime.platform.off('get_ws_data_response_' + data.e.websocket_queue_num, _ws_handler);
2101
+ };
2102
+ func.runtime.platform.on(_ws_event, _ws_handler);
1909
2103
  } else {
1910
2104
  throw new Error('fail to fetch from ws websocket inactive');
1911
2105
  }
@@ -1919,10 +2113,11 @@ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data
1919
2113
 
1920
2114
  if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED) {
1921
2115
  RUNTIME_SERVER_WEBSOCKET.emit('message', obj);
1922
- $('body').on('heartbeat_response', (e, data) => {
2116
+ const _hb_handler = function (data) {
1923
2117
  resolve(data.data);
1924
- $('body').off('heartbeat_response');
1925
- });
2118
+ func.runtime.platform.off('heartbeat_response', _hb_handler);
2119
+ };
2120
+ func.runtime.platform.on('heartbeat_response', _hb_handler);
1926
2121
  } else {
1927
2122
  throw new Error('fail to fetch from ws websocket inactive');
1928
2123
  }