wenay-common 1.0.129 → 1.0.130

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.
@@ -41,14 +41,16 @@ function funcPromiseServer(data, obj) {
41
41
  }
42
42
  });
43
43
  }
44
- const a = await (async () => buf[nameF](...request))()
45
- .catch((e) => {
46
- data.sendMessage({ mapId: datum.mapId, error: { error: e, key: key, arguments: request } });
47
- console.error({ error: e, key: key, arguments: request });
48
- })
44
+ const trt = async () => buf[nameF](...request);
45
+ const a = await trt()
49
46
  .then(a => {
50
47
  if (datum.wait !== false)
51
48
  data.sendMessage({ mapId: datum.mapId, data: a ?? undefined });
49
+ })
50
+ .catch((e) => {
51
+ console.log(nameF, request, key);
52
+ data.sendMessage({ mapId: datum.mapId, error: { error: e, key: key, arguments: request } });
53
+ console.error({ error: e, key: key, arguments: request });
52
54
  });
53
55
  }
54
56
  else {
@@ -209,6 +211,7 @@ function funcScreenerClient2(data, wait) {
209
211
  function funcScreenerClient3(data, obj, wait) {
210
212
  const tr = (address) => new Proxy((() => { }), {
211
213
  get(target, p, receiver) {
214
+ address.push(p);
212
215
  let o = obj();
213
216
  for (let a of address) {
214
217
  o = o?.[a];
@@ -217,7 +220,6 @@ function funcScreenerClient3(data, obj, wait) {
217
220
  if (o == "null")
218
221
  return undefined;
219
222
  }
220
- address.push(p);
221
223
  return tr(address);
222
224
  },
223
225
  apply(target, thisArg, argArray) {
@@ -229,21 +231,19 @@ function funcScreenerClient3(data, obj, wait) {
229
231
  if (o == "null")
230
232
  return undefined;
231
233
  }
232
- let i = 0;
233
234
  if (address.at(-1) == "call") {
234
- i = 1;
235
235
  address.length = address.length - 1;
236
+ argArray.splice(0, 1);
236
237
  }
237
238
  const callback = [];
238
239
  const callback2 = [];
239
- for (i < argArray.length; i++;) {
240
- const el = argArray[i];
240
+ argArray.forEach((el, i) => {
241
241
  if (typeof el == "function") {
242
242
  callback.push({ func: el, poz: i });
243
243
  callback2.push(el);
244
244
  argArray[i] = "___FUNC";
245
245
  }
246
- }
246
+ });
247
247
  return data.send({ key: address, request: argArray }, wait, callback2);
248
248
  }
249
249
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wenay-common",
3
- "version": "1.0.129",
3
+ "version": "1.0.130",
4
4
  "description": "Common library",
5
5
  "strict": true,
6
6
  "main": "lib/index.js",