@xuda.io/xuda-worker-bundle-min 1.3.420 → 1.3.422
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 +5 -77
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -266,79 +266,6 @@ func.common.db = async function (
|
|
|
266
266
|
|
|
267
267
|
data.req_id = new Date().valueOf();
|
|
268
268
|
|
|
269
|
-
// const perform_rpi_request = async function (serviceP) {
|
|
270
|
-
// var url = func.common.get_url(SESSION_ID, "rpi", "");
|
|
271
|
-
|
|
272
|
-
// if (
|
|
273
|
-
// APP_OBJ[app_id].is_deployment &&
|
|
274
|
-
// _session.rpi_http_methods?.includes(serviceP)
|
|
275
|
-
// ) {
|
|
276
|
-
// url = "https://" + _session.host + "/rpi/";
|
|
277
|
-
// }
|
|
278
|
-
|
|
279
|
-
// url += serviceP;
|
|
280
|
-
|
|
281
|
-
// try {
|
|
282
|
-
// const response = await fetch(url, {
|
|
283
|
-
// method: opt.type ? opt.type : "POST",
|
|
284
|
-
// headers: {
|
|
285
|
-
// Accept: "application/json",
|
|
286
|
-
// "Content-Type": "application/json",
|
|
287
|
-
// },
|
|
288
|
-
// body: JSON.stringify(data),
|
|
289
|
-
// });
|
|
290
|
-
// if (!response.ok) throw "";
|
|
291
|
-
// const json = await response.json();
|
|
292
|
-
// return json.data;
|
|
293
|
-
// } catch (err) {
|
|
294
|
-
// console.error(err);
|
|
295
|
-
// }
|
|
296
|
-
// };
|
|
297
|
-
|
|
298
|
-
// const perform_rpi_request_from_studio = async function (serviceP) {
|
|
299
|
-
// return new Promise(function (resolve, reject) {
|
|
300
|
-
// var _session = SESSION_OBJ[SESSION_ID];
|
|
301
|
-
// const req_id = crypto.randomUUID();
|
|
302
|
-
// if (glb.IS_WORKER) {
|
|
303
|
-
// func.utils.post_back_to_client(
|
|
304
|
-
// SESSION_ID,
|
|
305
|
-
// "perform_rpi_request_from_studio",
|
|
306
|
-
// _session.worker_id,
|
|
307
|
-
// { service: serviceP, data: dataP, req_id }
|
|
308
|
-
// );
|
|
309
|
-
|
|
310
|
-
// const event_handler = (event) => {
|
|
311
|
-
// resolve(event.detail.data);
|
|
312
|
-
// self.removeEventListener(
|
|
313
|
-
// "rpi_request_response_worker_" + req_id,
|
|
314
|
-
// event_handler
|
|
315
|
-
// );
|
|
316
|
-
// };
|
|
317
|
-
|
|
318
|
-
// self.addEventListener(
|
|
319
|
-
// "rpi_request_response_worker_" + req_id,
|
|
320
|
-
// event_handler
|
|
321
|
-
// );
|
|
322
|
-
// } else {
|
|
323
|
-
// STUDIO_PEER_CONN_SEND_METHOD({
|
|
324
|
-
// service: "perform_rpi_request",
|
|
325
|
-
// data: dataP,
|
|
326
|
-
// session_id: SESSION_ID,
|
|
327
|
-
// dbs_method: serviceP,
|
|
328
|
-
// id: STUDIO_PEER.id,
|
|
329
|
-
// source: "runtime",
|
|
330
|
-
// app_id,
|
|
331
|
-
// req_id,
|
|
332
|
-
// });
|
|
333
|
-
|
|
334
|
-
// $("body").on("rpi_request_response_" + req_id, function (e, data) {
|
|
335
|
-
// resolve(data.data);
|
|
336
|
-
// $("body").off("rpi_request_response_" + req_id);
|
|
337
|
-
// });
|
|
338
|
-
// }
|
|
339
|
-
// });
|
|
340
|
-
// };
|
|
341
|
-
|
|
342
269
|
const read_dbs_pouch = async function (db) {
|
|
343
270
|
let _data = _.cloneDeep(dataP);
|
|
344
271
|
|
|
@@ -389,7 +316,7 @@ func.common.db = async function (
|
|
|
389
316
|
data
|
|
390
317
|
);
|
|
391
318
|
}
|
|
392
|
-
return await func.db.pouch[serviceP](SESSION_ID,
|
|
319
|
+
return await func.db.pouch[serviceP](SESSION_ID, data);
|
|
393
320
|
} catch (err) {}
|
|
394
321
|
|
|
395
322
|
///////////////////////////
|
|
@@ -397,7 +324,7 @@ func.common.db = async function (
|
|
|
397
324
|
try {
|
|
398
325
|
const doc = await db.get(rep_id);
|
|
399
326
|
if (doc.stat < 3) throw "replication not ready";
|
|
400
|
-
const json = await func.db.pouch[serviceP](SESSION_ID,
|
|
327
|
+
const json = await func.db.pouch[serviceP](SESSION_ID, data);
|
|
401
328
|
|
|
402
329
|
return json;
|
|
403
330
|
} catch (err) {
|
|
@@ -433,7 +360,7 @@ func.common.db = async function (
|
|
|
433
360
|
debugger;
|
|
434
361
|
try {
|
|
435
362
|
await db.get(dataP.row_id);
|
|
436
|
-
return await func.db.pouch[serviceP](SESSION_ID,
|
|
363
|
+
return await func.db.pouch[serviceP](SESSION_ID, data);
|
|
437
364
|
} catch (err) {
|
|
438
365
|
return await func.common.perform_rpi_request(
|
|
439
366
|
SESSION_ID,
|
|
@@ -446,7 +373,7 @@ func.common.db = async function (
|
|
|
446
373
|
const create_dbs_pouch = async function (db) {
|
|
447
374
|
debugger;
|
|
448
375
|
try {
|
|
449
|
-
return await func.db.pouch[serviceP](SESSION_ID,
|
|
376
|
+
return await func.db.pouch[serviceP](SESSION_ID, data);
|
|
450
377
|
} catch (err) {
|
|
451
378
|
return await func.common.perform_rpi_request(
|
|
452
379
|
SESSION_ID,
|
|
@@ -1092,6 +1019,7 @@ func.common.perform_rpi_request = async function (
|
|
|
1092
1019
|
return json.data;
|
|
1093
1020
|
} catch (err) {
|
|
1094
1021
|
console.error(err);
|
|
1022
|
+
return {};
|
|
1095
1023
|
}
|
|
1096
1024
|
};
|
|
1097
1025
|
glb.DEBUG_INFO_OBJ = {};
|