@xuda.io/runtime-bundle 1.0.914 → 1.0.916

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.
@@ -1 +1 @@
1
- const _this={};export const init_module=e=>{_this.func=e.func;_this.glb=e.glb;_this.SESSION_OBJ=e.SESSION_OBJ;_this.APP_OBJ=e.APP_OBJ;_this.IS_DOCKER=e.IS_DOCKER;_this.IS_API_SERVER=e.IS_API_SERVER;_this.IS_PROCESS_SERVER=e.IS_PROCESS_SERVER};export const get_doc_from_studio=async function(SESSION_ID,app_id,idP){return new Promise(function(resolve,reject){var _session=_this.SESSION_OBJ[SESSION_ID];if(glb.IS_WORKER){func.utils.post_back_to_client(SESSION_ID,"get_doc_from_studio",_session.worker_id,{doc_id:idP});self.addEventListener("live_preview_get_obj_response_worker_"+idP,event=>{resolve(event.detail.data)})}else{STUDIO_PEER_CONN_SEND_METHOD({service:"get_doc_obj",data:{doc_id:idP},session_id:SESSION_ID,id:STUDIO_PEER.id,source:"runtime",app_id:app_id});$("body").on("live_preview_get_obj_response_"+idP,function(e,data){resolve(data.data);$("body").off("live_preview_get_obj_response_"+idP)})}})};export const get_doc_from_websocket=async function(SESSION_ID,app_id,idP){var _session=_this.SESSION_OBJ[SESSION_ID];return new Promise(function(resolve,reject){if(glb.IS_WORKER){func.utils.post_back_to_client(SESSION_ID,"get_doc_from_websocket",_session.worker_id,{doc_id:idP});self.addEventListener("get_doc_obj_from_build_worker_"+idP,event=>{resolve(event.detail.data)})}else{if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED){RUNTIME_SERVER_WEBSOCKET.emit("message",{service:"get_doc_obj_from_build",data:{doc_id:idP}});$("body").on("get_doc_obj_from_build_response_"+idP,(e,data)=>{resolve(data.data);$("body").off("get_doc_obj_from_build_response_"+idP)})}else{throw new Error("fail to fetch from ws websocket inactive")}}})};export const DOCS_OBJ_get=async function(SESSION_ID,idP){if(!idP)return;if(idP==="_empty_panel_program"){return{_id:"_empty_panel_program",properties:{menuName:"_empty_panel_program",menuTitle:"_empty_panel_program",menuType:"component",renderType:"form"},progUi:[{id:"node-empty_panel_program",tagName:"xu-single-view",children:[{id:"node-empty_panel_program-span",tagName:"span",children:[],content:"",type:"element",attributes:{}}],content:"",type:"element",attributes:{}}],progDataSource:{},progFields:[],progEvents:[]}}var _session=_this.SESSION_OBJ[SESSION_ID];const app_id=_session.app_id;var views_ret;if(_session.engine_mode==="live_preview"){return await get_doc_from_studio(SESSION_ID,app_id,idP)}if(glb.register_startup_programs){func.common.db(SESSION_ID,"register_startup_programs",{prog_id:idP,build_id:_session?.build_info?.build||0})}views_ret=await read_objects_cache(SESSION_ID,idP,"DOCS_OBJ");if(!views_ret){if(typeof _this.IS_DOCKER==="undefined"&&typeof _this.IS_PROCESS_SERVER==="undefined"){let url=_this.func.common.get_url(SESSION_ID,"rpi","");if(["master"].includes(_this.APP_OBJ[app_id].app_type)){url+="get_doc_obj_raw"}else{url+="get_doc_obj_from_build"}let app_id_reference=_this.APP_OBJ[app_id].app_id_reference;const http=async function(){const response=await fetch(url,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","xu-gtp-token":_session.gtp_token,"xu-app-token":_session.app_token},body:JSON.stringify({app_id:app_id,doc_id:idP,build:_session.build_info.instance_build||_session.build_info.build||_session.opt.app_build_id,app_id_reference:app_id_reference})});const json=await response.json();if(response){if(response&&response.status===400){return _this.func.utils.request_error(SESSION_ID,"ajax",response.statusText)}views_ret=json.data}};try{if(SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes("get_doc_obj_from_build")){views_ret=await get_doc_from_websocket(SESSION_ID,app_id,idP)}else{throw new Error("not a get_doc_obj_from_build method")}}catch(err){await http()}}if(typeof _this.IS_DOCKER!=="undefined"||typeof _this.IS_PROCESS_SERVER!=="undefined"){var ret=await __.rpi.get_prog(app_id,idP);if(ret.data){views_ret=ret.data}}if(views_ret){if(views_ret.error){console.error(views_ret);views_ret="";return}await save_objects_cache(SESSION_ID,idP,"DOCS_OBJ",views_ret)}}return views_ret};export const save_objects_cache=async function(SESSION_ID,id,obj_type,data){var _session=_this.SESSION_OBJ[SESSION_ID];if(typeof _this.IS_DOCKER!=="undefined"||typeof _this.IS_PROCESS_SERVER!=="undefined"||_session.worker_type==="Dev"){return}var build_id=_session?.build_info?.build||0;const db=await _this.func.utils.connect_pouchdb(SESSION_ID);var doc={_id:`cache_${build_id}_${obj_type}_${id}`,id:id,docType:"cache_objects",build_id:build_id.toString(),obj_type:obj_type,data:data};setTimeout(async function(){try{await db.get(doc_id);return}catch(e){if(await read_objects_cache(SESSION_ID,id,obj_type)){return}if(!doc.data||doc.data&&typeof doc.data==="string"&&doc.data.indexOf("error")>-1){return}try{return await db.put(doc)}catch(err){return}}},1e3)};export const read_objects_cache=async function(SESSION_ID,id,obj_type){if(typeof _this.IS_DOCKER!=="undefined"||typeof _this.IS_PROCESS_SERVER!=="undefined"){try{const data=fs.readFileSync("/var/xuda/progs/"+id+".json","utf8");return JSON.parse(data)}catch(err){console.error("read_objects_cache",err);return}}var _session=_this.SESSION_OBJ[SESSION_ID];var build_id=_session?.build_info?.build||0;const db=await _this.func.utils.connect_pouchdb(SESSION_ID);var ret;try{ret=await db.get(`cache_${build_id}_${obj_type}_${id}`);if(ret.data&&typeof ret.data==="string"&&ret.data.indexOf("error")>-1){return""}return ret.data}catch(err){return ret}};export const delete_objects_cache=async function(SESSION_ID,id,obj_type){const app_id=_this.SESSION_OBJ[SESSION_ID].app_id;var build_id=_session?.build_info?.build||0;const db=await _this.func.utils.connect_pouchdb(SESSION_ID);try{var doc=await db.get(`cache_${build_id}_${obj_type}_${id}`);if(!doc)return;var ret=await db.remove(doc)}catch(err){return}return ret};export const load_objects_cache=async function(SESSION_ID){var _session=_this.SESSION_OBJ[SESSION_ID];if(typeof _this.IS_DOCKER!=="undefined"||typeof _this.IS_PROCESS_SERVER!=="undefined"){return}const app_id=_session.app_id;const db=await _this.func.utils.connect_pouchdb(SESSION_ID);const build_id=_this.APP_OBJ[app_id].app_build_id;let ret=await db.find({selector:{docType:"cache_objects",build_id:build_id}});for(let val of ret.docs){eval(val.obj_type)[_session.app_id][val.id]=val.data}};
1
+ const _this={};export const init_module=e=>{_this.func=e.func;_this.glb=e.glb;_this.SESSION_OBJ=e.SESSION_OBJ;_this.APP_OBJ=e.APP_OBJ;_this.IS_DOCKER=e.IS_DOCKER;_this.IS_API_SERVER=e.IS_API_SERVER;_this.IS_PROCESS_SERVER=e.IS_PROCESS_SERVER};export const get_doc_from_studio=async function(SESSION_ID,app_id,idP){return new Promise(function(resolve,reject){var _session=_this.SESSION_OBJ[SESSION_ID];if(glb.IS_WORKER){func.utils.post_back_to_client(SESSION_ID,"get_doc_from_studio",_session.worker_id,{doc_id:idP});self.addEventListener("live_preview_get_obj_response_worker_"+idP,event=>{resolve(event.detail.data)})}else{STUDIO_PEER_CONN_SEND_METHOD({service:"get_doc_obj",data:{doc_id:idP},session_id:SESSION_ID,id:STUDIO_PEER.id,source:"runtime",app_id:app_id});$("body").on("live_preview_get_obj_response_"+idP,function(e,data){resolve(data.data);$("body").off("live_preview_get_obj_response_"+idP)})}})};export const get_doc_from_websocket=async function(SESSION_ID,app_id,idP){var _session=_this.SESSION_OBJ[SESSION_ID];return new Promise(function(resolve,reject){if(glb.IS_WORKER){func.utils.post_back_to_client(SESSION_ID,"get_doc_from_websocket",_session.worker_id,{doc_id:idP});self.addEventListener("get_doc_obj_from_build_worker_"+idP,event=>{resolve(event.detail.data)})}else{if(RUNTIME_SERVER_WEBSOCKET&&RUNTIME_SERVER_WEBSOCKET_CONNECTED){RUNTIME_SERVER_WEBSOCKET.emit("message",{service:"get_doc_obj_from_build",data:{doc_id:idP}});$("body").on("get_doc_obj_from_build_response_"+idP,(e,data)=>{resolve(data.data);$("body").off("get_doc_obj_from_build_response_"+idP)})}else{throw new Error("fail to fetch from ws websocket inactive")}}})};export const DOCS_OBJ_get=async function(SESSION_ID,idP){if(!idP)return;if(idP==="_empty_panel_program"){return{_id:"_empty_panel_program",properties:{menuName:"_empty_panel_program",menuTitle:"_empty_panel_program",menuType:"component",renderType:"form"},progUi:[{id:"node-empty_panel_program",tagName:"xu-single-view",children:[{id:"node-empty_panel_program-span",tagName:"span",children:[],content:"",type:"element",attributes:{}}],content:"",type:"element",attributes:{}}],progDataSource:{},progFields:[],progEvents:[]}}var _session=_this.SESSION_OBJ[SESSION_ID];const app_id=_session.app_id;var views_ret;if(_session.engine_mode==="live_preview"){return await get_doc_from_studio(SESSION_ID,app_id,idP)}if(glb.register_startup_programs){func.common.db(SESSION_ID,"register_startup_programs",{prog_id:idP,build_id:_session?.build_info?.build||0})}views_ret=await read_objects_cache(SESSION_ID,idP,"DOCS_OBJ");if(!views_ret){if(typeof _this.IS_DOCKER==="undefined"&&typeof _this.IS_PROCESS_SERVER==="undefined"){let url=_this.func.common.get_url(SESSION_ID,"rpi","");if(["master"].includes(_this.APP_OBJ[app_id].app_type)){url+="get_doc_obj_raw"}else{url+="get_doc_obj_from_build"}let app_id_reference=_this.APP_OBJ[app_id].app_id_reference;const http=async function(){const response=await fetch(url,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","xu-gtp-token":_session.gtp_token,"xu-app-token":_session.app_token},body:JSON.stringify({app_id:app_id,doc_id:idP,build:_session.build_info.instance_build||_session.build_info.build||_session.opt.app_build_id,app_id_reference:app_id_reference,engine_mode:_session.engine_mode})});const json=await response.json();if(response){if(response&&response.status===400){return _this.func.utils.request_error(SESSION_ID,"ajax",response.statusText)}views_ret=json.data}};try{if(SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes("get_doc_obj_from_build")){views_ret=await get_doc_from_websocket(SESSION_ID,app_id,idP)}else{throw new Error("not a get_doc_obj_from_build method")}}catch(err){await http()}}if(typeof _this.IS_DOCKER!=="undefined"||typeof _this.IS_PROCESS_SERVER!=="undefined"){var ret=await __.rpi.get_prog(app_id,idP);if(ret.data){views_ret=ret.data}}if(views_ret){if(views_ret.error){console.error(views_ret);views_ret="";return}await save_objects_cache(SESSION_ID,idP,"DOCS_OBJ",views_ret)}}return views_ret};export const save_objects_cache=async function(SESSION_ID,id,obj_type,data){var _session=_this.SESSION_OBJ[SESSION_ID];if(typeof _this.IS_DOCKER!=="undefined"||typeof _this.IS_PROCESS_SERVER!=="undefined"||_session.worker_type==="Dev"){return}var build_id=_session?.build_info?.build||0;const db=await _this.func.utils.connect_pouchdb(SESSION_ID);var doc={_id:`cache_${build_id}_${obj_type}_${id}`,id:id,docType:"cache_objects",build_id:build_id.toString(),obj_type:obj_type,data:data};setTimeout(async function(){try{await db.get(doc_id);return}catch(e){if(await read_objects_cache(SESSION_ID,id,obj_type)){return}if(!doc.data||doc.data&&typeof doc.data==="string"&&doc.data.indexOf("error")>-1){return}try{return await db.put(doc)}catch(err){return}}},1e3)};export const read_objects_cache=async function(SESSION_ID,id,obj_type){if(typeof _this.IS_DOCKER!=="undefined"||typeof _this.IS_PROCESS_SERVER!=="undefined"){try{const data=fs.readFileSync("/var/xuda/progs/"+id+".json","utf8");return JSON.parse(data)}catch(err){console.error("read_objects_cache",err);return}}var _session=_this.SESSION_OBJ[SESSION_ID];var build_id=_session?.build_info?.build||0;const db=await _this.func.utils.connect_pouchdb(SESSION_ID);var ret;try{ret=await db.get(`cache_${build_id}_${obj_type}_${id}`);if(ret.data&&typeof ret.data==="string"&&ret.data.indexOf("error")>-1){return""}return ret.data}catch(err){return ret}};export const delete_objects_cache=async function(SESSION_ID,id,obj_type){const app_id=_this.SESSION_OBJ[SESSION_ID].app_id;var build_id=_session?.build_info?.build||0;const db=await _this.func.utils.connect_pouchdb(SESSION_ID);try{var doc=await db.get(`cache_${build_id}_${obj_type}_${id}`);if(!doc)return;var ret=await db.remove(doc)}catch(err){return}return ret};export const load_objects_cache=async function(SESSION_ID){var _session=_this.SESSION_OBJ[SESSION_ID];if(typeof _this.IS_DOCKER!=="undefined"||typeof _this.IS_PROCESS_SERVER!=="undefined"){return}const app_id=_session.app_id;const db=await _this.func.utils.connect_pouchdb(SESSION_ID);const build_id=_this.APP_OBJ[app_id].app_build_id;let ret=await db.find({selector:{docType:"cache_objects",build_id:build_id}});for(let val of ret.docs){eval(val.obj_type)[_session.app_id][val.id]=val.data}};
@@ -14,33 +14,25 @@ export const get_doc_from_studio = async function (SESSION_ID, app_id, idP) {
14
14
  return new Promise(function (resolve, reject) {
15
15
  var _session = _this.SESSION_OBJ[SESSION_ID];
16
16
  if (glb.IS_WORKER) {
17
- func.utils.post_back_to_client(
18
- SESSION_ID,
19
- "get_doc_from_studio",
20
- _session.worker_id,
21
- { doc_id: idP }
22
- );
23
-
24
- self.addEventListener(
25
- "live_preview_get_obj_response_worker_" + idP,
26
- (event) => {
27
- // console.log("Custom event triggered:", event);
28
- resolve(event.detail.data);
29
- }
30
- );
17
+ func.utils.post_back_to_client(SESSION_ID, 'get_doc_from_studio', _session.worker_id, { doc_id: idP });
18
+
19
+ self.addEventListener('live_preview_get_obj_response_worker_' + idP, (event) => {
20
+ // console.log("Custom event triggered:", event);
21
+ resolve(event.detail.data);
22
+ });
31
23
  } else {
32
24
  STUDIO_PEER_CONN_SEND_METHOD({
33
- service: "get_doc_obj",
25
+ service: 'get_doc_obj',
34
26
  data: { doc_id: idP },
35
27
  session_id: SESSION_ID,
36
28
  id: STUDIO_PEER.id,
37
- source: "runtime",
29
+ source: 'runtime',
38
30
  app_id,
39
31
  });
40
32
 
41
- $("body").on("live_preview_get_obj_response_" + idP, function (e, data) {
33
+ $('body').on('live_preview_get_obj_response_' + idP, function (e, data) {
42
34
  resolve(data.data);
43
- $("body").off("live_preview_get_obj_response_" + idP);
35
+ $('body').off('live_preview_get_obj_response_' + idP);
44
36
  });
45
37
  }
46
38
  });
@@ -51,29 +43,24 @@ export const get_doc_from_websocket = async function (SESSION_ID, app_id, idP) {
51
43
  return new Promise(function (resolve, reject) {
52
44
  if (glb.IS_WORKER) {
53
45
  // throw new Error("fail to fetch from ws");
54
- func.utils.post_back_to_client(
55
- SESSION_ID,
56
- "get_doc_from_websocket",
57
- _session.worker_id,
58
- { doc_id: idP }
59
- );
60
-
61
- self.addEventListener("get_doc_obj_from_build_worker_" + idP, (event) => {
46
+ func.utils.post_back_to_client(SESSION_ID, 'get_doc_from_websocket', _session.worker_id, { doc_id: idP });
47
+
48
+ self.addEventListener('get_doc_obj_from_build_worker_' + idP, (event) => {
62
49
  resolve(event.detail.data);
63
50
  });
64
51
  } else {
65
52
  if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED) {
66
- RUNTIME_SERVER_WEBSOCKET.emit("message", {
67
- service: "get_doc_obj_from_build",
53
+ RUNTIME_SERVER_WEBSOCKET.emit('message', {
54
+ service: 'get_doc_obj_from_build',
68
55
  data: { doc_id: idP },
69
56
  });
70
- $("body").on("get_doc_obj_from_build_response_" + idP, (e, data) => {
57
+ $('body').on('get_doc_obj_from_build_response_' + idP, (e, data) => {
71
58
  // views_ret = data.data;
72
59
  resolve(data.data);
73
- $("body").off("get_doc_obj_from_build_response_" + idP);
60
+ $('body').off('get_doc_obj_from_build_response_' + idP);
74
61
  });
75
62
  } else {
76
- throw new Error("fail to fetch from ws websocket inactive");
63
+ throw new Error('fail to fetch from ws websocket inactive');
77
64
  }
78
65
  }
79
66
  });
@@ -82,33 +69,33 @@ export const get_doc_from_websocket = async function (SESSION_ID, app_id, idP) {
82
69
  export const DOCS_OBJ_get = async function (SESSION_ID, idP) {
83
70
  if (!idP) return;
84
71
 
85
- if (idP === "_empty_panel_program") {
72
+ if (idP === '_empty_panel_program') {
86
73
  return {
87
- _id: "_empty_panel_program",
74
+ _id: '_empty_panel_program',
88
75
 
89
76
  properties: {
90
- menuName: "_empty_panel_program",
91
- menuTitle: "_empty_panel_program",
92
- menuType: "component",
77
+ menuName: '_empty_panel_program',
78
+ menuTitle: '_empty_panel_program',
79
+ menuType: 'component',
93
80
  // uiFramework: "@xuda.io/xuda-framework-plugin-tailwind",
94
- renderType: "form",
81
+ renderType: 'form',
95
82
  },
96
83
  progUi: [
97
84
  {
98
- id: "node-empty_panel_program",
99
- tagName: "xu-single-view",
85
+ id: 'node-empty_panel_program',
86
+ tagName: 'xu-single-view',
100
87
  children: [
101
88
  {
102
- id: "node-empty_panel_program-span",
103
- tagName: "span",
89
+ id: 'node-empty_panel_program-span',
90
+ tagName: 'span',
104
91
  children: [],
105
- content: "",
106
- type: "element",
92
+ content: '',
93
+ type: 'element',
107
94
  attributes: {},
108
95
  },
109
96
  ],
110
- content: "",
111
- type: "element",
97
+ content: '',
98
+ type: 'element',
112
99
  attributes: {},
113
100
  },
114
101
  ],
@@ -122,35 +109,32 @@ export const DOCS_OBJ_get = async function (SESSION_ID, idP) {
122
109
  const app_id = _session.app_id;
123
110
  var views_ret;
124
111
 
125
- if (_session.engine_mode === "live_preview") {
112
+ if (_session.engine_mode === 'live_preview') {
126
113
  return await get_doc_from_studio(SESSION_ID, app_id, idP);
127
114
  }
128
115
 
129
116
  if (glb.register_startup_programs) {
130
- func.common.db(SESSION_ID, "register_startup_programs", {
117
+ func.common.db(SESSION_ID, 'register_startup_programs', {
131
118
  prog_id: idP,
132
119
  build_id: _session?.build_info?.build || 0,
133
120
  });
134
121
  }
135
122
 
136
- views_ret = await read_objects_cache(SESSION_ID, idP, "DOCS_OBJ");
123
+ views_ret = await read_objects_cache(SESSION_ID, idP, 'DOCS_OBJ');
137
124
 
138
125
  if (!views_ret) {
139
- if (
140
- typeof _this.IS_DOCKER === "undefined" &&
141
- typeof _this.IS_PROCESS_SERVER === "undefined"
142
- ) {
143
- let url = _this.func.common.get_url(SESSION_ID, "rpi", "");
126
+ if (typeof _this.IS_DOCKER === 'undefined' && typeof _this.IS_PROCESS_SERVER === 'undefined') {
127
+ let url = _this.func.common.get_url(SESSION_ID, 'rpi', '');
144
128
 
145
129
  if (
146
130
  [
147
- "master",
131
+ 'master',
148
132
  // "master_team"
149
133
  ].includes(_this.APP_OBJ[app_id].app_type)
150
134
  ) {
151
- url += "get_doc_obj_raw";
135
+ url += 'get_doc_obj_raw';
152
136
  } else {
153
- url += "get_doc_obj_from_build";
137
+ url += 'get_doc_obj_from_build';
154
138
  }
155
139
 
156
140
  let app_id_reference = _this.APP_OBJ[app_id].app_id_reference;
@@ -159,31 +143,25 @@ export const DOCS_OBJ_get = async function (SESSION_ID, idP) {
159
143
 
160
144
  const http = async function () {
161
145
  const response = await fetch(url, {
162
- method: "POST",
146
+ method: 'POST',
163
147
  headers: {
164
- Accept: "application/json",
165
- "Content-Type": "application/json",
166
- "xu-gtp-token": _session.gtp_token,
167
- "xu-app-token": _session.app_token,
148
+ Accept: 'application/json',
149
+ 'Content-Type': 'application/json',
150
+ 'xu-gtp-token': _session.gtp_token,
151
+ 'xu-app-token': _session.app_token,
168
152
  },
169
153
  body: JSON.stringify({
170
154
  app_id: app_id,
171
155
  doc_id: idP,
172
- build:
173
- _session.build_info.instance_build ||
174
- _session.build_info.build ||
175
- _session.opt.app_build_id,
156
+ build: _session.build_info.instance_build || _session.build_info.build || _session.opt.app_build_id,
176
157
  app_id_reference: app_id_reference,
158
+ engine_mode: _session.engine_mode,
177
159
  }),
178
160
  });
179
161
  const json = await response.json();
180
162
  if (response) {
181
163
  if (response && response.status === 400) {
182
- return _this.func.utils.request_error(
183
- SESSION_ID,
184
- "ajax",
185
- response.statusText
186
- );
164
+ return _this.func.utils.request_error(SESSION_ID, 'ajax', response.statusText);
187
165
  }
188
166
 
189
167
  views_ret = json.data;
@@ -191,24 +169,17 @@ export const DOCS_OBJ_get = async function (SESSION_ID, idP) {
191
169
  };
192
170
 
193
171
  try {
194
- if (
195
- SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(
196
- "get_doc_obj_from_build"
197
- )
198
- ) {
172
+ if (SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes('get_doc_obj_from_build')) {
199
173
  views_ret = await get_doc_from_websocket(SESSION_ID, app_id, idP);
200
174
  } else {
201
- throw new Error("not a get_doc_obj_from_build method");
175
+ throw new Error('not a get_doc_obj_from_build method');
202
176
  }
203
177
  } catch (err) {
204
178
  await http();
205
179
  }
206
180
  }
207
181
 
208
- if (
209
- typeof _this.IS_DOCKER !== "undefined" ||
210
- typeof _this.IS_PROCESS_SERVER !== "undefined"
211
- ) {
182
+ if (typeof _this.IS_DOCKER !== 'undefined' || typeof _this.IS_PROCESS_SERVER !== 'undefined') {
212
183
  var ret = await __.rpi.get_prog(app_id, idP);
213
184
 
214
185
  if (ret.data) {
@@ -219,28 +190,19 @@ export const DOCS_OBJ_get = async function (SESSION_ID, idP) {
219
190
  if (views_ret) {
220
191
  if (views_ret.error) {
221
192
  console.error(views_ret);
222
- views_ret = "";
193
+ views_ret = '';
223
194
  return;
224
195
  }
225
- await save_objects_cache(SESSION_ID, idP, "DOCS_OBJ", views_ret);
196
+ await save_objects_cache(SESSION_ID, idP, 'DOCS_OBJ', views_ret);
226
197
  }
227
198
  }
228
199
 
229
200
  return views_ret;
230
201
  };
231
202
 
232
- export const save_objects_cache = async function (
233
- SESSION_ID,
234
- id,
235
- obj_type,
236
- data
237
- ) {
203
+ export const save_objects_cache = async function (SESSION_ID, id, obj_type, data) {
238
204
  var _session = _this.SESSION_OBJ[SESSION_ID];
239
- if (
240
- typeof _this.IS_DOCKER !== "undefined" ||
241
- typeof _this.IS_PROCESS_SERVER !== "undefined" ||
242
- _session.worker_type === "Dev"
243
- ) {
205
+ if (typeof _this.IS_DOCKER !== 'undefined' || typeof _this.IS_PROCESS_SERVER !== 'undefined' || _session.worker_type === 'Dev') {
244
206
  return;
245
207
  }
246
208
 
@@ -250,7 +212,7 @@ export const save_objects_cache = async function (
250
212
  var doc = {
251
213
  _id: `cache_${build_id}_${obj_type}_${id}`,
252
214
  id: id,
253
- docType: "cache_objects",
215
+ docType: 'cache_objects',
254
216
  build_id: build_id.toString(),
255
217
  obj_type: obj_type,
256
218
  data: data,
@@ -263,12 +225,7 @@ export const save_objects_cache = async function (
263
225
  if (await read_objects_cache(SESSION_ID, id, obj_type)) {
264
226
  return;
265
227
  }
266
- if (
267
- !doc.data ||
268
- (doc.data &&
269
- typeof doc.data === "string" &&
270
- doc.data.indexOf("error") > -1)
271
- ) {
228
+ if (!doc.data || (doc.data && typeof doc.data === 'string' && doc.data.indexOf('error') > -1)) {
272
229
  return;
273
230
  }
274
231
 
@@ -281,15 +238,12 @@ export const save_objects_cache = async function (
281
238
  }, 1000);
282
239
  };
283
240
  export const read_objects_cache = async function (SESSION_ID, id, obj_type) {
284
- if (
285
- typeof _this.IS_DOCKER !== "undefined" ||
286
- typeof _this.IS_PROCESS_SERVER !== "undefined"
287
- ) {
241
+ if (typeof _this.IS_DOCKER !== 'undefined' || typeof _this.IS_PROCESS_SERVER !== 'undefined') {
288
242
  try {
289
- const data = fs.readFileSync("/var/xuda/progs/" + id + ".json", "utf8");
243
+ const data = fs.readFileSync('/var/xuda/progs/' + id + '.json', 'utf8');
290
244
  return JSON.parse(data);
291
245
  } catch (err) {
292
- console.error("read_objects_cache", err);
246
+ console.error('read_objects_cache', err);
293
247
  return;
294
248
  }
295
249
  }
@@ -302,12 +256,8 @@ export const read_objects_cache = async function (SESSION_ID, id, obj_type) {
302
256
  try {
303
257
  ret = await db.get(`cache_${build_id}_${obj_type}_${id}`);
304
258
 
305
- if (
306
- ret.data &&
307
- typeof ret.data === "string" &&
308
- ret.data.indexOf("error") > -1
309
- ) {
310
- return "";
259
+ if (ret.data && typeof ret.data === 'string' && ret.data.indexOf('error') > -1) {
260
+ return '';
311
261
  }
312
262
 
313
263
  return ret.data;
@@ -334,10 +284,7 @@ export const delete_objects_cache = async function (SESSION_ID, id, obj_type) {
334
284
  };
335
285
  export const load_objects_cache = async function (SESSION_ID) {
336
286
  var _session = _this.SESSION_OBJ[SESSION_ID];
337
- if (
338
- typeof _this.IS_DOCKER !== "undefined" ||
339
- typeof _this.IS_PROCESS_SERVER !== "undefined"
340
- ) {
287
+ if (typeof _this.IS_DOCKER !== 'undefined' || typeof _this.IS_PROCESS_SERVER !== 'undefined') {
341
288
  return;
342
289
  }
343
290
 
@@ -346,7 +293,7 @@ export const load_objects_cache = async function (SESSION_ID) {
346
293
  const db = await _this.func.utils.connect_pouchdb(SESSION_ID);
347
294
  const build_id = _this.APP_OBJ[app_id].app_build_id;
348
295
  let ret = await db.find({
349
- selector: { docType: "cache_objects", build_id },
296
+ selector: { docType: 'cache_objects', build_id },
350
297
  });
351
298
 
352
299
  for (let val of ret.docs) {
@@ -32435,12 +32435,14 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32435
32435
  if (val.handler === 'custom') {
32436
32436
  // do BL
32437
32437
  for await (const [key2, val2] of Object.entries(val.event)) {
32438
- var cond = val2.data.enabled;
32439
- if (val2.data.enabled && val2.props.condition) {
32440
- expCond = await func.expression.get(SESSION_ID, val2.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid); // execute expression
32441
- cond = expCond.result;
32442
- }
32443
- if (!cond) continue;
32438
+ // var cond = val2.data.enabled;
32439
+ // if (val2.data.enabled && val2.props.condition) {
32440
+ // expCond = await func.expression.get(SESSION_ID, val2.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid); // execute expression
32441
+ // cond = expCond.result;
32442
+ // }
32443
+ // if (!cond) continue;
32444
+
32445
+ if (!val2.data.enabled) continue; // added Jul 3, 25 - condition validate on execution
32444
32446
 
32445
32447
  func.events.add_to_queue(SESSION_ID, 'element event', val2.id, evt.type, val2.data.action, val2.data.name, null, $elm.attr('xu-ui-id'), null, evt, null, null, null, paramsP.dsSessionP, null, null, null, evt.type, val2.data.name, null, null, val2, null, null, null, null, null, null);
32446
32448
  }