@xuda.io/xuda-worker-bundle-min 1.3.419 → 1.3.421

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 (2) hide show
  1. package/index.js +27 -84
  2. 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
 
@@ -385,10 +312,11 @@ func.common.db = async function (
385
312
  return await func.common.perform_rpi_request(
386
313
  SESSION_ID,
387
314
  serviceP,
388
- opt
315
+ opt,
316
+ data
389
317
  );
390
318
  }
391
- return await func.db.pouch[serviceP](SESSION_ID, dataP);
319
+ return await func.db.pouch[serviceP](SESSION_ID, data);
392
320
  } catch (err) {}
393
321
 
394
322
  ///////////////////////////
@@ -396,14 +324,15 @@ func.common.db = async function (
396
324
  try {
397
325
  const doc = await db.get(rep_id);
398
326
  if (doc.stat < 3) throw "replication not ready";
399
- const json = await func.db.pouch[serviceP](SESSION_ID, dataP);
327
+ const json = await func.db.pouch[serviceP](SESSION_ID, data);
400
328
 
401
329
  return json;
402
330
  } catch (err) {
403
331
  const json = await func.common.perform_rpi_request(
404
332
  SESSION_ID,
405
333
  serviceP,
406
- opt
334
+ opt,
335
+ data
407
336
  );
408
337
  if (json.opt) {
409
338
  try {
@@ -431,17 +360,27 @@ func.common.db = async function (
431
360
  debugger;
432
361
  try {
433
362
  await db.get(dataP.row_id);
434
- return await func.db.pouch[serviceP](SESSION_ID, dataP);
363
+ return await func.db.pouch[serviceP](SESSION_ID, data);
435
364
  } catch (err) {
436
- return await func.common.perform_rpi_request(SESSION_ID, serviceP, opt);
365
+ return await func.common.perform_rpi_request(
366
+ SESSION_ID,
367
+ serviceP,
368
+ opt,
369
+ data
370
+ );
437
371
  }
438
372
  };
439
373
  const create_dbs_pouch = async function (db) {
440
374
  debugger;
441
375
  try {
442
- return await func.db.pouch[serviceP](SESSION_ID, dataP);
376
+ return await func.db.pouch[serviceP](SESSION_ID, data);
443
377
  } catch (err) {
444
- return await func.common.perform_rpi_request(SESSION_ID, serviceP, opt);
378
+ return await func.common.perform_rpi_request(
379
+ SESSION_ID,
380
+ serviceP,
381
+ opt,
382
+ data
383
+ );
445
384
  }
446
385
  };
447
386
 
@@ -495,7 +434,8 @@ func.common.db = async function (
495
434
  const json = await func.common.perform_rpi_request(
496
435
  SESSION_ID,
497
436
  serviceP,
498
- opt
437
+ opt,
438
+ data
499
439
  );
500
440
  return success_callback(json, true);
501
441
  } catch (err) {
@@ -508,7 +448,8 @@ func.common.db = async function (
508
448
  const json = await func.common.perform_rpi_request(
509
449
  SESSION_ID,
510
450
  serviceP,
511
- opt
451
+ opt,
452
+ data
512
453
  );
513
454
  return success_callback(json, true);
514
455
  } catch (err) {
@@ -1048,7 +989,8 @@ func.api.call_api_program = async function (prog_id, params) {
1048
989
  func.common.perform_rpi_request = async function (
1049
990
  SESSION_ID,
1050
991
  serviceP,
1051
- opt = {}
992
+ opt = {},
993
+ data
1052
994
  ) {
1053
995
  var url = func.common.get_url(SESSION_ID, "rpi", "");
1054
996
  var _session = SESSION_OBJ[SESSION_ID];
@@ -1077,6 +1019,7 @@ func.common.perform_rpi_request = async function (
1077
1019
  return json.data;
1078
1020
  } catch (err) {
1079
1021
  console.error(err);
1022
+ return {};
1080
1023
  }
1081
1024
  };
1082
1025
  glb.DEBUG_INFO_OBJ = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.419",
3
+ "version": "1.3.421",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {