bx-rest 0.26.1 → 1.1.0
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/CHANGELOG.md +32 -0
- package/README.en.md +52 -4
- package/README.md +71 -14
- package/esm2022/functions/lowerCaseOrder.mjs +23 -0
- package/esm2022/request-navvy/crm/company.mjs +8 -2
- package/esm2022/request-navvy/crm/contact.mjs +8 -2
- package/esm2022/request-navvy/crm/deal.mjs +8 -2
- package/esm2022/request-navvy/crm/lead.mjs +8 -2
- package/esm2022/services/http/HttpBX.mjs +63 -30
- package/esm2022/services/http/sessionKey.mjs +21 -2
- package/esm2022/settings.mjs +15 -3
- package/esm2022/typification/rest/batch/batchRequestParam.mjs +1 -1
- package/esm2022/typification/rest/crm/company/list.mjs +1 -1
- package/esm2022/typification/rest/crm/contact/list.mjs +1 -1
- package/esm2022/typification/rest/crm/deal/list.mjs +1 -1
- package/esm2022/typification/rest/crm/lead/list.mjs +1 -1
- package/esm2022/typification/rest/support/param.mjs +1 -1
- package/esm2022/typification/rest/task/access/getaccess.mjs +1 -1
- package/esm2022/typification/rest/task/commentitem/commentitem.mjs +1 -1
- package/esm2022/typification/rest/tasks/task.mjs +1 -1
- package/esm2022/typification/settings.mjs +1 -1
- package/fesm2022/bx-rest.mjs +143 -36
- package/fesm2022/bx-rest.mjs.map +1 -1
- package/functions/lowerCaseOrder.d.ts +15 -0
- package/map/tasks/task.d.ts +1 -3
- package/package.json +2 -1
- package/request-navvy/crm/company.d.ts +6 -1
- package/request-navvy/crm/contact.d.ts +6 -1
- package/request-navvy/crm/deal.d.ts +6 -1
- package/request-navvy/crm/lead.d.ts +6 -1
- package/services/http/HttpBX.d.ts +2 -1
- package/services/http/sessionKey.d.ts +7 -1
- package/settings.d.ts +7 -0
- package/typification/rest/batch/batchRequestParam.d.ts +3 -9
- package/typification/rest/crm/company/list.d.ts +2 -1
- package/typification/rest/crm/contact/list.d.ts +2 -1
- package/typification/rest/crm/deal/list.d.ts +2 -1
- package/typification/rest/crm/lead/list.d.ts +2 -1
- package/typification/rest/support/param.d.ts +0 -2
- package/typification/rest/task/access/getaccess.d.ts +1 -3
- package/typification/rest/task/commentitem/commentitem.d.ts +1 -3
- package/typification/rest/tasks/task.d.ts +5 -9
- package/typification/settings.d.ts +9 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { iBXRestParamSort } from '../typification/rest/base/sort';
|
|
2
|
+
/**
|
|
3
|
+
* crm.deal.list, crm.lead.list, crm.contact.list и crm.company.list — в
|
|
4
|
+
* отличие от остального REST API Bitrix24 — принимают значения `order` в
|
|
5
|
+
* нижнем регистре (`'asc'`/`'desc'`), а не в верхнем (`'ASC'`/`'DESC'`, как
|
|
6
|
+
* везде остальном, см. {@link iBXRestParamSort}). Публичный тип этих
|
|
7
|
+
* четырёх методов унифицирован на `iBXRestParamSort` ради единообразия
|
|
8
|
+
* во всей библиотеке — эта функция перед отправкой запроса приводит
|
|
9
|
+
* значения обратно к регистру, которого реально ожидает конкретно этот
|
|
10
|
+
* метод, так что на бэкенд уходит то же самое, что уходило бы и без
|
|
11
|
+
* унификации типов.
|
|
12
|
+
*
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export declare function lowerCaseOrder(order: Record<string, iBXRestParamSort> | undefined): Record<string, 'asc' | 'desc'> | undefined;
|
package/map/tasks/task.d.ts
CHANGED
|
@@ -6,9 +6,7 @@ import { iBXRestHttpTask, iBXRestTask } from '../../typification/rest/tasks/task
|
|
|
6
6
|
import { iBXRestTaskFieldsName } from '../../typification/rest/tasks/base/fields-name';
|
|
7
7
|
export declare class BXRestMapTasksTask {
|
|
8
8
|
readonly result: typeof BXRestMapTasksTaskResult;
|
|
9
|
-
static getAccess(v: iBXRestTaskGetAccess | undefined):
|
|
10
|
-
[key: number]: import("../../typification/rest/task/access/getaccess").iBXRestTaskGetAccessItem;
|
|
11
|
-
} | undefined;
|
|
9
|
+
static getAccess(v: iBXRestTaskGetAccess | undefined): Record<number, import("../../typification/rest/task/access/getaccess").iBXRestTaskGetAccessItem> | undefined;
|
|
12
10
|
static add(item: {
|
|
13
11
|
task: iBXRestTasksTaskGetHttpDefault;
|
|
14
12
|
} | undefined): iBXRestTask | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bx-rest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Bitrix24 REST API client and TypeScript SDK for Angular, Vue and browser apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitrix",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"README.md",
|
|
49
49
|
"README.en.md",
|
|
50
50
|
"LICENSE",
|
|
51
|
+
"CHANGELOG.md",
|
|
51
52
|
"*.d.ts",
|
|
52
53
|
"consts",
|
|
53
54
|
"esm2022",
|
|
@@ -56,7 +56,12 @@ export declare class BXRestNavvyCrmCompany {
|
|
|
56
56
|
* Возвращает список компаний
|
|
57
57
|
* @param param
|
|
58
58
|
*/
|
|
59
|
-
list(param: iBXRestParamCrmCompanyList): import("../../services/navvy").NavvyPag<import("../../typification/rest/crm").iBXRestCrmCompanyHttp, import("../../typification/rest/crm").iBXRestCrmCompany,
|
|
59
|
+
list(param: iBXRestParamCrmCompanyList): import("../../services/navvy").NavvyPag<import("../../typification/rest/crm").iBXRestCrmCompanyHttp, import("../../typification/rest/crm").iBXRestCrmCompany, {
|
|
60
|
+
order: Record<string, "asc" | "desc"> | undefined;
|
|
61
|
+
filter?: Record<string, any>;
|
|
62
|
+
select?: string[];
|
|
63
|
+
start?: number;
|
|
64
|
+
}>;
|
|
60
65
|
/**
|
|
61
66
|
* Обновляет существующую компанию
|
|
62
67
|
* @param param
|
|
@@ -56,7 +56,12 @@ export declare class BXRestNavvyCrmContact {
|
|
|
56
56
|
* Возвращает список контактов
|
|
57
57
|
* @param param
|
|
58
58
|
*/
|
|
59
|
-
list(param: iBXRestParamCrmContactList): import("../../services/navvy").NavvyPag<import("../../typification/rest/crm").iBXRestCrmContactHttp, import("../../typification/rest/crm").iBXRestCrmContact,
|
|
59
|
+
list(param: iBXRestParamCrmContactList): import("../../services/navvy").NavvyPag<import("../../typification/rest/crm").iBXRestCrmContactHttp, import("../../typification/rest/crm").iBXRestCrmContact, {
|
|
60
|
+
order: Record<string, "asc" | "desc"> | undefined;
|
|
61
|
+
filter?: Record<string, any>;
|
|
62
|
+
select?: string[];
|
|
63
|
+
start?: number;
|
|
64
|
+
}>;
|
|
60
65
|
/**
|
|
61
66
|
* Обновляет существующий контакт
|
|
62
67
|
* @param param
|
|
@@ -66,7 +66,12 @@ export declare class BXRestNavvyCrmDeal {
|
|
|
66
66
|
* Возвращает список сделок
|
|
67
67
|
* @param param
|
|
68
68
|
*/
|
|
69
|
-
list(param: iBXRestParamCrmDealList): import("../../services/navvy").NavvyPag<import("../../typification/rest/crm").iBXRestCrmDealHttp, import("../../typification/rest/crm").iBXRestCrmDeal,
|
|
69
|
+
list(param: iBXRestParamCrmDealList): import("../../services/navvy").NavvyPag<import("../../typification/rest/crm").iBXRestCrmDealHttp, import("../../typification/rest/crm").iBXRestCrmDeal, {
|
|
70
|
+
order: Record<string, "asc" | "desc"> | undefined;
|
|
71
|
+
filter?: Record<string, any>;
|
|
72
|
+
select?: string[];
|
|
73
|
+
start?: number;
|
|
74
|
+
}>;
|
|
70
75
|
/**
|
|
71
76
|
* Обновляет существующую сделку
|
|
72
77
|
* @param param
|
|
@@ -61,7 +61,12 @@ export declare class BXRestNavvyCrmLead {
|
|
|
61
61
|
* Возвращает список лидов
|
|
62
62
|
* @param param
|
|
63
63
|
*/
|
|
64
|
-
list(param: iBXRestParamCrmLeadList): import("../../services/navvy").NavvyPag<import("../../typification/rest/crm").iBXRestCrmLeadHttp, import("../../typification/rest/crm").iBXRestCrmLead,
|
|
64
|
+
list(param: iBXRestParamCrmLeadList): import("../../services/navvy").NavvyPag<import("../../typification/rest/crm").iBXRestCrmLeadHttp, import("../../typification/rest/crm").iBXRestCrmLead, {
|
|
65
|
+
order: Record<string, "asc" | "desc"> | undefined;
|
|
66
|
+
filter?: Record<string, any>;
|
|
67
|
+
select?: string[];
|
|
68
|
+
start?: number;
|
|
69
|
+
}>;
|
|
65
70
|
/**
|
|
66
71
|
* Обновляет существующий лид
|
|
67
72
|
* @param param
|
|
@@ -4,7 +4,7 @@ import { iBatchRequestAnswer, iBatchRequestParam, iBatchRequestParamArr, iBatchR
|
|
|
4
4
|
import { iBXRestAnswer } from '../../typification/rest/base/answer';
|
|
5
5
|
export declare class HttpBXServices extends HttpServices {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Не считайте этот метод образцом/финальным API.
|
|
8
8
|
* TODO: Удалить данный метод после реализации его в разделе Navvy
|
|
9
9
|
* @param param
|
|
10
10
|
*/
|
|
@@ -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
|
+
httpGet<T>(url: string, params?: any): Observable<T | undefined>;
|
|
30
31
|
serializeBitrixParams(params: unknown): string;
|
|
31
32
|
getNameMethod(arr: string[]): string;
|
|
32
33
|
}
|
|
@@ -10,11 +10,17 @@ export declare class SessionKeyServices {
|
|
|
10
10
|
subscribe: {
|
|
11
11
|
authData: Subscription;
|
|
12
12
|
};
|
|
13
|
-
private
|
|
13
|
+
private get BX_REST_SETTINGS();
|
|
14
14
|
constructor();
|
|
15
15
|
subscribeAll(): void;
|
|
16
16
|
getAuth(): string;
|
|
17
17
|
getKeyAuth(): IKeyAuth;
|
|
18
|
+
/**
|
|
19
|
+
* Стоит ли прикладывать браузерные cookie к запросу (axios `withCredentials`).
|
|
20
|
+
* Явный `BXRestSettings.withCredentials` имеет приоритет; если не задан —
|
|
21
|
+
* сохраняется историческое поведение: включаем только для `auth.key === 'OAuth2'`.
|
|
22
|
+
*/
|
|
23
|
+
getWithCredentials(): boolean;
|
|
18
24
|
getSessid(): string;
|
|
19
25
|
getAuthParams(): string | undefined;
|
|
20
26
|
getCheckAuthParamsIsOn(): boolean;
|
package/settings.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { iBXRestSettings } from './typification/settings';
|
|
2
2
|
export declare const DEFAULT_BX_REST_SETTINGS: iBXRestSettings;
|
|
3
3
|
export declare const BXRestSettings: {
|
|
4
|
+
value: iBXRestSettings;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Переименовано в `BXRestSettings.value` — имя `date` не
|
|
7
|
+
* отражало содержимое (настройки auth/urls, а не дату) и сбивало с толку
|
|
8
|
+
* в публичном API. Геттер/сеттер оставлен только для обратной совместимости
|
|
9
|
+
* с кодом, написанным против API до 1.0.
|
|
10
|
+
*/
|
|
4
11
|
date: iBXRestSettings;
|
|
5
12
|
update(newSettings: Partial<iBXRestSettings>): void;
|
|
6
13
|
};
|
|
@@ -4,12 +4,6 @@ export interface iBatchRequestParam<T> {
|
|
|
4
4
|
name: string;
|
|
5
5
|
param: T;
|
|
6
6
|
}
|
|
7
|
-
export type iBatchRequestParamHttp =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export type iBatchRequestParamArr<T> = {
|
|
11
|
-
[key: keyBatch]: iBatchRequestParam<T>;
|
|
12
|
-
};
|
|
13
|
-
export type iBatchRequestAnswer<T> = iBXRestAnswer<iBXRestAnswer<{
|
|
14
|
-
[key: keyBatch]: T;
|
|
15
|
-
}>>;
|
|
7
|
+
export type iBatchRequestParamHttp = Record<keyBatch, string>;
|
|
8
|
+
export type iBatchRequestParamArr<T> = Record<keyBatch, iBatchRequestParam<T>>;
|
|
9
|
+
export type iBatchRequestAnswer<T> = iBXRestAnswer<iBXRestAnswer<Record<keyBatch, T>>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { iBXRestPagination } from '../../base/api-pagination-bx';
|
|
2
|
+
import { iBXRestParamSort } from '../../base/sort';
|
|
2
3
|
export interface iBXRestParamCrmCompanyList extends iBXRestPagination {
|
|
3
|
-
order?: Record<string,
|
|
4
|
+
order?: Record<string, iBXRestParamSort>;
|
|
4
5
|
filter?: Record<string, any>;
|
|
5
6
|
select?: string[];
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { iBXRestPagination } from '../../base/api-pagination-bx';
|
|
2
|
+
import { iBXRestParamSort } from '../../base/sort';
|
|
2
3
|
export interface iBXRestParamCrmContactList extends iBXRestPagination {
|
|
3
|
-
order?: Record<string,
|
|
4
|
+
order?: Record<string, iBXRestParamSort>;
|
|
4
5
|
filter?: Record<string, any>;
|
|
5
6
|
select?: string[];
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { iBXRestPagination } from '../../base/api-pagination-bx';
|
|
2
|
+
import { iBXRestParamSort } from '../../base/sort';
|
|
2
3
|
export interface iBXRestParamCrmDealList extends iBXRestPagination {
|
|
3
|
-
order?: Record<string,
|
|
4
|
+
order?: Record<string, iBXRestParamSort>;
|
|
4
5
|
filter?: Record<string, any>;
|
|
5
6
|
select?: string[];
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { iBXRestPagination } from '../../base/api-pagination-bx';
|
|
2
|
+
import { iBXRestParamSort } from '../../base/sort';
|
|
2
3
|
export interface iBXRestParamCrmLeadList extends iBXRestPagination {
|
|
3
|
-
order?: Record<string,
|
|
4
|
+
order?: Record<string, iBXRestParamSort>;
|
|
4
5
|
filter?: Record<string, any>;
|
|
5
6
|
select?: string[];
|
|
6
7
|
}
|
|
@@ -6,9 +6,7 @@ export interface iBXRestParamTaskGetAccess {
|
|
|
6
6
|
users?: number[];
|
|
7
7
|
}
|
|
8
8
|
export interface iBXRestTaskGetAccess {
|
|
9
|
-
allowedActions:
|
|
10
|
-
[key: number]: iBXRestTaskGetAccessItem;
|
|
11
|
-
};
|
|
9
|
+
allowedActions: Record<number, iBXRestTaskGetAccessItem>;
|
|
12
10
|
}
|
|
13
11
|
export interface iBXRestTaskGetAccessItem {
|
|
14
12
|
ACCEPT: boolean;
|
|
@@ -5,9 +5,7 @@ export interface iBXRestTaskComment extends iBXRestTaskCommentBase {
|
|
|
5
5
|
POST_DATE: Date;
|
|
6
6
|
}
|
|
7
7
|
export interface iBXRestTaskCommentHtml extends iBXRestTaskCommentBase {
|
|
8
|
-
ATTACHED_OBJECTS?:
|
|
9
|
-
[key: number]: iCommentTaskFileHtml;
|
|
10
|
-
};
|
|
8
|
+
ATTACHED_OBJECTS?: Record<number, iCommentTaskFileHtml>;
|
|
11
9
|
AUTHOR_ID: string;
|
|
12
10
|
ID: string;
|
|
13
11
|
POST_DATE: string;
|
|
@@ -68,9 +68,7 @@ export interface iBXRestHttpTask extends iBXRestBaseTask {
|
|
|
68
68
|
additionalData: any[];
|
|
69
69
|
creator: iBXRestHttpTaskPeople;
|
|
70
70
|
responsible: iBXRestHttpTaskPeople;
|
|
71
|
-
accomplicesData:
|
|
72
|
-
[key: number]: iBXRestHttpTaskPeople;
|
|
73
|
-
};
|
|
71
|
+
accomplicesData: Record<number, iBXRestHttpTaskPeople>;
|
|
74
72
|
allowTimeTracking: iBXRestYesNo;
|
|
75
73
|
tags: iBXRestTaskHttpTag;
|
|
76
74
|
}
|
|
@@ -78,12 +76,10 @@ export interface iBXRestTaskTag {
|
|
|
78
76
|
id: number;
|
|
79
77
|
title: string;
|
|
80
78
|
}
|
|
81
|
-
export
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
}
|
|
79
|
+
export type iBXRestTaskHttpTag = Record<string, {
|
|
80
|
+
id: string;
|
|
81
|
+
title: string;
|
|
82
|
+
}>;
|
|
87
83
|
export interface iBXRestHttpTaskGroupHttp {
|
|
88
84
|
id: string;
|
|
89
85
|
name: string;
|
|
@@ -8,4 +8,13 @@ export interface iBXRestSettings {
|
|
|
8
8
|
key: string | 'OAuth2';
|
|
9
9
|
additional_part?: string;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Управляет axios-опцией `withCredentials` (прикладывать ли браузерные
|
|
13
|
+
* cookie к запросу) независимо от `auth.key`. Если не задано — сохраняется
|
|
14
|
+
* прежнее поведение: `withCredentials` включается только при
|
|
15
|
+
* `auth.key === 'OAuth2'`. Явное значение здесь имеет приоритет — нужно,
|
|
16
|
+
* например, когда `auth.source: 'off'` указывает на собственный прокси,
|
|
17
|
+
* а браузер должен приложить cookie сессии этого прокси (не Bitrix24).
|
|
18
|
+
*/
|
|
19
|
+
withCredentials?: boolean;
|
|
11
20
|
}
|