@xuda.io/xuda-worker-bundle-min 1.3.653 → 1.3.655
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/index.js +55 -45
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -188,7 +188,7 @@ func.common.get_custom_icon = async function (
|
|
|
188
188
|
if (get_image_onlyP) {
|
|
189
189
|
return tree_ret2.rPTH;
|
|
190
190
|
} else {
|
|
191
|
-
const app_obj = APP_OBJ[SESSION_OBJ[SESSION_ID].
|
|
191
|
+
const app_obj = APP_OBJ[SESSION_OBJ[SESSION_ID].app_id];
|
|
192
192
|
const url = func.common.get_url(
|
|
193
193
|
SESSION_ID,
|
|
194
194
|
"studio-drive",
|
|
@@ -217,7 +217,7 @@ func.common.db = async function (
|
|
|
217
217
|
) {
|
|
218
218
|
return new Promise(async function (resolve, reject) {
|
|
219
219
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
220
|
-
const app_id = _session.
|
|
220
|
+
const app_id = _session.app_id;
|
|
221
221
|
|
|
222
222
|
var data = {
|
|
223
223
|
app_id: app_id,
|
|
@@ -1092,7 +1092,7 @@ func.common.perform_rpi_request = async function (
|
|
|
1092
1092
|
|
|
1093
1093
|
var url = func.common.get_url(SESSION_ID, "rpi", "");
|
|
1094
1094
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
1095
|
-
const app_id = _session.
|
|
1095
|
+
const app_id = _session.app_id;
|
|
1096
1096
|
|
|
1097
1097
|
if (
|
|
1098
1098
|
APP_OBJ[app_id].is_deployment &&
|
|
@@ -1116,12 +1116,22 @@ func.common.perform_rpi_request = async function (
|
|
|
1116
1116
|
});
|
|
1117
1117
|
|
|
1118
1118
|
if (!response.ok) {
|
|
1119
|
-
throw
|
|
1119
|
+
throw response.status;
|
|
1120
1120
|
}
|
|
1121
1121
|
const json = await response.json();
|
|
1122
1122
|
return json;
|
|
1123
1123
|
} catch (err) {
|
|
1124
1124
|
console.error(err);
|
|
1125
|
+
if (err === 503) {
|
|
1126
|
+
_this.func.UI.utils.progressScreen.show(
|
|
1127
|
+
SESSION_ID,
|
|
1128
|
+
`Error code ${err}, reloading in 5 sec`
|
|
1129
|
+
);
|
|
1130
|
+
setTimeout(async () => {
|
|
1131
|
+
await func.index.delete_pouch(SESSION_ID);
|
|
1132
|
+
location.reload();
|
|
1133
|
+
}, 5000);
|
|
1134
|
+
}
|
|
1125
1135
|
return {};
|
|
1126
1136
|
}
|
|
1127
1137
|
};
|
|
@@ -1395,7 +1405,7 @@ glb.lifecycle = {
|
|
|
1395
1405
|
var params = {
|
|
1396
1406
|
SESSION_ID,
|
|
1397
1407
|
session_data: _session,
|
|
1398
|
-
app_obj: APP_OBJ[_session.
|
|
1408
|
+
app_obj: APP_OBJ[_session.app_id],
|
|
1399
1409
|
xu_api,
|
|
1400
1410
|
};
|
|
1401
1411
|
|
|
@@ -1728,19 +1738,19 @@ func.datasource.prepare = async function (
|
|
|
1728
1738
|
const build_GLOBAL_SYS_fields = function () {
|
|
1729
1739
|
if (!_ds.data_system) _ds.data_system = {};
|
|
1730
1740
|
_ds.data_system["SYS_GLOBAL_UTC"] = -new Date().getTimezoneOffset() / 60;
|
|
1731
|
-
_ds.data_system["SYS_GLOBAL_STR_APP_ID"] = APP_OBJ[_session.
|
|
1741
|
+
_ds.data_system["SYS_GLOBAL_STR_APP_ID"] = APP_OBJ[_session.app_id]._id;
|
|
1732
1742
|
_ds.data_system["SYS_GLOBAL_STR_SESSION_ID"] = SESSION_ID;
|
|
1733
1743
|
_ds.data_system["SYS_GLOBAL_STR_LOGIN_USER_ID"] = _session.USR_OBJ._id;
|
|
1734
1744
|
|
|
1735
1745
|
if (
|
|
1736
1746
|
_session.engine_mode !== "live_preview" &&
|
|
1737
|
-
PROJECT_OBJ[_session.
|
|
1747
|
+
PROJECT_OBJ[_session.app_id].info
|
|
1738
1748
|
) {
|
|
1739
1749
|
_ds.data_system["SYS_GLOBAL_OBJ_APP_INFO"] = {
|
|
1740
|
-
build: PROJECT_OBJ[_session.
|
|
1741
|
-
author: PROJECT_OBJ[_session.
|
|
1742
|
-
date: PROJECT_OBJ[_session.
|
|
1743
|
-
name: APP_OBJ[_session.
|
|
1750
|
+
build: PROJECT_OBJ[_session.app_id].info.build_id,
|
|
1751
|
+
author: PROJECT_OBJ[_session.app_id].info.author,
|
|
1752
|
+
date: PROJECT_OBJ[_session.app_id].info.build_date,
|
|
1753
|
+
name: APP_OBJ[_session.app_id].app_name,
|
|
1744
1754
|
};
|
|
1745
1755
|
}
|
|
1746
1756
|
_ds.data_system["SYS_GLOBAL_OBJ_LOGIN_USER_INFO"] = {
|
|
@@ -4850,7 +4860,7 @@ func.utils.DOCS_OBJ.get = async function (SESSION_ID, idP) {
|
|
|
4850
4860
|
if (!idP || idP === "0") return;
|
|
4851
4861
|
|
|
4852
4862
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
4853
|
-
const _app_id = _session.
|
|
4863
|
+
const _app_id = _session.app_id;
|
|
4854
4864
|
if (!DOCS_OBJ[_app_id]) {
|
|
4855
4865
|
DOCS_OBJ[_app_id] = {};
|
|
4856
4866
|
}
|
|
@@ -5372,21 +5382,21 @@ func.utils.ws_worker.functions = {
|
|
|
5372
5382
|
init: async function (data) {
|
|
5373
5383
|
var SESSION_ID = data.SESSION_ID;
|
|
5374
5384
|
|
|
5375
|
-
APP_OBJ[data.
|
|
5376
|
-
PROJECT_OBJ[data.
|
|
5385
|
+
APP_OBJ[data.app_id] = data.APP_OBJ;
|
|
5386
|
+
PROJECT_OBJ[data.app_id] = data.PROJECT_OBJ;
|
|
5377
5387
|
|
|
5378
5388
|
if (data.SESSION_INFO.engine_mode === "live_preview") {
|
|
5379
|
-
DOCS_OBJ[data.
|
|
5389
|
+
DOCS_OBJ[data.app_id] = data.DOCS_OBJ;
|
|
5380
5390
|
} else if (
|
|
5381
5391
|
typeof IS_DOCKER === "undefined" &&
|
|
5382
5392
|
typeof IS_PROCESS_SERVER === "undefined"
|
|
5383
5393
|
) {
|
|
5384
|
-
if (!DOCS_OBJ[data.
|
|
5385
|
-
DOCS_OBJ[data.
|
|
5394
|
+
if (!DOCS_OBJ[data.app_id]) {
|
|
5395
|
+
DOCS_OBJ[data.app_id] = {};
|
|
5386
5396
|
}
|
|
5387
5397
|
}
|
|
5388
5398
|
|
|
5389
|
-
glb.APP_INFO[data.
|
|
5399
|
+
glb.APP_INFO[data.app_id] = data.APP_INFO;
|
|
5390
5400
|
glb.DEBUG_MODE = data.DEBUG_MODE;
|
|
5391
5401
|
glb.DEBUG_INFO_OBJ = data.DEBUG_INFO_OBJ;
|
|
5392
5402
|
|
|
@@ -5420,7 +5430,7 @@ func.utils.ws_worker.functions = {
|
|
|
5420
5430
|
_session.WORKER_OBJ.fx = new func.utils.job_worker(SESSION_ID);
|
|
5421
5431
|
_session.WORKER_OBJ.fx.init();
|
|
5422
5432
|
|
|
5423
|
-
if (_session.
|
|
5433
|
+
if (_session.app_id === "unknown") {
|
|
5424
5434
|
worker_post_message({
|
|
5425
5435
|
fx_to_execute: "init_done",
|
|
5426
5436
|
worker_id: ws_worker_id,
|
|
@@ -5451,7 +5461,7 @@ func.utils.ws_worker.functions = {
|
|
|
5451
5461
|
if (show_log) {
|
|
5452
5462
|
console.log(
|
|
5453
5463
|
"DATASOURCE EXECUTING SESSION_ID: " + SESSION_ID,
|
|
5454
|
-
APP_OBJ[_session.
|
|
5464
|
+
APP_OBJ[_session.app_id].app_name
|
|
5455
5465
|
);
|
|
5456
5466
|
}
|
|
5457
5467
|
if (
|
|
@@ -5488,7 +5498,7 @@ func.utils.ws_worker.functions = {
|
|
|
5488
5498
|
" " +
|
|
5489
5499
|
_session.DS_GLB[ret.dsSessionP]?.tree_obj?.menuName ||
|
|
5490
5500
|
"" + " SESSION_ID: " + SESSION_ID,
|
|
5491
|
-
APP_OBJ[_session.
|
|
5501
|
+
APP_OBJ[_session.app_id].app_name
|
|
5492
5502
|
);
|
|
5493
5503
|
var obj = func.utils.clean_returned_datasource(SESSION_ID, ret.dsSessionP);
|
|
5494
5504
|
obj.dataSourceSessionGlobal = _session.dataSourceSessionGlobal;
|
|
@@ -5515,7 +5525,7 @@ func.utils.ws_worker.functions = {
|
|
|
5515
5525
|
if (show_log)
|
|
5516
5526
|
console.log(
|
|
5517
5527
|
"DATASOURCE DELETE SESSION_ID: " + SESSION_ID,
|
|
5518
|
-
APP_OBJ[_session.
|
|
5528
|
+
APP_OBJ[_session.app_id].app_name,
|
|
5519
5529
|
params.dssession
|
|
5520
5530
|
);
|
|
5521
5531
|
// debugger;
|
|
@@ -5536,14 +5546,14 @@ func.utils.ws_worker.functions = {
|
|
|
5536
5546
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
5537
5547
|
if (!_session) {
|
|
5538
5548
|
_session = {};
|
|
5539
|
-
_session.
|
|
5549
|
+
_session.app_id = params.app_id;
|
|
5540
5550
|
_session.dataSourceSessionGlobal = -1;
|
|
5541
5551
|
_session.DS_GLB = {};
|
|
5542
5552
|
}
|
|
5543
5553
|
if (show_log)
|
|
5544
5554
|
console.log(
|
|
5545
5555
|
"DATASOURCE UPDATE SESSION_ID: " + SESSION_ID,
|
|
5546
|
-
APP_OBJ[_session.
|
|
5556
|
+
APP_OBJ[_session.app_id].app_name,
|
|
5547
5557
|
params.dssession
|
|
5548
5558
|
);
|
|
5549
5559
|
|
|
@@ -5722,7 +5732,7 @@ func.utils.ws_worker.functions = {
|
|
|
5722
5732
|
if (typeof show_log !== "undefined" && show_log)
|
|
5723
5733
|
console.log(
|
|
5724
5734
|
"DATASOURCE GET GRID TOTALS SESSION_ID: " + SESSION_ID,
|
|
5725
|
-
APP_OBJ[_session.
|
|
5735
|
+
APP_OBJ[_session.app_id].app_name,
|
|
5726
5736
|
params.dssession
|
|
5727
5737
|
);
|
|
5728
5738
|
|
|
@@ -5809,7 +5819,7 @@ func.utils.ws_worker.functions = {
|
|
|
5809
5819
|
// if (show_log)
|
|
5810
5820
|
// console.log(
|
|
5811
5821
|
// "DATASOURCE GET VALUE SESSION_ID: " + SESSION_ID,
|
|
5812
|
-
// APP_OBJ[_session.
|
|
5822
|
+
// APP_OBJ[_session.app_id].app_name,
|
|
5813
5823
|
// params.dssession
|
|
5814
5824
|
// );
|
|
5815
5825
|
// const ret = await func.datasource.get_value(
|
|
@@ -5842,7 +5852,7 @@ func.utils.ws_worker.functions = {
|
|
|
5842
5852
|
params.dssession +
|
|
5843
5853
|
" SESSION_ID: " +
|
|
5844
5854
|
SESSION_ID,
|
|
5845
|
-
APP_OBJ[_session.
|
|
5855
|
+
APP_OBJ[_session.app_id].app_name
|
|
5846
5856
|
);
|
|
5847
5857
|
_session.DS_GLB[params.dssession].v.onscreen_events_active =
|
|
5848
5858
|
params.onscreen_events_active;
|
|
@@ -5857,7 +5867,7 @@ func.utils.ws_worker.functions = {
|
|
|
5857
5867
|
DS +
|
|
5858
5868
|
" SESSION_ID: " +
|
|
5859
5869
|
SESSION_ID,
|
|
5860
|
-
APP_OBJ[_session.
|
|
5870
|
+
APP_OBJ[_session.app_id].app_name
|
|
5861
5871
|
);
|
|
5862
5872
|
var obj = func.utils.clean_returned_datasource(SESSION_ID, DS);
|
|
5863
5873
|
obj.dataSourceSessionGlobal = _session.dataSourceSessionGlobal;
|
|
@@ -5887,7 +5897,7 @@ func.utils.ws_worker.functions = {
|
|
|
5887
5897
|
params.dssession +
|
|
5888
5898
|
" SESSION_ID: " +
|
|
5889
5899
|
SESSION_ID,
|
|
5890
|
-
APP_OBJ[_session.
|
|
5900
|
+
APP_OBJ[_session.app_id].app_name
|
|
5891
5901
|
);
|
|
5892
5902
|
ds.eventChangesResults_done = true;
|
|
5893
5903
|
},
|
|
@@ -5901,7 +5911,7 @@ func.utils.ws_worker.functions = {
|
|
|
5901
5911
|
params.dssession +
|
|
5902
5912
|
" SESSION_ID: " +
|
|
5903
5913
|
SESSION_ID,
|
|
5904
|
-
APP_OBJ[_session.
|
|
5914
|
+
APP_OBJ[_session.app_id].app_name
|
|
5905
5915
|
);
|
|
5906
5916
|
debugger;
|
|
5907
5917
|
var callback = func.utils.get_callback_queue(
|
|
@@ -5920,7 +5930,7 @@ func.utils.ws_worker.functions = {
|
|
|
5920
5930
|
params.dssession +
|
|
5921
5931
|
" SESSION_ID: " +
|
|
5922
5932
|
SESSION_ID,
|
|
5923
|
-
APP_OBJ[_session.
|
|
5933
|
+
APP_OBJ[_session.app_id].app_name
|
|
5924
5934
|
);
|
|
5925
5935
|
func.utils.get_callback_queue(SESSION_ID, params.callback_id)();
|
|
5926
5936
|
},
|
|
@@ -6137,7 +6147,7 @@ func.utils.get_drive_url = function (SESSION_ID, val, wrap) {
|
|
|
6137
6147
|
|
|
6138
6148
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
6139
6149
|
function replaceFiletoURL(fileString) {
|
|
6140
|
-
const _app = APP_OBJ[_session.
|
|
6150
|
+
const _app = APP_OBJ[_session.app_id];
|
|
6141
6151
|
let _domain = _session.domain;
|
|
6142
6152
|
if (_session.is_deployment) {
|
|
6143
6153
|
_domain =
|
|
@@ -6153,7 +6163,7 @@ func.utils.get_drive_url = function (SESSION_ID, val, wrap) {
|
|
|
6153
6163
|
const FILE_REPLACE_URL = `${url}${val}?token=${_session.app_token}`;
|
|
6154
6164
|
|
|
6155
6165
|
let match = `drv_${
|
|
6156
|
-
_app.app_replicate || _session.
|
|
6166
|
+
_app.app_replicate || _session.app_id
|
|
6157
6167
|
}_[0-9a-f\\-]+\\.[a-zA-Z0-9]+`;
|
|
6158
6168
|
|
|
6159
6169
|
let pat = new RegExp(match, "g");
|
|
@@ -6243,7 +6253,7 @@ func.utils.debug_report = async function (
|
|
|
6243
6253
|
typeof IS_PROCESS_SERVER !== "undefined"
|
|
6244
6254
|
) {
|
|
6245
6255
|
return __.rpi.write_log(
|
|
6246
|
-
SESSION_OBJ[SESSION_ID].
|
|
6256
|
+
SESSION_OBJ[SESSION_ID].app_id,
|
|
6247
6257
|
"error",
|
|
6248
6258
|
"worker",
|
|
6249
6259
|
"runtime",
|
|
@@ -6262,7 +6272,7 @@ func.utils.debug_report = async function (
|
|
|
6262
6272
|
id: STUDIO_WEBSOCKET_CONNECTION_ID,
|
|
6263
6273
|
uid: _session.USR_OBJ._id,
|
|
6264
6274
|
source: "runtime",
|
|
6265
|
-
app_id: _session.
|
|
6275
|
+
app_id: _session.app_id,
|
|
6266
6276
|
gtp_token: _session.gtp_token,
|
|
6267
6277
|
app_token: _session.app_token,
|
|
6268
6278
|
};
|
|
@@ -7178,7 +7188,7 @@ func.utils.get_plugin_setup = function (SESSION_ID, plugin_name) {
|
|
|
7178
7188
|
};
|
|
7179
7189
|
|
|
7180
7190
|
func.utils.connect_pouchdb = async function (SESSION_ID) {
|
|
7181
|
-
const app_id = SESSION_OBJ[SESSION_ID].
|
|
7191
|
+
const app_id = SESSION_OBJ[SESSION_ID].app_id;
|
|
7182
7192
|
return new PouchDB("xuda_rt_" + app_id);
|
|
7183
7193
|
};
|
|
7184
7194
|
|
|
@@ -7200,7 +7210,7 @@ func.utils.call_plugin_api = function (SESSION_ID, plugin_nameP, dataP) {
|
|
|
7200
7210
|
};
|
|
7201
7211
|
return new Promise(async (resolve) => {
|
|
7202
7212
|
var data = {
|
|
7203
|
-
app_id: APP_OBJ[_session.
|
|
7213
|
+
app_id: APP_OBJ[_session.app_id]._id,
|
|
7204
7214
|
debug: glb.DEBUG_MODE,
|
|
7205
7215
|
uid: _session.USR_OBJ._id,
|
|
7206
7216
|
gtp_token: _session.gtp_token,
|
|
@@ -7261,9 +7271,9 @@ func.utils.get_plugin_resource = function (
|
|
|
7261
7271
|
return `../../plugins/${plugin_name}/${resource}`;
|
|
7262
7272
|
}
|
|
7263
7273
|
if (typeof IS_PROCESS_SERVER !== "undefined") {
|
|
7264
|
-
return `${_conf.plugins_drive_path}/${_session.
|
|
7274
|
+
return `${_conf.plugins_drive_path}/${_session.app_id}/node_modules/${plugin_name}/${resource}`;
|
|
7265
7275
|
} else {
|
|
7266
|
-
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.
|
|
7276
|
+
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}`;
|
|
7267
7277
|
}
|
|
7268
7278
|
};
|
|
7269
7279
|
|
|
@@ -7333,7 +7343,7 @@ func.utils.get_plugin_npm_cdn = async function (
|
|
|
7333
7343
|
return `../../plugins/${plugin_name}/${resource}`;
|
|
7334
7344
|
}
|
|
7335
7345
|
|
|
7336
|
-
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.
|
|
7346
|
+
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?app_id=${_session.app_id}`;
|
|
7337
7347
|
};
|
|
7338
7348
|
|
|
7339
7349
|
return get_path(resource);
|
|
@@ -7353,7 +7363,7 @@ func.utils.write_log = async function (
|
|
|
7353
7363
|
typeof IS_DOCKER !== "undefined" ||
|
|
7354
7364
|
typeof IS_PROCESS_SERVER !== "undefined"
|
|
7355
7365
|
) {
|
|
7356
|
-
return __.rpi.write_log(_session.
|
|
7366
|
+
return __.rpi.write_log(_session.app_id, log_type, source, msg, details);
|
|
7357
7367
|
}
|
|
7358
7368
|
|
|
7359
7369
|
await func.common.db(SESSION_ID, "write_log", {
|
|
@@ -8832,7 +8842,7 @@ func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
|
8832
8842
|
"pendingUrlEvent_embed"
|
|
8833
8843
|
);
|
|
8834
8844
|
} else {
|
|
8835
|
-
console.error("Program not exist", params_obj.
|
|
8845
|
+
console.error("Program not exist", params_obj.prog_id);
|
|
8836
8846
|
func.UI.utils.progressScreen.show(
|
|
8837
8847
|
SESSION_ID,
|
|
8838
8848
|
"Program not exist",
|
|
@@ -9523,7 +9533,7 @@ func.expression.secure_eval = async function (
|
|
|
9523
9533
|
) {
|
|
9524
9534
|
if (SESSION_OBJ[SESSION_ID].crawler) return;
|
|
9525
9535
|
return __.rpi.write_log(
|
|
9526
|
-
SESSION_OBJ[SESSION_ID].
|
|
9536
|
+
SESSION_OBJ[SESSION_ID].app_id,
|
|
9527
9537
|
"error",
|
|
9528
9538
|
"worker",
|
|
9529
9539
|
"vm error",
|
|
@@ -9537,7 +9547,7 @@ func.expression.secure_eval = async function (
|
|
|
9537
9547
|
try {
|
|
9538
9548
|
const dir = path.join(
|
|
9539
9549
|
_conf.studio_drive_path,
|
|
9540
|
-
SESSION_OBJ[SESSION_ID].
|
|
9550
|
+
SESSION_OBJ[SESSION_ID].app_id,
|
|
9541
9551
|
"node_modules",
|
|
9542
9552
|
"/"
|
|
9543
9553
|
);
|
|
@@ -9574,7 +9584,7 @@ func.expression.secure_eval = async function (
|
|
|
9574
9584
|
|
|
9575
9585
|
if (typeof IS_PROCESS_SERVER !== "undefined") {
|
|
9576
9586
|
func.events.delete_job(SESSION_ID, jobNo);
|
|
9577
|
-
return __.db.add_error_log(SESSION_OBJ[SESSION_ID].
|
|
9587
|
+
return __.db.add_error_log(SESSION_OBJ[SESSION_ID].app_id, "api", err);
|
|
9578
9588
|
}
|
|
9579
9589
|
}
|
|
9580
9590
|
} else {
|