@xuda.io/runtime-bundle 1.0.528 → 1.0.529

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.
package/js/xuda_worker.js CHANGED
@@ -1,24 +1,24 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  var show_log = false;
4
4
  var ws_worker_id = null;
5
5
  var worker_name = this.name;
6
6
 
7
- var build = worker_name.split(":")[1].split(" ")[2];
8
- var domain = worker_name.split(":")[1].split(" ")[3];
7
+ var build = worker_name.split(':')[1].split(' ')[2];
8
+ var domain = worker_name.split(':')[1].split(' ')[3];
9
9
 
10
- if (build === "undefined") {
11
- build = "";
10
+ if (build === 'undefined') {
11
+ build = '';
12
12
  }
13
13
 
14
14
  const get_url = function (domain, method, path) {
15
15
  return `https://${domain}/${method}${
16
- path ? "/" + path : ""
16
+ path ? '/' + path : ''
17
17
  // return `https://${subdomain ? subdomain + "." : ""}${domain}${path ? "/" + path : ""
18
18
  }`;
19
19
  };
20
20
 
21
- const runtime_path = get_url(domain, "dist", "runtime/");
21
+ const runtime_path = get_url(domain, 'dist', 'runtime/');
22
22
 
23
23
  const get_resource_filename = function (build, filename) {
24
24
  if (build) {
@@ -27,51 +27,37 @@ const get_resource_filename = function (build, filename) {
27
27
  return filename;
28
28
  };
29
29
 
30
- if (worker_name.includes("Debug:")) {
31
- importScripts(
32
- get_resource_filename(build, runtime_path + "js/xuda-worker-bundle.js")
33
- );
34
- importScripts(runtime_path + "node_modules/lodash/lodash.js");
35
- importScripts(runtime_path + "node_modules/json5/dist/index.js");
30
+ if (worker_name.includes('Debug:')) {
31
+ importScripts(get_resource_filename(build, runtime_path + 'js/xuda-worker-bundle.js'));
32
+ importScripts(runtime_path + 'node_modules/lodash/lodash.js');
33
+ importScripts(runtime_path + 'node_modules/json5/dist/index.js');
36
34
  } else {
37
- if (worker_name.includes("Dev:")) {
38
- let files = [
39
- "xuda_common.js",
40
- "xuda_GLB.js",
41
- "xuda_datasource.js",
42
- "xuda_utils.js",
43
- "xuda_events.js",
44
- "xuda_expression.js",
45
- ];
35
+ if (worker_name.includes('Dev:')) {
36
+ let files = ['xuda_common.js', 'xuda_GLB.js', 'xuda_datasource.js', 'xuda_utils.js', 'xuda_events.js', 'xuda_expression.js'];
46
37
  files.forEach((file) => {
47
38
  importScripts(file);
48
39
  });
49
40
 
50
- importScripts("../vendor/lodash.min.js");
51
- importScripts("../vendor/json5.min.js");
41
+ importScripts('../vendor/lodash.min.js');
42
+ importScripts('../vendor/json5.min.js');
52
43
  } else {
53
- importScripts(
54
- get_resource_filename(
55
- build,
56
- runtime_path + "js/xuda-worker-bundle.min.js"
57
- )
58
- );
59
- importScripts(runtime_path + "node_modules/lodash/lodash.js");
60
- importScripts(runtime_path + "node_modules/json5/dist/index.js");
44
+ importScripts(get_resource_filename(build, runtime_path + 'js/xuda-worker-bundle.min.js'));
45
+ importScripts(runtime_path + 'node_modules/lodash/lodash.js');
46
+ importScripts(runtime_path + 'node_modules/json5/dist/index.js');
61
47
  }
62
48
  }
63
- if (!worker_name.includes("Slim ")) {
64
- importScripts(runtime_path + "node_modules/pouchdb/dist/pouchdb.min.js");
65
- importScripts(runtime_path + "node_modules/pouchdb/dist/pouchdb.find.min.js");
49
+ if (!worker_name.includes('Slim ')) {
50
+ importScripts(runtime_path + 'node_modules/pouchdb/dist/pouchdb.min.js');
51
+ importScripts(runtime_path + 'node_modules/pouchdb/dist/pouchdb.find.min.js');
66
52
  }
67
53
 
68
54
  // importScripts(runtime_path + "node_modules/lodash/lodash.js");
69
55
 
70
56
  glb.IS_WORKER = true;
71
57
  SESSION_ID = 1000;
72
- console.log("===========================================");
73
- console.log(" Worker started..." + new Date().getTime());
74
- console.log("===========================================");
58
+ console.log('===========================================');
59
+ console.log(' Worker started...' + new Date().getTime());
60
+ console.log('===========================================');
75
61
 
76
62
  const worker_post_message = function (data) {
77
63
  if (!data.process_pid) {
@@ -89,29 +75,22 @@ const worker_post_message = function (data) {
89
75
  };
90
76
 
91
77
  self.addEventListener(
92
- "message",
78
+ 'message',
93
79
  async function (e) {
94
80
  ws_worker_id = e.data.worker_id;
95
81
  if (!ws_worker_id) debugger;
96
82
 
97
83
  const _data = JSON.parse(e.data.data);
98
84
 
99
- if (e.data.service === "init") {
85
+ if (e.data.service === 'init') {
100
86
  worker_garbage_collector(_data.session_id);
101
87
  }
102
- const ret = await eval(func.utils.ws_worker.functions[e.data.service])(
103
- _data,
104
- e.data.promise_queue_id
105
- );
106
- if (
107
- !e.data.service ||
108
- e.data.service === "init" ||
109
- e.data.service === "datasource_create"
110
- ) {
88
+ const ret = await eval(func.utils.ws_worker.functions[e.data.service])(_data, e.data.promise_queue_id);
89
+ if (!e.data.service || e.data.service === 'init' || e.data.service === 'datasource_create') {
111
90
  return;
112
91
  }
113
92
  worker_post_message({
114
- fx_to_execute: "worker_response",
93
+ fx_to_execute: 'worker_response',
115
94
  worker_id: ws_worker_id,
116
95
  session_id: SESSION_ID,
117
96
  promise_queue_id: e.data.promise_queue_id,
@@ -119,22 +98,19 @@ self.addEventListener(
119
98
  params: ret,
120
99
  });
121
100
  },
122
- false
101
+ false,
123
102
  );
124
103
 
125
104
  worker_post_message({
126
105
  worker_id: ws_worker_id,
127
- service: "worker_ready",
106
+ service: 'worker_ready',
128
107
  });
129
108
 
130
109
  const worker_garbage_collector = function (SESSION_ID) {
110
+ return;
131
111
  setInterval(() => {
132
112
  for (const [dsP, _ds] of Object.entries(SESSION_OBJ[SESSION_ID].DS_GLB)) {
133
- if (
134
- _ds.is_worker &&
135
- _ds.stat === "idle" &&
136
- Date.now() - _ds.stat_ts > 60000
137
- ) {
113
+ if (_ds.is_worker && _ds.stat === 'idle' && Date.now() - _ds.stat_ts > 60000) {
138
114
  func.datasource.del(SESSION_ID, dsP);
139
115
  }
140
116
  }
@@ -1 +1 @@
1
- "use strict";var show_log=false;var ws_worker_id=null;var worker_name=this.name;var build=worker_name.split(":")[1].split(" ")[2];var domain=worker_name.split(":")[1].split(" ")[3];if(build==="undefined"){build=""}const get_url=function(domain,method,path){return`https://${domain}/${method}${path?"/"+path:""}`};const runtime_path=get_url(domain,"dist","runtime/");const get_resource_filename=function(build,filename){if(build){return filename.replace(/(\.\w+)$/,`.${build}$1`)}return filename};if(worker_name.includes("Debug:")){importScripts(get_resource_filename(build,runtime_path+"js/xuda-worker-bundle.js"));importScripts(runtime_path+"node_modules/lodash/lodash.js");importScripts(runtime_path+"node_modules/json5/dist/index.js")}else{if(worker_name.includes("Dev:")){let files=["xuda_common.js","xuda_GLB.js","xuda_datasource.js","xuda_utils.js","xuda_events.js","xuda_expression.js"];files.forEach(file=>{importScripts(file)});importScripts("../vendor/lodash.min.js");importScripts("../vendor/json5.min.js")}else{importScripts(get_resource_filename(build,runtime_path+"js/xuda-worker-bundle.min.js"));importScripts(runtime_path+"node_modules/lodash/lodash.js");importScripts(runtime_path+"node_modules/json5/dist/index.js")}}if(!worker_name.includes("Slim ")){importScripts(runtime_path+"node_modules/pouchdb/dist/pouchdb.min.js");importScripts(runtime_path+"node_modules/pouchdb/dist/pouchdb.find.min.js")}glb.IS_WORKER=true;SESSION_ID=1e3;console.log("===========================================");console.log(" Worker started..."+(new Date).getTime());console.log("===========================================");const worker_post_message=function(data){if(!data.process_pid){delete data.process_pid}if(!data.service){delete data.service}try{postMessage(data)}catch(error){debugger}};self.addEventListener("message",async function(e){ws_worker_id=e.data.worker_id;if(!ws_worker_id)debugger;const _data=JSON.parse(e.data.data);if(e.data.service==="init"){worker_garbage_collector(_data.session_id)}const ret=await eval(func.utils.ws_worker.functions[e.data.service])(_data,e.data.promise_queue_id);if(!e.data.service||e.data.service==="init"||e.data.service==="datasource_create"){return}worker_post_message({fx_to_execute:"worker_response",worker_id:ws_worker_id,session_id:SESSION_ID,promise_queue_id:e.data.promise_queue_id,service:e.data.service,params:ret})},false);worker_post_message({worker_id:ws_worker_id,service:"worker_ready"});const worker_garbage_collector=function(SESSION_ID){setInterval(()=>{for(const[dsP,_ds]of Object.entries(SESSION_OBJ[SESSION_ID].DS_GLB)){if(_ds.is_worker&&_ds.stat==="idle"&&Date.now()-_ds.stat_ts>6e4){func.datasource.del(SESSION_ID,dsP)}}},1e4)};
1
+ "use strict";var show_log=false;var ws_worker_id=null;var worker_name=this.name;var build=worker_name.split(":")[1].split(" ")[2];var domain=worker_name.split(":")[1].split(" ")[3];if(build==="undefined"){build=""}const get_url=function(domain,method,path){return`https://${domain}/${method}${path?"/"+path:""}`};const runtime_path=get_url(domain,"dist","runtime/");const get_resource_filename=function(build,filename){if(build){return filename.replace(/(\.\w+)$/,`.${build}$1`)}return filename};if(worker_name.includes("Debug:")){importScripts(get_resource_filename(build,runtime_path+"js/xuda-worker-bundle.js"));importScripts(runtime_path+"node_modules/lodash/lodash.js");importScripts(runtime_path+"node_modules/json5/dist/index.js")}else{if(worker_name.includes("Dev:")){let files=["xuda_common.js","xuda_GLB.js","xuda_datasource.js","xuda_utils.js","xuda_events.js","xuda_expression.js"];files.forEach(file=>{importScripts(file)});importScripts("../vendor/lodash.min.js");importScripts("../vendor/json5.min.js")}else{importScripts(get_resource_filename(build,runtime_path+"js/xuda-worker-bundle.min.js"));importScripts(runtime_path+"node_modules/lodash/lodash.js");importScripts(runtime_path+"node_modules/json5/dist/index.js")}}if(!worker_name.includes("Slim ")){importScripts(runtime_path+"node_modules/pouchdb/dist/pouchdb.min.js");importScripts(runtime_path+"node_modules/pouchdb/dist/pouchdb.find.min.js")}glb.IS_WORKER=true;SESSION_ID=1e3;console.log("===========================================");console.log(" Worker started..."+(new Date).getTime());console.log("===========================================");const worker_post_message=function(data){if(!data.process_pid){delete data.process_pid}if(!data.service){delete data.service}try{postMessage(data)}catch(error){debugger}};self.addEventListener("message",async function(e){ws_worker_id=e.data.worker_id;if(!ws_worker_id)debugger;const _data=JSON.parse(e.data.data);if(e.data.service==="init"){worker_garbage_collector(_data.session_id)}const ret=await eval(func.utils.ws_worker.functions[e.data.service])(_data,e.data.promise_queue_id);if(!e.data.service||e.data.service==="init"||e.data.service==="datasource_create"){return}worker_post_message({fx_to_execute:"worker_response",worker_id:ws_worker_id,session_id:SESSION_ID,promise_queue_id:e.data.promise_queue_id,service:e.data.service,params:ret})},false);worker_post_message({worker_id:ws_worker_id,service:"worker_ready"});const worker_garbage_collector=function(SESSION_ID){return;setInterval(()=>{for(const[dsP,_ds]of Object.entries(SESSION_OBJ[SESSION_ID].DS_GLB)){if(_ds.is_worker&&_ds.stat==="idle"&&Date.now()-_ds.stat_ts>6e4){func.datasource.del(SESSION_ID,dsP)}}},1e4)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/runtime-bundle",
3
- "version": "1.0.528",
3
+ "version": "1.0.529",
4
4
  "description": "The Xuda Runtime Bundle refers to a collection of scripts and libraries packaged together to provide the necessary runtime environment for executing plugins or components in the Xuda platform. ",
5
5
  "scripts": {
6
6
  "pub": "npm version patch --force && npm publish --access public"