bx-rest 0.6.7 → 0.8.1

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.
@@ -0,0 +1,10 @@
1
+ export declare function CatchError(options?: {
2
+ rethrow?: boolean;
3
+ defaultValue?: any;
4
+ }): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
5
+ export declare function formatError(info: {
6
+ message: string;
7
+ args?: any[];
8
+ error?: string;
9
+ stack?: string;
10
+ }): string;
@@ -1,6 +1,7 @@
1
- import { iBXRestImDialogRecentGet, iBXRestImDialogRecentGetHttp } from '../../typification/rest/im/dialog/recent/get';
1
+ import { iBXRestImDialogRecentGet, iBXRestImDialogRecentGetChatChatDataHttp, iBXRestImDialogRecentGetChatUserDataBase, iBXRestImDialogRecentGetHttp } from '../../typification/rest/im/dialog/recent/get';
2
2
  import { iBXRestImDialogRecentList, iBXRestImDialogRecentListHttp } from '../../typification/rest/im/dialog/recent/list';
3
3
  export declare class BXRestMapImRecent {
4
4
  static get(value: iBXRestImDialogRecentGetHttp[] | undefined): iBXRestImDialogRecentGet[] | undefined;
5
5
  static list(value: iBXRestImDialogRecentListHttp | undefined): iBXRestImDialogRecentList | undefined;
6
+ static isIBXRestImDialogRecentGetChatChatDataHttp(item: iBXRestImDialogRecentGetChatChatDataHttp | iBXRestImDialogRecentGetChatUserDataBase): item is iBXRestImDialogRecentGetChatChatDataHttp;
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bx-rest",
3
- "version": "0.6.7",
3
+ "version": "0.8.1",
4
4
  "description": "Bitrix24 REST API client angular, vue or typescript",
5
5
  "keywords": [
6
6
  "bitrix",
@@ -9,5 +9,9 @@ export declare class BXRestNavvyPullConfig {
9
9
  };
10
10
  private Navvy;
11
11
  static public: BXRestMapPullChannelPublic;
12
+ /**
13
+ * @experimental
14
+ * Этот метод находится в процессе тестирования и может измениться.
15
+ */
12
16
  get(): import("../../services/navvy/navvy-simple").NavvySimple<iBXRestPullConfigGetHttp, iBXRestPullConfigGet, undefined>;
13
17
  }
@@ -1,13 +1,65 @@
1
1
  import { DateTimeOptions } from 'luxon/src/datetime';
2
+ /**
3
+ * Преобразует значение в строку
4
+ *
5
+ * @param val
6
+ * @param throwError
7
+ */
2
8
  export declare function toStr(val: any, throwError?: boolean): string;
9
+ /**
10
+ * Преобразует значение в число
11
+ */
3
12
  export declare function toNum(val: any, throwError?: boolean, defValue?: number): number;
13
+ /**
14
+ * Кастомный тип ошибки для числовых преобразований
15
+ */
16
+ export declare class ToNumError extends Error {
17
+ readonly value: any;
18
+ constructor(value: any);
19
+ toString(): string;
20
+ }
21
+ /**
22
+ * Преобразует значение в дату
23
+ */
4
24
  export declare function toDate(val: number | string | Date, format?: string, opt?: DateTimeOptions, throwError?: boolean): Date;
25
+ /**
26
+ * Преобразует дату в строку с учетом временной зоны
27
+ *
28
+ * @param date
29
+ * @param throwError
30
+ */
5
31
  export declare function toISOStringWithTimezone(date: Date, throwError?: boolean): string;
32
+ /**
33
+ * Преобразует значение в булево значение
34
+ *
35
+ * @param val
36
+ * @param throwError
37
+ */
6
38
  export declare function toBool(val: any, throwError?: boolean): boolean;
39
+ /**
40
+ * Преобразует булево значение в 'Y' или 'N'
41
+ *
42
+ * @param val
43
+ */
7
44
  export declare function toBXYorN(val: boolean): string;
8
45
  export declare function getBaseUrlHttps(url: string, component?: boolean): string;
46
+ /**
47
+ * Обрезает URL (удаляет протокол)
48
+ *
49
+ * @param url
50
+ */
9
51
  export declare function cropUrl(url: string): string;
52
+ /**
53
+ * Преобразует файл в base64
54
+ *
55
+ * @param file
56
+ */
10
57
  export declare function getBase64File(file: File): Promise<string>;
58
+ /**
59
+ * Получить файл в формате base64 с разбивкой на заголовок и данные
60
+ *
61
+ * @param file
62
+ */
11
63
  export declare function getBase64FileLikeStr(file: File): Promise<{
12
64
  header: string;
13
65
  val: string;
@@ -27,6 +27,7 @@ export declare class HttpBXServices extends HttpServices {
27
27
  */
28
28
  get<T>(name: string[], params?: any): Observable<iBXRestAnswer<T> | undefined>;
29
29
  httpPost<T>(url: string, params?: any): Observable<T | undefined>;
30
+ serializeBitrixParams(obj: any, prefix?: string): string;
30
31
  httpGet<T>(url: string, params?: any): Observable<T | undefined>;
31
32
  getNameMethod(arr: string[]): string;
32
33
  }
@@ -92,19 +92,24 @@ export interface iBXRestImDialogRecentGetUserDataBase {
92
92
  /** Дата, когда пользователь отошел от компьютера, или false */
93
93
  idle: string | false;
94
94
  }
95
- export interface iBXRestImDialogRecentGetChatData extends iBXRestImDialogRecentGetChatDataBase {
95
+ export interface iBXRestImDialogRecentGetChatChatData extends iBXRestImDialogRecentGetChatChatDataBase {
96
96
  /** Идентификатор чата */
97
97
  id: number;
98
98
  /** Дата создания чата */
99
99
  date_create: Date;
100
100
  }
101
- export interface iBXRestImDialogRecentGetChatDataHttp extends iBXRestImDialogRecentGetChatDataBase {
101
+ export interface iBXRestImDialogRecentGetChatChatDataHttp extends iBXRestImDialogRecentGetChatChatDataBase {
102
102
  /** Идентификатор чата */
103
103
  id: string;
104
104
  /** Дата создания чата */
105
105
  date_create: string;
106
106
  }
107
- export interface iBXRestImDialogRecentGetChatDataBase {
107
+ export type iBXRestImDialogRecentGetChatDataBase = iBXRestImDialogRecentGetChatChatDataBase | iBXRestImDialogRecentGetChatUserDataBase;
108
+ export interface iBXRestImDialogRecentGetChatChatDataBase {
109
+ background_id: null;
110
+ text_field_enabled: true;
111
+ }
112
+ export interface iBXRestImDialogRecentGetChatUserDataBase {
108
113
  /** Название чата */
109
114
  title: string;
110
115
  /** Идентификатор владельца чата */
@@ -136,21 +141,20 @@ export interface iBXRestImDialogRecentGet extends iBXRestImDialogRecentGetBase {
136
141
  /** Объект пользователя, если type === 'user' */
137
142
  user?: iBXRestImDialogRecentGetUserData;
138
143
  /** Объект чата, если type === 'chat' */
139
- chat?: iBXRestImDialogRecentGetChatData;
144
+ chat?: iBXRestImDialogRecentGetChatChatData | iBXRestImDialogRecentGetChatUserDataBase;
140
145
  }
141
146
  export interface iBXRestImDialogRecentGetHttp extends iBXRestImDialogRecentGetBase {
142
147
  /** Дата последнего сообщения */
143
148
  date_update: string;
144
149
  /**
145
150
  * Объект пользователя, если type === 'user'
146
- * Посмотреть бы в глаза тому человеку что эту хуету сделала, ну тип {id: 0} это ахуй
147
- *
151
+ * Посмотреть бы в глаза тому человеку, что эту хуету сделала, ну тип {id: 0} это ахуй
148
152
  */
149
153
  user?: iBXRestImDialogRecentGetUserDataHttp | {
150
154
  id: 0;
151
155
  };
152
156
  /** Объект чата, если type === 'chat' */
153
- chat?: iBXRestImDialogRecentGetChatDataHttp;
157
+ chat?: iBXRestImDialogRecentGetChatChatDataHttp | iBXRestImDialogRecentGetChatUserDataBase;
154
158
  }
155
159
  export interface iBXRestImDialogRecentGetBase {
156
160
  /** Идентификатор записи: число для пользователя, строка "chatXXX" для чата */
@@ -1,11 +1,11 @@
1
1
  export interface iBXRestSettings {
2
2
  auth: {
3
- source: 'cookies' | 'localStorage' | 'off';
3
+ source: 'cookies' | 'localStorage' | 'off' | (() => string);
4
4
  key: 'auth' | 'sessid' | string;
5
5
  };
6
6
  urls: {
7
7
  source: 'string' | 'localStorage';
8
- key: string;
8
+ key: string | 'OAuth2';
9
9
  additional_part?: string;
10
10
  };
11
11
  }