@andrey4emk/npm-app-back-b24 2.0.10 → 2.0.12

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/bitrix24/b24.ts CHANGED
@@ -258,16 +258,23 @@ function wrapB24WithRetry(b24: B24OAuth): B24OAuth {
258
258
 
259
259
  return new Proxy(b24, {
260
260
  get(target, prop, receiver) {
261
- const value = Reflect.get(target, prop, receiver);
262
-
263
- if (typeof prop === "string" && RETRYABLE_METHODS.has(prop) && typeof value === "function") {
264
- if (!methodCache.has(prop)) {
265
- methodCache.set(prop, withRetry(value, target, prop));
261
+ // Передаём target вместо receiver — this внутри геттеров должен указывать
262
+ // на оригинальный target, иначе приватные поля (#authOAuthManager и др.)
263
+ // недоступны через Proxy
264
+
265
+ // Для методов из RETRYABLE_METHODS — оборачиваем retry-логикой
266
+ if (typeof prop === "string" && RETRYABLE_METHODS.has(prop)) {
267
+ const value = Reflect.get(target, prop, target);
268
+ if (typeof value === "function") {
269
+ if (!methodCache.has(prop)) {
270
+ methodCache.set(prop, withRetry(value, target, prop));
271
+ }
272
+ return methodCache.get(prop);
266
273
  }
267
- return methodCache.get(prop);
268
274
  }
269
275
 
270
- return value;
276
+ // Для остальных — передаём target чтобы приватные поля работали
277
+ return Reflect.get(target, prop, target);
271
278
  },
272
279
  });
273
280
  }
package/logs/logs.ts CHANGED
@@ -85,8 +85,12 @@ class LogsAPI {
85
85
  // Получаем цвет для уровня
86
86
  const color = (confLog.get(`${levelStr}.color`) as string) || "\x1b[37m";
87
87
 
88
+ // Формируем время ЧЧ:ММ:СС.мс (2 цифры миллисекунд)
89
+ const now = new Date();
90
+ const time = `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(now.getSeconds()).padStart(2, "0")}.${String(now.getMilliseconds()).slice(0, 2).padStart(2, "0")}`;
91
+
88
92
  // Логирование с цветом в консоль
89
- console.log(`${color}${levelStr}: ${messageText}${this.resetColor}`);
93
+ console.log(`${color}${time} ${levelStr}: ${messageText}${this.resetColor}`);
90
94
 
91
95
  if (jsonData) {
92
96
  console.dir(jsonData, { depth: null, colors: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrey4emk/npm-app-back-b24",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "Bitrix24 OAuth helpers for Node.js projects",
5
5
  "main": "index.ts",
6
6
  "type": "module",